ember-introjs
Version:
An Ember Component for intro.js
1,421 lines (1,161 loc) • 1.8 MB
JavaScript
(function() {
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2018 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 3.0.0
*/
/*globals process */
var enifed, requireModule, Ember;
// Used in ember-environment/lib/global.js
mainContext = this; // eslint-disable-line no-undef
(function() {
function missingModule(name, referrerName) {
if (referrerName) {
throw new Error('Could not find module ' + name + ' required by: ' + referrerName);
} else {
throw new Error('Could not find module ' + name);
}
}
function internalRequire(_name, referrerName) {
var name = _name;
var mod = registry[name];
if (!mod) {
name = name + '/index';
mod = registry[name];
}
var exports = seen[name];
if (exports !== undefined) {
return exports;
}
exports = seen[name] = {};
if (!mod) {
missingModule(_name, referrerName);
}
var deps = mod.deps;
var callback = mod.callback;
var reified = new Array(deps.length);
for (var i = 0; i < deps.length; i++) {
if (deps[i] === 'exports') {
reified[i] = exports;
} else if (deps[i] === 'require') {
reified[i] = requireModule;
} else {
reified[i] = internalRequire(deps[i], name);
}
}
callback.apply(this, reified);
return exports;
}
var isNode = typeof window === 'undefined' &&
typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
if (!isNode) {
Ember = this.Ember = this.Ember || {};
}
if (typeof Ember === 'undefined') { Ember = {}; }
if (typeof Ember.__loader === 'undefined') {
var registry = {};
var seen = {};
enifed = function(name, deps, callback) {
var value = { };
if (!callback) {
value.deps = [];
value.callback = deps;
} else {
value.deps = deps;
value.callback = callback;
}
registry[name] = value;
};
requireModule = function(name) {
return internalRequire(name, null);
};
// setup `require` module
requireModule['default'] = requireModule;
requireModule.has = function registryHas(moduleName) {
return !!registry[moduleName] || !!registry[moduleName + '/index'];
};
requireModule._eak_seen = registry;
Ember.__loader = {
define: enifed,
require: requireModule,
registry: registry
};
} else {
enifed = Ember.__loader.define;
requireModule = Ember.__loader.require;
}
})();
enifed("@glimmer/node", ["exports", "@glimmer/runtime"], function (exports, _runtime) {
"use strict";
exports.NodeDOMTreeConstruction = undefined;
function _defaults(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}return obj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass);
}
var NodeDOMTreeConstruction = function (_DOMTreeConstruction) {
_inherits(NodeDOMTreeConstruction, _DOMTreeConstruction);
function NodeDOMTreeConstruction(doc) {
_classCallCheck(this, NodeDOMTreeConstruction);
return _possibleConstructorReturn(this, _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, reference, html) {
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 _runtime.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;
}(_runtime.DOMTreeConstruction);
exports.NodeDOMTreeConstruction = NodeDOMTreeConstruction;
});
enifed("@glimmer/reference", ["exports", "@glimmer/util"], function (exports, _util) {
"use strict";
exports.isModified = exports.ReferenceCache = exports.map = exports.CachedReference = exports.UpdatableTag = exports.CachedTag = exports.combine = exports.combineSlice = exports.combineTagged = exports.DirtyableTag = exports.CURRENT_TAG = exports.VOLATILE_TAG = exports.CONSTANT_TAG = exports.TagWrapper = exports.RevisionTag = exports.VOLATILE = exports.INITIAL = exports.CONSTANT = exports.IteratorSynchronizer = exports.ReferenceIterator = exports.IterationArtifacts = exports.referenceFromParts = exports.ListItem = exports.isConst = exports.ConstReference = undefined;
function _defaults(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}return obj;
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass);
}
function _classCallCheck$1(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var CONSTANT = 0;
var INITIAL = 1;
var VOLATILE = NaN;
var RevisionTag = function () {
function RevisionTag() {
_classCallCheck$1(this, RevisionTag);
}
RevisionTag.prototype.validate = function validate(snapshot) {
return this.value() === snapshot;
};
return RevisionTag;
}();
RevisionTag.id = 0;
var VALUE = [];
var VALIDATE = [];
var TagWrapper = function () {
function TagWrapper(type, inner) {
_classCallCheck$1(this, TagWrapper);
this.type = type;
this.inner = inner;
}
TagWrapper.prototype.value = function value() {
var func = VALUE[this.type];
return func(this.inner);
};
TagWrapper.prototype.validate = function validate(snapshot) {
var func = VALIDATE[this.type];
return func(this.inner, snapshot);
};
return TagWrapper;
}();
function register(Type) {
var type = VALUE.length;
VALUE.push(function (tag) {
return tag.value();
});
VALIDATE.push(function (tag, snapshot) {
return tag.validate(snapshot);
});
Type.id = type;
}
///
// CONSTANT: 0
VALUE.push(function () {
return CONSTANT;
});
VALIDATE.push(function (_tag, snapshot) {
return snapshot === CONSTANT;
});
var CONSTANT_TAG = new TagWrapper(0, null);
// VOLATILE: 1
VALUE.push(function () {
return VOLATILE;
});
VALIDATE.push(function (_tag, snapshot) {
return snapshot === VOLATILE;
});
var VOLATILE_TAG = new TagWrapper(1, null);
// CURRENT: 2
VALUE.push(function () {
return $REVISION;
});
VALIDATE.push(function (_tag, snapshot) {
return snapshot === $REVISION;
});
var CURRENT_TAG = new TagWrapper(2, null);
///
var $REVISION = INITIAL;
var DirtyableTag = function (_RevisionTag) {
_inherits(DirtyableTag, _RevisionTag);
DirtyableTag.create = function create() {
var revision = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $REVISION;
return new TagWrapper(this.id, new DirtyableTag(revision));
};
function DirtyableTag() {
var revision = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $REVISION;
_classCallCheck$1(this, DirtyableTag);
var _this = _possibleConstructorReturn(this, _RevisionTag.call(this));
_this.revision = revision;
return _this;
}
DirtyableTag.prototype.value = function value() {
return this.revision;
};
DirtyableTag.prototype.dirty = function dirty() {
this.revision = ++$REVISION;
};
return DirtyableTag;
}(RevisionTag);
register(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 TagsPair.create(tags[0], tags[1]);
default:
return TagsCombinator.create(tags);
}
}
var CachedTag = function (_RevisionTag2) {
_inherits(CachedTag, _RevisionTag2);
function CachedTag() {
_classCallCheck$1(this, CachedTag);
var _this2 = _possibleConstructorReturn(this, _RevisionTag2.apply(this, arguments));
_this2.lastChecked = null;
_this2.lastValue = null;
return _this2;
}
CachedTag.prototype.value = function value() {
var lastChecked = this.lastChecked,
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) {
_inherits(TagsPair, _CachedTag);
TagsPair.create = function create(first, second) {
return new TagWrapper(this.id, new TagsPair(first, second));
};
function TagsPair(first, second) {
_classCallCheck$1(this, TagsPair);
var _this3 = _possibleConstructorReturn(this, _CachedTag.call(this));
_this3.first = first;
_this3.second = second;
return _this3;
}
TagsPair.prototype.compute = function compute() {
return Math.max(this.first.value(), this.second.value());
};
return TagsPair;
}(CachedTag);
register(TagsPair);
var TagsCombinator = function (_CachedTag2) {
_inherits(TagsCombinator, _CachedTag2);
TagsCombinator.create = function create(tags) {
return new TagWrapper(this.id, new TagsCombinator(tags));
};
function TagsCombinator(tags) {
_classCallCheck$1(this, TagsCombinator);
var _this4 = _possibleConstructorReturn(this, _CachedTag2.call(this));
_this4.tags = tags;
return _this4;
}
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);
register(TagsCombinator);
var UpdatableTag = function (_CachedTag3) {
_inherits(UpdatableTag, _CachedTag3);
UpdatableTag.create = function create(tag) {
return new TagWrapper(this.id, new UpdatableTag(tag));
};
function UpdatableTag(tag) {
_classCallCheck$1(this, UpdatableTag);
var _this5 = _possibleConstructorReturn(this, _CachedTag3.call(this));
_this5.tag = tag;
_this5.lastUpdated = INITIAL;
return _this5;
}
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);
register(UpdatableTag);
var CachedReference = function () {
function CachedReference() {
_classCallCheck$1(this, CachedReference);
this.lastRevision = null;
this.lastValue = null;
}
CachedReference.prototype.value = function value() {
var tag = this.tag,
lastRevision = this.lastRevision,
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) {
_inherits(MapperReference, _CachedReference);
function MapperReference(reference, mapper) {
_classCallCheck$1(this, MapperReference);
var _this6 = _possibleConstructorReturn(this, _CachedReference.call(this));
_this6.tag = reference.tag;
_this6.reference = reference;
_this6.mapper = mapper;
return _this6;
}
MapperReference.prototype.compute = function compute() {
var reference = this.reference,
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) {
_classCallCheck$1(this, ReferenceCache);
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,
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;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var ConstReference = function () {
function ConstReference(inner) {
_classCallCheck(this, ConstReference);
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;
}
function _defaults$1(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}return obj;
}
function _classCallCheck$2(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$1(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits$1(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults$1(subClass, superClass);
}
var ListItem = function (_ListNode) {
_inherits$1(ListItem, _ListNode);
function ListItem(iterable, result) {
_classCallCheck$2(this, ListItem);
var _this = _possibleConstructorReturn$1(this, _ListNode.call(this, iterable.valueReferenceFor(result)));
_this.retained = false;
_this.seen = false;
_this.key = result.key;
_this.iterable = iterable;
_this.memo = iterable.memoReferenceFor(result);
return _this;
}
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;
}(_util.ListNode);
var IterationArtifacts = function () {
function IterationArtifacts(iterable) {
_classCallCheck$2(this, IterationArtifacts);
this.map = (0, _util.dict)();
this.list = new _util.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,
list = this.list,
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,
list = this.list,
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) {
_classCallCheck$2(this, ReferenceIterator);
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,
artifacts = _ref.artifacts;
_classCallCheck$2(this, IteratorSynchronizer);
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,
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,
current = this.current,
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,
current = this.current;
current = 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,
artifacts = this.artifacts,
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,
target = this.target,
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,
target = this.target,
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.TagWrapper = TagWrapper;
exports.CONSTANT_TAG = CONSTANT_TAG;
exports.VOLATILE_TAG = VOLATILE_TAG;
exports.CURRENT_TAG = CURRENT_TAG;
exports.DirtyableTag = DirtyableTag;
exports.combineTagged = combineTagged;
exports.combineSlice = combineSlice;
exports.combine = combine;
exports.CachedTag = CachedTag;
exports.UpdatableTag = UpdatableTag;
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, _util, _reference2, _wireFormat) {
'use strict';
exports.ConcreteBounds = exports.ElementStack = exports.insertHTMLBefore = exports.isWhitespace = exports.DOMTreeConstruction = exports.IDOMChanges = exports.DOMChanges = exports.isComponentDefinition = exports.ComponentDefinition = exports.PartialDefinition = exports.Environment = exports.Scope = exports.isSafeString = exports.RenderResult = exports.UpdatingVM = exports.compileExpression = exports.compileList = exports.InlineMacros = exports.BlockMacros = exports.getDynamicVar = exports.resetDebuggerCallback = exports.setDebuggerCallback = exports.normalizeTextValue = exports.debugSlice = exports.Register = exports.readDOMAttr = exports.defaultPropertyManagers = exports.defaultAttributeManagers = exports.defaultManagers = exports.INPUT_VALUE_PROPERTY_MANAGER = exports.PropertyManager = exports.AttributeManager = exports.IAttributeManager = exports.CompiledDynamicTemplate = exports.CompiledStaticTemplate = exports.compileLayout = exports.OpcodeBuilderDSL = exports.ConditionalReference = exports.PrimitiveReference = exports.UNDEFINED_REFERENCE = exports.NULL_REFERENCE = exports.templateFactory = exports.Simple = undefined;
function _defaults(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}return obj;
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
/**
* Registers
*
* For the most part, these follows MIPS naming conventions, however the
* register numbers are different.
*/
var Register;
(function (Register) {
// $0 or $pc (program counter): pointer into `program` for the next insturction; -1 means exit
Register[Register["pc"] = 0] = "pc";
// $1 or $ra (return address): pointer into `program` for the return
Register[Register["ra"] = 1] = "ra";
// $2 or $fp (frame pointer): pointer into the `evalStack` for the base of the stack
Register[Register["fp"] = 2] = "fp";
// $3 or $sp (stack pointer): pointer into the `evalStack` for the top of the stack
Register[Register["sp"] = 3] = "sp";
// $4-$5 or $s0-$s1 (saved): callee saved general-purpose registers
Register[Register["s0"] = 4] = "s0";
Register[Register["s1"] = 5] = "s1";
// $6-$7 or $t0-$t1 (temporaries): caller saved general-purpose registers
Register[Register["t0"] = 6] = "t0";
Register[Register["t1"] = 7] = "t1";
})(Register || (exports.Register = Register = {}));
function debugSlice(env, start, end) {}
var AppendOpcodes = function () {
function AppendOpcodes() {
_classCallCheck(this, AppendOpcodes);
this.evaluateOpcode = (0, _util.fillNulls)(72 /* Size */).slice();
}
AppendOpcodes.prototype.add = function add(name, evaluate) {
this.evaluateOpcode[name] = evaluate;
};
AppendOpcodes.prototype.evaluate = function evaluate(vm, opcode, type) {
var func = this.evaluateOpcode[type];
func(vm, opcode);
};
return AppendOpcodes;
}();
var APPEND_OPCODES = new AppendOpcodes();
var AbstractOpcode = function () {
function AbstractOpcode() {
_classCallCheck(this, AbstractOpcode);
(0, _util.initializeGuid)(this);
}
AbstractOpcode.prototype.toJSON = function toJSON() {
return { guid: this._guid, type: this.type };
};
return AbstractOpcode;
}();
var UpdatingOpcode = function (_AbstractOpcode) {
_inherits(UpdatingOpcode, _AbstractOpcode);
function UpdatingOpcode() {
_classCallCheck(this, UpdatingOpcode);
var _this = _possibleConstructorReturn(this, _AbstractOpcode.apply(this, arguments));
_this.next = null;
_this.prev = null;
return _this;
}
return UpdatingOpcode;
}(AbstractOpcode);
function _defaults$1(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}return obj;
}
function _classCallCheck$1(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$1(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits$1(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults$1(subClass, superClass);
}
var PrimitiveReference = function (_ConstReference) {
_inherits$1(PrimitiveReference, _ConstReference);
function PrimitiveReference(value) {
_classCallCheck$1(this, PrimitiveReference);
return _possibleConstructorReturn$1(this, _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;
}(_reference2.ConstReference);
var StringReference = function (_PrimitiveReference) {
_inherits$1(StringReference, _PrimitiveReference);
function StringReference() {
_classCallCheck$1(this, StringReference);
var _this2 = _possibleConstructorReturn$1(this, _PrimitiveReference.apply(this, arguments));
_this2.lengthReference = null;
return _this2;
}
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) {
_inherits$1(ValueReference, _PrimitiveReference2);
function ValueReference(value) {
_classCallCheck$1(this, ValueReference);
return _possibleConstructorReturn$1(this, _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) {
_classCallCheck$1(this, ConditionalReference);
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;
}();
function _defaults$2(obj, defaults) {
var keys = Object.getOwnPropertyNames(defaults);for (var i = 0; i < keys.length; i++) {
var key = keys[i];var value = Object.getOwnPropertyDescriptor(defaults, key);if (value && value.configurable && obj[key] === undefined) {
Object.defineProperty(obj, key, value);
}
}return obj;
}
function _classCallCheck$2(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _possibleConstructorReturn$2(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && (typeof call === "object" || typeof call === "function") ? call : self;
}
function _inherits$2(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults$2(subClass, superClass);
}
var ConcatReference = function (_CachedReference) {
_inherits$2(ConcatReference, _CachedReference);
function ConcatReference(parts) {
_classCallCheck$2(this, ConcatReference);
var _this = _possibleConstructorReturn$2(this, _CachedReference.call(this));
_this.parts = parts;
_this.tag = (0, _reference2.combineTagged)(parts);
return _this;
}
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;
}(_reference2.CachedReference);
function castToString(value) {
if (typeof value.toString !== 'function') {
return '';
}
return String(value);
}
APPEND_OPCODES.add(1 /* Helper */, function (vm, _ref) {
var _helper = _ref.op1;
var stack = vm.stack;
var helper = vm.constants.getFunction(_helper);
var args = stack.pop();
var value = helper(vm, args);
args.clear();
vm.stack.push(value);
});
APPEND_OPCODES.add(2 /* Function */, function (vm, _ref2) {
var _function = _ref2.op1;
var func = vm.constants.getFunction(_function);
vm.stack.push(func(vm));
});
APPEND_OPCODES.add(5 /* GetVariable */, function (vm, _ref3) {
var symbol = _ref3.op1;
var expr = vm.referenceForSymbol(symbol);
vm.stack.push(expr);
});
APPEND_OPCODES.add(4 /* SetVariable */, function (vm, _ref4) {
var symbol = _ref4.op1;
var expr = vm.stack.pop();
vm.scope().bindSymbol(symbol, expr);
});
APPEND_OPCODES.add(70 /* ResolveMaybeLocal */, function (vm, _ref5) {
var _name = _ref5.op1;
var name = vm.constants.getString(_name);
var locals = vm.scope().getPartialMap();
var ref = locals[name];
if (ref === undefined) {
ref = vm.getSelf().get(name);
}
vm.stack.push(ref);
});
APPEND_OPCODES.add(19 /* RootScope */, function (vm, _ref6) {
var symbols = _ref6.op1,
bindCallerScope = _ref6.op2;
vm.pushRootScope(symbols, !!bindCallerScope);
});
APPEND_OPCODES.add(6 /* GetProperty */, function (vm, _ref7) {
var _key = _ref7.op1;
var key = vm.constants.getString(_key);
var expr = vm.stack.pop();
vm.stack.push(expr.get(key));
});
APPEND_OPCODES.add(7 /* PushBlock */, function (vm, _ref8) {
var _block = _ref8.op1;
var block = _block ? vm.constants.getBlock(_block) : null;
vm.stack.push(block);
});
APPEND_OPCODES.add(8 /* GetBlock */, function (vm, _ref9) {
var _block = _ref9.op1;
vm.stack.push(vm.scope().getBlock(_block));
});
APPEND_OPCODES.add(9 /* HasBlock */, function (vm, _ref10) {
var _block = _ref10.op1;
var hasBlock = !!vm.scope().getBlock(_block);
vm.stack.push(hasBlock ? TRUE_REFERENCE : FALSE_REFERENCE);
});
APPEND_OPCODES.add(10 /* HasBlockParams */, function (vm, _ref11) {
var _block = _ref11.op1;
var block = vm.scope().getBlock(_block);
var hasBlockParams = block && block.symbolTable.parameters.length;
vm.stack.push(hasBlockParams ? TRUE_REFERENCE : FALSE_REFERENCE);
});
APPEND_OPCODES.add(11 /* Concat */, function (vm, _ref12) {
var count = _ref12.op1;
var out = [];
for (var i = count; i > 0; i--) {
out.push(vm.stack.pop());
}
vm.stack.push(new ConcatReference(out.reverse()));
});
var _createClass = function () {
function defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);
}
}return function (Constructor, protoProps, staticProps) {
if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;
};
}();
function _classCallCheck$4(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var Arguments = function () {
function Arguments() {
_classCallCheck$4(this, Arguments);
this.stack = null;
this.positional = new PositionalArguments();
this.named = new NamedArguments();
}
Arguments.prototype.empty = function empty() {
this.setup(null, true);
return this;
};
Arguments.prototype.setup = function setup(stack, synthetic) {
this.stack = stack;
var names = stack.fromTop(0);
var namedCount = names.length;
var positionalCount = stack.fromTop(namedCount + 1);
var start = positionalCount + namedCount + 2;
var positional = this.positional;
positional.setup(stack, start, positionalCount);
var named = this.named;
named.setup(stack, namedCount, names, synthetic);
};
Arguments.prototype.at = function at(pos) {
return this.positional.at(pos);
};
Arguments.prototype.get = function get(name) {
return this.named.get(name);
};
Arguments.prototype.capture = function capture() {
return {
tag: this.tag,
length: this.length,
positional: this.positional.capture(),
named: this.named.capture()
};
};
Arguments.prototype.clear = function clear() {
var stack = this.stack,
length = this.length;
stack.pop(length + 2);
};
_createClass(Arguments, [{
key: 'tag',
get: function () {
return (0, _reference2.combineTagged)([this.positional, this.named]);
}
}, {
key: 'length',
get: function () {
return this.positional.length + this.named.length;
}
}]);
return Arguments;
}();
var PositionalArguments = function () {
function PositionalArguments() {
_classCallCheck$4(this, PositionalArguments);
this.length = 0;
this.stack = null;
this.start = 0;
this._tag = null;
this._references = null;
}
PositionalArguments.prototype.setup = function setup(stack, start, length) {
this.stack = stack;
this.start = start;
this.length = length;
this._tag = null;
this._references = null;
};