text: /* */ 
  define(['exports', 'aurelia-dependency-injection', 'aurelia-task-queue', 'aurelia-templating', 'aurelia-pal'], function (exports, _aureliaDependencyInjection, _aureliaTaskQueue, _aureliaTemplating, _aureliaPal) {
    'use strict';
  
    exports.__esModule = true;
  
    var _createDecoratedClass = (function () { function defineProperties(target, descriptors, initializers) { for (var i = 0; i < descriptors.length; i++) { var descriptor = descriptors[i]; var decorators = descriptor.decorators; var key = descriptor.key; delete descriptor.key; delete descriptor.decorators; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor || descriptor.initializer) descriptor.writable = true; if (decorators) { for (var f = 0; f < decorators.length; f++) { var decorator = decorators[f]; if (typeof decorator === 'function') { descriptor = decorator(target, key, descriptor) || descriptor; } else { throw new TypeError('The decorator for method ' + descriptor.key + ' is of the invalid type ' + typeof decorator); } } if (descriptor.initializer !== undefined) { initializers[key] = descriptor; continue; } } Object.defineProperty(target, key, descriptor); } } return function (Constructor, protoProps, staticProps, protoInitializers, staticInitializers) { if (protoProps) defineProperties(Constructor.prototype, protoProps, protoInitializers); if (staticProps) defineProperties(Constructor, staticProps, staticInitializers); return Constructor; }; })();
  
    function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
  
    function _defineDecoratedPropertyDescriptor(target, key, descriptors) { var _descriptor = descriptors[key]; if (!_descriptor) return; var descriptor = {}; for (var _key in _descriptor) descriptor[_key] = _descriptor[_key]; descriptor.value = descriptor.initializer ? descriptor.initializer.call(target) : undefined; Object.defineProperty(target, key, descriptor); }
  
    var Compose = (function () {
      var _instanceInitializers = {};
  
      _createDecoratedClass(Compose, [{
        key: 'model',
        decorators: [_aureliaTemplating.bindable],
        initializer: null,
        enumerable: true
      }, {
        key: 'view',
        decorators: [_aureliaTemplating.bindable],
        initializer: null,
        enumerable: true
      }, {
        key: 'viewModel',
        decorators: [_aureliaTemplating.bindable],
        initializer: null,
        enumerable: true
      }], null, _instanceInitializers);
  
      function Compose(element, container, compositionEngine, viewSlot, viewResources, taskQueue) {
        _classCallCheck(this, _Compose);
  
        _defineDecoratedPropertyDescriptor(this, 'model', _instanceInitializers);
  
        _defineDecoratedPropertyDescriptor(this, 'view', _instanceInitializers);
  
        _defineDecoratedPropertyDescriptor(this, 'viewModel', _instanceInitializers);
  
        this.element = element;
        this.container = container;
        this.compositionEngine = compositionEngine;
        this.viewSlot = viewSlot;
        this.viewResources = viewResources;
        this.taskQueue = taskQueue;
        this.currentController = null;
        this.currentViewModel = null;
      }
  
      Compose.prototype.created = function created(owningView) {
        this.owningView = owningView;
      };
  
      Compose.prototype.bind = function bind(bindingContext, overrideContext) {
        this.bindingContext = bindingContext;
        this.overrideContext = overrideContext;
        processInstruction(this, createInstruction(this, {
          view: this.view,
          viewModel: this.viewModel,
          model: this.model
        }));
      };
  
      Compose.prototype.unbind = function unbind(bindingContext, overrideContext) {
        this.bindingContext = null;
        this.overrideContext = null;
        var returnToCache = true;
        var skipAnimation = true;
        this.viewSlot.removeAll(returnToCache, skipAnimation);
      };
  
      Compose.prototype.modelChanged = function modelChanged(newValue, oldValue) {
        var _this = this;
  
        if (this.currentInstruction) {
          this.currentInstruction.model = newValue;
          return;
        }
  
        this.taskQueue.queueMicroTask(function () {
          if (_this.currentInstruction) {
            _this.currentInstruction.model = newValue;
            return;
          }
  
          var vm = _this.currentViewModel;
  
          if (vm && typeof vm.activate === 'function') {
            vm.activate(newValue);
          }
        });
      };
  
      Compose.prototype.viewChanged = function viewChanged(newValue, oldValue) {
        var _this2 = this;
  
        var instruction = createInstruction(this, {
          view: newValue,
          viewModel: this.currentViewModel || this.viewModel,
          model: this.model
        });
  
        if (this.currentInstruction) {
          this.currentInstruction = instruction;
          return;
        }
  
        this.currentInstruction = instruction;
        this.taskQueue.queueMicroTask(function () {
          return processInstruction(_this2, _this2.currentInstruction);
        });
      };
  
      Compose.prototype.viewModelChanged = function viewModelChanged(newValue, oldValue) {
        var _this3 = this;
  
        var instruction = createInstruction(this, {
          viewModel: newValue,
          view: this.view,
          model: this.model
        });
  
        if (this.currentInstruction) {
          this.currentInstruction = instruction;
          return;
        }
  
        this.currentInstruction = instruction;
        this.taskQueue.queueMicroTask(function () {
          return processInstruction(_this3, _this3.currentInstruction);
        });
      };
  
      var _Compose = Compose;
      Compose = _aureliaDependencyInjection.inject(_aureliaPal.DOM.Element, _aureliaDependencyInjection.Container, _aureliaTemplating.CompositionEngine, _aureliaTemplating.ViewSlot, _aureliaTemplating.ViewResources, _aureliaTaskQueue.TaskQueue)(Compose) || Compose;
      Compose = _aureliaTemplating.noView(Compose) || Compose;
      Compose = _aureliaTemplating.customElement('compose')(Compose) || Compose;
      return Compose;
    })();
  
    exports.Compose = Compose;
  
    function createInstruction(composer, instruction) {
      return Object.assign(instruction, {
        bindingContext: composer.bindingContext,
        overrideContext: composer.overrideContext,
        owningView: composer.owningView,
        container: composer.container,
        viewSlot: composer.viewSlot,
        viewResources: composer.viewResources,
        currentController: composer.currentController,
        host: composer.element
      });
    }
  
    function processInstruction(composer, instruction) {
      composer.currentInstruction = null;
      composer.compositionEngine.compose(instruction).then(function (controller) {
        composer.currentController = controller;
        composer.currentViewModel = controller ? controller.viewModel : null;
      });
    }
  });