dist/ember.js in ember-source-2.12.2 vs dist/ember.js in ember-source-2.13.0.beta.1

- old
+ new

@@ -4,11 +4,11 @@ * @copyright Copyright 2011-2017 Tilde Inc. and contributors * Portions Copyright 2006-2011 Strobe Inc. * Portions Copyright 2008-2011 Apple Inc. All rights reserved. * @license Licensed under MIT license * See https://raw.github.com/emberjs/ember.js/master/LICENSE - * @version 2.12.2 + * @version 2.13.0-beta.1 */ var enifed, requireModule, Ember; var mainContext = this; // Used in ember-environment/lib/global.js @@ -182,10 +182,1861 @@ createClass: createClass, interopExportWildcard: interopExportWildcard, defaults: defaults }; +enifed('@glimmer/di', ['exports', '@glimmer/util'], function (exports, _glimmerUtil) { + 'use strict'; + + var Container = (function () { + function Container(registry) { + var resolver = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + this._registry = registry; + this._resolver = resolver; + this._lookups = _glimmerUtil.dict(); + this._factoryLookups = _glimmerUtil.dict(); + } + + Container.prototype.factoryFor = function factoryFor(specifier) { + var factory = this._factoryLookups[specifier]; + if (!factory) { + if (this._resolver) { + factory = this._resolver.retrieve(specifier); + } + if (!factory) { + factory = this._registry.registration(specifier); + } + if (factory) { + this._factoryLookups[specifier] = factory; + } + } + return factory; + }; + + Container.prototype.lookup = function lookup(specifier) { + var singleton = this._registry.registeredOption(specifier, 'singleton') !== false; + if (singleton && this._lookups[specifier]) { + return this._lookups[specifier]; + } + var factory = this.factoryFor(specifier); + if (!factory) { + return; + } + if (this._registry.registeredOption(specifier, 'instantiate') === false) { + return factory; + } + var injections = this.buildInjections(specifier); + var object = factory.create(injections); + if (singleton && object) { + this._lookups[specifier] = object; + } + return object; + }; + + Container.prototype.defaultInjections = function defaultInjections(specifier) { + return {}; + }; + + Container.prototype.buildInjections = function buildInjections(specifier) { + var hash = this.defaultInjections(specifier); + var injections = this._registry.registeredInjections(specifier); + var injection = undefined; + for (var i = 0; i < injections.length; i++) { + injection = injections[i]; + hash[injection.property] = this.lookup(injection.source); + } + return hash; + }; + + return Container; + })(); + + var Registry = (function () { + function Registry() { + this._registrations = _glimmerUtil.dict(); + this._registeredOptions = _glimmerUtil.dict(); + this._registeredInjections = _glimmerUtil.dict(); + } + + // TODO - use symbol + + Registry.prototype.register = function register(specifier, factory, options) { + this._registrations[specifier] = factory; + if (options) { + this._registeredOptions[specifier] = options; + } + }; + + Registry.prototype.registration = function registration(specifier) { + return this._registrations[specifier]; + }; + + Registry.prototype.unregister = function unregister(specifier) { + delete this._registrations[specifier]; + delete this._registeredOptions[specifier]; + delete this._registeredInjections[specifier]; + }; + + Registry.prototype.registerOption = function registerOption(specifier, option, value) { + var options = this._registeredOptions[specifier]; + if (!options) { + options = {}; + this._registeredOptions[specifier] = options; + } + options[option] = value; + }; + + Registry.prototype.registeredOption = function registeredOption(specifier, option) { + var options = this.registeredOptions(specifier); + if (options) { + return options[option]; + } + }; + + Registry.prototype.registeredOptions = function registeredOptions(specifier) { + var options = this._registeredOptions[specifier]; + if (options === undefined) { + var _specifier$split = specifier.split(':'); + + var type = _specifier$split[0]; + + options = this._registeredOptions[type]; + } + return options; + }; + + Registry.prototype.unregisterOption = function unregisterOption(specifier, option) { + var options = this._registeredOptions[specifier]; + if (options) { + delete options[option]; + } + }; + + Registry.prototype.registerInjection = function registerInjection(specifier, property, source) { + var injections = this._registeredInjections[specifier]; + if (injections === undefined) { + this._registeredInjections[specifier] = injections = []; + } + injections.push({ + property: property, + source: source + }); + }; + + Registry.prototype.registeredInjections = function registeredInjections(specifier) { + var _specifier$split2 = specifier.split(':'); + + var type = _specifier$split2[0]; + + var injections = []; + Array.prototype.push.apply(injections, this._registeredInjections[type]); + Array.prototype.push.apply(injections, this._registeredInjections[specifier]); + return injections; + }; + + return Registry; + })(); + + var OWNER = '__owner__'; + function getOwner(object) { + return object[OWNER]; + } + function setOwner(object, owner) { + object[OWNER] = owner; + } + + function isSpecifierStringAbsolute(specifier) { + var _specifier$split3 = specifier.split(':'); + + var type = _specifier$split3[0]; + var path = _specifier$split3[1]; + + return !!(type && path && path.indexOf('/') === 0 && path.split('/').length > 3); + } + function isSpecifierObjectAbsolute(specifier) { + return specifier.rootName !== undefined && specifier.collection !== undefined && specifier.name !== undefined && specifier.type !== undefined; + } + function serializeSpecifier(specifier) { + var type = specifier.type; + var path = serializeSpecifierPath(specifier); + if (path) { + return type + ':' + path; + } else { + return type; + } + } + function serializeSpecifierPath(specifier) { + var path = []; + if (specifier.rootName) { + path.push(specifier.rootName); + } + if (specifier.collection) { + path.push(specifier.collection); + } + if (specifier.namespace) { + path.push(specifier.namespace); + } + if (specifier.name) { + path.push(specifier.name); + } + if (path.length > 0) { + var fullPath = path.join('/'); + if (isSpecifierObjectAbsolute(specifier)) { + fullPath = '/' + fullPath; + } + return fullPath; + } + } + function deserializeSpecifier(specifier) { + var obj = {}; + if (specifier.indexOf(':') > -1) { + var _specifier$split4 = specifier.split(':'); + + var type = _specifier$split4[0]; + var path = _specifier$split4[1]; + + obj.type = type; + var pathSegments = undefined; + if (path.indexOf('/') === 0) { + pathSegments = path.substr(1).split('/'); + obj.rootName = pathSegments.shift(); + obj.collection = pathSegments.shift(); + } else { + pathSegments = path.split('/'); + } + if (pathSegments.length > 0) { + obj.name = pathSegments.pop(); + if (pathSegments.length > 0) { + obj.namespace = pathSegments.join('/'); + } + } + } else { + obj.type = specifier; + } + return obj; + } + + exports.Container = Container; + exports.Registry = Registry; + exports.getOwner = getOwner; + exports.setOwner = setOwner; + exports.OWNER = OWNER; + exports.isSpecifierStringAbsolute = isSpecifierStringAbsolute; + exports.isSpecifierObjectAbsolute = isSpecifierObjectAbsolute; + exports.serializeSpecifier = serializeSpecifier; + exports.deserializeSpecifier = deserializeSpecifier; +}); +enifed('@glimmer/node', ['exports', '@glimmer/runtime'], function (exports, _glimmerRuntime) { + 'use strict'; + + var NodeDOMTreeConstruction = (function (_DOMTreeConstruction) { + babelHelpers.inherits(NodeDOMTreeConstruction, _DOMTreeConstruction); + + function NodeDOMTreeConstruction(doc) { + _DOMTreeConstruction.call(this, doc); + } + + // override to prevent usage of `this.document` until after the constructor + + NodeDOMTreeConstruction.prototype.setupUselessElement = function setupUselessElement() {}; + + NodeDOMTreeConstruction.prototype.insertHTMLBefore = function insertHTMLBefore(parent, html, reference) { + var prev = reference ? reference.previousSibling : parent.lastChild; + var raw = this.document.createRawHTMLSection(html); + parent.insertBefore(raw, reference); + var first = prev ? prev.nextSibling : parent.firstChild; + var last = reference ? reference.previousSibling : parent.lastChild; + return new _glimmerRuntime.ConcreteBounds(parent, first, last); + }; + + // override to avoid SVG detection/work when in node (this is not needed in SSR) + + NodeDOMTreeConstruction.prototype.createElement = function createElement(tag) { + return this.document.createElement(tag); + }; + + // override to avoid namespace shenanigans when in node (this is not needed in SSR) + + NodeDOMTreeConstruction.prototype.setAttribute = function setAttribute(element, name, value) { + element.setAttribute(name, value); + }; + + return NodeDOMTreeConstruction; + })(_glimmerRuntime.DOMTreeConstruction); + + exports.NodeDOMTreeConstruction = NodeDOMTreeConstruction; +}); +enifed("@glimmer/reference", ["exports", "@glimmer/util"], function (exports, _glimmerUtil) { + "use strict"; + + var CONSTANT = 0; + var INITIAL = 1; + var VOLATILE = NaN; + + var RevisionTag = (function () { + function RevisionTag() {} + + RevisionTag.prototype.validate = function validate(snapshot) { + return this.value() === snapshot; + }; + + return RevisionTag; + })(); + + var $REVISION = INITIAL; + + var DirtyableTag = (function (_RevisionTag) { + babelHelpers.inherits(DirtyableTag, _RevisionTag); + + function DirtyableTag() { + var revision = arguments.length <= 0 || arguments[0] === undefined ? $REVISION : arguments[0]; + + _RevisionTag.call(this); + this.revision = revision; + } + + DirtyableTag.prototype.value = function value() { + return this.revision; + }; + + DirtyableTag.prototype.dirty = function dirty() { + this.revision = ++$REVISION; + }; + + return DirtyableTag; + })(RevisionTag); + + function combineTagged(tagged) { + var optimized = []; + for (var i = 0, l = tagged.length; i < l; i++) { + var tag = tagged[i].tag; + if (tag === VOLATILE_TAG) return VOLATILE_TAG; + if (tag === CONSTANT_TAG) continue; + optimized.push(tag); + } + return _combine(optimized); + } + function combineSlice(slice) { + var optimized = []; + var node = slice.head(); + while (node !== null) { + var tag = node.tag; + if (tag === VOLATILE_TAG) return VOLATILE_TAG; + if (tag !== CONSTANT_TAG) optimized.push(tag); + node = slice.nextNode(node); + } + return _combine(optimized); + } + function combine(tags) { + var optimized = []; + for (var i = 0, l = tags.length; i < l; i++) { + var tag = tags[i]; + if (tag === VOLATILE_TAG) return VOLATILE_TAG; + if (tag === CONSTANT_TAG) continue; + optimized.push(tag); + } + return _combine(optimized); + } + function _combine(tags) { + switch (tags.length) { + case 0: + return CONSTANT_TAG; + case 1: + return tags[0]; + case 2: + return new TagsPair(tags[0], tags[1]); + default: + return new TagsCombinator(tags); + } + ; + } + + var CachedTag = (function (_RevisionTag2) { + babelHelpers.inherits(CachedTag, _RevisionTag2); + + function CachedTag() { + _RevisionTag2.apply(this, arguments); + this.lastChecked = null; + this.lastValue = null; + } + + CachedTag.prototype.value = function value() { + var lastChecked = this.lastChecked; + var lastValue = this.lastValue; + + if (lastChecked !== $REVISION) { + this.lastChecked = $REVISION; + this.lastValue = lastValue = this.compute(); + } + return this.lastValue; + }; + + CachedTag.prototype.invalidate = function invalidate() { + this.lastChecked = null; + }; + + return CachedTag; + })(RevisionTag); + + var TagsPair = (function (_CachedTag) { + babelHelpers.inherits(TagsPair, _CachedTag); + + function TagsPair(first, second) { + _CachedTag.call(this); + this.first = first; + this.second = second; + } + + TagsPair.prototype.compute = function compute() { + return Math.max(this.first.value(), this.second.value()); + }; + + return TagsPair; + })(CachedTag); + + var TagsCombinator = (function (_CachedTag2) { + babelHelpers.inherits(TagsCombinator, _CachedTag2); + + function TagsCombinator(tags) { + _CachedTag2.call(this); + this.tags = tags; + } + + TagsCombinator.prototype.compute = function compute() { + var tags = this.tags; + + var max = -1; + for (var i = 0; i < tags.length; i++) { + var value = tags[i].value(); + max = Math.max(value, max); + } + return max; + }; + + return TagsCombinator; + })(CachedTag); + + var UpdatableTag = (function (_CachedTag3) { + babelHelpers.inherits(UpdatableTag, _CachedTag3); + + function UpdatableTag(tag) { + _CachedTag3.call(this); + this.tag = tag; + this.lastUpdated = INITIAL; + } + + ////////// + + UpdatableTag.prototype.compute = function compute() { + return Math.max(this.lastUpdated, this.tag.value()); + }; + + UpdatableTag.prototype.update = function update(tag) { + if (tag !== this.tag) { + this.tag = tag; + this.lastUpdated = $REVISION; + this.invalidate(); + } + }; + + return UpdatableTag; + })(CachedTag); + + var CONSTANT_TAG = new ((function (_RevisionTag3) { + babelHelpers.inherits(ConstantTag, _RevisionTag3); + + function ConstantTag() { + _RevisionTag3.apply(this, arguments); + } + + ConstantTag.prototype.value = function value() { + return CONSTANT; + }; + + return ConstantTag; + })(RevisionTag))(); + var VOLATILE_TAG = new ((function (_RevisionTag4) { + babelHelpers.inherits(VolatileTag, _RevisionTag4); + + function VolatileTag() { + _RevisionTag4.apply(this, arguments); + } + + VolatileTag.prototype.value = function value() { + return VOLATILE; + }; + + return VolatileTag; + })(RevisionTag))(); + var CURRENT_TAG = new ((function (_DirtyableTag) { + babelHelpers.inherits(CurrentTag, _DirtyableTag); + + function CurrentTag() { + _DirtyableTag.apply(this, arguments); + } + + CurrentTag.prototype.value = function value() { + return $REVISION; + }; + + return CurrentTag; + })(DirtyableTag))(); + + var CachedReference = (function () { + function CachedReference() { + this.lastRevision = null; + this.lastValue = null; + } + + CachedReference.prototype.value = function value() { + var tag = this.tag; + var lastRevision = this.lastRevision; + var lastValue = this.lastValue; + + if (!lastRevision || !tag.validate(lastRevision)) { + lastValue = this.lastValue = this.compute(); + this.lastRevision = tag.value(); + } + return lastValue; + }; + + CachedReference.prototype.invalidate = function invalidate() { + this.lastRevision = null; + }; + + return CachedReference; + })(); + + var MapperReference = (function (_CachedReference) { + babelHelpers.inherits(MapperReference, _CachedReference); + + function MapperReference(reference, mapper) { + _CachedReference.call(this); + this.tag = reference.tag; + this.reference = reference; + this.mapper = mapper; + } + + MapperReference.prototype.compute = function compute() { + var reference = this.reference; + var mapper = this.mapper; + + return mapper(reference.value()); + }; + + return MapperReference; + })(CachedReference); + + function map(reference, mapper) { + return new MapperReference(reference, mapper); + } + ////////// + + var ReferenceCache = (function () { + function ReferenceCache(reference) { + this.lastValue = null; + this.lastRevision = null; + this.initialized = false; + this.tag = reference.tag; + this.reference = reference; + } + + ReferenceCache.prototype.peek = function peek() { + if (!this.initialized) { + return this.initialize(); + } + return this.lastValue; + }; + + ReferenceCache.prototype.revalidate = function revalidate() { + if (!this.initialized) { + return this.initialize(); + } + var reference = this.reference; + var lastRevision = this.lastRevision; + + var tag = reference.tag; + if (tag.validate(lastRevision)) return NOT_MODIFIED; + this.lastRevision = tag.value(); + var lastValue = this.lastValue; + + var value = reference.value(); + if (value === lastValue) return NOT_MODIFIED; + this.lastValue = value; + return value; + }; + + ReferenceCache.prototype.initialize = function initialize() { + var reference = this.reference; + + var value = this.lastValue = reference.value(); + this.lastRevision = reference.tag.value(); + this.initialized = true; + return value; + }; + + return ReferenceCache; + })(); + + var NOT_MODIFIED = "adb3b78e-3d22-4e4b-877a-6317c2c5c145"; + function isModified(value) { + return value !== NOT_MODIFIED; + } + + var ConstReference = (function () { + function ConstReference(inner) { + this.inner = inner; + this.tag = CONSTANT_TAG; + } + + ConstReference.prototype.value = function value() { + return this.inner; + }; + + return ConstReference; + })(); + + function isConst(reference) { + return reference.tag === CONSTANT_TAG; + } + + var ListItem = (function (_ListNode) { + babelHelpers.inherits(ListItem, _ListNode); + + function ListItem(iterable, result) { + _ListNode.call(this, iterable.valueReferenceFor(result)); + this.retained = false; + this.seen = false; + this.key = result.key; + this.iterable = iterable; + this.memo = iterable.memoReferenceFor(result); + } + + ListItem.prototype.update = function update(item) { + this.retained = true; + this.iterable.updateValueReference(this.value, item); + this.iterable.updateMemoReference(this.memo, item); + }; + + ListItem.prototype.shouldRemove = function shouldRemove() { + return !this.retained; + }; + + ListItem.prototype.reset = function reset() { + this.retained = false; + this.seen = false; + }; + + return ListItem; + })(_glimmerUtil.ListNode); + + var IterationArtifacts = (function () { + function IterationArtifacts(iterable) { + this.map = _glimmerUtil.dict(); + this.list = new _glimmerUtil.LinkedList(); + this.tag = iterable.tag; + this.iterable = iterable; + } + + IterationArtifacts.prototype.isEmpty = function isEmpty() { + var iterator = this.iterator = this.iterable.iterate(); + return iterator.isEmpty(); + }; + + IterationArtifacts.prototype.iterate = function iterate() { + var iterator = this.iterator || this.iterable.iterate(); + this.iterator = null; + return iterator; + }; + + IterationArtifacts.prototype.has = function has(key) { + return !!this.map[key]; + }; + + IterationArtifacts.prototype.get = function get(key) { + return this.map[key]; + }; + + IterationArtifacts.prototype.wasSeen = function wasSeen(key) { + var node = this.map[key]; + return node && node.seen; + }; + + IterationArtifacts.prototype.append = function append(item) { + var map = this.map; + var list = this.list; + var iterable = this.iterable; + + var node = map[item.key] = new ListItem(iterable, item); + list.append(node); + return node; + }; + + IterationArtifacts.prototype.insertBefore = function insertBefore(item, reference) { + var map = this.map; + var list = this.list; + var iterable = this.iterable; + + var node = map[item.key] = new ListItem(iterable, item); + node.retained = true; + list.insertBefore(node, reference); + return node; + }; + + IterationArtifacts.prototype.move = function move(item, reference) { + var list = this.list; + + item.retained = true; + list.remove(item); + list.insertBefore(item, reference); + }; + + IterationArtifacts.prototype.remove = function remove(item) { + var list = this.list; + + list.remove(item); + delete this.map[item.key]; + }; + + IterationArtifacts.prototype.nextNode = function nextNode(item) { + return this.list.nextNode(item); + }; + + IterationArtifacts.prototype.head = function head() { + return this.list.head(); + }; + + return IterationArtifacts; + })(); + + var ReferenceIterator = (function () { + // if anyone needs to construct this object with something other than + // an iterable, let @wycats know. + + function ReferenceIterator(iterable) { + this.iterator = null; + var artifacts = new IterationArtifacts(iterable); + this.artifacts = artifacts; + } + + ReferenceIterator.prototype.next = function next() { + var artifacts = this.artifacts; + + var iterator = this.iterator = this.iterator || artifacts.iterate(); + var item = iterator.next(); + if (!item) return null; + return artifacts.append(item); + }; + + return ReferenceIterator; + })(); + + var Phase; + (function (Phase) { + Phase[Phase["Append"] = 0] = "Append"; + Phase[Phase["Prune"] = 1] = "Prune"; + Phase[Phase["Done"] = 2] = "Done"; + })(Phase || (Phase = {})); + + var IteratorSynchronizer = (function () { + function IteratorSynchronizer(_ref) { + var target = _ref.target; + var artifacts = _ref.artifacts; + + this.target = target; + this.artifacts = artifacts; + this.iterator = artifacts.iterate(); + this.current = artifacts.head(); + } + + IteratorSynchronizer.prototype.sync = function sync() { + var phase = Phase.Append; + while (true) { + switch (phase) { + case Phase.Append: + phase = this.nextAppend(); + break; + case Phase.Prune: + phase = this.nextPrune(); + break; + case Phase.Done: + this.nextDone(); + return; + } + } + }; + + IteratorSynchronizer.prototype.advanceToKey = function advanceToKey(key) { + var current = this.current; + var artifacts = this.artifacts; + + var seek = current; + while (seek && seek.key !== key) { + seek.seen = true; + seek = artifacts.nextNode(seek); + } + this.current = seek && artifacts.nextNode(seek); + }; + + IteratorSynchronizer.prototype.nextAppend = function nextAppend() { + var iterator = this.iterator; + var current = this.current; + var artifacts = this.artifacts; + + var item = iterator.next(); + if (item === null) { + return this.startPrune(); + } + var key = item.key; + + if (current && current.key === key) { + this.nextRetain(item); + } else if (artifacts.has(key)) { + this.nextMove(item); + } else { + this.nextInsert(item); + } + return Phase.Append; + }; + + IteratorSynchronizer.prototype.nextRetain = function nextRetain(item) { + var artifacts = this.artifacts; + var current = this.current; + + current = _glimmerUtil.expect(current, 'BUG: current is empty'); + current.update(item); + this.current = artifacts.nextNode(current); + this.target.retain(item.key, current.value, current.memo); + }; + + IteratorSynchronizer.prototype.nextMove = function nextMove(item) { + var current = this.current; + var artifacts = this.artifacts; + var target = this.target; + var key = item.key; + + var found = artifacts.get(item.key); + found.update(item); + if (artifacts.wasSeen(item.key)) { + artifacts.move(found, current); + target.move(found.key, found.value, found.memo, current ? current.key : null); + } else { + this.advanceToKey(key); + } + }; + + IteratorSynchronizer.prototype.nextInsert = function nextInsert(item) { + var artifacts = this.artifacts; + var target = this.target; + var current = this.current; + + var node = artifacts.insertBefore(item, current); + target.insert(node.key, node.value, node.memo, current ? current.key : null); + }; + + IteratorSynchronizer.prototype.startPrune = function startPrune() { + this.current = this.artifacts.head(); + return Phase.Prune; + }; + + IteratorSynchronizer.prototype.nextPrune = function nextPrune() { + var artifacts = this.artifacts; + var target = this.target; + var current = this.current; + + if (current === null) { + return Phase.Done; + } + var node = current; + this.current = artifacts.nextNode(node); + if (node.shouldRemove()) { + artifacts.remove(node); + target.delete(node.key); + } else { + node.reset(); + } + return Phase.Prune; + }; + + IteratorSynchronizer.prototype.nextDone = function nextDone() { + this.target.done(); + }; + + return IteratorSynchronizer; + })(); + + function referenceFromParts(root, parts) { + var reference = root; + for (var i = 0; i < parts.length; i++) { + reference = reference.get(parts[i]); + } + return reference; + } + + exports.ConstReference = ConstReference; + exports.isConst = isConst; + exports.ListItem = ListItem; + exports.referenceFromParts = referenceFromParts; + exports.IterationArtifacts = IterationArtifacts; + exports.ReferenceIterator = ReferenceIterator; + exports.IteratorSynchronizer = IteratorSynchronizer; + exports.CONSTANT = CONSTANT; + exports.INITIAL = INITIAL; + exports.VOLATILE = VOLATILE; + exports.RevisionTag = RevisionTag; + exports.DirtyableTag = DirtyableTag; + exports.combineTagged = combineTagged; + exports.combineSlice = combineSlice; + exports.combine = combine; + exports.CachedTag = CachedTag; + exports.UpdatableTag = UpdatableTag; + exports.CONSTANT_TAG = CONSTANT_TAG; + exports.VOLATILE_TAG = VOLATILE_TAG; + exports.CURRENT_TAG = CURRENT_TAG; + exports.CachedReference = CachedReference; + exports.map = map; + exports.ReferenceCache = ReferenceCache; + exports.isModified = isModified; +}); +enifed('@glimmer/runtime',['exports','@glimmer/util','@glimmer/reference','@glimmer/wire-format'],function(exports,_glimmerUtil,_glimmerReference,_glimmerWireFormat){'use strict';var PrimitiveReference=(function(_ConstReference){babelHelpers.inherits(PrimitiveReference,_ConstReference);function PrimitiveReference(value){_ConstReference.call(this,value);}PrimitiveReference.create = function create(value){if(value === undefined){return UNDEFINED_REFERENCE;}else if(value === null){return NULL_REFERENCE;}else if(value === true){return TRUE_REFERENCE;}else if(value === false){return FALSE_REFERENCE;}else if(typeof value === 'number'){return new ValueReference(value);}else {return new StringReference(value);}};PrimitiveReference.prototype.get = function get(_key){return UNDEFINED_REFERENCE;};return PrimitiveReference;})(_glimmerReference.ConstReference);var StringReference=(function(_PrimitiveReference){babelHelpers.inherits(StringReference,_PrimitiveReference);function StringReference(){_PrimitiveReference.apply(this,arguments);this.lengthReference = null;}StringReference.prototype.get = function get(key){if(key === 'length'){var lengthReference=this.lengthReference;if(lengthReference === null){lengthReference = this.lengthReference = new ValueReference(this.inner.length);}return lengthReference;}else {return _PrimitiveReference.prototype.get.call(this,key);}};return StringReference;})(PrimitiveReference);var ValueReference=(function(_PrimitiveReference2){babelHelpers.inherits(ValueReference,_PrimitiveReference2);function ValueReference(value){_PrimitiveReference2.call(this,value);}return ValueReference;})(PrimitiveReference);var UNDEFINED_REFERENCE=new ValueReference(undefined);var NULL_REFERENCE=new ValueReference(null);var TRUE_REFERENCE=new ValueReference(true);var FALSE_REFERENCE=new ValueReference(false);var ConditionalReference=(function(){function ConditionalReference(inner){this.inner = inner;this.tag = inner.tag;}ConditionalReference.prototype.value = function value(){return this.toBool(this.inner.value());};ConditionalReference.prototype.toBool = function toBool(value){return !!value;};return ConditionalReference;})();var Constants=(function(){function Constants(){ // `0` means NULL +this.references = [];this.strings = [];this.expressions = [];this.arrays = [];this.blocks = [];this.functions = [];this.others = [];this.NULL_REFERENCE = this.reference(NULL_REFERENCE);this.UNDEFINED_REFERENCE = this.reference(UNDEFINED_REFERENCE);}Constants.prototype.getReference = function getReference(value){return this.references[value - 1];};Constants.prototype.reference = function reference(value){var index=this.references.length;this.references.push(value);return index + 1;};Constants.prototype.getString = function getString(value){return this.strings[value - 1];};Constants.prototype.string = function string(value){var index=this.strings.length;this.strings.push(value);return index + 1;};Constants.prototype.getExpression = function getExpression(value){return this.expressions[value - 1];};Constants.prototype.expression = function expression(value){var index=this.expressions.length;this.expressions.push(value);return index + 1;};Constants.prototype.getArray = function getArray(value){return this.arrays[value - 1];};Constants.prototype.array = function array(values){var index=this.arrays.length;this.arrays.push(values);return index + 1;};Constants.prototype.getBlock = function getBlock(value){return this.blocks[value - 1];};Constants.prototype.block = function block(_block2){var index=this.blocks.length;this.blocks.push(_block2);return index + 1;};Constants.prototype.getFunction = function getFunction(value){return this.functions[value - 1];};Constants.prototype.function = function _function(f){var index=this.functions.length;this.functions.push(f);return index + 1;};Constants.prototype.getOther = function getOther(value){return this.others[value - 1];};Constants.prototype.other = function other(_other){var index=this.others.length;this.others.push(_other);return index + 1;};return Constants;})();var AppendOpcodes=(function(){function AppendOpcodes(){this.evaluateOpcode = _glimmerUtil.fillNulls(51 /* EvaluatePartial */ + 1);}AppendOpcodes.prototype.add = function add(name,evaluate){this.evaluateOpcode[name] = evaluate;};AppendOpcodes.prototype.evaluate = function evaluate(vm,opcode){var func=this.evaluateOpcode[opcode.type];func(vm,opcode);};return AppendOpcodes;})();var APPEND_OPCODES=new AppendOpcodes();var AbstractOpcode=(function(){function AbstractOpcode(){_glimmerUtil.initializeGuid(this);}AbstractOpcode.prototype.toJSON = function toJSON(){return {guid:this._guid,type:this.type};};return AbstractOpcode;})();var UpdatingOpcode=(function(_AbstractOpcode){babelHelpers.inherits(UpdatingOpcode,_AbstractOpcode);function UpdatingOpcode(){_AbstractOpcode.apply(this,arguments);this.next = null;this.prev = null;}return UpdatingOpcode;})(AbstractOpcode);APPEND_OPCODES.add(20, /* OpenBlock */function(vm,_ref){var _getBlock=_ref.op1;var _args=_ref.op2;var inner=vm.constants.getOther(_getBlock);var rawArgs=vm.constants.getExpression(_args);var args=null;var block=inner.evaluate(vm);if(block){args = rawArgs.evaluate(vm);} // FIXME: can we avoid doing this when we don't have a block? +vm.pushCallerScope();if(block){vm.invokeBlock(block,args || null);}});APPEND_OPCODES.add(21, /* CloseBlock */function(vm){return vm.popScope();});APPEND_OPCODES.add(0, /* PushChildScope */function(vm){return vm.pushChildScope();});APPEND_OPCODES.add(1, /* PopScope */function(vm){return vm.popScope();});APPEND_OPCODES.add(2, /* PushDynamicScope */function(vm){return vm.pushDynamicScope();});APPEND_OPCODES.add(3, /* PopDynamicScope */function(vm){return vm.popDynamicScope();});APPEND_OPCODES.add(4, /* Put */function(vm,_ref2){var reference=_ref2.op1;vm.frame.setOperand(vm.constants.getReference(reference));});APPEND_OPCODES.add(5, /* EvaluatePut */function(vm,_ref3){var expression=_ref3.op1;var expr=vm.constants.getExpression(expression);vm.evaluateOperand(expr);});APPEND_OPCODES.add(6, /* PutArgs */function(vm,_ref4){var args=_ref4.op1;vm.evaluateArgs(vm.constants.getExpression(args));});APPEND_OPCODES.add(7, /* BindPositionalArgs */function(vm,_ref5){var _symbols=_ref5.op1;var symbols=vm.constants.getArray(_symbols);vm.bindPositionalArgs(symbols);});APPEND_OPCODES.add(8, /* BindNamedArgs */function(vm,_ref6){var _names=_ref6.op1;var _symbols=_ref6.op2;var names=vm.constants.getArray(_names);var symbols=vm.constants.getArray(_symbols);vm.bindNamedArgs(names,symbols);});APPEND_OPCODES.add(9, /* BindBlocks */function(vm,_ref7){var _names=_ref7.op1;var _symbols=_ref7.op2;var names=vm.constants.getArray(_names);var symbols=vm.constants.getArray(_symbols);vm.bindBlocks(names,symbols);});APPEND_OPCODES.add(10, /* BindPartialArgs */function(vm,_ref8){var symbol=_ref8.op1;vm.bindPartialArgs(symbol);});APPEND_OPCODES.add(11, /* BindCallerScope */function(vm){return vm.bindCallerScope();});APPEND_OPCODES.add(12, /* BindDynamicScope */function(vm,_ref9){var _names=_ref9.op1;var names=vm.constants.getArray(_names);vm.bindDynamicScope(names);});APPEND_OPCODES.add(13, /* Enter */function(vm,_ref10){var start=_ref10.op1;var end=_ref10.op2;return vm.enter(start,end);});APPEND_OPCODES.add(14, /* Exit */function(vm){return vm.exit();});APPEND_OPCODES.add(15, /* Evaluate */function(vm,_ref11){var _block=_ref11.op1;var block=vm.constants.getBlock(_block);var args=vm.frame.getArgs();vm.invokeBlock(block,args);});APPEND_OPCODES.add(16, /* Jump */function(vm,_ref12){var target=_ref12.op1;return vm.goto(target);});APPEND_OPCODES.add(17, /* JumpIf */function(vm,_ref13){var target=_ref13.op1;var reference=vm.frame.getCondition();if(_glimmerReference.isConst(reference)){if(reference.value()){vm.goto(target);}}else {var cache=new _glimmerReference.ReferenceCache(reference);if(cache.peek()){vm.goto(target);}vm.updateWith(new Assert(cache));}});APPEND_OPCODES.add(18, /* JumpUnless */function(vm,_ref14){var target=_ref14.op1;var reference=vm.frame.getCondition();if(_glimmerReference.isConst(reference)){if(!reference.value()){vm.goto(target);}}else {var cache=new _glimmerReference.ReferenceCache(reference);if(!cache.peek()){vm.goto(target);}vm.updateWith(new Assert(cache));}});var ConstTest=function(ref,_env){return new _glimmerReference.ConstReference(!!ref.value());};var SimpleTest=function(ref,_env){return ref;};var EnvironmentTest=function(ref,env){return env.toConditionalReference(ref);};APPEND_OPCODES.add(19, /* Test */function(vm,_ref15){var _func=_ref15.op1;var operand=vm.frame.getOperand();var func=vm.constants.getFunction(_func);vm.frame.setCondition(func(operand,vm.env));});var Assert=(function(_UpdatingOpcode){babelHelpers.inherits(Assert,_UpdatingOpcode);function Assert(cache){_UpdatingOpcode.call(this);this.type = "assert";this.tag = cache.tag;this.cache = cache;}Assert.prototype.evaluate = function evaluate(vm){var cache=this.cache;if(_glimmerReference.isModified(cache.revalidate())){vm.throw();}};Assert.prototype.toJSON = function toJSON(){var type=this.type;var _guid=this._guid;var cache=this.cache;var expected=undefined;try{expected = JSON.stringify(cache.peek());}catch(e) {expected = String(cache.peek());}return {guid:_guid,type:type,args:[],details:{expected:expected}};};return Assert;})(UpdatingOpcode);var JumpIfNotModifiedOpcode=(function(_UpdatingOpcode2){babelHelpers.inherits(JumpIfNotModifiedOpcode,_UpdatingOpcode2);function JumpIfNotModifiedOpcode(tag,target){_UpdatingOpcode2.call(this);this.target = target;this.type = "jump-if-not-modified";this.tag = tag;this.lastRevision = tag.value();}JumpIfNotModifiedOpcode.prototype.evaluate = function evaluate(vm){var tag=this.tag;var target=this.target;var lastRevision=this.lastRevision;if(!vm.alwaysRevalidate && tag.validate(lastRevision)){vm.goto(target);}};JumpIfNotModifiedOpcode.prototype.didModify = function didModify(){this.lastRevision = this.tag.value();};JumpIfNotModifiedOpcode.prototype.toJSON = function toJSON(){return {guid:this._guid,type:this.type,args:[JSON.stringify(this.target.inspect())]};};return JumpIfNotModifiedOpcode;})(UpdatingOpcode);var DidModifyOpcode=(function(_UpdatingOpcode3){babelHelpers.inherits(DidModifyOpcode,_UpdatingOpcode3);function DidModifyOpcode(target){_UpdatingOpcode3.call(this);this.target = target;this.type = "did-modify";this.tag = _glimmerReference.CONSTANT_TAG;}DidModifyOpcode.prototype.evaluate = function evaluate(){this.target.didModify();};return DidModifyOpcode;})(UpdatingOpcode);var LabelOpcode=(function(){function LabelOpcode(label){this.tag = _glimmerReference.CONSTANT_TAG;this.type = "label";this.label = null;this.prev = null;this.next = null;_glimmerUtil.initializeGuid(this);if(label)this.label = label;}LabelOpcode.prototype.evaluate = function evaluate(){};LabelOpcode.prototype.inspect = function inspect(){return this.label + ' [' + this._guid + ']';};LabelOpcode.prototype.toJSON = function toJSON(){return {guid:this._guid,type:this.type,args:[JSON.stringify(this.inspect())]};};return LabelOpcode;})();var EMPTY_ARRAY=_glimmerUtil.HAS_NATIVE_WEAKMAP?Object.freeze([]):[];var EMPTY_DICT=_glimmerUtil.HAS_NATIVE_WEAKMAP?Object.freeze(_glimmerUtil.dict()):_glimmerUtil.dict();var CompiledPositionalArgs=(function(){function CompiledPositionalArgs(values){this.values = values;this.length = values.length;}CompiledPositionalArgs.create = function create(values){if(values.length){return new this(values);}else {return COMPILED_EMPTY_POSITIONAL_ARGS;}};CompiledPositionalArgs.empty = function empty(){return COMPILED_EMPTY_POSITIONAL_ARGS;};CompiledPositionalArgs.prototype.evaluate = function evaluate(vm){var values=this.values;var length=this.length;var references=new Array(length);for(var i=0;i < length;i++) {references[i] = values[i].evaluate(vm);}return EvaluatedPositionalArgs.create(references);};CompiledPositionalArgs.prototype.toJSON = function toJSON(){return '[' + this.values.map(function(value){return value.toJSON();}).join(", ") + ']';};return CompiledPositionalArgs;})();var COMPILED_EMPTY_POSITIONAL_ARGS=new ((function(_CompiledPositionalArgs){babelHelpers.inherits(_class,_CompiledPositionalArgs);function _class(){_CompiledPositionalArgs.call(this,EMPTY_ARRAY);}_class.prototype.evaluate = function evaluate(_vm){return EVALUATED_EMPTY_POSITIONAL_ARGS;};_class.prototype.toJSON = function toJSON(){return '<EMPTY>';};return _class;})(CompiledPositionalArgs))();var EvaluatedPositionalArgs=(function(){function EvaluatedPositionalArgs(values){this.values = values;this.tag = _glimmerReference.combineTagged(values);this.length = values.length;}EvaluatedPositionalArgs.create = function create(values){return new this(values);};EvaluatedPositionalArgs.empty = function empty(){return EVALUATED_EMPTY_POSITIONAL_ARGS;};EvaluatedPositionalArgs.prototype.at = function at(index){var values=this.values;var length=this.length;return index < length?values[index]:UNDEFINED_REFERENCE;};EvaluatedPositionalArgs.prototype.value = function value(){var values=this.values;var length=this.length;var ret=new Array(length);for(var i=0;i < length;i++) {ret[i] = values[i].value();}return ret;};return EvaluatedPositionalArgs;})();var EVALUATED_EMPTY_POSITIONAL_ARGS=new ((function(_EvaluatedPositionalArgs){babelHelpers.inherits(_class2,_EvaluatedPositionalArgs);function _class2(){_EvaluatedPositionalArgs.call(this,EMPTY_ARRAY);}_class2.prototype.at = function at(){return UNDEFINED_REFERENCE;};_class2.prototype.value = function value(){return this.values;};return _class2;})(EvaluatedPositionalArgs))();var CompiledNamedArgs=(function(){function CompiledNamedArgs(keys,values){this.keys = keys;this.values = values;this.length = keys.length;_glimmerUtil.assert(keys.length === values.length,'Keys and values do not have the same length');}CompiledNamedArgs.empty = function empty(){return COMPILED_EMPTY_NAMED_ARGS;};CompiledNamedArgs.create = function create(map){var keys=Object.keys(map);var length=keys.length;if(length > 0){var values=[];for(var i=0;i < length;i++) {values[i] = map[keys[i]];}return new this(keys,values);}else {return COMPILED_EMPTY_NAMED_ARGS;}};CompiledNamedArgs.prototype.evaluate = function evaluate(vm){var keys=this.keys;var values=this.values;var length=this.length;var evaluated=new Array(length);for(var i=0;i < length;i++) {evaluated[i] = values[i].evaluate(vm);}return new EvaluatedNamedArgs(keys,evaluated);};CompiledNamedArgs.prototype.toJSON = function toJSON(){var keys=this.keys;var values=this.values;var inner=keys.map(function(key,i){return key + ': ' + values[i].toJSON();}).join(", ");return '{' + inner + '}';};return CompiledNamedArgs;})();var COMPILED_EMPTY_NAMED_ARGS=new ((function(_CompiledNamedArgs){babelHelpers.inherits(_class3,_CompiledNamedArgs);function _class3(){_CompiledNamedArgs.call(this,EMPTY_ARRAY,EMPTY_ARRAY);}_class3.prototype.evaluate = function evaluate(_vm){return EVALUATED_EMPTY_NAMED_ARGS;};_class3.prototype.toJSON = function toJSON(){return '<EMPTY>';};return _class3;})(CompiledNamedArgs))();var EvaluatedNamedArgs=(function(){function EvaluatedNamedArgs(keys,values){var _map=arguments.length <= 2 || arguments[2] === undefined?null:arguments[2];this.keys = keys;this.values = values;this._map = _map;this.tag = _glimmerReference.combineTagged(values);this.length = keys.length;_glimmerUtil.assert(keys.length === values.length,'Keys and values do not have the same length');}EvaluatedNamedArgs.create = function create(map){var keys=Object.keys(map);var length=keys.length;if(length > 0){var values=new Array(length);for(var i=0;i < length;i++) {values[i] = map[keys[i]];}return new this(keys,values,map);}else {return EVALUATED_EMPTY_NAMED_ARGS;}};EvaluatedNamedArgs.empty = function empty(){return EVALUATED_EMPTY_NAMED_ARGS;};EvaluatedNamedArgs.prototype.get = function get(key){var keys=this.keys;var values=this.values;var index=keys.indexOf(key);return index === -1?UNDEFINED_REFERENCE:values[index];};EvaluatedNamedArgs.prototype.has = function has(key){return this.keys.indexOf(key) !== -1;};EvaluatedNamedArgs.prototype.value = function value(){var keys=this.keys;var values=this.values;var out=_glimmerUtil.dict();for(var i=0;i < keys.length;i++) {var key=keys[i];var ref=values[i];out[key] = ref.value();}return out;};babelHelpers.createClass(EvaluatedNamedArgs,[{key:'map',get:function(){var map=this._map;if(map){return map;}map = this._map = _glimmerUtil.dict();var keys=this.keys;var values=this.values;var length=this.length;for(var i=0;i < length;i++) {map[keys[i]] = values[i];}return map;}}]);return EvaluatedNamedArgs;})();var EVALUATED_EMPTY_NAMED_ARGS=new ((function(_EvaluatedNamedArgs){babelHelpers.inherits(_class4,_EvaluatedNamedArgs);function _class4(){_EvaluatedNamedArgs.call(this,EMPTY_ARRAY,EMPTY_ARRAY,EMPTY_DICT);}_class4.prototype.get = function get(){return UNDEFINED_REFERENCE;};_class4.prototype.has = function has(_key){return false;};_class4.prototype.value = function value(){return EMPTY_DICT;};return _class4;})(EvaluatedNamedArgs))();var EMPTY_BLOCKS={default:null,inverse:null};var CompiledArgs=(function(){function CompiledArgs(positional,named,blocks){this.positional = positional;this.named = named;this.blocks = blocks;this.type = "compiled-args";}CompiledArgs.create = function create(positional,named,blocks){if(positional === COMPILED_EMPTY_POSITIONAL_ARGS && named === COMPILED_EMPTY_NAMED_ARGS && blocks === EMPTY_BLOCKS){return this.empty();}else {return new this(positional,named,blocks);}};CompiledArgs.empty = function empty(){return COMPILED_EMPTY_ARGS;};CompiledArgs.prototype.evaluate = function evaluate(vm){var positional=this.positional;var named=this.named;var blocks=this.blocks;return EvaluatedArgs.create(positional.evaluate(vm),named.evaluate(vm),blocks);};return CompiledArgs;})();var COMPILED_EMPTY_ARGS=new ((function(_CompiledArgs){babelHelpers.inherits(_class5,_CompiledArgs);function _class5(){_CompiledArgs.call(this,COMPILED_EMPTY_POSITIONAL_ARGS,COMPILED_EMPTY_NAMED_ARGS,EMPTY_BLOCKS);}_class5.prototype.evaluate = function evaluate(_vm){return EMPTY_EVALUATED_ARGS;};return _class5;})(CompiledArgs))();var EvaluatedArgs=(function(){function EvaluatedArgs(positional,named,blocks){this.positional = positional;this.named = named;this.blocks = blocks;this.tag = _glimmerReference.combineTagged([positional,named]);}EvaluatedArgs.empty = function empty(){return EMPTY_EVALUATED_ARGS;};EvaluatedArgs.create = function create(positional,named,blocks){return new this(positional,named,blocks);};EvaluatedArgs.positional = function positional(values){var blocks=arguments.length <= 1 || arguments[1] === undefined?EMPTY_BLOCKS:arguments[1];return new this(EvaluatedPositionalArgs.create(values),EVALUATED_EMPTY_NAMED_ARGS,blocks);};EvaluatedArgs.named = function named(map){var blocks=arguments.length <= 1 || arguments[1] === undefined?EMPTY_BLOCKS:arguments[1];return new this(EVALUATED_EMPTY_POSITIONAL_ARGS,EvaluatedNamedArgs.create(map),blocks);};return EvaluatedArgs;})();var EMPTY_EVALUATED_ARGS=new EvaluatedArgs(EVALUATED_EMPTY_POSITIONAL_ARGS,EVALUATED_EMPTY_NAMED_ARGS,EMPTY_BLOCKS);APPEND_OPCODES.add(22, /* PutDynamicComponent */function(vm){var reference=vm.frame.getOperand();var cache=_glimmerReference.isConst(reference)?undefined:new _glimmerReference.ReferenceCache(reference);var definition=cache?cache.peek():reference.value();vm.frame.setImmediate(definition);if(cache){vm.updateWith(new Assert(cache));}});APPEND_OPCODES.add(23, /* PutComponent */function(vm,_ref16){var _component=_ref16.op1;var definition=vm.constants.getOther(_component);vm.frame.setImmediate(definition);});APPEND_OPCODES.add(24, /* OpenComponent */function(vm,_ref17){var _args=_ref17.op1;var _shadow=_ref17.op2;var rawArgs=vm.constants.getExpression(_args);var shadow=vm.constants.getBlock(_shadow);var definition=vm.frame.getImmediate();var dynamicScope=vm.pushDynamicScope();var callerScope=vm.scope();var manager=definition.manager;var args=manager.prepareArgs(definition,rawArgs.evaluate(vm),dynamicScope);var hasDefaultBlock=!!args.blocks.default; // TODO Cleanup? +var component=manager.create(vm.env,definition,args,dynamicScope,vm.getSelf(),hasDefaultBlock);var destructor=manager.getDestructor(component);if(destructor)vm.newDestroyable(destructor);var layout=manager.layoutFor(definition,component,vm.env);var selfRef=manager.getSelf(component);vm.beginCacheGroup();vm.stack().pushSimpleBlock();vm.pushRootScope(selfRef,layout.symbols);vm.invokeLayout(args,layout,callerScope,component,manager,shadow);vm.updateWith(new UpdateComponentOpcode(definition.name,component,manager,args,dynamicScope));}); // export class DidCreateElementOpcode extends Opcode { +// public type = "did-create-element"; +// evaluate(vm: VM) { +// let manager = vm.frame.getManager(); +// let component = vm.frame.getComponent(); +// let action = 'DidCreateElementOpcode#evaluate'; +// manager.didCreateElement(component, vm.stack().expectConstructing(action), vm.stack().expectOperations(action)); +// } +// toJSON(): OpcodeJSON { +// return { +// guid: this._guid, +// type: this.type, +// args: ["$ARGS"] +// }; +// } +// } +APPEND_OPCODES.add(25, /* DidCreateElement */function(vm){var manager=vm.frame.getManager();var component=vm.frame.getComponent();var action='DidCreateElementOpcode#evaluate';manager.didCreateElement(component,vm.stack().expectConstructing(action),vm.stack().expectOperations(action));}); // export class ShadowAttributesOpcode extends Opcode { +// public type = "shadow-attributes"; +// evaluate(vm: VM) { +// let shadow = vm.frame.getShadow(); +// vm.pushCallerScope(); +// if (!shadow) return; +// vm.invokeBlock(shadow, EvaluatedArgs.empty()); +// } +// toJSON(): OpcodeJSON { +// return { +// guid: this._guid, +// type: this.type, +// args: ["$ARGS"] +// }; +// } +// } +// Slow path for non-specialized component invocations. Uses an internal +// named lookup on the args. +APPEND_OPCODES.add(26, /* ShadowAttributes */function(vm){var shadow=vm.frame.getShadow();vm.pushCallerScope();if(!shadow)return;vm.invokeBlock(shadow,EvaluatedArgs.empty());}); // export class DidRenderLayoutOpcode extends Opcode { +// public type = "did-render-layout"; +// evaluate(vm: VM) { +// let manager = vm.frame.getManager(); +// let component = vm.frame.getComponent(); +// let bounds = vm.stack().popBlock(); +// manager.didRenderLayout(component, bounds); +// vm.env.didCreate(component, manager); +// vm.updateWith(new DidUpdateLayoutOpcode(manager, component, bounds)); +// } +// } +APPEND_OPCODES.add(27, /* DidRenderLayout */function(vm){var manager=vm.frame.getManager();var component=vm.frame.getComponent();var bounds=vm.stack().popBlock();manager.didRenderLayout(component,bounds);vm.env.didCreate(component,manager);vm.updateWith(new DidUpdateLayoutOpcode(manager,component,bounds));}); // export class CloseComponentOpcode extends Opcode { +// public type = "close-component"; +// evaluate(vm: VM) { +// vm.popScope(); +// vm.popDynamicScope(); +// vm.commitCacheGroup(); +// } +// } +APPEND_OPCODES.add(28, /* CloseComponent */function(vm){vm.popScope();vm.popDynamicScope();vm.commitCacheGroup();});var UpdateComponentOpcode=(function(_UpdatingOpcode4){babelHelpers.inherits(UpdateComponentOpcode,_UpdatingOpcode4);function UpdateComponentOpcode(name,component,manager,args,dynamicScope){_UpdatingOpcode4.call(this);this.name = name;this.component = component;this.manager = manager;this.args = args;this.dynamicScope = dynamicScope;this.type = "update-component";var componentTag=manager.getTag(component);if(componentTag){this.tag = _glimmerReference.combine([args.tag,componentTag]);}else {this.tag = args.tag;}}UpdateComponentOpcode.prototype.evaluate = function evaluate(_vm){var component=this.component;var manager=this.manager;var args=this.args;var dynamicScope=this.dynamicScope;manager.update(component,args,dynamicScope);};UpdateComponentOpcode.prototype.toJSON = function toJSON(){return {guid:this._guid,type:this.type,args:[JSON.stringify(this.name)]};};return UpdateComponentOpcode;})(UpdatingOpcode);var DidUpdateLayoutOpcode=(function(_UpdatingOpcode5){babelHelpers.inherits(DidUpdateLayoutOpcode,_UpdatingOpcode5);function DidUpdateLayoutOpcode(manager,component,bounds){_UpdatingOpcode5.call(this);this.manager = manager;this.component = component;this.bounds = bounds;this.type = "did-update-layout";this.tag = _glimmerReference.CONSTANT_TAG;}DidUpdateLayoutOpcode.prototype.evaluate = function evaluate(vm){var manager=this.manager;var component=this.component;var bounds=this.bounds;manager.didUpdateLayout(component,bounds);vm.env.didUpdate(component,manager);};return DidUpdateLayoutOpcode;})(UpdatingOpcode);var Cursor=function Cursor(element,nextSibling){this.element = element;this.nextSibling = nextSibling;};var ConcreteBounds=(function(){function ConcreteBounds(parentNode,first,last){this.parentNode = parentNode;this.first = first;this.last = last;}ConcreteBounds.prototype.parentElement = function parentElement(){return this.parentNode;};ConcreteBounds.prototype.firstNode = function firstNode(){return this.first;};ConcreteBounds.prototype.lastNode = function lastNode(){return this.last;};return ConcreteBounds;})();var SingleNodeBounds=(function(){function SingleNodeBounds(parentNode,node){this.parentNode = parentNode;this.node = node;}SingleNodeBounds.prototype.parentElement = function parentElement(){return this.parentNode;};SingleNodeBounds.prototype.firstNode = function firstNode(){return this.node;};SingleNodeBounds.prototype.lastNode = function lastNode(){return this.node;};return SingleNodeBounds;})();function single(parent,node){return new SingleNodeBounds(parent,node);}function moveBounds(bounds,reference){var parent=bounds.parentElement();var first=bounds.firstNode();var last=bounds.lastNode();var node=first;while(node) {var next=node.nextSibling;parent.insertBefore(node,reference);if(node === last)return next;node = next;}return null;}function clear(bounds){var parent=bounds.parentElement();var first=bounds.firstNode();var last=bounds.lastNode();var node=first;while(node) {var next=node.nextSibling;parent.removeChild(node);if(node === last)return next;node = next;}return null;}function isSafeString(value){return !!value && typeof value['toHTML'] === 'function';}function isNode(value){return value !== null && typeof value === 'object' && typeof value['nodeType'] === 'number';}function isString(value){return typeof value === 'string';}var Upsert=function Upsert(bounds){this.bounds = bounds;};function cautiousInsert(dom,cursor,value){if(isString(value)){return TextUpsert.insert(dom,cursor,value);}if(isSafeString(value)){return SafeStringUpsert.insert(dom,cursor,value);}if(isNode(value)){return NodeUpsert.insert(dom,cursor,value);}throw _glimmerUtil.unreachable();}function trustingInsert(dom,cursor,value){if(isString(value)){return HTMLUpsert.insert(dom,cursor,value);}if(isNode(value)){return NodeUpsert.insert(dom,cursor,value);}throw _glimmerUtil.unreachable();}var TextUpsert=(function(_Upsert){babelHelpers.inherits(TextUpsert,_Upsert);TextUpsert.insert = function insert(dom,cursor,value){var textNode=dom.createTextNode(value);dom.insertBefore(cursor.element,textNode,cursor.nextSibling);var bounds=new SingleNodeBounds(cursor.element,textNode);return new TextUpsert(bounds,textNode);};function TextUpsert(bounds,textNode){_Upsert.call(this,bounds);this.textNode = textNode;}TextUpsert.prototype.update = function update(_dom,value){if(isString(value)){var textNode=this.textNode;textNode.nodeValue = value;return true;}else {return false;}};return TextUpsert;})(Upsert);var HTMLUpsert=(function(_Upsert2){babelHelpers.inherits(HTMLUpsert,_Upsert2);function HTMLUpsert(){_Upsert2.apply(this,arguments);}HTMLUpsert.insert = function insert(dom,cursor,value){var bounds=dom.insertHTMLBefore(cursor.element,value,cursor.nextSibling);return new HTMLUpsert(bounds);};HTMLUpsert.prototype.update = function update(dom,value){if(isString(value)){var bounds=this.bounds;var parentElement=bounds.parentElement();var nextSibling=clear(bounds);this.bounds = dom.insertHTMLBefore(parentElement,nextSibling,value);return true;}else {return false;}};return HTMLUpsert;})(Upsert);var SafeStringUpsert=(function(_Upsert3){babelHelpers.inherits(SafeStringUpsert,_Upsert3);function SafeStringUpsert(bounds,lastStringValue){_Upsert3.call(this,bounds);this.lastStringValue = lastStringValue;}SafeStringUpsert.insert = function insert(dom,cursor,value){var stringValue=value.toHTML();var bounds=dom.insertHTMLBefore(cursor.element,stringValue,cursor.nextSibling);return new SafeStringUpsert(bounds,stringValue);};SafeStringUpsert.prototype.update = function update(dom,value){if(isSafeString(value)){var stringValue=value.toHTML();if(stringValue !== this.lastStringValue){var bounds=this.bounds;var parentElement=bounds.parentElement();var nextSibling=clear(bounds);this.bounds = dom.insertHTMLBefore(parentElement,nextSibling,stringValue);this.lastStringValue = stringValue;}return true;}else {return false;}};return SafeStringUpsert;})(Upsert);var NodeUpsert=(function(_Upsert4){babelHelpers.inherits(NodeUpsert,_Upsert4);function NodeUpsert(){_Upsert4.apply(this,arguments);}NodeUpsert.insert = function insert(dom,cursor,node){dom.insertBefore(cursor.element,node,cursor.nextSibling);return new NodeUpsert(single(cursor.element,node));};NodeUpsert.prototype.update = function update(dom,value){if(isNode(value)){var bounds=this.bounds;var parentElement=bounds.parentElement();var nextSibling=clear(bounds);this.bounds = dom.insertNodeBefore(parentElement,value,nextSibling);return true;}else {return false;}};return NodeUpsert;})(Upsert);var COMPONENT_DEFINITION_BRAND='COMPONENT DEFINITION [id=e59c754e-61eb-4392-8c4a-2c0ac72bfcd4]';function isComponentDefinition(obj){return typeof obj === 'object' && obj && obj[COMPONENT_DEFINITION_BRAND];}var ComponentDefinition=function ComponentDefinition(name,manager,ComponentClass){this[COMPONENT_DEFINITION_BRAND] = true;this.name = name;this.manager = manager;this.ComponentClass = ComponentClass;};var CompiledExpression=(function(){function CompiledExpression(){}CompiledExpression.prototype.toJSON = function toJSON(){return 'UNIMPL: ' + this.type.toUpperCase();};return CompiledExpression;})();APPEND_OPCODES.add(29, /* Text */function(vm,_ref18){var text=_ref18.op1;vm.stack().appendText(vm.constants.getString(text));});APPEND_OPCODES.add(30, /* Comment */function(vm,_ref19){var text=_ref19.op1;vm.stack().appendComment(vm.constants.getString(text));});APPEND_OPCODES.add(32, /* OpenElement */function(vm,_ref20){var tag=_ref20.op1;vm.stack().openElement(vm.constants.getString(tag));});APPEND_OPCODES.add(33, /* PushRemoteElement */function(vm){var reference=vm.frame.getOperand();var cache=_glimmerReference.isConst(reference)?undefined:new _glimmerReference.ReferenceCache(reference);var element=cache?cache.peek():reference.value();vm.stack().pushRemoteElement(element);if(cache){vm.updateWith(new Assert(cache));}});APPEND_OPCODES.add(34, /* PopRemoteElement */function(vm){return vm.stack().popRemoteElement();});APPEND_OPCODES.add(35, /* OpenComponentElement */function(vm,_ref21){var _tag=_ref21.op1;var tag=vm.constants.getString(_tag);vm.stack().openElement(tag,new ComponentElementOperations(vm.env));});APPEND_OPCODES.add(36, /* OpenDynamicElement */function(vm){var tagName=vm.frame.getOperand().value();vm.stack().openElement(tagName);});var ClassList=(function(){function ClassList(){this.list = null;this.isConst = true;}ClassList.prototype.append = function append(reference){var list=this.list;var isConst$$=this.isConst;if(list === null)list = this.list = [];list.push(reference);this.isConst = isConst$$ && _glimmerReference.isConst(reference);};ClassList.prototype.toReference = function toReference(){var list=this.list;var isConst$$=this.isConst;if(!list)return NULL_REFERENCE;if(isConst$$)return PrimitiveReference.create(toClassName(list));return new ClassListReference(list);};return ClassList;})();var ClassListReference=(function(_CachedReference){babelHelpers.inherits(ClassListReference,_CachedReference);function ClassListReference(list){_CachedReference.call(this);this.list = [];this.tag = _glimmerReference.combineTagged(list);this.list = list;}ClassListReference.prototype.compute = function compute(){return toClassName(this.list);};return ClassListReference;})(_glimmerReference.CachedReference);function toClassName(list){var ret=[];for(var i=0;i < list.length;i++) {var value=list[i].value();if(value !== false && value !== null && value !== undefined)ret.push(value);}return ret.length === 0?null:ret.join(' ');}var SimpleElementOperations=(function(){function SimpleElementOperations(env){this.env = env;this.opcodes = null;this.classList = null;}SimpleElementOperations.prototype.addStaticAttribute = function addStaticAttribute(element,name,value){if(name === 'class'){this.addClass(PrimitiveReference.create(value));}else {this.env.getAppendOperations().setAttribute(element,name,value);}};SimpleElementOperations.prototype.addStaticAttributeNS = function addStaticAttributeNS(element,namespace,name,value){this.env.getAppendOperations().setAttribute(element,name,value,namespace);};SimpleElementOperations.prototype.addDynamicAttribute = function addDynamicAttribute(element,name,reference,isTrusting){if(name === 'class'){this.addClass(reference);}else {var attributeManager=this.env.attributeFor(element,name,isTrusting);var attribute=new DynamicAttribute(element,attributeManager,name,reference);this.addAttribute(attribute);}};SimpleElementOperations.prototype.addDynamicAttributeNS = function addDynamicAttributeNS(element,namespace,name,reference,isTrusting){var attributeManager=this.env.attributeFor(element,name,isTrusting,namespace);var nsAttribute=new DynamicAttribute(element,attributeManager,name,reference,namespace);this.addAttribute(nsAttribute);};SimpleElementOperations.prototype.flush = function flush(element,vm){var env=vm.env;var opcodes=this.opcodes;var classList=this.classList;for(var i=0;opcodes && i < opcodes.length;i++) {vm.updateWith(opcodes[i]);}if(classList){var attributeManager=env.attributeFor(element,'class',false);var attribute=new DynamicAttribute(element,attributeManager,'class',classList.toReference());var opcode=attribute.flush(env);if(opcode){vm.updateWith(opcode);}}this.opcodes = null;this.classList = null;};SimpleElementOperations.prototype.addClass = function addClass(reference){var classList=this.classList;if(!classList){classList = this.classList = new ClassList();}classList.append(reference);};SimpleElementOperations.prototype.addAttribute = function addAttribute(attribute){var opcode=attribute.flush(this.env);if(opcode){var opcodes=this.opcodes;if(!opcodes){opcodes = this.opcodes = [];}opcodes.push(opcode);}};return SimpleElementOperations;})();var ComponentElementOperations=(function(){function ComponentElementOperations(env){this.env = env;this.attributeNames = null;this.attributes = null;this.classList = null;}ComponentElementOperations.prototype.addStaticAttribute = function addStaticAttribute(element,name,value){if(name === 'class'){this.addClass(PrimitiveReference.create(value));}else if(this.shouldAddAttribute(name)){this.addAttribute(name,new StaticAttribute(element,name,value));}};ComponentElementOperations.prototype.addStaticAttributeNS = function addStaticAttributeNS(element,namespace,name,value){if(this.shouldAddAttribute(name)){this.addAttribute(name,new StaticAttribute(element,name,value,namespace));}};ComponentElementOperations.prototype.addDynamicAttribute = function addDynamicAttribute(element,name,reference,isTrusting){if(name === 'class'){this.addClass(reference);}else if(this.shouldAddAttribute(name)){var attributeManager=this.env.attributeFor(element,name,isTrusting);var attribute=new DynamicAttribute(element,attributeManager,name,reference);this.addAttribute(name,attribute);}};ComponentElementOperations.prototype.addDynamicAttributeNS = function addDynamicAttributeNS(element,namespace,name,reference,isTrusting){if(this.shouldAddAttribute(name)){var attributeManager=this.env.attributeFor(element,name,isTrusting,namespace);var nsAttribute=new DynamicAttribute(element,attributeManager,name,reference,namespace);this.addAttribute(name,nsAttribute);}};ComponentElementOperations.prototype.flush = function flush(element,vm){var env=this.env;var attributes=this.attributes;var classList=this.classList;for(var i=0;attributes && i < attributes.length;i++) {var opcode=attributes[i].flush(env);if(opcode){vm.updateWith(opcode);}}if(classList){var attributeManager=env.attributeFor(element,'class',false);var attribute=new DynamicAttribute(element,attributeManager,'class',classList.toReference());var opcode=attribute.flush(env);if(opcode){vm.updateWith(opcode);}}};ComponentElementOperations.prototype.shouldAddAttribute = function shouldAddAttribute(name){return !this.attributeNames || this.attributeNames.indexOf(name) === -1;};ComponentElementOperations.prototype.addClass = function addClass(reference){var classList=this.classList;if(!classList){classList = this.classList = new ClassList();}classList.append(reference);};ComponentElementOperations.prototype.addAttribute = function addAttribute(name,attribute){var attributeNames=this.attributeNames;var attributes=this.attributes;if(!attributeNames){attributeNames = this.attributeNames = [];attributes = this.attributes = [];}attributeNames.push(name);_glimmerUtil.unwrap(attributes).push(attribute);};return ComponentElementOperations;})();APPEND_OPCODES.add(37, /* FlushElement */function(vm){var stack=vm.stack();var action='FlushElementOpcode#evaluate';stack.expectOperations(action).flush(stack.expectConstructing(action),vm);stack.flushElement();});APPEND_OPCODES.add(38, /* CloseElement */function(vm){return vm.stack().closeElement();});APPEND_OPCODES.add(39, /* PopElement */function(vm){return vm.stack().popElement();});APPEND_OPCODES.add(40, /* StaticAttr */function(vm,_ref22){var _name=_ref22.op1;var _value=_ref22.op2;var _namespace=_ref22.op3;var name=vm.constants.getString(_name);var value=vm.constants.getString(_value);if(_namespace){var namespace=vm.constants.getString(_namespace);vm.stack().setStaticAttributeNS(namespace,name,value);}else {vm.stack().setStaticAttribute(name,value);}});APPEND_OPCODES.add(41, /* Modifier */function(vm,_ref23){var _name=_ref23.op1;var _manager=_ref23.op2;var _args=_ref23.op3;var manager=vm.constants.getOther(_manager);var rawArgs=vm.constants.getExpression(_args);var stack=vm.stack();var element=stack.constructing;var updateOperations=stack.updateOperations;var args=rawArgs.evaluate(vm);var dynamicScope=vm.dynamicScope();var modifier=manager.create(element,args,dynamicScope,updateOperations);vm.env.scheduleInstallModifier(modifier,manager);var destructor=manager.getDestructor(modifier);if(destructor){vm.newDestroyable(destructor);}vm.updateWith(new UpdateModifierOpcode(manager,modifier,args));});var UpdateModifierOpcode=(function(_UpdatingOpcode6){babelHelpers.inherits(UpdateModifierOpcode,_UpdatingOpcode6);function UpdateModifierOpcode(manager,modifier,args){_UpdatingOpcode6.call(this);this.manager = manager;this.modifier = modifier;this.args = args;this.type = "update-modifier";this.tag = args.tag;this.lastUpdated = args.tag.value();}UpdateModifierOpcode.prototype.evaluate = function evaluate(vm){var manager=this.manager;var modifier=this.modifier;var tag=this.tag;var lastUpdated=this.lastUpdated;if(!tag.validate(lastUpdated)){vm.env.scheduleUpdateModifier(modifier,manager);this.lastUpdated = tag.value();}};UpdateModifierOpcode.prototype.toJSON = function toJSON(){return {guid:this._guid,type:this.type,args:[JSON.stringify(this.args)]};};return UpdateModifierOpcode;})(UpdatingOpcode);var StaticAttribute=(function(){function StaticAttribute(element,name,value,namespace){this.element = element;this.name = name;this.value = value;this.namespace = namespace;}StaticAttribute.prototype.flush = function flush(env){env.getAppendOperations().setAttribute(this.element,this.name,this.value,this.namespace);return null;};return StaticAttribute;})();var DynamicAttribute=(function(){function DynamicAttribute(element,attributeManager,name,reference,namespace){this.element = element;this.attributeManager = attributeManager;this.name = name;this.reference = reference;this.namespace = namespace;this.cache = null;this.tag = reference.tag;}DynamicAttribute.prototype.patch = function patch(env){var element=this.element;var cache=this.cache;var value=_glimmerUtil.expect(cache,'must patch after flush').revalidate();if(_glimmerReference.isModified(value)){this.attributeManager.updateAttribute(env,element,value,this.namespace);}};DynamicAttribute.prototype.flush = function flush(env){var reference=this.reference;var element=this.element;if(_glimmerReference.isConst(reference)){var value=reference.value();this.attributeManager.setAttribute(env,element,value,this.namespace);return null;}else {var cache=this.cache = new _glimmerReference.ReferenceCache(reference);var value=cache.peek();this.attributeManager.setAttribute(env,element,value,this.namespace);return new PatchElementOpcode(this);}};DynamicAttribute.prototype.toJSON = function toJSON(){var element=this.element;var namespace=this.namespace;var name=this.name;var cache=this.cache;var formattedElement=formatElement(element);var lastValue=_glimmerUtil.expect(cache,'must serialize after flush').peek();if(namespace){return {element:formattedElement,type:'attribute',namespace:namespace,name:name,lastValue:lastValue};}return {element:formattedElement,type:'attribute',namespace:namespace === undefined?null:namespace,name:name,lastValue:lastValue};};return DynamicAttribute;})();function formatElement(element){return JSON.stringify('<' + element.tagName.toLowerCase() + ' />');}APPEND_OPCODES.add(42, /* DynamicAttrNS */function(vm,_ref24){var _name=_ref24.op1;var _namespace=_ref24.op2;var trusting=_ref24.op3;var name=vm.constants.getString(_name);var namespace=vm.constants.getString(_namespace);var reference=vm.frame.getOperand();vm.stack().setDynamicAttributeNS(namespace,name,reference,!!trusting);});APPEND_OPCODES.add(43, /* DynamicAttr */function(vm,_ref25){var _name=_ref25.op1;var trusting=_ref25.op2;var name=vm.constants.getString(_name);var reference=vm.frame.getOperand();vm.stack().setDynamicAttribute(name,reference,!!trusting);});var PatchElementOpcode=(function(_UpdatingOpcode7){babelHelpers.inherits(PatchElementOpcode,_UpdatingOpcode7);function PatchElementOpcode(operation){_UpdatingOpcode7.call(this);this.type = "patch-element";this.tag = operation.tag;this.operation = operation;}PatchElementOpcode.prototype.evaluate = function evaluate(vm){this.operation.patch(vm.env);};PatchElementOpcode.prototype.toJSON = function toJSON(){var _guid=this._guid;var type=this.type;var operation=this.operation;return {guid:_guid,type:type,details:operation.toJSON()};};return PatchElementOpcode;})(UpdatingOpcode);var First=(function(){function First(node){this.node = node;}First.prototype.firstNode = function firstNode(){return this.node;};return First;})();var Last=(function(){function Last(node){this.node = node;}Last.prototype.lastNode = function lastNode(){return this.node;};return Last;})();var Fragment=(function(){function Fragment(bounds){this.bounds = bounds;}Fragment.prototype.parentElement = function parentElement(){return this.bounds.parentElement();};Fragment.prototype.firstNode = function firstNode(){return this.bounds.firstNode();};Fragment.prototype.lastNode = function lastNode(){return this.bounds.lastNode();};Fragment.prototype.update = function update(bounds){this.bounds = bounds;};return Fragment;})();var ElementStack=(function(){function ElementStack(env,parentNode,nextSibling){this.constructing = null;this.operations = null;this.elementStack = new _glimmerUtil.Stack();this.nextSiblingStack = new _glimmerUtil.Stack();this.blockStack = new _glimmerUtil.Stack();this.env = env;this.dom = env.getAppendOperations();this.updateOperations = env.getDOM();this.element = parentNode;this.nextSibling = nextSibling;this.defaultOperations = new SimpleElementOperations(env);this.elementStack.push(this.element);this.nextSiblingStack.push(this.nextSibling);}ElementStack.forInitialRender = function forInitialRender(env,parentNode,nextSibling){return new ElementStack(env,parentNode,nextSibling);};ElementStack.resume = function resume(env,tracker,nextSibling){var parentNode=tracker.parentElement();var stack=new ElementStack(env,parentNode,nextSibling);stack.pushBlockTracker(tracker);return stack;};ElementStack.prototype.expectConstructing = function expectConstructing(method){return _glimmerUtil.expect(this.constructing,method + ' should only be called while constructing an element');};ElementStack.prototype.expectOperations = function expectOperations(method){return _glimmerUtil.expect(this.operations,method + ' should only be called while constructing an element');};ElementStack.prototype.block = function block(){return _glimmerUtil.expect(this.blockStack.current,"Expected a current block tracker");};ElementStack.prototype.popElement = function popElement(){var elementStack=this.elementStack;var nextSiblingStack=this.nextSiblingStack;var topElement=elementStack.pop();nextSiblingStack.pop(); // LOGGER.debug(`-> element stack ${this.elementStack.toArray().map(e => e.tagName).join(', ')}`); +this.element = _glimmerUtil.expect(elementStack.current,"can't pop past the last element");this.nextSibling = nextSiblingStack.current;return topElement;};ElementStack.prototype.pushSimpleBlock = function pushSimpleBlock(){var tracker=new SimpleBlockTracker(this.element);this.pushBlockTracker(tracker);return tracker;};ElementStack.prototype.pushUpdatableBlock = function pushUpdatableBlock(){var tracker=new UpdatableBlockTracker(this.element);this.pushBlockTracker(tracker);return tracker;};ElementStack.prototype.pushBlockTracker = function pushBlockTracker(tracker){var isRemote=arguments.length <= 1 || arguments[1] === undefined?false:arguments[1];var current=this.blockStack.current;if(current !== null){current.newDestroyable(tracker);if(!isRemote){current.newBounds(tracker);}}this.blockStack.push(tracker);return tracker;};ElementStack.prototype.pushBlockList = function pushBlockList(list){var tracker=new BlockListTracker(this.element,list);var current=this.blockStack.current;if(current !== null){current.newDestroyable(tracker);current.newBounds(tracker);}this.blockStack.push(tracker);return tracker;};ElementStack.prototype.popBlock = function popBlock(){this.block().finalize(this);return _glimmerUtil.expect(this.blockStack.pop(),"Expected popBlock to return a block");};ElementStack.prototype.openElement = function openElement(tag){var operations=arguments.length <= 1 || arguments[1] === undefined?this.defaultOperations:arguments[1];var element=this.dom.createElement(tag,this.element);this.constructing = element;this.operations = operations;return element;};ElementStack.prototype.flushElement = function flushElement(){var parent=this.element;var element=_glimmerUtil.expect(this.constructing,'flushElement should only be called when constructing an element');this.dom.insertBefore(parent,element,this.nextSibling);this.constructing = null;this.operations = null;this.pushElement(element);this.block().openElement(element);};ElementStack.prototype.pushRemoteElement = function pushRemoteElement(element){this.pushElement(element);var tracker=new RemoteBlockTracker(element);this.pushBlockTracker(tracker,true);};ElementStack.prototype.popRemoteElement = function popRemoteElement(){this.popBlock();this.popElement();};ElementStack.prototype.pushElement = function pushElement(element){this.element = element;this.elementStack.push(element); // LOGGER.debug(`-> element stack ${this.elementStack.toArray().map(e => e.tagName).join(', ')}`); +this.nextSibling = null;this.nextSiblingStack.push(null);};ElementStack.prototype.newDestroyable = function newDestroyable(d){this.block().newDestroyable(d);};ElementStack.prototype.newBounds = function newBounds(bounds){this.block().newBounds(bounds);};ElementStack.prototype.appendText = function appendText(string){var dom=this.dom;var text=dom.createTextNode(string);dom.insertBefore(this.element,text,this.nextSibling);this.block().newNode(text);return text;};ElementStack.prototype.appendComment = function appendComment(string){var dom=this.dom;var comment=dom.createComment(string);dom.insertBefore(this.element,comment,this.nextSibling);this.block().newNode(comment);return comment;};ElementStack.prototype.setStaticAttribute = function setStaticAttribute(name,value){this.expectOperations('setStaticAttribute').addStaticAttribute(this.expectConstructing('setStaticAttribute'),name,value);};ElementStack.prototype.setStaticAttributeNS = function setStaticAttributeNS(namespace,name,value){this.expectOperations('setStaticAttributeNS').addStaticAttributeNS(this.expectConstructing('setStaticAttributeNS'),namespace,name,value);};ElementStack.prototype.setDynamicAttribute = function setDynamicAttribute(name,reference,isTrusting){this.expectOperations('setDynamicAttribute').addDynamicAttribute(this.expectConstructing('setDynamicAttribute'),name,reference,isTrusting);};ElementStack.prototype.setDynamicAttributeNS = function setDynamicAttributeNS(namespace,name,reference,isTrusting){this.expectOperations('setDynamicAttributeNS').addDynamicAttributeNS(this.expectConstructing('setDynamicAttributeNS'),namespace,name,reference,isTrusting);};ElementStack.prototype.closeElement = function closeElement(){this.block().closeElement();this.popElement();};return ElementStack;})();var SimpleBlockTracker=(function(){function SimpleBlockTracker(parent){this.parent = parent;this.first = null;this.last = null;this.destroyables = null;this.nesting = 0;}SimpleBlockTracker.prototype.destroy = function destroy(){var destroyables=this.destroyables;if(destroyables && destroyables.length){for(var i=0;i < destroyables.length;i++) {destroyables[i].destroy();}}};SimpleBlockTracker.prototype.parentElement = function parentElement(){return this.parent;};SimpleBlockTracker.prototype.firstNode = function firstNode(){return this.first && this.first.firstNode();};SimpleBlockTracker.prototype.lastNode = function lastNode(){return this.last && this.last.lastNode();};SimpleBlockTracker.prototype.openElement = function openElement(element){this.newNode(element);this.nesting++;};SimpleBlockTracker.prototype.closeElement = function closeElement(){this.nesting--;};SimpleBlockTracker.prototype.newNode = function newNode(node){if(this.nesting !== 0)return;if(!this.first){this.first = new First(node);}this.last = new Last(node);};SimpleBlockTracker.prototype.newBounds = function newBounds(bounds){if(this.nesting !== 0)return;if(!this.first){this.first = bounds;}this.last = bounds;};SimpleBlockTracker.prototype.newDestroyable = function newDestroyable(d){this.destroyables = this.destroyables || [];this.destroyables.push(d);};SimpleBlockTracker.prototype.finalize = function finalize(stack){if(!this.first){stack.appendComment('');}};return SimpleBlockTracker;})();var RemoteBlockTracker=(function(_SimpleBlockTracker){babelHelpers.inherits(RemoteBlockTracker,_SimpleBlockTracker);function RemoteBlockTracker(){_SimpleBlockTracker.apply(this,arguments);}RemoteBlockTracker.prototype.destroy = function destroy(){_SimpleBlockTracker.prototype.destroy.call(this);clear(this);};return RemoteBlockTracker;})(SimpleBlockTracker);var UpdatableBlockTracker=(function(_SimpleBlockTracker2){babelHelpers.inherits(UpdatableBlockTracker,_SimpleBlockTracker2);function UpdatableBlockTracker(){_SimpleBlockTracker2.apply(this,arguments);}UpdatableBlockTracker.prototype.reset = function reset(env){var destroyables=this.destroyables;if(destroyables && destroyables.length){for(var i=0;i < destroyables.length;i++) {env.didDestroy(destroyables[i]);}}var nextSibling=clear(this);this.destroyables = null;this.first = null;this.last = null;return nextSibling;};return UpdatableBlockTracker;})(SimpleBlockTracker);var BlockListTracker=(function(){function BlockListTracker(parent,boundList){this.parent = parent;this.boundList = boundList;this.parent = parent;this.boundList = boundList;}BlockListTracker.prototype.destroy = function destroy(){this.boundList.forEachNode(function(node){return node.destroy();});};BlockListTracker.prototype.parentElement = function parentElement(){return this.parent;};BlockListTracker.prototype.firstNode = function firstNode(){var head=this.boundList.head();return head && head.firstNode();};BlockListTracker.prototype.lastNode = function lastNode(){var tail=this.boundList.tail();return tail && tail.lastNode();};BlockListTracker.prototype.openElement = function openElement(_element){_glimmerUtil.assert(false,'Cannot openElement directly inside a block list');};BlockListTracker.prototype.closeElement = function closeElement(){_glimmerUtil.assert(false,'Cannot closeElement directly inside a block list');};BlockListTracker.prototype.newNode = function newNode(_node){_glimmerUtil.assert(false,'Cannot create a new node directly inside a block list');};BlockListTracker.prototype.newBounds = function newBounds(_bounds){};BlockListTracker.prototype.newDestroyable = function newDestroyable(_d){};BlockListTracker.prototype.finalize = function finalize(_stack){};return BlockListTracker;})();var CompiledValue=(function(_CompiledExpression){babelHelpers.inherits(CompiledValue,_CompiledExpression);function CompiledValue(value){_CompiledExpression.call(this);this.type = "value";this.reference = PrimitiveReference.create(value);}CompiledValue.prototype.evaluate = function evaluate(_vm){return this.reference;};CompiledValue.prototype.toJSON = function toJSON(){return JSON.stringify(this.reference.value());};return CompiledValue;})(CompiledExpression);var CompiledHasBlock=(function(_CompiledExpression2){babelHelpers.inherits(CompiledHasBlock,_CompiledExpression2);function CompiledHasBlock(inner){_CompiledExpression2.call(this);this.inner = inner;this.type = "has-block";}CompiledHasBlock.prototype.evaluate = function evaluate(vm){var block=this.inner.evaluate(vm);return PrimitiveReference.create(!!block);};CompiledHasBlock.prototype.toJSON = function toJSON(){return 'has-block(' + this.inner.toJSON() + ')';};return CompiledHasBlock;})(CompiledExpression);var CompiledHasBlockParams=(function(_CompiledExpression3){babelHelpers.inherits(CompiledHasBlockParams,_CompiledExpression3);function CompiledHasBlockParams(inner){_CompiledExpression3.call(this);this.inner = inner;this.type = "has-block-params";}CompiledHasBlockParams.prototype.evaluate = function evaluate(vm){var block=this.inner.evaluate(vm);var hasLocals=block && block.symbolTable.getSymbols().locals;return PrimitiveReference.create(!!hasLocals);};CompiledHasBlockParams.prototype.toJSON = function toJSON(){return 'has-block-params(' + this.inner.toJSON() + ')';};return CompiledHasBlockParams;})(CompiledExpression);var CompiledGetBlockBySymbol=(function(){function CompiledGetBlockBySymbol(symbol,debug){this.symbol = symbol;this.debug = debug;}CompiledGetBlockBySymbol.prototype.evaluate = function evaluate(vm){return vm.scope().getBlock(this.symbol);};CompiledGetBlockBySymbol.prototype.toJSON = function toJSON(){return 'get-block($' + this.symbol + '(' + this.debug + '))';};return CompiledGetBlockBySymbol;})();var CompiledInPartialGetBlock=(function(){function CompiledInPartialGetBlock(symbol,name){this.symbol = symbol;this.name = name;}CompiledInPartialGetBlock.prototype.evaluate = function evaluate(vm){var symbol=this.symbol;var name=this.name;var args=vm.scope().getPartialArgs(symbol);return args.blocks[name];};CompiledInPartialGetBlock.prototype.toJSON = function toJSON(){return 'get-block($' + this.symbol + '($ARGS).' + this.name + '))';};return CompiledInPartialGetBlock;})();var CompiledBlock=function CompiledBlock(start,end){this.start = start;this.end = end;};var CompiledProgram=(function(_CompiledBlock){babelHelpers.inherits(CompiledProgram,_CompiledBlock);function CompiledProgram(start,end,symbols){_CompiledBlock.call(this,start,end);this.symbols = symbols;}return CompiledProgram;})(CompiledBlock);var Labels=(function(){function Labels(){this.labels = _glimmerUtil.dict();this.jumps = [];this.ranges = [];}Labels.prototype.label = function label(name,index){this.labels[name] = index;};Labels.prototype.jump = function jump(at,Target,target){this.jumps.push({at:at,target:target,Target:Target});};Labels.prototype.range = function range(at,Range,start,end){this.ranges.push({at:at,start:start,end:end,Range:Range});};Labels.prototype.patch = function patch(opcodes){for(var i=0;i < this.jumps.length;i++) {var _jumps$i=this.jumps[i];var at=_jumps$i.at;var target=_jumps$i.target;var Target=_jumps$i.Target;opcodes.set(at,Target,this.labels[target]);}for(var i=0;i < this.ranges.length;i++) {var _ranges$i=this.ranges[i];var at=_ranges$i.at;var start=_ranges$i.start;var end=_ranges$i.end;var _Range=_ranges$i.Range;opcodes.set(at,_Range,this.labels[start],this.labels[end] - 1);}};return Labels;})();var BasicOpcodeBuilder=(function(){function BasicOpcodeBuilder(symbolTable,env,program){this.symbolTable = symbolTable;this.env = env;this.program = program;this.labelsStack = new _glimmerUtil.Stack();this.constants = env.constants;this.start = program.next;}BasicOpcodeBuilder.prototype.opcode = function opcode(name,op1,op2,op3){this.push(name,op1,op2,op3);};BasicOpcodeBuilder.prototype.push = function push(type){var op1=arguments.length <= 1 || arguments[1] === undefined?0:arguments[1];var op2=arguments.length <= 2 || arguments[2] === undefined?0:arguments[2];var op3=arguments.length <= 3 || arguments[3] === undefined?0:arguments[3];this.program.push(type,op1,op2,op3);}; // helpers +BasicOpcodeBuilder.prototype.startLabels = function startLabels(){this.labelsStack.push(new Labels());};BasicOpcodeBuilder.prototype.stopLabels = function stopLabels(){var label=_glimmerUtil.expect(this.labelsStack.pop(),'unbalanced push and pop labels');label.patch(this.program);}; // partials +BasicOpcodeBuilder.prototype.putPartialDefinition = function putPartialDefinition(_definition){var definition=this.constants.other(_definition);this.opcode(50, /* PutPartial */definition);};BasicOpcodeBuilder.prototype.putDynamicPartialDefinition = function putDynamicPartialDefinition(){this.opcode(49, /* PutDynamicPartial */this.constants.other(this.symbolTable));};BasicOpcodeBuilder.prototype.evaluatePartial = function evaluatePartial(){this.opcode(51, /* EvaluatePartial */this.constants.other(this.symbolTable),this.constants.other(_glimmerUtil.dict()));}; // components +BasicOpcodeBuilder.prototype.putComponentDefinition = function putComponentDefinition(definition){this.opcode(23, /* PutComponent */this.other(definition));};BasicOpcodeBuilder.prototype.putDynamicComponentDefinition = function putDynamicComponentDefinition(){this.opcode(22 /* PutDynamicComponent */);};BasicOpcodeBuilder.prototype.openComponent = function openComponent(args,shadow){this.opcode(24, /* OpenComponent */this.args(args),shadow?this.block(shadow):0);};BasicOpcodeBuilder.prototype.didCreateElement = function didCreateElement(){this.opcode(25 /* DidCreateElement */);};BasicOpcodeBuilder.prototype.shadowAttributes = function shadowAttributes(){this.opcode(26 /* ShadowAttributes */);this.opcode(21 /* CloseBlock */);};BasicOpcodeBuilder.prototype.didRenderLayout = function didRenderLayout(){this.opcode(27 /* DidRenderLayout */);};BasicOpcodeBuilder.prototype.closeComponent = function closeComponent(){this.opcode(28 /* CloseComponent */);}; // content +BasicOpcodeBuilder.prototype.dynamicContent = function dynamicContent(Opcode){this.opcode(31, /* DynamicContent */this.other(Opcode));};BasicOpcodeBuilder.prototype.cautiousAppend = function cautiousAppend(){this.dynamicContent(new OptimizedCautiousAppendOpcode());};BasicOpcodeBuilder.prototype.trustingAppend = function trustingAppend(){this.dynamicContent(new OptimizedTrustingAppendOpcode());};BasicOpcodeBuilder.prototype.guardedCautiousAppend = function guardedCautiousAppend(expression){this.dynamicContent(new GuardedCautiousAppendOpcode(this.compileExpression(expression),this.symbolTable));};BasicOpcodeBuilder.prototype.guardedTrustingAppend = function guardedTrustingAppend(expression){this.dynamicContent(new GuardedTrustingAppendOpcode(this.compileExpression(expression),this.symbolTable));}; // dom +BasicOpcodeBuilder.prototype.text = function text(_text){this.opcode(29, /* Text */this.constants.string(_text));};BasicOpcodeBuilder.prototype.openPrimitiveElement = function openPrimitiveElement(tag){this.opcode(32, /* OpenElement */this.constants.string(tag));};BasicOpcodeBuilder.prototype.openComponentElement = function openComponentElement(tag){this.opcode(35, /* OpenComponentElement */this.constants.string(tag));};BasicOpcodeBuilder.prototype.openDynamicPrimitiveElement = function openDynamicPrimitiveElement(){this.opcode(36 /* OpenDynamicElement */);};BasicOpcodeBuilder.prototype.flushElement = function flushElement(){this.opcode(37 /* FlushElement */);};BasicOpcodeBuilder.prototype.closeElement = function closeElement(){this.opcode(38 /* CloseElement */);};BasicOpcodeBuilder.prototype.staticAttr = function staticAttr(_name,_namespace,_value){var name=this.constants.string(_name);var namespace=_namespace?this.constants.string(_namespace):0;var value=this.constants.string(_value);this.opcode(40, /* StaticAttr */name,value,namespace);};BasicOpcodeBuilder.prototype.dynamicAttrNS = function dynamicAttrNS(_name,_namespace,trusting){var name=this.constants.string(_name);var namespace=this.constants.string(_namespace);this.opcode(42, /* DynamicAttrNS */name,namespace,trusting | 0);};BasicOpcodeBuilder.prototype.dynamicAttr = function dynamicAttr(_name,trusting){var name=this.constants.string(_name);this.opcode(43, /* DynamicAttr */name,trusting | 0);};BasicOpcodeBuilder.prototype.comment = function comment(_comment){var comment=this.constants.string(_comment);this.opcode(30, /* Comment */comment);};BasicOpcodeBuilder.prototype.modifier = function modifier(_name,_args){var args=this.constants.expression(this.compile(_args));var _modifierManager=this.env.lookupModifier(_name,this.symbolTable);var modifierManager=this.constants.other(_modifierManager);var name=this.constants.string(_name);this.opcode(41, /* Modifier */name,modifierManager,args);}; // lists +BasicOpcodeBuilder.prototype.putIterator = function putIterator(){this.opcode(44 /* PutIterator */);};BasicOpcodeBuilder.prototype.enterList = function enterList(start,end){this.push(45 /* EnterList */);this.labels.range(this.pos,45, /* EnterList */start,end);};BasicOpcodeBuilder.prototype.exitList = function exitList(){this.opcode(46 /* ExitList */);};BasicOpcodeBuilder.prototype.enterWithKey = function enterWithKey(start,end){this.push(47 /* EnterWithKey */);this.labels.range(this.pos,47, /* EnterWithKey */start,end);};BasicOpcodeBuilder.prototype.nextIter = function nextIter(end){this.push(48 /* NextIter */);this.labels.jump(this.pos,48, /* NextIter */end);}; // vm +BasicOpcodeBuilder.prototype.openBlock = function openBlock(_args,_inner){var args=this.constants.expression(this.compile(_args));var inner=this.constants.other(_inner);this.opcode(20, /* OpenBlock */inner,args);};BasicOpcodeBuilder.prototype.closeBlock = function closeBlock(){this.opcode(21 /* CloseBlock */);};BasicOpcodeBuilder.prototype.pushRemoteElement = function pushRemoteElement(){this.opcode(33 /* PushRemoteElement */);};BasicOpcodeBuilder.prototype.popRemoteElement = function popRemoteElement(){this.opcode(34 /* PopRemoteElement */);};BasicOpcodeBuilder.prototype.popElement = function popElement(){this.opcode(39 /* PopElement */);};BasicOpcodeBuilder.prototype.label = function label(name){this.labels.label(name,this.nextPos);};BasicOpcodeBuilder.prototype.pushChildScope = function pushChildScope(){this.opcode(0 /* PushChildScope */);};BasicOpcodeBuilder.prototype.popScope = function popScope(){this.opcode(1 /* PopScope */);};BasicOpcodeBuilder.prototype.pushDynamicScope = function pushDynamicScope(){this.opcode(2 /* PushDynamicScope */);};BasicOpcodeBuilder.prototype.popDynamicScope = function popDynamicScope(){this.opcode(3 /* PopDynamicScope */);};BasicOpcodeBuilder.prototype.putNull = function putNull(){this.opcode(4, /* Put */this.constants.NULL_REFERENCE);};BasicOpcodeBuilder.prototype.putValue = function putValue(_expression){var expr=this.constants.expression(this.compileExpression(_expression));this.opcode(5, /* EvaluatePut */expr);};BasicOpcodeBuilder.prototype.putArgs = function putArgs(_args){var args=this.constants.expression(this.compile(_args));this.opcode(6, /* PutArgs */args);};BasicOpcodeBuilder.prototype.bindDynamicScope = function bindDynamicScope(_names){this.opcode(12, /* BindDynamicScope */this.names(_names));};BasicOpcodeBuilder.prototype.bindPositionalArgs = function bindPositionalArgs(_names,_symbols){this.opcode(7, /* BindPositionalArgs */this.names(_names),this.symbols(_symbols));};BasicOpcodeBuilder.prototype.bindNamedArgs = function bindNamedArgs(_names,_symbols){this.opcode(8, /* BindNamedArgs */this.names(_names),this.symbols(_symbols));};BasicOpcodeBuilder.prototype.bindBlocks = function bindBlocks(_names,_symbols){this.opcode(9, /* BindBlocks */this.names(_names),this.symbols(_symbols));};BasicOpcodeBuilder.prototype.enter = function enter(_enter,exit){this.push(13 /* Enter */);this.labels.range(this.pos,13, /* Enter */_enter,exit);};BasicOpcodeBuilder.prototype.exit = function exit(){this.opcode(14 /* Exit */);};BasicOpcodeBuilder.prototype.evaluate = function evaluate(_block){var block=this.constants.block(_block);this.opcode(15, /* Evaluate */block);};BasicOpcodeBuilder.prototype.test = function test(testFunc){var _func=undefined;if(testFunc === 'const'){_func = ConstTest;}else if(testFunc === 'simple'){_func = SimpleTest;}else if(testFunc === 'environment'){_func = EnvironmentTest;}else if(typeof testFunc === 'function'){_func = testFunc;}else {throw new Error('unreachable');}var func=this.constants.function(_func);this.opcode(19, /* Test */func);};BasicOpcodeBuilder.prototype.jump = function jump(target){this.push(16 /* Jump */);this.labels.jump(this.pos,16, /* Jump */target);};BasicOpcodeBuilder.prototype.jumpIf = function jumpIf(target){this.push(17 /* JumpIf */);this.labels.jump(this.pos,17, /* JumpIf */target);};BasicOpcodeBuilder.prototype.jumpUnless = function jumpUnless(target){this.push(18 /* JumpUnless */);this.labels.jump(this.pos,18, /* JumpUnless */target);};BasicOpcodeBuilder.prototype.names = function names(_names){var _this=this;var names=_names.map(function(n){return _this.constants.string(n);});return this.constants.array(names);};BasicOpcodeBuilder.prototype.symbols = function symbols(_symbols2){return this.constants.array(_symbols2);};BasicOpcodeBuilder.prototype.other = function other(value){return this.constants.other(value);};BasicOpcodeBuilder.prototype.args = function args(_args2){return this.constants.expression(this.compile(_args2));};BasicOpcodeBuilder.prototype.block = function block(_block3){return this.constants.block(_block3);};babelHelpers.createClass(BasicOpcodeBuilder,[{key:'end',get:function(){return this.program.next;}},{key:'pos',get:function(){return this.program.current;}},{key:'nextPos',get:function(){return this.program.next;}},{key:'labels',get:function(){return _glimmerUtil.expect(this.labelsStack.current,'bug: not in a label stack');}}]);return BasicOpcodeBuilder;})();function isCompilableExpression(expr){return expr && typeof expr['compile'] === 'function';}var OpcodeBuilder=(function(_BasicOpcodeBuilder){babelHelpers.inherits(OpcodeBuilder,_BasicOpcodeBuilder);function OpcodeBuilder(symbolTable,env){var program=arguments.length <= 2 || arguments[2] === undefined?env.program:arguments[2];return (function(){_BasicOpcodeBuilder.call(this,symbolTable,env,program);this.component = new ComponentBuilder(this);}).apply(this,arguments);}OpcodeBuilder.prototype.compile = function compile(expr){if(isCompilableExpression(expr)){return expr.compile(this);}else {return expr;}};OpcodeBuilder.prototype.compileExpression = function compileExpression(expression){if(expression instanceof CompiledExpression){return expression;}else {return expr(expression,this);}};OpcodeBuilder.prototype.bindPositionalArgsForLocals = function bindPositionalArgsForLocals(locals){var names=Object.keys(locals);var symbols=new Array(names.length); //Object.keys(locals).map(name => locals[name]); +for(var i=0;i < names.length;i++) {symbols[i] = locals[names[i]];}this.opcode(7, /* BindPositionalArgs */this.symbols(symbols));};OpcodeBuilder.prototype.preludeForLayout = function preludeForLayout(layout){var _this2=this;var symbols=layout.symbolTable.getSymbols();if(symbols.named){(function(){var named=symbols.named;var namedNames=Object.keys(named);var namedSymbols=namedNames.map(function(n){return named[n];});_this2.opcode(8, /* BindNamedArgs */_this2.names(namedNames),_this2.symbols(namedSymbols));})();}this.opcode(11 /* BindCallerScope */);if(symbols.yields){(function(){var yields=symbols.yields;var yieldNames=Object.keys(yields);var yieldSymbols=yieldNames.map(function(n){return yields[n];});_this2.opcode(9, /* BindBlocks */_this2.names(yieldNames),_this2.symbols(yieldSymbols));})();}if(symbols.partialArgs){this.opcode(10, /* BindPartialArgs */symbols.partialArgs);}};OpcodeBuilder.prototype.yield = function _yield(args,to){var yields=undefined,partial=undefined;var inner=undefined;if(yields = this.symbolTable.getSymbol('yields',to)){inner = new CompiledGetBlockBySymbol(yields,to);}else if(partial = this.symbolTable.getPartialArgs()){inner = new CompiledInPartialGetBlock(partial,to);}else {throw new Error('[BUG] ${to} is not a valid block name.');}this.openBlock(args,inner);this.closeBlock();}; // TODO +// come back to this +OpcodeBuilder.prototype.labelled = function labelled(args,callback){if(args)this.putArgs(args);this.startLabels();this.enter('BEGIN','END');this.label('BEGIN');callback(this,'BEGIN','END');this.label('END');this.exit();this.stopLabels();}; // TODO +// come back to this +OpcodeBuilder.prototype.iter = function iter(callback){this.startLabels();this.enterList('BEGIN','END');this.label('ITER');this.nextIter('BREAK');this.enterWithKey('BEGIN','END');this.label('BEGIN');callback(this,'BEGIN','END');this.label('END');this.exit();this.jump('ITER');this.label('BREAK');this.exitList();this.stopLabels();}; // TODO +// come back to this +OpcodeBuilder.prototype.unit = function unit(callback){this.startLabels();callback(this);this.stopLabels();};return OpcodeBuilder;})(BasicOpcodeBuilder);function compileLayout(compilable,env){var builder=new ComponentLayoutBuilder(env);compilable.compile(builder);return builder.compile();}var ComponentLayoutBuilder=(function(){function ComponentLayoutBuilder(env){this.env = env;}ComponentLayoutBuilder.prototype.wrapLayout = function wrapLayout(layout){this.inner = new WrappedBuilder(this.env,layout);};ComponentLayoutBuilder.prototype.fromLayout = function fromLayout(layout){this.inner = new UnwrappedBuilder(this.env,layout);};ComponentLayoutBuilder.prototype.compile = function compile(){return this.inner.compile();};babelHelpers.createClass(ComponentLayoutBuilder,[{key:'tag',get:function(){return this.inner.tag;}},{key:'attrs',get:function(){return this.inner.attrs;}}]);return ComponentLayoutBuilder;})();var WrappedBuilder=(function(){function WrappedBuilder(env,layout){this.env = env;this.layout = layout;this.tag = new ComponentTagBuilder();this.attrs = new ComponentAttrsBuilder();}WrappedBuilder.prototype.compile = function compile(){ //========DYNAMIC +// PutValue(TagExpr) +// Test +// JumpUnless(BODY) +// OpenDynamicPrimitiveElement +// DidCreateElement +// ...attr statements... +// FlushElement +// BODY: Noop +// ...body statements... +// PutValue(TagExpr) +// Test +// JumpUnless(END) +// CloseElement +// END: Noop +// DidRenderLayout +// Exit +// +//========STATIC +// OpenPrimitiveElementOpcode +// DidCreateElement +// ...attr statements... +// FlushElement +// ...body statements... +// CloseElement +// DidRenderLayout +// Exit +var env=this.env;var layout=this.layout;var symbolTable=layout.symbolTable;var b=builder(env,layout.symbolTable);b.startLabels();var dynamicTag=this.tag.getDynamic();var staticTag=undefined;if(dynamicTag){b.putValue(dynamicTag);b.test('simple');b.jumpUnless('BODY');b.openDynamicPrimitiveElement();b.didCreateElement();this.attrs['buffer'].forEach(function(statement){return compileStatement(statement,b);});b.flushElement();b.label('BODY');}else if(staticTag = this.tag.getStatic()){b.openPrimitiveElement(staticTag);b.didCreateElement();this.attrs['buffer'].forEach(function(statement){return compileStatement(statement,b);});b.flushElement();}b.preludeForLayout(layout);layout.statements.forEach(function(statement){return compileStatement(statement,b);});if(dynamicTag){b.putValue(dynamicTag);b.test('simple');b.jumpUnless('END');b.closeElement();b.label('END');}else if(staticTag){b.closeElement();}b.didRenderLayout();b.stopLabels();return new CompiledProgram(b.start,b.end,symbolTable.size);};return WrappedBuilder;})();function isOpenElement(value){var type=value[0];return type === _glimmerWireFormat.Ops.OpenElement || type === _glimmerWireFormat.Ops.OpenPrimitiveElement;}var UnwrappedBuilder=(function(){function UnwrappedBuilder(env,layout){this.env = env;this.layout = layout;this.attrs = new ComponentAttrsBuilder();}UnwrappedBuilder.prototype.compile = function compile(){var env=this.env;var layout=this.layout;var b=builder(env,layout.symbolTable);b.startLabels();b.preludeForLayout(layout);var attrs=this.attrs['buffer'];var attrsInserted=false;for(var i=0;i < layout.statements.length;i++) {var statement=layout.statements[i];if(!attrsInserted && isOpenElement(statement)){b.openComponentElement(statement[1]);b.didCreateElement();b.shadowAttributes();attrs.forEach(function(statement){return compileStatement(statement,b);});attrsInserted = true;}else {compileStatement(statement,b);}}b.didRenderLayout();b.stopLabels();return new CompiledProgram(b.start,b.end,layout.symbolTable.size);};babelHelpers.createClass(UnwrappedBuilder,[{key:'tag',get:function(){throw new Error('BUG: Cannot call `tag` on an UnwrappedBuilder');}}]);return UnwrappedBuilder;})();var ComponentTagBuilder=(function(){function ComponentTagBuilder(){this.isDynamic = null;this.isStatic = null;this.staticTagName = null;this.dynamicTagName = null;}ComponentTagBuilder.prototype.getDynamic = function getDynamic(){if(this.isDynamic){return this.dynamicTagName;}};ComponentTagBuilder.prototype.getStatic = function getStatic(){if(this.isStatic){return this.staticTagName;}};ComponentTagBuilder.prototype.static = function _static(tagName){this.isStatic = true;this.staticTagName = tagName;};ComponentTagBuilder.prototype.dynamic = function dynamic(tagName){this.isDynamic = true;this.dynamicTagName = [_glimmerWireFormat.Ops.Function,tagName];};return ComponentTagBuilder;})();var ComponentAttrsBuilder=(function(){function ComponentAttrsBuilder(){this.buffer = [];}ComponentAttrsBuilder.prototype.static = function _static(name,value){this.buffer.push([_glimmerWireFormat.Ops.StaticAttr,name,value,null]);};ComponentAttrsBuilder.prototype.dynamic = function dynamic(name,value){this.buffer.push([_glimmerWireFormat.Ops.DynamicAttr,name,[_glimmerWireFormat.Ops.Function,value],null]);};return ComponentAttrsBuilder;})();var ComponentBuilder=(function(){function ComponentBuilder(builder){this.builder = builder;this.env = builder.env;}ComponentBuilder.prototype.static = function _static(definition,args,_symbolTable,shadow){this.builder.unit(function(b){b.putComponentDefinition(definition);b.openComponent(compileBaselineArgs(args,b),shadow);b.closeComponent();});};ComponentBuilder.prototype.dynamic = function dynamic(definitionArgs,definition,args,_symbolTable,shadow){this.builder.unit(function(b){b.putArgs(compileArgs(definitionArgs[0],definitionArgs[1],b));b.putValue([_glimmerWireFormat.Ops.Function,definition]);b.test('simple');b.enter('BEGIN','END');b.label('BEGIN');b.jumpUnless('END');b.putDynamicComponentDefinition();b.openComponent(compileBaselineArgs(args,b),shadow);b.closeComponent();b.label('END');b.exit();});};return ComponentBuilder;})();function builder(env,symbolTable){return new OpcodeBuilder(symbolTable,env);}function entryPoint(meta){return new ProgramSymbolTable(meta);}function layout(meta,wireNamed,wireYields,hasPartials){var _symbols3=symbols(wireNamed,wireYields,hasPartials);var named=_symbols3.named;var yields=_symbols3.yields;var partialSymbol=_symbols3.partialSymbol;var size=_symbols3.size;return new ProgramSymbolTable(meta,named,yields,partialSymbol,size);}function block(parent,locals){var localsMap=null;var program=parent['program'];if(locals.length !== 0){(function(){var map=localsMap = _glimmerUtil.dict();locals.forEach(function(l){return map[l] = program.size++;});})();}return new BlockSymbolTable(parent,program,localsMap);}function symbols(named,yields,hasPartials){var yieldsMap=null;var namedMap=null;var size=1;if(yields.length !== 0){(function(){var map=yieldsMap = _glimmerUtil.dict();yields.forEach(function(y){return map[y] = size++;});})();}if(named.length !== 0){(function(){var map=namedMap = _glimmerUtil.dict();named.forEach(function(y){return map[y] = size++;});})();}var partialSymbol=hasPartials?size++:null;return {named:namedMap,yields:yieldsMap,partialSymbol:partialSymbol,size:size};}var ProgramSymbolTable=(function(){function ProgramSymbolTable(meta){var named=arguments.length <= 1 || arguments[1] === undefined?null:arguments[1];var yields=arguments.length <= 2 || arguments[2] === undefined?null:arguments[2];var partialArgs=arguments.length <= 3 || arguments[3] === undefined?null:arguments[3];var size=arguments.length <= 4 || arguments[4] === undefined?1:arguments[4];this.meta = meta;this.named = named;this.yields = yields;this.partialArgs = partialArgs;this.size = size;this.program = this;}ProgramSymbolTable.prototype.getMeta = function getMeta(){return this.meta;};ProgramSymbolTable.prototype.getSymbols = function getSymbols(){return {named:this.named,yields:this.yields,locals:null,partialArgs:this.partialArgs};};ProgramSymbolTable.prototype.getSymbol = function getSymbol(kind,name){if(kind === 'local')return null;return this[kind] && this[kind][name];};ProgramSymbolTable.prototype.getPartialArgs = function getPartialArgs(){return this.partialArgs || 0;};return ProgramSymbolTable;})();var BlockSymbolTable=(function(){function BlockSymbolTable(parent,program,locals){this.parent = parent;this.program = program;this.locals = locals;}BlockSymbolTable.prototype.getMeta = function getMeta(){return this.program.getMeta();};BlockSymbolTable.prototype.getSymbols = function getSymbols(){return {named:null,yields:null,locals:this.locals,partialArgs:null};};BlockSymbolTable.prototype.getSymbol = function getSymbol(kind,name){if(kind === 'local'){return this.getLocal(name);}else {return this.program.getSymbol(kind,name);}};BlockSymbolTable.prototype.getLocal = function getLocal(name){var locals=this.locals;var parent=this.parent;var symbol=locals && locals[name];if(!symbol && parent){symbol = parent.getSymbol('local',name);}return symbol;};BlockSymbolTable.prototype.getPartialArgs = function getPartialArgs(){return this.program.getPartialArgs();};return BlockSymbolTable;})();var Specialize=(function(){function Specialize(){this.names = _glimmerUtil.dict();this.funcs = [];}Specialize.prototype.add = function add(name,func){this.funcs.push(func);this.names[name] = this.funcs.length - 1;};Specialize.prototype.specialize = function specialize(sexp,table){var name=sexp[0];var index=this.names[name];if(index === undefined)return sexp;var func=this.funcs[index];_glimmerUtil.assert(!!func,'expected a specialization for ' + sexp[0]);return func(sexp,table);};return Specialize;})();var SPECIALIZE=new Specialize();var E=_glimmerWireFormat.Expressions;var Ops$3=_glimmerWireFormat.Ops;SPECIALIZE.add(Ops$3.Append,function(sexp,_symbolTable){var expression=sexp[1];if(Array.isArray(expression) && E.isGet(expression)){var path=expression[1];if(path.length !== 1){return [Ops$3.UnoptimizedAppend,sexp[1],sexp[2]];}}return [Ops$3.OptimizedAppend,sexp[1],sexp[2]];});SPECIALIZE.add(Ops$3.DynamicAttr,function(sexp,_symbolTable){return [Ops$3.AnyDynamicAttr,sexp[1],sexp[2],sexp[3],false];});SPECIALIZE.add(Ops$3.TrustingAttr,function(sexp,_symbolTable){return [Ops$3.AnyDynamicAttr,sexp[1],sexp[2],sexp[3],true];});SPECIALIZE.add(Ops$3.Partial,function(sexp,_table){var expression=sexp[1];if(typeof expression === 'string'){return [Ops$3.StaticPartial,expression];}else {return [Ops$3.DynamicPartial,expression];}});function compileStatement(statement,builder){var refined=SPECIALIZE.specialize(statement,builder.symbolTable);STATEMENTS.compile(refined,builder);}var Template=function Template(statements,symbolTable){this.statements = statements;this.symbolTable = symbolTable;};var Layout=(function(_Template){babelHelpers.inherits(Layout,_Template);function Layout(){_Template.apply(this,arguments);}return Layout;})(Template);var EntryPoint=(function(_Template2){babelHelpers.inherits(EntryPoint,_Template2);function EntryPoint(){_Template2.apply(this,arguments);this.compiled = null;}EntryPoint.prototype.compile = function compile(env){var compiled=this.compiled;if(!compiled){var table=this.symbolTable;var b=builder(env,table);for(var i=0;i < this.statements.length;i++) {var statement=this.statements[i];var refined=SPECIALIZE.specialize(statement,table);STATEMENTS.compile(refined,b);}compiled = this.compiled = new CompiledProgram(b.start,b.end,this.symbolTable.size);}return compiled;};return EntryPoint;})(Template);var InlineBlock=(function(_Template3){babelHelpers.inherits(InlineBlock,_Template3);function InlineBlock(){_Template3.apply(this,arguments);this.compiled = null;}InlineBlock.prototype.splat = function splat(builder){var table=builder.symbolTable;var locals=table.getSymbols().locals;if(locals){builder.pushChildScope();builder.bindPositionalArgsForLocals(locals);}for(var i=0;i < this.statements.length;i++) {var statement=this.statements[i];var refined=SPECIALIZE.specialize(statement,table);STATEMENTS.compile(refined,builder);}if(locals){builder.popScope();}};InlineBlock.prototype.compile = function compile(env){var compiled=this.compiled;if(!compiled){var table=this.symbolTable;var b=builder(env,table);this.splat(b);compiled = this.compiled = new CompiledBlock(b.start,b.end);}return compiled;};return InlineBlock;})(Template);var PartialBlock=(function(_Template4){babelHelpers.inherits(PartialBlock,_Template4);function PartialBlock(){_Template4.apply(this,arguments);this.compiled = null;}PartialBlock.prototype.compile = function compile(env){var compiled=this.compiled;if(!compiled){var table=this.symbolTable;var b=builder(env,table);for(var i=0;i < this.statements.length;i++) {var statement=this.statements[i];var refined=SPECIALIZE.specialize(statement,table);STATEMENTS.compile(refined,b);}compiled = this.compiled = new CompiledProgram(b.start,b.end,table.size);}return compiled;};return PartialBlock;})(Template);var Scanner=(function(){function Scanner(block,meta,env){this.block = block;this.meta = meta;this.env = env;}Scanner.prototype.scanEntryPoint = function scanEntryPoint(){var block=this.block;var meta=this.meta;var symbolTable=entryPoint(meta);var child=scanBlock(block,symbolTable,this.env);return new EntryPoint(child.statements,symbolTable);};Scanner.prototype.scanLayout = function scanLayout(){var block=this.block;var meta=this.meta;var named=block.named;var yields=block.yields;var hasPartials=block.hasPartials;var symbolTable=layout(meta,named,yields,hasPartials);var child=scanBlock(block,symbolTable,this.env);return new Layout(child.statements,symbolTable);};Scanner.prototype.scanPartial = function scanPartial(symbolTable){var block=this.block;var child=scanBlock(block,symbolTable,this.env);return new PartialBlock(child.statements,symbolTable);};return Scanner;})();function scanBlock(_ref26,symbolTable,env){var statements=_ref26.statements;return new RawInlineBlock(env,symbolTable,statements).scan();}var BaselineSyntax;(function(BaselineSyntax){var Ops=_glimmerWireFormat.Ops;BaselineSyntax.isScannedComponent = _glimmerWireFormat.is(Ops.ScannedComponent);BaselineSyntax.isPrimitiveElement = _glimmerWireFormat.is(Ops.OpenPrimitiveElement);BaselineSyntax.isOptimizedAppend = _glimmerWireFormat.is(Ops.OptimizedAppend);BaselineSyntax.isUnoptimizedAppend = _glimmerWireFormat.is(Ops.UnoptimizedAppend);BaselineSyntax.isAnyAttr = _glimmerWireFormat.is(Ops.AnyDynamicAttr);BaselineSyntax.isStaticPartial = _glimmerWireFormat.is(Ops.StaticPartial);BaselineSyntax.isDynamicPartial = _glimmerWireFormat.is(Ops.DynamicPartial);BaselineSyntax.isFunctionExpression = _glimmerWireFormat.is(Ops.Function);BaselineSyntax.isNestedBlock = _glimmerWireFormat.is(Ops.NestedBlock);BaselineSyntax.isScannedBlock = _glimmerWireFormat.is(Ops.ScannedBlock);BaselineSyntax.isDebugger = _glimmerWireFormat.is(Ops.Debugger);var NestedBlock;(function(NestedBlock){function defaultBlock(sexp){return sexp[4];}NestedBlock.defaultBlock = defaultBlock;function inverseBlock(sexp){return sexp[5];}NestedBlock.inverseBlock = inverseBlock;function params(sexp){return sexp[2];}NestedBlock.params = params;function hash(sexp){return sexp[3];}NestedBlock.hash = hash;})(NestedBlock = BaselineSyntax.NestedBlock || (BaselineSyntax.NestedBlock = {}));})(BaselineSyntax || (exports.BaselineSyntax = BaselineSyntax = {}));var Ops$2=_glimmerWireFormat.Ops;var RawInlineBlock=(function(){function RawInlineBlock(env,table,statements){this.env = env;this.table = table;this.statements = statements;}RawInlineBlock.prototype.scan = function scan(){var buffer=[];for(var i=0;i < this.statements.length;i++) {var statement=this.statements[i];if(_glimmerWireFormat.Statements.isBlock(statement)){buffer.push(this.specializeBlock(statement));}else if(_glimmerWireFormat.Statements.isComponent(statement)){buffer.push.apply(buffer,this.specializeComponent(statement));}else {buffer.push(statement);}}return new InlineBlock(buffer,this.table);};RawInlineBlock.prototype.specializeBlock = function specializeBlock(block$$){var path=block$$[1];var params=block$$[2];var hash=block$$[3];var template=block$$[4];var inverse=block$$[5];return [Ops$2.ScannedBlock,path,params,hash,this.child(template),this.child(inverse)];};RawInlineBlock.prototype.specializeComponent = function specializeComponent(sexp){var tag=sexp[1];var component=sexp[2];if(this.env.hasComponentDefinition(tag,this.table)){var child=this.child(component);var attrs=new RawInlineBlock(this.env,this.table,component.attrs);return [[Ops$2.ScannedComponent,tag,attrs,component.args,child]];}else {var buf=[];buf.push([Ops$2.OpenElement,tag,[]]);buf.push.apply(buf,component.attrs);buf.push([Ops$2.FlushElement]);buf.push.apply(buf,component.statements);buf.push([Ops$2.CloseElement]);return buf;}};RawInlineBlock.prototype.child = function child(block$$){if(!block$$)return null;var table=block(this.table,block$$.locals);return new RawInlineBlock(this.env,table,block$$.statements);};return RawInlineBlock;})();var CompiledLookup=(function(_CompiledExpression4){babelHelpers.inherits(CompiledLookup,_CompiledExpression4);function CompiledLookup(base,path){_CompiledExpression4.call(this);this.base = base;this.path = path;this.type = "lookup";}CompiledLookup.create = function create(base,path){if(path.length === 0){return base;}else {return new this(base,path);}};CompiledLookup.prototype.evaluate = function evaluate(vm){var base=this.base;var path=this.path;return _glimmerReference.referenceFromParts(base.evaluate(vm),path);};CompiledLookup.prototype.toJSON = function toJSON(){return this.base.toJSON() + '.' + this.path.join('.');};return CompiledLookup;})(CompiledExpression);var CompiledSelf=(function(_CompiledExpression5){babelHelpers.inherits(CompiledSelf,_CompiledExpression5);function CompiledSelf(){_CompiledExpression5.apply(this,arguments);}CompiledSelf.prototype.evaluate = function evaluate(vm){return vm.getSelf();};CompiledSelf.prototype.toJSON = function toJSON(){return 'self';};return CompiledSelf;})(CompiledExpression);var CompiledSymbol=(function(_CompiledExpression6){babelHelpers.inherits(CompiledSymbol,_CompiledExpression6);function CompiledSymbol(symbol,debug){_CompiledExpression6.call(this);this.symbol = symbol;this.debug = debug;}CompiledSymbol.prototype.evaluate = function evaluate(vm){return vm.referenceForSymbol(this.symbol);};CompiledSymbol.prototype.toJSON = function toJSON(){return '$' + this.symbol + '(' + this.debug + ')';};return CompiledSymbol;})(CompiledExpression);var CompiledInPartialName=(function(_CompiledExpression7){babelHelpers.inherits(CompiledInPartialName,_CompiledExpression7);function CompiledInPartialName(symbol,name){_CompiledExpression7.call(this);this.symbol = symbol;this.name = name;}CompiledInPartialName.prototype.evaluate = function evaluate(vm){var symbol=this.symbol;var name=this.name;var args=vm.scope().getPartialArgs(symbol);return args.named.get(name);};CompiledInPartialName.prototype.toJSON = function toJSON(){return '$' + this.symbol + '($ARGS).' + this.name;};return CompiledInPartialName;})(CompiledExpression);var CompiledHelper=(function(_CompiledExpression8){babelHelpers.inherits(CompiledHelper,_CompiledExpression8);function CompiledHelper(name,helper,args,symbolTable){_CompiledExpression8.call(this);this.name = name;this.helper = helper;this.args = args;this.symbolTable = symbolTable;this.type = "helper";}CompiledHelper.prototype.evaluate = function evaluate(vm){var helper=this.helper;return helper(vm,this.args.evaluate(vm),this.symbolTable);};CompiledHelper.prototype.toJSON = function toJSON(){return '`' + this.name + '($ARGS)`';};return CompiledHelper;})(CompiledExpression);var CompiledConcat=(function(){function CompiledConcat(parts){this.parts = parts;this.type = "concat";}CompiledConcat.prototype.evaluate = function evaluate(vm){var parts=new Array(this.parts.length);for(var i=0;i < this.parts.length;i++) {parts[i] = this.parts[i].evaluate(vm);}return new ConcatReference(parts);};CompiledConcat.prototype.toJSON = function toJSON(){return 'concat(' + this.parts.map(function(expr){return expr.toJSON();}).join(", ") + ')';};return CompiledConcat;})();var ConcatReference=(function(_CachedReference2){babelHelpers.inherits(ConcatReference,_CachedReference2);function ConcatReference(parts){_CachedReference2.call(this);this.parts = parts;this.tag = _glimmerReference.combineTagged(parts);}ConcatReference.prototype.compute = function compute(){var parts=new Array();for(var i=0;i < this.parts.length;i++) {var value=this.parts[i].value();if(value !== null && value !== undefined){parts[i] = castToString(value);}}if(parts.length > 0){return parts.join('');}return null;};return ConcatReference;})(_glimmerReference.CachedReference);function castToString(value){if(typeof value['toString'] !== 'function'){return '';}return String(value);}var CompiledFunctionExpression=(function(_CompiledExpression9){babelHelpers.inherits(CompiledFunctionExpression,_CompiledExpression9);function CompiledFunctionExpression(func,symbolTable){_CompiledExpression9.call(this);this.func = func;this.symbolTable = symbolTable;this.type = "function";this.func = func;}CompiledFunctionExpression.prototype.evaluate = function evaluate(vm){var func=this.func;var symbolTable=this.symbolTable;return func(vm,symbolTable);};CompiledFunctionExpression.prototype.toJSON = function toJSON(){var func=this.func;if(func.name){return '`' + func.name + '(...)`';}else {return "`func(...)`";}};return CompiledFunctionExpression;})(CompiledExpression);var _BaselineSyntax$NestedBlock=BaselineSyntax.NestedBlock;var defaultBlock=_BaselineSyntax$NestedBlock.defaultBlock;var params=_BaselineSyntax$NestedBlock.params;var hash=_BaselineSyntax$NestedBlock.hash;function debugCallback(context,get){console.info('Use `context`, and `get(<path>)` to debug this template.'); /* tslint:disable */debugger; /* tslint:enable */return {context:context,get:get};}function getter(vm,builder){return function(path){var parts=path.split('.');if(parts[0] === 'this'){parts[0] = null;}return compileRef(parts,builder).evaluate(vm);};}var callback=debugCallback; // For testing purposes +function setDebuggerCallback(cb){callback = cb;}function resetDebuggerCallback(){callback = debugCallback;}var Compilers=(function(){function Compilers(){this.names = _glimmerUtil.dict();this.funcs = [];}Compilers.prototype.add = function add(name,func){this.funcs.push(func);this.names[name] = this.funcs.length - 1;};Compilers.prototype.compile = function compile(sexp,builder){var name=sexp[0];var index=this.names[name];var func=this.funcs[index];_glimmerUtil.assert(!!func,'expected an implementation for ' + sexp[0]);return func(sexp,builder);};return Compilers;})();var Ops$1=_glimmerWireFormat.Ops;var STATEMENTS=new Compilers();STATEMENTS.add(Ops$1.Text,function(sexp,builder){builder.text(sexp[1]);});STATEMENTS.add(Ops$1.Comment,function(sexp,builder){builder.comment(sexp[1]);});STATEMENTS.add(Ops$1.CloseElement,function(_sexp,builder){_glimmerUtil.LOGGER.trace('close-element statement');builder.closeElement();});STATEMENTS.add(Ops$1.FlushElement,function(_sexp,builder){builder.flushElement();});STATEMENTS.add(Ops$1.Modifier,function(sexp,builder){var path=sexp[1];var params=sexp[2];var hash=sexp[3];var args=compileArgs(params,hash,builder);if(builder.env.hasModifier(path[0],builder.symbolTable)){builder.modifier(path[0],args);}else {throw new Error('Compile Error ' + path.join('.') + ' is not a modifier: Helpers may not be used in the element form.');}});STATEMENTS.add(Ops$1.StaticAttr,function(sexp,builder){var name=sexp[1];var value=sexp[2];var namespace=sexp[3];builder.staticAttr(name,namespace,value);});STATEMENTS.add(Ops$1.AnyDynamicAttr,function(sexp,builder){var name=sexp[1];var value=sexp[2];var namespace=sexp[3];var trusting=sexp[4];builder.putValue(value);if(namespace){builder.dynamicAttrNS(name,namespace,trusting);}else {builder.dynamicAttr(name,trusting);}});STATEMENTS.add(Ops$1.OpenElement,function(sexp,builder){_glimmerUtil.LOGGER.trace('open-element statement');builder.openPrimitiveElement(sexp[1]);});STATEMENTS.add(Ops$1.OptimizedAppend,function(sexp,builder){var value=sexp[1];var trustingMorph=sexp[2];var _builder$env$macros=builder.env.macros();var inlines=_builder$env$macros.inlines;var returned=inlines.compile(sexp,builder) || value;if(returned === true)return;builder.putValue(returned[1]);if(trustingMorph){builder.trustingAppend();}else {builder.cautiousAppend();}});STATEMENTS.add(Ops$1.UnoptimizedAppend,function(sexp,builder){var value=sexp[1];var trustingMorph=sexp[2];var _builder$env$macros2=builder.env.macros();var inlines=_builder$env$macros2.inlines;var returned=inlines.compile(sexp,builder) || value;if(returned === true)return;if(trustingMorph){builder.guardedTrustingAppend(returned[1]);}else {builder.guardedCautiousAppend(returned[1]);}});STATEMENTS.add(Ops$1.NestedBlock,function(sexp,builder){var _builder$env$macros3=builder.env.macros();var blocks=_builder$env$macros3.blocks;blocks.compile(sexp,builder);});STATEMENTS.add(Ops$1.ScannedBlock,function(sexp,builder){var path=sexp[1];var params=sexp[2];var hash=sexp[3];var template=sexp[4];var inverse=sexp[5];var templateBlock=template && template.scan();var inverseBlock=inverse && inverse.scan();var _builder$env$macros4=builder.env.macros();var blocks=_builder$env$macros4.blocks;blocks.compile([Ops$1.NestedBlock,path,params,hash,templateBlock,inverseBlock],builder);});STATEMENTS.add(Ops$1.ScannedComponent,function(sexp,builder){var tag=sexp[1];var attrs=sexp[2];var rawArgs=sexp[3];var rawBlock=sexp[4];var block=rawBlock && rawBlock.scan();var args=compileBlockArgs(null,rawArgs,{default:block,inverse:null},builder);var definition=builder.env.getComponentDefinition(tag,builder.symbolTable);builder.putComponentDefinition(definition);builder.openComponent(args,attrs.scan());builder.closeComponent();});STATEMENTS.add(Ops$1.StaticPartial,function(sexp,builder){var name=sexp[1];if(!builder.env.hasPartial(name,builder.symbolTable)){throw new Error('Compile Error: Could not find a partial named "' + name + '"');}var definition=builder.env.lookupPartial(name,builder.symbolTable);builder.putPartialDefinition(definition);builder.evaluatePartial();});STATEMENTS.add(Ops$1.DynamicPartial,function(sexp,builder){var name=sexp[1];builder.startLabels();builder.putValue(name);builder.test('simple');builder.enter('BEGIN','END');builder.label('BEGIN');builder.jumpUnless('END');builder.putDynamicPartialDefinition();builder.evaluatePartial();builder.label('END');builder.exit();builder.stopLabels();});STATEMENTS.add(Ops$1.Yield,function(sexp,builder){var to=sexp[1];var params=sexp[2];var args=compileArgs(params,null,builder);builder.yield(args,to);});STATEMENTS.add(Ops$1.Debugger,function(sexp,builder){builder.putValue([Ops$1.Function,function(vm){var context=vm.getSelf().value();var get=function(path){return getter(vm,builder)(path).value();};callback(context,get);}]);return sexp;});var EXPRESSIONS=new Compilers();function expr(expression,builder){if(Array.isArray(expression)){return EXPRESSIONS.compile(expression,builder);}else {return new CompiledValue(expression);}}EXPRESSIONS.add(Ops$1.Unknown,function(sexp,builder){var path=sexp[1];var name=path[0];if(builder.env.hasHelper(name,builder.symbolTable)){return new CompiledHelper(name,builder.env.lookupHelper(name,builder.symbolTable),CompiledArgs.empty(),builder.symbolTable);}else {return compileRef(path,builder);}});EXPRESSIONS.add(Ops$1.Concat,function(sexp,builder){var params=sexp[1].map(function(p){return expr(p,builder);});return new CompiledConcat(params);});EXPRESSIONS.add(Ops$1.Function,function(sexp,builder){return new CompiledFunctionExpression(sexp[1],builder.symbolTable);});EXPRESSIONS.add(Ops$1.Helper,function(sexp,builder){var env=builder.env;var symbolTable=builder.symbolTable;var _sexp$1=sexp[1];var name=_sexp$1[0];var params=sexp[2];var hash=sexp[3];if(env.hasHelper(name,symbolTable)){var args=compileArgs(params,hash,builder);return new CompiledHelper(name,env.lookupHelper(name,symbolTable),args,symbolTable);}else {throw new Error('Compile Error: ' + name + ' is not a helper');}});EXPRESSIONS.add(Ops$1.Get,function(sexp,builder){return compileRef(sexp[1],builder);});EXPRESSIONS.add(Ops$1.Undefined,function(_sexp,_builder){return new CompiledValue(undefined);});EXPRESSIONS.add(Ops$1.Arg,function(sexp,builder){var parts=sexp[1];var head=parts[0];var named=undefined,partial=undefined;if(named = builder.symbolTable.getSymbol('named',head)){var path=parts.slice(1);var inner=new CompiledSymbol(named,head);return CompiledLookup.create(inner,path);}else if(partial = builder.symbolTable.getPartialArgs()){var path=parts.slice(1);var inner=new CompiledInPartialName(partial,head);return CompiledLookup.create(inner,path);}else {throw new Error('[BUG] @' + parts.join('.') + ' is not a valid lookup path.');}});EXPRESSIONS.add(Ops$1.HasBlock,function(sexp,builder){var blockName=sexp[1];var yields=undefined,partial=undefined;if(yields = builder.symbolTable.getSymbol('yields',blockName)){var inner=new CompiledGetBlockBySymbol(yields,blockName);return new CompiledHasBlock(inner);}else if(partial = builder.symbolTable.getPartialArgs()){var inner=new CompiledInPartialGetBlock(partial,blockName);return new CompiledHasBlock(inner);}else {throw new Error('[BUG] ${blockName} is not a valid block name.');}});EXPRESSIONS.add(Ops$1.HasBlockParams,function(sexp,builder){var blockName=sexp[1];var yields=undefined,partial=undefined;if(yields = builder.symbolTable.getSymbol('yields',blockName)){var inner=new CompiledGetBlockBySymbol(yields,blockName);return new CompiledHasBlockParams(inner);}else if(partial = builder.symbolTable.getPartialArgs()){var inner=new CompiledInPartialGetBlock(partial,blockName);return new CompiledHasBlockParams(inner);}else {throw new Error('[BUG] ${blockName} is not a valid block name.');}});function compileArgs(params,hash,builder){var compiledParams=compileParams(params,builder);var compiledHash=compileHash(hash,builder);return CompiledArgs.create(compiledParams,compiledHash,EMPTY_BLOCKS);}function compileBlockArgs(params,hash,blocks,builder){var compiledParams=compileParams(params,builder);var compiledHash=compileHash(hash,builder);return CompiledArgs.create(compiledParams,compiledHash,blocks);}function compileBaselineArgs(args,builder){var params=args[0];var hash=args[1];var _default=args[2];var inverse=args[3];return CompiledArgs.create(compileParams(params,builder),compileHash(hash,builder),{default:_default,inverse:inverse});}function compileParams(params,builder){if(!params || params.length === 0)return COMPILED_EMPTY_POSITIONAL_ARGS;var compiled=new Array(params.length);for(var i=0;i < params.length;i++) {compiled[i] = expr(params[i],builder);}return CompiledPositionalArgs.create(compiled);}function compileHash(hash,builder){if(!hash)return COMPILED_EMPTY_NAMED_ARGS;var keys=hash[0];var values=hash[1];if(keys.length === 0)return COMPILED_EMPTY_NAMED_ARGS;var compiled=new Array(values.length);for(var i=0;i < values.length;i++) {compiled[i] = expr(values[i],builder);}return new CompiledNamedArgs(keys,compiled);}function compileRef(parts,builder){var head=parts[0];var local=undefined;if(head === null){var inner=new CompiledSelf();var path=parts.slice(1);return CompiledLookup.create(inner,path);}else if(local = builder.symbolTable.getSymbol('local',head)){var path=parts.slice(1);var inner=new CompiledSymbol(local,head);return CompiledLookup.create(inner,path);}else {var inner=new CompiledSelf();return CompiledLookup.create(inner,parts);}}var Blocks=(function(){function Blocks(){this.names = _glimmerUtil.dict();this.funcs = [];}Blocks.prototype.add = function add(name,func){this.funcs.push(func);this.names[name] = this.funcs.length - 1;};Blocks.prototype.addMissing = function addMissing(func){this.missing = func;};Blocks.prototype.compile = function compile(sexp,builder){ // assert(sexp[1].length === 1, 'paths in blocks are not supported'); +var name=sexp[1][0];var index=this.names[name];if(index === undefined){_glimmerUtil.assert(!!this.missing,name + ' not found, and no catch-all block handler was registered');var func=this.missing;var handled=func(sexp,builder);_glimmerUtil.assert(!!handled,name + ' not found, and the catch-all block handler didn\'t handle it');}else {var func=this.funcs[index];func(sexp,builder);}};return Blocks;})();var BLOCKS=new Blocks();var Inlines=(function(){function Inlines(){this.names = _glimmerUtil.dict();this.funcs = [];}Inlines.prototype.add = function add(name,func){this.funcs.push(func);this.names[name] = this.funcs.length - 1;};Inlines.prototype.addMissing = function addMissing(func){this.missing = func;};Inlines.prototype.compile = function compile(sexp,builder){var value=sexp[1]; // TODO: Fix this so that expression macros can return +// things like components, so that {{component foo}} +// is the same as {{(component foo)}} +if(!Array.isArray(value))return ['expr',value];var path=undefined;var params=undefined;var hash=undefined;if(value[0] === Ops$1.Helper){path = value[1];params = value[2];hash = value[3];}else if(value[0] === Ops$1.Unknown){path = value[1];params = hash = null;}else {return ['expr',value];}if(path.length > 1 && !params && !hash){return ['expr',value];}var name=path[0];var index=this.names[name];if(index === undefined && this.missing){var func=this.missing;var returned=func(path,params,hash,builder);return returned === false?['expr',value]:returned;}else if(index !== undefined){var func=this.funcs[index];var returned=func(path,params,hash,builder);return returned === false?['expr',value]:returned;}else {return ['expr',value];}};return Inlines;})();var INLINES=new Inlines();populateBuiltins(BLOCKS,INLINES);function populateBuiltins(){var blocks=arguments.length <= 0 || arguments[0] === undefined?new Blocks():arguments[0];var inlines=arguments.length <= 1 || arguments[1] === undefined?new Inlines():arguments[1];blocks.add('if',function(sexp,builder){ // PutArgs +// Test(Environment) +// Enter(BEGIN, END) +// BEGIN: Noop +// JumpUnless(ELSE) +// Evaluate(default) +// Jump(END) +// ELSE: Noop +// Evalulate(inverse) +// END: Noop +// Exit +var params=sexp[2];var hash=sexp[3];var _default=sexp[4];var inverse=sexp[5];var args=compileArgs(params,hash,builder);builder.putArgs(args);builder.test('environment');builder.labelled(null,function(b){if(_default && inverse){b.jumpUnless('ELSE');b.evaluate(_default);b.jump('END');b.label('ELSE');b.evaluate(inverse);}else if(_default){b.jumpUnless('END');b.evaluate(_default);}else {throw _glimmerUtil.unreachable();}});});blocks.add('-in-element',function(sexp,builder){var block=defaultBlock(sexp);var args=compileArgs(params(sexp),null,builder);builder.putArgs(args);builder.test('simple');builder.labelled(null,function(b){b.jumpUnless('END');b.pushRemoteElement();b.evaluate(_glimmerUtil.unwrap(block));b.popRemoteElement();});});blocks.add('-with-dynamic-vars',function(sexp,builder){var block=defaultBlock(sexp);var args=compileArgs(params(sexp),hash(sexp),builder);builder.unit(function(b){b.putArgs(args);b.pushDynamicScope();b.bindDynamicScope(args.named.keys);b.evaluate(_glimmerUtil.unwrap(block));b.popDynamicScope();});});blocks.add('unless',function(sexp,builder){ // PutArgs +// Test(Environment) +// Enter(BEGIN, END) +// BEGIN: Noop +// JumpUnless(ELSE) +// Evaluate(default) +// Jump(END) +// ELSE: Noop +// Evalulate(inverse) +// END: Noop +// Exit +var params=sexp[2];var hash=sexp[3];var _default=sexp[4];var inverse=sexp[5];var args=compileArgs(params,hash,builder);builder.putArgs(args);builder.test('environment');builder.labelled(null,function(b){if(_default && inverse){b.jumpIf('ELSE');b.evaluate(_default);b.jump('END');b.label('ELSE');b.evaluate(inverse);}else if(_default){b.jumpIf('END');b.evaluate(_default);}else {throw _glimmerUtil.unreachable();}});});blocks.add('with',function(sexp,builder){ // PutArgs +// Test(Environment) +// Enter(BEGIN, END) +// BEGIN: Noop +// JumpUnless(ELSE) +// Evaluate(default) +// Jump(END) +// ELSE: Noop +// Evalulate(inverse) +// END: Noop +// Exit +var params=sexp[2];var hash=sexp[3];var _default=sexp[4];var inverse=sexp[5];var args=compileArgs(params,hash,builder);builder.putArgs(args);builder.test('environment');builder.labelled(null,function(b){if(_default && inverse){b.jumpUnless('ELSE');b.evaluate(_default);b.jump('END');b.label('ELSE');b.evaluate(inverse);}else if(_default){b.jumpUnless('END');b.evaluate(_default);}else {throw _glimmerUtil.unreachable();}});});blocks.add('each',function(sexp,builder){ // Enter(BEGIN, END) +// BEGIN: Noop +// PutArgs +// PutIterable +// JumpUnless(ELSE) +// EnterList(BEGIN2, END2) +// ITER: Noop +// NextIter(BREAK) +// EnterWithKey(BEGIN2, END2) +// BEGIN2: Noop +// PushChildScope +// Evaluate(default) +// PopScope +// END2: Noop +// Exit +// Jump(ITER) +// BREAK: Noop +// ExitList +// Jump(END) +// ELSE: Noop +// Evalulate(inverse) +// END: Noop +// Exit +var params=sexp[2];var hash=sexp[3];var _default=sexp[4];var inverse=sexp[5];var args=compileArgs(params,hash,builder);builder.labelled(args,function(b){b.putIterator();if(inverse){b.jumpUnless('ELSE');}else {b.jumpUnless('END');}b.iter(function(b){b.evaluate(_glimmerUtil.unwrap(_default));});if(inverse){b.jump('END');b.label('ELSE');b.evaluate(inverse);}});});return {blocks:blocks,inlines:inlines};}var badProtocols=['javascript:','vbscript:'];var badTags=['A','BODY','LINK','IMG','IFRAME','BASE','FORM'];var badTagsForDataURI=['EMBED'];var badAttributes=['href','src','background','action'];var badAttributesForDataURI=['src'];function has(array,item){return array.indexOf(item) !== -1;}function checkURI(tagName,attribute){return (tagName === null || has(badTags,tagName)) && has(badAttributes,attribute);}function checkDataURI(tagName,attribute){if(tagName === null)return false;return has(badTagsForDataURI,tagName) && has(badAttributesForDataURI,attribute);}function requiresSanitization(tagName,attribute){return checkURI(tagName,attribute) || checkDataURI(tagName,attribute);}function sanitizeAttributeValue(env,element,attribute,value){var tagName=null;if(value === null || value === undefined){return value;}if(isSafeString(value)){return value.toHTML();}if(!element){tagName = null;}else {tagName = element.tagName.toUpperCase();}var str=normalizeTextValue(value);if(checkURI(tagName,attribute)){var protocol=env.protocolForURL(str);if(has(badProtocols,protocol)){return 'unsafe:' + str;}}if(checkDataURI(tagName,attribute)){return 'unsafe:' + str;}return str;} /* + * @method normalizeProperty + * @param element {HTMLElement} + * @param slotName {String} + * @returns {Object} { name, type } + */function normalizeProperty(element,slotName){var type=undefined,normalized=undefined;if(slotName in element){normalized = slotName;type = 'prop';}else {var lower=slotName.toLowerCase();if(lower in element){type = 'prop';normalized = lower;}else {type = 'attr';normalized = slotName;}}if(type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName,normalized))){type = 'attr';}return {normalized:normalized,type:type};} // properties that MUST be set as attributes, due to: +// * browser bug +// * strange spec outlier +var ATTR_OVERRIDES={ // phantomjs < 2.0 lets you set it as a prop but won't reflect it +// back to the attribute. button.getAttribute('type') === null +BUTTON:{type:true,form:true},INPUT:{ // Some version of IE (like IE9) actually throw an exception +// if you set input.type = 'something-unknown' +type:true,form:true, // Chrome 46.0.2464.0: 'autocorrect' in document.createElement('input') === false +// Safari 8.0.7: 'autocorrect' in document.createElement('input') === false +// Mobile Safari (iOS 8.4 simulator): 'autocorrect' in document.createElement('input') === true +autocorrect:true, // Chrome 54.0.2840.98: 'list' in document.createElement('input') === true +// Safari 9.1.3: 'list' in document.createElement('input') === false +list:true}, // element.form is actually a legitimate readOnly property, that is to be +// mutated, but must be mutated by setAttribute... +SELECT:{form:true},OPTION:{form:true},TEXTAREA:{form:true},LABEL:{form:true},FIELDSET:{form:true},LEGEND:{form:true},OBJECT:{form:true}};function preferAttr(tagName,propName){var tag=ATTR_OVERRIDES[tagName.toUpperCase()];return tag && tag[propName.toLowerCase()] || false;}var innerHTMLWrapper={colgroup:{depth:2,before:'<table><colgroup>',after:'</colgroup></table>'},table:{depth:1,before:'<table>',after:'</table>'},tbody:{depth:2,before:'<table><tbody>',after:'</tbody></table>'},tfoot:{depth:2,before:'<table><tfoot>',after:'</tfoot></table>'},thead:{depth:2,before:'<table><thead>',after:'</thead></table>'},tr:{depth:3,before:'<table><tbody><tr>',after:'</tr></tbody></table>'}}; // Patch: innerHTML Fix +// Browsers: IE9 +// Reason: IE9 don't allow us to set innerHTML on col, colgroup, frameset, +// html, style, table, tbody, tfoot, thead, title, tr. +// Fix: Wrap the innerHTML we are about to set in its parents, apply the +// wrapped innerHTML on a div, then move the unwrapped nodes into the +// target position. +function domChanges(document,DOMChangesClass){if(!document)return DOMChangesClass;if(!shouldApplyFix(document)){return DOMChangesClass;}var div=document.createElement('div');return (function(_DOMChangesClass){babelHelpers.inherits(DOMChangesWithInnerHTMLFix,_DOMChangesClass);function DOMChangesWithInnerHTMLFix(){_DOMChangesClass.apply(this,arguments);}DOMChangesWithInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent,nextSibling,html){if(html === null || html === ''){return _DOMChangesClass.prototype.insertHTMLBefore.call(this,parent,nextSibling,html);}var parentTag=parent.tagName.toLowerCase();var wrapper=innerHTMLWrapper[parentTag];if(wrapper === undefined){return _DOMChangesClass.prototype.insertHTMLBefore.call(this,parent,nextSibling,html);}return fixInnerHTML(parent,wrapper,div,html,nextSibling);};return DOMChangesWithInnerHTMLFix;})(DOMChangesClass);}function treeConstruction(document,DOMTreeConstructionClass){if(!document)return DOMTreeConstructionClass;if(!shouldApplyFix(document)){return DOMTreeConstructionClass;}var div=document.createElement('div');return (function(_DOMTreeConstructionClass){babelHelpers.inherits(DOMTreeConstructionWithInnerHTMLFix,_DOMTreeConstructionClass);function DOMTreeConstructionWithInnerHTMLFix(){_DOMTreeConstructionClass.apply(this,arguments);}DOMTreeConstructionWithInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent,html,reference){if(html === null || html === ''){return _DOMTreeConstructionClass.prototype.insertHTMLBefore.call(this,parent,html,reference);}var parentTag=parent.tagName.toLowerCase();var wrapper=innerHTMLWrapper[parentTag];if(wrapper === undefined){return _DOMTreeConstructionClass.prototype.insertHTMLBefore.call(this,parent,html,reference);}return fixInnerHTML(parent,wrapper,div,html,reference);};return DOMTreeConstructionWithInnerHTMLFix;})(DOMTreeConstructionClass);}function fixInnerHTML(parent,wrapper,div,html,reference){var wrappedHtml=wrapper.before + html + wrapper.after;div.innerHTML = wrappedHtml;var parentNode=div;for(var i=0;i < wrapper.depth;i++) {parentNode = parentNode.childNodes[0];}var _moveNodesBefore=moveNodesBefore(parentNode,parent,reference);var first=_moveNodesBefore[0];var last=_moveNodesBefore[1];return new ConcreteBounds(parent,first,last);}function shouldApplyFix(document){var table=document.createElement('table');try{table.innerHTML = '<tbody></tbody>';}catch(e) {}finally {if(table.childNodes.length !== 0){ // It worked as expected, no fix required +return false;}}return true;}var SVG_NAMESPACE$1='http://www.w3.org/2000/svg'; // Patch: insertAdjacentHTML on SVG Fix +// Browsers: Safari, IE, Edge, Firefox ~33-34 +// Reason: insertAdjacentHTML does not exist on SVG elements in Safari. It is +// present but throws an exception on IE and Edge. Old versions of +// Firefox create nodes in the incorrect namespace. +// Fix: Since IE and Edge silently fail to create SVG nodes using +// innerHTML, and because Firefox may create nodes in the incorrect +// namespace using innerHTML on SVG elements, an HTML-string wrapping +// approach is used. A pre/post SVG tag is added to the string, then +// that whole string is added to a div. The created nodes are plucked +// out and applied to the target location on DOM. +function domChanges$1(document,DOMChangesClass,svgNamespace){if(!document)return DOMChangesClass;if(!shouldApplyFix$1(document,svgNamespace)){return DOMChangesClass;}var div=document.createElement('div');return (function(_DOMChangesClass2){babelHelpers.inherits(DOMChangesWithSVGInnerHTMLFix,_DOMChangesClass2);function DOMChangesWithSVGInnerHTMLFix(){_DOMChangesClass2.apply(this,arguments);}DOMChangesWithSVGInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent,nextSibling,html){if(html === null || html === ''){return _DOMChangesClass2.prototype.insertHTMLBefore.call(this,parent,nextSibling,html);}if(parent.namespaceURI !== svgNamespace){return _DOMChangesClass2.prototype.insertHTMLBefore.call(this,parent,nextSibling,html);}return fixSVG(parent,div,html,nextSibling);};return DOMChangesWithSVGInnerHTMLFix;})(DOMChangesClass);}function treeConstruction$1(document,TreeConstructionClass,svgNamespace){if(!document)return TreeConstructionClass;if(!shouldApplyFix$1(document,svgNamespace)){return TreeConstructionClass;}var div=document.createElement('div');return (function(_TreeConstructionClass){babelHelpers.inherits(TreeConstructionWithSVGInnerHTMLFix,_TreeConstructionClass);function TreeConstructionWithSVGInnerHTMLFix(){_TreeConstructionClass.apply(this,arguments);}TreeConstructionWithSVGInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent,html,reference){if(html === null || html === ''){return _TreeConstructionClass.prototype.insertHTMLBefore.call(this,parent,html,reference);}if(parent.namespaceURI !== svgNamespace){return _TreeConstructionClass.prototype.insertHTMLBefore.call(this,parent,html,reference);}return fixSVG(parent,div,html,reference);};return TreeConstructionWithSVGInnerHTMLFix;})(TreeConstructionClass);}function fixSVG(parent,div,html,reference){ // IE, Edge: also do not correctly support using `innerHTML` on SVG +// namespaced elements. So here a wrapper is used. +var wrappedHtml='<svg>' + html + '</svg>';div.innerHTML = wrappedHtml;var _moveNodesBefore2=moveNodesBefore(div.firstChild,parent,reference);var first=_moveNodesBefore2[0];var last=_moveNodesBefore2[1];return new ConcreteBounds(parent,first,last);}function shouldApplyFix$1(document,svgNamespace){var svg=document.createElementNS(svgNamespace,'svg');try{svg['insertAdjacentHTML']('beforeEnd','<circle></circle>');}catch(e) { // IE, Edge: Will throw, insertAdjacentHTML is unsupported on SVG +// Safari: Will throw, insertAdjacentHTML is not present on SVG +}finally { // FF: Old versions will create a node in the wrong namespace +if(svg.childNodes.length === 1 && _glimmerUtil.unwrap(svg.firstChild).namespaceURI === SVG_NAMESPACE$1){ // The test worked as expected, no fix required +return false;}return true;}} // Patch: Adjacent text node merging fix +// Browsers: IE, Edge, Firefox w/o inspector open +// Reason: These browsers will merge adjacent text nodes. For exmaple given +// <div>Hello</div> with div.insertAdjacentHTML(' world') browsers +// with proper behavior will populate div.childNodes with two items. +// These browsers will populate it with one merged node instead. +// Fix: Add these nodes to a wrapper element, then iterate the childNodes +// of that wrapper and move the nodes to their target location. Note +// that potential SVG bugs will have been handled before this fix. +// Note that this fix must only apply to the previous text node, as +// the base implementation of `insertHTMLBefore` already handles +// following text nodes correctly. +function domChanges$2(document,DOMChangesClass){if(!document)return DOMChangesClass;if(!shouldApplyFix$2(document)){return DOMChangesClass;}return (function(_DOMChangesClass3){babelHelpers.inherits(DOMChangesWithTextNodeMergingFix,_DOMChangesClass3);function DOMChangesWithTextNodeMergingFix(document){_DOMChangesClass3.call(this,document);this.uselessComment = document.createComment('');}DOMChangesWithTextNodeMergingFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent,nextSibling,html){if(html === null){return _DOMChangesClass3.prototype.insertHTMLBefore.call(this,parent,nextSibling,html);}var didSetUselessComment=false;var nextPrevious=nextSibling?nextSibling.previousSibling:parent.lastChild;if(nextPrevious && nextPrevious instanceof Text){didSetUselessComment = true;parent.insertBefore(this.uselessComment,nextSibling);}var bounds=_DOMChangesClass3.prototype.insertHTMLBefore.call(this,parent,nextSibling,html);if(didSetUselessComment){parent.removeChild(this.uselessComment);}return bounds;};return DOMChangesWithTextNodeMergingFix;})(DOMChangesClass);}function treeConstruction$2(document,TreeConstructionClass){if(!document)return TreeConstructionClass;if(!shouldApplyFix$2(document)){return TreeConstructionClass;}return (function(_TreeConstructionClass2){babelHelpers.inherits(TreeConstructionWithTextNodeMergingFix,_TreeConstructionClass2);function TreeConstructionWithTextNodeMergingFix(document){_TreeConstructionClass2.call(this,document);this.uselessComment = this.createComment('');}TreeConstructionWithTextNodeMergingFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent,html,reference){if(html === null){return _TreeConstructionClass2.prototype.insertHTMLBefore.call(this,parent,html,reference);}var didSetUselessComment=false;var nextPrevious=reference?reference.previousSibling:parent.lastChild;if(nextPrevious && nextPrevious instanceof Text){didSetUselessComment = true;parent.insertBefore(this.uselessComment,reference);}var bounds=_TreeConstructionClass2.prototype.insertHTMLBefore.call(this,parent,html,reference);if(didSetUselessComment){parent.removeChild(this.uselessComment);}return bounds;};return TreeConstructionWithTextNodeMergingFix;})(TreeConstructionClass);}function shouldApplyFix$2(document){var mergingTextDiv=document.createElement('div');mergingTextDiv.innerHTML = 'first';mergingTextDiv.insertAdjacentHTML('beforeEnd','second');if(mergingTextDiv.childNodes.length === 2){ // It worked as expected, no fix required +return false;}return true;}var SVG_NAMESPACE='http://www.w3.org/2000/svg'; // http://www.w3.org/TR/html/syntax.html#html-integration-point +var SVG_INTEGRATION_POINTS={foreignObject:1,desc:1,title:1}; // http://www.w3.org/TR/html/syntax.html#adjust-svg-attributes +// TODO: Adjust SVG attributes +// http://www.w3.org/TR/html/syntax.html#parsing-main-inforeign +// TODO: Adjust SVG elements +// http://www.w3.org/TR/html/syntax.html#parsing-main-inforeign +var BLACKLIST_TABLE=Object.create(null);["b","big","blockquote","body","br","center","code","dd","div","dl","dt","em","embed","h1","h2","h3","h4","h5","h6","head","hr","i","img","li","listing","main","meta","nobr","ol","p","pre","ruby","s","small","span","strong","strike","sub","sup","table","tt","u","ul","var"].forEach(function(tag){return BLACKLIST_TABLE[tag] = 1;});var WHITESPACE=/[\t-\r \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;var doc=typeof document === 'undefined'?null:document;function isWhitespace(string){return WHITESPACE.test(string);}function moveNodesBefore(source,target,nextSibling){var first=source.firstChild;var last=null;var current=first;while(current) {last = current;current = current.nextSibling;target.insertBefore(last,nextSibling);}return [first,last];}var DOM;(function(DOM){var TreeConstruction=(function(){function TreeConstruction(document){this.document = document;this.setupUselessElement();}TreeConstruction.prototype.setupUselessElement = function setupUselessElement(){this.uselessElement = this.document.createElement('div');};TreeConstruction.prototype.createElement = function createElement(tag,context){var isElementInSVGNamespace=undefined,isHTMLIntegrationPoint=undefined;if(context){isElementInSVGNamespace = context.namespaceURI === SVG_NAMESPACE || tag === 'svg';isHTMLIntegrationPoint = SVG_INTEGRATION_POINTS[context.tagName];}else {isElementInSVGNamespace = tag === 'svg';isHTMLIntegrationPoint = false;}if(isElementInSVGNamespace && !isHTMLIntegrationPoint){ // FIXME: This does not properly handle <font> with color, face, or +// size attributes, which is also disallowed by the spec. We should fix +// this. +if(BLACKLIST_TABLE[tag]){throw new Error('Cannot create a ' + tag + ' inside an SVG context');}return this.document.createElementNS(SVG_NAMESPACE,tag);}else {return this.document.createElement(tag);}};TreeConstruction.prototype.createElementNS = function createElementNS(namespace,tag){return this.document.createElementNS(namespace,tag);};TreeConstruction.prototype.setAttribute = function setAttribute(element,name,value,namespace){if(namespace){element.setAttributeNS(namespace,name,value);}else {element.setAttribute(name,value);}};TreeConstruction.prototype.createTextNode = function createTextNode(text){return this.document.createTextNode(text);};TreeConstruction.prototype.createComment = function createComment(data){return this.document.createComment(data);};TreeConstruction.prototype.insertBefore = function insertBefore(parent,node,reference){parent.insertBefore(node,reference);};TreeConstruction.prototype.insertHTMLBefore = function insertHTMLBefore(parent,html,reference){return _insertHTMLBefore(this.uselessElement,parent,reference,html);};return TreeConstruction;})();DOM.TreeConstruction = TreeConstruction;var appliedTreeContruction=TreeConstruction;appliedTreeContruction = treeConstruction$2(doc,appliedTreeContruction);appliedTreeContruction = treeConstruction(doc,appliedTreeContruction);appliedTreeContruction = treeConstruction$1(doc,appliedTreeContruction,SVG_NAMESPACE);DOM.DOMTreeConstruction = appliedTreeContruction;})(DOM || (DOM = {}));var DOMChanges=(function(){function DOMChanges(document){this.document = document;this.namespace = null;this.uselessElement = this.document.createElement('div');}DOMChanges.prototype.setAttribute = function setAttribute(element,name,value){element.setAttribute(name,value);};DOMChanges.prototype.setAttributeNS = function setAttributeNS(element,namespace,name,value){element.setAttributeNS(namespace,name,value);};DOMChanges.prototype.removeAttribute = function removeAttribute(element,name){element.removeAttribute(name);};DOMChanges.prototype.removeAttributeNS = function removeAttributeNS(element,namespace,name){element.removeAttributeNS(namespace,name);};DOMChanges.prototype.createTextNode = function createTextNode(text){return this.document.createTextNode(text);};DOMChanges.prototype.createComment = function createComment(data){return this.document.createComment(data);};DOMChanges.prototype.createElement = function createElement(tag,context){var isElementInSVGNamespace=undefined,isHTMLIntegrationPoint=undefined;if(context){isElementInSVGNamespace = context.namespaceURI === SVG_NAMESPACE || tag === 'svg';isHTMLIntegrationPoint = SVG_INTEGRATION_POINTS[context.tagName];}else {isElementInSVGNamespace = tag === 'svg';isHTMLIntegrationPoint = false;}if(isElementInSVGNamespace && !isHTMLIntegrationPoint){ // FIXME: This does not properly handle <font> with color, face, or +// size attributes, which is also disallowed by the spec. We should fix +// this. +if(BLACKLIST_TABLE[tag]){throw new Error('Cannot create a ' + tag + ' inside an SVG context');}return this.document.createElementNS(SVG_NAMESPACE,tag);}else {return this.document.createElement(tag);}};DOMChanges.prototype.insertHTMLBefore = function insertHTMLBefore(_parent,nextSibling,html){return _insertHTMLBefore(this.uselessElement,_parent,nextSibling,html);};DOMChanges.prototype.insertNodeBefore = function insertNodeBefore(parent,node,reference){if(isDocumentFragment(node)){var firstChild=node.firstChild;var lastChild=node.lastChild;this.insertBefore(parent,node,reference);return new ConcreteBounds(parent,firstChild,lastChild);}else {this.insertBefore(parent,node,reference);return new SingleNodeBounds(parent,node);}};DOMChanges.prototype.insertTextBefore = function insertTextBefore(parent,nextSibling,text){var textNode=this.createTextNode(text);this.insertBefore(parent,textNode,nextSibling);return textNode;};DOMChanges.prototype.insertBefore = function insertBefore(element,node,reference){element.insertBefore(node,reference);};DOMChanges.prototype.insertAfter = function insertAfter(element,node,reference){this.insertBefore(element,node,reference.nextSibling);};return DOMChanges;})();function _insertHTMLBefore(_useless,_parent,_nextSibling,html){ // TypeScript vendored an old version of the DOM spec where `insertAdjacentHTML` +// only exists on `HTMLElement` but not on `Element`. We actually work with the +// newer version of the DOM API here (and monkey-patch this method in `./compat` +// when we detect older browsers). This is a hack to work around this limitation. +var parent=_parent;var useless=_useless;var nextSibling=_nextSibling;var prev=nextSibling?nextSibling.previousSibling:parent.lastChild;var last=undefined;if(html === null || html === ''){return new ConcreteBounds(parent,null,null);}if(nextSibling === null){parent.insertAdjacentHTML('beforeEnd',html);last = parent.lastChild;}else if(nextSibling instanceof HTMLElement){nextSibling.insertAdjacentHTML('beforeBegin',html);last = nextSibling.previousSibling;}else { // Non-element nodes do not support insertAdjacentHTML, so add an +// element and call it on that element. Then remove the element. +// +// This also protects Edge, IE and Firefox w/o the inspector open +// from merging adjacent text nodes. See ./compat/text-node-merging-fix.ts +parent.insertBefore(useless,nextSibling);useless.insertAdjacentHTML('beforeBegin',html);last = useless.previousSibling;parent.removeChild(useless);}var first=prev?prev.nextSibling:parent.firstChild;return new ConcreteBounds(parent,first,last);}function isDocumentFragment(node){return node.nodeType === Node.DOCUMENT_FRAGMENT_NODE;}var helper=DOMChanges;helper = domChanges$2(doc,helper);helper = domChanges(doc,helper);helper = domChanges$1(doc,helper,SVG_NAMESPACE);var helper$1=helper;var DOMTreeConstruction=DOM.DOMTreeConstruction;function defaultManagers(element,attr,_isTrusting,_namespace){var tagName=element.tagName;var isSVG=element.namespaceURI === SVG_NAMESPACE;if(isSVG){return defaultAttributeManagers(tagName,attr);}var _normalizeProperty=normalizeProperty(element,attr);var type=_normalizeProperty.type;var normalized=_normalizeProperty.normalized;if(type === 'attr'){return defaultAttributeManagers(tagName,normalized);}else {return defaultPropertyManagers(tagName,normalized);}}function defaultPropertyManagers(tagName,attr){if(requiresSanitization(tagName,attr)){return new SafePropertyManager(attr);}if(isUserInputValue(tagName,attr)){return INPUT_VALUE_PROPERTY_MANAGER;}if(isOptionSelected(tagName,attr)){return OPTION_SELECTED_MANAGER;}return new PropertyManager(attr);}function defaultAttributeManagers(tagName,attr){if(requiresSanitization(tagName,attr)){return new SafeAttributeManager(attr);}return new AttributeManager(attr);}function readDOMAttr(element,attr){var isSVG=element.namespaceURI === SVG_NAMESPACE;var _normalizeProperty2=normalizeProperty(element,attr);var type=_normalizeProperty2.type;var normalized=_normalizeProperty2.normalized;if(isSVG){return element.getAttribute(normalized);}if(type === 'attr'){return element.getAttribute(normalized);}{return element[normalized];}};var AttributeManager=(function(){function AttributeManager(attr){this.attr = attr;}AttributeManager.prototype.setAttribute = function setAttribute(env,element,value,namespace){var dom=env.getAppendOperations();var normalizedValue=normalizeAttributeValue(value);if(!isAttrRemovalValue(normalizedValue)){dom.setAttribute(element,this.attr,normalizedValue,namespace);}};AttributeManager.prototype.updateAttribute = function updateAttribute(env,element,value,namespace){if(value === null || value === undefined || value === false){if(namespace){env.getDOM().removeAttributeNS(element,namespace,this.attr);}else {env.getDOM().removeAttribute(element,this.attr);}}else {this.setAttribute(env,element,value);}};return AttributeManager;})();;var PropertyManager=(function(_AttributeManager){babelHelpers.inherits(PropertyManager,_AttributeManager);function PropertyManager(){_AttributeManager.apply(this,arguments);}PropertyManager.prototype.setAttribute = function setAttribute(_env,element,value,_namespace){if(!isAttrRemovalValue(value)){element[this.attr] = value;}};PropertyManager.prototype.removeAttribute = function removeAttribute(env,element,namespace){ // TODO this sucks but to preserve properties first and to meet current +// semantics we must do this. +var attr=this.attr;if(namespace){env.getDOM().removeAttributeNS(element,namespace,attr);}else {env.getDOM().removeAttribute(element,attr);}};PropertyManager.prototype.updateAttribute = function updateAttribute(env,element,value,namespace){ // ensure the property is always updated +element[this.attr] = value;if(isAttrRemovalValue(value)){this.removeAttribute(env,element,namespace);}};return PropertyManager;})(AttributeManager);;function normalizeAttributeValue(value){if(value === false || value === undefined || value === null){return null;}if(value === true){return '';} // onclick function etc in SSR +if(typeof value === 'function'){return null;}return String(value);}function isAttrRemovalValue(value){return value === null || value === undefined;}var SafePropertyManager=(function(_PropertyManager){babelHelpers.inherits(SafePropertyManager,_PropertyManager);function SafePropertyManager(){_PropertyManager.apply(this,arguments);}SafePropertyManager.prototype.setAttribute = function setAttribute(env,element,value){_PropertyManager.prototype.setAttribute.call(this,env,element,sanitizeAttributeValue(env,element,this.attr,value));};SafePropertyManager.prototype.updateAttribute = function updateAttribute(env,element,value){_PropertyManager.prototype.updateAttribute.call(this,env,element,sanitizeAttributeValue(env,element,this.attr,value));};return SafePropertyManager;})(PropertyManager);function isUserInputValue(tagName,attribute){return (tagName === 'INPUT' || tagName === 'TEXTAREA') && attribute === 'value';}var InputValuePropertyManager=(function(_AttributeManager2){babelHelpers.inherits(InputValuePropertyManager,_AttributeManager2);function InputValuePropertyManager(){_AttributeManager2.apply(this,arguments);}InputValuePropertyManager.prototype.setAttribute = function setAttribute(_env,element,value){var input=element;input.value = normalizeTextValue(value);};InputValuePropertyManager.prototype.updateAttribute = function updateAttribute(_env,element,value){var input=element;var currentValue=input.value;var normalizedValue=normalizeTextValue(value);if(currentValue !== normalizedValue){input.value = normalizedValue;}};return InputValuePropertyManager;})(AttributeManager);var INPUT_VALUE_PROPERTY_MANAGER=new InputValuePropertyManager('value');function isOptionSelected(tagName,attribute){return tagName === 'OPTION' && attribute === 'selected';}var OptionSelectedManager=(function(_PropertyManager2){babelHelpers.inherits(OptionSelectedManager,_PropertyManager2);function OptionSelectedManager(){_PropertyManager2.apply(this,arguments);}OptionSelectedManager.prototype.setAttribute = function setAttribute(_env,element,value){if(value !== null && value !== undefined && value !== false){var option=element;option.selected = true;}};OptionSelectedManager.prototype.updateAttribute = function updateAttribute(_env,element,value){var option=element;if(value){option.selected = true;}else {option.selected = false;}};return OptionSelectedManager;})(PropertyManager);var OPTION_SELECTED_MANAGER=new OptionSelectedManager('selected');var SafeAttributeManager=(function(_AttributeManager3){babelHelpers.inherits(SafeAttributeManager,_AttributeManager3);function SafeAttributeManager(){_AttributeManager3.apply(this,arguments);}SafeAttributeManager.prototype.setAttribute = function setAttribute(env,element,value){_AttributeManager3.prototype.setAttribute.call(this,env,element,sanitizeAttributeValue(env,element,this.attr,value));};SafeAttributeManager.prototype.updateAttribute = function updateAttribute(env,element,value,_namespace){_AttributeManager3.prototype.updateAttribute.call(this,env,element,sanitizeAttributeValue(env,element,this.attr,value));};return SafeAttributeManager;})(AttributeManager);var Scope=(function(){function Scope(references){var callerScope=arguments.length <= 1 || arguments[1] === undefined?null:arguments[1];this.callerScope = null;this.slots = references;this.callerScope = callerScope;}Scope.root = function root(self){var size=arguments.length <= 1 || arguments[1] === undefined?0:arguments[1];var refs=new Array(size + 1);for(var i=0;i <= size;i++) {refs[i] = UNDEFINED_REFERENCE;}return new Scope(refs).init({self:self});};Scope.prototype.init = function init(_ref27){var self=_ref27.self;this.slots[0] = self;return this;};Scope.prototype.getSelf = function getSelf(){return this.slots[0];};Scope.prototype.getSymbol = function getSymbol(symbol){return this.slots[symbol];};Scope.prototype.getBlock = function getBlock(symbol){return this.slots[symbol];};Scope.prototype.getPartialArgs = function getPartialArgs(symbol){return this.slots[symbol];};Scope.prototype.bindSymbol = function bindSymbol(symbol,value){this.slots[symbol] = value;};Scope.prototype.bindBlock = function bindBlock(symbol,value){this.slots[symbol] = value;};Scope.prototype.bindPartialArgs = function bindPartialArgs(symbol,value){this.slots[symbol] = value;};Scope.prototype.bindCallerScope = function bindCallerScope(scope){this.callerScope = scope;};Scope.prototype.getCallerScope = function getCallerScope(){return this.callerScope;};Scope.prototype.child = function child(){return new Scope(this.slots.slice(),this.callerScope);};return Scope;})();var Transaction=(function(){function Transaction(){this.scheduledInstallManagers = [];this.scheduledInstallModifiers = [];this.scheduledUpdateModifierManagers = [];this.scheduledUpdateModifiers = [];this.createdComponents = [];this.createdManagers = [];this.updatedComponents = [];this.updatedManagers = [];this.destructors = [];}Transaction.prototype.didCreate = function didCreate(component,manager){this.createdComponents.push(component);this.createdManagers.push(manager);};Transaction.prototype.didUpdate = function didUpdate(component,manager){this.updatedComponents.push(component);this.updatedManagers.push(manager);};Transaction.prototype.scheduleInstallModifier = function scheduleInstallModifier(modifier,manager){this.scheduledInstallManagers.push(manager);this.scheduledInstallModifiers.push(modifier);};Transaction.prototype.scheduleUpdateModifier = function scheduleUpdateModifier(modifier,manager){this.scheduledUpdateModifierManagers.push(manager);this.scheduledUpdateModifiers.push(modifier);};Transaction.prototype.didDestroy = function didDestroy(d){this.destructors.push(d);};Transaction.prototype.commit = function commit(){var createdComponents=this.createdComponents;var createdManagers=this.createdManagers;for(var i=0;i < createdComponents.length;i++) {var component=createdComponents[i];var manager=createdManagers[i];manager.didCreate(component);}var updatedComponents=this.updatedComponents;var updatedManagers=this.updatedManagers;for(var i=0;i < updatedComponents.length;i++) {var component=updatedComponents[i];var manager=updatedManagers[i];manager.didUpdate(component);}var destructors=this.destructors;for(var i=0;i < destructors.length;i++) {destructors[i].destroy();}var scheduledInstallManagers=this.scheduledInstallManagers;var scheduledInstallModifiers=this.scheduledInstallModifiers;for(var i=0;i < scheduledInstallManagers.length;i++) {var manager=scheduledInstallManagers[i];var modifier=scheduledInstallModifiers[i];manager.install(modifier);}var scheduledUpdateModifierManagers=this.scheduledUpdateModifierManagers;var scheduledUpdateModifiers=this.scheduledUpdateModifiers;for(var i=0;i < scheduledUpdateModifierManagers.length;i++) {var manager=scheduledUpdateModifierManagers[i];var modifier=scheduledUpdateModifiers[i];manager.update(modifier);}};return Transaction;})();var Opcode=(function(){function Opcode(array){this.array = array;this.offset = 0;}babelHelpers.createClass(Opcode,[{key:'type',get:function(){return this.array[this.offset];}},{key:'op1',get:function(){return this.array[this.offset + 1];}},{key:'op2',get:function(){return this.array[this.offset + 2];}},{key:'op3',get:function(){return this.array[this.offset + 3];}}]);return Opcode;})();var Program=(function(){function Program(){this.opcodes = [];this._offset = 0;this._opcode = new Opcode(this.opcodes);}Program.prototype.opcode = function opcode(offset){this._opcode.offset = offset;return this._opcode;};Program.prototype.set = function set(pos,type){var op1=arguments.length <= 2 || arguments[2] === undefined?0:arguments[2];var op2=arguments.length <= 3 || arguments[3] === undefined?0:arguments[3];var op3=arguments.length <= 4 || arguments[4] === undefined?0:arguments[4];this.opcodes[pos] = type;this.opcodes[pos + 1] = op1;this.opcodes[pos + 2] = op2;this.opcodes[pos + 3] = op3;};Program.prototype.push = function push(type){var op1=arguments.length <= 1 || arguments[1] === undefined?0:arguments[1];var op2=arguments.length <= 2 || arguments[2] === undefined?0:arguments[2];var op3=arguments.length <= 3 || arguments[3] === undefined?0:arguments[3];var offset=this._offset;this.opcodes[this._offset++] = type;this.opcodes[this._offset++] = op1;this.opcodes[this._offset++] = op2;this.opcodes[this._offset++] = op3;return offset;};babelHelpers.createClass(Program,[{key:'next',get:function(){return this._offset;}},{key:'current',get:function(){return this._offset - 4;}}]);return Program;})();var Environment=(function(){function Environment(_ref28){var appendOperations=_ref28.appendOperations;var updateOperations=_ref28.updateOperations;this._macros = null;this._transaction = null;this.constants = new Constants();this.program = new Program();this.appendOperations = appendOperations;this.updateOperations = updateOperations;}Environment.prototype.toConditionalReference = function toConditionalReference(reference){return new ConditionalReference(reference);};Environment.prototype.getAppendOperations = function getAppendOperations(){return this.appendOperations;};Environment.prototype.getDOM = function getDOM(){return this.updateOperations;};Environment.prototype.getIdentity = function getIdentity(object){return _glimmerUtil.ensureGuid(object) + '';};Environment.prototype.begin = function begin(){_glimmerUtil.assert(!this._transaction,'Cannot start a nested transaction');this._transaction = new Transaction();};Environment.prototype.didCreate = function didCreate(component,manager){this.transaction.didCreate(component,manager);};Environment.prototype.didUpdate = function didUpdate(component,manager){this.transaction.didUpdate(component,manager);};Environment.prototype.scheduleInstallModifier = function scheduleInstallModifier(modifier,manager){this.transaction.scheduleInstallModifier(modifier,manager);};Environment.prototype.scheduleUpdateModifier = function scheduleUpdateModifier(modifier,manager){this.transaction.scheduleUpdateModifier(modifier,manager);};Environment.prototype.didDestroy = function didDestroy(d){this.transaction.didDestroy(d);};Environment.prototype.commit = function commit(){this.transaction.commit();this._transaction = null;};Environment.prototype.attributeFor = function attributeFor(element,attr,isTrusting,namespace){return defaultManagers(element,attr,isTrusting,namespace === undefined?null:namespace);};Environment.prototype.macros = function macros(){var macros=this._macros;if(!macros){this._macros = macros = populateBuiltins();}return macros;};babelHelpers.createClass(Environment,[{key:'transaction',get:function(){return _glimmerUtil.expect(this._transaction,'must be in a transaction');}}]);return Environment;})();var RenderResult=(function(){function RenderResult(env,updating,bounds){this.env = env;this.updating = updating;this.bounds = bounds;}RenderResult.prototype.rerender = function rerender(){var _ref29=arguments.length <= 0 || arguments[0] === undefined?{alwaysRevalidate:false}:arguments[0];var _ref29$alwaysRevalidate=_ref29.alwaysRevalidate;var alwaysRevalidate=_ref29$alwaysRevalidate === undefined?false:_ref29$alwaysRevalidate;var env=this.env;var updating=this.updating;var vm=new UpdatingVM(env,{alwaysRevalidate:alwaysRevalidate});vm.execute(updating,this);};RenderResult.prototype.parentElement = function parentElement(){return this.bounds.parentElement();};RenderResult.prototype.firstNode = function firstNode(){return this.bounds.firstNode();};RenderResult.prototype.lastNode = function lastNode(){return this.bounds.lastNode();};RenderResult.prototype.opcodes = function opcodes(){return this.updating;};RenderResult.prototype.handleException = function handleException(){throw "this should never happen";};RenderResult.prototype.destroy = function destroy(){this.bounds.destroy();clear(this.bounds);};return RenderResult;})();var CapturedFrame=function CapturedFrame(operand,args,condition){this.operand = operand;this.args = args;this.condition = condition;};var Frame=(function(){function Frame(start,end){var component=arguments.length <= 2 || arguments[2] === undefined?null:arguments[2];var manager=arguments.length <= 3 || arguments[3] === undefined?null:arguments[3];var shadow=arguments.length <= 4 || arguments[4] === undefined?null:arguments[4];this.start = start;this.end = end;this.component = component;this.manager = manager;this.shadow = shadow;this.operand = null;this.immediate = null;this.args = null;this.callerScope = null;this.blocks = null;this.condition = null;this.iterator = null;this.key = null;this.ip = start;}Frame.prototype.capture = function capture(){return new CapturedFrame(this.operand,this.args,this.condition);};Frame.prototype.restore = function restore(frame){this.operand = frame.operand;this.args = frame.args;this.condition = frame.condition;};return Frame;})();var FrameStack=(function(){function FrameStack(){this.frames = [];this.frame = -1;}FrameStack.prototype.push = function push(start,end){var component=arguments.length <= 2 || arguments[2] === undefined?null:arguments[2];var manager=arguments.length <= 3 || arguments[3] === undefined?null:arguments[3];var shadow=arguments.length <= 4 || arguments[4] === undefined?null:arguments[4];var pos=++this.frame;if(pos < this.frames.length){var frame=this.frames[pos];frame.start = frame.ip = start;frame.end = end;frame.component = component;frame.manager = manager;frame.shadow = shadow;frame.operand = null;frame.immediate = null;frame.args = null;frame.callerScope = null;frame.blocks = null;frame.condition = null;frame.iterator = null;frame.key = null;}else {this.frames[pos] = new Frame(start,end,component,manager,shadow);}};FrameStack.prototype.pop = function pop(){this.frame--;};FrameStack.prototype.capture = function capture(){return this.currentFrame.capture();};FrameStack.prototype.restore = function restore(frame){this.currentFrame.restore(frame);};FrameStack.prototype.getStart = function getStart(){return this.currentFrame.start;};FrameStack.prototype.getEnd = function getEnd(){return this.currentFrame.end;};FrameStack.prototype.getCurrent = function getCurrent(){return this.currentFrame.ip;};FrameStack.prototype.setCurrent = function setCurrent(ip){return this.currentFrame.ip = ip;};FrameStack.prototype.getOperand = function getOperand(){return _glimmerUtil.unwrap(this.currentFrame.operand);};FrameStack.prototype.setOperand = function setOperand(operand){return this.currentFrame.operand = operand;};FrameStack.prototype.getImmediate = function getImmediate(){return this.currentFrame.immediate;};FrameStack.prototype.setImmediate = function setImmediate(value){return this.currentFrame.immediate = value;}; // FIXME: These options are required in practice by the existing code, but +// figure out why. +FrameStack.prototype.getArgs = function getArgs(){return this.currentFrame.args;};FrameStack.prototype.setArgs = function setArgs(args){return this.currentFrame.args = args;};FrameStack.prototype.getCondition = function getCondition(){return _glimmerUtil.unwrap(this.currentFrame.condition);};FrameStack.prototype.setCondition = function setCondition(condition){return this.currentFrame.condition = condition;};FrameStack.prototype.getIterator = function getIterator(){return _glimmerUtil.unwrap(this.currentFrame.iterator);};FrameStack.prototype.setIterator = function setIterator(iterator){return this.currentFrame.iterator = iterator;};FrameStack.prototype.getKey = function getKey(){return this.currentFrame.key;};FrameStack.prototype.setKey = function setKey(key){return this.currentFrame.key = key;};FrameStack.prototype.getBlocks = function getBlocks(){return _glimmerUtil.unwrap(this.currentFrame.blocks);};FrameStack.prototype.setBlocks = function setBlocks(blocks){return this.currentFrame.blocks = blocks;};FrameStack.prototype.getCallerScope = function getCallerScope(){return _glimmerUtil.unwrap(this.currentFrame.callerScope);};FrameStack.prototype.setCallerScope = function setCallerScope(callerScope){return this.currentFrame.callerScope = callerScope;};FrameStack.prototype.getComponent = function getComponent(){return _glimmerUtil.unwrap(this.currentFrame.component);};FrameStack.prototype.getManager = function getManager(){return _glimmerUtil.unwrap(this.currentFrame.manager);};FrameStack.prototype.getShadow = function getShadow(){return this.currentFrame.shadow;};FrameStack.prototype.goto = function goto(ip){this.setCurrent(ip);};FrameStack.prototype.nextStatement = function nextStatement(env){while(this.frame !== -1) {var frame=this.frames[this.frame];var ip=frame.ip;var end=frame.end;if(ip < end){var program=env.program;frame.ip += 4;return program.opcode(ip);}else {this.pop();}}return null;};babelHelpers.createClass(FrameStack,[{key:'currentFrame',get:function(){return this.frames[this.frame];}}]);return FrameStack;})();var VM=(function(){function VM(env,scope,dynamicScope,elementStack){this.env = env;this.elementStack = elementStack;this.dynamicScopeStack = new _glimmerUtil.Stack();this.scopeStack = new _glimmerUtil.Stack();this.updatingOpcodeStack = new _glimmerUtil.Stack();this.cacheGroups = new _glimmerUtil.Stack();this.listBlockStack = new _glimmerUtil.Stack();this.frame = new FrameStack();this.env = env;this.constants = env.constants;this.elementStack = elementStack;this.scopeStack.push(scope);this.dynamicScopeStack.push(dynamicScope);}VM.initial = function initial(env,self,dynamicScope,elementStack,compiledProgram){var size=compiledProgram.symbols;var start=compiledProgram.start;var end=compiledProgram.end;var scope=Scope.root(self,size);var vm=new VM(env,scope,dynamicScope,elementStack);vm.prepare(start,end);return vm;};VM.prototype.capture = function capture(){return {env:this.env,scope:this.scope(),dynamicScope:this.dynamicScope(),frame:this.frame.capture()};};VM.prototype.goto = function goto(ip){this.frame.goto(ip);};VM.prototype.beginCacheGroup = function beginCacheGroup(){this.cacheGroups.push(this.updating().tail());};VM.prototype.commitCacheGroup = function commitCacheGroup(){ // JumpIfNotModified(END) +// (head) +// (....) +// (tail) +// DidModify +// END: Noop +var END=new LabelOpcode("END");var opcodes=this.updating();var marker=this.cacheGroups.pop();var head=marker?opcodes.nextNode(marker):opcodes.head();var tail=opcodes.tail();var tag=_glimmerReference.combineSlice(new _glimmerUtil.ListSlice(head,tail));var guard=new JumpIfNotModifiedOpcode(tag,END);opcodes.insertBefore(guard,head);opcodes.append(new DidModifyOpcode(guard));opcodes.append(END);};VM.prototype.enter = function enter(start,end){var updating=new _glimmerUtil.LinkedList();var tracker=this.stack().pushUpdatableBlock();var state=this.capture();var tryOpcode=new TryOpcode(start,end,state,tracker,updating);this.didEnter(tryOpcode,updating);};VM.prototype.enterWithKey = function enterWithKey(key,start,end){var updating=new _glimmerUtil.LinkedList();var tracker=this.stack().pushUpdatableBlock();var state=this.capture();var tryOpcode=new TryOpcode(start,end,state,tracker,updating);this.listBlock().map[key] = tryOpcode;this.didEnter(tryOpcode,updating);};VM.prototype.enterList = function enterList(start,end){var updating=new _glimmerUtil.LinkedList();var tracker=this.stack().pushBlockList(updating);var state=this.capture();var artifacts=this.frame.getIterator().artifacts;var opcode=new ListBlockOpcode(start,end,state,tracker,updating,artifacts);this.listBlockStack.push(opcode);this.didEnter(opcode,updating);};VM.prototype.didEnter = function didEnter(opcode,updating){this.updateWith(opcode);this.updatingOpcodeStack.push(updating);};VM.prototype.exit = function exit(){this.stack().popBlock();this.updatingOpcodeStack.pop();var parent=this.updating().tail();parent.didInitializeChildren();};VM.prototype.exitList = function exitList(){this.exit();this.listBlockStack.pop();};VM.prototype.updateWith = function updateWith(opcode){this.updating().append(opcode);};VM.prototype.listBlock = function listBlock(){return _glimmerUtil.expect(this.listBlockStack.current,'expected a list block');};VM.prototype.updating = function updating(){return _glimmerUtil.expect(this.updatingOpcodeStack.current,'expected updating opcode on the updating opcode stack');};VM.prototype.stack = function stack(){return this.elementStack;};VM.prototype.scope = function scope(){return _glimmerUtil.expect(this.scopeStack.current,'expected scope on the scope stack');};VM.prototype.dynamicScope = function dynamicScope(){return _glimmerUtil.expect(this.dynamicScopeStack.current,'expected dynamic scope on the dynamic scope stack');};VM.prototype.pushFrame = function pushFrame(block,args,callerScope){this.frame.push(block.start,block.end);if(args)this.frame.setArgs(args);if(args && args.blocks)this.frame.setBlocks(args.blocks);if(callerScope)this.frame.setCallerScope(callerScope);};VM.prototype.pushComponentFrame = function pushComponentFrame(layout,args,callerScope,component,manager,shadow){this.frame.push(layout.start,layout.end,component,manager,shadow);if(args)this.frame.setArgs(args);if(args && args.blocks)this.frame.setBlocks(args.blocks);if(callerScope)this.frame.setCallerScope(callerScope);};VM.prototype.pushEvalFrame = function pushEvalFrame(start,end){this.frame.push(start,end);};VM.prototype.pushChildScope = function pushChildScope(){this.scopeStack.push(this.scope().child());};VM.prototype.pushCallerScope = function pushCallerScope(){this.scopeStack.push(_glimmerUtil.expect(this.scope().getCallerScope(),'pushCallerScope is called when a caller scope is present'));};VM.prototype.pushDynamicScope = function pushDynamicScope(){var child=this.dynamicScope().child();this.dynamicScopeStack.push(child);return child;};VM.prototype.pushRootScope = function pushRootScope(self,size){var scope=Scope.root(self,size);this.scopeStack.push(scope);return scope;};VM.prototype.popScope = function popScope(){this.scopeStack.pop();};VM.prototype.popDynamicScope = function popDynamicScope(){this.dynamicScopeStack.pop();};VM.prototype.newDestroyable = function newDestroyable(d){this.stack().newDestroyable(d);}; /// SCOPE HELPERS +VM.prototype.getSelf = function getSelf(){return this.scope().getSelf();};VM.prototype.referenceForSymbol = function referenceForSymbol(symbol){return this.scope().getSymbol(symbol);};VM.prototype.getArgs = function getArgs(){return this.frame.getArgs();}; /// EXECUTION +VM.prototype.resume = function resume(start,end,frame){return this.execute(start,end,function(vm){return vm.frame.restore(frame);});};VM.prototype.execute = function execute(start,end,initialize){this.prepare(start,end,initialize);var result=undefined;while(true) {result = this.next();if(result.done)break;}return result.value;};VM.prototype.prepare = function prepare(start,end,initialize){var elementStack=this.elementStack;var frame=this.frame;var updatingOpcodeStack=this.updatingOpcodeStack;elementStack.pushSimpleBlock();updatingOpcodeStack.push(new _glimmerUtil.LinkedList());frame.push(start,end);if(initialize)initialize(this);};VM.prototype.next = function next(){var frame=this.frame;var env=this.env;var updatingOpcodeStack=this.updatingOpcodeStack;var elementStack=this.elementStack;var opcode=undefined;if(opcode = frame.nextStatement(env)){APPEND_OPCODES.evaluate(this,opcode);return {done:false,value:null};}return {done:true,value:new RenderResult(env,_glimmerUtil.expect(updatingOpcodeStack.pop(),'there should be a final updating opcode stack'),elementStack.popBlock())};};VM.prototype.evaluateOpcode = function evaluateOpcode(opcode){APPEND_OPCODES.evaluate(this,opcode);}; // Make sure you have opcodes that push and pop a scope around this opcode +// if you need to change the scope. +VM.prototype.invokeBlock = function invokeBlock(block,args){var compiled=block.compile(this.env);this.pushFrame(compiled,args);};VM.prototype.invokePartial = function invokePartial(block){var compiled=block.compile(this.env);this.pushFrame(compiled);};VM.prototype.invokeLayout = function invokeLayout(args,layout,callerScope,component,manager,shadow){this.pushComponentFrame(layout,args,callerScope,component,manager,shadow);};VM.prototype.evaluateOperand = function evaluateOperand(expr){this.frame.setOperand(expr.evaluate(this));};VM.prototype.evaluateArgs = function evaluateArgs(args){var evaledArgs=this.frame.setArgs(args.evaluate(this));this.frame.setOperand(evaledArgs.positional.at(0));};VM.prototype.bindPositionalArgs = function bindPositionalArgs(symbols){var args=_glimmerUtil.expect(this.frame.getArgs(),'bindPositionalArgs assumes a previous setArgs');var positional=args.positional;var scope=this.scope();for(var i=0;i < symbols.length;i++) {scope.bindSymbol(symbols[i],positional.at(i));}};VM.prototype.bindNamedArgs = function bindNamedArgs(names,symbols){var args=_glimmerUtil.expect(this.frame.getArgs(),'bindNamedArgs assumes a previous setArgs');var scope=this.scope();var named=args.named;for(var i=0;i < names.length;i++) {var _name2=this.constants.getString(names[i]);scope.bindSymbol(symbols[i],named.get(_name2));}};VM.prototype.bindBlocks = function bindBlocks(names,symbols){var blocks=this.frame.getBlocks();var scope=this.scope();for(var i=0;i < names.length;i++) {var _name3=this.constants.getString(names[i]);scope.bindBlock(symbols[i],blocks && blocks[_name3] || null);}};VM.prototype.bindPartialArgs = function bindPartialArgs(symbol){var args=_glimmerUtil.expect(this.frame.getArgs(),'bindPartialArgs assumes a previous setArgs');var scope=this.scope();_glimmerUtil.assert(args,"Cannot bind named args");scope.bindPartialArgs(symbol,args);};VM.prototype.bindCallerScope = function bindCallerScope(){var callerScope=this.frame.getCallerScope();var scope=this.scope();_glimmerUtil.assert(callerScope,"Cannot bind caller scope");scope.bindCallerScope(callerScope);};VM.prototype.bindDynamicScope = function bindDynamicScope(names){var args=_glimmerUtil.expect(this.frame.getArgs(),'bindDynamicScope assumes a previous setArgs');var scope=this.dynamicScope();_glimmerUtil.assert(args,"Cannot bind dynamic scope");for(var i=0;i < names.length;i++) {var _name4=this.constants.getString(names[i]);scope.set(_name4,args.named.get(_name4));}};return VM;})();var UpdatingVM=(function(){function UpdatingVM(env,_ref30){var _ref30$alwaysRevalidate=_ref30.alwaysRevalidate;var alwaysRevalidate=_ref30$alwaysRevalidate === undefined?false:_ref30$alwaysRevalidate;this.frameStack = new _glimmerUtil.Stack();this.env = env;this.constants = env.constants;this.dom = env.getDOM();this.alwaysRevalidate = alwaysRevalidate;}UpdatingVM.prototype.execute = function execute(opcodes,handler){var frameStack=this.frameStack;this.try(opcodes,handler);while(true) {if(frameStack.isEmpty())break;var opcode=this.frame.nextStatement();if(opcode === null){this.frameStack.pop();continue;}opcode.evaluate(this);}};UpdatingVM.prototype.goto = function goto(op){this.frame.goto(op);};UpdatingVM.prototype.try = function _try(ops,handler){this.frameStack.push(new UpdatingVMFrame(this,ops,handler));};UpdatingVM.prototype.throw = function _throw(){this.frame.handleException();this.frameStack.pop();};UpdatingVM.prototype.evaluateOpcode = function evaluateOpcode(opcode){opcode.evaluate(this);};babelHelpers.createClass(UpdatingVM,[{key:'frame',get:function(){return _glimmerUtil.expect(this.frameStack.current,'bug: expected a frame');}}]);return UpdatingVM;})();var BlockOpcode=(function(_UpdatingOpcode8){babelHelpers.inherits(BlockOpcode,_UpdatingOpcode8);function BlockOpcode(start,end,state,bounds,children){_UpdatingOpcode8.call(this);this.start = start;this.end = end;this.type = "block";this.next = null;this.prev = null;var env=state.env;var scope=state.scope;var dynamicScope=state.dynamicScope;var frame=state.frame;this.children = children;this.env = env;this.scope = scope;this.dynamicScope = dynamicScope;this.frame = frame;this.bounds = bounds;}BlockOpcode.prototype.parentElement = function parentElement(){return this.bounds.parentElement();};BlockOpcode.prototype.firstNode = function firstNode(){return this.bounds.firstNode();};BlockOpcode.prototype.lastNode = function lastNode(){return this.bounds.lastNode();};BlockOpcode.prototype.evaluate = function evaluate(vm){vm.try(this.children,null);};BlockOpcode.prototype.destroy = function destroy(){this.bounds.destroy();};BlockOpcode.prototype.didDestroy = function didDestroy(){this.env.didDestroy(this.bounds);};BlockOpcode.prototype.toJSON = function toJSON(){var details=_glimmerUtil.dict();details["guid"] = '' + this._guid;return {guid:this._guid,type:this.type,details:details,children:this.children.toArray().map(function(op){return op.toJSON();})};};return BlockOpcode;})(UpdatingOpcode);var TryOpcode=(function(_BlockOpcode){babelHelpers.inherits(TryOpcode,_BlockOpcode);function TryOpcode(start,end,state,bounds,children){_BlockOpcode.call(this,start,end,state,bounds,children);this.type = "try";this.tag = this._tag = new _glimmerReference.UpdatableTag(_glimmerReference.CONSTANT_TAG);}TryOpcode.prototype.didInitializeChildren = function didInitializeChildren(){this._tag.update(_glimmerReference.combineSlice(this.children));};TryOpcode.prototype.evaluate = function evaluate(vm){vm.try(this.children,this);};TryOpcode.prototype.handleException = function handleException(){var env=this.env;var scope=this.scope;var start=this.start;var end=this.end;var dynamicScope=this.dynamicScope;var frame=this.frame;var elementStack=ElementStack.resume(this.env,this.bounds,this.bounds.reset(env));var vm=new VM(env,scope,dynamicScope,elementStack);var result=vm.resume(start,end,frame);this.children = result.opcodes();this.didInitializeChildren();};TryOpcode.prototype.toJSON = function toJSON(){var json=_BlockOpcode.prototype.toJSON.call(this);var details=json["details"];if(!details){details = json["details"] = {};}return _BlockOpcode.prototype.toJSON.call(this);};return TryOpcode;})(BlockOpcode);var ListRevalidationDelegate=(function(){function ListRevalidationDelegate(opcode,marker){this.opcode = opcode;this.marker = marker;this.didInsert = false;this.didDelete = false;this.map = opcode.map;this.updating = opcode['children'];}ListRevalidationDelegate.prototype.insert = function insert(key,item,memo,before){var map=this.map;var opcode=this.opcode;var updating=this.updating;var nextSibling=null;var reference=null;if(before){reference = map[before];nextSibling = reference['bounds'].firstNode();}else {nextSibling = this.marker;}var vm=opcode.vmForInsertion(nextSibling);var tryOpcode=null;vm.execute(opcode.start,opcode.end,function(vm){vm.frame.setArgs(EvaluatedArgs.positional([item,memo]));vm.frame.setOperand(item);vm.frame.setCondition(new _glimmerReference.ConstReference(true));vm.frame.setKey(key);var state=vm.capture();var tracker=vm.stack().pushUpdatableBlock();tryOpcode = new TryOpcode(opcode.start,opcode.end,state,tracker,vm.updating());});tryOpcode.didInitializeChildren();updating.insertBefore(tryOpcode,reference);map[key] = tryOpcode;this.didInsert = true;};ListRevalidationDelegate.prototype.retain = function retain(_key,_item,_memo){};ListRevalidationDelegate.prototype.move = function move(key,_item,_memo,before){var map=this.map;var updating=this.updating;var entry=map[key];var reference=map[before] || null;if(before){moveBounds(entry,reference.firstNode());}else {moveBounds(entry,this.marker);}updating.remove(entry);updating.insertBefore(entry,reference);};ListRevalidationDelegate.prototype.delete = function _delete(key){var map=this.map;var opcode=map[key];opcode.didDestroy();clear(opcode);this.updating.remove(opcode);delete map[key];this.didDelete = true;};ListRevalidationDelegate.prototype.done = function done(){this.opcode.didInitializeChildren(this.didInsert || this.didDelete);};return ListRevalidationDelegate;})();var ListBlockOpcode=(function(_BlockOpcode2){babelHelpers.inherits(ListBlockOpcode,_BlockOpcode2);function ListBlockOpcode(start,end,state,bounds,children,artifacts){_BlockOpcode2.call(this,start,end,state,bounds,children);this.type = "list-block";this.map = _glimmerUtil.dict();this.lastIterated = _glimmerReference.INITIAL;this.artifacts = artifacts;var _tag=this._tag = new _glimmerReference.UpdatableTag(_glimmerReference.CONSTANT_TAG);this.tag = _glimmerReference.combine([artifacts.tag,_tag]);}ListBlockOpcode.prototype.didInitializeChildren = function didInitializeChildren(){var listDidChange=arguments.length <= 0 || arguments[0] === undefined?true:arguments[0];this.lastIterated = this.artifacts.tag.value();if(listDidChange){this._tag.update(_glimmerReference.combineSlice(this.children));}};ListBlockOpcode.prototype.evaluate = function evaluate(vm){var artifacts=this.artifacts;var lastIterated=this.lastIterated;if(!artifacts.tag.validate(lastIterated)){var bounds=this.bounds;var dom=vm.dom;var marker=dom.createComment('');dom.insertAfter(bounds.parentElement(),marker,_glimmerUtil.expect(bounds.lastNode(),"can't insert after an empty bounds"));var target=new ListRevalidationDelegate(this,marker);var synchronizer=new _glimmerReference.IteratorSynchronizer({target:target,artifacts:artifacts});synchronizer.sync();this.parentElement().removeChild(marker);} // Run now-updated updating opcodes +_BlockOpcode2.prototype.evaluate.call(this,vm);};ListBlockOpcode.prototype.vmForInsertion = function vmForInsertion(nextSibling){var env=this.env;var scope=this.scope;var dynamicScope=this.dynamicScope;var elementStack=ElementStack.forInitialRender(this.env,this.bounds.parentElement(),nextSibling);return new VM(env,scope,dynamicScope,elementStack);};ListBlockOpcode.prototype.toJSON = function toJSON(){var json=_BlockOpcode2.prototype.toJSON.call(this);var map=this.map;var inner=Object.keys(map).map(function(key){return JSON.stringify(key) + ': ' + map[key]._guid;}).join(", ");var details=json["details"];if(!details){details = json["details"] = {};}details["map"] = '{' + inner + '}';return json;};return ListBlockOpcode;})(BlockOpcode);var UpdatingVMFrame=(function(){function UpdatingVMFrame(vm,ops,exceptionHandler){this.vm = vm;this.ops = ops;this.exceptionHandler = exceptionHandler;this.vm = vm;this.ops = ops;this.current = ops.head();}UpdatingVMFrame.prototype.goto = function goto(op){this.current = op;};UpdatingVMFrame.prototype.nextStatement = function nextStatement(){var current=this.current;var ops=this.ops;if(current)this.current = ops.nextNode(current);return current;};UpdatingVMFrame.prototype.handleException = function handleException(){if(this.exceptionHandler){this.exceptionHandler.handleException();}};return UpdatingVMFrame;})();APPEND_OPCODES.add(31, /* DynamicContent */function(vm,_ref31){var append=_ref31.op1;var opcode=vm.constants.getOther(append);opcode.evaluate(vm);});function isEmpty(value){return value === null || value === undefined || typeof value['toString'] !== 'function';}function normalizeTextValue(value){if(isEmpty(value)){return '';}return String(value);}function normalizeTrustedValue(value){if(isEmpty(value)){return '';}if(isString(value)){return value;}if(isSafeString(value)){return value.toHTML();}if(isNode(value)){return value;}return String(value);}function normalizeValue(value){if(isEmpty(value)){return '';}if(isString(value)){return value;}if(isSafeString(value) || isNode(value)){return value;}return String(value);}var AppendDynamicOpcode=(function(){function AppendDynamicOpcode(){}AppendDynamicOpcode.prototype.evaluate = function evaluate(vm){var reference=vm.frame.getOperand();var normalized=this.normalize(reference);var value=undefined,cache=undefined;if(_glimmerReference.isConst(reference)){value = normalized.value();}else {cache = new _glimmerReference.ReferenceCache(normalized);value = cache.peek();}var stack=vm.stack();var upsert=this.insert(vm.env.getAppendOperations(),stack,value);var bounds=new Fragment(upsert.bounds);stack.newBounds(bounds);if(cache /* i.e. !isConst(reference) */){vm.updateWith(this.updateWith(vm,reference,cache,bounds,upsert));}};return AppendDynamicOpcode;})();var GuardedAppendOpcode=(function(_AppendDynamicOpcode){babelHelpers.inherits(GuardedAppendOpcode,_AppendDynamicOpcode);function GuardedAppendOpcode(expression,symbolTable){_AppendDynamicOpcode.call(this);this.expression = expression;this.symbolTable = symbolTable;this.start = -1;this.end = -1;}GuardedAppendOpcode.prototype.evaluate = function evaluate(vm){if(this.start === -1){vm.evaluateOperand(this.expression);var value=vm.frame.getOperand().value();if(isComponentDefinition(value)){this.deopt(vm.env);vm.pushEvalFrame(this.start,this.end);}else {_AppendDynamicOpcode.prototype.evaluate.call(this,vm);}}else {vm.pushEvalFrame(this.start,this.end);}};GuardedAppendOpcode.prototype.deopt = function deopt(env){var _this3=this; // At compile time, we determined that this append callsite might refer +// to a local variable/property lookup that resolves to a component +// definition at runtime. +// +// We could have eagerly compiled this callsite into something like this: +// +// {{#if (is-component-definition foo)}} +// {{component foo}} +// {{else}} +// {{foo}} +// {{/if}} +// +// However, in practice, there might be a large amout of these callsites +// and most of them would resolve to a simple value lookup. Therefore, we +// tried to be optimistic and assumed that the callsite will resolve to +// appending a simple value. +// +// However, we have reached here because at runtime, the guard conditional +// have detected that this callsite is indeed referring to a component +// definition object. Since this is likely going to be true for other +// instances of the same callsite, it is now appropiate to deopt into the +// expanded version that handles both cases. The compilation would look +// like this: +// +// PutValue(expression) +// Test(is-component-definition) +// Enter(BEGIN, END) +// BEGIN: Noop +// JumpUnless(VALUE) +// PutDynamicComponentDefinitionOpcode +// OpenComponent +// CloseComponent +// Jump(END) +// VALUE: Noop +// OptimizedAppend +// END: Noop +// Exit +// +// Keep in mind that even if we *don't* reach here at initial render time, +// it is still possible (although quite rare) that the simple value we +// encounter during initial render could later change into a component +// definition object at update time. That is handled by the "lazy deopt" +// code on the update side (scroll down for the next big block of comment). +var dsl=new OpcodeBuilder(this.symbolTable,env);dsl.putValue(this.expression);dsl.test(IsComponentDefinitionReference.create);dsl.labelled(null,function(dsl,_BEGIN,END){dsl.jumpUnless('VALUE');dsl.putDynamicComponentDefinition();dsl.openComponent(CompiledArgs.empty());dsl.closeComponent();dsl.jump(END);dsl.label('VALUE');dsl.dynamicContent(new _this3.AppendOpcode());});this.start = dsl.start;this.end = dsl.end; // From this point on, we have essentially replaced ourselves with a new set +// of opcodes. Since we will always be executing the new/deopted code, it's +// a good idea (as a pattern) to null out any unneeded fields here to avoid +// holding on to unneeded/stale objects: +// QUESTION: Shouldn't this whole object be GCed? If not, why not? +this.expression = null;return dsl.start;};return GuardedAppendOpcode;})(AppendDynamicOpcode);var IsComponentDefinitionReference=(function(_ConditionalReference){babelHelpers.inherits(IsComponentDefinitionReference,_ConditionalReference);function IsComponentDefinitionReference(){_ConditionalReference.apply(this,arguments);}IsComponentDefinitionReference.create = function create(inner){return new IsComponentDefinitionReference(inner);};IsComponentDefinitionReference.prototype.toBool = function toBool(value){return isComponentDefinition(value);};return IsComponentDefinitionReference;})(ConditionalReference);var UpdateOpcode=(function(_UpdatingOpcode9){babelHelpers.inherits(UpdateOpcode,_UpdatingOpcode9);function UpdateOpcode(cache,bounds,upsert){_UpdatingOpcode9.call(this);this.cache = cache;this.bounds = bounds;this.upsert = upsert;this.tag = cache.tag;}UpdateOpcode.prototype.evaluate = function evaluate(vm){var value=this.cache.revalidate();if(_glimmerReference.isModified(value)){var bounds=this.bounds;var upsert=this.upsert;var dom=vm.dom;if(!this.upsert.update(dom,value)){var cursor=new Cursor(bounds.parentElement(),clear(bounds));upsert = this.upsert = this.insert(vm.env.getAppendOperations(),cursor,value);}bounds.update(upsert.bounds);}};UpdateOpcode.prototype.toJSON = function toJSON(){var guid=this._guid;var type=this.type;var cache=this.cache;return {guid:guid,type:type,details:{lastValue:JSON.stringify(cache.peek())}};};return UpdateOpcode;})(UpdatingOpcode);var GuardedUpdateOpcode=(function(_UpdateOpcode){babelHelpers.inherits(GuardedUpdateOpcode,_UpdateOpcode);function GuardedUpdateOpcode(reference,cache,bounds,upsert,appendOpcode,state){_UpdateOpcode.call(this,cache,bounds,upsert);this.reference = reference;this.appendOpcode = appendOpcode;this.state = state;this.deopted = null;this.tag = this._tag = new _glimmerReference.UpdatableTag(this.tag);}GuardedUpdateOpcode.prototype.evaluate = function evaluate(vm){if(this.deopted){vm.evaluateOpcode(this.deopted);}else {if(isComponentDefinition(this.reference.value())){this.lazyDeopt(vm);}else {_UpdateOpcode.prototype.evaluate.call(this,vm);}}};GuardedUpdateOpcode.prototype.lazyDeopt = function lazyDeopt(vm){ // Durign initial render, we know that the reference does not contain a +// component definition, so we optimistically assumed that this append +// is just a normal append. However, at update time, we discovered that +// the reference has switched into containing a component definition, so +// we need to do a "lazy deopt", simulating what would have happened if +// we had decided to perform the deopt in the first place during initial +// render. +// +// More concretely, we would have expanded the curly into a if/else, and +// based on whether the value is a component definition or not, we would +// have entered either the dynamic component branch or the simple value +// branch. +// +// Since we rendered a simple value during initial render (and all the +// updates up until this point), we need to pretend that the result is +// produced by the "VALUE" branch of the deopted append opcode: +// +// Try(BEGIN, END) +// Assert(IsComponentDefinition, expected=false) +// OptimizedUpdate +// +// In this case, because the reference has switched from being a simple +// value into a component definition, what would have happened is that +// the assert would throw, causing the Try opcode to teardown the bounds +// and rerun the original append opcode. +// +// Since the Try opcode would have nuked the updating opcodes anyway, we +// wouldn't have to worry about simulating those. All we have to do is to +// execute the Try opcode and immediately throw. +var bounds=this.bounds;var appendOpcode=this.appendOpcode;var state=this.state;var env=vm.env;var deoptStart=appendOpcode.deopt(env);var enter=_glimmerUtil.expect(env.program.opcode(deoptStart + 8),'hardcoded deopt location');var start=enter.op1;var end=enter.op2;var tracker=new UpdatableBlockTracker(bounds.parentElement());tracker.newBounds(this.bounds);var children=new _glimmerUtil.LinkedList();state.frame.condition = IsComponentDefinitionReference.create(_glimmerUtil.expect(state.frame['operand'],'operand should be populated'));var deopted=this.deopted = new TryOpcode(start,end,state,tracker,children);this._tag.update(deopted.tag);vm.evaluateOpcode(deopted);vm.throw(); // From this point on, we have essentially replaced ourselve with a new +// opcode. Since we will always be executing the new/deopted code, it's a +// good idea (as a pattern) to null out any unneeded fields here to avoid +// holding on to unneeded/stale objects: +// QUESTION: Shouldn't this whole object be GCed? If not, why not? +this._tag = null;this.reference = null;this.cache = null;this.bounds = null;this.upsert = null;this.appendOpcode = null;this.state = null;};GuardedUpdateOpcode.prototype.toJSON = function toJSON(){var guid=this._guid;var type=this.type;var deopted=this.deopted;if(deopted){return {guid:guid,type:type,deopted:true,children:[deopted.toJSON()]};}else {return _UpdateOpcode.prototype.toJSON.call(this);}};return GuardedUpdateOpcode;})(UpdateOpcode);var OptimizedCautiousAppendOpcode=(function(_AppendDynamicOpcode2){babelHelpers.inherits(OptimizedCautiousAppendOpcode,_AppendDynamicOpcode2);function OptimizedCautiousAppendOpcode(){_AppendDynamicOpcode2.apply(this,arguments);this.type = 'optimized-cautious-append';}OptimizedCautiousAppendOpcode.prototype.normalize = function normalize(reference){return _glimmerReference.map(reference,normalizeValue);};OptimizedCautiousAppendOpcode.prototype.insert = function insert(dom,cursor,value){return cautiousInsert(dom,cursor,value);};OptimizedCautiousAppendOpcode.prototype.updateWith = function updateWith(_vm,_reference,cache,bounds,upsert){return new OptimizedCautiousUpdateOpcode(cache,bounds,upsert);};return OptimizedCautiousAppendOpcode;})(AppendDynamicOpcode);var OptimizedCautiousUpdateOpcode=(function(_UpdateOpcode2){babelHelpers.inherits(OptimizedCautiousUpdateOpcode,_UpdateOpcode2);function OptimizedCautiousUpdateOpcode(){_UpdateOpcode2.apply(this,arguments);this.type = 'optimized-cautious-update';}OptimizedCautiousUpdateOpcode.prototype.insert = function insert(dom,cursor,value){return cautiousInsert(dom,cursor,value);};return OptimizedCautiousUpdateOpcode;})(UpdateOpcode);var GuardedCautiousAppendOpcode=(function(_GuardedAppendOpcode){babelHelpers.inherits(GuardedCautiousAppendOpcode,_GuardedAppendOpcode);function GuardedCautiousAppendOpcode(){_GuardedAppendOpcode.apply(this,arguments);this.type = 'guarded-cautious-append';this.AppendOpcode = OptimizedCautiousAppendOpcode;}GuardedCautiousAppendOpcode.prototype.normalize = function normalize(reference){return _glimmerReference.map(reference,normalizeValue);};GuardedCautiousAppendOpcode.prototype.insert = function insert(dom,cursor,value){return cautiousInsert(dom,cursor,value);};GuardedCautiousAppendOpcode.prototype.updateWith = function updateWith(vm,reference,cache,bounds,upsert){return new GuardedCautiousUpdateOpcode(reference,cache,bounds,upsert,this,vm.capture());};return GuardedCautiousAppendOpcode;})(GuardedAppendOpcode);var GuardedCautiousUpdateOpcode=(function(_GuardedUpdateOpcode){babelHelpers.inherits(GuardedCautiousUpdateOpcode,_GuardedUpdateOpcode);function GuardedCautiousUpdateOpcode(){_GuardedUpdateOpcode.apply(this,arguments);this.type = 'guarded-cautious-update';}GuardedCautiousUpdateOpcode.prototype.insert = function insert(dom,cursor,value){return cautiousInsert(dom,cursor,value);};return GuardedCautiousUpdateOpcode;})(GuardedUpdateOpcode);var OptimizedTrustingAppendOpcode=(function(_AppendDynamicOpcode3){babelHelpers.inherits(OptimizedTrustingAppendOpcode,_AppendDynamicOpcode3);function OptimizedTrustingAppendOpcode(){_AppendDynamicOpcode3.apply(this,arguments);this.type = 'optimized-trusting-append';}OptimizedTrustingAppendOpcode.prototype.normalize = function normalize(reference){return _glimmerReference.map(reference,normalizeTrustedValue);};OptimizedTrustingAppendOpcode.prototype.insert = function insert(dom,cursor,value){return trustingInsert(dom,cursor,value);};OptimizedTrustingAppendOpcode.prototype.updateWith = function updateWith(_vm,_reference,cache,bounds,upsert){return new OptimizedTrustingUpdateOpcode(cache,bounds,upsert);};return OptimizedTrustingAppendOpcode;})(AppendDynamicOpcode);var OptimizedTrustingUpdateOpcode=(function(_UpdateOpcode3){babelHelpers.inherits(OptimizedTrustingUpdateOpcode,_UpdateOpcode3);function OptimizedTrustingUpdateOpcode(){_UpdateOpcode3.apply(this,arguments);this.type = 'optimized-trusting-update';}OptimizedTrustingUpdateOpcode.prototype.insert = function insert(dom,cursor,value){return trustingInsert(dom,cursor,value);};return OptimizedTrustingUpdateOpcode;})(UpdateOpcode);var GuardedTrustingAppendOpcode=(function(_GuardedAppendOpcode2){babelHelpers.inherits(GuardedTrustingAppendOpcode,_GuardedAppendOpcode2);function GuardedTrustingAppendOpcode(){_GuardedAppendOpcode2.apply(this,arguments);this.type = 'guarded-trusting-append';this.AppendOpcode = OptimizedTrustingAppendOpcode;}GuardedTrustingAppendOpcode.prototype.normalize = function normalize(reference){return _glimmerReference.map(reference,normalizeTrustedValue);};GuardedTrustingAppendOpcode.prototype.insert = function insert(dom,cursor,value){return trustingInsert(dom,cursor,value);};GuardedTrustingAppendOpcode.prototype.updateWith = function updateWith(vm,reference,cache,bounds,upsert){return new GuardedTrustingUpdateOpcode(reference,cache,bounds,upsert,this,vm.capture());};return GuardedTrustingAppendOpcode;})(GuardedAppendOpcode);var GuardedTrustingUpdateOpcode=(function(_GuardedUpdateOpcode2){babelHelpers.inherits(GuardedTrustingUpdateOpcode,_GuardedUpdateOpcode2);function GuardedTrustingUpdateOpcode(){_GuardedUpdateOpcode2.apply(this,arguments);this.type = 'trusting-update';}GuardedTrustingUpdateOpcode.prototype.insert = function insert(dom,cursor,value){return trustingInsert(dom,cursor,value);};return GuardedTrustingUpdateOpcode;})(GuardedUpdateOpcode);APPEND_OPCODES.add(49, /* PutDynamicPartial */function(vm,_ref32){var _symbolTable=_ref32.op1;var env=vm.env;var symbolTable=vm.constants.getOther(_symbolTable);function lookupPartial(name){var normalized=String(name);if(!env.hasPartial(normalized,symbolTable)){throw new Error('Could not find a partial named "' + normalized + '"');}return env.lookupPartial(normalized,symbolTable);}var reference=_glimmerReference.map(vm.frame.getOperand(),lookupPartial);var cache=_glimmerReference.isConst(reference)?undefined:new _glimmerReference.ReferenceCache(reference);var definition=cache?cache.peek():reference.value();vm.frame.setImmediate(definition);if(cache){vm.updateWith(new Assert(cache));}});APPEND_OPCODES.add(50, /* PutPartial */function(vm,_ref33){var _definition=_ref33.op1;var definition=vm.constants.getOther(_definition);vm.frame.setImmediate(definition);});APPEND_OPCODES.add(51, /* EvaluatePartial */function(vm,_ref34){var _symbolTable=_ref34.op1;var _cache=_ref34.op2;var symbolTable=vm.constants.getOther(_symbolTable);var cache=vm.constants.getOther(_cache);var _vm$frame$getImmediate=vm.frame.getImmediate();var template=_vm$frame$getImmediate.template;var block=cache[template.id];if(!block){block = template.asPartial(symbolTable);}vm.invokePartial(block);});var IterablePresenceReference=(function(){function IterablePresenceReference(artifacts){this.tag = artifacts.tag;this.artifacts = artifacts;}IterablePresenceReference.prototype.value = function value(){return !this.artifacts.isEmpty();};return IterablePresenceReference;})();APPEND_OPCODES.add(44, /* PutIterator */function(vm){var listRef=vm.frame.getOperand();var args=_glimmerUtil.expect(vm.frame.getArgs(),'PutIteratorOpcode expects a populated args register');var iterable=vm.env.iterableFor(listRef,args);var iterator=new _glimmerReference.ReferenceIterator(iterable);vm.frame.setIterator(iterator);vm.frame.setCondition(new IterablePresenceReference(iterator.artifacts));});APPEND_OPCODES.add(45, /* EnterList */function(vm,_ref35){var start=_ref35.op1;var end=_ref35.op2;vm.enterList(start,end);});APPEND_OPCODES.add(46, /* ExitList */function(vm){return vm.exitList();});APPEND_OPCODES.add(47, /* EnterWithKey */function(vm,_ref36){var start=_ref36.op1;var end=_ref36.op2;var key=_glimmerUtil.expect(vm.frame.getKey(),'EnterWithKeyOpcode expects a populated key register');vm.enterWithKey(key,start,end);});var TRUE_REF=new _glimmerReference.ConstReference(true);var FALSE_REF=new _glimmerReference.ConstReference(false);APPEND_OPCODES.add(48, /* NextIter */function(vm,_ref37){var end=_ref37.op1;var item=vm.frame.getIterator().next();if(item){vm.frame.setCondition(TRUE_REF);vm.frame.setKey(item.key);vm.frame.setOperand(item.value);vm.frame.setArgs(EvaluatedArgs.positional([item.value,item.memo]));}else {vm.frame.setCondition(FALSE_REF);vm.goto(end);}});var TemplateIterator=(function(){function TemplateIterator(vm){this.vm = vm;}TemplateIterator.prototype.next = function next(){return this.vm.next();};return TemplateIterator;})();var clientId=0;function templateFactory(_ref38){var templateId=_ref38.id;var meta=_ref38.meta;var block=_ref38.block;var parsedBlock=undefined;var id=templateId || 'client-' + clientId++;var create=function(env,envMeta){var newMeta=envMeta?_glimmerUtil.assign({},envMeta,meta):meta;if(!parsedBlock){parsedBlock = JSON.parse(block);}return template(parsedBlock,id,newMeta,env);};return {id:id,meta:meta,create:create};}function template(block,id,meta,env){var scanner=new Scanner(block,meta,env);var entryPoint=undefined;var asEntryPoint=function(){if(!entryPoint)entryPoint = scanner.scanEntryPoint();return entryPoint;};var layout=undefined;var asLayout=function(){if(!layout)layout = scanner.scanLayout();return layout;};var asPartial=function(symbols){return scanner.scanPartial(symbols);};var render=function(self,appendTo,dynamicScope){var elementStack=ElementStack.forInitialRender(env,appendTo,null);var compiled=asEntryPoint().compile(env);var vm=VM.initial(env,self,dynamicScope,elementStack,compiled);return new TemplateIterator(vm);};return {id:id,meta:meta,_block:block,asEntryPoint:asEntryPoint,asLayout:asLayout,asPartial:asPartial,render:render};}var DynamicVarReference=(function(){function DynamicVarReference(scope,nameRef){this.scope = scope;this.nameRef = nameRef;var varTag=this.varTag = new _glimmerReference.UpdatableTag(_glimmerReference.CONSTANT_TAG);this.tag = _glimmerReference.combine([nameRef.tag,varTag]);}DynamicVarReference.prototype.value = function value(){return this.getVar().value();};DynamicVarReference.prototype.get = function get(key){return this.getVar().get(key);};DynamicVarReference.prototype.getVar = function getVar(){var name=String(this.nameRef.value());var ref=this.scope.get(name);this.varTag.update(ref.tag);return ref;};return DynamicVarReference;})();function getDynamicVar(vm,args,_symbolTable){var scope=vm.dynamicScope();var nameRef=args.positional.at(0);return new DynamicVarReference(scope,nameRef);}var PartialDefinition=function PartialDefinition(name,template){this.name = name;this.template = template;};var NodeType;(function(NodeType){NodeType[NodeType["Element"] = 0] = "Element";NodeType[NodeType["Attribute"] = 1] = "Attribute";NodeType[NodeType["Text"] = 2] = "Text";NodeType[NodeType["CdataSection"] = 3] = "CdataSection";NodeType[NodeType["EntityReference"] = 4] = "EntityReference";NodeType[NodeType["Entity"] = 5] = "Entity";NodeType[NodeType["ProcessingInstruction"] = 6] = "ProcessingInstruction";NodeType[NodeType["Comment"] = 7] = "Comment";NodeType[NodeType["Document"] = 8] = "Document";NodeType[NodeType["DocumentType"] = 9] = "DocumentType";NodeType[NodeType["DocumentFragment"] = 10] = "DocumentFragment";NodeType[NodeType["Notation"] = 11] = "Notation";})(NodeType || (NodeType = {}));var Simple=Object.freeze({get NodeType(){return NodeType;}});exports.Simple = Simple;exports.templateFactory = templateFactory;exports.NULL_REFERENCE = NULL_REFERENCE;exports.UNDEFINED_REFERENCE = UNDEFINED_REFERENCE;exports.PrimitiveReference = PrimitiveReference;exports.ConditionalReference = ConditionalReference;exports.OpcodeBuilderDSL = OpcodeBuilder;exports.compileLayout = compileLayout;exports.CompiledBlock = CompiledBlock;exports.CompiledProgram = CompiledProgram;exports.IAttributeManager = AttributeManager;exports.AttributeManager = AttributeManager;exports.PropertyManager = PropertyManager;exports.INPUT_VALUE_PROPERTY_MANAGER = INPUT_VALUE_PROPERTY_MANAGER;exports.defaultManagers = defaultManagers;exports.defaultAttributeManagers = defaultAttributeManagers;exports.defaultPropertyManagers = defaultPropertyManagers;exports.readDOMAttr = readDOMAttr;exports.normalizeTextValue = normalizeTextValue;exports.CompiledExpression = CompiledExpression;exports.CompiledArgs = CompiledArgs;exports.CompiledNamedArgs = CompiledNamedArgs;exports.CompiledPositionalArgs = CompiledPositionalArgs;exports.EvaluatedArgs = EvaluatedArgs;exports.EvaluatedNamedArgs = EvaluatedNamedArgs;exports.EvaluatedPositionalArgs = EvaluatedPositionalArgs;exports.getDynamicVar = getDynamicVar;exports.BlockMacros = Blocks;exports.InlineMacros = Inlines;exports.compileArgs = compileArgs;exports.setDebuggerCallback = setDebuggerCallback;exports.resetDebuggerCallback = resetDebuggerCallback;exports.BaselineSyntax = BaselineSyntax;exports.Layout = Layout;exports.UpdatingVM = UpdatingVM;exports.RenderResult = RenderResult;exports.isSafeString = isSafeString;exports.Scope = Scope;exports.Environment = Environment;exports.PartialDefinition = PartialDefinition;exports.ComponentDefinition = ComponentDefinition;exports.isComponentDefinition = isComponentDefinition;exports.DOMChanges = helper$1;exports.IDOMChanges = DOMChanges;exports.DOMTreeConstruction = DOMTreeConstruction;exports.isWhitespace = isWhitespace;exports.insertHTMLBefore = _insertHTMLBefore;exports.ElementStack = ElementStack;exports.ConcreteBounds = ConcreteBounds;}); +enifed('@glimmer/util', ['exports'], function (exports) { + // There is a small whitelist of namespaced attributes specially + // enumerated in + // https://www.w3.org/TR/html/syntax.html#attributes-0 + // + // > When a foreign element has one of the namespaced attributes given by + // > the local name and namespace of the first and second cells of a row + // > from the following table, it must be written using the name given by + // > the third cell from the same row. + // + // In all other cases, colons are interpreted as a regular character + // with no special meaning: + // + // > No other namespaced attribute can be expressed in the HTML syntax. + 'use strict'; + + var XLINK = 'http://www.w3.org/1999/xlink'; + var XML = 'http://www.w3.org/XML/1998/namespace'; + var XMLNS = 'http://www.w3.org/2000/xmlns/'; + var WHITELIST = { + 'xlink:actuate': XLINK, + 'xlink:arcrole': XLINK, + 'xlink:href': XLINK, + 'xlink:role': XLINK, + 'xlink:show': XLINK, + 'xlink:title': XLINK, + 'xlink:type': XLINK, + 'xml:base': XML, + 'xml:lang': XML, + 'xml:space': XML, + 'xmlns': XMLNS, + 'xmlns:xlink': XMLNS + }; + function getAttrNamespace(attrName) { + return WHITELIST[attrName] || null; + } + + // tslint:disable-line + function unwrap(val) { + if (val === null || val === undefined) throw new Error('Expected value to be present'); + return val; + } + function expect(val, message) { + if (val === null || val === undefined) throw new Error(message); + return val; + } + function unreachable() { + return new Error('unreachable'); + } + + // import Logger from './logger'; + // let alreadyWarned = false; + // import Logger from './logger'; + function debugAssert(test, msg) { + // if (!alreadyWarned) { + // alreadyWarned = true; + // Logger.warn("Don't leave debug assertions on in public builds"); + // } + if (!test) { + throw new Error(msg || "assertion failure"); + } + } + + var LogLevel; + (function (LogLevel) { + LogLevel[LogLevel["Trace"] = 0] = "Trace"; + LogLevel[LogLevel["Debug"] = 1] = "Debug"; + LogLevel[LogLevel["Warn"] = 2] = "Warn"; + LogLevel[LogLevel["Error"] = 3] = "Error"; + })(LogLevel || (exports.LogLevel = LogLevel = {})); + + var NullConsole = (function () { + function NullConsole() {} + + NullConsole.prototype.log = function log(_message) {}; + + NullConsole.prototype.warn = function warn(_message) {}; + + NullConsole.prototype.error = function error(_message) {}; + + NullConsole.prototype.trace = function trace() {}; + + return NullConsole; + })(); + + var ALWAYS = undefined; + + var Logger = (function () { + function Logger(_ref) { + var console = _ref.console; + var level = _ref.level; + + this.f = ALWAYS; + this.force = ALWAYS; + this.console = console; + this.level = level; + } + + Logger.prototype.skipped = function skipped(level) { + return level < this.level; + }; + + Logger.prototype.trace = function trace(message) { + var _ref2 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var _ref2$stackTrace = _ref2.stackTrace; + var stackTrace = _ref2$stackTrace === undefined ? false : _ref2$stackTrace; + + if (this.skipped(LogLevel.Trace)) return; + this.console.log(message); + if (stackTrace) this.console.trace(); + }; + + Logger.prototype.debug = function debug(message) { + var _ref3 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var _ref3$stackTrace = _ref3.stackTrace; + var stackTrace = _ref3$stackTrace === undefined ? false : _ref3$stackTrace; + + if (this.skipped(LogLevel.Debug)) return; + this.console.log(message); + if (stackTrace) this.console.trace(); + }; + + Logger.prototype.warn = function warn(message) { + var _ref4 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + var _ref4$stackTrace = _ref4.stackTrace; + var stackTrace = _ref4$stackTrace === undefined ? false : _ref4$stackTrace; + + if (this.skipped(LogLevel.Warn)) return; + this.console.warn(message); + if (stackTrace) this.console.trace(); + }; + + Logger.prototype.error = function error(message) { + if (this.skipped(LogLevel.Error)) return; + this.console.error(message); + }; + + return Logger; + })(); + + var _console = typeof console === 'undefined' ? new NullConsole() : console; + ALWAYS = new Logger({ console: _console, level: LogLevel.Trace }); + var LOG_LEVEL = LogLevel.Warn; + var logger = new Logger({ console: _console, level: LOG_LEVEL }); + + var objKeys = Object.keys; + + function assign(obj) { + for (var i = 1; i < arguments.length; i++) { + var assignment = arguments[i]; + if (assignment === null || typeof assignment !== 'object') continue; + var keys = objKeys(assignment); + for (var j = 0; j < keys.length; j++) { + var key = keys[j]; + obj[key] = assignment[key]; + } + } + return obj; + } + function fillNulls(count) { + var arr = new Array(count); + for (var i = 0; i < count; i++) { + arr[i] = null; + } + return arr; + } + + var GUID = 0; + function initializeGuid(object) { + return object._guid = ++GUID; + } + function ensureGuid(object) { + return object._guid || initializeGuid(object); + } + + var proto = Object.create(null, { + // without this, we will always still end up with (new + // EmptyObject()).constructor === Object + constructor: { + value: undefined, + enumerable: false, + writable: true + } + }); + function EmptyObject() {} + EmptyObject.prototype = proto; + function dict() { + // let d = Object.create(null); + // d.x = 1; + // delete d.x; + // return d; + return new EmptyObject(); + } + + var DictSet = (function () { + function DictSet() { + this.dict = dict(); + } + + DictSet.prototype.add = function add(obj) { + if (typeof obj === 'string') this.dict[obj] = obj;else this.dict[ensureGuid(obj)] = obj; + return this; + }; + + DictSet.prototype.delete = function _delete(obj) { + if (typeof obj === 'string') delete this.dict[obj];else if (obj._guid) delete this.dict[obj._guid]; + }; + + DictSet.prototype.forEach = function forEach(callback) { + var dict = this.dict; + + Object.keys(dict).forEach(function (key) { + return callback(dict[key]); + }); + }; + + DictSet.prototype.toArray = function toArray() { + return Object.keys(this.dict); + }; + + return DictSet; + })(); + + var Stack = (function () { + function Stack() { + this.stack = []; + this.current = null; + } + + Stack.prototype.toArray = function toArray() { + return this.stack; + }; + + Stack.prototype.push = function push(item) { + this.current = item; + this.stack.push(item); + }; + + Stack.prototype.pop = function pop() { + var item = this.stack.pop(); + var len = this.stack.length; + this.current = len === 0 ? null : this.stack[len - 1]; + return item === undefined ? null : item; + }; + + Stack.prototype.isEmpty = function isEmpty() { + return this.stack.length === 0; + }; + + return Stack; + })(); + + var ListNode = function ListNode(value) { + this.next = null; + this.prev = null; + this.value = value; + }; + + var LinkedList = (function () { + function LinkedList() { + this.clear(); + } + + LinkedList.fromSlice = function fromSlice(slice) { + var list = new LinkedList(); + slice.forEachNode(function (n) { + return list.append(n.clone()); + }); + return list; + }; + + LinkedList.prototype.head = function head() { + return this._head; + }; + + LinkedList.prototype.tail = function tail() { + return this._tail; + }; + + LinkedList.prototype.clear = function clear() { + this._head = this._tail = null; + }; + + LinkedList.prototype.isEmpty = function isEmpty() { + return this._head === null; + }; + + LinkedList.prototype.toArray = function toArray() { + var out = []; + this.forEachNode(function (n) { + return out.push(n); + }); + return out; + }; + + LinkedList.prototype.splice = function splice(start, end, reference) { + var before = undefined; + if (reference === null) { + before = this._tail; + this._tail = end; + } else { + before = reference.prev; + end.next = reference; + reference.prev = end; + } + if (before) { + before.next = start; + start.prev = before; + } + }; + + LinkedList.prototype.nextNode = function nextNode(node) { + return node.next; + }; + + LinkedList.prototype.prevNode = function prevNode(node) { + return node.prev; + }; + + LinkedList.prototype.forEachNode = function forEachNode(callback) { + var node = this._head; + while (node !== null) { + callback(node); + node = node.next; + } + }; + + LinkedList.prototype.contains = function contains(needle) { + var node = this._head; + while (node !== null) { + if (node === needle) return true; + node = node.next; + } + return false; + }; + + LinkedList.prototype.insertBefore = function insertBefore(node) { + var reference = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; + + if (reference === null) return this.append(node); + if (reference.prev) reference.prev.next = node;else this._head = node; + node.prev = reference.prev; + node.next = reference; + reference.prev = node; + return node; + }; + + LinkedList.prototype.append = function append(node) { + var tail = this._tail; + if (tail) { + tail.next = node; + node.prev = tail; + node.next = null; + } else { + this._head = node; + } + return this._tail = node; + }; + + LinkedList.prototype.pop = function pop() { + if (this._tail) return this.remove(this._tail); + return null; + }; + + LinkedList.prototype.prepend = function prepend(node) { + if (this._head) return this.insertBefore(node, this._head); + return this._head = this._tail = node; + }; + + LinkedList.prototype.remove = function remove(node) { + if (node.prev) node.prev.next = node.next;else this._head = node.next; + if (node.next) node.next.prev = node.prev;else this._tail = node.prev; + return node; + }; + + return LinkedList; + })(); + + var ListSlice = (function () { + function ListSlice(head, tail) { + this._head = head; + this._tail = tail; + } + + ListSlice.toList = function toList(slice) { + var list = new LinkedList(); + slice.forEachNode(function (n) { + return list.append(n.clone()); + }); + return list; + }; + + ListSlice.prototype.forEachNode = function forEachNode(callback) { + var node = this._head; + while (node !== null) { + callback(node); + node = this.nextNode(node); + } + }; + + ListSlice.prototype.contains = function contains(needle) { + var node = this._head; + while (node !== null) { + if (node === needle) return true; + node = node.next; + } + return false; + }; + + ListSlice.prototype.head = function head() { + return this._head; + }; + + ListSlice.prototype.tail = function tail() { + return this._tail; + }; + + ListSlice.prototype.toArray = function toArray() { + var out = []; + this.forEachNode(function (n) { + return out.push(n); + }); + return out; + }; + + ListSlice.prototype.nextNode = function nextNode(node) { + if (node === this._tail) return null; + return node.next; + }; + + ListSlice.prototype.prevNode = function prevNode(node) { + if (node === this._head) return null; + return node.prev; + }; + + ListSlice.prototype.isEmpty = function isEmpty() { + return false; + }; + + return ListSlice; + })(); + + var EMPTY_SLICE = new ListSlice(null, null); + + var HAS_TYPED_ARRAYS = typeof Uint32Array !== 'undefined'; + var A = undefined; + if (HAS_TYPED_ARRAYS) { + A = Uint32Array; + } else { + A = Array; + } + var A$1 = A; + + var HAS_NATIVE_WEAKMAP = (function () { + // detect if `WeakMap` is even present + var hasWeakMap = typeof WeakMap === 'function'; + if (!hasWeakMap) { + return false; + } + var instance = new WeakMap(); + // use `Object`'s `.toString` directly to prevent us from detecting + // polyfills as native weakmaps + return Object.prototype.toString.call(instance) === '[object WeakMap]'; + })(); + + exports.getAttrNamespace = getAttrNamespace; + exports.assert = debugAssert; + exports.LOGGER = logger; + exports.Logger = Logger; + exports.LogLevel = LogLevel; + exports.assign = assign; + exports.fillNulls = fillNulls; + exports.ensureGuid = ensureGuid; + exports.initializeGuid = initializeGuid; + exports.Stack = Stack; + exports.DictSet = DictSet; + exports.dict = dict; + exports.EMPTY_SLICE = EMPTY_SLICE; + exports.LinkedList = LinkedList; + exports.ListNode = ListNode; + exports.ListSlice = ListSlice; + exports.A = A$1; + exports.HAS_NATIVE_WEAKMAP = HAS_NATIVE_WEAKMAP; + exports.unwrap = unwrap; + exports.expect = expect; + exports.unreachable = unreachable; +}); +enifed("@glimmer/wire-format", ["exports"], function (exports) { + "use strict"; + + var Opcodes; + (function (Opcodes) { + // Statements + Opcodes[Opcodes["Text"] = 0] = "Text"; + Opcodes[Opcodes["Append"] = 1] = "Append"; + Opcodes[Opcodes["UnoptimizedAppend"] = 2] = "UnoptimizedAppend"; + Opcodes[Opcodes["OptimizedAppend"] = 3] = "OptimizedAppend"; + Opcodes[Opcodes["Comment"] = 4] = "Comment"; + Opcodes[Opcodes["Modifier"] = 5] = "Modifier"; + Opcodes[Opcodes["Block"] = 6] = "Block"; + Opcodes[Opcodes["ScannedBlock"] = 7] = "ScannedBlock"; + Opcodes[Opcodes["NestedBlock"] = 8] = "NestedBlock"; + Opcodes[Opcodes["Component"] = 9] = "Component"; + Opcodes[Opcodes["ScannedComponent"] = 10] = "ScannedComponent"; + Opcodes[Opcodes["OpenElement"] = 11] = "OpenElement"; + Opcodes[Opcodes["OpenPrimitiveElement"] = 12] = "OpenPrimitiveElement"; + Opcodes[Opcodes["FlushElement"] = 13] = "FlushElement"; + Opcodes[Opcodes["CloseElement"] = 14] = "CloseElement"; + Opcodes[Opcodes["StaticAttr"] = 15] = "StaticAttr"; + Opcodes[Opcodes["DynamicAttr"] = 16] = "DynamicAttr"; + Opcodes[Opcodes["AnyDynamicAttr"] = 17] = "AnyDynamicAttr"; + Opcodes[Opcodes["Yield"] = 18] = "Yield"; + Opcodes[Opcodes["Partial"] = 19] = "Partial"; + Opcodes[Opcodes["StaticPartial"] = 20] = "StaticPartial"; + Opcodes[Opcodes["DynamicPartial"] = 21] = "DynamicPartial"; + Opcodes[Opcodes["DynamicArg"] = 22] = "DynamicArg"; + Opcodes[Opcodes["StaticArg"] = 23] = "StaticArg"; + Opcodes[Opcodes["TrustingAttr"] = 24] = "TrustingAttr"; + Opcodes[Opcodes["Debugger"] = 25] = "Debugger"; + // Expressions + Opcodes[Opcodes["Unknown"] = 26] = "Unknown"; + Opcodes[Opcodes["Arg"] = 27] = "Arg"; + Opcodes[Opcodes["Get"] = 28] = "Get"; + Opcodes[Opcodes["HasBlock"] = 29] = "HasBlock"; + Opcodes[Opcodes["HasBlockParams"] = 30] = "HasBlockParams"; + Opcodes[Opcodes["Undefined"] = 31] = "Undefined"; + Opcodes[Opcodes["Function"] = 32] = "Function"; + Opcodes[Opcodes["Helper"] = 33] = "Helper"; + Opcodes[Opcodes["Concat"] = 34] = "Concat"; + })(Opcodes || (exports.Ops = Opcodes = {})); + + function is(variant) { + return function (value) { + return value[0] === variant; + }; + } + var Expressions; + (function (Expressions) { + Expressions.isUnknown = is(Opcodes.Unknown); + Expressions.isArg = is(Opcodes.Arg); + Expressions.isGet = is(Opcodes.Get); + Expressions.isConcat = is(Opcodes.Concat); + Expressions.isHelper = is(Opcodes.Helper); + Expressions.isHasBlock = is(Opcodes.HasBlock); + Expressions.isHasBlockParams = is(Opcodes.HasBlockParams); + Expressions.isUndefined = is(Opcodes.Undefined); + function isPrimitiveValue(value) { + if (value === null) { + return true; + } + return typeof value !== 'object'; + } + Expressions.isPrimitiveValue = isPrimitiveValue; + })(Expressions || (exports.Expressions = Expressions = {})); + var Statements; + (function (Statements) { + Statements.isText = is(Opcodes.Text); + Statements.isAppend = is(Opcodes.Append); + Statements.isComment = is(Opcodes.Comment); + Statements.isModifier = is(Opcodes.Modifier); + Statements.isBlock = is(Opcodes.Block); + Statements.isComponent = is(Opcodes.Component); + Statements.isOpenElement = is(Opcodes.OpenElement); + Statements.isFlushElement = is(Opcodes.FlushElement); + Statements.isCloseElement = is(Opcodes.CloseElement); + Statements.isStaticAttr = is(Opcodes.StaticAttr); + Statements.isDynamicAttr = is(Opcodes.DynamicAttr); + Statements.isYield = is(Opcodes.Yield); + Statements.isPartial = is(Opcodes.Partial); + Statements.isDynamicArg = is(Opcodes.DynamicArg); + Statements.isStaticArg = is(Opcodes.StaticArg); + Statements.isTrustingAttr = is(Opcodes.TrustingAttr); + Statements.isDebugger = is(Opcodes.Debugger); + function isAttribute(val) { + return val[0] === Opcodes.StaticAttr || val[0] === Opcodes.DynamicAttr; + } + Statements.isAttribute = isAttribute; + function isArgument(val) { + return val[0] === Opcodes.StaticArg || val[0] === Opcodes.DynamicArg; + } + Statements.isArgument = isArgument; + function isParameter(val) { + return isAttribute(val) || isArgument(val); + } + Statements.isParameter = isParameter; + function getParameterName(s) { + return s[1]; + } + Statements.getParameterName = getParameterName; + })(Statements || (exports.Statements = Statements = {})); + + exports.is = is; + exports.Expressions = Expressions; + exports.Statements = Statements; + exports.Ops = Opcodes; +}); enifed('backburner', ['exports'], function (exports) { 'use strict'; var NUMBER = /\d+/; function each(collection, callback) { @@ -1196,12 +3047,11 @@ exports['default'] = Backburner; Object.defineProperty(exports, '__esModule', { value: true }); }); -enifed('container/container', ['exports', 'ember-utils', 'ember-environment', 'ember-metal'], function (exports, _emberUtils, _emberEnvironment, _emberMetal) { - /* globals Proxy */ +enifed('container/container', ['exports', 'ember-debug', 'ember-utils', 'ember-environment'], function (exports, _emberDebug, _emberUtils, _emberEnvironment) { 'use strict'; var _Container$prototype; exports.default = Container; @@ -1307,11 +3157,11 @@ @param {Object} [options] @param {String} [options.source] The fullname of the request source (used for local lookup) @return {any} */ lookup: function (fullName, options) { - _emberMetal.assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); return lookup(this, this.registry.normalize(fullName), options); }, /** Given a fullName, return the corresponding factory. @@ -1321,24 +3171,24 @@ @param {Object} [options] @param {String} [options.source] The fullname of the request source (used for local lookup) @return {any} */ lookupFactory: function (fullName, options) { - _emberMetal.assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); - _emberMetal.deprecate('Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.', !true, { id: 'container-lookupFactory', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_migrating-from-_lookupfactory-to-factoryfor' }); + _emberDebug.deprecate('Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.', !true, { id: 'container-lookupFactory', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_migrating-from-_lookupfactory-to-factoryfor' }); return deprecatedFactoryFor(this, this.registry.normalize(fullName), options); } }, _Container$prototype[LOOKUP_FACTORY] = function (fullName, options) { - _emberMetal.assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.registry.validateFullName(fullName)); return deprecatedFactoryFor(this, this.registry.normalize(fullName), options); }, _Container$prototype[FACTORY_FOR] = function (fullName) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - if (false) { + if (true) { if (true) { return this.factoryFor(fullName, options); } else { /* This throws in case of a poorly designed build */ throw new Error('If ember-no-double-extend is enabled, ember-factory-for must also be enabled'); @@ -1348,22 +3198,17 @@ if (factory === undefined) { return; } var manager = new DeprecatedFactoryManager(this, factory, fullName); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { manager = wrapManagerInDeprecationProxy(manager); }); return manager; }, _Container$prototype.destroy = function () { - eachDestroyable(this, function (item) { - if (item.destroy) { - item.destroy(); - } - }); - + destroyDestroyables(this); this.isDestroyed = true; }, _Container$prototype.reset = function (fullName) { if (arguments.length > 0) { resetMember(this, this.registry.normalize(fullName)); } else { @@ -1433,11 +3278,11 @@ Container.prototype.factoryFor = function _factoryFor(fullName) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var normalizedName = this.registry.normalize(fullName); - _emberMetal.assert('fullName must be a proper full name', this.registry.validateFullName(normalizedName)); + _emberDebug.assert('fullName must be a proper full name', this.registry.validateFullName(normalizedName)); if (options.source) { normalizedName = this.registry.expandLocalLookup(fullName, options); // if expandLocalLookup returns falsey, we do not support local lookup if (!normalizedName) { @@ -1457,11 +3302,11 @@ return; } var manager = new FactoryManager(this, factory, fullName, normalizedName); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { manager = wrapManagerInDeprecationProxy(manager); }); this.factoryManagerCache[normalizedName] = manager; return manager; @@ -1470,11 +3315,11 @@ function isSingleton(container, fullName) { return container.registry.getOption(fullName, 'singleton') !== false; } - function shouldInstantiate(container, fullName) { + function isInstantiatable(container, fullName) { return container.registry.getOption(fullName, 'instantiate') !== false; } function lookup(container, fullName) { var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; @@ -1512,32 +3357,32 @@ function isSingletonClass(container, fullName, _ref2) { var instantiate = _ref2.instantiate; var singleton = _ref2.singleton; - return singleton !== false && isSingleton(container, fullName) && !instantiate && !shouldInstantiate(container, fullName); + return singleton !== false && isSingleton(container, fullName) && !instantiate && !isInstantiatable(container, fullName); } function isSingletonInstance(container, fullName, _ref3) { var instantiate = _ref3.instantiate; var singleton = _ref3.singleton; - return singleton !== false && isSingleton(container, fullName) && instantiate !== false && shouldInstantiate(container, fullName); + return singleton !== false && isSingleton(container, fullName) && instantiate !== false && isInstantiatable(container, fullName); } function isFactoryClass(container, fullname, _ref4) { var instantiate = _ref4.instantiate; var singleton = _ref4.singleton; - return (singleton === false || !isSingleton(container, fullname)) && instantiate === false && !shouldInstantiate(container, fullname); + return (singleton === false || !isSingleton(container, fullname)) && instantiate === false && !isInstantiatable(container, fullname); } function isFactoryInstance(container, fullName, _ref5) { var instantiate = _ref5.instantiate; var singleton = _ref5.singleton; - return (singleton !== false || isSingleton(container, fullName)) && instantiate !== false && shouldInstantiate(container, fullName); + return (singleton !== false || isSingleton(container, fullName)) && instantiate !== false && isInstantiatable(container, fullName); } function instantiateFactory(container, fullName, options) { var factoryManager = container[FACTORY_FOR](fullName); @@ -1587,12 +3432,12 @@ if (_arguments[i]) { injections = injections.concat(_arguments[i]); } } - _emberMetal.runInDebug(function () { - return container.registry.validateInjections(injections); + _emberDebug.runInDebug(function () { + container.registry.validateInjections(injections); }); for (var i = 0; i < injections.length; i++) { injection = injections[i]; hash[injection.property] = lookup(container, injection.fullName); @@ -1691,11 +3536,11 @@ throw new Error('Failed to create an instance of \'' + fullName + '\'. Most likely an improperly defined class or' + ' an invalid module export.'); } validationCache = container.validationCache; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { // Ensure that all lazy injections are valid at instantiation time if (!validationCache[fullName] && typeof factory._lazyInjections === 'function') { lazyInjections = factory._lazyInjections(); lazyInjections = container.registry.normalizeInjectionsHash(lazyInjections); @@ -1742,56 +3587,49 @@ factoryInjections._debugContainerKey = fullName; return factoryInjections; } - var INJECTED_DEPRECATED_CONTAINER_DESC = { - configurable: true, - enumerable: false, - get: function () { - _emberMetal.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); - return this[CONTAINER_OVERRIDE] || _emberUtils.getOwner(this).__container__; - }, - - set: function (value) { - _emberMetal.deprecate('Providing the `container` property to ' + this + ' is deprecated. Please use `Ember.setOwner` or `owner.ownerInjection()` instead to provide an owner to the instance being created.', false, { id: 'ember-application.injected-container', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); - - this[CONTAINER_OVERRIDE] = value; - - return value; - } - }; - // TODO - remove when Ember reaches v3.0.0 function injectDeprecatedContainer(object, container) { if ('container' in object) { return; } - Object.defineProperty(object, 'container', INJECTED_DEPRECATED_CONTAINER_DESC); + Object.defineProperty(object, 'container', { + configurable: true, + enumerable: false, + get: function () { + _emberDebug.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); + return this[CONTAINER_OVERRIDE] || container; + }, + + set: function (value) { + _emberDebug.deprecate('Providing the `container` property to ' + this + ' is deprecated. Please use `Ember.setOwner` or `owner.ownerInjection()` instead to provide an owner to the instance being created.', false, { id: 'ember-application.injected-container', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); + + this[CONTAINER_OVERRIDE] = value; + + return value; + } + }); } - function eachDestroyable(container, callback) { + function destroyDestroyables(container) { var cache = container.cache; var keys = Object.keys(cache); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = cache[key]; - if (container.registry.getOption(key, 'instantiate') !== false) { - callback(value); + if (isInstantiatable(container, key) && value.destroy) { + value.destroy(); } } } function resetCache(container) { - eachDestroyable(container, function (value) { - if (value.destroy) { - value.destroy(); - } - }); - + destroyDestroyables(container); container.cache.dict = _emberUtils.dictionary(null); } function resetMember(container, fullName) { var member = container.cache[fullName]; @@ -1821,13 +3659,13 @@ return fakeContainer; } function buildFakeContainerFunction(container, containerProperty, ownerProperty) { return function () { - _emberMetal.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper to access the owner of this object and then call `' + ownerProperty + '` instead.', false, { + _emberDebug.deprecate('Using the injected `container` is deprecated. Please use the `getOwner` helper to access the owner of this object and then call `' + ownerProperty + '` instead.', false, { id: 'ember-application.injected-container', - until: '2.13.0', + until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }); return container[containerProperty].apply(container, arguments); }; } @@ -1857,30 +3695,23 @@ this.container = container; this.class = factory; this.fullName = fullName; this.normalizedName = normalizedName; this.madeToString = undefined; - this.injections = undefined; } FactoryManager.prototype.create = function create() { var _this = this; var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - var injections = this.injections; - if (injections === undefined) { - injections = injectionsFor(this.container, this.normalizedName); - if (areInjectionsDynamic(injections) === false) { - this.injections = injections; - } - } + var injections = injectionsFor(this.container, this.normalizedName); var props = _emberUtils.assign({}, injections, options); props[_emberUtils.NAME_KEY] = this.madeToString || (this.madeToString = this.container.registry.makeToString(this.class, this.fullName)); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { var lazyInjections = undefined; var validationCache = _this.container.validationCache; // Ensure that all lazy injections are valid at instantiation time if (!validationCache[_this.fullName] && _this.class && typeof _this.class._lazyInjections === 'function') { lazyInjections = _this.class._lazyInjections(); @@ -1906,10 +3737,12 @@ return FactoryManager; })(); }); +/* globals Proxy */ + /* * This internal version of factoryFor swaps between the public API for * factoryFor (class is the registered class) and a transition implementation * (class is the double-extended class). It is *not* the public API version * of factoryFor, which always returns the registered class. @@ -1951,11 +3784,11 @@ exports.Container = _containerContainer.default; exports.buildFakeContainerWithDeprecations = _containerContainer.buildFakeContainerWithDeprecations; exports.FACTORY_FOR = _containerContainer.FACTORY_FOR; exports.LOOKUP_FACTORY = _containerContainer.LOOKUP_FACTORY; }); -enifed('container/registry', ['exports', 'ember-utils', 'ember-metal', 'container/container'], function (exports, _emberUtils, _emberMetal, _containerContainer) { +enifed('container/registry', ['exports', 'ember-utils', 'ember-debug', 'container/container'], function (exports, _emberUtils, _emberDebug, _containerContainer) { 'use strict'; exports.default = Registry; exports.privatize = privatize; @@ -2109,11 +3942,11 @@ @param {Object} options */ register: function (fullName, factory) { var options = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2]; - _emberMetal.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); if (factory === undefined) { throw new TypeError('Attempting to register an unknown factory: \'' + fullName + '\''); } @@ -2140,11 +3973,11 @@ @private @method unregister @param {String} fullName */ unregister: function (fullName) { - _emberMetal.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); var normalizedName = this.normalize(fullName); this._localLookupCache = Object.create(null); @@ -2181,11 +4014,11 @@ @param {Object} [options] @param {String} [options.source] the fullname of the request source (used for local lookups) @return {Function} fullName's factory */ resolve: function (fullName, options) { - _emberMetal.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); var factory = resolve(this, this.normalize(fullName), options); if (factory === undefined && this.fallback) { var _fallback; factory = (_fallback = this.fallback).resolve.apply(_fallback, arguments); @@ -2378,11 +4211,11 @@ @param {String} type @param {String} property @param {String} fullName */ typeInjection: function (type, property, fullName) { - _emberMetal.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); var fullNameType = fullName.split(':')[0]; if (fullNameType === type) { throw new Error('Cannot inject a \'' + fullName + '\' on other ' + type + '(s).'); } @@ -2434,11 +4267,11 @@ if (fullName.indexOf(':') === -1) { return this.typeInjection(fullName, property, normalizedInjectionName); } - _emberMetal.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); var normalizedName = this.normalize(fullName); var injections = this._injections[normalizedName] || (this._injections[normalizedName] = []); injections.push({ @@ -2583,22 +4416,20 @@ var fullName = undefined; for (var i = 0; i < injections.length; i++) { fullName = injections[i].fullName; - if (!this.has(fullName)) { - throw new Error('Attempting to inject an unknown injection: \'' + fullName + '\''); - } + _emberDebug.assert('Attempting to inject an unknown injection: \'' + fullName + '\'', this.has(fullName)); } }, normalizeInjectionsHash: function (hash) { var injections = []; for (var key in hash) { if (hash.hasOwnProperty(key)) { - _emberMetal.assert('Expected a proper full name, given \'' + hash[key] + '\'', this.validateFullName(hash[key])); + _emberDebug.assert('Expected a proper full name, given \'' + hash[key] + '\'', this.validateFullName(hash[key])); injections.push({ property: key, fullName: hash[key] }); @@ -2640,11 +4471,11 @@ return injections; } }; function deprecateResolverFunction(registry) { - _emberMetal.deprecate('Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.', false, { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' }); + _emberDebug.deprecate('Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.', false, { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' }); registry.resolver = { resolve: registry.resolver }; } @@ -2666,13 +4497,13 @@ @param {String} [options.source] the fullname of the request source (used for local lookups) @return {String} fullName */ Registry.prototype.expandLocalLookup = function Registry_expandLocalLookup(fullName, options) { if (this.resolver && this.resolver.expandLocalLookup) { - _emberMetal.assert('fullName must be a proper full name', this.validateFullName(fullName)); - _emberMetal.assert('options.source must be provided to expandLocalLookup', options && options.source); - _emberMetal.assert('options.source must be a proper full name', this.validateFullName(options.source)); + _emberDebug.assert('fullName must be a proper full name', this.validateFullName(fullName)); + _emberDebug.assert('options.source must be provided to expandLocalLookup', options && options.source); + _emberDebug.assert('options.source must be a proper full name', this.validateFullName(options.source)); var normalizedFullName = this.normalize(fullName); var normalizedSource = this.normalize(options.source); return expandLocalLookup(this, normalizedFullName, normalizedSource); @@ -3019,11 +4850,11 @@ bootstrap({ context: context, hasTemplate: _emberGlimmer.hasTemplate, setTemplate: _emberGlimmer.setTemplate }); } }); }); -enifed('ember-application/system/application-instance', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-environment', 'ember-views', 'ember-application/system/engine-instance'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberEnvironment, _emberViews, _emberApplicationSystemEngineInstance) { +enifed('ember-application/system/application-instance', ['exports', 'ember-utils', 'ember-debug', 'ember-metal', 'ember-runtime', 'ember-environment', 'ember-views', 'ember-application/system/engine-instance'], function (exports, _emberUtils, _emberDebug, _emberMetal, _emberRuntime, _emberEnvironment, _emberViews, _emberApplicationSystemEngineInstance) { /** @module ember @submodule ember-application */ @@ -3267,12 +5098,12 @@ }; var handleTransitionReject = function (error) { if (error.error) { throw error.error; - } else if (error.name === 'TransitionAborted' && router.router.activeTransition) { - return router.router.activeTransition.then(handleTransitionResolve, handleTransitionReject); + } else if (error.name === 'TransitionAborted' && router._routerMicrolib.activeTransition) { + return router._routerMicrolib.activeTransition.then(handleTransitionResolve, handleTransitionReject); } else if (error.name === 'TransitionAborted') { throw new Error(error.message); } else { throw error; } @@ -3489,13 +5320,13 @@ enumerable: false, get: function () { var instance = this; return { lookup: function () { - _emberMetal.deprecate('Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead.', false, { + _emberDebug.deprecate('Using `ApplicationInstance.container.lookup` is deprecated. Please use `ApplicationInstance.lookup` instead.', false, { id: 'ember-application.app-instance-container', - until: '2.13.0', + until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-applicationinstance-container' }); return instance.lookup.apply(instance, arguments); } }; @@ -3510,11 +5341,11 @@ } }); exports.default = ApplicationInstance; }); -enifed('ember-application/system/application', ['exports', 'ember-utils', 'ember-environment', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-routing', 'ember-application/system/application-instance', 'container', 'ember-application/system/engine', 'ember-glimmer'], function (exports, _emberUtils, _emberEnvironment, _emberMetal, _emberRuntime, _emberViews, _emberRouting, _emberApplicationSystemApplicationInstance, _container, _emberApplicationSystemEngine, _emberGlimmer) { +enifed('ember-application/system/application', ['exports', 'ember-utils', 'ember-environment', 'ember-debug', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-routing', 'ember-application/system/application-instance', 'container', 'ember-application/system/engine', 'ember-glimmer'], function (exports, _emberUtils, _emberEnvironment, _emberDebug, _emberMetal, _emberRuntime, _emberViews, _emberRouting, _emberApplicationSystemApplicationInstance, _container, _emberApplicationSystemEngine, _emberGlimmer) { /** @module ember @submodule ember-application */ 'use strict'; @@ -3802,11 +5633,11 @@ if (!this.$) { this.$ = _emberViews.jQuery; } registerLibraries(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return logLibraryVersions(); }); // Start off the number of deferrals at 1. This will be decremented by // the Application's own `boot` method. @@ -3954,12 +5785,12 @@ to use the router for this purpose. @method deferReadiness @public */ deferReadiness: function () { - _emberMetal.assert('You must call deferReadiness on an instance of Ember.Application', this instanceof Application); - _emberMetal.assert('You cannot defer readiness since the `ready()` hook has already been called.', this._readinessDeferrals > 0); + _emberDebug.assert('You must call deferReadiness on an instance of Ember.Application', this instanceof Application); + _emberDebug.assert('You cannot defer readiness since the `ready()` hook has already been called.', this._readinessDeferrals > 0); this._readinessDeferrals++; }, /** Call `advanceReadiness` after any asynchronous setup logic has completed. @@ -3968,11 +5799,11 @@ @method advanceReadiness @see {Ember.Application#deferReadiness} @public */ advanceReadiness: function () { - _emberMetal.assert('You must call advanceReadiness on an instance of Ember.Application', this instanceof Application); + _emberDebug.assert('You must call advanceReadiness on an instance of Ember.Application', this instanceof Application); this._readinessDeferrals--; if (this._readinessDeferrals === 0) { _emberMetal.run.once(this, this.didBecomeReady); } @@ -4095,11 +5926,11 @@ ``` @method reset @public */ reset: function () { - _emberMetal.assert('Calling reset() on instances of `Ember.Application` is not\n supported when globals mode is disabled; call `visit()` to\n create new `Ember.ApplicationInstance`s and dispose them\n via their `destroy()` method instead.', this._globalsMode && this.autoboot); + _emberDebug.assert('Calling reset() on instances of `Ember.Application` is not\n supported when globals mode is disabled; call `visit()` to\n create new `Ember.ApplicationInstance`s and dispose them\n via their `destroy()` method instead.', this._globalsMode && this.autoboot); var instance = this.__deprecatedInstance__; this._readinessDeferrals = 1; this._bootPromise = null; @@ -4120,11 +5951,11 @@ @method didBecomeReady */ didBecomeReady: function () { try { // TODO: Is this still needed for _globalsMode = false? - if (!_emberMetal.isTesting()) { + if (!_emberDebug.isTesting()) { // Eagerly name all classes that are already loaded _emberRuntime.Namespace.processAll(); _emberRuntime.setNamespaceSearchDisabled(true); } @@ -4419,10 +6250,15 @@ registry.register('location:hash', _emberRouting.HashLocation); registry.register('location:history', _emberRouting.HistoryLocation); registry.register('location:none', _emberRouting.NoneLocation); registry.register(_container.privatize(_templateObject), _emberRouting.BucketCache); + + if (false) { + registry.register('service:router', _emberRouting.RouterService); + registry.injection('service:router', 'router', 'router:main'); + } } function registerLibraries() { if (!librariesRegistered) { librariesRegistered = true; @@ -4434,11 +6270,11 @@ } function logLibraryVersions() { var _this2 = this; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { if (_emberEnvironment.ENV.LOG_VERSION) { // we only need to see this once per Application#init _emberEnvironment.ENV.LOG_VERSION = false; var libs = _emberMetal.libraries._registry; @@ -4446,24 +6282,24 @@ return _emberMetal.get(item, 'name.length'); }); var maxNameLength = Math.max.apply(_this2, nameLengths); - _emberMetal.debug('-------------------------------'); + _emberDebug.debug('-------------------------------'); for (var i = 0; i < libs.length; i++) { var lib = libs[i]; var spaces = new Array(maxNameLength - lib.name.length + 1).join(' '); - _emberMetal.debug([lib.name, spaces, ' : ', lib.version].join('')); + _emberDebug.debug([lib.name, spaces, ' : ', lib.version].join('')); } - _emberMetal.debug('-------------------------------'); + _emberDebug.debug('-------------------------------'); } }); } exports.default = Application; }); -enifed('ember-application/system/engine-instance', ['exports', 'ember-utils', 'ember-runtime', 'ember-metal', 'container', 'ember-application/system/engine-parent'], function (exports, _emberUtils, _emberRuntime, _emberMetal, _container, _emberApplicationSystemEngineParent) { +enifed('ember-application/system/engine-instance', ['exports', 'ember-utils', 'ember-runtime', 'ember-debug', 'ember-metal', 'container', 'ember-application/system/engine-parent'], function (exports, _emberUtils, _emberRuntime, _emberDebug, _emberMetal, _container, _emberApplicationSystemEngineParent) { /** @module ember @submodule ember-application */ @@ -4555,11 +6391,11 @@ _bootSync: function (options) { if (this._booted) { return this; } - _emberMetal.assert('An engine instance\'s parent must be set via `setEngineParent(engine, parent)` prior to calling `engine.boot()`.', _emberApplicationSystemEngineParent.getEngineParent(this)); + _emberDebug.assert('An engine instance\'s parent must be set via `setEngineParent(engine, parent)` prior to calling `engine.boot()`.', _emberApplicationSystemEngineParent.getEngineParent(this)); this.cloneParentDependencies(); this.setupRegistry(options); @@ -4611,11 +6447,11 @@ var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; var Engine = this.lookup('engine:' + name); if (!Engine) { - throw new _emberMetal.Error('You attempted to mount the engine \'' + name + '\', but it is not registered with its parent.'); + throw new _emberDebug.Error('You attempted to mount the engine \'' + name + '\', but it is not registered with its parent.'); } var engineInstance = Engine.buildInstance(options); _emberApplicationSystemEngineParent.setEngineParent(engineInstance, this); @@ -4719,11 +6555,11 @@ function setEngineParent(engine, parent) { engine[ENGINE_PARENT] = parent; } }); -enifed('ember-application/system/engine', ['exports', 'ember-utils', 'ember-runtime', 'container', 'dag-map', 'ember-metal', 'ember-application/system/resolver', 'ember-application/system/engine-instance', 'ember-routing', 'ember-extension-support', 'ember-views', 'ember-glimmer'], function (exports, _emberUtils, _emberRuntime, _container, _dagMap, _emberMetal, _emberApplicationSystemResolver, _emberApplicationSystemEngineInstance, _emberRouting, _emberExtensionSupport, _emberViews, _emberGlimmer) { +enifed('ember-application/system/engine', ['exports', 'ember-utils', 'ember-runtime', 'container', 'dag-map', 'ember-debug', 'ember-metal', 'ember-application/system/resolver', 'ember-application/system/engine-instance', 'ember-routing', 'ember-extension-support', 'ember-views', 'ember-glimmer'], function (exports, _emberUtils, _emberRuntime, _container, _dagMap, _emberDebug, _emberMetal, _emberApplicationSystemResolver, _emberApplicationSystemEngineInstance, _emberRouting, _emberExtensionSupport, _emberViews, _emberGlimmer) { /** @module ember @submodule ember-application */ 'use strict'; @@ -4831,13 +6667,13 @@ */ runInitializers: function () { var _this = this; this._runInitializer('initializers', function (name, initializer) { - _emberMetal.assert('No application initializer named \'' + name + '\'', !!initializer); + _emberDebug.assert('No application initializer named \'' + name + '\'', !!initializer); if (initializer.initialize.length === 2) { - _emberMetal.deprecate('The `initialize` method for Application initializer \'' + name + '\' should take only one argument - `App`, an instance of an `Application`.', false, { + _emberDebug.deprecate('The `initialize` method for Application initializer \'' + name + '\' should take only one argument - `App`, an instance of an `Application`.', false, { id: 'ember-application.app-initializer-initialize-arguments', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_initializer-arity' }); @@ -4853,11 +6689,11 @@ @since 1.12.0 @method runInstanceInitializers */ runInstanceInitializers: function (instance) { this._runInitializer('instanceInitializers', function (name, initializer) { - _emberMetal.assert('No instance initializer named \'' + name + '\'', !!initializer); + _emberDebug.assert('No instance initializer named \'' + name + '\'', !!initializer); initializer.initialize(instance); }); }, _runInitializer: function (bucketName, cb) { @@ -5117,13 +6953,13 @@ var attrs = {}; attrs[bucketName] = Object.create(this[bucketName]); this.reopenClass(attrs); } - _emberMetal.assert('The ' + humanName + ' \'' + initializer.name + '\' has already been registered', !this[bucketName][initializer.name]); - _emberMetal.assert('An ' + humanName + ' cannot be registered without an initialize function', _emberUtils.canInvoke(initializer, 'initialize')); - _emberMetal.assert('An ' + humanName + ' cannot be registered without a name property', initializer.name !== undefined); + _emberDebug.assert('The ' + humanName + ' \'' + initializer.name + '\' has already been registered', !this[bucketName][initializer.name]); + _emberDebug.assert('An ' + humanName + ' cannot be registered without an initialize function', _emberUtils.canInvoke(initializer, 'initialize')); + _emberDebug.assert('An ' + humanName + ' cannot be registered without a name property', initializer.name !== undefined); this[bucketName][initializer.name] = initializer; }; } @@ -5165,11 +7001,11 @@ registry.register('component-lookup:main', _emberViews.ComponentLookup); } exports.default = Engine; }); -enifed('ember-application/system/resolver', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-application/utils/validate-type', 'ember-glimmer'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberApplicationUtilsValidateType, _emberGlimmer) { +enifed('ember-application/system/resolver', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-runtime', 'ember-application/utils/validate-type', 'ember-glimmer'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberRuntime, _emberApplicationUtilsValidateType, _emberGlimmer) { /** @module ember @submodule ember-application */ @@ -5280,11 +7116,11 @@ var _fullName$split = fullName.split(':', 2); var type = _fullName$split[0]; var name = _fullName$split[1]; - _emberMetal.assert('Tried to normalize a container name without a colon (:) in it. ' + 'You probably tried to lookup a name that did not contain a type, ' + 'a colon, and a name. A proper lookup name would be `view:post`.', fullName.split(':').length === 2); + _emberDebug.assert('Tried to normalize a container name without a colon (:) in it. ' + 'You probably tried to lookup a name that did not contain a type, ' + 'a colon, and a name. A proper lookup name would be `view:post`.', fullName.split(':').length === 2); if (type !== 'template') { var result = name; if (result.indexOf('.') > -1) { @@ -5319,23 +7155,27 @@ @param {String} fullName the lookup string @return {Object} the resolved factory @public */ resolve: function (fullName) { + var _this = this; + var parsedName = this.parseName(fullName); var resolveMethodName = parsedName.resolveMethodName; var resolved = undefined; if (this[resolveMethodName]) { resolved = this[resolveMethodName](parsedName); } resolved = resolved || this.resolveOther(parsedName); - if (parsedName.root && parsedName.root.LOG_RESOLVER) { - this._logLookup(resolved, parsedName); - } + _emberDebug.runInDebug(function () { + if (parsedName.root && parsedName.root.LOG_RESOLVER) { + _this._logLookup(resolved, parsedName); + } + }); if (resolved) { _emberApplicationUtilsValidateType.default(resolved, parsedName); } @@ -5371,11 +7211,11 @@ var parts = name.split('/'); name = parts[parts.length - 1]; var namespaceName = _emberRuntime.String.capitalize(parts.slice(0, -1).join('.')); root = _emberRuntime.Namespace.byName(namespaceName); - _emberMetal.assert('You are looking for a ' + name + ' ' + type + ' in the ' + namespaceName + ' namespace, but the namespace could not be found', root); + _emberDebug.assert('You are looking for a ' + name + ' ' + type + ' in the ' + namespaceName + ' namespace, but the namespace could not be found', root); } var resolveMethodName = fullNameWithoutType === 'main' ? 'Main' : _emberRuntime.String.classify(type); if (!(name && type)) { @@ -5548,11 +7388,11 @@ padding = '.'; } else { padding = new Array(60 - parsedName.fullName.length).join('.'); } - _emberMetal.info(symbol, parsedName.fullName, padding, this.lookupDescription(parsedName.fullName)); + _emberDebug.info(symbol, parsedName.fullName, padding, this.lookupDescription(parsedName.fullName)); }, /** Used to iterate all items of a given type. @method knownForType @@ -5597,11 +7437,11 @@ return type + ':' + dasherizedName; } }); }); -enifed('ember-application/utils/validate-type', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-application/utils/validate-type', ['exports', 'ember-debug'], function (exports, _emberDebug) { /** @module ember @submodule ember-application */ @@ -5626,13 +7466,13 @@ var action = validationAttributes[0]; var factoryFlag = validationAttributes[1]; var expectedType = validationAttributes[2]; if (action === 'deprecate') { - _emberMetal.deprecate('In Ember 2.0 ' + parsedName.type + ' factories must have an `' + factoryFlag + '` ' + ('property set to true. You registered ' + resolvedType + ' as a ' + parsedName.type + ' ') + ('factory. Either add the `' + factoryFlag + '` property to this factory or ') + ('extend from ' + expectedType + '.'), !!resolvedType[factoryFlag], { id: 'ember-application.validate-type', until: '3.0.0' }); + _emberDebug.deprecate('In Ember 2.0 ' + parsedName.type + ' factories must have an `' + factoryFlag + '` ' + ('property set to true. You registered ' + resolvedType + ' as a ' + parsedName.type + ' ') + ('factory. Either add the `' + factoryFlag + '` property to this factory or ') + ('extend from ' + expectedType + '.'), !!resolvedType[factoryFlag], { id: 'ember-application.validate-type', until: '3.0.0' }); } else { - _emberMetal.assert('Expected ' + parsedName.fullName + ' to resolve to an ' + expectedType + ' but ' + ('instead it was ' + resolvedType + '.'), !!resolvedType[factoryFlag]); + _emberDebug.assert('Expected ' + parsedName.fullName + ' to resolve to an ' + expectedType + ' but ' + ('instead it was ' + resolvedType + '.'), !!resolvedType[factoryFlag]); } } }); enifed('ember-console/index', ['exports', 'ember-environment'], function (exports, _emberEnvironment) { 'use strict'; @@ -5771,18 +7611,54 @@ @public */ assert: consoleMethod('assert') || assertPolyfill }; }); -enifed('ember-debug/deprecate', ['exports', 'ember-metal', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _emberMetal, _emberConsole, _emberEnvironment, _emberDebugHandlers) { +enifed('ember-debug/deprecate', ['exports', 'ember-debug/error', 'ember-console', 'ember-environment', 'ember-debug/handlers'], function (exports, _emberDebugError, _emberConsole, _emberEnvironment, _emberDebugHandlers) { /*global __fail__*/ 'use strict'; exports.registerHandler = registerHandler; exports.default = deprecate; + /** + Allows for runtime registration of handler functions that override the default deprecation behavior. + Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate). + The following example demonstrates its usage by registering a handler that throws an error if the + message contains the word "should", otherwise defers to the default handler. + + ```javascript + Ember.Debug.registerDeprecationHandler((message, options, next) => { + if (message.indexOf('should') !== -1) { + throw new Error(`Deprecation message with should: ${message}`); + } else { + // defer to whatever handler was registered before this one + next(message, options); + } + }); + ``` + + The handler function takes the following arguments: + + <ul> + <li> <code>message</code> - The message received from the deprecation call.</li> + <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li> + <ul> + <li> <code>id</code> - An id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li> + <li> <code>until</code> - The Ember version number the feature and deprecation will be removed in.</li> + </ul> + <li> <code>next</code> - A function that calls into the previously registered handler.</li> + </ul> + + @public + @static + @method registerDeprecationHandler + @param handler {Function} A function to handle deprecation calls. + @since 2.1.0 + */ + function registerHandler(handler) { _emberDebugHandlers.registerHandler('deprecate', handler); } function formatMessage(_message, options) { @@ -5850,11 +7726,11 @@ registerHandler(function raiseOnDeprecation(message, options, next) { if (_emberEnvironment.ENV.RAISE_ON_DEPRECATION) { var updatedMessage = formatMessage(message); - throw new _emberMetal.Error(updatedMessage); + throw new _emberDebugError.default(updatedMessage); } else { next.apply(undefined, arguments); } }); @@ -5920,10 +7796,109 @@ } _emberDebugHandlers.invoke.apply(undefined, ['deprecate'].concat(babelHelpers.slice.call(arguments))); } }); +enifed("ember-debug/error", ["exports"], function (exports) { + + /** + A subclass of the JavaScript Error object for use in Ember. + + @class Error + @namespace Ember + @extends Error + @constructor + @public + */ + "use strict"; + + var EmberError = (function (_Error) { + babelHelpers.inherits(EmberError, _Error); + + function EmberError(message) { + babelHelpers.classCallCheck(this, EmberError); + + _Error.call(this); + + if (!(this instanceof EmberError)) { + return new EmberError(message); + } + + var error = Error.call(this, message); + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, EmberError); + } else { + this.stack = error.stack; + } + + this.description = error.description; + this.fileName = error.fileName; + this.lineNumber = error.lineNumber; + this.message = error.message; + this.name = error.name; + this.number = error.number; + this.code = error.code; + } + + return EmberError; + })(Error); + + exports.default = EmberError; +}); +enifed('ember-debug/features', ['exports', 'ember-utils', 'ember-environment', 'ember/features'], function (exports, _emberUtils, _emberEnvironment, _emberFeatures) { + 'use strict'; + + exports.default = isEnabled; + + /** + The hash of enabled Canary features. Add to this, any canary features + before creating your application. + + Alternatively (and recommended), you can also define `EmberENV.FEATURES` + if you need to enable features flagged at runtime. + + @class FEATURES + @namespace Ember + @static + @since 1.1.0 + @public + */ + var FEATURES = _emberUtils.assign(_emberFeatures.default, _emberEnvironment.ENV.FEATURES); + + exports.FEATURES = FEATURES; + /** + Determine whether the specified `feature` is enabled. Used by Ember's + build tools to exclude experimental features from beta/stable builds. + + You can define the following configuration options: + + * `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly + enabled/disabled. + + @method isEnabled + @param {String} feature The feature to check + @return {Boolean} + @for Ember.FEATURES + @since 1.1.0 + @public + */ + + function isEnabled(feature) { + var featureValue = FEATURES[feature]; + + if (featureValue === true || featureValue === false || featureValue === undefined) { + return featureValue; + } else if (_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES) { + return true; + } else { + return false; + } + } + + exports.DEFAULT_FEATURES = _emberFeatures.default; +}); enifed("ember-debug/handlers", ["exports"], function (exports) { "use strict"; exports.registerHandler = registerHandler; exports.invoke = invoke; @@ -5953,15 +7928,51 @@ if (handlerForType) { handlerForType(message, options); } } }); -enifed('ember-debug/index', ['exports', 'ember-metal', 'ember-environment', 'ember-console', 'ember-debug/deprecate', 'ember-debug/warn'], function (exports, _emberMetal, _emberEnvironment, _emberConsole, _emberDebugDeprecate, _emberDebugWarn) { +enifed('ember-debug/index', ['exports', 'ember/features', 'ember-environment', 'ember-console', 'ember-debug/testing', 'ember-debug/error', 'ember-debug/features', 'ember-debug/deprecate', 'ember-debug/warn'], function (exports, _emberFeatures, _emberEnvironment, _emberConsole, _emberDebugTesting, _emberDebugError, _emberDebugFeatures, _emberDebugDeprecate, _emberDebugWarn) { 'use strict'; exports._warnIfUsingStrippedFeatureFlags = _warnIfUsingStrippedFeatureFlags; + exports.getDebugFunction = getDebugFunction; + exports.setDebugFunction = setDebugFunction; + exports.assert = assert; + exports.info = info; + exports.warn = warn; + exports.debug = debug; + exports.deprecate = deprecate; + exports.deprecateFunc = deprecateFunc; + exports.runInDebug = runInDebug; + exports.debugSeal = debugSeal; + exports.debugFreeze = debugFreeze; + exports.registerWarnHandler = _emberDebugWarn.registerHandler; + exports.registerDeprecationHandler = _emberDebugDeprecate.registerHandler; + exports.isFeatureEnabled = _emberDebugFeatures.default; + exports.FEATURES = _emberDebugFeatures.FEATURES; + exports.Error = _emberDebugError.default; + exports.isTesting = _emberDebugTesting.isTesting; + exports.setTesting = _emberDebugTesting.setTesting; + var debugFunctions = { + assert: function () {}, + info: function () {}, + warn: function () {}, + debug: function () {}, + deprecate: function () {}, + deprecateFunc: function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + return args[args.length - 1]; + }, + runInDebug: function () {}, + debugSeal: function () {}, + debugFreeze: function () {} + }; + + exports.debugFunctions = debugFunctions; /** @module ember @submodule ember-debug */ @@ -5990,13 +8001,13 @@ @param {Boolean} test Must be truthy for the assertion to pass. If falsy, an exception will be thrown. @public @since 1.0.0 */ - _emberMetal.setDebugFunction('assert', function assert(desc, test) { + setDebugFunction('assert', function assert(desc, test) { if (!test) { - throw new _emberMetal.Error('Assertion Failed: ' + desc); + throw new _emberDebugError.default('Assertion Failed: ' + desc); } }); /** Display a debug notice. @@ -6010,11 +8021,11 @@ @method debug @param {String} message A debug message to display. @public */ - _emberMetal.setDebugFunction('debug', function debug(message) { + setDebugFunction('debug', function debug(message) { _emberConsole.default.debug('DEBUG: ' + message); }); /** Display an info notice. @@ -6023,11 +8034,11 @@ Uses of this method in Ember itself are stripped from the ember.prod.js build. @method info @private */ - _emberMetal.setDebugFunction('info', function info() { + setDebugFunction('info', function info() { _emberConsole.default.info.apply(undefined, arguments); }); /** Alias an old, deprecated method with its new counterpart. @@ -6046,24 +8057,24 @@ @param {Object} [options] The options object for Ember.deprecate. @param {Function} func The new function called to replace its deprecated counterpart. @return {Function} A new function that wraps the original function with a deprecation warning @private */ - _emberMetal.setDebugFunction('deprecateFunc', function deprecateFunc() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; + setDebugFunction('deprecateFunc', function deprecateFunc() { + for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; } if (args.length === 3) { var _ret = (function () { var message = args[0]; var options = args[1]; var func = args[2]; return { v: function () { - _emberMetal.deprecate(message, false, options); + deprecate(message, false, options); return func.apply(this, arguments); } }; })(); @@ -6073,11 +8084,11 @@ var message = args[0]; var func = args[1]; return { v: function () { - _emberMetal.deprecate(message); + deprecate(message); return func.apply(this, arguments); } }; })(); @@ -6104,25 +8115,25 @@ @method runInDebug @param {Function} func The function to be executed. @since 1.5.0 @public */ - _emberMetal.setDebugFunction('runInDebug', function runInDebug(func) { + setDebugFunction('runInDebug', function runInDebug(func) { func(); }); - _emberMetal.setDebugFunction('debugSeal', function debugSeal(obj) { + setDebugFunction('debugSeal', function debugSeal(obj) { Object.seal(obj); }); - _emberMetal.setDebugFunction('debugFreeze', function debugFreeze(obj) { + setDebugFunction('debugFreeze', function debugFreeze(obj) { Object.freeze(obj); }); - _emberMetal.setDebugFunction('deprecate', _emberDebugDeprecate.default); + setDebugFunction('deprecate', _emberDebugDeprecate.default); - _emberMetal.setDebugFunction('warn', _emberDebugWarn.default); + setDebugFunction('warn', _emberDebugWarn.default); /** Will call `Ember.warn()` if ENABLE_OPTIONAL_FEATURES or any specific FEATURES flag is truthy. @@ -6133,36 +8144,36 @@ @return {void} */ function _warnIfUsingStrippedFeatureFlags(FEATURES, knownFeatures, featuresWereStripped) { if (featuresWereStripped) { - _emberMetal.warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' }); + warn('Ember.ENV.ENABLE_OPTIONAL_FEATURES is only available in canary builds.', !_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES, { id: 'ember-debug.feature-flag-with-features-stripped' }); var keys = Object.keys(FEATURES || {}); for (var i = 0; i < keys.length; i++) { var key = keys[i]; if (key === 'isEnabled' || !(key in knownFeatures)) { continue; } - _emberMetal.warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' }); + warn('FEATURE["' + key + '"] is set as enabled, but FEATURE flags are only available in canary builds.', !FEATURES[key], { id: 'ember-debug.feature-flag-with-features-stripped' }); } } } - if (!_emberMetal.isTesting()) { + if (!_emberDebugTesting.isTesting()) { (function () { // Complain if they're using FEATURE flags in builds other than canary - _emberMetal.FEATURES['features-stripped-test'] = true; + _emberDebugFeatures.FEATURES['features-stripped-test'] = true; var featuresWereStripped = true; if (false) { featuresWereStripped = false; } - delete _emberMetal.FEATURES['features-stripped-test']; - _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberMetal.DEFAULT_FEATURES, featuresWereStripped); + delete _emberDebugFeatures.FEATURES['features-stripped-test']; + _warnIfUsingStrippedFeatureFlags(_emberEnvironment.ENV.FEATURES, _emberFeatures.default, featuresWereStripped); // Inform the developer about the Ember Inspector if not installed. var isFirefox = _emberEnvironment.environment.isFirefox; var isChrome = _emberEnvironment.environment.isChrome; @@ -6175,58 +8186,99 @@ downloadURL = 'https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi'; } else if (isFirefox) { downloadURL = 'https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/'; } - _emberMetal.debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL); + debug('For more advanced debugging, install the Ember Inspector from ' + downloadURL); } }, false); } })(); } - /** - @public - @class Ember.Debug - */ - _emberMetal.default.Debug = {}; - /** - Allows for runtime registration of handler functions that override the default deprecation behavior. - Deprecations are invoked by calls to [Ember.deprecate](http://emberjs.com/api/classes/Ember.html#method_deprecate). - The following example demonstrates its usage by registering a handler that throws an error if the - message contains the word "should", otherwise defers to the default handler. + /* + We are transitioning away from `ember.js` to `ember.debug.js` to make + it much clearer that it is only for local development purposes. - ```javascript - Ember.Debug.registerDeprecationHandler((message, options, next) => { - if (message.indexOf('should') !== -1) { - throw new Error(`Deprecation message with should: ${message}`); - } else { - // defer to whatever handler was registered before this one - next(message, options); - } - }); - ``` - - The handler function takes the following arguments: - - <ul> - <li> <code>message</code> - The message received from the deprecation call.</li> - <li> <code>options</code> - An object passed in with the deprecation call containing additional information including:</li> - <ul> - <li> <code>id</code> - An id of the deprecation in the form of <code>package-name.specific-deprecation</code>.</li> - <li> <code>until</code> - The Ember version number the feature and deprecation will be removed in.</li> - </ul> - <li> <code>next</code> - A function that calls into the previously registered handler.</li> - </ul> - - @public - @static - @method registerDeprecationHandler - @param handler {Function} A function to handle deprecation calls. - @since 2.1.0 + This flag value is changed by the tooling (by a simple string replacement) + so that if `ember.js` (which must be output for backwards compat reasons) is + used a nice helpful warning message will be printed out. */ - _emberMetal.default.Debug.registerDeprecationHandler = _emberDebugDeprecate.registerHandler; + var runningNonEmberDebugJS = true; + exports.runningNonEmberDebugJS = runningNonEmberDebugJS; + if (runningNonEmberDebugJS) { + warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.'); + } + + function getDebugFunction(name) { + return debugFunctions[name]; + } + + function setDebugFunction(name, fn) { + debugFunctions[name] = fn; + } + + function assert() { + return debugFunctions.assert.apply(undefined, arguments); + } + + function info() { + return debugFunctions.info.apply(undefined, arguments); + } + + function warn() { + return debugFunctions.warn.apply(undefined, arguments); + } + + function debug() { + return debugFunctions.debug.apply(undefined, arguments); + } + + function deprecate() { + return debugFunctions.deprecate.apply(undefined, arguments); + } + + function deprecateFunc() { + return debugFunctions.deprecateFunc.apply(undefined, arguments); + } + + function runInDebug() { + return debugFunctions.runInDebug.apply(undefined, arguments); + } + + function debugSeal() { + return debugFunctions.debugSeal.apply(undefined, arguments); + } + + function debugFreeze() { + return debugFunctions.debugFreeze.apply(undefined, arguments); + } +}); +enifed("ember-debug/run-in-debug", ["exports"], function (exports) { + "use strict"; +}); +enifed("ember-debug/testing", ["exports"], function (exports) { + "use strict"; + + exports.isTesting = isTesting; + exports.setTesting = setTesting; + var testing = false; + + function isTesting() { + return testing; + } + + function setTesting(value) { + testing = !!value; + } +}); +enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-debug/deprecate', 'ember-debug/handlers'], function (exports, _emberConsole, _emberDebugDeprecate, _emberDebugHandlers) { + 'use strict'; + + exports.registerHandler = registerHandler; + exports.default = warn; + /** Allows for runtime registration of handler functions that override the default warning behavior. Warnings are invoked by calls made to [Ember.warn](http://emberjs.com/api/classes/Ember.html#method_warn). The following example demonstrates its usage by registering a handler that does nothing overriding Ember's default warning behavior. @@ -6251,33 +8303,11 @@ @static @method registerWarnHandler @param handler {Function} A function to handle warnings. @since 2.1.0 */ - _emberMetal.default.Debug.registerWarnHandler = _emberDebugWarn.registerHandler; - /* - We are transitioning away from `ember.js` to `ember.debug.js` to make - it much clearer that it is only for local development purposes. - - This flag value is changed by the tooling (by a simple string replacement) - so that if `ember.js` (which must be output for backwards compat reasons) is - used a nice helpful warning message will be printed out. - */ - var runningNonEmberDebugJS = true; - exports.runningNonEmberDebugJS = runningNonEmberDebugJS; - if (runningNonEmberDebugJS) { - _emberMetal.warn('Please use `ember.debug.js` instead of `ember.js` for development and debugging.'); - } -}); -// reexports -enifed('ember-debug/warn', ['exports', 'ember-console', 'ember-metal', 'ember-debug/handlers'], function (exports, _emberConsole, _emberMetal, _emberDebugHandlers) { - 'use strict'; - - exports.registerHandler = registerHandler; - exports.default = warn; - function registerHandler(handler) { _emberDebugHandlers.registerHandler('warn', handler); } registerHandler(function logWarning(message, options) { @@ -6316,19 +8346,19 @@ @since 1.0.0 */ function warn(message, test, options) { if (!options) { - _emberMetal.deprecate(missingOptionsDeprecation, false, { + _emberDebugDeprecate.default(missingOptionsDeprecation, false, { id: 'ember-debug.warn-options-missing', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options' }); } if (options && !options.id) { - _emberMetal.deprecate(missingOptionsIdDeprecation, false, { + _emberDebugDeprecate.default(missingOptionsIdDeprecation, false, { id: 'ember-debug.warn-id-missing', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options' }); } @@ -7104,11 +9134,11 @@ 'use strict'; exports.DataAdapter = _emberExtensionSupportData_adapter.default; exports.ContainerDebugAdapter = _emberExtensionSupportContainer_debug_adapter.default; }); -enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'ember-runtime', 'ember-metal', 'ember-glimmer/utils/references', 'glimmer-reference', 'glimmer-runtime'], function (exports, _emberUtils, _emberViews, _emberRuntime, _emberMetal, _emberGlimmerUtilsReferences, _glimmerReference, _glimmerRuntime) { +enifed('ember-glimmer/component', ['exports', 'ember-utils', 'ember-views', 'ember-runtime', 'ember-debug', 'ember-metal', 'ember-glimmer/utils/references', '@glimmer/reference', '@glimmer/runtime'], function (exports, _emberUtils, _emberViews, _emberRuntime, _emberDebug, _emberMetal, _emberGlimmerUtilsReferences, _glimmerReference, _glimmerRuntime) { 'use strict'; var _CoreView$extend; var DIRTY_TAG = _emberUtils.symbol('DIRTY_TAG'); @@ -7634,21 +9664,21 @@ // If a `defaultLayout` was specified move it to the `layout` prop. // `layout` is no longer a CP, so this just ensures that the `defaultLayout` // logic is supported with a deprecation if (this.defaultLayout && !this.layout) { - _emberMetal.deprecate('Specifying `defaultLayout` to ' + this + ' is deprecated. Please use `layout` instead.', false, { + _emberDebug.deprecate('Specifying `defaultLayout` to ' + this + ' is deprecated. Please use `layout` instead.', false, { id: 'ember-views.component.defaultLayout', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-component-defaultlayout' }); this.layout = this.defaultLayout; } // If in a tagless component, assert that no event handlers are defined - _emberMetal.assert('You can not define a function that handles DOM events in the `' + this + '` tagless component since it doesn\'t have any DOM element.', this.tagName !== '' || !this.renderer._destinedForDOM || !(function () { + _emberDebug.assert('You can not define a function that handles DOM events in the `' + this + '` tagless component since it doesn\'t have any DOM element.', this.tagName !== '' || !this.renderer._destinedForDOM || !(function () { var eventDispatcher = _emberUtils.getOwner(_this).lookup('event_dispatcher:main'); var events = eventDispatcher && eventDispatcher._finalEvents || {}; for (var key in events) { var methodName = events[key]; @@ -7657,11 +9687,11 @@ return true; // indicate that the assertion should be triggered } } })()); - _emberMetal.assert('You cannot use a computed property for the component\'s `tagName` (' + this + ').', !(this.tagName && this.tagName.isDescriptor)); + _emberDebug.assert('You cannot use a computed property for the component\'s `tagName` (' + this + ').', !(this.tagName && this.tagName.isDescriptor)); }, rerender: function () { this[DIRTY_TAG].dirty(); this._super(); @@ -8003,11 +10033,11 @@ change: function () { _emberMetal.set(this, 'checked', this.$().prop('checked')); } }); }); -enifed('ember-glimmer/components/link-to', ['exports', 'ember-console', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-glimmer/templates/link-to', 'ember-glimmer/component'], function (exports, _emberConsole, _emberMetal, _emberRuntime, _emberViews, _emberGlimmerTemplatesLinkTo, _emberGlimmerComponent) { +enifed('ember-glimmer/components/link-to', ['exports', 'ember-console', 'ember-debug', 'ember-metal', 'ember-runtime', 'ember-views', 'ember-glimmer/templates/link-to', 'ember-glimmer/component'], function (exports, _emberConsole, _emberDebug, _emberMetal, _emberRuntime, _emberViews, _emberGlimmerTemplatesLinkTo, _emberGlimmerComponent) { /** @module ember @submodule ember-glimmer */ @@ -8702,11 +10732,11 @@ } var routing = _emberMetal.get(this, '_routing'); var queryParams = _emberMetal.get(this, 'queryParams.values'); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { /* * Unfortunately, to get decent error messages, we need to do this. * In some future state we should be able to use a "feature flag" * which allows us to strip this without needing to call it twice. * @@ -8717,11 +10747,11 @@ * } */ try { routing.generateURL(qualifiedRouteName, models, queryParams); } catch (e) { - _emberMetal.assert('You attempted to define a `{{link-to "' + qualifiedRouteName + '"}}` but did not pass the parameters required for generating its dynamic segments. ' + e.message); + _emberDebug.assert('You attempted to define a `{{link-to "' + qualifiedRouteName + '"}}` but did not pass the parameters required for generating its dynamic segments. ' + e.message); } }); return routing.generateURL(qualifiedRouteName, models, queryParams); }), @@ -8752,11 +10782,11 @@ for (var i = 0; i < modelCount; i++) { var value = params[i + 1]; while (_emberRuntime.ControllerMixin.detect(value)) { - _emberMetal.deprecate('Providing `{{link-to}}` with a param that is wrapped in a controller is deprecated. ' + (this.parentView ? 'Please update `' + this.parentView + '` to use `{{link-to "post" someController.model}}` instead.' : ''), false, { id: 'ember-routing-views.controller-wrapped-param', until: '3.0.0' }); + _emberDebug.deprecate('Providing `{{link-to}}` with a param that is wrapped in a controller is deprecated. ' + (this.parentView ? 'Please update `' + this.parentView + '` to use `{{link-to "post" someController.model}}` instead.' : ''), false, { id: 'ember-routing-views.controller-wrapped-param', until: '3.0.0' }); value = value.get('model'); } models[i] = value; } @@ -8782,11 +10812,11 @@ if (params) { // Do not mutate params in place params = params.slice(); } - _emberMetal.assert('You must provide one or more parameters to the link-to component.', (function () { + _emberDebug.assert('You must provide one or more parameters to the link-to component.', (function () { if (!params) { return false; } return params.length; @@ -9182,24 +11212,20 @@ @public */ max: null }); }); -enifed('ember-glimmer/dom', ['exports', 'glimmer-runtime', 'glimmer-node'], function (exports, _glimmerRuntime, _glimmerNode) { +enifed('ember-glimmer/dom', ['exports', '@glimmer/runtime', '@glimmer/node'], function (exports, _glimmerRuntime, _glimmerNode) { 'use strict'; exports.DOMChanges = _glimmerRuntime.DOMChanges; exports.DOMTreeConstruction = _glimmerRuntime.DOMTreeConstruction; exports.NodeDOMTreeConstruction = _glimmerNode.NodeDOMTreeConstruction; }); -enifed('ember-glimmer/environment', ['exports', 'ember-utils', 'ember-metal', 'ember-views', 'glimmer-runtime', 'ember-glimmer/syntax/curly-component', 'ember-glimmer/syntax', 'ember-glimmer/syntax/dynamic-component', 'ember-glimmer/utils/iterable', 'ember-glimmer/utils/references', 'ember-glimmer/utils/debug-stack', 'ember-glimmer/helpers/if-unless', 'ember-glimmer/utils/bindings', 'ember-glimmer/helpers/action', 'ember-glimmer/helpers/component', 'ember-glimmer/helpers/concat', 'ember-glimmer/helpers/debugger', 'ember-glimmer/helpers/get', 'ember-glimmer/helpers/hash', 'ember-glimmer/helpers/loc', 'ember-glimmer/helpers/log', 'ember-glimmer/helpers/mut', 'ember-glimmer/helpers/readonly', 'ember-glimmer/helpers/unbound', 'ember-glimmer/helpers/-class', 'ember-glimmer/helpers/-input-type', 'ember-glimmer/helpers/query-param', 'ember-glimmer/helpers/each-in', 'ember-glimmer/helpers/-normalize-class', 'ember-glimmer/helpers/-html-safe', 'ember-glimmer/protocol-for-url', 'container', 'ember-glimmer/modifiers/action'], function (exports, _emberUtils, _emberMetal, _emberViews, _glimmerRuntime, _emberGlimmerSyntaxCurlyComponent, _emberGlimmerSyntax, _emberGlimmerSyntaxDynamicComponent, _emberGlimmerUtilsIterable, _emberGlimmerUtilsReferences, _emberGlimmerUtilsDebugStack, _emberGlimmerHelpersIfUnless, _emberGlimmerUtilsBindings, _emberGlimmerHelpersAction, _emberGlimmerHelpersComponent, _emberGlimmerHelpersConcat, _emberGlimmerHelpersDebugger, _emberGlimmerHelpersGet, _emberGlimmerHelpersHash, _emberGlimmerHelpersLoc, _emberGlimmerHelpersLog, _emberGlimmerHelpersMut, _emberGlimmerHelpersReadonly, _emberGlimmerHelpersUnbound, _emberGlimmerHelpersClass, _emberGlimmerHelpersInputType, _emberGlimmerHelpersQueryParam, _emberGlimmerHelpersEachIn, _emberGlimmerHelpersNormalizeClass, _emberGlimmerHelpersHtmlSafe, _emberGlimmerProtocolForUrl, _container, _emberGlimmerModifiersAction) { +enifed('ember-glimmer/environment', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-views', '@glimmer/runtime', 'ember-glimmer/syntax/curly-component', 'ember-glimmer/syntax', 'ember-glimmer/utils/iterable', 'ember-glimmer/utils/references', 'ember-glimmer/utils/debug-stack', 'ember-glimmer/helpers/if-unless', 'ember-glimmer/helpers/action', 'ember-glimmer/helpers/component', 'ember-glimmer/helpers/concat', 'ember-glimmer/helpers/get', 'ember-glimmer/helpers/hash', 'ember-glimmer/helpers/loc', 'ember-glimmer/helpers/log', 'ember-glimmer/helpers/mut', 'ember-glimmer/helpers/readonly', 'ember-glimmer/helpers/unbound', 'ember-glimmer/helpers/-class', 'ember-glimmer/helpers/-input-type', 'ember-glimmer/helpers/query-param', 'ember-glimmer/helpers/each-in', 'ember-glimmer/helpers/-normalize-class', 'ember-glimmer/helpers/-html-safe', 'ember-glimmer/protocol-for-url', 'container', 'ember-glimmer/modifiers/action'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberViews, _glimmerRuntime, _emberGlimmerSyntaxCurlyComponent, _emberGlimmerSyntax, _emberGlimmerUtilsIterable, _emberGlimmerUtilsReferences, _emberGlimmerUtilsDebugStack, _emberGlimmerHelpersIfUnless, _emberGlimmerHelpersAction, _emberGlimmerHelpersComponent, _emberGlimmerHelpersConcat, _emberGlimmerHelpersGet, _emberGlimmerHelpersHash, _emberGlimmerHelpersLoc, _emberGlimmerHelpersLog, _emberGlimmerHelpersMut, _emberGlimmerHelpersReadonly, _emberGlimmerHelpersUnbound, _emberGlimmerHelpersClass, _emberGlimmerHelpersInputType, _emberGlimmerHelpersQueryParam, _emberGlimmerHelpersEachIn, _emberGlimmerHelpersNormalizeClass, _emberGlimmerHelpersHtmlSafe, _emberGlimmerProtocolForUrl, _container, _emberGlimmerModifiersAction) { 'use strict'; - var builtInComponents = { - textarea: '-text-area' - }; - var Environment = (function (_GlimmerEnvironment) { babelHelpers.inherits(Environment, _GlimmerEnvironment); Environment.create = function create(options) { return new Environment(options); @@ -9282,11 +11308,10 @@ this.builtInHelpers = { if: _emberGlimmerHelpersIfUnless.inlineIf, action: _emberGlimmerHelpersAction.default, component: _emberGlimmerHelpersComponent.default, concat: _emberGlimmerHelpersConcat.default, - debugger: _emberGlimmerHelpersDebugger.default, get: _emberGlimmerHelpersGet.default, hash: _emberGlimmerHelpersHash.default, loc: _emberGlimmerHelpersLoc.default, log: _emberGlimmerHelpersLog.default, mut: _emberGlimmerHelpersMut.default, @@ -9300,115 +11325,19 @@ '-normalize-class': _emberGlimmerHelpersNormalizeClass.default, '-html-safe': _emberGlimmerHelpersHtmlSafe.default, '-get-dynamic-var': _glimmerRuntime.getDynamicVar }; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this.debugStack = new _emberGlimmerUtilsDebugStack.default(); }); } - // Hello future traveler, welcome to the world of syntax refinement. - // The method below is called by Glimmer's runtime compiler to allow - // us to take generic statement syntax and refine it to more meaniful - // syntax for Ember's use case. This on the fly switch-a-roo sounds fine - // and dandy, however Ember has precedence on statement refinement that you - // need to be aware of. The presendence for language constructs is as follows: - // - // ------------------------ - // Native & Built-in Syntax - // ------------------------ - // User-land components - // ------------------------ - // User-land helpers - // ------------------------ - // - // The one caveat here is that Ember also allows for dashed references that are - // not a component or helper: - // - // export default Component.extend({ - // 'foo-bar': 'LAME' - // }); - // - // {{foo-bar}} - // - // The heuristic for the above situation is a dashed "key" in inline form - // that does not resolve to a defintion. In this case refine statement simply - // isn't going to return any syntax and the Glimmer engine knows how to handle - // this case. - - Environment.prototype.refineStatement = function refineStatement(statement, symbolTable) { - var _this2 = this; - - // 1. resolve any native syntax – if, unless, with, each, and partial - var nativeSyntax = _GlimmerEnvironment.prototype.refineStatement.call(this, statement, symbolTable); - - if (nativeSyntax) { - return nativeSyntax; - } - - var appendType = statement.appendType; - var isSimple = statement.isSimple; - var isInline = statement.isInline; - var isBlock = statement.isBlock; - var isModifier = statement.isModifier; - var key = statement.key; - var path = statement.path; - var args = statement.args; - - _emberMetal.assert('You attempted to overwrite the built-in helper "' + key + '" which is not allowed. Please rename the helper.', !(this.builtInHelpers[key] && this.owner.hasRegistration('helper:' + key))); - - if (isSimple && (isInline || isBlock) && appendType !== 'get') { - // 2. built-in syntax - - var RefinedSyntax = _emberGlimmerSyntax.findSyntaxBuilder(key); - if (RefinedSyntax) { - return RefinedSyntax.create(this, args, symbolTable); - } - - var internalKey = builtInComponents[key]; - var definition = null; - - if (internalKey) { - definition = this.getComponentDefinition([internalKey], symbolTable); - } else if (key.indexOf('-') >= 0) { - definition = this.getComponentDefinition(path, symbolTable); - } - - if (definition) { - _emberGlimmerUtilsBindings.wrapComponentClassAttribute(args); - - return new _emberGlimmerSyntaxCurlyComponent.CurlyComponentSyntax(args, definition, symbolTable); - } - - _emberMetal.assert('A component or helper named "' + key + '" could not be found', !isBlock || this.hasHelper(path, symbolTable)); - } - - if (isInline && !isSimple && appendType !== 'helper') { - return statement.original.deopt(); - } - - if (!isSimple && path) { - return _emberGlimmerSyntaxDynamicComponent.DynamicComponentSyntax.fromPath(this, path, args, symbolTable); - } - - _emberMetal.assert('Helpers may not be used in the block form, for example {{#' + key + '}}{{/' + key + '}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (' + key + ')}}{{/if}}.', !isBlock || !this.hasHelper(path, symbolTable)); - - _emberMetal.assert('Helpers may not be used in the element form.', (function () { - if (nativeSyntax) { - return true; - } - if (!key) { - return true; - } - - if (isModifier && !_this2.hasModifier(path, symbolTable) && _this2.hasHelper(path, symbolTable)) { - return false; - } - - return true; - })()); + Environment.prototype.macros = function macros() { + var macros = _GlimmerEnvironment.prototype.macros.call(this); + _emberGlimmerSyntax.populateMacros(macros.blocks, macros.inlines); + return macros; }; Environment.prototype.hasComponentDefinition = function hasComponentDefinition() { return false; }; @@ -9459,20 +11388,11 @@ } else { throw new Error(name + ' is not a partial'); } }; - Environment.prototype.hasHelper = function hasHelper(nameParts, symbolTable) { - _emberMetal.assert('The first argument passed into `hasHelper` should be an array', Array.isArray(nameParts)); - - // helpers are not allowed to include a dot in their invocation - if (nameParts.length > 1) { - return false; - } - - var name = nameParts[0]; - + Environment.prototype.hasHelper = function hasHelper(name, symbolTable) { if (this.builtInHelpers[name]) { return true; } var blockMeta = symbolTable.getMeta(); @@ -9480,14 +11400,11 @@ var options = { source: 'template:' + blockMeta.moduleName }; return owner.hasRegistration('helper:' + name, options) || owner.hasRegistration('helper:' + name); }; - Environment.prototype.lookupHelper = function lookupHelper(nameParts, symbolTable) { - _emberMetal.assert('The first argument passed into `lookupHelper` should be an array', Array.isArray(nameParts)); - - var name = nameParts[0]; + Environment.prototype.lookupHelper = function lookupHelper(name, symbolTable) { var helper = this.builtInHelpers[name]; if (helper) { return helper; } @@ -9506,20 +11423,20 @@ v: function (vm, args) { return _emberGlimmerUtilsReferences.SimpleHelperReference.create(helperFactory.class.compute, args); } }; } else if (helperFactory.class.isHelperFactory) { - if (!false) { + if (!true) { helperFactory = helperFactory.create(); } return { v: function (vm, args) { return _emberGlimmerUtilsReferences.ClassBasedHelperReference.create(helperFactory, vm, args); } }; } else { - throw new Error(nameParts + ' is not a helper'); + throw new Error(name + ' is not a helper'); } })(); if (typeof _ret === 'object') return _ret.v; } else { @@ -9538,38 +11455,29 @@ v: function (vm, args) { return _emberGlimmerUtilsReferences.ClassBasedHelperReference.create(helperFactory, vm, args); } }; } else { - throw new Error(nameParts + ' is not a helper'); + throw new Error(name + ' is not a helper'); } })(); if (typeof _ret2 === 'object') return _ret2.v; } }; - Environment.prototype.hasModifier = function hasModifier(nameParts) { - _emberMetal.assert('The first argument passed into `hasModifier` should be an array', Array.isArray(nameParts)); - - // modifiers are not allowed to include a dot in their invocation - if (nameParts.length > 1) { - return false; - } - - return !!this.builtInModifiers[nameParts[0]]; + Environment.prototype.hasModifier = function hasModifier(name) { + return !!this.builtInModifiers[name]; }; - Environment.prototype.lookupModifier = function lookupModifier(nameParts) { - _emberMetal.assert('The first argument passed into `lookupModifier` should be an array', Array.isArray(nameParts)); + Environment.prototype.lookupModifier = function lookupModifier(name) { + var modifier = this.builtInModifiers[name]; - var modifier = this.builtInModifiers[nameParts[0]]; - if (modifier) { return modifier; } else { - throw new Error(nameParts + ' is not a modifier'); + throw new Error(name + ' is not a modifier'); } }; Environment.prototype.toConditionalReference = function toConditionalReference(reference) { return _emberGlimmerUtilsReferences.ConditionalReference.create(reference); @@ -9624,11 +11532,11 @@ return Environment; })(_glimmerRuntime.Environment); exports.default = Environment; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { var StyleAttributeManager = (function (_AttributeManager) { babelHelpers.inherits(StyleAttributeManager, _AttributeManager); function StyleAttributeManager() { babelHelpers.classCallCheck(this, StyleAttributeManager); @@ -9637,11 +11545,11 @@ } StyleAttributeManager.prototype.setAttribute = function setAttribute(dom, element, value) { var _AttributeManager$prototype$setAttribute; - _emberMetal.warn(_emberViews.constructStyleDeprecationMessage(value), (function () { + _emberDebug.warn(_emberViews.constructStyleDeprecationMessage(value), (function () { if (value === null || value === undefined || _glimmerRuntime.isSafeString(value)) { return true; } return false; })(), { id: 'ember-htmlbars.style-xss-warning' }); @@ -9649,11 +11557,11 @@ }; StyleAttributeManager.prototype.updateAttribute = function updateAttribute(dom, element, value) { var _AttributeManager$prototype$updateAttribute; - _emberMetal.warn(_emberViews.constructStyleDeprecationMessage(value), (function () { + _emberDebug.warn(_emberViews.constructStyleDeprecationMessage(value), (function () { if (value === null || value === undefined || _glimmerRuntime.isSafeString(value)) { return true; } return false; })(), { id: 'ember-htmlbars.style-xss-warning' }); @@ -9672,11 +11580,11 @@ return _glimmerRuntime.Environment.prototype.attributeFor.call(this, element, attribute, isTrusting); }; }); }); -enifed('ember-glimmer/helper', ['exports', 'ember-utils', 'ember-runtime', 'glimmer-reference'], function (exports, _emberUtils, _emberRuntime, _glimmerReference) { +enifed('ember-glimmer/helper', ['exports', 'ember-utils', 'ember-runtime', '@glimmer/reference'], function (exports, _emberUtils, _emberRuntime, _glimmerReference) { /** @module ember @submodule ember-glimmer */ @@ -9888,11 +11796,11 @@ exports.default = function (vm, args) { return new _emberGlimmerUtilsReferences.InternalHelperReference(normalizeClass, args); }; }); -enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal', 'ember-glimmer/utils/references', 'glimmer-runtime', 'glimmer-reference'], function (exports, _emberUtils, _emberMetal, _emberGlimmerUtilsReferences, _glimmerRuntime, _glimmerReference) { +enifed('ember-glimmer/helpers/action', ['exports', 'ember-utils', 'ember-metal', 'ember-glimmer/utils/references', '@glimmer/runtime', '@glimmer/reference', 'ember-debug'], function (exports, _emberUtils, _emberMetal, _emberGlimmerUtilsReferences, _glimmerRuntime, _glimmerReference, _emberDebug) { /** @module ember @submodule ember-glimmer */ 'use strict'; @@ -10230,11 +12138,11 @@ } } function makeDynamicClosureAction(context, targetRef, actionRef, processArgs, debugKey) { // We don't allow undefined/null values, so this creates a throw-away action to trigger the assertions - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey); }); return function () { return makeClosureAction(context, targetRef.value(), actionRef.value(), processArgs, debugKey).apply(undefined, arguments); @@ -10243,11 +12151,11 @@ function makeClosureAction(context, target, action, processArgs, debugKey) { var self = undefined, fn = undefined; - _emberMetal.assert('Action passed is null or undefined in (action) from ' + target + '.', !_emberMetal.isNone(action)); + _emberDebug.assert('Action passed is null or undefined in (action) from ' + target + '.', !_emberMetal.isNone(action)); if (typeof action[INVOKE] === 'function') { self = action; fn = action[INVOKE]; } else { @@ -10255,32 +12163,32 @@ if (typeofAction === 'string') { self = target; fn = target.actions && target.actions[action]; - _emberMetal.assert('An action named \'' + action + '\' was not found in ' + target, fn); + _emberDebug.assert('An action named \'' + action + '\' was not found in ' + target, fn); } else if (typeofAction === 'function') { self = context; fn = action; } else { - _emberMetal.assert('An action could not be made for `' + (debugKey || action) + '` in ' + target + '. Please confirm that you are using either a quoted action name (i.e. `(action \'' + (debugKey || 'myAction') + '\')`) or a function available in ' + target + '.', false); + _emberDebug.assert('An action could not be made for `' + (debugKey || action) + '` in ' + target + '. Please confirm that you are using either a quoted action name (i.e. `(action \'' + (debugKey || 'myAction') + '\')`) or a function available in ' + target + '.', false); } } return function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - var payload = { target: self, args: args, label: 'glimmer-closure-action' }; + var payload = { target: self, args: args, label: '@glimmer/closure-action' }; return _emberMetal.flaggedInstrument('interaction.ember-action', payload, function () { return _emberMetal.run.join.apply(_emberMetal.run, [self, fn].concat(processArgs(args))); }); }; } }); -enifed('ember-glimmer/helpers/component', ['exports', 'ember-utils', 'ember-glimmer/utils/references', 'ember-glimmer/syntax/curly-component', 'glimmer-runtime', 'ember-metal'], function (exports, _emberUtils, _emberGlimmerUtilsReferences, _emberGlimmerSyntaxCurlyComponent, _glimmerRuntime, _emberMetal) { +enifed('ember-glimmer/helpers/component', ['exports', 'ember-utils', 'ember-glimmer/utils/references', 'ember-glimmer/syntax/curly-component', '@glimmer/runtime', 'ember-debug'], function (exports, _emberUtils, _emberGlimmerUtilsReferences, _emberGlimmerSyntaxCurlyComponent, _glimmerRuntime, _emberDebug) { /** @module ember @submodule ember-glimmer */ 'use strict'; @@ -10452,18 +12360,18 @@ } this.lastName = nameOrDef; if (typeof nameOrDef === 'string') { - _emberMetal.assert('You cannot use the input helper as a contextual helper. Please extend Ember.TextField or Ember.Checkbox to use it as a contextual component.', nameOrDef !== 'input'); - _emberMetal.assert('You cannot use the textarea helper as a contextual helper. Please extend Ember.TextArea to use it as a contextual component.', nameOrDef !== 'textarea'); + _emberDebug.assert('You cannot use the input helper as a contextual helper. Please extend Ember.TextField or Ember.Checkbox to use it as a contextual component.', nameOrDef !== 'input'); + _emberDebug.assert('You cannot use the textarea helper as a contextual helper. Please extend Ember.TextArea to use it as a contextual component.', nameOrDef !== 'textarea'); definition = env.getComponentDefinition([nameOrDef], symbolTable); - _emberMetal.assert('The component helper cannot be used without a valid component name. You used "' + nameOrDef + '" via (component "' + nameOrDef + '")', definition); + _emberDebug.assert('The component helper cannot be used without a valid component name. You used "' + nameOrDef + '" via (component "' + nameOrDef + '")', definition); } else if (_glimmerRuntime.isComponentDefinition(nameOrDef)) { definition = nameOrDef; } else { - _emberMetal.assert('You cannot create a component from ' + nameOrDef + ' using the {{component}} helper', nameOrDef); + _emberDebug.assert('You cannot create a component from ' + nameOrDef + ' using the {{component}} helper', nameOrDef); return null; } var newDef = createCurriedDefinition(definition, args); @@ -10481,10 +12389,19 @@ var curriedArgs = curryArgs(definition, args); return new _emberGlimmerSyntaxCurlyComponent.CurlyComponentDefinition(definition.name, definition.ComponentClass, definition.template, curriedArgs); } + var EMPTY_BLOCKS = { + default: null, + inverse: null + }; + + _emberDebug.runInDebug(function () { + EMPTY_BLOCKS = Object.freeze(EMPTY_BLOCKS); + }); + function curryArgs(definition, newArgs) { var args = definition.args; var ComponentClass = definition.ComponentClass; var positionalParams = ComponentClass.class.positionalParams; @@ -10534,20 +12451,20 @@ mergedPositional.splice.apply(mergedPositional, [0, slicedPositionalArgs.length].concat(slicedPositionalArgs)); // Merge named maps var mergedNamed = _emberUtils.assign({}, oldNamed, positionalToNamedParams, newArgs.named.map); - var mergedArgs = _glimmerRuntime.EvaluatedArgs.create(_glimmerRuntime.EvaluatedPositionalArgs.create(mergedPositional), _glimmerRuntime.EvaluatedNamedArgs.create(mergedNamed), _glimmerRuntime.Blocks.empty()); + var mergedArgs = _glimmerRuntime.EvaluatedArgs.create(_glimmerRuntime.EvaluatedPositionalArgs.create(mergedPositional), _glimmerRuntime.EvaluatedNamedArgs.create(mergedNamed), EMPTY_BLOCKS); return mergedArgs; } exports.default = function (vm, args, symbolTable) { return ClosureComponentReference.create(args, symbolTable, vm.env); }; }); -enifed('ember-glimmer/helpers/concat', ['exports', 'ember-glimmer/utils/references', 'glimmer-runtime'], function (exports, _emberGlimmerUtilsReferences, _glimmerRuntime) { +enifed('ember-glimmer/helpers/concat', ['exports', 'ember-glimmer/utils/references', '@glimmer/runtime'], function (exports, _emberGlimmerUtilsReferences, _glimmerRuntime) { 'use strict'; /** @module ember @submodule ember-glimmer @@ -10577,109 +12494,10 @@ exports.default = function (vm, args) { return new _emberGlimmerUtilsReferences.InternalHelperReference(concat, args); }; }); -enifed('ember-glimmer/helpers/debugger', ['exports', 'ember-metal/debug', 'glimmer-runtime'], function (exports, _emberMetalDebug, _glimmerRuntime) { - /* eslint no-debugger:off */ - /*jshint debug:true*/ - - /** - @module ember - @submodule ember-htmlbars - */ - - 'use strict'; - - exports.default = debuggerHelper; - exports.setDebuggerCallback = setDebuggerCallback; - exports.resetDebuggerCallback = resetDebuggerCallback; - - /** - Execute the `debugger` statement in the current template's context. - - ```handlebars - {{debugger}} - ``` - - When using the debugger helper you will have access to a `get` function. This - function retrieves values available in the context of the template. - For example, if you're wondering why a value `{{foo}}` isn't rendering as - expected within a template, you could place a `{{debugger}}` statement and, - when the `debugger;` breakpoint is hit, you can attempt to retrieve this value: - - ``` - > get('foo') - ``` - - `get` is also aware of block variables. So in this situation - - ```handlebars - {{#each items as |item|}} - {{debugger}} - {{/each}} - ``` - - You'll be able to get values from the current item: - - ``` - > get('item.name') - ``` - - You can also access the context of the view to make sure it is the object that - you expect: - - ``` - > context - ``` - - @method debugger - @for Ember.Templates.helpers - @public - */ - function defaultCallback(context, get) { - /* jshint debug: true */ - - _emberMetalDebug.info('Use `context`, and `get(<path>)` to debug this template.'); - - debugger; - } - - var callback = defaultCallback; - - function debuggerHelper(vm, args, symbolTable) { - var context = vm.getSelf().value(); - - // Note: this is totally an overkill since we are only compiling - // expressions, but this is the only kind of SymbolLookup we can - // construct. The symbol table itself should really be sufficient - // here – we should refactor the Glimmer code to make that possible. - var symbolLookup = new _glimmerRuntime.CompileIntoList(vm.env, symbolTable); - - function get(path) { - // Problem: technically, we are getting a `PublicVM` here, but to - // evaluate an expression it requires the full VM. We happen to know - // that they are the same thing, so this would work for now. However - // this might break in the future. - return _glimmerRuntime.GetSyntax.build(path).compile(symbolLookup).evaluate(vm).value(); - } - - callback(context, get); - - return _glimmerRuntime.UNDEFINED_REFERENCE; - } - - // These are exported for testing - - function setDebuggerCallback(newCallback) { - callback = newCallback; - } - - function resetDebuggerCallback() { - callback = defaultCallback; - } -}); enifed('ember-glimmer/helpers/each-in', ['exports', 'ember-utils'], function (exports, _emberUtils) { /** @module ember @submodule ember-glimmer */ @@ -10803,11 +12621,11 @@ var ref = Object.create(args.positional.at(0)); ref[EACH_IN_REFERENCE] = true; return ref; }; }); -enifed('ember-glimmer/helpers/get', ['exports', 'ember-metal', 'ember-glimmer/utils/references', 'glimmer-reference'], function (exports, _emberMetal, _emberGlimmerUtilsReferences, _glimmerReference) { +enifed('ember-glimmer/helpers/get', ['exports', 'ember-metal', 'ember-glimmer/utils/references', '@glimmer/reference'], function (exports, _emberMetal, _emberGlimmerUtilsReferences, _glimmerReference) { 'use strict'; /** @module ember @submodule ember-glimmer @@ -10960,11 +12778,11 @@ exports.default = function (vm, args) { return args.named; }; }); -enifed('ember-glimmer/helpers/if-unless', ['exports', 'ember-metal', 'ember-glimmer/utils/references', 'glimmer-reference'], function (exports, _emberMetal, _emberGlimmerUtilsReferences, _glimmerReference) { +enifed('ember-glimmer/helpers/if-unless', ['exports', 'ember-debug', 'ember-glimmer/utils/references', '@glimmer/reference'], function (exports, _emberDebug, _emberGlimmerUtilsReferences, _glimmerReference) { /** @module ember @submodule ember-glimmer */ @@ -11101,11 +12919,11 @@ case 2: return ConditionalHelperReference.create(positional.at(0), positional.at(1), null); case 3: return ConditionalHelperReference.create(positional.at(0), positional.at(1), positional.at(2)); default: - _emberMetal.assert('The inline form of the `if` helper expects two or three arguments, e.g. ' + '`{{if trialExpired "Expired" expiryDate}}`.'); + _emberDebug.assert('The inline form of the `if` helper expects two or three arguments, e.g. ' + '`{{if trialExpired "Expired" expiryDate}}`.'); } } /** The inline `unless` helper conditionally renders a single property or string. @@ -11135,11 +12953,11 @@ case 2: return ConditionalHelperReference.create(positional.at(0), null, positional.at(1)); case 3: return ConditionalHelperReference.create(positional.at(0), positional.at(2), positional.at(1)); default: - _emberMetal.assert('The inline form of the `unless` helper expects two or three arguments, e.g. ' + '`{{unless isFirstLogin "Welcome back!"}}`.'); + _emberDebug.assert('The inline form of the `unless` helper expects two or three arguments, e.g. ' + '`{{unless isFirstLogin "Welcome back!"}}`.'); } } }); enifed('ember-glimmer/helpers/loc', ['exports', 'ember-glimmer/utils/references', 'ember-runtime'], function (exports, _emberGlimmerUtilsReferences, _emberRuntime) { /** @@ -11219,11 +13037,11 @@ /** @module ember @submodule ember-glimmer */ -enifed('ember-glimmer/helpers/mut', ['exports', 'ember-utils', 'ember-metal', 'ember-glimmer/utils/references', 'ember-glimmer/helpers/action'], function (exports, _emberUtils, _emberMetal, _emberGlimmerUtilsReferences, _emberGlimmerHelpersAction) { +enifed('ember-glimmer/helpers/mut', ['exports', 'ember-utils', 'ember-debug', 'ember-glimmer/utils/references', 'ember-glimmer/helpers/action'], function (exports, _emberUtils, _emberDebug, _emberGlimmerUtilsReferences, _emberGlimmerHelpersAction) { /** @module ember @submodule ember-glimmer */ 'use strict'; @@ -11328,22 +13146,22 @@ // that was originally derived from a literal, result from a helper // invocation, etc // // This message is alright for the first case, but could be quite // confusing for the second case. - _emberMetal.assert('You can only pass a path to mut', rawRef[_emberGlimmerUtilsReferences.UPDATE]); + _emberDebug.assert('You can only pass a path to mut', rawRef[_emberGlimmerUtilsReferences.UPDATE]); var wrappedRef = Object.create(rawRef); wrappedRef[SOURCE] = rawRef; wrappedRef[_emberGlimmerHelpersAction.INVOKE] = rawRef[_emberGlimmerUtilsReferences.UPDATE]; wrappedRef[MUT_REFERENCE] = true; return wrappedRef; }; }); -enifed('ember-glimmer/helpers/query-param', ['exports', 'ember-utils', 'ember-glimmer/utils/references', 'ember-metal', 'ember-routing'], function (exports, _emberUtils, _emberGlimmerUtilsReferences, _emberMetal, _emberRouting) { +enifed('ember-glimmer/helpers/query-param', ['exports', 'ember-utils', 'ember-glimmer/utils/references', 'ember-debug', 'ember-routing'], function (exports, _emberUtils, _emberGlimmerUtilsReferences, _emberDebug, _emberRouting) { /** @module ember @submodule ember-glimmer */ 'use strict'; @@ -11366,11 +13184,11 @@ */ function queryParams(_ref) { var positional = _ref.positional; var named = _ref.named; - _emberMetal.assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', positional.value().length === 0); + _emberDebug.assert('The `query-params` helper only accepts hash parameters, e.g. (query-params queryParamPropertyName=\'foo\') as opposed to just (query-params \'foo\')', positional.value().length === 0); return _emberRouting.QueryParams.create({ values: _emberUtils.assign({}, named.value()) }); } @@ -11489,11 +13307,11 @@ wrapped[_emberGlimmerUtilsReferences.UPDATE] = undefined; return wrapped; }; }); -enifed('ember-glimmer/helpers/unbound', ['exports', 'ember-metal', 'ember-glimmer/utils/references'], function (exports, _emberMetal, _emberGlimmerUtilsReferences) { +enifed('ember-glimmer/helpers/unbound', ['exports', 'ember-debug', 'ember-glimmer/utils/references'], function (exports, _emberDebug, _emberGlimmerUtilsReferences) { /** @module ember @submodule ember-glimmer */ @@ -11526,16 +13344,16 @@ @for Ember.Templates.helpers @public */ exports.default = function (vm, args) { - _emberMetal.assert('unbound helper cannot be called with multiple params or hash params', args.positional.values.length === 1 && args.named.keys.length === 0); + _emberDebug.assert('unbound helper cannot be called with multiple params or hash params', args.positional.values.length === 1 && args.named.keys.length === 0); return _emberGlimmerUtilsReferences.UnboundReference.create(args.positional.at(0).value()); }; }); -enifed('ember-glimmer/index', ['exports', 'ember-glimmer/helpers/action', 'ember-glimmer/templates/root', 'ember-glimmer/syntax', 'ember-glimmer/template', 'ember-glimmer/components/checkbox', 'ember-glimmer/components/text_field', 'ember-glimmer/components/text_area', 'ember-glimmer/components/link-to', 'ember-glimmer/component', 'ember-glimmer/helper', 'ember-glimmer/environment', 'ember-glimmer/make-bound-helper', 'ember-glimmer/utils/string', 'ember-glimmer/renderer', 'ember-glimmer/template_registry', 'ember-glimmer/setup-registry', 'ember-glimmer/dom'], function (exports, _emberGlimmerHelpersAction, _emberGlimmerTemplatesRoot, _emberGlimmerSyntax, _emberGlimmerTemplate, _emberGlimmerComponentsCheckbox, _emberGlimmerComponentsText_field, _emberGlimmerComponentsText_area, _emberGlimmerComponentsLinkTo, _emberGlimmerComponent, _emberGlimmerHelper, _emberGlimmerEnvironment, _emberGlimmerMakeBoundHelper, _emberGlimmerUtilsString, _emberGlimmerRenderer, _emberGlimmerTemplate_registry, _emberGlimmerSetupRegistry, _emberGlimmerDom) { +enifed('ember-glimmer/index', ['exports', 'ember-glimmer/helpers/action', 'ember-glimmer/templates/root', 'ember-glimmer/template', 'ember-glimmer/components/checkbox', 'ember-glimmer/components/text_field', 'ember-glimmer/components/text_area', 'ember-glimmer/components/link-to', 'ember-glimmer/component', 'ember-glimmer/helper', 'ember-glimmer/environment', 'ember-glimmer/make-bound-helper', 'ember-glimmer/utils/string', 'ember-glimmer/renderer', 'ember-glimmer/template_registry', 'ember-glimmer/setup-registry', 'ember-glimmer/dom'], function (exports, _emberGlimmerHelpersAction, _emberGlimmerTemplatesRoot, _emberGlimmerTemplate, _emberGlimmerComponentsCheckbox, _emberGlimmerComponentsText_field, _emberGlimmerComponentsText_area, _emberGlimmerComponentsLinkTo, _emberGlimmerComponent, _emberGlimmerHelper, _emberGlimmerEnvironment, _emberGlimmerMakeBoundHelper, _emberGlimmerUtilsString, _emberGlimmerRenderer, _emberGlimmerTemplate_registry, _emberGlimmerSetupRegistry, _emberGlimmerDom) { /** [Glimmer](https://github.com/tildeio/glimmer) is a templating engine used by Ember.js that is compatible with a subset of the [Handlebars](http://handlebarsjs.com/) syntax. ### Showing a property @@ -11731,11 +13549,10 @@ 'use strict'; exports.INVOKE = _emberGlimmerHelpersAction.INVOKE; exports.RootTemplate = _emberGlimmerTemplatesRoot.default; - exports.registerSyntax = _emberGlimmerSyntax.registerSyntax; exports.template = _emberGlimmerTemplate.default; exports.Checkbox = _emberGlimmerComponentsCheckbox.default; exports.TextField = _emberGlimmerComponentsText_field.default; exports.TextArea = _emberGlimmerComponentsText_area.default; exports.LinkComponent = _emberGlimmerComponentsLinkTo.default; @@ -11761,11 +13578,11 @@ exports.setupApplicationRegistry = _emberGlimmerSetupRegistry.setupApplicationRegistry; exports.DOMChanges = _emberGlimmerDom.DOMChanges; exports.NodeDOMTreeConstruction = _emberGlimmerDom.NodeDOMTreeConstruction; exports.DOMTreeConstruction = _emberGlimmerDom.DOMTreeConstruction; }); -enifed('ember-glimmer/make-bound-helper', ['exports', 'ember-metal', 'ember-glimmer/helper'], function (exports, _emberMetal, _emberGlimmerHelper) { +enifed('ember-glimmer/make-bound-helper', ['exports', 'ember-debug', 'ember-glimmer/helper'], function (exports, _emberDebug, _emberGlimmerHelper) { /** @module ember @submodule ember-glimmer */ 'use strict'; @@ -11815,15 +13632,15 @@ @param {Function} fn @since 1.10.0 */ function makeBoundHelper(fn) { - _emberMetal.deprecate('Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to use `Ember.Helper` or `Ember.Helper.helper`.', false, { id: 'ember-htmlbars.make-bound-helper', until: '3.0.0' }); + _emberDebug.deprecate('Using `Ember.HTMLBars.makeBoundHelper` is deprecated. Please refactor to use `Ember.Helper` or `Ember.Helper.helper`.', false, { id: 'ember-htmlbars.make-bound-helper', until: '3.0.0' }); return _emberGlimmerHelper.helper(fn); } }); -enifed('ember-glimmer/modifiers/action', ['exports', 'ember-utils', 'ember-metal', 'ember-views', 'ember-glimmer/helpers/action'], function (exports, _emberUtils, _emberMetal, _emberViews, _emberGlimmerHelpersAction) { +enifed('ember-glimmer/modifiers/action', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-views', 'ember-glimmer/helpers/action'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberViews, _emberGlimmerHelpersAction) { 'use strict'; var MODIFIERS = ['alt', 'shift', 'meta', 'ctrl']; var POINTER_EVENT_TYPE_REGEX = /^click|mouse|touch/; @@ -11962,11 +13779,11 @@ if (target.send) { _emberMetal.flaggedInstrument('interaction.ember-action', payload, function () { target.send.apply(target, [actionName].concat(args)); }); } else { - _emberMetal.assert('The action \'' + actionName + '\' did not exist on ' + target, typeof target[actionName] === 'function'); + _emberDebug.assert('The action \'' + actionName + '\' did not exist on ' + target, typeof target[actionName] === 'function'); _emberMetal.flaggedInstrument('interaction.ember-action', payload, function () { target[actionName].apply(target, args); }); } }); @@ -12001,11 +13818,11 @@ actionName = actionNameRef; } else { var actionLabel = actionNameRef._propertyKey; actionName = actionNameRef.value(); - _emberMetal.assert('You specified a quoteless path, `' + actionLabel + '`, to the ' + '{{action}} helper which did not resolve to an action name (a ' + 'string). Perhaps you meant to use a quoted actionName? (e.g. ' + '{{action "' + actionLabel + '"}}).', typeof actionName === 'string' || typeof actionName === 'function'); + _emberDebug.assert('You specified a quoteless path, `' + actionLabel + '`, to the ' + '{{action}} helper which did not resolve to an action name (a ' + 'string). Perhaps you meant to use a quoted actionName? (e.g. ' + '{{action "' + actionLabel + '"}}).', typeof actionName === 'string' || typeof actionName === 'function'); } } var actionArgs = []; // The first two arguments are (1) `this` and (2) the action name. @@ -12103,24 +13920,13 @@ protocol = nodeURL.parse(url).protocol; } return protocol === null ? ':' : protocol; } }); -enifed('ember-glimmer/renderer', ['exports', 'ember-glimmer/utils/references', 'ember-metal', 'glimmer-reference', 'ember-views', 'ember-glimmer/component', 'ember-glimmer/syntax/curly-component', 'ember-glimmer/syntax/outlet'], function (exports, _emberGlimmerUtilsReferences, _emberMetal, _glimmerReference, _emberViews, _emberGlimmerComponent, _emberGlimmerSyntaxCurlyComponent, _emberGlimmerSyntaxOutlet) { +enifed('ember-glimmer/renderer', ['exports', 'ember-glimmer/utils/references', 'ember-metal', '@glimmer/reference', 'ember-views', 'ember-glimmer/component', 'ember-glimmer/syntax/curly-component', 'ember-glimmer/syntax/outlet', 'ember-debug'], function (exports, _emberGlimmerUtilsReferences, _emberMetal, _glimmerReference, _emberViews, _emberGlimmerComponent, _emberGlimmerSyntaxCurlyComponent, _emberGlimmerSyntaxOutlet, _emberDebug) { 'use strict'; - var runInTransaction = undefined; - - if (true || false) { - runInTransaction = _emberMetal.runInTransaction; - } else { - runInTransaction = function (context, methodName) { - context[methodName](); - return false; - }; - } - var backburner = _emberMetal.run.backburner; var DynamicScope = (function () { function DynamicScope(view, outletState, rootOutletState, targetObject) { babelHelpers.classCallCheck(this, DynamicScope); @@ -12133,16 +13939,16 @@ DynamicScope.prototype.child = function child() { return new DynamicScope(this.view, this.outletState, this.rootOutletState); }; DynamicScope.prototype.get = function get(key) { - _emberMetal.assert('Using `-get-dynamic-scope` is only supported for `outletState` (you used `' + key + '`).', key === 'outletState'); + _emberDebug.assert('Using `-get-dynamic-scope` is only supported for `outletState` (you used `' + key + '`).', key === 'outletState'); return this.outletState; }; DynamicScope.prototype.set = function set(key, value) { - _emberMetal.assert('Using `-with-dynamic-scope` is only supported for `outletState` (you used `' + key + '`).', key === 'outletState'); + _emberDebug.assert('Using `-with-dynamic-scope` is only supported for `outletState` (you used `' + key + '`).', key === 'outletState'); this.outletState = value; return value; }; return DynamicScope; @@ -12152,11 +13958,11 @@ function RootState(root, env, template, self, parentElement, dynamicScope) { var _this = this; babelHelpers.classCallCheck(this, RootState); - _emberMetal.assert('You cannot render `' + self.value() + '` without a template.', template); + _emberDebug.assert('You cannot render `' + self.value() + '` without a template.', template); this.id = _emberViews.getViewId(root); this.env = env; this.root = root; this.result = undefined; @@ -12167,12 +13973,19 @@ var options = this.options = { alwaysRevalidate: false }; this.render = function () { - var result = _this.result = template.render(self, parentElement, dynamicScope); + var iterator = template.render(self, parentElement, dynamicScope); + var iteratorResult = undefined; + do { + iteratorResult = iterator.next(); + } while (!iteratorResult.done); + + var result = _this.result = iteratorResult.value; + // override .render function after initial render _this.render = function () { result.rerender(options); }; }; @@ -12224,17 +14037,17 @@ _emberMetal.setHasViews(function () { return renderers.length > 0; }); function register(renderer) { - _emberMetal.assert('Cannot register the same renderer twice', renderers.indexOf(renderer) === -1); + _emberDebug.assert('Cannot register the same renderer twice', renderers.indexOf(renderer) === -1); renderers.push(renderer); } function deregister(renderer) { var index = renderers.indexOf(renderer); - _emberMetal.assert('Cannot deregister unknown unregistered renderer', index !== -1); + _emberDebug.assert('Cannot deregister unknown unregistered renderer', index !== -1); renderers.splice(index, 1); } function loopBegin() { for (var i = 0; i < renderers.length; i++) { @@ -12313,11 +14126,11 @@ this._scheduleRevalidate(); }; Renderer.prototype.register = function register(view) { var id = _emberViews.getViewId(view); - _emberMetal.assert('Attempted to register a view with an id already in use: ' + id, !this._viewRegistry[id]); + _emberDebug.assert('Attempted to register a view with an id already in use: ' + id, !this._viewRegistry[id]); this._viewRegistry[id] = view; }; Renderer.prototype.unregister = function unregister(view) { delete this._viewRegistry[_emberViews.getViewId(view)]; @@ -12432,11 +14245,11 @@ continue; } root.options.alwaysRevalidate = shouldReflush; // track shouldReflush based on this roots render result - shouldReflush = root.shouldReflush = runInTransaction(root, 'render'); + shouldReflush = root.shouldReflush = _emberMetal.runInTransaction(root, 'render'); // globalShouldReflush should be `true` if *any* of // the roots need to reflush globalShouldReflush = globalShouldReflush || shouldReflush; } @@ -12631,70 +14444,176 @@ registry.register('component:-checkbox', _emberGlimmerComponentsCheckbox.default); registry.register('component:link-to', _emberGlimmerComponentsLinkTo.default); registry.register(_container.privatize(_templateObject3), _emberGlimmerComponent.default); } }); -enifed('ember-glimmer/syntax', ['exports', 'ember-glimmer/syntax/render', 'ember-glimmer/syntax/outlet', 'ember-glimmer/syntax/mount', 'ember-glimmer/syntax/dynamic-component', 'ember-glimmer/syntax/input', 'glimmer-runtime'], function (exports, _emberGlimmerSyntaxRender, _emberGlimmerSyntaxOutlet, _emberGlimmerSyntaxMount, _emberGlimmerSyntaxDynamicComponent, _emberGlimmerSyntaxInput, _glimmerRuntime) { +enifed('ember-glimmer/syntax', ['exports', 'ember-glimmer/syntax/render', 'ember-glimmer/syntax/outlet', 'ember-glimmer/syntax/mount', 'ember-glimmer/syntax/dynamic-component', 'ember-glimmer/utils/bindings', 'ember-glimmer/syntax/-with-dynamic-vars', 'ember-glimmer/syntax/-in-element', 'ember-glimmer/syntax/input', 'ember-glimmer/syntax/-text-area', 'ember-debug'], function (exports, _emberGlimmerSyntaxRender, _emberGlimmerSyntaxOutlet, _emberGlimmerSyntaxMount, _emberGlimmerSyntaxDynamicComponent, _emberGlimmerUtilsBindings, _emberGlimmerSyntaxWithDynamicVars, _emberGlimmerSyntaxInElement, _emberGlimmerSyntaxInput, _emberGlimmerSyntaxTextArea, _emberDebug) { 'use strict'; - exports.registerSyntax = registerSyntax; - exports.findSyntaxBuilder = findSyntaxBuilder; + exports.registerMacros = registerMacros; + exports.populateMacros = populateMacros; - var syntaxKeys = []; - var syntaxes = []; + function refineInlineSyntax(path, params, hash, builder) { + var name = path[0]; - function registerSyntax(key, syntax) { - syntaxKeys.push(key); - syntaxes.push(syntax); - } + _emberDebug.assert('You attempted to overwrite the built-in helper "' + name + '" which is not allowed. Please rename the helper.', !(builder.env.builtInHelpers[name] && builder.env.owner.hasRegistration('helper:' + name))); - function findSyntaxBuilder(key) { - var index = syntaxKeys.indexOf(key); + if (path.length > 1) { + return _emberGlimmerSyntaxDynamicComponent.closureComponentMacro(path, params, hash, null, null, builder); + } - if (index > -1) { - return syntaxes[index]; + var symbolTable = builder.symbolTable; + + var definition = undefined; + if (name.indexOf('-') > -1) { + definition = builder.env.getComponentDefinition(path, symbolTable); } + + if (definition) { + _emberGlimmerUtilsBindings.wrapComponentClassAttribute(hash); + builder.component.static(definition, [params, hash, null, null], symbolTable); + return true; + } + + return false; } - registerSyntax('render', _emberGlimmerSyntaxRender.RenderSyntax); - registerSyntax('outlet', _emberGlimmerSyntaxOutlet.OutletSyntax); - registerSyntax('mount', _emberGlimmerSyntaxMount.MountSyntax); - registerSyntax('component', _emberGlimmerSyntaxDynamicComponent.DynamicComponentSyntax); - registerSyntax('input', _emberGlimmerSyntaxInput.InputSyntax); + function refineBlockSyntax(sexp, builder) { + var path = sexp[1]; + var params = sexp[2]; + var hash = sexp[3]; + var _default = sexp[4]; + var inverse = sexp[5]; + var name = path[0]; - registerSyntax('-with-dynamic-vars', (function () { - function _class() { - babelHelpers.classCallCheck(this, _class); + if (path.length > 1) { + return _emberGlimmerSyntaxDynamicComponent.closureComponentMacro(path, params, hash, _default, inverse, builder); } - _class.create = function create(environment, args, symbolTable) { - return new _glimmerRuntime.WithDynamicVarsSyntax(args); - }; + if (name.indexOf('-') === -1) { + return false; + } - return _class; - })()); + var symbolTable = builder.symbolTable; - registerSyntax('-in-element', (function () { - function _class2() { - babelHelpers.classCallCheck(this, _class2); + var definition = undefined; + if (name.indexOf('-') > -1) { + definition = builder.env.getComponentDefinition(path, symbolTable); } - _class2.create = function create(environment, args, symbolTable) { - return new _glimmerRuntime.InElementSyntax(args); - }; + if (definition) { + _emberGlimmerUtilsBindings.wrapComponentClassAttribute(hash); + builder.component.static(definition, [params, hash, _default, inverse], symbolTable); + return true; + } - return _class2; - })()); + _emberDebug.assert('A component or helper named "' + name + '" could not be found', builder.env.hasHelper(path, symbolTable)); + + _emberDebug.assert('Helpers may not be used in the block form, for example {{#' + name + '}}{{/' + name + '}}. Please use a component, or alternatively use the helper in combination with a built-in Ember helper, for example {{#if (' + name + ')}}{{/if}}.', !builder.env.hasHelper(path, symbolTable)); + + return false; + } + + var experimentalMacros = []; + + // This is a private API to allow for expiremental macros + // to be created in user space. Registering a macro should + // should be done in an initializer. + + function registerMacros(macro) { + experimentalMacros.push(macro); + } + + function populateMacros(blocks, inlines) { + inlines.add('outlet', _emberGlimmerSyntaxOutlet.outletMacro); + inlines.add('component', _emberGlimmerSyntaxDynamicComponent.inlineComponentMacro); + inlines.add('render', _emberGlimmerSyntaxRender.renderMacro); + inlines.add('mount', _emberGlimmerSyntaxMount.mountMacro); + inlines.add('input', _emberGlimmerSyntaxInput.inputMacro); + inlines.add('textarea', _emberGlimmerSyntaxTextArea.textAreaMacro); + inlines.addMissing(refineInlineSyntax); + blocks.add('component', _emberGlimmerSyntaxDynamicComponent.blockComponentMacro); + blocks.add('-with-dynamic-vars', _emberGlimmerSyntaxWithDynamicVars._withDynamicVarsMacro); + blocks.add('-in-element', _emberGlimmerSyntaxInElement._inElementMacro); + blocks.addMissing(refineBlockSyntax); + + for (var i = 0; i < experimentalMacros.length; i++) { + var macro = experimentalMacros[i]; + macro(blocks, inlines); + } + + experimentalMacros = []; + + return { blocks: blocks, inlines: inlines }; + } }); -enifed('ember-glimmer/syntax/abstract-manager', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-glimmer/syntax/-in-element', ['exports', '@glimmer/runtime', '@glimmer/util'], function (exports, _glimmerRuntime, _glimmerUtil) { 'use strict'; + exports._inElementMacro = _inElementMacro; + var _BaselineSyntax$NestedBlock = _glimmerRuntime.BaselineSyntax.NestedBlock; + var defaultBlock = _BaselineSyntax$NestedBlock.defaultBlock; + var params = _BaselineSyntax$NestedBlock.params; + var hash = _BaselineSyntax$NestedBlock.hash; + + function _inElementMacro(sexp, builder) { + var block = defaultBlock(sexp); + var args = _glimmerRuntime.compileArgs(params(sexp), hash(sexp), builder); + + builder.putArgs(args); + builder.test('simple'); + + builder.labelled(null, function (b) { + b.jumpUnless('END'); + b.pushRemoteElement(); + b.evaluate(_glimmerUtil.unwrap(block)); + b.popRemoteElement(); + }); + } +}); +enifed('ember-glimmer/syntax/-text-area', ['exports', 'ember-glimmer/utils/bindings'], function (exports, _emberGlimmerUtilsBindings) { + 'use strict'; + + exports.textAreaMacro = textAreaMacro; + + function textAreaMacro(path, params, hash, builder) { + var definition = builder.env.getComponentDefinition(['-text-area'], builder.symbolTable); + _emberGlimmerUtilsBindings.wrapComponentClassAttribute(hash); + builder.component.static(definition, [params, hash, null, null], builder.symbolTable); + return true; + } +}); +enifed('ember-glimmer/syntax/-with-dynamic-vars', ['exports', '@glimmer/runtime', '@glimmer/util'], function (exports, _glimmerRuntime, _glimmerUtil) { + 'use strict'; + + exports._withDynamicVarsMacro = _withDynamicVarsMacro; + var _BaselineSyntax$NestedBlock = _glimmerRuntime.BaselineSyntax.NestedBlock; + var defaultBlock = _BaselineSyntax$NestedBlock.defaultBlock; + var params = _BaselineSyntax$NestedBlock.params; + var hash = _BaselineSyntax$NestedBlock.hash; + + function _withDynamicVarsMacro(sexp, builder) { + var block = defaultBlock(sexp); + var args = _glimmerRuntime.compileArgs(params(sexp), hash(sexp), builder); + + builder.unit(function (b) { + b.putArgs(args); + b.pushDynamicScope(); + b.bindDynamicScope(args.named.keys); + b.evaluate(_glimmerUtil.unwrap(block)); + b.popDynamicScope(); + }); + } +}); +enifed('ember-glimmer/syntax/abstract-manager', ['exports', 'ember-debug'], function (exports, _emberDebug) { + 'use strict'; + var AbstractManager = function AbstractManager() { babelHelpers.classCallCheck(this, AbstractManager); }; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { AbstractManager.prototype._pushToDebugStack = function (name, environment) { this.debugStack = environment.debugStack; this.debugStack.push(name); }; @@ -12704,21 +14623,21 @@ }; }); exports.default = AbstractManager; }); -enifed('ember-glimmer/syntax/curly-component', ['exports', 'ember-utils', 'glimmer-runtime', 'ember-glimmer/utils/bindings', 'ember-glimmer/component', 'ember-metal', 'ember-views', 'ember-glimmer/utils/process-args', 'container', 'ember-glimmer/syntax/abstract-manager'], function (exports, _emberUtils, _glimmerRuntime, _emberGlimmerUtilsBindings, _emberGlimmerComponent, _emberMetal, _emberViews, _emberGlimmerUtilsProcessArgs, _container, _emberGlimmerSyntaxAbstractManager) { +enifed('ember-glimmer/syntax/curly-component', ['exports', 'ember-utils', '@glimmer/runtime', 'ember-glimmer/utils/bindings', 'ember-glimmer/component', 'ember-metal', 'ember-debug', 'ember-views', 'ember-glimmer/utils/process-args', 'container', 'ember-glimmer/syntax/abstract-manager'], function (exports, _emberUtils, _glimmerRuntime, _emberGlimmerUtilsBindings, _emberGlimmerComponent, _emberMetal, _emberDebug, _emberViews, _emberGlimmerUtilsProcessArgs, _container, _emberGlimmerSyntaxAbstractManager) { 'use strict'; exports.validatePositionalParameters = validatePositionalParameters; var _templateObject = babelHelpers.taggedTemplateLiteralLoose(['template:components/-default'], ['template:components/-default']); var DEFAULT_LAYOUT = _container.privatize(_templateObject); function processComponentInitializationAssertions(component, props) { - _emberMetal.assert('classNameBindings must not have spaces in them: ' + component.toString(), (function () { + _emberDebug.assert('classNameBindings must not have spaces in them: ' + component.toString(), (function () { var classNameBindings = component.classNameBindings; for (var i = 0; i < classNameBindings.length; i++) { var binding = classNameBindings[i]; if (binding.split(' ').length > 1) { @@ -12726,59 +14645,59 @@ } } return true; })()); - _emberMetal.assert('You cannot use `classNameBindings` on a tag-less component: ' + component.toString(), (function () { + _emberDebug.assert('You cannot use `classNameBindings` on a tag-less component: ' + component.toString(), (function () { var classNameBindings = component.classNameBindings; var tagName = component.tagName; return tagName !== '' || !classNameBindings || classNameBindings.length === 0; })()); - _emberMetal.assert('You cannot use `elementId` on a tag-less component: ' + component.toString(), (function () { + _emberDebug.assert('You cannot use `elementId` on a tag-less component: ' + component.toString(), (function () { var elementId = component.elementId; var tagName = component.tagName; return tagName !== '' || props.id === elementId || !elementId && elementId !== ''; })()); - _emberMetal.assert('You cannot use `attributeBindings` on a tag-less component: ' + component.toString(), (function () { + _emberDebug.assert('You cannot use `attributeBindings` on a tag-less component: ' + component.toString(), (function () { var attributeBindings = component.attributeBindings; var tagName = component.tagName; return tagName !== '' || !attributeBindings || attributeBindings.length === 0; })()); } function validatePositionalParameters(named, positional, positionalParamsDefinition) { - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { if (!named || !positional || !positional.length) { return; } var paramType = typeof positionalParamsDefinition; if (paramType === 'string') { - _emberMetal.assert('You cannot specify positional parameters and the hash argument `' + positionalParamsDefinition + '`.', !named.has(positionalParamsDefinition)); + _emberDebug.assert('You cannot specify positional parameters and the hash argument `' + positionalParamsDefinition + '`.', !named.has(positionalParamsDefinition)); } else { if (positional.length < positionalParamsDefinition.length) { positionalParamsDefinition = positionalParamsDefinition.slice(0, positional.length); } for (var i = 0; i < positionalParamsDefinition.length; i++) { var _name = positionalParamsDefinition[i]; - _emberMetal.assert('You cannot specify both a positional param (at position ' + i + ') and the hash argument `' + _name + '`.', !named.has(_name)); + _emberDebug.assert('You cannot specify both a positional param (at position ' + i + ') and the hash argument `' + _name + '`.', !named.has(_name)); } } }); } function aliasIdToElementId(args, props) { if (args.named.has('id')) { - _emberMetal.assert('You cannot invoke a component with both \'id\' and \'elementId\' at the same time.', !args.named.has('elementId')); + _emberDebug.assert('You cannot invoke a component with both \'id\' and \'elementId\' at the same time.', !args.named.has('elementId')); props.elementId = props.id; } } // We must traverse the attributeBindings in reverse keeping track of @@ -12808,32 +14727,10 @@ if (seen.indexOf('style') === -1) { _emberGlimmerUtilsBindings.IsVisibleBinding.install(element, component, operations); } } - var CurlyComponentSyntax = (function (_StatementSyntax) { -babelHelpers.inherits(CurlyComponentSyntax, _StatementSyntax); - - function CurlyComponentSyntax(args, definition, symbolTable) { -babelHelpers.classCallCheck(this, CurlyComponentSyntax); - - _StatementSyntax.call(this); - this.args = args; - this.definition = definition; - this.symbolTable = symbolTable; - this.shadow = null; - } - - CurlyComponentSyntax.prototype.compile = function compile(builder) { - builder.component.static(this.definition, this.args, this.symbolTable, this.shadow); - }; - - return CurlyComponentSyntax; - })(_glimmerRuntime.StatementSyntax); - - exports.CurlyComponentSyntax = CurlyComponentSyntax; - function NOOP() {} var ComponentStateBucket = (function () { function ComponentStateBucket(environment, component, args, finalizer) { babelHelpers.classCallCheck(this, ComponentStateBucket); @@ -12894,11 +14791,11 @@ }; CurlyComponentManager.prototype.create = function create(environment, definition, args, dynamicScope, callerSelfRef, hasBlock) { var _this = this; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this._pushToDebugStack('component:' + definition.name, environment); }); var parentView = dynamicScope.view; @@ -12944,11 +14841,11 @@ if (args.named.has('class')) { bucket.classRef = args.named.get('class'); } - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { processComponentInitializationAssertions(component, props); }); if (environment.isInteractive && component.tagName !== '') { component.trigger('willRender'); @@ -13034,11 +14931,11 @@ var _this2 = this; bucket.component[_emberGlimmerComponent.BOUNDS] = bounds; bucket.finalize(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this2.debugStack.pop(); }); }; CurlyComponentManager.prototype.getTag = function getTag(_ref3) { @@ -13064,11 +14961,11 @@ var component = bucket.component; var args = bucket.args; var argsRevision = bucket.argsRevision; var environment = bucket.environment; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this3._pushToDebugStack(component._debugContainerKey, environment); }); bucket.finalizer = _emberMetal._instrumentStart('render.component', rerenderInstrumentDetails, component); @@ -13100,11 +14997,11 @@ CurlyComponentManager.prototype.didUpdateLayout = function didUpdateLayout(bucket) { var _this4 = this; bucket.finalize(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this4.debugStack.pop(); }); }; CurlyComponentManager.prototype.didUpdate = function didUpdate(_ref5) { @@ -13138,11 +15035,11 @@ TopComponentManager.prototype.create = function create(environment, definition, args, dynamicScope, currentScope, hasBlock) { var _this5 = this; var component = definition.ComponentClass.create(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this5._pushToDebugStack(component._debugContainerKey, environment); }); var finalizer = _emberMetal._instrumentStart('render.component', initialRenderInstrumentDetails, component); @@ -13159,11 +15056,11 @@ if (environment.isInteractive) { component.trigger('willInsertElement'); } } - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { processComponentInitializationAssertions(component, {}); }); return new ComponentStateBucket(environment, component, args, finalizer); }; @@ -13237,64 +15134,59 @@ return CurlyComponentLayoutCompiler; })(); CurlyComponentLayoutCompiler.id = 'curly'; }); -enifed('ember-glimmer/syntax/dynamic-component', ['exports', 'glimmer-runtime', 'glimmer-reference', 'ember-metal'], function (exports, _glimmerRuntime, _glimmerReference, _emberMetal) { +enifed('ember-glimmer/syntax/dynamic-component', ['exports', '@glimmer/runtime', '@glimmer/reference', 'ember-debug'], function (exports, _glimmerRuntime, _glimmerReference, _emberDebug) { 'use strict'; + exports.closureComponentMacro = closureComponentMacro; + exports.dynamicComponentMacro = dynamicComponentMacro; + exports.blockComponentMacro = blockComponentMacro; + exports.inlineComponentMacro = inlineComponentMacro; + function dynamicComponentFor(vm, symbolTable) { var env = vm.env; var args = vm.getArgs(); var nameRef = args.positional.at(0); return new DynamicComponentReference({ nameRef: nameRef, env: env, symbolTable: symbolTable }); } - var DynamicComponentSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(DynamicComponentSyntax, _StatementSyntax); + function closureComponentMacro(path, params, hash, _default, inverse, builder) { + var definitionArgs = [[['get', path]], hash, _default, inverse]; + var args = [params, hash, _default, inverse]; + builder.component.dynamic(definitionArgs, dynamicComponentFor, args, builder.symbolTable); + return true; + } - // for {{component componentName}} + function dynamicComponentMacro(params, hash, _default, inverse, builder) { + var definitionArgs = [params.slice(0, 1), null, null, null]; + var args = [params.slice(1), hash, null, null]; + builder.component.dynamic(definitionArgs, dynamicComponentFor, args, builder.symbolTable); + return true; + } - DynamicComponentSyntax.create = function create(environment, args, symbolTable) { - var definitionArgs = _glimmerRuntime.ArgsSyntax.fromPositionalArgs(args.positional.slice(0, 1)); - var invocationArgs = _glimmerRuntime.ArgsSyntax.build(args.positional.slice(1), args.named, args.blocks); + function blockComponentMacro(sexp, builder) { + var params = sexp[2]; + var hash = sexp[3]; + var _default = sexp[4]; + var inverse = sexp[5]; - return new this(definitionArgs, invocationArgs, symbolTable); - }; + var definitionArgs = [params.slice(0, 1), null, null, null]; + var args = [params.slice(1), hash, _default, inverse]; + builder.component.dynamic(definitionArgs, dynamicComponentFor, args, builder.symbolTable); + return true; + } - // Transforms {{foo.bar with=args}} or {{#foo.bar with=args}}{{/foo.bar}} - // into {{component foo.bar with=args}} or - // {{#component foo.bar with=args}}{{/component}} - // with all of it's arguments + function inlineComponentMacro(path, params, hash, builder) { + var definitionArgs = [params.slice(0, 1), null, null, null]; + var args = [params.slice(1), hash, null, null]; + builder.component.dynamic(definitionArgs, dynamicComponentFor, args, builder.symbolTable); + return true; + } - DynamicComponentSyntax.fromPath = function fromPath(environment, path, args, symbolTable) { - var positional = _glimmerRuntime.ArgsSyntax.fromPositionalArgs(_glimmerRuntime.PositionalArgsSyntax.build([_glimmerRuntime.GetSyntax.build(path.join('.'))])); - - return new this(positional, args, symbolTable); - }; - - function DynamicComponentSyntax(definitionArgs, args, symbolTable) { - babelHelpers.classCallCheck(this, DynamicComponentSyntax); - - _StatementSyntax.call(this); - this.definition = dynamicComponentFor; - this.definitionArgs = definitionArgs; - this.args = args; - this.symbolTable = symbolTable; - this.shadow = null; - } - - DynamicComponentSyntax.prototype.compile = function compile(builder) { - builder.component.dynamic(this.definitionArgs, this.definition, this.args, this.symbolTable, this.shadow); - }; - - return DynamicComponentSyntax; - })(_glimmerRuntime.StatementSyntax); - - exports.DynamicComponentSyntax = DynamicComponentSyntax; - var DynamicComponentReference = (function () { function DynamicComponentReference(_ref) { var nameRef = _ref.nameRef; var env = _ref.env; var symbolTable = _ref.symbolTable; @@ -13316,11 +15208,11 @@ var nameOrDef = nameRef.value(); if (typeof nameOrDef === 'string') { var definition = env.getComponentDefinition([nameOrDef], symbolTable); - _emberMetal.assert('Could not find component named "' + nameOrDef + '" (no component or template with that name was found)', definition); + _emberDebug.assert('Could not find component named "' + nameOrDef + '" (no component or template with that name was found)', definition); return definition; } else if (_glimmerRuntime.isComponentDefinition(nameOrDef)) { return nameOrDef; } else { @@ -13333,21 +15225,23 @@ }; return DynamicComponentReference; })(); }); -enifed('ember-glimmer/syntax/input', ['exports', 'ember-metal', 'ember-glimmer/syntax/curly-component', 'ember-glimmer/syntax/dynamic-component', 'ember-glimmer/utils/bindings'], function (exports, _emberMetal, _emberGlimmerSyntaxCurlyComponent, _emberGlimmerSyntaxDynamicComponent, _emberGlimmerUtilsBindings) { +enifed('ember-glimmer/syntax/input', ['exports', 'ember-debug', 'ember-glimmer/utils/bindings', 'ember-glimmer/syntax/dynamic-component'], function (exports, _emberDebug, _emberGlimmerUtilsBindings, _emberGlimmerSyntaxDynamicComponent) { /** @module ember @submodule ember-glimmer */ 'use strict'; - function buildTextFieldSyntax(args, getDefinition, symbolTable) { - var definition = getDefinition('-text-field'); - _emberGlimmerUtilsBindings.wrapComponentClassAttribute(args); - return new _emberGlimmerSyntaxCurlyComponent.CurlyComponentSyntax(args, definition, symbolTable); + exports.inputMacro = inputMacro; + + function buildTextFieldSyntax(params, hash, builder) { + var definition = builder.env.getComponentDefinition(['-text-field'], builder.symbolTable); + builder.component.static(definition, [params, hash, null, null], builder.symbolTable); + return true; } /** The `{{input}}` helper lets you create an HTML `<input />` component. It causes an `Ember.TextField` component to be rendered. For more info, @@ -13478,45 +15372,67 @@ @method input @for Ember.Templates.helpers @param {Hash} options @public */ - var InputSyntax = { - create: function (environment, args, symbolTable) { - var getDefinition = function (path) { - return environment.getComponentDefinition([path], symbolTable); - }; - if (args.named.has('type')) { - var typeArg = args.named.at('type'); - if (typeArg.type === 'value') { - if (typeArg.value === 'checkbox') { - _emberMetal.assert('{{input type=\'checkbox\'}} does not support setting `value=someBooleanValue`; ' + 'you must use `checked=someBooleanValue` instead.', !args.named.has('value')); + function inputMacro(path, params, hash, builder) { + var keys = undefined; + var values = undefined; + var typeIndex = -1; + var valueIndex = -1; - _emberGlimmerUtilsBindings.wrapComponentClassAttribute(args); - var definition = getDefinition('-checkbox'); - return new _emberGlimmerSyntaxCurlyComponent.CurlyComponentSyntax(args, definition, symbolTable); - } else { - return buildTextFieldSyntax(args, getDefinition, symbolTable); - } + if (hash) { + keys = hash[0]; + values = hash[1]; + typeIndex = keys.indexOf('type'); + valueIndex = keys.indexOf('value'); + } + + if (!params) { + params = []; + } + + if (typeIndex > -1) { + var typeArg = values[typeIndex]; + if (!Array.isArray(typeArg)) { + if (typeArg === 'checkbox') { + _emberDebug.assert('{{input type=\'checkbox\'}} does not support setting `value=someBooleanValue`; ' + 'you must use `checked=someBooleanValue` instead.', valueIndex === -1); + + _emberGlimmerUtilsBindings.wrapComponentClassAttribute(hash); + + var definition = builder.env.getComponentDefinition(['-checkbox'], builder.symbolTable); + builder.component.static(definition, [params, hash, null, null], builder.symbolTable); + return true; + } else { + return buildTextFieldSyntax(params, hash, builder); } - } else { - return buildTextFieldSyntax(args, getDefinition, symbolTable); } - - return _emberGlimmerSyntaxDynamicComponent.DynamicComponentSyntax.create(environment, args, symbolTable); + } else { + return buildTextFieldSyntax(params, hash, builder); } - }; - exports.InputSyntax = InputSyntax; + + return _emberGlimmerSyntaxDynamicComponent.dynamicComponentMacro(params, hash, null, null, builder); + } }); -enifed('ember-glimmer/syntax/mount', ['exports', 'glimmer-runtime', 'glimmer-reference', 'ember-metal', 'ember-glimmer/utils/references', 'ember-routing', 'ember-glimmer/syntax/outlet', 'container', 'ember-glimmer/syntax/abstract-manager'], function (exports, _glimmerRuntime, _glimmerReference, _emberMetal, _emberGlimmerUtilsReferences, _emberRouting, _emberGlimmerSyntaxOutlet, _container, _emberGlimmerSyntaxAbstractManager) { +enifed('ember-glimmer/syntax/mount', ['exports', '@glimmer/runtime', '@glimmer/reference', 'ember-debug', 'ember-glimmer/utils/references', 'ember-routing', 'ember-glimmer/syntax/outlet', 'container', 'ember-glimmer/syntax/abstract-manager'], function (exports, _glimmerRuntime, _glimmerReference, _emberDebug, _emberGlimmerUtilsReferences, _emberRouting, _emberGlimmerSyntaxOutlet, _container, _emberGlimmerSyntaxAbstractManager) { /** @module ember @submodule ember-glimmer */ 'use strict'; + exports.mountMacro = mountMacro; + + function dynamicEngineFor(vm, symbolTable) { + var env = vm.env; + var args = vm.getArgs(); + var nameRef = args.positional.at(0); + + return new DynamicEngineReference({ nameRef: nameRef, env: env, symbolTable: symbolTable }); + } + /** The `{{mount}}` helper lets you embed a routeless engine in a template. Mounting an engine will cause an instance to be booted and its `application` template to be rendered. @@ -13534,44 +15450,62 @@ @for Ember.Templates.helpers @category ember-application-engines @public */ - var MountSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(MountSyntax, _StatementSyntax); + function mountMacro(path, params, hash, builder) { + _emberDebug.assert('You can only pass a single argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', params.length === 1 && hash === null); - MountSyntax.create = function create(env, args, symbolTable) { - _emberMetal.assert('You can only pass a single argument to the {{mount}} helper, e.g. {{mount "chat-engine"}}.', args.positional.length === 1 && args.named.length === 0); + _emberDebug.assert('The first argument of {{mount}} must be quoted, e.g. {{mount "chat-engine"}}.', typeof params[0] === 'string'); - _emberMetal.assert('The first argument of {{mount}} must be quoted, e.g. {{mount "chat-engine"}}.', args.positional.at(0).type === 'value' && typeof args.positional.at(0).inner() === 'string'); + var definitionArgs = [params.slice(0, 1), null, null, null]; + var args = [null, null, null, null]; + builder.component.dynamic(definitionArgs, dynamicEngineFor, args, builder.symbolTable); + return true; + } - var name = args.positional.at(0).inner(); + var DynamicEngineReference = (function () { + function DynamicEngineReference(_ref) { + var nameRef = _ref.nameRef; + var env = _ref.env; + var symbolTable = _ref.symbolTable; + var args = _ref.args; + babelHelpers.classCallCheck(this, DynamicEngineReference); - _emberMetal.assert('You used `{{mount \'' + name + '\'}}`, but the engine \'' + name + '\' can not be found.', env.owner.hasRegistration('engine:' + name)); + this.tag = nameRef.tag; + this.nameRef = nameRef; + this.env = env; + this.symbolTable = symbolTable; + this._lastName = undefined; + this._lastDef = undefined; + } - var definition = new MountDefinition(name, env); + DynamicEngineReference.prototype.value = function value() { + var env = /*symbolTable*/this.env; + var nameRef = this.nameRef; - return new MountSyntax(definition, symbolTable); - }; + var nameOrDef = nameRef.value(); - function MountSyntax(definition, symbolTable) { - babelHelpers.classCallCheck(this, MountSyntax); + if (this._lastName === nameOrDef) { + return this._lastDef; + } - _StatementSyntax.call(this); - this.definition = definition; - this.symbolTable = symbolTable; - } + _emberDebug.assert('You used `{{mount \'' + nameOrDef + '\'}}`, but the engine \'' + nameOrDef + '\' can not be found.', env.owner.hasRegistration('engine:' + nameOrDef)); - MountSyntax.prototype.compile = function compile(builder) { - builder.component.static(this.definition, _glimmerRuntime.ArgsSyntax.empty(), null, this.symbolTable, null); - }; + if (!env.owner.hasRegistration('engine:' + nameOrDef)) { + return null; + } - return MountSyntax; - })(_glimmerRuntime.StatementSyntax); + this._lastName = nameOrDef; + this._lastDef = new MountDefinition(nameOrDef); - exports.MountSyntax = MountSyntax; + return this._lastDef; + }; + return DynamicEngineReference; + })(); + var MountManager = (function (_AbstractManager) { babelHelpers.inherits(MountManager, _AbstractManager); function MountManager() { babelHelpers.classCallCheck(this, MountManager); @@ -13581,60 +15515,53 @@ MountManager.prototype.prepareArgs = function prepareArgs(definition, args) { return args; }; - MountManager.prototype.create = function create(environment, _ref, args, dynamicScope) { - var name = _ref.name; - var env = _ref.env; + MountManager.prototype.create = function create(environment, _ref2, args, dynamicScope) { + var name = _ref2.name; var _this = this; - _emberMetal.runInDebug(function () { - return _this._pushEngineToDebugStack('engine:' + name, env); + _emberDebug.runInDebug(function () { + return _this._pushEngineToDebugStack('engine:' + name, environment); }); dynamicScope.outletState = _glimmerReference.UNDEFINED_REFERENCE; - var engine = env.owner.buildChildEngineInstance(name); + var engine = environment.owner.buildChildEngineInstance(name); engine.boot(); - return { engine: engine }; + return engine; }; - MountManager.prototype.layoutFor = function layoutFor(definition, _ref2, env) { - var engine = _ref2.engine; - + MountManager.prototype.layoutFor = function layoutFor(definition, engine, env) { var template = engine.lookup('template:application'); return env.getCompiledBlock(_emberGlimmerSyntaxOutlet.OutletLayoutCompiler, template); }; - MountManager.prototype.getSelf = function getSelf(_ref3) { - var engine = _ref3.engine; - + MountManager.prototype.getSelf = function getSelf(engine) { var applicationFactory = engine[_container.FACTORY_FOR]('controller:application'); var factory = applicationFactory || _emberRouting.generateControllerFactory(engine, 'application'); return new _emberGlimmerUtilsReferences.RootReference(factory.create()); }; MountManager.prototype.getTag = function getTag() { return null; }; - MountManager.prototype.getDestructor = function getDestructor(_ref4) { - var engine = _ref4.engine; - + MountManager.prototype.getDestructor = function getDestructor(engine) { return engine; }; MountManager.prototype.didCreateElement = function didCreateElement() {}; MountManager.prototype.didRenderLayout = function didRenderLayout() { var _this2 = this; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this2.debugStack.pop(); }); }; MountManager.prototype.didCreate = function didCreate(state) {}; @@ -13651,27 +15578,28 @@ var MOUNT_MANAGER = new MountManager(); var MountDefinition = (function (_ComponentDefinition) { babelHelpers.inherits(MountDefinition, _ComponentDefinition); - function MountDefinition(name, env) { + function MountDefinition(name) { babelHelpers.classCallCheck(this, MountDefinition); _ComponentDefinition.call(this, name, MOUNT_MANAGER, null); - this.env = env; } return MountDefinition; })(_glimmerRuntime.ComponentDefinition); }); -enifed('ember-glimmer/syntax/outlet', ['exports', 'ember-utils', 'glimmer-runtime', 'ember-metal', 'ember-glimmer/utils/references', 'glimmer-reference', 'ember-glimmer/syntax/abstract-manager'], function (exports, _emberUtils, _glimmerRuntime, _emberMetal, _emberGlimmerUtilsReferences, _glimmerReference, _emberGlimmerSyntaxAbstractManager) { +enifed('ember-glimmer/syntax/outlet', ['exports', 'ember-utils', '@glimmer/runtime', 'ember-debug', 'ember-metal', 'ember-glimmer/utils/references', 'ember-glimmer/syntax/abstract-manager', '@glimmer/reference'], function (exports, _emberUtils, _glimmerRuntime, _emberDebug, _emberMetal, _emberGlimmerUtilsReferences, _emberGlimmerSyntaxAbstractManager, _glimmerReference) { /** @module ember @submodule ember-glimmer */ 'use strict'; + exports.outletMacro = outletMacro; + function outletComponentFor(vm) { var _vm$dynamicScope = vm.dynamicScope(); var outletState = _vm$dynamicScope.outletState; @@ -13734,38 +15662,19 @@ @param {String} [name] @for Ember.Templates.helpers @public */ - var OutletSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(OutletSyntax, _StatementSyntax); - - OutletSyntax.create = function create(environment, args, symbolTable) { - var definitionArgs = _glimmerRuntime.ArgsSyntax.fromPositionalArgs(args.positional.slice(0, 1)); - return new this(environment, definitionArgs, symbolTable); - }; - - function OutletSyntax(environment, args, symbolTable) { - babelHelpers.classCallCheck(this, OutletSyntax); - - _StatementSyntax.call(this); - this.definitionArgs = args; - this.definition = outletComponentFor; - this.args = _glimmerRuntime.ArgsSyntax.empty(); - this.symbolTable = symbolTable; - this.shadow = null; + function outletMacro(path, params, hash, builder) { + if (!params) { + params = []; } + var definitionArgs = [params.slice(0, 1), null, null, null]; + builder.component.dynamic(definitionArgs, outletComponentFor, _glimmerRuntime.CompiledArgs.empty(), builder.symbolTable, null); + return true; + } - OutletSyntax.prototype.compile = function compile(builder) { - builder.component.dynamic(this.definitionArgs, this.definition, this.args, this.symbolTable, this.shadow); - }; - - return OutletSyntax; - })(_glimmerRuntime.StatementSyntax); - - exports.OutletSyntax = OutletSyntax; - var OutletComponentReference = (function () { function OutletComponentReference(outletNameRef, parentOutletStateRef) { babelHelpers.classCallCheck(this, OutletComponentReference); this.outletNameRef = outletNameRef; @@ -13866,11 +15775,11 @@ }; OutletComponentManager.prototype.create = function create(environment, definition, args, dynamicScope) { var _this = this; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this._pushToDebugStack('template:' + definition.template.meta.moduleName, environment); }); var outletStateReference = dynamicScope.outletState = dynamicScope.outletState.get('outlets').get(definition.outletName); var outletState = outletStateReference.value(); @@ -13898,11 +15807,11 @@ OutletComponentManager.prototype.didRenderLayout = function didRenderLayout(bucket) { var _this2 = this; bucket.finalize(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this2.debugStack.pop(); }); }; OutletComponentManager.prototype.didCreateElement = function didCreateElement() {}; @@ -13930,11 +15839,11 @@ } TopLevelOutletComponentManager.prototype.create = function create(environment, definition, args, dynamicScope) { var _this3 = this; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this3._pushToDebugStack('template:' + definition.template.meta.moduleName, environment); }); return new StateBucket(dynamicScope.outletState.value()); }; @@ -14014,41 +15923,43 @@ exports.OutletLayoutCompiler = OutletLayoutCompiler; OutletLayoutCompiler.id = 'outlet'; }); -enifed('ember-glimmer/syntax/render', ['exports', 'glimmer-runtime', 'glimmer-reference', 'ember-metal', 'ember-glimmer/utils/references', 'ember-routing', 'ember-glimmer/syntax/outlet', 'container', 'ember-glimmer/syntax/abstract-manager'], function (exports, _glimmerRuntime, _glimmerReference, _emberMetal, _emberGlimmerUtilsReferences, _emberRouting, _emberGlimmerSyntaxOutlet, _container, _emberGlimmerSyntaxAbstractManager) { +enifed('ember-glimmer/syntax/render', ['exports', '@glimmer/runtime', '@glimmer/reference', 'ember-debug', 'ember-glimmer/utils/references', 'ember-routing', 'ember-glimmer/syntax/outlet', 'container', 'ember-glimmer/syntax/abstract-manager'], function (exports, _glimmerRuntime, _glimmerReference, _emberDebug, _emberGlimmerUtilsReferences, _emberRouting, _emberGlimmerSyntaxOutlet, _container, _emberGlimmerSyntaxAbstractManager) { /** @module ember @submodule ember-glimmer */ 'use strict'; + exports.renderMacro = renderMacro; + function makeComponentDefinition(vm) { var env = vm.env; var args = vm.getArgs(); var nameRef = args.positional.at(0); - _emberMetal.assert('The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.', _glimmerReference.isConst(nameRef)); - _emberMetal.assert('The second argument of {{render}} must be a path, e.g. {{render "post" post}}.', args.positional.length === 1 || !_glimmerReference.isConst(args.positional.at(1))); + _emberDebug.assert('The first argument of {{render}} must be quoted, e.g. {{render "sidebar"}}.', _glimmerReference.isConst(nameRef)); + _emberDebug.assert('The second argument of {{render}} must be a path, e.g. {{render "post" post}}.', args.positional.length === 1 || !_glimmerReference.isConst(args.positional.at(1))); var templateName = nameRef.value(); - _emberMetal.assert('You used `{{render \'' + templateName + '\'}}`, but \'' + templateName + '\' can not be found as a template.', env.owner.hasRegistration('template:' + templateName)); + _emberDebug.assert('You used `{{render \'' + templateName + '\'}}`, but \'' + templateName + '\' can not be found as a template.', env.owner.hasRegistration('template:' + templateName)); var template = env.owner.lookup('template:' + templateName); var controllerName = undefined; if (args.named.has('controller')) { var controllerNameRef = args.named.get('controller'); - _emberMetal.assert('The controller argument for {{render}} must be quoted, e.g. {{render "sidebar" controller="foo"}}.', _glimmerReference.isConst(controllerNameRef)); + _emberDebug.assert('The controller argument for {{render}} must be quoted, e.g. {{render "sidebar" controller="foo"}}.', _glimmerReference.isConst(controllerNameRef)); controllerName = controllerNameRef.value(); - _emberMetal.assert('The controller name you supplied \'' + controllerName + '\' did not resolve to a controller.', env.owner.hasRegistration('controller:' + controllerName)); + _emberDebug.assert('The controller name you supplied \'' + controllerName + '\' did not resolve to a controller.', env.owner.hasRegistration('controller:' + controllerName)); } else { controllerName = templateName; } if (args.positional.length === 1) { @@ -14126,37 +16037,20 @@ @param {Hash} options @return {String} HTML string @public */ - var RenderSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(RenderSyntax, _StatementSyntax); - - RenderSyntax.create = function create(environment, args, symbolTable) { - return new this(environment, args, symbolTable); - }; - - function RenderSyntax(environment, args, symbolTable) { - babelHelpers.classCallCheck(this, RenderSyntax); - - _StatementSyntax.call(this); - this.definitionArgs = args; - this.definition = makeComponentDefinition; - this.args = _glimmerRuntime.ArgsSyntax.fromPositionalArgs(args.positional.slice(1, 2)); - this.symbolTable = symbolTable; - this.shadow = null; + function renderMacro(path, params, hash, builder) { + if (!params) { + params = []; } + var definitionArgs = [params.slice(0), hash, null, null]; + var args = [params.slice(1), hash, null, null]; + builder.component.dynamic(definitionArgs, makeComponentDefinition, args, builder.symbolTable); + return true; + } - RenderSyntax.prototype.compile = function compile(builder) { - builder.component.dynamic(this.definitionArgs, this.definition, this.args, this.symbolTable, this.shadow); - }; - - return RenderSyntax; - })(_glimmerRuntime.StatementSyntax); - - exports.RenderSyntax = RenderSyntax; - var AbstractRenderManager = (function (_AbstractManager) { babelHelpers.inherits(AbstractRenderManager, _AbstractManager); function AbstractRenderManager() { babelHelpers.classCallCheck(this, AbstractRenderManager); @@ -14201,11 +16095,11 @@ AbstractRenderManager.prototype.didUpdate = function didUpdate() {}; return AbstractRenderManager; })(_emberGlimmerSyntaxAbstractManager.default); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { AbstractRenderManager.prototype.didRenderLayout = function () { this.debugStack.pop(); }; }); @@ -14224,11 +16118,11 @@ var name = definition.name; var env = definition.env; var controller = env.owner.lookup('controller:' + name) || _emberRouting.generateController(env.owner, name); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this._pushToDebugStack('controller:' + name + ' (with the render helper)', environment); }); if (dynamicScope.rootOutletState) { dynamicScope.outletState = dynamicScope.rootOutletState.getOrphan(name); @@ -14261,11 +16155,11 @@ var controllerFactory = env.owner[_container.FACTORY_FOR]('controller:' + name); var factory = controllerFactory || _emberRouting.generateControllerFactory(env.owner, name); var controller = factory.create({ model: modelRef.value() }); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { return _this2._pushToDebugStack('controller:' + name + ' (with the render helper)', environment); }); if (dynamicScope.rootOutletState) { dynamicScope.outletState = dynamicScope.rootOutletState.getOrphan(name); @@ -14305,11 +16199,11 @@ } return RenderDefinition; })(_glimmerRuntime.ComponentDefinition); }); -enifed('ember-glimmer/template', ['exports', 'ember-utils', 'glimmer-runtime'], function (exports, _emberUtils, _glimmerRuntime) { +enifed('ember-glimmer/template', ['exports', 'ember-utils', '@glimmer/runtime'], function (exports, _emberUtils, _glimmerRuntime) { 'use strict'; exports.default = template; function template(json) { @@ -14360,33 +16254,33 @@ } }); enifed("ember-glimmer/templates/component", ["exports", "ember-glimmer/template"], function (exports, _emberGlimmerTemplate) { "use strict"; - exports.default = _emberGlimmerTemplate.default({ "id": "ZoGfVsSJ", "block": "{\"statements\":[[\"yield\",\"default\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/component.hbs" } }); + exports.default = _emberGlimmerTemplate.default({ "id": "n+3mKSnB", "block": "{\"statements\":[[18,\"default\"]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/component.hbs" } }); }); enifed("ember-glimmer/templates/empty", ["exports", "ember-glimmer/template"], function (exports, _emberGlimmerTemplate) { "use strict"; - exports.default = _emberGlimmerTemplate.default({ "id": "qEHL4OLi", "block": "{\"statements\":[],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/empty.hbs" } }); + exports.default = _emberGlimmerTemplate.default({ "id": "5QJJjniM", "block": "{\"statements\":[],\"locals\":[],\"named\":[],\"yields\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/empty.hbs" } }); }); enifed("ember-glimmer/templates/link-to", ["exports", "ember-glimmer/template"], function (exports, _emberGlimmerTemplate) { "use strict"; - exports.default = _emberGlimmerTemplate.default({ "id": "Ca7iQMR7", "block": "{\"statements\":[[\"block\",[\"if\"],[[\"get\",[\"linkTitle\"]]],null,1,0]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"blocks\":[{\"statements\":[[\"yield\",\"default\"]],\"locals\":[]},{\"statements\":[[\"append\",[\"unknown\",[\"linkTitle\"]],false]],\"locals\":[]}],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/link-to.hbs" } }); + exports.default = _emberGlimmerTemplate.default({ "id": "YUwHICAk", "block": "{\"statements\":[[6,[\"if\"],[[28,[\"linkTitle\"]]],null,{\"statements\":[[1,[26,[\"linkTitle\"]],false]],\"locals\":[]},{\"statements\":[[18,\"default\"]],\"locals\":[]}]],\"locals\":[],\"named\":[],\"yields\":[\"default\"],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/link-to.hbs" } }); }); enifed("ember-glimmer/templates/outlet", ["exports", "ember-glimmer/template"], function (exports, _emberGlimmerTemplate) { "use strict"; - exports.default = _emberGlimmerTemplate.default({ "id": "sYQo9vi/", "block": "{\"statements\":[[\"append\",[\"unknown\",[\"outlet\"]],false]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/outlet.hbs" } }); + exports.default = _emberGlimmerTemplate.default({ "id": "bVP1WVLR", "block": "{\"statements\":[[1,[26,[\"outlet\"]],false]],\"locals\":[],\"named\":[],\"yields\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/outlet.hbs" } }); }); enifed("ember-glimmer/templates/root", ["exports", "ember-glimmer/template"], function (exports, _emberGlimmerTemplate) { "use strict"; - exports.default = _emberGlimmerTemplate.default({ "id": "Eaf3RPY3", "block": "{\"statements\":[[\"append\",[\"helper\",[\"component\"],[[\"get\",[null]]],null],false]],\"locals\":[],\"named\":[],\"yields\":[],\"blocks\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/root.hbs" } }); + exports.default = _emberGlimmerTemplate.default({ "id": "Cjk2vS10", "block": "{\"statements\":[[1,[33,[\"component\"],[[28,[null]]],null],false]],\"locals\":[],\"named\":[],\"yields\":[],\"hasPartials\":false}", "meta": { "moduleName": "ember-glimmer/templates/root.hbs" } }); }); -enifed('ember-glimmer/utils/bindings', ['exports', 'glimmer-reference', 'glimmer-runtime', 'ember-metal', 'ember-runtime', 'ember-glimmer/component', 'ember-glimmer/utils/string'], function (exports, _glimmerReference, _glimmerRuntime, _emberMetal, _emberRuntime, _emberGlimmerComponent, _emberGlimmerUtilsString) { +enifed('ember-glimmer/utils/bindings', ['exports', '@glimmer/reference', '@glimmer/wire-format', 'ember-debug', 'ember-metal', 'ember-runtime', 'ember-glimmer/component', 'ember-glimmer/utils/string'], function (exports, _glimmerReference, _glimmerWireFormat, _emberDebug, _emberMetal, _emberRuntime, _emberGlimmerComponent, _emberGlimmerUtilsString) { 'use strict'; exports.wrapComponentClassAttribute = wrapComponentClassAttribute; function referenceForKey(component, key) { @@ -14408,41 +16302,47 @@ return _glimmerReference.referenceFromParts(component[_emberGlimmerComponent.ROOT_REF], parts); } // TODO we should probably do this transform at build time - function wrapComponentClassAttribute(args) { - var named = args.named; + function wrapComponentClassAttribute(hash) { + if (!hash) { + return hash; + } - var index = named.keys.indexOf('class'); + var keys = hash[0]; + var values = hash[1]; + var index = keys.indexOf('class'); + if (index !== -1) { - var _named$values$index = named.values[index]; - var ref = _named$values$index.ref; - var type = _named$values$index.type; + var _values$index = values[index]; + var type = _values$index[0]; - if (type === 'get') { - var propName = ref.parts[ref.parts.length - 1]; - named.values[index] = _glimmerRuntime.HelperSyntax.fromSpec(['helper', ['-class'], [['get', ref.parts], propName], null]); + if (type === _glimmerWireFormat.Ops.Get) { + var getExp = values[index]; + var path = getExp[1]; + var propName = path[path.length - 1]; + hash[1][index] = [_glimmerWireFormat.Ops.Helper, ['-class'], [getExp, propName]]; } } - return args; + return hash; } var AttributeBinding = { parse: function (microsyntax) { var colonIndex = microsyntax.indexOf(':'); if (colonIndex === -1) { - _emberMetal.assert('You cannot use class as an attributeBinding, use classNameBindings instead.', microsyntax !== 'class'); + _emberDebug.assert('You cannot use class as an attributeBinding, use classNameBindings instead.', microsyntax !== 'class'); return [microsyntax, microsyntax, true]; } else { var prop = microsyntax.substring(0, colonIndex); var attribute = microsyntax.substring(colonIndex + 1); - _emberMetal.assert('You cannot use class as an attributeBinding, use classNameBindings instead.', attribute !== 'class'); + _emberDebug.assert('You cannot use class as an attributeBinding, use classNameBindings instead.', attribute !== 'class'); return [prop, attribute, false]; } }, @@ -14461,11 +16361,11 @@ } var isPath = prop.indexOf('.') > -1; var reference = isPath ? referenceForParts(component, prop.split('.')) : referenceForKey(component, prop); - _emberMetal.assert('Illegal attributeBinding: \'' + prop + '\' is not a valid attribute name.', !(isSimple && isPath)); + _emberDebug.assert('Illegal attributeBinding: \'' + prop + '\' is not a valid attribute name.', !(isSimple && isPath)); if (attribute === 'style') { reference = new StyleBindingReference(reference, referenceForKey(component, 'isVisible')); } @@ -14604,16 +16504,16 @@ }; return ColonClassNameBindingReference; })(_glimmerReference.CachedReference); }); -enifed('ember-glimmer/utils/debug-stack', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-glimmer/utils/debug-stack', ['exports', 'ember-debug'], function (exports, _emberDebug) { 'use strict'; var DebugStack = undefined; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { var Element = function Element(name) { babelHelpers.classCallCheck(this, Element); this.name = name; }; @@ -14697,11 +16597,11 @@ })(); }); exports.default = DebugStack; }); -enifed('ember-glimmer/utils/iterable', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-glimmer/utils/references', 'ember-glimmer/helpers/each-in', 'glimmer-reference'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberGlimmerUtilsReferences, _emberGlimmerHelpersEachIn, _glimmerReference) { +enifed('ember-glimmer/utils/iterable', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-glimmer/utils/references', 'ember-glimmer/helpers/each-in', '@glimmer/reference'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberGlimmerUtilsReferences, _emberGlimmerHelpersEachIn, _glimmerReference) { 'use strict'; exports.default = iterableFor; var ITERATOR_KEY_GUID = 'be277757-bbbe-4620-9fcb-213ef433cca2'; @@ -15026,11 +16926,11 @@ }; return ArrayIterable; })(); }); -enifed('ember-glimmer/utils/process-args', ['exports', 'ember-utils', 'glimmer-reference', 'ember-glimmer/component', 'ember-glimmer/utils/references', 'ember-views', 'ember-glimmer/helpers/action', 'glimmer-runtime'], function (exports, _emberUtils, _glimmerReference, _emberGlimmerComponent, _emberGlimmerUtilsReferences, _emberViews, _emberGlimmerHelpersAction, _glimmerRuntime) { +enifed('ember-glimmer/utils/process-args', ['exports', 'ember-utils', '@glimmer/reference', 'ember-glimmer/component', 'ember-glimmer/utils/references', 'ember-views', 'ember-glimmer/helpers/action', '@glimmer/runtime'], function (exports, _emberUtils, _glimmerReference, _emberGlimmerComponent, _emberGlimmerUtilsReferences, _emberViews, _emberGlimmerHelpersAction, _glimmerRuntime) { 'use strict'; exports.gatherArgs = gatherArgs; // Maps all variants of positional and dynamically scoped arguments @@ -15174,11 +17074,11 @@ }; return MutableCell; })(); }); -enifed('ember-glimmer/utils/references', ['exports', 'ember-utils', 'ember-metal', 'glimmer-reference', 'glimmer-runtime', 'ember-glimmer/utils/to-bool', 'ember-glimmer/helper'], function (exports, _emberUtils, _emberMetal, _glimmerReference, _glimmerRuntime, _emberGlimmerUtilsToBool, _emberGlimmerHelper) { +enifed('ember-glimmer/utils/references', ['exports', 'ember-utils', 'ember-metal', '@glimmer/reference', '@glimmer/runtime', 'ember-glimmer/utils/to-bool', 'ember-glimmer/helper', 'ember-debug'], function (exports, _emberUtils, _emberMetal, _glimmerReference, _glimmerRuntime, _emberGlimmerUtilsToBool, _emberGlimmerHelper, _emberDebug) { 'use strict'; var UPDATE = _emberUtils.symbol('UPDATE'); exports.UPDATE = UPDATE; @@ -15529,11 +17429,11 @@ var named = args.named; var positionalValue = positional.value(); var namedValue = named.value(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { if (_emberUtils.HAS_NATIVE_WEAKMAP) { Object.freeze(positionalValue); Object.freeze(namedValue); } }); @@ -15582,11 +17482,11 @@ var named = _args.named; var positionalValue = positional.value(); var namedValue = named.value(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { if (_emberUtils.HAS_NATIVE_WEAKMAP) { Object.freeze(positionalValue); Object.freeze(namedValue); } }); @@ -15625,11 +17525,11 @@ var named = _args2.named; var positionalValue = positional.value(); var namedValue = named.value(); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { if (_emberUtils.HAS_NATIVE_WEAKMAP) { Object.freeze(positionalValue); Object.freeze(namedValue); } }); @@ -15697,11 +17597,11 @@ return UnboundReference; })(_glimmerReference.ConstReference); exports.UnboundReference = UnboundReference; }); -enifed('ember-glimmer/utils/string', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-glimmer/utils/string', ['exports', 'ember-debug'], function (exports, _emberDebug) { /** @module ember @submodule ember-glimmer */ @@ -15731,11 +17631,11 @@ })(); exports.SafeString = SafeString; function getSafeString() { - _emberMetal.deprecate('Ember.Handlebars.SafeString is deprecated in favor of Ember.String.htmlSafe', false, { + _emberDebug.deprecate('Ember.Handlebars.SafeString is deprecated in favor of Ember.String.htmlSafe', false, { id: 'ember-htmlbars.ember-handlebars-safestring', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_use-ember-string-htmlsafe-over-ember-handlebars-safestring' }); @@ -15850,11 +17750,11 @@ } return true; } }); -enifed('ember-glimmer/views/outlet', ['exports', 'ember-utils', 'glimmer-reference', 'ember-environment', 'ember-metal'], function (exports, _emberUtils, _glimmerReference, _emberEnvironment, _emberMetal) { +enifed('ember-glimmer/views/outlet', ['exports', 'ember-utils', '@glimmer/reference', 'ember-environment', 'ember-metal'], function (exports, _emberUtils, _glimmerReference, _emberEnvironment, _emberMetal) { /** @module ember @submodule ember-glimmer */ 'use strict'; @@ -16034,11 +17934,11 @@ return OutletView; })(); exports.default = OutletView; }); -enifed('ember-metal/alias', ['exports', 'ember-utils', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/meta', 'ember-metal/dependent_keys'], function (exports, _emberUtils, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalError, _emberMetalProperties, _emberMetalComputed, _emberMetalMeta, _emberMetalDependent_keys) { +enifed('ember-metal/alias', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/meta', 'ember-metal/dependent_keys'], function (exports, _emberUtils, _emberDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalProperties, _emberMetalComputed, _emberMetalMeta, _emberMetalDependent_keys) { 'use strict'; exports.default = alias; var CONSUMED = {}; @@ -16058,11 +17958,11 @@ this.altKey = altKey; this._dependentKeys = [altKey]; } AliasedProperty.prototype.setup = function setup(obj, keyName) { - _emberMetalDebug.assert('Setting alias \'' + keyName + '\' on self', this.altKey !== keyName); + _emberDebug.assert('Setting alias \'' + keyName + '\' on self', this.altKey !== keyName); var meta = _emberMetalMeta.meta(obj); if (meta.peekWatching(keyName)) { _emberMetalDependent_keys.addDependentKeys(this, obj, keyName, meta); } }; @@ -16111,11 +18011,11 @@ })(_emberMetalProperties.Descriptor); exports.AliasedProperty = AliasedProperty; function AliasedProperty_readOnlySet(obj, keyName, value) { - throw new _emberMetalError.default('Cannot set read-only property \'' + keyName + '\' on object: ' + _emberUtils.inspect(obj)); + throw new _emberDebug.Error('Cannot set read-only property \'' + keyName + '\' on object: ' + _emberUtils.inspect(obj)); } function AliasedProperty_oneWaySet(obj, keyName, value) { _emberMetalProperties.defineProperty(obj, keyName, null); return _emberMetalProperty_set.set(obj, keyName, value); @@ -16123,11 +18023,11 @@ // Backwards compatibility with Ember Data. AliasedProperty.prototype._meta = undefined; AliasedProperty.prototype.meta = _emberMetalComputed.ComputedProperty.prototype.meta; }); -enifed('ember-metal/binding', ['exports', 'ember-utils', 'ember-console', 'ember-environment', 'ember-metal/run_loop', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/events', 'ember-metal/observer', 'ember-metal/path_cache'], function (exports, _emberUtils, _emberConsole, _emberEnvironment, _emberMetalRun_loop, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEvents, _emberMetalObserver, _emberMetalPath_cache) { +enifed('ember-metal/binding', ['exports', 'ember-utils', 'ember-console', 'ember-environment', 'ember-metal/run_loop', 'ember-debug', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/events', 'ember-metal/observer', 'ember-metal/path_cache'], function (exports, _emberUtils, _emberConsole, _emberEnvironment, _emberMetalRun_loop, _emberDebug, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalEvents, _emberMetalObserver, _emberMetalPath_cache) { 'use strict'; exports.bind = bind; /** @@ -16257,11 +18157,11 @@ @return {Ember.Binding} `this` @public */ Binding.prototype.connect = function connect(obj) { - _emberMetalDebug.assert('Must pass a valid object to Ember.Binding.connect()', !!obj); + _emberDebug.assert('Must pass a valid object to Ember.Binding.connect()', !!obj); var fromObj = undefined, fromPath = undefined, possibleGlobal = undefined; @@ -16311,11 +18211,11 @@ @return {Ember.Binding} `this` @public */ Binding.prototype.disconnect = function disconnect() { - _emberMetalDebug.assert('Must pass a valid object to Ember.Binding.disconnect()', !!this._toObj); + _emberDebug.assert('Must pass a valid object to Ember.Binding.disconnect()', !!this._toObj); // Remove an observer on the object so we're no longer notified of // changes that should update bindings. _emberMetalObserver.removeObserver(this._fromObj, this._fromPath, this, 'fromDidChange'); @@ -16417,21 +18317,21 @@ var deprecateGlobalMessage = '`Ember.Binding` is deprecated. Since you' + ' are binding to a global consider using a service instead.'; var deprecateOneWayMessage = '`Ember.Binding` is deprecated. Since you' + ' are using a `oneWay` binding consider using a `readOnly` computed' + ' property instead.'; var deprecateAliasMessage = '`Ember.Binding` is deprecated. Consider' + ' using an `alias` computed property instead.'; var objectInfo = 'The `' + toPath + '` property of `' + obj + '` is an `Ember.Binding` connected to `' + fromPath + '`, but '; - _emberMetalDebug.deprecate(objectInfo + deprecateGlobalMessage, !deprecateGlobal, { + _emberDebug.deprecate(objectInfo + deprecateGlobalMessage, !deprecateGlobal, { id: 'ember-metal.binding', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_ember-binding' }); - _emberMetalDebug.deprecate(objectInfo + deprecateOneWayMessage, !deprecateOneWay, { + _emberDebug.deprecate(objectInfo + deprecateOneWayMessage, !deprecateOneWay, { id: 'ember-metal.binding', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_ember-binding' }); - _emberMetalDebug.deprecate(objectInfo + deprecateAliasMessage, !deprecateAlias, { + _emberDebug.deprecate(objectInfo + deprecateAliasMessage, !deprecateAlias, { id: 'ember-metal.binding', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_ember-binding' }); } @@ -17082,11 +18982,11 @@ } exports.removeChainWatcher = removeChainWatcher; exports.ChainNode = ChainNode; }); -enifed('ember-metal/computed', ['exports', 'ember-utils', 'ember-metal/debug', 'ember-metal/property_set', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/error', 'ember-metal/properties', 'ember-metal/property_events', 'ember-metal/dependent_keys'], function (exports, _emberUtils, _emberMetalDebug, _emberMetalProperty_set, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalError, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) { +enifed('ember-metal/computed', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/property_set', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/properties', 'ember-metal/property_events', 'ember-metal/dependent_keys'], function (exports, _emberUtils, _emberDebug, _emberMetalProperty_set, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalProperties, _emberMetalProperty_events, _emberMetalDependent_keys) { 'use strict'; exports.default = computed; /** @@ -17203,12 +19103,12 @@ function ComputedProperty(config, opts) { this.isDescriptor = true; if (typeof config === 'function') { this._getter = config; } else { - _emberMetalDebug.assert('Ember.computed expects a function or an object as last argument.', typeof config === 'object' && !Array.isArray(config)); - _emberMetalDebug.assert('Config object passed to an Ember.computed can only contain `get` or `set` keys.', (function () { + _emberDebug.assert('Ember.computed expects a function or an object as last argument.', typeof config === 'object' && !Array.isArray(config)); + _emberDebug.assert('Config object passed to an Ember.computed can only contain `get` or `set` keys.', (function () { var keys = Object.keys(config); for (var i = 0; i < keys.length; i++) { if (keys[i] !== 'get' && keys[i] !== 'set') { return false; } @@ -17216,11 +19116,11 @@ return true; })()); this._getter = config.get; this._setter = config.set; } - _emberMetalDebug.assert('Computed properties must receive a getter or a setter, you passed none.', !!this._getter || !!this._setter); + _emberDebug.assert('Computed properties must receive a getter or a setter, you passed none.', !!this._getter || !!this._setter); this._dependentKeys = undefined; this._suspended = undefined; this._meta = undefined; this._volatile = false; this._dependentKeys = opts && opts.dependentKeys; @@ -17281,11 +19181,11 @@ @chainable @public */ ComputedPropertyPrototype.readOnly = function () { this._readOnly = true; - _emberMetalDebug.assert('Computed properties that define a setter using the new syntax cannot be read-only', !(this._readOnly && this._setter && this._setter !== this._getter)); + _emberDebug.assert('Computed properties that define a setter using the new syntax cannot be read-only', !(this._readOnly && this._setter && this._setter !== this._getter)); return this; }; /** Sets the dependent keys on this computed property. Pass any number of @@ -17317,11 +19217,11 @@ */ ComputedPropertyPrototype.property = function () { var args = []; function addArg(property) { - _emberMetalDebug.warn('Dependent keys containing @each only work one level deep. ' + ('You used the key "' + property + '" which is invalid. ') + 'Please create an intermediary computed property.', DEEP_EACH_REGEX.test(property) === false, { id: 'ember-metal.computed-deep-each' }); + _emberDebug.warn('Dependent keys containing @each only work one level deep. ' + ('You used the key "' + property + '" which is invalid. ') + 'Please create an intermediary computed property.', DEEP_EACH_REGEX.test(property) === false, { id: 'ember-metal.computed-deep-each' }); args.push(property); } for (var i = 0; i < arguments.length; i++) { _emberMetalExpand_properties.default(arguments[i], addArg); @@ -17432,11 +19332,11 @@ return this.setWithSuspend(obj, keyName, value); }; ComputedPropertyPrototype._throwReadOnlyError = function computedPropertyThrowReadOnlyError(obj, keyName) { - throw new _emberMetalError.default('Cannot set read-only property "' + keyName + '" on object: ' + _emberUtils.inspect(obj)); + throw new _emberDebug.Error('Cannot set read-only property "' + keyName + '" on object: ' + _emberUtils.inspect(obj)); }; ComputedPropertyPrototype.clobberSet = function computedPropertyClobberSet(obj, keyName, value) { var cachedValue = cacheFor(obj, keyName); _emberMetalProperties.defineProperty(obj, keyName, null, cachedValue); @@ -17700,92 +19600,12 @@ // BOOTSTRAP // exports.default = Ember; }); -enifed("ember-metal/debug", ["exports"], function (exports) { - "use strict"; - - exports.getDebugFunction = getDebugFunction; - exports.setDebugFunction = setDebugFunction; - exports.assert = assert; - exports.info = info; - exports.warn = warn; - exports.debug = debug; - exports.deprecate = deprecate; - exports.deprecateFunc = deprecateFunc; - exports.runInDebug = runInDebug; - exports.debugSeal = debugSeal; - exports.debugFreeze = debugFreeze; - var debugFunctions = { - assert: function () {}, - info: function () {}, - warn: function () {}, - debug: function () {}, - deprecate: function () {}, - deprecateFunc: function () { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return args[args.length - 1]; - }, - runInDebug: function () {}, - debugSeal: function () {}, - debugFreeze: function () {} - }; - - exports.debugFunctions = debugFunctions; - - function getDebugFunction(name) { - return debugFunctions[name]; - } - - function setDebugFunction(name, fn) { - debugFunctions[name] = fn; - } - - function assert() { - return debugFunctions.assert.apply(undefined, arguments); - } - - function info() { - return debugFunctions.info.apply(undefined, arguments); - } - - function warn() { - return debugFunctions.warn.apply(undefined, arguments); - } - - function debug() { - return debugFunctions.debug.apply(undefined, arguments); - } - - function deprecate() { - return debugFunctions.deprecate.apply(undefined, arguments); - } - - function deprecateFunc() { - return debugFunctions.deprecateFunc.apply(undefined, arguments); - } - - function runInDebug() { - return debugFunctions.runInDebug.apply(undefined, arguments); - } - - function debugSeal() { - return debugFunctions.debugSeal.apply(undefined, arguments); - } - - function debugFreeze() { - return debugFunctions.debugFreeze.apply(undefined, arguments); - } -}); enifed('ember-metal/dependent_keys', ['exports', 'ember-metal/watching'], function (exports, _emberMetalWatching) { - 'no use strict'; - // Remove "use strict"; from transpiled module until - // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed + 'use strict'; exports.addDependentKeys = addDependentKeys; exports.removeDependentKeys = removeDependentKeys; /** @@ -17831,11 +19651,11 @@ // Unwatch the depKey _emberMetalWatching.unwatch(obj, depKey, meta); } } }); -enifed('ember-metal/deprecate_property', ['exports', 'ember-metal/debug', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberMetalDebug, _emberMetalProperty_get, _emberMetalProperty_set) { +enifed('ember-metal/deprecate_property', ['exports', 'ember-debug', 'ember-metal/property_get', 'ember-metal/property_set'], function (exports, _emberDebug, _emberMetalProperty_get, _emberMetalProperty_set) { /** @module ember @submodule ember-metal */ @@ -17855,11 +19675,11 @@ @since 1.7.0 */ function deprecateProperty(object, deprecatedKey, newKey, options) { function _deprecate() { - _emberMetalDebug.deprecate('Usage of `' + deprecatedKey + '` is deprecated, use `' + newKey + '` instead.', false, options); + _emberDebug.deprecate('Usage of `' + deprecatedKey + '` is deprecated, use `' + newKey + '` instead.', false, options); } Object.defineProperty(object, deprecatedKey, { configurable: true, enumerable: false, @@ -17909,58 +19729,11 @@ Descriptor.prototype.teardown = function teardown(obj, key) {}; return Descriptor; })(_emberMetalProperties.Descriptor); }); -enifed("ember-metal/error", ["exports"], function (exports) { - - /** - A subclass of the JavaScript Error object for use in Ember. - - @class Error - @namespace Ember - @extends Error - @constructor - @public - */ - "use strict"; - - var EmberError = (function (_Error) { - babelHelpers.inherits(EmberError, _Error); - - function EmberError(message) { - babelHelpers.classCallCheck(this, EmberError); - - _Error.call(this); - - if (!(this instanceof EmberError)) { - return new EmberError(message); - } - - var error = Error.call(this, message); - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, EmberError); - } else { - this.stack = error.stack; - } - - this.description = error.description; - this.fileName = error.fileName; - this.lineNumber = error.lineNumber; - this.message = error.message; - this.name = error.name; - this.number = error.number; - this.code = error.code; - } - - return EmberError; - })(Error); - - exports.default = EmberError; -}); -enifed('ember-metal/error_handler', ['exports', 'ember-console', 'ember-metal/testing'], function (exports, _emberConsole, _emberMetalTesting) { +enifed('ember-metal/error_handler', ['exports', 'ember-console', 'ember-debug'], function (exports, _emberConsole, _emberDebug) { 'use strict'; exports.getOnerror = getOnerror; exports.setOnerror = setOnerror; exports.dispatchError = dispatchError; @@ -17970,11 +19743,11 @@ // To maintain stacktrace consistency across browsers var getStack = function (error) { var stack = error.stack; var message = error.message; - if (stack && stack.indexOf(message) === -1) { + if (stack && !stack.includes(message)) { stack = message + '\n' + stack; } return stack; }; @@ -18012,29 +19785,27 @@ function setDispatchOverride(handler) { dispatchOverride = handler; } function defaultDispatch(error) { - if (_emberMetalTesting.isTesting()) { + if (_emberDebug.isTesting()) { throw error; } if (onerror) { onerror(error); } else { _emberConsole.default.error(getStack(error)); } } }); -enifed('ember-metal/events', ['exports', 'ember-utils', 'ember-metal/debug', 'ember-metal/meta', 'ember-metal/meta_listeners'], function (exports, _emberUtils, _emberMetalDebug, _emberMetalMeta, _emberMetalMeta_listeners) { - 'no use strict'; - // Remove "use strict"; from transpiled module until - // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed - +enifed('ember-metal/events', ['exports', 'ember-utils', 'ember-metal/meta', 'ember-debug', 'ember-metal/meta_listeners'], function (exports, _emberUtils, _emberMetalMeta, _emberDebug, _emberMetalMeta_listeners) { /** @module ember @submodule ember-metal */ + 'use strict'; + exports.accumulateListeners = accumulateListeners; exports.addListener = addListener; exports.removeListener = removeListener; exports.suspendListener = suspendListener; exports.suspendListeners = suspendListeners; @@ -18111,13 +19882,13 @@ @param {Boolean} once A flag whether a function should only be called once @public */ function addListener(obj, eventName, target, method, once) { - _emberMetalDebug.assert('You must pass at least an object and event name to Ember.addListener', !!obj && !!eventName); + _emberDebug.assert('You must pass at least an object and event name to Ember.addListener', !!obj && !!eventName); - _emberMetalDebug.deprecate('didInitAttrs called in ' + (obj && obj.toString && obj.toString()) + '.', eventName !== 'didInitAttrs', { + _emberDebug.deprecate('didInitAttrs called in ' + (obj && obj.toString && obj.toString()) + '.', eventName !== 'didInitAttrs', { id: 'ember-views.did-init-attrs', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs' }); @@ -18151,11 +19922,11 @@ @param {Function|String} method A function or the name of a function to be called on `target` @public */ function removeListener(obj, eventName, target, method) { - _emberMetalDebug.assert('You must pass at least an object and event name to Ember.removeListener', !!obj && !!eventName); + _emberDebug.assert('You must pass at least an object and event name to Ember.removeListener', !!obj && !!eventName); if (!method && 'function' === typeof target) { method = target; target = null; } @@ -18362,21 +20133,20 @@ var events = args; func.__ember_listens__ = events; return func; } }); -enifed('ember-metal/expand_properties', ['exports', 'ember-metal/debug'], function (exports, _emberMetalDebug) { +enifed('ember-metal/expand_properties', ['exports', 'ember-debug'], function (exports, _emberDebug) { 'use strict'; exports.default = expandProperties; /** @module ember @submodule ember-metal */ - var SPLIT_REGEX = /\{|\}/; var END_WITH_EACH_REGEX = /\.@each$/; /** Expands `pattern`, invoking `callback` for each expansion. @@ -18404,113 +20174,63 @@ @param {Function} callback The callback to invoke. It is invoked once per expansion, and is passed the expansion. */ function expandProperties(pattern, callback) { - _emberMetalDebug.assert('A computed property key must be a string, you passed ' + typeof pattern + ' ' + pattern, typeof pattern === 'string'); - _emberMetalDebug.assert('Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"', pattern.indexOf(' ') === -1); - _emberMetalDebug.assert('Brace expanded properties have to be balanced and cannot be nested, pattern: ' + pattern, (function (str) { - var inBrace = 0; - var char = undefined; - for (var i = 0; i < str.length; i++) { - char = str.charAt(i); + _emberDebug.assert('A computed property key must be a string', typeof pattern === 'string'); + _emberDebug.assert('Brace expanded properties cannot contain spaces, e.g. "user.{firstName, lastName}" should be "user.{firstName,lastName}"', pattern.indexOf(' ') === -1); - if (char === '{') { - inBrace++; - } else if (char === '}') { - inBrace--; - } + var unbalancedNestedError = 'Brace expanded properties have to be balanced and cannot be nested, pattern: ' + pattern; + var properties = [pattern]; - if (inBrace > 1 || inBrace < 0) { - return false; - } - } + // Iterating backward over the pattern makes dealing with indices easier. + var bookmark = undefined; + var inside = false; + for (var i = pattern.length; i > 0; --i) { + var current = pattern[i - 1]; - return true; - })(pattern)); - - var parts = pattern.split(SPLIT_REGEX); - var properties = [parts]; - - for (var i = 0; i < parts.length; i++) { - var part = parts[i]; - if (part.indexOf(',') >= 0) { - properties = duplicateAndReplace(properties, part.split(','), i); + switch (current) { + // Closing curly brace will be the first character of the brace expansion we encounter. + // Bookmark its index so long as we're not already inside a brace expansion. + case '}': + if (!inside) { + bookmark = i - 1; + inside = true; + } else { + _emberDebug.assert(unbalancedNestedError, false); + } + break; + // Opening curly brace will be the last character of the brace expansion we encounter. + // Apply the brace expansion so long as we've already seen a closing curly brace. + case '{': + if (inside) { + var expansion = pattern.slice(i, bookmark).split(','); + // Iterating backward allows us to push new properties w/out affecting our "cursor". + for (var j = properties.length; j > 0; --j) { + // Extract the unexpanded property from the array. + var property = properties.splice(j - 1, 1)[0]; + // Iterate over the expansion, pushing the newly formed properties onto the array. + for (var k = 0; k < expansion.length; ++k) { + properties.push(property.slice(0, i - 1) + expansion[k] + property.slice(bookmark + 1)); + } + } + inside = false; + } else { + _emberDebug.assert(unbalancedNestedError, false); + } + break; } } + if (inside) { + _emberDebug.assert(unbalancedNestedError, false); + } for (var i = 0; i < properties.length; i++) { - callback(properties[i].join('').replace(END_WITH_EACH_REGEX, '.[]')); + callback(properties[i].replace(END_WITH_EACH_REGEX, '.[]')); } } - - function duplicateAndReplace(properties, currentParts, index) { - var all = []; - - properties.forEach(function (property) { - currentParts.forEach(function (part) { - var current = property.slice(0); - current[index] = part; - all.push(current); - }); - }); - - return all; - } }); -enifed('ember-metal/features', ['exports', 'ember-utils', 'ember-environment', 'ember/features'], function (exports, _emberUtils, _emberEnvironment, _emberFeatures) { - 'use strict'; - - exports.default = isEnabled; - - /** - The hash of enabled Canary features. Add to this, any canary features - before creating your application. - - Alternatively (and recommended), you can also define `EmberENV.FEATURES` - if you need to enable features flagged at runtime. - - @class FEATURES - @namespace Ember - @static - @since 1.1.0 - @public - */ - var FEATURES = _emberUtils.assign(_emberFeatures.default, _emberEnvironment.ENV.FEATURES); - - exports.FEATURES = FEATURES; - /** - Determine whether the specified `feature` is enabled. Used by Ember's - build tools to exclude experimental features from beta/stable builds. - - You can define the following configuration options: - - * `EmberENV.ENABLE_OPTIONAL_FEATURES` - enable any features that have not been explicitly - enabled/disabled. - - @method isEnabled - @param {String} feature The feature to check - @return {Boolean} - @for Ember.FEATURES - @since 1.1.0 - @public - */ - - function isEnabled(feature) { - var featureValue = FEATURES[feature]; - - if (featureValue === true || featureValue === false || featureValue === undefined) { - return featureValue; - } else if (_emberEnvironment.ENV.ENABLE_OPTIONAL_FEATURES) { - return true; - } else { - return false; - } - } - - exports.DEFAULT_FEATURES = _emberFeatures.default; -}); enifed('ember-metal/get_properties', ['exports', 'ember-metal/property_get'], function (exports, _emberMetalProperty_get) { 'use strict'; exports.default = getProperties; @@ -18551,11 +20271,11 @@ ret[propertyNames[i]] = _emberMetalProperty_get.get(obj, propertyNames[i]); } return ret; } }); -enifed('ember-metal/index', ['exports', 'require', 'ember-metal/core', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/merge', 'ember-metal/debug', 'ember-metal/instrumentation', 'ember-metal/testing', 'ember-metal/error_handler', 'ember-metal/meta', 'ember-metal/error', 'ember-metal/cache', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/weak_map', 'ember-metal/events', 'ember-metal/is_none', 'ember-metal/is_empty', 'ember-metal/is_blank', 'ember-metal/is_present', 'ember-metal/run_loop', 'ember-metal/observer_set', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/watch_key', 'ember-metal/chains', 'ember-metal/watch_path', 'ember-metal/watching', 'ember-metal/libraries', 'ember-metal/map', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/expand_properties', 'ember-metal/observer', 'ember-metal/mixin', 'ember-metal/binding', 'ember-metal/path_cache', 'ember-metal/injected_property', 'ember-metal/tags', 'ember-metal/replace', 'ember-metal/transaction', 'ember-metal/is_proxy', 'ember-metal/descriptor'], function (exports, _require, _emberMetalCore, _emberMetalComputed, _emberMetalAlias, _emberMetalMerge, _emberMetalDebug, _emberMetalInstrumentation, _emberMetalTesting, _emberMetalError_handler, _emberMetalMeta, _emberMetalError, _emberMetalCache, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalWeak_map, _emberMetalEvents, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _emberMetalRun_loop, _emberMetalObserver_set, _emberMetalProperty_events, _emberMetalProperties, _emberMetalWatch_key, _emberMetalChains, _emberMetalWatch_path, _emberMetalWatching, _emberMetalLibraries, _emberMetalMap, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalExpand_properties, _emberMetalObserver, _emberMetalMixin, _emberMetalBinding, _emberMetalPath_cache, _emberMetalInjected_property, _emberMetalTags, _emberMetalReplace, _emberMetalTransaction, _emberMetalIs_proxy, _emberMetalDescriptor) { +enifed('ember-metal/index', ['exports', 'ember-metal/core', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/merge', 'ember-metal/deprecate_property', 'ember-metal/instrumentation', 'ember-metal/error_handler', 'ember-metal/meta', 'ember-metal/cache', 'ember-metal/property_get', 'ember-metal/property_set', 'ember-metal/weak_map', 'ember-metal/events', 'ember-metal/is_none', 'ember-metal/is_empty', 'ember-metal/is_blank', 'ember-metal/is_present', 'ember-metal/run_loop', 'ember-metal/observer_set', 'ember-metal/property_events', 'ember-metal/properties', 'ember-metal/watch_key', 'ember-metal/chains', 'ember-metal/watch_path', 'ember-metal/watching', 'ember-metal/libraries', 'ember-metal/map', 'ember-metal/get_properties', 'ember-metal/set_properties', 'ember-metal/expand_properties', 'ember-metal/observer', 'ember-metal/mixin', 'ember-metal/binding', 'ember-metal/path_cache', 'ember-metal/injected_property', 'ember-metal/tags', 'ember-metal/replace', 'ember-metal/transaction', 'ember-metal/is_proxy', 'ember-metal/descriptor'], function (exports, _emberMetalCore, _emberMetalComputed, _emberMetalAlias, _emberMetalMerge, _emberMetalDeprecate_property, _emberMetalInstrumentation, _emberMetalError_handler, _emberMetalMeta, _emberMetalCache, _emberMetalProperty_get, _emberMetalProperty_set, _emberMetalWeak_map, _emberMetalEvents, _emberMetalIs_none, _emberMetalIs_empty, _emberMetalIs_blank, _emberMetalIs_present, _emberMetalRun_loop, _emberMetalObserver_set, _emberMetalProperty_events, _emberMetalProperties, _emberMetalWatch_key, _emberMetalChains, _emberMetalWatch_path, _emberMetalWatching, _emberMetalLibraries, _emberMetalMap, _emberMetalGet_properties, _emberMetalSet_properties, _emberMetalExpand_properties, _emberMetalObserver, _emberMetalMixin, _emberMetalBinding, _emberMetalPath_cache, _emberMetalInjected_property, _emberMetalTags, _emberMetalReplace, _emberMetalTransaction, _emberMetalIs_proxy, _emberMetalDescriptor) { /** @module ember @submodule ember-metal */ @@ -18566,41 +20286,25 @@ exports.computed = _emberMetalComputed.default; exports.cacheFor = _emberMetalComputed.cacheFor; exports.ComputedProperty = _emberMetalComputed.ComputedProperty; exports.alias = _emberMetalAlias.default; exports.merge = _emberMetalMerge.default; - exports.assert = _emberMetalDebug.assert; - exports.info = _emberMetalDebug.info; - exports.warn = _emberMetalDebug.warn; - exports.debug = _emberMetalDebug.debug; - exports.deprecate = _emberMetalDebug.deprecate; - exports.deprecateFunc = _emberMetalDebug.deprecateFunc; - exports.runInDebug = _emberMetalDebug.runInDebug; - exports.setDebugFunction = _emberMetalDebug.setDebugFunction; - exports.getDebugFunction = _emberMetalDebug.getDebugFunction; - exports.debugSeal = _emberMetalDebug.debugSeal; - exports.debugFreeze = _emberMetalDebug.debugFreeze; + exports.deprecateProperty = _emberMetalDeprecate_property.deprecateProperty; exports.instrument = _emberMetalInstrumentation.instrument; exports.flaggedInstrument = _emberMetalInstrumentation.flaggedInstrument; exports._instrumentStart = _emberMetalInstrumentation._instrumentStart; exports.instrumentationReset = _emberMetalInstrumentation.reset; exports.instrumentationSubscribe = _emberMetalInstrumentation.subscribe; exports.instrumentationUnsubscribe = _emberMetalInstrumentation.unsubscribe; - exports.isTesting = _emberMetalTesting.isTesting; - exports.setTesting = _emberMetalTesting.setTesting; exports.getOnerror = _emberMetalError_handler.getOnerror; exports.setOnerror = _emberMetalError_handler.setOnerror; exports.dispatchError = _emberMetalError_handler.dispatchError; exports.setDispatchOverride = _emberMetalError_handler.setDispatchOverride; exports.META_DESC = _emberMetalMeta.META_DESC; exports.meta = _emberMetalMeta.meta; exports.peekMeta = _emberMetalMeta.peekMeta; - exports.Error = _emberMetalError.default; exports.Cache = _emberMetalCache.default; - exports.isFeatureEnabled = _emberMetalFeatures.default; - exports.FEATURES = _emberMetalFeatures.FEATURES; - exports.DEFAULT_FEATURES = _emberMetalFeatures.DEFAULT_FEATURES; exports._getPath = _emberMetalProperty_get._getPath; exports.get = _emberMetalProperty_get.get; exports.getWithDefault = _emberMetalProperty_get.getWithDefault; exports.set = _emberMetalProperty_set.set; exports.trySet = _emberMetalProperty_set.trySet; @@ -18679,21 +20383,12 @@ exports.runInTransaction = _emberMetalTransaction.default; exports.didRender = _emberMetalTransaction.didRender; exports.assertNotRendered = _emberMetalTransaction.assertNotRendered; exports.isProxy = _emberMetalIs_proxy.isProxy; exports.descriptor = _emberMetalDescriptor.default; - - // TODO: this needs to be deleted once we refactor the build tooling - // do this for side-effects of updating Ember.assert, warn, etc when - // ember-debug is present - // This needs to be called before any deprecateFunc - - if (_require.has('ember-debug')) { - _require.default('ember-debug'); - } }); -enifed('ember-metal/injected_property', ['exports', 'ember-utils', 'ember-metal/debug', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/properties'], function (exports, _emberUtils, _emberMetalDebug, _emberMetalComputed, _emberMetalAlias, _emberMetalProperties) { +enifed('ember-metal/injected_property', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/computed', 'ember-metal/alias', 'ember-metal/properties'], function (exports, _emberUtils, _emberDebug, _emberMetalComputed, _emberMetalAlias, _emberMetalProperties) { 'use strict'; exports.default = InjectedProperty; /** @@ -18718,12 +20413,12 @@ function injectedPropertyGet(keyName) { var desc = this[keyName]; var owner = _emberUtils.getOwner(this) || this.container; // fallback to `container` for backwards compat - _emberMetalDebug.assert('InjectedProperties should be defined with the Ember.inject computed property macros.', desc && desc.isDescriptor && desc.type); - _emberMetalDebug.assert('Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.', owner); + _emberDebug.assert('InjectedProperties should be defined with the Ember.inject computed property macros.', desc && desc.isDescriptor && desc.type); + _emberDebug.assert('Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.', owner); return owner.lookup(desc.type + ':' + (desc.name || keyName)); } InjectedProperty.prototype = Object.create(_emberMetalProperties.Descriptor.prototype); @@ -18736,11 +20431,11 @@ InjectedPropertyPrototype.get = ComputedPropertyPrototype.get; InjectedPropertyPrototype.readOnly = ComputedPropertyPrototype.readOnly; InjectedPropertyPrototype.teardown = ComputedPropertyPrototype.teardown; }); -enifed('ember-metal/instrumentation', ['exports', 'ember-environment', 'ember-metal/features'], function (exports, _emberEnvironment, _emberMetalFeatures) { +enifed('ember-metal/instrumentation', ['exports', 'ember-environment', 'ember-debug'], function (exports, _emberEnvironment, _emberDebug) { /* eslint no-console:off */ /* global console */ 'use strict'; @@ -19194,11 +20889,11 @@ } return false; } }); -enifed('ember-metal/libraries', ['exports', 'ember-metal/debug', 'ember-metal/features'], function (exports, _emberMetalDebug, _emberMetalFeatures) { +enifed('ember-metal/libraries', ['exports', 'ember-debug'], function (exports, _emberDebug) { 'use strict'; /** Helper class that allows you to register your library with Ember. @@ -19247,11 +20942,11 @@ if (isCoreLibrary) { index = this._coreLibIndex++; } this._registry.splice(index, 0, { name: name, version: version }); } else { - _emberMetalDebug.warn('Library "' + name + '" is already registered with Ember.', false, { id: 'ember-metal.libraries-register' }); + _emberDebug.warn('Library "' + name + '" is already registered with Ember.', false, { id: 'ember-metal.libraries-register' }); } }, registerCoreLibrary: function (name, version) { this.register(name, version, true); @@ -19804,14 +21499,12 @@ } return original; } }); -enifed('ember-metal/meta', ['exports', 'ember-utils', 'ember-metal/features', 'ember-metal/meta_listeners', 'ember-metal/debug', 'ember-metal/chains', 'require'], function (exports, _emberUtils, _emberMetalFeatures, _emberMetalMeta_listeners, _emberMetalDebug, _emberMetalChains, _require) { - 'no use strict'; - // Remove "use strict"; from transpiled module until - // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed +enifed('ember-metal/meta', ['exports', 'ember-utils', 'ember-metal/meta_listeners', 'ember-debug', 'ember-metal/chains', 'require'], function (exports, _emberUtils, _emberMetalMeta_listeners, _emberDebug, _emberMetalChains, _require) { + 'use strict'; exports.deleteMeta = deleteMeta; exports.meta = meta; var counters = { @@ -19884,11 +21577,11 @@ function Meta(obj, parentMeta) { var _this = this; babelHelpers.classCallCheck(this, Meta); - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.metaInstantiated++; }); this._cache = undefined; this._weak = undefined; @@ -19919,11 +21612,11 @@ // inherited, and we can optimize it much better than JS runtimes. this.parent = parentMeta; if (true || false) { this._lastRendered = undefined; - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { _this._lastRenderedReferenceMap = undefined; _this._lastRenderedTemplateMap = undefined; }); } @@ -20043,11 +21736,11 @@ // Implements a member that provides a lazily created map of maps, // with inheritance at both levels. Meta.prototype.writeDeps = function writeDeps(subkey, itemkey, value) { - _emberMetalDebug.assert('Cannot call writeDeps after the object is destroyed.', !this.isMetaDestroyed()); + _emberDebug.assert('Cannot call writeDeps after the object is destroyed.', !this.isMetaDestroyed()); var outerMap = this._getOrCreateOwnMap('_deps'); var innerMap = outerMap[subkey]; if (!innerMap) { innerMap = outerMap[subkey] = Object.create(null); @@ -20181,11 +21874,11 @@ function inheritedMap(name, Meta) { var key = memberProperty(name); var capitalized = capitalize(name); Meta.prototype['write' + capitalized] = function (subkey, value) { - _emberMetalDebug.assert('Cannot call write' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); + _emberDebug.assert('Cannot call write' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); var map = this._getOrCreateOwnMap(key); map[subkey] = value; }; @@ -20210,11 +21903,11 @@ pointer = pointer.parent; } }; Meta.prototype['clear' + capitalized] = function () { - _emberMetalDebug.assert('Cannot call clear' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); + _emberDebug.assert('Cannot call clear' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); this[key] = undefined; }; Meta.prototype['deleteFrom' + capitalized] = function (subkey) { @@ -20233,11 +21926,11 @@ // object using the method you provide. function ownCustomObject(name, Meta) { var key = memberProperty(name); var capitalized = capitalize(name); Meta.prototype['writable' + capitalized] = function (create) { - _emberMetalDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); + _emberDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); var ret = this[key]; if (!ret) { ret = this[key] = create(this.source); } @@ -20253,11 +21946,11 @@ // their parents by calling your object's `copy()` method. function inheritedCustomObject(name, Meta) { var key = memberProperty(name); var capitalized = capitalize(name); Meta.prototype['writable' + capitalized] = function (create) { - _emberMetalDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); + _emberDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed()); var ret = this[key]; if (!ret) { if (this.parent) { ret = this[key] = this.parent['writable' + capitalized](create).copy(this.source); @@ -20337,18 +22030,18 @@ (function () { var getPrototypeOf = Object.getPrototypeOf; var metaStore = new WeakMap(); exports.setMeta = setMeta = function WeakMap_setMeta(obj, meta) { - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.setCalls++; }); metaStore.set(obj, meta); }; exports.peekMeta = peekMeta = function WeakMap_peekMeta(obj) { - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.peekCalls++; }); return metaStore.get(obj); }; @@ -20357,22 +22050,22 @@ var pointer = obj; var meta = undefined; while (pointer) { meta = metaStore.get(pointer); // jshint loopfunc:true - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.peekCalls++; }); // stop if we find a `null` value, since // that means the meta was deleted // any other truthy value is a "real" meta if (meta === null || meta) { return meta; } pointer = getPrototypeOf(pointer); - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.peakPrototypeWalks++; }); } }; })(); @@ -20395,11 +22088,11 @@ return obj[META_FIELD]; }; } function deleteMeta(obj) { - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.deleteCalls++; }); var meta = peekMeta(obj); if (meta) { @@ -20425,11 +22118,11 @@ the meta hash, allowing the method to avoid making an unnecessary copy. @return {Object} the meta hash for an object */ function meta(obj) { - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { return counters.metaCalls++; }); var maybeMeta = peekMeta(obj); var parent = undefined; @@ -20622,32 +22315,27 @@ } } destination.push(target, method, source[index + 3]); } }); -enifed('ember-metal/mixin', ['exports', 'ember-utils', 'ember-metal/error', 'ember-metal/debug', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/binding', 'ember-metal/observer', 'ember-metal/events'], function (exports, _emberUtils, _emberMetalError, _emberMetalDebug, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalProperties, _emberMetalComputed, _emberMetalBinding, _emberMetalObserver, _emberMetalEvents) { - 'no use strict'; - // Remove "use strict"; from transpiled module until - // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed - +enifed('ember-metal/mixin', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/meta', 'ember-metal/expand_properties', 'ember-metal/properties', 'ember-metal/computed', 'ember-metal/binding', 'ember-metal/observer', 'ember-metal/events'], function (exports, _emberUtils, _emberDebug, _emberMetalMeta, _emberMetalExpand_properties, _emberMetalProperties, _emberMetalComputed, _emberMetalBinding, _emberMetalObserver, _emberMetalEvents) { /** @module ember @submodule ember-metal */ + 'use strict'; + exports.detectBinding = detectBinding; exports.mixin = mixin; exports.hasUnprocessedMixins = hasUnprocessedMixins; exports.clearUnprocessedMixins = clearUnprocessedMixins; exports.required = required; exports.aliasMethod = aliasMethod; exports.observer = observer; exports._immediateObserver = _immediateObserver; exports._beforeObserver = _beforeObserver; - function ROOT() {} - ROOT.__hasSuper = false; - var a_slice = Array.prototype.slice; var a_concat = Array.prototype.concat; var isArray = Array.isArray; function isMethod(obj) { @@ -20755,11 +22443,11 @@ } else { ret = a_concat.call(_emberUtils.makeArray(baseValue), value); } } - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { // it is possible to use concatenatedProperties with strings (which cannot be frozen) // only freeze objects... if (typeof ret === 'object' && ret !== null) { // prevent mutating `concatenatedProperties` array after it is applied Object.freeze(ret); @@ -20770,14 +22458,14 @@ } function applyMergedProperties(obj, key, value, values) { var baseValue = values[key] || obj[key]; - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { if (isArray(value)) { // use conditional to avoid stringifying every time - _emberMetalDebug.assert('You passed in `' + JSON.stringify(value) + '` as the value for `' + key + '` but `' + key + '` cannot be an Array', false); + _emberDebug.assert('You passed in `' + JSON.stringify(value) + '` as the value for `' + key + '` but `' + key + '` cannot be an Array', false); } }); if (!baseValue) { return value; @@ -20800,11 +22488,11 @@ newBase[prop] = propValue; } } if (hasFunction) { - newBase._super = ROOT; + newBase._super = _emberUtils.ROOT; } return newBase; } @@ -20834,11 +22522,11 @@ descs[key] = undefined; values[key] = value; } } - function mergeMixins(mixins, m, descs, values, base, keys) { + function mergeMixins(mixins, meta, descs, values, base, keys) { var currentMixin = undefined, props = undefined, key = undefined, concats = undefined, mergings = undefined; @@ -20848,13 +22536,13 @@ delete values[keyName]; } for (var i = 0; i < mixins.length; i++) { currentMixin = mixins[i]; - _emberMetalDebug.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(currentMixin), typeof currentMixin === 'object' && currentMixin !== null && Object.prototype.toString.call(currentMixin) !== '[object Array]'); + _emberDebug.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(currentMixin), typeof currentMixin === 'object' && currentMixin !== null && Object.prototype.toString.call(currentMixin) !== '[object Array]'); - props = mixinProperties(m, currentMixin); + props = mixinProperties(meta, currentMixin); if (props === CONTINUE) { continue; } if (props) { @@ -20867,19 +22555,19 @@ for (key in props) { if (!props.hasOwnProperty(key)) { continue; } keys.push(key); - addNormalizedProperty(base, key, props[key], m, descs, values, concats, mergings); + addNormalizedProperty(base, key, props[key], meta, descs, values, concats, mergings); } // manually copy toString() because some JS engines do not enumerate it if (props.hasOwnProperty('toString')) { base.toString = props.toString; } } else if (currentMixin.mixins) { - mergeMixins(currentMixin.mixins, m, descs, values, base, keys); + mergeMixins(currentMixin.mixins, meta, descs, values, base, keys); if (currentMixin._without) { currentMixin._without.forEach(removeKeys); } } } @@ -20893,13 +22581,13 @@ // warm both paths of above function detectBinding('notbound'); detectBinding('fooBinding'); - function connectBindings(obj, m) { + function connectBindings(obj, meta) { // TODO Mixin.apply(instance) should disconnect binding if exists - m.forEachBindings(function (key, binding) { + meta.forEachBindings(function (key, binding) { if (binding) { var to = key.slice(0, -7); // strip Binding off end if (binding instanceof _emberMetalBinding.Binding) { binding = binding.copy(); // copy prototypes' instance binding.to(to); @@ -20910,19 +22598,19 @@ binding.connect(obj); obj[key] = binding; } }); // mark as applied - m.clearBindings(); + meta.clearBindings(); } - function finishPartial(obj, m) { - connectBindings(obj, m || _emberMetalMeta.meta(obj)); + function finishPartial(obj, meta) { + connectBindings(obj, meta || _emberMetalMeta.meta(obj)); return obj; } - function followAlias(obj, desc, m, descs, values) { + function followAlias(obj, desc, descs, values) { var altKey = desc.methodName; var value = undefined; var possibleDesc = undefined; if (descs[altKey] || values[altKey]) { value = values[altKey]; @@ -20965,26 +22653,26 @@ } function applyMixin(obj, mixins, partial) { var descs = {}; var values = {}; - var m = _emberMetalMeta.meta(obj); + var meta = _emberMetalMeta.meta(obj); var keys = []; var key = undefined, value = undefined, desc = undefined; - obj._super = ROOT; + obj._super = _emberUtils.ROOT; // Go through all mixins and hashes passed in, and: // // * Handle concatenated properties // * Handle merged properties // * Set up _super wrapping if necessary // * Set up computed property descriptors // * Copying `toString` in broken browsers - mergeMixins(mixins, m, descs, values, obj, keys); + mergeMixins(mixins, meta, descs, values, obj, keys); for (var i = 0; i < keys.length; i++) { key = keys[i]; if (key === 'constructor' || !values.hasOwnProperty(key)) { continue; @@ -20996,11 +22684,11 @@ if (desc === REQUIRED) { continue; } while (desc && desc instanceof Alias) { - var followed = followAlias(obj, desc, m, descs, values); + var followed = followAlias(obj, desc, descs, values); desc = followed.desc; value = followed.value; } if (desc === undefined && value === undefined) { @@ -21008,19 +22696,19 @@ } replaceObserversAndListeners(obj, key, value); if (detectBinding(key)) { - m.writeBindings(key, value); + meta.writeBindings(key, value); } - _emberMetalProperties.defineProperty(obj, key, desc, value, m); + _emberMetalProperties.defineProperty(obj, key, desc, value, meta); } if (!partial) { // don't apply to prototype - finishPartial(obj, m); + finishPartial(obj, meta); } return obj; } @@ -21059,14 +22747,14 @@ // `.extend.` const Comment = Ember.Object.extend(EditableMixin, { post: null }); - let comment = Comment.create({ - post: somePost + let comment = Comment.create({ + post: somePost }); - + comment.edit(); // outputs 'starting to edit' ``` Note that Mixins are created with `Ember.Mixin.create`, not `Ember.Mixin.extend`. @@ -21102,22 +22790,22 @@ @namespace Ember @public */ var Mixin = (function () { - function Mixin(args, properties) { + function Mixin(mixins, properties) { babelHelpers.classCallCheck(this, Mixin); this.properties = properties; - var length = args && args.length; + var length = mixins && mixins.length; if (length > 0) { var m = new Array(length); for (var i = 0; i < length; i++) { - var x = args[i]; + var x = mixins[i]; if (x instanceof Mixin) { m[i] = x; } else { m[i] = new Mixin(undefined, x); } @@ -21129,15 +22817,18 @@ } this.ownerConstructor = undefined; this._without = undefined; this[_emberUtils.GUID_KEY] = null; this[_emberUtils.NAME_KEY] = null; - _emberMetalDebug.debugSeal(this); + _emberDebug.debugSeal(this); } Mixin.applyPartial = function applyPartial(obj) { - var args = a_slice.call(arguments, 1); + for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + return applyMixin(obj, args, true); }; /** @method create @@ -21149,28 +22840,28 @@ Mixin.create = function create() { // ES6TODO: this relies on a global state? unprocessedFlag = true; var M = this; - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; + for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; } return new M(args, undefined); }; // returns the mixins currently applied to the specified object // TODO: Make Ember.mixin Mixin.mixins = function mixins(obj) { - var m = _emberMetalMeta.peekMeta(obj); + var meta = _emberMetalMeta.peekMeta(obj); var ret = []; - if (!m) { + if (!meta) { return ret; } - m.forEachMixins(function (key, currentMixin) { + meta.forEachMixins(function (key, currentMixin) { // skip primitive mixins since these are always anonymous if (!currentMixin.properties) { ret.push(currentMixin); } }); @@ -21218,11 +22909,11 @@ var mixins = this.mixins; var idx = undefined; for (idx = 0; idx < arguments.length; idx++) { currentMixin = arguments[idx]; - _emberMetalDebug.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(currentMixin), typeof currentMixin === 'object' && currentMixin !== null && Object.prototype.toString.call(currentMixin) !== '[object Array]'); + _emberDebug.assert('Expected hash or Mixin instance, got ' + Object.prototype.toString.call(currentMixin), typeof currentMixin === 'object' && currentMixin !== null && Object.prototype.toString.call(currentMixin) !== '[object Array]'); if (currentMixin instanceof Mixin) { mixins.push(currentMixin); } else { mixins.push(new Mixin(undefined, currentMixin)); @@ -21280,22 +22971,22 @@ return false; } if (obj instanceof Mixin) { return _detect(obj, this, {}); } - var m = _emberMetalMeta.peekMeta(obj); - if (!m) { + var meta = _emberMetalMeta.peekMeta(obj); + if (!meta) { return false; } - return !!m.peekMixins(_emberUtils.guidFor(this)); + return !!meta.peekMixins(_emberUtils.guidFor(this)); }; MixinPrototype.without = function () { var ret = new Mixin([this]); - for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { - args[_key3] = arguments[_key3]; + for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; } ret._without = args; return ret; }; @@ -21326,11 +23017,11 @@ _keys(keys, this, seen); var ret = Object.keys(keys); return ret; }; - _emberMetalDebug.debugSeal(MixinPrototype); + _emberDebug.debugSeal(MixinPrototype); var REQUIRED = new _emberMetalProperties.Descriptor(); REQUIRED.toString = function () { return '(Required Property)'; }; @@ -21342,11 +23033,11 @@ @for Ember @private */ function required() { - _emberMetalDebug.deprecate('Ember.required is deprecated as its behavior is inconsistent and unreliable.', false, { id: 'ember-metal.required', until: '3.0.0' }); + _emberDebug.deprecate('Ember.required is deprecated as its behavior is inconsistent and unreliable.', false, { id: 'ember-metal.required', until: '3.0.0' }); return REQUIRED; } function Alias(methodName) { this.isDescriptor = true; @@ -21407,12 +23098,12 @@ @return func @public */ function observer() { - for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { - args[_key4] = arguments[_key4]; + for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; } var func = args.slice(-1)[0]; var paths = undefined; @@ -21421,11 +23112,11 @@ }; var _paths = args.slice(0, -1); if (typeof func !== 'function') { // revert to old, soft-deprecated argument ordering - _emberMetalDebug.deprecate('Passing the dependentKeys after the callback function in Ember.observer is deprecated. Ensure the callback function is the last argument.', false, { id: 'ember-metal.observer-argument-order', until: '3.0.0' }); + _emberDebug.deprecate('Passing the dependentKeys after the callback function in Ember.observer is deprecated. Ensure the callback function is the last argument.', false, { id: 'ember-metal.observer-argument-order', until: '3.0.0' }); func = args[0]; _paths = args.slice(1); } @@ -21434,11 +23125,11 @@ for (var i = 0; i < _paths.length; ++i) { _emberMetalExpand_properties.default(_paths[i], addWatchedProperty); } if (typeof func !== 'function') { - throw new _emberMetalError.default('Ember.observer called without a function'); + throw new _emberDebug.EmberError('Ember.observer called without a function'); } func.__ember_observes__ = paths; return func; } @@ -21468,15 +23159,15 @@ @return func @private */ function _immediateObserver() { - _emberMetalDebug.deprecate('Usage of `Ember.immediateObserver` is deprecated, use `Ember.observer` instead.', false, { id: 'ember-metal.immediate-observer', until: '3.0.0' }); + _emberDebug.deprecate('Usage of `Ember.immediateObserver` is deprecated, use `Ember.observer` instead.', false, { id: 'ember-metal.immediate-observer', until: '3.0.0' }); for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; - _emberMetalDebug.assert('Immediate observers must observe internal properties only, not properties on other objects.', typeof arg !== 'string' || arg.indexOf('.') === -1); + _emberDebug.assert('Immediate observers must observe internal properties only, not properties on other objects.', typeof arg !== 'string' || arg.indexOf('.') === -1); } return observer.apply(this, arguments); } @@ -21496,12 +23187,12 @@ @deprecated @private */ function _beforeObserver() { - for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { - args[_key5] = arguments[_key5]; + for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) { + args[_key6] = arguments[_key6]; } var func = args.slice(-1)[0]; var paths = undefined; @@ -21523,11 +23214,11 @@ for (var i = 0; i < _paths.length; ++i) { _emberMetalExpand_properties.default(_paths[i], addWatchedProperty); } if (typeof func !== 'function') { - throw new _emberMetalError.default('_beforeObserver called without a function'); + throw new _emberDebug.EmberError('_beforeObserver called without a function'); } func.__ember_observesBefore__ = paths; return func; } @@ -21803,11 +23494,11 @@ function getTailPath(path) { return tailPathCache.get(path); } }); -enifed('ember-metal/properties', ['exports', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/meta', 'ember-metal/property_events'], function (exports, _emberMetalDebug, _emberMetalFeatures, _emberMetalMeta, _emberMetalProperty_events) { +enifed('ember-metal/properties', ['exports', 'ember-debug', 'ember-metal/meta', 'ember-metal/property_events'], function (exports, _emberDebug, _emberMetalMeta, _emberMetalProperty_events) { /** @module ember-metal */ 'use strict'; @@ -21858,11 +23549,11 @@ function SETTER_FUNCTION(value) { var m = _emberMetalMeta.peekMeta(this); if (!m.isInitialized(this)) { m.writeValues(name, value); } else { - _emberMetalDebug.assert('You must use Ember.set() to set the `' + name + '` property (of ' + this + ') to `' + value + '`.', false); + _emberDebug.assert('You must use Ember.set() to set the `' + name + '` property (of ' + this + ') to `' + value + '`.', false); } } SETTER_FUNCTION.isMandatorySetter = true; return SETTER_FUNCTION; @@ -22029,11 +23720,11 @@ // https://github.com/ariya/phantomjs/issues/11856 Object.defineProperty(obj, keyName, { configurable: true, writable: true, value: 'iCry' }); Object.defineProperty(obj, keyName, desc); } }); -enifed('ember-metal/property_events', ['exports', 'ember-utils', 'ember-metal/meta', 'ember-metal/events', 'ember-metal/tags', 'ember-metal/observer_set', 'ember-metal/features', 'ember-metal/transaction'], function (exports, _emberUtils, _emberMetalMeta, _emberMetalEvents, _emberMetalTags, _emberMetalObserver_set, _emberMetalFeatures, _emberMetalTransaction) { +enifed('ember-metal/property_events', ['exports', 'ember-utils', 'ember-metal/meta', 'ember-metal/events', 'ember-metal/tags', 'ember-metal/observer_set', 'ember-debug', 'ember-metal/transaction'], function (exports, _emberUtils, _emberMetalMeta, _emberMetalEvents, _emberMetalTags, _emberMetalObserver_set, _emberDebug, _emberMetalTransaction) { 'use strict'; var PROPERTY_DID_CHANGE = _emberUtils.symbol('PROPERTY_DID_CHANGE'); exports.PROPERTY_DID_CHANGE = PROPERTY_DID_CHANGE; @@ -22322,11 +24013,11 @@ exports.overrideChains = overrideChains; exports.beginPropertyChanges = beginPropertyChanges; exports.endPropertyChanges = endPropertyChanges; exports.changeProperties = changeProperties; }); -enifed('ember-metal/property_get', ['exports', 'ember-metal/debug', 'ember-metal/path_cache'], function (exports, _emberMetalDebug, _emberMetalPath_cache) { +enifed('ember-metal/property_get', ['exports', 'ember-debug', 'ember-metal/path_cache'], function (exports, _emberDebug, _emberMetalPath_cache) { /** @module ember-metal */ 'use strict'; @@ -22377,15 +24068,15 @@ @return {Object} the property value or `null`. @public */ function get(obj, keyName) { - _emberMetalDebug.assert('Get must be called with two arguments; an object and a property key', arguments.length === 2); - _emberMetalDebug.assert('Cannot call get with \'' + keyName + '\' on an undefined object.', obj !== undefined && obj !== null); - _emberMetalDebug.assert('The key provided to get must be a string, you passed ' + keyName, typeof keyName === 'string'); - _emberMetalDebug.assert('\'this\' in paths is not supported', !_emberMetalPath_cache.hasThis(keyName)); - _emberMetalDebug.assert('Cannot call `Ember.get` with an empty string', keyName !== ''); + _emberDebug.assert('Get must be called with two arguments; an object and a property key', arguments.length === 2); + _emberDebug.assert('Cannot call get with \'' + keyName + '\' on an undefined object.', obj !== undefined && obj !== null); + _emberDebug.assert('The key provided to get must be a string, you passed ' + keyName, typeof keyName === 'string'); + _emberDebug.assert('\'this\' in paths is not supported', !_emberMetalPath_cache.hasThis(keyName)); + _emberDebug.assert('Cannot call `Ember.get` with an empty string', keyName !== ''); var value = obj[keyName]; var desc = value !== null && typeof value === 'object' && value.isDescriptor ? value : undefined; var ret = undefined; @@ -22459,11 +24150,11 @@ return value; } exports.default = get; }); -enifed('ember-metal/property_set', ['exports', 'ember-utils', 'ember-metal/debug', 'ember-metal/features', 'ember-metal/property_get', 'ember-metal/property_events', 'ember-metal/error', 'ember-metal/path_cache', 'ember-metal/meta'], function (exports, _emberUtils, _emberMetalDebug, _emberMetalFeatures, _emberMetalProperty_get, _emberMetalProperty_events, _emberMetalError, _emberMetalPath_cache, _emberMetalMeta) { +enifed('ember-metal/property_set', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/property_get', 'ember-metal/property_events', 'ember-metal/path_cache', 'ember-metal/meta'], function (exports, _emberUtils, _emberDebug, _emberMetalProperty_get, _emberMetalProperty_events, _emberMetalPath_cache, _emberMetalMeta) { 'use strict'; exports.set = set; exports.trySet = trySet; @@ -22485,15 +24176,15 @@ @return {Object} the passed value. @public */ function set(obj, keyName, value, tolerant) { - _emberMetalDebug.assert('Set must be called with three or four arguments; an object, a property key, a value and tolerant true/false', arguments.length === 3 || arguments.length === 4); - _emberMetalDebug.assert('Cannot call set with \'' + keyName + '\' on an undefined object.', obj && typeof obj === 'object' || typeof obj === 'function'); - _emberMetalDebug.assert('The key provided to set must be a string, you passed ' + keyName, typeof keyName === 'string'); - _emberMetalDebug.assert('\'this\' in paths is not supported', !_emberMetalPath_cache.hasThis(keyName)); - _emberMetalDebug.assert('calling set on destroyed object: ' + _emberUtils.toString(obj) + '.' + keyName + ' = ' + _emberUtils.toString(value), !obj.isDestroyed); + _emberDebug.assert('Set must be called with three or four arguments; an object, a property key, a value and tolerant true/false', arguments.length === 3 || arguments.length === 4); + _emberDebug.assert('Cannot call set with \'' + keyName + '\' on an undefined object.', obj && typeof obj === 'object' || typeof obj === 'function'); + _emberDebug.assert('The key provided to set must be a string, you passed ' + keyName, typeof keyName === 'string'); + _emberDebug.assert('\'this\' in paths is not supported', !_emberMetalPath_cache.hasThis(keyName)); + _emberDebug.assert('calling set on destroyed object: ' + _emberUtils.toString(obj) + '.' + keyName + ' = ' + _emberUtils.toString(value), !obj.isDestroyed); if (_emberMetalPath_cache.isPath(keyName)) { return setPath(obj, keyName, value, tolerant); } @@ -22511,11 +24202,11 @@ if (desc) { /* computed property */ desc.set(obj, keyName, value); } else if (obj.setUnknownProperty && currentValue === undefined && !(keyName in obj)) { /* unknown property */ - _emberMetalDebug.assert('setUnknownProperty must be a function', typeof obj.setUnknownProperty === 'function'); + _emberDebug.assert('setUnknownProperty must be a function', typeof obj.setUnknownProperty === 'function'); obj.setUnknownProperty(keyName, value); } else if (currentValue === value) { /* no change */ return value; } else { @@ -22565,18 +24256,18 @@ if (path !== 'this') { root = _emberMetalProperty_get._getPath(root, path); } if (!keyName || keyName.length === 0) { - throw new _emberMetalError.default('Property set failed: You passed an empty path'); + throw new _emberDebug.Error('Property set failed: You passed an empty path'); } if (!root) { if (tolerant) { return; } else { - throw new _emberMetalError.default('Property set failed: object in path "' + path + '" could not be found or was destroyed.'); + throw new _emberDebug.Error('Property set failed: object in path "' + path + '" could not be found or was destroyed.'); } } return set(root, keyName, value); } @@ -22631,11 +24322,11 @@ ret = ret.concat(splice.apply(array, chunk)); } return ret; } }); -enifed('ember-metal/run_loop', ['exports', 'ember-utils', 'ember-metal/debug', 'ember-metal/testing', 'ember-metal/error_handler', 'ember-metal/property_events', 'backburner'], function (exports, _emberUtils, _emberMetalDebug, _emberMetalTesting, _emberMetalError_handler, _emberMetalProperty_events, _backburner) { +enifed('ember-metal/run_loop', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/error_handler', 'ember-metal/property_events', 'backburner'], function (exports, _emberUtils, _emberDebug, _emberMetalError_handler, _emberMetalProperty_events, _backburner) { 'use strict'; exports.default = run; function onBegin(current) { @@ -22902,11 +24593,11 @@ @param {Object} [arguments*] Optional arguments to be passed to the queued method. @return {*} Timer information for use in cancelling, see `run.cancel`. @public */ run.schedule = function () /* queue, target, method */{ - _emberMetalDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !_emberMetalTesting.isTesting()); + _emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !_emberDebug.isTesting()); return backburner.schedule.apply(backburner, arguments); }; // Used by global test teardown @@ -22984,11 +24675,11 @@ @param {Object} [args*] Optional arguments to pass to the timeout. @return {Object} Timer information for use in cancelling, see `run.cancel`. @public */ run.once = function () { - _emberMetalDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !_emberMetalTesting.isTesting()); + _emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !_emberDebug.isTesting()); for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } @@ -23047,11 +24738,11 @@ @param {Object} [args*] Optional arguments to pass to the timeout. @return {Object} Timer information for use in cancelling, see `run.cancel`. @public */ run.scheduleOnce = function () /*queue, target, method*/{ - _emberMetalDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !_emberMetalTesting.isTesting()); + _emberDebug.assert('You have turned on testing mode, which disabled the run-loop\'s autorun. ' + 'You will need to wrap any code with asynchronous side-effects in a run', run.currentRunLoop || !_emberDebug.isTesting()); return backburner.scheduleOnce.apply(backburner, arguments); }; /** Schedules an item to run from within a separate run loop, after @@ -23358,11 +25049,11 @@ } }); return properties; } }); -enifed('ember-metal/tags', ['exports', 'glimmer-reference', 'ember-metal/meta', 'require', 'ember-metal/is_proxy'], function (exports, _glimmerReference, _emberMetalMeta, _require, _emberMetalIs_proxy) { +enifed('ember-metal/tags', ['exports', '@glimmer/reference', 'ember-metal/meta', 'require', 'ember-metal/is_proxy'], function (exports, _glimmerReference, _emberMetalMeta, _require, _emberMetalIs_proxy) { 'use strict'; exports.setHasViews = setHasViews; exports.tagForProperty = tagForProperty; exports.tagFor = tagFor; @@ -23439,57 +25130,30 @@ if (hasViews() && !run.backburner.currentInstance) { run.schedule('actions', K); } } }); -enifed("ember-metal/testing", ["exports"], function (exports) { - "use strict"; - - exports.isTesting = isTesting; - exports.setTesting = setTesting; - var testing = false; - - function isTesting() { - return testing; - } - - function setTesting(value) { - testing = !!value; - } -}); -enifed('ember-metal/transaction', ['exports', 'ember-metal/meta', 'ember-metal/debug', 'ember-metal/features'], function (exports, _emberMetalMeta, _emberMetalDebug, _emberMetalFeatures) { +enifed('ember-metal/transaction', ['exports', 'ember-metal/meta', 'ember-debug'], function (exports, _emberMetalMeta, _emberDebug) { 'use strict'; var runInTransaction = undefined, didRender = undefined, assertNotRendered = undefined; - var raise = _emberMetalDebug.assert; - if (false) { - raise = function (message, test) { - _emberMetalDebug.deprecate(message, test, { id: 'ember-views.render-double-modify', until: '3.0.0' }); - }; - } - - var implication = undefined; - if (false) { - implication = 'will be removed in Ember 3.0.'; - } else if (true) { - implication = 'is no longer supported. See https://github.com/emberjs/ember.js/issues/13948 for more details.'; - } - + // detect-backtracking-rerender by default is debug build only + // detect-glimmer-allow-backtracking-rerender can be enabled in custom builds if (true || false) { (function () { var counter = 0; var inTransaction = false; var shouldReflush = undefined; var debugStack = undefined; exports.default = runInTransaction = function (context, methodName) { shouldReflush = false; inTransaction = true; - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { debugStack = context.env.debugStack; }); context[methodName](); inTransaction = false; counter++; @@ -23502,11 +25166,11 @@ } var meta = _emberMetalMeta.meta(object); var lastRendered = meta.writableLastRendered(); lastRendered[key] = counter; - _emberMetalDebug.runInDebug(function () { + _emberDebug.runInDebug(function () { var referenceMap = meta.writableLastRenderedReferenceMap(); referenceMap[key] = reference; var templateMap = meta.writableLastRenderedTemplateMap(); if (templateMap[key] === undefined) { @@ -23518,11 +25182,11 @@ exports.assertNotRendered = assertNotRendered = function (object, key, _meta) { var meta = _meta || _emberMetalMeta.meta(object); var lastRendered = meta.readableLastRendered(); if (lastRendered && lastRendered[key] === counter) { - raise((function () { + _emberDebug.runInDebug(function () { var templateMap = meta.readableLastRenderedTemplateMap(); var lastRenderedIn = templateMap[key]; var currentlyIn = debugStack.peek(); var referenceMap = meta.readableLastRenderedReferenceMap(); @@ -23539,36 +25203,36 @@ label = parts.join('.'); } else { label = 'the same value'; } - return 'You modified "' + label + '" twice on ' + object + ' in a single render. It was rendered in ' + lastRenderedIn + ' and modified in ' + currentlyIn + '. This was unreliable and slow in Ember 1.x and ' + implication; - })(), false); + var message = 'You modified "' + label + '" twice on ' + object + ' in a single render. It was rendered in ' + lastRenderedIn + ' and modified in ' + currentlyIn + '. This was unreliable and slow in Ember 1.x and'; + if (false) { + _emberDebug.deprecate(message + ' will be removed in Ember 3.0.', false, { id: 'ember-views.render-double-modify', until: '3.0.0' }); + } else { + _emberDebug.assert(message + ' is no longer supported. See https://github.com/emberjs/ember.js/issues/13948 for more details.', false); + } + }); + shouldReflush = true; } }; })(); } else { - exports.default = runInTransaction = function () { - throw new Error('Cannot call runInTransaction without Glimmer'); + // in production do nothing to detect reflushes + exports.default = runInTransaction = function (context, methodName) { + context[methodName](); + return false; }; - - exports.didRender = didRender = function () { - throw new Error('Cannot call didRender without Glimmer'); - }; - - exports.assertNotRendered = assertNotRendered = function () { - throw new Error('Cannot call assertNotRendered without Glimmer'); - }; } exports.default = runInTransaction; exports.didRender = didRender; exports.assertNotRendered = assertNotRendered; }); -enifed('ember-metal/watch_key', ['exports', 'ember-utils', 'ember-metal/features', 'ember-metal/meta', 'ember-metal/properties'], function (exports, _emberUtils, _emberMetalFeatures, _emberMetalMeta, _emberMetalProperties) { +enifed('ember-metal/watch_key', ['exports', 'ember-utils', 'ember-debug', 'ember-metal/meta', 'ember-metal/properties'], function (exports, _emberUtils, _emberDebug, _emberMetalMeta, _emberMetalProperties) { 'use strict'; exports.watchKey = watchKey; exports.unwatchKey = unwatchKey; @@ -24163,11 +25827,11 @@ // resolve), which is used in router transitions to prevent unnecessary // loading state entry if all context promises resolve on the // 'actions' queue first. _emberMetal.run._addQueue('routerTransitions', 'actions'); }); -enifed('ember-routing/index', ['exports', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route', 'ember-routing/system/query_params', 'ember-routing/services/routing', 'ember-routing/system/cache'], function (exports, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute, _emberRoutingSystemQuery_params, _emberRoutingServicesRouting, _emberRoutingSystemCache) { +enifed('ember-routing/index', ['exports', 'ember-routing/ext/run_loop', 'ember-routing/ext/controller', 'ember-routing/location/api', 'ember-routing/location/none_location', 'ember-routing/location/hash_location', 'ember-routing/location/history_location', 'ember-routing/location/auto_location', 'ember-routing/system/generate_controller', 'ember-routing/system/controller_for', 'ember-routing/system/dsl', 'ember-routing/system/router', 'ember-routing/system/route', 'ember-routing/system/query_params', 'ember-routing/services/routing', 'ember-routing/services/router', 'ember-routing/system/cache'], function (exports, _emberRoutingExtRun_loop, _emberRoutingExtController, _emberRoutingLocationApi, _emberRoutingLocationNone_location, _emberRoutingLocationHash_location, _emberRoutingLocationHistory_location, _emberRoutingLocationAuto_location, _emberRoutingSystemGenerate_controller, _emberRoutingSystemController_for, _emberRoutingSystemDsl, _emberRoutingSystemRouter, _emberRoutingSystemRoute, _emberRoutingSystemQuery_params, _emberRoutingServicesRouting, _emberRoutingServicesRouter, _emberRoutingSystemCache) { /** @module ember @submodule ember-routing */ @@ -24185,13 +25849,14 @@ exports.RouterDSL = _emberRoutingSystemDsl.default; exports.Router = _emberRoutingSystemRouter.default; exports.Route = _emberRoutingSystemRoute.default; exports.QueryParams = _emberRoutingSystemQuery_params.default; exports.RoutingService = _emberRoutingServicesRouting.default; + exports.RouterService = _emberRoutingServicesRouter.default; exports.BucketCache = _emberRoutingSystemCache.default; }); -enifed('ember-routing/location/api', ['exports', 'ember-metal', 'ember-environment', 'ember-routing/location/util'], function (exports, _emberMetal, _emberEnvironment, _emberRoutingLocationUtil) { +enifed('ember-routing/location/api', ['exports', 'ember-debug', 'ember-environment', 'ember-routing/location/util'], function (exports, _emberDebug, _emberEnvironment, _emberRoutingLocationUtil) { 'use strict'; /** @module ember @submodule ember-routing @@ -24351,14 +26016,14 @@ need. @private */ create: function (options) { var implementation = options && options.implementation; - _emberMetal.assert('Ember.Location.create: you must specify a \'implementation\' option', !!implementation); + _emberDebug.assert('Ember.Location.create: you must specify a \'implementation\' option', !!implementation); var implementationClass = this.implementations[implementation]; - _emberMetal.assert('Ember.Location.create: ' + implementation + ' is not a valid implementation', !!implementationClass); + _emberDebug.assert('Ember.Location.create: ' + implementation + ' is not a valid implementation', !!implementationClass); return implementationClass.create.apply(implementationClass, arguments); }, implementations: {}, @@ -24375,11 +26040,11 @@ _getHash: function () { return _emberRoutingLocationUtil.getHash(this.location); } }; }); -enifed('ember-routing/location/auto_location', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-environment', 'ember-routing/location/util'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberEnvironment, _emberRoutingLocationUtil) { +enifed('ember-routing/location/auto_location', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-runtime', 'ember-environment', 'ember-routing/location/util'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberRuntime, _emberEnvironment, _emberRoutingLocationUtil) { 'use strict'; exports.getHistoryPath = getHistoryPath; exports.getHashPath = getHashPath; @@ -24468,11 +26133,11 @@ @private */ detect: function () { var rootURL = this.rootURL; - _emberMetal.assert('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/'); + _emberDebug.assert('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/'); var implementation = detectImplementation({ location: this.location, history: this.history, userAgent: this.userAgent, @@ -24487,11 +26152,11 @@ } var concrete = _emberUtils.getOwner(this).lookup('location:' + implementation); _emberMetal.set(concrete, 'rootURL', rootURL); - _emberMetal.assert('Could not find location \'' + implementation + '\'.', !!concrete); + _emberDebug.assert('Could not find location \'' + implementation + '\'.', !!concrete); _emberMetal.set(this, 'concreteImplementation', concrete); }, initState: delegateToConcreteImplementation('initState'), @@ -24511,11 +26176,11 @@ }); function delegateToConcreteImplementation(methodName) { return function () { var concreteImplementation = _emberMetal.get(this, 'concreteImplementation'); - _emberMetal.assert('AutoLocation\'s detect() method should be called before calling any other hooks.', !!concreteImplementation); + _emberDebug.assert('AutoLocation\'s detect() method should be called before calling any other hooks.', !!concreteImplementation); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } @@ -24602,11 +26267,11 @@ var query = _emberRoutingLocationUtil.getQuery(location); var rootURLIndex = path.indexOf(rootURL); var routeHash = undefined, hashParts = undefined; - _emberMetal.assert('Path ' + path + ' does not start with the provided rootURL ' + rootURL, rootURLIndex === 0); + _emberDebug.assert('Path ' + path + ' does not start with the provided rootURL ' + rootURL, rootURLIndex === 0); // By convention, Ember.js routes using HashLocation are required to start // with `#/`. Anything else should NOT be considered a route and should // be passed straight through, without transformation. if (hash.substr(0, 2) === '#/') { @@ -24802,20 +26467,33 @@ window.removeEventListener('hashchange', this._hashchangeHandler); } } }); }); -enifed('ember-routing/location/history_location', ['exports', 'ember-metal', 'ember-runtime', 'ember-routing/location/api'], function (exports, _emberMetal, _emberRuntime, _emberRoutingLocationApi) { +enifed('ember-routing/location/history_location', ['exports', 'ember-metal', 'ember-debug', 'ember-runtime', 'ember-routing/location/api'], function (exports, _emberMetal, _emberDebug, _emberRuntime, _emberRoutingLocationApi) { 'use strict'; /** @module ember @submodule ember-routing */ var popstateFired = false; + var _uuid = undefined; + + if (true) { + _uuid = function _uuid() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r, v; + r = Math.random() * 16 | 0; + v = c === 'x' ? r : r & 3 | 8; + return v.toString(16); + }); + }; + } + /** Ember.HistoryLocation implements the location API using the browser's history.pushState API. @class HistoryLocation @@ -24881,11 +26559,11 @@ // remove trailing slashes if they exists rootURL = rootURL.replace(/\/$/, ''); baseURL = baseURL.replace(/\/$/, ''); // remove baseURL and rootURL from start of path - var url = path.replace(new RegExp('^' + baseURL + '(?=/|$)'), '').replace(new RegExp('^' + rootURL + '(?=/|$)'), '').replace(/\/\/$/g, '/'); // remove extra slashes + var url = path.replace(new RegExp('^' + baseURL + '(?=/|$)'), '').replace(new RegExp('^' + rootURL + '(?=/|$)'), ''); var search = location.search || ''; url += search + this.getHash(); return url; @@ -24925,10 +26603,13 @@ /** Get the current `history.state`. Checks for if a polyfill is required and if so fetches this._historyState. The state returned from getState may be null if an iframe has changed a window's history. + The object returned will contain a `path` for the given state as well + as a unique state `id`. The state index will allow the app to distinguish + between two states with similar paths but should be unique from one another. @private @method getState @return state {Object} */ getState: function () { @@ -24945,10 +26626,13 @@ @method pushState @param path {String} */ pushState: function (path) { var state = { path: path }; + if (true) { + state.uuid = _uuid(); + } _emberMetal.get(this, 'history').pushState(state, null, path); this._historyState = state; @@ -24962,10 +26646,14 @@ @method replaceState @param path {String} */ replaceState: function (path) { var state = { path: path }; + if (true) { + state.uuid = _uuid(); + } + _emberMetal.get(this, 'history').replaceState(state, null, path); this._historyState = state; // used for webkit workaround @@ -25043,11 +26731,11 @@ window.removeEventListener('popstate', this._popstateHandler); } } }); }); -enifed('ember-routing/location/none_location', ['exports', 'ember-metal', 'ember-runtime'], function (exports, _emberMetal, _emberRuntime) { +enifed('ember-routing/location/none_location', ['exports', 'ember-metal', 'ember-debug', 'ember-runtime'], function (exports, _emberMetal, _emberDebug, _emberRuntime) { 'use strict'; /** @module ember @submodule ember-routing @@ -25069,11 +26757,11 @@ path: '', detect: function () { var rootURL = this.rootURL; - _emberMetal.assert('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/'); + _emberDebug.assert('rootURL must end with a trailing forward slash e.g. "/app/"', rootURL.charAt(rootURL.length - 1) === '/'); }, /** Will be pre-pended to path. @private @@ -25280,10 +26968,94 @@ function replacePath(location, path) { location.replace(getOrigin(location) + path); } }); +enifed('ember-routing/services/router', ['exports', 'ember-runtime', 'ember-metal', 'ember-routing/system/dsl'], function (exports, _emberRuntime, _emberMetal, _emberRoutingSystemDsl) { + /** + @module ember + @submodule ember-routing + */ + + 'use strict'; + + /** + The Router service is the public API that provides component/view layer + access to the router. + + @public + @class RouterService + @category ember-routing-router-service + */ + var RouterService = _emberRuntime.Service.extend({ + currentRouteName: _emberRuntime.readOnly('router.currentRouteName'), + currentURL: _emberRuntime.readOnly('router.currentURL'), + location: _emberRuntime.readOnly('router.location'), + rootURL: _emberRuntime.readOnly('router.rootURL'), + + /** + Transition the application into another route. The route may + be either a single route or route path: + See [Route.transitionTo](http://emberjs.com/api/classes/Ember.Route.html#method_transitionTo) for more info. + @method transitionTo + @category ember-routing-router-service + @param {String} routeNameOrUrl the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @param {Object} [options] optional hash with a queryParams property + containing a mapping of query parameters + @return {Transition} the transition object associated with this + attempted transition + @public + */ + transitionTo: function () /* routeNameOrUrl, ...models, options */{ + var _router; + + return (_router = this.router).transitionTo.apply(_router, arguments); + }, + + /** + Transition into another route while replacing the current URL, if possible. + The route may be either a single route or route path: + See [Route.replaceWith](http://emberjs.com/api/classes/Ember.Route.html#method_replaceWith) for more info. + @method replaceWith + @category ember-routing-router-service + @param {String} routeNameOrUrl the name of the route or a URL + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @param {Object} [options] optional hash with a queryParams property + containing a mapping of query parameters + @return {Transition} the transition object associated with this + attempted transition + @public + */ + replaceWith: function () /* routeNameOrUrl, ...models, options */{ + var _router2; + + return (_router2 = this.router).replaceWith.apply(_router2, arguments); + }, + + /** + Generate a URL based on the supplied route name. + @method urlFor + @param {String} routeName the name of the route + @param {...Object} models the model(s) or identifier(s) to be used while + transitioning to the route. + @param {Object} [options] optional hash with a queryParams property + containing a mapping of query parameters + @return {String} the string representing the generated URL + @public + */ + urlFor: function () /* routeName, ...models, options */{ + var _router3; + + return (_router3 = this.router).generate.apply(_router3, arguments); + } + }); + + exports.default = RouterService; +}); enifed('ember-routing/services/routing', ['exports', 'ember-utils', 'ember-runtime', 'ember-metal', 'ember-routing/utils'], function (exports, _emberUtils, _emberRuntime, _emberMetal, _emberRoutingUtils) { /** @module ember @submodule ember-routing */ @@ -25334,11 +27106,11 @@ router._prepareQueryParams(routeName, models, queryParams); }, generateURL: function (routeName, models, queryParams) { var router = _emberMetal.get(this, 'router'); - if (!router.router) { + if (!router._routerMicrolib) { return; } var visibleQueryParams = {}; _emberUtils.assign(visibleQueryParams, queryParams); @@ -25350,11 +27122,11 @@ }, isActiveForRoute: function (contexts, queryParams, routeName, routerState, isCurrentWhenSpecified) { var router = _emberMetal.get(this, 'router'); - var handlers = router.router.recognizer.handlersFor(routeName); + var handlers = router._routerMicrolib.recognizer.handlersFor(routeName); var leafName = handlers[handlers.length - 1].handler; var maximumContexts = numberOfContextsAcceptedByHandler(routeName, handlers); // NOTE: any ugliness in the calculation of activeness is largely // due to the fact that we support automatic normalizing of @@ -25449,11 +27221,11 @@ function controllerFor(container, controllerName, lookupOptions) { return container.lookup("controller:" + controllerName, lookupOptions); } }); -enifed('ember-routing/system/dsl', ['exports', 'ember-utils', 'ember-metal'], function (exports, _emberUtils, _emberMetal) { +enifed('ember-routing/system/dsl', ['exports', 'ember-utils', 'ember-debug'], function (exports, _emberUtils, _emberDebug) { 'use strict'; /** @module ember @submodule ember-routing @@ -25479,11 +27251,11 @@ if (arguments.length === 2 && typeof options === 'function') { callback = options; options = {}; } - _emberMetal.assert('\'' + name + '\' cannot be used as a route name.', (function () { + _emberDebug.assert('\'' + name + '\' cannot be used as a route name.', (function () { if (options.overrideNameAssertion === true) { return true; } return ['array', 'basic', 'object', 'application'].indexOf(name) === -1; @@ -25539,11 +27311,11 @@ callback = options; options = {}; } options.resetNamespace = true; - _emberMetal.deprecate('this.resource() is deprecated. Use this.route(\'name\', { resetNamespace: true }, function () {}) instead.', false, { id: 'ember-routing.router-resource', until: '3.0.0' }); + _emberDebug.deprecate('this.resource() is deprecated. Use this.route(\'name\', { resetNamespace: true }, function () {}) instead.', false, { id: 'ember-routing.router-resource', until: '3.0.0' }); this.route(name, options, callback); }; DSL.prototype.generate = function generate() { var dslMatches = this.matches; @@ -25667,11 +27439,11 @@ var dsl = new DSL(); callback.call(dsl); return dsl; }; }); -enifed('ember-routing/system/generate_controller', ['exports', 'ember-metal', 'container'], function (exports, _emberMetal, _container) { +enifed('ember-routing/system/generate_controller', ['exports', 'ember-metal', 'container', 'ember-debug'], function (exports, _emberMetal, _container, _emberDebug) { 'use strict'; exports.generateControllerFactory = generateControllerFactory; exports.default = generateController; @@ -25718,13 +27490,15 @@ generateControllerFactory(owner, controllerName); var fullName = 'controller:' + controllerName; var instance = owner.lookup(fullName); - if (_emberMetal.get(instance, 'namespace.LOG_ACTIVE_GENERATION')) { - _emberMetal.info('generated -> ' + fullName, { fullName: fullName }); - } + _emberDebug.runInDebug(function () { + if (_emberMetal.get(instance, 'namespace.LOG_ACTIVE_GENERATION')) { + _emberDebug.info('generated -> ' + fullName, { fullName: fullName }); + } + }); return instance; } }); enifed('ember-routing/system/query_params', ['exports', 'ember-runtime'], function (exports, _emberRuntime) { @@ -25733,11 +27507,11 @@ exports.default = _emberRuntime.Object.extend({ isQueryParams: true, values: null }); }); -enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-routing/system/generate_controller', 'ember-routing/utils', 'container'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberRoutingSystemGenerate_controller, _emberRoutingUtils, _container) { +enifed('ember-routing/system/route', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-runtime', 'ember-routing/system/generate_controller', 'ember-routing/utils', 'container'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberRuntime, _emberRoutingSystemGenerate_controller, _emberRoutingUtils, _container) { 'use strict'; exports.defaultSerialize = defaultSerialize; exports.hasDefaultSerialize = hasDefaultSerialize; var slice = Array.prototype.slice; @@ -25856,19 +27630,10 @@ this.routeName = name; this.fullRouteName = getEngineRouteName(_emberUtils.getOwner(this), name); }, /** - Populates the QP meta information in the BucketCache. - @private - @method _populateQPMeta - */ - _populateQPMeta: function () { - this._bucketCache.stash('route-meta', this.fullRouteName, this.get('_qp')); - }, - - /** @private @property _qp */ _qp: _emberMetal.computed(function () { var _this = this; @@ -26095,19 +27860,19 @@ if (!route) { return {}; } - var transition = this.router.router.activeTransition; - var state = transition ? transition.state : this.router.router.state; + var transition = this.router._routerMicrolib.activeTransition; + var state = transition ? transition.state : this.router._routerMicrolib.state; var fullName = route.fullRouteName; var params = _emberUtils.assign({}, state.params[fullName]); var queryParams = getQueryParamsFor(route, state); return Object.keys(queryParams).reduce(function (params, key) { - _emberMetal.assert('The route \'' + _this2.routeName + '\' has both a dynamic segment and query param with name \'' + key + '\'. Please rename one to avoid collisions.', !params[key]); + _emberDebug.assert('The route \'' + _this2.routeName + '\' has both a dynamic segment and query param with name \'' + key + '\'. Please rename one to avoid collisions.', !params[key]); params[key] = queryParams[key]; return params; }, params); }, @@ -26777,11 +28542,11 @@ attempted transition @since 1.4.0 @public */ refresh: function () { - return this.router.router.refresh(this); + return this.router._routerMicrolib.refresh(this); }, /** Transition into another route while replacing the current URL, if possible. This will replace the current history entry instead of adding a new one. @@ -26862,11 +28627,11 @@ send: function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } - if (this.router && this.router.router || !_emberMetal.isTesting()) { + if (this.router && this.router._routerMicrolib || !_emberDebug.isTesting()) { var _router; (_router = this.router).send.apply(_router, args); } else { var _name2 = args[0]; @@ -27194,19 +28959,19 @@ return { find: function (name, value) { var modelClass = owner[_container.FACTORY_FOR]('model:' + name); - _emberMetal.assert('You used the dynamic segment ' + name + '_id in your route ' + routeName + ', but ' + namespace + '.' + _emberRuntime.String.classify(name) + ' did not exist and you did not override your route\'s `model` hook.', !!modelClass); + _emberDebug.assert('You used the dynamic segment ' + name + '_id in your route ' + routeName + ', but ' + namespace + '.' + _emberRuntime.String.classify(name) + ' did not exist and you did not override your route\'s `model` hook.', !!modelClass); if (!modelClass) { return; } modelClass = modelClass.class; - _emberMetal.assert(_emberRuntime.String.classify(name) + ' has no method `find`.', typeof modelClass.find === 'function'); + _emberDebug.assert(_emberRuntime.String.classify(name) + ' has no method `find`.', typeof modelClass.find === 'function'); return modelClass.find(value); } }; }), @@ -27340,11 +29105,11 @@ controller = owner.lookup('controller:' + name); // NOTE: We're specifically checking that skipAssert is true, because according // to the old API the second parameter was model. We do not want people who // passed a model to skip the assertion. - _emberMetal.assert('The controller named \'' + name + '\' could not be found. Make sure that this route exists and has already been entered at least once. If you are accessing a controller not associated with a route, make sure the controller class is explicitly defined.', controller || _skipAssert === true); + _emberDebug.assert('The controller named \'' + name + '\' could not be found. Make sure that this route exists and has already been entered at least once. If you are accessing a controller not associated with a route, make sure the controller class is explicitly defined.', controller || _skipAssert === true); return controller; }, /** @@ -27407,18 +29172,18 @@ var name = undefined; var owner = _emberUtils.getOwner(this); // Only change the route name when there is an active transition. // Otherwise, use the passed in route name. - if (owner.routable && this.router && this.router.router.activeTransition) { + if (owner.routable && this.router && this.router._routerMicrolib.activeTransition) { name = getEngineRouteName(owner, _name); } else { name = _name; } var route = _emberUtils.getOwner(this).lookup('route:' + name); - var transition = this.router ? this.router.router.activeTransition : null; + var transition = this.router ? this.router._routerMicrolib.activeTransition : null; // If we are mid-transition, we want to try and look up // resolved parent contexts on the current transitionEvent. if (transition) { var modelLookupName = route && route.routeName || name; @@ -27563,11 +29328,11 @@ Defaults to the return value of the Route's model hook @since 1.0.0 @public */ render: function (_name, options) { - _emberMetal.assert('The name in the given arguments is undefined', arguments.length > 0 ? !_emberMetal.isNone(arguments[0]) : true); + _emberDebug.assert('The name in the given arguments is undefined', arguments.length > 0 ? !_emberMetal.isNone(arguments[0]) : true); var namePassed = typeof _name === 'string' && !!_name; var isDefaultRender = arguments.length === 0 || _emberMetal.isEmpty(arguments[0]); var name = undefined; @@ -27636,22 +29401,22 @@ } else { outletName = options.outlet; parentView = options.parentView; if (options && Object.keys(options).indexOf('outlet') !== -1 && typeof options.outlet === 'undefined') { - throw new _emberMetal.Error('You passed undefined as the outlet name.'); + throw new _emberDebug.Error('You passed undefined as the outlet name.'); } } parentView = parentView && parentView.replace(/\//g, '.'); outletName = outletName || 'main'; this._disconnectOutlet(outletName, parentView); - for (var i = 0; i < this.router.router.currentHandlerInfos.length; i++) { + for (var i = 0; i < this.router._routerMicrolib.currentHandlerInfos.length; i++) { // This non-local state munging is sadly necessary to maintain // backward compatibility with our existing semantics, which allow // any route to disconnectOutlet things originally rendered by any // other route. This should all get cut in 2.0. - this.router.router.currentHandlerInfos[i].handler._disconnectOutlet(outletName, parentView); + this.router._routerMicrolib.currentHandlerInfos[i].handler._disconnectOutlet(outletName, parentView); } }, _disconnectOutlet: function (outletName, parentView) { var parent = parentRoute(this); @@ -27702,11 +29467,11 @@ Route.reopenClass({ isRouteFactory: true }); function parentRoute(route) { - var handlerInfo = handlerInfoFor(route, route.router.router.state.handlerInfos, -1); + var handlerInfo = handlerInfoFor(route, route.router._routerMicrolib.state.handlerInfos, -1); return handlerInfo && handlerInfo.handler; } function handlerInfoFor(route, handlerInfos) { var offset = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; @@ -27750,16 +29515,16 @@ if (typeof controller === 'string') { var controllerName = controller; controller = owner.lookup('controller:' + controllerName); if (!controller) { - throw new _emberMetal.Error('You passed `controller: \'' + controllerName + '\'` into the `render` method, but no such controller could be found.'); + throw new _emberDebug.Error('You passed `controller: \'' + controllerName + '\'` into the `render` method, but no such controller could be found.'); } } if (options && Object.keys(options).indexOf('outlet') !== -1 && typeof options.outlet === 'undefined') { - throw new _emberMetal.Error('You passed undefined as the outlet name.'); + throw new _emberDebug.Error('You passed undefined as the outlet name.'); } if (options && options.model) { controller.set('model', options.model); } @@ -27779,16 +29544,18 @@ controller: controller, template: template || route._topLevelViewTemplate, ViewClass: undefined }; - _emberMetal.assert('Could not find "' + name + '" template, view, or component.', isDefaultRender || template); + _emberDebug.assert('Could not find "' + name + '" template, view, or component.', isDefaultRender || template); - var LOG_VIEW_LOOKUPS = _emberMetal.get(route.router, 'namespace.LOG_VIEW_LOOKUPS'); - if (LOG_VIEW_LOOKUPS && !template) { - _emberMetal.info('Could not find "' + name + '" template. Nothing will be rendered', { fullName: 'template:' + name }); - } + _emberDebug.runInDebug(function () { + var LOG_VIEW_LOOKUPS = _emberMetal.get(route.router, 'namespace.LOG_VIEW_LOOKUPS'); + if (LOG_VIEW_LOOKUPS && !template) { + _emberDebug.info('Could not find "' + name + '" template. Nothing will be rendered', { fullName: 'template:' + name }); + } + }); return renderOptions; } function getFullQueryParams(router, state) { @@ -27904,11 +29671,11 @@ return routeName; } exports.default = Route; }); -enifed('ember-routing/system/router', ['exports', 'ember-utils', 'ember-console', 'ember-metal', 'ember-runtime', 'ember-routing/system/route', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', 'ember-routing/system/router_state', 'container', 'router'], function (exports, _emberUtils, _emberConsole, _emberMetal, _emberRuntime, _emberRoutingSystemRoute, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _emberRoutingSystemRouter_state, _container, _router5) { +enifed('ember-routing/system/router', ['exports', 'ember-utils', 'ember-console', 'ember-metal', 'ember-debug', 'ember-runtime', 'ember-routing/system/route', 'ember-routing/system/dsl', 'ember-routing/location/api', 'ember-routing/utils', 'ember-routing/system/router_state', 'container', 'router'], function (exports, _emberUtils, _emberConsole, _emberMetal, _emberDebug, _emberRuntime, _emberRoutingSystemRoute, _emberRoutingSystemDsl, _emberRoutingLocationApi, _emberRoutingUtils, _emberRoutingSystemRouter_state, _container, _router) { 'use strict'; exports.triggerEvent = triggerEvent; function K() { @@ -27952,30 +29719,34 @@ @public */ rootURL: '/', _initRouterJs: function () { - var router = this.router = new _router5.default(); - router.triggerEvent = triggerEvent; + var _this = this; - router._triggerWillChangeContext = K; - router._triggerWillLeave = K; + var routerMicrolib = this._routerMicrolib = new _router.default(); + routerMicrolib.triggerEvent = triggerEvent; + routerMicrolib._triggerWillChangeContext = K; + routerMicrolib._triggerWillLeave = K; + var dslCallbacks = this.constructor.dslCallbacks || [K]; var dsl = this._buildDSL(); dsl.route('application', { path: '/', resetNamespace: true, overrideNameAssertion: true }, function () { for (var i = 0; i < dslCallbacks.length; i++) { dslCallbacks[i].call(this); } }); - if (_emberMetal.get(this, 'namespace.LOG_TRANSITIONS_INTERNAL')) { - router.log = _emberConsole.default.debug; - } + _emberDebug.runInDebug(function () { + if (_emberMetal.get(_this, 'namespace.LOG_TRANSITIONS_INTERNAL')) { + routerMicrolib.log = _emberConsole.default.debug; + } + }); - router.map(dsl.generate()); + routerMicrolib.map(dsl.generate()); }, _buildDSL: function () { var moduleBasedResolver = this._hasModuleBasedResolver(); var options = { @@ -27999,10 +29770,14 @@ }, init: function () { this._super.apply(this, arguments); + this.currentURL = null; + this.currentRouteName = null; + this.currentPath = null; + this._qpCache = Object.create(null); this._resetQueuedQueryParameterChanges(); this._handledErrors = _emberUtils.dictionary(null); this._engineInstances = Object.create(null); this._engineInfoByRoute = Object.create(null); @@ -28064,28 +29839,27 @@ } } }, setupRouter: function () { - var _this = this; + var _this2 = this; this._initRouterJs(); this._setupLocation(); - var router = this.router; var location = _emberMetal.get(this, 'location'); // Allow the Location class to cancel the router setup while it refreshes // the page if (_emberMetal.get(location, 'cancelRouterSetup')) { return false; } - this._setupRouter(router, location); + this._setupRouter(location); location.onUpdateURL(function (url) { - _this.handleURL(url); + _this2.handleURL(url); }); return true; }, @@ -28110,10 +29884,12 @@ @method didTransition @public @since 1.2.0 */ didTransition: function (infos) { + var _this3 = this; + updatePaths(this); this._cancelSlowTransitionTimer(); this.notifyPropertyChange('url'); @@ -28121,24 +29897,26 @@ // Put this in the runloop so url will be accurate. Seems // less surprising than didTransition being out of sync. _emberMetal.run.once(this, this.trigger, 'didTransition'); - if (_emberMetal.get(this, 'namespace').LOG_TRANSITIONS) { - _emberConsole.default.log('Transitioned into \'' + EmberRouter._routePath(infos) + '\''); - } + _emberDebug.runInDebug(function () { + if (_emberMetal.get(_this3, 'namespace').LOG_TRANSITIONS) { + _emberConsole.default.log('Transitioned into \'' + EmberRouter._routePath(infos) + '\''); + } + }); }, _setOutlets: function () { // This is triggered async during Ember.Route#willDestroy. // If the router is also being destroyed we do not want to // to create another this._toplevelView (and leak the renderer) if (this.isDestroying || this.isDestroyed) { return; } - var handlerInfos = this.router.currentHandlerInfos; + var handlerInfos = this._routerMicrolib.currentHandlerInfos; var route = undefined; var defaultParentState = undefined; var liveRoutes = null; if (!handlerInfos) { @@ -28190,26 +29968,30 @@ @method willTransition @public @since 1.11.0 */ willTransition: function (oldInfos, newInfos, transition) { + var _this4 = this; + _emberMetal.run.once(this, this.trigger, 'willTransition', transition); - if (_emberMetal.get(this, 'namespace').LOG_TRANSITIONS) { - _emberConsole.default.log('Preparing to transition from \'' + EmberRouter._routePath(oldInfos) + '\' to \'' + EmberRouter._routePath(newInfos) + '\''); - } + _emberDebug.runInDebug(function () { + if (_emberMetal.get(_this4, 'namespace').LOG_TRANSITIONS) { + _emberConsole.default.log('Preparing to transition from \'' + EmberRouter._routePath(oldInfos) + '\' to \'' + EmberRouter._routePath(newInfos) + '\''); + } + }); }, handleURL: function (url) { // Until we have an ember-idiomatic way of accessing #hashes, we need to // remove it because router.js doesn't know how to handle it. url = url.split(/#(.+)?/)[0]; return this._doURLTransition('handleURL', url); }, _doURLTransition: function (routerJsMethod, url) { - var transition = this.router[routerJsMethod](url || '/'); + var transition = this._routerMicrolib[routerJsMethod](url || '/'); didBeginTransition(transition, this); return transition; }, /** @@ -28247,30 +30029,33 @@ var targetRouteName = args.shift(); return this._doTransition(targetRouteName, args, queryParams); }, intermediateTransitionTo: function () { - var _router; + var _routerMicrolib, + _this5 = this; - (_router = this.router).intermediateTransitionTo.apply(_router, arguments); + (_routerMicrolib = this._routerMicrolib).intermediateTransitionTo.apply(_routerMicrolib, arguments); updatePaths(this); - var infos = this.router.currentHandlerInfos; - if (_emberMetal.get(this, 'namespace').LOG_TRANSITIONS) { - _emberConsole.default.log('Intermediate-transitioned into \'' + EmberRouter._routePath(infos) + '\''); - } + _emberDebug.runInDebug(function () { + var infos = _this5._routerMicrolib.currentHandlerInfos; + if (_emberMetal.get(_this5, 'namespace').LOG_TRANSITIONS) { + _emberConsole.default.log('Intermediate-transitioned into \'' + EmberRouter._routePath(infos) + '\''); + } + }); }, replaceWith: function () { return this.transitionTo.apply(this, arguments).method('replace'); }, generate: function () { - var _router2; + var _routerMicrolib2; - var url = (_router2 = this.router).generate.apply(_router2, arguments); + var url = (_routerMicrolib2 = this._routerMicrolib).generate.apply(_routerMicrolib2, arguments); return this.location.formatURL(url); }, /** Determines if the supplied route is currently active. @@ -28278,12 +30063,13 @@ @param routeName @return {Boolean} @private */ isActive: function (routeName) { - var router = this.router; - return router.isActive.apply(router, arguments); + var _routerMicrolib3; + + return (_routerMicrolib3 = this._routerMicrolib).isActive.apply(_routerMicrolib3, arguments); }, /** An alternative form of `isActive` that doesn't require manual concatenation of the arguments into a single @@ -28299,34 +30085,34 @@ isActiveIntent: function (routeName, models, queryParams) { return this.currentState.isActiveIntent(routeName, models, queryParams); }, send: function (name, context) { - var _router3; + var _routerMicrolib4; - (_router3 = this.router).trigger.apply(_router3, arguments); + (_routerMicrolib4 = this._routerMicrolib).trigger.apply(_routerMicrolib4, arguments); }, /** Does this router instance have the given route. @method hasRoute @return {Boolean} @private */ hasRoute: function (route) { - return this.router.hasRoute(route); + return this._routerMicrolib.hasRoute(route); }, /** Resets the state of the router by clearing the current route handlers and deactivating them. @private @method reset */ reset: function () { - if (this.router) { - this.router.reset(); + if (this._routerMicrolib) { + this._routerMicrolib.reset(); } }, willDestroy: function () { if (this._toplevelView) { @@ -28420,22 +30206,22 @@ } } }, _getHandlerFunction: function () { - var _this2 = this; + var _this6 = this; var seen = Object.create(null); var owner = _emberUtils.getOwner(this); return function (name) { var routeName = name; var routeOwner = owner; - var engineInfo = _this2._engineInfoByRoute[routeName]; + var engineInfo = _this6._engineInfoByRoute[routeName]; if (engineInfo) { - var engineInstance = _this2._getEngineInstance(engineInfo); + var engineInstance = _this6._getEngineInstance(engineInfo); routeOwner = engineInstance; routeName = engineInfo.localFullName; } @@ -28452,75 +30238,79 @@ if (!handler) { var DefaultRoute = routeOwner[_container.FACTORY_FOR]('route:basic').class; routeOwner.register(fullRouteName, DefaultRoute.extend()); handler = routeOwner.lookup(fullRouteName); - if (_emberMetal.get(_this2, 'namespace.LOG_ACTIVE_GENERATION')) { - _emberMetal.info('generated -> ' + fullRouteName, { fullName: fullRouteName }); - } + _emberDebug.runInDebug(function () { + if (_emberMetal.get(_this6, 'namespace.LOG_ACTIVE_GENERATION')) { + _emberDebug.info('generated -> ' + fullRouteName, { fullName: fullRouteName }); + } + }); } handler._setRouteName(routeName); - handler._populateQPMeta(); if (engineInfo && !_emberRoutingSystemRoute.hasDefaultSerialize(handler)) { throw new Error('Defining a custom serialize method on an Engine route is not supported.'); } return handler; }; }, _getSerializerFunction: function () { - var _this3 = this; + var _this7 = this; return function (name) { - var engineInfo = _this3._engineInfoByRoute[name]; + var engineInfo = _this7._engineInfoByRoute[name]; // If this is not an Engine route, we fall back to the handler for serialization if (!engineInfo) { return; } return engineInfo.serializeMethod || _emberRoutingSystemRoute.defaultSerialize; }; }, - _setupRouter: function (router, location) { + _setupRouter: function (location) { var lastURL = undefined; var emberRouter = this; + var routerMicrolib = this._routerMicrolib; - router.getHandler = this._getHandlerFunction(); - router.getSerializer = this._getSerializerFunction(); + routerMicrolib.getHandler = this._getHandlerFunction(); + routerMicrolib.getSerializer = this._getSerializerFunction(); var doUpdateURL = function () { location.setURL(lastURL); + _emberMetal.set(emberRouter, 'currentURL', lastURL); }; - router.updateURL = function (path) { + routerMicrolib.updateURL = function (path) { lastURL = path; _emberMetal.run.once(doUpdateURL); }; if (location.replaceURL) { (function () { var doReplaceURL = function () { location.replaceURL(lastURL); + _emberMetal.set(emberRouter, 'currentURL', lastURL); }; - router.replaceURL = function (path) { + routerMicrolib.replaceURL = function (path) { lastURL = path; _emberMetal.run.once(doReplaceURL); }; })(); } - router.didTransition = function (infos) { + routerMicrolib.didTransition = function (infos) { emberRouter.didTransition(infos); }; - router.willTransition = function (oldInfos, newInfos, transition) { + routerMicrolib.willTransition = function (oldInfos, newInfos, transition) { emberRouter.willTransition(oldInfos, newInfos, transition); }; }, /** @@ -28530,20 +30320,20 @@ @param {Arrray<HandlerInfo>} handlerInfos @param {Object} queryParams @return {Void} */ _serializeQueryParams: function (handlerInfos, queryParams) { - var _this4 = this; + var _this8 = this; forEachQueryParam(this, handlerInfos, queryParams, function (key, value, qp) { if (qp) { delete queryParams[key]; queryParams[qp.urlKey] = qp.route.serializeQueryParam(value, qp.urlKey, qp.type); } else if (value === undefined) { return; // We don't serialize undefined values } else { - queryParams[key] = _this4._serializeQueryParam(value, _emberRuntime.typeOf(value)); + queryParams[key] = _this8._serializeQueryParam(value, _emberRuntime.typeOf(value)); } }); }, /** @@ -28617,42 +30407,42 @@ } } }, _doTransition: function (_targetRouteName, models, _queryParams) { - var _router4; + var _routerMicrolib5; - var targetRouteName = _targetRouteName || _emberRoutingUtils.getActiveTargetName(this.router); - _emberMetal.assert('The route ' + targetRouteName + ' was not found', targetRouteName && this.router.hasRoute(targetRouteName)); + var targetRouteName = _targetRouteName || _emberRoutingUtils.getActiveTargetName(this._routerMicrolib); + _emberDebug.assert('The route ' + targetRouteName + ' was not found', targetRouteName && this._routerMicrolib.hasRoute(targetRouteName)); var queryParams = {}; this._processActiveTransitionQueryParams(targetRouteName, models, queryParams, _queryParams); _emberUtils.assign(queryParams, _queryParams); this._prepareQueryParams(targetRouteName, models, queryParams); var transitionArgs = _emberRoutingUtils.routeArgs(targetRouteName, models, queryParams); - var transition = (_router4 = this.router).transitionTo.apply(_router4, transitionArgs); + var transition = (_routerMicrolib5 = this._routerMicrolib).transitionTo.apply(_routerMicrolib5, transitionArgs); didBeginTransition(transition, this); return transition; }, _processActiveTransitionQueryParams: function (targetRouteName, models, queryParams, _queryParams) { // merge in any queryParams from the active transition which could include // queryParams from the url on initial load. - if (!this.router.activeTransition) { + if (!this._routerMicrolib.activeTransition) { return; } var unchangedQPs = {}; var qpUpdates = this._qpUpdates || {}; - for (var key in this.router.activeTransition.queryParams) { + for (var key in this._routerMicrolib.activeTransition.queryParams) { if (!qpUpdates[key]) { - unchangedQPs[key] = this.router.activeTransition.queryParams[key]; + unchangedQPs[key] = this._routerMicrolib.activeTransition.queryParams[key]; } } // We need to fully scope queryParams so that we can create one object // that represents both pased in queryParams and ones that aren't changed @@ -28725,11 +30515,11 @@ var urlKey = qp.urlKey; var qpOther = qpsByUrlKey[urlKey]; if (qpOther && qpOther.controllerName !== qp.controllerName) { var otherQP = qpsByUrlKey[urlKey]; - _emberMetal.assert('You\'re not allowed to have more than one controller property map to the same query param key, but both `' + otherQP.scopedPropertyName + '` and `' + qp.scopedPropertyName + '` map to `' + urlKey + '`. You can fix this by mapping one of the controller properties to a different query param key via the `as` config option, e.g. `' + otherQP.prop + ': { as: \'other-' + otherQP.prop + '\' }`', false); + _emberDebug.assert('You\'re not allowed to have more than one controller property map to the same query param key, but both `' + otherQP.scopedPropertyName + '` and `' + qp.scopedPropertyName + '` map to `' + urlKey + '`. You can fix this by mapping one of the controller properties to a different query param key via the `as` config option, e.g. `' + otherQP.prop + ': { as: \'other-' + otherQP.prop + '\' }`', false); } qpsByUrlKey[urlKey] = qp; qps.push(qp); } @@ -28831,20 +30621,20 @@ currentState: null, targetState: null, _handleSlowTransition: function (transition, originRoute) { - if (!this.router.activeTransition) { + if (!this._routerMicrolib.activeTransition) { // Don't fire an event if we've since moved on from // the transition that put us in a loading state. return; } this.set('targetState', _emberRoutingSystemRouter_state.default.create({ emberRouter: this, - routerJs: this.router, - routerJsState: this.router.activeTransition.state + routerJs: this._routerMicrolib, + routerJsState: this._routerMicrolib.activeTransition.state })); transition.trigger(true, 'loading', transition, originRoute); }, @@ -28883,11 +30673,11 @@ var engineInstance = engineInstances[name][instanceId]; if (!engineInstance) { var owner = _emberUtils.getOwner(this); - _emberMetal.assert('You attempted to mount the engine \'' + name + '\' in your router map, but the engine can not be found.', owner.hasRegistration('engine:' + name)); + _emberDebug.assert('You attempted to mount the engine \'' + name + '\' in your router map, but the engine can not be found.', owner.hasRegistration('engine:' + name)); engineInstance = owner.buildChildEngineInstance(name, { routable: true, mountPoint: mountPoint }); @@ -29101,11 +30891,11 @@ if (!handlerInfos) { if (ignoreFailure) { return; } - throw new _emberMetal.Error('Can\'t trigger action \'' + name + '\' because your app hasn\'t finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call `.send()` on the `Transition` object passed to the `model/beforeModel/afterModel` hooks.'); + throw new _emberDebug.EmberError('Can\'t trigger action \'' + name + '\' because your app hasn\'t finished transitioning into its first route. To trigger an action on destination routes during a transition, you can call `.send()` on the `Transition` object passed to the `model/beforeModel/afterModel` hooks.'); } var eventWasHandled = false; var handlerInfo = undefined, handler = undefined; @@ -29132,17 +30922,17 @@ defaultActionHandlers[name].apply(null, args); return; } if (!eventWasHandled && !ignoreFailure) { - throw new _emberMetal.Error('Nothing handled the action \'' + name + '\'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.'); + throw new _emberDebug.EmberError('Nothing handled the action \'' + name + '\'. If you did handle the action, this error can be caused by returning true from an action handler in a controller, causing the action to bubble.'); } } function calculatePostTransitionState(emberRouter, leafRouteName, contexts) { - var routerjs = emberRouter.router; - var state = routerjs.applyIntent(leafRouteName, contexts); + var routerMicrolib = emberRouter._routerMicrolib; + var state = routerMicrolib.applyIntent(leafRouteName, contexts); var handlerInfos = state.handlerInfos; var params = state.params; for (var i = 0; i < handlerInfos.length; ++i) { var handlerInfo = handlerInfos[i]; @@ -29156,20 +30946,22 @@ } return state; } function updatePaths(router) { - var infos = router.router.currentHandlerInfos; + var infos = router._routerMicrolib.currentHandlerInfos; if (infos.length === 0) { return; } var path = EmberRouter._routePath(infos); var currentRouteName = infos[infos.length - 1].name; + var currentURL = router.get('location').getURL(); _emberMetal.set(router, 'currentPath', path); _emberMetal.set(router, 'currentRouteName', currentRouteName); + _emberMetal.set(router, 'currentURL', currentURL); var appController = _emberUtils.getOwner(router).lookup('controller:application'); if (!appController) { // appController might not exist when top-level loading/error @@ -29278,11 +31070,11 @@ }); function didBeginTransition(transition, router) { var routerState = _emberRoutingSystemRouter_state.default.create({ emberRouter: router, - routerJs: router.router, + routerJs: router._routerMicrolib, routerJsState: transition.state }); if (!router.currentState) { router.set('currentState', routerState); @@ -29349,11 +31141,11 @@ } if (target) { _emberMetal.set(target.outlets, renderOptions.outlet, myState); } else { if (renderOptions.into) { - _emberMetal.deprecate('Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated.', false, { + _emberDebug.deprecate('Rendering into a {{render}} helper that resolves to an {{outlet}} is deprecated.', false, { id: 'ember-routing.top-level-render-helper', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_rendering-into-a-render-helper-that-resolves-to-an-outlet' }); @@ -29384,11 +31176,11 @@ }; } liveRoutes.outlets.__ember_orphans__.outlets[into] = myState; _emberMetal.run.schedule('afterRender', function () { // `wasUsed` gets set by the render helper. - _emberMetal.assert('You attempted to render into \'' + into + '\' but it was not found', liveRoutes.outlets.__ember_orphans__.outlets[into].wasUsed); + _emberDebug.assert('You attempted to render into \'' + into + '\' but it was not found', liveRoutes.outlets.__ember_orphans__.outlets[into].wasUsed); }); } function representEmptyRoute(liveRoutes, defaultParentState, route) { // the route didn't render anything @@ -29411,10 +31203,16 @@ }; return defaultParentState; } } + _emberMetal.deprecateProperty(EmberRouter.prototype, 'router', '_routerMicrolib', { + id: 'ember-router.router', + until: '2.16', + url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-router-router-renamed-to-ember-router-_routerMicrolib' + }); + exports.default = EmberRouter; }); /** @module ember @@ -29461,11 +31259,11 @@ } } return true; } }); -enifed('ember-routing/utils', ['exports', 'ember-utils', 'ember-metal'], function (exports, _emberUtils, _emberMetal) { +enifed('ember-routing/utils', ['exports', 'ember-utils', 'ember-metal', 'ember-debug'], function (exports, _emberUtils, _emberMetal, _emberDebug) { 'use strict'; exports.routeArgs = routeArgs; exports.getActiveTargetName = getActiveTargetName; exports.stashParamNames = stashParamNames; @@ -29498,11 +31296,11 @@ // This helper exists because router.js/route-recognizer.js awkwardly // keeps separate a handlerInfo's list of parameter names depending // on whether a URL transition or named transition is happening. // Hopefully we can remove this in the future. var targetRouteName = handlerInfos[handlerInfos.length - 1].name; - var recogHandlers = router.router.recognizer.handlersFor(targetRouteName); + var recogHandlers = router._routerMicrolib.recognizer.handlersFor(targetRouteName); var dynamicParent = null; for (var i = 0; i < handlerInfos.length; ++i) { var handlerInfo = handlerInfos[i]; var names = recogHandlers[i].names; @@ -29659,11 +31457,11 @@ var prefix = owner.mountPoint; // only alter the routeName if it's actually referencing a route. if (owner.routable && typeof routeName === 'string') { if (resemblesURL(routeName)) { - throw new _emberMetal.Error('Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.'); + throw new _emberDebug.Error('Programmatic transitions by URL cannot be used within an Engine. Please use the route name instead.'); } else { routeName = prefix + '.' + routeName; args[0] = routeName; } } @@ -29816,11 +31614,11 @@ default: return 0; } } }); -enifed('ember-runtime/computed/computed_macros', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/computed/computed_macros', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { 'use strict'; exports.empty = empty; exports.notEmpty = notEmpty; exports.none = none; @@ -29848,11 +31646,11 @@ expandedProperties.push(entry); } for (var i = 0; i < properties.length; i++) { var property = properties[i]; - _emberMetal.assert('Dependent keys passed to Ember.computed.' + predicateName + '() can\'t have spaces.', property.indexOf(' ') < 0); + _emberDebug.assert('Dependent keys passed to Ember.computed.' + predicateName + '() can\'t have spaces.', property.indexOf(' ') < 0); _emberMetal.expandProperties(property, extractProperty); } return expandedProperties; @@ -30495,22 +32293,22 @@ */ function deprecatingAlias(dependentKey, options) { return _emberMetal.computed(dependentKey, { get: function (key) { - _emberMetal.deprecate('Usage of `' + key + '` is deprecated, use `' + dependentKey + '` instead.', false, options); + _emberDebug.deprecate('Usage of `' + key + '` is deprecated, use `' + dependentKey + '` instead.', false, options); return _emberMetal.get(this, dependentKey); }, set: function (key, value) { - _emberMetal.deprecate('Usage of `' + key + '` is deprecated, use `' + dependentKey + '` instead.', false, options); + _emberDebug.deprecate('Usage of `' + key + '` is deprecated, use `' + dependentKey + '` instead.', false, options); _emberMetal.set(this, dependentKey, value); return value; } }); } }); -enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/compare', 'ember-runtime/utils', 'ember-runtime/system/native_array'], function (exports, _emberUtils, _emberMetal, _emberRuntimeCompare, _emberRuntimeUtils, _emberRuntimeSystemNative_array) { +enifed('ember-runtime/computed/reduce_computed_macros', ['exports', 'ember-utils', 'ember-debug', 'ember-metal', 'ember-runtime/compare', 'ember-runtime/utils', 'ember-runtime/system/native_array'], function (exports, _emberUtils, _emberDebug, _emberMetal, _emberRuntimeCompare, _emberRuntimeUtils, _emberRuntimeSystemNative_array) { /** @module ember @submodule ember-runtime */ @@ -30763,11 +32561,11 @@ @return {Ember.ComputedProperty} an array mapped to the specified key @public */ function mapBy(dependentKey, propertyKey) { - _emberMetal.assert('Ember.computed.mapBy expects a property string for its second argument, ' + 'perhaps you meant to use "map"', typeof propertyKey === 'string'); + _emberDebug.assert('Ember.computed.mapBy expects a property string for its second argument, ' + 'perhaps you meant to use "map"', typeof propertyKey === 'string'); return map(dependentKey + '.@each.' + propertyKey, function (item) { return _emberMetal.get(item, propertyKey); }); } @@ -30800,10 +32598,32 @@ }); hamster.get('remainingChores'); // [{name: 'write more unit tests', done: false}] ``` + You can also use `@each.property` in your dependent key, the callback will still use the underlying array: + + ```javascript + let Hamster = Ember.Object.extend({ + remainingChores: Ember.computed.filter('chores.@each.done', function(chore, index, array) { + return !chore.get('done'); + }) + }); + + let hamster = Hamster.create({ + chores: Ember.A([ + Ember.Object.create({ name: 'cook', done: true }), + Ember.Object.create({ name: 'clean', done: true }), + Ember.Object.create({ name: 'write more unit tests', done: false }) + ]) + }); + hamster.get('remainingChores'); // [{name: 'write more unit tests', done: false}] + hamster.get('chores').objectAt(2).set('done', true); + hamster.get('remainingChores'); // [] + ``` + + @method filter @for Ember.computed @param {String} dependentKey @param {Function} callback @return {Ember.ComputedProperty} the filtered array @@ -30963,12 +32783,38 @@ return uniq; }).readOnly(); } /** - Alias for [Ember.computed.uniq](/api/#method_computed_uniq). + A computed property which returns a new array with all the unique + elements from one or more dependent arrays. + Example + + ```javascript + let Hamster = Ember.Object.extend({ + uniqueFruits: Ember.computed.union('fruits', 'vegetables') + }); + + let hamster = Hamster.create({ + fruits: [ + 'banana', + 'grape', + 'kale', + 'banana', + 'tomato' + ], + vegetables: [ + 'tomato', + 'carrot', + 'lettuce' + ] + }); + + hamster.get('uniqueFruits'); // ['banana', 'grape', 'kale', 'tomato', 'carrot', 'lettuce'] + ``` + @method union @for Ember.computed @param {String} propertyKey* @return {Ember.ComputedProperty} computes a new array with all the unique elements from the dependent array @@ -30976,12 +32822,12 @@ */ var union = uniq; exports.union = union; /** - A computed property which returns a new array with all the duplicated - elements from two or more dependent arrays. + A computed property which returns a new array with all the elements + two or more dependent arrays have in common. Example ```javascript let obj = Ember.Object.extend({ @@ -31072,11 +32918,11 @@ @public */ function setDiff(setAProperty, setBProperty) { if (arguments.length !== 2) { - throw new _emberMetal.Error('setDiff requires exactly two dependent arrays.'); + throw new _emberDebug.Error('setDiff requires exactly two dependent arrays.'); } return _emberMetal.computed(setAProperty + '.[]', setBProperty + '.[]', function () { var setA = this.get(setAProperty); var setB = this.get(setBProperty); @@ -31207,11 +33053,11 @@ on the sort property array or callback function @public */ function sort(itemsKey, sortDefinition) { - _emberMetal.assert('Ember.computed.sort requires two arguments: an array key to sort and ' + 'either a sort properties key or sort function', arguments.length === 2); + _emberDebug.assert('Ember.computed.sort requires two arguments: an array key to sort and ' + 'either a sort properties key or sort function', arguments.length === 2); if (typeof sortDefinition === 'function') { return customSort(itemsKey, sortDefinition); } else { return propertySort(itemsKey, sortDefinition); @@ -31235,11 +33081,11 @@ var _this5 = this; var itemsKeyIsAtThis = itemsKey === '@this'; var sortProperties = _emberMetal.get(this, sortPropertiesKey); - _emberMetal.assert('The sort definition for \'' + key + '\' on ' + this + ' must be a function or an array of strings', _emberRuntimeUtils.isArray(sortProperties) && sortProperties.every(function (s) { + _emberDebug.assert('The sort definition for \'' + key + '\' on ' + this + ' must be a function or an array of strings', _emberRuntimeUtils.isArray(sortProperties) && sortProperties.every(function (s) { return typeof s === 'string'; })); var normalizedSortProperties = normalizeSortProperties(sortProperties); @@ -31311,11 +33157,11 @@ return 0; })); } }); -enifed('ember-runtime/controllers/controller', ['exports', 'ember-metal', 'ember-runtime/system/object', 'ember-runtime/mixins/controller', 'ember-runtime/inject', 'ember-runtime/mixins/action_handler'], function (exports, _emberMetal, _emberRuntimeSystemObject, _emberRuntimeMixinsController, _emberRuntimeInject, _emberRuntimeMixinsAction_handler) { +enifed('ember-runtime/controllers/controller', ['exports', 'ember-debug', 'ember-runtime/system/object', 'ember-runtime/mixins/controller', 'ember-runtime/inject', 'ember-runtime/mixins/action_handler'], function (exports, _emberDebug, _emberRuntimeSystemObject, _emberRuntimeMixinsController, _emberRuntimeInject, _emberRuntimeMixinsAction_handler) { 'use strict'; /** @module ember @submodule ember-runtime @@ -31331,11 +33177,11 @@ var Controller = _emberRuntimeSystemObject.default.extend(_emberRuntimeMixinsController.default); _emberRuntimeMixinsAction_handler.deprecateUnderscoreActions(Controller); function controllerInjectionHelper(factory) { - _emberMetal.assert('Defining an injected controller property on a ' + 'non-controller is not allowed.', _emberRuntimeMixinsController.default.detect(factory.PrototypeMixin)); + _emberDebug.assert('Defining an injected controller property on a ' + 'non-controller is not allowed.', _emberRuntimeMixinsController.default.detect(factory.PrototypeMixin)); } /** Creates a property that lazily looks up another controller in the container. Can only be used when defining another controller. @@ -31369,11 +33215,11 @@ */ _emberRuntimeInject.createInjectionHelper('controller', controllerInjectionHelper); exports.default = Controller; }); -enifed('ember-runtime/copy', ['exports', 'ember-metal', 'ember-runtime/system/object', 'ember-runtime/mixins/copyable'], function (exports, _emberMetal, _emberRuntimeSystemObject, _emberRuntimeMixinsCopyable) { +enifed('ember-runtime/copy', ['exports', 'ember-debug', 'ember-runtime/system/object', 'ember-runtime/mixins/copyable'], function (exports, _emberDebug, _emberRuntimeSystemObject, _emberRuntimeMixinsCopyable) { 'use strict'; exports.default = copy; function _copy(obj, deep, seen, copies) { @@ -31389,11 +33235,11 @@ // avoid cyclical loops if (deep && (loc = seen.indexOf(obj)) >= 0) { return copies[loc]; } - _emberMetal.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof _emberRuntimeSystemObject.default) || _emberRuntimeMixinsCopyable.default && _emberRuntimeMixinsCopyable.default.detect(obj)); + _emberDebug.assert('Cannot clone an Ember.Object that does not implement Ember.Copyable', !(obj instanceof _emberRuntimeSystemObject.default) || _emberRuntimeMixinsCopyable.default && _emberRuntimeMixinsCopyable.default.detect(obj)); // IMPORTANT: this specific test will detect a native array only. Any other // object will need to implement Copyable. if (Array.isArray(obj)) { ret = obj.slice(); @@ -31466,11 +33312,11 @@ } return _copy(obj, deep, deep ? [] : null, deep ? [] : null); } }); -enifed('ember-runtime/ext/function', ['exports', 'ember-environment', 'ember-metal'], function (exports, _emberEnvironment, _emberMetal) { +enifed('ember-runtime/ext/function', ['exports', 'ember-environment', 'ember-metal', 'ember-debug'], function (exports, _emberEnvironment, _emberMetal, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -31561,11 +33407,11 @@ args.push(this); return _emberMetal.observer.apply(this, args); }; FunctionPrototype._observesImmediately = function () { - _emberMetal.assert('Immediate observers must observe internal properties only, ' + 'not properties on other objects.', function checkIsInternalProperty() { + _emberDebug.assert('Immediate observers must observe internal properties only, ' + 'not properties on other objects.', function checkIsInternalProperty() { for (var i = 0; i < arguments.length; i++) { if (arguments[i].indexOf('.') !== -1) { return false; } } @@ -31595,11 +33441,11 @@ @method observesImmediately @for Function @deprecated @private */ - FunctionPrototype.observesImmediately = _emberMetal.deprecateFunc('Function#observesImmediately is deprecated. Use Function#observes instead', { id: 'ember-runtime.ext-function', until: '3.0.0' }, FunctionPrototype._observesImmediately); + FunctionPrototype.observesImmediately = _emberDebug.deprecateFunc('Function#observesImmediately is deprecated. Use Function#observes instead', { id: 'ember-runtime.ext-function', until: '3.0.0' }, FunctionPrototype._observesImmediately); /** The `on` extension of Javascript's Function prototype is available when `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Function` is true, which is the default. @@ -31623,11 +33469,11 @@ return this; }; } }); -enifed('ember-runtime/ext/rsvp', ['exports', 'rsvp', 'ember-metal'], function (exports, _rsvp, _emberMetal) { +enifed('ember-runtime/ext/rsvp', ['exports', 'rsvp', 'ember-metal', 'ember-debug'], function (exports, _rsvp, _emberMetal, _emberDebug) { 'use strict'; exports.onerrorDefault = onerrorDefault; var backburner = _emberMetal.run.backburner; @@ -31656,11 +33502,11 @@ if (reason.errorThrown) { return unwrapErrorThrown(reason); } if (reason.name === 'UnrecognizedURLError') { - _emberMetal.assert('The URL \'' + reason.message + '\' did not match any routes in your application', false); + _emberDebug.assert('The URL \'' + reason.message + '\' did not match any routes in your application', false); return; } if (reason.name === 'TransitionAborted') { return; @@ -31884,11 +33730,11 @@ exports.getStrings = _emberRuntimeString_registry.getStrings; exports.setStrings = _emberRuntimeString_registry.setStrings; }); // just for side effect of extending String.prototype // just for side effect of extending Function.prototype -enifed('ember-runtime/inject', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/inject', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { 'use strict'; exports.default = inject; exports.createInjectionHelper = createInjectionHelper; exports.validatePropertyInjections = validatePropertyInjections; @@ -31901,11 +33747,11 @@ @static @public */ function inject() { - _emberMetal.assert('Injected properties must be created through helpers, see \'' + Object.keys(inject).join('"', '"') + '\''); + _emberDebug.assert('Injected properties must be created through helpers, see \'' + Object.keys(inject).join('"', '"') + '\''); } // Dictionary of injection validations by type, added to by `createInjectionHelper` var typeValidators = {}; @@ -32018,11 +33864,11 @@ } return a === b; } }); -enifed('ember-runtime/mixins/-proxy', ['exports', 'glimmer-reference', 'ember-metal', 'ember-runtime/computed/computed_macros'], function (exports, _glimmerReference, _emberMetal, _emberRuntimeComputedComputed_macros) { +enifed('ember-runtime/mixins/-proxy', ['exports', '@glimmer/reference', 'ember-metal', 'ember-debug', 'ember-runtime/computed/computed_macros'], function (exports, _glimmerReference, _emberMetal, _emberDebug, _emberRuntimeComputedComputed_macros) { /** @module ember @submodule ember-runtime */ @@ -32102,11 +33948,11 @@ _initializeTag: _emberMetal.on('init', function () { _emberMetal.meta(this)._tag = new ProxyTag(this); }), _contentDidChange: _emberMetal.observer('content', function () { - _emberMetal.assert('Can\'t set Proxy\'s content to itself', _emberMetal.get(this, 'content') !== this); + _emberDebug.assert('Can\'t set Proxy\'s content to itself', _emberMetal.get(this, 'content') !== this); _emberMetal.tagFor(this).contentDidChange(); }), isTruthy: _emberRuntimeComputedComputed_macros.bool('content'), @@ -32125,11 +33971,11 @@ }, unknownProperty: function (key) { var content = _emberMetal.get(this, 'content'); if (content) { - _emberMetal.deprecate('You attempted to access `' + key + '` from `' + this + '`, but object proxying is deprecated. Please use `model.' + key + '` instead.', !this.isController, { id: 'ember-runtime.controller-proxy', until: '3.0.0' }); + _emberDebug.deprecate('You attempted to access `' + key + '` from `' + this + '`, but object proxying is deprecated. Please use `model.' + key + '` instead.', !this.isController, { id: 'ember-runtime.controller-proxy', until: '3.0.0' }); return _emberMetal.get(content, key); } }, setUnknownProperty: function (key, value) { @@ -32140,18 +33986,18 @@ _emberMetal.defineProperty(this, key, null, value); return value; } var content = _emberMetal.get(this, 'content'); - _emberMetal.assert('Cannot delegate set(\'' + key + '\', ' + value + ') to the \'content\' property of object proxy ' + this + ': its \'content\' is undefined.', content); + _emberDebug.assert('Cannot delegate set(\'' + key + '\', ' + value + ') to the \'content\' property of object proxy ' + this + ': its \'content\' is undefined.', content); - _emberMetal.deprecate('You attempted to set `' + key + '` from `' + this + '`, but object proxying is deprecated. Please use `model.' + key + '` instead.', !this.isController, { id: 'ember-runtime.controller-proxy', until: '3.0.0' }); + _emberDebug.deprecate('You attempted to set `' + key + '` from `' + this + '`, but object proxying is deprecated. Please use `model.' + key + '` instead.', !this.isController, { id: 'ember-runtime.controller-proxy', until: '3.0.0' }); return _emberMetal.set(content, key, value); } }); }); -enifed('ember-runtime/mixins/action_handler', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/mixins/action_handler', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -32312,20 +34158,20 @@ } } var target = _emberMetal.get(this, 'target'); if (target) { - _emberMetal.assert('The `target` for ' + this + ' (' + target + ') does not have a `send` method', typeof target.send === 'function'); + _emberDebug.assert('The `target` for ' + this + ' (' + target + ') does not have a `send` method', typeof target.send === 'function'); target.send.apply(target, arguments); } }, willMergeMixin: function (props) { - _emberMetal.assert('Specifying `_actions` and `actions` in the same mixin is not supported.', !props.actions || !props._actions); + _emberDebug.assert('Specifying `_actions` and `actions` in the same mixin is not supported.', !props.actions || !props._actions); if (props._actions) { - _emberMetal.deprecate('Specifying actions in `_actions` is deprecated, please use `actions` instead.', false, { id: 'ember-runtime.action-handler-_actions', until: '3.0.0' }); + _emberDebug.deprecate('Specifying actions in `_actions` is deprecated, please use `actions` instead.', false, { id: 'ember-runtime.action-handler-_actions', until: '3.0.0' }); props.actions = props._actions; delete props._actions; } } @@ -32336,20 +34182,20 @@ function deprecateUnderscoreActions(factory) { Object.defineProperty(factory.prototype, '_actions', { configurable: true, enumerable: false, set: function (value) { - _emberMetal.assert('You cannot set `_actions` on ' + this + ', please use `actions` instead.'); + _emberDebug.assert('You cannot set `_actions` on ' + this + ', please use `actions` instead.'); }, get: function () { - _emberMetal.deprecate('Usage of `_actions` is deprecated, use `actions` instead.', false, { id: 'ember-runtime.action-handler-_actions', until: '3.0.0' }); + _emberDebug.deprecate('Usage of `_actions` is deprecated, use `actions` instead.', false, { id: 'ember-runtime.action-handler-_actions', until: '3.0.0' }); return _emberMetal.get(this, 'actions'); } }); } }); -enifed('ember-runtime/mixins/array', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/mixins/enumerable', 'ember-runtime/system/each_proxy'], function (exports, _emberUtils, _emberMetal, _emberRuntimeMixinsEnumerable, _emberRuntimeSystemEach_proxy) { +enifed('ember-runtime/mixins/array', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-runtime/mixins/enumerable', 'ember-runtime/system/each_proxy'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberRuntimeMixinsEnumerable, _emberRuntimeSystemEach_proxy) { /** @module ember @submodule ember-runtime */ @@ -32564,11 +34410,11 @@ }), _Mixin$create.firstObject = _emberMetal.computed(function () { return objectAt(this, 0); }).readOnly(), _Mixin$create.lastObject = _emberMetal.computed(function () { return objectAt(this, _emberMetal.get(this, 'length') - 1); }).readOnly(), _Mixin$create.contains = function (obj) { - _emberMetal.deprecate('`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.', false, { id: 'ember-runtime.enumerable-contains', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_enumerable-contains' }); + _emberDebug.deprecate('`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.', false, { id: 'ember-runtime.enumerable-contains', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_enumerable-contains' }); return this.indexOf(obj) >= 0; }, _Mixin$create.slice = function (beginIndex, endIndex) { var ret = _emberMetal.default.A(); var length = _emberMetal.get(this, 'length'); @@ -32945,11 +34791,11 @@ @private */ compare: null }); }); -enifed('ember-runtime/mixins/container_proxy', ['exports', 'ember-metal', 'container'], function (exports, _emberMetal, _container) { +enifed('ember-runtime/mixins/container_proxy', ['exports', 'ember-metal', 'container', 'ember-debug'], function (exports, _emberMetal, _container, _emberDebug) { /** @module ember @submodule ember-runtime */ 'use strict'; @@ -33153,11 +34999,11 @@ */ content: _emberMetal.alias('model') }); }); -enifed('ember-runtime/mixins/controller_content_model_alias_deprecation', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/mixins/controller_content_model_alias_deprecation', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { 'use strict'; /* The ControllerContentModelAliasDeprecation mixin is used to provide a useful deprecation warning when specifying `content` directly on a `Ember.Controller` @@ -33191,16 +35037,16 @@ if (props.content && !modelSpecified) { props.model = props.content; delete props['content']; - _emberMetal.deprecate('Do not specify `content` on a Controller, use `model` instead.', false, { id: 'ember-runtime.will-merge-mixin', until: '3.0.0' }); + _emberDebug.deprecate('Do not specify `content` on a Controller, use `model` instead.', false, { id: 'ember-runtime.will-merge-mixin', until: '3.0.0' }); } } }); }); -enifed('ember-runtime/mixins/copyable', ['exports', 'ember-metal', 'ember-runtime/mixins/freezable'], function (exports, _emberMetal, _emberRuntimeMixinsFreezable) { +enifed('ember-runtime/mixins/copyable', ['exports', 'ember-metal', 'ember-debug', 'ember-runtime/mixins/freezable'], function (exports, _emberMetal, _emberDebug, _emberRuntimeMixinsFreezable) { /** @module ember @submodule ember-runtime */ @@ -33246,20 +35092,20 @@ @return {Object} copy of receiver or receiver @deprecated Use `Object.freeze` instead. @private */ frozenCopy: function () { - _emberMetal.deprecate('`frozenCopy` is deprecated, use `Object.freeze` instead.', false, { id: 'ember-runtime.frozen-copy', until: '3.0.0' }); + _emberDebug.deprecate('`frozenCopy` is deprecated, use `Object.freeze` instead.', false, { id: 'ember-runtime.frozen-copy', until: '3.0.0' }); if (_emberRuntimeMixinsFreezable.Freezable && _emberRuntimeMixinsFreezable.Freezable.detect(this)) { return _emberMetal.get(this, 'isFrozen') ? this : this.copy().freeze(); } else { - throw new _emberMetal.Error(this + ' does not support freezing'); + throw new _emberDebug.Error(this + ' does not support freezing'); } } }); }); -enifed('ember-runtime/mixins/enumerable', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/compare', 'require'], function (exports, _emberUtils, _emberMetal, _emberRuntimeCompare, _require) { +enifed('ember-runtime/mixins/enumerable', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-runtime/compare', 'require'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberRuntimeCompare, _require) { /** @module ember @submodule ember-runtime */ @@ -33452,11 +35298,11 @@ @param {Object} obj The object to search for. @return {Boolean} `true` if object is found in enumerable. @public */ contains: function (obj) { - _emberMetal.deprecate('`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.', false, { id: 'ember-runtime.enumerable-contains', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_enumerable-contains' }); + _emberDebug.deprecate('`Enumerable#contains` is deprecated, use `Enumerable#includes` instead.', false, { id: 'ember-runtime.enumerable-contains', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_enumerable-contains' }); var found = this.find(function (item) { return item === obj; }); @@ -34281,11 +36127,11 @@ @param {Object} obj The object to search for. @return {Boolean} `true` if object is found in the enumerable. @public */ includes: function (obj) { - _emberMetal.assert('Enumerable#includes cannot accept a second argument "startAt" as enumerable items are unordered.', arguments.length === 1); + _emberDebug.assert('Enumerable#includes cannot accept a second argument "startAt" as enumerable items are unordered.', arguments.length === 1); var len = _emberMetal.get(this, 'length'); var idx = undefined, next = undefined; var last = null; @@ -34451,11 +36297,11 @@ has: function (name) { return _emberMetal.hasListeners(this, name); } }); }); -enifed('ember-runtime/mixins/freezable', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/mixins/freezable', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -34520,11 +36366,11 @@ @private */ var Freezable = _emberMetal.Mixin.create({ init: function () { - _emberMetal.deprecate('`Ember.Freezable` is deprecated, use `Object.freeze` instead.', false, { id: 'ember-runtime.freezable-init', until: '3.0.0' }); + _emberDebug.deprecate('`Ember.Freezable` is deprecated, use `Object.freeze` instead.', false, { id: 'ember-runtime.freezable-init', until: '3.0.0' }); this._super.apply(this, arguments); }, /** Set to `true` when the object is frozen. Use this property to detect @@ -34555,11 +36401,11 @@ exports.Freezable = Freezable; var FROZEN_ERROR = 'Frozen object cannot be modified.'; exports.FROZEN_ERROR = FROZEN_ERROR; }); -enifed('ember-runtime/mixins/mutable_array', ['exports', 'ember-metal', 'ember-runtime/mixins/array', 'ember-runtime/mixins/mutable_enumerable', 'ember-runtime/mixins/enumerable'], function (exports, _emberMetal, _emberRuntimeMixinsArray, _emberRuntimeMixinsMutable_enumerable, _emberRuntimeMixinsEnumerable) { +enifed('ember-runtime/mixins/mutable_array', ['exports', 'ember-metal', 'ember-runtime/mixins/array', 'ember-runtime/mixins/mutable_enumerable', 'ember-runtime/mixins/enumerable', 'ember-debug'], function (exports, _emberMetal, _emberRuntimeMixinsArray, _emberRuntimeMixinsMutable_enumerable, _emberRuntimeMixinsEnumerable, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -34574,11 +36420,11 @@ // function removeAt(array, start, len) { if ('number' === typeof start) { if (start < 0 || start >= _emberMetal.get(array, 'length')) { - throw new _emberMetal.Error(OUT_OF_RANGE_EXCEPTION); + throw new _emberDebug.Error(OUT_OF_RANGE_EXCEPTION); } // fast case if (len === undefined) { len = 1; @@ -34666,11 +36512,11 @@ @return {Ember.Array} receiver @public */ insertAt: function (idx, object) { if (idx > _emberMetal.get(this, 'length')) { - throw new _emberMetal.Error(OUT_OF_RANGE_EXCEPTION); + throw new _emberDebug.Error(OUT_OF_RANGE_EXCEPTION); } this.replace(idx, 0, [object]); return this; }, @@ -35021,11 +36867,11 @@ _emberMetal.endPropertyChanges(this); return this; } }); }); -enifed('ember-runtime/mixins/observable', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/mixins/observable', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -35402,11 +37248,11 @@ */ incrementProperty: function (keyName, increment) { if (_emberMetal.isNone(increment)) { increment = 1; } - _emberMetal.assert('Must pass a numeric value to incrementProperty', !isNaN(parseFloat(increment)) && isFinite(increment)); + _emberDebug.assert('Must pass a numeric value to incrementProperty', !isNaN(parseFloat(increment)) && isFinite(increment)); return _emberMetal.set(this, keyName, (parseFloat(_emberMetal.get(this, keyName)) || 0) + increment); }, /** Set the value of a property to the current value minus some amount. @@ -35422,11 +37268,11 @@ */ decrementProperty: function (keyName, decrement) { if (_emberMetal.isNone(decrement)) { decrement = 1; } - _emberMetal.assert('Must pass a numeric value to decrementProperty', !isNaN(parseFloat(decrement)) && isFinite(decrement)); + _emberDebug.assert('Must pass a numeric value to decrementProperty', !isNaN(parseFloat(decrement)) && isFinite(decrement)); return _emberMetal.set(this, keyName, (_emberMetal.get(this, keyName) || 0) - decrement); }, /** Set the value of a boolean property to the opposite of its @@ -35461,11 +37307,11 @@ observersForKey: function (keyName) { return _emberMetal.observersFor(this, keyName); } }); }); -enifed('ember-runtime/mixins/promise_proxy', ['exports', 'ember-metal', 'ember-runtime/computed/computed_macros'], function (exports, _emberMetal, _emberRuntimeComputedComputed_macros) { +enifed('ember-runtime/mixins/promise_proxy', ['exports', 'ember-metal', 'ember-debug', 'ember-runtime/computed/computed_macros'], function (exports, _emberMetal, _emberDebug, _emberRuntimeComputedComputed_macros) { 'use strict'; /** @module ember @submodule ember-runtime @@ -35609,11 +37455,11 @@ @property promise @public */ promise: _emberMetal.computed({ get: function () { - throw new _emberMetal.Error('PromiseProxy\'s promise must be set'); + throw new _emberDebug.Error('PromiseProxy\'s promise must be set'); }, set: function (key, promise) { return tap(this, promise); } }), @@ -35657,11 +37503,11 @@ var promise = _emberMetal.get(this, 'promise'); return promise[name].apply(promise, arguments); }; } }); -enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-runtime/mixins/registry_proxy', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -35902,20 +37748,20 @@ return fakeRegistry; } function buildFakeRegistryFunction(instance, typeForMessage, deprecatedProperty, nonDeprecatedProperty) { return function () { - _emberMetal.deprecate('Using `' + typeForMessage + '.registry.' + deprecatedProperty + '` is deprecated. Please use `' + typeForMessage + '.' + nonDeprecatedProperty + '` instead.', false, { + _emberDebug.deprecate('Using `' + typeForMessage + '.registry.' + deprecatedProperty + '` is deprecated. Please use `' + typeForMessage + '.' + nonDeprecatedProperty + '` instead.', false, { id: 'ember-application.app-instance-registry', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-application-registry-ember-applicationinstance-registry' }); return instance[nonDeprecatedProperty].apply(instance, arguments); }; } }); -enifed('ember-runtime/mixins/target_action_support', ['exports', 'ember-environment', 'ember-metal'], function (exports, _emberEnvironment, _emberMetal) { +enifed('ember-runtime/mixins/target_action_support', ['exports', 'ember-environment', 'ember-metal', 'ember-debug'], function (exports, _emberEnvironment, _emberMetal, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -36032,11 +37878,11 @@ ret = (_target = target).send.apply(_target, args(actionContext, action)); } else { var _target2; - _emberMetal.assert('The action \'' + action + '\' did not exist on ' + target, typeof target[action] === 'function'); + _emberDebug.assert('The action \'' + action + '\' did not exist on ' + target, typeof target[action] === 'function'); ret = (_target2 = target)[action].apply(_target2, args(actionContext)); } if (ret !== false) { ret = true; @@ -36106,11 +37952,11 @@ enifed('ember-runtime/system/application', ['exports', 'ember-runtime/system/namespace'], function (exports, _emberRuntimeSystemNamespace) { 'use strict'; exports.default = _emberRuntimeSystemNamespace.default.extend(); }); -enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal', 'ember-runtime/utils', 'ember-runtime/system/object', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/enumerable', 'ember-runtime/mixins/array'], function (exports, _emberMetal, _emberRuntimeUtils, _emberRuntimeSystemObject, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsEnumerable, _emberRuntimeMixinsArray) { +enifed('ember-runtime/system/array_proxy', ['exports', 'ember-metal', 'ember-runtime/utils', 'ember-runtime/system/object', 'ember-runtime/mixins/mutable_array', 'ember-runtime/mixins/enumerable', 'ember-runtime/mixins/array', 'ember-debug'], function (exports, _emberMetal, _emberRuntimeUtils, _emberRuntimeSystemObject, _emberRuntimeMixinsMutable_array, _emberRuntimeMixinsEnumerable, _emberRuntimeMixinsArray, _emberDebug) { 'use strict'; /** @module ember @submodule ember-runtime @@ -36262,20 +38108,20 @@ @method _contentDidChange */ _contentDidChange: _emberMetal.observer('content', function () { var content = _emberMetal.get(this, 'content'); - _emberMetal.assert('Can\'t set ArrayProxy\'s content to itself', content !== this); + _emberDebug.assert('Can\'t set ArrayProxy\'s content to itself', content !== this); this._setupContent(); }), _setupContent: function () { var content = _emberMetal.get(this, 'content'); if (content) { - _emberMetal.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof content, _emberRuntimeUtils.isArray(content) || content.isDestroyed); + _emberDebug.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof content, _emberRuntimeUtils.isArray(content) || content.isDestroyed); _emberRuntimeMixinsArray.addArrayObserver(content, this, { willChange: 'contentArrayWillChange', didChange: 'contentArrayDidChange' }); @@ -36294,11 +38140,11 @@ _arrangedContentDidChange: _emberMetal.observer('arrangedContent', function () { var arrangedContent = _emberMetal.get(this, 'arrangedContent'); var len = arrangedContent ? _emberMetal.get(arrangedContent, 'length') : 0; - _emberMetal.assert('Can\'t set ArrayProxy\'s content to itself', arrangedContent !== this); + _emberDebug.assert('Can\'t set ArrayProxy\'s content to itself', arrangedContent !== this); this._setupArrangedContent(); this.arrangedContentDidChange(this); this.arrangedContentArrayDidChange(this, 0, undefined, len); @@ -36306,11 +38152,11 @@ _setupArrangedContent: function () { var arrangedContent = _emberMetal.get(this, 'arrangedContent'); if (arrangedContent) { - _emberMetal.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof arrangedContent, _emberRuntimeUtils.isArray(arrangedContent) || arrangedContent.isDestroyed); + _emberDebug.assert('ArrayProxy expects an Array or Ember.ArrayProxy, but you passed ' + typeof arrangedContent, _emberRuntimeUtils.isArray(arrangedContent) || arrangedContent.isDestroyed); _emberRuntimeMixinsArray.addArrayObserver(arrangedContent, this, { willChange: 'arrangedContentArrayWillChange', didChange: 'arrangedContentArrayDidChange' }); @@ -36341,11 +38187,11 @@ // No dependencies since Enumerable notifies length of change }), _replace: function (idx, amt, objects) { var content = _emberMetal.get(this, 'content'); - _emberMetal.assert('The content property of ' + this.constructor + ' should be set before modifying it', content); + _emberDebug.assert('The content property of ' + this.constructor + ' should be set before modifying it', content); if (content) { this.replaceContent(idx, amt, objects); } return this; @@ -36353,39 +38199,39 @@ replace: function () { if (_emberMetal.get(this, 'arrangedContent') === _emberMetal.get(this, 'content')) { this._replace.apply(this, arguments); } else { - throw new _emberMetal.Error('Using replace on an arranged ArrayProxy is not allowed.'); + throw new _emberDebug.Error('Using replace on an arranged ArrayProxy is not allowed.'); } }, _insertAt: function (idx, object) { if (idx > _emberMetal.get(this, 'content.length')) { - throw new _emberMetal.Error(OUT_OF_RANGE_EXCEPTION); + throw new _emberDebug.Error(OUT_OF_RANGE_EXCEPTION); } this._replace(idx, 0, [object]); return this; }, insertAt: function (idx, object) { if (_emberMetal.get(this, 'arrangedContent') === _emberMetal.get(this, 'content')) { return this._insertAt(idx, object); } else { - throw new _emberMetal.Error('Using insertAt on an arranged ArrayProxy is not allowed.'); + throw new _emberDebug.Error('Using insertAt on an arranged ArrayProxy is not allowed.'); } }, removeAt: function (start, len) { if ('number' === typeof start) { var content = _emberMetal.get(this, 'content'); var arrangedContent = _emberMetal.get(this, 'arrangedContent'); var indices = []; if (start < 0 || start >= _emberMetal.get(this, 'length')) { - throw new _emberMetal.Error(OUT_OF_RANGE_EXCEPTION); + throw new _emberDebug.Error(OUT_OF_RANGE_EXCEPTION); } if (len === undefined) { len = 1; } @@ -36467,22 +38313,19 @@ this._teardownArrangedContent(); this._teardownContent(); } }); }); -enifed('ember-runtime/system/core_object', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/mixins/action_handler', 'ember-runtime/inject'], function (exports, _emberUtils, _emberMetal, _emberRuntimeMixinsAction_handler, _emberRuntimeInject) { - 'no use strict'; - // Remove "use strict"; from transpiled module until - // https://bugs.webkit.org/show_bug.cgi?id=138038 is fixed - +enifed('ember-runtime/system/core_object', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/mixins/action_handler', 'ember-runtime/inject', 'ember-debug'], function (exports, _emberUtils, _emberMetal, _emberRuntimeMixinsAction_handler, _emberRuntimeInject, _emberDebug) { /** @module ember @submodule ember-runtime */ // using ember-metal/lib/main here to ensure that ember-debug is setup // if present + 'use strict'; var _Mixin$create, _ClassMixinProps; var _templateObject = babelHelpers.taggedTemplateLiteralLoose(['.'], ['.']); @@ -36527,14 +38370,14 @@ var concatenatedProperties = this.concatenatedProperties; var mergedProperties = this.mergedProperties; for (var i = 0; i < props.length; i++) { var properties = props[i]; - _emberMetal.assert('Ember.Object.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof _emberMetal.Mixin)); + _emberDebug.assert('Ember.Object.create no longer supports mixing in other ' + 'definitions, use .extend & .create separately instead.', !(properties instanceof _emberMetal.Mixin)); if (typeof properties !== 'object' && properties !== undefined) { - throw new _emberMetal.Error('Ember.Object.create only accepts objects.'); + throw new _emberDebug.Error('Ember.Object.create only accepts objects.'); } if (!properties) { continue; } @@ -36550,13 +38393,13 @@ } var possibleDesc = this[keyName]; var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined; - _emberMetal.assert('Ember.Object.create no longer supports defining computed ' + 'properties. Define computed properties using extend() or reopen() ' + 'before calling create().', !(value instanceof _emberMetal.ComputedProperty)); - _emberMetal.assert('Ember.Object.create no longer supports defining methods that call _super.', !(typeof value === 'function' && value.toString().indexOf('._super') !== -1)); - _emberMetal.assert('`actions` must be provided at extend time, not at create time, ' + 'when Ember.ActionHandler is used (i.e. views, controllers & routes).', !(keyName === 'actions' && _emberRuntimeMixinsAction_handler.default.detect(this))); + _emberDebug.assert('Ember.Object.create no longer supports defining computed ' + 'properties. Define computed properties using extend() or reopen() ' + 'before calling create().', !(value instanceof _emberMetal.ComputedProperty)); + _emberDebug.assert('Ember.Object.create no longer supports defining methods that call _super.', !(typeof value === 'function' && value.toString().indexOf('._super') !== -1)); + _emberDebug.assert('`actions` must be provided at extend time, not at create time, ' + 'when Ember.ActionHandler is used (i.e. views, controllers & routes).', !(keyName === 'actions' && _emberRuntimeMixinsAction_handler.default.detect(this))); if (concatenatedProperties && concatenatedProperties.length > 0 && concatenatedProperties.indexOf(keyName) >= 0) { var baseValue = this[keyName]; if (baseValue) { @@ -36694,11 +38537,11 @@ // prevent setting while applying mixins if (typeof value === 'object' && value !== null && value.isDescriptor) { return; } - _emberMetal.assert(('You cannot set `' + this + '.isDestroyed` directly, please use ').destroy()(_templateObject), false); + _emberDebug.assert(('You cannot set `' + this + '.isDestroyed` directly, please use ').destroy()(_templateObject), false); } }), _Mixin$create.isDestroying = _emberMetal.descriptor({ get: function () { return _emberMetal.meta(this).isSourceDestroying(); }, @@ -36707,11 +38550,11 @@ // prevent setting while applying mixins if (typeof value === 'object' && value !== null && value.isDescriptor) { return; } - _emberMetal.assert(('You cannot set `' + this + '.isDestroying` directly, please use ').destroy()(_templateObject), false); + _emberDebug.assert(('You cannot set `' + this + '.isDestroying` directly, please use ').destroy()(_templateObject), false); } }), _Mixin$create.destroy = function () { var m = _emberMetal.meta(this); if (m.isSourceDestroying()) { return; @@ -36812,11 +38655,11 @@ }, _ClassMixinProps.metaForProperty = function (key) { var proto = this.proto(); var possibleDesc = proto[key]; var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined; - _emberMetal.assert('metaForProperty() could not find a computed property with key \'' + key + '\'.', !!desc && desc instanceof _emberMetal.ComputedProperty); + _emberDebug.assert('metaForProperty() could not find a computed property with key \'' + key + '\'.', !!desc && desc instanceof _emberMetal.ComputedProperty); return desc._meta || {}; }, _ClassMixinProps._computedProperties = _emberMetal.computed(function () { hasCachedComputedProperties = true; var proto = this.proto(); var property = undefined; @@ -36844,14 +38687,14 @@ callback.call(binding || this, property.name, property.meta || empty); } }, _ClassMixinProps); function injectedPropertyAssertion() { - _emberMetal.assert('Injected properties are invalid', _emberRuntimeInject.validatePropertyInjections(this)); + _emberDebug.assert('Injected properties are invalid', _emberRuntimeInject.validatePropertyInjections(this)); } - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { /** Provides lookup-time type validation for injected properties. @private @method _onLookup */ @@ -37248,12 +39091,11 @@ alert(`Hello. My name is ${this.get('name')}`); } }); Person.reopenClass({ species: 'Homo sapiens', - - createPerson(name) { + createPerson(name) { return Person.create({ name }); } }); let tom = Person.create({ name: 'Tom Dale' @@ -37303,11 +39145,11 @@ @method eachComputedProperty @param {Function} callback @param {Object} binding @private */ -enifed('ember-runtime/system/each_proxy', ['exports', 'ember-metal', 'ember-runtime/mixins/array'], function (exports, _emberMetal, _emberRuntimeMixinsArray) { +enifed('ember-runtime/system/each_proxy', ['exports', 'ember-debug', 'ember-metal', 'ember-runtime/mixins/array'], function (exports, _emberDebug, _emberMetal, _emberRuntimeMixinsArray) { 'use strict'; exports.default = EachProxy; /** @@ -37409,11 +39251,11 @@ function addObserverForContentKey(content, keyName, proxy, idx, loc) { while (--loc >= idx) { var item = _emberRuntimeMixinsArray.objectAt(content, loc); if (item) { - _emberMetal.assert('When using @each to observe the array ' + content + ', the array must return an object', typeof item === 'object'); + _emberDebug.assert('When using @each to observe the array ' + content + ', the array must return an object', typeof item === 'object'); _emberMetal._addBeforeObserver(item, keyName, proxy, 'contentKeyWillChange'); _emberMetal.addObserver(item, keyName, proxy, 'contentKeyDidChange'); } } } @@ -37888,11 +39730,11 @@ exports.A = A; exports.NativeArray = NativeArray; exports.default = NativeArray; }); // Ember.A circular -enifed('ember-runtime/system/object', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/system/core_object', 'ember-runtime/mixins/observable'], function (exports, _emberUtils, _emberMetal, _emberRuntimeSystemCore_object, _emberRuntimeMixinsObservable) { +enifed('ember-runtime/system/object', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime/system/core_object', 'ember-runtime/mixins/observable', 'ember-debug'], function (exports, _emberUtils, _emberMetal, _emberRuntimeSystemCore_object, _emberRuntimeMixinsObservable, _emberDebug) { /** @module ember @submodule ember-runtime */ @@ -37915,11 +39757,11 @@ }; var FrameworkObject = EmberObject; exports.FrameworkObject = FrameworkObject; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { var _EmberObject$extend; var INIT_WAS_CALLED = _emberUtils.symbol('INIT_WAS_CALLED'); var ASSERT_INIT_WAS_CALLED = _emberUtils.symbol('ASSERT_INIT_WAS_CALLED'); @@ -37928,11 +39770,11 @@ this._super.apply(this, arguments); this[INIT_WAS_CALLED] = true; } }, _EmberObject$extend[ASSERT_INIT_WAS_CALLED] = _emberMetal.on('init', function () { - _emberMetal.assert('You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update ' + this + ' to call `this._super(...arguments);` from `init`.', this[INIT_WAS_CALLED]); + _emberDebug.assert('You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update ' + this + ' to call `this._super(...arguments);` from `init`.', this[INIT_WAS_CALLED]); }), _EmberObject$extend)); }); exports.default = EmberObject; }); @@ -38057,11 +39899,11 @@ isServiceFactory: true }); exports.default = Service; }); -enifed('ember-runtime/system/string', ['exports', 'ember-metal', 'ember-utils', 'ember-runtime/utils', 'ember-runtime/string_registry'], function (exports, _emberMetal, _emberUtils, _emberRuntimeUtils, _emberRuntimeString_registry) { +enifed('ember-runtime/system/string', ['exports', 'ember-metal', 'ember-debug', 'ember-utils', 'ember-runtime/utils', 'ember-runtime/string_registry'], function (exports, _emberMetal, _emberDebug, _emberUtils, _emberRuntimeUtils, _emberRuntimeString_registry) { /** @module ember @submodule ember-runtime */ 'use strict'; @@ -38143,11 +39985,11 @@ return s === null ? '(null)' : s === undefined ? '' : _emberUtils.inspect(s); }); } function fmt(str, formats) { - _emberMetal.deprecate('Ember.String.fmt is deprecated, use ES6 template strings instead.', false, { id: 'ember-string-utils.fmt', until: '3.0.0', url: 'http://babeljs.io/docs/learn-es2015/#template-strings' }); + _emberDebug.deprecate('Ember.String.fmt is deprecated, use ES6 template strings instead.', false, { id: 'ember-string-utils.fmt', until: '3.0.0', url: 'http://babeljs.io/docs/learn-es2015/#template-strings' }); return _fmt.apply(undefined, arguments); } function loc(str, formats) { if (!_emberRuntimeUtils.isArray(formats) || arguments.length > 2) { @@ -38882,16 +40724,16 @@ return fn.apply(app, [app].concat(args)); }).finally(_emberTestingTestAdapter.asyncEnd); }; } }); -enifed('ember-testing/ext/rsvp', ['exports', 'ember-runtime', 'ember-metal', 'ember-testing/test/adapter'], function (exports, _emberRuntime, _emberMetal, _emberTestingTestAdapter) { +enifed('ember-testing/ext/rsvp', ['exports', 'ember-runtime', 'ember-metal', 'ember-debug', 'ember-testing/test/adapter'], function (exports, _emberRuntime, _emberMetal, _emberDebug, _emberTestingTestAdapter) { 'use strict'; _emberRuntime.RSVP.configure('async', function (callback, promise) { // if schedule will cause autorun, we need to inform adapter - if (_emberMetal.isTesting() && !_emberMetal.run.backburner.currentInstance) { + if (_emberDebug.isTesting() && !_emberMetal.run.backburner.currentInstance) { _emberTestingTestAdapter.asyncStart(); _emberMetal.run.backburner.schedule('actions', function () { _emberTestingTestAdapter.asyncEnd(); callback(promise); }); @@ -38902,11 +40744,11 @@ } }); exports.default = _emberRuntime.RSVP; }); -enifed('ember-testing/helpers', ['exports', 'ember-metal', 'ember-testing/test/helpers', 'ember-testing/helpers/and_then', 'ember-testing/helpers/click', 'ember-testing/helpers/current_path', 'ember-testing/helpers/current_route_name', 'ember-testing/helpers/current_url', 'ember-testing/helpers/fill_in', 'ember-testing/helpers/find', 'ember-testing/helpers/find_with_assert', 'ember-testing/helpers/key_event', 'ember-testing/helpers/pause_test', 'ember-testing/helpers/trigger_event', 'ember-testing/helpers/visit', 'ember-testing/helpers/wait'], function (exports, _emberMetal, _emberTestingTestHelpers, _emberTestingHelpersAnd_then, _emberTestingHelpersClick, _emberTestingHelpersCurrent_path, _emberTestingHelpersCurrent_route_name, _emberTestingHelpersCurrent_url, _emberTestingHelpersFill_in, _emberTestingHelpersFind, _emberTestingHelpersFind_with_assert, _emberTestingHelpersKey_event, _emberTestingHelpersPause_test, _emberTestingHelpersTrigger_event, _emberTestingHelpersVisit, _emberTestingHelpersWait) { +enifed('ember-testing/helpers', ['exports', 'ember-debug', 'ember-testing/test/helpers', 'ember-testing/helpers/and_then', 'ember-testing/helpers/click', 'ember-testing/helpers/current_path', 'ember-testing/helpers/current_route_name', 'ember-testing/helpers/current_url', 'ember-testing/helpers/fill_in', 'ember-testing/helpers/find', 'ember-testing/helpers/find_with_assert', 'ember-testing/helpers/key_event', 'ember-testing/helpers/pause_test', 'ember-testing/helpers/trigger_event', 'ember-testing/helpers/visit', 'ember-testing/helpers/wait'], function (exports, _emberDebug, _emberTestingTestHelpers, _emberTestingHelpersAnd_then, _emberTestingHelpersClick, _emberTestingHelpersCurrent_path, _emberTestingHelpersCurrent_route_name, _emberTestingHelpersCurrent_url, _emberTestingHelpersFill_in, _emberTestingHelpersFind, _emberTestingHelpersFind_with_assert, _emberTestingHelpersKey_event, _emberTestingHelpersPause_test, _emberTestingHelpersTrigger_event, _emberTestingHelpersVisit, _emberTestingHelpersWait) { 'use strict'; _emberTestingTestHelpers.registerAsyncHelper('visit', _emberTestingHelpersVisit.default); _emberTestingTestHelpers.registerAsyncHelper('click', _emberTestingHelpersClick.default); _emberTestingTestHelpers.registerAsyncHelper('keyEvent', _emberTestingHelpersKey_event.default); @@ -38920,11 +40762,11 @@ _emberTestingTestHelpers.registerHelper('findWithAssert', _emberTestingHelpersFind_with_assert.default); _emberTestingTestHelpers.registerHelper('currentRouteName', _emberTestingHelpersCurrent_route_name.default); _emberTestingTestHelpers.registerHelper('currentPath', _emberTestingHelpersCurrent_path.default); _emberTestingTestHelpers.registerHelper('currentURL', _emberTestingHelpersCurrent_url.default); - if (false) { + if (true) { _emberTestingTestHelpers.registerHelper('resumeTest', _emberTestingHelpersPause_test.resumeTest); } }); enifed("ember-testing/helpers/and_then", ["exports"], function (exports) { /** @@ -39244,11 +41086,11 @@ } return app.testHelpers.triggerEvent(selector, context, type, { keyCode: keyCode, which: keyCode }); } }); -enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime', 'ember-console', 'ember-metal'], function (exports, _emberRuntime, _emberConsole, _emberMetal) { +enifed('ember-testing/helpers/pause_test', ['exports', 'ember-runtime', 'ember-console', 'ember-debug'], function (exports, _emberRuntime, _emberConsole, _emberDebug) { /** @module ember @submodule ember-testing */ 'use strict'; @@ -39265,11 +41107,11 @@ @return {void} @public */ function resumeTest() { - _emberMetal.assert('Testing has not been paused. There is nothing to resume.', resume); + _emberDebug.assert('Testing has not been paused. There is nothing to resume.', resume); resume(); resume = undefined; } /** @@ -39287,16 +41129,16 @@ @return {Object} A promise that will never resolve @public */ function pauseTest() { - if (false) { + if (true) { _emberConsole.default.info('Testing paused. Use `resumeTest()` to continue.'); } return new _emberRuntime.RSVP.Promise(function (resolve) { - if (false) { + if (true) { resume = resolve; } }, 'TestAdapter paused promise'); } }); @@ -39464,11 +41306,11 @@ var router = app.__container__.lookup('router:main'); // Every 10ms, poll for the async thing to have finished var watcher = setInterval(function () { // 1. If the router is loading, keep polling - var routerIsLoading = router.router && !!router.router.activeTransition; + var routerIsLoading = router._routerMicrolib && !!router._routerMicrolib.activeTransition; if (routerIsLoading) { return; } // 2. If there are pending Ajax requests, keep polling @@ -39528,11 +41370,11 @@ } }); } }); }); -enifed('ember-testing/setup_for_testing', ['exports', 'ember-metal', 'ember-views', 'ember-testing/test/adapter', 'ember-testing/test/pending_requests', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit'], function (exports, _emberMetal, _emberViews, _emberTestingTestAdapter, _emberTestingTestPending_requests, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit) { +enifed('ember-testing/setup_for_testing', ['exports', 'ember-debug', 'ember-views', 'ember-testing/test/adapter', 'ember-testing/test/pending_requests', 'ember-testing/adapters/adapter', 'ember-testing/adapters/qunit'], function (exports, _emberDebug, _emberViews, _emberTestingTestAdapter, _emberTestingTestPending_requests, _emberTestingAdaptersAdapter, _emberTestingAdaptersQunit) { /* global self */ 'use strict'; exports.default = setupForTesting; @@ -39549,11 +41391,11 @@ @since 1.5.0 @private */ function setupForTesting() { - _emberMetal.setTesting(true); + _emberDebug.setTesting(true); var adapter = _emberTestingTestAdapter.getAdapter(); // if adapter is not manually set default to QUnit if (!adapter) { _emberTestingTestAdapter.setAdapter(typeof self.QUnit === 'undefined' ? new _emberTestingAdaptersAdapter.default() : new _emberTestingAdaptersQunit.default()); @@ -39566,11 +41408,11 @@ _emberViews.jQuery(document).on('ajaxSend', _emberTestingTestPending_requests.incrementPendingRequests); _emberViews.jQuery(document).on('ajaxComplete', _emberTestingTestPending_requests.decrementPendingRequests); } }); -enifed('ember-testing/support', ['exports', 'ember-metal', 'ember-views', 'ember-environment'], function (exports, _emberMetal, _emberViews, _emberEnvironment) { +enifed('ember-testing/support', ['exports', 'ember-debug', 'ember-views', 'ember-environment'], function (exports, _emberDebug, _emberViews, _emberEnvironment) { 'use strict'; /** @module ember @submodule ember-testing @@ -39614,11 +41456,11 @@ } }); // Try again to verify that the patch took effect or blow up. testCheckboxClick(function () { - _emberMetal.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' }); + _emberDebug.warn('clicked checkboxes should be checked! the jQuery patch didn\'t work', this.checked, { id: 'ember-testing.test-checkbox-click' }); }); }); } }); enifed('ember-testing/test', ['exports', 'ember-testing/test/helpers', 'ember-testing/test/on_inject_helpers', 'ember-testing/test/promise', 'ember-testing/test/waiters', 'ember-testing/test/adapter'], function (exports, _emberTestingTestHelpers, _emberTestingTestOn_inject_helpers, _emberTestingTestPromise, _emberTestingTestWaiters, _emberTestingTestAdapter) { @@ -40037,11 +41879,11 @@ } else { return fn(); } } }); -enifed('ember-testing/test/waiters', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-testing/test/waiters', ['exports', 'ember-debug'], function (exports, _emberDebug) { 'use strict'; exports.registerWaiter = registerWaiter; exports.unregisterWaiter = unregisterWaiter; exports.checkWaiters = checkWaiters; @@ -40158,11 +42000,11 @@ } return -1; } function generateDeprecatedWaitersArray() { - _emberMetal.deprecate('Usage of `Ember.Test.waiters` is deprecated. Please refactor to `Ember.Test.checkWaiters`.', false, { until: '2.8.0', id: 'ember-testing.test-waiters' }); + _emberDebug.deprecate('Usage of `Ember.Test.waiters` is deprecated. Please refactor to `Ember.Test.checkWaiters`.', false, { until: '2.8.0', id: 'ember-testing.test-waiters' }); var array = new Array(callbacks.length); for (var i = 0; i < callbacks.length; i++) { var context = contexts[i]; var callback = callbacks[i]; @@ -40823,10 +42665,11 @@ exports.HAS_NATIVE_PROXY = HAS_NATIVE_PROXY; }); enifed('ember-utils/super', ['exports'], function (exports) { 'use strict'; + exports.ROOT = ROOT; exports.wrap = wrap; var HAS_SUPER_PATTERN = /\.(_super|call\(this|apply\(this)/; var fnToString = Function.prototype.toString; var checkHasSuper = (function () { @@ -40844,11 +42687,13 @@ return true; }; })(); exports.checkHasSuper = checkHasSuper; + function ROOT() {} + ROOT.__hasSuper = false; function hasSuper(func) { if (func.__hasSuper === undefined) { func.__hasSuper = checkHasSuper(func); @@ -40955,22 +42800,22 @@ enifed('ember-views/compat/fallback-view-registry', ['exports', 'ember-utils'], function (exports, _emberUtils) { 'use strict'; exports.default = _emberUtils.dictionary(null); }); -enifed('ember-views/component_lookup', ['exports', 'ember-metal', 'ember-runtime', 'container'], function (exports, _emberMetal, _emberRuntime, _container) { +enifed('ember-views/component_lookup', ['exports', 'ember-debug', 'ember-runtime', 'container'], function (exports, _emberDebug, _emberRuntime, _container) { 'use strict'; exports.default = _emberRuntime.Object.extend({ componentFor: function (name, owner, options) { - _emberMetal.assert('You cannot use \'' + name + '\' as a component name. Component names must contain a hyphen.', ~name.indexOf('-')); + _emberDebug.assert('You cannot use \'' + name + '\' as a component name. Component names must contain a hyphen.', ~name.indexOf('-')); var fullName = 'component:' + name; return owner[_container.FACTORY_FOR](fullName, options); }, layoutFor: function (name, owner, options) { - _emberMetal.assert('You cannot use \'' + name + '\' as a component name. Component names must contain a hyphen.', ~name.indexOf('-')); + _emberDebug.assert('You cannot use \'' + name + '\' as a component name. Component names must contain a hyphen.', ~name.indexOf('-')); var templateFullName = 'template:components/' + name; return owner.lookup(templateFullName, options); } }); @@ -41010,11 +42855,11 @@ exports.lookupComponent = _emberViewsUtilsLookupComponent.default; exports.ActionManager = _emberViewsSystemAction_manager.default; exports.fallbackViewRegistry = _emberViewsCompatFallbackViewRegistry.default; }); // for the side effect of extending Ember.run.queues -enifed('ember-views/mixins/action_support', ['exports', 'ember-utils', 'ember-metal', 'ember-views/compat/attrs'], function (exports, _emberUtils, _emberMetal, _emberViewsCompatAttrs) { +enifed('ember-views/mixins/action_support', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-views/compat/attrs'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberViewsCompatAttrs) { /** @module ember @submodule ember-views */ 'use strict'; @@ -41022,11 +42867,11 @@ function validateAction(component, actionName) { if (actionName && actionName[_emberViewsCompatAttrs.MUTABLE_CELL]) { actionName = actionName.value; } - _emberMetal.assert('The default action was triggered on the component ' + component.toString() + ', but the action name (' + actionName + ') was not a string.', _emberMetal.isNone(actionName) || typeof actionName === 'string' || typeof actionName === 'function'); + _emberDebug.assert('The default action was triggered on the component ' + component.toString() + ', but the action name (' + actionName + ') was not a string.', _emberMetal.isNone(actionName) || typeof actionName === 'string' || typeof actionName === 'function'); return actionName; } /** @class ActionSupport @@ -41146,14 +42991,14 @@ } } var target = _emberMetal.get(this, 'target'); if (target) { - _emberMetal.assert('The `target` for ' + this + ' (' + target + ') does not have a `send` method', typeof target.send === 'function'); + _emberDebug.assert('The `target` for ' + this + ' (' + target + ') does not have a `send` method', typeof target.send === 'function'); target.send.apply(target, arguments); } else { - _emberMetal.assert(_emberUtils.inspect(this) + ' had no action handler for: ' + actionName, action); + _emberDebug.assert(_emberUtils.inspect(this) + ' had no action handler for: ' + actionName, action); } } }); }); enifed('ember-views/mixins/child_views_support', ['exports', 'ember-utils', 'ember-metal', 'ember-views/system/utils'], function (exports, _emberUtils, _emberMetal, _emberViewsSystemUtils) { @@ -41194,11 +43039,11 @@ _emberUtils.setOwner(instance, _emberUtils.getOwner(this)); } } }); }); -enifed('ember-views/mixins/class_names_support', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-views/mixins/class_names_support', ['exports', 'ember-metal', 'ember-debug'], function (exports, _emberMetal, _emberDebug) { /** @module ember @submodule ember-views */ @@ -41215,12 +43060,12 @@ concatenatedProperties: ['classNames', 'classNameBindings'], init: function () { this._super.apply(this, arguments); - _emberMetal.assert('Only arrays are allowed for \'classNameBindings\'', Array.isArray(this.classNameBindings)); - _emberMetal.assert('Only arrays of static class strings are allowed for \'classNames\'. For dynamic classes, use \'classNameBindings\'.', Array.isArray(this.classNames)); + _emberDebug.assert('Only arrays are allowed for \'classNameBindings\'', Array.isArray(this.classNameBindings)); + _emberDebug.assert('Only arrays of static class strings are allowed for \'classNames\'. For dynamic classes, use \'classNameBindings\'.', Array.isArray(this.classNames)); }, /** Standard CSS class names to apply to the view's outer element. This property automatically inherits any class names defined by the view's @@ -41608,11 +43453,11 @@ currentState.enter(this); } } }); }); -enifed('ember-views/mixins/view_support', ['exports', 'ember-utils', 'ember-metal', 'ember-environment', 'ember-views/system/utils', 'ember-runtime/system/core_object', 'ember-views/system/jquery'], function (exports, _emberUtils, _emberMetal, _emberEnvironment, _emberViewsSystemUtils, _emberRuntimeSystemCore_object, _emberViewsSystemJquery) { +enifed('ember-views/mixins/view_support', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-environment', 'ember-views/system/utils', 'ember-runtime/system/core_object', 'ember-views/system/jquery'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberEnvironment, _emberViewsSystemUtils, _emberRuntimeSystemCore_object, _emberViewsSystemJquery) { 'use strict'; var _Mixin$create; function K() { @@ -41622,11 +43467,11 @@ var dispatchLifeCycleHook = function (component, hook, oldAttrs, newAttrs) { component.trigger(hook, { attrs: newAttrs, oldAttrs: oldAttrs, newAttrs: newAttrs }); }; exports.dispatchLifeCycleHook = dispatchLifeCycleHook; - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { var Attrs = (function () { function Attrs(oldAttrs, newAttrs, message) { babelHelpers.classCallCheck(this, Attrs); this._oldAttrs = oldAttrs; @@ -41640,22 +43485,22 @@ return this.newAttrs; } }, { key: 'oldAttrs', get: function () { - _emberMetal.deprecate(this._message, false, { + _emberDebug.deprecate(this._message, false, { id: 'ember-views.lifecycle-hook-arguments', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_arguments-in-component-lifecycle-hooks' }); return this._oldAttrs; } }, { key: 'newAttrs', get: function () { - _emberMetal.deprecate(this._message, false, { + _emberDebug.deprecate(this._message, false, { id: 'ember-views.lifecycle-hook-arguments', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_arguments-in-component-lifecycle-hooks' }); @@ -41752,24 +43597,24 @@ enumerable: false, get: function () { return this.renderer.getElement(this); } }), _Mixin$create.$ = function (sel) { - _emberMetal.assert('You cannot access this.$() on a component with `tagName: \'\'` specified.', this.tagName !== ''); + _emberDebug.assert('You cannot access this.$() on a component with `tagName: \'\'` specified.', this.tagName !== ''); if (this.element) { return sel ? _emberViewsSystemJquery.default(sel, this.element) : _emberViewsSystemJquery.default(this.element); } }, _Mixin$create.appendTo = function (selector) { var env = this._environment || _emberEnvironment.environment; var target = undefined; if (env.hasDOM) { target = typeof selector === 'string' ? document.querySelector(selector) : selector; - _emberMetal.assert('You tried to append to (' + selector + ') but that isn\'t in the DOM', target); - _emberMetal.assert('You cannot append to an existing Ember.View.', !_emberViewsSystemUtils.matches(target, '.ember-view')); - _emberMetal.assert('You cannot append to an existing Ember.View.', (function () { + _emberDebug.assert('You tried to append to (' + selector + ') but that isn\'t in the DOM', target); + _emberDebug.assert('You cannot append to an existing Ember.View.', !_emberViewsSystemUtils.matches(target, '.ember-view')); + _emberDebug.assert('You cannot append to an existing Ember.View.', (function () { var node = target.parentNode; while (node) { if (node.nodeType !== 9 && _emberViewsSystemUtils.matches(node, '.ember-view')) { return false; } @@ -41780,21 +43625,21 @@ return true; })()); } else { target = selector; - _emberMetal.assert('You tried to append to a selector string (' + selector + ') in an environment without jQuery', typeof target !== 'string'); - _emberMetal.assert('You tried to append to a non-Element (' + selector + ') in an environment without jQuery', typeof selector.appendChild === 'function'); + _emberDebug.assert('You tried to append to a selector string (' + selector + ') in an environment without jQuery', typeof target !== 'string'); + _emberDebug.assert('You tried to append to a non-Element (' + selector + ') in an environment without jQuery', typeof selector.appendChild === 'function'); } this.renderer.appendTo(this, target); return this; }, _Mixin$create.renderToElement = function () { var tagName = arguments.length <= 0 || arguments[0] === undefined ? 'body' : arguments[0]; - _emberMetal.deprecate('Using the `renderToElement` is deprecated in favor of `appendTo`. Called in ' + this.toString(), false, { + _emberDebug.deprecate('Using the `renderToElement` is deprecated in favor of `appendTo`. Called in ' + this.toString(), false, { id: 'ember-views.render-to-element', until: '2.12.0', url: 'http://emberjs.com/deprecations/v2.x#toc_code-rendertoelement-code' }); @@ -41803,12 +43648,12 @@ this.renderer.appendTo(this, element); return element; }, _Mixin$create.replaceIn = function (selector) { var target = _emberViewsSystemJquery.default(selector); - _emberMetal.assert('You tried to replace in (' + selector + ') but that isn\'t in the DOM', target.length > 0); - _emberMetal.assert('You cannot replace an existing Ember.View.', !target.is('.ember-view') && !target.parents().is('.ember-view')); + _emberDebug.assert('You tried to replace in (' + selector + ') but that isn\'t in the DOM', target.length > 0); + _emberDebug.assert('You cannot replace an existing Ember.View.', !target.is('.ember-view') && !target.parents().is('.ember-view')); this.renderer.replaceIn(this, target[0]); return this; }, _Mixin$create.append = function () { @@ -41836,35 +43681,35 @@ if (dispatcher && dispatcher.canDispatchToEventManager === null) { dispatcher.canDispatchToEventManager = true; } } - _emberMetal.deprecate('[DEPRECATED] didInitAttrs called in ' + this.toString() + '.', typeof this.didInitAttrs !== 'function', { + _emberDebug.deprecate('[DEPRECATED] didInitAttrs called in ' + this.toString() + '.', typeof this.didInitAttrs !== 'function', { id: 'ember-views.did-init-attrs', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs' }); - _emberMetal.deprecate('[DEPRECATED] Ember will stop passing arguments to component lifecycle hooks. Please change `' + this.toString() + '#didInitAttrs` to stop taking arguments.', typeof this.didInitAttrs !== 'function' || this.didInitAttrs.length === 0, { + _emberDebug.deprecate('[DEPRECATED] Ember will stop passing arguments to component lifecycle hooks. Please change `' + this.toString() + '#didInitAttrs` to stop taking arguments.', typeof this.didInitAttrs !== 'function' || this.didInitAttrs.length === 0, { id: 'ember-views.lifecycle-hook-arguments', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_arguments-in-component-lifecycle-hooks' }); - _emberMetal.deprecate('[DEPRECATED] Ember will stop passing arguments to component lifecycle hooks. Please change `' + this.toString() + '#didReceiveAttrs` to stop taking arguments.', typeof this.didReceiveAttrs !== 'function' || this.didReceiveAttrs.length === 0, { + _emberDebug.deprecate('[DEPRECATED] Ember will stop passing arguments to component lifecycle hooks. Please change `' + this.toString() + '#didReceiveAttrs` to stop taking arguments.', typeof this.didReceiveAttrs !== 'function' || this.didReceiveAttrs.length === 0, { id: 'ember-views.lifecycle-hook-arguments', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_arguments-in-component-lifecycle-hooks' }); - _emberMetal.deprecate('[DEPRECATED] Ember will stop passing arguments to component lifecycle hooks. Please change `' + this.toString() + '#didUpdateAttrs` to stop taking arguments.', typeof this.didUpdateAttrs !== 'function' || this.didUpdateAttrs.length === 0, { + _emberDebug.deprecate('[DEPRECATED] Ember will stop passing arguments to component lifecycle hooks. Please change `' + this.toString() + '#didUpdateAttrs` to stop taking arguments.', typeof this.didUpdateAttrs !== 'function' || this.didUpdateAttrs.length === 0, { id: 'ember-views.lifecycle-hook-arguments', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_arguments-in-component-lifecycle-hooks' }); - _emberMetal.assert('Using a custom `.render` function is no longer supported.', !this.render); + _emberDebug.assert('Using a custom `.render` function is no longer supported.', !this.render); }, _Mixin$create.__defineNonEnumerable = function (property) { this[property.name] = property.descriptor.value; }, _Mixin$create.handleEvent = function (eventName, evt) { return this._currentState.handleEvent(this, eventName, evt); }, _Mixin$create)); @@ -42158,11 +44003,11 @@ @property registeredActions @type Object */ ActionManager.registeredActions = {}; }); -enifed('ember-views/system/event_dispatcher', ['exports', 'ember-utils', 'ember-metal', 'ember-runtime', 'ember-views/system/jquery', 'ember-views/system/action_manager', 'ember-environment', 'ember-views/compat/fallback-view-registry'], function (exports, _emberUtils, _emberMetal, _emberRuntime, _emberViewsSystemJquery, _emberViewsSystemAction_manager, _emberEnvironment, _emberViewsCompatFallbackViewRegistry) { +enifed('ember-views/system/event_dispatcher', ['exports', 'ember-utils', 'ember-debug', 'ember-metal', 'ember-runtime', 'ember-views/system/jquery', 'ember-views/system/action_manager', 'ember-environment', 'ember-views/compat/fallback-view-registry'], function (exports, _emberUtils, _emberDebug, _emberMetal, _emberRuntime, _emberViewsSystemJquery, _emberViewsSystemAction_manager, _emberEnvironment, _emberViewsCompatFallbackViewRegistry) { /** @module ember @submodule ember-views */ @@ -42279,11 +44124,11 @@ */ canDispatchToEventManager: null, init: function () { this._super(); - _emberMetal.assert('EventDispatcher should never be instantiated in fastboot mode. Please report this as an Ember bug.', _emberEnvironment.environment.hasDOM); + _emberDebug.assert('EventDispatcher should never be instantiated in fastboot mode. Please report this as an Ember bug.', _emberEnvironment.environment.hasDOM); }, /** Sets up event listeners for standard browser events. This will be called after the browser sends a `DOMContentReady` event. By @@ -42304,13 +44149,13 @@ _emberMetal.set(this, 'rootElement', rootElement); } rootElement = _emberViewsSystemJquery.default(rootElement); - _emberMetal.assert('You cannot use the same root element (' + (rootElement.selector || rootElement[0].tagName) + ') multiple times in an Ember.Application', !rootElement.is(ROOT_ELEMENT_SELECTOR)); - _emberMetal.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest(ROOT_ELEMENT_SELECTOR).length); - _emberMetal.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find(ROOT_ELEMENT_SELECTOR).length); + _emberDebug.assert('You cannot use the same root element (' + (rootElement.selector || rootElement[0].tagName) + ') multiple times in an Ember.Application', !rootElement.is(ROOT_ELEMENT_SELECTOR)); + _emberDebug.assert('You cannot make a new Ember.Application using a root element that is a descendent of an existing Ember.Application', !rootElement.closest(ROOT_ELEMENT_SELECTOR).length); + _emberDebug.assert('You cannot make a new Ember.Application using a root element that is an ancestor of an existing Ember.Application', !rootElement.find(ROOT_ELEMENT_SELECTOR).length); rootElement.addClass(ROOT_ELEMENT_CLASS); if (!rootElement.is(ROOT_ELEMENT_SELECTOR)) { throw new TypeError('Unable to add \'' + ROOT_ELEMENT_CLASS + '\' class to root element (' + (rootElement.selector || rootElement[0].tagName) + '). Make sure you set rootElement to the body or an element in the body.'); @@ -42360,11 +44205,10 @@ return result; }); rootElement.on(event + '.ember', '[data-ember-action]', function (evt) { var attributes = evt.currentTarget.attributes; - var handledActions = []; for (var i = 0; i < attributes.length; i++) { var attr = attributes.item(i); var attrName = attr.name; @@ -42372,16 +44216,12 @@ var action = _emberViewsSystemAction_manager.default.registeredActions[attr.value]; // We have to check for action here since in some cases, jQuery will trigger // an event on `removeChild` (i.e. focusout) after we've already torn down the // action handlers for the view. - if (action && action.eventName === eventName && handledActions.indexOf(action) === -1) { + if (action && action.eventName === eventName) { action.handler(evt); - // Action handlers can mutate state which in turn creates new attributes on the element. - // This effect could cause the `data-ember-action` attribute to shift down and be invoked twice. - // To avoid this, we keep track of which actions have been handled. - handledActions.push(action); } } } }); }, @@ -42474,11 +44314,11 @@ } } exports.default = jQuery; }); -enifed('ember-views/system/lookup_partial', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-views/system/lookup_partial', ['exports', 'ember-debug'], function (exports, _emberDebug) { 'use strict'; exports.default = lookupPartial; exports.hasPartial = hasPartial; @@ -42496,31 +44336,31 @@ return; } var template = templateFor(owner, parseUnderscoredName(templateName), templateName); - _emberMetal.assert('Unable to find partial with name "' + templateName + '"', !!template); + _emberDebug.assert('Unable to find partial with name "' + templateName + '"', !!template); return template; } function hasPartial(name, owner) { if (!owner) { - throw new _emberMetal.Error('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA'); + throw new _emberDebug.Error('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA'); } return owner.hasRegistration('template:' + parseUnderscoredName(name)) || owner.hasRegistration('template:' + name); } function templateFor(owner, underscored, name) { if (!name) { return; } - _emberMetal.assert('templateNames are not allowed to contain periods: ' + name, name.indexOf('.') === -1); + _emberDebug.assert('templateNames are not allowed to contain periods: ' + name, name.indexOf('.') === -1); if (!owner) { - throw new _emberMetal.Error('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA'); + throw new _emberDebug.Error('Container was not found when looking up a views template. ' + 'This is most likely due to manually instantiating an Ember.View. ' + 'See: http://git.io/EKPpnA'); } return owner.lookup('template:' + underscored) || owner.lookup('template:' + name); } }); @@ -42901,21 +44741,21 @@ hasElement: _emberViewsViewsStatesHas_element.default, destroying: _emberViewsViewsStatesDestroying.default }; exports.states = states; }); -enifed('ember-views/views/states/default', ['exports', 'ember-metal'], function (exports, _emberMetal) { +enifed('ember-views/views/states/default', ['exports', 'ember-debug'], function (exports, _emberDebug) { 'use strict'; /** @module ember @submodule ember-views */ exports.default = { // appendChild is only legal while rendering the buffer. appendChild: function () { - throw new _emberMetal.Error('You can\'t use appendChild outside of the rendering process'); + throw new _emberDebug.EmberError('You can\'t use appendChild outside of the rendering process'); }, // Handle events from `Ember.EventDispatcher` handleEvent: function () { return true; // continue event propagation @@ -42924,11 +44764,11 @@ rerender: function () {}, destroy: function () {} }; }); -enifed('ember-views/views/states/destroying', ['exports', 'ember-utils', 'ember-metal', 'ember-views/views/states/default'], function (exports, _emberUtils, _emberMetal, _emberViewsViewsStatesDefault) { +enifed('ember-views/views/states/destroying', ['exports', 'ember-utils', 'ember-debug', 'ember-views/views/states/default'], function (exports, _emberUtils, _emberDebug, _emberViewsViewsStatesDefault) { 'use strict'; /** @module ember @submodule ember-views @@ -42936,14 +44776,14 @@ var destroying = Object.create(_emberViewsViewsStatesDefault.default); _emberUtils.assign(destroying, { appendChild: function () { - throw new _emberMetal.Error('You can\'t call appendChild on a view being destroyed'); + throw new _emberDebug.Error('You can\'t call appendChild on a view being destroyed'); }, rerender: function () { - throw new _emberMetal.Error('You can\'t call rerender on a view being destroyed'); + throw new _emberDebug.Error('You can\'t call rerender on a view being destroyed'); } }); exports.default = destroying; }); @@ -42976,11 +44816,11 @@ } }); exports.default = hasElement; }); -enifed('ember-views/views/states/in_dom', ['exports', 'ember-utils', 'ember-metal', 'ember-views/views/states/has_element'], function (exports, _emberUtils, _emberMetal, _emberViewsViewsStatesHas_element) { +enifed('ember-views/views/states/in_dom', ['exports', 'ember-utils', 'ember-metal', 'ember-debug', 'ember-views/views/states/has_element'], function (exports, _emberUtils, _emberMetal, _emberDebug, _emberViewsViewsStatesHas_element) { 'use strict'; /** @module ember @submodule ember-views @@ -42992,13 +44832,13 @@ enter: function (view) { // Register the view for event handling. This hash is used by // Ember.EventDispatcher to dispatch incoming events. view.renderer.register(view); - _emberMetal.runInDebug(function () { + _emberDebug.runInDebug(function () { _emberMetal._addBeforeObserver(view, 'elementId', function () { - throw new _emberMetal.Error('Changing a view\'s elementId after creation is not allowed'); + throw new _emberDebug.Error('Changing a view\'s elementId after creation is not allowed'); }); }); }, exit: function (view) { @@ -43035,13 +44875,13 @@ @private */ enifed("ember/features", ["exports"], function (exports) { "use strict"; - exports.default = { "features-stripped-test": false, "ember-libraries-isregistered": false, "ember-improved-instrumentation": false, "ember-metal-weakmap": false, "ember-glimmer-allow-backtracking-rerender": false, "ember-testing-resume-test": false, "ember-factory-for": true, "ember-no-double-extend": false, "mandatory-setter": true, "ember-glimmer-detect-backtracking-rerender": true }; + exports.default = { "features-stripped-test": false, "ember-libraries-isregistered": false, "ember-improved-instrumentation": false, "ember-metal-weakmap": false, "ember-glimmer-allow-backtracking-rerender": false, "ember-testing-resume-test": true, "ember-factory-for": true, "ember-no-double-extend": true, "ember-routing-router-service": false, "ember-unique-location-history-state": true, "mandatory-setter": true, "ember-glimmer-detect-backtracking-rerender": true }; }); -enifed('ember/index', ['exports', 'require', 'ember-environment', 'ember-utils', 'container', 'ember-metal', 'backburner', 'ember-console', 'ember-runtime', 'ember-glimmer', 'ember/version', 'ember-views', 'ember-routing', 'ember-application', 'ember-extension-support'], function (exports, _require, _emberEnvironment, _emberUtils, _container, _emberMetal, _backburner, _emberConsole, _emberRuntime, _emberGlimmer, _emberVersion, _emberViews, _emberRouting, _emberApplication, _emberExtensionSupport) { +enifed('ember/index', ['exports', 'require', 'ember-environment', 'ember-utils', 'container', 'ember-metal', 'ember-debug', 'backburner', 'ember-console', 'ember-runtime', 'ember-glimmer', 'ember/version', 'ember-views', 'ember-routing', 'ember-application', 'ember-extension-support'], function (exports, _require, _emberEnvironment, _emberUtils, _container, _emberMetal, _emberDebug, _backburner, _emberConsole, _emberRuntime, _emberGlimmer, _emberVersion, _emberViews, _emberRouting, _emberApplication, _emberExtensionSupport) { 'use strict'; // ember-utils exports _emberMetal.default.getOwner = _emberUtils.getOwner; _emberMetal.default.setOwner = _emberUtils.setOwner; @@ -43068,16 +44908,29 @@ computed.alias = _emberMetal.alias; _emberMetal.default.computed = computed; _emberMetal.default.ComputedProperty = _emberMetal.ComputedProperty; _emberMetal.default.cacheFor = _emberMetal.cacheFor; - _emberMetal.default.assert = _emberMetal.assert; - _emberMetal.default.warn = _emberMetal.warn; - _emberMetal.default.debug = _emberMetal.debug; - _emberMetal.default.deprecate = _emberMetal.deprecate; - _emberMetal.default.deprecateFunc = _emberMetal.deprecateFunc; - _emberMetal.default.runInDebug = _emberMetal.runInDebug; + _emberMetal.default.assert = _emberDebug.assert; + _emberMetal.default.warn = _emberDebug.warn; + _emberMetal.default.debug = _emberDebug.debug; + _emberMetal.default.deprecate = function () {}; + _emberMetal.default.deprecateFunc = function () {}; + _emberDebug.runInDebug(function () { + _emberMetal.default.deprecate = _emberDebug.deprecate; + _emberMetal.default.deprecateFunc = _emberDebug.deprecateFunc; + }); + _emberMetal.default.deprecateFunc = _emberDebug.deprecateFunc; + _emberMetal.default.runInDebug = _emberDebug.runInDebug; + /** + @public + @class Ember.Debug + */ + _emberMetal.default.Debug = { + registerDeprecationHandler: _emberDebug.registerDeprecationHandler, + registerWarnHandler: _emberDebug.registerWarnHandler + }; _emberMetal.default.merge = _emberMetal.merge; _emberMetal.default.instrument = _emberMetal.instrument; _emberMetal.default.subscribe = _emberMetal.instrumentationSubscribe; _emberMetal.default.Instrumentation = { @@ -43085,20 +44938,20 @@ subscribe: _emberMetal.instrumentationSubscribe, unsubscribe: _emberMetal.instrumentationUnsubscribe, reset: _emberMetal.instrumentationReset }; - _emberMetal.default.Error = _emberMetal.Error; + _emberMetal.default.Error = _emberDebug.Error; _emberMetal.default.META_DESC = _emberMetal.META_DESC; _emberMetal.default.meta = _emberMetal.meta; _emberMetal.default.get = _emberMetal.get; _emberMetal.default.getWithDefault = _emberMetal.getWithDefault; _emberMetal.default._getPath = _emberMetal._getPath; _emberMetal.default.set = _emberMetal.set; _emberMetal.default.trySet = _emberMetal.trySet; - _emberMetal.default.FEATURES = _emberMetal.FEATURES; - _emberMetal.default.FEATURES.isEnabled = _emberMetal.isFeatureEnabled; + _emberMetal.default.FEATURES = _emberDebug.FEATURES; + _emberMetal.default.FEATURES.isEnabled = _emberDebug.isFeatureEnabled; _emberMetal.default._Cache = _emberMetal.Cache; _emberMetal.default.on = _emberMetal.on; _emberMetal.default.addListener = _emberMetal.addListener; _emberMetal.default.removeListener = _emberMetal.removeListener; _emberMetal.default._suspendListener = _emberMetal.suspendListener; @@ -43157,11 +45010,11 @@ _emberMetal.default.Mixin = _emberMetal.Mixin; _emberMetal.default.bind = _emberMetal.bind; _emberMetal.default.Binding = _emberMetal.Binding; _emberMetal.default.isGlobalPath = _emberMetal.isGlobalPath; - if (false) { + if (_emberDebug.isFeatureEnabled('ember-metal-weakmap')) { _emberMetal.default.WeakMap = _emberMetal.WeakMap; } Object.defineProperty(_emberMetal.default, 'ENV', { get: function () { @@ -43266,40 +45119,33 @@ return this; } Object.defineProperty(_emberMetal.default, 'K', { get: function () { - _emberMetal.deprecate('Ember.K is deprecated in favor of defining a function inline.', false, { + _emberDebug.deprecate('Ember.K is deprecated in favor of defining a function inline.', false, { id: 'ember-metal.ember-k', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_code-ember-k-code' }); return deprecatedEmberK; } }); Object.defineProperty(_emberMetal.default, 'testing', { - get: _emberMetal.isTesting, - set: _emberMetal.setTesting, + get: _emberDebug.isTesting, + set: _emberDebug.setTesting, enumerable: false }); - if (!_require.has('ember-debug')) { - _emberMetal.default.Debug = { - registerDeprecationHandler: function () {}, - registerWarnHandler: function () {} - }; - } - /** @class Backburner @for Ember @private */ _emberMetal.default.Backburner = function () { - _emberMetal.deprecate('Usage of Ember.Backburner is deprecated.', false, { + _emberDebug.deprecate('Usage of Ember.Backburner is deprecated.', false, { id: 'ember-metal.ember-backburner', until: '2.8.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_ember-backburner' }); @@ -43484,12 +45330,12 @@ */ _emberMetal.default.VERSION = _emberVersion.default; _emberMetal.libraries.registerCoreLibrary('Ember', _emberVersion.default); - _emberMetal.default.create = _emberMetal.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create); - _emberMetal.default.keys = _emberMetal.deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys); + _emberMetal.default.create = _emberDebug.deprecateFunc('Ember.create is deprecated in favor of Object.create', { id: 'ember-metal.ember-create', until: '3.0.0' }, Object.create); + _emberMetal.default.keys = _emberDebug.deprecateFunc('Ember.keys is deprecated in favor of Object.keys', { id: 'ember-metal.ember.keys', until: '3.0.0' }, Object.keys); // require the main entry points for each of these packages // this is so that the global exports occur properly /** @@ -43578,11 +45424,11 @@ // reduced computed macros enifed("ember/version", ["exports"], function (exports) { "use strict"; - exports.default = "2.12.2"; + exports.default = "2.13.0-beta.1"; }); enifed('internal-test-helpers/apply-mixins', ['exports', 'ember-utils'], function (exports, _emberUtils) { 'use strict'; exports.default = applyMixins; @@ -43616,11 +45462,11 @@ }); return TestClass; } }); -enifed('internal-test-helpers/build-owner', ['exports', 'container', 'ember-routing', 'ember-application', 'ember-metal', 'ember-runtime'], function (exports, _container, _emberRouting, _emberApplication, _emberMetal, _emberRuntime) { +enifed('internal-test-helpers/build-owner', ['exports', 'container', 'ember-routing', 'ember-application', 'ember-debug', 'ember-runtime'], function (exports, _container, _emberRouting, _emberApplication, _emberDebug, _emberRuntime) { 'use strict'; exports.default = buildOwner; function buildOwner() { @@ -43872,11 +45718,11 @@ return Child; } } }); -enifed('internal-test-helpers/index', ['exports', 'internal-test-helpers/factory', 'internal-test-helpers/build-owner', 'internal-test-helpers/confirm-export', 'internal-test-helpers/equal-inner-html', 'internal-test-helpers/equal-tokens', 'internal-test-helpers/module-for', 'internal-test-helpers/strip', 'internal-test-helpers/apply-mixins', 'internal-test-helpers/matchers', 'internal-test-helpers/run', 'internal-test-helpers/test-groups', 'internal-test-helpers/test-cases/abstract', 'internal-test-helpers/test-cases/abstract-application', 'internal-test-helpers/test-cases/application', 'internal-test-helpers/test-cases/query-param', 'internal-test-helpers/test-cases/abstract-rendering', 'internal-test-helpers/test-cases/rendering'], function (exports, _internalTestHelpersFactory, _internalTestHelpersBuildOwner, _internalTestHelpersConfirmExport, _internalTestHelpersEqualInnerHtml, _internalTestHelpersEqualTokens, _internalTestHelpersModuleFor, _internalTestHelpersStrip, _internalTestHelpersApplyMixins, _internalTestHelpersMatchers, _internalTestHelpersRun, _internalTestHelpersTestGroups, _internalTestHelpersTestCasesAbstract, _internalTestHelpersTestCasesAbstractApplication, _internalTestHelpersTestCasesApplication, _internalTestHelpersTestCasesQueryParam, _internalTestHelpersTestCasesAbstractRendering, _internalTestHelpersTestCasesRendering) { +enifed('internal-test-helpers/index', ['exports', 'internal-test-helpers/factory', 'internal-test-helpers/build-owner', 'internal-test-helpers/confirm-export', 'internal-test-helpers/equal-inner-html', 'internal-test-helpers/equal-tokens', 'internal-test-helpers/module-for', 'internal-test-helpers/strip', 'internal-test-helpers/apply-mixins', 'internal-test-helpers/matchers', 'internal-test-helpers/run', 'internal-test-helpers/test-groups', 'internal-test-helpers/test-cases/abstract', 'internal-test-helpers/test-cases/abstract-application', 'internal-test-helpers/test-cases/application', 'internal-test-helpers/test-cases/query-param', 'internal-test-helpers/test-cases/abstract-rendering', 'internal-test-helpers/test-cases/rendering', 'internal-test-helpers/test-cases/router'], function (exports, _internalTestHelpersFactory, _internalTestHelpersBuildOwner, _internalTestHelpersConfirmExport, _internalTestHelpersEqualInnerHtml, _internalTestHelpersEqualTokens, _internalTestHelpersModuleFor, _internalTestHelpersStrip, _internalTestHelpersApplyMixins, _internalTestHelpersMatchers, _internalTestHelpersRun, _internalTestHelpersTestGroups, _internalTestHelpersTestCasesAbstract, _internalTestHelpersTestCasesAbstractApplication, _internalTestHelpersTestCasesApplication, _internalTestHelpersTestCasesQueryParam, _internalTestHelpersTestCasesAbstractRendering, _internalTestHelpersTestCasesRendering, _internalTestHelpersTestCasesRouter) { 'use strict'; exports.factory = _internalTestHelpersFactory.default; exports.buildOwner = _internalTestHelpersBuildOwner.default; exports.confirmExport = _internalTestHelpersConfirmExport.default; @@ -43897,10 +45743,11 @@ exports.AbstractApplicationTestCase = _internalTestHelpersTestCasesAbstractApplication.default; exports.ApplicationTestCase = _internalTestHelpersTestCasesApplication.default; exports.QueryParamTestCase = _internalTestHelpersTestCasesQueryParam.default; exports.AbstractRenderingTestCase = _internalTestHelpersTestCasesAbstractRendering.default; exports.RenderingTestCase = _internalTestHelpersTestCasesRendering.default; + exports.RouterTestCase = _internalTestHelpersTestCasesRouter.default; }); enifed('internal-test-helpers/matchers', ['exports'], function (exports) { 'use strict'; exports.regex = regex; @@ -44693,10 +46540,42 @@ return RenderingTestCase; })(_internalTestHelpersTestCasesAbstractRendering.default); exports.default = RenderingTestCase; }); +enifed('internal-test-helpers/test-cases/router', ['exports', 'internal-test-helpers/test-cases/application'], function (exports, _internalTestHelpersTestCasesApplication) { + 'use strict'; + + var RouterTestCase = (function (_ApplicationTestCase) { + babelHelpers.inherits(RouterTestCase, _ApplicationTestCase); + + function RouterTestCase() { + babelHelpers.classCallCheck(this, RouterTestCase); + + _ApplicationTestCase.call(this); + + this.router.map(function () { + this.route('parent', { path: '/' }, function () { + this.route('child'); + this.route('sister'); + this.route('brother'); + }); + this.route('dynamic', { path: '/dynamic/:dynamic_id' }); + }); + } + + babelHelpers.createClass(RouterTestCase, [{ + key: 'routerService', + get: function () { + return this.applicationInstance.lookup('service:router'); + } + }]); + return RouterTestCase; + })(_internalTestHelpersTestCasesApplication.default); + + exports.default = RouterTestCase; +}); enifed('internal-test-helpers/test-groups', ['exports', 'ember-environment', 'ember-metal'], function (exports, _emberEnvironment, _emberMetal) { 'use strict'; exports.testBoth = testBoth; exports.testWithDefault = testWithDefault; @@ -44773,10932 +46652,9 @@ ok('SKIPPING ACCESSORS'); } }); } }); -enifed('glimmer-node/index', ['exports', 'glimmer-node/lib/node-dom-helper'], function (exports, _glimmerNodeLibNodeDomHelper) { - 'use strict'; - - exports.NodeDOMTreeConstruction = _glimmerNodeLibNodeDomHelper.default; -}); - -enifed('glimmer-node/lib/node-dom-helper', ['exports', 'glimmer-runtime'], function (exports, _glimmerRuntime) { - 'use strict'; - - var NodeDOMTreeConstruction = (function (_DOMTreeConstruction) { - babelHelpers.inherits(NodeDOMTreeConstruction, _DOMTreeConstruction); - - function NodeDOMTreeConstruction(doc) { - _DOMTreeConstruction.call(this, doc); - } - - // override to prevent usage of `this.document` until after the constructor - - NodeDOMTreeConstruction.prototype.setupUselessElement = function setupUselessElement() {}; - - NodeDOMTreeConstruction.prototype.insertHTMLBefore = function insertHTMLBefore(parent, html, reference) { - var prev = reference ? reference.previousSibling : parent.lastChild; - var raw = this.document.createRawHTMLSection(html); - parent.insertBefore(raw, reference); - var first = prev ? prev.nextSibling : parent.firstChild; - var last = reference ? reference.previousSibling : parent.lastChild; - return new _glimmerRuntime.ConcreteBounds(parent, first, last); - }; - - // override to avoid SVG detection/work when in node (this is not needed in SSR) - - NodeDOMTreeConstruction.prototype.createElement = function createElement(tag) { - return this.document.createElement(tag); - }; - - // override to avoid namespace shenanigans when in node (this is not needed in SSR) - - NodeDOMTreeConstruction.prototype.setAttribute = function setAttribute(element, name, value) { - element.setAttribute(name, value); - }; - - return NodeDOMTreeConstruction; - })(_glimmerRuntime.DOMTreeConstruction); - - exports.default = NodeDOMTreeConstruction; -}); - -enifed('glimmer-reference/index', ['exports', 'glimmer-reference/lib/reference', 'glimmer-reference/lib/const', 'glimmer-reference/lib/validators', 'glimmer-reference/lib/utils', 'glimmer-reference/lib/iterable'], function (exports, _glimmerReferenceLibReference, _glimmerReferenceLibConst, _glimmerReferenceLibValidators, _glimmerReferenceLibUtils, _glimmerReferenceLibIterable) { - 'use strict'; - - exports.BasicReference = _glimmerReferenceLibReference.Reference; - exports.BasicPathReference = _glimmerReferenceLibReference.PathReference; - exports.ConstReference = _glimmerReferenceLibConst.ConstReference; - exports.isConst = _glimmerReferenceLibConst.isConst; - babelHelpers.defaults(exports, babelHelpers.interopExportWildcard(_glimmerReferenceLibValidators, babelHelpers.defaults)); - exports.Reference = _glimmerReferenceLibValidators.VersionedReference; - exports.PathReference = _glimmerReferenceLibValidators.VersionedPathReference; - exports.referenceFromParts = _glimmerReferenceLibUtils.referenceFromParts; - exports.IterationItem = _glimmerReferenceLibIterable.IterationItem; - exports.Iterator = _glimmerReferenceLibIterable.Iterator; - exports.Iterable = _glimmerReferenceLibIterable.Iterable; - exports.OpaqueIterator = _glimmerReferenceLibIterable.OpaqueIterator; - exports.OpaqueIterable = _glimmerReferenceLibIterable.OpaqueIterable; - exports.AbstractIterator = _glimmerReferenceLibIterable.AbstractIterator; - exports.AbstractIterable = _glimmerReferenceLibIterable.AbstractIterable; - exports.IterationArtifacts = _glimmerReferenceLibIterable.IterationArtifacts; - exports.ReferenceIterator = _glimmerReferenceLibIterable.ReferenceIterator; - exports.IteratorSynchronizer = _glimmerReferenceLibIterable.IteratorSynchronizer; - exports.IteratorSynchronizerDelegate = _glimmerReferenceLibIterable.IteratorSynchronizerDelegate; -}); - -enifed('glimmer-reference/lib/const', ['exports', 'glimmer-reference/lib/validators'], function (exports, _glimmerReferenceLibValidators) { - 'use strict'; - - exports.isConst = isConst; - - var ConstReference = (function () { - function ConstReference(inner) { - this.inner = inner; - this.tag = _glimmerReferenceLibValidators.CONSTANT_TAG; - } - - ConstReference.prototype.value = function value() { - return this.inner; - }; - - return ConstReference; - })(); - - exports.ConstReference = ConstReference; - - function isConst(reference) { - return reference.tag === _glimmerReferenceLibValidators.CONSTANT_TAG; - } -}); - -enifed("glimmer-reference/lib/iterable", ["exports", "glimmer-util"], function (exports, _glimmerUtil) { - "use strict"; - - var ListItem = (function (_ListNode) { - babelHelpers.inherits(ListItem, _ListNode); - - function ListItem(iterable, result) { - _ListNode.call(this, iterable.valueReferenceFor(result)); - this.retained = false; - this.seen = false; - this.key = result.key; - this.iterable = iterable; - this.memo = iterable.memoReferenceFor(result); - } - - ListItem.prototype.update = function update(item) { - this.retained = true; - this.iterable.updateValueReference(this.value, item); - this.iterable.updateMemoReference(this.memo, item); - }; - - ListItem.prototype.shouldRemove = function shouldRemove() { - return !this.retained; - }; - - ListItem.prototype.reset = function reset() { - this.retained = false; - this.seen = false; - }; - - return ListItem; - })(_glimmerUtil.ListNode); - - exports.ListItem = ListItem; - - var IterationArtifacts = (function () { - function IterationArtifacts(iterable) { - this.map = _glimmerUtil.dict(); - this.list = new _glimmerUtil.LinkedList(); - this.tag = iterable.tag; - this.iterable = iterable; - } - - IterationArtifacts.prototype.isEmpty = function isEmpty() { - var iterator = this.iterator = this.iterable.iterate(); - return iterator.isEmpty(); - }; - - IterationArtifacts.prototype.iterate = function iterate() { - var iterator = this.iterator || this.iterable.iterate(); - this.iterator = null; - return iterator; - }; - - IterationArtifacts.prototype.has = function has(key) { - return !!this.map[key]; - }; - - IterationArtifacts.prototype.get = function get(key) { - return this.map[key]; - }; - - IterationArtifacts.prototype.wasSeen = function wasSeen(key) { - var node = this.map[key]; - return node && node.seen; - }; - - IterationArtifacts.prototype.append = function append(item) { - var map = this.map; - var list = this.list; - var iterable = this.iterable; - - var node = map[item.key] = new ListItem(iterable, item); - list.append(node); - return node; - }; - - IterationArtifacts.prototype.insertBefore = function insertBefore(item, reference) { - var map = this.map; - var list = this.list; - var iterable = this.iterable; - - var node = map[item.key] = new ListItem(iterable, item); - node.retained = true; - list.insertBefore(node, reference); - return node; - }; - - IterationArtifacts.prototype.move = function move(item, reference) { - var list = this.list; - - item.retained = true; - list.remove(item); - list.insertBefore(item, reference); - }; - - IterationArtifacts.prototype.remove = function remove(item) { - var list = this.list; - - list.remove(item); - delete this.map[item.key]; - }; - - IterationArtifacts.prototype.nextNode = function nextNode(item) { - return this.list.nextNode(item); - }; - - IterationArtifacts.prototype.head = function head() { - return this.list.head(); - }; - - return IterationArtifacts; - })(); - - exports.IterationArtifacts = IterationArtifacts; - - var ReferenceIterator = (function () { - // if anyone needs to construct this object with something other than - // an iterable, let @wycats know. - - function ReferenceIterator(iterable) { - this.iterator = null; - var artifacts = new IterationArtifacts(iterable); - this.artifacts = artifacts; - } - - ReferenceIterator.prototype.next = function next() { - var artifacts = this.artifacts; - - var iterator = this.iterator = this.iterator || artifacts.iterate(); - var item = iterator.next(); - if (!item) return null; - return artifacts.append(item); - }; - - return ReferenceIterator; - })(); - - exports.ReferenceIterator = ReferenceIterator; - - var Phase; - (function (Phase) { - Phase[Phase["Append"] = 0] = "Append"; - Phase[Phase["Prune"] = 1] = "Prune"; - Phase[Phase["Done"] = 2] = "Done"; - })(Phase || (Phase = {})); - - var IteratorSynchronizer = (function () { - function IteratorSynchronizer(_ref) { - var target = _ref.target; - var artifacts = _ref.artifacts; - - this.target = target; - this.artifacts = artifacts; - this.iterator = artifacts.iterate(); - this.current = artifacts.head(); - } - - IteratorSynchronizer.prototype.sync = function sync() { - var phase = Phase.Append; - while (true) { - switch (phase) { - case Phase.Append: - phase = this.nextAppend(); - break; - case Phase.Prune: - phase = this.nextPrune(); - break; - case Phase.Done: - this.nextDone(); - return; - } - } - }; - - IteratorSynchronizer.prototype.advanceToKey = function advanceToKey(key) { - var current = this.current; - var artifacts = this.artifacts; - - var seek = current; - while (seek && seek.key !== key) { - seek.seen = true; - seek = artifacts.nextNode(seek); - } - this.current = seek && artifacts.nextNode(seek); - }; - - IteratorSynchronizer.prototype.nextAppend = function nextAppend() { - var iterator = this.iterator; - var current = this.current; - var artifacts = this.artifacts; - - var item = iterator.next(); - if (item === null) { - return this.startPrune(); - } - var key = item.key; - - if (current && current.key === key) { - this.nextRetain(item); - } else if (artifacts.has(key)) { - this.nextMove(item); - } else { - this.nextInsert(item); - } - return Phase.Append; - }; - - IteratorSynchronizer.prototype.nextRetain = function nextRetain(item) { - var artifacts = this.artifacts; - var current = this.current; - - current.update(item); - this.current = artifacts.nextNode(current); - this.target.retain(item.key, current.value, current.memo); - }; - - IteratorSynchronizer.prototype.nextMove = function nextMove(item) { - var current = this.current; - var artifacts = this.artifacts; - var target = this.target; - var key = item.key; - - var found = artifacts.get(item.key); - found.update(item); - if (artifacts.wasSeen(item.key)) { - artifacts.move(found, current); - target.move(found.key, found.value, found.memo, current ? current.key : null); - } else { - this.advanceToKey(key); - } - }; - - IteratorSynchronizer.prototype.nextInsert = function nextInsert(item) { - var artifacts = this.artifacts; - var target = this.target; - var current = this.current; - - var node = artifacts.insertBefore(item, current); - target.insert(node.key, node.value, node.memo, current ? current.key : null); - }; - - IteratorSynchronizer.prototype.startPrune = function startPrune() { - this.current = this.artifacts.head(); - return Phase.Prune; - }; - - IteratorSynchronizer.prototype.nextPrune = function nextPrune() { - var artifacts = this.artifacts; - var target = this.target; - var current = this.current; - - if (current === null) { - return Phase.Done; - } - var node = current; - this.current = artifacts.nextNode(node); - if (node.shouldRemove()) { - artifacts.remove(node); - target.delete(node.key); - } else { - node.reset(); - } - return Phase.Prune; - }; - - IteratorSynchronizer.prototype.nextDone = function nextDone() { - this.target.done(); - }; - - return IteratorSynchronizer; - })(); - - exports.IteratorSynchronizer = IteratorSynchronizer; -}); - -enifed("glimmer-reference/lib/reference", ["exports"], function (exports) { - "use strict"; -}); - -enifed("glimmer-reference/lib/utils", ["exports"], function (exports) { - "use strict"; - - exports.referenceFromParts = referenceFromParts; - - function referenceFromParts(root, parts) { - var reference = root; - for (var i = 0; i < parts.length; i++) { - reference = reference.get(parts[i]); - } - return reference; - } -}); - -enifed("glimmer-reference/lib/validators", ["exports"], function (exports) { - "use strict"; - - exports.combineTagged = combineTagged; - exports.combineSlice = combineSlice; - exports.combine = combine; - exports.map = map; - exports.isModified = isModified; - var CONSTANT = 0; - exports.CONSTANT = CONSTANT; - var INITIAL = 1; - exports.INITIAL = INITIAL; - var VOLATILE = NaN; - exports.VOLATILE = VOLATILE; - - var RevisionTag = (function () { - function RevisionTag() {} - - RevisionTag.prototype.validate = function validate(snapshot) { - return this.value() === snapshot; - }; - - return RevisionTag; - })(); - - exports.RevisionTag = RevisionTag; - - var $REVISION = INITIAL; - - var DirtyableTag = (function (_RevisionTag) { - babelHelpers.inherits(DirtyableTag, _RevisionTag); - - function DirtyableTag() { - var revision = arguments.length <= 0 || arguments[0] === undefined ? $REVISION : arguments[0]; - - _RevisionTag.call(this); - this.revision = revision; - } - - DirtyableTag.prototype.value = function value() { - return this.revision; - }; - - DirtyableTag.prototype.dirty = function dirty() { - this.revision = ++$REVISION; - }; - - return DirtyableTag; - })(RevisionTag); - - exports.DirtyableTag = DirtyableTag; - - function combineTagged(tagged) { - var optimized = []; - for (var i = 0, l = tagged.length; i < l; i++) { - var tag = tagged[i].tag; - if (tag === VOLATILE_TAG) return VOLATILE_TAG; - if (tag === CONSTANT_TAG) continue; - optimized.push(tag); - } - return _combine(optimized); - } - - function combineSlice(slice) { - var optimized = []; - var node = slice.head(); - while (node !== null) { - var tag = node.tag; - if (tag === VOLATILE_TAG) return VOLATILE_TAG; - if (tag !== CONSTANT_TAG) optimized.push(tag); - node = slice.nextNode(node); - } - return _combine(optimized); - } - - function combine(tags) { - var optimized = []; - for (var i = 0, l = tags.length; i < l; i++) { - var tag = tags[i]; - if (tag === VOLATILE_TAG) return VOLATILE_TAG; - if (tag === CONSTANT_TAG) continue; - optimized.push(tag); - } - return _combine(optimized); - } - - function _combine(tags) { - switch (tags.length) { - case 0: - return CONSTANT_TAG; - case 1: - return tags[0]; - case 2: - return new TagsPair(tags[0], tags[1]); - default: - return new TagsCombinator(tags); - } - ; - } - - var CachedTag = (function (_RevisionTag2) { - babelHelpers.inherits(CachedTag, _RevisionTag2); - - function CachedTag() { - _RevisionTag2.apply(this, arguments); - this.lastChecked = null; - this.lastValue = null; - } - - CachedTag.prototype.value = function value() { - var lastChecked = this.lastChecked; - var lastValue = this.lastValue; - - if (lastChecked !== $REVISION) { - this.lastChecked = $REVISION; - this.lastValue = lastValue = this.compute(); - } - return this.lastValue; - }; - - CachedTag.prototype.invalidate = function invalidate() { - this.lastChecked = null; - }; - - return CachedTag; - })(RevisionTag); - - exports.CachedTag = CachedTag; - - var TagsPair = (function (_CachedTag) { - babelHelpers.inherits(TagsPair, _CachedTag); - - function TagsPair(first, second) { - _CachedTag.call(this); - this.first = first; - this.second = second; - } - - TagsPair.prototype.compute = function compute() { - return Math.max(this.first.value(), this.second.value()); - }; - - return TagsPair; - })(CachedTag); - - var TagsCombinator = (function (_CachedTag2) { - babelHelpers.inherits(TagsCombinator, _CachedTag2); - - function TagsCombinator(tags) { - _CachedTag2.call(this); - this.tags = tags; - } - - TagsCombinator.prototype.compute = function compute() { - var tags = this.tags; - - var max = -1; - for (var i = 0; i < tags.length; i++) { - var value = tags[i].value(); - max = Math.max(value, max); - } - return max; - }; - - return TagsCombinator; - })(CachedTag); - - var UpdatableTag = (function (_CachedTag3) { - babelHelpers.inherits(UpdatableTag, _CachedTag3); - - function UpdatableTag(tag) { - _CachedTag3.call(this); - this.tag = tag; - this.lastUpdated = INITIAL; - } - - ////////// - - UpdatableTag.prototype.compute = function compute() { - return Math.max(this.lastUpdated, this.tag.value()); - }; - - UpdatableTag.prototype.update = function update(tag) { - if (tag !== this.tag) { - this.tag = tag; - this.lastUpdated = $REVISION; - this.invalidate(); - } - }; - - return UpdatableTag; - })(CachedTag); - - exports.UpdatableTag = UpdatableTag; - var CONSTANT_TAG = new ((function (_RevisionTag3) { - babelHelpers.inherits(ConstantTag, _RevisionTag3); - - function ConstantTag() { - _RevisionTag3.apply(this, arguments); - } - - ConstantTag.prototype.value = function value() { - return CONSTANT; - }; - - return ConstantTag; - })(RevisionTag))(); - exports.CONSTANT_TAG = CONSTANT_TAG; - var VOLATILE_TAG = new ((function (_RevisionTag4) { - babelHelpers.inherits(VolatileTag, _RevisionTag4); - - function VolatileTag() { - _RevisionTag4.apply(this, arguments); - } - - VolatileTag.prototype.value = function value() { - return VOLATILE; - }; - - return VolatileTag; - })(RevisionTag))(); - exports.VOLATILE_TAG = VOLATILE_TAG; - var CURRENT_TAG = new ((function (_DirtyableTag) { - babelHelpers.inherits(CurrentTag, _DirtyableTag); - - function CurrentTag() { - _DirtyableTag.apply(this, arguments); - } - - CurrentTag.prototype.value = function value() { - return $REVISION; - }; - - return CurrentTag; - })(DirtyableTag))(); - exports.CURRENT_TAG = CURRENT_TAG; - - var CachedReference = (function () { - function CachedReference() { - this.lastRevision = null; - this.lastValue = null; - } - - CachedReference.prototype.value = function value() { - var tag = this.tag; - var lastRevision = this.lastRevision; - var lastValue = this.lastValue; - - if (!lastRevision || !tag.validate(lastRevision)) { - lastValue = this.lastValue = this.compute(); - this.lastRevision = tag.value(); - } - return lastValue; - }; - - CachedReference.prototype.invalidate = function invalidate() { - this.lastRevision = null; - }; - - return CachedReference; - })(); - - exports.CachedReference = CachedReference; - - var MapperReference = (function (_CachedReference) { - babelHelpers.inherits(MapperReference, _CachedReference); - - function MapperReference(reference, mapper) { - _CachedReference.call(this); - this.tag = reference.tag; - this.reference = reference; - this.mapper = mapper; - } - - MapperReference.prototype.compute = function compute() { - var reference = this.reference; - var mapper = this.mapper; - - return mapper(reference.value()); - }; - - return MapperReference; - })(CachedReference); - - function map(reference, mapper) { - return new MapperReference(reference, mapper); - } - - ////////// - - var ReferenceCache = (function () { - function ReferenceCache(reference) { - this.lastValue = null; - this.lastRevision = null; - this.initialized = false; - this.tag = reference.tag; - this.reference = reference; - } - - ReferenceCache.prototype.peek = function peek() { - if (!this.initialized) { - return this.initialize(); - } - return this.lastValue; - }; - - ReferenceCache.prototype.revalidate = function revalidate() { - if (!this.initialized) { - return this.initialize(); - } - var reference = this.reference; - var lastRevision = this.lastRevision; - - var tag = reference.tag; - if (tag.validate(lastRevision)) return NOT_MODIFIED; - this.lastRevision = tag.value(); - var lastValue = this.lastValue; - - var value = reference.value(); - if (value === lastValue) return NOT_MODIFIED; - this.lastValue = value; - return value; - }; - - ReferenceCache.prototype.initialize = function initialize() { - var reference = this.reference; - - var value = this.lastValue = reference.value(); - this.lastRevision = reference.tag.value(); - this.initialized = true; - return value; - }; - - return ReferenceCache; - })(); - - exports.ReferenceCache = ReferenceCache; - - var NOT_MODIFIED = "adb3b78e-3d22-4e4b-877a-6317c2c5c145"; - - function isModified(value) { - return value !== NOT_MODIFIED; - } -}); - -enifed('glimmer-runtime/index', ['exports', 'glimmer-runtime/lib/dom/interfaces', 'glimmer-runtime/lib/syntax', 'glimmer-runtime/lib/template', 'glimmer-runtime/lib/symbol-table', 'glimmer-runtime/lib/references', 'glimmer-runtime/lib/syntax/core', 'glimmer-runtime/lib/compiled/opcodes/builder', 'glimmer-runtime/lib/compiler', 'glimmer-runtime/lib/opcode-builder', 'glimmer-runtime/lib/compiled/blocks', 'glimmer-runtime/lib/dom/attribute-managers', 'glimmer-runtime/lib/compiled/opcodes/content', 'glimmer-runtime/lib/compiled/expressions', 'glimmer-runtime/lib/compiled/expressions/args', 'glimmer-runtime/lib/compiled/expressions/function', 'glimmer-runtime/lib/helpers/get-dynamic-var', 'glimmer-runtime/lib/syntax/builtins/with-dynamic-vars', 'glimmer-runtime/lib/syntax/builtins/in-element', 'glimmer-runtime/lib/vm', 'glimmer-runtime/lib/upsert', 'glimmer-runtime/lib/environment', 'glimmer-runtime/lib/partial', 'glimmer-runtime/lib/component/interfaces', 'glimmer-runtime/lib/modifier/interfaces', 'glimmer-runtime/lib/dom/helper', 'glimmer-runtime/lib/builder', 'glimmer-runtime/lib/bounds'], function (exports, _glimmerRuntimeLibDomInterfaces, _glimmerRuntimeLibSyntax, _glimmerRuntimeLibTemplate, _glimmerRuntimeLibSymbolTable, _glimmerRuntimeLibReferences, _glimmerRuntimeLibSyntaxCore, _glimmerRuntimeLibCompiledOpcodesBuilder, _glimmerRuntimeLibCompiler, _glimmerRuntimeLibOpcodeBuilder, _glimmerRuntimeLibCompiledBlocks, _glimmerRuntimeLibDomAttributeManagers, _glimmerRuntimeLibCompiledOpcodesContent, _glimmerRuntimeLibCompiledExpressions, _glimmerRuntimeLibCompiledExpressionsArgs, _glimmerRuntimeLibCompiledExpressionsFunction, _glimmerRuntimeLibHelpersGetDynamicVar, _glimmerRuntimeLibSyntaxBuiltinsWithDynamicVars, _glimmerRuntimeLibSyntaxBuiltinsInElement, _glimmerRuntimeLibVm, _glimmerRuntimeLibUpsert, _glimmerRuntimeLibEnvironment, _glimmerRuntimeLibPartial, _glimmerRuntimeLibComponentInterfaces, _glimmerRuntimeLibModifierInterfaces, _glimmerRuntimeLibDomHelper, _glimmerRuntimeLibBuilder, _glimmerRuntimeLibBounds) { - 'use strict'; - - exports.ATTRIBUTE_SYNTAX = _glimmerRuntimeLibSyntax.ATTRIBUTE; - exports.StatementSyntax = _glimmerRuntimeLibSyntax.Statement; - exports.ExpressionSyntax = _glimmerRuntimeLibSyntax.Expression; - exports.AttributeSyntax = _glimmerRuntimeLibSyntax.Attribute; - exports.StatementCompilationBuffer = _glimmerRuntimeLibSyntax.StatementCompilationBuffer; - exports.SymbolLookup = _glimmerRuntimeLibSyntax.SymbolLookup; - exports.CompileInto = _glimmerRuntimeLibSyntax.CompileInto; - exports.isAttribute = _glimmerRuntimeLibSyntax.isAttribute; - exports.templateFactory = _glimmerRuntimeLibTemplate.default; - exports.TemplateFactory = _glimmerRuntimeLibTemplate.TemplateFactory; - exports.Template = _glimmerRuntimeLibTemplate.Template; - exports.SymbolTable = _glimmerRuntimeLibSymbolTable.default; - exports.NULL_REFERENCE = _glimmerRuntimeLibReferences.NULL_REFERENCE; - exports.UNDEFINED_REFERENCE = _glimmerRuntimeLibReferences.UNDEFINED_REFERENCE; - exports.PrimitiveReference = _glimmerRuntimeLibReferences.PrimitiveReference; - exports.ConditionalReference = _glimmerRuntimeLibReferences.ConditionalReference; - exports.Blocks = _glimmerRuntimeLibSyntaxCore.Blocks; - exports.OptimizedAppend = _glimmerRuntimeLibSyntaxCore.OptimizedAppend; - exports.UnoptimizedAppend = _glimmerRuntimeLibSyntaxCore.UnoptimizedAppend; - exports.Unknown = _glimmerRuntimeLibSyntaxCore.Unknown; - exports.StaticAttr = _glimmerRuntimeLibSyntaxCore.StaticAttr; - exports.DynamicAttr = _glimmerRuntimeLibSyntaxCore.DynamicAttr; - exports.ArgsSyntax = _glimmerRuntimeLibSyntaxCore.Args; - exports.NamedArgsSyntax = _glimmerRuntimeLibSyntaxCore.NamedArgs; - exports.PositionalArgsSyntax = _glimmerRuntimeLibSyntaxCore.PositionalArgs; - exports.RefSyntax = _glimmerRuntimeLibSyntaxCore.Ref; - exports.GetNamedParameterSyntax = _glimmerRuntimeLibSyntaxCore.GetArgument; - exports.GetSyntax = _glimmerRuntimeLibSyntaxCore.Get; - exports.ValueSyntax = _glimmerRuntimeLibSyntaxCore.Value; - exports.OpenElement = _glimmerRuntimeLibSyntaxCore.OpenElement; - exports.HelperSyntax = _glimmerRuntimeLibSyntaxCore.Helper; - exports.BlockSyntax = _glimmerRuntimeLibSyntaxCore.Block; - exports.OpenPrimitiveElementSyntax = _glimmerRuntimeLibSyntaxCore.OpenPrimitiveElement; - exports.CloseElementSyntax = _glimmerRuntimeLibSyntaxCore.CloseElement; - exports.OpcodeBuilderDSL = _glimmerRuntimeLibCompiledOpcodesBuilder.default; - exports.Compiler = _glimmerRuntimeLibCompiler.default; - exports.Compilable = _glimmerRuntimeLibCompiler.Compilable; - exports.CompileIntoList = _glimmerRuntimeLibCompiler.CompileIntoList; - exports.compileLayout = _glimmerRuntimeLibCompiler.compileLayout; - exports.ComponentBuilder = _glimmerRuntimeLibOpcodeBuilder.ComponentBuilder; - exports.StaticDefinition = _glimmerRuntimeLibOpcodeBuilder.StaticDefinition; - exports.DynamicDefinition = _glimmerRuntimeLibOpcodeBuilder.DynamicDefinition; - exports.Block = _glimmerRuntimeLibCompiledBlocks.Block; - exports.CompiledBlock = _glimmerRuntimeLibCompiledBlocks.CompiledBlock; - exports.Layout = _glimmerRuntimeLibCompiledBlocks.Layout; - exports.InlineBlock = _glimmerRuntimeLibCompiledBlocks.InlineBlock; - exports.EntryPoint = _glimmerRuntimeLibCompiledBlocks.EntryPoint; - exports.IAttributeManager = _glimmerRuntimeLibDomAttributeManagers.AttributeManager; - exports.AttributeManager = _glimmerRuntimeLibDomAttributeManagers.AttributeManager; - exports.PropertyManager = _glimmerRuntimeLibDomAttributeManagers.PropertyManager; - exports.INPUT_VALUE_PROPERTY_MANAGER = _glimmerRuntimeLibDomAttributeManagers.INPUT_VALUE_PROPERTY_MANAGER; - exports.defaultManagers = _glimmerRuntimeLibDomAttributeManagers.defaultManagers; - exports.defaultAttributeManagers = _glimmerRuntimeLibDomAttributeManagers.defaultAttributeManagers; - exports.defaultPropertyManagers = _glimmerRuntimeLibDomAttributeManagers.defaultPropertyManagers; - exports.readDOMAttr = _glimmerRuntimeLibDomAttributeManagers.readDOMAttr; - exports.normalizeTextValue = _glimmerRuntimeLibCompiledOpcodesContent.normalizeTextValue; - exports.CompiledExpression = _glimmerRuntimeLibCompiledExpressions.CompiledExpression; - exports.CompiledArgs = _glimmerRuntimeLibCompiledExpressionsArgs.CompiledArgs; - exports.CompiledNamedArgs = _glimmerRuntimeLibCompiledExpressionsArgs.CompiledNamedArgs; - exports.CompiledPositionalArgs = _glimmerRuntimeLibCompiledExpressionsArgs.CompiledPositionalArgs; - exports.EvaluatedArgs = _glimmerRuntimeLibCompiledExpressionsArgs.EvaluatedArgs; - exports.EvaluatedNamedArgs = _glimmerRuntimeLibCompiledExpressionsArgs.EvaluatedNamedArgs; - exports.EvaluatedPositionalArgs = _glimmerRuntimeLibCompiledExpressionsArgs.EvaluatedPositionalArgs; - exports.FunctionExpression = _glimmerRuntimeLibCompiledExpressionsFunction.FunctionExpression; - exports.getDynamicVar = _glimmerRuntimeLibHelpersGetDynamicVar.default; - exports.WithDynamicVarsSyntax = _glimmerRuntimeLibSyntaxBuiltinsWithDynamicVars.default; - exports.InElementSyntax = _glimmerRuntimeLibSyntaxBuiltinsInElement.default; - exports.VM = _glimmerRuntimeLibVm.PublicVM; - exports.UpdatingVM = _glimmerRuntimeLibVm.UpdatingVM; - exports.RenderResult = _glimmerRuntimeLibVm.RenderResult; - exports.SafeString = _glimmerRuntimeLibUpsert.SafeString; - exports.isSafeString = _glimmerRuntimeLibUpsert.isSafeString; - exports.Scope = _glimmerRuntimeLibEnvironment.Scope; - exports.Environment = _glimmerRuntimeLibEnvironment.default; - exports.Helper = _glimmerRuntimeLibEnvironment.Helper; - exports.ParsedStatement = _glimmerRuntimeLibEnvironment.ParsedStatement; - exports.DynamicScope = _glimmerRuntimeLibEnvironment.DynamicScope; - exports.PartialDefinition = _glimmerRuntimeLibPartial.PartialDefinition; - exports.Component = _glimmerRuntimeLibComponentInterfaces.Component; - exports.ComponentClass = _glimmerRuntimeLibComponentInterfaces.ComponentClass; - exports.ComponentManager = _glimmerRuntimeLibComponentInterfaces.ComponentManager; - exports.ComponentDefinition = _glimmerRuntimeLibComponentInterfaces.ComponentDefinition; - exports.ComponentLayoutBuilder = _glimmerRuntimeLibComponentInterfaces.ComponentLayoutBuilder; - exports.ComponentAttrsBuilder = _glimmerRuntimeLibComponentInterfaces.ComponentAttrsBuilder; - exports.isComponentDefinition = _glimmerRuntimeLibComponentInterfaces.isComponentDefinition; - exports.ModifierManager = _glimmerRuntimeLibModifierInterfaces.ModifierManager; - exports.DOMChanges = _glimmerRuntimeLibDomHelper.default; - exports.IDOMChanges = _glimmerRuntimeLibDomHelper.DOMChanges; - exports.DOMTreeConstruction = _glimmerRuntimeLibDomHelper.DOMTreeConstruction; - exports.isWhitespace = _glimmerRuntimeLibDomHelper.isWhitespace; - exports.insertHTMLBefore = _glimmerRuntimeLibDomHelper.insertHTMLBefore; - exports.Simple = _glimmerRuntimeLibDomInterfaces; - exports.ElementStack = _glimmerRuntimeLibBuilder.ElementStack; - exports.ElementOperations = _glimmerRuntimeLibBuilder.ElementOperations; - exports.Bounds = _glimmerRuntimeLibBounds.default; - exports.ConcreteBounds = _glimmerRuntimeLibBounds.ConcreteBounds; -}); - -enifed("glimmer-runtime/lib/bounds", ["exports"], function (exports) { - "use strict"; - - exports.bounds = bounds; - exports.single = single; - exports.move = move; - exports.clear = clear; - - var Cursor = function Cursor(element, nextSibling) { - this.element = element; - this.nextSibling = nextSibling; - }; - - exports.Cursor = Cursor; - - var RealDOMBounds = (function () { - function RealDOMBounds(bounds) { - this.bounds = bounds; - } - - RealDOMBounds.prototype.parentElement = function parentElement() { - return this.bounds.parentElement(); - }; - - RealDOMBounds.prototype.firstNode = function firstNode() { - return this.bounds.firstNode(); - }; - - RealDOMBounds.prototype.lastNode = function lastNode() { - return this.bounds.lastNode(); - }; - - return RealDOMBounds; - })(); - - exports.RealDOMBounds = RealDOMBounds; - - var ConcreteBounds = (function () { - function ConcreteBounds(parentNode, first, last) { - this.parentNode = parentNode; - this.first = first; - this.last = last; - } - - ConcreteBounds.prototype.parentElement = function parentElement() { - return this.parentNode; - }; - - ConcreteBounds.prototype.firstNode = function firstNode() { - return this.first; - }; - - ConcreteBounds.prototype.lastNode = function lastNode() { - return this.last; - }; - - return ConcreteBounds; - })(); - - exports.ConcreteBounds = ConcreteBounds; - - var SingleNodeBounds = (function () { - function SingleNodeBounds(parentNode, node) { - this.parentNode = parentNode; - this.node = node; - } - - SingleNodeBounds.prototype.parentElement = function parentElement() { - return this.parentNode; - }; - - SingleNodeBounds.prototype.firstNode = function firstNode() { - return this.node; - }; - - SingleNodeBounds.prototype.lastNode = function lastNode() { - return this.node; - }; - - return SingleNodeBounds; - })(); - - exports.SingleNodeBounds = SingleNodeBounds; - - function bounds(parent, first, last) { - return new ConcreteBounds(parent, first, last); - } - - function single(parent, node) { - return new SingleNodeBounds(parent, node); - } - - function move(bounds, reference) { - var parent = bounds.parentElement(); - var first = bounds.firstNode(); - var last = bounds.lastNode(); - var node = first; - while (node) { - var next = node.nextSibling; - parent.insertBefore(node, reference); - if (node === last) return next; - node = next; - } - return null; - } - - function clear(bounds) { - var parent = bounds.parentElement(); - var first = bounds.firstNode(); - var last = bounds.lastNode(); - var node = first; - while (node) { - var next = node.nextSibling; - parent.removeChild(node); - if (node === last) return next; - node = next; - } - return null; - } -}); - -enifed('glimmer-runtime/lib/builder', ['exports', 'glimmer-runtime/lib/bounds', 'glimmer-util', 'glimmer-runtime/lib/compiled/opcodes/dom'], function (exports, _glimmerRuntimeLibBounds, _glimmerUtil, _glimmerRuntimeLibCompiledOpcodesDom) { - 'use strict'; - - var First = (function () { - function First(node) { - this.node = node; - } - - First.prototype.firstNode = function firstNode() { - return this.node; - }; - - return First; - })(); - - var Last = (function () { - function Last(node) { - this.node = node; - } - - Last.prototype.lastNode = function lastNode() { - return this.node; - }; - - return Last; - })(); - - var Fragment = (function () { - function Fragment(bounds) { - this.bounds = bounds; - } - - Fragment.prototype.parentElement = function parentElement() { - return this.bounds.parentElement(); - }; - - Fragment.prototype.firstNode = function firstNode() { - return this.bounds.firstNode(); - }; - - Fragment.prototype.lastNode = function lastNode() { - return this.bounds.lastNode(); - }; - - Fragment.prototype.update = function update(bounds) { - this.bounds = bounds; - }; - - return Fragment; - })(); - - exports.Fragment = Fragment; - - var ElementStack = (function () { - function ElementStack(env, parentNode, nextSibling) { - this.constructing = null; - this.operations = null; - this.elementStack = new _glimmerUtil.Stack(); - this.nextSiblingStack = new _glimmerUtil.Stack(); - this.blockStack = new _glimmerUtil.Stack(); - this.env = env; - this.dom = env.getAppendOperations(); - this.updateOperations = env.getDOM(); - this.element = parentNode; - this.nextSibling = nextSibling; - this.defaultOperations = new _glimmerRuntimeLibCompiledOpcodesDom.SimpleElementOperations(env); - this.elementStack.push(this.element); - this.nextSiblingStack.push(this.nextSibling); - } - - ElementStack.forInitialRender = function forInitialRender(env, parentNode, nextSibling) { - return new ElementStack(env, parentNode, nextSibling); - }; - - ElementStack.resume = function resume(env, tracker, nextSibling) { - var parentNode = tracker.parentElement(); - var stack = new ElementStack(env, parentNode, nextSibling); - stack.pushBlockTracker(tracker); - return stack; - }; - - ElementStack.prototype.block = function block() { - return this.blockStack.current; - }; - - ElementStack.prototype.popElement = function popElement() { - var elementStack = this.elementStack; - var nextSiblingStack = this.nextSiblingStack; - - var topElement = elementStack.pop(); - nextSiblingStack.pop(); - this.element = elementStack.current; - this.nextSibling = nextSiblingStack.current; - return topElement; - }; - - ElementStack.prototype.pushSimpleBlock = function pushSimpleBlock() { - var tracker = new SimpleBlockTracker(this.element); - this.pushBlockTracker(tracker); - return tracker; - }; - - ElementStack.prototype.pushUpdatableBlock = function pushUpdatableBlock() { - var tracker = new UpdatableBlockTracker(this.element); - this.pushBlockTracker(tracker); - return tracker; - }; - - ElementStack.prototype.pushBlockTracker = function pushBlockTracker(tracker) { - var isRemote = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - - var current = this.blockStack.current; - if (current !== null) { - current.newDestroyable(tracker); - if (!isRemote) { - current.newBounds(tracker); - } - } - this.blockStack.push(tracker); - return tracker; - }; - - ElementStack.prototype.pushBlockList = function pushBlockList(list) { - var tracker = new BlockListTracker(this.element, list); - var current = this.blockStack.current; - if (current !== null) { - current.newDestroyable(tracker); - current.newBounds(tracker); - } - this.blockStack.push(tracker); - return tracker; - }; - - ElementStack.prototype.popBlock = function popBlock() { - this.blockStack.current.finalize(this); - return this.blockStack.pop(); - }; - - ElementStack.prototype.openElement = function openElement(tag) { - var operations = arguments.length <= 1 || arguments[1] === undefined ? this.defaultOperations : arguments[1]; - - var element = this.dom.createElement(tag, this.element); - this.constructing = element; - this.operations = operations; - return element; - }; - - ElementStack.prototype.flushElement = function flushElement() { - var parent = this.element; - var element = this.constructing; - this.dom.insertBefore(parent, element, this.nextSibling); - this.constructing = null; - this.operations = null; - this.pushElement(element); - this.blockStack.current.openElement(element); - }; - - ElementStack.prototype.pushRemoteElement = function pushRemoteElement(element) { - this.pushElement(element); - var tracker = new RemoteBlockTracker(element); - this.pushBlockTracker(tracker, true); - }; - - ElementStack.prototype.popRemoteElement = function popRemoteElement() { - this.popBlock(); - this.popElement(); - }; - - ElementStack.prototype.pushElement = function pushElement(element) { - this.element = element; - this.elementStack.push(element); - this.nextSibling = null; - this.nextSiblingStack.push(null); - }; - - ElementStack.prototype.newDestroyable = function newDestroyable(d) { - this.blockStack.current.newDestroyable(d); - }; - - ElementStack.prototype.newBounds = function newBounds(bounds) { - this.blockStack.current.newBounds(bounds); - }; - - ElementStack.prototype.appendText = function appendText(string) { - var dom = this.dom; - - var text = dom.createTextNode(string); - dom.insertBefore(this.element, text, this.nextSibling); - this.blockStack.current.newNode(text); - return text; - }; - - ElementStack.prototype.appendComment = function appendComment(string) { - var dom = this.dom; - - var comment = dom.createComment(string); - dom.insertBefore(this.element, comment, this.nextSibling); - this.blockStack.current.newNode(comment); - return comment; - }; - - ElementStack.prototype.setStaticAttribute = function setStaticAttribute(name, value) { - this.operations.addStaticAttribute(this.constructing, name, value); - }; - - ElementStack.prototype.setStaticAttributeNS = function setStaticAttributeNS(namespace, name, value) { - this.operations.addStaticAttributeNS(this.constructing, namespace, name, value); - }; - - ElementStack.prototype.setDynamicAttribute = function setDynamicAttribute(name, reference, isTrusting) { - this.operations.addDynamicAttribute(this.constructing, name, reference, isTrusting); - }; - - ElementStack.prototype.setDynamicAttributeNS = function setDynamicAttributeNS(namespace, name, reference, isTrusting) { - this.operations.addDynamicAttributeNS(this.constructing, namespace, name, reference, isTrusting); - }; - - ElementStack.prototype.closeElement = function closeElement() { - this.blockStack.current.closeElement(); - this.popElement(); - }; - - return ElementStack; - })(); - - exports.ElementStack = ElementStack; - - var SimpleBlockTracker = (function () { - function SimpleBlockTracker(parent) { - this.parent = parent; - this.first = null; - this.last = null; - this.destroyables = null; - this.nesting = 0; - } - - SimpleBlockTracker.prototype.destroy = function destroy() { - var destroyables = this.destroyables; - - if (destroyables && destroyables.length) { - for (var i = 0; i < destroyables.length; i++) { - destroyables[i].destroy(); - } - } - }; - - SimpleBlockTracker.prototype.parentElement = function parentElement() { - return this.parent; - }; - - SimpleBlockTracker.prototype.firstNode = function firstNode() { - return this.first && this.first.firstNode(); - }; - - SimpleBlockTracker.prototype.lastNode = function lastNode() { - return this.last && this.last.lastNode(); - }; - - SimpleBlockTracker.prototype.openElement = function openElement(element) { - this.newNode(element); - this.nesting++; - }; - - SimpleBlockTracker.prototype.closeElement = function closeElement() { - this.nesting--; - }; - - SimpleBlockTracker.prototype.newNode = function newNode(node) { - if (this.nesting !== 0) return; - if (!this.first) { - this.first = new First(node); - } - this.last = new Last(node); - }; - - SimpleBlockTracker.prototype.newBounds = function newBounds(bounds) { - if (this.nesting !== 0) return; - if (!this.first) { - this.first = bounds; - } - this.last = bounds; - }; - - SimpleBlockTracker.prototype.newDestroyable = function newDestroyable(d) { - this.destroyables = this.destroyables || []; - this.destroyables.push(d); - }; - - SimpleBlockTracker.prototype.finalize = function finalize(stack) { - if (!this.first) { - stack.appendComment(''); - } - }; - - return SimpleBlockTracker; - })(); - - exports.SimpleBlockTracker = SimpleBlockTracker; - - var RemoteBlockTracker = (function (_SimpleBlockTracker) { - babelHelpers.inherits(RemoteBlockTracker, _SimpleBlockTracker); - - function RemoteBlockTracker() { - _SimpleBlockTracker.apply(this, arguments); - } - - RemoteBlockTracker.prototype.destroy = function destroy() { - _SimpleBlockTracker.prototype.destroy.call(this); - _glimmerRuntimeLibBounds.clear(this); - }; - - return RemoteBlockTracker; - })(SimpleBlockTracker); - - var UpdatableBlockTracker = (function (_SimpleBlockTracker2) { - babelHelpers.inherits(UpdatableBlockTracker, _SimpleBlockTracker2); - - function UpdatableBlockTracker() { - _SimpleBlockTracker2.apply(this, arguments); - } - - UpdatableBlockTracker.prototype.reset = function reset(env) { - var destroyables = this.destroyables; - - if (destroyables && destroyables.length) { - for (var i = 0; i < destroyables.length; i++) { - env.didDestroy(destroyables[i]); - } - } - var nextSibling = _glimmerRuntimeLibBounds.clear(this); - this.destroyables = null; - this.first = null; - this.last = null; - return nextSibling; - }; - - return UpdatableBlockTracker; - })(SimpleBlockTracker); - - exports.UpdatableBlockTracker = UpdatableBlockTracker; - - var BlockListTracker = (function () { - function BlockListTracker(parent, boundList) { - this.parent = parent; - this.boundList = boundList; - this.parent = parent; - this.boundList = boundList; - } - - BlockListTracker.prototype.destroy = function destroy() { - this.boundList.forEachNode(function (node) { - return node.destroy(); - }); - }; - - BlockListTracker.prototype.parentElement = function parentElement() { - return this.parent; - }; - - BlockListTracker.prototype.firstNode = function firstNode() { - return this.boundList.head().firstNode(); - }; - - BlockListTracker.prototype.lastNode = function lastNode() { - return this.boundList.tail().lastNode(); - }; - - BlockListTracker.prototype.openElement = function openElement(element) { - _glimmerUtil.assert(false, 'Cannot openElement directly inside a block list'); - }; - - BlockListTracker.prototype.closeElement = function closeElement() { - _glimmerUtil.assert(false, 'Cannot closeElement directly inside a block list'); - }; - - BlockListTracker.prototype.newNode = function newNode(node) { - _glimmerUtil.assert(false, 'Cannot create a new node directly inside a block list'); - }; - - BlockListTracker.prototype.newBounds = function newBounds(bounds) {}; - - BlockListTracker.prototype.newDestroyable = function newDestroyable(d) {}; - - BlockListTracker.prototype.finalize = function finalize(stack) {}; - - return BlockListTracker; - })(); -}); - -enifed('glimmer-runtime/lib/compat/inner-html-fix', ['exports', 'glimmer-runtime/lib/bounds', 'glimmer-runtime/lib/dom/helper'], function (exports, _glimmerRuntimeLibBounds, _glimmerRuntimeLibDomHelper) { - 'use strict'; - - exports.domChanges = domChanges; - exports.treeConstruction = treeConstruction; - - var innerHTMLWrapper = { - colgroup: { depth: 2, before: '<table><colgroup>', after: '</colgroup></table>' }, - table: { depth: 1, before: '<table>', after: '</table>' }, - tbody: { depth: 2, before: '<table><tbody>', after: '</tbody></table>' }, - tfoot: { depth: 2, before: '<table><tfoot>', after: '</tfoot></table>' }, - thead: { depth: 2, before: '<table><thead>', after: '</thead></table>' }, - tr: { depth: 3, before: '<table><tbody><tr>', after: '</tr></tbody></table>' } - }; - // Patch: innerHTML Fix - // Browsers: IE9 - // Reason: IE9 don't allow us to set innerHTML on col, colgroup, frameset, - // html, style, table, tbody, tfoot, thead, title, tr. - // Fix: Wrap the innerHTML we are about to set in its parents, apply the - // wrapped innerHTML on a div, then move the unwrapped nodes into the - // target position. - - function domChanges(document, DOMChangesClass) { - if (!document) return DOMChangesClass; - if (!shouldApplyFix(document)) { - return DOMChangesClass; - } - var div = document.createElement('div'); - return (function (_DOMChangesClass) { - babelHelpers.inherits(DOMChangesWithInnerHTMLFix, _DOMChangesClass); - - function DOMChangesWithInnerHTMLFix() { - _DOMChangesClass.apply(this, arguments); - } - - DOMChangesWithInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent, nextSibling, html) { - if (html === null || html === '') { - return _DOMChangesClass.prototype.insertHTMLBefore.call(this, parent, nextSibling, html); - } - var parentTag = parent.tagName.toLowerCase(); - var wrapper = innerHTMLWrapper[parentTag]; - if (wrapper === undefined) { - return _DOMChangesClass.prototype.insertHTMLBefore.call(this, parent, nextSibling, html); - } - return fixInnerHTML(parent, wrapper, div, html, nextSibling); - }; - - return DOMChangesWithInnerHTMLFix; - })(DOMChangesClass); - } - - function treeConstruction(document, DOMTreeConstructionClass) { - if (!document) return DOMTreeConstructionClass; - if (!shouldApplyFix(document)) { - return DOMTreeConstructionClass; - } - var div = document.createElement('div'); - return (function (_DOMTreeConstructionClass) { - babelHelpers.inherits(DOMTreeConstructionWithInnerHTMLFix, _DOMTreeConstructionClass); - - function DOMTreeConstructionWithInnerHTMLFix() { - _DOMTreeConstructionClass.apply(this, arguments); - } - - DOMTreeConstructionWithInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent, html, reference) { - if (html === null || html === '') { - return _DOMTreeConstructionClass.prototype.insertHTMLBefore.call(this, parent, html, reference); - } - var parentTag = parent.tagName.toLowerCase(); - var wrapper = innerHTMLWrapper[parentTag]; - if (wrapper === undefined) { - return _DOMTreeConstructionClass.prototype.insertHTMLBefore.call(this, parent, html, reference); - } - return fixInnerHTML(parent, wrapper, div, html, reference); - }; - - return DOMTreeConstructionWithInnerHTMLFix; - })(DOMTreeConstructionClass); - } - - function fixInnerHTML(parent, wrapper, div, html, reference) { - var wrappedHtml = wrapper.before + html + wrapper.after; - div.innerHTML = wrappedHtml; - var parentNode = div; - for (var i = 0; i < wrapper.depth; i++) { - parentNode = parentNode.childNodes[0]; - } - - var _moveNodesBefore = _glimmerRuntimeLibDomHelper.moveNodesBefore(parentNode, parent, reference); - - var first = _moveNodesBefore[0]; - var last = _moveNodesBefore[1]; - - return new _glimmerRuntimeLibBounds.ConcreteBounds(parent, first, last); - } - function shouldApplyFix(document) { - var table = document.createElement('table'); - try { - table.innerHTML = '<tbody></tbody>'; - } catch (e) {} finally { - if (table.childNodes.length !== 0) { - // It worked as expected, no fix required - return false; - } - } - return true; - } -}); - -enifed('glimmer-runtime/lib/compat/svg-inner-html-fix', ['exports', 'glimmer-runtime/lib/bounds', 'glimmer-runtime/lib/dom/helper'], function (exports, _glimmerRuntimeLibBounds, _glimmerRuntimeLibDomHelper) { - 'use strict'; - - exports.domChanges = domChanges; - exports.treeConstruction = treeConstruction; - - var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; - // Patch: insertAdjacentHTML on SVG Fix - // Browsers: Safari, IE, Edge, Firefox ~33-34 - // Reason: insertAdjacentHTML does not exist on SVG elements in Safari. It is - // present but throws an exception on IE and Edge. Old versions of - // Firefox create nodes in the incorrect namespace. - // Fix: Since IE and Edge silently fail to create SVG nodes using - // innerHTML, and because Firefox may create nodes in the incorrect - // namespace using innerHTML on SVG elements, an HTML-string wrapping - // approach is used. A pre/post SVG tag is added to the string, then - // that whole string is added to a div. The created nodes are plucked - // out and applied to the target location on DOM. - - function domChanges(document, DOMChangesClass, svgNamespace) { - if (!document) return DOMChangesClass; - if (!shouldApplyFix(document, svgNamespace)) { - return DOMChangesClass; - } - var div = document.createElement('div'); - return (function (_DOMChangesClass) { - babelHelpers.inherits(DOMChangesWithSVGInnerHTMLFix, _DOMChangesClass); - - function DOMChangesWithSVGInnerHTMLFix() { - _DOMChangesClass.apply(this, arguments); - } - - DOMChangesWithSVGInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent, nextSibling, html) { - if (html === null || html === '') { - return _DOMChangesClass.prototype.insertHTMLBefore.call(this, parent, nextSibling, html); - } - if (parent.namespaceURI !== svgNamespace) { - return _DOMChangesClass.prototype.insertHTMLBefore.call(this, parent, nextSibling, html); - } - return fixSVG(parent, div, html, nextSibling); - }; - - return DOMChangesWithSVGInnerHTMLFix; - })(DOMChangesClass); - } - - function treeConstruction(document, TreeConstructionClass, svgNamespace) { - if (!document) return TreeConstructionClass; - if (!shouldApplyFix(document, svgNamespace)) { - return TreeConstructionClass; - } - var div = document.createElement('div'); - return (function (_TreeConstructionClass) { - babelHelpers.inherits(TreeConstructionWithSVGInnerHTMLFix, _TreeConstructionClass); - - function TreeConstructionWithSVGInnerHTMLFix() { - _TreeConstructionClass.apply(this, arguments); - } - - TreeConstructionWithSVGInnerHTMLFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent, html, reference) { - if (html === null || html === '') { - return _TreeConstructionClass.prototype.insertHTMLBefore.call(this, parent, html, reference); - } - if (parent.namespaceURI !== svgNamespace) { - return _TreeConstructionClass.prototype.insertHTMLBefore.call(this, parent, html, reference); - } - return fixSVG(parent, div, html, reference); - }; - - return TreeConstructionWithSVGInnerHTMLFix; - })(TreeConstructionClass); - } - - function fixSVG(parent, div, html, reference) { - // IE, Edge: also do not correctly support using `innerHTML` on SVG - // namespaced elements. So here a wrapper is used. - var wrappedHtml = '<svg>' + html + '</svg>'; - div.innerHTML = wrappedHtml; - - var _moveNodesBefore = _glimmerRuntimeLibDomHelper.moveNodesBefore(div.firstChild, parent, reference); - - var first = _moveNodesBefore[0]; - var last = _moveNodesBefore[1]; - - return new _glimmerRuntimeLibBounds.ConcreteBounds(parent, first, last); - } - function shouldApplyFix(document, svgNamespace) { - var svg = document.createElementNS(svgNamespace, 'svg'); - try { - svg['insertAdjacentHTML']('beforeEnd', '<circle></circle>'); - } catch (e) {} finally { - // FF: Old versions will create a node in the wrong namespace - if (svg.childNodes.length === 1 && svg.firstChild.namespaceURI === SVG_NAMESPACE) { - // The test worked as expected, no fix required - return false; - } - svg = null; - return true; - } - } -}); - -enifed('glimmer-runtime/lib/compat/text-node-merging-fix', ['exports'], function (exports) { - // Patch: Adjacent text node merging fix - // Browsers: IE, Edge, Firefox w/o inspector open - // Reason: These browsers will merge adjacent text nodes. For exmaple given - // <div>Hello</div> with div.insertAdjacentHTML(' world') browsers - // with proper behavior will populate div.childNodes with two items. - // These browsers will populate it with one merged node instead. - // Fix: Add these nodes to a wrapper element, then iterate the childNodes - // of that wrapper and move the nodes to their target location. Note - // that potential SVG bugs will have been handled before this fix. - // Note that this fix must only apply to the previous text node, as - // the base implementation of `insertHTMLBefore` already handles - // following text nodes correctly. - 'use strict'; - - exports.domChanges = domChanges; - exports.treeConstruction = treeConstruction; - - function domChanges(document, DOMChangesClass) { - if (!document) return DOMChangesClass; - if (!shouldApplyFix(document)) { - return DOMChangesClass; - } - return (function (_DOMChangesClass) { - babelHelpers.inherits(DOMChangesWithTextNodeMergingFix, _DOMChangesClass); - - function DOMChangesWithTextNodeMergingFix(document) { - _DOMChangesClass.call(this, document); - this.uselessComment = document.createComment(''); - } - - DOMChangesWithTextNodeMergingFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent, nextSibling, html) { - if (html === null) { - return _DOMChangesClass.prototype.insertHTMLBefore.call(this, parent, nextSibling, html); - } - var didSetUselessComment = false; - var nextPrevious = nextSibling ? nextSibling.previousSibling : parent.lastChild; - if (nextPrevious && nextPrevious instanceof Text) { - didSetUselessComment = true; - parent.insertBefore(this.uselessComment, nextSibling); - } - var bounds = _DOMChangesClass.prototype.insertHTMLBefore.call(this, parent, nextSibling, html); - if (didSetUselessComment) { - parent.removeChild(this.uselessComment); - } - return bounds; - }; - - return DOMChangesWithTextNodeMergingFix; - })(DOMChangesClass); - } - - function treeConstruction(document, TreeConstructionClass) { - if (!document) return TreeConstructionClass; - if (!shouldApplyFix(document)) { - return TreeConstructionClass; - } - return (function (_TreeConstructionClass) { - babelHelpers.inherits(TreeConstructionWithTextNodeMergingFix, _TreeConstructionClass); - - function TreeConstructionWithTextNodeMergingFix(document) { - _TreeConstructionClass.call(this, document); - this.uselessComment = this.createComment(''); - } - - TreeConstructionWithTextNodeMergingFix.prototype.insertHTMLBefore = function insertHTMLBefore(parent, html, reference) { - if (html === null) { - return _TreeConstructionClass.prototype.insertHTMLBefore.call(this, parent, html, reference); - } - var didSetUselessComment = false; - var nextPrevious = reference ? reference.previousSibling : parent.lastChild; - if (nextPrevious && nextPrevious instanceof Text) { - didSetUselessComment = true; - parent.insertBefore(this.uselessComment, reference); - } - var bounds = _TreeConstructionClass.prototype.insertHTMLBefore.call(this, parent, html, reference); - if (didSetUselessComment) { - parent.removeChild(this.uselessComment); - } - return bounds; - }; - - return TreeConstructionWithTextNodeMergingFix; - })(TreeConstructionClass); - } - - function shouldApplyFix(document) { - var mergingTextDiv = document.createElement('div'); - mergingTextDiv.innerHTML = 'first'; - mergingTextDiv.insertAdjacentHTML('beforeEnd', 'second'); - if (mergingTextDiv.childNodes.length === 2) { - mergingTextDiv = null; - // It worked as expected, no fix required - return false; - } - mergingTextDiv = null; - return true; - } -}); - -enifed('glimmer-runtime/lib/compiled/blocks', ['exports', 'glimmer-runtime/lib/utils', 'glimmer-runtime/lib/compiler'], function (exports, _glimmerRuntimeLibUtils, _glimmerRuntimeLibCompiler) { - 'use strict'; - - var CompiledBlock = function CompiledBlock(ops, symbols) { - this.ops = ops; - this.symbols = symbols; - }; - - exports.CompiledBlock = CompiledBlock; - - var Block = function Block(program, symbolTable) { - this.program = program; - this.symbolTable = symbolTable; - this.compiled = null; - }; - - exports.Block = Block; - - var InlineBlock = (function (_Block) { - babelHelpers.inherits(InlineBlock, _Block); - - function InlineBlock(program, symbolTable) { - var locals = arguments.length <= 2 || arguments[2] === undefined ? _glimmerRuntimeLibUtils.EMPTY_ARRAY : arguments[2]; - - _Block.call(this, program, symbolTable); - this.locals = locals; - } - - InlineBlock.prototype.hasPositionalParameters = function hasPositionalParameters() { - return !!this.locals.length; - }; - - InlineBlock.prototype.compile = function compile(env) { - var compiled = this.compiled; - if (compiled) return compiled; - var ops = new _glimmerRuntimeLibCompiler.InlineBlockCompiler(this, env).compile(); - return this.compiled = new CompiledBlock(ops, this.symbolTable.size); - }; - - return InlineBlock; - })(Block); - - exports.InlineBlock = InlineBlock; - - var PartialBlock = (function (_InlineBlock) { - babelHelpers.inherits(PartialBlock, _InlineBlock); - - function PartialBlock() { - _InlineBlock.apply(this, arguments); - } - - return PartialBlock; - })(InlineBlock); - - exports.PartialBlock = PartialBlock; - - var TopLevelTemplate = (function (_Block2) { - babelHelpers.inherits(TopLevelTemplate, _Block2); - - function TopLevelTemplate() { - _Block2.apply(this, arguments); - } - - return TopLevelTemplate; - })(Block); - - exports.TopLevelTemplate = TopLevelTemplate; - - var EntryPoint = (function (_TopLevelTemplate) { - babelHelpers.inherits(EntryPoint, _TopLevelTemplate); - - function EntryPoint() { - _TopLevelTemplate.apply(this, arguments); - } - - EntryPoint.prototype.compile = function compile(env) { - var compiled = this.compiled; - if (compiled) return compiled; - var ops = new _glimmerRuntimeLibCompiler.EntryPointCompiler(this, env).compile(); - return this.compiled = new CompiledBlock(ops, this.symbolTable.size); - }; - - return EntryPoint; - })(TopLevelTemplate); - - exports.EntryPoint = EntryPoint; - - var Layout = (function (_TopLevelTemplate2) { - babelHelpers.inherits(Layout, _TopLevelTemplate2); - - function Layout(program, symbolTable, named, yields, hasPartials) { - _TopLevelTemplate2.call(this, program, symbolTable); - this.named = named; - this.yields = yields; - this.hasPartials = hasPartials; - this.hasNamedParameters = !!this.named.length; - this.hasYields = !!this.yields.length; - ; - } - - return Layout; - })(TopLevelTemplate); - - exports.Layout = Layout; -}); - -enifed("glimmer-runtime/lib/compiled/expressions", ["exports"], function (exports) { - "use strict"; - - var CompiledExpression = (function () { - function CompiledExpression() {} - - CompiledExpression.prototype.toJSON = function toJSON() { - return "UNIMPL: " + this.type.toUpperCase(); - }; - - return CompiledExpression; - })(); - - exports.CompiledExpression = CompiledExpression; -}); - -enifed('glimmer-runtime/lib/compiled/expressions/args', ['exports', 'glimmer-runtime/lib/compiled/expressions/positional-args', 'glimmer-runtime/lib/compiled/expressions/named-args', 'glimmer-runtime/lib/syntax/core', 'glimmer-reference'], function (exports, _glimmerRuntimeLibCompiledExpressionsPositionalArgs, _glimmerRuntimeLibCompiledExpressionsNamedArgs, _glimmerRuntimeLibSyntaxCore, _glimmerReference) { - 'use strict'; - - var CompiledArgs = (function () { - function CompiledArgs(positional, named, blocks) { - this.positional = positional; - this.named = named; - this.blocks = blocks; - } - - CompiledArgs.create = function create(positional, named, blocks) { - if (positional === _glimmerRuntimeLibCompiledExpressionsPositionalArgs.COMPILED_EMPTY_POSITIONAL_ARGS && named === _glimmerRuntimeLibCompiledExpressionsNamedArgs.COMPILED_EMPTY_NAMED_ARGS && blocks === _glimmerRuntimeLibSyntaxCore.EMPTY_BLOCKS) { - return this.empty(); - } else { - return new this(positional, named, blocks); - } - }; - - CompiledArgs.empty = function empty() { - return COMPILED_EMPTY_ARGS; - }; - - CompiledArgs.prototype.evaluate = function evaluate(vm) { - var positional = this.positional; - var named = this.named; - var blocks = this.blocks; - - return EvaluatedArgs.create(positional.evaluate(vm), named.evaluate(vm), blocks); - }; - - return CompiledArgs; - })(); - - exports.CompiledArgs = CompiledArgs; - - var COMPILED_EMPTY_ARGS = new ((function (_CompiledArgs) { - babelHelpers.inherits(_class, _CompiledArgs); - - function _class() { - _CompiledArgs.call(this, _glimmerRuntimeLibCompiledExpressionsPositionalArgs.COMPILED_EMPTY_POSITIONAL_ARGS, _glimmerRuntimeLibCompiledExpressionsNamedArgs.COMPILED_EMPTY_NAMED_ARGS, _glimmerRuntimeLibSyntaxCore.EMPTY_BLOCKS); - } - - _class.prototype.evaluate = function evaluate(vm) { - return EMPTY_EVALUATED_ARGS; - }; - - return _class; - })(CompiledArgs))(); - - var EvaluatedArgs = (function () { - function EvaluatedArgs(positional, named, blocks) { - this.positional = positional; - this.named = named; - this.blocks = blocks; - this.tag = _glimmerReference.combineTagged([positional, named]); - } - - EvaluatedArgs.empty = function empty() { - return EMPTY_EVALUATED_ARGS; - }; - - EvaluatedArgs.create = function create(positional, named, blocks) { - return new this(positional, named, blocks); - }; - - EvaluatedArgs.positional = function positional(values) { - var blocks = arguments.length <= 1 || arguments[1] === undefined ? _glimmerRuntimeLibSyntaxCore.EMPTY_BLOCKS : arguments[1]; - - return new this(_glimmerRuntimeLibCompiledExpressionsPositionalArgs.EvaluatedPositionalArgs.create(values), _glimmerRuntimeLibCompiledExpressionsNamedArgs.EVALUATED_EMPTY_NAMED_ARGS, blocks); - }; - - EvaluatedArgs.named = function named(map) { - var blocks = arguments.length <= 1 || arguments[1] === undefined ? _glimmerRuntimeLibSyntaxCore.EMPTY_BLOCKS : arguments[1]; - - return new this(_glimmerRuntimeLibCompiledExpressionsPositionalArgs.EVALUATED_EMPTY_POSITIONAL_ARGS, _glimmerRuntimeLibCompiledExpressionsNamedArgs.EvaluatedNamedArgs.create(map), blocks); - }; - - return EvaluatedArgs; - })(); - - exports.EvaluatedArgs = EvaluatedArgs; - - var EMPTY_EVALUATED_ARGS = new EvaluatedArgs(_glimmerRuntimeLibCompiledExpressionsPositionalArgs.EVALUATED_EMPTY_POSITIONAL_ARGS, _glimmerRuntimeLibCompiledExpressionsNamedArgs.EVALUATED_EMPTY_NAMED_ARGS, _glimmerRuntimeLibSyntaxCore.EMPTY_BLOCKS); - exports.CompiledPositionalArgs = _glimmerRuntimeLibCompiledExpressionsPositionalArgs.CompiledPositionalArgs; - exports.EvaluatedPositionalArgs = _glimmerRuntimeLibCompiledExpressionsPositionalArgs.EvaluatedPositionalArgs; - exports.CompiledNamedArgs = _glimmerRuntimeLibCompiledExpressionsNamedArgs.CompiledNamedArgs; - exports.EvaluatedNamedArgs = _glimmerRuntimeLibCompiledExpressionsNamedArgs.EvaluatedNamedArgs; -}); - -enifed("glimmer-runtime/lib/compiled/expressions/concat", ["exports", "glimmer-reference"], function (exports, _glimmerReference) { - "use strict"; - - var CompiledConcat = (function () { - function CompiledConcat(parts) { - this.parts = parts; - this.type = "concat"; - } - - CompiledConcat.prototype.evaluate = function evaluate(vm) { - var parts = new Array(this.parts.length); - for (var i = 0; i < this.parts.length; i++) { - parts[i] = this.parts[i].evaluate(vm); - } - return new ConcatReference(parts); - }; - - CompiledConcat.prototype.toJSON = function toJSON() { - return "concat(" + this.parts.map(function (expr) { - return expr.toJSON(); - }).join(", ") + ")"; - }; - - return CompiledConcat; - })(); - - exports.default = CompiledConcat; - - var ConcatReference = (function (_CachedReference) { - babelHelpers.inherits(ConcatReference, _CachedReference); - - function ConcatReference(parts) { - _CachedReference.call(this); - this.parts = parts; - this.tag = _glimmerReference.combineTagged(parts); - } - - ConcatReference.prototype.compute = function compute() { - var parts = new Array(); - for (var i = 0; i < this.parts.length; i++) { - var value = this.parts[i].value(); - if (value !== null && value !== undefined) { - parts[i] = castToString(this.parts[i].value()); - } - } - if (parts.length > 0) { - return parts.join(''); - } - return null; - }; - - return ConcatReference; - })(_glimmerReference.CachedReference); - - function castToString(value) { - if (typeof value['toString'] !== 'function') { - return ''; - } - return String(value); - } -}); - -enifed('glimmer-runtime/lib/compiled/expressions/function', ['exports', 'glimmer-runtime/lib/syntax', 'glimmer-runtime/lib/compiled/expressions'], function (exports, _glimmerRuntimeLibSyntax, _glimmerRuntimeLibCompiledExpressions) { - 'use strict'; - - exports.default = make; - - function make(func) { - return new FunctionExpressionSyntax(func); - } - - var FunctionExpressionSyntax = (function (_ExpressionSyntax) { - babelHelpers.inherits(FunctionExpressionSyntax, _ExpressionSyntax); - - function FunctionExpressionSyntax(func) { - _ExpressionSyntax.call(this); - this.type = "function-expression"; - this.func = func; - } - - FunctionExpressionSyntax.prototype.compile = function compile(lookup, env, symbolTable) { - return new CompiledFunctionExpression(this.func, symbolTable); - }; - - return FunctionExpressionSyntax; - })(_glimmerRuntimeLibSyntax.Expression); - - var CompiledFunctionExpression = (function (_CompiledExpression) { - babelHelpers.inherits(CompiledFunctionExpression, _CompiledExpression); - - function CompiledFunctionExpression(func, symbolTable) { - _CompiledExpression.call(this); - this.func = func; - this.symbolTable = symbolTable; - this.type = "function"; - this.func = func; - } - - CompiledFunctionExpression.prototype.evaluate = function evaluate(vm) { - var func = this.func; - var symbolTable = this.symbolTable; - - return func(vm, symbolTable); - }; - - CompiledFunctionExpression.prototype.toJSON = function toJSON() { - var func = this.func; - - if (func.name) { - return '`' + func.name + '(...)`'; - } else { - return "`func(...)`"; - } - }; - - return CompiledFunctionExpression; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); -}); - -enifed('glimmer-runtime/lib/compiled/expressions/has-block', ['exports', 'glimmer-runtime/lib/compiled/expressions', 'glimmer-runtime/lib/references'], function (exports, _glimmerRuntimeLibCompiledExpressions, _glimmerRuntimeLibReferences) { - 'use strict'; - - var CompiledHasBlock = (function (_CompiledExpression) { - babelHelpers.inherits(CompiledHasBlock, _CompiledExpression); - - function CompiledHasBlock(inner) { - _CompiledExpression.call(this); - this.inner = inner; - this.type = "has-block"; - } - - CompiledHasBlock.prototype.evaluate = function evaluate(vm) { - var block = this.inner.evaluate(vm); - return _glimmerRuntimeLibReferences.PrimitiveReference.create(!!block); - }; - - CompiledHasBlock.prototype.toJSON = function toJSON() { - return 'has-block(' + this.inner.toJSON() + ')'; - }; - - return CompiledHasBlock; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.default = CompiledHasBlock; - - var CompiledHasBlockParams = (function (_CompiledExpression2) { - babelHelpers.inherits(CompiledHasBlockParams, _CompiledExpression2); - - function CompiledHasBlockParams(inner) { - _CompiledExpression2.call(this); - this.inner = inner; - this.type = "has-block-params"; - } - - CompiledHasBlockParams.prototype.evaluate = function evaluate(vm) { - var block = this.inner.evaluate(vm); - return _glimmerRuntimeLibReferences.PrimitiveReference.create(!!(block && block.locals.length > 0)); - }; - - CompiledHasBlockParams.prototype.toJSON = function toJSON() { - return 'has-block-params(' + this.inner.toJSON() + ')'; - }; - - return CompiledHasBlockParams; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.CompiledHasBlockParams = CompiledHasBlockParams; - - var CompiledGetBlockBySymbol = (function () { - function CompiledGetBlockBySymbol(symbol, debug) { - this.symbol = symbol; - this.debug = debug; - } - - CompiledGetBlockBySymbol.prototype.evaluate = function evaluate(vm) { - return vm.scope().getBlock(this.symbol); - }; - - CompiledGetBlockBySymbol.prototype.toJSON = function toJSON() { - return 'get-block($' + this.symbol + '(' + this.debug + '))'; - }; - - return CompiledGetBlockBySymbol; - })(); - - exports.CompiledGetBlockBySymbol = CompiledGetBlockBySymbol; - - var CompiledInPartialGetBlock = (function () { - function CompiledInPartialGetBlock(symbol, name) { - this.symbol = symbol; - this.name = name; - } - - CompiledInPartialGetBlock.prototype.evaluate = function evaluate(vm) { - var symbol = this.symbol; - var name = this.name; - - var args = vm.scope().getPartialArgs(symbol); - return args.blocks[name]; - }; - - CompiledInPartialGetBlock.prototype.toJSON = function toJSON() { - return 'get-block($' + this.symbol + '($ARGS).' + this.name + '))'; - }; - - return CompiledInPartialGetBlock; - })(); - - exports.CompiledInPartialGetBlock = CompiledInPartialGetBlock; -}); - -enifed('glimmer-runtime/lib/compiled/expressions/helper', ['exports', 'glimmer-runtime/lib/compiled/expressions'], function (exports, _glimmerRuntimeLibCompiledExpressions) { - 'use strict'; - - var CompiledHelper = (function (_CompiledExpression) { - babelHelpers.inherits(CompiledHelper, _CompiledExpression); - - function CompiledHelper(name, helper, args, symbolTable) { - _CompiledExpression.call(this); - this.name = name; - this.helper = helper; - this.args = args; - this.symbolTable = symbolTable; - this.type = "helper"; - } - - CompiledHelper.prototype.evaluate = function evaluate(vm) { - var helper = this.helper; - - return helper(vm, this.args.evaluate(vm), this.symbolTable); - }; - - CompiledHelper.prototype.toJSON = function toJSON() { - return '`' + this.name.join('.') + '($ARGS)`'; - }; - - return CompiledHelper; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.default = CompiledHelper; -}); - -enifed('glimmer-runtime/lib/compiled/expressions/lookups', ['exports', 'glimmer-runtime/lib/compiled/expressions', 'glimmer-reference'], function (exports, _glimmerRuntimeLibCompiledExpressions, _glimmerReference) { - 'use strict'; - - var CompiledLookup = (function (_CompiledExpression) { - babelHelpers.inherits(CompiledLookup, _CompiledExpression); - - function CompiledLookup(base, path) { - _CompiledExpression.call(this); - this.base = base; - this.path = path; - this.type = "lookup"; - } - - CompiledLookup.create = function create(base, path) { - if (path.length === 0) { - return base; - } else { - return new this(base, path); - } - }; - - CompiledLookup.prototype.evaluate = function evaluate(vm) { - var base = this.base; - var path = this.path; - - return _glimmerReference.referenceFromParts(base.evaluate(vm), path); - }; - - CompiledLookup.prototype.toJSON = function toJSON() { - return this.base.toJSON() + '.' + this.path.join('.'); - }; - - return CompiledLookup; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.default = CompiledLookup; - - var CompiledSelf = (function (_CompiledExpression2) { - babelHelpers.inherits(CompiledSelf, _CompiledExpression2); - - function CompiledSelf() { - _CompiledExpression2.apply(this, arguments); - } - - CompiledSelf.prototype.evaluate = function evaluate(vm) { - return vm.getSelf(); - }; - - CompiledSelf.prototype.toJSON = function toJSON() { - return 'self'; - }; - - return CompiledSelf; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.CompiledSelf = CompiledSelf; - - var CompiledSymbol = (function (_CompiledExpression3) { - babelHelpers.inherits(CompiledSymbol, _CompiledExpression3); - - function CompiledSymbol(symbol, debug) { - _CompiledExpression3.call(this); - this.symbol = symbol; - this.debug = debug; - } - - CompiledSymbol.prototype.evaluate = function evaluate(vm) { - return vm.referenceForSymbol(this.symbol); - }; - - CompiledSymbol.prototype.toJSON = function toJSON() { - return '$' + this.symbol + '(' + this.debug + ')'; - }; - - return CompiledSymbol; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.CompiledSymbol = CompiledSymbol; - - var CompiledInPartialName = (function (_CompiledExpression4) { - babelHelpers.inherits(CompiledInPartialName, _CompiledExpression4); - - function CompiledInPartialName(symbol, name) { - _CompiledExpression4.call(this); - this.symbol = symbol; - this.name = name; - } - - CompiledInPartialName.prototype.evaluate = function evaluate(vm) { - var symbol = this.symbol; - var name = this.name; - - var args = vm.scope().getPartialArgs(symbol); - return args.named.get(name); - }; - - CompiledInPartialName.prototype.toJSON = function toJSON() { - return '$' + this.symbol + '($ARGS).' + this.name; - }; - - return CompiledInPartialName; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.CompiledInPartialName = CompiledInPartialName; -}); - -enifed('glimmer-runtime/lib/compiled/expressions/named-args', ['exports', 'glimmer-runtime/lib/references', 'glimmer-runtime/lib/utils', 'glimmer-reference', 'glimmer-util'], function (exports, _glimmerRuntimeLibReferences, _glimmerRuntimeLibUtils, _glimmerReference, _glimmerUtil) { - 'use strict'; - - var CompiledNamedArgs = (function () { - function CompiledNamedArgs(keys, values) { - this.keys = keys; - this.values = values; - this.length = keys.length; - _glimmerUtil.assert(keys.length === values.length, 'Keys and values do not have the same length'); - } - - CompiledNamedArgs.empty = function empty() { - return COMPILED_EMPTY_NAMED_ARGS; - }; - - CompiledNamedArgs.create = function create(map) { - var keys = Object.keys(map); - var length = keys.length; - if (length > 0) { - var values = []; - for (var i = 0; i < length; i++) { - values[i] = map[keys[i]]; - } - return new this(keys, values); - } else { - return COMPILED_EMPTY_NAMED_ARGS; - } - }; - - CompiledNamedArgs.prototype.evaluate = function evaluate(vm) { - var keys = this.keys; - var values = this.values; - var length = this.length; - - var evaluated = new Array(length); - for (var i = 0; i < length; i++) { - evaluated[i] = values[i].evaluate(vm); - } - return new EvaluatedNamedArgs(keys, evaluated); - }; - - CompiledNamedArgs.prototype.toJSON = function toJSON() { - var keys = this.keys; - var values = this.values; - - var inner = keys.map(function (key, i) { - return key + ': ' + values[i].toJSON(); - }).join(", "); - return '{' + inner + '}'; - }; - - return CompiledNamedArgs; - })(); - - exports.CompiledNamedArgs = CompiledNamedArgs; - var COMPILED_EMPTY_NAMED_ARGS = new ((function (_CompiledNamedArgs) { - babelHelpers.inherits(_class, _CompiledNamedArgs); - - function _class() { - _CompiledNamedArgs.call(this, _glimmerRuntimeLibUtils.EMPTY_ARRAY, _glimmerRuntimeLibUtils.EMPTY_ARRAY); - } - - _class.prototype.evaluate = function evaluate(vm) { - return EVALUATED_EMPTY_NAMED_ARGS; - }; - - _class.prototype.toJSON = function toJSON() { - return '<EMPTY>'; - }; - - return _class; - })(CompiledNamedArgs))(); - exports.COMPILED_EMPTY_NAMED_ARGS = COMPILED_EMPTY_NAMED_ARGS; - - var EvaluatedNamedArgs = (function () { - function EvaluatedNamedArgs(keys, values) { - var _map = arguments.length <= 2 || arguments[2] === undefined ? undefined : arguments[2]; - - this.keys = keys; - this.values = values; - this._map = _map; - this.tag = _glimmerReference.combineTagged(values); - this.length = keys.length; - _glimmerUtil.assert(keys.length === values.length, 'Keys and values do not have the same length'); - } - - EvaluatedNamedArgs.create = function create(map) { - var keys = Object.keys(map); - var length = keys.length; - if (length > 0) { - var values = new Array(length); - for (var i = 0; i < length; i++) { - values[i] = map[keys[i]]; - } - return new this(keys, values, map); - } else { - return EVALUATED_EMPTY_NAMED_ARGS; - } - }; - - EvaluatedNamedArgs.empty = function empty() { - return EVALUATED_EMPTY_NAMED_ARGS; - }; - - EvaluatedNamedArgs.prototype.get = function get(key) { - var keys = this.keys; - var values = this.values; - - var index = keys.indexOf(key); - return index === -1 ? _glimmerRuntimeLibReferences.UNDEFINED_REFERENCE : values[index]; - }; - - EvaluatedNamedArgs.prototype.has = function has(key) { - return this.keys.indexOf(key) !== -1; - }; - - EvaluatedNamedArgs.prototype.value = function value() { - var keys = this.keys; - var values = this.values; - - var out = _glimmerUtil.dict(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var ref = values[i]; - out[key] = ref.value(); - } - return out; - }; - - babelHelpers.createClass(EvaluatedNamedArgs, [{ - key: 'map', - get: function () { - var map = this._map; - - if (map) { - return map; - } - map = this._map = _glimmerUtil.dict(); - var keys = this.keys; - var values = this.values; - var length = this.length; - - for (var i = 0; i < length; i++) { - map[keys[i]] = values[i]; - } - return map; - } - }]); - return EvaluatedNamedArgs; - })(); - - exports.EvaluatedNamedArgs = EvaluatedNamedArgs; - var EVALUATED_EMPTY_NAMED_ARGS = new ((function (_EvaluatedNamedArgs) { - babelHelpers.inherits(_class2, _EvaluatedNamedArgs); - - function _class2() { - _EvaluatedNamedArgs.call(this, _glimmerRuntimeLibUtils.EMPTY_ARRAY, _glimmerRuntimeLibUtils.EMPTY_ARRAY, _glimmerRuntimeLibUtils.EMPTY_DICT); - } - - _class2.prototype.get = function get() { - return _glimmerRuntimeLibReferences.UNDEFINED_REFERENCE; - }; - - _class2.prototype.has = function has(key) { - return false; - }; - - _class2.prototype.value = function value() { - return _glimmerRuntimeLibUtils.EMPTY_DICT; - }; - - return _class2; - })(EvaluatedNamedArgs))(); - exports.EVALUATED_EMPTY_NAMED_ARGS = EVALUATED_EMPTY_NAMED_ARGS; -}); - -enifed('glimmer-runtime/lib/compiled/expressions/positional-args', ['exports', 'glimmer-runtime/lib/references', 'glimmer-runtime/lib/utils', 'glimmer-reference'], function (exports, _glimmerRuntimeLibReferences, _glimmerRuntimeLibUtils, _glimmerReference) { - 'use strict'; - - var CompiledPositionalArgs = (function () { - function CompiledPositionalArgs(values) { - this.values = values; - this.length = values.length; - } - - CompiledPositionalArgs.create = function create(values) { - if (values.length) { - return new this(values); - } else { - return COMPILED_EMPTY_POSITIONAL_ARGS; - } - }; - - CompiledPositionalArgs.empty = function empty() { - return COMPILED_EMPTY_POSITIONAL_ARGS; - }; - - CompiledPositionalArgs.prototype.evaluate = function evaluate(vm) { - var values = this.values; - var length = this.length; - - var references = new Array(length); - for (var i = 0; i < length; i++) { - references[i] = values[i].evaluate(vm); - } - return EvaluatedPositionalArgs.create(references); - }; - - CompiledPositionalArgs.prototype.toJSON = function toJSON() { - return '[' + this.values.map(function (value) { - return value.toJSON(); - }).join(", ") + ']'; - }; - - return CompiledPositionalArgs; - })(); - - exports.CompiledPositionalArgs = CompiledPositionalArgs; - var COMPILED_EMPTY_POSITIONAL_ARGS = new ((function (_CompiledPositionalArgs) { - babelHelpers.inherits(_class, _CompiledPositionalArgs); - - function _class() { - _CompiledPositionalArgs.call(this, _glimmerRuntimeLibUtils.EMPTY_ARRAY); - } - - _class.prototype.evaluate = function evaluate(vm) { - return EVALUATED_EMPTY_POSITIONAL_ARGS; - }; - - _class.prototype.toJSON = function toJSON() { - return '<EMPTY>'; - }; - - return _class; - })(CompiledPositionalArgs))(); - exports.COMPILED_EMPTY_POSITIONAL_ARGS = COMPILED_EMPTY_POSITIONAL_ARGS; - - var EvaluatedPositionalArgs = (function () { - function EvaluatedPositionalArgs(values) { - this.values = values; - this.tag = _glimmerReference.combineTagged(values); - this.length = values.length; - } - - EvaluatedPositionalArgs.create = function create(values) { - return new this(values); - }; - - EvaluatedPositionalArgs.empty = function empty() { - return EVALUATED_EMPTY_POSITIONAL_ARGS; - }; - - EvaluatedPositionalArgs.prototype.at = function at(index) { - var values = this.values; - var length = this.length; - - return index < length ? values[index] : _glimmerRuntimeLibReferences.UNDEFINED_REFERENCE; - }; - - EvaluatedPositionalArgs.prototype.value = function value() { - var values = this.values; - var length = this.length; - - var ret = new Array(length); - for (var i = 0; i < length; i++) { - ret[i] = values[i].value(); - } - return ret; - }; - - return EvaluatedPositionalArgs; - })(); - - exports.EvaluatedPositionalArgs = EvaluatedPositionalArgs; - var EVALUATED_EMPTY_POSITIONAL_ARGS = new ((function (_EvaluatedPositionalArgs) { - babelHelpers.inherits(_class2, _EvaluatedPositionalArgs); - - function _class2() { - _EvaluatedPositionalArgs.call(this, _glimmerRuntimeLibUtils.EMPTY_ARRAY); - } - - _class2.prototype.at = function at() { - return _glimmerRuntimeLibReferences.UNDEFINED_REFERENCE; - }; - - _class2.prototype.value = function value() { - return this.values; - }; - - return _class2; - })(EvaluatedPositionalArgs))(); - exports.EVALUATED_EMPTY_POSITIONAL_ARGS = EVALUATED_EMPTY_POSITIONAL_ARGS; -}); - -enifed('glimmer-runtime/lib/compiled/expressions/value', ['exports', 'glimmer-runtime/lib/compiled/expressions', 'glimmer-runtime/lib/references'], function (exports, _glimmerRuntimeLibCompiledExpressions, _glimmerRuntimeLibReferences) { - 'use strict'; - - var CompiledValue = (function (_CompiledExpression) { - babelHelpers.inherits(CompiledValue, _CompiledExpression); - - function CompiledValue(value) { - _CompiledExpression.call(this); - this.type = "value"; - this.reference = _glimmerRuntimeLibReferences.PrimitiveReference.create(value); - } - - CompiledValue.prototype.evaluate = function evaluate(vm) { - return this.reference; - }; - - CompiledValue.prototype.toJSON = function toJSON() { - return JSON.stringify(this.reference.value()); - }; - - return CompiledValue; - })(_glimmerRuntimeLibCompiledExpressions.CompiledExpression); - - exports.default = CompiledValue; -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/builder', ['exports', 'glimmer-runtime/lib/compiled/opcodes/component', 'glimmer-runtime/lib/compiled/opcodes/partial', 'glimmer-runtime/lib/compiled/opcodes/content', 'glimmer-runtime/lib/compiled/opcodes/dom', 'glimmer-runtime/lib/compiled/opcodes/lists', 'glimmer-runtime/lib/compiled/opcodes/vm', 'glimmer-util', 'glimmer-runtime/lib/utils'], function (exports, _glimmerRuntimeLibCompiledOpcodesComponent, _glimmerRuntimeLibCompiledOpcodesPartial, _glimmerRuntimeLibCompiledOpcodesContent, _glimmerRuntimeLibCompiledOpcodesDom, _glimmerRuntimeLibCompiledOpcodesLists, _glimmerRuntimeLibCompiledOpcodesVm, _glimmerUtil, _glimmerRuntimeLibUtils) { - 'use strict'; - - var StatementCompilationBufferProxy = (function () { - function StatementCompilationBufferProxy(inner) { - this.inner = inner; - } - - StatementCompilationBufferProxy.prototype.toOpSeq = function toOpSeq() { - return this.inner.toOpSeq(); - }; - - StatementCompilationBufferProxy.prototype.append = function append(opcode) { - this.inner.append(opcode); - }; - - StatementCompilationBufferProxy.prototype.getLocalSymbol = function getLocalSymbol(name) { - return this.inner.getLocalSymbol(name); - }; - - StatementCompilationBufferProxy.prototype.hasLocalSymbol = function hasLocalSymbol(name) { - return this.inner.hasLocalSymbol(name); - }; - - StatementCompilationBufferProxy.prototype.getNamedSymbol = function getNamedSymbol(name) { - return this.inner.getNamedSymbol(name); - }; - - StatementCompilationBufferProxy.prototype.hasNamedSymbol = function hasNamedSymbol(name) { - return this.inner.hasNamedSymbol(name); - }; - - StatementCompilationBufferProxy.prototype.getBlockSymbol = function getBlockSymbol(name) { - return this.inner.getBlockSymbol(name); - }; - - StatementCompilationBufferProxy.prototype.hasBlockSymbol = function hasBlockSymbol(name) { - return this.inner.hasBlockSymbol(name); - }; - - StatementCompilationBufferProxy.prototype.getPartialArgsSymbol = function getPartialArgsSymbol() { - return this.inner.getPartialArgsSymbol(); - }; - - StatementCompilationBufferProxy.prototype.hasPartialArgsSymbol = function hasPartialArgsSymbol() { - return this.inner.hasPartialArgsSymbol(); - }; - - babelHelpers.createClass(StatementCompilationBufferProxy, [{ - key: 'component', - get: function () { - return this.inner.component; - } - }]); - return StatementCompilationBufferProxy; - })(); - - exports.StatementCompilationBufferProxy = StatementCompilationBufferProxy; - - var BasicOpcodeBuilder = (function (_StatementCompilationBufferProxy) { - babelHelpers.inherits(BasicOpcodeBuilder, _StatementCompilationBufferProxy); - - function BasicOpcodeBuilder(inner, symbolTable, env) { - _StatementCompilationBufferProxy.call(this, inner); - this.symbolTable = symbolTable; - this.env = env; - this.labelsStack = new _glimmerUtil.Stack(); - } - - // helpers - - BasicOpcodeBuilder.prototype.startLabels = function startLabels() { - this.labelsStack.push(_glimmerUtil.dict()); - }; - - BasicOpcodeBuilder.prototype.stopLabels = function stopLabels() { - this.labelsStack.pop(); - }; - - BasicOpcodeBuilder.prototype.labelFor = function labelFor(name) { - var labels = this.labels; - var label = labels[name]; - if (!label) { - label = labels[name] = new _glimmerRuntimeLibCompiledOpcodesVm.LabelOpcode(name); - } - return label; - }; - - // partials - - BasicOpcodeBuilder.prototype.putPartialDefinition = function putPartialDefinition(definition) { - this.append(new _glimmerRuntimeLibCompiledOpcodesPartial.PutPartialDefinitionOpcode(definition)); - }; - - BasicOpcodeBuilder.prototype.putDynamicPartialDefinition = function putDynamicPartialDefinition() { - this.append(new _glimmerRuntimeLibCompiledOpcodesPartial.PutDynamicPartialDefinitionOpcode(this.symbolTable)); - }; - - BasicOpcodeBuilder.prototype.evaluatePartial = function evaluatePartial() { - this.append(new _glimmerRuntimeLibCompiledOpcodesPartial.EvaluatePartialOpcode(this.symbolTable)); - }; - - // components - - BasicOpcodeBuilder.prototype.putComponentDefinition = function putComponentDefinition(definition) { - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.PutComponentDefinitionOpcode(definition)); - }; - - BasicOpcodeBuilder.prototype.putDynamicComponentDefinition = function putDynamicComponentDefinition() { - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.PutDynamicComponentDefinitionOpcode()); - }; - - BasicOpcodeBuilder.prototype.openComponent = function openComponent(args) { - var shadow = arguments.length <= 1 || arguments[1] === undefined ? _glimmerRuntimeLibUtils.EMPTY_ARRAY : arguments[1]; - - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.OpenComponentOpcode(this.compile(args), shadow)); - }; - - BasicOpcodeBuilder.prototype.didCreateElement = function didCreateElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.DidCreateElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.shadowAttributes = function shadowAttributes() { - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.ShadowAttributesOpcode()); - }; - - BasicOpcodeBuilder.prototype.didRenderLayout = function didRenderLayout() { - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.DidRenderLayoutOpcode()); - }; - - BasicOpcodeBuilder.prototype.closeComponent = function closeComponent() { - this.append(new _glimmerRuntimeLibCompiledOpcodesComponent.CloseComponentOpcode()); - }; - - // content - - BasicOpcodeBuilder.prototype.cautiousAppend = function cautiousAppend() { - this.append(new _glimmerRuntimeLibCompiledOpcodesContent.OptimizedCautiousAppendOpcode()); - }; - - BasicOpcodeBuilder.prototype.trustingAppend = function trustingAppend() { - this.append(new _glimmerRuntimeLibCompiledOpcodesContent.OptimizedTrustingAppendOpcode()); - }; - - // dom - - BasicOpcodeBuilder.prototype.text = function text(_text) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.TextOpcode(_text)); - }; - - BasicOpcodeBuilder.prototype.openPrimitiveElement = function openPrimitiveElement(tag) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.OpenPrimitiveElementOpcode(tag)); - }; - - BasicOpcodeBuilder.prototype.openComponentElement = function openComponentElement(tag) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.OpenComponentElementOpcode(tag)); - }; - - BasicOpcodeBuilder.prototype.openDynamicPrimitiveElement = function openDynamicPrimitiveElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.OpenDynamicPrimitiveElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.flushElement = function flushElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.FlushElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.closeElement = function closeElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.CloseElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.staticAttr = function staticAttr(name, namespace, value) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.StaticAttrOpcode(name, namespace, value)); - }; - - BasicOpcodeBuilder.prototype.dynamicAttrNS = function dynamicAttrNS(name, namespace, isTrusting) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.DynamicAttrNSOpcode(name, namespace, isTrusting)); - }; - - BasicOpcodeBuilder.prototype.dynamicAttr = function dynamicAttr(name, isTrusting) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.DynamicAttrOpcode(name, isTrusting)); - }; - - BasicOpcodeBuilder.prototype.comment = function comment(_comment) { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.CommentOpcode(_comment)); - }; - - // lists - - BasicOpcodeBuilder.prototype.putIterator = function putIterator() { - this.append(new _glimmerRuntimeLibCompiledOpcodesLists.PutIteratorOpcode()); - }; - - BasicOpcodeBuilder.prototype.enterList = function enterList(start, end) { - this.append(new _glimmerRuntimeLibCompiledOpcodesLists.EnterListOpcode(this.labelFor(start), this.labelFor(end))); - }; - - BasicOpcodeBuilder.prototype.exitList = function exitList() { - this.append(new _glimmerRuntimeLibCompiledOpcodesLists.ExitListOpcode()); - }; - - BasicOpcodeBuilder.prototype.enterWithKey = function enterWithKey(start, end) { - this.append(new _glimmerRuntimeLibCompiledOpcodesLists.EnterWithKeyOpcode(this.labelFor(start), this.labelFor(end))); - }; - - BasicOpcodeBuilder.prototype.nextIter = function nextIter(end) { - this.append(new _glimmerRuntimeLibCompiledOpcodesLists.NextIterOpcode(this.labelFor(end))); - }; - - // vm - - BasicOpcodeBuilder.prototype.pushRemoteElement = function pushRemoteElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.PushRemoteElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.popRemoteElement = function popRemoteElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.PopRemoteElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.popElement = function popElement() { - this.append(new _glimmerRuntimeLibCompiledOpcodesDom.PopElementOpcode()); - }; - - BasicOpcodeBuilder.prototype.label = function label(name) { - this.append(this.labelFor(name)); - }; - - BasicOpcodeBuilder.prototype.pushChildScope = function pushChildScope() { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PushChildScopeOpcode()); - }; - - BasicOpcodeBuilder.prototype.popScope = function popScope() { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PopScopeOpcode()); - }; - - BasicOpcodeBuilder.prototype.pushDynamicScope = function pushDynamicScope() { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PushDynamicScopeOpcode()); - }; - - BasicOpcodeBuilder.prototype.popDynamicScope = function popDynamicScope() { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PopDynamicScopeOpcode()); - }; - - BasicOpcodeBuilder.prototype.putNull = function putNull() { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PutNullOpcode()); - }; - - BasicOpcodeBuilder.prototype.putValue = function putValue(expression) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PutValueOpcode(this.compile(expression))); - }; - - BasicOpcodeBuilder.prototype.putArgs = function putArgs(args) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.PutArgsOpcode(this.compile(args))); - }; - - BasicOpcodeBuilder.prototype.bindDynamicScope = function bindDynamicScope(names) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.BindDynamicScopeOpcode(names)); - }; - - BasicOpcodeBuilder.prototype.bindPositionalArgs = function bindPositionalArgs(names, symbols) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.BindPositionalArgsOpcode(names, symbols)); - }; - - BasicOpcodeBuilder.prototype.bindNamedArgs = function bindNamedArgs(names, symbols) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.BindNamedArgsOpcode(names, symbols)); - }; - - BasicOpcodeBuilder.prototype.bindBlocks = function bindBlocks(names, symbols) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.BindBlocksOpcode(names, symbols)); - }; - - BasicOpcodeBuilder.prototype.enter = function enter(_enter, exit) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.EnterOpcode(this.labelFor(_enter), this.labelFor(exit))); - }; - - BasicOpcodeBuilder.prototype.exit = function exit() { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.ExitOpcode()); - }; - - BasicOpcodeBuilder.prototype.evaluate = function evaluate(name, block) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.EvaluateOpcode(name, block)); - }; - - BasicOpcodeBuilder.prototype.test = function test(testFunc) { - if (testFunc === 'const') { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.TestOpcode(_glimmerRuntimeLibCompiledOpcodesVm.ConstTest)); - } else if (testFunc === 'simple') { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.TestOpcode(_glimmerRuntimeLibCompiledOpcodesVm.SimpleTest)); - } else if (testFunc === 'environment') { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.TestOpcode(_glimmerRuntimeLibCompiledOpcodesVm.EnvironmentTest)); - } else if (typeof testFunc === 'function') { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.TestOpcode(testFunc)); - } else { - throw new Error('unreachable'); - } - }; - - BasicOpcodeBuilder.prototype.jump = function jump(target) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.JumpOpcode(this.labelFor(target))); - }; - - BasicOpcodeBuilder.prototype.jumpIf = function jumpIf(target) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.JumpIfOpcode(this.labelFor(target))); - }; - - BasicOpcodeBuilder.prototype.jumpUnless = function jumpUnless(target) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.JumpUnlessOpcode(this.labelFor(target))); - }; - - babelHelpers.createClass(BasicOpcodeBuilder, [{ - key: 'labels', - get: function () { - return this.labelsStack.current; - } - }]); - return BasicOpcodeBuilder; - })(StatementCompilationBufferProxy); - - exports.BasicOpcodeBuilder = BasicOpcodeBuilder; - - function isCompilableExpression(expr) { - return expr && typeof expr['compile'] === 'function'; - } - - var OpcodeBuilder = (function (_BasicOpcodeBuilder) { - babelHelpers.inherits(OpcodeBuilder, _BasicOpcodeBuilder); - - function OpcodeBuilder() { - _BasicOpcodeBuilder.apply(this, arguments); - } - - OpcodeBuilder.prototype.compile = function compile(expr) { - if (isCompilableExpression(expr)) { - return expr.compile(this, this.env, this.symbolTable); - } else { - return expr; - } - }; - - OpcodeBuilder.prototype.bindPositionalArgsForBlock = function bindPositionalArgsForBlock(block) { - this.append(_glimmerRuntimeLibCompiledOpcodesVm.BindPositionalArgsOpcode.create(block)); - }; - - OpcodeBuilder.prototype.preludeForLayout = function preludeForLayout(layout) { - if (layout.hasNamedParameters) { - this.append(_glimmerRuntimeLibCompiledOpcodesVm.BindNamedArgsOpcode.create(layout)); - } - if (layout.hasYields || layout.hasPartials) { - this.append(new _glimmerRuntimeLibCompiledOpcodesVm.BindCallerScopeOpcode()); - } - if (layout.hasYields) { - this.append(_glimmerRuntimeLibCompiledOpcodesVm.BindBlocksOpcode.create(layout)); - } - if (layout.hasPartials) { - this.append(_glimmerRuntimeLibCompiledOpcodesVm.BindPartialArgsOpcode.create(layout)); - } - }; - - // TODO - // come back to this - - OpcodeBuilder.prototype.block = function block(args, callback) { - if (args) this.putArgs(args); - this.startLabels(); - this.enter('BEGIN', 'END'); - this.label('BEGIN'); - callback(this, 'BEGIN', 'END'); - this.label('END'); - this.exit(); - this.stopLabels(); - }; - - // TODO - // come back to this - - OpcodeBuilder.prototype.iter = function iter(callback) { - this.startLabels(); - this.enterList('BEGIN', 'END'); - this.label('ITER'); - this.nextIter('BREAK'); - this.enterWithKey('BEGIN', 'END'); - this.label('BEGIN'); - callback(this, 'BEGIN', 'END'); - this.label('END'); - this.exit(); - this.jump('ITER'); - this.label('BREAK'); - this.exitList(); - this.stopLabels(); - }; - - // TODO - // come back to this - - OpcodeBuilder.prototype.unit = function unit(callback) { - this.startLabels(); - callback(this); - this.stopLabels(); - }; - - return OpcodeBuilder; - })(BasicOpcodeBuilder); - - exports.default = OpcodeBuilder; -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/component', ['exports', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/compiled/opcodes/vm', 'glimmer-reference'], function (exports, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibCompiledOpcodesVm, _glimmerReference) { - 'use strict'; - - var PutDynamicComponentDefinitionOpcode = (function (_Opcode) { - babelHelpers.inherits(PutDynamicComponentDefinitionOpcode, _Opcode); - - function PutDynamicComponentDefinitionOpcode() { - _Opcode.apply(this, arguments); - this.type = "put-dynamic-component-definition"; - } - - PutDynamicComponentDefinitionOpcode.prototype.evaluate = function evaluate(vm) { - var reference = vm.frame.getOperand(); - var cache = _glimmerReference.isConst(reference) ? undefined : new _glimmerReference.ReferenceCache(reference); - var definition = cache ? cache.peek() : reference.value(); - vm.frame.setImmediate(definition); - if (cache) { - vm.updateWith(new _glimmerRuntimeLibCompiledOpcodesVm.Assert(cache)); - } - }; - - PutDynamicComponentDefinitionOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND"] - }; - }; - - return PutDynamicComponentDefinitionOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutDynamicComponentDefinitionOpcode = PutDynamicComponentDefinitionOpcode; - - var PutComponentDefinitionOpcode = (function (_Opcode2) { - babelHelpers.inherits(PutComponentDefinitionOpcode, _Opcode2); - - function PutComponentDefinitionOpcode(definition) { - _Opcode2.call(this); - this.definition = definition; - this.type = "put-component-definition"; - } - - PutComponentDefinitionOpcode.prototype.evaluate = function evaluate(vm) { - vm.frame.setImmediate(this.definition); - }; - - PutComponentDefinitionOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.definition.name)] - }; - }; - - return PutComponentDefinitionOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutComponentDefinitionOpcode = PutComponentDefinitionOpcode; - - var OpenComponentOpcode = (function (_Opcode3) { - babelHelpers.inherits(OpenComponentOpcode, _Opcode3); - - function OpenComponentOpcode(args, shadow) { - _Opcode3.call(this); - this.args = args; - this.shadow = shadow; - this.type = "open-component"; - } - - OpenComponentOpcode.prototype.evaluate = function evaluate(vm) { - var rawArgs = this.args; - var shadow = this.shadow; - - var definition = vm.frame.getImmediate(); - var dynamicScope = vm.pushDynamicScope(); - var callerScope = vm.scope(); - var manager = definition.manager; - var args = manager.prepareArgs(definition, rawArgs.evaluate(vm), dynamicScope); - var hasDefaultBlock = !!args.blocks.default; // TODO Cleanup? - var component = manager.create(vm.env, definition, args, dynamicScope, vm.getSelf(), hasDefaultBlock); - var destructor = manager.getDestructor(component); - if (destructor) vm.newDestroyable(destructor); - var layout = manager.layoutFor(definition, component, vm.env); - var selfRef = manager.getSelf(component); - vm.beginCacheGroup(); - vm.stack().pushSimpleBlock(); - vm.pushRootScope(selfRef, layout.symbols); - vm.invokeLayout(args, layout, callerScope, component, manager, shadow); - vm.updateWith(new UpdateComponentOpcode(definition.name, component, manager, args, dynamicScope)); - }; - - OpenComponentOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND"] - }; - }; - - return OpenComponentOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.OpenComponentOpcode = OpenComponentOpcode; - - var UpdateComponentOpcode = (function (_UpdatingOpcode) { - babelHelpers.inherits(UpdateComponentOpcode, _UpdatingOpcode); - - function UpdateComponentOpcode(name, component, manager, args, dynamicScope) { - _UpdatingOpcode.call(this); - this.name = name; - this.component = component; - this.manager = manager; - this.args = args; - this.dynamicScope = dynamicScope; - this.type = "update-component"; - var componentTag = manager.getTag(component); - if (componentTag) { - this.tag = _glimmerReference.combine([args.tag, componentTag]); - } else { - this.tag = args.tag; - } - } - - UpdateComponentOpcode.prototype.evaluate = function evaluate(vm) { - var component = this.component; - var manager = this.manager; - var args = this.args; - var dynamicScope = this.dynamicScope; - - manager.update(component, args, dynamicScope); - }; - - UpdateComponentOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.name)] - }; - }; - - return UpdateComponentOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.UpdateComponentOpcode = UpdateComponentOpcode; - - var DidCreateElementOpcode = (function (_Opcode4) { - babelHelpers.inherits(DidCreateElementOpcode, _Opcode4); - - function DidCreateElementOpcode() { - _Opcode4.apply(this, arguments); - this.type = "did-create-element"; - } - - // Slow path for non-specialized component invocations. Uses an internal - // named lookup on the args. - - DidCreateElementOpcode.prototype.evaluate = function evaluate(vm) { - var manager = vm.frame.getManager(); - var component = vm.frame.getComponent(); - manager.didCreateElement(component, vm.stack().constructing, vm.stack().operations); - }; - - DidCreateElementOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$ARGS"] - }; - }; - - return DidCreateElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.DidCreateElementOpcode = DidCreateElementOpcode; - - var ShadowAttributesOpcode = (function (_Opcode5) { - babelHelpers.inherits(ShadowAttributesOpcode, _Opcode5); - - function ShadowAttributesOpcode() { - _Opcode5.apply(this, arguments); - this.type = "shadow-attributes"; - } - - ShadowAttributesOpcode.prototype.evaluate = function evaluate(vm) { - var shadow = vm.frame.getShadow(); - if (!shadow) return; - - var _vm$frame$getArgs = vm.frame.getArgs(); - - var named = _vm$frame$getArgs.named; - - shadow.forEach(function (name) { - vm.stack().setDynamicAttribute(name, named.get(name), false); - }); - }; - - ShadowAttributesOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$ARGS"] - }; - }; - - return ShadowAttributesOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.ShadowAttributesOpcode = ShadowAttributesOpcode; - - var DidRenderLayoutOpcode = (function (_Opcode6) { - babelHelpers.inherits(DidRenderLayoutOpcode, _Opcode6); - - function DidRenderLayoutOpcode() { - _Opcode6.apply(this, arguments); - this.type = "did-render-layout"; - } - - DidRenderLayoutOpcode.prototype.evaluate = function evaluate(vm) { - var manager = vm.frame.getManager(); - var component = vm.frame.getComponent(); - var bounds = vm.stack().popBlock(); - manager.didRenderLayout(component, bounds); - vm.env.didCreate(component, manager); - vm.updateWith(new DidUpdateLayoutOpcode(manager, component, bounds)); - }; - - return DidRenderLayoutOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.DidRenderLayoutOpcode = DidRenderLayoutOpcode; - - var DidUpdateLayoutOpcode = (function (_UpdatingOpcode2) { - babelHelpers.inherits(DidUpdateLayoutOpcode, _UpdatingOpcode2); - - function DidUpdateLayoutOpcode(manager, component, bounds) { - _UpdatingOpcode2.call(this); - this.manager = manager; - this.component = component; - this.bounds = bounds; - this.type = "did-update-layout"; - this.tag = _glimmerReference.CONSTANT_TAG; - } - - DidUpdateLayoutOpcode.prototype.evaluate = function evaluate(vm) { - var manager = this.manager; - var component = this.component; - var bounds = this.bounds; - - manager.didUpdateLayout(component, bounds); - vm.env.didUpdate(component, manager); - }; - - return DidUpdateLayoutOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.DidUpdateLayoutOpcode = DidUpdateLayoutOpcode; - - var CloseComponentOpcode = (function (_Opcode7) { - babelHelpers.inherits(CloseComponentOpcode, _Opcode7); - - function CloseComponentOpcode() { - _Opcode7.apply(this, arguments); - this.type = "close-component"; - } - - CloseComponentOpcode.prototype.evaluate = function evaluate(vm) { - vm.popScope(); - vm.popDynamicScope(); - vm.commitCacheGroup(); - }; - - return CloseComponentOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.CloseComponentOpcode = CloseComponentOpcode; -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/content', ['exports', 'glimmer-runtime/lib/upsert', 'glimmer-runtime/lib/component/interfaces', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/vm/update', 'glimmer-reference', 'glimmer-util', 'glimmer-runtime/lib/bounds', 'glimmer-runtime/lib/builder', 'glimmer-runtime/lib/compiler', 'glimmer-runtime/lib/compiled/opcodes/builder', 'glimmer-runtime/lib/references', 'glimmer-runtime/lib/syntax/core'], function (exports, _glimmerRuntimeLibUpsert, _glimmerRuntimeLibComponentInterfaces, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibVmUpdate, _glimmerReference, _glimmerUtil, _glimmerRuntimeLibBounds, _glimmerRuntimeLibBuilder, _glimmerRuntimeLibCompiler, _glimmerRuntimeLibCompiledOpcodesBuilder, _glimmerRuntimeLibReferences, _glimmerRuntimeLibSyntaxCore) { - 'use strict'; - - exports.normalizeTextValue = normalizeTextValue; - - function isEmpty(value) { - return value === null || value === undefined || typeof value['toString'] !== 'function'; - } - - function normalizeTextValue(value) { - if (isEmpty(value)) { - return ''; - } - return String(value); - } - - function normalizeTrustedValue(value) { - if (isEmpty(value)) { - return ''; - } - if (_glimmerRuntimeLibUpsert.isString(value)) { - return value; - } - if (_glimmerRuntimeLibUpsert.isSafeString(value)) { - return value.toHTML(); - } - if (_glimmerRuntimeLibUpsert.isNode(value)) { - return value; - } - return String(value); - } - function normalizeValue(value) { - if (isEmpty(value)) { - return ''; - } - if (_glimmerRuntimeLibUpsert.isString(value)) { - return value; - } - if (_glimmerRuntimeLibUpsert.isSafeString(value) || _glimmerRuntimeLibUpsert.isNode(value)) { - return value; - } - return String(value); - } - - var AppendOpcode = (function (_Opcode) { - babelHelpers.inherits(AppendOpcode, _Opcode); - - function AppendOpcode() { - _Opcode.apply(this, arguments); - } - - AppendOpcode.prototype.evaluate = function evaluate(vm) { - var reference = vm.frame.getOperand(); - var normalized = this.normalize(reference); - var value = undefined, - cache = undefined; - if (_glimmerReference.isConst(reference)) { - value = normalized.value(); - } else { - cache = new _glimmerReference.ReferenceCache(normalized); - value = cache.peek(); - } - var stack = vm.stack(); - var upsert = this.insert(vm.env.getAppendOperations(), stack, value); - var bounds = new _glimmerRuntimeLibBuilder.Fragment(upsert.bounds); - stack.newBounds(bounds); - if (cache /* i.e. !isConst(reference) */) { - vm.updateWith(this.updateWith(vm, reference, cache, bounds, upsert)); - } - }; - - AppendOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND"] - }; - }; - - return AppendOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.AppendOpcode = AppendOpcode; - - var GuardedAppendOpcode = (function (_AppendOpcode) { - babelHelpers.inherits(GuardedAppendOpcode, _AppendOpcode); - - function GuardedAppendOpcode(expression, symbolTable) { - _AppendOpcode.call(this); - this.expression = expression; - this.symbolTable = symbolTable; - this.deopted = null; - } - - GuardedAppendOpcode.prototype.evaluate = function evaluate(vm) { - if (this.deopted) { - vm.pushEvalFrame(this.deopted); - } else { - vm.evaluateOperand(this.expression); - var value = vm.frame.getOperand().value(); - if (_glimmerRuntimeLibComponentInterfaces.isComponentDefinition(value)) { - vm.pushEvalFrame(this.deopt(vm.env)); - } else { - _AppendOpcode.prototype.evaluate.call(this, vm); - } - } - }; - - GuardedAppendOpcode.prototype.deopt = function deopt(env) { - var _this = this; - - // At compile time, we determined that this append callsite might refer - // to a local variable/property lookup that resolves to a component - // definition at runtime. - // - // We could have eagerly compiled this callsite into something like this: - // - // {{#if (is-component-definition foo)}} - // {{component foo}} - // {{else}} - // {{foo}} - // {{/if}} - // - // However, in practice, there might be a large amout of these callsites - // and most of them would resolve to a simple value lookup. Therefore, we - // tried to be optimistic and assumed that the callsite will resolve to - // appending a simple value. - // - // However, we have reached here because at runtime, the guard conditional - // have detected that this callsite is indeed referring to a component - // definition object. Since this is likely going to be true for other - // instances of the same callsite, it is now appropiate to deopt into the - // expanded version that handles both cases. The compilation would look - // like this: - // - // PutValue(expression) - // Test(is-component-definition) - // Enter(BEGIN, END) - // BEGIN: Noop - // JumpUnless(VALUE) - // PutDynamicComponentDefinitionOpcode - // OpenComponent - // CloseComponent - // Jump(END) - // VALUE: Noop - // OptimizedAppend - // END: Noop - // Exit - // - // Keep in mind that even if we *don't* reach here at initial render time, - // it is still possible (although quite rare) that the simple value we - // encounter during initial render could later change into a component - // definition object at update time. That is handled by the "lazy deopt" - // code on the update side (scroll down for the next big block of comment). - var buffer = new _glimmerRuntimeLibCompiler.CompileIntoList(env, null); - var dsl = new _glimmerRuntimeLibCompiledOpcodesBuilder.default(buffer, this.symbolTable, env); - dsl.putValue(this.expression); - dsl.test(IsComponentDefinitionReference.create); - dsl.block(null, function (dsl, BEGIN, END) { - dsl.jumpUnless('VALUE'); - dsl.putDynamicComponentDefinition(); - dsl.openComponent(_glimmerRuntimeLibSyntaxCore.Args.empty()); - dsl.closeComponent(); - dsl.jump(END); - dsl.label('VALUE'); - dsl.append(new _this.AppendOpcode()); - }); - var deopted = this.deopted = dsl.toOpSeq(); - // From this point on, we have essentially replaced ourselve with a new set - // of opcodes. Since we will always be executing the new/deopted code, it's - // a good idea (as a pattern) to null out any unneeded fields here to avoid - // holding on to unneeded/stale objects: - this.expression = null; - return deopted; - }; - - GuardedAppendOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var deopted = this.deopted; - - if (deopted) { - return { - guid: guid, - type: type, - deopted: true, - children: deopted.toArray().map(function (op) { - return op.toJSON(); - }) - }; - } else { - return { - guid: guid, - type: type, - args: [this.expression.toJSON()] - }; - } - }; - - return GuardedAppendOpcode; - })(AppendOpcode); - - exports.GuardedAppendOpcode = GuardedAppendOpcode; - - var IsComponentDefinitionReference = (function (_ConditionalReference) { - babelHelpers.inherits(IsComponentDefinitionReference, _ConditionalReference); - - function IsComponentDefinitionReference() { - _ConditionalReference.apply(this, arguments); - } - - IsComponentDefinitionReference.create = function create(inner) { - return new IsComponentDefinitionReference(inner); - }; - - IsComponentDefinitionReference.prototype.toBool = function toBool(value) { - return _glimmerRuntimeLibComponentInterfaces.isComponentDefinition(value); - }; - - return IsComponentDefinitionReference; - })(_glimmerRuntimeLibReferences.ConditionalReference); - - var UpdateOpcode = (function (_UpdatingOpcode) { - babelHelpers.inherits(UpdateOpcode, _UpdatingOpcode); - - function UpdateOpcode(cache, bounds, upsert) { - _UpdatingOpcode.call(this); - this.cache = cache; - this.bounds = bounds; - this.upsert = upsert; - this.tag = cache.tag; - } - - UpdateOpcode.prototype.evaluate = function evaluate(vm) { - var value = this.cache.revalidate(); - if (_glimmerReference.isModified(value)) { - var bounds = this.bounds; - var upsert = this.upsert; - var dom = vm.dom; - - if (!this.upsert.update(dom, value)) { - var cursor = new _glimmerRuntimeLibBounds.Cursor(bounds.parentElement(), _glimmerRuntimeLibBounds.clear(bounds)); - upsert = this.upsert = this.insert(vm.env.getAppendOperations(), cursor, value); - } - bounds.update(upsert.bounds); - } - }; - - UpdateOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var cache = this.cache; - - return { - guid: guid, - type: type, - details: { lastValue: JSON.stringify(cache.peek()) } - }; - }; - - return UpdateOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - var GuardedUpdateOpcode = (function (_UpdateOpcode) { - babelHelpers.inherits(GuardedUpdateOpcode, _UpdateOpcode); - - function GuardedUpdateOpcode(reference, cache, bounds, upsert, appendOpcode, state) { - _UpdateOpcode.call(this, cache, bounds, upsert); - this.reference = reference; - this.appendOpcode = appendOpcode; - this.state = state; - this.deopted = null; - this.tag = this._tag = new _glimmerReference.UpdatableTag(this.tag); - } - - GuardedUpdateOpcode.prototype.evaluate = function evaluate(vm) { - if (this.deopted) { - vm.evaluateOpcode(this.deopted); - } else { - if (_glimmerRuntimeLibComponentInterfaces.isComponentDefinition(this.reference.value())) { - this.lazyDeopt(vm); - } else { - _UpdateOpcode.prototype.evaluate.call(this, vm); - } - } - }; - - GuardedUpdateOpcode.prototype.lazyDeopt = function lazyDeopt(vm) { - // Durign initial render, we know that the reference does not contain a - // component definition, so we optimistically assumed that this append - // is just a normal append. However, at update time, we discovered that - // the reference has switched into containing a component definition, so - // we need to do a "lazy deopt", simulating what would have happened if - // we had decided to perform the deopt in the first place during initial - // render. - // - // More concretely, we would have expanded the curly into a if/else, and - // based on whether the value is a component definition or not, we would - // have entered either the dynamic component branch or the simple value - // branch. - // - // Since we rendered a simple value during initial render (and all the - // updates up until this point), we need to pretend that the result is - // produced by the "VALUE" branch of the deopted append opcode: - // - // Try(BEGIN, END) - // Assert(IsComponentDefinition, expected=false) - // OptimizedUpdate - // - // In this case, because the reference has switched from being a simple - // value into a component definition, what would have happened is that - // the assert would throw, causing the Try opcode to teardown the bounds - // and rerun the original append opcode. - // - // Since the Try opcode would have nuked the updating opcodes anyway, we - // wouldn't have to worry about simulating those. All we have to do is to - // execute the Try opcode and immediately throw. - var bounds = this.bounds; - var appendOpcode = this.appendOpcode; - var state = this.state; - - var appendOps = appendOpcode.deopt(vm.env); - var enter = appendOps.head().next.next; - var ops = enter.slice; - var tracker = new _glimmerRuntimeLibBuilder.UpdatableBlockTracker(bounds.parentElement()); - tracker.newBounds(this.bounds); - var children = new _glimmerUtil.LinkedList(); - state.frame['condition'] = IsComponentDefinitionReference.create(state.frame['operand']); - var deopted = this.deopted = new _glimmerRuntimeLibVmUpdate.TryOpcode(ops, state, tracker, children); - this._tag.update(deopted.tag); - vm.evaluateOpcode(deopted); - vm.throw(); - // From this point on, we have essentially replaced ourselve with a new - // opcode. Since we will always be executing the new/deopted code, it's a - // good idea (as a pattern) to null out any unneeded fields here to avoid - // holding on to unneeded/stale objects: - this._tag = null; - this.reference = null; - this.cache = null; - this.bounds = null; - this.upsert = null; - this.appendOpcode = null; - this.state = null; - }; - - GuardedUpdateOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var deopted = this.deopted; - - if (deopted) { - return { - guid: guid, - type: type, - deopted: true, - children: [deopted.toJSON()] - }; - } else { - return _UpdateOpcode.prototype.toJSON.call(this); - } - }; - - return GuardedUpdateOpcode; - })(UpdateOpcode); - - var OptimizedCautiousAppendOpcode = (function (_AppendOpcode2) { - babelHelpers.inherits(OptimizedCautiousAppendOpcode, _AppendOpcode2); - - function OptimizedCautiousAppendOpcode() { - _AppendOpcode2.apply(this, arguments); - this.type = 'optimized-cautious-append'; - } - - OptimizedCautiousAppendOpcode.prototype.normalize = function normalize(reference) { - return _glimmerReference.map(reference, normalizeValue); - }; - - OptimizedCautiousAppendOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.cautiousInsert(dom, cursor, value); - }; - - OptimizedCautiousAppendOpcode.prototype.updateWith = function updateWith(vm, reference, cache, bounds, upsert) { - return new OptimizedCautiousUpdateOpcode(cache, bounds, upsert); - }; - - return OptimizedCautiousAppendOpcode; - })(AppendOpcode); - - exports.OptimizedCautiousAppendOpcode = OptimizedCautiousAppendOpcode; - - var OptimizedCautiousUpdateOpcode = (function (_UpdateOpcode2) { - babelHelpers.inherits(OptimizedCautiousUpdateOpcode, _UpdateOpcode2); - - function OptimizedCautiousUpdateOpcode() { - _UpdateOpcode2.apply(this, arguments); - this.type = 'optimized-cautious-update'; - } - - OptimizedCautiousUpdateOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.cautiousInsert(dom, cursor, value); - }; - - return OptimizedCautiousUpdateOpcode; - })(UpdateOpcode); - - var GuardedCautiousAppendOpcode = (function (_GuardedAppendOpcode) { - babelHelpers.inherits(GuardedCautiousAppendOpcode, _GuardedAppendOpcode); - - function GuardedCautiousAppendOpcode() { - _GuardedAppendOpcode.apply(this, arguments); - this.type = 'guarded-cautious-append'; - this.AppendOpcode = OptimizedCautiousAppendOpcode; - } - - GuardedCautiousAppendOpcode.prototype.normalize = function normalize(reference) { - return _glimmerReference.map(reference, normalizeValue); - }; - - GuardedCautiousAppendOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.cautiousInsert(dom, cursor, value); - }; - - GuardedCautiousAppendOpcode.prototype.updateWith = function updateWith(vm, reference, cache, bounds, upsert) { - return new GuardedCautiousUpdateOpcode(reference, cache, bounds, upsert, this, vm.capture()); - }; - - return GuardedCautiousAppendOpcode; - })(GuardedAppendOpcode); - - exports.GuardedCautiousAppendOpcode = GuardedCautiousAppendOpcode; - - var GuardedCautiousUpdateOpcode = (function (_GuardedUpdateOpcode) { - babelHelpers.inherits(GuardedCautiousUpdateOpcode, _GuardedUpdateOpcode); - - function GuardedCautiousUpdateOpcode() { - _GuardedUpdateOpcode.apply(this, arguments); - this.type = 'guarded-cautious-update'; - } - - GuardedCautiousUpdateOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.cautiousInsert(dom, cursor, value); - }; - - return GuardedCautiousUpdateOpcode; - })(GuardedUpdateOpcode); - - var OptimizedTrustingAppendOpcode = (function (_AppendOpcode3) { - babelHelpers.inherits(OptimizedTrustingAppendOpcode, _AppendOpcode3); - - function OptimizedTrustingAppendOpcode() { - _AppendOpcode3.apply(this, arguments); - this.type = 'optimized-trusting-append'; - } - - OptimizedTrustingAppendOpcode.prototype.normalize = function normalize(reference) { - return _glimmerReference.map(reference, normalizeTrustedValue); - }; - - OptimizedTrustingAppendOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.trustingInsert(dom, cursor, value); - }; - - OptimizedTrustingAppendOpcode.prototype.updateWith = function updateWith(vm, reference, cache, bounds, upsert) { - return new OptimizedTrustingUpdateOpcode(cache, bounds, upsert); - }; - - return OptimizedTrustingAppendOpcode; - })(AppendOpcode); - - exports.OptimizedTrustingAppendOpcode = OptimizedTrustingAppendOpcode; - - var OptimizedTrustingUpdateOpcode = (function (_UpdateOpcode3) { - babelHelpers.inherits(OptimizedTrustingUpdateOpcode, _UpdateOpcode3); - - function OptimizedTrustingUpdateOpcode() { - _UpdateOpcode3.apply(this, arguments); - this.type = 'optimized-trusting-update'; - } - - OptimizedTrustingUpdateOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.trustingInsert(dom, cursor, value); - }; - - return OptimizedTrustingUpdateOpcode; - })(UpdateOpcode); - - var GuardedTrustingAppendOpcode = (function (_GuardedAppendOpcode2) { - babelHelpers.inherits(GuardedTrustingAppendOpcode, _GuardedAppendOpcode2); - - function GuardedTrustingAppendOpcode() { - _GuardedAppendOpcode2.apply(this, arguments); - this.type = 'guarded-trusting-append'; - this.AppendOpcode = OptimizedTrustingAppendOpcode; - } - - GuardedTrustingAppendOpcode.prototype.normalize = function normalize(reference) { - return _glimmerReference.map(reference, normalizeTrustedValue); - }; - - GuardedTrustingAppendOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.trustingInsert(dom, cursor, value); - }; - - GuardedTrustingAppendOpcode.prototype.updateWith = function updateWith(vm, reference, cache, bounds, upsert) { - return new GuardedTrustingUpdateOpcode(reference, cache, bounds, upsert, this, vm.capture()); - }; - - return GuardedTrustingAppendOpcode; - })(GuardedAppendOpcode); - - exports.GuardedTrustingAppendOpcode = GuardedTrustingAppendOpcode; - - var GuardedTrustingUpdateOpcode = (function (_GuardedUpdateOpcode2) { - babelHelpers.inherits(GuardedTrustingUpdateOpcode, _GuardedUpdateOpcode2); - - function GuardedTrustingUpdateOpcode() { - _GuardedUpdateOpcode2.apply(this, arguments); - this.type = 'trusting-update'; - } - - GuardedTrustingUpdateOpcode.prototype.insert = function insert(dom, cursor, value) { - return _glimmerRuntimeLibUpsert.trustingInsert(dom, cursor, value); - }; - - return GuardedTrustingUpdateOpcode; - })(GuardedUpdateOpcode); -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/dom', ['exports', 'glimmer-runtime/lib/opcodes', 'glimmer-util', 'glimmer-reference', 'glimmer-runtime/lib/references', 'glimmer-runtime/lib/compiled/opcodes/vm'], function (exports, _glimmerRuntimeLibOpcodes, _glimmerUtil, _glimmerReference, _glimmerRuntimeLibReferences, _glimmerRuntimeLibCompiledOpcodesVm) { - 'use strict'; - - var TextOpcode = (function (_Opcode) { - babelHelpers.inherits(TextOpcode, _Opcode); - - function TextOpcode(text) { - _Opcode.call(this); - this.text = text; - this.type = "text"; - } - - TextOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().appendText(this.text); - }; - - TextOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.text)] - }; - }; - - return TextOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.TextOpcode = TextOpcode; - - var OpenPrimitiveElementOpcode = (function (_Opcode2) { - babelHelpers.inherits(OpenPrimitiveElementOpcode, _Opcode2); - - function OpenPrimitiveElementOpcode(tag) { - _Opcode2.call(this); - this.tag = tag; - this.type = "open-primitive-element"; - } - - OpenPrimitiveElementOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().openElement(this.tag); - }; - - OpenPrimitiveElementOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.tag)] - }; - }; - - return OpenPrimitiveElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.OpenPrimitiveElementOpcode = OpenPrimitiveElementOpcode; - - var PushRemoteElementOpcode = (function (_Opcode3) { - babelHelpers.inherits(PushRemoteElementOpcode, _Opcode3); - - function PushRemoteElementOpcode() { - _Opcode3.apply(this, arguments); - this.type = "push-remote-element"; - } - - PushRemoteElementOpcode.prototype.evaluate = function evaluate(vm) { - var reference = vm.frame.getOperand(); - var cache = _glimmerReference.isConst(reference) ? undefined : new _glimmerReference.ReferenceCache(reference); - var element = cache ? cache.peek() : reference.value(); - vm.stack().pushRemoteElement(element); - if (cache) { - vm.updateWith(new _glimmerRuntimeLibCompiledOpcodesVm.Assert(cache)); - } - }; - - PushRemoteElementOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ['$OPERAND'] - }; - }; - - return PushRemoteElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PushRemoteElementOpcode = PushRemoteElementOpcode; - - var PopRemoteElementOpcode = (function (_Opcode4) { - babelHelpers.inherits(PopRemoteElementOpcode, _Opcode4); - - function PopRemoteElementOpcode() { - _Opcode4.apply(this, arguments); - this.type = "pop-remote-element"; - } - - PopRemoteElementOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().popRemoteElement(); - }; - - return PopRemoteElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PopRemoteElementOpcode = PopRemoteElementOpcode; - - var OpenComponentElementOpcode = (function (_Opcode5) { - babelHelpers.inherits(OpenComponentElementOpcode, _Opcode5); - - function OpenComponentElementOpcode(tag) { - _Opcode5.call(this); - this.tag = tag; - this.type = "open-component-element"; - } - - OpenComponentElementOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().openElement(this.tag, new ComponentElementOperations(vm.env)); - }; - - OpenComponentElementOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.tag)] - }; - }; - - return OpenComponentElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.OpenComponentElementOpcode = OpenComponentElementOpcode; - - var OpenDynamicPrimitiveElementOpcode = (function (_Opcode6) { - babelHelpers.inherits(OpenDynamicPrimitiveElementOpcode, _Opcode6); - - function OpenDynamicPrimitiveElementOpcode() { - _Opcode6.apply(this, arguments); - this.type = "open-dynamic-primitive-element"; - } - - OpenDynamicPrimitiveElementOpcode.prototype.evaluate = function evaluate(vm) { - var tagName = vm.frame.getOperand().value(); - vm.stack().openElement(tagName); - }; - - OpenDynamicPrimitiveElementOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND"] - }; - }; - - return OpenDynamicPrimitiveElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.OpenDynamicPrimitiveElementOpcode = OpenDynamicPrimitiveElementOpcode; - - var ClassList = (function () { - function ClassList() { - this.list = null; - this.isConst = true; - } - - ClassList.prototype.append = function append(reference) { - var list = this.list; - var isConst = this.isConst; - - if (list === null) list = this.list = []; - list.push(reference); - this.isConst = isConst && _glimmerReference.isConst(reference); - }; - - ClassList.prototype.toReference = function toReference() { - var list = this.list; - var isConst = this.isConst; - - if (!list) return _glimmerRuntimeLibReferences.NULL_REFERENCE; - if (isConst) return _glimmerRuntimeLibReferences.PrimitiveReference.create(toClassName(list)); - return new ClassListReference(list); - }; - - return ClassList; - })(); - - var ClassListReference = (function (_CachedReference) { - babelHelpers.inherits(ClassListReference, _CachedReference); - - function ClassListReference(list) { - _CachedReference.call(this); - this.list = []; - this.tag = _glimmerReference.combineTagged(list); - this.list = list; - } - - ClassListReference.prototype.compute = function compute() { - return toClassName(this.list); - }; - - return ClassListReference; - })(_glimmerReference.CachedReference); - - function toClassName(list) { - var ret = []; - for (var i = 0; i < list.length; i++) { - var value = list[i].value(); - if (value !== false && value !== null && value !== undefined) ret.push(value); - } - return ret.length === 0 ? null : ret.join(' '); - } - - var SimpleElementOperations = (function () { - function SimpleElementOperations(env) { - this.env = env; - this.opcodes = null; - this.classList = null; - } - - SimpleElementOperations.prototype.addStaticAttribute = function addStaticAttribute(element, name, value) { - if (name === 'class') { - this.addClass(_glimmerRuntimeLibReferences.PrimitiveReference.create(value)); - } else { - this.env.getAppendOperations().setAttribute(element, name, value); - } - }; - - SimpleElementOperations.prototype.addStaticAttributeNS = function addStaticAttributeNS(element, namespace, name, value) { - this.env.getAppendOperations().setAttribute(element, name, value, namespace); - }; - - SimpleElementOperations.prototype.addDynamicAttribute = function addDynamicAttribute(element, name, reference, isTrusting) { - if (name === 'class') { - this.addClass(reference); - } else { - var attributeManager = this.env.attributeFor(element, name, isTrusting); - var attribute = new DynamicAttribute(element, attributeManager, name, reference); - this.addAttribute(attribute); - } - }; - - SimpleElementOperations.prototype.addDynamicAttributeNS = function addDynamicAttributeNS(element, namespace, name, reference, isTrusting) { - var attributeManager = this.env.attributeFor(element, name, isTrusting, namespace); - var nsAttribute = new DynamicAttribute(element, attributeManager, name, reference, namespace); - this.addAttribute(nsAttribute); - }; - - SimpleElementOperations.prototype.flush = function flush(element, vm) { - var env = vm.env; - var opcodes = this.opcodes; - var classList = this.classList; - - for (var i = 0; opcodes && i < opcodes.length; i++) { - vm.updateWith(opcodes[i]); - } - if (classList) { - var attributeManager = env.attributeFor(element, 'class', false); - var attribute = new DynamicAttribute(element, attributeManager, 'class', classList.toReference()); - var opcode = attribute.flush(env); - if (opcode) { - vm.updateWith(opcode); - } - } - this.opcodes = null; - this.classList = null; - }; - - SimpleElementOperations.prototype.addClass = function addClass(reference) { - var classList = this.classList; - - if (!classList) { - classList = this.classList = new ClassList(); - } - classList.append(reference); - }; - - SimpleElementOperations.prototype.addAttribute = function addAttribute(attribute) { - var opcode = attribute.flush(this.env); - if (opcode) { - var opcodes = this.opcodes; - - if (!opcodes) { - opcodes = this.opcodes = []; - } - opcodes.push(opcode); - } - }; - - return SimpleElementOperations; - })(); - - exports.SimpleElementOperations = SimpleElementOperations; - - var ComponentElementOperations = (function () { - function ComponentElementOperations(env) { - this.env = env; - this.attributeNames = null; - this.attributes = null; - this.classList = null; - } - - ComponentElementOperations.prototype.addStaticAttribute = function addStaticAttribute(element, name, value) { - if (name === 'class') { - this.addClass(_glimmerRuntimeLibReferences.PrimitiveReference.create(value)); - } else if (this.shouldAddAttribute(name)) { - this.addAttribute(name, new StaticAttribute(element, name, value)); - } - }; - - ComponentElementOperations.prototype.addStaticAttributeNS = function addStaticAttributeNS(element, namespace, name, value) { - if (this.shouldAddAttribute(name)) { - this.addAttribute(name, new StaticAttribute(element, name, value, namespace)); - } - }; - - ComponentElementOperations.prototype.addDynamicAttribute = function addDynamicAttribute(element, name, reference, isTrusting) { - if (name === 'class') { - this.addClass(reference); - } else if (this.shouldAddAttribute(name)) { - var attributeManager = this.env.attributeFor(element, name, isTrusting); - var attribute = new DynamicAttribute(element, attributeManager, name, reference); - this.addAttribute(name, attribute); - } - }; - - ComponentElementOperations.prototype.addDynamicAttributeNS = function addDynamicAttributeNS(element, namespace, name, reference, isTrusting) { - if (this.shouldAddAttribute(name)) { - var attributeManager = this.env.attributeFor(element, name, isTrusting, namespace); - var nsAttribute = new DynamicAttribute(element, attributeManager, name, reference, namespace); - this.addAttribute(name, nsAttribute); - } - }; - - ComponentElementOperations.prototype.flush = function flush(element, vm) { - var env = this.env; - var attributes = this.attributes; - var classList = this.classList; - - for (var i = 0; attributes && i < attributes.length; i++) { - var opcode = attributes[i].flush(env); - if (opcode) { - vm.updateWith(opcode); - } - } - if (classList) { - var attributeManager = env.attributeFor(element, 'class', false); - var attribute = new DynamicAttribute(element, attributeManager, 'class', classList.toReference()); - var opcode = attribute.flush(env); - if (opcode) { - vm.updateWith(opcode); - } - } - }; - - ComponentElementOperations.prototype.shouldAddAttribute = function shouldAddAttribute(name) { - return !this.attributeNames || this.attributeNames.indexOf(name) === -1; - }; - - ComponentElementOperations.prototype.addClass = function addClass(reference) { - var classList = this.classList; - - if (!classList) { - classList = this.classList = new ClassList(); - } - classList.append(reference); - }; - - ComponentElementOperations.prototype.addAttribute = function addAttribute(name, attribute) { - var attributeNames = this.attributeNames; - var attributes = this.attributes; - - if (!attributeNames) { - attributeNames = this.attributeNames = []; - attributes = this.attributes = []; - } - attributeNames.push(name); - attributes.push(attribute); - }; - - return ComponentElementOperations; - })(); - - exports.ComponentElementOperations = ComponentElementOperations; - - var FlushElementOpcode = (function (_Opcode7) { - babelHelpers.inherits(FlushElementOpcode, _Opcode7); - - function FlushElementOpcode() { - _Opcode7.apply(this, arguments); - this.type = "flush-element"; - } - - FlushElementOpcode.prototype.evaluate = function evaluate(vm) { - var stack = vm.stack(); - stack.operations.flush(stack.constructing, vm); - stack.flushElement(); - }; - - return FlushElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.FlushElementOpcode = FlushElementOpcode; - - var CloseElementOpcode = (function (_Opcode8) { - babelHelpers.inherits(CloseElementOpcode, _Opcode8); - - function CloseElementOpcode() { - _Opcode8.apply(this, arguments); - this.type = "close-element"; - } - - CloseElementOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().closeElement(); - }; - - return CloseElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.CloseElementOpcode = CloseElementOpcode; - - var PopElementOpcode = (function (_Opcode9) { - babelHelpers.inherits(PopElementOpcode, _Opcode9); - - function PopElementOpcode() { - _Opcode9.apply(this, arguments); - this.type = "pop-element"; - } - - PopElementOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().popElement(); - }; - - return PopElementOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PopElementOpcode = PopElementOpcode; - - var StaticAttrOpcode = (function (_Opcode10) { - babelHelpers.inherits(StaticAttrOpcode, _Opcode10); - - function StaticAttrOpcode(namespace, name, value) { - _Opcode10.call(this); - this.namespace = namespace; - this.name = name; - this.value = value; - this.type = "static-attr"; - } - - StaticAttrOpcode.prototype.evaluate = function evaluate(vm) { - var name = this.name; - var value = this.value; - var namespace = this.namespace; - - if (namespace) { - vm.stack().setStaticAttributeNS(namespace, name, value); - } else { - vm.stack().setStaticAttribute(name, value); - } - }; - - StaticAttrOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var namespace = this.namespace; - var name = this.name; - var value = this.value; - - var details = _glimmerUtil.dict(); - if (namespace) { - details["namespace"] = JSON.stringify(namespace); - } - details["name"] = JSON.stringify(name); - details["value"] = JSON.stringify(value); - return { guid: guid, type: type, details: details }; - }; - - return StaticAttrOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.StaticAttrOpcode = StaticAttrOpcode; - - var ModifierOpcode = (function (_Opcode11) { - babelHelpers.inherits(ModifierOpcode, _Opcode11); - - function ModifierOpcode(name, manager, args) { - _Opcode11.call(this); - this.name = name; - this.manager = manager; - this.args = args; - this.type = "modifier"; - } - - ModifierOpcode.prototype.evaluate = function evaluate(vm) { - var manager = this.manager; - - var stack = vm.stack(); - var element = stack.constructing; - var updateOperations = stack.updateOperations; - - var args = this.args.evaluate(vm); - var dynamicScope = vm.dynamicScope(); - var modifier = manager.create(element, args, dynamicScope, updateOperations); - vm.env.scheduleInstallModifier(modifier, manager); - var destructor = manager.getDestructor(modifier); - if (destructor) { - vm.newDestroyable(destructor); - } - vm.updateWith(new UpdateModifierOpcode(manager, modifier, args)); - }; - - ModifierOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var name = this.name; - var args = this.args; - - var details = _glimmerUtil.dict(); - details["type"] = JSON.stringify(type); - details["name"] = JSON.stringify(name); - details["args"] = JSON.stringify(args); - return { guid: guid, type: type, details: details }; - }; - - return ModifierOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.ModifierOpcode = ModifierOpcode; - - var UpdateModifierOpcode = (function (_UpdatingOpcode) { - babelHelpers.inherits(UpdateModifierOpcode, _UpdatingOpcode); - - function UpdateModifierOpcode(manager, modifier, args) { - _UpdatingOpcode.call(this); - this.manager = manager; - this.modifier = modifier; - this.args = args; - this.type = "update-modifier"; - this.tag = args.tag; - this.lastUpdated = args.tag.value(); - } - - UpdateModifierOpcode.prototype.evaluate = function evaluate(vm) { - var manager = this.manager; - var modifier = this.modifier; - var tag = this.tag; - var lastUpdated = this.lastUpdated; - - if (!tag.validate(lastUpdated)) { - vm.env.scheduleUpdateModifier(modifier, manager); - this.lastUpdated = tag.value(); - } - }; - - UpdateModifierOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.args)] - }; - }; - - return UpdateModifierOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.UpdateModifierOpcode = UpdateModifierOpcode; - - var StaticAttribute = (function () { - function StaticAttribute(element, name, value, namespace) { - this.element = element; - this.name = name; - this.value = value; - this.namespace = namespace; - } - - StaticAttribute.prototype.flush = function flush(env) { - env.getAppendOperations().setAttribute(this.element, this.name, this.value, this.namespace); - return null; - }; - - return StaticAttribute; - })(); - - exports.StaticAttribute = StaticAttribute; - - var DynamicAttribute = (function () { - function DynamicAttribute(element, attributeManager, name, reference, namespace) { - this.element = element; - this.attributeManager = attributeManager; - this.name = name; - this.reference = reference; - this.namespace = namespace; - this.tag = reference.tag; - this.cache = null; - } - - DynamicAttribute.prototype.patch = function patch(env) { - var element = this.element; - var cache = this.cache; - - var value = cache.revalidate(); - if (_glimmerReference.isModified(value)) { - this.attributeManager.updateAttribute(env, element, value, this.namespace); - } - }; - - DynamicAttribute.prototype.flush = function flush(env) { - var reference = this.reference; - var element = this.element; - - if (_glimmerReference.isConst(reference)) { - var value = reference.value(); - this.attributeManager.setAttribute(env, element, value, this.namespace); - return null; - } else { - var cache = this.cache = new _glimmerReference.ReferenceCache(reference); - var value = cache.peek(); - this.attributeManager.setAttribute(env, element, value, this.namespace); - return new PatchElementOpcode(this); - } - }; - - DynamicAttribute.prototype.toJSON = function toJSON() { - var element = this.element; - var namespace = this.namespace; - var name = this.name; - var cache = this.cache; - - var formattedElement = formatElement(element); - var lastValue = cache.peek(); - if (namespace) { - return { - element: formattedElement, - type: 'attribute', - namespace: namespace, - name: name, - lastValue: lastValue - }; - } - return { - element: formattedElement, - type: 'attribute', - namespace: namespace, - name: name, - lastValue: lastValue - }; - }; - - return DynamicAttribute; - })(); - - exports.DynamicAttribute = DynamicAttribute; - - function formatElement(element) { - return JSON.stringify('<' + element.tagName.toLowerCase() + ' />'); - } - - var DynamicAttrNSOpcode = (function (_Opcode12) { - babelHelpers.inherits(DynamicAttrNSOpcode, _Opcode12); - - function DynamicAttrNSOpcode(name, namespace, isTrusting) { - _Opcode12.call(this); - this.name = name; - this.namespace = namespace; - this.isTrusting = isTrusting; - this.type = "dynamic-attr"; - } - - DynamicAttrNSOpcode.prototype.evaluate = function evaluate(vm) { - var name = this.name; - var namespace = this.namespace; - var isTrusting = this.isTrusting; - - var reference = vm.frame.getOperand(); - vm.stack().setDynamicAttributeNS(namespace, name, reference, isTrusting); - }; - - DynamicAttrNSOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var name = this.name; - var namespace = this.namespace; - - var details = _glimmerUtil.dict(); - details["name"] = JSON.stringify(name); - details["value"] = "$OPERAND"; - if (namespace) { - details["namespace"] = JSON.stringify(namespace); - } - return { guid: guid, type: type, details: details }; - }; - - return DynamicAttrNSOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.DynamicAttrNSOpcode = DynamicAttrNSOpcode; - - var DynamicAttrOpcode = (function (_Opcode13) { - babelHelpers.inherits(DynamicAttrOpcode, _Opcode13); - - function DynamicAttrOpcode(name, isTrusting) { - _Opcode13.call(this); - this.name = name; - this.isTrusting = isTrusting; - this.type = "dynamic-attr"; - } - - DynamicAttrOpcode.prototype.evaluate = function evaluate(vm) { - var name = this.name; - var isTrusting = this.isTrusting; - - var reference = vm.frame.getOperand(); - vm.stack().setDynamicAttribute(name, reference, isTrusting); - }; - - DynamicAttrOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var name = this.name; - - var details = _glimmerUtil.dict(); - details["name"] = JSON.stringify(name); - details["value"] = "$OPERAND"; - return { guid: guid, type: type, details: details }; - }; - - return DynamicAttrOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.DynamicAttrOpcode = DynamicAttrOpcode; - - var PatchElementOpcode = (function (_UpdatingOpcode2) { - babelHelpers.inherits(PatchElementOpcode, _UpdatingOpcode2); - - function PatchElementOpcode(operation) { - _UpdatingOpcode2.call(this); - this.type = "patch-element"; - this.tag = operation.tag; - this.operation = operation; - } - - PatchElementOpcode.prototype.evaluate = function evaluate(vm) { - this.operation.patch(vm.env); - }; - - PatchElementOpcode.prototype.toJSON = function toJSON() { - var _guid = this._guid; - var type = this.type; - var operation = this.operation; - - return { - guid: _guid, - type: type, - details: operation.toJSON() - }; - }; - - return PatchElementOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.PatchElementOpcode = PatchElementOpcode; - - var CommentOpcode = (function (_Opcode14) { - babelHelpers.inherits(CommentOpcode, _Opcode14); - - function CommentOpcode(comment) { - _Opcode14.call(this); - this.comment = comment; - this.type = "comment"; - } - - CommentOpcode.prototype.evaluate = function evaluate(vm) { - vm.stack().appendComment(this.comment); - }; - - CommentOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.comment)] - }; - }; - - return CommentOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.CommentOpcode = CommentOpcode; -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/lists', ['exports', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/compiled/expressions/args', 'glimmer-util', 'glimmer-reference'], function (exports, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibCompiledExpressionsArgs, _glimmerUtil, _glimmerReference) { - 'use strict'; - - var IterablePresenceReference = (function () { - function IterablePresenceReference(artifacts) { - this.tag = artifacts.tag; - this.artifacts = artifacts; - } - - IterablePresenceReference.prototype.value = function value() { - return !this.artifacts.isEmpty(); - }; - - return IterablePresenceReference; - })(); - - var PutIteratorOpcode = (function (_Opcode) { - babelHelpers.inherits(PutIteratorOpcode, _Opcode); - - function PutIteratorOpcode() { - _Opcode.apply(this, arguments); - this.type = "put-iterator"; - } - - PutIteratorOpcode.prototype.evaluate = function evaluate(vm) { - var listRef = vm.frame.getOperand(); - var args = vm.frame.getArgs(); - var iterable = vm.env.iterableFor(listRef, args); - var iterator = new _glimmerReference.ReferenceIterator(iterable); - vm.frame.setIterator(iterator); - vm.frame.setCondition(new IterablePresenceReference(iterator.artifacts)); - }; - - return PutIteratorOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutIteratorOpcode = PutIteratorOpcode; - - var EnterListOpcode = (function (_Opcode2) { - babelHelpers.inherits(EnterListOpcode, _Opcode2); - - function EnterListOpcode(start, end) { - _Opcode2.call(this); - this.type = "enter-list"; - this.slice = new _glimmerUtil.ListSlice(start, end); - } - - EnterListOpcode.prototype.evaluate = function evaluate(vm) { - vm.enterList(this.slice); - }; - - EnterListOpcode.prototype.toJSON = function toJSON() { - var slice = this.slice; - var type = this.type; - var _guid = this._guid; - - var begin = slice.head(); - var end = slice.tail(); - return { - guid: _guid, - type: type, - args: [JSON.stringify(begin.inspect()), JSON.stringify(end.inspect())] - }; - }; - - return EnterListOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.EnterListOpcode = EnterListOpcode; - - var ExitListOpcode = (function (_Opcode3) { - babelHelpers.inherits(ExitListOpcode, _Opcode3); - - function ExitListOpcode() { - _Opcode3.apply(this, arguments); - this.type = "exit-list"; - } - - ExitListOpcode.prototype.evaluate = function evaluate(vm) { - vm.exitList(); - }; - - return ExitListOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.ExitListOpcode = ExitListOpcode; - - var EnterWithKeyOpcode = (function (_Opcode4) { - babelHelpers.inherits(EnterWithKeyOpcode, _Opcode4); - - function EnterWithKeyOpcode(start, end) { - _Opcode4.call(this); - this.type = "enter-with-key"; - this.slice = new _glimmerUtil.ListSlice(start, end); - } - - EnterWithKeyOpcode.prototype.evaluate = function evaluate(vm) { - vm.enterWithKey(vm.frame.getKey(), this.slice); - }; - - EnterWithKeyOpcode.prototype.toJSON = function toJSON() { - var slice = this.slice; - var _guid = this._guid; - var type = this.type; - - var begin = slice.head(); - var end = slice.tail(); - return { - guid: _guid, - type: type, - args: [JSON.stringify(begin.inspect()), JSON.stringify(end.inspect())] - }; - }; - - return EnterWithKeyOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.EnterWithKeyOpcode = EnterWithKeyOpcode; - - var TRUE_REF = new _glimmerReference.ConstReference(true); - var FALSE_REF = new _glimmerReference.ConstReference(false); - - var NextIterOpcode = (function (_Opcode5) { - babelHelpers.inherits(NextIterOpcode, _Opcode5); - - function NextIterOpcode(end) { - _Opcode5.call(this); - this.type = "next-iter"; - this.end = end; - } - - NextIterOpcode.prototype.evaluate = function evaluate(vm) { - var item = vm.frame.getIterator().next(); - if (item) { - vm.frame.setCondition(TRUE_REF); - vm.frame.setKey(item.key); - vm.frame.setOperand(item.value); - vm.frame.setArgs(_glimmerRuntimeLibCompiledExpressionsArgs.EvaluatedArgs.positional([item.value, item.memo])); - } else { - vm.frame.setCondition(FALSE_REF); - vm.goto(this.end); - } - }; - - return NextIterOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.NextIterOpcode = NextIterOpcode; -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/partial', ['exports', 'glimmer-util', 'glimmer-reference', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/compiled/opcodes/vm'], function (exports, _glimmerUtil, _glimmerReference, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibCompiledOpcodesVm) { - 'use strict'; - - var PutDynamicPartialDefinitionOpcode = (function (_Opcode) { - babelHelpers.inherits(PutDynamicPartialDefinitionOpcode, _Opcode); - - function PutDynamicPartialDefinitionOpcode(symbolTable) { - _Opcode.call(this); - this.symbolTable = symbolTable; - this.type = "put-dynamic-partial-definition"; - } - - PutDynamicPartialDefinitionOpcode.prototype.evaluate = function evaluate(vm) { - var env = vm.env; - var symbolTable = this.symbolTable; - - function lookupPartial(name) { - var normalized = String(name); - if (!env.hasPartial(normalized, symbolTable)) { - throw new Error('Could not find a partial named "' + normalized + '"'); - } - return env.lookupPartial(normalized, symbolTable); - } - var reference = _glimmerReference.map(vm.frame.getOperand(), lookupPartial); - var cache = _glimmerReference.isConst(reference) ? undefined : new _glimmerReference.ReferenceCache(reference); - var definition = cache ? cache.peek() : reference.value(); - vm.frame.setImmediate(definition); - if (cache) { - vm.updateWith(new _glimmerRuntimeLibCompiledOpcodesVm.Assert(cache)); - } - }; - - PutDynamicPartialDefinitionOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND"] - }; - }; - - return PutDynamicPartialDefinitionOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutDynamicPartialDefinitionOpcode = PutDynamicPartialDefinitionOpcode; - - var PutPartialDefinitionOpcode = (function (_Opcode2) { - babelHelpers.inherits(PutPartialDefinitionOpcode, _Opcode2); - - function PutPartialDefinitionOpcode(definition) { - _Opcode2.call(this); - this.definition = definition; - this.type = "put-partial-definition"; - } - - PutPartialDefinitionOpcode.prototype.evaluate = function evaluate(vm) { - vm.frame.setImmediate(this.definition); - }; - - PutPartialDefinitionOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.definition.name)] - }; - }; - - return PutPartialDefinitionOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutPartialDefinitionOpcode = PutPartialDefinitionOpcode; - - var EvaluatePartialOpcode = (function (_Opcode3) { - babelHelpers.inherits(EvaluatePartialOpcode, _Opcode3); - - function EvaluatePartialOpcode(symbolTable) { - _Opcode3.call(this); - this.symbolTable = symbolTable; - this.type = "evaluate-partial"; - this.cache = _glimmerUtil.dict(); - } - - EvaluatePartialOpcode.prototype.evaluate = function evaluate(vm) { - var _vm$frame$getImmediate = vm.frame.getImmediate(); - - var template = _vm$frame$getImmediate.template; - - var block = this.cache[template.id]; - if (!block) { - block = template.asPartial(this.symbolTable); - } - vm.invokePartial(block); - }; - - EvaluatePartialOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND"] - }; - }; - - return EvaluatePartialOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.EvaluatePartialOpcode = EvaluatePartialOpcode; -}); - -enifed('glimmer-runtime/lib/compiled/opcodes/vm', ['exports', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/references', 'glimmer-reference', 'glimmer-util'], function (exports, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibReferences, _glimmerReference, _glimmerUtil) { - 'use strict'; - - var PushChildScopeOpcode = (function (_Opcode) { - babelHelpers.inherits(PushChildScopeOpcode, _Opcode); - - function PushChildScopeOpcode() { - _Opcode.apply(this, arguments); - this.type = "push-child-scope"; - } - - PushChildScopeOpcode.prototype.evaluate = function evaluate(vm) { - vm.pushChildScope(); - }; - - return PushChildScopeOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PushChildScopeOpcode = PushChildScopeOpcode; - - var PopScopeOpcode = (function (_Opcode2) { - babelHelpers.inherits(PopScopeOpcode, _Opcode2); - - function PopScopeOpcode() { - _Opcode2.apply(this, arguments); - this.type = "pop-scope"; - } - - PopScopeOpcode.prototype.evaluate = function evaluate(vm) { - vm.popScope(); - }; - - return PopScopeOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PopScopeOpcode = PopScopeOpcode; - - var PushDynamicScopeOpcode = (function (_Opcode3) { - babelHelpers.inherits(PushDynamicScopeOpcode, _Opcode3); - - function PushDynamicScopeOpcode() { - _Opcode3.apply(this, arguments); - this.type = "push-dynamic-scope"; - } - - PushDynamicScopeOpcode.prototype.evaluate = function evaluate(vm) { - vm.pushDynamicScope(); - }; - - return PushDynamicScopeOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PushDynamicScopeOpcode = PushDynamicScopeOpcode; - - var PopDynamicScopeOpcode = (function (_Opcode4) { - babelHelpers.inherits(PopDynamicScopeOpcode, _Opcode4); - - function PopDynamicScopeOpcode() { - _Opcode4.apply(this, arguments); - this.type = "pop-dynamic-scope"; - } - - PopDynamicScopeOpcode.prototype.evaluate = function evaluate(vm) { - vm.popDynamicScope(); - }; - - return PopDynamicScopeOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PopDynamicScopeOpcode = PopDynamicScopeOpcode; - - var PutNullOpcode = (function (_Opcode5) { - babelHelpers.inherits(PutNullOpcode, _Opcode5); - - function PutNullOpcode() { - _Opcode5.apply(this, arguments); - this.type = "put-null"; - } - - PutNullOpcode.prototype.evaluate = function evaluate(vm) { - vm.frame.setOperand(_glimmerRuntimeLibReferences.NULL_REFERENCE); - }; - - return PutNullOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutNullOpcode = PutNullOpcode; - - var PutValueOpcode = (function (_Opcode6) { - babelHelpers.inherits(PutValueOpcode, _Opcode6); - - function PutValueOpcode(expression) { - _Opcode6.call(this); - this.expression = expression; - this.type = "put-value"; - } - - PutValueOpcode.prototype.evaluate = function evaluate(vm) { - vm.evaluateOperand(this.expression); - }; - - PutValueOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [this.expression.toJSON()] - }; - }; - - return PutValueOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutValueOpcode = PutValueOpcode; - - var PutArgsOpcode = (function (_Opcode7) { - babelHelpers.inherits(PutArgsOpcode, _Opcode7); - - function PutArgsOpcode(args) { - _Opcode7.call(this); - this.args = args; - this.type = "put-args"; - } - - PutArgsOpcode.prototype.evaluate = function evaluate(vm) { - vm.evaluateArgs(this.args); - }; - - PutArgsOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - details: { - "positional": this.args.positional.toJSON(), - "named": this.args.named.toJSON() - } - }; - }; - - return PutArgsOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.PutArgsOpcode = PutArgsOpcode; - - var BindPositionalArgsOpcode = (function (_Opcode8) { - babelHelpers.inherits(BindPositionalArgsOpcode, _Opcode8); - - function BindPositionalArgsOpcode(names, symbols) { - _Opcode8.call(this); - this.names = names; - this.symbols = symbols; - this.type = "bind-positional-args"; - } - - BindPositionalArgsOpcode.create = function create(block) { - var names = block.locals; - var symbols = names.map(function (name) { - return block.symbolTable.getLocal(name); - }); - return new this(names, symbols); - }; - - BindPositionalArgsOpcode.prototype.evaluate = function evaluate(vm) { - vm.bindPositionalArgs(this.symbols); - }; - - BindPositionalArgsOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ['[' + this.names.map(function (name) { - return JSON.stringify(name); - }).join(", ") + ']'] - }; - }; - - return BindPositionalArgsOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.BindPositionalArgsOpcode = BindPositionalArgsOpcode; - - var BindNamedArgsOpcode = (function (_Opcode9) { - babelHelpers.inherits(BindNamedArgsOpcode, _Opcode9); - - function BindNamedArgsOpcode(names, symbols) { - _Opcode9.call(this); - this.names = names; - this.symbols = symbols; - this.type = "bind-named-args"; - } - - BindNamedArgsOpcode.create = function create(layout) { - var names = layout.named; - var symbols = names.map(function (name) { - return layout.symbolTable.getNamed(name); - }); - return new this(names, symbols); - }; - - BindNamedArgsOpcode.prototype.evaluate = function evaluate(vm) { - vm.bindNamedArgs(this.names, this.symbols); - }; - - BindNamedArgsOpcode.prototype.toJSON = function toJSON() { - var names = this.names; - var symbols = this.symbols; - - var args = names.map(function (name, i) { - return '$' + symbols[i] + ': $ARGS[' + name + ']'; - }); - return { - guid: this._guid, - type: this.type, - args: args - }; - }; - - return BindNamedArgsOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.BindNamedArgsOpcode = BindNamedArgsOpcode; - - var BindBlocksOpcode = (function (_Opcode10) { - babelHelpers.inherits(BindBlocksOpcode, _Opcode10); - - function BindBlocksOpcode(names, symbols) { - _Opcode10.call(this); - this.names = names; - this.symbols = symbols; - this.type = "bind-blocks"; - } - - BindBlocksOpcode.create = function create(layout) { - var names = layout.yields; - var symbols = names.map(function (name) { - return layout.symbolTable.getYield(name); - }); - return new this(names, symbols); - }; - - BindBlocksOpcode.prototype.evaluate = function evaluate(vm) { - vm.bindBlocks(this.names, this.symbols); - }; - - BindBlocksOpcode.prototype.toJSON = function toJSON() { - var names = this.names; - var symbols = this.symbols; - - var args = names.map(function (name, i) { - return '$' + symbols[i] + ': $BLOCKS[' + name + ']'; - }); - return { - guid: this._guid, - type: this.type, - args: args - }; - }; - - return BindBlocksOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.BindBlocksOpcode = BindBlocksOpcode; - - var BindPartialArgsOpcode = (function (_Opcode11) { - babelHelpers.inherits(BindPartialArgsOpcode, _Opcode11); - - function BindPartialArgsOpcode(symbol) { - _Opcode11.call(this); - this.symbol = symbol; - this.type = "bind-partial-args"; - } - - BindPartialArgsOpcode.create = function create(layout) { - return new this(layout.symbolTable.getPartialArgs()); - }; - - BindPartialArgsOpcode.prototype.evaluate = function evaluate(vm) { - vm.bindPartialArgs(this.symbol); - }; - - return BindPartialArgsOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.BindPartialArgsOpcode = BindPartialArgsOpcode; - - var BindCallerScopeOpcode = (function (_Opcode12) { - babelHelpers.inherits(BindCallerScopeOpcode, _Opcode12); - - function BindCallerScopeOpcode() { - _Opcode12.apply(this, arguments); - this.type = "bind-caller-scope"; - } - - BindCallerScopeOpcode.prototype.evaluate = function evaluate(vm) { - vm.bindCallerScope(); - }; - - return BindCallerScopeOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.BindCallerScopeOpcode = BindCallerScopeOpcode; - - var BindDynamicScopeOpcode = (function (_Opcode13) { - babelHelpers.inherits(BindDynamicScopeOpcode, _Opcode13); - - function BindDynamicScopeOpcode(names) { - _Opcode13.call(this); - this.names = names; - this.type = "bind-dynamic-scope"; - } - - BindDynamicScopeOpcode.prototype.evaluate = function evaluate(vm) { - vm.bindDynamicScope(this.names); - }; - - return BindDynamicScopeOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.BindDynamicScopeOpcode = BindDynamicScopeOpcode; - - var EnterOpcode = (function (_Opcode14) { - babelHelpers.inherits(EnterOpcode, _Opcode14); - - function EnterOpcode(begin, end) { - _Opcode14.call(this); - this.type = "enter"; - this.slice = new _glimmerUtil.ListSlice(begin, end); - } - - EnterOpcode.prototype.evaluate = function evaluate(vm) { - vm.enter(this.slice); - }; - - EnterOpcode.prototype.toJSON = function toJSON() { - var slice = this.slice; - var type = this.type; - var _guid = this._guid; - - var begin = slice.head(); - var end = slice.tail(); - return { - guid: _guid, - type: type, - args: [JSON.stringify(begin.inspect()), JSON.stringify(end.inspect())] - }; - }; - - return EnterOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.EnterOpcode = EnterOpcode; - - var ExitOpcode = (function (_Opcode15) { - babelHelpers.inherits(ExitOpcode, _Opcode15); - - function ExitOpcode() { - _Opcode15.apply(this, arguments); - this.type = "exit"; - } - - ExitOpcode.prototype.evaluate = function evaluate(vm) { - vm.exit(); - }; - - return ExitOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.ExitOpcode = ExitOpcode; - - var LabelOpcode = (function (_Opcode16) { - babelHelpers.inherits(LabelOpcode, _Opcode16); - - function LabelOpcode(label) { - _Opcode16.call(this); - this.tag = _glimmerReference.CONSTANT_TAG; - this.type = "label"; - this.label = null; - this.prev = null; - this.next = null; - if (label) this.label = label; - } - - LabelOpcode.prototype.evaluate = function evaluate() {}; - - LabelOpcode.prototype.inspect = function inspect() { - return this.label + ' [' + this._guid + ']'; - }; - - LabelOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.inspect())] - }; - }; - - return LabelOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.LabelOpcode = LabelOpcode; - - var EvaluateOpcode = (function (_Opcode17) { - babelHelpers.inherits(EvaluateOpcode, _Opcode17); - - function EvaluateOpcode(debug, block) { - _Opcode17.call(this); - this.debug = debug; - this.block = block; - this.type = "evaluate"; - } - - EvaluateOpcode.prototype.evaluate = function evaluate(vm) { - vm.invokeBlock(this.block, vm.frame.getArgs()); - }; - - EvaluateOpcode.prototype.toJSON = function toJSON() { - var guid = this._guid; - var type = this.type; - var debug = this.debug; - var block = this.block; - - var compiled = block['compiled']; - var children = undefined; - if (compiled) { - children = compiled.ops.toArray().map(function (op) { - return op.toJSON(); - }); - } else { - children = [{ guid: null, type: '[ UNCOMPILED BLOCK ]' }]; - } - return { - guid: guid, - type: type, - args: [debug], - children: children - }; - }; - - return EvaluateOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.EvaluateOpcode = EvaluateOpcode; - var ConstTest = function (ref, env) { - return new _glimmerReference.ConstReference(!!ref.value()); - }; - exports.ConstTest = ConstTest; - var SimpleTest = function (ref, env) { - return ref; - }; - exports.SimpleTest = SimpleTest; - var EnvironmentTest = function (ref, env) { - return env.toConditionalReference(ref); - }; - exports.EnvironmentTest = EnvironmentTest; - - var TestOpcode = (function (_Opcode18) { - babelHelpers.inherits(TestOpcode, _Opcode18); - - function TestOpcode(testFunc) { - _Opcode18.call(this); - this.testFunc = testFunc; - this.type = "test"; - } - - TestOpcode.prototype.evaluate = function evaluate(vm) { - vm.frame.setCondition(this.testFunc(vm.frame.getOperand(), vm.env)); - }; - - TestOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: ["$OPERAND", this.testFunc.name] - }; - }; - - return TestOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.TestOpcode = TestOpcode; - - var JumpOpcode = (function (_Opcode19) { - babelHelpers.inherits(JumpOpcode, _Opcode19); - - function JumpOpcode(target) { - _Opcode19.call(this); - this.target = target; - this.type = "jump"; - } - - JumpOpcode.prototype.evaluate = function evaluate(vm) { - vm.goto(this.target); - }; - - JumpOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.target.inspect())] - }; - }; - - return JumpOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.JumpOpcode = JumpOpcode; - - var JumpIfOpcode = (function (_JumpOpcode) { - babelHelpers.inherits(JumpIfOpcode, _JumpOpcode); - - function JumpIfOpcode() { - _JumpOpcode.apply(this, arguments); - this.type = "jump-if"; - } - - JumpIfOpcode.prototype.evaluate = function evaluate(vm) { - var reference = vm.frame.getCondition(); - if (_glimmerReference.isConst(reference)) { - if (reference.value()) { - _JumpOpcode.prototype.evaluate.call(this, vm); - } - } else { - var cache = new _glimmerReference.ReferenceCache(reference); - if (cache.peek()) { - _JumpOpcode.prototype.evaluate.call(this, vm); - } - vm.updateWith(new Assert(cache)); - } - }; - - return JumpIfOpcode; - })(JumpOpcode); - - exports.JumpIfOpcode = JumpIfOpcode; - - var JumpUnlessOpcode = (function (_JumpOpcode2) { - babelHelpers.inherits(JumpUnlessOpcode, _JumpOpcode2); - - function JumpUnlessOpcode() { - _JumpOpcode2.apply(this, arguments); - this.type = "jump-unless"; - } - - JumpUnlessOpcode.prototype.evaluate = function evaluate(vm) { - var reference = vm.frame.getCondition(); - if (_glimmerReference.isConst(reference)) { - if (!reference.value()) { - _JumpOpcode2.prototype.evaluate.call(this, vm); - } - } else { - var cache = new _glimmerReference.ReferenceCache(reference); - if (!cache.peek()) { - _JumpOpcode2.prototype.evaluate.call(this, vm); - } - vm.updateWith(new Assert(cache)); - } - }; - - return JumpUnlessOpcode; - })(JumpOpcode); - - exports.JumpUnlessOpcode = JumpUnlessOpcode; - - var Assert = (function (_UpdatingOpcode) { - babelHelpers.inherits(Assert, _UpdatingOpcode); - - function Assert(cache) { - _UpdatingOpcode.call(this); - this.type = "assert"; - this.tag = cache.tag; - this.cache = cache; - } - - Assert.prototype.evaluate = function evaluate(vm) { - var cache = this.cache; - - if (_glimmerReference.isModified(cache.revalidate())) { - vm.throw(); - } - }; - - Assert.prototype.toJSON = function toJSON() { - var type = this.type; - var _guid = this._guid; - var cache = this.cache; - - var expected = undefined; - try { - expected = JSON.stringify(cache.peek()); - } catch (e) { - expected = String(cache.peek()); - } - return { - guid: _guid, - type: type, - args: [], - details: { expected: expected } - }; - }; - - return Assert; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.Assert = Assert; - - var JumpIfNotModifiedOpcode = (function (_UpdatingOpcode2) { - babelHelpers.inherits(JumpIfNotModifiedOpcode, _UpdatingOpcode2); - - function JumpIfNotModifiedOpcode(tag, target) { - _UpdatingOpcode2.call(this); - this.target = target; - this.type = "jump-if-not-modified"; - this.tag = tag; - this.lastRevision = tag.value(); - } - - JumpIfNotModifiedOpcode.prototype.evaluate = function evaluate(vm) { - var tag = this.tag; - var target = this.target; - var lastRevision = this.lastRevision; - - if (!vm.alwaysRevalidate && tag.validate(lastRevision)) { - vm.goto(target); - } - }; - - JumpIfNotModifiedOpcode.prototype.didModify = function didModify() { - this.lastRevision = this.tag.value(); - }; - - JumpIfNotModifiedOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - args: [JSON.stringify(this.target.inspect())] - }; - }; - - return JumpIfNotModifiedOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.JumpIfNotModifiedOpcode = JumpIfNotModifiedOpcode; - - var DidModifyOpcode = (function (_UpdatingOpcode3) { - babelHelpers.inherits(DidModifyOpcode, _UpdatingOpcode3); - - function DidModifyOpcode(target) { - _UpdatingOpcode3.call(this); - this.target = target; - this.type = "did-modify"; - this.tag = _glimmerReference.CONSTANT_TAG; - } - - DidModifyOpcode.prototype.evaluate = function evaluate() { - this.target.didModify(); - }; - - return DidModifyOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.DidModifyOpcode = DidModifyOpcode; -}); - -enifed('glimmer-runtime/lib/compiler', ['exports', 'glimmer-util', 'glimmer-runtime/lib/utils', 'glimmer-runtime/lib/syntax/core', 'glimmer-runtime/lib/compiled/blocks', 'glimmer-runtime/lib/compiled/expressions/function', 'glimmer-runtime/lib/compiled/opcodes/builder'], function (exports, _glimmerUtil, _glimmerRuntimeLibUtils, _glimmerRuntimeLibSyntaxCore, _glimmerRuntimeLibCompiledBlocks, _glimmerRuntimeLibCompiledExpressionsFunction, _glimmerRuntimeLibCompiledOpcodesBuilder) { - 'use strict'; - - exports.compileLayout = compileLayout; - - var Compiler = (function () { - function Compiler(block, env) { - this.block = block; - this.env = env; - this.current = block.program.head(); - this.symbolTable = block.symbolTable; - } - - Compiler.prototype.compileStatement = function compileStatement(statement, ops) { - this.env.statement(statement, this.symbolTable).compile(ops, this.env, this.symbolTable); - }; - - return Compiler; - })(); - - function compileStatement(env, statement, ops, layout) { - env.statement(statement, layout.symbolTable).compile(ops, env, layout.symbolTable); - } - exports.default = Compiler; - - var EntryPointCompiler = (function (_Compiler) { - babelHelpers.inherits(EntryPointCompiler, _Compiler); - - function EntryPointCompiler(template, env) { - _Compiler.call(this, template, env); - var list = new CompileIntoList(env, template.symbolTable); - this.ops = new _glimmerRuntimeLibCompiledOpcodesBuilder.default(list, template.symbolTable, env); - } - - EntryPointCompiler.prototype.compile = function compile() { - var block = this.block; - var ops = this.ops; - var program = block.program; - - var current = program.head(); - while (current) { - var next = program.nextNode(current); - this.compileStatement(current, ops); - current = next; - } - return ops.toOpSeq(); - }; - - EntryPointCompiler.prototype.append = function append(op) { - this.ops.append(op); - }; - - EntryPointCompiler.prototype.getLocalSymbol = function getLocalSymbol(name) { - return this.symbolTable.getLocal(name); - }; - - EntryPointCompiler.prototype.getNamedSymbol = function getNamedSymbol(name) { - return this.symbolTable.getNamed(name); - }; - - EntryPointCompiler.prototype.getYieldSymbol = function getYieldSymbol(name) { - return this.symbolTable.getYield(name); - }; - - return EntryPointCompiler; - })(Compiler); - - exports.EntryPointCompiler = EntryPointCompiler; - - var InlineBlockCompiler = (function (_Compiler2) { - babelHelpers.inherits(InlineBlockCompiler, _Compiler2); - - function InlineBlockCompiler(block, env) { - _Compiler2.call(this, block, env); - this.block = block; - var list = new CompileIntoList(env, block.symbolTable); - this.ops = new _glimmerRuntimeLibCompiledOpcodesBuilder.default(list, block.symbolTable, env); - } - - InlineBlockCompiler.prototype.compile = function compile() { - var block = this.block; - var ops = this.ops; - var program = block.program; - - var hasPositionalParameters = block.hasPositionalParameters(); - if (hasPositionalParameters) { - ops.pushChildScope(); - ops.bindPositionalArgsForBlock(block); - } - var current = program.head(); - while (current) { - var next = program.nextNode(current); - this.compileStatement(current, ops); - current = next; - } - if (hasPositionalParameters) { - ops.popScope(); - } - return ops.toOpSeq(); - }; - - return InlineBlockCompiler; - })(Compiler); - - exports.InlineBlockCompiler = InlineBlockCompiler; - - function compileLayout(compilable, env) { - var builder = new ComponentLayoutBuilder(env); - compilable.compile(builder); - return builder.compile(); - } - - var ComponentLayoutBuilder = (function () { - function ComponentLayoutBuilder(env) { - this.env = env; - } - - ComponentLayoutBuilder.prototype.empty = function empty() { - this.inner = new EmptyBuilder(this.env); - }; - - ComponentLayoutBuilder.prototype.wrapLayout = function wrapLayout(layout) { - this.inner = new WrappedBuilder(this.env, layout); - }; - - ComponentLayoutBuilder.prototype.fromLayout = function fromLayout(layout) { - this.inner = new UnwrappedBuilder(this.env, layout); - }; - - ComponentLayoutBuilder.prototype.compile = function compile() { - return this.inner.compile(); - }; - - babelHelpers.createClass(ComponentLayoutBuilder, [{ - key: 'tag', - get: function () { - return this.inner.tag; - } - }, { - key: 'attrs', - get: function () { - return this.inner.attrs; - } - }]); - return ComponentLayoutBuilder; - })(); - - var EmptyBuilder = (function () { - function EmptyBuilder(env) { - this.env = env; - } - - EmptyBuilder.prototype.compile = function compile() { - var env = this.env; - - var list = new CompileIntoList(env, null); - return new _glimmerRuntimeLibCompiledBlocks.CompiledBlock(list, 0); - }; - - babelHelpers.createClass(EmptyBuilder, [{ - key: 'tag', - get: function () { - throw new Error('Nope'); - } - }, { - key: 'attrs', - get: function () { - throw new Error('Nope'); - } - }]); - return EmptyBuilder; - })(); - - var WrappedBuilder = (function () { - function WrappedBuilder(env, layout) { - this.env = env; - this.layout = layout; - this.tag = new ComponentTagBuilder(); - this.attrs = new ComponentAttrsBuilder(); - } - - WrappedBuilder.prototype.compile = function compile() { - //========DYNAMIC - // PutValue(TagExpr) - // Test - // JumpUnless(BODY) - // OpenDynamicPrimitiveElement - // DidCreateElement - // ...attr statements... - // FlushElement - // BODY: Noop - // ...body statements... - // PutValue(TagExpr) - // Test - // JumpUnless(END) - // CloseElement - // END: Noop - // DidRenderLayout - // Exit - // - //========STATIC - // OpenPrimitiveElementOpcode - // DidCreateElement - // ...attr statements... - // FlushElement - // ...body statements... - // CloseElement - // DidRenderLayout - // Exit - var env = this.env; - var layout = this.layout; - - var symbolTable = layout.symbolTable; - var buffer = new CompileIntoList(env, layout.symbolTable); - var dsl = new _glimmerRuntimeLibCompiledOpcodesBuilder.default(buffer, layout.symbolTable, env); - dsl.startLabels(); - if (this.tag.isDynamic) { - dsl.putValue(this.tag.dynamicTagName); - dsl.test('simple'); - dsl.jumpUnless('BODY'); - dsl.openDynamicPrimitiveElement(); - dsl.didCreateElement(); - this.attrs['buffer'].forEach(function (statement) { - return compileStatement(env, statement, dsl, layout); - }); - dsl.flushElement(); - dsl.label('BODY'); - } else if (this.tag.isStatic) { - var tag = this.tag.staticTagName; - dsl.openPrimitiveElement(tag); - dsl.didCreateElement(); - this.attrs['buffer'].forEach(function (statement) { - return compileStatement(env, statement, dsl, layout); - }); - dsl.flushElement(); - } - dsl.preludeForLayout(layout); - layout.program.forEachNode(function (statement) { - return compileStatement(env, statement, dsl, layout); - }); - if (this.tag.isDynamic) { - dsl.putValue(this.tag.dynamicTagName); - dsl.test('simple'); - dsl.jumpUnless('END'); - dsl.closeElement(); - dsl.label('END'); - } else if (this.tag.isStatic) { - dsl.closeElement(); - } - dsl.didRenderLayout(); - dsl.stopLabels(); - return new _glimmerRuntimeLibCompiledBlocks.CompiledBlock(dsl.toOpSeq(), symbolTable.size); - }; - - return WrappedBuilder; - })(); - - var UnwrappedBuilder = (function () { - function UnwrappedBuilder(env, layout) { - this.env = env; - this.layout = layout; - this.attrs = new ComponentAttrsBuilder(); - } - - UnwrappedBuilder.prototype.compile = function compile() { - var env = this.env; - var layout = this.layout; - - var buffer = new CompileIntoList(env, layout.symbolTable); - var dsl = new _glimmerRuntimeLibCompiledOpcodesBuilder.default(buffer, layout.symbolTable, env); - dsl.startLabels(); - dsl.preludeForLayout(layout); - var attrs = this.attrs['buffer']; - var attrsInserted = false; - this.layout.program.forEachNode(function (statement) { - if (!attrsInserted && isOpenElement(statement)) { - dsl.openComponentElement(statement.tag); - dsl.didCreateElement(); - dsl.shadowAttributes(); - attrs.forEach(function (statement) { - return compileStatement(env, statement, dsl, layout); - }); - attrsInserted = true; - } else { - compileStatement(env, statement, dsl, layout); - } - }); - dsl.didRenderLayout(); - dsl.stopLabels(); - return new _glimmerRuntimeLibCompiledBlocks.CompiledBlock(dsl.toOpSeq(), layout.symbolTable.size); - }; - - babelHelpers.createClass(UnwrappedBuilder, [{ - key: 'tag', - get: function () { - throw new Error('BUG: Cannot call `tag` on an UnwrappedBuilder'); - } - }]); - return UnwrappedBuilder; - })(); - - function isOpenElement(syntax) { - return syntax instanceof _glimmerRuntimeLibSyntaxCore.OpenElement || syntax instanceof _glimmerRuntimeLibSyntaxCore.OpenPrimitiveElement; - } - - var ComponentTagBuilder = (function () { - function ComponentTagBuilder() { - this.isDynamic = null; - this.isStatic = null; - this.staticTagName = null; - this.dynamicTagName = null; - } - - ComponentTagBuilder.prototype.static = function _static(tagName) { - this.isStatic = true; - this.staticTagName = tagName; - }; - - ComponentTagBuilder.prototype.dynamic = function dynamic(tagName) { - this.isDynamic = true; - this.dynamicTagName = _glimmerRuntimeLibCompiledExpressionsFunction.default(tagName); - }; - - return ComponentTagBuilder; - })(); - - var ComponentAttrsBuilder = (function () { - function ComponentAttrsBuilder() { - this.buffer = []; - } - - ComponentAttrsBuilder.prototype.static = function _static(name, value) { - this.buffer.push(new _glimmerRuntimeLibSyntaxCore.StaticAttr(name, value, null)); - }; - - ComponentAttrsBuilder.prototype.dynamic = function dynamic(name, value) { - this.buffer.push(new _glimmerRuntimeLibSyntaxCore.DynamicAttr(name, _glimmerRuntimeLibCompiledExpressionsFunction.default(value), null, false)); - }; - - return ComponentAttrsBuilder; - })(); - - var ComponentBuilder = (function () { - function ComponentBuilder(dsl) { - this.dsl = dsl; - this.env = dsl.env; - } - - ComponentBuilder.prototype.static = function _static(definition, args, symbolTable) { - var shadow = arguments.length <= 3 || arguments[3] === undefined ? _glimmerRuntimeLibUtils.EMPTY_ARRAY : arguments[3]; - - this.dsl.unit(function (dsl) { - dsl.putComponentDefinition(definition); - dsl.openComponent(args, shadow); - dsl.closeComponent(); - }); - }; - - ComponentBuilder.prototype.dynamic = function dynamic(definitionArgs, definition, args, symbolTable) { - var shadow = arguments.length <= 4 || arguments[4] === undefined ? _glimmerRuntimeLibUtils.EMPTY_ARRAY : arguments[4]; - - this.dsl.unit(function (dsl) { - dsl.putArgs(definitionArgs); - dsl.putValue(_glimmerRuntimeLibCompiledExpressionsFunction.default(definition)); - dsl.test('simple'); - dsl.enter('BEGIN', 'END'); - dsl.label('BEGIN'); - dsl.jumpUnless('END'); - dsl.putDynamicComponentDefinition(); - dsl.openComponent(args, shadow); - dsl.closeComponent(); - dsl.label('END'); - dsl.exit(); - }); - }; - - return ComponentBuilder; - })(); - - var CompileIntoList = (function (_LinkedList) { - babelHelpers.inherits(CompileIntoList, _LinkedList); - - function CompileIntoList(env, symbolTable) { - _LinkedList.call(this); - this.env = env; - this.symbolTable = symbolTable; - var dsl = new _glimmerRuntimeLibCompiledOpcodesBuilder.default(this, symbolTable, env); - this.component = new ComponentBuilder(dsl); - } - - CompileIntoList.prototype.getLocalSymbol = function getLocalSymbol(name) { - return this.symbolTable.getLocal(name); - }; - - CompileIntoList.prototype.hasLocalSymbol = function hasLocalSymbol(name) { - return typeof this.symbolTable.getLocal(name) === 'number'; - }; - - CompileIntoList.prototype.getNamedSymbol = function getNamedSymbol(name) { - return this.symbolTable.getNamed(name); - }; - - CompileIntoList.prototype.hasNamedSymbol = function hasNamedSymbol(name) { - return typeof this.symbolTable.getNamed(name) === 'number'; - }; - - CompileIntoList.prototype.getBlockSymbol = function getBlockSymbol(name) { - return this.symbolTable.getYield(name); - }; - - CompileIntoList.prototype.hasBlockSymbol = function hasBlockSymbol(name) { - return typeof this.symbolTable.getYield(name) === 'number'; - }; - - CompileIntoList.prototype.getPartialArgsSymbol = function getPartialArgsSymbol() { - return this.symbolTable.getPartialArgs(); - }; - - CompileIntoList.prototype.hasPartialArgsSymbol = function hasPartialArgsSymbol() { - return typeof this.symbolTable.getPartialArgs() === 'number'; - }; - - CompileIntoList.prototype.toOpSeq = function toOpSeq() { - return this; - }; - - return CompileIntoList; - })(_glimmerUtil.LinkedList); - - exports.CompileIntoList = CompileIntoList; -}); - -enifed('glimmer-runtime/lib/component/interfaces', ['exports'], function (exports) { - 'use strict'; - - exports.isComponentDefinition = isComponentDefinition; - var COMPONENT_DEFINITION_BRAND = 'COMPONENT DEFINITION [id=e59c754e-61eb-4392-8c4a-2c0ac72bfcd4]'; - - function isComponentDefinition(obj) { - return typeof obj === 'object' && obj && obj[COMPONENT_DEFINITION_BRAND]; - } - - var ComponentDefinition = function ComponentDefinition(name, manager, ComponentClass) { - this['COMPONENT DEFINITION [id=e59c754e-61eb-4392-8c4a-2c0ac72bfcd4]'] = true; - this.name = name; - this.manager = manager; - this.ComponentClass = ComponentClass; - }; - - exports.ComponentDefinition = ComponentDefinition; -}); - -enifed('glimmer-runtime/lib/dom/attribute-managers', ['exports', 'glimmer-runtime/lib/dom/sanitized-values', 'glimmer-runtime/lib/dom/props', 'glimmer-runtime/lib/dom/helper', 'glimmer-runtime/lib/compiled/opcodes/content'], function (exports, _glimmerRuntimeLibDomSanitizedValues, _glimmerRuntimeLibDomProps, _glimmerRuntimeLibDomHelper, _glimmerRuntimeLibCompiledOpcodesContent) { - 'use strict'; - - exports.defaultManagers = defaultManagers; - exports.defaultPropertyManagers = defaultPropertyManagers; - exports.defaultAttributeManagers = defaultAttributeManagers; - exports.readDOMAttr = readDOMAttr; - - function defaultManagers(element, attr, isTrusting, namespace) { - var tagName = element.tagName; - var isSVG = element.namespaceURI === _glimmerRuntimeLibDomHelper.SVG_NAMESPACE; - if (isSVG) { - return defaultAttributeManagers(tagName, attr); - } - - var _normalizeProperty = _glimmerRuntimeLibDomProps.normalizeProperty(element, attr); - - var type = _normalizeProperty.type; - var normalized = _normalizeProperty.normalized; - - if (type === 'attr') { - return defaultAttributeManagers(tagName, normalized); - } else { - return defaultPropertyManagers(tagName, normalized); - } - } - - function defaultPropertyManagers(tagName, attr) { - if (_glimmerRuntimeLibDomSanitizedValues.requiresSanitization(tagName, attr)) { - return new SafePropertyManager(attr); - } - if (isUserInputValue(tagName, attr)) { - return INPUT_VALUE_PROPERTY_MANAGER; - } - if (isOptionSelected(tagName, attr)) { - return OPTION_SELECTED_MANAGER; - } - return new PropertyManager(attr); - } - - function defaultAttributeManagers(tagName, attr) { - if (_glimmerRuntimeLibDomSanitizedValues.requiresSanitization(tagName, attr)) { - return new SafeAttributeManager(attr); - } - return new AttributeManager(attr); - } - - function readDOMAttr(element, attr) { - var isSVG = element.namespaceURI === _glimmerRuntimeLibDomHelper.SVG_NAMESPACE; - - var _normalizeProperty2 = _glimmerRuntimeLibDomProps.normalizeProperty(element, attr); - - var type = _normalizeProperty2.type; - var normalized = _normalizeProperty2.normalized; - - if (isSVG) { - return element.getAttribute(normalized); - } - if (type === 'attr') { - return element.getAttribute(normalized); - } - { - return element[normalized]; - } - } - - ; - - var AttributeManager = (function () { - function AttributeManager(attr) { - this.attr = attr; - } - - AttributeManager.prototype.setAttribute = function setAttribute(env, element, value, namespace) { - var dom = env.getAppendOperations(); - var normalizedValue = normalizeAttributeValue(value); - if (!isAttrRemovalValue(normalizedValue)) { - dom.setAttribute(element, this.attr, normalizedValue, namespace); - } - }; - - AttributeManager.prototype.updateAttribute = function updateAttribute(env, element, value, namespace) { - if (value === null || value === undefined || value === false) { - if (namespace) { - env.getDOM().removeAttributeNS(element, namespace, this.attr); - } else { - env.getDOM().removeAttribute(element, this.attr); - } - } else { - this.setAttribute(env, element, value); - } - }; - - return AttributeManager; - })(); - - exports.AttributeManager = AttributeManager; - - ; - - var PropertyManager = (function (_AttributeManager) { - babelHelpers.inherits(PropertyManager, _AttributeManager); - - function PropertyManager() { - _AttributeManager.apply(this, arguments); - } - - PropertyManager.prototype.setAttribute = function setAttribute(env, element, value, namespace) { - if (!isAttrRemovalValue(value)) { - element[this.attr] = value; - } - }; - - PropertyManager.prototype.removeAttribute = function removeAttribute(env, element, namespace) { - // TODO this sucks but to preserve properties first and to meet current - // semantics we must do this. - var attr = this.attr; - - if (namespace) { - env.getDOM().removeAttributeNS(element, namespace, attr); - } else { - env.getDOM().removeAttribute(element, attr); - } - }; - - PropertyManager.prototype.updateAttribute = function updateAttribute(env, element, value, namespace) { - // ensure the property is always updated - element[this.attr] = value; - if (isAttrRemovalValue(value)) { - this.removeAttribute(env, element, namespace); - } - }; - - return PropertyManager; - })(AttributeManager); - - exports.PropertyManager = PropertyManager; - - ; - function normalizeAttributeValue(value) { - if (value === false || value === undefined || value === null) { - return null; - } - if (value === true) { - return ''; - } - // onclick function etc in SSR - if (typeof value === 'function') { - return null; - } - return String(value); - } - function isAttrRemovalValue(value) { - return value === null || value === undefined; - } - - var SafePropertyManager = (function (_PropertyManager) { - babelHelpers.inherits(SafePropertyManager, _PropertyManager); - - function SafePropertyManager() { - _PropertyManager.apply(this, arguments); - } - - SafePropertyManager.prototype.setAttribute = function setAttribute(env, element, value) { - _PropertyManager.prototype.setAttribute.call(this, env, element, _glimmerRuntimeLibDomSanitizedValues.sanitizeAttributeValue(env, element, this.attr, value)); - }; - - SafePropertyManager.prototype.updateAttribute = function updateAttribute(env, element, value) { - _PropertyManager.prototype.updateAttribute.call(this, env, element, _glimmerRuntimeLibDomSanitizedValues.sanitizeAttributeValue(env, element, this.attr, value)); - }; - - return SafePropertyManager; - })(PropertyManager); - - function isUserInputValue(tagName, attribute) { - return (tagName === 'INPUT' || tagName === 'TEXTAREA') && attribute === 'value'; - } - - var InputValuePropertyManager = (function (_AttributeManager2) { - babelHelpers.inherits(InputValuePropertyManager, _AttributeManager2); - - function InputValuePropertyManager() { - _AttributeManager2.apply(this, arguments); - } - - InputValuePropertyManager.prototype.setAttribute = function setAttribute(env, element, value) { - var input = element; - input.value = _glimmerRuntimeLibCompiledOpcodesContent.normalizeTextValue(value); - }; - - InputValuePropertyManager.prototype.updateAttribute = function updateAttribute(env, element, value) { - var input = element; - var currentValue = input.value; - var normalizedValue = _glimmerRuntimeLibCompiledOpcodesContent.normalizeTextValue(value); - if (currentValue !== normalizedValue) { - input.value = normalizedValue; - } - }; - - return InputValuePropertyManager; - })(AttributeManager); - - var INPUT_VALUE_PROPERTY_MANAGER = new InputValuePropertyManager('value'); - exports.INPUT_VALUE_PROPERTY_MANAGER = INPUT_VALUE_PROPERTY_MANAGER; - function isOptionSelected(tagName, attribute) { - return tagName === 'OPTION' && attribute === 'selected'; - } - - var OptionSelectedManager = (function (_PropertyManager2) { - babelHelpers.inherits(OptionSelectedManager, _PropertyManager2); - - function OptionSelectedManager() { - _PropertyManager2.apply(this, arguments); - } - - OptionSelectedManager.prototype.setAttribute = function setAttribute(env, element, value) { - if (value !== null && value !== undefined && value !== false) { - var option = element; - option.selected = true; - } - }; - - OptionSelectedManager.prototype.updateAttribute = function updateAttribute(env, element, value) { - var option = element; - if (value) { - option.selected = true; - } else { - option.selected = false; - } - }; - - return OptionSelectedManager; - })(PropertyManager); - - var OPTION_SELECTED_MANAGER = new OptionSelectedManager('selected'); - exports.OPTION_SELECTED_MANAGER = OPTION_SELECTED_MANAGER; - - var SafeAttributeManager = (function (_AttributeManager3) { - babelHelpers.inherits(SafeAttributeManager, _AttributeManager3); - - function SafeAttributeManager() { - _AttributeManager3.apply(this, arguments); - } - - SafeAttributeManager.prototype.setAttribute = function setAttribute(env, element, value) { - _AttributeManager3.prototype.setAttribute.call(this, env, element, _glimmerRuntimeLibDomSanitizedValues.sanitizeAttributeValue(env, element, this.attr, value)); - }; - - SafeAttributeManager.prototype.updateAttribute = function updateAttribute(env, element, value, namespace) { - _AttributeManager3.prototype.updateAttribute.call(this, env, element, _glimmerRuntimeLibDomSanitizedValues.sanitizeAttributeValue(env, element, this.attr, value)); - }; - - return SafeAttributeManager; - })(AttributeManager); -}); - -enifed('glimmer-runtime/lib/dom/helper', ['exports', 'glimmer-runtime/lib/bounds', 'glimmer-runtime/lib/compat/inner-html-fix', 'glimmer-runtime/lib/compat/svg-inner-html-fix', 'glimmer-runtime/lib/compat/text-node-merging-fix', 'glimmer-runtime/lib/dom/interfaces'], function (exports, _glimmerRuntimeLibBounds, _glimmerRuntimeLibCompatInnerHtmlFix, _glimmerRuntimeLibCompatSvgInnerHtmlFix, _glimmerRuntimeLibCompatTextNodeMergingFix, _glimmerRuntimeLibDomInterfaces) { - 'use strict'; - - exports.isWhitespace = isWhitespace; - exports.moveNodesBefore = moveNodesBefore; - exports.insertHTMLBefore = _insertHTMLBefore; - var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; - exports.SVG_NAMESPACE = SVG_NAMESPACE; - // http://www.w3.org/TR/html/syntax.html#html-integration-point - var SVG_INTEGRATION_POINTS = { foreignObject: 1, desc: 1, title: 1 }; - // http://www.w3.org/TR/html/syntax.html#adjust-svg-attributes - // TODO: Adjust SVG attributes - // http://www.w3.org/TR/html/syntax.html#parsing-main-inforeign - // TODO: Adjust SVG elements - // http://www.w3.org/TR/html/syntax.html#parsing-main-inforeign - var BLACKLIST_TABLE = Object.create(null); - exports.BLACKLIST_TABLE = BLACKLIST_TABLE; - ["b", "big", "blockquote", "body", "br", "center", "code", "dd", "div", "dl", "dt", "em", "embed", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "i", "img", "li", "listing", "main", "meta", "nobr", "ol", "p", "pre", "ruby", "s", "small", "span", "strong", "strike", "sub", "sup", "table", "tt", "u", "ul", "var"].forEach(function (tag) { - return BLACKLIST_TABLE[tag] = 1; - }); - var WHITESPACE = /[\t-\r \xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/; - var doc = typeof document === 'undefined' ? undefined : document; - - function isWhitespace(string) { - return WHITESPACE.test(string); - } - - function moveNodesBefore(source, target, nextSibling) { - var first = source.firstChild; - var last = null; - var current = first; - while (current) { - last = current; - current = current.nextSibling; - target.insertBefore(last, nextSibling); - } - return [first, last]; - } - - var DOM; - exports.DOM = DOM; - (function (DOM) { - var TreeConstruction = (function () { - function TreeConstruction(document) { - this.document = document; - this.uselessElement = null; - this.setupUselessElement(); - } - - TreeConstruction.prototype.setupUselessElement = function setupUselessElement() { - this.uselessElement = this.document.createElement('div'); - }; - - TreeConstruction.prototype.createElement = function createElement(tag, context) { - var isElementInSVGNamespace = undefined, - isHTMLIntegrationPoint = undefined; - if (context) { - isElementInSVGNamespace = context.namespaceURI === SVG_NAMESPACE || tag === 'svg'; - isHTMLIntegrationPoint = SVG_INTEGRATION_POINTS[context.tagName]; - } else { - isElementInSVGNamespace = tag === 'svg'; - isHTMLIntegrationPoint = false; - } - if (isElementInSVGNamespace && !isHTMLIntegrationPoint) { - // FIXME: This does not properly handle <font> with color, face, or - // size attributes, which is also disallowed by the spec. We should fix - // this. - if (BLACKLIST_TABLE[tag]) { - throw new Error('Cannot create a ' + tag + ' inside an SVG context'); - } - return this.document.createElementNS(SVG_NAMESPACE, tag); - } else { - return this.document.createElement(tag); - } - }; - - TreeConstruction.prototype.createElementNS = function createElementNS(namespace, tag) { - return this.document.createElementNS(namespace, tag); - }; - - TreeConstruction.prototype.setAttribute = function setAttribute(element, name, value, namespace) { - if (namespace) { - element.setAttributeNS(namespace, name, value); - } else { - element.setAttribute(name, value); - } - }; - - TreeConstruction.prototype.createTextNode = function createTextNode(text) { - return this.document.createTextNode(text); - }; - - TreeConstruction.prototype.createComment = function createComment(data) { - return this.document.createComment(data); - }; - - TreeConstruction.prototype.insertBefore = function insertBefore(parent, node, reference) { - parent.insertBefore(node, reference); - }; - - TreeConstruction.prototype.insertHTMLBefore = function insertHTMLBefore(parent, html, reference) { - return _insertHTMLBefore(this.uselessElement, parent, reference, html); - }; - - return TreeConstruction; - })(); - - DOM.TreeConstruction = TreeConstruction; - var appliedTreeContruction = TreeConstruction; - appliedTreeContruction = _glimmerRuntimeLibCompatTextNodeMergingFix.treeConstruction(doc, appliedTreeContruction); - appliedTreeContruction = _glimmerRuntimeLibCompatInnerHtmlFix.treeConstruction(doc, appliedTreeContruction); - appliedTreeContruction = _glimmerRuntimeLibCompatSvgInnerHtmlFix.treeConstruction(doc, appliedTreeContruction, SVG_NAMESPACE); - DOM.DOMTreeConstruction = appliedTreeContruction; - })(DOM || (exports.DOM = DOM = {})); - - var DOMChanges = (function () { - function DOMChanges(document) { - this.document = document; - this.uselessElement = null; - this.namespace = null; - this.uselessElement = this.document.createElement('div'); - } - - DOMChanges.prototype.setAttribute = function setAttribute(element, name, value) { - element.setAttribute(name, value); - }; - - DOMChanges.prototype.setAttributeNS = function setAttributeNS(element, namespace, name, value) { - element.setAttributeNS(namespace, name, value); - }; - - DOMChanges.prototype.removeAttribute = function removeAttribute(element, name) { - element.removeAttribute(name); - }; - - DOMChanges.prototype.removeAttributeNS = function removeAttributeNS(element, namespace, name) { - element.removeAttributeNS(namespace, name); - }; - - DOMChanges.prototype.createTextNode = function createTextNode(text) { - return this.document.createTextNode(text); - }; - - DOMChanges.prototype.createComment = function createComment(data) { - return this.document.createComment(data); - }; - - DOMChanges.prototype.createElement = function createElement(tag, context) { - var isElementInSVGNamespace = undefined, - isHTMLIntegrationPoint = undefined; - if (context) { - isElementInSVGNamespace = context.namespaceURI === SVG_NAMESPACE || tag === 'svg'; - isHTMLIntegrationPoint = SVG_INTEGRATION_POINTS[context.tagName]; - } else { - isElementInSVGNamespace = tag === 'svg'; - isHTMLIntegrationPoint = false; - } - if (isElementInSVGNamespace && !isHTMLIntegrationPoint) { - // FIXME: This does not properly handle <font> with color, face, or - // size attributes, which is also disallowed by the spec. We should fix - // this. - if (BLACKLIST_TABLE[tag]) { - throw new Error('Cannot create a ' + tag + ' inside an SVG context'); - } - return this.document.createElementNS(SVG_NAMESPACE, tag); - } else { - return this.document.createElement(tag); - } - }; - - DOMChanges.prototype.insertHTMLBefore = function insertHTMLBefore(_parent, nextSibling, html) { - return _insertHTMLBefore(this.uselessElement, _parent, nextSibling, html); - }; - - DOMChanges.prototype.insertNodeBefore = function insertNodeBefore(parent, node, reference) { - if (isDocumentFragment(node)) { - var firstChild = node.firstChild; - var lastChild = node.lastChild; - - this.insertBefore(parent, node, reference); - return new _glimmerRuntimeLibBounds.ConcreteBounds(parent, firstChild, lastChild); - } else { - this.insertBefore(parent, node, reference); - return new _glimmerRuntimeLibBounds.SingleNodeBounds(parent, node); - } - }; - - DOMChanges.prototype.insertTextBefore = function insertTextBefore(parent, nextSibling, text) { - var textNode = this.createTextNode(text); - this.insertBefore(parent, textNode, nextSibling); - return textNode; - }; - - DOMChanges.prototype.insertBefore = function insertBefore(element, node, reference) { - element.insertBefore(node, reference); - }; - - DOMChanges.prototype.insertAfter = function insertAfter(element, node, reference) { - this.insertBefore(element, node, reference.nextSibling); - }; - - return DOMChanges; - })(); - - exports.DOMChanges = DOMChanges; - - function _insertHTMLBefore(_useless, _parent, _nextSibling, html) { - // TypeScript vendored an old version of the DOM spec where `insertAdjacentHTML` - // only exists on `HTMLElement` but not on `Element`. We actually work with the - // newer version of the DOM API here (and monkey-patch this method in `./compat` - // when we detect older browsers). This is a hack to work around this limitation. - var parent = _parent; - var useless = _useless; - var nextSibling = _nextSibling; - var prev = nextSibling ? nextSibling.previousSibling : parent.lastChild; - var last = undefined; - if (html === null || html === '') { - return new _glimmerRuntimeLibBounds.ConcreteBounds(parent, null, null); - } - if (nextSibling === null) { - parent.insertAdjacentHTML('beforeEnd', html); - last = parent.lastChild; - } else if (nextSibling instanceof HTMLElement) { - nextSibling.insertAdjacentHTML('beforeBegin', html); - last = nextSibling.previousSibling; - } else { - // Non-element nodes do not support insertAdjacentHTML, so add an - // element and call it on that element. Then remove the element. - // - // This also protects Edge, IE and Firefox w/o the inspector open - // from merging adjacent text nodes. See ./compat/text-node-merging-fix.ts - parent.insertBefore(useless, nextSibling); - useless.insertAdjacentHTML('beforeBegin', html); - last = useless.previousSibling; - parent.removeChild(useless); - } - var first = prev ? prev.nextSibling : parent.firstChild; - return new _glimmerRuntimeLibBounds.ConcreteBounds(parent, first, last); - } - - function isDocumentFragment(node) { - return node.nodeType === Node.DOCUMENT_FRAGMENT_NODE; - } - var helper = DOMChanges; - helper = _glimmerRuntimeLibCompatTextNodeMergingFix.domChanges(doc, helper); - helper = _glimmerRuntimeLibCompatInnerHtmlFix.domChanges(doc, helper); - helper = _glimmerRuntimeLibCompatSvgInnerHtmlFix.domChanges(doc, helper, SVG_NAMESPACE); - exports.default = helper; - var DOMTreeConstruction = DOM.DOMTreeConstruction; - exports.DOMTreeConstruction = DOMTreeConstruction; - exports.DOMNamespace = _glimmerRuntimeLibDomInterfaces.Namespace; -}); - -enifed("glimmer-runtime/lib/dom/interfaces", ["exports"], function (exports) { - "use strict"; - - var NodeType; - exports.NodeType = NodeType; - (function (NodeType) { - NodeType[NodeType["Element"] = 0] = "Element"; - NodeType[NodeType["Attribute"] = 1] = "Attribute"; - NodeType[NodeType["Text"] = 2] = "Text"; - NodeType[NodeType["CdataSection"] = 3] = "CdataSection"; - NodeType[NodeType["EntityReference"] = 4] = "EntityReference"; - NodeType[NodeType["Entity"] = 5] = "Entity"; - NodeType[NodeType["ProcessingInstruction"] = 6] = "ProcessingInstruction"; - NodeType[NodeType["Comment"] = 7] = "Comment"; - NodeType[NodeType["Document"] = 8] = "Document"; - NodeType[NodeType["DocumentType"] = 9] = "DocumentType"; - NodeType[NodeType["DocumentFragment"] = 10] = "DocumentFragment"; - NodeType[NodeType["Notation"] = 11] = "Notation"; - })(NodeType || (exports.NodeType = NodeType = {})); -}); - -enifed('glimmer-runtime/lib/dom/props', ['exports'], function (exports) { - /* - * @method normalizeProperty - * @param element {HTMLElement} - * @param slotName {String} - * @returns {Object} { name, type } - */ - 'use strict'; - - exports.normalizeProperty = normalizeProperty; - exports.normalizePropertyValue = normalizePropertyValue; - - function normalizeProperty(element, slotName) { - var type = undefined, - normalized = undefined; - if (slotName in element) { - normalized = slotName; - type = 'prop'; - } else { - var lower = slotName.toLowerCase(); - if (lower in element) { - type = 'prop'; - normalized = lower; - } else { - type = 'attr'; - normalized = slotName; - } - } - if (type === 'prop' && (normalized.toLowerCase() === 'style' || preferAttr(element.tagName, normalized))) { - type = 'attr'; - } - return { normalized: normalized, type: type }; - } - - function normalizePropertyValue(value) { - if (value === '') { - return true; - } - return value; - } - - // properties that MUST be set as attributes, due to: - // * browser bug - // * strange spec outlier - var ATTR_OVERRIDES = { - // phantomjs < 2.0 lets you set it as a prop but won't reflect it - // back to the attribute. button.getAttribute('type') === null - BUTTON: { type: true, form: true }, - INPUT: { - // Some version of IE (like IE9) actually throw an exception - // if you set input.type = 'something-unknown' - type: true, - form: true, - // Chrome 46.0.2464.0: 'autocorrect' in document.createElement('input') === false - // Safari 8.0.7: 'autocorrect' in document.createElement('input') === false - // Mobile Safari (iOS 8.4 simulator): 'autocorrect' in document.createElement('input') === true - autocorrect: true, - // Chrome 54.0.2840.98: 'list' in document.createElement('input') === true - // Safari 9.1.3: 'list' in document.createElement('input') === false - list: true - }, - // element.form is actually a legitimate readOnly property, that is to be - // mutated, but must be mutated by setAttribute... - SELECT: { form: true }, - OPTION: { form: true }, - TEXTAREA: { form: true }, - LABEL: { form: true }, - FIELDSET: { form: true }, - LEGEND: { form: true }, - OBJECT: { form: true } - }; - function preferAttr(tagName, propName) { - var tag = ATTR_OVERRIDES[tagName.toUpperCase()]; - return tag && tag[propName.toLowerCase()] || false; - } -}); - -enifed('glimmer-runtime/lib/dom/sanitized-values', ['exports', 'glimmer-runtime/lib/compiled/opcodes/content', 'glimmer-runtime/lib/upsert'], function (exports, _glimmerRuntimeLibCompiledOpcodesContent, _glimmerRuntimeLibUpsert) { - 'use strict'; - - exports.requiresSanitization = requiresSanitization; - exports.sanitizeAttributeValue = sanitizeAttributeValue; - - var badProtocols = ['javascript:', 'vbscript:']; - var badTags = ['A', 'BODY', 'LINK', 'IMG', 'IFRAME', 'BASE', 'FORM']; - var badTagsForDataURI = ['EMBED']; - var badAttributes = ['href', 'src', 'background', 'action']; - var badAttributesForDataURI = ['src']; - function has(array, item) { - return array.indexOf(item) !== -1; - } - function checkURI(tagName, attribute) { - return (tagName === null || has(badTags, tagName)) && has(badAttributes, attribute); - } - function checkDataURI(tagName, attribute) { - return has(badTagsForDataURI, tagName) && has(badAttributesForDataURI, attribute); - } - - function requiresSanitization(tagName, attribute) { - return checkURI(tagName, attribute) || checkDataURI(tagName, attribute); - } - - function sanitizeAttributeValue(env, element, attribute, value) { - var tagName = undefined; - if (value === null || value === undefined) { - return value; - } - if (_glimmerRuntimeLibUpsert.isSafeString(value)) { - return value.toHTML(); - } - if (!element) { - tagName = null; - } else { - tagName = element.tagName.toUpperCase(); - } - var str = _glimmerRuntimeLibCompiledOpcodesContent.normalizeTextValue(value); - if (checkURI(tagName, attribute)) { - var protocol = env.protocolForURL(str); - if (has(badProtocols, protocol)) { - return 'unsafe:' + str; - } - } - if (checkDataURI(tagName, attribute)) { - return 'unsafe:' + str; - } - return str; - } -}); - -enifed('glimmer-runtime/lib/environment', ['exports', 'glimmer-runtime/lib/references', 'glimmer-runtime/lib/dom/attribute-managers', 'glimmer-util', 'glimmer-runtime/lib/syntax/core', 'glimmer-runtime/lib/syntax/builtins/if', 'glimmer-runtime/lib/syntax/builtins/unless', 'glimmer-runtime/lib/syntax/builtins/with', 'glimmer-runtime/lib/syntax/builtins/each'], function (exports, _glimmerRuntimeLibReferences, _glimmerRuntimeLibDomAttributeManagers, _glimmerUtil, _glimmerRuntimeLibSyntaxCore, _glimmerRuntimeLibSyntaxBuiltinsIf, _glimmerRuntimeLibSyntaxBuiltinsUnless, _glimmerRuntimeLibSyntaxBuiltinsWith, _glimmerRuntimeLibSyntaxBuiltinsEach) { - 'use strict'; - - var Scope = (function () { - function Scope(references) { - var callerScope = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - this.callerScope = null; - this.slots = references; - this.callerScope = callerScope; - } - - Scope.root = function root(self) { - var size = arguments.length <= 1 || arguments[1] === undefined ? 0 : arguments[1]; - - var refs = new Array(size + 1); - for (var i = 0; i <= size; i++) { - refs[i] = _glimmerRuntimeLibReferences.UNDEFINED_REFERENCE; - } - return new Scope(refs).init({ self: self }); - }; - - Scope.prototype.init = function init(_ref) { - var self = _ref.self; - - this.slots[0] = self; - return this; - }; - - Scope.prototype.getSelf = function getSelf() { - return this.slots[0]; - }; - - Scope.prototype.getSymbol = function getSymbol(symbol) { - return this.slots[symbol]; - }; - - Scope.prototype.getBlock = function getBlock(symbol) { - return this.slots[symbol]; - }; - - Scope.prototype.getPartialArgs = function getPartialArgs(symbol) { - return this.slots[symbol]; - }; - - Scope.prototype.bindSymbol = function bindSymbol(symbol, value) { - this.slots[symbol] = value; - }; - - Scope.prototype.bindBlock = function bindBlock(symbol, value) { - this.slots[symbol] = value; - }; - - Scope.prototype.bindPartialArgs = function bindPartialArgs(symbol, value) { - this.slots[symbol] = value; - }; - - Scope.prototype.bindCallerScope = function bindCallerScope(scope) { - this.callerScope = scope; - }; - - Scope.prototype.getCallerScope = function getCallerScope() { - return this.callerScope; - }; - - Scope.prototype.child = function child() { - return new Scope(this.slots.slice(), this.callerScope); - }; - - return Scope; - })(); - - exports.Scope = Scope; - - var Environment = (function () { - function Environment(_ref2) { - var appendOperations = _ref2.appendOperations; - var updateOperations = _ref2.updateOperations; - - this.scheduledInstallManagers = null; - this.scheduledInstallModifiers = null; - this.scheduledUpdateModifierManagers = null; - this.scheduledUpdateModifiers = null; - this.createdComponents = null; - this.createdManagers = null; - this.updatedComponents = null; - this.updatedManagers = null; - this.destructors = null; - this.appendOperations = appendOperations; - this.updateOperations = updateOperations; - } - - Environment.prototype.toConditionalReference = function toConditionalReference(reference) { - return new _glimmerRuntimeLibReferences.ConditionalReference(reference); - }; - - Environment.prototype.getAppendOperations = function getAppendOperations() { - return this.appendOperations; - }; - - Environment.prototype.getDOM = function getDOM() { - return this.updateOperations; - }; - - Environment.prototype.getIdentity = function getIdentity(object) { - return _glimmerUtil.ensureGuid(object) + ''; - }; - - Environment.prototype.statement = function statement(_statement, symbolTable) { - return this.refineStatement(parseStatement(_statement), symbolTable) || _statement; - }; - - Environment.prototype.refineStatement = function refineStatement(statement, symbolTable) { - var isSimple = statement.isSimple; - var isBlock = statement.isBlock; - var key = statement.key; - var args = statement.args; - - if (isSimple && isBlock) { - switch (key) { - case 'each': - return new _glimmerRuntimeLibSyntaxBuiltinsEach.default(args); - case 'if': - return new _glimmerRuntimeLibSyntaxBuiltinsIf.default(args); - case 'with': - return new _glimmerRuntimeLibSyntaxBuiltinsWith.default(args); - case 'unless': - return new _glimmerRuntimeLibSyntaxBuiltinsUnless.default(args); - } - } - }; - - Environment.prototype.begin = function begin() { - this.createdComponents = []; - this.createdManagers = []; - this.updatedComponents = []; - this.updatedManagers = []; - this.destructors = []; - this.scheduledInstallManagers = []; - this.scheduledInstallModifiers = []; - this.scheduledUpdateModifierManagers = []; - this.scheduledUpdateModifiers = []; - }; - - Environment.prototype.didCreate = function didCreate(component, manager) { - this.createdComponents.push(component); - this.createdManagers.push(manager); - }; - - Environment.prototype.didUpdate = function didUpdate(component, manager) { - this.updatedComponents.push(component); - this.updatedManagers.push(manager); - }; - - Environment.prototype.scheduleInstallModifier = function scheduleInstallModifier(modifier, manager) { - this.scheduledInstallManagers.push(manager); - this.scheduledInstallModifiers.push(modifier); - }; - - Environment.prototype.scheduleUpdateModifier = function scheduleUpdateModifier(modifier, manager) { - this.scheduledUpdateModifierManagers.push(manager); - this.scheduledUpdateModifiers.push(modifier); - }; - - Environment.prototype.didDestroy = function didDestroy(d) { - this.destructors.push(d); - }; - - Environment.prototype.commit = function commit() { - for (var i = 0; i < this.createdComponents.length; i++) { - var component = this.createdComponents[i]; - var manager = this.createdManagers[i]; - manager.didCreate(component); - } - for (var i = 0; i < this.updatedComponents.length; i++) { - var component = this.updatedComponents[i]; - var manager = this.updatedManagers[i]; - manager.didUpdate(component); - } - for (var i = 0; i < this.destructors.length; i++) { - this.destructors[i].destroy(); - } - for (var i = 0; i < this.scheduledInstallManagers.length; i++) { - var manager = this.scheduledInstallManagers[i]; - var modifier = this.scheduledInstallModifiers[i]; - manager.install(modifier); - } - for (var i = 0; i < this.scheduledUpdateModifierManagers.length; i++) { - var manager = this.scheduledUpdateModifierManagers[i]; - var modifier = this.scheduledUpdateModifiers[i]; - manager.update(modifier); - } - this.createdComponents = null; - this.createdManagers = null; - this.updatedComponents = null; - this.updatedManagers = null; - this.destructors = null; - this.scheduledInstallManagers = null; - this.scheduledInstallModifiers = null; - this.scheduledUpdateModifierManagers = null; - this.scheduledUpdateModifiers = null; - }; - - Environment.prototype.attributeFor = function attributeFor(element, attr, isTrusting, namespace) { - return _glimmerRuntimeLibDomAttributeManagers.defaultManagers(element, attr, isTrusting, namespace); - }; - - return Environment; - })(); - - exports.Environment = Environment; - exports.default = Environment; - - function parseStatement(statement) { - var type = statement.type; - var block = type === 'block' ? statement : null; - var append = type === 'optimized-append' ? statement : null; - var modifier = type === 'modifier' ? statement : null; - var appendType = append && append.value.type; - var args = undefined; - var path = undefined; - if (block) { - args = block.args; - path = block.path; - } else if (append && (appendType === 'unknown' || appendType === 'get')) { - var appendValue = append.value; - args = _glimmerRuntimeLibSyntaxCore.Args.empty(); - path = appendValue.ref.parts; - } else if (append && append.value.type === 'helper') { - var helper = append.value; - args = helper.args; - path = helper.ref.parts; - } else if (modifier) { - path = modifier.path; - args = modifier.args; - } - var key = undefined, - isSimple = undefined; - if (path) { - isSimple = path.length === 1; - key = path[0]; - } - return { - isSimple: isSimple, - path: path, - key: key, - args: args, - appendType: appendType, - original: statement, - isInline: !!append, - isBlock: !!block, - isModifier: !!modifier - }; - } -}); - -enifed('glimmer-runtime/lib/helpers/get-dynamic-var', ['exports', 'glimmer-reference'], function (exports, _glimmerReference) { - 'use strict'; - - var DynamicVarReference = (function () { - function DynamicVarReference(scope, nameRef) { - this.scope = scope; - this.nameRef = nameRef; - var varTag = this.varTag = new _glimmerReference.UpdatableTag(_glimmerReference.CONSTANT_TAG); - this.tag = _glimmerReference.combine([nameRef.tag, varTag]); - } - - DynamicVarReference.prototype.value = function value() { - return this.getVar().value(); - }; - - DynamicVarReference.prototype.get = function get(key) { - return this.getVar().get(key); - }; - - DynamicVarReference.prototype.getVar = function getVar() { - var name = String(this.nameRef.value()); - var ref = this.scope.get(name); - this.varTag.update(ref.tag); - return ref; - }; - - return DynamicVarReference; - })(); - - function getDynamicVar(vm, args, symbolTable) { - var scope = vm.dynamicScope(); - var nameRef = args.positional.at(0); - return new DynamicVarReference(scope, nameRef); - } - exports.default = getDynamicVar; -}); - -enifed("glimmer-runtime/lib/modifier/interfaces", ["exports"], function (exports) { - "use strict"; -}); - -enifed("glimmer-runtime/lib/opcode-builder", ["exports"], function (exports) { - "use strict"; -}); - -enifed('glimmer-runtime/lib/opcodes', ['exports', 'glimmer-util'], function (exports, _glimmerUtil) { - 'use strict'; - - exports.inspect = inspect; - - var AbstractOpcode = (function () { - function AbstractOpcode() { - _glimmerUtil.initializeGuid(this); - } - - AbstractOpcode.prototype.toJSON = function toJSON() { - return { guid: this._guid, type: this.type }; - }; - - return AbstractOpcode; - })(); - - exports.AbstractOpcode = AbstractOpcode; - - var Opcode = (function (_AbstractOpcode) { - babelHelpers.inherits(Opcode, _AbstractOpcode); - - function Opcode() { - _AbstractOpcode.apply(this, arguments); - this.next = null; - this.prev = null; - } - - return Opcode; - })(AbstractOpcode); - - exports.Opcode = Opcode; - - var UpdatingOpcode = (function (_AbstractOpcode2) { - babelHelpers.inherits(UpdatingOpcode, _AbstractOpcode2); - - function UpdatingOpcode() { - _AbstractOpcode2.apply(this, arguments); - this.next = null; - this.prev = null; - } - - return UpdatingOpcode; - })(AbstractOpcode); - - exports.UpdatingOpcode = UpdatingOpcode; - - function inspect(opcodes) { - var buffer = []; - opcodes.toArray().forEach(function (opcode, i) { - _inspect(opcode.toJSON(), buffer, 0, i); - }); - return buffer.join(''); - } - - function _inspect(opcode, buffer, level, index) { - var indentation = []; - for (var i = 0; i < level; i++) { - indentation.push(' '); - } - buffer.push.apply(buffer, indentation); - buffer.push(index + 1 + '. ' + opcode.type.toUpperCase()); - if (opcode.args || opcode.details) { - buffer.push('('); - if (opcode.args) { - buffer.push(opcode.args.join(', ')); - } - if (opcode.details) { - var keys = Object.keys(opcode.details); - if (keys.length) { - if (opcode.args && opcode.args.length) { - buffer.push(', '); - } - buffer.push(keys.map(function (key) { - return key + '=' + opcode.details[key]; - }).join(', ')); - } - } - buffer.push(')'); - } - buffer.push('\n'); - if (opcode.children && opcode.children.length) { - for (var i = 0; i < opcode.children.length; i++) { - _inspect(opcode.children[i], buffer, level + 1, i); - } - } - } -}); - -enifed("glimmer-runtime/lib/partial", ["exports"], function (exports) { - "use strict"; - - var PartialDefinition = function PartialDefinition(name, template) { - this.name = name; - this.template = template; - }; - - exports.PartialDefinition = PartialDefinition; -}); - -enifed('glimmer-runtime/lib/references', ['exports', 'glimmer-reference'], function (exports, _glimmerReference) { - 'use strict'; - - var PrimitiveReference = (function (_ConstReference) { - babelHelpers.inherits(PrimitiveReference, _ConstReference); - - function PrimitiveReference(value) { - _ConstReference.call(this, value); - } - - PrimitiveReference.create = function create(value) { - if (value === undefined) { - return UNDEFINED_REFERENCE; - } else if (value === null) { - return NULL_REFERENCE; - } else if (value === true) { - return TRUE_REFERENCE; - } else if (value === false) { - return FALSE_REFERENCE; - } else if (typeof value === 'number') { - return new ValueReference(value); - } else { - return new StringReference(value); - } - }; - - PrimitiveReference.prototype.get = function get(key) { - return UNDEFINED_REFERENCE; - }; - - return PrimitiveReference; - })(_glimmerReference.ConstReference); - - exports.PrimitiveReference = PrimitiveReference; - - var StringReference = (function (_PrimitiveReference) { - babelHelpers.inherits(StringReference, _PrimitiveReference); - - function StringReference() { - _PrimitiveReference.apply(this, arguments); - this.lengthReference = null; - } - - StringReference.prototype.get = function get(key) { - if (key === 'length') { - var lengthReference = this.lengthReference; - - if (lengthReference === null) { - lengthReference = this.lengthReference = new ValueReference(this.inner.length); - } - return lengthReference; - } else { - return _PrimitiveReference.prototype.get.call(this, key); - } - }; - - return StringReference; - })(PrimitiveReference); - - var ValueReference = (function (_PrimitiveReference2) { - babelHelpers.inherits(ValueReference, _PrimitiveReference2); - - function ValueReference(value) { - _PrimitiveReference2.call(this, value); - } - - return ValueReference; - })(PrimitiveReference); - - var UNDEFINED_REFERENCE = new ValueReference(undefined); - exports.UNDEFINED_REFERENCE = UNDEFINED_REFERENCE; - var NULL_REFERENCE = new ValueReference(null); - exports.NULL_REFERENCE = NULL_REFERENCE; - var TRUE_REFERENCE = new ValueReference(true); - var FALSE_REFERENCE = new ValueReference(false); - - var ConditionalReference = (function () { - function ConditionalReference(inner) { - this.inner = inner; - this.tag = inner.tag; - } - - ConditionalReference.prototype.value = function value() { - return this.toBool(this.inner.value()); - }; - - ConditionalReference.prototype.toBool = function toBool(value) { - return !!value; - }; - - return ConditionalReference; - })(); - - exports.ConditionalReference = ConditionalReference; -}); - -enifed('glimmer-runtime/lib/scanner', ['exports', 'glimmer-runtime/lib/syntax/statements', 'glimmer-runtime/lib/compiled/blocks', 'glimmer-util', 'glimmer-runtime/lib/symbol-table'], function (exports, _glimmerRuntimeLibSyntaxStatements, _glimmerRuntimeLibCompiledBlocks, _glimmerUtil, _glimmerRuntimeLibSymbolTable) { - 'use strict'; - - var Scanner = (function () { - function Scanner(block, meta, env) { - this.block = block; - this.meta = meta; - this.env = env; - } - - Scanner.prototype.scanEntryPoint = function scanEntryPoint() { - var block = this.block; - var meta = this.meta; - - var symbolTable = _glimmerRuntimeLibSymbolTable.default.forEntryPoint(meta); - var program = buildStatements(block, block.blocks, symbolTable, this.env); - return new _glimmerRuntimeLibCompiledBlocks.EntryPoint(program, symbolTable); - }; - - Scanner.prototype.scanLayout = function scanLayout() { - var block = this.block; - var meta = this.meta; - var blocks = block.blocks; - var named = block.named; - var yields = block.yields; - var hasPartials = block.hasPartials; - - var symbolTable = _glimmerRuntimeLibSymbolTable.default.forLayout(named, yields, hasPartials, meta); - var program = buildStatements(block, blocks, symbolTable, this.env); - return new _glimmerRuntimeLibCompiledBlocks.Layout(program, symbolTable, named, yields, hasPartials); - }; - - Scanner.prototype.scanPartial = function scanPartial(symbolTable) { - var block = this.block; - var blocks = block.blocks; - var locals = block.locals; - - var program = buildStatements(block, blocks, symbolTable, this.env); - return new _glimmerRuntimeLibCompiledBlocks.PartialBlock(program, symbolTable, locals); - }; - - return Scanner; - })(); - - exports.default = Scanner; - - function buildStatements(_ref, blocks, symbolTable, env) { - var statements = _ref.statements; - - if (statements.length === 0) return EMPTY_PROGRAM; - return new BlockScanner(statements, blocks, symbolTable, env).scan(); - } - var EMPTY_PROGRAM = _glimmerUtil.EMPTY_SLICE; - - var BlockScanner = (function () { - function BlockScanner(statements, blocks, symbolTable, env) { - this.blocks = blocks; - this.symbolTable = symbolTable; - this.stack = new _glimmerUtil.Stack(); - this.stack.push(new ChildBlockScanner(symbolTable)); - this.reader = new SyntaxReader(statements, symbolTable, this); - this.env = env; - } - - BlockScanner.prototype.scan = function scan() { - var statement = undefined; - while (statement = this.reader.next()) { - this.addStatement(statement); - } - return this.stack.current.program; - }; - - BlockScanner.prototype.blockFor = function blockFor(symbolTable, id) { - var block = this.blocks[id]; - var childTable = _glimmerRuntimeLibSymbolTable.default.forBlock(this.symbolTable, block.locals); - var program = buildStatements(block, this.blocks, childTable, this.env); - return new _glimmerRuntimeLibCompiledBlocks.InlineBlock(program, childTable, block.locals); - }; - - BlockScanner.prototype.startBlock = function startBlock(locals) { - var childTable = _glimmerRuntimeLibSymbolTable.default.forBlock(this.symbolTable, locals); - this.stack.push(new ChildBlockScanner(childTable)); - }; - - BlockScanner.prototype.endBlock = function endBlock(locals) { - var _stack$pop = this.stack.pop(); - - var program = _stack$pop.program; - var symbolTable = _stack$pop.symbolTable; - - var block = new _glimmerRuntimeLibCompiledBlocks.InlineBlock(program, symbolTable, locals); - this.addChild(block); - return block; - }; - - BlockScanner.prototype.addChild = function addChild(block) { - this.stack.current.addChild(block); - }; - - BlockScanner.prototype.addStatement = function addStatement(statement) { - this.stack.current.addStatement(statement.scan(this)); - }; - - BlockScanner.prototype.next = function next() { - return this.reader.next(); - }; - - return BlockScanner; - })(); - - exports.BlockScanner = BlockScanner; - - var ChildBlockScanner = (function () { - function ChildBlockScanner(symbolTable) { - this.symbolTable = symbolTable; - this.children = []; - this.program = new _glimmerUtil.LinkedList(); - } - - ChildBlockScanner.prototype.addChild = function addChild(block) { - this.children.push(block); - }; - - ChildBlockScanner.prototype.addStatement = function addStatement(statement) { - this.program.append(statement); - }; - - return ChildBlockScanner; - })(); - - var SyntaxReader = (function () { - function SyntaxReader(statements, symbolTable, scanner) { - this.statements = statements; - this.symbolTable = symbolTable; - this.scanner = scanner; - this.current = 0; - this.last = null; - } - - SyntaxReader.prototype.next = function next() { - var last = this.last; - if (last) { - this.last = null; - return last; - } else if (this.current === this.statements.length) { - return null; - } - var sexp = this.statements[this.current++]; - return _glimmerRuntimeLibSyntaxStatements.default(sexp, this.symbolTable, this.scanner); - }; - - return SyntaxReader; - })(); -}); - -enifed('glimmer-runtime/lib/symbol-table', ['exports', 'glimmer-util'], function (exports, _glimmerUtil) { - 'use strict'; - - var SymbolTable = (function () { - function SymbolTable(parent) { - var meta = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - this.parent = parent; - this.meta = meta; - this.locals = _glimmerUtil.dict(); - this.named = _glimmerUtil.dict(); - this.yields = _glimmerUtil.dict(); - this.partialArgs = null; - this.size = 1; - this.top = parent ? parent.top : this; - } - - SymbolTable.forEntryPoint = function forEntryPoint(meta) { - return new SymbolTable(null, meta).initEntryPoint(); - }; - - SymbolTable.forLayout = function forLayout(named, yields, hasPartials, meta) { - return new SymbolTable(null, meta).initLayout(named, yields, hasPartials); - }; - - SymbolTable.forBlock = function forBlock(parent, locals) { - return new SymbolTable(parent, null).initBlock(locals); - }; - - SymbolTable.prototype.initEntryPoint = function initEntryPoint() { - return this; - }; - - SymbolTable.prototype.initBlock = function initBlock(locals) { - this.initPositionals(locals); - return this; - }; - - SymbolTable.prototype.initLayout = function initLayout(named, yields, hasPartials) { - this.initNamed(named); - this.initYields(yields); - this.initPartials(hasPartials); - return this; - }; - - SymbolTable.prototype.initPositionals = function initPositionals(positionals) { - var _this = this; - - if (positionals) positionals.forEach(function (s) { - return _this.locals[s] = _this.top.size++; - }); - return this; - }; - - SymbolTable.prototype.initNamed = function initNamed(named) { - var _this2 = this; - - if (named) named.forEach(function (s) { - return _this2.named[s] = _this2.top.size++; - }); - return this; - }; - - SymbolTable.prototype.initYields = function initYields(yields) { - var _this3 = this; - - if (yields) yields.forEach(function (b) { - return _this3.yields[b] = _this3.top.size++; - }); - return this; - }; - - SymbolTable.prototype.initPartials = function initPartials(hasPartials) { - if (hasPartials) this.top.partialArgs = this.top.size++; - return this; - }; - - SymbolTable.prototype.getMeta = function getMeta() { - var meta = this.meta; - var parent = this.parent; - - if (!meta && parent) { - meta = parent.getMeta(); - } - return meta; - }; - - SymbolTable.prototype.getYield = function getYield(name) { - var yields = this.yields; - var parent = this.parent; - - var symbol = yields[name]; - if (!symbol && parent) { - symbol = parent.getYield(name); - } - return symbol; - }; - - SymbolTable.prototype.getNamed = function getNamed(name) { - var named = this.named; - var parent = this.parent; - - var symbol = named[name]; - if (!symbol && parent) { - symbol = parent.getNamed(name); - } - return symbol; - }; - - SymbolTable.prototype.getLocal = function getLocal(name) { - var locals = this.locals; - var parent = this.parent; - - var symbol = locals[name]; - if (!symbol && parent) { - symbol = parent.getLocal(name); - } - return symbol; - }; - - SymbolTable.prototype.getPartialArgs = function getPartialArgs() { - return this.top.partialArgs; - }; - - SymbolTable.prototype.isTop = function isTop() { - return this.top === this; - }; - - return SymbolTable; - })(); - - exports.default = SymbolTable; -}); - -enifed("glimmer-runtime/lib/syntax", ["exports"], function (exports) { - "use strict"; - - exports.isAttribute = isAttribute; - - var Statement = (function () { - function Statement() { - this.next = null; - this.prev = null; - } - - Statement.fromSpec = function fromSpec(spec, symbolTable, scanner) { - throw new Error("You need to implement fromSpec on " + this); - }; - - Statement.prototype.clone = function clone() { - // not type safe but the alternative is extreme boilerplate per - // syntax subclass. - return new this.constructor(this); - }; - - Statement.prototype.scan = function scan(scanner) { - return this; - }; - - return Statement; - })(); - - exports.Statement = Statement; - - var Expression = (function () { - function Expression() {} - - Expression.fromSpec = function fromSpec(spec, blocks) { - throw new Error("You need to implement fromSpec on " + this); - }; - - return Expression; - })(); - - exports.Expression = Expression; - var ATTRIBUTE = "e1185d30-7cac-4b12-b26a-35327d905d92"; - exports.ATTRIBUTE = ATTRIBUTE; - var ARGUMENT = "0f3802314-d747-bbc5-0168-97875185c3rt"; - exports.ARGUMENT = ARGUMENT; - - var Attribute = (function (_Statement) { - babelHelpers.inherits(Attribute, _Statement); - - function Attribute() { - _Statement.apply(this, arguments); - this["e1185d30-7cac-4b12-b26a-35327d905d92"] = true; - } - - return Attribute; - })(Statement); - - exports.Attribute = Attribute; - - var Argument = (function (_Statement2) { - babelHelpers.inherits(Argument, _Statement2); - - function Argument() { - _Statement2.apply(this, arguments); - this["0f3802314-d747-bbc5-0168-97875185c3rt"] = true; - } - - return Argument; - })(Statement); - - exports.Argument = Argument; - - function isAttribute(value) { - return value && value[ATTRIBUTE] === true; - } -}); - -enifed('glimmer-runtime/lib/syntax/builtins/each', ['exports', 'glimmer-runtime/lib/syntax'], function (exports, _glimmerRuntimeLibSyntax) { - 'use strict'; - - var EachSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(EachSyntax, _StatementSyntax); - - function EachSyntax(args) { - _StatementSyntax.call(this); - this.args = args; - this.type = "each-statement"; - } - - EachSyntax.prototype.compile = function compile(dsl, env) { - // Enter(BEGIN, END) - // BEGIN: Noop - // PutArgs - // PutIterable - // JumpUnless(ELSE) - // EnterList(BEGIN2, END2) - // ITER: Noop - // NextIter(BREAK) - // EnterWithKey(BEGIN2, END2) - // BEGIN2: Noop - // PushChildScope - // Evaluate(default) - // PopScope - // END2: Noop - // Exit - // Jump(ITER) - // BREAK: Noop - // ExitList - // Jump(END) - // ELSE: Noop - // Evalulate(inverse) - // END: Noop - // Exit - var args = this.args; - var blocks = this.args.blocks; - - dsl.block(args, function (dsl, BEGIN, END) { - dsl.putIterator(); - if (blocks.inverse) { - dsl.jumpUnless('ELSE'); - } else { - dsl.jumpUnless(END); - } - dsl.iter(function (dsl, BEGIN, END) { - dsl.evaluate('default', blocks.default); - }); - if (blocks.inverse) { - dsl.jump(END); - dsl.label('ELSE'); - dsl.evaluate('inverse', blocks.inverse); - } - }); - }; - - return EachSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.default = EachSyntax; -}); - -enifed('glimmer-runtime/lib/syntax/builtins/if', ['exports', 'glimmer-runtime/lib/syntax'], function (exports, _glimmerRuntimeLibSyntax) { - 'use strict'; - - var IfSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(IfSyntax, _StatementSyntax); - - function IfSyntax(args) { - _StatementSyntax.call(this); - this.args = args; - this.type = "if-statement"; - } - - IfSyntax.prototype.compile = function compile(dsl) { - // PutArgs - // Test(Environment) - // Enter(BEGIN, END) - // BEGIN: Noop - // JumpUnless(ELSE) - // Evaluate(default) - // Jump(END) - // ELSE: Noop - // Evalulate(inverse) - // END: Noop - // Exit - var args = this.args; - var blocks = this.args.blocks; - - dsl.putArgs(args); - dsl.test('environment'); - dsl.block(null, function (dsl, BEGIN, END) { - if (blocks.inverse) { - dsl.jumpUnless('ELSE'); - dsl.evaluate('default', blocks.default); - dsl.jump(END); - dsl.label('ELSE'); - dsl.evaluate('inverse', blocks.inverse); - } else { - dsl.jumpUnless(END); - dsl.evaluate('default', blocks.default); - } - }); - }; - - return IfSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.default = IfSyntax; -}); - -enifed('glimmer-runtime/lib/syntax/builtins/in-element', ['exports', 'glimmer-runtime/lib/syntax'], function (exports, _glimmerRuntimeLibSyntax) { - 'use strict'; - - var InElementSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(InElementSyntax, _StatementSyntax); - - function InElementSyntax(args) { - _StatementSyntax.call(this); - this.args = args; - this.type = "in-element-statement"; - } - - InElementSyntax.prototype.compile = function compile(dsl, env) { - var args = this.args; - var blocks = this.args.blocks; - - dsl.putArgs(args); - dsl.test('simple'); - dsl.block(null, function (dsl, BEGIN, END) { - dsl.jumpUnless(END); - dsl.pushRemoteElement(); - dsl.evaluate('default', blocks.default); - dsl.popRemoteElement(); - }); - }; - - return InElementSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.default = InElementSyntax; -}); - -enifed("glimmer-runtime/lib/syntax/builtins/partial", ["exports", "glimmer-runtime/lib/syntax"], function (exports, _glimmerRuntimeLibSyntax) { - "use strict"; - - var StaticPartialSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(StaticPartialSyntax, _StatementSyntax); - - function StaticPartialSyntax(name) { - _StatementSyntax.call(this); - this.name = name; - this.type = "static-partial"; - } - - StaticPartialSyntax.prototype.compile = function compile(dsl, env, symbolTable) { - var name = String(this.name.inner()); - if (!env.hasPartial(name, symbolTable)) { - throw new Error("Compile Error: " + name + " is not a partial"); - } - var definition = env.lookupPartial(name, symbolTable); - dsl.putPartialDefinition(definition); - dsl.evaluatePartial(); - }; - - return StaticPartialSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.StaticPartialSyntax = StaticPartialSyntax; - - var DynamicPartialSyntax = (function (_StatementSyntax2) { - babelHelpers.inherits(DynamicPartialSyntax, _StatementSyntax2); - - function DynamicPartialSyntax(name) { - _StatementSyntax2.call(this); - this.name = name; - this.type = "dynamic-partial"; - } - - DynamicPartialSyntax.prototype.compile = function compile(dsl) { - var name = this.name; - - dsl.startLabels(); - dsl.putValue(name); - dsl.test('simple'); - dsl.enter('BEGIN', 'END'); - dsl.label('BEGIN'); - dsl.jumpUnless('END'); - dsl.putDynamicPartialDefinition(); - dsl.evaluatePartial(); - dsl.label('END'); - dsl.exit(); - dsl.stopLabels(); - }; - - return DynamicPartialSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.DynamicPartialSyntax = DynamicPartialSyntax; -}); - -enifed('glimmer-runtime/lib/syntax/builtins/unless', ['exports', 'glimmer-runtime/lib/syntax'], function (exports, _glimmerRuntimeLibSyntax) { - 'use strict'; - - var UnlessSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(UnlessSyntax, _StatementSyntax); - - function UnlessSyntax(args) { - _StatementSyntax.call(this); - this.args = args; - this.type = "unless-statement"; - } - - UnlessSyntax.prototype.compile = function compile(dsl, env) { - // PutArgs - // Enter(BEGIN, END) - // BEGIN: Noop - // Test(Environment) - // JumpIf(ELSE) - // Evaluate(default) - // Jump(END) - // ELSE: Noop - // Evalulate(inverse) - // END: Noop - // Exit - var args = this.args; - var blocks = this.args.blocks; - - dsl.putArgs(args); - dsl.test('environment'); - dsl.block(null, function (dsl) { - if (blocks.inverse) { - dsl.jumpIf('ELSE'); - dsl.evaluate('default', blocks.default); - dsl.jump('END'); - dsl.label('ELSE'); - dsl.evaluate('inverse', blocks.inverse); - } else { - dsl.jumpIf('END'); - dsl.evaluate('default', blocks.default); - } - }); - }; - - return UnlessSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.default = UnlessSyntax; -}); - -enifed('glimmer-runtime/lib/syntax/builtins/with-dynamic-vars', ['exports', 'glimmer-runtime/lib/syntax'], function (exports, _glimmerRuntimeLibSyntax) { - 'use strict'; - - var WithDynamicVarsSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(WithDynamicVarsSyntax, _StatementSyntax); - - function WithDynamicVarsSyntax(args) { - _StatementSyntax.call(this); - this.args = args; - this.type = "with-dynamic-vars-statement"; - } - - WithDynamicVarsSyntax.prototype.compile = function compile(dsl, env) { - var args = this.args; - var blocks = this.args.blocks; - - dsl.unit(function (dsl) { - dsl.putArgs(args); - dsl.pushDynamicScope(); - dsl.bindDynamicScope(args.named.keys); - dsl.evaluate('default', blocks.default); - dsl.popDynamicScope(); - }); - }; - - return WithDynamicVarsSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.default = WithDynamicVarsSyntax; -}); - -enifed('glimmer-runtime/lib/syntax/builtins/with', ['exports', 'glimmer-runtime/lib/syntax'], function (exports, _glimmerRuntimeLibSyntax) { - 'use strict'; - - var WithSyntax = (function (_StatementSyntax) { - babelHelpers.inherits(WithSyntax, _StatementSyntax); - - function WithSyntax(args) { - _StatementSyntax.call(this); - this.args = args; - this.type = "with-statement"; - } - - WithSyntax.prototype.compile = function compile(dsl, env) { - // PutArgs - // Test(Environment) - // Enter(BEGIN, END) - // BEGIN: Noop - // JumpUnless(ELSE) - // Evaluate(default) - // Jump(END) - // ELSE: Noop - // Evaluate(inverse) - // END: Noop - // Exit - var args = this.args; - var blocks = this.args.blocks; - - dsl.putArgs(args); - dsl.test('environment'); - dsl.block(null, function (dsl, BEGIN, END) { - if (blocks.inverse) { - dsl.jumpUnless('ELSE'); - dsl.evaluate('default', blocks.default); - dsl.jump(END); - dsl.label('ELSE'); - dsl.evaluate('inverse', blocks.inverse); - } else { - dsl.jumpUnless(END); - dsl.evaluate('default', blocks.default); - } - }); - }; - - return WithSyntax; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.default = WithSyntax; -}); - -enifed('glimmer-runtime/lib/syntax/core', ['exports', 'glimmer-runtime/lib/syntax', 'glimmer-runtime/lib/syntax/builtins/partial', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/compiled/opcodes/vm', 'glimmer-runtime/lib/compiled/opcodes/component', 'glimmer-runtime/lib/compiled/opcodes/dom', 'glimmer-runtime/lib/syntax/expressions', 'glimmer-runtime/lib/compiled/expressions/args', 'glimmer-runtime/lib/compiled/expressions/value', 'glimmer-runtime/lib/compiled/expressions/lookups', 'glimmer-runtime/lib/compiled/expressions/has-block', 'glimmer-runtime/lib/compiled/expressions/helper', 'glimmer-runtime/lib/compiled/expressions/concat', 'glimmer-runtime/lib/utils', 'glimmer-runtime/lib/compiled/opcodes/content'], function (exports, _glimmerRuntimeLibSyntax, _glimmerRuntimeLibSyntaxBuiltinsPartial, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibCompiledOpcodesVm, _glimmerRuntimeLibCompiledOpcodesComponent, _glimmerRuntimeLibCompiledOpcodesDom, _glimmerRuntimeLibSyntaxExpressions, _glimmerRuntimeLibCompiledExpressionsArgs, _glimmerRuntimeLibCompiledExpressionsValue, _glimmerRuntimeLibCompiledExpressionsLookups, _glimmerRuntimeLibCompiledExpressionsHasBlock, _glimmerRuntimeLibCompiledExpressionsHelper, _glimmerRuntimeLibCompiledExpressionsConcat, _glimmerRuntimeLibUtils, _glimmerRuntimeLibCompiledOpcodesContent) { - 'use strict'; - - var Block = (function (_StatementSyntax) { - babelHelpers.inherits(Block, _StatementSyntax); - - function Block(path, args) { - _StatementSyntax.call(this); - this.path = path; - this.args = args; - this.type = "block"; - } - - Block.fromSpec = function fromSpec(sexp, symbolTable, scanner) { - var path = sexp[1]; - var params = sexp[2]; - var hash = sexp[3]; - var templateId = sexp[4]; - var inverseId = sexp[5]; - - var template = scanner.blockFor(symbolTable, templateId); - var inverse = typeof inverseId === 'number' ? scanner.blockFor(symbolTable, inverseId) : null; - var blocks = Blocks.fromSpec(template, inverse); - return new Block(path, Args.fromSpec(params, hash, blocks)); - }; - - Block.build = function build(path, args) { - return new this(path, args); - }; - - Block.prototype.scan = function scan(scanner) { - var _args$blocks = this.args.blocks; - var _default = _args$blocks.default; - var inverse = _args$blocks.inverse; - - if (_default) scanner.addChild(_default); - if (inverse) scanner.addChild(inverse); - return this; - }; - - Block.prototype.compile = function compile(ops) { - throw new Error("SyntaxError"); - }; - - return Block; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Block = Block; - - var Append = (function (_StatementSyntax2) { - babelHelpers.inherits(Append, _StatementSyntax2); - - function Append(_ref) { - var value = _ref.value; - var trustingMorph = _ref.trustingMorph; - - _StatementSyntax2.call(this); - this.value = value; - this.trustingMorph = trustingMorph; - } - - Append.fromSpec = function fromSpec(sexp) { - var value = sexp[1]; - var trustingMorph = sexp[2]; - - return new OptimizedAppend({ value: _glimmerRuntimeLibSyntaxExpressions.default(value), trustingMorph: trustingMorph }); - }; - - return Append; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Append = Append; - - var OptimizedAppend = (function (_Append) { - babelHelpers.inherits(OptimizedAppend, _Append); - - function OptimizedAppend() { - _Append.apply(this, arguments); - this.type = "optimized-append"; - } - - OptimizedAppend.prototype.deopt = function deopt() { - return new UnoptimizedAppend(this); - }; - - OptimizedAppend.prototype.compile = function compile(compiler, env, symbolTable) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesVm.PutValueOpcode(this.value.compile(compiler, env, symbolTable))); - if (this.trustingMorph) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesContent.OptimizedTrustingAppendOpcode()); - } else { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesContent.OptimizedCautiousAppendOpcode()); - } - }; - - return OptimizedAppend; - })(Append); - - exports.OptimizedAppend = OptimizedAppend; - - var UnoptimizedAppend = (function (_Append2) { - babelHelpers.inherits(UnoptimizedAppend, _Append2); - - function UnoptimizedAppend() { - _Append2.apply(this, arguments); - this.type = "unoptimized-append"; - } - - UnoptimizedAppend.prototype.compile = function compile(compiler, env, symbolTable) { - var expression = this.value.compile(compiler, env, symbolTable); - if (this.trustingMorph) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesContent.GuardedTrustingAppendOpcode(expression, symbolTable)); - } else { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesContent.GuardedCautiousAppendOpcode(expression, symbolTable)); - } - }; - - return UnoptimizedAppend; - })(Append); - - exports.UnoptimizedAppend = UnoptimizedAppend; - - var MODIFIER_SYNTAX = "c0420397-8ff1-4241-882b-4b7a107c9632"; - - var Modifier = (function (_StatementSyntax3) { - babelHelpers.inherits(Modifier, _StatementSyntax3); - - function Modifier(options) { - _StatementSyntax3.call(this); - this["c0420397-8ff1-4241-882b-4b7a107c9632"] = true; - this.type = "modifier"; - this.path = options.path; - this.args = options.args; - } - - Modifier.fromSpec = function fromSpec(node) { - var path = node[1]; - var params = node[2]; - var hash = node[3]; - - return new Modifier({ - path: path, - args: Args.fromSpec(params, hash, EMPTY_BLOCKS) - }); - }; - - Modifier.build = function build(path, options) { - return new Modifier({ - path: path, - params: options.params, - hash: options.hash - }); - }; - - Modifier.prototype.compile = function compile(compiler, env, symbolTable) { - var args = this.args.compile(compiler, env, symbolTable); - if (env.hasModifier(this.path, symbolTable)) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.ModifierOpcode(this.path[0], env.lookupModifier(this.path, symbolTable), args)); - } else { - throw new Error('Compile Error: ' + this.path.join('.') + ' is not a modifier'); - } - }; - - return Modifier; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Modifier = Modifier; - - var StaticArg = (function (_ArgumentSyntax) { - babelHelpers.inherits(StaticArg, _ArgumentSyntax); - - function StaticArg(name, value) { - _ArgumentSyntax.call(this); - this.name = name; - this.value = value; - this.type = "static-arg"; - } - - StaticArg.fromSpec = function fromSpec(node) { - var name = node[1]; - var value = node[2]; - - return new StaticArg(name, value); - }; - - StaticArg.build = function build(name, value) { - var namespace = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - return new this(name, value); - }; - - StaticArg.prototype.compile = function compile() { - throw new Error('Cannot compiler StaticArg "' + this.name + '" as it is a delegate for ValueSyntax<string>.'); - }; - - StaticArg.prototype.valueSyntax = function valueSyntax() { - return Value.build(this.value); - }; - - return StaticArg; - })(_glimmerRuntimeLibSyntax.Argument); - - exports.StaticArg = StaticArg; - - var DynamicArg = (function (_ArgumentSyntax2) { - babelHelpers.inherits(DynamicArg, _ArgumentSyntax2); - - function DynamicArg(name, value) { - var namespace = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - _ArgumentSyntax2.call(this); - this.name = name; - this.value = value; - this.namespace = namespace; - this.type = 'dynamic-arg'; - } - - DynamicArg.fromSpec = function fromSpec(sexp) { - var name = sexp[1]; - var value = sexp[2]; - - return new DynamicArg(name, _glimmerRuntimeLibSyntaxExpressions.default(value)); - }; - - DynamicArg.build = function build(name, value) { - return new this(name, value); - }; - - DynamicArg.prototype.compile = function compile() { - throw new Error('Cannot compile DynamicArg for "' + this.name + '" as it is delegate for ExpressionSyntax<Opaque>.'); - }; - - DynamicArg.prototype.valueSyntax = function valueSyntax() { - return this.value; - }; - - return DynamicArg; - })(_glimmerRuntimeLibSyntax.Argument); - - exports.DynamicArg = DynamicArg; - - var TrustingAttr = (function () { - function TrustingAttr() {} - - TrustingAttr.fromSpec = function fromSpec(sexp) { - var name = sexp[1]; - var value = sexp[2]; - var namespace = sexp[3]; - - return new DynamicAttr(name, _glimmerRuntimeLibSyntaxExpressions.default(value), namespace, true); - }; - - TrustingAttr.build = function build(name, value, isTrusting) { - var namespace = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - return new DynamicAttr(name, value, namespace, isTrusting); - }; - - TrustingAttr.prototype.compile = function compile() { - throw new Error('Attempting to compile a TrustingAttr which is just a delegate for DynamicAttr.'); - }; - - return TrustingAttr; - })(); - - exports.TrustingAttr = TrustingAttr; - - var StaticAttr = (function (_AttributeSyntax) { - babelHelpers.inherits(StaticAttr, _AttributeSyntax); - - function StaticAttr(name, value, namespace) { - _AttributeSyntax.call(this); - this.name = name; - this.value = value; - this.namespace = namespace; - this["e1185d30-7cac-4b12-b26a-35327d905d92"] = true; - this.type = "static-attr"; - this.isTrusting = false; - } - - StaticAttr.fromSpec = function fromSpec(node) { - var name = node[1]; - var value = node[2]; - var namespace = node[3]; - - return new StaticAttr(name, value, namespace); - }; - - StaticAttr.build = function build(name, value) { - var namespace = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - - return new this(name, value, namespace); - }; - - StaticAttr.prototype.compile = function compile(compiler) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.StaticAttrOpcode(this.namespace, this.name, this.value)); - }; - - StaticAttr.prototype.valueSyntax = function valueSyntax() { - return Value.build(this.value); - }; - - return StaticAttr; - })(_glimmerRuntimeLibSyntax.Attribute); - - exports.StaticAttr = StaticAttr; - - var DynamicAttr = (function (_AttributeSyntax2) { - babelHelpers.inherits(DynamicAttr, _AttributeSyntax2); - - function DynamicAttr(name, value, namespace, isTrusting) { - if (namespace === undefined) namespace = undefined; - - _AttributeSyntax2.call(this); - this.name = name; - this.value = value; - this.namespace = namespace; - this.isTrusting = isTrusting; - this["e1185d30-7cac-4b12-b26a-35327d905d92"] = true; - this.type = "dynamic-attr"; - } - - DynamicAttr.fromSpec = function fromSpec(sexp) { - var name = sexp[1]; - var value = sexp[2]; - var namespace = sexp[3]; - - return new DynamicAttr(name, _glimmerRuntimeLibSyntaxExpressions.default(value), namespace); - }; - - DynamicAttr.build = function build(name, value) { - var isTrusting = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; - var namespace = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - return new this(name, value, namespace, isTrusting); - }; - - DynamicAttr.prototype.compile = function compile(compiler, env, symbolTable) { - var namespace = this.namespace; - var value = this.value; - - compiler.append(new _glimmerRuntimeLibCompiledOpcodesVm.PutValueOpcode(value.compile(compiler, env, symbolTable))); - if (namespace) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.DynamicAttrNSOpcode(this.name, this.namespace, this.isTrusting)); - } else { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.DynamicAttrOpcode(this.name, this.isTrusting)); - } - }; - - DynamicAttr.prototype.valueSyntax = function valueSyntax() { - return this.value; - }; - - return DynamicAttr; - })(_glimmerRuntimeLibSyntax.Attribute); - - exports.DynamicAttr = DynamicAttr; - - var FlushElement = (function (_StatementSyntax4) { - babelHelpers.inherits(FlushElement, _StatementSyntax4); - - function FlushElement() { - _StatementSyntax4.apply(this, arguments); - this.type = "flush-element"; - } - - FlushElement.fromSpec = function fromSpec() { - return new FlushElement(); - }; - - FlushElement.build = function build() { - return new this(); - }; - - FlushElement.prototype.compile = function compile(compiler) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.FlushElementOpcode()); - }; - - return FlushElement; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.FlushElement = FlushElement; - - var CloseElement = (function (_StatementSyntax5) { - babelHelpers.inherits(CloseElement, _StatementSyntax5); - - function CloseElement() { - _StatementSyntax5.apply(this, arguments); - this.type = "close-element"; - } - - CloseElement.fromSpec = function fromSpec() { - return new CloseElement(); - }; - - CloseElement.build = function build() { - return new this(); - }; - - CloseElement.prototype.compile = function compile(compiler) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.CloseElementOpcode()); - }; - - return CloseElement; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.CloseElement = CloseElement; - - var Text = (function (_StatementSyntax6) { - babelHelpers.inherits(Text, _StatementSyntax6); - - function Text(content) { - _StatementSyntax6.call(this); - this.content = content; - this.type = "text"; - } - - Text.fromSpec = function fromSpec(node) { - var content = node[1]; - - return new Text(content); - }; - - Text.build = function build(content) { - return new this(content); - }; - - Text.prototype.compile = function compile(dsl) { - dsl.text(this.content); - }; - - return Text; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Text = Text; - - var Comment = (function (_StatementSyntax7) { - babelHelpers.inherits(Comment, _StatementSyntax7); - - function Comment(comment) { - _StatementSyntax7.call(this); - this.comment = comment; - this.type = "comment"; - } - - Comment.fromSpec = function fromSpec(sexp) { - var value = sexp[1]; - - return new Comment(value); - }; - - Comment.build = function build(value) { - return new this(value); - }; - - Comment.prototype.compile = function compile(dsl) { - dsl.comment(this.comment); - }; - - return Comment; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Comment = Comment; - - var OpenElement = (function (_StatementSyntax8) { - babelHelpers.inherits(OpenElement, _StatementSyntax8); - - function OpenElement(tag, blockParams, symbolTable) { - _StatementSyntax8.call(this); - this.tag = tag; - this.blockParams = blockParams; - this.symbolTable = symbolTable; - this.type = "open-element"; - } - - OpenElement.fromSpec = function fromSpec(sexp, symbolTable) { - var tag = sexp[1]; - var blockParams = sexp[2]; - - return new OpenElement(tag, blockParams, symbolTable); - }; - - OpenElement.build = function build(tag, blockParams, symbolTable) { - return new this(tag, blockParams, symbolTable); - }; - - OpenElement.prototype.scan = function scan(scanner) { - var tag = this.tag; - - if (scanner.env.hasComponentDefinition([tag], this.symbolTable)) { - var _parameters = this.parameters(scanner); - - var args = _parameters.args; - var attrs = _parameters.attrs; - - scanner.startBlock(this.blockParams); - this.tagContents(scanner); - var template = scanner.endBlock(this.blockParams); - args.blocks = Blocks.fromSpec(template); - return new Component(tag, attrs, args); - } else { - return new OpenPrimitiveElement(tag); - } - }; - - OpenElement.prototype.compile = function compile(list, env) { - list.append(new _glimmerRuntimeLibCompiledOpcodesDom.OpenPrimitiveElementOpcode(this.tag)); - }; - - OpenElement.prototype.toIdentity = function toIdentity() { - var tag = this.tag; - - return new OpenPrimitiveElement(tag); - }; - - OpenElement.prototype.parameters = function parameters(scanner) { - var current = scanner.next(); - var attrs = []; - var argKeys = []; - var argValues = []; - while (!(current instanceof FlushElement)) { - if (current[MODIFIER_SYNTAX]) { - throw new Error('Compile Error: Element modifiers are not allowed in components'); - } - var param = current; - if (current[_glimmerRuntimeLibSyntax.ATTRIBUTE]) { - attrs.push(param.name); - // REMOVE ME: attributes should not be treated as args - argKeys.push(param.name); - argValues.push(param.valueSyntax()); - } else if (current[_glimmerRuntimeLibSyntax.ARGUMENT]) { - argKeys.push(param.name); - argValues.push(param.valueSyntax()); - } else { - throw new Error("Expected FlushElement, but got ${current}"); - } - current = scanner.next(); - } - return { args: Args.fromNamedArgs(NamedArgs.build(argKeys, argValues)), attrs: attrs }; - }; - - OpenElement.prototype.tagContents = function tagContents(scanner) { - var nesting = 1; - while (true) { - var current = scanner.next(); - if (current instanceof CloseElement && --nesting === 0) { - break; - } - scanner.addStatement(current); - if (current instanceof OpenElement || current instanceof OpenPrimitiveElement) { - nesting++; - } - } - }; - - return OpenElement; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.OpenElement = OpenElement; - - var Component = (function (_StatementSyntax9) { - babelHelpers.inherits(Component, _StatementSyntax9); - - function Component(tag, attrs, args) { - _StatementSyntax9.call(this); - this.tag = tag; - this.attrs = attrs; - this.args = args; - this.type = 'component'; - } - - Component.prototype.compile = function compile(list, env, symbolTable) { - var definition = env.getComponentDefinition([this.tag], symbolTable); - var args = this.args.compile(list, env, symbolTable); - var shadow = this.attrs; - list.append(new _glimmerRuntimeLibCompiledOpcodesComponent.PutComponentDefinitionOpcode(definition)); - list.append(new _glimmerRuntimeLibCompiledOpcodesComponent.OpenComponentOpcode(args, shadow)); - list.append(new _glimmerRuntimeLibCompiledOpcodesComponent.CloseComponentOpcode()); - }; - - return Component; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Component = Component; - - var OpenPrimitiveElement = (function (_StatementSyntax10) { - babelHelpers.inherits(OpenPrimitiveElement, _StatementSyntax10); - - function OpenPrimitiveElement(tag) { - _StatementSyntax10.call(this); - this.tag = tag; - this.type = "open-primitive-element"; - } - - OpenPrimitiveElement.build = function build(tag) { - return new this(tag); - }; - - OpenPrimitiveElement.prototype.compile = function compile(compiler) { - compiler.append(new _glimmerRuntimeLibCompiledOpcodesDom.OpenPrimitiveElementOpcode(this.tag)); - }; - - return OpenPrimitiveElement; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.OpenPrimitiveElement = OpenPrimitiveElement; - - var Yield = (function (_StatementSyntax11) { - babelHelpers.inherits(Yield, _StatementSyntax11); - - function Yield(to, args) { - _StatementSyntax11.call(this); - this.to = to; - this.args = args; - this.type = "yield"; - } - - Yield.fromSpec = function fromSpec(sexp) { - var to = sexp[1]; - var params = sexp[2]; - - var args = Args.fromSpec(params, null, EMPTY_BLOCKS); - return new Yield(to, args); - }; - - Yield.build = function build(params, to) { - var args = Args.fromPositionalArgs(PositionalArgs.build(params)); - return new this(to, args); - }; - - Yield.prototype.compile = function compile(dsl, env, symbolTable) { - var to = this.to; - - var args = this.args.compile(dsl, env, symbolTable); - if (dsl.hasBlockSymbol(to)) { - var symbol = dsl.getBlockSymbol(to); - var inner = new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledGetBlockBySymbol(symbol, to); - dsl.append(new OpenBlockOpcode(inner, args)); - dsl.append(new CloseBlockOpcode()); - } else if (dsl.hasPartialArgsSymbol()) { - var symbol = dsl.getPartialArgsSymbol(); - var inner = new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledInPartialGetBlock(symbol, to); - dsl.append(new OpenBlockOpcode(inner, args)); - dsl.append(new CloseBlockOpcode()); - } else { - throw new Error('[BUG] ${to} is not a valid block name.'); - } - }; - - return Yield; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Yield = Yield; - - function isStaticPartialName(exp) { - return exp.type === 'value'; - } - - var Partial = (function (_StatementSyntax12) { - babelHelpers.inherits(Partial, _StatementSyntax12); - - function Partial() { - _StatementSyntax12.apply(this, arguments); - } - - Partial.fromSpec = function fromSpec(sexp) { - var exp = sexp[1]; - - var name = _glimmerRuntimeLibSyntaxExpressions.default(exp); - if (isStaticPartialName(name)) { - return new _glimmerRuntimeLibSyntaxBuiltinsPartial.StaticPartialSyntax(name); - } else { - return new _glimmerRuntimeLibSyntaxBuiltinsPartial.DynamicPartialSyntax(name); - } - }; - - return Partial; - })(_glimmerRuntimeLibSyntax.Statement); - - exports.Partial = Partial; - - var OpenBlockOpcode = (function (_Opcode) { - babelHelpers.inherits(OpenBlockOpcode, _Opcode); - - function OpenBlockOpcode(inner, args) { - _Opcode.call(this); - this.inner = inner; - this.args = args; - this.type = "open-block"; - } - - OpenBlockOpcode.prototype.evaluate = function evaluate(vm) { - var block = this.inner.evaluate(vm); - var args = undefined; - if (block) { - args = this.args.evaluate(vm); - } - // FIXME: can we avoid doing this when we don't have a block? - vm.pushCallerScope(); - if (block) { - vm.invokeBlock(block, args); - } - }; - - OpenBlockOpcode.prototype.toJSON = function toJSON() { - return { - guid: this._guid, - type: this.type, - details: { - "block": this.inner.toJSON(), - "positional": this.args.positional.toJSON(), - "named": this.args.named.toJSON() - } - }; - }; - - return OpenBlockOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - var CloseBlockOpcode = (function (_Opcode2) { - babelHelpers.inherits(CloseBlockOpcode, _Opcode2); - - function CloseBlockOpcode() { - _Opcode2.apply(this, arguments); - this.type = "close-block"; - } - - CloseBlockOpcode.prototype.evaluate = function evaluate(vm) { - vm.popScope(); - }; - - return CloseBlockOpcode; - })(_glimmerRuntimeLibOpcodes.Opcode); - - exports.CloseBlockOpcode = CloseBlockOpcode; - - var Value = (function (_ExpressionSyntax) { - babelHelpers.inherits(Value, _ExpressionSyntax); - - function Value(value) { - _ExpressionSyntax.call(this); - this.value = value; - this.type = "value"; - } - - Value.fromSpec = function fromSpec(value) { - return new Value(value); - }; - - Value.build = function build(value) { - return new this(value); - }; - - Value.prototype.inner = function inner() { - return this.value; - }; - - Value.prototype.compile = function compile(compiler) { - return new _glimmerRuntimeLibCompiledExpressionsValue.default(this.value); - }; - - return Value; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.Value = Value; - - var GetArgument = (function (_ExpressionSyntax2) { - babelHelpers.inherits(GetArgument, _ExpressionSyntax2); - - function GetArgument(parts) { - _ExpressionSyntax2.call(this); - this.parts = parts; - this.type = "get-argument"; - } - - // this is separated out from Get because Unknown also has a ref, but it - // may turn out to be a helper - - GetArgument.fromSpec = function fromSpec(sexp) { - var parts = sexp[1]; - - return new GetArgument(parts); - }; - - GetArgument.build = function build(path) { - return new this(path.split('.')); - }; - - GetArgument.prototype.compile = function compile(lookup) { - var parts = this.parts; - - var head = parts[0]; - if (lookup.hasNamedSymbol(head)) { - var symbol = lookup.getNamedSymbol(head); - var path = parts.slice(1); - var inner = new _glimmerRuntimeLibCompiledExpressionsLookups.CompiledSymbol(symbol, head); - return _glimmerRuntimeLibCompiledExpressionsLookups.default.create(inner, path); - } else if (lookup.hasPartialArgsSymbol()) { - var symbol = lookup.getPartialArgsSymbol(); - var path = parts.slice(1); - var inner = new _glimmerRuntimeLibCompiledExpressionsLookups.CompiledInPartialName(symbol, head); - return _glimmerRuntimeLibCompiledExpressionsLookups.default.create(inner, path); - } else { - throw new Error('[BUG] @' + this.parts.join('.') + ' is not a valid lookup path.'); - } - }; - - return GetArgument; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.GetArgument = GetArgument; - - var Ref = (function (_ExpressionSyntax3) { - babelHelpers.inherits(Ref, _ExpressionSyntax3); - - function Ref(parts) { - _ExpressionSyntax3.call(this); - this.parts = parts; - this.type = "ref"; - } - - Ref.build = function build(path) { - var parts = path.split('.'); - if (parts[0] === 'this') { - parts[0] = null; - } - return new this(parts); - }; - - Ref.prototype.compile = function compile(lookup) { - var parts = this.parts; - - var head = parts[0]; - if (head === null) { - var inner = new _glimmerRuntimeLibCompiledExpressionsLookups.CompiledSelf(); - var path = parts.slice(1); - return _glimmerRuntimeLibCompiledExpressionsLookups.default.create(inner, path); - } else if (lookup.hasLocalSymbol(head)) { - var symbol = lookup.getLocalSymbol(head); - var path = parts.slice(1); - var inner = new _glimmerRuntimeLibCompiledExpressionsLookups.CompiledSymbol(symbol, head); - return _glimmerRuntimeLibCompiledExpressionsLookups.default.create(inner, path); - } else { - var inner = new _glimmerRuntimeLibCompiledExpressionsLookups.CompiledSelf(); - return _glimmerRuntimeLibCompiledExpressionsLookups.default.create(inner, parts); - } - }; - - return Ref; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.Ref = Ref; - - var Get = (function (_ExpressionSyntax4) { - babelHelpers.inherits(Get, _ExpressionSyntax4); - - function Get(ref) { - _ExpressionSyntax4.call(this); - this.ref = ref; - this.type = "get"; - } - - Get.fromSpec = function fromSpec(sexp) { - var parts = sexp[1]; - - return new this(new Ref(parts)); - }; - - Get.build = function build(path) { - return new this(Ref.build(path)); - }; - - Get.prototype.compile = function compile(compiler) { - return this.ref.compile(compiler); - }; - - return Get; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.Get = Get; - - var Unknown = (function (_ExpressionSyntax5) { - babelHelpers.inherits(Unknown, _ExpressionSyntax5); - - function Unknown(ref) { - _ExpressionSyntax5.call(this); - this.ref = ref; - this.type = "unknown"; - } - - Unknown.fromSpec = function fromSpec(sexp) { - var path = sexp[1]; - - return new this(new Ref(path)); - }; - - Unknown.build = function build(path) { - return new this(Ref.build(path)); - }; - - Unknown.prototype.compile = function compile(compiler, env, symbolTable) { - var ref = this.ref; - - if (env.hasHelper(ref.parts, symbolTable)) { - return new _glimmerRuntimeLibCompiledExpressionsHelper.default(ref.parts, env.lookupHelper(ref.parts, symbolTable), _glimmerRuntimeLibCompiledExpressionsArgs.CompiledArgs.empty(), symbolTable); - } else { - return this.ref.compile(compiler); - } - }; - - return Unknown; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.Unknown = Unknown; - - var Helper = (function (_ExpressionSyntax6) { - babelHelpers.inherits(Helper, _ExpressionSyntax6); - - function Helper(ref, args) { - _ExpressionSyntax6.call(this); - this.ref = ref; - this.args = args; - this.type = "helper"; - } - - Helper.fromSpec = function fromSpec(sexp) { - var path = sexp[1]; - var params = sexp[2]; - var hash = sexp[3]; - - return new Helper(new Ref(path), Args.fromSpec(params, hash, EMPTY_BLOCKS)); - }; - - Helper.build = function build(path, positional, named) { - return new this(Ref.build(path), Args.build(positional, named, EMPTY_BLOCKS)); - }; - - Helper.prototype.compile = function compile(compiler, env, symbolTable) { - if (env.hasHelper(this.ref.parts, symbolTable)) { - var args = this.args; - var ref = this.ref; - - return new _glimmerRuntimeLibCompiledExpressionsHelper.default(ref.parts, env.lookupHelper(ref.parts, symbolTable), args.compile(compiler, env, symbolTable), symbolTable); - } else { - throw new Error('Compile Error: ' + this.ref.parts.join('.') + ' is not a helper'); - } - }; - - return Helper; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.Helper = Helper; - - var HasBlock = (function (_ExpressionSyntax7) { - babelHelpers.inherits(HasBlock, _ExpressionSyntax7); - - function HasBlock(blockName) { - _ExpressionSyntax7.call(this); - this.blockName = blockName; - this.type = "has-block"; - } - - HasBlock.fromSpec = function fromSpec(sexp) { - var blockName = sexp[1]; - - return new HasBlock(blockName); - }; - - HasBlock.build = function build(blockName) { - return new this(blockName); - }; - - HasBlock.prototype.compile = function compile(compiler, env) { - var blockName = this.blockName; - - if (compiler.hasBlockSymbol(blockName)) { - var symbol = compiler.getBlockSymbol(blockName); - var inner = new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledGetBlockBySymbol(symbol, blockName); - return new _glimmerRuntimeLibCompiledExpressionsHasBlock.default(inner); - } else if (compiler.hasPartialArgsSymbol()) { - var symbol = compiler.getPartialArgsSymbol(); - var inner = new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledInPartialGetBlock(symbol, blockName); - return new _glimmerRuntimeLibCompiledExpressionsHasBlock.default(inner); - } else { - throw new Error('[BUG] ${blockName} is not a valid block name.'); - } - }; - - return HasBlock; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.HasBlock = HasBlock; - - var HasBlockParams = (function (_ExpressionSyntax8) { - babelHelpers.inherits(HasBlockParams, _ExpressionSyntax8); - - function HasBlockParams(blockName) { - _ExpressionSyntax8.call(this); - this.blockName = blockName; - this.type = "has-block-params"; - } - - HasBlockParams.fromSpec = function fromSpec(sexp) { - var blockName = sexp[1]; - - return new HasBlockParams(blockName); - }; - - HasBlockParams.build = function build(blockName) { - return new this(blockName); - }; - - HasBlockParams.prototype.compile = function compile(compiler, env) { - var blockName = this.blockName; - - if (compiler.hasBlockSymbol(blockName)) { - var symbol = compiler.getBlockSymbol(blockName); - var inner = new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledGetBlockBySymbol(symbol, blockName); - return new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledHasBlockParams(inner); - } else if (compiler.hasPartialArgsSymbol()) { - var symbol = compiler.getPartialArgsSymbol(); - var inner = new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledInPartialGetBlock(symbol, blockName); - return new _glimmerRuntimeLibCompiledExpressionsHasBlock.CompiledHasBlockParams(inner); - } else { - throw new Error('[BUG] ${blockName} is not a valid block name.'); - } - }; - - return HasBlockParams; - })(_glimmerRuntimeLibSyntax.Expression); - - exports.HasBlockParams = HasBlockParams; - - var Concat = (function () { - function Concat(parts) { - this.parts = parts; - this.type = "concat"; - } - - Concat.fromSpec = function fromSpec(sexp) { - var params = sexp[1]; - - return new Concat(params.map(_glimmerRuntimeLibSyntaxExpressions.default)); - }; - - Concat.build = function build(parts) { - return new this(parts); - }; - - Concat.prototype.compile = function compile(compiler, env, symbolTable) { - return new _glimmerRuntimeLibCompiledExpressionsConcat.default(this.parts.map(function (p) { - return p.compile(compiler, env, symbolTable); - })); - }; - - return Concat; - })(); - - exports.Concat = Concat; - - var Blocks = (function () { - function Blocks(_default) { - var inverse = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - this.type = "blocks"; - this.default = _default; - this.inverse = inverse; - } - - Blocks.fromSpec = function fromSpec(_default) { - var inverse = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - return new Blocks(_default, inverse); - }; - - Blocks.empty = function empty() { - return EMPTY_BLOCKS; - }; - - return Blocks; - })(); - - exports.Blocks = Blocks; - var EMPTY_BLOCKS = new ((function (_Blocks) { - babelHelpers.inherits(_class, _Blocks); - - function _class() { - _Blocks.call(this, null, null); - } - - return _class; - })(Blocks))(); - exports.EMPTY_BLOCKS = EMPTY_BLOCKS; - - var Args = (function () { - function Args(positional, named, blocks) { - this.positional = positional; - this.named = named; - this.blocks = blocks; - this.type = "args"; - } - - Args.empty = function empty() { - return EMPTY_ARGS; - }; - - Args.fromSpec = function fromSpec(positional, named, blocks) { - return new Args(PositionalArgs.fromSpec(positional), NamedArgs.fromSpec(named), blocks); - }; - - Args.fromPositionalArgs = function fromPositionalArgs(positional) { - var blocks = arguments.length <= 1 || arguments[1] === undefined ? EMPTY_BLOCKS : arguments[1]; - - return new Args(positional, EMPTY_NAMED_ARGS, blocks); - }; - - Args.fromNamedArgs = function fromNamedArgs(named) { - var blocks = arguments.length <= 1 || arguments[1] === undefined ? EMPTY_BLOCKS : arguments[1]; - - return new Args(EMPTY_POSITIONAL_ARGS, named, blocks); - }; - - Args.build = function build(positional, named, blocks) { - if (positional === EMPTY_POSITIONAL_ARGS && named === EMPTY_NAMED_ARGS && blocks === EMPTY_BLOCKS) { - return EMPTY_ARGS; - } else { - return new this(positional, named, blocks); - } - }; - - Args.prototype.compile = function compile(compiler, env, symbolTable) { - var positional = this.positional; - var named = this.named; - var blocks = this.blocks; - - return _glimmerRuntimeLibCompiledExpressionsArgs.CompiledArgs.create(positional.compile(compiler, env, symbolTable), named.compile(compiler, env, symbolTable), blocks); - }; - - return Args; - })(); - - exports.Args = Args; - - var PositionalArgs = (function () { - function PositionalArgs(values) { - this.values = values; - this.type = "positional"; - this.length = values.length; - } - - PositionalArgs.empty = function empty() { - return EMPTY_POSITIONAL_ARGS; - }; - - PositionalArgs.fromSpec = function fromSpec(sexp) { - if (!sexp || sexp.length === 0) return EMPTY_POSITIONAL_ARGS; - return new PositionalArgs(sexp.map(_glimmerRuntimeLibSyntaxExpressions.default)); - }; - - PositionalArgs.build = function build(exprs) { - if (exprs.length === 0) { - return EMPTY_POSITIONAL_ARGS; - } else { - return new this(exprs); - } - }; - - PositionalArgs.prototype.slice = function slice(start, end) { - return PositionalArgs.build(this.values.slice(start, end)); - }; - - PositionalArgs.prototype.at = function at(index) { - return this.values[index]; - }; - - PositionalArgs.prototype.compile = function compile(compiler, env, symbolTable) { - return _glimmerRuntimeLibCompiledExpressionsArgs.CompiledPositionalArgs.create(this.values.map(function (v) { - return v.compile(compiler, env, symbolTable); - })); - }; - - return PositionalArgs; - })(); - - exports.PositionalArgs = PositionalArgs; - - var EMPTY_POSITIONAL_ARGS = new ((function (_PositionalArgs) { - babelHelpers.inherits(_class2, _PositionalArgs); - - function _class2() { - _PositionalArgs.call(this, _glimmerRuntimeLibUtils.EMPTY_ARRAY); - } - - _class2.prototype.slice = function slice(start, end) { - return this; - }; - - _class2.prototype.at = function at(index) { - return undefined; // ??! - }; - - _class2.prototype.compile = function compile(compiler, env) { - return _glimmerRuntimeLibCompiledExpressionsArgs.CompiledPositionalArgs.empty(); - }; - - return _class2; - })(PositionalArgs))(); - - var NamedArgs = (function () { - function NamedArgs(keys, values) { - this.keys = keys; - this.values = values; - this.type = "named"; - this.length = keys.length; - } - - NamedArgs.empty = function empty() { - return EMPTY_NAMED_ARGS; - }; - - NamedArgs.fromSpec = function fromSpec(sexp) { - if (sexp === null || sexp === undefined) { - return EMPTY_NAMED_ARGS; - } - var keys = sexp[0]; - var exprs = sexp[1]; - - if (keys.length === 0) { - return EMPTY_NAMED_ARGS; - } - return new this(keys, exprs.map(function (expr) { - return _glimmerRuntimeLibSyntaxExpressions.default(expr); - })); - }; - - NamedArgs.build = function build(keys, values) { - if (keys.length === 0) { - return EMPTY_NAMED_ARGS; - } else { - return new this(keys, values); - } - }; - - NamedArgs.prototype.at = function at(key) { - var keys = this.keys; - var values = this.values; - - var index = keys.indexOf(key); - return values[index]; - }; - - NamedArgs.prototype.has = function has(key) { - return this.keys.indexOf(key) !== -1; - }; - - NamedArgs.prototype.compile = function compile(compiler, env, symbolTable) { - var keys = this.keys; - var values = this.values; - - var compiledValues = new Array(values.length); - for (var i = 0; i < compiledValues.length; i++) { - compiledValues[i] = values[i].compile(compiler, env, symbolTable); - } - return new _glimmerRuntimeLibCompiledExpressionsArgs.CompiledNamedArgs(keys, compiledValues); - }; - - return NamedArgs; - })(); - - exports.NamedArgs = NamedArgs; - - var EMPTY_NAMED_ARGS = new ((function (_NamedArgs) { - babelHelpers.inherits(_class3, _NamedArgs); - - function _class3() { - _NamedArgs.call(this, _glimmerRuntimeLibUtils.EMPTY_ARRAY, _glimmerRuntimeLibUtils.EMPTY_ARRAY); - } - - _class3.prototype.at = function at(key) { - return undefined; // ??! - }; - - _class3.prototype.has = function has(key) { - return false; - }; - - _class3.prototype.compile = function compile(compiler, env) { - return _glimmerRuntimeLibCompiledExpressionsArgs.CompiledNamedArgs.empty(); - }; - - return _class3; - })(NamedArgs))(); - var EMPTY_ARGS = new ((function (_Args) { - babelHelpers.inherits(_class4, _Args); - - function _class4() { - _Args.call(this, EMPTY_POSITIONAL_ARGS, EMPTY_NAMED_ARGS, EMPTY_BLOCKS); - } - - _class4.prototype.compile = function compile(compiler, env) { - return _glimmerRuntimeLibCompiledExpressionsArgs.CompiledArgs.empty(); - }; - - return _class4; - })(Args))(); -}); - -enifed('glimmer-runtime/lib/syntax/expressions', ['exports', 'glimmer-runtime/lib/syntax/core', 'glimmer-wire-format'], function (exports, _glimmerRuntimeLibSyntaxCore, _glimmerWireFormat) { - 'use strict'; - - var isArg = _glimmerWireFormat.Expressions.isArg; - var isConcat = _glimmerWireFormat.Expressions.isConcat; - var isGet = _glimmerWireFormat.Expressions.isGet; - var isHasBlock = _glimmerWireFormat.Expressions.isHasBlock; - var isHasBlockParams = _glimmerWireFormat.Expressions.isHasBlockParams; - var isHelper = _glimmerWireFormat.Expressions.isHelper; - var isUnknown = _glimmerWireFormat.Expressions.isUnknown; - var isPrimitiveValue = _glimmerWireFormat.Expressions.isPrimitiveValue; - var isUndefined = _glimmerWireFormat.Expressions.isUndefined; - - exports.default = function (sexp) { - if (isPrimitiveValue(sexp)) return _glimmerRuntimeLibSyntaxCore.Value.fromSpec(sexp); - if (isUndefined(sexp)) return _glimmerRuntimeLibSyntaxCore.Value.build(undefined); - if (isArg(sexp)) return _glimmerRuntimeLibSyntaxCore.GetArgument.fromSpec(sexp); - if (isConcat(sexp)) return _glimmerRuntimeLibSyntaxCore.Concat.fromSpec(sexp); - if (isGet(sexp)) return _glimmerRuntimeLibSyntaxCore.Get.fromSpec(sexp); - if (isHelper(sexp)) return _glimmerRuntimeLibSyntaxCore.Helper.fromSpec(sexp); - if (isUnknown(sexp)) return _glimmerRuntimeLibSyntaxCore.Unknown.fromSpec(sexp); - if (isHasBlock(sexp)) return _glimmerRuntimeLibSyntaxCore.HasBlock.fromSpec(sexp); - if (isHasBlockParams(sexp)) return _glimmerRuntimeLibSyntaxCore.HasBlockParams.fromSpec(sexp); - throw new Error('Unexpected wire format: ' + JSON.stringify(sexp)); - }; - - ; -}); - -enifed('glimmer-runtime/lib/syntax/statements', ['exports', 'glimmer-runtime/lib/syntax/core', 'glimmer-wire-format'], function (exports, _glimmerRuntimeLibSyntaxCore, _glimmerWireFormat) { - 'use strict'; - - var isYield = _glimmerWireFormat.Statements.isYield; - var isBlock = _glimmerWireFormat.Statements.isBlock; - var isPartial = _glimmerWireFormat.Statements.isPartial; - var isAppend = _glimmerWireFormat.Statements.isAppend; - var isDynamicAttr = _glimmerWireFormat.Statements.isDynamicAttr; - var isText = _glimmerWireFormat.Statements.isText; - var isComment = _glimmerWireFormat.Statements.isComment; - var isOpenElement = _glimmerWireFormat.Statements.isOpenElement; - var isFlushElement = _glimmerWireFormat.Statements.isFlushElement; - var isCloseElement = _glimmerWireFormat.Statements.isCloseElement; - var isStaticAttr = _glimmerWireFormat.Statements.isStaticAttr; - var isModifier = _glimmerWireFormat.Statements.isModifier; - var isDynamicArg = _glimmerWireFormat.Statements.isDynamicArg; - var isStaticArg = _glimmerWireFormat.Statements.isStaticArg; - var isTrustingAttr = _glimmerWireFormat.Statements.isTrustingAttr; - - exports.default = function (sexp, symbolTable, scanner) { - if (isYield(sexp)) return _glimmerRuntimeLibSyntaxCore.Yield.fromSpec(sexp); - if (isPartial(sexp)) return _glimmerRuntimeLibSyntaxCore.Partial.fromSpec(sexp); - if (isBlock(sexp)) return _glimmerRuntimeLibSyntaxCore.Block.fromSpec(sexp, symbolTable, scanner); - if (isAppend(sexp)) return _glimmerRuntimeLibSyntaxCore.OptimizedAppend.fromSpec(sexp); - if (isDynamicAttr(sexp)) return _glimmerRuntimeLibSyntaxCore.DynamicAttr.fromSpec(sexp); - if (isDynamicArg(sexp)) return _glimmerRuntimeLibSyntaxCore.DynamicArg.fromSpec(sexp); - if (isTrustingAttr(sexp)) return _glimmerRuntimeLibSyntaxCore.TrustingAttr.fromSpec(sexp); - if (isText(sexp)) return _glimmerRuntimeLibSyntaxCore.Text.fromSpec(sexp); - if (isComment(sexp)) return _glimmerRuntimeLibSyntaxCore.Comment.fromSpec(sexp); - if (isOpenElement(sexp)) return _glimmerRuntimeLibSyntaxCore.OpenElement.fromSpec(sexp, symbolTable); - if (isFlushElement(sexp)) return _glimmerRuntimeLibSyntaxCore.FlushElement.fromSpec(); - if (isCloseElement(sexp)) return _glimmerRuntimeLibSyntaxCore.CloseElement.fromSpec(); - if (isStaticAttr(sexp)) return _glimmerRuntimeLibSyntaxCore.StaticAttr.fromSpec(sexp); - if (isStaticArg(sexp)) return _glimmerRuntimeLibSyntaxCore.StaticArg.fromSpec(sexp); - if (isModifier(sexp)) return _glimmerRuntimeLibSyntaxCore.Modifier.fromSpec(sexp); - }; - - ; -}); - -enifed('glimmer-runtime/lib/template', ['exports', 'glimmer-util', 'glimmer-runtime/lib/builder', 'glimmer-runtime/lib/vm', 'glimmer-runtime/lib/scanner'], function (exports, _glimmerUtil, _glimmerRuntimeLibBuilder, _glimmerRuntimeLibVm, _glimmerRuntimeLibScanner) { - 'use strict'; - - exports.default = templateFactory; - - var clientId = 0; - - function templateFactory(_ref) { - var id = _ref.id; - var meta = _ref.meta; - var block = _ref.block; - - var parsedBlock = undefined; - if (!id) { - id = 'client-' + clientId++; - } - var create = function (env, envMeta) { - var newMeta = envMeta ? _glimmerUtil.assign({}, envMeta, meta) : meta; - if (!parsedBlock) { - parsedBlock = JSON.parse(block); - } - return template(parsedBlock, id, newMeta, env); - }; - return { id: id, meta: meta, create: create }; - } - - function template(block, id, meta, env) { - var scanner = new _glimmerRuntimeLibScanner.default(block, meta, env); - var entryPoint = undefined; - var asEntryPoint = function () { - if (!entryPoint) entryPoint = scanner.scanEntryPoint(); - return entryPoint; - }; - var layout = undefined; - var asLayout = function () { - if (!layout) layout = scanner.scanLayout(); - return layout; - }; - var asPartial = function (symbols) { - return scanner.scanPartial(symbols); - }; - var render = function (self, appendTo, dynamicScope) { - var elementStack = _glimmerRuntimeLibBuilder.ElementStack.forInitialRender(env, appendTo, null); - var compiled = asEntryPoint().compile(env); - var vm = _glimmerRuntimeLibVm.VM.initial(env, self, dynamicScope, elementStack, compiled.symbols); - return vm.execute(compiled.ops); - }; - return { id: id, meta: meta, _block: block, asEntryPoint: asEntryPoint, asLayout: asLayout, asPartial: asPartial, render: render }; - } -}); - -enifed('glimmer-runtime/lib/upsert', ['exports', 'glimmer-runtime/lib/bounds'], function (exports, _glimmerRuntimeLibBounds) { - 'use strict'; - - exports.isSafeString = isSafeString; - exports.isNode = isNode; - exports.isString = isString; - exports.cautiousInsert = cautiousInsert; - exports.trustingInsert = trustingInsert; - - function isSafeString(value) { - return value && typeof value['toHTML'] === 'function'; - } - - function isNode(value) { - return value !== null && typeof value === 'object' && typeof value['nodeType'] === 'number'; - } - - function isString(value) { - return typeof value === 'string'; - } - - var Upsert = function Upsert(bounds) { - this.bounds = bounds; - }; - - exports.default = Upsert; - - function cautiousInsert(dom, cursor, value) { - if (isString(value)) { - return TextUpsert.insert(dom, cursor, value); - } - if (isSafeString(value)) { - return SafeStringUpsert.insert(dom, cursor, value); - } - if (isNode(value)) { - return NodeUpsert.insert(dom, cursor, value); - } - } - - function trustingInsert(dom, cursor, value) { - if (isString(value)) { - return HTMLUpsert.insert(dom, cursor, value); - } - if (isNode(value)) { - return NodeUpsert.insert(dom, cursor, value); - } - } - - var TextUpsert = (function (_Upsert) { - babelHelpers.inherits(TextUpsert, _Upsert); - - function TextUpsert(bounds, textNode) { - _Upsert.call(this, bounds); - this.textNode = textNode; - } - - TextUpsert.insert = function insert(dom, cursor, value) { - var textNode = dom.createTextNode(value); - dom.insertBefore(cursor.element, textNode, cursor.nextSibling); - var bounds = new _glimmerRuntimeLibBounds.SingleNodeBounds(cursor.element, textNode); - return new TextUpsert(bounds, textNode); - }; - - TextUpsert.prototype.update = function update(dom, value) { - if (isString(value)) { - var textNode = this.textNode; - - textNode.nodeValue = value; - return true; - } else { - return false; - } - }; - - return TextUpsert; - })(Upsert); - - var HTMLUpsert = (function (_Upsert2) { - babelHelpers.inherits(HTMLUpsert, _Upsert2); - - function HTMLUpsert() { - _Upsert2.apply(this, arguments); - } - - HTMLUpsert.insert = function insert(dom, cursor, value) { - var bounds = dom.insertHTMLBefore(cursor.element, value, cursor.nextSibling); - return new HTMLUpsert(bounds); - }; - - HTMLUpsert.prototype.update = function update(dom, value) { - if (isString(value)) { - var bounds = this.bounds; - - var parentElement = bounds.parentElement(); - var nextSibling = _glimmerRuntimeLibBounds.clear(bounds); - this.bounds = dom.insertHTMLBefore(parentElement, nextSibling, value); - return true; - } else { - return false; - } - }; - - return HTMLUpsert; - })(Upsert); - - var SafeStringUpsert = (function (_Upsert3) { - babelHelpers.inherits(SafeStringUpsert, _Upsert3); - - function SafeStringUpsert(bounds, lastStringValue) { - _Upsert3.call(this, bounds); - this.lastStringValue = lastStringValue; - } - - SafeStringUpsert.insert = function insert(dom, cursor, value) { - var stringValue = value.toHTML(); - var bounds = dom.insertHTMLBefore(cursor.element, stringValue, cursor.nextSibling); - return new SafeStringUpsert(bounds, stringValue); - }; - - SafeStringUpsert.prototype.update = function update(dom, value) { - if (isSafeString(value)) { - var stringValue = value.toHTML(); - if (stringValue !== this.lastStringValue) { - var bounds = this.bounds; - - var parentElement = bounds.parentElement(); - var nextSibling = _glimmerRuntimeLibBounds.clear(bounds); - this.bounds = dom.insertHTMLBefore(parentElement, nextSibling, stringValue); - this.lastStringValue = stringValue; - } - return true; - } else { - return false; - } - }; - - return SafeStringUpsert; - })(Upsert); - - var NodeUpsert = (function (_Upsert4) { - babelHelpers.inherits(NodeUpsert, _Upsert4); - - function NodeUpsert() { - _Upsert4.apply(this, arguments); - } - - NodeUpsert.insert = function insert(dom, cursor, node) { - dom.insertBefore(cursor.element, node, cursor.nextSibling); - return new NodeUpsert(_glimmerRuntimeLibBounds.single(cursor.element, node)); - }; - - NodeUpsert.prototype.update = function update(dom, value) { - if (isNode(value)) { - var bounds = this.bounds; - - var parentElement = bounds.parentElement(); - var nextSibling = _glimmerRuntimeLibBounds.clear(bounds); - this.bounds = dom.insertNodeBefore(parentElement, value, nextSibling); - return true; - } else { - return false; - } - }; - - return NodeUpsert; - })(Upsert); -}); - -enifed('glimmer-runtime/lib/utils', ['exports', 'glimmer-util'], function (exports, _glimmerUtil) { - 'use strict'; - - var HAS_NATIVE_WEAKMAP = (function () { - // detect if `WeakMap` is even present - var hasWeakMap = typeof WeakMap === 'function'; - if (!hasWeakMap) { - return false; - } - var instance = new WeakMap(); - // use `Object`'s `.toString` directly to prevent us from detecting - // polyfills as native weakmaps - return Object.prototype.toString.call(instance) === '[object WeakMap]'; - })(); - var EMPTY_ARRAY = HAS_NATIVE_WEAKMAP ? Object.freeze([]) : []; - exports.EMPTY_ARRAY = EMPTY_ARRAY; - var EMPTY_DICT = HAS_NATIVE_WEAKMAP ? Object.freeze(_glimmerUtil.dict()) : _glimmerUtil.dict(); - exports.EMPTY_DICT = EMPTY_DICT; - - var ListRange = (function () { - function ListRange(list, start, end) { - this.list = list; - this.start = start; - this.end = end; - } - - ListRange.prototype.at = function at(index) { - if (index >= this.list.length) return null; - return this.list[index]; - }; - - ListRange.prototype.min = function min() { - return this.start; - }; - - ListRange.prototype.max = function max() { - return this.end; - }; - - return ListRange; - })(); - - exports.ListRange = ListRange; -}); - -enifed('glimmer-runtime/lib/vm', ['exports', 'glimmer-runtime/lib/vm/append', 'glimmer-runtime/lib/vm/update', 'glimmer-runtime/lib/vm/render-result'], function (exports, _glimmerRuntimeLibVmAppend, _glimmerRuntimeLibVmUpdate, _glimmerRuntimeLibVmRenderResult) { - 'use strict'; - - exports.VM = _glimmerRuntimeLibVmAppend.default; - exports.PublicVM = _glimmerRuntimeLibVmAppend.PublicVM; - exports.UpdatingVM = _glimmerRuntimeLibVmUpdate.default; - exports.RenderResult = _glimmerRuntimeLibVmRenderResult.default; -}); - -enifed('glimmer-runtime/lib/vm/append', ['exports', 'glimmer-runtime/lib/environment', 'glimmer-util', 'glimmer-reference', 'glimmer-runtime/lib/compiled/opcodes/vm', 'glimmer-runtime/lib/vm/update', 'glimmer-runtime/lib/vm/render-result', 'glimmer-runtime/lib/vm/frame'], function (exports, _glimmerRuntimeLibEnvironment, _glimmerUtil, _glimmerReference, _glimmerRuntimeLibCompiledOpcodesVm, _glimmerRuntimeLibVmUpdate, _glimmerRuntimeLibVmRenderResult, _glimmerRuntimeLibVmFrame) { - 'use strict'; - - var VM = (function () { - function VM(env, scope, dynamicScope, elementStack) { - this.env = env; - this.elementStack = elementStack; - this.dynamicScopeStack = new _glimmerUtil.Stack(); - this.scopeStack = new _glimmerUtil.Stack(); - this.updatingOpcodeStack = new _glimmerUtil.Stack(); - this.cacheGroups = new _glimmerUtil.Stack(); - this.listBlockStack = new _glimmerUtil.Stack(); - this.frame = new _glimmerRuntimeLibVmFrame.FrameStack(); - this.env = env; - this.elementStack = elementStack; - this.scopeStack.push(scope); - this.dynamicScopeStack.push(dynamicScope); - } - - VM.initial = function initial(env, self, dynamicScope, elementStack, size) { - var scope = _glimmerRuntimeLibEnvironment.Scope.root(self, size); - return new VM(env, scope, dynamicScope, elementStack); - }; - - VM.prototype.capture = function capture() { - return { - env: this.env, - scope: this.scope(), - dynamicScope: this.dynamicScope(), - frame: this.frame.capture() - }; - }; - - VM.prototype.goto = function goto(op) { - // assert(this.frame.getOps().contains(op), `Illegal jump to ${op.label}`); - this.frame.goto(op); - }; - - VM.prototype.beginCacheGroup = function beginCacheGroup() { - this.cacheGroups.push(this.updatingOpcodeStack.current.tail()); - }; - - VM.prototype.commitCacheGroup = function commitCacheGroup() { - // JumpIfNotModified(END) - // (head) - // (....) - // (tail) - // DidModify - // END: Noop - var END = new _glimmerRuntimeLibCompiledOpcodesVm.LabelOpcode("END"); - var opcodes = this.updatingOpcodeStack.current; - var marker = this.cacheGroups.pop(); - var head = marker ? opcodes.nextNode(marker) : opcodes.head(); - var tail = opcodes.tail(); - var tag = _glimmerReference.combineSlice(new _glimmerUtil.ListSlice(head, tail)); - var guard = new _glimmerRuntimeLibCompiledOpcodesVm.JumpIfNotModifiedOpcode(tag, END); - opcodes.insertBefore(guard, head); - opcodes.append(new _glimmerRuntimeLibCompiledOpcodesVm.DidModifyOpcode(guard)); - opcodes.append(END); - }; - - VM.prototype.enter = function enter(ops) { - var updating = new _glimmerUtil.LinkedList(); - var tracker = this.stack().pushUpdatableBlock(); - var state = this.capture(); - var tryOpcode = new _glimmerRuntimeLibVmUpdate.TryOpcode(ops, state, tracker, updating); - this.didEnter(tryOpcode, updating); - }; - - VM.prototype.enterWithKey = function enterWithKey(key, ops) { - var updating = new _glimmerUtil.LinkedList(); - var tracker = this.stack().pushUpdatableBlock(); - var state = this.capture(); - var tryOpcode = new _glimmerRuntimeLibVmUpdate.TryOpcode(ops, state, tracker, updating); - this.listBlockStack.current.map[key] = tryOpcode; - this.didEnter(tryOpcode, updating); - }; - - VM.prototype.enterList = function enterList(ops) { - var updating = new _glimmerUtil.LinkedList(); - var tracker = this.stack().pushBlockList(updating); - var state = this.capture(); - var artifacts = this.frame.getIterator().artifacts; - var opcode = new _glimmerRuntimeLibVmUpdate.ListBlockOpcode(ops, state, tracker, updating, artifacts); - this.listBlockStack.push(opcode); - this.didEnter(opcode, updating); - }; - - VM.prototype.didEnter = function didEnter(opcode, updating) { - this.updateWith(opcode); - this.updatingOpcodeStack.push(updating); - }; - - VM.prototype.exit = function exit() { - this.stack().popBlock(); - this.updatingOpcodeStack.pop(); - var parent = this.updatingOpcodeStack.current.tail(); - parent.didInitializeChildren(); - }; - - VM.prototype.exitList = function exitList() { - this.exit(); - this.listBlockStack.pop(); - }; - - VM.prototype.updateWith = function updateWith(opcode) { - this.updatingOpcodeStack.current.append(opcode); - }; - - VM.prototype.stack = function stack() { - return this.elementStack; - }; - - VM.prototype.scope = function scope() { - return this.scopeStack.current; - }; - - VM.prototype.dynamicScope = function dynamicScope() { - return this.dynamicScopeStack.current; - }; - - VM.prototype.pushFrame = function pushFrame(block, args, callerScope) { - this.frame.push(block.ops); - if (args) this.frame.setArgs(args); - if (args && args.blocks) this.frame.setBlocks(args.blocks); - if (callerScope) this.frame.setCallerScope(callerScope); - }; - - VM.prototype.pushComponentFrame = function pushComponentFrame(layout, args, callerScope, component, manager, shadow) { - this.frame.push(layout.ops, component, manager, shadow); - if (args) this.frame.setArgs(args); - if (args && args.blocks) this.frame.setBlocks(args.blocks); - if (callerScope) this.frame.setCallerScope(callerScope); - }; - - VM.prototype.pushEvalFrame = function pushEvalFrame(ops) { - this.frame.push(ops); - }; - - VM.prototype.pushChildScope = function pushChildScope() { - this.scopeStack.push(this.scopeStack.current.child()); - }; - - VM.prototype.pushCallerScope = function pushCallerScope() { - this.scopeStack.push(this.scope().getCallerScope()); - }; - - VM.prototype.pushDynamicScope = function pushDynamicScope() { - var child = this.dynamicScopeStack.current.child(); - this.dynamicScopeStack.push(child); - return child; - }; - - VM.prototype.pushRootScope = function pushRootScope(self, size) { - var scope = _glimmerRuntimeLibEnvironment.Scope.root(self, size); - this.scopeStack.push(scope); - return scope; - }; - - VM.prototype.popScope = function popScope() { - this.scopeStack.pop(); - }; - - VM.prototype.popDynamicScope = function popDynamicScope() { - this.dynamicScopeStack.pop(); - }; - - VM.prototype.newDestroyable = function newDestroyable(d) { - this.stack().newDestroyable(d); - }; - - /// SCOPE HELPERS - - VM.prototype.getSelf = function getSelf() { - return this.scope().getSelf(); - }; - - VM.prototype.referenceForSymbol = function referenceForSymbol(symbol) { - return this.scope().getSymbol(symbol); - }; - - VM.prototype.getArgs = function getArgs() { - return this.frame.getArgs(); - }; - - /// EXECUTION - - VM.prototype.resume = function resume(opcodes, frame) { - return this.execute(opcodes, function (vm) { - return vm.frame.restore(frame); - }); - }; - - VM.prototype.execute = function execute(opcodes, initialize) { - _glimmerUtil.LOGGER.debug("[VM] Begin program execution"); - var elementStack = this.elementStack; - var frame = this.frame; - var updatingOpcodeStack = this.updatingOpcodeStack; - var env = this.env; - - elementStack.pushSimpleBlock(); - updatingOpcodeStack.push(new _glimmerUtil.LinkedList()); - frame.push(opcodes); - if (initialize) initialize(this); - var opcode = undefined; - while (frame.hasOpcodes()) { - if (opcode = frame.nextStatement()) { - _glimmerUtil.LOGGER.debug('[VM] OP ' + opcode.type); - _glimmerUtil.LOGGER.trace(opcode); - opcode.evaluate(this); - } - } - _glimmerUtil.LOGGER.debug("[VM] Completed program execution"); - return new _glimmerRuntimeLibVmRenderResult.default(env, updatingOpcodeStack.pop(), elementStack.popBlock()); - }; - - VM.prototype.evaluateOpcode = function evaluateOpcode(opcode) { - opcode.evaluate(this); - }; - - // Make sure you have opcodes that push and pop a scope around this opcode - // if you need to change the scope. - - VM.prototype.invokeBlock = function invokeBlock(block, args) { - var compiled = block.compile(this.env); - this.pushFrame(compiled, args); - }; - - VM.prototype.invokePartial = function invokePartial(block) { - var compiled = block.compile(this.env); - this.pushFrame(compiled); - }; - - VM.prototype.invokeLayout = function invokeLayout(args, layout, callerScope, component, manager, shadow) { - this.pushComponentFrame(layout, args, callerScope, component, manager, shadow); - }; - - VM.prototype.evaluateOperand = function evaluateOperand(expr) { - this.frame.setOperand(expr.evaluate(this)); - }; - - VM.prototype.evaluateArgs = function evaluateArgs(args) { - var evaledArgs = this.frame.setArgs(args.evaluate(this)); - this.frame.setOperand(evaledArgs.positional.at(0)); - }; - - VM.prototype.bindPositionalArgs = function bindPositionalArgs(symbols) { - var args = this.frame.getArgs(); - _glimmerUtil.assert(args, "Cannot bind positional args"); - var positional = args.positional; - - var scope = this.scope(); - for (var i = 0; i < symbols.length; i++) { - scope.bindSymbol(symbols[i], positional.at(i)); - } - }; - - VM.prototype.bindNamedArgs = function bindNamedArgs(names, symbols) { - var args = this.frame.getArgs(); - var scope = this.scope(); - _glimmerUtil.assert(args, "Cannot bind named args"); - var named = args.named; - - for (var i = 0; i < names.length; i++) { - scope.bindSymbol(symbols[i], named.get(names[i])); - } - }; - - VM.prototype.bindBlocks = function bindBlocks(names, symbols) { - var blocks = this.frame.getBlocks(); - var scope = this.scope(); - for (var i = 0; i < names.length; i++) { - scope.bindBlock(symbols[i], blocks && blocks[names[i]] || null); - } - }; - - VM.prototype.bindPartialArgs = function bindPartialArgs(symbol) { - var args = this.frame.getArgs(); - var scope = this.scope(); - _glimmerUtil.assert(args, "Cannot bind named args"); - scope.bindPartialArgs(symbol, args); - }; - - VM.prototype.bindCallerScope = function bindCallerScope() { - var callerScope = this.frame.getCallerScope(); - var scope = this.scope(); - _glimmerUtil.assert(callerScope, "Cannot bind caller scope"); - scope.bindCallerScope(callerScope); - }; - - VM.prototype.bindDynamicScope = function bindDynamicScope(names) { - var args = this.frame.getArgs(); - var scope = this.dynamicScope(); - _glimmerUtil.assert(args, "Cannot bind dynamic scope"); - for (var i = 0; i < names.length; i++) { - scope.set(names[i], args.named.get(names[i])); - } - }; - - return VM; - })(); - - exports.default = VM; -}); - -enifed('glimmer-runtime/lib/vm/frame', ['exports'], function (exports) { - 'use strict'; - - var CapturedFrame = function CapturedFrame(operand, args, condition) { - this.operand = operand; - this.args = args; - this.condition = condition; - }; - - exports.CapturedFrame = CapturedFrame; - - var Frame = (function () { - function Frame(ops) { - var component = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - var manager = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - var shadow = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - this.component = component; - this.manager = manager; - this.shadow = shadow; - this.operand = null; - this.immediate = null; - this.args = null; - this.callerScope = null; - this.blocks = null; - this.condition = null; - this.iterator = null; - this.key = null; - this.ops = ops; - this.op = ops.head(); - } - - Frame.prototype.capture = function capture() { - return new CapturedFrame(this.operand, this.args, this.condition); - }; - - Frame.prototype.restore = function restore(frame) { - this.operand = frame['operand']; - this.args = frame['args']; - this.condition = frame['condition']; - }; - - return Frame; - })(); - - var FrameStack = (function () { - function FrameStack() { - this.frames = []; - this.frame = undefined; - } - - FrameStack.prototype.push = function push(ops) { - var component = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - var manager = arguments.length <= 2 || arguments[2] === undefined ? null : arguments[2]; - var shadow = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3]; - - var frame = this.frame === undefined ? this.frame = 0 : ++this.frame; - if (this.frames.length <= frame) { - this.frames.push(null); - } - this.frames[frame] = new Frame(ops, component, manager, shadow); - }; - - FrameStack.prototype.pop = function pop() { - var frames = this.frames; - var frame = this.frame; - - frames[frame] = null; - this.frame = frame === 0 ? undefined : frame - 1; - }; - - FrameStack.prototype.capture = function capture() { - return this.frames[this.frame].capture(); - }; - - FrameStack.prototype.restore = function restore(frame) { - this.frames[this.frame].restore(frame); - }; - - FrameStack.prototype.getOps = function getOps() { - return this.frames[this.frame].ops; - }; - - FrameStack.prototype.getCurrent = function getCurrent() { - return this.frames[this.frame].op; - }; - - FrameStack.prototype.setCurrent = function setCurrent(op) { - return this.frames[this.frame].op = op; - }; - - FrameStack.prototype.getOperand = function getOperand() { - return this.frames[this.frame].operand; - }; - - FrameStack.prototype.setOperand = function setOperand(operand) { - return this.frames[this.frame].operand = operand; - }; - - FrameStack.prototype.getImmediate = function getImmediate() { - return this.frames[this.frame].immediate; - }; - - FrameStack.prototype.setImmediate = function setImmediate(value) { - return this.frames[this.frame].immediate = value; - }; - - FrameStack.prototype.getArgs = function getArgs() { - return this.frames[this.frame].args; - }; - - FrameStack.prototype.setArgs = function setArgs(args) { - var frame = this.frames[this.frame]; - return frame.args = args; - }; - - FrameStack.prototype.getCondition = function getCondition() { - return this.frames[this.frame].condition; - }; - - FrameStack.prototype.setCondition = function setCondition(condition) { - return this.frames[this.frame].condition = condition; - }; - - FrameStack.prototype.getIterator = function getIterator() { - return this.frames[this.frame].iterator; - }; - - FrameStack.prototype.setIterator = function setIterator(iterator) { - return this.frames[this.frame].iterator = iterator; - }; - - FrameStack.prototype.getKey = function getKey() { - return this.frames[this.frame].key; - }; - - FrameStack.prototype.setKey = function setKey(key) { - return this.frames[this.frame].key = key; - }; - - FrameStack.prototype.getBlocks = function getBlocks() { - return this.frames[this.frame].blocks; - }; - - FrameStack.prototype.setBlocks = function setBlocks(blocks) { - return this.frames[this.frame].blocks = blocks; - }; - - FrameStack.prototype.getCallerScope = function getCallerScope() { - return this.frames[this.frame].callerScope; - }; - - FrameStack.prototype.setCallerScope = function setCallerScope(callerScope) { - return this.frames[this.frame].callerScope = callerScope; - }; - - FrameStack.prototype.getComponent = function getComponent() { - return this.frames[this.frame].component; - }; - - FrameStack.prototype.getManager = function getManager() { - return this.frames[this.frame].manager; - }; - - FrameStack.prototype.getShadow = function getShadow() { - return this.frames[this.frame].shadow; - }; - - FrameStack.prototype.goto = function goto(op) { - this.setCurrent(op); - }; - - FrameStack.prototype.hasOpcodes = function hasOpcodes() { - return this.frame !== undefined; - }; - - FrameStack.prototype.nextStatement = function nextStatement() { - var op = this.frames[this.frame].op; - var ops = this.getOps(); - if (op) { - this.setCurrent(ops.nextNode(op)); - return op; - } else { - this.pop(); - return null; - } - }; - - return FrameStack; - })(); - - exports.FrameStack = FrameStack; -}); - -enifed('glimmer-runtime/lib/vm/render-result', ['exports', 'glimmer-runtime/lib/bounds', 'glimmer-runtime/lib/vm/update'], function (exports, _glimmerRuntimeLibBounds, _glimmerRuntimeLibVmUpdate) { - 'use strict'; - - var RenderResult = (function () { - function RenderResult(env, updating, bounds) { - this.env = env; - this.updating = updating; - this.bounds = bounds; - } - - RenderResult.prototype.rerender = function rerender() { - var _ref = arguments.length <= 0 || arguments[0] === undefined ? { alwaysRevalidate: false } : arguments[0]; - - var _ref$alwaysRevalidate = _ref.alwaysRevalidate; - var alwaysRevalidate = _ref$alwaysRevalidate === undefined ? false : _ref$alwaysRevalidate; - var env = this.env; - var updating = this.updating; - - var vm = new _glimmerRuntimeLibVmUpdate.default(env, { alwaysRevalidate: alwaysRevalidate }); - vm.execute(updating, this); - }; - - RenderResult.prototype.parentElement = function parentElement() { - return this.bounds.parentElement(); - }; - - RenderResult.prototype.firstNode = function firstNode() { - return this.bounds.firstNode(); - }; - - RenderResult.prototype.lastNode = function lastNode() { - return this.bounds.lastNode(); - }; - - RenderResult.prototype.opcodes = function opcodes() { - return this.updating; - }; - - RenderResult.prototype.handleException = function handleException() { - throw "this should never happen"; - }; - - RenderResult.prototype.destroy = function destroy() { - this.bounds.destroy(); - _glimmerRuntimeLibBounds.clear(this.bounds); - }; - - return RenderResult; - })(); - - exports.default = RenderResult; -}); - -enifed('glimmer-runtime/lib/vm/update', ['exports', 'glimmer-runtime/lib/bounds', 'glimmer-runtime/lib/builder', 'glimmer-util', 'glimmer-reference', 'glimmer-runtime/lib/compiled/expressions/args', 'glimmer-runtime/lib/opcodes', 'glimmer-runtime/lib/vm/append'], function (exports, _glimmerRuntimeLibBounds, _glimmerRuntimeLibBuilder, _glimmerUtil, _glimmerReference, _glimmerRuntimeLibCompiledExpressionsArgs, _glimmerRuntimeLibOpcodes, _glimmerRuntimeLibVmAppend) { - 'use strict'; - - var UpdatingVM = (function () { - function UpdatingVM(env, _ref) { - var _ref$alwaysRevalidate = _ref.alwaysRevalidate; - var alwaysRevalidate = _ref$alwaysRevalidate === undefined ? false : _ref$alwaysRevalidate; - - this.frameStack = new _glimmerUtil.Stack(); - this.env = env; - this.dom = env.getDOM(); - this.alwaysRevalidate = alwaysRevalidate; - } - - UpdatingVM.prototype.execute = function execute(opcodes, handler) { - var frameStack = this.frameStack; - - this.try(opcodes, handler); - while (true) { - if (frameStack.isEmpty()) break; - var opcode = this.frameStack.current.nextStatement(); - if (opcode === null) { - this.frameStack.pop(); - continue; - } - _glimmerUtil.LOGGER.debug('[VM] OP ' + opcode.type); - _glimmerUtil.LOGGER.trace(opcode); - opcode.evaluate(this); - } - }; - - UpdatingVM.prototype.goto = function goto(op) { - this.frameStack.current.goto(op); - }; - - UpdatingVM.prototype.try = function _try(ops, handler) { - this.frameStack.push(new UpdatingVMFrame(this, ops, handler)); - }; - - UpdatingVM.prototype.throw = function _throw() { - this.frameStack.current.handleException(); - this.frameStack.pop(); - }; - - UpdatingVM.prototype.evaluateOpcode = function evaluateOpcode(opcode) { - opcode.evaluate(this); - }; - - return UpdatingVM; - })(); - - exports.default = UpdatingVM; - - var BlockOpcode = (function (_UpdatingOpcode) { - babelHelpers.inherits(BlockOpcode, _UpdatingOpcode); - - function BlockOpcode(ops, state, bounds, children) { - _UpdatingOpcode.call(this); - this.type = "block"; - this.next = null; - this.prev = null; - var env = state.env; - var scope = state.scope; - var dynamicScope = state.dynamicScope; - var frame = state.frame; - - this.ops = ops; - this.children = children; - this.env = env; - this.scope = scope; - this.dynamicScope = dynamicScope; - this.frame = frame; - this.bounds = bounds; - } - - BlockOpcode.prototype.parentElement = function parentElement() { - return this.bounds.parentElement(); - }; - - BlockOpcode.prototype.firstNode = function firstNode() { - return this.bounds.firstNode(); - }; - - BlockOpcode.prototype.lastNode = function lastNode() { - return this.bounds.lastNode(); - }; - - BlockOpcode.prototype.evaluate = function evaluate(vm) { - vm.try(this.children, null); - }; - - BlockOpcode.prototype.destroy = function destroy() { - this.bounds.destroy(); - }; - - BlockOpcode.prototype.didDestroy = function didDestroy() { - this.env.didDestroy(this.bounds); - }; - - BlockOpcode.prototype.toJSON = function toJSON() { - var begin = this.ops.head(); - var end = this.ops.tail(); - var details = _glimmerUtil.dict(); - details["guid"] = '' + this._guid; - details["begin"] = begin.inspect(); - details["end"] = end.inspect(); - return { - guid: this._guid, - type: this.type, - details: details, - children: this.children.toArray().map(function (op) { - return op.toJSON(); - }) - }; - }; - - return BlockOpcode; - })(_glimmerRuntimeLibOpcodes.UpdatingOpcode); - - exports.BlockOpcode = BlockOpcode; - - var TryOpcode = (function (_BlockOpcode) { - babelHelpers.inherits(TryOpcode, _BlockOpcode); - - function TryOpcode(ops, state, bounds, children) { - _BlockOpcode.call(this, ops, state, bounds, children); - this.type = "try"; - this.tag = this._tag = new _glimmerReference.UpdatableTag(_glimmerReference.CONSTANT_TAG); - } - - TryOpcode.prototype.didInitializeChildren = function didInitializeChildren() { - this._tag.update(_glimmerReference.combineSlice(this.children)); - }; - - TryOpcode.prototype.evaluate = function evaluate(vm) { - vm.try(this.children, this); - }; - - TryOpcode.prototype.handleException = function handleException() { - var env = this.env; - var scope = this.scope; - var ops = this.ops; - var dynamicScope = this.dynamicScope; - var frame = this.frame; - - var elementStack = _glimmerRuntimeLibBuilder.ElementStack.resume(this.env, this.bounds, this.bounds.reset(env)); - var vm = new _glimmerRuntimeLibVmAppend.default(env, scope, dynamicScope, elementStack); - var result = vm.resume(ops, frame); - this.children = result.opcodes(); - this.didInitializeChildren(); - }; - - TryOpcode.prototype.toJSON = function toJSON() { - var json = _BlockOpcode.prototype.toJSON.call(this); - var begin = this.ops.head(); - var end = this.ops.tail(); - json["details"]["begin"] = JSON.stringify(begin.inspect()); - json["details"]["end"] = JSON.stringify(end.inspect()); - return _BlockOpcode.prototype.toJSON.call(this); - }; - - return TryOpcode; - })(BlockOpcode); - - exports.TryOpcode = TryOpcode; - - var ListRevalidationDelegate = (function () { - function ListRevalidationDelegate(opcode, marker) { - this.opcode = opcode; - this.marker = marker; - this.didInsert = false; - this.didDelete = false; - this.map = opcode.map; - this.updating = opcode['children']; - } - - ListRevalidationDelegate.prototype.insert = function insert(key, item, memo, before) { - var map = this.map; - var opcode = this.opcode; - var updating = this.updating; - - var nextSibling = null; - var reference = null; - if (before) { - reference = map[before]; - nextSibling = reference.bounds.firstNode(); - } else { - nextSibling = this.marker; - } - var vm = opcode.vmForInsertion(nextSibling); - var tryOpcode = undefined; - vm.execute(opcode.ops, function (vm) { - vm.frame.setArgs(_glimmerRuntimeLibCompiledExpressionsArgs.EvaluatedArgs.positional([item, memo])); - vm.frame.setOperand(item); - vm.frame.setCondition(new _glimmerReference.ConstReference(true)); - vm.frame.setKey(key); - var state = vm.capture(); - var tracker = vm.stack().pushUpdatableBlock(); - tryOpcode = new TryOpcode(opcode.ops, state, tracker, vm.updatingOpcodeStack.current); - }); - tryOpcode.didInitializeChildren(); - updating.insertBefore(tryOpcode, reference); - map[key] = tryOpcode; - this.didInsert = true; - }; - - ListRevalidationDelegate.prototype.retain = function retain(key, item, memo) {}; - - ListRevalidationDelegate.prototype.move = function move(key, item, memo, before) { - var map = this.map; - var updating = this.updating; - - var entry = map[key]; - var reference = map[before] || null; - if (before) { - _glimmerRuntimeLibBounds.move(entry, reference.firstNode()); - } else { - _glimmerRuntimeLibBounds.move(entry, this.marker); - } - updating.remove(entry); - updating.insertBefore(entry, reference); - }; - - ListRevalidationDelegate.prototype.delete = function _delete(key) { - var map = this.map; - - var opcode = map[key]; - opcode.didDestroy(); - _glimmerRuntimeLibBounds.clear(opcode); - this.updating.remove(opcode); - delete map[key]; - this.didDelete = true; - }; - - ListRevalidationDelegate.prototype.done = function done() { - this.opcode.didInitializeChildren(this.didInsert || this.didDelete); - }; - - return ListRevalidationDelegate; - })(); - - var ListBlockOpcode = (function (_BlockOpcode2) { - babelHelpers.inherits(ListBlockOpcode, _BlockOpcode2); - - function ListBlockOpcode(ops, state, bounds, children, artifacts) { - _BlockOpcode2.call(this, ops, state, bounds, children); - this.type = "list-block"; - this.map = _glimmerUtil.dict(); - this.lastIterated = _glimmerReference.INITIAL; - this.artifacts = artifacts; - var _tag = this._tag = new _glimmerReference.UpdatableTag(_glimmerReference.CONSTANT_TAG); - this.tag = _glimmerReference.combine([artifacts.tag, _tag]); - } - - ListBlockOpcode.prototype.didInitializeChildren = function didInitializeChildren() { - var listDidChange = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; - - this.lastIterated = this.artifacts.tag.value(); - if (listDidChange) { - this._tag.update(_glimmerReference.combineSlice(this.children)); - } - }; - - ListBlockOpcode.prototype.evaluate = function evaluate(vm) { - var artifacts = this.artifacts; - var lastIterated = this.lastIterated; - - if (!artifacts.tag.validate(lastIterated)) { - var bounds = this.bounds; - var dom = vm.dom; - - var marker = dom.createComment(''); - dom.insertAfter(bounds.parentElement(), marker, bounds.lastNode()); - var target = new ListRevalidationDelegate(this, marker); - var synchronizer = new _glimmerReference.IteratorSynchronizer({ target: target, artifacts: artifacts }); - synchronizer.sync(); - this.parentElement().removeChild(marker); - } - // Run now-updated updating opcodes - _BlockOpcode2.prototype.evaluate.call(this, vm); - }; - - ListBlockOpcode.prototype.vmForInsertion = function vmForInsertion(nextSibling) { - var env = this.env; - var scope = this.scope; - var dynamicScope = this.dynamicScope; - - var elementStack = _glimmerRuntimeLibBuilder.ElementStack.forInitialRender(this.env, this.bounds.parentElement(), nextSibling); - return new _glimmerRuntimeLibVmAppend.default(env, scope, dynamicScope, elementStack); - }; - - ListBlockOpcode.prototype.toJSON = function toJSON() { - var json = _BlockOpcode2.prototype.toJSON.call(this); - var map = this.map; - var inner = Object.keys(map).map(function (key) { - return JSON.stringify(key) + ': ' + map[key]._guid; - }).join(", "); - json["details"]["map"] = '{' + inner + '}'; - return json; - }; - - return ListBlockOpcode; - })(BlockOpcode); - - exports.ListBlockOpcode = ListBlockOpcode; - - var UpdatingVMFrame = (function () { - function UpdatingVMFrame(vm, ops, handler) { - this.vm = vm; - this.ops = ops; - this.current = ops.head(); - this.exceptionHandler = handler; - } - - UpdatingVMFrame.prototype.goto = function goto(op) { - this.current = op; - }; - - UpdatingVMFrame.prototype.nextStatement = function nextStatement() { - var current = this.current; - var ops = this.ops; - - if (current) this.current = ops.nextNode(current); - return current; - }; - - UpdatingVMFrame.prototype.handleException = function handleException() { - this.exceptionHandler.handleException(); - }; - - return UpdatingVMFrame; - })(); -}); - -enifed('glimmer-util/index', ['exports', 'glimmer-util/lib/namespaces', 'glimmer-util/lib/platform-utils', 'glimmer-util/lib/assert', 'glimmer-util/lib/logger', 'glimmer-util/lib/object-utils', 'glimmer-util/lib/guid', 'glimmer-util/lib/collections', 'glimmer-util/lib/list-utils'], function (exports, _glimmerUtilLibNamespaces, _glimmerUtilLibPlatformUtils, _glimmerUtilLibAssert, _glimmerUtilLibLogger, _glimmerUtilLibObjectUtils, _glimmerUtilLibGuid, _glimmerUtilLibCollections, _glimmerUtilLibListUtils) { - 'use strict'; - - exports.getAttrNamespace = _glimmerUtilLibNamespaces.getAttrNamespace; - exports.Option = _glimmerUtilLibPlatformUtils.Option; - exports.Maybe = _glimmerUtilLibPlatformUtils.Maybe; - exports.Opaque = _glimmerUtilLibPlatformUtils.Opaque; - exports.assert = _glimmerUtilLibAssert.default; - exports.LOGGER = _glimmerUtilLibLogger.default; - exports.Logger = _glimmerUtilLibLogger.Logger; - exports.LogLevel = _glimmerUtilLibLogger.LogLevel; - exports.assign = _glimmerUtilLibObjectUtils.assign; - exports.ensureGuid = _glimmerUtilLibGuid.ensureGuid; - exports.initializeGuid = _glimmerUtilLibGuid.initializeGuid; - exports.HasGuid = _glimmerUtilLibGuid.HasGuid; - exports.Stack = _glimmerUtilLibCollections.Stack; - exports.Dict = _glimmerUtilLibCollections.Dict; - exports.Set = _glimmerUtilLibCollections.Set; - exports.DictSet = _glimmerUtilLibCollections.DictSet; - exports.dict = _glimmerUtilLibCollections.dict; - exports.EMPTY_SLICE = _glimmerUtilLibListUtils.EMPTY_SLICE; - exports.LinkedList = _glimmerUtilLibListUtils.LinkedList; - exports.LinkedListNode = _glimmerUtilLibListUtils.LinkedListNode; - exports.ListNode = _glimmerUtilLibListUtils.ListNode; - exports.CloneableListNode = _glimmerUtilLibListUtils.CloneableListNode; - exports.ListSlice = _glimmerUtilLibListUtils.ListSlice; - exports.Slice = _glimmerUtilLibListUtils.Slice; -}); - -enifed("glimmer-util/lib/assert", ["exports"], function (exports) { - // import Logger from './logger'; - // let alreadyWarned = false; - "use strict"; - - exports.debugAssert = debugAssert; - exports.prodAssert = prodAssert; - - function debugAssert(test, msg) { - // if (!alreadyWarned) { - // alreadyWarned = true; - // Logger.warn("Don't leave debug assertions on in public builds"); - // } - if (!test) { - throw new Error(msg || "assertion failure"); - } - } - - function prodAssert() {} - - exports.default = debugAssert; -}); - -enifed('glimmer-util/lib/collections', ['exports', 'glimmer-util/lib/guid'], function (exports, _glimmerUtilLibGuid) { - 'use strict'; - - exports.dict = dict; - - var proto = Object.create(null, { - // without this, we will always still end up with (new - // EmptyObject()).constructor === Object - constructor: { - value: undefined, - enumerable: false, - writable: true - } - }); - function EmptyObject() {} - EmptyObject.prototype = proto; - - function dict() { - // let d = Object.create(null); - // d.x = 1; - // delete d.x; - // return d; - return new EmptyObject(); - } - - var DictSet = (function () { - function DictSet() { - this.dict = dict(); - } - - DictSet.prototype.add = function add(obj) { - if (typeof obj === 'string') this.dict[obj] = obj;else this.dict[_glimmerUtilLibGuid.ensureGuid(obj)] = obj; - return this; - }; - - DictSet.prototype.delete = function _delete(obj) { - if (typeof obj === 'string') delete this.dict[obj];else if (obj._guid) delete this.dict[obj._guid]; - }; - - DictSet.prototype.forEach = function forEach(callback) { - var dict = this.dict; - - Object.keys(dict).forEach(function (key) { - return callback(dict[key]); - }); - }; - - DictSet.prototype.toArray = function toArray() { - return Object.keys(this.dict); - }; - - return DictSet; - })(); - - exports.DictSet = DictSet; - - var Stack = (function () { - function Stack() { - this.stack = []; - this.current = null; - } - - Stack.prototype.push = function push(item) { - this.current = item; - this.stack.push(item); - }; - - Stack.prototype.pop = function pop() { - var item = this.stack.pop(); - var len = this.stack.length; - this.current = len === 0 ? null : this.stack[len - 1]; - return item; - }; - - Stack.prototype.isEmpty = function isEmpty() { - return this.stack.length === 0; - }; - - return Stack; - })(); - - exports.Stack = Stack; -}); - -enifed("glimmer-util/lib/guid", ["exports"], function (exports) { - "use strict"; - - exports.initializeGuid = initializeGuid; - exports.ensureGuid = ensureGuid; - var GUID = 0; - - function initializeGuid(object) { - return object._guid = ++GUID; - } - - function ensureGuid(object) { - return object._guid || initializeGuid(object); - } -}); - -enifed("glimmer-util/lib/list-utils", ["exports"], function (exports) { - "use strict"; - - var ListNode = function ListNode(value) { - this.next = null; - this.prev = null; - this.value = value; - }; - - exports.ListNode = ListNode; - - var LinkedList = (function () { - function LinkedList() { - this.clear(); - } - - LinkedList.fromSlice = function fromSlice(slice) { - var list = new LinkedList(); - slice.forEachNode(function (n) { - return list.append(n.clone()); - }); - return list; - }; - - LinkedList.prototype.head = function head() { - return this._head; - }; - - LinkedList.prototype.tail = function tail() { - return this._tail; - }; - - LinkedList.prototype.clear = function clear() { - this._head = this._tail = null; - }; - - LinkedList.prototype.isEmpty = function isEmpty() { - return this._head === null; - }; - - LinkedList.prototype.toArray = function toArray() { - var out = []; - this.forEachNode(function (n) { - return out.push(n); - }); - return out; - }; - - LinkedList.prototype.splice = function splice(start, end, reference) { - var before = undefined; - if (reference === null) { - before = this._tail; - this._tail = end; - } else { - before = reference.prev; - end.next = reference; - reference.prev = end; - } - if (before) { - before.next = start; - start.prev = before; - } - }; - - LinkedList.prototype.spliceList = function spliceList(list, reference) { - if (list.isEmpty()) return; - this.splice(list.head(), list.tail(), reference); - }; - - LinkedList.prototype.nextNode = function nextNode(node) { - return node.next; - }; - - LinkedList.prototype.prevNode = function prevNode(node) { - return node.prev; - }; - - LinkedList.prototype.forEachNode = function forEachNode(callback) { - var node = this._head; - while (node !== null) { - callback(node); - node = node.next; - } - }; - - LinkedList.prototype.contains = function contains(needle) { - var node = this._head; - while (node !== null) { - if (node === needle) return true; - node = node.next; - } - return false; - }; - - LinkedList.prototype.insertBefore = function insertBefore(node) { - var reference = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; - - if (reference === null) return this.append(node); - if (reference.prev) reference.prev.next = node;else this._head = node; - node.prev = reference.prev; - node.next = reference; - reference.prev = node; - return node; - }; - - LinkedList.prototype.append = function append(node) { - var tail = this._tail; - if (tail) { - tail.next = node; - node.prev = tail; - node.next = null; - } else { - this._head = node; - } - return this._tail = node; - }; - - LinkedList.prototype.pop = function pop() { - if (this._tail) return this.remove(this._tail); - return null; - }; - - LinkedList.prototype.prepend = function prepend(node) { - if (this._head) return this.insertBefore(node, this._head); - return this._head = this._tail = node; - }; - - LinkedList.prototype.remove = function remove(node) { - if (node.prev) node.prev.next = node.next;else this._head = node.next; - if (node.next) node.next.prev = node.prev;else this._tail = node.prev; - return node; - }; - - return LinkedList; - })(); - - exports.LinkedList = LinkedList; - - var LinkedListRemover = (function () { - function LinkedListRemover(node) { - this.node = node; - } - - LinkedListRemover.prototype.destroy = function destroy() { - var _node = this.node; - var prev = _node.prev; - var next = _node.next; - - prev.next = next; - next.prev = prev; - }; - - return LinkedListRemover; - })(); - - var ListSlice = (function () { - function ListSlice(head, tail) { - this._head = head; - this._tail = tail; - } - - ListSlice.toList = function toList(slice) { - var list = new LinkedList(); - slice.forEachNode(function (n) { - return list.append(n.clone()); - }); - return list; - }; - - ListSlice.prototype.forEachNode = function forEachNode(callback) { - var node = this._head; - while (node !== null) { - callback(node); - node = this.nextNode(node); - } - }; - - ListSlice.prototype.contains = function contains(needle) { - var node = this._head; - while (node !== null) { - if (node === needle) return true; - node = node.next; - } - return false; - }; - - ListSlice.prototype.head = function head() { - return this._head; - }; - - ListSlice.prototype.tail = function tail() { - return this._tail; - }; - - ListSlice.prototype.toArray = function toArray() { - var out = []; - this.forEachNode(function (n) { - return out.push(n); - }); - return out; - }; - - ListSlice.prototype.nextNode = function nextNode(node) { - if (node === this._tail) return null; - return node.next; - }; - - ListSlice.prototype.prevNode = function prevNode(node) { - if (node === this._head) return null; - return node.prev; - }; - - ListSlice.prototype.isEmpty = function isEmpty() { - return false; - }; - - return ListSlice; - })(); - - exports.ListSlice = ListSlice; - var EMPTY_SLICE = new ListSlice(null, null); - exports.EMPTY_SLICE = EMPTY_SLICE; -}); - -enifed("glimmer-util/lib/logger", ["exports"], function (exports) { - "use strict"; - - var LogLevel; - exports.LogLevel = LogLevel; - (function (LogLevel) { - LogLevel[LogLevel["Trace"] = 0] = "Trace"; - LogLevel[LogLevel["Debug"] = 1] = "Debug"; - LogLevel[LogLevel["Warn"] = 2] = "Warn"; - LogLevel[LogLevel["Error"] = 3] = "Error"; - })(LogLevel || (exports.LogLevel = LogLevel = {})); - - var NullConsole = (function () { - function NullConsole() {} - - NullConsole.prototype.log = function log(message) {}; - - NullConsole.prototype.warn = function warn(message) {}; - - NullConsole.prototype.error = function error(message) {}; - - NullConsole.prototype.trace = function trace() {}; - - return NullConsole; - })(); - - var Logger = (function () { - function Logger(_ref) { - var console = _ref.console; - var level = _ref.level; - - this.f = ALWAYS; - this.force = ALWAYS; - this.console = console; - this.level = level; - } - - Logger.prototype.skipped = function skipped(level) { - return level < this.level; - }; - - Logger.prototype.trace = function trace(message) { - var _ref2 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var _ref2$stackTrace = _ref2.stackTrace; - var stackTrace = _ref2$stackTrace === undefined ? false : _ref2$stackTrace; - - if (this.skipped(LogLevel.Trace)) return; - this.console.log(message); - if (stackTrace) this.console.trace(); - }; - - Logger.prototype.debug = function debug(message) { - var _ref3 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var _ref3$stackTrace = _ref3.stackTrace; - var stackTrace = _ref3$stackTrace === undefined ? false : _ref3$stackTrace; - - if (this.skipped(LogLevel.Debug)) return; - this.console.log(message); - if (stackTrace) this.console.trace(); - }; - - Logger.prototype.warn = function warn(message) { - var _ref4 = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - - var _ref4$stackTrace = _ref4.stackTrace; - var stackTrace = _ref4$stackTrace === undefined ? false : _ref4$stackTrace; - - if (this.skipped(LogLevel.Warn)) return; - this.console.warn(message); - if (stackTrace) this.console.trace(); - }; - - Logger.prototype.error = function error(message) { - if (this.skipped(LogLevel.Error)) return; - this.console.error(message); - }; - - return Logger; - })(); - - exports.Logger = Logger; - - var _console = typeof console === 'undefined' ? new NullConsole() : console; - var ALWAYS = new Logger({ console: _console, level: LogLevel.Trace }); - var LOG_LEVEL = LogLevel.Warn; - exports.default = new Logger({ console: _console, level: LOG_LEVEL }); -}); - -enifed('glimmer-util/lib/namespaces', ['exports'], function (exports) { - // There is a small whitelist of namespaced attributes specially - // enumerated in - // https://www.w3.org/TR/html/syntax.html#attributes-0 - // - // > When a foreign element has one of the namespaced attributes given by - // > the local name and namespace of the first and second cells of a row - // > from the following table, it must be written using the name given by - // > the third cell from the same row. - // - // In all other cases, colons are interpreted as a regular character - // with no special meaning: - // - // > No other namespaced attribute can be expressed in the HTML syntax. - 'use strict'; - - exports.getAttrNamespace = getAttrNamespace; - var XLINK = 'http://www.w3.org/1999/xlink'; - var XML = 'http://www.w3.org/XML/1998/namespace'; - var XMLNS = 'http://www.w3.org/2000/xmlns/'; - var WHITELIST = { - 'xlink:actuate': XLINK, - 'xlink:arcrole': XLINK, - 'xlink:href': XLINK, - 'xlink:role': XLINK, - 'xlink:show': XLINK, - 'xlink:title': XLINK, - 'xlink:type': XLINK, - 'xml:base': XML, - 'xml:lang': XML, - 'xml:space': XML, - 'xmlns': XMLNS, - 'xmlns:xlink': XMLNS - }; - - function getAttrNamespace(attrName) { - return WHITELIST[attrName] || null; - } -}); - -enifed('glimmer-util/lib/object-utils', ['exports'], function (exports) { - 'use strict'; - - exports.assign = assign; - var objKeys = Object.keys; - - function assign(obj) { - for (var i = 1; i < arguments.length; i++) { - var assignment = arguments[i]; - if (assignment === null || typeof assignment !== 'object') continue; - var keys = objKeys(assignment); - for (var j = 0; j < keys.length; j++) { - var key = keys[j]; - obj[key] = assignment[key]; - } - } - return obj; - } -}); - -enifed("glimmer-util/lib/platform-utils", ["exports"], function (exports) { - "use strict"; - - exports.unwrap = unwrap; - - function unwrap(val) { - if (val === null || val === undefined) throw new Error("Expected value to be present"); - return val; - } -}); - -enifed("glimmer-util/lib/quoting", ["exports"], function (exports) { - "use strict"; - - exports.hash = hash; - exports.repeat = repeat; - function escapeString(str) { - str = str.replace(/\\/g, "\\\\"); - str = str.replace(/"/g, '\\"'); - str = str.replace(/\n/g, "\\n"); - return str; - } - exports.escapeString = escapeString; - - function string(str) { - return '"' + escapeString(str) + '"'; - } - exports.string = string; - - function array(a) { - return "[" + a + "]"; - } - exports.array = array; - - function hash(pairs) { - return "{" + pairs.join(", ") + "}"; - } - - function repeat(chars, times) { - var str = ""; - while (times--) { - str += chars; - } - return str; - } -}); - -enifed('glimmer-wire-format/index', ['exports'], function (exports) { - 'use strict'; - - function is(variant) { - return function (value) { - return value[0] === variant; - }; - } - var Expressions; - exports.Expressions = Expressions; - (function (Expressions) { - Expressions.isUnknown = is('unknown'); - Expressions.isArg = is('arg'); - Expressions.isGet = is('get'); - Expressions.isConcat = is('concat'); - Expressions.isHelper = is('helper'); - Expressions.isHasBlock = is('has-block'); - Expressions.isHasBlockParams = is('has-block-params'); - Expressions.isUndefined = is('undefined'); - function isPrimitiveValue(value) { - if (value === null) { - return true; - } - return typeof value !== 'object'; - } - Expressions.isPrimitiveValue = isPrimitiveValue; - })(Expressions || (exports.Expressions = Expressions = {})); - var Statements; - exports.Statements = Statements; - (function (Statements) { - Statements.isText = is('text'); - Statements.isAppend = is('append'); - Statements.isComment = is('comment'); - Statements.isModifier = is('modifier'); - Statements.isBlock = is('block'); - Statements.isOpenElement = is('open-element'); - Statements.isFlushElement = is('flush-element'); - Statements.isCloseElement = is('close-element'); - Statements.isStaticAttr = is('static-attr'); - Statements.isDynamicAttr = is('dynamic-attr'); - Statements.isYield = is('yield'); - Statements.isPartial = is('partial'); - Statements.isDynamicArg = is('dynamic-arg'); - Statements.isStaticArg = is('static-arg'); - Statements.isTrustingAttr = is('trusting-attr'); - })(Statements || (exports.Statements = Statements = {})); -}); - -enifed('glimmer/index', ['exports', 'glimmer-compiler'], function (exports, _glimmerCompiler) { - /* - * @overview Glimmer - * @copyright Copyright 2011-2015 Tilde Inc. and contributors - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/tildeio/glimmer/master/LICENSE - * @version VERSION_STRING_PLACEHOLDER - */ - 'use strict'; - - exports.precompile = _glimmerCompiler.precompile; -}); - enifed('route-recognizer', ['exports'], function (exports) { 'use strict'; var createObject = Object.create; function createMap() { var map = createObject(null);