-
Notifications
You must be signed in to change notification settings - Fork 0
/
vendors~9e0f4621.261e5f7a56ea812fad20.chunk.js
15 lines (11 loc) · 432 KB
/
vendors~9e0f4621.261e5f7a56ea812fad20.chunk.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["vendors~9e0f4621"],{
/***/ "hij8":
/*!***********************************************************************************!*\
!*** ./node_modules/aurelia-templating/dist/native-modules/aurelia-templating.js ***!
\***********************************************************************************/
/*! exports provided: animationEvent, Animator, CompositionTransactionNotifier, CompositionTransactionOwnershipToken, CompositionTransaction, _hyphenate, _isAllWhitespace, ViewEngineHooksResource, viewEngineHooks, ElementEvents, ResourceLoadContext, ViewCompileInstruction, BehaviorInstruction, TargetInstruction, viewStrategy, RelativeViewStrategy, ConventionalViewStrategy, NoViewStrategy, TemplateRegistryViewStrategy, InlineViewStrategy, StaticViewStrategy, ViewLocator, BindingLanguage, SlotCustomAttribute, PassThroughSlot, ShadowSlot, ShadowDOM, validateBehaviorName, ViewResources, View, ViewSlot, BoundViewFactory, ViewFactory, ViewCompiler, ResourceModule, ResourceDescription, ModuleAnalyzer, ViewEngine, Controller, BehaviorPropertyObserver, BindableProperty, HtmlBehaviorResource, children, child, SwapStrategies, CompositionEngine, ElementConfigResource, resource, behavior, customElement, customAttribute, templateController, bindable, dynamicOptions, useShadowDOM, processAttributes, processContent, containerless, useViewStrategy, useView, inlineView, noView, view, elementConfig, viewResources, TemplatingEngine */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"animationEvent\", function() { return animationEvent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Animator\", function() { return Animator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CompositionTransactionNotifier\", function() { return CompositionTransactionNotifier; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CompositionTransactionOwnershipToken\", function() { return CompositionTransactionOwnershipToken; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CompositionTransaction\", function() { return CompositionTransaction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_hyphenate\", function() { return _hyphenate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"_isAllWhitespace\", function() { return _isAllWhitespace; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewEngineHooksResource\", function() { return ViewEngineHooksResource; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"viewEngineHooks\", function() { return viewEngineHooks; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ElementEvents\", function() { return ElementEvents; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ResourceLoadContext\", function() { return ResourceLoadContext; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewCompileInstruction\", function() { return ViewCompileInstruction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BehaviorInstruction\", function() { return BehaviorInstruction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TargetInstruction\", function() { return TargetInstruction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"viewStrategy\", function() { return viewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"RelativeViewStrategy\", function() { return RelativeViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ConventionalViewStrategy\", function() { return ConventionalViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"NoViewStrategy\", function() { return NoViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TemplateRegistryViewStrategy\", function() { return TemplateRegistryViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"InlineViewStrategy\", function() { return InlineViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"StaticViewStrategy\", function() { return StaticViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewLocator\", function() { return ViewLocator; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BindingLanguage\", function() { return BindingLanguage; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SlotCustomAttribute\", function() { return SlotCustomAttribute; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"PassThroughSlot\", function() { return PassThroughSlot; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowSlot\", function() { return ShadowSlot; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ShadowDOM\", function() { return ShadowDOM; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"validateBehaviorName\", function() { return validateBehaviorName; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewResources\", function() { return ViewResources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"View\", function() { return View; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewSlot\", function() { return ViewSlot; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BoundViewFactory\", function() { return BoundViewFactory; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewFactory\", function() { return ViewFactory; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewCompiler\", function() { return ViewCompiler; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ResourceModule\", function() { return ResourceModule; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ResourceDescription\", function() { return ResourceDescription; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ModuleAnalyzer\", function() { return ModuleAnalyzer; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ViewEngine\", function() { return ViewEngine; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Controller\", function() { return Controller; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BehaviorPropertyObserver\", function() { return BehaviorPropertyObserver; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"BindableProperty\", function() { return BindableProperty; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"HtmlBehaviorResource\", function() { return HtmlBehaviorResource; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"children\", function() { return children; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"child\", function() { return child; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"SwapStrategies\", function() { return SwapStrategies; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"CompositionEngine\", function() { return CompositionEngine; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"ElementConfigResource\", function() { return ElementConfigResource; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"resource\", function() { return resource; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"behavior\", function() { return behavior; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"customElement\", function() { return customElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"customAttribute\", function() { return customAttribute; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"templateController\", function() { return templateController; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bindable\", function() { return bindable; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"dynamicOptions\", function() { return dynamicOptions; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useShadowDOM\", function() { return useShadowDOM; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"processAttributes\", function() { return processAttributes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"processContent\", function() { return processContent; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"containerless\", function() { return containerless; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useViewStrategy\", function() { return useViewStrategy; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"useView\", function() { return useView; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"inlineView\", function() { return inlineView; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"noView\", function() { return noView; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"view\", function() { return view; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"elementConfig\", function() { return elementConfig; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"viewResources\", function() { return viewResources; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"TemplatingEngine\", function() { return TemplatingEngine; });\n/* harmony import */ var aurelia_logging__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aurelia-logging */ \"MP1E\");\n/* harmony import */ var aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! aurelia-metadata */ \"qrcG\");\n/* harmony import */ var aurelia_pal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! aurelia-pal */ \"70NS\");\n/* harmony import */ var aurelia_loader__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! aurelia-loader */ \"ZdUM\");\n/* harmony import */ var aurelia_path__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! aurelia-path */ \"iD3O\");\n/* harmony import */ var aurelia_binding__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! aurelia-binding */ \"X5gX\");\n/* harmony import */ var aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! aurelia-dependency-injection */ \"3U8n\");\n/* harmony import */ var aurelia_task_queue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! aurelia-task-queue */ \"K/SW\");\nvar _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; }; }();\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _class, _temp, _class2, _temp2, _dec, _class3, _dec2, _class4, _dec3, _class5, _dec4, _class6, _dec5, _class7, _dec6, _class8, _class9, _temp3, _class10, _temp4, _class12, _class14, _temp5, _dec7, _class15, _dec8, _class16, _dec9, _class17;\n\n\n\n\n\n\n\n\n\n\n\n\nvar animationEvent = {\n enterBegin: 'animation:enter:begin',\n enterActive: 'animation:enter:active',\n enterDone: 'animation:enter:done',\n enterTimeout: 'animation:enter:timeout',\n\n leaveBegin: 'animation:leave:begin',\n leaveActive: 'animation:leave:active',\n leaveDone: 'animation:leave:done',\n leaveTimeout: 'animation:leave:timeout',\n\n staggerNext: 'animation:stagger:next',\n\n removeClassBegin: 'animation:remove-class:begin',\n removeClassActive: 'animation:remove-class:active',\n removeClassDone: 'animation:remove-class:done',\n removeClassTimeout: 'animation:remove-class:timeout',\n\n addClassBegin: 'animation:add-class:begin',\n addClassActive: 'animation:add-class:active',\n addClassDone: 'animation:add-class:done',\n addClassTimeout: 'animation:add-class:timeout',\n\n animateBegin: 'animation:animate:begin',\n animateActive: 'animation:animate:active',\n animateDone: 'animation:animate:done',\n animateTimeout: 'animation:animate:timeout',\n\n sequenceBegin: 'animation:sequence:begin',\n sequenceDone: 'animation:sequence:done'\n};\n\nvar Animator = function () {\n function Animator() {\n \n }\n\n Animator.prototype.enter = function enter(element) {\n return Promise.resolve(false);\n };\n\n Animator.prototype.leave = function leave(element) {\n return Promise.resolve(false);\n };\n\n Animator.prototype.removeClass = function removeClass(element, className) {\n element.classList.remove(className);\n return Promise.resolve(false);\n };\n\n Animator.prototype.addClass = function addClass(element, className) {\n element.classList.add(className);\n return Promise.resolve(false);\n };\n\n Animator.prototype.animate = function animate(element, className) {\n return Promise.resolve(false);\n };\n\n Animator.prototype.runSequence = function runSequence(animations) {};\n\n Animator.prototype.registerEffect = function registerEffect(effectName, properties) {};\n\n Animator.prototype.unregisterEffect = function unregisterEffect(effectName) {};\n\n return Animator;\n}();\n\nvar CompositionTransactionNotifier = function () {\n function CompositionTransactionNotifier(owner) {\n \n\n this.owner = owner;\n this.owner._compositionCount++;\n }\n\n CompositionTransactionNotifier.prototype.done = function done() {\n this.owner._compositionCount--;\n this.owner._tryCompleteTransaction();\n };\n\n return CompositionTransactionNotifier;\n}();\n\nvar CompositionTransactionOwnershipToken = function () {\n function CompositionTransactionOwnershipToken(owner) {\n \n\n this.owner = owner;\n this.owner._ownershipToken = this;\n this.thenable = this._createThenable();\n }\n\n CompositionTransactionOwnershipToken.prototype.waitForCompositionComplete = function waitForCompositionComplete() {\n this.owner._tryCompleteTransaction();\n return this.thenable;\n };\n\n CompositionTransactionOwnershipToken.prototype.resolve = function resolve() {\n this._resolveCallback();\n };\n\n CompositionTransactionOwnershipToken.prototype._createThenable = function _createThenable() {\n var _this = this;\n\n return new Promise(function (resolve, reject) {\n _this._resolveCallback = resolve;\n });\n };\n\n return CompositionTransactionOwnershipToken;\n}();\n\nvar CompositionTransaction = function () {\n function CompositionTransaction() {\n \n\n this._ownershipToken = null;\n this._compositionCount = 0;\n }\n\n CompositionTransaction.prototype.tryCapture = function tryCapture() {\n return this._ownershipToken === null ? new CompositionTransactionOwnershipToken(this) : null;\n };\n\n CompositionTransaction.prototype.enlist = function enlist() {\n return new CompositionTransactionNotifier(this);\n };\n\n CompositionTransaction.prototype._tryCompleteTransaction = function _tryCompleteTransaction() {\n if (this._compositionCount <= 0) {\n this._compositionCount = 0;\n\n if (this._ownershipToken !== null) {\n var token = this._ownershipToken;\n this._ownershipToken = null;\n token.resolve();\n }\n }\n };\n\n return CompositionTransaction;\n}();\n\nvar capitalMatcher = /([A-Z])/g;\n\nfunction addHyphenAndLower(char) {\n return '-' + char.toLowerCase();\n}\n\nfunction _hyphenate(name) {\n return (name.charAt(0).toLowerCase() + name.slice(1)).replace(capitalMatcher, addHyphenAndLower);\n}\n\nfunction _isAllWhitespace(node) {\n return !(node.auInterpolationTarget || /[^\\t\\n\\r ]/.test(node.textContent));\n}\n\nvar ViewEngineHooksResource = function () {\n function ViewEngineHooksResource() {\n \n }\n\n ViewEngineHooksResource.prototype.initialize = function initialize(container, target) {\n this.instance = container.get(target);\n };\n\n ViewEngineHooksResource.prototype.register = function register(registry, name) {\n registry.registerViewEngineHooks(this.instance);\n };\n\n ViewEngineHooksResource.prototype.load = function load(container, target) {};\n\n ViewEngineHooksResource.convention = function convention(name) {\n if (name.endsWith('ViewEngineHooks')) {\n return new ViewEngineHooksResource();\n }\n };\n\n return ViewEngineHooksResource;\n}();\n\nfunction viewEngineHooks(target) {\n var deco = function deco(t) {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, new ViewEngineHooksResource(), t);\n };\n\n return target ? deco(target) : deco;\n}\n\nvar ElementEvents = (_temp = _class = function () {\n function ElementEvents(element) {\n \n\n this.element = element;\n this.subscriptions = {};\n }\n\n ElementEvents.prototype._enqueueHandler = function _enqueueHandler(handler) {\n this.subscriptions[handler.eventName] = this.subscriptions[handler.eventName] || [];\n this.subscriptions[handler.eventName].push(handler);\n };\n\n ElementEvents.prototype._dequeueHandler = function _dequeueHandler(handler) {\n var index = void 0;\n var subscriptions = this.subscriptions[handler.eventName];\n if (subscriptions) {\n index = subscriptions.indexOf(handler);\n if (index > -1) {\n subscriptions.splice(index, 1);\n }\n }\n return handler;\n };\n\n ElementEvents.prototype.publish = function publish(eventName) {\n var detail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var bubbles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var cancelable = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;\n\n var event = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createCustomEvent(eventName, { cancelable: cancelable, bubbles: bubbles, detail: detail });\n this.element.dispatchEvent(event);\n };\n\n ElementEvents.prototype.subscribe = function subscribe(eventName, handler, captureOrOptions) {\n if (typeof handler === 'function') {\n if (captureOrOptions === undefined) {\n captureOrOptions = ElementEvents.defaultListenerOptions;\n }\n var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, false);\n return eventHandler;\n }\n\n return undefined;\n };\n\n ElementEvents.prototype.subscribeOnce = function subscribeOnce(eventName, handler, captureOrOptions) {\n if (typeof handler === 'function') {\n if (captureOrOptions === undefined) {\n captureOrOptions = ElementEvents.defaultListenerOptions;\n }\n var eventHandler = new EventHandlerImpl(this, eventName, handler, captureOrOptions, true);\n return eventHandler;\n }\n\n return undefined;\n };\n\n ElementEvents.prototype.dispose = function dispose(eventName) {\n if (eventName && typeof eventName === 'string') {\n var subscriptions = this.subscriptions[eventName];\n if (subscriptions) {\n while (subscriptions.length) {\n var subscription = subscriptions.pop();\n if (subscription) {\n subscription.dispose();\n }\n }\n }\n } else {\n this.disposeAll();\n }\n };\n\n ElementEvents.prototype.disposeAll = function disposeAll() {\n for (var _key in this.subscriptions) {\n this.dispose(_key);\n }\n };\n\n return ElementEvents;\n}(), _class.defaultListenerOptions = true, _temp);\n\nvar EventHandlerImpl = function () {\n function EventHandlerImpl(owner, eventName, handler, captureOrOptions, once) {\n \n\n this.owner = owner;\n this.eventName = eventName;\n this.handler = handler;\n\n this.capture = typeof captureOrOptions === 'boolean' ? captureOrOptions : captureOrOptions.capture;\n this.bubbles = !this.capture;\n this.captureOrOptions = captureOrOptions;\n this.once = once;\n owner.element.addEventListener(eventName, this, captureOrOptions);\n owner._enqueueHandler(this);\n }\n\n EventHandlerImpl.prototype.handleEvent = function handleEvent(e) {\n var fn = this.handler;\n fn(e);\n if (this.once) {\n this.dispose();\n }\n };\n\n EventHandlerImpl.prototype.dispose = function dispose() {\n this.owner.element.removeEventListener(this.eventName, this, this.captureOrOptions);\n this.owner._dequeueHandler(this);\n this.owner = this.handler = null;\n };\n\n return EventHandlerImpl;\n}();\n\nvar ResourceLoadContext = function () {\n function ResourceLoadContext() {\n \n\n this.dependencies = {};\n }\n\n ResourceLoadContext.prototype.addDependency = function addDependency(url) {\n this.dependencies[url] = true;\n };\n\n ResourceLoadContext.prototype.hasDependency = function hasDependency(url) {\n return url in this.dependencies;\n };\n\n return ResourceLoadContext;\n}();\n\nvar ViewCompileInstruction = function ViewCompileInstruction() {\n var targetShadowDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var compileSurrogate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n \n\n this.targetShadowDOM = targetShadowDOM;\n this.compileSurrogate = compileSurrogate;\n this.associatedModuleId = null;\n};\n\nViewCompileInstruction.normal = new ViewCompileInstruction();\n\nvar BehaviorInstruction = function () {\n function BehaviorInstruction() {\n \n }\n\n BehaviorInstruction.enhance = function enhance() {\n var instruction = new BehaviorInstruction();\n instruction.enhance = true;\n return instruction;\n };\n\n BehaviorInstruction.unitTest = function unitTest(type, attributes) {\n var instruction = new BehaviorInstruction();\n instruction.type = type;\n instruction.attributes = attributes || {};\n return instruction;\n };\n\n BehaviorInstruction.element = function element(node, type) {\n var instruction = new BehaviorInstruction();\n instruction.type = type;\n instruction.attributes = {};\n instruction.anchorIsContainer = !(node.hasAttribute('containerless') || type.containerless);\n instruction.initiatedByBehavior = true;\n return instruction;\n };\n\n BehaviorInstruction.attribute = function attribute(attrName, type) {\n var instruction = new BehaviorInstruction();\n instruction.attrName = attrName;\n instruction.type = type || null;\n instruction.attributes = {};\n return instruction;\n };\n\n BehaviorInstruction.dynamic = function dynamic(host, viewModel, viewFactory) {\n var instruction = new BehaviorInstruction();\n instruction.host = host;\n instruction.viewModel = viewModel;\n instruction.viewFactory = viewFactory;\n instruction.inheritBindingContext = true;\n return instruction;\n };\n\n return BehaviorInstruction;\n}();\n\nvar biProto = BehaviorInstruction.prototype;\nbiProto.initiatedByBehavior = false;\nbiProto.enhance = false;\nbiProto.partReplacements = null;\nbiProto.viewFactory = null;\nbiProto.originalAttrName = null;\nbiProto.skipContentProcessing = false;\nbiProto.contentFactory = null;\nbiProto.viewModel = null;\nbiProto.anchorIsContainer = false;\nbiProto.host = null;\nbiProto.attributes = null;\nbiProto.type = null;\nbiProto.attrName = null;\nbiProto.inheritBindingContext = false;\n\nBehaviorInstruction.normal = new BehaviorInstruction();\n\nvar TargetInstruction = (_temp2 = _class2 = function () {\n function TargetInstruction() {\n \n }\n\n TargetInstruction.shadowSlot = function shadowSlot(parentInjectorId) {\n var instruction = new TargetInstruction();\n instruction.parentInjectorId = parentInjectorId;\n instruction.shadowSlot = true;\n return instruction;\n };\n\n TargetInstruction.contentExpression = function contentExpression(expression) {\n var instruction = new TargetInstruction();\n instruction.contentExpression = expression;\n return instruction;\n };\n\n TargetInstruction.letElement = function letElement(expressions) {\n var instruction = new TargetInstruction();\n instruction.expressions = expressions;\n instruction.letElement = true;\n return instruction;\n };\n\n TargetInstruction.lifting = function lifting(parentInjectorId, liftingInstruction) {\n var instruction = new TargetInstruction();\n instruction.parentInjectorId = parentInjectorId;\n instruction.expressions = TargetInstruction.noExpressions;\n instruction.behaviorInstructions = [liftingInstruction];\n instruction.viewFactory = liftingInstruction.viewFactory;\n instruction.providers = [liftingInstruction.type.target];\n instruction.lifting = true;\n return instruction;\n };\n\n TargetInstruction.normal = function normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction) {\n var instruction = new TargetInstruction();\n instruction.injectorId = injectorId;\n instruction.parentInjectorId = parentInjectorId;\n instruction.providers = providers;\n instruction.behaviorInstructions = behaviorInstructions;\n instruction.expressions = expressions;\n instruction.anchorIsContainer = elementInstruction ? elementInstruction.anchorIsContainer : true;\n instruction.elementInstruction = elementInstruction;\n return instruction;\n };\n\n TargetInstruction.surrogate = function surrogate(providers, behaviorInstructions, expressions, values) {\n var instruction = new TargetInstruction();\n instruction.expressions = expressions;\n instruction.behaviorInstructions = behaviorInstructions;\n instruction.providers = providers;\n instruction.values = values;\n return instruction;\n };\n\n return TargetInstruction;\n}(), _class2.noExpressions = Object.freeze([]), _temp2);\n\nvar tiProto = TargetInstruction.prototype;\n\ntiProto.injectorId = null;\ntiProto.parentInjectorId = null;\n\ntiProto.shadowSlot = false;\ntiProto.slotName = null;\ntiProto.slotFallbackFactory = null;\n\ntiProto.contentExpression = null;\ntiProto.letElement = false;\n\ntiProto.expressions = null;\ntiProto.expressions = null;\ntiProto.providers = null;\n\ntiProto.viewFactory = null;\n\ntiProto.anchorIsContainer = false;\ntiProto.elementInstruction = null;\ntiProto.lifting = false;\n\ntiProto.values = null;\n\nvar viewStrategy = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"protocol\"].create('aurelia:view-strategy', {\n validate: function validate(target) {\n if (!(typeof target.loadViewFactory === 'function')) {\n return 'View strategies must implement: loadViewFactory(viewEngine: ViewEngine, compileInstruction: ViewCompileInstruction, loadContext?: ResourceLoadContext): Promise<ViewFactory>';\n }\n\n return true;\n },\n compose: function compose(target) {\n if (!(typeof target.makeRelativeTo === 'function')) {\n target.makeRelativeTo = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"PLATFORM\"].noop;\n }\n }\n});\n\nvar RelativeViewStrategy = (_dec = viewStrategy(), _dec(_class3 = function () {\n function RelativeViewStrategy(path) {\n \n\n this.path = path;\n this.absolutePath = null;\n }\n\n RelativeViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {\n if (this.absolutePath === null && this.moduleId) {\n this.absolutePath = Object(aurelia_path__WEBPACK_IMPORTED_MODULE_4__[\"relativeToFile\"])(this.path, this.moduleId);\n }\n\n compileInstruction.associatedModuleId = this.moduleId;\n return viewEngine.loadViewFactory(this.absolutePath || this.path, compileInstruction, loadContext, target);\n };\n\n RelativeViewStrategy.prototype.makeRelativeTo = function makeRelativeTo(file) {\n if (this.absolutePath === null) {\n this.absolutePath = Object(aurelia_path__WEBPACK_IMPORTED_MODULE_4__[\"relativeToFile\"])(this.path, file);\n }\n };\n\n return RelativeViewStrategy;\n}()) || _class3);\n\nvar ConventionalViewStrategy = (_dec2 = viewStrategy(), _dec2(_class4 = function () {\n function ConventionalViewStrategy(viewLocator, origin) {\n \n\n this.moduleId = origin.moduleId;\n this.viewUrl = viewLocator.convertOriginToViewUrl(origin);\n }\n\n ConventionalViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {\n compileInstruction.associatedModuleId = this.moduleId;\n return viewEngine.loadViewFactory(this.viewUrl, compileInstruction, loadContext, target);\n };\n\n return ConventionalViewStrategy;\n}()) || _class4);\n\nvar NoViewStrategy = (_dec3 = viewStrategy(), _dec3(_class5 = function () {\n function NoViewStrategy(dependencies, dependencyBaseUrl) {\n \n\n this.dependencies = dependencies || null;\n this.dependencyBaseUrl = dependencyBaseUrl || '';\n }\n\n NoViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {\n var entry = this.entry;\n var dependencies = this.dependencies;\n\n if (entry && entry.factoryIsReady) {\n return Promise.resolve(null);\n }\n\n this.entry = entry = new aurelia_loader__WEBPACK_IMPORTED_MODULE_3__[\"TemplateRegistryEntry\"](this.moduleId || this.dependencyBaseUrl);\n\n entry.dependencies = [];\n entry.templateIsLoaded = true;\n\n if (dependencies !== null) {\n for (var i = 0, ii = dependencies.length; i < ii; ++i) {\n var current = dependencies[i];\n\n if (typeof current === 'string' || typeof current === 'function') {\n entry.addDependency(current);\n } else {\n entry.addDependency(current.from, current.as);\n }\n }\n }\n\n compileInstruction.associatedModuleId = this.moduleId;\n\n return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);\n };\n\n return NoViewStrategy;\n}()) || _class5);\n\nvar TemplateRegistryViewStrategy = (_dec4 = viewStrategy(), _dec4(_class6 = function () {\n function TemplateRegistryViewStrategy(moduleId, entry) {\n \n\n this.moduleId = moduleId;\n this.entry = entry;\n }\n\n TemplateRegistryViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {\n var entry = this.entry;\n\n if (entry.factoryIsReady) {\n return Promise.resolve(entry.factory);\n }\n\n compileInstruction.associatedModuleId = this.moduleId;\n return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);\n };\n\n return TemplateRegistryViewStrategy;\n}()) || _class6);\n\nvar InlineViewStrategy = (_dec5 = viewStrategy(), _dec5(_class7 = function () {\n function InlineViewStrategy(markup, dependencies, dependencyBaseUrl) {\n \n\n this.markup = markup;\n this.dependencies = dependencies || null;\n this.dependencyBaseUrl = dependencyBaseUrl || '';\n }\n\n InlineViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {\n var entry = this.entry;\n var dependencies = this.dependencies;\n\n if (entry && entry.factoryIsReady) {\n return Promise.resolve(entry.factory);\n }\n\n this.entry = entry = new aurelia_loader__WEBPACK_IMPORTED_MODULE_3__[\"TemplateRegistryEntry\"](this.moduleId || this.dependencyBaseUrl);\n entry.template = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createTemplateFromMarkup(this.markup);\n\n if (dependencies !== null) {\n for (var i = 0, ii = dependencies.length; i < ii; ++i) {\n var current = dependencies[i];\n\n if (typeof current === 'string' || typeof current === 'function') {\n entry.addDependency(current);\n } else {\n entry.addDependency(current.from, current.as);\n }\n }\n }\n\n compileInstruction.associatedModuleId = this.moduleId;\n return viewEngine.loadViewFactory(entry, compileInstruction, loadContext, target);\n };\n\n return InlineViewStrategy;\n}()) || _class7);\n\nvar StaticViewStrategy = (_dec6 = viewStrategy(), _dec6(_class8 = function () {\n function StaticViewStrategy(config) {\n \n\n if (typeof config === 'string' || config instanceof aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].Element && config.tagName === 'TEMPLATE') {\n config = {\n template: config\n };\n }\n this.template = config.template;\n this.dependencies = config.dependencies || [];\n this.factoryIsReady = false;\n this.onReady = null;\n this.moduleId = 'undefined';\n }\n\n StaticViewStrategy.prototype.loadViewFactory = function loadViewFactory(viewEngine, compileInstruction, loadContext, target) {\n var _this2 = this;\n\n if (this.factoryIsReady) {\n return Promise.resolve(this.factory);\n }\n var deps = this.dependencies;\n deps = typeof deps === 'function' ? deps() : deps;\n deps = deps ? deps : [];\n deps = Array.isArray(deps) ? deps : [deps];\n\n return Promise.all(deps).then(function (dependencies) {\n var container = viewEngine.container;\n var appResources = viewEngine.appResources;\n var viewCompiler = viewEngine.viewCompiler;\n var viewResources = new ViewResources(appResources);\n\n var resource = void 0;\n var elDeps = [];\n\n if (target) {\n viewResources.autoRegister(container, target);\n }\n\n for (var _iterator = dependencies, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var dep = _ref;\n\n if (typeof dep === 'function') {\n resource = viewResources.autoRegister(container, dep);\n if (resource.elementName !== null) {\n elDeps.push(resource);\n }\n } else if (dep && (typeof dep === 'undefined' ? 'undefined' : _typeof(dep)) === 'object') {\n for (var _key2 in dep) {\n var exported = dep[_key2];\n if (typeof exported === 'function') {\n resource = viewResources.autoRegister(container, exported);\n if (resource.elementName !== null) {\n elDeps.push(resource);\n }\n }\n }\n } else {\n throw new Error('dependency neither function nor object. Received: \"' + (typeof dep === 'undefined' ? 'undefined' : _typeof(dep)) + '\"');\n }\n }\n\n return Promise.all(elDeps.map(function (el) {\n return el.load(container, el.target);\n })).then(function () {\n var factory = _this2.template !== null ? viewCompiler.compile(_this2.template, viewResources, compileInstruction) : null;\n _this2.factoryIsReady = true;\n _this2.factory = factory;\n return factory;\n });\n });\n };\n\n return StaticViewStrategy;\n}()) || _class8);\n\nvar ViewLocator = (_temp3 = _class9 = function () {\n function ViewLocator() {\n \n }\n\n ViewLocator.prototype.getViewStrategy = function getViewStrategy(value) {\n if (!value) {\n return null;\n }\n\n if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && 'getViewStrategy' in value) {\n var _origin = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"Origin\"].get(value.constructor);\n\n value = value.getViewStrategy();\n\n if (typeof value === 'string') {\n value = new RelativeViewStrategy(value);\n }\n\n viewStrategy.assert(value);\n\n if (_origin.moduleId) {\n value.makeRelativeTo(_origin.moduleId);\n }\n\n return value;\n }\n\n if (typeof value === 'string') {\n value = new RelativeViewStrategy(value);\n }\n\n if (viewStrategy.validate(value)) {\n return value;\n }\n\n if (typeof value !== 'function') {\n value = value.constructor;\n }\n\n if ('$view' in value) {\n var c = value.$view;\n var _view = void 0;\n c = typeof c === 'function' ? c.call(value) : c;\n if (c === null) {\n _view = new NoViewStrategy();\n } else {\n _view = c instanceof StaticViewStrategy ? c : new StaticViewStrategy(c);\n }\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(ViewLocator.viewStrategyMetadataKey, _view, value);\n return _view;\n }\n\n var origin = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"Origin\"].get(value);\n var strategy = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].get(ViewLocator.viewStrategyMetadataKey, value);\n\n if (!strategy) {\n if (!origin.moduleId) {\n throw new Error('Cannot determine default view strategy for object.', value);\n }\n\n strategy = this.createFallbackViewStrategy(origin);\n } else if (origin.moduleId) {\n strategy.moduleId = origin.moduleId;\n }\n\n return strategy;\n };\n\n ViewLocator.prototype.createFallbackViewStrategy = function createFallbackViewStrategy(origin) {\n return new ConventionalViewStrategy(this, origin);\n };\n\n ViewLocator.prototype.convertOriginToViewUrl = function convertOriginToViewUrl(origin) {\n var moduleId = origin.moduleId;\n var id = moduleId.endsWith('.js') || moduleId.endsWith('.ts') ? moduleId.substring(0, moduleId.length - 3) : moduleId;\n return id + '.html';\n };\n\n return ViewLocator;\n}(), _class9.viewStrategyMetadataKey = 'aurelia:view-strategy', _temp3);\n\nfunction mi(name) {\n throw new Error('BindingLanguage must implement ' + name + '().');\n}\n\nvar BindingLanguage = function () {\n function BindingLanguage() {\n \n }\n\n BindingLanguage.prototype.inspectAttribute = function inspectAttribute(resources, elementName, attrName, attrValue) {\n mi('inspectAttribute');\n };\n\n BindingLanguage.prototype.createAttributeInstruction = function createAttributeInstruction(resources, element, info, existingInstruction) {\n mi('createAttributeInstruction');\n };\n\n BindingLanguage.prototype.createLetExpressions = function createLetExpressions(resources, element) {\n mi('createLetExpressions');\n };\n\n BindingLanguage.prototype.inspectTextContent = function inspectTextContent(resources, value) {\n mi('inspectTextContent');\n };\n\n return BindingLanguage;\n}();\n\nvar noNodes = Object.freeze([]);\n\nvar SlotCustomAttribute = function () {\n SlotCustomAttribute.inject = function inject() {\n return [aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].Element];\n };\n\n function SlotCustomAttribute(element) {\n \n\n this.element = element;\n this.element.auSlotAttribute = this;\n }\n\n SlotCustomAttribute.prototype.valueChanged = function valueChanged(newValue, oldValue) {};\n\n return SlotCustomAttribute;\n}();\n\nvar PassThroughSlot = function () {\n function PassThroughSlot(anchor, name, destinationName, fallbackFactory) {\n \n\n this.anchor = anchor;\n this.anchor.viewSlot = this;\n this.name = name;\n this.destinationName = destinationName;\n this.fallbackFactory = fallbackFactory;\n this.destinationSlot = null;\n\n this.projections = 0;\n\n this.contentView = null;\n\n var attr = new SlotCustomAttribute(this.anchor);\n attr.value = this.destinationName;\n }\n\n PassThroughSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) {\n if (this.contentView === null) {\n this.contentView = this.fallbackFactory.create(this.ownerView.container);\n this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);\n\n var slots = Object.create(null);\n slots[this.destinationSlot.name] = this.destinationSlot;\n\n ShadowDOM.distributeView(this.contentView, slots, projectionSource, index, this.destinationSlot.name);\n }\n };\n\n PassThroughSlot.prototype.passThroughTo = function passThroughTo(destinationSlot) {\n this.destinationSlot = destinationSlot;\n };\n\n PassThroughSlot.prototype.addNode = function addNode(view, node, projectionSource, index) {\n if (this.contentView !== null) {\n this.contentView.removeNodes();\n this.contentView.detached();\n this.contentView.unbind();\n this.contentView = null;\n }\n\n if (node.viewSlot instanceof PassThroughSlot) {\n node.viewSlot.passThroughTo(this);\n return;\n }\n\n this.projections++;\n this.destinationSlot.addNode(view, node, projectionSource, index);\n };\n\n PassThroughSlot.prototype.removeView = function removeView(view, projectionSource) {\n this.projections--;\n this.destinationSlot.removeView(view, projectionSource);\n\n if (this.needsFallbackRendering) {\n this.renderFallbackContent(null, noNodes, projectionSource);\n }\n };\n\n PassThroughSlot.prototype.removeAll = function removeAll(projectionSource) {\n this.projections = 0;\n this.destinationSlot.removeAll(projectionSource);\n\n if (this.needsFallbackRendering) {\n this.renderFallbackContent(null, noNodes, projectionSource);\n }\n };\n\n PassThroughSlot.prototype.projectFrom = function projectFrom(view, projectionSource) {\n this.destinationSlot.projectFrom(view, projectionSource);\n };\n\n PassThroughSlot.prototype.created = function created(ownerView) {\n this.ownerView = ownerView;\n };\n\n PassThroughSlot.prototype.bind = function bind(view) {\n if (this.contentView) {\n this.contentView.bind(view.bindingContext, view.overrideContext);\n }\n };\n\n PassThroughSlot.prototype.attached = function attached() {\n if (this.contentView) {\n this.contentView.attached();\n }\n };\n\n PassThroughSlot.prototype.detached = function detached() {\n if (this.contentView) {\n this.contentView.detached();\n }\n };\n\n PassThroughSlot.prototype.unbind = function unbind() {\n if (this.contentView) {\n this.contentView.unbind();\n }\n };\n\n _createClass(PassThroughSlot, [{\n key: 'needsFallbackRendering',\n get: function get() {\n return this.fallbackFactory && this.projections === 0;\n }\n }]);\n\n return PassThroughSlot;\n}();\n\nvar ShadowSlot = function () {\n function ShadowSlot(anchor, name, fallbackFactory) {\n \n\n this.anchor = anchor;\n this.anchor.isContentProjectionSource = true;\n this.anchor.viewSlot = this;\n this.name = name;\n this.fallbackFactory = fallbackFactory;\n this.contentView = null;\n this.projections = 0;\n\n this.children = [];\n this.projectFromAnchors = null;\n this.destinationSlots = null;\n }\n\n ShadowSlot.prototype.addNode = function addNode(view, node, projectionSource, index, destination) {\n if (this.contentView !== null) {\n this.contentView.removeNodes();\n this.contentView.detached();\n this.contentView.unbind();\n this.contentView = null;\n }\n\n if (node.viewSlot instanceof PassThroughSlot) {\n node.viewSlot.passThroughTo(this);\n return;\n }\n\n if (this.destinationSlots !== null) {\n ShadowDOM.distributeNodes(view, [node], this.destinationSlots, this, index);\n } else {\n node.auOwnerView = view;\n node.auProjectionSource = projectionSource;\n node.auAssignedSlot = this;\n\n var anchor = this._findAnchor(view, node, projectionSource, index);\n var parent = anchor.parentNode;\n\n parent.insertBefore(node, anchor);\n this.children.push(node);\n this.projections++;\n }\n };\n\n ShadowSlot.prototype.removeView = function removeView(view, projectionSource) {\n if (this.destinationSlots !== null) {\n ShadowDOM.undistributeView(view, this.destinationSlots, this);\n } else if (this.contentView && this.contentView.hasSlots) {\n ShadowDOM.undistributeView(view, this.contentView.slots, projectionSource);\n } else {\n var found = this.children.find(function (x) {\n return x.auSlotProjectFrom === projectionSource;\n });\n if (found) {\n var _children = found.auProjectionChildren;\n var ownChildren = this.children;\n\n for (var i = 0, ii = _children.length; i < ii; ++i) {\n var _child = _children[i];\n\n if (_child.auOwnerView === view) {\n _children.splice(i, 1);\n view.fragment.appendChild(_child);\n i--;ii--;\n\n this.projections--;\n var idx = ownChildren.indexOf(_child);\n if (idx > -1) {\n ownChildren.splice(idx, 1);\n }\n }\n }\n\n if (this.needsFallbackRendering) {\n this.renderFallbackContent(view, noNodes, projectionSource);\n }\n }\n }\n };\n\n ShadowSlot.prototype.removeAll = function removeAll(projectionSource) {\n if (this.destinationSlots !== null) {\n ShadowDOM.undistributeAll(this.destinationSlots, this);\n } else if (this.contentView && this.contentView.hasSlots) {\n ShadowDOM.undistributeAll(this.contentView.slots, projectionSource);\n } else {\n var found = this.children.find(function (x) {\n return x.auSlotProjectFrom === projectionSource;\n });\n\n if (found) {\n var _children2 = found.auProjectionChildren;\n var ownChildren = this.children;\n\n for (var i = 0, ii = _children2.length; i < ii; ++i) {\n var _child2 = _children2[i];\n _child2.auOwnerView.fragment.appendChild(_child2);\n\n this.projections--;\n var idx = ownChildren.indexOf(_child2);\n if (idx > -1) {\n ownChildren.splice(idx, 1);\n }\n }\n\n found.auProjectionChildren = [];\n\n if (this.needsFallbackRendering) {\n this.renderFallbackContent(null, noNodes, projectionSource);\n }\n }\n }\n };\n\n ShadowSlot.prototype._findAnchor = function _findAnchor(view, node, projectionSource, index) {\n if (projectionSource) {\n var found = this.children.find(function (x) {\n return x.auSlotProjectFrom === projectionSource;\n });\n if (found) {\n if (index !== undefined) {\n var _children3 = found.auProjectionChildren;\n var viewIndex = -1;\n var lastView = void 0;\n\n for (var i = 0, ii = _children3.length; i < ii; ++i) {\n var current = _children3[i];\n\n if (current.auOwnerView !== lastView) {\n viewIndex++;\n lastView = current.auOwnerView;\n\n if (viewIndex >= index && lastView !== view) {\n _children3.splice(i, 0, node);\n return current;\n }\n }\n }\n }\n\n found.auProjectionChildren.push(node);\n return found;\n }\n }\n\n return this.anchor;\n };\n\n ShadowSlot.prototype.projectTo = function projectTo(slots) {\n this.destinationSlots = slots;\n };\n\n ShadowSlot.prototype.projectFrom = function projectFrom(view, projectionSource) {\n var anchor = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createComment('anchor');\n var parent = this.anchor.parentNode;\n anchor.auSlotProjectFrom = projectionSource;\n anchor.auOwnerView = view;\n anchor.auProjectionChildren = [];\n parent.insertBefore(anchor, this.anchor);\n this.children.push(anchor);\n\n if (this.projectFromAnchors === null) {\n this.projectFromAnchors = [];\n }\n\n this.projectFromAnchors.push(anchor);\n };\n\n ShadowSlot.prototype.renderFallbackContent = function renderFallbackContent(view, nodes, projectionSource, index) {\n if (this.contentView === null) {\n this.contentView = this.fallbackFactory.create(this.ownerView.container);\n this.contentView.bind(this.ownerView.bindingContext, this.ownerView.overrideContext);\n this.contentView.insertNodesBefore(this.anchor);\n }\n\n if (this.contentView.hasSlots) {\n var slots = this.contentView.slots;\n var projectFromAnchors = this.projectFromAnchors;\n\n if (projectFromAnchors !== null) {\n for (var slotName in slots) {\n var slot = slots[slotName];\n\n for (var i = 0, ii = projectFromAnchors.length; i < ii; ++i) {\n var anchor = projectFromAnchors[i];\n slot.projectFrom(anchor.auOwnerView, anchor.auSlotProjectFrom);\n }\n }\n }\n\n this.fallbackSlots = slots;\n ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index);\n }\n };\n\n ShadowSlot.prototype.created = function created(ownerView) {\n this.ownerView = ownerView;\n };\n\n ShadowSlot.prototype.bind = function bind(view) {\n if (this.contentView) {\n this.contentView.bind(view.bindingContext, view.overrideContext);\n }\n };\n\n ShadowSlot.prototype.attached = function attached() {\n if (this.contentView) {\n this.contentView.attached();\n }\n };\n\n ShadowSlot.prototype.detached = function detached() {\n if (this.contentView) {\n this.contentView.detached();\n }\n };\n\n ShadowSlot.prototype.unbind = function unbind() {\n if (this.contentView) {\n this.contentView.unbind();\n }\n };\n\n _createClass(ShadowSlot, [{\n key: 'needsFallbackRendering',\n get: function get() {\n return this.fallbackFactory && this.projections === 0;\n }\n }]);\n\n return ShadowSlot;\n}();\n\nvar ShadowDOM = (_temp4 = _class10 = function () {\n function ShadowDOM() {\n \n }\n\n ShadowDOM.getSlotName = function getSlotName(node) {\n if (node.auSlotAttribute === undefined) {\n return ShadowDOM.defaultSlotKey;\n }\n\n return node.auSlotAttribute.value;\n };\n\n ShadowDOM.distributeView = function distributeView(view, slots, projectionSource, index, destinationOverride) {\n var nodes = void 0;\n\n if (view === null) {\n nodes = noNodes;\n } else {\n var childNodes = view.fragment.childNodes;\n var ii = childNodes.length;\n nodes = new Array(ii);\n\n for (var i = 0; i < ii; ++i) {\n nodes[i] = childNodes[i];\n }\n }\n\n ShadowDOM.distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride);\n };\n\n ShadowDOM.undistributeView = function undistributeView(view, slots, projectionSource) {\n for (var slotName in slots) {\n slots[slotName].removeView(view, projectionSource);\n }\n };\n\n ShadowDOM.undistributeAll = function undistributeAll(slots, projectionSource) {\n for (var slotName in slots) {\n slots[slotName].removeAll(projectionSource);\n }\n };\n\n ShadowDOM.distributeNodes = function distributeNodes(view, nodes, slots, projectionSource, index, destinationOverride) {\n for (var i = 0, ii = nodes.length; i < ii; ++i) {\n var currentNode = nodes[i];\n var nodeType = currentNode.nodeType;\n\n if (currentNode.isContentProjectionSource) {\n currentNode.viewSlot.projectTo(slots);\n\n for (var slotName in slots) {\n slots[slotName].projectFrom(view, currentNode.viewSlot);\n }\n\n nodes.splice(i, 1);\n ii--;i--;\n } else if (nodeType === 1 || nodeType === 3 || currentNode.viewSlot instanceof PassThroughSlot) {\n if (nodeType === 3 && _isAllWhitespace(currentNode)) {\n nodes.splice(i, 1);\n ii--;i--;\n } else {\n var found = slots[destinationOverride || ShadowDOM.getSlotName(currentNode)];\n\n if (found) {\n found.addNode(view, currentNode, projectionSource, index);\n nodes.splice(i, 1);\n ii--;i--;\n }\n }\n } else {\n nodes.splice(i, 1);\n ii--;i--;\n }\n }\n\n for (var _slotName in slots) {\n var slot = slots[_slotName];\n\n if (slot.needsFallbackRendering) {\n slot.renderFallbackContent(view, nodes, projectionSource, index);\n }\n }\n };\n\n return ShadowDOM;\n}(), _class10.defaultSlotKey = '__au-default-slot-key__', _temp4);\n\nfunction register(lookup, name, resource, type) {\n if (!name) {\n return;\n }\n\n var existing = lookup[name];\n if (existing) {\n if (existing !== resource) {\n throw new Error('Attempted to register ' + type + ' when one with the same name already exists. Name: ' + name + '.');\n }\n\n return;\n }\n\n lookup[name] = resource;\n}\n\nfunction validateBehaviorName(name, type) {\n if (/[A-Z]/.test(name)) {\n var newName = _hyphenate(name);\n aurelia_logging__WEBPACK_IMPORTED_MODULE_0__[\"getLogger\"]('templating').warn('\\'' + name + '\\' is not a valid ' + type + ' name and has been converted to \\'' + newName + '\\'. Upper-case letters are not allowed because the DOM is not case-sensitive.');\n return newName;\n }\n return name;\n}\n\nvar conventionMark = '__au_resource__';\n\nvar ViewResources = function () {\n ViewResources.convention = function convention(target, existing) {\n var resource = void 0;\n\n if (existing && conventionMark in existing) {\n return existing;\n }\n if ('$resource' in target) {\n var config = target.$resource;\n\n if (typeof config === 'string') {\n resource = existing || new HtmlBehaviorResource();\n resource[conventionMark] = true;\n if (!resource.elementName) {\n resource.elementName = validateBehaviorName(config, 'custom element');\n }\n } else {\n if (typeof config === 'function') {\n config = config.call(target);\n }\n if (typeof config === 'string') {\n config = { name: config };\n }\n\n config = Object.assign({}, config);\n\n var resourceType = config.type || 'element';\n\n var _name = config.name;\n switch (resourceType) {\n case 'element':case 'attribute':\n resource = existing || new HtmlBehaviorResource();\n resource[conventionMark] = true;\n if (resourceType === 'element') {\n if (!resource.elementName) {\n resource.elementName = _name ? validateBehaviorName(_name, 'custom element') : _hyphenate(target.name);\n }\n } else {\n if (!resource.attributeName) {\n resource.attributeName = _name ? validateBehaviorName(_name, 'custom attribute') : _hyphenate(target.name);\n }\n }\n if ('templateController' in config) {\n config.liftsContent = config.templateController;\n delete config.templateController;\n }\n if ('defaultBindingMode' in config && resource.attributeDefaultBindingMode !== undefined) {\n config.attributeDefaultBindingMode = config.defaultBindingMode;\n delete config.defaultBindingMode;\n }\n\n delete config.name;\n\n Object.assign(resource, config);\n break;\n case 'valueConverter':\n resource = new aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"ValueConverterResource\"](Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"camelCase\"])(_name || target.name));\n break;\n case 'bindingBehavior':\n resource = new aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"BindingBehaviorResource\"](Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"camelCase\"])(_name || target.name));\n break;\n case 'viewEngineHooks':\n resource = new ViewEngineHooksResource();\n break;\n }\n }\n\n if (resource instanceof HtmlBehaviorResource) {\n var _bindables = typeof config === 'string' ? undefined : config.bindables;\n var currentProps = resource.properties;\n if (Array.isArray(_bindables)) {\n for (var i = 0, ii = _bindables.length; ii > i; ++i) {\n var prop = _bindables[i];\n if (!prop || typeof prop !== 'string' && !prop.name) {\n throw new Error('Invalid bindable property at \"' + i + '\" for class \"' + target.name + '\". Expected either a string or an object with \"name\" property.');\n }\n var newProp = new BindableProperty(prop);\n\n var existed = false;\n for (var j = 0, jj = currentProps.length; jj > j; ++j) {\n if (currentProps[j].name === newProp.name) {\n existed = true;\n break;\n }\n }\n if (existed) {\n continue;\n }\n newProp.registerWith(target, resource);\n }\n }\n }\n }\n return resource;\n };\n\n function ViewResources(parent, viewUrl) {\n \n\n this.bindingLanguage = null;\n\n this.parent = parent || null;\n this.hasParent = this.parent !== null;\n this.viewUrl = viewUrl || '';\n this.lookupFunctions = {\n valueConverters: this.getValueConverter.bind(this),\n bindingBehaviors: this.getBindingBehavior.bind(this)\n };\n this.attributes = Object.create(null);\n this.elements = Object.create(null);\n this.valueConverters = Object.create(null);\n this.bindingBehaviors = Object.create(null);\n this.attributeMap = Object.create(null);\n this.values = Object.create(null);\n this.beforeCompile = this.afterCompile = this.beforeCreate = this.afterCreate = this.beforeBind = this.beforeUnbind = false;\n }\n\n ViewResources.prototype._tryAddHook = function _tryAddHook(obj, name) {\n if (typeof obj[name] === 'function') {\n var func = obj[name].bind(obj);\n var counter = 1;\n var callbackName = void 0;\n\n while (this[callbackName = name + counter.toString()] !== undefined) {\n counter++;\n }\n\n this[name] = true;\n this[callbackName] = func;\n }\n };\n\n ViewResources.prototype._invokeHook = function _invokeHook(name, one, two, three, four) {\n if (this.hasParent) {\n this.parent._invokeHook(name, one, two, three, four);\n }\n\n if (this[name]) {\n this[name + '1'](one, two, three, four);\n\n var callbackName = name + '2';\n if (this[callbackName]) {\n this[callbackName](one, two, three, four);\n\n callbackName = name + '3';\n if (this[callbackName]) {\n this[callbackName](one, two, three, four);\n\n var counter = 4;\n\n while (this[callbackName = name + counter.toString()] !== undefined) {\n this[callbackName](one, two, three, four);\n counter++;\n }\n }\n }\n }\n };\n\n ViewResources.prototype.registerViewEngineHooks = function registerViewEngineHooks(hooks) {\n this._tryAddHook(hooks, 'beforeCompile');\n this._tryAddHook(hooks, 'afterCompile');\n this._tryAddHook(hooks, 'beforeCreate');\n this._tryAddHook(hooks, 'afterCreate');\n this._tryAddHook(hooks, 'beforeBind');\n this._tryAddHook(hooks, 'beforeUnbind');\n };\n\n ViewResources.prototype.getBindingLanguage = function getBindingLanguage(bindingLanguageFallback) {\n return this.bindingLanguage || (this.bindingLanguage = bindingLanguageFallback);\n };\n\n ViewResources.prototype.patchInParent = function patchInParent(newParent) {\n var originalParent = this.parent;\n\n this.parent = newParent || null;\n this.hasParent = this.parent !== null;\n\n if (newParent.parent === null) {\n newParent.parent = originalParent;\n newParent.hasParent = originalParent !== null;\n }\n };\n\n ViewResources.prototype.relativeToView = function relativeToView(path) {\n return Object(aurelia_path__WEBPACK_IMPORTED_MODULE_4__[\"relativeToFile\"])(path, this.viewUrl);\n };\n\n ViewResources.prototype.registerElement = function registerElement(tagName, behavior) {\n register(this.elements, tagName, behavior, 'an Element');\n };\n\n ViewResources.prototype.getElement = function getElement(tagName) {\n return this.elements[tagName] || (this.hasParent ? this.parent.getElement(tagName) : null);\n };\n\n ViewResources.prototype.mapAttribute = function mapAttribute(attribute) {\n return this.attributeMap[attribute] || (this.hasParent ? this.parent.mapAttribute(attribute) : null);\n };\n\n ViewResources.prototype.registerAttribute = function registerAttribute(attribute, behavior, knownAttribute) {\n this.attributeMap[attribute] = knownAttribute;\n register(this.attributes, attribute, behavior, 'an Attribute');\n };\n\n ViewResources.prototype.getAttribute = function getAttribute(attribute) {\n return this.attributes[attribute] || (this.hasParent ? this.parent.getAttribute(attribute) : null);\n };\n\n ViewResources.prototype.registerValueConverter = function registerValueConverter(name, valueConverter) {\n register(this.valueConverters, name, valueConverter, 'a ValueConverter');\n };\n\n ViewResources.prototype.getValueConverter = function getValueConverter(name) {\n return this.valueConverters[name] || (this.hasParent ? this.parent.getValueConverter(name) : null);\n };\n\n ViewResources.prototype.registerBindingBehavior = function registerBindingBehavior(name, bindingBehavior) {\n register(this.bindingBehaviors, name, bindingBehavior, 'a BindingBehavior');\n };\n\n ViewResources.prototype.getBindingBehavior = function getBindingBehavior(name) {\n return this.bindingBehaviors[name] || (this.hasParent ? this.parent.getBindingBehavior(name) : null);\n };\n\n ViewResources.prototype.registerValue = function registerValue(name, value) {\n register(this.values, name, value, 'a value');\n };\n\n ViewResources.prototype.getValue = function getValue(name) {\n return this.values[name] || (this.hasParent ? this.parent.getValue(name) : null);\n };\n\n ViewResources.prototype.autoRegister = function autoRegister(container, impl) {\n var resourceTypeMeta = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, impl);\n if (resourceTypeMeta) {\n if (resourceTypeMeta instanceof HtmlBehaviorResource) {\n ViewResources.convention(impl, resourceTypeMeta);\n\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\n HtmlBehaviorResource.convention(impl.name, resourceTypeMeta);\n }\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\n resourceTypeMeta.elementName = _hyphenate(impl.name);\n }\n }\n } else {\n resourceTypeMeta = ViewResources.convention(impl) || HtmlBehaviorResource.convention(impl.name) || aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"ValueConverterResource\"].convention(impl.name) || aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"BindingBehaviorResource\"].convention(impl.name) || ViewEngineHooksResource.convention(impl.name);\n if (!resourceTypeMeta) {\n resourceTypeMeta = new HtmlBehaviorResource();\n resourceTypeMeta.elementName = _hyphenate(impl.name);\n }\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, resourceTypeMeta, impl);\n }\n resourceTypeMeta.initialize(container, impl);\n resourceTypeMeta.register(this);\n return resourceTypeMeta;\n };\n\n return ViewResources;\n}();\n\nvar View = function () {\n function View(container, viewFactory, fragment, controllers, bindings, children, slots) {\n \n\n this.container = container;\n this.viewFactory = viewFactory;\n this.resources = viewFactory.resources;\n this.fragment = fragment;\n this.firstChild = fragment.firstChild;\n this.lastChild = fragment.lastChild;\n this.controllers = controllers;\n this.bindings = bindings;\n this.children = children;\n this.slots = slots;\n this.hasSlots = false;\n this.fromCache = false;\n this.isBound = false;\n this.isAttached = false;\n this.bindingContext = null;\n this.overrideContext = null;\n this.controller = null;\n this.viewModelScope = null;\n this.animatableElement = undefined;\n this._isUserControlled = false;\n this.contentView = null;\n\n for (var _key3 in slots) {\n this.hasSlots = true;\n break;\n }\n }\n\n View.prototype.returnToCache = function returnToCache() {\n this.viewFactory.returnViewToCache(this);\n };\n\n View.prototype.created = function created() {\n var i = void 0;\n var ii = void 0;\n var controllers = this.controllers;\n\n for (i = 0, ii = controllers.length; i < ii; ++i) {\n controllers[i].created(this);\n }\n };\n\n View.prototype.bind = function bind(bindingContext, overrideContext, _systemUpdate) {\n var controllers = void 0;\n var bindings = void 0;\n var children = void 0;\n var i = void 0;\n var ii = void 0;\n\n if (_systemUpdate && this._isUserControlled) {\n return;\n }\n\n if (this.isBound) {\n if (this.bindingContext === bindingContext) {\n return;\n }\n\n this.unbind();\n }\n\n this.isBound = true;\n this.bindingContext = bindingContext;\n this.overrideContext = overrideContext || Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"createOverrideContext\"])(bindingContext);\n\n this.resources._invokeHook('beforeBind', this);\n\n bindings = this.bindings;\n for (i = 0, ii = bindings.length; i < ii; ++i) {\n bindings[i].bind(this);\n }\n\n if (this.viewModelScope !== null) {\n bindingContext.bind(this.viewModelScope.bindingContext, this.viewModelScope.overrideContext);\n this.viewModelScope = null;\n }\n\n controllers = this.controllers;\n for (i = 0, ii = controllers.length; i < ii; ++i) {\n controllers[i].bind(this);\n }\n\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n children[i].bind(bindingContext, overrideContext, true);\n }\n\n if (this.hasSlots) {\n ShadowDOM.distributeView(this.contentView, this.slots);\n }\n };\n\n View.prototype.addBinding = function addBinding(binding) {\n this.bindings.push(binding);\n\n if (this.isBound) {\n binding.bind(this);\n }\n };\n\n View.prototype.unbind = function unbind() {\n var controllers = void 0;\n var bindings = void 0;\n var children = void 0;\n var i = void 0;\n var ii = void 0;\n\n if (this.isBound) {\n this.isBound = false;\n this.resources._invokeHook('beforeUnbind', this);\n\n if (this.controller !== null) {\n this.controller.unbind();\n }\n\n bindings = this.bindings;\n for (i = 0, ii = bindings.length; i < ii; ++i) {\n bindings[i].unbind();\n }\n\n controllers = this.controllers;\n for (i = 0, ii = controllers.length; i < ii; ++i) {\n controllers[i].unbind();\n }\n\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n children[i].unbind();\n }\n\n this.bindingContext = null;\n this.overrideContext = null;\n }\n };\n\n View.prototype.insertNodesBefore = function insertNodesBefore(refNode) {\n refNode.parentNode.insertBefore(this.fragment, refNode);\n };\n\n View.prototype.appendNodesTo = function appendNodesTo(parent) {\n parent.appendChild(this.fragment);\n };\n\n View.prototype.removeNodes = function removeNodes() {\n var fragment = this.fragment;\n var current = this.firstChild;\n var end = this.lastChild;\n var next = void 0;\n\n while (current) {\n next = current.nextSibling;\n fragment.appendChild(current);\n\n if (current === end) {\n break;\n }\n\n current = next;\n }\n };\n\n View.prototype.attached = function attached() {\n var controllers = void 0;\n var children = void 0;\n var i = void 0;\n var ii = void 0;\n\n if (this.isAttached) {\n return;\n }\n\n this.isAttached = true;\n\n if (this.controller !== null) {\n this.controller.attached();\n }\n\n controllers = this.controllers;\n for (i = 0, ii = controllers.length; i < ii; ++i) {\n controllers[i].attached();\n }\n\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n children[i].attached();\n }\n };\n\n View.prototype.detached = function detached() {\n var controllers = void 0;\n var children = void 0;\n var i = void 0;\n var ii = void 0;\n\n if (this.isAttached) {\n this.isAttached = false;\n\n if (this.controller !== null) {\n this.controller.detached();\n }\n\n controllers = this.controllers;\n for (i = 0, ii = controllers.length; i < ii; ++i) {\n controllers[i].detached();\n }\n\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n children[i].detached();\n }\n }\n };\n\n return View;\n}();\n\nfunction getAnimatableElement(view) {\n if (view.animatableElement !== undefined) {\n return view.animatableElement;\n }\n\n var current = view.firstChild;\n\n while (current && current.nodeType !== 1) {\n current = current.nextSibling;\n }\n\n if (current && current.nodeType === 1) {\n return view.animatableElement = current.classList.contains('au-animate') ? current : null;\n }\n\n return view.animatableElement = null;\n}\n\nvar ViewSlot = function () {\n function ViewSlot(anchor, anchorIsContainer) {\n var animator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Animator.instance;\n\n \n\n this.anchor = anchor;\n this.anchorIsContainer = anchorIsContainer;\n this.bindingContext = null;\n this.overrideContext = null;\n this.animator = animator;\n this.children = [];\n this.isBound = false;\n this.isAttached = false;\n this.contentSelectors = null;\n anchor.viewSlot = this;\n anchor.isContentProjectionSource = false;\n }\n\n ViewSlot.prototype.animateView = function animateView(view) {\n var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'enter';\n\n var animatableElement = getAnimatableElement(view);\n\n if (animatableElement !== null) {\n switch (direction) {\n case 'enter':\n return this.animator.enter(animatableElement);\n case 'leave':\n return this.animator.leave(animatableElement);\n default:\n throw new Error('Invalid animation direction: ' + direction);\n }\n }\n };\n\n ViewSlot.prototype.transformChildNodesIntoView = function transformChildNodesIntoView() {\n var parent = this.anchor;\n\n this.children.push({\n fragment: parent,\n firstChild: parent.firstChild,\n lastChild: parent.lastChild,\n returnToCache: function returnToCache() {},\n removeNodes: function removeNodes() {\n var last = void 0;\n\n while (last = parent.lastChild) {\n parent.removeChild(last);\n }\n },\n created: function created() {},\n bind: function bind() {},\n unbind: function unbind() {},\n attached: function attached() {},\n detached: function detached() {}\n });\n };\n\n ViewSlot.prototype.bind = function bind(bindingContext, overrideContext) {\n var i = void 0;\n var ii = void 0;\n var children = void 0;\n\n if (this.isBound) {\n if (this.bindingContext === bindingContext) {\n return;\n }\n\n this.unbind();\n }\n\n this.isBound = true;\n this.bindingContext = bindingContext = bindingContext || this.bindingContext;\n this.overrideContext = overrideContext = overrideContext || this.overrideContext;\n\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n children[i].bind(bindingContext, overrideContext, true);\n }\n };\n\n ViewSlot.prototype.unbind = function unbind() {\n if (this.isBound) {\n var i = void 0;\n var ii = void 0;\n var _children4 = this.children;\n\n this.isBound = false;\n this.bindingContext = null;\n this.overrideContext = null;\n\n for (i = 0, ii = _children4.length; i < ii; ++i) {\n _children4[i].unbind();\n }\n }\n };\n\n ViewSlot.prototype.add = function add(view) {\n if (this.anchorIsContainer) {\n view.appendNodesTo(this.anchor);\n } else {\n view.insertNodesBefore(this.anchor);\n }\n\n this.children.push(view);\n\n if (this.isAttached) {\n view.attached();\n return this.animateView(view, 'enter');\n }\n };\n\n ViewSlot.prototype.insert = function insert(index, view) {\n var children = this.children;\n var length = children.length;\n\n if (index === 0 && length === 0 || index >= length) {\n return this.add(view);\n }\n\n view.insertNodesBefore(children[index].firstChild);\n children.splice(index, 0, view);\n\n if (this.isAttached) {\n view.attached();\n return this.animateView(view, 'enter');\n }\n };\n\n ViewSlot.prototype.move = function move(sourceIndex, targetIndex) {\n if (sourceIndex === targetIndex) {\n return;\n }\n\n var children = this.children;\n var view = children[sourceIndex];\n\n view.removeNodes();\n view.insertNodesBefore(children[targetIndex].firstChild);\n children.splice(sourceIndex, 1);\n children.splice(targetIndex, 0, view);\n };\n\n ViewSlot.prototype.remove = function remove(view, returnToCache, skipAnimation) {\n return this.removeAt(this.children.indexOf(view), returnToCache, skipAnimation);\n };\n\n ViewSlot.prototype.removeMany = function removeMany(viewsToRemove, returnToCache, skipAnimation) {\n var _this3 = this;\n\n var children = this.children;\n var ii = viewsToRemove.length;\n var i = void 0;\n var rmPromises = [];\n\n viewsToRemove.forEach(function (child) {\n if (skipAnimation) {\n child.removeNodes();\n return;\n }\n\n var animation = _this3.animateView(child, 'leave');\n if (animation) {\n rmPromises.push(animation.then(function () {\n return child.removeNodes();\n }));\n } else {\n child.removeNodes();\n }\n });\n\n var removeAction = function removeAction() {\n if (_this3.isAttached) {\n for (i = 0; i < ii; ++i) {\n viewsToRemove[i].detached();\n }\n }\n\n if (returnToCache) {\n for (i = 0; i < ii; ++i) {\n viewsToRemove[i].returnToCache();\n }\n }\n\n for (i = 0; i < ii; ++i) {\n var index = children.indexOf(viewsToRemove[i]);\n if (index >= 0) {\n children.splice(index, 1);\n }\n }\n };\n\n if (rmPromises.length > 0) {\n return Promise.all(rmPromises).then(function () {\n return removeAction();\n });\n }\n\n return removeAction();\n };\n\n ViewSlot.prototype.removeAt = function removeAt(index, returnToCache, skipAnimation) {\n var _this4 = this;\n\n var view = this.children[index];\n\n var removeAction = function removeAction() {\n index = _this4.children.indexOf(view);\n view.removeNodes();\n _this4.children.splice(index, 1);\n\n if (_this4.isAttached) {\n view.detached();\n }\n\n if (returnToCache) {\n view.returnToCache();\n }\n\n return view;\n };\n\n if (!skipAnimation) {\n var animation = this.animateView(view, 'leave');\n if (animation) {\n return animation.then(function () {\n return removeAction();\n });\n }\n }\n\n return removeAction();\n };\n\n ViewSlot.prototype.removeAll = function removeAll(returnToCache, skipAnimation) {\n var _this5 = this;\n\n var children = this.children;\n var ii = children.length;\n var i = void 0;\n var rmPromises = [];\n\n children.forEach(function (child) {\n if (skipAnimation) {\n child.removeNodes();\n return;\n }\n\n var animation = _this5.animateView(child, 'leave');\n if (animation) {\n rmPromises.push(animation.then(function () {\n return child.removeNodes();\n }));\n } else {\n child.removeNodes();\n }\n });\n\n var removeAction = function removeAction() {\n if (_this5.isAttached) {\n for (i = 0; i < ii; ++i) {\n children[i].detached();\n }\n }\n\n if (returnToCache) {\n for (i = 0; i < ii; ++i) {\n var _child3 = children[i];\n\n if (_child3) {\n _child3.returnToCache();\n }\n }\n }\n\n _this5.children = [];\n };\n\n if (rmPromises.length > 0) {\n return Promise.all(rmPromises).then(function () {\n return removeAction();\n });\n }\n\n return removeAction();\n };\n\n ViewSlot.prototype.attached = function attached() {\n var i = void 0;\n var ii = void 0;\n var children = void 0;\n var child = void 0;\n\n if (this.isAttached) {\n return;\n }\n\n this.isAttached = true;\n\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n child = children[i];\n child.attached();\n this.animateView(child, 'enter');\n }\n };\n\n ViewSlot.prototype.detached = function detached() {\n var i = void 0;\n var ii = void 0;\n var children = void 0;\n\n if (this.isAttached) {\n this.isAttached = false;\n children = this.children;\n for (i = 0, ii = children.length; i < ii; ++i) {\n children[i].detached();\n }\n }\n };\n\n ViewSlot.prototype.projectTo = function projectTo(slots) {\n var _this6 = this;\n\n this.projectToSlots = slots;\n this.add = this._projectionAdd;\n this.insert = this._projectionInsert;\n this.move = this._projectionMove;\n this.remove = this._projectionRemove;\n this.removeAt = this._projectionRemoveAt;\n this.removeMany = this._projectionRemoveMany;\n this.removeAll = this._projectionRemoveAll;\n this.children.forEach(function (view) {\n return ShadowDOM.distributeView(view, slots, _this6);\n });\n };\n\n ViewSlot.prototype._projectionAdd = function _projectionAdd(view) {\n ShadowDOM.distributeView(view, this.projectToSlots, this);\n\n this.children.push(view);\n\n if (this.isAttached) {\n view.attached();\n }\n };\n\n ViewSlot.prototype._projectionInsert = function _projectionInsert(index, view) {\n if (index === 0 && !this.children.length || index >= this.children.length) {\n this.add(view);\n } else {\n ShadowDOM.distributeView(view, this.projectToSlots, this, index);\n\n this.children.splice(index, 0, view);\n\n if (this.isAttached) {\n view.attached();\n }\n }\n };\n\n ViewSlot.prototype._projectionMove = function _projectionMove(sourceIndex, targetIndex) {\n if (sourceIndex === targetIndex) {\n return;\n }\n\n var children = this.children;\n var view = children[sourceIndex];\n\n ShadowDOM.undistributeView(view, this.projectToSlots, this);\n ShadowDOM.distributeView(view, this.projectToSlots, this, targetIndex);\n\n children.splice(sourceIndex, 1);\n children.splice(targetIndex, 0, view);\n };\n\n ViewSlot.prototype._projectionRemove = function _projectionRemove(view, returnToCache) {\n ShadowDOM.undistributeView(view, this.projectToSlots, this);\n this.children.splice(this.children.indexOf(view), 1);\n\n if (this.isAttached) {\n view.detached();\n }\n if (returnToCache) {\n view.returnToCache();\n }\n };\n\n ViewSlot.prototype._projectionRemoveAt = function _projectionRemoveAt(index, returnToCache) {\n var view = this.children[index];\n\n ShadowDOM.undistributeView(view, this.projectToSlots, this);\n this.children.splice(index, 1);\n\n if (this.isAttached) {\n view.detached();\n }\n if (returnToCache) {\n view.returnToCache();\n }\n };\n\n ViewSlot.prototype._projectionRemoveMany = function _projectionRemoveMany(viewsToRemove, returnToCache) {\n var _this7 = this;\n\n viewsToRemove.forEach(function (view) {\n return _this7.remove(view, returnToCache);\n });\n };\n\n ViewSlot.prototype._projectionRemoveAll = function _projectionRemoveAll(returnToCache) {\n ShadowDOM.undistributeAll(this.projectToSlots, this);\n\n var children = this.children;\n var ii = children.length;\n\n for (var i = 0; i < ii; ++i) {\n if (returnToCache) {\n children[i].returnToCache();\n } else if (this.isAttached) {\n children[i].detached();\n }\n }\n\n this.children = [];\n };\n\n return ViewSlot;\n}();\n\nvar ProviderResolver = Object(aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"resolver\"])(_class12 = function () {\n function ProviderResolver() {\n \n }\n\n ProviderResolver.prototype.get = function get(container, key) {\n var id = key.__providerId__;\n return id in container ? container[id] : container[id] = container.invoke(key);\n };\n\n return ProviderResolver;\n}()) || _class12;\n\nvar providerResolverInstance = new ProviderResolver();\n\nfunction elementContainerGet(key) {\n if (key === aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].Element) {\n return this.element;\n }\n\n if (key === BoundViewFactory) {\n if (this.boundViewFactory) {\n return this.boundViewFactory;\n }\n\n var factory = this.instruction.viewFactory;\n var _partReplacements = this.partReplacements;\n\n if (_partReplacements) {\n factory = _partReplacements[factory.part] || factory;\n }\n\n this.boundViewFactory = new BoundViewFactory(this, factory, _partReplacements);\n return this.boundViewFactory;\n }\n\n if (key === ViewSlot) {\n if (this.viewSlot === undefined) {\n this.viewSlot = new ViewSlot(this.element, this.instruction.anchorIsContainer);\n this.element.isContentProjectionSource = this.instruction.lifting;\n this.children.push(this.viewSlot);\n }\n\n return this.viewSlot;\n }\n\n if (key === ElementEvents) {\n return this.elementEvents || (this.elementEvents = new ElementEvents(this.element));\n }\n\n if (key === CompositionTransaction) {\n return this.compositionTransaction || (this.compositionTransaction = this.parent.get(key));\n }\n\n if (key === ViewResources) {\n return this.viewResources;\n }\n\n if (key === TargetInstruction) {\n return this.instruction;\n }\n\n return this.superGet(key);\n}\n\nfunction createElementContainer(parent, element, instruction, children, partReplacements, resources) {\n var container = parent.createChild();\n var providers = void 0;\n var i = void 0;\n\n container.element = element;\n container.instruction = instruction;\n container.children = children;\n container.viewResources = resources;\n container.partReplacements = partReplacements;\n\n providers = instruction.providers;\n i = providers.length;\n\n while (i--) {\n container._resolvers.set(providers[i], providerResolverInstance);\n }\n\n container.superGet = container.get;\n container.get = elementContainerGet;\n\n return container;\n}\n\nfunction hasAttribute(name) {\n return this._element.hasAttribute(name);\n}\n\nfunction getAttribute(name) {\n return this._element.getAttribute(name);\n}\n\nfunction setAttribute(name, value) {\n this._element.setAttribute(name, value);\n}\n\nfunction makeElementIntoAnchor(element, elementInstruction) {\n var anchor = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createComment('anchor');\n\n if (elementInstruction) {\n var firstChild = element.firstChild;\n\n if (firstChild && firstChild.tagName === 'AU-CONTENT') {\n anchor.contentElement = firstChild;\n }\n\n anchor._element = element;\n\n anchor.hasAttribute = hasAttribute;\n anchor.getAttribute = getAttribute;\n anchor.setAttribute = setAttribute;\n }\n\n aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].replaceNode(anchor, element);\n\n return anchor;\n}\n\nfunction applyInstructions(containers, element, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources) {\n var behaviorInstructions = instruction.behaviorInstructions;\n var expressions = instruction.expressions;\n var elementContainer = void 0;\n var i = void 0;\n var ii = void 0;\n var current = void 0;\n var instance = void 0;\n\n if (instruction.contentExpression) {\n bindings.push(instruction.contentExpression.createBinding(element.nextSibling));\n element.nextSibling.auInterpolationTarget = true;\n element.parentNode.removeChild(element);\n return;\n }\n\n if (instruction.shadowSlot) {\n var commentAnchor = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createComment('slot');\n var slot = void 0;\n\n if (instruction.slotDestination) {\n slot = new PassThroughSlot(commentAnchor, instruction.slotName, instruction.slotDestination, instruction.slotFallbackFactory);\n } else {\n slot = new ShadowSlot(commentAnchor, instruction.slotName, instruction.slotFallbackFactory);\n }\n\n aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].replaceNode(commentAnchor, element);\n shadowSlots[instruction.slotName] = slot;\n controllers.push(slot);\n return;\n }\n\n if (instruction.letElement) {\n for (i = 0, ii = expressions.length; i < ii; ++i) {\n bindings.push(expressions[i].createBinding());\n }\n element.parentNode.removeChild(element);\n return;\n }\n\n if (behaviorInstructions.length) {\n if (!instruction.anchorIsContainer) {\n element = makeElementIntoAnchor(element, instruction.elementInstruction);\n }\n\n containers[instruction.injectorId] = elementContainer = createElementContainer(containers[instruction.parentInjectorId], element, instruction, children, partReplacements, resources);\n\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\n current = behaviorInstructions[i];\n instance = current.type.create(elementContainer, current, element, bindings);\n controllers.push(instance);\n }\n }\n\n for (i = 0, ii = expressions.length; i < ii; ++i) {\n bindings.push(expressions[i].createBinding(element));\n }\n}\n\nfunction styleStringToObject(style, target) {\n var attributes = style.split(';');\n var firstIndexOfColon = void 0;\n var i = void 0;\n var current = void 0;\n var key = void 0;\n var value = void 0;\n\n target = target || {};\n\n for (i = 0; i < attributes.length; i++) {\n current = attributes[i];\n firstIndexOfColon = current.indexOf(':');\n key = current.substring(0, firstIndexOfColon).trim();\n value = current.substring(firstIndexOfColon + 1).trim();\n target[key] = value;\n }\n\n return target;\n}\n\nfunction styleObjectToString(obj) {\n var result = '';\n\n for (var _key4 in obj) {\n result += _key4 + ':' + obj[_key4] + ';';\n }\n\n return result;\n}\n\nfunction applySurrogateInstruction(container, element, instruction, controllers, bindings, children) {\n var behaviorInstructions = instruction.behaviorInstructions;\n var expressions = instruction.expressions;\n var providers = instruction.providers;\n var values = instruction.values;\n var i = void 0;\n var ii = void 0;\n var current = void 0;\n var instance = void 0;\n var currentAttributeValue = void 0;\n\n i = providers.length;\n while (i--) {\n container._resolvers.set(providers[i], providerResolverInstance);\n }\n\n for (var _key5 in values) {\n currentAttributeValue = element.getAttribute(_key5);\n\n if (currentAttributeValue) {\n if (_key5 === 'class') {\n element.setAttribute('class', currentAttributeValue + ' ' + values[_key5]);\n } else if (_key5 === 'style') {\n var styleObject = styleStringToObject(values[_key5]);\n styleStringToObject(currentAttributeValue, styleObject);\n element.setAttribute('style', styleObjectToString(styleObject));\n }\n } else {\n element.setAttribute(_key5, values[_key5]);\n }\n }\n\n if (behaviorInstructions.length) {\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\n current = behaviorInstructions[i];\n instance = current.type.create(container, current, element, bindings);\n\n if (instance.contentView) {\n children.push(instance.contentView);\n }\n\n controllers.push(instance);\n }\n }\n\n for (i = 0, ii = expressions.length; i < ii; ++i) {\n bindings.push(expressions[i].createBinding(element));\n }\n}\n\nvar BoundViewFactory = function () {\n function BoundViewFactory(parentContainer, viewFactory, partReplacements) {\n \n\n this.parentContainer = parentContainer;\n this.viewFactory = viewFactory;\n this.factoryCreateInstruction = { partReplacements: partReplacements };\n }\n\n BoundViewFactory.prototype.create = function create() {\n var view = this.viewFactory.create(this.parentContainer.createChild(), this.factoryCreateInstruction);\n view._isUserControlled = true;\n return view;\n };\n\n BoundViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {\n this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);\n };\n\n BoundViewFactory.prototype.getCachedView = function getCachedView() {\n return this.viewFactory.getCachedView();\n };\n\n BoundViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {\n this.viewFactory.returnViewToCache(view);\n };\n\n _createClass(BoundViewFactory, [{\n key: 'isCaching',\n get: function get() {\n return this.viewFactory.isCaching;\n }\n }]);\n\n return BoundViewFactory;\n}();\n\nvar ViewFactory = function () {\n function ViewFactory(template, instructions, resources) {\n \n\n this.isCaching = false;\n\n this.template = template;\n this.instructions = instructions;\n this.resources = resources;\n this.cacheSize = -1;\n this.cache = null;\n }\n\n ViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {\n if (size) {\n if (size === '*') {\n size = Number.MAX_VALUE;\n } else if (typeof size === 'string') {\n size = parseInt(size, 10);\n }\n }\n\n if (this.cacheSize === -1 || !doNotOverrideIfAlreadySet) {\n this.cacheSize = size;\n }\n\n if (this.cacheSize > 0) {\n this.cache = [];\n } else {\n this.cache = null;\n }\n\n this.isCaching = this.cacheSize > 0;\n };\n\n ViewFactory.prototype.getCachedView = function getCachedView() {\n return this.cache !== null ? this.cache.pop() || null : null;\n };\n\n ViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {\n if (view.isAttached) {\n view.detached();\n }\n\n if (view.isBound) {\n view.unbind();\n }\n\n if (this.cache !== null && this.cache.length < this.cacheSize) {\n view.fromCache = true;\n this.cache.push(view);\n }\n };\n\n ViewFactory.prototype.create = function create(container, createInstruction, element) {\n createInstruction = createInstruction || BehaviorInstruction.normal;\n\n var cachedView = this.getCachedView();\n if (cachedView !== null) {\n return cachedView;\n }\n\n var fragment = createInstruction.enhance ? this.template : this.template.cloneNode(true);\n var instructables = fragment.querySelectorAll('.au-target');\n var instructions = this.instructions;\n var resources = this.resources;\n var controllers = [];\n var bindings = [];\n var children = [];\n var shadowSlots = Object.create(null);\n var containers = { root: container };\n var partReplacements = createInstruction.partReplacements;\n var i = void 0;\n var ii = void 0;\n var view = void 0;\n var instructable = void 0;\n var instruction = void 0;\n\n this.resources._invokeHook('beforeCreate', this, container, fragment, createInstruction);\n\n if (element && this.surrogateInstruction !== null) {\n applySurrogateInstruction(container, element, this.surrogateInstruction, controllers, bindings, children);\n }\n\n if (createInstruction.enhance && fragment.hasAttribute('au-target-id')) {\n instructable = fragment;\n instruction = instructions[instructable.getAttribute('au-target-id')];\n applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);\n }\n\n for (i = 0, ii = instructables.length; i < ii; ++i) {\n instructable = instructables[i];\n instruction = instructions[instructable.getAttribute('au-target-id')];\n applyInstructions(containers, instructable, instruction, controllers, bindings, children, shadowSlots, partReplacements, resources);\n }\n\n view = new View(container, this, fragment, controllers, bindings, children, shadowSlots);\n\n if (!createInstruction.initiatedByBehavior) {\n view.created();\n }\n\n this.resources._invokeHook('afterCreate', view);\n\n return view;\n };\n\n return ViewFactory;\n}();\n\nvar nextInjectorId = 0;\nfunction getNextInjectorId() {\n return ++nextInjectorId;\n}\n\nvar lastAUTargetID = 0;\nfunction getNextAUTargetID() {\n return (++lastAUTargetID).toString();\n}\n\nfunction makeIntoInstructionTarget(element) {\n var value = element.getAttribute('class');\n var auTargetID = getNextAUTargetID();\n\n element.setAttribute('class', value ? value + ' au-target' : 'au-target');\n element.setAttribute('au-target-id', auTargetID);\n\n return auTargetID;\n}\n\nfunction makeShadowSlot(compiler, resources, node, instructions, parentInjectorId) {\n var auShadowSlot = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createElement('au-shadow-slot');\n aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].replaceNode(auShadowSlot, node);\n\n var auTargetID = makeIntoInstructionTarget(auShadowSlot);\n var instruction = TargetInstruction.shadowSlot(parentInjectorId);\n\n instruction.slotName = node.getAttribute('name') || ShadowDOM.defaultSlotKey;\n instruction.slotDestination = node.getAttribute('slot');\n\n if (node.innerHTML.trim()) {\n var fragment = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createDocumentFragment();\n var _child4 = void 0;\n\n while (_child4 = node.firstChild) {\n fragment.appendChild(_child4);\n }\n\n instruction.slotFallbackFactory = compiler.compile(fragment, resources);\n }\n\n instructions[auTargetID] = instruction;\n\n return auShadowSlot;\n}\n\nvar defaultLetHandler = BindingLanguage.prototype.createLetExpressions;\n\nvar ViewCompiler = function () {\n ViewCompiler.inject = function inject() {\n return [BindingLanguage, ViewResources];\n };\n\n function ViewCompiler(bindingLanguage, resources) {\n \n\n this.bindingLanguage = bindingLanguage;\n this.resources = resources;\n }\n\n ViewCompiler.prototype.compile = function compile(source, resources, compileInstruction) {\n resources = resources || this.resources;\n compileInstruction = compileInstruction || ViewCompileInstruction.normal;\n source = typeof source === 'string' ? aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createTemplateFromMarkup(source) : source;\n\n var content = void 0;\n var part = void 0;\n var cacheSize = void 0;\n\n if (source.content) {\n part = source.getAttribute('part');\n cacheSize = source.getAttribute('view-cache');\n content = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].adoptNode(source.content);\n } else {\n content = source;\n }\n\n compileInstruction.targetShadowDOM = compileInstruction.targetShadowDOM && aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"FEATURE\"].shadowDOM;\n resources._invokeHook('beforeCompile', content, resources, compileInstruction);\n\n var instructions = {};\n this._compileNode(content, resources, instructions, source, 'root', !compileInstruction.targetShadowDOM);\n\n var firstChild = content.firstChild;\n if (firstChild && firstChild.nodeType === 1) {\n var targetId = firstChild.getAttribute('au-target-id');\n if (targetId) {\n var ins = instructions[targetId];\n\n if (ins.shadowSlot || ins.lifting || ins.elementInstruction && !ins.elementInstruction.anchorIsContainer) {\n content.insertBefore(aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createComment('view'), firstChild);\n }\n }\n }\n\n var factory = new ViewFactory(content, instructions, resources);\n\n factory.surrogateInstruction = compileInstruction.compileSurrogate ? this._compileSurrogate(source, resources) : null;\n factory.part = part;\n\n if (cacheSize) {\n factory.setCacheSize(cacheSize);\n }\n\n resources._invokeHook('afterCompile', factory);\n\n return factory;\n };\n\n ViewCompiler.prototype._compileNode = function _compileNode(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {\n switch (node.nodeType) {\n case 1:\n return this._compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM);\n case 3:\n var expression = resources.getBindingLanguage(this.bindingLanguage).inspectTextContent(resources, node.wholeText);\n if (expression) {\n var marker = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createElement('au-marker');\n var auTargetID = makeIntoInstructionTarget(marker);\n (node.parentNode || parentNode).insertBefore(marker, node);\n node.textContent = ' ';\n instructions[auTargetID] = TargetInstruction.contentExpression(expression);\n\n while (node.nextSibling && node.nextSibling.nodeType === 3) {\n (node.parentNode || parentNode).removeChild(node.nextSibling);\n }\n } else {\n while (node.nextSibling && node.nextSibling.nodeType === 3) {\n node = node.nextSibling;\n }\n }\n return node.nextSibling;\n case 11:\n var currentChild = node.firstChild;\n while (currentChild) {\n currentChild = this._compileNode(currentChild, resources, instructions, node, parentInjectorId, targetLightDOM);\n }\n break;\n default:\n break;\n }\n\n return node.nextSibling;\n };\n\n ViewCompiler.prototype._compileSurrogate = function _compileSurrogate(node, resources) {\n var tagName = node.tagName.toLowerCase();\n var attributes = node.attributes;\n var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);\n var knownAttribute = void 0;\n var property = void 0;\n var instruction = void 0;\n var i = void 0;\n var ii = void 0;\n var attr = void 0;\n var attrName = void 0;\n var attrValue = void 0;\n var info = void 0;\n var type = void 0;\n var expressions = [];\n var expression = void 0;\n var behaviorInstructions = [];\n var values = {};\n var hasValues = false;\n var providers = [];\n\n for (i = 0, ii = attributes.length; i < ii; ++i) {\n attr = attributes[i];\n attrName = attr.name;\n attrValue = attr.value;\n\n info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);\n type = resources.getAttribute(info.attrName);\n\n if (type) {\n knownAttribute = resources.mapAttribute(info.attrName);\n if (knownAttribute) {\n property = type.attributes[knownAttribute];\n\n if (property) {\n info.defaultBindingMode = property.defaultBindingMode;\n\n if (!info.command && !info.expression) {\n info.command = property.hasOptions ? 'options' : null;\n }\n\n if (info.command && info.command !== 'options' && type.primaryProperty) {\n var _primaryProperty = type.primaryProperty;\n attrName = info.attrName = _primaryProperty.attribute;\n\n info.defaultBindingMode = _primaryProperty.defaultBindingMode;\n }\n }\n }\n }\n\n instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);\n\n if (instruction) {\n if (instruction.alteredAttr) {\n type = resources.getAttribute(instruction.attrName);\n }\n\n if (instruction.discrete) {\n expressions.push(instruction);\n } else {\n if (type) {\n instruction.type = type;\n this._configureProperties(instruction, resources);\n\n if (type.liftsContent) {\n throw new Error('You cannot place a template controller on a surrogate element.');\n } else {\n behaviorInstructions.push(instruction);\n }\n } else {\n expressions.push(instruction.attributes[instruction.attrName]);\n }\n }\n } else {\n if (type) {\n instruction = BehaviorInstruction.attribute(attrName, type);\n instruction.attributes[resources.mapAttribute(attrName)] = attrValue;\n\n if (type.liftsContent) {\n throw new Error('You cannot place a template controller on a surrogate element.');\n } else {\n behaviorInstructions.push(instruction);\n }\n } else if (attrName !== 'id' && attrName !== 'part' && attrName !== 'replace-part') {\n hasValues = true;\n values[attrName] = attrValue;\n }\n }\n }\n\n if (expressions.length || behaviorInstructions.length || hasValues) {\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\n instruction = behaviorInstructions[i];\n instruction.type.compile(this, resources, node, instruction);\n providers.push(instruction.type.target);\n }\n\n for (i = 0, ii = expressions.length; i < ii; ++i) {\n expression = expressions[i];\n if (expression.attrToRemove !== undefined) {\n node.removeAttribute(expression.attrToRemove);\n }\n }\n\n return TargetInstruction.surrogate(providers, behaviorInstructions, expressions, values);\n }\n\n return null;\n };\n\n ViewCompiler.prototype._compileElement = function _compileElement(node, resources, instructions, parentNode, parentInjectorId, targetLightDOM) {\n var tagName = node.tagName.toLowerCase();\n var attributes = node.attributes;\n var expressions = [];\n var expression = void 0;\n var behaviorInstructions = [];\n var providers = [];\n var bindingLanguage = resources.getBindingLanguage(this.bindingLanguage);\n var liftingInstruction = void 0;\n var viewFactory = void 0;\n var type = void 0;\n var elementInstruction = void 0;\n var elementProperty = void 0;\n var i = void 0;\n var ii = void 0;\n var attr = void 0;\n var attrName = void 0;\n var attrValue = void 0;\n var originalAttrName = void 0;\n var instruction = void 0;\n var info = void 0;\n var property = void 0;\n var knownAttribute = void 0;\n var auTargetID = void 0;\n var injectorId = void 0;\n\n if (tagName === 'slot') {\n if (targetLightDOM) {\n node = makeShadowSlot(this, resources, node, instructions, parentInjectorId);\n }\n return node.nextSibling;\n } else if (tagName === 'template') {\n if (!('content' in node)) {\n throw new Error('You cannot place a template element within ' + node.namespaceURI + ' namespace');\n }\n viewFactory = this.compile(node, resources);\n viewFactory.part = node.getAttribute('part');\n } else {\n type = resources.getElement(node.getAttribute('as-element') || tagName);\n\n if (tagName === 'let' && !type && bindingLanguage.createLetExpressions !== defaultLetHandler) {\n expressions = bindingLanguage.createLetExpressions(resources, node);\n auTargetID = makeIntoInstructionTarget(node);\n instructions[auTargetID] = TargetInstruction.letElement(expressions);\n return node.nextSibling;\n }\n if (type) {\n elementInstruction = BehaviorInstruction.element(node, type);\n type.processAttributes(this, resources, node, attributes, elementInstruction);\n behaviorInstructions.push(elementInstruction);\n }\n }\n\n for (i = 0, ii = attributes.length; i < ii; ++i) {\n attr = attributes[i];\n originalAttrName = attrName = attr.name;\n attrValue = attr.value;\n info = bindingLanguage.inspectAttribute(resources, tagName, attrName, attrValue);\n\n if (targetLightDOM && info.attrName === 'slot') {\n info.attrName = attrName = 'au-slot';\n }\n\n type = resources.getAttribute(info.attrName);\n elementProperty = null;\n\n if (type) {\n knownAttribute = resources.mapAttribute(info.attrName);\n if (knownAttribute) {\n property = type.attributes[knownAttribute];\n\n if (property) {\n info.defaultBindingMode = property.defaultBindingMode;\n\n if (!info.command && !info.expression) {\n info.command = property.hasOptions ? 'options' : null;\n }\n\n if (info.command && info.command !== 'options' && type.primaryProperty) {\n var _primaryProperty2 = type.primaryProperty;\n attrName = info.attrName = _primaryProperty2.attribute;\n\n info.defaultBindingMode = _primaryProperty2.defaultBindingMode;\n }\n }\n }\n } else if (elementInstruction) {\n elementProperty = elementInstruction.type.attributes[info.attrName];\n if (elementProperty) {\n info.defaultBindingMode = elementProperty.defaultBindingMode;\n }\n }\n\n if (elementProperty) {\n instruction = bindingLanguage.createAttributeInstruction(resources, node, info, elementInstruction);\n } else {\n instruction = bindingLanguage.createAttributeInstruction(resources, node, info, undefined, type);\n }\n\n if (instruction) {\n if (instruction.alteredAttr) {\n type = resources.getAttribute(instruction.attrName);\n }\n\n if (instruction.discrete) {\n expressions.push(instruction);\n } else {\n if (type) {\n instruction.type = type;\n this._configureProperties(instruction, resources);\n\n if (type.liftsContent) {\n instruction.originalAttrName = originalAttrName;\n liftingInstruction = instruction;\n break;\n } else {\n behaviorInstructions.push(instruction);\n }\n } else if (elementProperty) {\n elementInstruction.attributes[info.attrName].targetProperty = elementProperty.name;\n } else {\n expressions.push(instruction.attributes[instruction.attrName]);\n }\n }\n } else {\n if (type) {\n instruction = BehaviorInstruction.attribute(attrName, type);\n instruction.attributes[resources.mapAttribute(attrName)] = attrValue;\n\n if (type.liftsContent) {\n instruction.originalAttrName = originalAttrName;\n liftingInstruction = instruction;\n break;\n } else {\n behaviorInstructions.push(instruction);\n }\n } else if (elementProperty) {\n elementInstruction.attributes[attrName] = attrValue;\n }\n }\n }\n\n if (liftingInstruction) {\n liftingInstruction.viewFactory = viewFactory;\n node = liftingInstruction.type.compile(this, resources, node, liftingInstruction, parentNode);\n auTargetID = makeIntoInstructionTarget(node);\n instructions[auTargetID] = TargetInstruction.lifting(parentInjectorId, liftingInstruction);\n } else {\n var skipContentProcessing = false;\n\n if (expressions.length || behaviorInstructions.length) {\n injectorId = behaviorInstructions.length ? getNextInjectorId() : false;\n\n for (i = 0, ii = behaviorInstructions.length; i < ii; ++i) {\n instruction = behaviorInstructions[i];\n instruction.type.compile(this, resources, node, instruction, parentNode);\n providers.push(instruction.type.target);\n skipContentProcessing = skipContentProcessing || instruction.skipContentProcessing;\n }\n\n for (i = 0, ii = expressions.length; i < ii; ++i) {\n expression = expressions[i];\n if (expression.attrToRemove !== undefined) {\n node.removeAttribute(expression.attrToRemove);\n }\n }\n\n auTargetID = makeIntoInstructionTarget(node);\n instructions[auTargetID] = TargetInstruction.normal(injectorId, parentInjectorId, providers, behaviorInstructions, expressions, elementInstruction);\n }\n\n if (skipContentProcessing) {\n return node.nextSibling;\n }\n\n var currentChild = node.firstChild;\n while (currentChild) {\n currentChild = this._compileNode(currentChild, resources, instructions, node, injectorId || parentInjectorId, targetLightDOM);\n }\n }\n\n return node.nextSibling;\n };\n\n ViewCompiler.prototype._configureProperties = function _configureProperties(instruction, resources) {\n var type = instruction.type;\n var attrName = instruction.attrName;\n var attributes = instruction.attributes;\n var property = void 0;\n var key = void 0;\n var value = void 0;\n\n var knownAttribute = resources.mapAttribute(attrName);\n if (knownAttribute && attrName in attributes && knownAttribute !== attrName) {\n attributes[knownAttribute] = attributes[attrName];\n delete attributes[attrName];\n }\n\n for (key in attributes) {\n value = attributes[key];\n\n if (value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {\n property = type.attributes[key];\n\n if (property !== undefined) {\n value.targetProperty = property.name;\n } else {\n value.targetProperty = key;\n }\n }\n }\n };\n\n return ViewCompiler;\n}();\n\nvar ResourceModule = function () {\n function ResourceModule(moduleId) {\n \n\n this.id = moduleId;\n this.moduleInstance = null;\n this.mainResource = null;\n this.resources = null;\n this.viewStrategy = null;\n this.isInitialized = false;\n this.onLoaded = null;\n this.loadContext = null;\n }\n\n ResourceModule.prototype.initialize = function initialize(container) {\n var current = this.mainResource;\n var resources = this.resources;\n var vs = this.viewStrategy;\n\n if (this.isInitialized) {\n return;\n }\n\n this.isInitialized = true;\n\n if (current !== undefined) {\n current.metadata.viewStrategy = vs;\n current.initialize(container);\n }\n\n for (var i = 0, ii = resources.length; i < ii; ++i) {\n current = resources[i];\n current.metadata.viewStrategy = vs;\n current.initialize(container);\n }\n };\n\n ResourceModule.prototype.register = function register(registry, name) {\n var main = this.mainResource;\n var resources = this.resources;\n\n if (main !== undefined) {\n main.register(registry, name);\n name = null;\n }\n\n for (var i = 0, ii = resources.length; i < ii; ++i) {\n resources[i].register(registry, name);\n name = null;\n }\n };\n\n ResourceModule.prototype.load = function load(container, loadContext) {\n if (this.onLoaded !== null) {\n return this.loadContext === loadContext ? Promise.resolve() : this.onLoaded;\n }\n\n var main = this.mainResource;\n var resources = this.resources;\n var loads = void 0;\n\n if (main !== undefined) {\n loads = new Array(resources.length + 1);\n loads[0] = main.load(container, loadContext);\n for (var i = 0, ii = resources.length; i < ii; ++i) {\n loads[i + 1] = resources[i].load(container, loadContext);\n }\n } else {\n loads = new Array(resources.length);\n for (var _i2 = 0, _ii = resources.length; _i2 < _ii; ++_i2) {\n loads[_i2] = resources[_i2].load(container, loadContext);\n }\n }\n\n this.loadContext = loadContext;\n this.onLoaded = Promise.all(loads);\n return this.onLoaded;\n };\n\n return ResourceModule;\n}();\n\nvar ResourceDescription = function () {\n function ResourceDescription(key, exportedValue, resourceTypeMeta) {\n \n\n if (!resourceTypeMeta) {\n resourceTypeMeta = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].get(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, exportedValue);\n\n if (!resourceTypeMeta) {\n resourceTypeMeta = new HtmlBehaviorResource();\n resourceTypeMeta.elementName = _hyphenate(key);\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, resourceTypeMeta, exportedValue);\n }\n }\n\n if (resourceTypeMeta instanceof HtmlBehaviorResource) {\n if (resourceTypeMeta.elementName === undefined) {\n resourceTypeMeta.elementName = _hyphenate(key);\n } else if (resourceTypeMeta.attributeName === undefined) {\n resourceTypeMeta.attributeName = _hyphenate(key);\n } else if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\n HtmlBehaviorResource.convention(key, resourceTypeMeta);\n }\n } else if (!resourceTypeMeta.name) {\n resourceTypeMeta.name = _hyphenate(key);\n }\n\n this.metadata = resourceTypeMeta;\n this.value = exportedValue;\n }\n\n ResourceDescription.prototype.initialize = function initialize(container) {\n this.metadata.initialize(container, this.value);\n };\n\n ResourceDescription.prototype.register = function register(registry, name) {\n this.metadata.register(registry, name);\n };\n\n ResourceDescription.prototype.load = function load(container, loadContext) {\n return this.metadata.load(container, this.value, loadContext);\n };\n\n return ResourceDescription;\n}();\n\nvar ModuleAnalyzer = function () {\n function ModuleAnalyzer() {\n \n\n this.cache = Object.create(null);\n }\n\n ModuleAnalyzer.prototype.getAnalysis = function getAnalysis(moduleId) {\n return this.cache[moduleId];\n };\n\n ModuleAnalyzer.prototype.analyze = function analyze(moduleId, moduleInstance, mainResourceKey) {\n var mainResource = void 0;\n var fallbackValue = void 0;\n var fallbackKey = void 0;\n var resourceTypeMeta = void 0;\n var key = void 0;\n var exportedValue = void 0;\n var resources = [];\n var conventional = void 0;\n var vs = void 0;\n var resourceModule = void 0;\n\n resourceModule = this.cache[moduleId];\n if (resourceModule) {\n return resourceModule;\n }\n\n resourceModule = new ResourceModule(moduleId);\n this.cache[moduleId] = resourceModule;\n\n if (typeof moduleInstance === 'function') {\n moduleInstance = { 'default': moduleInstance };\n }\n\n if (mainResourceKey) {\n mainResource = new ResourceDescription(mainResourceKey, moduleInstance[mainResourceKey]);\n }\n\n for (key in moduleInstance) {\n exportedValue = moduleInstance[key];\n\n if (key === mainResourceKey || typeof exportedValue !== 'function') {\n continue;\n }\n\n resourceTypeMeta = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].get(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, exportedValue);\n\n if (resourceTypeMeta) {\n if (resourceTypeMeta instanceof HtmlBehaviorResource) {\n ViewResources.convention(exportedValue, resourceTypeMeta);\n\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\n HtmlBehaviorResource.convention(key, resourceTypeMeta);\n }\n\n if (resourceTypeMeta.attributeName === null && resourceTypeMeta.elementName === null) {\n resourceTypeMeta.elementName = _hyphenate(key);\n }\n }\n\n if (!mainResource && resourceTypeMeta instanceof HtmlBehaviorResource && resourceTypeMeta.elementName !== null) {\n mainResource = new ResourceDescription(key, exportedValue, resourceTypeMeta);\n } else {\n resources.push(new ResourceDescription(key, exportedValue, resourceTypeMeta));\n }\n } else if (viewStrategy.decorates(exportedValue)) {\n vs = exportedValue;\n } else if (exportedValue instanceof aurelia_loader__WEBPACK_IMPORTED_MODULE_3__[\"TemplateRegistryEntry\"]) {\n vs = new TemplateRegistryViewStrategy(moduleId, exportedValue);\n } else {\n if (conventional = ViewResources.convention(exportedValue)) {\n if (conventional.elementName !== null && !mainResource) {\n mainResource = new ResourceDescription(key, exportedValue, conventional);\n } else {\n resources.push(new ResourceDescription(key, exportedValue, conventional));\n }\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, conventional, exportedValue);\n } else if (conventional = HtmlBehaviorResource.convention(key)) {\n if (conventional.elementName !== null && !mainResource) {\n mainResource = new ResourceDescription(key, exportedValue, conventional);\n } else {\n resources.push(new ResourceDescription(key, exportedValue, conventional));\n }\n\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, conventional, exportedValue);\n } else if (conventional = aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"ValueConverterResource\"].convention(key) || aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"BindingBehaviorResource\"].convention(key) || ViewEngineHooksResource.convention(key)) {\n resources.push(new ResourceDescription(key, exportedValue, conventional));\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, conventional, exportedValue);\n } else if (!fallbackValue) {\n fallbackValue = exportedValue;\n fallbackKey = key;\n }\n }\n }\n\n if (!mainResource && fallbackValue) {\n mainResource = new ResourceDescription(fallbackKey, fallbackValue);\n }\n\n resourceModule.moduleInstance = moduleInstance;\n resourceModule.mainResource = mainResource;\n resourceModule.resources = resources;\n resourceModule.viewStrategy = vs;\n\n return resourceModule;\n };\n\n return ModuleAnalyzer;\n}();\n\nvar logger = aurelia_logging__WEBPACK_IMPORTED_MODULE_0__[\"getLogger\"]('templating');\n\nfunction ensureRegistryEntry(loader, urlOrRegistryEntry) {\n if (urlOrRegistryEntry instanceof aurelia_loader__WEBPACK_IMPORTED_MODULE_3__[\"TemplateRegistryEntry\"]) {\n return Promise.resolve(urlOrRegistryEntry);\n }\n\n return loader.loadTemplate(urlOrRegistryEntry);\n}\n\nvar ProxyViewFactory = function () {\n function ProxyViewFactory(promise) {\n var _this8 = this;\n\n \n\n promise.then(function (x) {\n return _this8.viewFactory = x;\n });\n }\n\n ProxyViewFactory.prototype.create = function create(container, bindingContext, createInstruction, element) {\n return this.viewFactory.create(container, bindingContext, createInstruction, element);\n };\n\n ProxyViewFactory.prototype.setCacheSize = function setCacheSize(size, doNotOverrideIfAlreadySet) {\n this.viewFactory.setCacheSize(size, doNotOverrideIfAlreadySet);\n };\n\n ProxyViewFactory.prototype.getCachedView = function getCachedView() {\n return this.viewFactory.getCachedView();\n };\n\n ProxyViewFactory.prototype.returnViewToCache = function returnViewToCache(view) {\n this.viewFactory.returnViewToCache(view);\n };\n\n _createClass(ProxyViewFactory, [{\n key: 'isCaching',\n get: function get() {\n return this.viewFactory.isCaching;\n }\n }]);\n\n return ProxyViewFactory;\n}();\n\nvar auSlotBehavior = null;\n\nvar ViewEngine = (_temp5 = _class14 = function () {\n ViewEngine.inject = function inject() {\n return [aurelia_loader__WEBPACK_IMPORTED_MODULE_3__[\"Loader\"], aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"Container\"], ViewCompiler, ModuleAnalyzer, ViewResources];\n };\n\n function ViewEngine(loader, container, viewCompiler, moduleAnalyzer, appResources) {\n \n\n this.loader = loader;\n this.container = container;\n this.viewCompiler = viewCompiler;\n this.moduleAnalyzer = moduleAnalyzer;\n this.appResources = appResources;\n this._pluginMap = {};\n\n if (auSlotBehavior === null) {\n auSlotBehavior = new HtmlBehaviorResource();\n auSlotBehavior.attributeName = 'au-slot';\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, auSlotBehavior, SlotCustomAttribute);\n }\n\n auSlotBehavior.initialize(container, SlotCustomAttribute);\n auSlotBehavior.register(appResources);\n }\n\n ViewEngine.prototype.addResourcePlugin = function addResourcePlugin(extension, implementation) {\n var name = extension.replace('.', '') + '-resource-plugin';\n this._pluginMap[extension] = name;\n this.loader.addPlugin(name, implementation);\n };\n\n ViewEngine.prototype.loadViewFactory = function loadViewFactory(urlOrRegistryEntry, compileInstruction, loadContext, target) {\n var _this9 = this;\n\n loadContext = loadContext || new ResourceLoadContext();\n\n return ensureRegistryEntry(this.loader, urlOrRegistryEntry).then(function (registryEntry) {\n var url = registryEntry.address;\n\n if (registryEntry.onReady) {\n if (!loadContext.hasDependency(url)) {\n loadContext.addDependency(url);\n return registryEntry.onReady;\n }\n\n if (registryEntry.template === null) {\n return registryEntry.onReady;\n }\n\n return Promise.resolve(new ProxyViewFactory(registryEntry.onReady));\n }\n\n loadContext.addDependency(url);\n\n registryEntry.onReady = _this9.loadTemplateResources(registryEntry, compileInstruction, loadContext, target).then(function (resources) {\n registryEntry.resources = resources;\n\n if (registryEntry.template === null) {\n return registryEntry.factory = null;\n }\n\n var viewFactory = _this9.viewCompiler.compile(registryEntry.template, resources, compileInstruction);\n return registryEntry.factory = viewFactory;\n });\n\n return registryEntry.onReady;\n });\n };\n\n ViewEngine.prototype.loadTemplateResources = function loadTemplateResources(registryEntry, compileInstruction, loadContext, target) {\n var resources = new ViewResources(this.appResources, registryEntry.address);\n var dependencies = registryEntry.dependencies;\n var importIds = void 0;\n var names = void 0;\n\n compileInstruction = compileInstruction || ViewCompileInstruction.normal;\n\n if (dependencies.length === 0 && !compileInstruction.associatedModuleId) {\n return Promise.resolve(resources);\n }\n\n importIds = dependencies.map(function (x) {\n return x.src;\n });\n names = dependencies.map(function (x) {\n return x.name;\n });\n logger.debug('importing resources for ' + registryEntry.address, importIds);\n\n if (target) {\n var viewModelRequires = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].get(ViewEngine.viewModelRequireMetadataKey, target);\n if (viewModelRequires) {\n var templateImportCount = importIds.length;\n for (var i = 0, ii = viewModelRequires.length; i < ii; ++i) {\n var req = viewModelRequires[i];\n var importId = typeof req === 'function' ? aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"Origin\"].get(req).moduleId : Object(aurelia_path__WEBPACK_IMPORTED_MODULE_4__[\"relativeToFile\"])(req.src || req, registryEntry.address);\n\n if (importIds.indexOf(importId) === -1) {\n importIds.push(importId);\n names.push(req.as);\n }\n }\n logger.debug('importing ViewModel resources for ' + compileInstruction.associatedModuleId, importIds.slice(templateImportCount));\n }\n }\n\n return this.importViewResources(importIds, names, resources, compileInstruction, loadContext);\n };\n\n ViewEngine.prototype.importViewModelResource = function importViewModelResource(moduleImport, moduleMember) {\n var _this10 = this;\n\n return this.loader.loadModule(moduleImport).then(function (viewModelModule) {\n var normalizedId = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"Origin\"].get(viewModelModule).moduleId;\n var resourceModule = _this10.moduleAnalyzer.analyze(normalizedId, viewModelModule, moduleMember);\n\n if (!resourceModule.mainResource) {\n throw new Error('No view model found in module \"' + moduleImport + '\".');\n }\n\n resourceModule.initialize(_this10.container);\n\n return resourceModule.mainResource;\n });\n };\n\n ViewEngine.prototype.importViewResources = function importViewResources(moduleIds, names, resources, compileInstruction, loadContext) {\n var _this11 = this;\n\n loadContext = loadContext || new ResourceLoadContext();\n compileInstruction = compileInstruction || ViewCompileInstruction.normal;\n\n moduleIds = moduleIds.map(function (x) {\n return _this11._applyLoaderPlugin(x);\n });\n\n return this.loader.loadAllModules(moduleIds).then(function (imports) {\n var i = void 0;\n var ii = void 0;\n var analysis = void 0;\n var normalizedId = void 0;\n var current = void 0;\n var associatedModule = void 0;\n var container = _this11.container;\n var moduleAnalyzer = _this11.moduleAnalyzer;\n var allAnalysis = new Array(imports.length);\n\n for (i = 0, ii = imports.length; i < ii; ++i) {\n current = imports[i];\n normalizedId = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"Origin\"].get(current).moduleId;\n\n analysis = moduleAnalyzer.analyze(normalizedId, current);\n analysis.initialize(container);\n analysis.register(resources, names[i]);\n\n allAnalysis[i] = analysis;\n }\n\n if (compileInstruction.associatedModuleId) {\n associatedModule = moduleAnalyzer.getAnalysis(compileInstruction.associatedModuleId);\n\n if (associatedModule) {\n associatedModule.register(resources);\n }\n }\n\n for (i = 0, ii = allAnalysis.length; i < ii; ++i) {\n allAnalysis[i] = allAnalysis[i].load(container, loadContext);\n }\n\n return Promise.all(allAnalysis).then(function () {\n return resources;\n });\n });\n };\n\n ViewEngine.prototype._applyLoaderPlugin = function _applyLoaderPlugin(id) {\n var index = id.lastIndexOf('.');\n if (index !== -1) {\n var ext = id.substring(index);\n var pluginName = this._pluginMap[ext];\n\n if (pluginName === undefined) {\n return id;\n }\n\n return this.loader.applyPluginToUrl(id, pluginName);\n }\n\n return id;\n };\n\n return ViewEngine;\n}(), _class14.viewModelRequireMetadataKey = 'aurelia:view-model-require', _temp5);\n\nvar Controller = function () {\n function Controller(behavior, instruction, viewModel, container) {\n \n\n this.behavior = behavior;\n this.instruction = instruction;\n this.viewModel = viewModel;\n this.isAttached = false;\n this.view = null;\n this.isBound = false;\n this.scope = null;\n this.container = container;\n this.elementEvents = container.elementEvents || null;\n\n var observerLookup = behavior.observerLocator.getOrCreateObserversLookup(viewModel);\n var handlesBind = behavior.handlesBind;\n var attributes = instruction.attributes;\n var boundProperties = this.boundProperties = [];\n var properties = behavior.properties;\n var i = void 0;\n var ii = void 0;\n\n behavior._ensurePropertiesDefined(viewModel, observerLookup);\n\n for (i = 0, ii = properties.length; i < ii; ++i) {\n properties[i]._initialize(viewModel, observerLookup, attributes, handlesBind, boundProperties);\n }\n }\n\n Controller.prototype.created = function created(owningView) {\n if (this.behavior.handlesCreated) {\n this.viewModel.created(owningView, this.view);\n }\n };\n\n Controller.prototype.automate = function automate(overrideContext, owningView) {\n this.view.bindingContext = this.viewModel;\n this.view.overrideContext = overrideContext || Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"createOverrideContext\"])(this.viewModel);\n this.view._isUserControlled = true;\n\n if (this.behavior.handlesCreated) {\n this.viewModel.created(owningView || null, this.view);\n }\n\n this.bind(this.view);\n };\n\n Controller.prototype.bind = function bind(scope) {\n var skipSelfSubscriber = this.behavior.handlesBind;\n var boundProperties = this.boundProperties;\n var i = void 0;\n var ii = void 0;\n var x = void 0;\n var observer = void 0;\n var selfSubscriber = void 0;\n\n if (this.isBound) {\n if (this.scope === scope) {\n return;\n }\n\n this.unbind();\n }\n\n this.isBound = true;\n this.scope = scope;\n\n for (i = 0, ii = boundProperties.length; i < ii; ++i) {\n x = boundProperties[i];\n observer = x.observer;\n selfSubscriber = observer.selfSubscriber;\n observer.publishing = false;\n\n if (skipSelfSubscriber) {\n observer.selfSubscriber = null;\n }\n\n x.binding.bind(scope);\n observer.call();\n\n observer.publishing = true;\n observer.selfSubscriber = selfSubscriber;\n }\n\n var overrideContext = void 0;\n if (this.view !== null) {\n if (skipSelfSubscriber) {\n this.view.viewModelScope = scope;\n }\n\n if (this.viewModel === scope.overrideContext.bindingContext) {\n overrideContext = scope.overrideContext;\n } else if (this.instruction.inheritBindingContext) {\n overrideContext = Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"createOverrideContext\"])(this.viewModel, scope.overrideContext);\n } else {\n overrideContext = Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"createOverrideContext\"])(this.viewModel);\n overrideContext.__parentOverrideContext = scope.overrideContext;\n }\n\n this.view.bind(this.viewModel, overrideContext);\n } else if (skipSelfSubscriber) {\n overrideContext = scope.overrideContext;\n\n if (scope.overrideContext.__parentOverrideContext !== undefined && this.viewModel.viewFactory && this.viewModel.viewFactory.factoryCreateInstruction.partReplacements) {\n overrideContext = Object.assign({}, scope.overrideContext);\n overrideContext.parentOverrideContext = scope.overrideContext.__parentOverrideContext;\n }\n this.viewModel.bind(scope.bindingContext, overrideContext);\n }\n };\n\n Controller.prototype.unbind = function unbind() {\n if (this.isBound) {\n var _boundProperties = this.boundProperties;\n var _i3 = void 0;\n var _ii2 = void 0;\n\n this.isBound = false;\n this.scope = null;\n\n if (this.view !== null) {\n this.view.unbind();\n }\n\n if (this.behavior.handlesUnbind) {\n this.viewModel.unbind();\n }\n\n if (this.elementEvents !== null) {\n this.elementEvents.disposeAll();\n }\n\n for (_i3 = 0, _ii2 = _boundProperties.length; _i3 < _ii2; ++_i3) {\n _boundProperties[_i3].binding.unbind();\n }\n }\n };\n\n Controller.prototype.attached = function attached() {\n if (this.isAttached) {\n return;\n }\n\n this.isAttached = true;\n\n if (this.behavior.handlesAttached) {\n this.viewModel.attached();\n }\n\n if (this.view !== null) {\n this.view.attached();\n }\n };\n\n Controller.prototype.detached = function detached() {\n if (this.isAttached) {\n this.isAttached = false;\n\n if (this.view !== null) {\n this.view.detached();\n }\n\n if (this.behavior.handlesDetached) {\n this.viewModel.detached();\n }\n }\n };\n\n return Controller;\n}();\n\nvar BehaviorPropertyObserver = (_dec7 = Object(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"subscriberCollection\"])(), _dec7(_class15 = function () {\n function BehaviorPropertyObserver(taskQueue, obj, propertyName, selfSubscriber, initialValue) {\n \n\n this.taskQueue = taskQueue;\n this.obj = obj;\n this.propertyName = propertyName;\n this.notqueued = true;\n this.publishing = false;\n this.selfSubscriber = selfSubscriber;\n this.currentValue = this.oldValue = initialValue;\n }\n\n BehaviorPropertyObserver.prototype.getValue = function getValue() {\n return this.currentValue;\n };\n\n BehaviorPropertyObserver.prototype.setValue = function setValue(newValue) {\n var oldValue = this.currentValue;\n\n if (!Object.is(newValue, oldValue)) {\n this.oldValue = oldValue;\n this.currentValue = newValue;\n\n if (this.publishing && this.notqueued) {\n if (this.taskQueue.flushing) {\n this.call();\n } else {\n this.notqueued = false;\n this.taskQueue.queueMicroTask(this);\n }\n }\n }\n };\n\n BehaviorPropertyObserver.prototype.call = function call() {\n var oldValue = this.oldValue;\n var newValue = this.currentValue;\n\n this.notqueued = true;\n\n if (Object.is(newValue, oldValue)) {\n return;\n }\n\n if (this.selfSubscriber) {\n this.selfSubscriber(newValue, oldValue);\n }\n\n this.callSubscribers(newValue, oldValue);\n this.oldValue = newValue;\n };\n\n BehaviorPropertyObserver.prototype.subscribe = function subscribe(context, callable) {\n this.addSubscriber(context, callable);\n };\n\n BehaviorPropertyObserver.prototype.unsubscribe = function unsubscribe(context, callable) {\n this.removeSubscriber(context, callable);\n };\n\n return BehaviorPropertyObserver;\n}()) || _class15);\n\nfunction getObserver(instance, name) {\n var lookup = instance.__observers__;\n\n if (lookup === undefined) {\n var ctor = Object.getPrototypeOf(instance).constructor;\n var _behavior = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].get(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, ctor);\n if (!_behavior.isInitialized) {\n _behavior.initialize(aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"Container\"].instance || new aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"Container\"](), instance.constructor);\n }\n\n lookup = _behavior.observerLocator.getOrCreateObserversLookup(instance);\n _behavior._ensurePropertiesDefined(instance, lookup);\n }\n\n return lookup[name];\n}\n\nvar BindableProperty = function () {\n function BindableProperty(nameOrConfig) {\n \n\n if (typeof nameOrConfig === 'string') {\n this.name = nameOrConfig;\n } else {\n Object.assign(this, nameOrConfig);\n }\n\n this.attribute = this.attribute || _hyphenate(this.name);\n var defaultBindingMode = this.defaultBindingMode;\n if (defaultBindingMode === null || defaultBindingMode === undefined) {\n this.defaultBindingMode = aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"bindingMode\"].oneWay;\n } else if (typeof defaultBindingMode === 'string') {\n this.defaultBindingMode = aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"bindingMode\"][defaultBindingMode] || aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"bindingMode\"].oneWay;\n }\n this.changeHandler = this.changeHandler || null;\n this.owner = null;\n this.descriptor = null;\n }\n\n BindableProperty.prototype.registerWith = function registerWith(target, behavior, descriptor) {\n behavior.properties.push(this);\n behavior.attributes[this.attribute] = this;\n this.owner = behavior;\n\n if (descriptor) {\n this.descriptor = descriptor;\n return this._configureDescriptor(descriptor);\n }\n\n return undefined;\n };\n\n BindableProperty.prototype._configureDescriptor = function _configureDescriptor(descriptor) {\n var name = this.name;\n\n descriptor.configurable = true;\n descriptor.enumerable = true;\n\n if ('initializer' in descriptor) {\n this.defaultValue = descriptor.initializer;\n delete descriptor.initializer;\n delete descriptor.writable;\n }\n\n if ('value' in descriptor) {\n this.defaultValue = descriptor.value;\n delete descriptor.value;\n delete descriptor.writable;\n }\n\n descriptor.get = function () {\n return getObserver(this, name).getValue();\n };\n\n descriptor.set = function (value) {\n getObserver(this, name).setValue(value);\n };\n\n descriptor.get.getObserver = function (obj) {\n return getObserver(obj, name);\n };\n\n return descriptor;\n };\n\n BindableProperty.prototype.defineOn = function defineOn(target, behavior) {\n var name = this.name;\n var handlerName = void 0;\n\n if (this.changeHandler === null) {\n handlerName = name + 'Changed';\n if (handlerName in target.prototype) {\n this.changeHandler = handlerName;\n }\n }\n\n if (this.descriptor === null) {\n Object.defineProperty(target.prototype, name, this._configureDescriptor(behavior, {}));\n }\n };\n\n BindableProperty.prototype.createObserver = function createObserver(viewModel) {\n var selfSubscriber = null;\n var defaultValue = this.defaultValue;\n var changeHandlerName = this.changeHandler;\n var name = this.name;\n var initialValue = void 0;\n\n if (this.hasOptions) {\n return undefined;\n }\n\n if (changeHandlerName in viewModel) {\n if ('propertyChanged' in viewModel) {\n selfSubscriber = function selfSubscriber(newValue, oldValue) {\n viewModel[changeHandlerName](newValue, oldValue);\n viewModel.propertyChanged(name, newValue, oldValue);\n };\n } else {\n selfSubscriber = function selfSubscriber(newValue, oldValue) {\n return viewModel[changeHandlerName](newValue, oldValue);\n };\n }\n } else if ('propertyChanged' in viewModel) {\n selfSubscriber = function selfSubscriber(newValue, oldValue) {\n return viewModel.propertyChanged(name, newValue, oldValue);\n };\n } else if (changeHandlerName !== null) {\n throw new Error('Change handler ' + changeHandlerName + ' was specified but not declared on the class.');\n }\n\n if (defaultValue !== undefined) {\n initialValue = typeof defaultValue === 'function' ? defaultValue.call(viewModel) : defaultValue;\n }\n\n return new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, this.name, selfSubscriber, initialValue);\n };\n\n BindableProperty.prototype._initialize = function _initialize(viewModel, observerLookup, attributes, behaviorHandlesBind, boundProperties) {\n var selfSubscriber = void 0;\n var observer = void 0;\n var attribute = void 0;\n var defaultValue = this.defaultValue;\n\n if (this.isDynamic) {\n for (var _key6 in attributes) {\n this._createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, _key6, attributes[_key6], boundProperties);\n }\n } else if (!this.hasOptions) {\n observer = observerLookup[this.name];\n\n if (attributes !== null) {\n selfSubscriber = observer.selfSubscriber;\n attribute = attributes[this.attribute];\n\n if (behaviorHandlesBind) {\n observer.selfSubscriber = null;\n }\n\n if (typeof attribute === 'string') {\n viewModel[this.name] = attribute;\n observer.call();\n } else if (attribute) {\n boundProperties.push({ observer: observer, binding: attribute.createBinding(viewModel) });\n } else if (defaultValue !== undefined) {\n observer.call();\n }\n\n observer.selfSubscriber = selfSubscriber;\n }\n\n observer.publishing = true;\n }\n };\n\n BindableProperty.prototype._createDynamicProperty = function _createDynamicProperty(viewModel, observerLookup, behaviorHandlesBind, name, attribute, boundProperties) {\n var changeHandlerName = name + 'Changed';\n var selfSubscriber = null;\n var observer = void 0;\n var info = void 0;\n\n if (changeHandlerName in viewModel) {\n if ('propertyChanged' in viewModel) {\n selfSubscriber = function selfSubscriber(newValue, oldValue) {\n viewModel[changeHandlerName](newValue, oldValue);\n viewModel.propertyChanged(name, newValue, oldValue);\n };\n } else {\n selfSubscriber = function selfSubscriber(newValue, oldValue) {\n return viewModel[changeHandlerName](newValue, oldValue);\n };\n }\n } else if ('propertyChanged' in viewModel) {\n selfSubscriber = function selfSubscriber(newValue, oldValue) {\n return viewModel.propertyChanged(name, newValue, oldValue);\n };\n }\n\n observer = observerLookup[name] = new BehaviorPropertyObserver(this.owner.taskQueue, viewModel, name, selfSubscriber);\n\n Object.defineProperty(viewModel, name, {\n configurable: true,\n enumerable: true,\n get: observer.getValue.bind(observer),\n set: observer.setValue.bind(observer)\n });\n\n if (behaviorHandlesBind) {\n observer.selfSubscriber = null;\n }\n\n if (typeof attribute === 'string') {\n viewModel[name] = attribute;\n observer.call();\n } else if (attribute) {\n info = { observer: observer, binding: attribute.createBinding(viewModel) };\n boundProperties.push(info);\n }\n\n observer.publishing = true;\n observer.selfSubscriber = selfSubscriber;\n };\n\n return BindableProperty;\n}();\n\nvar lastProviderId = 0;\n\nfunction nextProviderId() {\n return ++lastProviderId;\n}\n\nfunction doProcessContent() {\n return true;\n}\nfunction doProcessAttributes() {}\n\nvar HtmlBehaviorResource = function () {\n function HtmlBehaviorResource() {\n \n\n this.elementName = null;\n this.attributeName = null;\n this.attributeDefaultBindingMode = undefined;\n this.liftsContent = false;\n this.targetShadowDOM = false;\n this.shadowDOMOptions = null;\n this.processAttributes = doProcessAttributes;\n this.processContent = doProcessContent;\n this.usesShadowDOM = false;\n this.childBindings = null;\n this.hasDynamicOptions = false;\n this.containerless = false;\n this.properties = [];\n this.attributes = {};\n this.isInitialized = false;\n this.primaryProperty = null;\n }\n\n HtmlBehaviorResource.convention = function convention(name, existing) {\n var behavior = void 0;\n\n if (name.endsWith('CustomAttribute')) {\n behavior = existing || new HtmlBehaviorResource();\n behavior.attributeName = _hyphenate(name.substring(0, name.length - 15));\n }\n\n if (name.endsWith('CustomElement')) {\n behavior = existing || new HtmlBehaviorResource();\n behavior.elementName = _hyphenate(name.substring(0, name.length - 13));\n }\n\n return behavior;\n };\n\n HtmlBehaviorResource.prototype.addChildBinding = function addChildBinding(behavior) {\n if (this.childBindings === null) {\n this.childBindings = [];\n }\n\n this.childBindings.push(behavior);\n };\n\n HtmlBehaviorResource.prototype.initialize = function initialize(container, target) {\n var proto = target.prototype;\n var properties = this.properties;\n var attributeName = this.attributeName;\n var attributeDefaultBindingMode = this.attributeDefaultBindingMode;\n var i = void 0;\n var ii = void 0;\n var current = void 0;\n\n if (this.isInitialized) {\n return;\n }\n\n this.isInitialized = true;\n target.__providerId__ = nextProviderId();\n\n this.observerLocator = container.get(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"ObserverLocator\"]);\n this.taskQueue = container.get(aurelia_task_queue__WEBPACK_IMPORTED_MODULE_7__[\"TaskQueue\"]);\n\n this.target = target;\n this.usesShadowDOM = this.targetShadowDOM && aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"FEATURE\"].shadowDOM;\n this.handlesCreated = 'created' in proto;\n this.handlesBind = 'bind' in proto;\n this.handlesUnbind = 'unbind' in proto;\n this.handlesAttached = 'attached' in proto;\n this.handlesDetached = 'detached' in proto;\n this.htmlName = this.elementName || this.attributeName;\n\n if (attributeName !== null) {\n if (properties.length === 0) {\n new BindableProperty({\n name: 'value',\n changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,\n attribute: attributeName,\n defaultBindingMode: attributeDefaultBindingMode\n }).registerWith(target, this);\n }\n\n current = properties[0];\n\n if (properties.length === 1 && current.name === 'value') {\n current.isDynamic = current.hasOptions = this.hasDynamicOptions;\n current.defineOn(target, this);\n } else {\n for (i = 0, ii = properties.length; i < ii; ++i) {\n properties[i].defineOn(target, this);\n if (properties[i].primaryProperty) {\n if (this.primaryProperty) {\n throw new Error('Only one bindable property on a custom element can be defined as the default');\n }\n this.primaryProperty = properties[i];\n }\n }\n\n current = new BindableProperty({\n name: 'value',\n changeHandler: 'valueChanged' in proto ? 'valueChanged' : null,\n attribute: attributeName,\n defaultBindingMode: attributeDefaultBindingMode\n });\n\n current.hasOptions = true;\n current.registerWith(target, this);\n }\n } else {\n for (i = 0, ii = properties.length; i < ii; ++i) {\n properties[i].defineOn(target, this);\n }\n\n this._copyInheritedProperties(container, target);\n }\n };\n\n HtmlBehaviorResource.prototype.register = function register(registry, name) {\n var _this12 = this;\n\n if (this.attributeName !== null) {\n registry.registerAttribute(name || this.attributeName, this, this.attributeName);\n\n if (Array.isArray(this.aliases)) {\n this.aliases.forEach(function (alias) {\n registry.registerAttribute(alias, _this12, _this12.attributeName);\n });\n }\n }\n\n if (this.elementName !== null) {\n registry.registerElement(name || this.elementName, this);\n }\n };\n\n HtmlBehaviorResource.prototype.load = function load(container, target, loadContext, viewStrategy, transientView) {\n var _this13 = this;\n\n var options = void 0;\n\n if (this.elementName !== null) {\n viewStrategy = container.get(ViewLocator).getViewStrategy(viewStrategy || this.viewStrategy || target);\n options = new ViewCompileInstruction(this.targetShadowDOM, true);\n\n if (!viewStrategy.moduleId) {\n viewStrategy.moduleId = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"Origin\"].get(target).moduleId;\n }\n\n return viewStrategy.loadViewFactory(container.get(ViewEngine), options, loadContext, target).then(function (viewFactory) {\n if (!transientView || !_this13.viewFactory) {\n _this13.viewFactory = viewFactory;\n }\n\n return viewFactory;\n });\n }\n\n return Promise.resolve(this);\n };\n\n HtmlBehaviorResource.prototype.compile = function compile(compiler, resources, node, instruction, parentNode) {\n if (this.liftsContent) {\n if (!instruction.viewFactory) {\n var _template = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createElement('template');\n var fragment = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createDocumentFragment();\n var cacheSize = node.getAttribute('view-cache');\n var part = node.getAttribute('part');\n\n node.removeAttribute(instruction.originalAttrName);\n aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].replaceNode(_template, node, parentNode);\n fragment.appendChild(node);\n instruction.viewFactory = compiler.compile(fragment, resources);\n\n if (part) {\n instruction.viewFactory.part = part;\n node.removeAttribute('part');\n }\n\n if (cacheSize) {\n instruction.viewFactory.setCacheSize(cacheSize);\n node.removeAttribute('view-cache');\n }\n\n node = _template;\n }\n } else if (this.elementName !== null) {\n var _partReplacements2 = {};\n\n if (this.processContent(compiler, resources, node, instruction) && node.hasChildNodes()) {\n var currentChild = node.firstChild;\n var contentElement = this.usesShadowDOM ? null : aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createElement('au-content');\n var nextSibling = void 0;\n var toReplace = void 0;\n\n while (currentChild) {\n nextSibling = currentChild.nextSibling;\n\n if (currentChild.tagName === 'TEMPLATE' && (toReplace = currentChild.getAttribute('replace-part'))) {\n _partReplacements2[toReplace] = compiler.compile(currentChild, resources);\n aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].removeNode(currentChild, parentNode);\n instruction.partReplacements = _partReplacements2;\n } else if (contentElement !== null) {\n if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) {\n aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].removeNode(currentChild, parentNode);\n } else {\n contentElement.appendChild(currentChild);\n }\n }\n\n currentChild = nextSibling;\n }\n\n if (contentElement !== null && contentElement.hasChildNodes()) {\n node.appendChild(contentElement);\n }\n\n instruction.skipContentProcessing = false;\n } else {\n instruction.skipContentProcessing = true;\n }\n } else if (!this.processContent(compiler, resources, node, instruction)) {\n instruction.skipContentProcessing = true;\n }\n\n return node;\n };\n\n HtmlBehaviorResource.prototype.create = function create(container, instruction, element, bindings) {\n var viewHost = void 0;\n var au = null;\n\n instruction = instruction || BehaviorInstruction.normal;\n element = element || null;\n bindings = bindings || null;\n\n if (this.elementName !== null && element) {\n if (this.usesShadowDOM) {\n viewHost = element.attachShadow(this.shadowDOMOptions);\n container.registerInstance(aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].boundary, viewHost);\n } else {\n viewHost = element;\n if (this.targetShadowDOM) {\n container.registerInstance(aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].boundary, viewHost);\n }\n }\n }\n\n if (element !== null) {\n element.au = au = element.au || {};\n }\n\n var viewModel = instruction.viewModel || container.get(this.target);\n var controller = new Controller(this, instruction, viewModel, container);\n var childBindings = this.childBindings;\n var viewFactory = void 0;\n\n if (this.liftsContent) {\n au.controller = controller;\n } else if (this.elementName !== null) {\n viewFactory = instruction.viewFactory || this.viewFactory;\n container.viewModel = viewModel;\n\n if (viewFactory) {\n controller.view = viewFactory.create(container, instruction, element);\n }\n\n if (element !== null) {\n au.controller = controller;\n\n if (controller.view) {\n if (!this.usesShadowDOM && (element.childNodes.length === 1 || element.contentElement)) {\n var contentElement = element.childNodes[0] || element.contentElement;\n controller.view.contentView = { fragment: contentElement };\n contentElement.parentNode && aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].removeNode(contentElement);\n }\n\n if (instruction.anchorIsContainer) {\n if (childBindings !== null) {\n for (var _i4 = 0, _ii3 = childBindings.length; _i4 < _ii3; ++_i4) {\n controller.view.addBinding(childBindings[_i4].create(element, viewModel, controller));\n }\n }\n\n controller.view.appendNodesTo(viewHost);\n } else {\n controller.view.insertNodesBefore(viewHost);\n }\n } else if (childBindings !== null) {\n for (var _i5 = 0, _ii4 = childBindings.length; _i5 < _ii4; ++_i5) {\n bindings.push(childBindings[_i5].create(element, viewModel, controller));\n }\n }\n } else if (controller.view) {\n controller.view.controller = controller;\n\n if (childBindings !== null) {\n for (var _i6 = 0, _ii5 = childBindings.length; _i6 < _ii5; ++_i6) {\n controller.view.addBinding(childBindings[_i6].create(instruction.host, viewModel, controller));\n }\n }\n } else if (childBindings !== null) {\n for (var _i7 = 0, _ii6 = childBindings.length; _i7 < _ii6; ++_i7) {\n bindings.push(childBindings[_i7].create(instruction.host, viewModel, controller));\n }\n }\n } else if (childBindings !== null) {\n for (var _i8 = 0, _ii7 = childBindings.length; _i8 < _ii7; ++_i8) {\n bindings.push(childBindings[_i8].create(element, viewModel, controller));\n }\n }\n\n if (au !== null) {\n au[this.htmlName] = controller;\n }\n\n if (instruction.initiatedByBehavior && viewFactory) {\n controller.view.created();\n }\n\n return controller;\n };\n\n HtmlBehaviorResource.prototype._ensurePropertiesDefined = function _ensurePropertiesDefined(instance, lookup) {\n var properties = void 0;\n var i = void 0;\n var ii = void 0;\n var observer = void 0;\n\n if ('__propertiesDefined__' in lookup) {\n return;\n }\n\n lookup.__propertiesDefined__ = true;\n properties = this.properties;\n\n for (i = 0, ii = properties.length; i < ii; ++i) {\n observer = properties[i].createObserver(instance);\n\n if (observer !== undefined) {\n lookup[observer.propertyName] = observer;\n }\n }\n };\n\n HtmlBehaviorResource.prototype._copyInheritedProperties = function _copyInheritedProperties(container, target) {\n var _this14 = this;\n\n var behavior = void 0;\n var derived = target;\n\n while (true) {\n var proto = Object.getPrototypeOf(target.prototype);\n target = proto && proto.constructor;\n if (!target) {\n return;\n }\n behavior = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, target);\n if (behavior) {\n break;\n }\n }\n behavior.initialize(container, target);\n\n var _loop = function _loop(_i9, _ii8) {\n var prop = behavior.properties[_i9];\n\n if (_this14.properties.some(function (p) {\n return p.name === prop.name;\n })) {\n return 'continue';\n }\n\n new BindableProperty(prop).registerWith(derived, _this14);\n };\n\n for (var _i9 = 0, _ii8 = behavior.properties.length; _i9 < _ii8; ++_i9) {\n var _ret = _loop(_i9, _ii8);\n\n if (_ret === 'continue') continue;\n }\n };\n\n return HtmlBehaviorResource;\n}();\n\nfunction createChildObserverDecorator(selectorOrConfig, all) {\n return function (target, key, descriptor) {\n var actualTarget = typeof key === 'string' ? target.constructor : target;\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, actualTarget);\n\n if (typeof selectorOrConfig === 'string') {\n selectorOrConfig = {\n selector: selectorOrConfig,\n name: key\n };\n }\n\n if (descriptor) {\n descriptor.writable = true;\n descriptor.configurable = true;\n }\n\n selectorOrConfig.all = all;\n r.addChildBinding(new ChildObserver(selectorOrConfig));\n };\n}\n\nfunction children(selectorOrConfig) {\n return createChildObserverDecorator(selectorOrConfig, true);\n}\n\nfunction child(selectorOrConfig) {\n return createChildObserverDecorator(selectorOrConfig, false);\n}\n\nvar ChildObserver = function () {\n function ChildObserver(config) {\n \n\n this.name = config.name;\n this.changeHandler = config.changeHandler || this.name + 'Changed';\n this.selector = config.selector;\n this.all = config.all;\n }\n\n ChildObserver.prototype.create = function create(viewHost, viewModel, controller) {\n return new ChildObserverBinder(this.selector, viewHost, this.name, viewModel, controller, this.changeHandler, this.all);\n };\n\n return ChildObserver;\n}();\n\nvar noMutations = [];\n\nfunction trackMutation(groupedMutations, binder, record) {\n var mutations = groupedMutations.get(binder);\n\n if (!mutations) {\n mutations = [];\n groupedMutations.set(binder, mutations);\n }\n\n mutations.push(record);\n}\n\nfunction onChildChange(mutations, observer) {\n var binders = observer.binders;\n var bindersLength = binders.length;\n\n var groupedMutations = new Map();\n\n for (var _i10 = 0, _ii9 = mutations.length; _i10 < _ii9; ++_i10) {\n var record = mutations[_i10];\n var added = record.addedNodes;\n var removed = record.removedNodes;\n\n for (var j = 0, jj = removed.length; j < jj; ++j) {\n var _node = removed[j];\n if (_node.nodeType === 1) {\n for (var k = 0; k < bindersLength; ++k) {\n var binder = binders[k];\n\n if (binder.onRemove(_node)) {\n trackMutation(groupedMutations, binder, record);\n }\n }\n }\n }\n\n for (var _j = 0, _jj = added.length; _j < _jj; ++_j) {\n var _node2 = added[_j];\n if (_node2.nodeType === 1) {\n for (var _k = 0; _k < bindersLength; ++_k) {\n var _binder = binders[_k];\n\n if (_binder.onAdd(_node2)) {\n trackMutation(groupedMutations, _binder, record);\n }\n }\n }\n }\n }\n\n groupedMutations.forEach(function (mutationRecords, binder) {\n if (binder.isBound && binder.changeHandler !== null) {\n binder.viewModel[binder.changeHandler](mutationRecords);\n }\n });\n}\n\nvar ChildObserverBinder = function () {\n function ChildObserverBinder(selector, viewHost, property, viewModel, controller, changeHandler, all) {\n \n\n this.selector = selector;\n\n this.viewHost = viewHost;\n this.property = property;\n this.viewModel = viewModel;\n this.controller = controller;\n this.changeHandler = changeHandler in viewModel ? changeHandler : null;\n this.usesShadowDOM = controller.behavior.usesShadowDOM;\n this.all = all;\n\n if (!this.usesShadowDOM && controller.view && controller.view.contentView) {\n this.contentView = controller.view.contentView;\n } else {\n this.contentView = null;\n }\n this.source = null;\n this.isBound = false;\n }\n\n ChildObserverBinder.prototype.matches = function matches(element) {\n if (element.matches(this.selector)) {\n if (this.contentView === null) {\n return true;\n }\n\n var contentView = this.contentView;\n var assignedSlot = element.auAssignedSlot;\n\n if (assignedSlot && assignedSlot.projectFromAnchors) {\n var anchors = assignedSlot.projectFromAnchors;\n\n for (var _i11 = 0, _ii10 = anchors.length; _i11 < _ii10; ++_i11) {\n if (anchors[_i11].auOwnerView === contentView) {\n return true;\n }\n }\n\n return false;\n }\n\n return element.auOwnerView === contentView;\n }\n\n return false;\n };\n\n ChildObserverBinder.prototype.bind = function bind(source) {\n if (this.isBound) {\n if (this.source === source) {\n return;\n }\n this.source = source;\n }\n this.isBound = true;\n\n var viewHost = this.viewHost;\n var viewModel = this.viewModel;\n var observer = viewHost.__childObserver__;\n\n if (!observer) {\n observer = viewHost.__childObserver__ = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createMutationObserver(onChildChange);\n\n var options = {\n childList: true,\n subtree: !this.usesShadowDOM\n };\n\n observer.observe(viewHost, options);\n observer.binders = [];\n }\n\n observer.binders.push(this);\n\n if (this.usesShadowDOM) {\n var current = viewHost.firstElementChild;\n\n if (this.all) {\n var items = viewModel[this.property];\n if (!items) {\n items = viewModel[this.property] = [];\n } else {\n items.splice(0);\n }\n\n while (current) {\n if (this.matches(current)) {\n items.push(current.au && current.au.controller ? current.au.controller.viewModel : current);\n }\n\n current = current.nextElementSibling;\n }\n\n if (this.changeHandler !== null) {\n this.viewModel[this.changeHandler](noMutations);\n }\n } else {\n while (current) {\n if (this.matches(current)) {\n var _value = current.au && current.au.controller ? current.au.controller.viewModel : current;\n this.viewModel[this.property] = _value;\n\n if (this.changeHandler !== null) {\n this.viewModel[this.changeHandler](_value);\n }\n\n break;\n }\n\n current = current.nextElementSibling;\n }\n }\n }\n };\n\n ChildObserverBinder.prototype.onRemove = function onRemove(element) {\n if (this.matches(element)) {\n var _value2 = element.au && element.au.controller ? element.au.controller.viewModel : element;\n\n if (this.all) {\n var items = this.viewModel[this.property] || (this.viewModel[this.property] = []);\n var index = items.indexOf(_value2);\n\n if (index !== -1) {\n items.splice(index, 1);\n }\n\n return true;\n }\n\n var currentValue = this.viewModel[this.property];\n if (currentValue === _value2) {\n this.viewModel[this.property] = null;\n\n if (this.isBound && this.changeHandler !== null) {\n this.viewModel[this.changeHandler](_value2);\n }\n }\n }\n\n return false;\n };\n\n ChildObserverBinder.prototype.onAdd = function onAdd(element) {\n if (this.matches(element)) {\n var _value3 = element.au && element.au.controller ? element.au.controller.viewModel : element;\n\n if (this.all) {\n var items = this.viewModel[this.property] || (this.viewModel[this.property] = []);\n\n if (this.selector === '*') {\n items.push(_value3);\n return true;\n }\n\n var index = 0;\n var prev = element.previousElementSibling;\n\n while (prev) {\n if (this.matches(prev)) {\n index++;\n }\n\n prev = prev.previousElementSibling;\n }\n\n items.splice(index, 0, _value3);\n return true;\n }\n\n this.viewModel[this.property] = _value3;\n\n if (this.isBound && this.changeHandler !== null) {\n this.viewModel[this.changeHandler](_value3);\n }\n }\n\n return false;\n };\n\n ChildObserverBinder.prototype.unbind = function unbind() {\n if (!this.isBound) {\n return;\n }\n this.isBound = false;\n this.source = null;\n var childObserver = this.viewHost.__childObserver__;\n if (childObserver) {\n var binders = childObserver.binders;\n if (binders && binders.length) {\n var idx = binders.indexOf(this);\n if (idx !== -1) {\n binders.splice(idx, 1);\n }\n if (binders.length === 0) {\n childObserver.disconnect();\n this.viewHost.__childObserver__ = null;\n }\n }\n\n if (this.usesShadowDOM) {\n this.viewModel[this.property] = null;\n }\n }\n };\n\n return ChildObserverBinder;\n}();\n\nfunction remove(viewSlot, previous) {\n return Array.isArray(previous) ? viewSlot.removeMany(previous, true) : viewSlot.remove(previous, true);\n}\n\nvar SwapStrategies = {\n before: function before(viewSlot, previous, callback) {\n return previous === undefined ? callback() : callback().then(function () {\n return remove(viewSlot, previous);\n });\n },\n with: function _with(viewSlot, previous, callback) {\n return previous === undefined ? callback() : Promise.all([remove(viewSlot, previous), callback()]);\n },\n after: function after(viewSlot, previous, callback) {\n return Promise.resolve(viewSlot.removeAll(true)).then(callback);\n }\n};\n\nfunction tryActivateViewModel(context) {\n if (context.skipActivation || typeof context.viewModel.activate !== 'function') {\n return Promise.resolve();\n }\n\n return context.viewModel.activate(context.model) || Promise.resolve();\n}\n\nvar CompositionEngine = (_dec8 = Object(aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"inject\"])(ViewEngine, ViewLocator), _dec8(_class16 = function () {\n function CompositionEngine(viewEngine, viewLocator) {\n \n\n this.viewEngine = viewEngine;\n this.viewLocator = viewLocator;\n }\n\n CompositionEngine.prototype._swap = function _swap(context, view) {\n var swapStrategy = SwapStrategies[context.swapOrder] || SwapStrategies.after;\n var previousViews = context.viewSlot.children.slice();\n\n return swapStrategy(context.viewSlot, previousViews, function () {\n return Promise.resolve(context.viewSlot.add(view)).then(function () {\n if (context.currentController) {\n context.currentController.unbind();\n }\n });\n }).then(function () {\n if (context.compositionTransactionNotifier) {\n context.compositionTransactionNotifier.done();\n }\n });\n };\n\n CompositionEngine.prototype._createControllerAndSwap = function _createControllerAndSwap(context) {\n var _this15 = this;\n\n return this.createController(context).then(function (controller) {\n if (context.compositionTransactionOwnershipToken) {\n return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {\n controller.automate(context.overrideContext, context.owningView);\n\n return _this15._swap(context, controller.view);\n }).then(function () {\n return controller;\n });\n }\n\n controller.automate(context.overrideContext, context.owningView);\n\n return _this15._swap(context, controller.view).then(function () {\n return controller;\n });\n });\n };\n\n CompositionEngine.prototype.createController = function createController(context) {\n var _this16 = this;\n\n var childContainer = void 0;\n var viewModel = void 0;\n var viewModelResource = void 0;\n\n var m = void 0;\n\n return this.ensureViewModel(context).then(tryActivateViewModel).then(function () {\n childContainer = context.childContainer;\n viewModel = context.viewModel;\n viewModelResource = context.viewModelResource;\n m = viewModelResource.metadata;\n\n var viewStrategy = _this16.viewLocator.getViewStrategy(context.view || viewModel);\n\n if (context.viewResources) {\n viewStrategy.makeRelativeTo(context.viewResources.viewUrl);\n }\n\n return m.load(childContainer, viewModelResource.value, null, viewStrategy, true);\n }).then(function (viewFactory) {\n return m.create(childContainer, BehaviorInstruction.dynamic(context.host, viewModel, viewFactory));\n });\n };\n\n CompositionEngine.prototype.ensureViewModel = function ensureViewModel(context) {\n var childContainer = context.childContainer = context.childContainer || context.container.createChild();\n\n if (typeof context.viewModel === 'string') {\n context.viewModel = context.viewResources ? context.viewResources.relativeToView(context.viewModel) : context.viewModel;\n\n return this.viewEngine.importViewModelResource(context.viewModel).then(function (viewModelResource) {\n childContainer.autoRegister(viewModelResource.value);\n\n if (context.host) {\n childContainer.registerInstance(aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].Element, context.host);\n }\n\n context.viewModel = childContainer.viewModel = childContainer.get(viewModelResource.value);\n context.viewModelResource = viewModelResource;\n return context;\n });\n }\n\n var ctor = context.viewModel.constructor;\n var isClass = typeof context.viewModel === 'function';\n if (isClass) {\n ctor = context.viewModel;\n childContainer.autoRegister(ctor);\n }\n var m = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, ctor);\n\n m.elementName = m.elementName || 'dynamic-element';\n\n m.initialize(isClass ? childContainer : context.container || childContainer, ctor);\n\n context.viewModelResource = { metadata: m, value: ctor };\n\n if (context.host) {\n childContainer.registerInstance(aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].Element, context.host);\n }\n childContainer.viewModel = context.viewModel = isClass ? childContainer.get(ctor) : context.viewModel;\n return Promise.resolve(context);\n };\n\n CompositionEngine.prototype.compose = function compose(context) {\n var _this17 = this;\n\n context.childContainer = context.childContainer || context.container.createChild();\n context.view = this.viewLocator.getViewStrategy(context.view);\n\n var transaction = context.childContainer.get(CompositionTransaction);\n var compositionTransactionOwnershipToken = transaction.tryCapture();\n\n if (compositionTransactionOwnershipToken) {\n context.compositionTransactionOwnershipToken = compositionTransactionOwnershipToken;\n } else {\n context.compositionTransactionNotifier = transaction.enlist();\n }\n\n if (context.viewModel) {\n return this._createControllerAndSwap(context);\n } else if (context.view) {\n if (context.viewResources) {\n context.view.makeRelativeTo(context.viewResources.viewUrl);\n }\n\n return context.view.loadViewFactory(this.viewEngine, new ViewCompileInstruction()).then(function (viewFactory) {\n var result = viewFactory.create(context.childContainer);\n result.bind(context.bindingContext, context.overrideContext);\n\n if (context.compositionTransactionOwnershipToken) {\n return context.compositionTransactionOwnershipToken.waitForCompositionComplete().then(function () {\n return _this17._swap(context, result);\n }).then(function () {\n return result;\n });\n }\n\n return _this17._swap(context, result).then(function () {\n return result;\n });\n });\n } else if (context.viewSlot) {\n context.viewSlot.removeAll();\n\n if (context.compositionTransactionNotifier) {\n context.compositionTransactionNotifier.done();\n }\n\n return Promise.resolve(null);\n }\n\n return Promise.resolve(null);\n };\n\n return CompositionEngine;\n}()) || _class16);\n\nvar ElementConfigResource = function () {\n function ElementConfigResource() {\n \n }\n\n ElementConfigResource.prototype.initialize = function initialize(container, target) {};\n\n ElementConfigResource.prototype.register = function register(registry, name) {};\n\n ElementConfigResource.prototype.load = function load(container, target) {\n var config = new target();\n var eventManager = container.get(aurelia_binding__WEBPACK_IMPORTED_MODULE_5__[\"EventManager\"]);\n eventManager.registerElementConfig(config);\n };\n\n return ElementConfigResource;\n}();\n\nfunction resource(instanceOrConfig) {\n return function (target) {\n var isConfig = typeof instanceOrConfig === 'string' || Object.getPrototypeOf(instanceOrConfig) === Object.prototype;\n if (isConfig) {\n target.$resource = instanceOrConfig;\n } else {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, instanceOrConfig, target);\n }\n };\n}\n\nfunction behavior(override) {\n return function (target) {\n if (override instanceof HtmlBehaviorResource) {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, override, target);\n } else {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, target);\n Object.assign(r, override);\n }\n };\n}\n\nfunction customElement(name) {\n return function (target) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, target);\n r.elementName = validateBehaviorName(name, 'custom element');\n };\n}\n\nfunction customAttribute(name, defaultBindingMode, aliases) {\n return function (target) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, target);\n r.attributeName = validateBehaviorName(name, 'custom attribute');\n r.attributeDefaultBindingMode = defaultBindingMode;\n r.aliases = aliases;\n };\n}\n\nfunction templateController(target) {\n var deco = function deco(t) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, t);\n r.liftsContent = true;\n };\n\n return target ? deco(target) : deco;\n}\n\nfunction bindable(nameOrConfigOrTarget, key, descriptor) {\n var deco = function deco(target, key2, descriptor2) {\n var actualTarget = key2 ? target.constructor : target;\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, actualTarget);\n var prop = void 0;\n\n if (key2) {\n nameOrConfigOrTarget = nameOrConfigOrTarget || {};\n nameOrConfigOrTarget.name = key2;\n }\n\n prop = new BindableProperty(nameOrConfigOrTarget);\n return prop.registerWith(actualTarget, r, descriptor2);\n };\n\n if (!nameOrConfigOrTarget) {\n return deco;\n }\n\n if (key) {\n var _target = nameOrConfigOrTarget;\n nameOrConfigOrTarget = null;\n return deco(_target, key, descriptor);\n }\n\n return deco;\n}\n\nfunction dynamicOptions(target) {\n var deco = function deco(t) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, t);\n r.hasDynamicOptions = true;\n };\n\n return target ? deco(target) : deco;\n}\n\nvar defaultShadowDOMOptions = { mode: 'open' };\n\nfunction useShadowDOM(targetOrOptions) {\n var options = typeof targetOrOptions === 'function' || !targetOrOptions ? defaultShadowDOMOptions : targetOrOptions;\n\n var deco = function deco(t) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, t);\n r.targetShadowDOM = true;\n r.shadowDOMOptions = options;\n };\n\n return typeof targetOrOptions === 'function' ? deco(targetOrOptions) : deco;\n}\n\nfunction processAttributes(processor) {\n return function (t) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, t);\n r.processAttributes = function (compiler, resources, node, attributes, elementInstruction) {\n try {\n processor(compiler, resources, node, attributes, elementInstruction);\n } catch (error) {\n aurelia_logging__WEBPACK_IMPORTED_MODULE_0__[\"getLogger\"]('templating').error(error);\n }\n };\n };\n}\n\nfunction doNotProcessContent() {\n return false;\n}\n\nfunction processContent(processor) {\n return function (t) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, t);\n r.processContent = processor ? function (compiler, resources, node, instruction) {\n try {\n return processor(compiler, resources, node, instruction);\n } catch (error) {\n aurelia_logging__WEBPACK_IMPORTED_MODULE_0__[\"getLogger\"]('templating').error(error);\n return false;\n }\n } : doNotProcessContent;\n };\n}\n\nfunction containerless(target) {\n var deco = function deco(t) {\n var r = aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].getOrCreateOwn(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, HtmlBehaviorResource, t);\n r.containerless = true;\n };\n\n return target ? deco(target) : deco;\n}\n\nfunction useViewStrategy(strategy) {\n return function (target) {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(ViewLocator.viewStrategyMetadataKey, strategy, target);\n };\n}\n\nfunction useView(path) {\n return useViewStrategy(new RelativeViewStrategy(path));\n}\n\nfunction inlineView(markup, dependencies, dependencyBaseUrl) {\n return useViewStrategy(new InlineViewStrategy(markup, dependencies, dependencyBaseUrl));\n}\n\nfunction noView(targetOrDependencies, dependencyBaseUrl) {\n var target = void 0;\n var dependencies = void 0;\n if (typeof targetOrDependencies === 'function') {\n target = targetOrDependencies;\n } else {\n dependencies = targetOrDependencies;\n target = undefined;\n }\n\n var deco = function deco(t) {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(ViewLocator.viewStrategyMetadataKey, new NoViewStrategy(dependencies, dependencyBaseUrl), t);\n };\n\n return target ? deco(target) : deco;\n}\n\nfunction view(templateOrConfig) {\n return function (target) {\n target.$view = templateOrConfig;\n };\n}\n\nfunction elementConfig(target) {\n var deco = function deco(t) {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].resource, new ElementConfigResource(), t);\n };\n\n return target ? deco(target) : deco;\n}\n\nfunction viewResources() {\n for (var _len = arguments.length, resources = Array(_len), _key7 = 0; _key7 < _len; _key7++) {\n resources[_key7] = arguments[_key7];\n }\n\n return function (target) {\n aurelia_metadata__WEBPACK_IMPORTED_MODULE_1__[\"metadata\"].define(ViewEngine.viewModelRequireMetadataKey, resources, target);\n };\n}\n\nvar TemplatingEngine = (_dec9 = Object(aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"inject\"])(aurelia_dependency_injection__WEBPACK_IMPORTED_MODULE_6__[\"Container\"], ModuleAnalyzer, ViewCompiler, CompositionEngine), _dec9(_class17 = function () {\n function TemplatingEngine(container, moduleAnalyzer, viewCompiler, compositionEngine) {\n \n\n this._container = container;\n this._moduleAnalyzer = moduleAnalyzer;\n this._viewCompiler = viewCompiler;\n this._compositionEngine = compositionEngine;\n container.registerInstance(Animator, Animator.instance = new Animator());\n }\n\n TemplatingEngine.prototype.configureAnimator = function configureAnimator(animator) {\n this._container.unregister(Animator);\n this._container.registerInstance(Animator, Animator.instance = animator);\n };\n\n TemplatingEngine.prototype.compose = function compose(context) {\n return this._compositionEngine.compose(context);\n };\n\n TemplatingEngine.prototype.enhance = function enhance(instruction) {\n if (instruction instanceof aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].Element) {\n instruction = { element: instruction };\n }\n\n var compilerInstructions = { letExpressions: [] };\n var resources = instruction.resources || this._container.get(ViewResources);\n\n this._viewCompiler._compileNode(instruction.element, resources, compilerInstructions, instruction.element.parentNode, 'root', true);\n\n var factory = new ViewFactory(instruction.element, compilerInstructions, resources);\n var container = instruction.container || this._container.createChild();\n var view = factory.create(container, BehaviorInstruction.enhance());\n\n view.bind(instruction.bindingContext || {}, instruction.overrideContext);\n\n view.firstChild = view.lastChild = view.fragment;\n view.fragment = aurelia_pal__WEBPACK_IMPORTED_MODULE_2__[\"DOM\"].createDocumentFragment();\n view.attached();\n\n return view;\n };\n\n return TemplatingEngine;\n}()) || _class17);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGlqOC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL25vZGVfbW9kdWxlcy9hdXJlbGlhLXRlbXBsYXRpbmcvZGlzdC9uYXRpdmUtbW9kdWxlcy9hdXJlbGlhLXRlbXBsYXRpbmcuanM/ODYyOCJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgX2NyZWF0ZUNsYXNzID0gZnVuY3Rpb24gKCkgeyBmdW5jdGlvbiBkZWZpbmVQcm9wZXJ0aWVzKHRhcmdldCwgcHJvcHMpIHsgZm9yICh2YXIgaSA9IDA7IGkgPCBwcm9wcy5sZW5ndGg7IGkrKykgeyB2YXIgZGVzY3JpcHRvciA9IHByb3BzW2ldOyBkZXNjcmlwdG9yLmVudW1lcmFibGUgPSBkZXNjcmlwdG9yLmVudW1lcmFibGUgfHwgZmFsc2U7IGRlc2NyaXB0b3IuY29uZmlndXJhYmxlID0gdHJ1ZTsgaWYgKFwidmFsdWVcIiBpbiBkZXNjcmlwdG9yKSBkZXNjcmlwdG9yLndyaXRhYmxlID0gdHJ1ZTsgT2JqZWN0LmRlZmluZVByb3BlcnR5KHRhcmdldCwgZGVzY3JpcHRvci5rZXksIGRlc2NyaXB0b3IpOyB9IH0gcmV0dXJuIGZ1bmN0aW9uIChDb25zdHJ1Y3RvciwgcHJvdG9Qcm9wcywgc3RhdGljUHJvcHMpIHsgaWYgKHByb3RvUHJvcHMpIGRlZmluZVByb3BlcnRpZXMoQ29uc3RydWN0b3IucHJvdG90eXBlLCBwcm90b1Byb3BzKTsgaWYgKHN0YXRpY1Byb3BzKSBkZWZpbmVQcm9wZXJ0aWVzKENvbnN0cnVjdG9yLCBzdGF0aWNQcm9wcyk7IHJldHVybiBDb25zdHJ1Y3RvcjsgfTsgfSgpO1xuXG52YXIgX3R5cGV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Y29udGFpbmVyID0gdmlld0VuZ2luZS5jb250YWluZXI7XG4gICAgICB2YXIgYXBwUmVzb3VyY2VzID0gdmlld0VuZ2luZS5hcHBSZXNvdXJjZXM7XG4gICAgICB2YXIgdmlld0NvbXBpbGVyID0gdmlld0VuZ2luZS52aWV3Q29tcGlsZXI7XG4gICAgICB2YXIgdmlld1Jlc291cmNlcyA9IG5ldyBWaWV3UmVzb3VyY2VzKGFwcFJlc291cmNlcyk7XG5cbiAgICAgIHZhciByZXNvdXJjZSA9IHZvaWQgMDtcbiAgICAgIHZhciBlbERlcHMgPSBbXTtcblxuICAgICAgaWYgKHRhcmdldCkge1xuICAgICAgICB2aWV3UmVzb3VyY2VzLmF1dG9SZWdpc3Rlcihjb250YWluZXIsIHRhcmdldCk7XG4gICAgICB9XG5cbiAgICAgIGZvciAodmFyIF9pdGVyYXRvciA9IGRlcGVuZGVuY2llcywgX2lzQXJyYXkgPSBBcnJheS5pc0FycmF5KF9pdGVyYXRvciksIF9pID0gMCwgX2l0ZXJhdG9yID0gX2lzQXJyYXkgPyBfaXRlcmF0b3IgOiBfaXRlcmF0b3JbU3ltYm9sLml0ZXJhdG9yXSgpOzspIHtcbiAgICAgICAgdmFyIF9yZWY7XG5cbiAgICAgICAgaWYgKF9pc0FycmF5KSB7XG4gICAgICAgICAgaWYgKF9pID49IF9pdGVyYXRvci5sZW5ndGgpIGJyZWFrO1xuICAgICAgICAgIF9yZWYgPSBfaXRlcmF0b3JbX2krK107XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgX2kgPSBfaXRlcmF0b3IubmV4dCgpO1xuICAgICAgICAgIGlmIChfaS5kb25lKSBicmVhaztcbiAgICAgICAgICBfcmVmID0gX2kudmFsdWU7XG4gICAgICAgIH1cblxuICAgICAgICB2YXIgZGVwID0gX3JlZjtcblxuICAgICAgICBpZiAodHlwZW9mIGRlcCA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgIHJlc291cmNlID0gdmlld1Jlc291cmNlcy5hdXRvUmVnaXN0ZXIoY29udGFpbmVyLCBkZXApO1xuICAgICAgICAgIGlmIChyZXNvdXJjZS5lbGVtZW50TmFtZSAhPT0gbnVsbCkge1xuICAgICAgICAgICAgZWxEZXBzLnB1c2gocmVzb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChkZXAgJiYgKHR5cGVvZiBkZXAgPT09ICd1bmRlZmluZWQnID8gJ3VuZGVmaW5lZCcgOiBfdHlwZW9mKGRlcCkpID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgIGZvciAodmFyIF9rZXkyIGluIGRlcCkge1xuICAgICAgICAgICAgdmFyIGV4cG9ydGVkID0gZGVwW19rZXkyXTtcbiAgICAgICAgICAgIGlmICh0eXBlb2YgZXhwb3J0ZWQgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICAgICAgcmVzb3VyY2UgPSB2aWV3UmVzb3VyY2VzLmF1dG9SZWdpc3Rlcihjb250YWluZXIsIGV4cG9ydGVkKTtcbiAgICAgICAgICAgICAgaWYgKHJlc291cmNlLmVsZW1lbnROYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgZWxEZXBzLnB1c2gocmVzb3VyY2UpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHRocm93IG5ldyBFcnJvcignZGVwZW5kZW5jeSBuZWl0aGVyIGZ1bmN0aW9uIG5vciBvYmplY3QuIFJlY2VpdmVkOiBcIicgKyAodHlwZW9mIGRlcCA9PT0gJ3VuZGVmaW5lZCcgPyAndW5kZWZpbmVkJyA6IF90eXBlb2YoZGVwKSkgKyAnXCInKTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICByZXR1cm4gUHJvbWlzZS5hbGwoZWxEZXBzLm1hcChmdW5jdGlvbiAoZWwpIHtcbiAgICAgICAgcmV0dXJuIGVsLmxvYWQoY29udGFpb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yA9IHZvaWQgMDtcblxuICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBpaSA9IF9jaGlsZHJlbjMubGVuZ3RoOyBpIDwgaWk7ICsraSkge1xuICAgICAgICAgICAgdmFyIGN1cnJlbnQgPSBfY2hpbGRyZW4zW2ldO1xuXG4gICAgICAgICAgICBpZiAoY3VycmVudC5hdU93bmVyVmlldyAhPT0gbGFzdFZpZXcpIHtcbiAgICAgICAgICAgICAgdmlld0luZGV4Kys7XG4gICAgICAgICAgICAgIGxhc3RWaWV3ID0gY3VycmVudC5hdU93bmVyVmlldztcblxuICAgICAgICAgICAgICBpZiAodmlld0luZGV4ID49IGluZGV4ICYmIGxhc3RWaWV3ICE9PSB2aWV3KSB7XG4gICAgICAgICAgICAgICAgX2NoaWxkcmVuMy5zcGxpY2UoaSwgMCwgbm9kZSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGN1cnJlbnQ7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmb3VuZC5hdVByb2plY3Rpb25DaGlsZHJlbi5wdXNoKG5vZGUpO1xuICAgICAgICByZXR1cm4gZm91bmQ7XG4gICAgICB9XG4gICAgfVxuXG4gICAgcmV0dXJuIHRoaXMuYW5jaG9yO1xuICB9O1xuXG4gIFNoYWRvd1Nsb3QucHJvdG90eXBlLnByb2plY3RUbyA9IGZ1bmN0aW9uIHByb2plY3RUbyhzbG90cykge1xuICAgIHRoaXMuZGVzdGluYXRpb25TbG90cyA9IHNsb3RzO1xuICB9O1xuXG4gIFNoYWRvd1Nsb3QucHJvdG90eXBlLnByb2plY3RGcm9tID0gZnVuY3Rpb24gcHJvamVjdEZyb20odmlldywgcHJvamVjdGlvblNvdXJjZSkge1xuICAgIHZhciBhbmNob3IgPSBET00uY3JlYXRlQ29tbWVudCgnYW5jaG9yJyk7XG4gICAgdmFyIHBhcmVudCA9IHRoaXMuYW5jaG9yLnBhcmVudE5v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nKSB7XG4gICAgdmFyIHJlc291cmNlID0gdm9pZCAwO1xuXG4gICAgaWYgKGV4aXN0aW5nICYmIGNvbnZlbnRpb25NYXJrIGluIGV4aXN0aW5nKSB7XG4gICAgICByZXR1cm4gZXhpc3Rpbmc7XG4gICAgfVxuICAgIGlmICgnJHJlc291cmNlJyBpbiB0YXJnZXQpIHtcbiAgICAgIHZhciBjb25maWcgPSB0YXJnZXQuJHJlc291cmNlO1xuXG4gICAgICBpZiAodHlwZW9mIGNvbmZpZyA9PT0gJ3N0cmluZycpIHtcbiAgICAgICAgcmVzb3VyY2UgPSBleGlzdGluZyB8fCBuZXcgSHRtbEJlaGF2aW9yUmVzb3VyY2UoKTtcbiAgICAgICAgcmVzb3VyY2VbY29udmVudGlvbk1hcmtdID0gdHJ1ZTtcbiAgICAgICAgaWYgKCFyZXNvdXJjZS5lbGVtZW50TmFtZSkge1xuICAgICAgICAgIHJlc291cmNlLmVsZW1lbnROYW1lID0gdmFsaWRhdGVCZWhhdmlvck5hbWUoY29uZmlnLCAnY3VzdG9tIGVsZW1lbnQnKTtcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgaWYgKHR5cGVvZiBjb25maWcgPT09ICdmdW5jdGlvbicpIHtcbiAgICAgICAgICBjb25maWcgPSBjb25maWcuY2FsbCh0YXJnZXQpO1xuICAgICAgICB9XG4gICAgICAgIGlmICh0eXBlb2YgY29uZmlnID09PSAnc3RyaW5nJykge1xuICAgICAgICAgIGNvbmZpZyA9IHsgbmFtZTogY29uZmlnIH07XG4gICAgICAgIH1cblxuICAgICAgICBjb25maWcgPSBPYmplY3QuYXNzaWduKHt9LCBjb25maWcpO1xuXG4gICAgICAgIHZhciByZXNvdXJjZVR5cGUgPSBjb25maWcudHlwZSB8fCAnZWxlbWVudCc7XG5cbiAgICAgICAgdmFyIF9uYW1lID0gY29uZmlnLm5hbWU7XG4gICAgICAgIHN3aXRjaCAocmVzb3VyY2VUeXBlKSB7XG4gICAgICAgICAgY2FzZSAnZWxlbWVudCc6Y2FzZSAnYXR0cmlidXRlJzpcbiAgICAgICAgICAgIHJlc291cmNlID0gZXhpc3RpbmcgfHwgbmV3IEh0bWxCZWhhdmlvclJlc291cmNlKCk7XG4gICAgICAgICAgICByZXNvdXJjZVtjb252ZW50aW9uTWFya10gPSB0cnVlO1xuICAgICAgICAgICAgaWYgKHJlc291cmNlVHlwZSA9PT0gJ2VsZW1lbnQnKSB7XG4gICAgICAgICAgICAgIGlmICghcmVzb3VyY2UuZWxlbWVudE5hbWUpIHtcbiAgICAgICAgICAgICAgICByZXNvdXJjZS5lbGVtZW50TmFtZSA9IF9uYW1lID8gdmFsaWRhdGVCZWhhdmlvck5hbWUoX25hbWUsICdjdXN0b20gZWxlbWVudCcpIDogX2h5cGhlbmF0ZSh0YXJnZXQubmFtZSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGlmICghcmVzb3VyY2UuYXR0cmlidXRlTmFtZSkge1xuICAgICAgICAgICAgICAgIHJlc291cmNlLmF0dHJpYnV0ZU5hbWUgPSBfbmFtZSA/IHZhbGlkYXRlQmVoYXZpb3JOYW1lKF9uYW1lLCAnY3VzdG9tIGF0dHJpYnV0ZScpIDogX2h5cGhlbmF0ZSh0YXJnZXQubmFtZSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICgndGVtcGxhdGVDb250cm9sbGVyJyBpbiBjb25maWcpIHtcbiAgICAgICAgICAgICAgY29uZmlnLmxpZnRzQ29udGVudCA9IGNvbmZpZy50ZW1wbGF0ZUNvbnRyb2xsZXI7XG4gICAgICAgICAgICAgIGRlbGV0ZSBjb25maWcudGVtcGxhdGVDb250cm9sbGVyO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCdkZWZhdWx0QmluZGluZ01vZGUnIGluIGNvbmZpZyAmJiByZXNvdXJjZS5hdHRyaWJ1dGVEZWZhdWx0QmluZGluZ01vZGUgIT09IHVuZGVmaW5lZCkge1xuICAgICAgICAgICAgICBjb25maWcuYXR0cmlidXRlRGVmYXVsdEJpbmRpbmdNb2RlID0gY29uZmlnLmRlZmF1bHRCaW5kaW5nTW9kZTtcbiAgICAgICAgICAgICAgZGVsZXRlIGNvbmZpZy5kZWZhdWx0QmluZGluZ01vZGU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGRlbGV0ZSBjb25maWcubmFtZTtcblxuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihyZXNvdXJjZSwgY29uZmlnKTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIGNhc2UgJ3ZhbHVlQ29udmVydGVyJzpcbiAgICAgICAgICAgIHJlc291cmNlID0gbmV3IFZhbHVlQ29udmVydGVyUmVzb3VyY2UoY2FtZWxDYXNlKF9uYW1lIHx8IHRhcmdldC5uYW1lKSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlICdiaW5kaW5nQmVoYXZpb3InOlxuICAgICAgICAgICAgcmVzb3VyY2UgPSBuZXcgQmluZGluZ0JlaGF2aW9yUmVzb3VyY2UoY2FtZWxDYXNlKF9uYW1lIHx8IHRhcmdldC5uYW1lKSk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlICd2aWV3RW5naW5lSG9va3MnOlxuICAgICAgICAgICAgcmVzb3VyY2UgPSBuZXcgVmlld0VuZ2luZUhvb2tzUmVzb3VyY2UoKTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGlmIChyZXNvdXJjZSBpbnN0YW5jZW9mIEh0bWxCZWhhdmlvclJlc291cmNlKSB7XG4gICAgICAgIHZhciBfYmluZGFibGVzID0gdHlwZW9mIGNvbmZpZyA9PT0gJ3N0cmluZycgPyB1bmRlZmluZWQgOiBjb25maWcuYmluZGFibGVzO1xuICAgICAgICB2YXIgY3VycmVudFByb3BzID0gcmVzb3VyY2UucHJvcGVydGllcztcbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoX2JpbmRhYmxlcykpIHtcbiAgICAgICAgICBmb3IgKHZhciBpID0gMCwgaWkgPSBfYmluZGFibGVzLmxlbmd0aDsgaWkgPiBpOyArK2kpIHtcbiAgICAgICAgICAgIHZhciBwcm9wID0gX2JpbmRhYmxlc1tpXTtcbiAgICAgICAgICAgIGlmICghcHJvcCB8fCB0eXBlb2YgcHJvcCAhPT0gJ3N0cmluZycgJiYgIXByb3AubmFtZSkge1xuICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoJ0ludmFsaWQgYmluZGFibGUgcHJvcGVydHkgYXQgXCInICsgaSArICdcIiBmb3IgY2xhc3MgXCInICsgdGFyZ2V0Lm5hbWUgKyAnXCIuIEV4cGVjdGVkIGVpdGhlciBhIHN0cmluZyBvciBhbiBvYmplY3Qgd2l0aCBcIm5hbWVcIiBwcm9wZXJ0eS4nKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBuZXdQcm9wID0gbmV3IEJpbmRhYmxlUHJvcGVydHkocHJvcCk7XG5cbiAgICAgICAgICAgIHZhciBleGlzdGVkID0gZmFsc2U7XG4gICAgICAgICAgICBmb3IgKHZhciBqID0gMCwgamogPSBjdXJyZW50UHJvcHMubGVuZ3RoOyBqaiA+IGo7ICsraikge1xuICAgICAgICAgICAgICBpZiAoY3VycmVudFByb3BzW2pdLm5hbWUgPT09IG5ld1Byb3AubmFtZSkge1xuICAgICAgICAgICAgICAgIGV4aXN0ZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoZXhpc3RlZCkge1xuICAgICAgICAgICAgICBjb250aW51ZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIG5ld1Byb3AucmVnaXN0ZXJXaXRoKHRhcmdldCwgcmVzb3VyY2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GkgPSB2b2lkIDA7XG4gICAgdmFyIHJtUHJvbWlzZXMgPSBbXTtcblxuICAgIGNoaWxkcmVuLmZvckVhY2goZnVuY3Rpb24gKGNoaWxkKSB7XG4gICAgICBpZiAoc2tpcEFuaW1hdGlvbikge1xuICAgICAgICBjaGlsZC5yZW1vdmVOb2RlcygpO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIHZhciBhbmltYXRpb24gPSBfdGhpczUuYW5pbWF0ZVZpZXcoY2hpbGQsICdsZWF2ZScpO1xuICAgICAgaWYgKGFuaW1hdGlvbikge1xuICAgICAgICBybVByb21pc2VzLnB1c2goYW5pbWF0aW9uLnRoZW4oZnVuY3Rpb24gKCkge1xuICAgICAgICAgIHJldHVybiBjaGlsZC5yZW1vdmVOb2RlcygpO1xuICAgICAgICB9KSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBjaGlsZC5yZW1vdmVOb2RlcygpO1xuICAgICAgfVxuICAgIH0pO1xuXG4gICAgdmFyIHJlbW92ZUFjdGlvbiA9IGZ1bmN0aW9uIHJlbW92ZUFjdGlvbigpIHtcbiAgICAgIGlmIChfdGhpczUuaXNBdHRhY2hlZCkge1xuICAgICAgICBmb3IgKGkgPSAwOyBpIDwgaWk7ICsraSkge1xuICAgICAgICAgIGNoaWxkcmVuW2ldLmRldGFjaGVkKCk7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKHJldHVyblRvQ2FjaGUpIHtcbiAgICAgICAgZm9yIChpID0gMDsgaSA8IGlpOyArK2kpIHtcbiAgICAgICAgICB2YXIgX2NoaWxkMyA9IGNoaWxkcmVuW2ldO1xuXG4gICAgICAgICAgaWYgKF9jaGlsZDMpIHtcbiAgICAgICAgICAgIF9jaGlsZDMucmV0dXJuVG9DYWNoZSgpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBfdGhpczUuY2hpbGRyZW4gPSBbXTtcbiAgICB9O1xuXG4gICAg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Chjb252ZW50aW9uYWwgPSBWaWV3UmVzb3VyY2VzLmNvbnZlbnRpb24oZXhwb3J0ZWRWYWx1ZSkpIHtcbiAgICAgICAgICBpZiAoY29udmVudGlvbmFsLmVsZW1lbnROYW1lICE9PSBudWxsICYmICFtYWluUmVzb3VyY2UpIHtcbiAgICAgICAgICAgIG1haW5SZXNvdXJjZSA9IG5ldyBSZXNvdXJjZURlc2NyaXB0aW9uKGtleSwgZXhwb3J0ZWRWYWx1ZSwgY29udmVudGlvbmFsKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmVzb3VyY2VzLnB1c2gobmV3IFJlc291cmNlRGVzY3JpcHRpb24oa2V5LCBleHBvcnRlZFZhbHVlLCBjb252ZW50aW9uYWwpKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgbWV0YWRhdGEuZGVmaW5lKG1ldGFkYXRhLnJlc291cmNlLCBjb252ZW50aW9uYWwsIGV4cG9ydGVkVmFsdWUpO1xuICAgICAgICB9IGVsc2UgaWYgKGNvbnZlbnRpb25hbCA9IEh0bWxCZWhhdmlvclJlc291cmNlLmNvbnZlbnRpb24oa2V5KSkge1xuICAgICAgICAgIGlmIChjb252ZW50aW9uYWwuZWxlbWVudE5hbWUgIT09IG51bGwgJiYgIW1haW5SZXNvdXJjZSkge1xuICAgICAgICAgICAgbWFpblJlc291cmNlID0gbmV3IFJlc291cmNlRGVzY3JpcHRpb24oa2V5LCBleHBvcnRlZFZhbHVlLCBjb252ZW50aW9uYWwpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICByZXNvdXJjZXMucHVzaChuZXcgUmVzb3VyY2VEZXNjcmlwdGlvbihrZXksIGV4cG9ydGVkVmFsdWUsIGNvbnZlbnRpb25hbCkpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIG1ldGFkYXRhLmRlZmluZShtZXRhZGF0YS5yZXNvdXJjZSwgY29udmVudGlvbmFsLCBleHBvcnRlZFZhbHVlKTtcbiAgICA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nNlcnZlci5zZWxmU3Vic2NyaWJlciA9IHNlbGZTdWJzY3JpYmVyO1xuICAgIH1cblxuICAgIHZhciBvdmVycmlkZUNvbnRleHQgPSB2b2lkIDA7XG4gICAgaWYgKHRoaXMudmlldyAhPT0gbnVsbCkge1xuICAgICAgaWYgKHNraXBTZWxmU3Vic2NyaWJlcikge1xuICAgICAgICB0aGlzLnZpZXcudmlld01vZGVsU2NvcGUgPSBzY29wZTtcbiAgICAgIH1cblxuICAgICAgaWYgKHRoaXMudmlld01vZGVsID09PSBzY29wZS5vdmVycmlkZUNvbnRleHQuYmluZGluZ0NvbnRleHQpIHtcbiAgICAgICAgb3ZlcnJpZGVDb250ZXh0ID0gc2NvcGUub3ZlcnJpZGVDb250ZXh0O1xuICAgICAgfSBlbHNlIGlmICh0aGlzLmluc3RydWN0aW9uLmluaGVyaXRCaW5kaW5nQ29udGV4dCkge1xuICAgICAgICBvdmVycmlkZUNvbnRleHQgPSBjcmVhdGVPdmVycmlkZUNvbnRleHQodGhpcy52aWV3TW9kZWwsIHNjb3BlLm92ZXJyaWRlQ29udGV4dCk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBvdmVycmlkZUNvbnRleHQgPSBjcmVhdGVPdmVycmlkZUNvbnRleHQodGhpcy52aWV3TW9kZWwpO1xuICAgICAgICBvdmVycmlkZUNvbnRleHQuX19wYXJlbnRPdmVycmlkZUNvbnRleHQgPSBzY29wZS5vdmVycmlkZUNvbnRleHQ7XG4gICAgICB9XG5cbiAgICAgIHRoaXMudmlldy5iaW5kKHRoaXMudmlld01vZGVsLCBvdmVycmlkZUNvbnRleHQpO1xuICAgIH0gZWxzZSBpZiAoc2tpcFNlbGZTdWJzY3JpYmVyKSB7XG4gICAgICBvdmVycmlkZUNvbnRleHQgPSBzY29wZS5vdmVycmlkZUNvbnRleHQ7XG5cbiAgICAgIGlmIChzY29wZS5vdmVycmlkZUNvbnRleHQuX19wYXJlbnRPdmVycmlkZUNvbnRleHQgIT09IHVuZGV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29tcGlsZXIuY29tcGlsZShjdXJyZW50Q2hpbGQsIHJlc291cmNlcyk7XG4gICAgICAgICAgICBET00ucmVtb3ZlTm9kZShjdXJyZW50Q2hpbGQsIHBhcmVudE5vZGUpO1xuICAgICAgICAgICAgaW5zdHJ1Y3Rpb24ucGFydFJlcGxhY2VtZW50cyA9IF9wYXJ0UmVwbGFjZW1lbnRzMjtcbiAgICAgICAgICB9IGVsc2UgaWYgKGNvbnRlbnRFbGVtZW50ICE9PSBudWxsKSB7XG4gICAgICAgICAgICBpZiAoY3VycmVudENoaWxkLm5vZGVUeXBlID09PSAzICYmIF9pc0FsbFdoaXRlc3BhY2UoY3VycmVudENoaWxkKSkge1xuICAgICAgICAgICAgICBET00ucmVtb3ZlTm9kZShjdXJyZW50Q2hpbGQsIHBhcmVudE5vZGUpO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgY29udGVudEVsZW1lbnQuYXBwZW5kQ2hpbGQoY3VycmVudENoaWxkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG5cbiAgICAgICAgICBjdXJyZW50Q2hpbGQgPSBuZXh0U2libGluZztcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChjb250ZW50RWxlbWVudCAhPT0gbnVsbCAmJiBjb250ZW50RWxlbWVudC5oYXNDaGlsZE5vZGVzKCkpIHtcbiAgICAgICAgICBub2RlLmFwcGVuZENoaWxkKGNvbnRlbnRFbGVtZW50KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGluc3RydWN0aW9uLnNraXBDb250ZW50UHJvY2Vzc2luZyA9IGZhbHNlO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgaW5zdHJ1Y3Rpb24uc2tpcENvbnRlbnRQcm9jZXNzaW5nID0gdHJ1ZTtcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKCF0aGlzLnByb2Nlc3NDb250ZW50KGNvbXBpbGVyLCByZXNvdXJjZXMsIG5vZGUsIGluc3RydWN0aW9u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1xuICAgIH1cblxuICAgIHZhciB2aWV3TW9kZWwgPSBpbnN0cnVjdGlvbi52aWV3TW9kZWwgfHwgY29udGFpbmVyLmdldCh0aGlzLnRhcmdldCk7XG4gICAgdmFyIGNvbnRyb2xsZXIgPSBuZXcgQ29udHJvbGxlcih0aGlzLCBpbnN0cnVjdGlvbiwgdmlld01vZGVsLCBjb250YWluZXIpO1xuICAgIHZhciBjaGlsZEJpbmRpbmdzID0gdGhpcy5jaGlsZEJpbmRpbmdzO1xuICAgIHZhciB2aWV3RmFjdG9yeSA9IHZvaWQgMDtcblxuICAgIGlmICh0aGlzLmxpZnRzQ29udGVudCkge1xuICAgICAgYXUuY29udHJvbGxlciA9IGNvbnRyb2xsZXI7XG4gICAgfSBlbHNlIGlmICh0aGlzLmVsZW1lbnROYW1lICE9PSBudWxsKSB7XG4gICAgICB2aWV3RmFjdG9yeSA9IGluc3RydWN0aW9uLnZpZXdGYWN0b3J5IHx8IHRoaXMudmlld0ZhY3Rvcnk7XG4gICAgICBjb250YWluZXIudmlld01vZGVsID0gdmlld01vZGVsO1xuXG4gICAgICBpZiAodmlld0ZhY3RvcnkpIHtcbiAgICAgICAgY29udHJvbGxlci52aWV3ID0gdmlld0ZhY3RvcnkuY3JlYXRlKGNvbnRhaW5lciwgaW5zdHJ1Y3Rpb24sIGVsZW1lbnQpO1xuICAgICAgfVxuXG4gICAgICBpZiAoZWxlbWVudCAhPT0gbnVsbCkge1xuICAgICAgICBhdS5jb250cm9sbGVyID0gY29udHJvbGxlcjtcblxuICAgICAgICBpZiAoY29udHJvbGxlci52aWV3KSB7XG4gICAgICAgICAgaWYgKCF0aGlzLnVzZXNTaGFkb3dET00gJiYgKGVsZW1lbnQuY2hpbGROb2Rlcy5sZW5ndGggPT09IDEgfHwgZWxlbWVudC5jb250ZW50RWxlbWVudCkpIHtcbiAgICAgICAgICAgIHZhciBjb250ZW50RWxlbWVudCA9IGVsZW1lbnQuY2hpbGROb2Rlc1swXSB8fCBlbGVtZW50LmNvbnRlbnRFbGVtZW50O1xuICAgICAgICAgICAgY29udHJvbGxlci52aWV3LmNvbnRlbnRWaWV3ID0geyBmcmFnbWVudDogY29udGVudEVsZW1lbnQgfTtcbiAgICAgICAgICAgIGNvbnRlbnRFbGVtZW50LnBhcmVudE5vZGUgJiYgRE9NLnJlbW92ZU5vZGUoY29udGVudEVsZW1lbnQpO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChpbnN0cnVjdGlvbi5hbmNob3JJc0NvbnRhaW5lcikge1xuICAgICAgICAgICAgaWYgKGNoaWxkQmluZGluZ3MgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgZm9yICh2YXIgX2k0ID0gMCwgX2lpMyA9IGNoaWxkQmluZGluZ3MubGVuZ3RoOyBfaTQgPCBfaWkzOyArK19pNCkge1xuICAgICAgICAgICAgICAgIGNvbnRyb2xsZXIudmlldy5hZGRCaW5kaW5nKGNoaWxkQmluZGluZ3NbX2k0XS5jcmVhdGUoZWxlbWVudCwgdmlld01vZGVsLCBjb250cm9sbGVyKSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgY29udHJvbGxlci52aWV3LmFwcGVuZE5vZGVzVG8odmlld0hvc3QpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBjb250cm9sbGVyLnZpZXcuaW5zZXJ0Tm9kZXNCZWZvcmUodmlld0hvc3QpO1xuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIGlmIChjaGlsZEJpbmRpbmdzICE9PSBudWxsKSB7XG4gICAgICAgICAgZm9yICh2YXIgX2k1ID0gMCwgX2lpNCA9IGNoaWxkQmluZGluZ3MubGVuZ3RoOyBfaTUgPCBfaWk0OyArK19pNSkge1xuICAgICAgICAgICAgYmluZGluZ3MucHVzaChjaGlsZEJpbmRpbmdzW19pNV0uY3JlYXRlKGVsZW1lbnQsIHZpZXdNb2RlbCwgY29udHJvbGxlcikpO1xuICAgICAgICAg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aXMudmlld01vZGVsW3RoaXMuY2hhbmdlSGFuZGxlcl0obm9NdXRhdGlvbnMpO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICB3aGlsZSAoY3VycmVudCkge1xuICAgICAgICAgIGlmICh0aGlzLm1hdGNoZXMoY3VycmVudCkpIHtcbiAgICAgICAgICAgIHZhciBfdmFsdWUgPSBjdXJyZW50LmF1ICYmIGN1cnJlbnQuYXUuY29udHJvbGxlciA/IGN1cnJlbnQuYXUuY29udHJvbGxlci52aWV3TW9kZWwgOiBjdXJyZW50O1xuICAgICAgICAgICAgdGhpcy52aWV3TW9kZWxbdGhpcy5wcm9wZXJ0eV0gPSBfdmFsdWU7XG5cbiAgICAgICAgICAgIGlmICh0aGlzLmNoYW5nZUhhbmRsZXIgIT09IG51bGwpIHtcbiAgICAgICAgICAgICAgdGhpcy52aWV3TW9kZWxbdGhpcy5jaGFuZ2VIYW5kbGVyXShfdmFsdWUpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBjdXJyZW50ID0gY3VycmVudC5uZXh0RWxlbWVudFNpYmxpbmc7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG4gIH07XG5cbiAgQ2hpbGRPYnNlcnZlckJpbmRlci5wcm90b3R5cGUub25SZW1vdmUgPSBmdW5jdGlvbiBvblJlbW92ZShlbGVtZW50KSB7XG4gICAgaWYgKHRoaXMubWF0Y2hlcyhlbGVtZW50KSkge1xuICAgICAgdmFyIF92YWx1ZTIgPSBlbGVtZW50LmF1ICYmIGVsZW1lbnQuYXUuY29udHJvbGxlciA/IGVsZW1lbnQuYXUuY29udHJvbGxlci52aWV3TW9kZWwgOiBlbGVtZW50O1xuXG4gICAgICBpZiAodGhpcy5hbGwpIHtcbiAgICAgICAgdmFyIGl0ZW1zID0gdGhpcy52aWV3TW9kZWxbdGhpcy5wcm9wZXJ0eV0gfHwgKHRoaXMudmlld01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vZGVsID0gZnVuY3Rpb24gZW5zdXJlVmlld01vZGVsKGNvbnRleHQpIHtcbiAgICB2YXIgY2hpbGRDb250YWluZXIgPSBjb250ZXh0LmNoaWxkQ29udGFpbmVyID0gY29udGV4dC5jaGlsZENvbnRhaW5lciB8fCBjb250ZXh0LmNvbnRhaW5lci5jcmVhdGVDaGlsZCgpO1xuXG4gICAgaWYgKHR5cGVvZiBjb250ZXh0LnZpZXdNb2RlbCA9PT0gJ3N0cmluZycpIHtcbiAgICAgIGNvbnRleHQudmlld01vZGVsID0gY29udGV4dC52aWV3UmVzb3VyY2VzID8gY29udGV4dC52aWV3UmVzb3VyY2VzLnJlbGF0aXZlVG9WaWV3KGNvbnRleHQudmlld01vZGVsKSA6IGNvbnRleHQudmlld01vZGVsO1xuXG4gICAgICByZXR1cm4gdGhpcy52aWV3RW5naW5lLmltcG9ydFZpZXdNb2RlbFJlc291cmNlKGNvbnRleHQudmlld01vZGVsKS50aGVuKGZ1bmN0aW9uICh2aWV3TW9kZWxSZXNvdXJjZSkge1xuICAgICAgICBjaGlsZENvbnRhaW5lci5hdXRvUmVnaXN0ZXIodmlld01vZGVsUmVzb3VyY2UudmFsdWUpO1xuXG4gICAgICAgIGlmIChjb250ZXh0Lmhvc3QpIHtcbiAgICAgICAgICBjaGlsZENvbnRhaW5lci5yZWdpc3Rlckluc3RhbmNlKERPTS5FbGVtZW50LCBjb250ZXh0Lmhvc3QpO1xuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC52aWV3TW9kZWwgPSBjaGlsZENvbnRhaW5lci52aWV3TW9kZWwgPSBjaGlsZENvbnRhaW5lci5nZXQodmlld01vZGVsUmVzb3VyY2UudmFsdWUpO1xuICAgICAgICBjb250ZXh0LnZpZXdNb2RlbFJlc291cmNlID0gdmlld01vZGVsUmVzb3VyY2U7XG4gICAgICAgIHJldHVybiBjb250ZXh0O1xuICAgICAgfSk7XG4gICAgfVxuXG4gICAgdmFyIGN0b3IgPSBjb250ZXh0LnZpZ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