text: System.register(['../brokers/StorageBroker', '../models/Task', 'aurelia-framework'], function (_export) {
    var StorageBroker, Task, inject, _classCallCheck, _createClass, TaskService;
  
    return {
      setters: [function (_brokersStorageBroker) {
        StorageBroker = _brokersStorageBroker.StorageBroker;
      }, function (_modelsTask) {
        Task = _modelsTask.Task;
      }, function (_aureliaFramework) {
        inject = _aureliaFramework.inject;
      }],
      execute: function () {
        'use strict';
  
        _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };
  
        _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; }; })();
  
        TaskService = (function () {
          function TaskService(storage) {
            _classCallCheck(this, _TaskService);
  
            this.storage = storage;
          }
  
          _createClass(TaskService, [{
            key: 'loadAllTasks',
            value: function loadAllTasks() {
              var tasks = this.storage.fetch('tasks') || [];
              return tasks.map(function (t) {
                return Task.parse(t);
              });
            }
          }, {
            key: 'loadFinishedTasks',
            value: function loadFinishedTasks() {
              return this.loadAllTasks().filter(function (task) {
                return task.isFinished;
              });
            }
          }, {
            key: 'getCurrentTask',
            value: function getCurrentTask() {
              return this.loadAllTasks().filter(function (task) {
                return !task.isFinished;
              })[0];
            }
          }, {
            key: 'saveTask',
            value: function saveTask(task) {
              if (!task.startTime) {
                return;
              }var allTasks = this.loadAllTasks();
              var existingTask = allTasks.filter(function (t) {
                return t.id === task.id;
              })[0];
              if (!existingTask) {
                allTasks.push(task);
              } else {
                allTasks[allTasks.indexOf(existingTask)] = task;
              }
              this.storage.save('tasks', allTasks);
            }
          }]);
  
          var _TaskService = TaskService;
          TaskService = inject(StorageBroker)(TaskService) || TaskService;
          return Task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