UNPKG

ember-introjs

Version:
1 lines 752 kB
{"version":3,"sources":["license.js","loader.js","@glimmer/compiler.js","@glimmer/reference.js","@glimmer/syntax.js","@glimmer/util.js","@glimmer/wire-format.js","backburner.js","container.js","ember-babel.js","ember-console.js","ember-debug/deprecate.js","ember-debug/error.js","ember-debug/features.js","ember-debug/handlers.js","ember-debug/index.js","ember-debug/testing.js","ember-debug/warn.js","ember-environment.js","ember-metal.js","ember-template-compiler/compat.js","ember-template-compiler/index.js","ember-template-compiler/plugins/assert-input-helper-without-block.js","ember-template-compiler/plugins/assert-reserved-named-arguments.js","ember-template-compiler/plugins/deprecate-render-model.js","ember-template-compiler/plugins/deprecate-render.js","ember-template-compiler/plugins/extract-pragma-tag.js","ember-template-compiler/plugins/index.js","ember-template-compiler/plugins/transform-action-syntax.js","ember-template-compiler/plugins/transform-angle-bracket-components.js","ember-template-compiler/plugins/transform-attrs-into-args.js","ember-template-compiler/plugins/transform-dot-component-invocation.js","ember-template-compiler/plugins/transform-each-in-into-each.js","ember-template-compiler/plugins/transform-has-block-syntax.js","ember-template-compiler/plugins/transform-inline-link-to.js","ember-template-compiler/plugins/transform-input-type-syntax.js","ember-template-compiler/plugins/transform-old-binding-syntax.js","ember-template-compiler/plugins/transform-old-class-binding-syntax.js","ember-template-compiler/plugins/transform-quoted-bindings-into-just-bindings.js","ember-template-compiler/plugins/transform-top-level-components.js","ember-template-compiler/system/bootstrap.js","ember-template-compiler/system/calculate-location-display.js","ember-template-compiler/system/compile-options.js","ember-template-compiler/system/compile.js","ember-template-compiler/system/precompile.js","ember-utils.js","ember/features.js","ember/version.js","handlebars.js","node-module.js","simple-html-tokenizer.js","bootstrap"],"sourcesContent":["/*!\n * @overview Ember - JavaScript Application Framework\n * @copyright Copyright 2011-2018 Tilde Inc. and contributors\n * Portions Copyright 2006-2011 Strobe Inc.\n * Portions Copyright 2008-2011 Apple Inc. All rights reserved.\n * @license Licensed under MIT license\n * See https://raw.github.com/emberjs/ember.js/master/LICENSE\n * @version 3.0.0\n */\n","/*globals process */\nvar enifed, requireModule, Ember;\n\n// Used in ember-environment/lib/global.js\nmainContext = this; // eslint-disable-line no-undef\n\n(function() {\n function missingModule(name, referrerName) {\n if (referrerName) {\n throw new Error('Could not find module ' + name + ' required by: ' + referrerName);\n } else {\n throw new Error('Could not find module ' + name);\n }\n }\n\n function internalRequire(_name, referrerName) {\n var name = _name;\n var mod = registry[name];\n\n if (!mod) {\n name = name + '/index';\n mod = registry[name];\n }\n\n var exports = seen[name];\n\n if (exports !== undefined) {\n return exports;\n }\n\n exports = seen[name] = {};\n\n if (!mod) {\n missingModule(_name, referrerName);\n }\n\n var deps = mod.deps;\n var callback = mod.callback;\n var reified = new Array(deps.length);\n\n for (var i = 0; i < deps.length; i++) {\n if (deps[i] === 'exports') {\n reified[i] = exports;\n } else if (deps[i] === 'require') {\n reified[i] = requireModule;\n } else {\n reified[i] = internalRequire(deps[i], name);\n }\n }\n\n callback.apply(this, reified);\n\n return exports;\n }\n\n var isNode = typeof window === 'undefined' &&\n typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n\n if (!isNode) {\n Ember = this.Ember = this.Ember || {};\n }\n\n if (typeof Ember === 'undefined') { Ember = {}; }\n\n if (typeof Ember.__loader === 'undefined') {\n var registry = {};\n var seen = {};\n\n enifed = function(name, deps, callback) {\n var value = { };\n\n if (!callback) {\n value.deps = [];\n value.callback = deps;\n } else {\n value.deps = deps;\n value.callback = callback;\n }\n\n registry[name] = value;\n };\n\n requireModule = function(name) {\n return internalRequire(name, null);\n };\n\n // setup `require` module\n requireModule['default'] = requireModule;\n\n requireModule.has = function registryHas(moduleName) {\n return !!registry[moduleName] || !!registry[moduleName + '/index'];\n };\n\n requireModule._eak_seen = registry;\n\n Ember.__loader = {\n define: enifed,\n require: requireModule,\n registry: registry\n };\n } else {\n enifed = Ember.__loader.define;\n requireModule = Ember.__loader.require;\n }\n})();\n","enifed('@glimmer/compiler', ['exports', 'node-module', '@glimmer/syntax', '@glimmer/util', '@glimmer/wire-format'], function (exports, _nodeModule, _syntax, _util, _wireFormat) {\n 'use strict';\n\n exports.TemplateVisitor = exports.precompile = undefined;\n\n var _createClass$1 = function () {\n function defineProperties(target, props) {\n var i, descriptor;\n\n for (i = 0; i < props.length; i++) {\n descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n }();\n\n function _defaults(obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults),\n i,\n key,\n value;for (i = 0; i < keys.length; i++) {\n key = keys[i];\n value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }return obj;\n }\n\n function _possibleConstructorReturn(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n }\n\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }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);\n }\n\n function _classCallCheck$1(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var SymbolTable = function () {\n function SymbolTable() {\n _classCallCheck$1(this, SymbolTable);\n }\n\n SymbolTable.top = function () {\n return new ProgramSymbolTable();\n };\n\n SymbolTable.prototype.child = function (locals) {\n var _this = this;\n\n var symbols = locals.map(function (name) {\n return _this.allocate(name);\n });\n return new BlockSymbolTable(this, locals, symbols);\n };\n\n return SymbolTable;\n }();\n var ProgramSymbolTable = function (_SymbolTable) {\n _inherits(ProgramSymbolTable, _SymbolTable);\n\n function ProgramSymbolTable() {\n _classCallCheck$1(this, ProgramSymbolTable);\n\n var _this2 = _possibleConstructorReturn(this, _SymbolTable.apply(this, arguments));\n\n _this2.symbols = [];\n _this2.size = 1;\n _this2.named = (0, _util.dict)();\n _this2.blocks = (0, _util.dict)();\n return _this2;\n }\n\n ProgramSymbolTable.prototype.has = function () {\n return false;\n };\n\n ProgramSymbolTable.prototype.get = function () {\n throw (0, _util.unreachable)();\n };\n\n ProgramSymbolTable.prototype.getLocalsMap = function () {\n return {};\n };\n\n ProgramSymbolTable.prototype.getEvalInfo = function () {\n return [];\n };\n\n ProgramSymbolTable.prototype.allocateNamed = function (name) {\n var named = this.named[name];\n if (!named) {\n named = this.named[name] = this.allocate('@' + name);\n }\n return named;\n };\n\n ProgramSymbolTable.prototype.allocateBlock = function (name) {\n var block = this.blocks[name];\n if (!block) {\n block = this.blocks[name] = this.allocate('&' + name);\n }\n return block;\n };\n\n ProgramSymbolTable.prototype.allocate = function (identifier) {\n this.symbols.push(identifier);\n return this.size++;\n };\n\n return ProgramSymbolTable;\n }(SymbolTable);\n var BlockSymbolTable = function (_SymbolTable2) {\n _inherits(BlockSymbolTable, _SymbolTable2);\n\n function BlockSymbolTable(parent, symbols, slots) {\n _classCallCheck$1(this, BlockSymbolTable);\n\n var _this3 = _possibleConstructorReturn(this, _SymbolTable2.call(this));\n\n _this3.parent = parent;\n _this3.symbols = symbols;\n _this3.slots = slots;\n return _this3;\n }\n\n BlockSymbolTable.prototype.has = function (name) {\n return this.symbols.indexOf(name) !== -1 || this.parent.has(name);\n };\n\n BlockSymbolTable.prototype.get = function (name) {\n var slot = this.symbols.indexOf(name);\n return slot === -1 ? this.parent.get(name) : this.slots[slot];\n };\n\n BlockSymbolTable.prototype.getLocalsMap = function () {\n var _this4 = this;\n\n var dict$$1 = this.parent.getLocalsMap();\n this.symbols.forEach(function (symbol) {\n return dict$$1[symbol] = _this4.get(symbol);\n });\n return dict$$1;\n };\n\n BlockSymbolTable.prototype.getEvalInfo = function () {\n var locals = this.getLocalsMap();\n return Object.keys(locals).map(function (symbol) {\n return locals[symbol];\n });\n };\n\n BlockSymbolTable.prototype.allocateNamed = function (name) {\n return this.parent.allocateNamed(name);\n };\n\n BlockSymbolTable.prototype.allocateBlock = function (name) {\n return this.parent.allocateBlock(name);\n };\n\n BlockSymbolTable.prototype.allocate = function (identifier) {\n return this.parent.allocate(identifier);\n };\n\n return BlockSymbolTable;\n }(SymbolTable);\n /**\n * Takes in an AST and outputs a list of actions to be consumed\n * by a compiler. For example, the template\n *\n * foo{{bar}}<div>baz</div>\n *\n * produces the actions\n *\n * [['startProgram', [programNode, 0]],\n * ['text', [textNode, 0, 3]],\n * ['mustache', [mustacheNode, 1, 3]],\n * ['openElement', [elementNode, 2, 3, 0]],\n * ['text', [textNode, 0, 1]],\n * ['closeElement', [elementNode, 2, 3],\n * ['endProgram', [programNode]]]\n *\n * This visitor walks the AST depth first and backwards. As\n * a result the bottom-most child template will appear at the\n * top of the actions list whereas the root template will appear\n * at the bottom of the list. For example,\n *\n * <div>{{#if}}foo{{else}}bar<b></b>{{/if}}</div>\n *\n * produces the actions\n *\n * [['startProgram', [programNode, 0]],\n * ['text', [textNode, 0, 2, 0]],\n * ['openElement', [elementNode, 1, 2, 0]],\n * ['closeElement', [elementNode, 1, 2]],\n * ['endProgram', [programNode]],\n * ['startProgram', [programNode, 0]],\n * ['text', [textNode, 0, 1]],\n * ['endProgram', [programNode]],\n * ['startProgram', [programNode, 2]],\n * ['openElement', [elementNode, 0, 1, 1]],\n * ['block', [blockNode, 0, 1]],\n * ['closeElement', [elementNode, 0, 1]],\n * ['endProgram', [programNode]]]\n *\n * The state of the traversal is maintained by a stack of frames.\n * Whenever a node with children is entered (either a ProgramNode\n * or an ElementNode) a frame is pushed onto the stack. The frame\n * contains information about the state of the traversal of that\n * node. For example,\n *\n * - index of the current child node being visited\n * - the number of mustaches contained within its child nodes\n * - the list of actions generated by its child nodes\n */\n\n var Frame = function Frame() {\n _classCallCheck$1(this, Frame);\n\n this.parentNode = null;\n this.children = null;\n this.childIndex = null;\n this.childCount = null;\n this.childTemplateCount = 0;\n this.mustacheCount = 0;\n this.actions = [];\n this.blankChildTextNodes = null;\n this.symbols = null;\n };\n\n var TemplateVisitor = function () {\n function TemplateVisitor() {\n _classCallCheck$1(this, TemplateVisitor);\n\n this.frameStack = [];\n this.actions = [];\n this.programDepth = -1;\n }\n\n TemplateVisitor.prototype.visit = function (node) {\n this[node.type](node);\n };\n // Traversal methods\n\n\n TemplateVisitor.prototype.Program = function (program) {\n var _actions, i;\n\n this.programDepth++;\n var parentFrame = this.getCurrentFrame();\n var programFrame = this.pushFrame();\n if (!parentFrame) {\n program['symbols'] = SymbolTable.top();\n } else {\n program['symbols'] = parentFrame.symbols.child(program.blockParams);\n }\n var startType = void 0,\n endType = void 0;\n if (this.programDepth === 0) {\n startType = 'startProgram';\n endType = 'endProgram';\n } else {\n startType = 'startBlock';\n endType = 'endBlock';\n }\n programFrame.parentNode = program;\n programFrame.children = program.body;\n programFrame.childCount = program.body.length;\n programFrame.blankChildTextNodes = [];\n programFrame.actions.push([endType, [program, this.programDepth]]);\n programFrame.symbols = program['symbols'];\n for (i = program.body.length - 1; i >= 0; i--) {\n programFrame.childIndex = i;\n this.visit(program.body[i]);\n }\n programFrame.actions.push([startType, [program, programFrame.childTemplateCount, programFrame.blankChildTextNodes.reverse()]]);\n this.popFrame();\n this.programDepth--;\n // Push the completed template into the global actions list\n if (parentFrame) {\n parentFrame.childTemplateCount++;\n }\n (_actions = this.actions).push.apply(_actions, programFrame.actions.reverse());\n };\n\n TemplateVisitor.prototype.ElementNode = function (element) {\n var _parentFrame$actions, i, _i;\n\n var parentFrame = this.currentFrame;\n var elementFrame = this.pushFrame();\n elementFrame.parentNode = element;\n elementFrame.children = element.children;\n elementFrame.childCount = element.children.length;\n elementFrame.mustacheCount += element.modifiers.length;\n elementFrame.blankChildTextNodes = [];\n elementFrame.symbols = element['symbols'] = parentFrame.symbols.child(element.blockParams);\n var actionArgs = [element, parentFrame.childIndex, parentFrame.childCount];\n elementFrame.actions.push(['closeElement', actionArgs]);\n for (i = element.attributes.length - 1; i >= 0; i--) {\n this.visit(element.attributes[i]);\n }\n for (_i = element.children.length - 1; _i >= 0; _i--) {\n elementFrame.childIndex = _i;\n this.visit(element.children[_i]);\n }\n var open = ['openElement', [].concat(actionArgs, [elementFrame.mustacheCount, elementFrame.blankChildTextNodes.reverse()])];\n elementFrame.actions.push(open);\n this.popFrame();\n // Propagate the element's frame state to the parent frame\n if (elementFrame.mustacheCount > 0) {\n parentFrame.mustacheCount++;\n }\n parentFrame.childTemplateCount += elementFrame.childTemplateCount;\n (_parentFrame$actions = parentFrame.actions).push.apply(_parentFrame$actions, elementFrame.actions);\n };\n\n TemplateVisitor.prototype.AttrNode = function (attr) {\n if (attr.value.type !== 'TextNode') {\n this.currentFrame.mustacheCount++;\n }\n };\n\n TemplateVisitor.prototype.TextNode = function (text) {\n var frame = this.currentFrame;\n if (text.chars === '') {\n frame.blankChildTextNodes.push(domIndexOf(frame.children, text));\n }\n frame.actions.push(['text', [text, frame.childIndex, frame.childCount]]);\n };\n\n TemplateVisitor.prototype.BlockStatement = function (node) {\n var frame = this.currentFrame;\n frame.mustacheCount++;\n frame.actions.push(['block', [node, frame.childIndex, frame.childCount]]);\n if (node.inverse) {\n this.visit(node.inverse);\n }\n if (node.program) {\n this.visit(node.program);\n }\n };\n\n TemplateVisitor.prototype.PartialStatement = function (node) {\n var frame = this.currentFrame;\n frame.mustacheCount++;\n frame.actions.push(['mustache', [node, frame.childIndex, frame.childCount]]);\n };\n\n TemplateVisitor.prototype.CommentStatement = function (text) {\n var frame = this.currentFrame;\n frame.actions.push(['comment', [text, frame.childIndex, frame.childCount]]);\n };\n\n TemplateVisitor.prototype.MustacheCommentStatement = function () {\n // Intentional empty: Handlebars comments should not affect output.\n };\n\n TemplateVisitor.prototype.MustacheStatement = function (mustache) {\n var frame = this.currentFrame;\n frame.mustacheCount++;\n frame.actions.push(['mustache', [mustache, frame.childIndex, frame.childCount]]);\n };\n\n // Frame helpers\n\n\n TemplateVisitor.prototype.getCurrentFrame = function () {\n return this.frameStack[this.frameStack.length - 1];\n };\n\n TemplateVisitor.prototype.pushFrame = function () {\n var frame = new Frame();\n this.frameStack.push(frame);\n return frame;\n };\n\n TemplateVisitor.prototype.popFrame = function () {\n return this.frameStack.pop();\n };\n\n _createClass$1(TemplateVisitor, [{\n key: 'currentFrame',\n get: function () {\n return this.getCurrentFrame();\n }\n }]);\n\n return TemplateVisitor;\n }();\n function domIndexOf(nodes, domNode) {\n var index = -1,\n i,\n node;\n for (i = 0; i < nodes.length; i++) {\n node = nodes[i];\n\n if (node.type !== 'TextNode' && node.type !== 'ElementNode') {\n continue;\n } else {\n index++;\n }\n if (node === domNode) {\n return index;\n }\n }\n return -1;\n }\n\n var _createClass$2 = function () {\n function defineProperties(target, props) {\n var i, descriptor;\n\n for (i = 0; i < props.length; i++) {\n descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n }();\n\n function _defaults$1(obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults),\n i,\n key,\n value;for (i = 0; i < keys.length; i++) {\n key = keys[i];\n value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }return obj;\n }\n\n function _possibleConstructorReturn$1(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n }\n\n function _inherits$1(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }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);\n }\n\n function _classCallCheck$2(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var Block = function () {\n function Block() {\n _classCallCheck$2(this, Block);\n\n this.statements = [];\n }\n\n Block.prototype.push = function (statement) {\n this.statements.push(statement);\n };\n\n return Block;\n }();\n var InlineBlock = function (_Block) {\n _inherits$1(InlineBlock, _Block);\n\n function InlineBlock(table) {\n _classCallCheck$2(this, InlineBlock);\n\n var _this = _possibleConstructorReturn$1(this, _Block.call(this));\n\n _this.table = table;\n return _this;\n }\n\n InlineBlock.prototype.toJSON = function () {\n return {\n statements: this.statements,\n parameters: this.table.slots\n };\n };\n\n return InlineBlock;\n }(Block);\n var TemplateBlock = function (_Block2) {\n _inherits$1(TemplateBlock, _Block2);\n\n function TemplateBlock(symbolTable) {\n _classCallCheck$2(this, TemplateBlock);\n\n var _this2 = _possibleConstructorReturn$1(this, _Block2.call(this));\n\n _this2.symbolTable = symbolTable;\n _this2.type = \"template\";\n _this2.yields = new _util.DictSet();\n _this2.named = new _util.DictSet();\n _this2.blocks = [];\n _this2.hasEval = false;\n return _this2;\n }\n\n TemplateBlock.prototype.push = function (statement) {\n this.statements.push(statement);\n };\n\n TemplateBlock.prototype.toJSON = function () {\n return {\n symbols: this.symbolTable.symbols,\n statements: this.statements,\n hasEval: this.hasEval\n };\n };\n\n return TemplateBlock;\n }(Block);\n var ComponentBlock = function (_Block3) {\n _inherits$1(ComponentBlock, _Block3);\n\n function ComponentBlock(table) {\n _classCallCheck$2(this, ComponentBlock);\n\n var _this3 = _possibleConstructorReturn$1(this, _Block3.call(this));\n\n _this3.table = table;\n _this3.attributes = [];\n _this3.arguments = [];\n _this3.inParams = true;\n _this3.positionals = [];\n return _this3;\n }\n\n ComponentBlock.prototype.push = function (statement) {\n if (this.inParams) {\n if (_wireFormat.Statements.isFlushElement(statement)) {\n this.inParams = false;\n } else if (_wireFormat.Statements.isArgument(statement)) {\n this.arguments.push(statement);\n } else if (_wireFormat.Statements.isAttribute(statement)) {\n this.attributes.push(statement);\n } else if (_wireFormat.Statements.isModifier(statement)) {\n throw new Error('Compile Error: Element modifiers are not allowed in components');\n } else {\n throw new Error('Compile Error: only parameters allowed before flush-element');\n }\n } else {\n this.statements.push(statement);\n }\n };\n\n ComponentBlock.prototype.toJSON = function () {\n var args = this.arguments;\n var keys = args.map(function (arg) {\n return arg[1];\n });\n var values = args.map(function (arg) {\n return arg[2];\n });\n return [this.attributes, [keys, values], {\n statements: this.statements,\n parameters: this.table.slots\n }];\n };\n\n return ComponentBlock;\n }(Block);\n var Template = function () {\n function Template(symbols, meta) {\n _classCallCheck$2(this, Template);\n\n this.meta = meta;\n this.block = new TemplateBlock(symbols);\n }\n\n Template.prototype.toJSON = function () {\n return {\n block: this.block.toJSON(),\n meta: this.meta\n };\n };\n\n return Template;\n }();\n\n var JavaScriptCompiler = function () {\n function JavaScriptCompiler(opcodes, symbols, meta) {\n _classCallCheck$2(this, JavaScriptCompiler);\n\n this.blocks = new _util.Stack();\n this.values = [];\n this.opcodes = opcodes;\n this.template = new Template(symbols, meta);\n }\n\n JavaScriptCompiler.process = function (opcodes, symbols, meta) {\n var compiler = new JavaScriptCompiler(opcodes, symbols, meta);\n return compiler.process();\n };\n\n JavaScriptCompiler.prototype.process = function () {\n var _this4 = this;\n\n this.opcodes.forEach(function (_ref) {\n var opcode = _ref[0],\n args = _ref.slice(1);\n\n if (!_this4[opcode]) {\n throw new Error(\"unimplemented \" + opcode + \" on JavaScriptCompiler\");\n }\n _this4[opcode].apply(_this4, args);\n });\n return this.template;\n };\n /// Nesting\n\n\n JavaScriptCompiler.prototype.startBlock = function (_ref2) {\n var program = _ref2[0];\n\n var block = new InlineBlock(program['symbols']);\n this.blocks.push(block);\n };\n\n JavaScriptCompiler.prototype.endBlock = function () {\n var template = this.template,\n blocks = this.blocks;\n\n var block = blocks.pop();\n template.block.blocks.push(block.toJSON());\n };\n\n JavaScriptCompiler.prototype.startProgram = function () {\n this.blocks.push(this.template.block);\n };\n\n JavaScriptCompiler.prototype.endProgram = function () {};\n /// Statements\n\n\n JavaScriptCompiler.prototype.text = function (content) {\n this.push([_wireFormat.Ops.Text, content]);\n };\n\n JavaScriptCompiler.prototype.append = function (trusted) {\n this.push([_wireFormat.Ops.Append, this.popValue(), trusted]);\n };\n\n JavaScriptCompiler.prototype.comment = function (value) {\n this.push([_wireFormat.Ops.Comment, value]);\n };\n\n JavaScriptCompiler.prototype.modifier = function (name) {\n var params = this.popValue();\n var hash = this.popValue();\n this.push([_wireFormat.Ops.Modifier, name, params, hash]);\n };\n\n JavaScriptCompiler.prototype.block = function (name, template, inverse) {\n var params = this.popValue();\n var hash = this.popValue();\n var blocks = this.template.block.blocks;\n (0, _util.assert)(typeof template !== 'number' || blocks[template] !== null, 'missing block in the compiler');\n (0, _util.assert)(typeof inverse !== 'number' || blocks[inverse] !== null, 'missing block in the compiler');\n this.push([_wireFormat.Ops.Block, name, params, hash, blocks[template], blocks[inverse]]);\n };\n\n JavaScriptCompiler.prototype.openElement = function (element) {\n var tag = element.tag;\n if (tag.indexOf('-') !== -1) {\n this.startComponent(element);\n } else if (element.blockParams.length > 0) {\n throw new Error(\"Compile Error: <\" + element.tag + \"> is not a component and doesn't support block parameters\");\n } else {\n this.push([_wireFormat.Ops.OpenElement, tag]);\n }\n };\n\n JavaScriptCompiler.prototype.flushElement = function () {\n this.push([_wireFormat.Ops.FlushElement]);\n };\n\n JavaScriptCompiler.prototype.closeElement = function (element) {\n var tag = element.tag,\n _endComponent,\n attrs,\n args,\n block;\n if (tag.indexOf('-') !== -1) {\n _endComponent = this.endComponent(), attrs = _endComponent[0], args = _endComponent[1], block = _endComponent[2];\n\n\n this.push([_wireFormat.Ops.Component, tag, attrs, args, block]);\n } else {\n this.push([_wireFormat.Ops.CloseElement]);\n }\n };\n\n JavaScriptCompiler.prototype.staticAttr = function (name, namespace) {\n var value = this.popValue();\n this.push([_wireFormat.Ops.StaticAttr, name, value, namespace]);\n };\n\n JavaScriptCompiler.prototype.dynamicAttr = function (name, namespace) {\n var value = this.popValue();\n this.push([_wireFormat.Ops.DynamicAttr, name, value, namespace]);\n };\n\n JavaScriptCompiler.prototype.trustingAttr = function (name, namespace) {\n var value = this.popValue();\n this.push([_wireFormat.Ops.TrustingAttr, name, value, namespace]);\n };\n\n JavaScriptCompiler.prototype.staticArg = function (name) {\n var value = this.popValue();\n this.push([_wireFormat.Ops.StaticArg, name, value]);\n };\n\n JavaScriptCompiler.prototype.dynamicArg = function (name) {\n var value = this.popValue();\n this.push([_wireFormat.Ops.DynamicArg, name, value]);\n };\n\n JavaScriptCompiler.prototype.yield = function (to) {\n var params = this.popValue();\n this.push([_wireFormat.Ops.Yield, to, params]);\n };\n\n JavaScriptCompiler.prototype.debugger = function (evalInfo) {\n this.push([_wireFormat.Ops.Debugger, evalInfo]);\n this.template.block.hasEval = true;\n };\n\n JavaScriptCompiler.prototype.hasBlock = function (name) {\n this.pushValue([_wireFormat.Ops.HasBlock, name]);\n };\n\n JavaScriptCompiler.prototype.hasBlockParams = function (name) {\n this.pushValue([_wireFormat.Ops.HasBlockParams, name]);\n };\n\n JavaScriptCompiler.prototype.partial = function (evalInfo) {\n var params = this.popValue();\n this.push([_wireFormat.Ops.Partial, params[0], evalInfo]);\n this.template.block.hasEval = true;\n };\n /// Expressions\n\n\n JavaScriptCompiler.prototype.literal = function (value) {\n if (value === undefined) {\n this.pushValue([_wireFormat.Ops.Undefined]);\n } else {\n this.pushValue(value);\n }\n };\n\n JavaScriptCompiler.prototype.unknown = function (name) {\n this.pushValue([_wireFormat.Ops.Unknown, name]);\n };\n\n JavaScriptCompiler.prototype.get = function (head, path) {\n this.pushValue([_wireFormat.Ops.Get, head, path]);\n };\n\n JavaScriptCompiler.prototype.maybeLocal = function (path) {\n this.pushValue([_wireFormat.Ops.MaybeLocal, path]);\n };\n\n JavaScriptCompiler.prototype.concat = function () {\n this.pushValue([_wireFormat.Ops.Concat, this.popValue()]);\n };\n\n JavaScriptCompiler.prototype.helper = function (name) {\n var params = this.popValue();\n var hash = this.popValue();\n this.pushValue([_wireFormat.Ops.Helper, name, params, hash]);\n };\n /// Stack Management Opcodes\n\n\n JavaScriptCompiler.prototype.startComponent = function (element) {\n var component = new ComponentBlock(element['symbols']);\n this.blocks.push(component);\n };\n\n JavaScriptCompiler.prototype.endComponent = function () {\n var component = this.blocks.pop();\n (0, _util.assert)(component instanceof ComponentBlock, \"Compiler bug: endComponent() should end a component\");\n return component.toJSON();\n };\n\n JavaScriptCompiler.prototype.prepareArray = function (size) {\n var values = [],\n i;\n for (i = 0; i < size; i++) {\n values.push(this.popValue());\n }\n this.pushValue(values);\n };\n\n JavaScriptCompiler.prototype.prepareObject = function (size) {\n (0, _util.assert)(this.values.length >= size, \"Expected \" + size + \" values on the stack, found \" + this.values.length);\n var keys = new Array(size),\n i;\n var values = new Array(size);\n for (i = 0; i < size; i++) {\n keys[i] = this.popValue();\n values[i] = this.popValue();\n }\n this.pushValue([keys, values]);\n };\n /// Utilities\n\n\n JavaScriptCompiler.prototype.push = function (args) {\n while (args[args.length - 1] === null) {\n args.pop();\n }\n this.currentBlock.push(args);\n };\n\n JavaScriptCompiler.prototype.pushValue = function (val) {\n this.values.push(val);\n };\n\n JavaScriptCompiler.prototype.popValue = function () {\n (0, _util.assert)(this.values.length, \"No expression found on stack\");\n return this.values.pop();\n };\n\n _createClass$2(JavaScriptCompiler, [{\n key: \"currentBlock\",\n get: function () {\n return this.blocks.current;\n }\n }]);\n\n return JavaScriptCompiler;\n }();\n\n var _createClass = function () {\n function defineProperties(target, props) {\n var i, descriptor;\n\n for (i = 0; i < props.length; i++) {\n descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if (\"value\" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);\n }\n }return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;\n };\n }();\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n function isTrustedValue(value) {\n return value.escaped !== undefined && !value.escaped;\n }\n\n var TemplateCompiler = function () {\n function TemplateCompiler(options) {\n _classCallCheck(this, TemplateCompiler);\n\n this.templateId = 0;\n this.templateIds = [];\n this.symbolStack = new _util.Stack();\n this.opcodes = [];\n this.includeMeta = false;\n this.options = options || {};\n }\n\n TemplateCompiler.compile = function (options, ast) {\n var templateVisitor = new TemplateVisitor();\n templateVisitor.visit(ast);\n var compiler = new TemplateCompiler(options);\n var opcodes = compiler.process(templateVisitor.actions);\n return JavaScriptCompiler.process(opcodes, ast['symbols'], options.meta);\n };\n\n TemplateCompiler.prototype.process = function (actions) {\n var _this = this;\n\n actions.forEach(function (_ref) {\n var name = _ref[0],\n args = _ref.slice(1);\n\n if (!_this[name]) {\n throw new Error(\"Unimplemented \" + name + \" on TemplateCompiler\");\n }\n _this[name].apply(_this, args);\n });\n return this.opcodes;\n };\n\n TemplateCompiler.prototype.startProgram = function (program) {\n this.symbolStack.push(program[0]['symbols']);\n this.opcode('startProgram', program, program);\n };\n\n TemplateCompiler.prototype.endProgram = function () {\n this.symbolStack.pop();\n this.opcode('endProgram', null);\n };\n\n TemplateCompiler.prototype.startBlock = function (program) {\n this.symbolStack.push(program[0]['symbols']);\n this.templateId++;\n this.opcode('startBlock', program, program);\n };\n\n TemplateCompiler.prototype.endBlock = function () {\n this.symbolStack.pop();\n this.templateIds.push(this.templateId - 1);\n this.opcode('endBlock', null);\n };\n\n TemplateCompiler.prototype.text = function (_ref2) {\n var action = _ref2[0];\n\n this.opcode('text', action, action.chars);\n };\n\n TemplateCompiler.prototype.comment = function (_ref3) {\n var action = _ref3[0];\n\n this.opcode('comment', action, action.value);\n };\n\n TemplateCompiler.prototype.openElement = function (_ref4) {\n var action = _ref4[0],\n i,\n _i;\n\n this.opcode('openElement', action, action);\n for (i = 0; i < action.attributes.length; i++) {\n this.attribute([action.attributes[i]]);\n }\n for (_i = 0; _i < action.modifiers.length; _i++) {\n this.modifier([action.modifiers[_i]]);\n }\n this.opcode('flushElement', null);\n this.symbolStack.push(action['symbols']);\n };\n\n TemplateCompiler.prototype.closeElement = function (_ref5) {\n var action = _ref5[0];\n\n this.symbolStack.pop();\n this.opcode('closeElement', null, action);\n };\n\n TemplateCompiler.prototype.attribute = function (_ref6) {\n var action = _ref6[0],\n isTrusting;\n var name = action.name,\n value = action.value;\n\n var namespace = (0, _util.getAttrNamespace)(name);\n var isStatic = this.prepareAttributeValue(value);\n if (name.charAt(0) === '@') {\n // Arguments\n if (isStatic) {\n this.opcode('staticArg', action, name);\n } else if (action.value.type === 'MustacheStatement') {\n this.opcode('dynamicArg', action, name);\n } else {\n this.opcode('dynamicArg', action, name);\n }\n } else {\n isTrusting = isTrustedValue(value);\n\n if (isStatic) {\n this.opcode('staticAttr', action, name, namespace);\n } else if (isTrusting) {\n this.opcode('trustingAttr', action, name, namespace);\n } else if (action.value.type === 'MustacheStatement') {\n this.opcode('dynamicAttr', action, name);\n } else {\n this.opcode('dynamicAttr', action, name, namespace);\n }\n }\n };\n\n TemplateCompiler.prototype.modifier = function (_ref7) {\n var action = _ref7[0];\n\n assertIsSimplePath(action.path, action.loc, 'modifier');\n var parts = action.path.parts;\n\n this.prepareHelper(action);\n this.opcode('modifier', action, parts[0]);\n };\n\n TemplateCompiler.prototype.mustache = function (_ref8) {\n var action = _ref8[0],\n to,\n params;\n var path = action.path;\n\n if ((0, _syntax.isLiteral)(path)) {\n this.mustacheExpression(action);\n this.opcode('append', action, !action.escaped);\n } else if (isYield(path)) {\n to = assertValidYield(action);\n\n this.yield(to, action);\n } else if (isPartial(path)) {\n params = assertValidPartial(action);\n\n this.partial(params, action);\n } else if (isDebugger(path)) {\n assertValidDebuggerUsage(action);\n this.debugger('debugger', action);\n } else {\n this.mustacheExpression(action);\n this.opcode('append', action, !action.escaped);\n }\n };\n\n TemplateCompiler.prototype.block = function (_ref9) {\n var action /*, index, count*/ = _ref9[0];\n\n this.prepareHelper(action);\n var templateId = this.templateIds.pop();\n var inverseId = action.inverse === null ? null : this.templateIds.pop();\n this.opcode('block', action, action.path.parts[0], templateId, inverseId);\n };\n /// Internal actions, not found in the original processed actions\n\n\n TemplateCompiler.prototype.arg = function (_ref10) {\n var path = _ref10[0];\n\n var _path$parts = path.parts,\n head = _path$parts[0],\n rest = _path$parts.slice(1);\n\n var symbol = this.symbols.allocateNamed(head);\n this.opcode('get', path, symbol, rest);\n };\n\n TemplateCompiler.prototype.mustacheExpression = function (expr) {\n var path = expr.path,\n _path$parts2,\n head,\n parts;\n\n if ((0, _syntax.isLiteral)(path)) {\n this.opcode('literal', expr, path.value);\n } else if (isBuiltInHelper(path)) {\n this.builtInHelper(expr);\n } else if (isArg(path)) {\n this.arg([path]);\n } else if (isHelperInvocation(expr)) {\n this.prepareHelper(expr);\n this.opcode('helper', expr, path.parts[0]);\n } else if (path.this) {\n this.opcode('get', expr, 0, path.parts);\n } else if (isLocal(path, this.symbols)) {\n _path$parts2 = path.parts, head = _path$parts2[0], parts = _path$parts2.slice(1);\n\n\n this.opcode('get', expr, this.symbols.get(head), parts);\n } else if (isSimplePath(path)) {\n this.opcode('unknown', expr, path.parts[0]);\n } else {\n this.opcode('maybeLocal', expr, path.parts);\n }\n };\n /// Internal Syntax\n\n\n TemplateCompiler.prototype.yield = function (to, action) {\n this.prepareParams(action.params);\n this.opcode('yield', action, this.symbols.allocateBlock(to));\n };\n\n TemplateCompiler.prototype.debugger = function (_name, action) {\n this.opcode('debugger', action, this.symbols.getEvalInfo());\n };\n\n TemplateCompiler.prototype.hasBlock = function (name, action) {\n this.opcode('hasBlock', action, this.symbols.allocateBlock(name));\n };\n\n TemplateCompiler.prototype.hasBlockParams = function (name, action) {\n this.opcode('hasBlockParams', action, this.symbols.allocateBlock(name));\n };\n\n TemplateCompiler.prototype.partial = function (_params, action) {\n this.prepareParams(action.params);\n this.opcode('partial', action, this.symbols.getEvalInfo());\n };\n\n TemplateCompiler.prototype.builtInHelper = function (expr) {\n var path = expr.path,\n name,\n _name2;\n\n if (isHasBlock(path)) {\n name = assertValidHasBlockUsage(expr.path.original, expr);\n\n this.hasBlock(name, expr);\n } else if (isHasBlockParams(path)) {\n _name2 = assertValidHasBlockUsage(expr.path.original, expr);\n\n this.hasBlockParams(_name2, expr);\n }\n };\n /// Expressions, invoked recursively from prepareParams and prepareHash\n\n\n TemplateCompiler.prototype.SubExpression = function (expr) {\n if (isBuiltInHelper(expr.path)) {\n this.builtInHelper(expr);\n } else {\n this.prepareHelper(expr);\n this.opcode('helper', expr, expr.path.parts[0]);\n }\n };\n\n TemplateCompiler.prototype.PathExpression = function (expr) {\n var symbols, _expr$parts, head;\n\n if (expr.data) {\n this.arg([expr]);\n } else {\n symbols = this.symbols;\n _expr$parts = expr.parts, head = _expr$parts[0];\n\n\n if (expr.this) {\n this.opcode('get', expr, 0, expr.parts);\n } else if (symbols.has(head)) {\n this.opcode('get', expr, symbols.get(head), expr.parts.slice(1));\n } else {\n this.opcode('maybeLocal', expr, expr.parts);\n }\n }\n };\n\n TemplateCompiler.prototype.StringLiteral = function (action) {\n this.opcode('literal', null, action.value);\n };\n\n TemplateCompiler.prototype.BooleanLiteral = function (action) {\n this.opcode('literal', null, action.value);\n };\n\n TemplateCompiler.prototype.NumberLiteral = function (action) {\n this.opcode('literal', null, action.value);\n };\n\n TemplateCompiler.prototype.NullLiteral = function (action) {\n this.opcode('literal', null, action.value);\n };\n\n TemplateCompiler.prototype.UndefinedLiteral = function (action) {\n this.opcode('literal', null, action.value);\n };\n /// Utilities\n\n\n TemplateCompiler.prototype.opcode = function (name, action) {\n for (_len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n\n var opcode = [name].concat(args),\n _len,\n args,\n _key;\n if (this.includeMeta && action) {\n opcode.push(this.meta(action));\n }\n this.opcodes.push(opcode);\n };\n\n TemplateCompiler.prototype.prepareHelper = function (expr) {\n assertIsSimplePath(expr.path, expr.loc, 'helper');\n var params = expr.params,\n hash = expr.hash;\n\n this.prepareHash(hash);\n this.prepareParams(params);\n };\n\n TemplateCompiler.prototype.prepareParams = function (params)