ember-source 2.14.1 → 2.15.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9768a328a56c0b4e1ce563adefc27dde47eb12fd
4
- data.tar.gz: 3c0afe8e67ab67129cf6adad38079ac99fb3ab14
3
+ metadata.gz: 837dbd7fb572dd0ef6914e79596b0ed915b7902c
4
+ data.tar.gz: 999a619c076d16e997bb242b4900cbefa4d1c464
5
5
  SHA512:
6
- metadata.gz: b4e9854182f137d10d33798c5a99dbbe69a3abb018b41813a84e4440394bc02c250ab03765095655b02b2b9dcfac091df4e0ead502fa21137ebd4fa51daf4f13
7
- data.tar.gz: 0db4d86ea1e5628d1c046d92437e5e4d7886aa15dde2aca932cf072cf32db731a365f9765c114cc81ff64e0fd6377b3e1179e7e97e4592c78d13caa2978332ef
6
+ metadata.gz: 78d9e22bbcfe1a4386f7d3d6fdcb79080a22ad4855d83111f77669e3a3bfe5de8b7a51a32e788abe22c479dbdf5baffb99ae24dca07c58e9baf42ba84b3719f7
7
+ data.tar.gz: 4e0a5b4dd1e6a2b1eea3c11ff495472a9d791de4e82d989628b3af3e572343910f4792f749f268527939350fbea968fda8b3eb63cdb59988c614fed4f0b3c356
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.14.1
1
+ 2.15.0.beta.1
@@ -6,7 +6,7 @@
6
6
  * Portions Copyright 2008-2011 Apple Inc. All rights reserved.
7
7
  * @license Licensed under MIT license
8
8
  * See https://raw.github.com/emberjs/ember.js/master/LICENSE
9
- * @version 2.14.1
9
+ * @version 2.15.0-beta.1
10
10
  */
11
11
 
12
12
  var enifed, requireModule, Ember;
@@ -112,10 +112,10 @@ var mainContext = this; // Used in ember-environment/lib/global.js
112
112
  }
113
113
  })();
114
114
 
115
- enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'ember-environment'], function (exports, _emberBabel, _emberUtils, _emberDebug, _emberEnvironment) {
115
+ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'ember/features', 'ember-environment'], function (exports, _emberBabel, _emberUtils, _emberDebug, _features) {
116
116
  'use strict';
117
117
 
118
- exports.buildFakeContainerWithDeprecations = exports.Container = exports.privatize = exports.Registry = undefined;
118
+ exports.Container = exports.privatize = exports.Registry = undefined;
119
119
 
120
120
 
121
121
  /* globals Proxy */
@@ -134,16 +134,19 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
134
134
  @private
135
135
  @class Container
136
136
  */
137
- function Container(registry, options) {
137
+ function Container(registry) {
138
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
139
+
138
140
  this.registry = registry;
139
- this.owner = options && options.owner ? options.owner : null;
140
- this.cache = (0, _emberUtils.dictionary)(options && options.cache ? options.cache : null);
141
- this.factoryCache = (0, _emberUtils.dictionary)(options && options.factoryCache ? options.factoryCache : null);
142
- this.factoryManagerCache = (0, _emberUtils.dictionary)(options && options.factoryManagerCache ? options.factoryManagerCache : null);
143
- this.validationCache = (0, _emberUtils.dictionary)(options && options.validationCache ? options.validationCache : null);
144
- this._fakeContainerToInject = buildFakeContainerWithDeprecations(this);
141
+ this.owner = options.owner || null;
142
+ this.cache = (0, _emberUtils.dictionary)(options.cache || null);
143
+ this.factoryManagerCache = (0, _emberUtils.dictionary)(options.factoryManagerCache || null);
145
144
  this[CONTAINER_OVERRIDE] = undefined;
146
145
  this.isDestroyed = false;
146
+
147
+ if (true) {
148
+ this.validationCache = (0, _emberUtils.dictionary)(options.validationCache || null);
149
+ }
147
150
  }
148
151
 
149
152
  Container.prototype = {
@@ -152,19 +155,12 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
152
155
 
153
156
  return lookup(this, this.registry.normalize(fullName), options);
154
157
  },
155
- lookupFactory: function (fullName, options) {
156
- (true && !(this.registry.validateFullName(fullName)) && (0, _emberDebug.assert)('fullName must be a proper full name', this.registry.validateFullName(fullName)));
157
- (true && !(false) && (0, _emberDebug.deprecate)('Using "_lookupFactory" is deprecated. Please use container.factoryFor instead.', false, { id: 'container-lookupFactory', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x/#toc_migrating-from-_lookupfactory-to-factoryfor' }));
158
-
159
-
160
- return deprecatedFactoryFor(this, this.registry.normalize(fullName), options);
161
- },
162
158
  destroy: function () {
163
159
  destroyDestroyables(this);
164
160
  this.isDestroyed = true;
165
161
  },
166
162
  reset: function (fullName) {
167
- if (arguments.length > 0) {
163
+ if (fullName !== undefined) {
168
164
  resetMember(this, this.registry.normalize(fullName));
169
165
  } else {
170
166
  resetCache(this);
@@ -175,6 +171,9 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
175
171
 
176
172
  return _ref = {}, _ref[_emberUtils.OWNER] = this.owner, _ref;
177
173
  },
174
+ _resolverCacheKey: function (name, options) {
175
+ return this.registry.resolverCacheKey(name, options);
176
+ },
178
177
  factoryFor: function (fullName) {
179
178
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
180
179
 
@@ -184,20 +183,37 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
184
183
 
185
184
 
186
185
  if (options.source) {
187
- normalizedName = this.registry.expandLocalLookup(fullName, options);
186
+ var expandedFullName = this.registry.expandLocalLookup(fullName, options);
188
187
  // if expandLocalLookup returns falsey, we do not support local lookup
189
- if (!normalizedName) {
190
- return;
188
+ if (_features.EMBER_MODULE_UNIFICATION) {
189
+ if (expandedFullName) {
190
+ // with ember-module-unification, if expandLocalLookup returns something,
191
+ // pass it to the resolve without the source
192
+ normalizedName = expandedFullName;
193
+ options = {};
194
+ }
195
+ } else {
196
+ if (!expandedFullName) {
197
+ return;
198
+ }
199
+
200
+ normalizedName = expandedFullName;
191
201
  }
192
202
  }
193
203
 
194
- var cached = this.factoryManagerCache[normalizedName];
204
+ var cacheKey = this._resolverCacheKey(normalizedName, options);
205
+ var cached = this.factoryManagerCache[cacheKey];
195
206
 
196
- if (cached) {
207
+ if (cached !== undefined) {
197
208
  return cached;
198
209
  }
199
210
 
200
- var factory = this.registry.resolve(normalizedName);
211
+ var factory = void 0;
212
+ if (_features.EMBER_MODULE_UNIFICATION) {
213
+ factory = this.registry.resolve(normalizedName, options);
214
+ } else {
215
+ factory = this.registry.resolve(normalizedName);
216
+ }
201
217
 
202
218
  if (factory === undefined) {
203
219
  return;
@@ -213,7 +229,7 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
213
229
  manager = wrapManagerInDeprecationProxy(manager);
214
230
  }
215
231
 
216
- this.factoryManagerCache[normalizedName] = manager;
232
+ this.factoryManagerCache[cacheKey] = manager;
217
233
  return manager;
218
234
  }
219
235
  };
@@ -225,20 +241,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
225
241
  function wrapManagerInDeprecationProxy(manager) {
226
242
  if (_emberUtils.HAS_NATIVE_PROXY) {
227
243
  var validator = {
228
- get: function (obj, prop) {
229
- if (typeof prop === 'symbol') {
230
- return obj[prop];
231
- }
232
- if (prop === 'inspect') {
233
- return undefined; /* for nodes formatter */
234
- }
235
-
236
- if (prop !== 'class' && prop !== 'create' && prop !== 'toString') {
237
- throw new Error('You attempted to access "' + prop + '" on a factory manager created by container#factoryFor. "' + prop + '" is not a member of a factory manager."');
238
- }
239
-
240
- return obj[prop];
241
- },
242
244
  set: function (obj, prop, value) {
243
245
  throw new Error('You attempted to set "' + prop + '" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.');
244
246
  }
@@ -273,16 +275,29 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
273
275
  var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
274
276
 
275
277
  if (options.source) {
276
- fullName = container.registry.expandLocalLookup(fullName, options);
278
+ var expandedFullName = container.registry.expandLocalLookup(fullName, options);
279
+
280
+ if (_features.EMBER_MODULE_UNIFICATION) {
281
+ if (expandedFullName) {
282
+ // with ember-module-unification, if expandLocalLookup returns something,
283
+ // pass it to the resolve without the source
284
+ fullName = expandedFullName;
285
+ options = {};
286
+ }
287
+ } else {
288
+ // if expandLocalLookup returns falsey, we do not support local lookup
289
+ if (!expandedFullName) {
290
+ return;
291
+ }
277
292
 
278
- // if expandLocalLookup returns falsey, we do not support local lookup
279
- if (!fullName) {
280
- return;
293
+ fullName = expandedFullName;
281
294
  }
282
295
  }
283
296
 
284
- if (container.cache[fullName] !== undefined && options.singleton !== false) {
285
- return container.cache[fullName];
297
+ var cacheKey = container._resolverCacheKey(fullName, options);
298
+ var cached = container.cache[cacheKey];
299
+ if (cached !== undefined && options.singleton !== false) {
300
+ return cached;
286
301
  }
287
302
 
288
303
  return instantiateFactory(container, fullName, options);
@@ -292,41 +307,53 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
292
307
  var instantiate = _ref2.instantiate,
293
308
  singleton = _ref2.singleton;
294
309
 
295
- return singleton !== false && isSingleton(container, fullName) && !instantiate && !isInstantiatable(container, fullName);
310
+ return singleton !== false && !instantiate && isSingleton(container, fullName) && !isInstantiatable(container, fullName);
296
311
  }
297
312
 
298
313
  function isSingletonInstance(container, fullName, _ref3) {
299
314
  var instantiate = _ref3.instantiate,
300
315
  singleton = _ref3.singleton;
301
316
 
302
- return singleton !== false && isSingleton(container, fullName) && instantiate !== false && isInstantiatable(container, fullName);
317
+ return singleton !== false && instantiate !== false && isSingleton(container, fullName) && isInstantiatable(container, fullName);
303
318
  }
304
319
 
305
320
  function isFactoryClass(container, fullname, _ref4) {
306
321
  var instantiate = _ref4.instantiate,
307
322
  singleton = _ref4.singleton;
308
323
 
309
- return (singleton === false || !isSingleton(container, fullname)) && instantiate === false && !isInstantiatable(container, fullname);
324
+ return instantiate === false && (singleton === false || !isSingleton(container, fullname)) && !isInstantiatable(container, fullname);
310
325
  }
311
326
 
312
327
  function isFactoryInstance(container, fullName, _ref5) {
313
328
  var instantiate = _ref5.instantiate,
314
329
  singleton = _ref5.singleton;
315
330
 
316
- return (singleton !== false || isSingleton(container, fullName)) && instantiate !== false && isInstantiatable(container, fullName);
331
+ return instantiate !== false && (singleton !== false || isSingleton(container, fullName)) && isInstantiatable(container, fullName);
317
332
  }
318
333
 
319
334
  function instantiateFactory(container, fullName, options) {
320
- var factoryManager = container.factoryFor(fullName);
335
+
336
+ var factoryManager = void 0;
337
+ if (_features.EMBER_MODULE_UNIFICATION) {
338
+ if (options && options.source) {
339
+ factoryManager = container.factoryFor(fullName, options);
340
+ } else {
341
+ factoryManager = container.factoryFor(fullName);
342
+ }
343
+ } else {
344
+ factoryManager = container.factoryFor(fullName);
345
+ }
321
346
 
322
347
  if (factoryManager === undefined) {
323
348
  return;
324
349
  }
325
350
 
351
+ var cacheKey = container._resolverCacheKey(fullName, options);
352
+
326
353
  // SomeClass { singleton: true, instantiate: true } | { singleton: true } | { instantiate: true } | {}
327
354
  // By default majority of objects fall into this case
328
355
  if (isSingletonInstance(container, fullName, options)) {
329
- return container.cache[fullName] = factoryManager.create();
356
+ return container.cache[cacheKey] = factoryManager.create();
330
357
  }
331
358
 
332
359
  // SomeClass { singleton: false, instantiate: true }
@@ -346,8 +373,8 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
346
373
  injections._dynamic = true;
347
374
  }
348
375
 
349
- function areInjectionsDynamic(injections) {
350
- return !!injections._dynamic;
376
+ function areInjectionsNotDynamic(injections) {
377
+ return injections._dynamic !== true;
351
378
  }
352
379
 
353
380
  function buildInjections() /* container, ...injections */{
@@ -385,65 +412,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
385
412
  return hash;
386
413
  }
387
414
 
388
- function deprecatedFactoryFor(container, fullName) {
389
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
390
-
391
- var registry = container.registry;
392
-
393
- if (options.source) {
394
- fullName = registry.expandLocalLookup(fullName, options);
395
- // if expandLocalLookup returns falsey, we do not support local lookup
396
- if (!fullName) {
397
- return;
398
- }
399
- }
400
-
401
- var cache = container.factoryCache;
402
- if (cache[fullName]) {
403
- return cache[fullName];
404
- }
405
- var factory = registry.resolve(fullName);
406
- if (factory === undefined) {
407
- return;
408
- }
409
-
410
- var type = fullName.split(':')[0];
411
- if (!factory || typeof factory.extend !== 'function' || !_emberEnvironment.ENV.MODEL_FACTORY_INJECTIONS && type === 'model') {
412
- if (factory && typeof factory._onLookup === 'function') {
413
- factory._onLookup(fullName);
414
- }
415
-
416
- // TODO: think about a 'safe' merge style extension
417
- // for now just fallback to create time injection
418
- cache[fullName] = factory;
419
- return factory;
420
- } else {
421
- var injections = injectionsFor(container, fullName);
422
- var factoryInjections = factoryInjectionsFor(container, fullName);
423
- var cacheable = !areInjectionsDynamic(injections) && !areInjectionsDynamic(factoryInjections);
424
-
425
- factoryInjections[_emberUtils.NAME_KEY] = registry.makeToString(factory, fullName);
426
- injections._debugContainerKey = fullName;
427
- (0, _emberUtils.setOwner)(injections, container.owner);
428
-
429
- var injectedFactory = factory.extend(injections);
430
-
431
- // TODO - remove all `container` injections when Ember reaches v3.0.0
432
- injectDeprecatedContainer(injectedFactory.prototype, container);
433
- injectedFactory.reopenClass(factoryInjections);
434
-
435
- if (factory && typeof factory._onLookup === 'function') {
436
- factory._onLookup(fullName);
437
- }
438
-
439
- if (cacheable) {
440
- cache[fullName] = injectedFactory;
441
- }
442
-
443
- return injectedFactory;
444
- }
445
- }
446
-
447
415
  function injectionsFor(container, fullName) {
448
416
  var registry = container.registry;
449
417
  var splitName = fullName.split(':');
@@ -454,43 +422,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
454
422
  return injections;
455
423
  }
456
424
 
457
- function factoryInjectionsFor(container, fullName) {
458
- var registry = container.registry;
459
- var splitName = fullName.split(':');
460
- var type = splitName[0];
461
-
462
- var factoryInjections = buildInjections(container, registry.getFactoryTypeInjections(type), registry.getFactoryInjections(fullName));
463
- factoryInjections._debugContainerKey = fullName;
464
-
465
- return factoryInjections;
466
- }
467
-
468
- var INJECTED_DEPRECATED_CONTAINER_DESC = {
469
- configurable: true,
470
- enumerable: false,
471
- get: function () {
472
- (true && !(false) && (0, _emberDebug.deprecate)('Using the injected `container` is deprecated. Please use the `getOwner` helper instead to access the owner of this object.', false, { id: 'ember-application.injected-container', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }));
473
-
474
- return this[CONTAINER_OVERRIDE] || (0, _emberUtils.getOwner)(this).__container__;
475
- },
476
- set: function (value) {
477
- (true && !(false) && (0, _emberDebug.deprecate)('Providing the `container` property to ' + this + ' is deprecated. Please use `Ember.setOwner` or `owner.ownerInjection()` instead to provide an owner to the instance being created.', false, { id: 'ember-application.injected-container', until: '2.13.0', url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access' }));
478
-
479
-
480
- this[CONTAINER_OVERRIDE] = value;
481
-
482
- return value;
483
- }
484
- };
485
-
486
- // TODO - remove when Ember reaches v3.0.0
487
- function injectDeprecatedContainer(object, container) {
488
- if ('container' in object) {
489
- return;
490
- }
491
- Object.defineProperty(object, 'container', INJECTED_DEPRECATED_CONTAINER_DESC);
492
- }
493
-
494
425
  function destroyDestroyables(container) {
495
426
  var cache = container.cache;
496
427
  var keys = Object.keys(cache);
@@ -513,7 +444,7 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
513
444
  function resetMember(container, fullName) {
514
445
  var member = container.cache[fullName];
515
446
 
516
- delete container.factoryCache[fullName];
447
+ delete container.factoryManagerCache[fullName];
517
448
 
518
449
  if (member) {
519
450
  delete container.cache[fullName];
@@ -524,32 +455,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
524
455
  }
525
456
  }
526
457
 
527
- function buildFakeContainerWithDeprecations(container) {
528
- var fakeContainer = {};
529
- var propertyMappings = {
530
- lookup: 'lookup',
531
- lookupFactory: '_lookupFactory'
532
- };
533
-
534
- for (var containerProperty in propertyMappings) {
535
- fakeContainer[containerProperty] = buildFakeContainerFunction(container, containerProperty, propertyMappings[containerProperty]);
536
- }
537
-
538
- return fakeContainer;
539
- }
540
-
541
- function buildFakeContainerFunction(container, containerProperty, ownerProperty) {
542
- return function () {
543
- (true && !(false) && (0, _emberDebug.deprecate)('Using the injected `container` is deprecated. Please use the `getOwner` helper to access the owner of this object and then call `' + ownerProperty + '` instead.', false, {
544
- id: 'ember-application.injected-container',
545
- until: '2.13.0',
546
- url: 'http://emberjs.com/deprecations/v2.x#toc_injected-container-access'
547
- }));
548
-
549
- return container[containerProperty].apply(container, arguments);
550
- };
551
- }
552
-
553
458
  var FactoryManager = function () {
554
459
  function FactoryManager(container, factory, fullName, normalizedName) {
555
460
  (0, _emberBabel.classCallCheck)(this, FactoryManager);
@@ -574,11 +479,10 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
574
479
  FactoryManager.prototype.create = function create() {
575
480
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
576
481
 
577
-
578
482
  var injections = this.injections;
579
483
  if (injections === undefined) {
580
484
  injections = injectionsFor(this.container, this.normalizedName);
581
- if (areInjectionsDynamic(injections) === false) {
485
+ if (areInjectionsNotDynamic(injections)) {
582
486
  this.injections = injections;
583
487
  }
584
488
  }
@@ -602,11 +506,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
602
506
  throw new Error('Failed to create an instance of \'' + this.normalizedName + '\'. Most likely an improperly defined class or' + ' an invalid module export.');
603
507
  }
604
508
 
605
- var prototype = this.class.prototype;
606
- if (prototype) {
607
- injectDeprecatedContainer(prototype, this.container);
608
- }
609
-
610
509
  // required to allow access to things like
611
510
  // the customized toString, _debugContainerKey,
612
511
  // owner, etc. without a double extend and without
@@ -643,23 +542,22 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
643
542
  @class Registry
644
543
  @since 1.11.0
645
544
  */
646
- function Registry(options) {
647
- this.fallback = options && options.fallback ? options.fallback : null;
545
+ function Registry() {
546
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
648
547
 
649
- if (options && options.resolver) {
650
- this.resolver = options.resolver;
548
+ this.fallback = options.fallback || null;
651
549
 
550
+ if (options.resolver) {
551
+ this.resolver = options.resolver;
652
552
  if (typeof this.resolver === 'function') {
653
553
  deprecateResolverFunction(this);
654
554
  }
655
555
  }
656
556
 
657
- this.registrations = (0, _emberUtils.dictionary)(options && options.registrations ? options.registrations : null);
557
+ this.registrations = (0, _emberUtils.dictionary)(options.registrations || null);
658
558
 
659
559
  this._typeInjections = (0, _emberUtils.dictionary)(null);
660
560
  this._injections = (0, _emberUtils.dictionary)(null);
661
- this._factoryTypeInjections = (0, _emberUtils.dictionary)(null);
662
- this._factoryInjections = (0, _emberUtils.dictionary)(null);
663
561
 
664
562
  this._localLookupCache = Object.create(null);
665
563
  this._normalizeCache = (0, _emberUtils.dictionary)(null);
@@ -708,20 +606,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
708
606
  */
709
607
  _injections: null,
710
608
 
711
- /**
712
- @private
713
- @property _factoryTypeInjections
714
- @type InheritingDict
715
- */
716
- _factoryTypeInjections: null,
717
-
718
- /**
719
- @private
720
- @property _factoryInjections
721
- @type InheritingDict
722
- */
723
- _factoryInjections: null,
724
-
725
609
  /**
726
610
  @private
727
611
  @property _normalizeCache
@@ -911,31 +795,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
911
795
  fullName: normalizedInjectionName
912
796
  });
913
797
  },
914
- factoryTypeInjection: function (type, property, fullName) {
915
- var injections = this._factoryTypeInjections[type] || (this._factoryTypeInjections[type] = []);
916
-
917
- injections.push({
918
- property: property,
919
- fullName: this.normalize(fullName)
920
- });
921
- },
922
- factoryInjection: function (fullName, property, injectionName) {
923
- var normalizedName = this.normalize(fullName);
924
- var normalizedInjectionName = this.normalize(injectionName);
925
-
926
- this.validateFullName(injectionName);
927
-
928
- if (fullName.indexOf(':') === -1) {
929
- return this.factoryTypeInjection(normalizedName, property, normalizedInjectionName);
930
- }
931
-
932
- var injections = this._factoryInjections[normalizedName] || (this._factoryInjections[normalizedName] = []);
933
-
934
- injections.push({
935
- property: property,
936
- fullName: normalizedInjectionName
937
- });
938
- },
939
798
  knownForType: function (type) {
940
799
  var fallbackKnown = void 0,
941
800
  resolverKnown = void 0;
@@ -969,20 +828,7 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
969
828
  return true;
970
829
  },
971
830
  isValidFullName: function (fullName) {
972
- return !!VALID_FULL_NAME_REGEXP.test(fullName);
973
- },
974
- validateInjections: function (injections) {
975
- if (!injections) {
976
- return;
977
- }
978
-
979
- var fullName = void 0;
980
-
981
- for (var i = 0; i < injections.length; i++) {
982
- fullName = injections[i].fullName;
983
-
984
- (true && !(this.has(fullName)) && (0, _emberDebug.assert)('Attempting to inject an unknown injection: \'' + fullName + '\'', this.has(fullName)));
985
- }
831
+ return VALID_FULL_NAME_REGEXP.test(fullName);
986
832
  },
987
833
  normalizeInjectionsHash: function (hash) {
988
834
  var injections = [];
@@ -1015,30 +861,39 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
1015
861
  }
1016
862
  return injections;
1017
863
  },
1018
- getFactoryInjections: function (fullName) {
1019
- var injections = this._factoryInjections[fullName] || [];
1020
- if (this.fallback) {
1021
- injections = injections.concat(this.fallback.getFactoryInjections(fullName));
1022
- }
1023
- return injections;
1024
- },
1025
- getFactoryTypeInjections: function (type) {
1026
- var injections = this._factoryTypeInjections[type] || [];
1027
- if (this.fallback) {
1028
- injections = injections.concat(this.fallback.getFactoryTypeInjections(type));
864
+ resolverCacheKey: function (name, options) {
865
+ if (_features.EMBER_MODULE_UNIFICATION) {
866
+ return options && options.source ? options.source + ':' + name : name;
867
+ } else {
868
+ return name;
1029
869
  }
1030
- return injections;
1031
870
  }
1032
871
  };
1033
872
 
1034
873
  function deprecateResolverFunction(registry) {
1035
- (true && !(false) && (0, _emberDebug.deprecate)('Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.', false, { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'http://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' }));
874
+ (true && !(false) && (0, _emberDebug.deprecate)('Passing a `resolver` function into a Registry is deprecated. Please pass in a Resolver object with a `resolve` method.', false, { id: 'ember-application.registry-resolver-as-function', until: '3.0.0', url: 'https://emberjs.com/deprecations/v2.x#toc_registry-resolver-as-function' }));
1036
875
 
1037
876
  registry.resolver = {
1038
877
  resolve: registry.resolver
1039
878
  };
1040
879
  }
1041
880
 
881
+ if (true) {
882
+ Registry.prototype.validateInjections = function (injections) {
883
+ if (!injections) {
884
+ return;
885
+ }
886
+
887
+ var fullName = void 0;
888
+
889
+ for (var i = 0; i < injections.length; i++) {
890
+ fullName = injections[i].fullName;
891
+
892
+ (true && !(this.has(fullName)) && (0, _emberDebug.assert)('Attempting to inject an unknown injection: \'' + fullName + '\'', this.has(fullName)));
893
+ }
894
+ };
895
+ }
896
+
1042
897
  /**
1043
898
  Given a fullName and a source fullName returns the fully resolved
1044
899
  fullName. Used to allow for local lookup.
@@ -1098,26 +953,38 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
1098
953
  if (options && options.source) {
1099
954
  // when `source` is provided expand normalizedName
1100
955
  // and source into the full normalizedName
1101
- normalizedName = registry.expandLocalLookup(normalizedName, options);
956
+ var expandedNormalizedName = registry.expandLocalLookup(normalizedName, options);
957
+
958
+ if (_features.EMBER_MODULE_UNIFICATION) {
959
+ if (expandedNormalizedName) {
960
+ // with ember-module-unification, if expandLocalLookup returns something,
961
+ // pass it to the resolve without the source
962
+ normalizedName = expandedNormalizedName;
963
+ options = {};
964
+ }
965
+ } else {
966
+ // if expandLocalLookup returns falsey, we do not support local lookup
967
+ if (!expandedNormalizedName) {
968
+ return;
969
+ }
1102
970
 
1103
- // if expandLocalLookup returns falsey, we do not support local lookup
1104
- if (!normalizedName) {
1105
- return;
971
+ normalizedName = expandedNormalizedName;
1106
972
  }
1107
973
  }
1108
974
 
1109
- var cached = registry._resolveCache[normalizedName];
975
+ var cacheKey = registry.resolverCacheKey(normalizedName, options);
976
+ var cached = registry._resolveCache[cacheKey];
1110
977
  if (cached !== undefined) {
1111
978
  return cached;
1112
979
  }
1113
- if (registry._failCache[normalizedName]) {
980
+ if (registry._failCache[cacheKey]) {
1114
981
  return;
1115
982
  }
1116
983
 
1117
984
  var resolved = void 0;
1118
985
 
1119
986
  if (registry.resolver) {
1120
- resolved = registry.resolver.resolve(normalizedName);
987
+ resolved = registry.resolver.resolve(normalizedName, options && options.source);
1121
988
  }
1122
989
 
1123
990
  if (resolved === undefined) {
@@ -1125,9 +992,9 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
1125
992
  }
1126
993
 
1127
994
  if (resolved === undefined) {
1128
- registry._failCache[normalizedName] = true;
995
+ registry._failCache[cacheKey] = true;
1129
996
  } else {
1130
- registry._resolveCache[normalizedName] = resolved;
997
+ registry._resolveCache[cacheKey] = resolved;
1131
998
  }
1132
999
 
1133
1000
  return resolved;
@@ -1138,7 +1005,7 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
1138
1005
  }
1139
1006
 
1140
1007
  var privateNames = (0, _emberUtils.dictionary)(null);
1141
- var privateSuffix = '' + Math.random() + Date.now();
1008
+ var privateSuffix = ('' + Math.random() + Date.now()).replace('.', '');
1142
1009
 
1143
1010
  function privatize(_ref6) {
1144
1011
  var fullName = _ref6[0];
@@ -1165,7 +1032,6 @@ enifed('container', ['exports', 'ember-babel', 'ember-utils', 'ember-debug', 'em
1165
1032
  exports.Registry = Registry;
1166
1033
  exports.privatize = privatize;
1167
1034
  exports.Container = Container;
1168
- exports.buildFakeContainerWithDeprecations = buildFakeContainerWithDeprecations;
1169
1035
  });
1170
1036
  enifed('ember-babel', ['exports'], function (exports) {
1171
1037
  'use strict';
@@ -1233,7 +1099,7 @@ enifed('ember-babel', ['exports'], function (exports) {
1233
1099
 
1234
1100
  var possibleConstructorReturn = exports.possibleConstructorReturn = function (self, call) {
1235
1101
  if (!self) {
1236
- throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
1102
+ throw new ReferenceError('this hasn\'t been initialized - super() hasn\'t been called');
1237
1103
  }
1238
1104
  return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
1239
1105
  };
@@ -1545,7 +1411,7 @@ enifed('ember-environment', ['exports'], function (exports) {
1545
1411
  enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-debug', 'ember-babel', 'ember/features', '@glimmer/reference', 'require', 'ember-console', 'backburner'], function (exports, emberEnvironment, emberUtils, emberDebug, emberBabel, ember_features, _glimmer_reference, require, Logger, Backburner) {
1546
1412
  'use strict';
1547
1413
 
1548
- var require__default = 'default' in require ? require['default'] : require;
1414
+ require = 'default' in require ? require['default'] : require;
1549
1415
  Logger = 'default' in Logger ? Logger['default'] : Logger;
1550
1416
  Backburner = 'default' in Backburner ? Backburner['default'] : Backburner;
1551
1417
 
@@ -1563,7 +1429,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1563
1429
  cross-platform compatibility and object property observing. Ember-Runtime is
1564
1430
  small and performance-focused so you can use it alongside other
1565
1431
  cross-platform libraries such as jQuery. For more details, see
1566
- [Ember-Runtime](http://emberjs.com/api/modules/ember-runtime.html).
1432
+ [Ember-Runtime](https://emberjs.com/api/modules/ember-runtime.html).
1567
1433
 
1568
1434
  @class Ember
1569
1435
  @static
@@ -1595,7 +1461,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1595
1461
 
1596
1462
  var protoMethods = {
1597
1463
  addToListeners: function (eventName, target, method, flags) {
1598
- if (!this._listeners) {
1464
+ if (this._listeners === undefined) {
1599
1465
  this._listeners = [];
1600
1466
  }
1601
1467
  this._listeners.push(eventName, target, method, flags);
@@ -1604,13 +1470,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1604
1470
  if (this._listenersFinalized) {
1605
1471
  return;
1606
1472
  }
1607
- if (!this._listeners) {
1473
+ if (this._listeners === undefined) {
1608
1474
  this._listeners = [];
1609
1475
  }
1610
1476
  var pointer = this.parent;
1611
- while (pointer) {
1477
+ while (pointer !== undefined) {
1612
1478
  var listeners = pointer._listeners;
1613
- if (listeners) {
1479
+ if (listeners !== undefined) {
1614
1480
  this._listeners = this._listeners.concat(listeners);
1615
1481
  }
1616
1482
  if (pointer._listenersFinalized) {
@@ -1622,9 +1488,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1622
1488
  },
1623
1489
  removeFromListeners: function (eventName, target, method, didRemove) {
1624
1490
  var pointer = this;
1625
- while (pointer) {
1491
+ while (pointer !== undefined) {
1626
1492
  var listeners = pointer._listeners;
1627
- if (listeners) {
1493
+ if (listeners !== undefined) {
1628
1494
  for (var index = listeners.length - 4; index >= 0; index -= 4) {
1629
1495
  if (listeners[index] === eventName && (!method || listeners[index + 1] === target && listeners[index + 2] === method)) {
1630
1496
  if (pointer === this) {
@@ -1655,23 +1521,23 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1655
1521
  while (pointer !== undefined) {
1656
1522
  var listeners = pointer._listeners;
1657
1523
  if (listeners !== undefined) {
1658
- for (var index = 0; index < listeners.length - 3; index += 4) {
1524
+ for (var index = 0; index < listeners.length; index += 4) {
1659
1525
  if (listeners[index] === eventName) {
1660
1526
  result = result || [];
1661
1527
  pushUniqueListener(result, listeners, index);
1662
1528
  }
1663
1529
  }
1664
1530
  }
1665
- if (pointer._listenersFinalized === true) {
1531
+ if (pointer._listenersFinalized) {
1666
1532
  break;
1667
1533
  }
1668
1534
  pointer = pointer.parent;
1669
1535
  }
1670
1536
  var sus = this._suspendedListeners;
1671
1537
  if (sus !== undefined && result !== undefined) {
1672
- for (var susIndex = 0; susIndex < sus.length - 2; susIndex += 3) {
1538
+ for (var susIndex = 0; susIndex < sus.length; susIndex += 3) {
1673
1539
  if (eventName === sus[susIndex]) {
1674
- for (var resultIndex = 0; resultIndex < result.length - 2; resultIndex += 3) {
1540
+ for (var resultIndex = 0; resultIndex < result.length; resultIndex += 3) {
1675
1541
  if (result[resultIndex] === sus[susIndex + 1] && result[resultIndex + 1] === sus[susIndex + 2]) {
1676
1542
  result[resultIndex + 2] |= SUSPENDED;
1677
1543
  }
@@ -1683,7 +1549,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1683
1549
  },
1684
1550
  suspendListeners: function (eventNames, target, method, callback) {
1685
1551
  var sus = this._suspendedListeners;
1686
- if (!sus) {
1552
+ if (sus === undefined) {
1687
1553
  sus = this._suspendedListeners = [];
1688
1554
  }
1689
1555
  for (var i = 0; i < eventNames.length; i++) {
@@ -1706,10 +1572,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1706
1572
  watchedEvents: function () {
1707
1573
  var pointer = this;
1708
1574
  var names = {};
1709
- while (pointer) {
1575
+ while (pointer !== undefined) {
1710
1576
  var listeners = pointer._listeners;
1711
- if (listeners) {
1712
- for (var index = 0; index < listeners.length - 3; index += 4) {
1577
+ if (listeners !== undefined) {
1578
+ for (var index = 0; index < listeners.length; index += 4) {
1713
1579
  names[listeners[index]] = true;
1714
1580
  }
1715
1581
  }
@@ -1719,18 +1585,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1719
1585
  pointer = pointer.parent;
1720
1586
  }
1721
1587
  return Object.keys(names);
1722
- },
1723
- _initializeListeners: function () {
1724
- this._listeners = undefined;
1725
- this._listenersFinalized = undefined;
1726
- this._suspendedListeners = undefined;
1727
1588
  }
1728
1589
  };
1729
1590
 
1730
1591
  function pushUniqueListener(destination, source, index) {
1731
1592
  var target = source[index + 1];
1732
1593
  var method = source[index + 2];
1733
- for (var destinationIndex = 0; destinationIndex < destination.length - 2; destinationIndex += 3) {
1594
+ for (var destinationIndex = 0; destinationIndex < destination.length; destinationIndex += 3) {
1734
1595
  if (destination[destinationIndex] === target && destination[destinationIndex + 1] === method) {
1735
1596
  return;
1736
1597
  }
@@ -1817,7 +1678,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1817
1678
  true && !(eventName !== 'didInitAttrs') && emberDebug.deprecate('didInitAttrs called in ' + (obj && obj.toString && obj.toString()) + '.', eventName !== 'didInitAttrs', {
1818
1679
  id: 'ember-views.did-init-attrs',
1819
1680
  until: '3.0.0',
1820
- url: 'http://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs'
1681
+ url: 'https://emberjs.com/deprecations/v2.x#toc_ember-component-didinitattrs'
1821
1682
  });
1822
1683
 
1823
1684
  if (!method && 'function' === typeof target) {
@@ -1858,11 +1719,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1858
1719
  target = null;
1859
1720
  }
1860
1721
 
1861
- meta(obj).removeFromListeners(eventName, target, method, function () {
1862
- if ('function' === typeof obj.didRemoveListener) {
1863
- obj.didRemoveListener.apply(obj, arguments);
1864
- }
1865
- });
1722
+ var func = 'function' === typeof obj.didRemoveListener ? obj.didRemoveListener.bind(obj) : function () {};
1723
+ meta(obj).removeFromListeners(eventName, target, method, func);
1866
1724
  }
1867
1725
 
1868
1726
  /**
@@ -1917,7 +1775,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1917
1775
  @param obj
1918
1776
  */
1919
1777
  function watchedEvents(obj) {
1920
- return meta(obj).watchedEvents();
1778
+ var meta$$1 = exports.peekMeta(obj);
1779
+ return meta$$1 && meta$$1.watchedEvents() || [];
1921
1780
  }
1922
1781
 
1923
1782
  /**
@@ -1943,7 +1802,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
1943
1802
  }
1944
1803
 
1945
1804
  if (actions === undefined || actions.length === 0) {
1946
- return;
1805
+ return false;
1947
1806
  }
1948
1807
 
1949
1808
  for (var i = actions.length - 3; i >= 0; i -= 3) {
@@ -2057,15 +1916,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2057
1916
  return func;
2058
1917
  }
2059
1918
 
2060
- function isProxy(value) {
2061
- if (typeof value === 'object' && value) {
2062
- var meta$$1 = exports.peekMeta(value);
2063
- return meta$$1 && meta$$1.isProxy();
2064
- }
2065
-
2066
- return false;
2067
- }
2068
-
2069
1919
  var hasViews = function () {
2070
1920
  return false;
2071
1921
  };
@@ -2098,7 +1948,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2098
1948
  }
2099
1949
 
2100
1950
  function tagFor(object, _meta) {
2101
- if (typeof object === 'object' && object) {
1951
+ if (typeof object === 'object' && object !== null) {
2102
1952
  var meta$$1 = _meta || meta(object);
2103
1953
  return meta$$1.writableTag(makeTag);
2104
1954
  } else {
@@ -2109,14 +1959,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2109
1959
  function markObjectAsDirty(meta$$1, propertyKey) {
2110
1960
  var objectTag = meta$$1.readableTag();
2111
1961
 
2112
- if (objectTag) {
1962
+ if (objectTag !== undefined) {
2113
1963
  objectTag.dirty();
2114
1964
  }
2115
1965
 
2116
1966
  var tags = meta$$1.readableTags();
2117
- var propertyTag = tags && tags[propertyKey];
1967
+ var propertyTag = tags !== undefined ? tags[propertyKey] : undefined;
2118
1968
 
2119
- if (propertyTag) {
1969
+ if (propertyTag !== undefined) {
2120
1970
  propertyTag.dirty();
2121
1971
  }
2122
1972
 
@@ -2124,22 +1974,19 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2124
1974
  meta$$1.getTag().contentDidChange();
2125
1975
  }
2126
1976
 
2127
- if (objectTag || propertyTag) {
1977
+ if (objectTag !== undefined || propertyTag !== undefined) {
2128
1978
  ensureRunloop();
2129
1979
  }
2130
1980
  }
2131
1981
 
2132
1982
  var run = void 0;
2133
-
2134
- function K() {}
2135
-
2136
1983
  function ensureRunloop() {
2137
- if (!run) {
2138
- run = require__default('ember-metal').run;
1984
+ if (run === undefined) {
1985
+ run = require('ember-metal').run;
2139
1986
  }
2140
1987
 
2141
- if (hasViews() && !run.backburner.currentInstance) {
2142
- run.schedule('actions', K);
1988
+ if (hasViews()) {
1989
+ run.backburner.ensureInstance();
2143
1990
  }
2144
1991
  }
2145
1992
 
@@ -2340,10 +2187,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2340
2187
 
2341
2188
  var watching = meta$$1 && meta$$1.peekWatching(keyName) > 0;
2342
2189
  var possibleDesc = obj[keyName];
2343
- var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
2190
+ var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2344
2191
 
2345
- if (desc && desc.willChange) {
2346
- desc.willChange(obj, keyName);
2192
+ if (isDescriptor && possibleDesc.willChange) {
2193
+ possibleDesc.willChange(obj, keyName);
2347
2194
  }
2348
2195
 
2349
2196
  if (watching) {
@@ -2379,11 +2226,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2379
2226
  }
2380
2227
 
2381
2228
  var possibleDesc = obj[keyName];
2382
- var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
2229
+ var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2383
2230
 
2384
2231
  // shouldn't this mean that we're watching this key?
2385
- if (desc && desc.didChange) {
2386
- desc.didChange(obj, keyName);
2232
+ if (isDescriptor && possibleDesc.didChange) {
2233
+ possibleDesc.didChange(obj, keyName);
2387
2234
  }
2388
2235
 
2389
2236
  if (hasMeta && meta$$1.peekWatching(keyName) > 0) {
@@ -2452,7 +2299,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2452
2299
 
2453
2300
  function iterDeps(method, obj, depKey, seen, meta$$1) {
2454
2301
  var possibleDesc = void 0,
2455
- desc = void 0;
2302
+ isDescriptor = void 0;
2456
2303
  var guid = emberUtils.guidFor(obj);
2457
2304
  var current = seen[guid];
2458
2305
 
@@ -2472,9 +2319,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2472
2319
  }
2473
2320
 
2474
2321
  possibleDesc = obj[key];
2475
- desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
2322
+ isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2476
2323
 
2477
- if (desc && desc._suspended === obj) {
2324
+ if (isDescriptor && possibleDesc._suspended === obj) {
2478
2325
  return;
2479
2326
  }
2480
2327
 
@@ -2707,14 +2554,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2707
2554
  if (!meta$$1) {
2708
2555
  meta$$1 = meta(obj);
2709
2556
  }
2710
- var watchEntry = meta$$1.peekWatching(keyName);
2711
- var possibleDesc = obj[keyName];
2712
- var existingDesc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
2713
2557
 
2558
+ var watchEntry = meta$$1.peekWatching(keyName);
2714
2559
  var watching = watchEntry !== undefined && watchEntry > 0;
2560
+ var possibleDesc = obj[keyName];
2561
+ var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2715
2562
 
2716
- if (existingDesc) {
2717
- existingDesc.teardown(obj, keyName);
2563
+ if (isDescriptor) {
2564
+ possibleDesc.teardown(obj, keyName, meta$$1);
2718
2565
  }
2719
2566
 
2720
2567
  var value = void 0;
@@ -2740,38 +2587,36 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2740
2587
  if (typeof desc.setup === 'function') {
2741
2588
  desc.setup(obj, keyName);
2742
2589
  }
2743
- } else {
2744
- if (desc == null) {
2745
- value = data;
2590
+ } else if (desc === undefined || desc === null) {
2591
+ value = data;
2746
2592
 
2747
- if (ember_features.MANDATORY_SETTER) {
2748
- if (watching) {
2749
- meta$$1.writeValues(keyName, data);
2593
+ if (ember_features.MANDATORY_SETTER) {
2594
+ if (watching) {
2595
+ meta$$1.writeValues(keyName, data);
2750
2596
 
2751
- var defaultDescriptor = {
2752
- configurable: true,
2753
- enumerable: true,
2754
- set: MANDATORY_SETTER_FUNCTION(keyName),
2755
- get: DEFAULT_GETTER_FUNCTION(keyName)
2756
- };
2597
+ var defaultDescriptor = {
2598
+ configurable: true,
2599
+ enumerable: true,
2600
+ set: MANDATORY_SETTER_FUNCTION(keyName),
2601
+ get: DEFAULT_GETTER_FUNCTION(keyName)
2602
+ };
2757
2603
 
2758
- if (REDEFINE_SUPPORTED) {
2759
- Object.defineProperty(obj, keyName, defaultDescriptor);
2760
- } else {
2761
- handleBrokenPhantomDefineProperty(obj, keyName, defaultDescriptor);
2762
- }
2604
+ if (REDEFINE_SUPPORTED) {
2605
+ Object.defineProperty(obj, keyName, defaultDescriptor);
2763
2606
  } else {
2764
- obj[keyName] = data;
2607
+ handleBrokenPhantomDefineProperty(obj, keyName, defaultDescriptor);
2765
2608
  }
2766
2609
  } else {
2767
2610
  obj[keyName] = data;
2768
2611
  }
2769
2612
  } else {
2770
- value = desc;
2771
-
2772
- // fallback to ES5
2773
- Object.defineProperty(obj, keyName, desc);
2613
+ obj[keyName] = data;
2774
2614
  }
2615
+ } else {
2616
+ value = desc;
2617
+
2618
+ // fallback to ES5
2619
+ Object.defineProperty(obj, keyName, desc);
2775
2620
  }
2776
2621
 
2777
2622
  // if key is being watched, override chains that
@@ -2817,16 +2662,17 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2817
2662
  if (typeof obj !== 'object' || obj === null) {
2818
2663
  return;
2819
2664
  }
2820
- var m = meta$$1 || meta(obj);
2821
2665
 
2822
- // activate watching first time
2823
- if (!m.peekWatching(keyName)) {
2824
- m.writeWatching(keyName, 1);
2666
+ var m = meta$$1 || meta(obj);
2667
+ var count = m.peekWatching(keyName) || 0;
2668
+ m.writeWatching(keyName, count + 1);
2825
2669
 
2670
+ if (count === 0) {
2671
+ // activate watching first time
2826
2672
  var possibleDesc = obj[keyName];
2827
- var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
2828
- if (desc && desc.willWatch) {
2829
- desc.willWatch(obj, keyName);
2673
+ var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2674
+ if (isDescriptor && possibleDesc.willWatch) {
2675
+ possibleDesc.willWatch(obj, keyName);
2830
2676
  }
2831
2677
 
2832
2678
  if ('function' === typeof obj.willWatchProperty) {
@@ -2837,8 +2683,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2837
2683
  // NOTE: this is dropped for prod + minified builds
2838
2684
  handleMandatorySetter(m, obj, keyName);
2839
2685
  }
2840
- } else {
2841
- m.writeWatching(keyName, (m.peekWatching(keyName) || 0) + 1);
2842
2686
  }
2843
2687
  }
2844
2688
 
@@ -2856,10 +2700,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2856
2700
  // ember strip this entire block out
2857
2701
  handleMandatorySetter = function handleMandatorySetter(m, obj, keyName) {
2858
2702
  var descriptor = emberUtils.lookupDescriptor(obj, keyName);
2859
- var configurable = descriptor ? descriptor.configurable : true;
2860
- var isWritable = descriptor ? descriptor.writable : true;
2861
- var hasValue = descriptor ? 'value' in descriptor : true;
2862
- var possibleDesc = descriptor && descriptor.value;
2703
+ var hasDescriptor = descriptor !== null;
2704
+ var configurable = hasDescriptor ? descriptor.configurable : true;
2705
+ var isWritable = hasDescriptor ? descriptor.writable : true;
2706
+ var hasValue = hasDescriptor ? 'value' in descriptor : true;
2707
+ var possibleDesc = hasDescriptor && descriptor.value;
2863
2708
  var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2864
2709
 
2865
2710
  if (isDescriptor) {
@@ -2891,10 +2736,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2891
2736
  if (typeof obj !== 'object' || obj === null) {
2892
2737
  return;
2893
2738
  }
2894
- var meta$$1 = _meta || meta(obj);
2739
+ var meta$$1 = _meta || exports.peekMeta(obj);
2895
2740
 
2896
2741
  // do nothing of this object has already been destroyed
2897
- if (meta$$1.isSourceDestroyed()) {
2742
+ if (!meta$$1 || meta$$1.isSourceDestroyed()) {
2898
2743
  return;
2899
2744
  }
2900
2745
 
@@ -2903,10 +2748,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2903
2748
  meta$$1.writeWatching(keyName, 0);
2904
2749
 
2905
2750
  var possibleDesc = obj[keyName];
2906
- var desc = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor ? possibleDesc : undefined;
2751
+ var isDescriptor = possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor;
2907
2752
 
2908
- if (desc && desc.didUnwatch) {
2909
- desc.didUnwatch(obj, keyName);
2753
+ if (isDescriptor && possibleDesc.didUnwatch) {
2754
+ possibleDesc.didUnwatch(obj, keyName);
2910
2755
  }
2911
2756
 
2912
2757
  if ('function' === typeof obj.didUnwatchProperty) {
@@ -2922,7 +2767,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2922
2767
  // for mutation, will bypass observation. This code exists to assert when
2923
2768
  // that occurs, and attempt to provide more helpful feedback. The alternative
2924
2769
  // is tricky to debug partially observable properties.
2925
- if (!desc && keyName in obj) {
2770
+ if (!isDescriptor && keyName in obj) {
2926
2771
  var maybeMandatoryDescriptor = emberUtils.lookupDescriptor(obj, keyName);
2927
2772
 
2928
2773
  if (maybeMandatoryDescriptor.set && maybeMandatoryDescriptor.set.isMandatorySetter) {
@@ -2966,12 +2811,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2966
2811
  }
2967
2812
  var m = meta$$1 || meta(obj);
2968
2813
  var counter = m.peekWatching(keyPath) || 0;
2969
- if (!counter) {
2814
+
2815
+ m.writeWatching(keyPath, counter + 1);
2816
+ if (counter === 0) {
2970
2817
  // activate watching first time
2971
- m.writeWatching(keyPath, 1);
2972
2818
  chainsFor(obj, m).add(keyPath);
2973
- } else {
2974
- m.writeWatching(keyPath, counter + 1);
2975
2819
  }
2976
2820
  }
2977
2821
 
@@ -2979,7 +2823,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2979
2823
  if (typeof obj !== 'object' || obj === null) {
2980
2824
  return;
2981
2825
  }
2982
- var m = meta$$1 || meta(obj);
2826
+ var m = meta$$1 || exports.peekMeta(obj);
2827
+ if (m === undefined) {
2828
+ return;
2829
+ }
2983
2830
  var counter = m.peekWatching(keyPath) || 0;
2984
2831
 
2985
2832
  if (counter === 1) {
@@ -2997,7 +2844,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
2997
2844
  }
2998
2845
 
2999
2846
  function isObject(obj) {
3000
- return typeof obj === 'object' && obj;
2847
+ return typeof obj === 'object' && obj !== null;
3001
2848
  }
3002
2849
 
3003
2850
  function isVolatile(obj) {
@@ -3025,7 +2872,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3025
2872
 
3026
2873
  ChainWatchers.prototype.remove = function remove(key, node) {
3027
2874
  var nodes = this.chains[key];
3028
- if (nodes) {
2875
+ if (nodes !== undefined) {
3029
2876
  for (var i = 0; i < nodes.length; i++) {
3030
2877
  if (nodes[i] === node) {
3031
2878
  nodes.splice(i, 1);
@@ -3035,9 +2882,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3035
2882
  }
3036
2883
  };
3037
2884
 
3038
- ChainWatchers.prototype.has = function has$$1(key, node) {
2885
+ ChainWatchers.prototype.has = function has(key, node) {
3039
2886
  var nodes = this.chains[key];
3040
- if (nodes) {
2887
+ if (nodes !== undefined) {
3041
2888
  for (var i = 0; i < nodes.length; i++) {
3042
2889
  if (nodes[i] === node) {
3043
2890
  return true;
@@ -3149,10 +2996,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3149
2996
 
3150
2997
  this._value = value;
3151
2998
  this._paths = undefined;
3152
- if (isWatching === true) {
2999
+ if (isWatching) {
3153
3000
  var obj = parent.value();
3154
3001
 
3155
- if (!isObject(obj) === true) {
3002
+ if (!isObject(obj)) {
3156
3003
  return;
3157
3004
  }
3158
3005
 
@@ -3163,7 +3010,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3163
3010
  }
3164
3011
 
3165
3012
  ChainNode.prototype.value = function value() {
3166
- if (this._value === undefined && this._watching === true) {
3013
+ if (this._value === undefined && this._watching) {
3167
3014
  var obj = this._parent.value();
3168
3015
  this._value = lazyGet(obj, this._key);
3169
3016
  }
@@ -3171,11 +3018,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3171
3018
  };
3172
3019
 
3173
3020
  ChainNode.prototype.destroy = function destroy() {
3174
- if (this._watching === true) {
3175
- var obj = this._object;
3176
- if (obj) {
3177
- removeChainWatcher(obj, this._key, this);
3178
- }
3021
+ if (this._watching) {
3022
+ removeChainWatcher(this._object, this._key, this);
3179
3023
  this._watching = false; // so future calls do nothing
3180
3024
  }
3181
3025
  };
@@ -3275,13 +3119,11 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3275
3119
  };
3276
3120
 
3277
3121
  ChainNode.prototype.notify = function notify(revalidate, affected) {
3278
- if (revalidate && this._watching === true) {
3122
+ if (revalidate && this._watching) {
3279
3123
  var parentValue = this._parent.value();
3280
3124
 
3281
3125
  if (parentValue !== this._object) {
3282
- if (this._object !== undefined) {
3283
- removeChainWatcher(this._object, this._key, this);
3284
- }
3126
+ removeChainWatcher(this._object, this._key, this);
3285
3127
 
3286
3128
  if (isObject(parentValue)) {
3287
3129
  this._object = parentValue;
@@ -3340,12 +3182,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3340
3182
  }
3341
3183
 
3342
3184
  // Use `get` if the return value is an EachProxy or an uncacheable value.
3343
- if (isVolatile(obj[key]) === true) {
3185
+ if (isVolatile(obj[key])) {
3344
3186
  return get(obj, key);
3345
3187
  // Otherwise attempt to get the cached value of the computed property
3346
3188
  } else {
3347
3189
  var cache = meta$$1.readableCache();
3348
- if (cache) {
3190
+ if (cache !== undefined) {
3349
3191
  return cacheFor.get(cache, key);
3350
3192
  }
3351
3193
  }
@@ -3364,53 +3206,24 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3364
3206
  }
3365
3207
  }
3366
3208
 
3367
- var counters = {
3368
- peekCalls: 0,
3369
- peekParentCalls: 0,
3370
- peekPrototypeWalks: 0,
3371
- setCalls: 0,
3372
- deleteCalls: 0,
3373
- metaCalls: 0,
3374
- metaInstantiated: 0
3375
- };
3209
+ var counters = void 0;
3210
+ {
3211
+ counters = {
3212
+ peekCalls: 0,
3213
+ peekParentCalls: 0,
3214
+ peekPrototypeWalks: 0,
3215
+ setCalls: 0,
3216
+ deleteCalls: 0,
3217
+ metaCalls: 0,
3218
+ metaInstantiated: 0
3219
+ };
3220
+ }
3376
3221
 
3377
3222
  /**
3378
3223
  @module ember-metal
3379
3224
  */
3380
3225
 
3381
- /*
3382
- This declares several meta-programmed members on the Meta class. Such
3383
- meta!
3384
-
3385
- In general, the `readable` variants will give you an object (if it
3386
- already exists) that you can read but should not modify. The
3387
- `writable` variants will give you a mutable object, and they will
3388
- create it if it didn't already exist.
3389
-
3390
- The following methods will get generated metaprogrammatically, and
3391
- I'm including them here for greppability:
3392
-
3393
- writableCache, readableCache, writeWatching,
3394
- peekWatching, clearWatching, writeMixins,
3395
- peekMixins, clearMixins, writeBindings,
3396
- peekBindings, clearBindings, writeValues,
3397
- peekValues, clearValues, writeDeps, forEachInDeps
3398
- writableChainWatchers, readableChainWatchers, writableChains,
3399
- readableChains, writableTag, readableTag, writableTags,
3400
- readableTags
3401
- */
3402
- var members = {
3403
- cache: ownMap,
3404
- weak: ownMap,
3405
- watching: inheritedMap,
3406
- mixins: inheritedMap,
3407
- bindings: inheritedMap,
3408
- values: inheritedMap,
3409
- chainWatchers: ownCustomObject,
3410
- chains: inheritedCustomObject,
3411
- tag: ownCustomObject,
3412
- tags: ownMap
3413
- };
3226
+ var UNDEFINED = emberUtils.symbol('undefined');
3414
3227
 
3415
3228
  // FLAGS
3416
3229
  var SOURCE_DESTROYING = 1 << 1;
@@ -3418,17 +3231,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3418
3231
  var META_DESTROYED = 1 << 3;
3419
3232
  var IS_PROXY = 1 << 4;
3420
3233
 
3421
- if (ember_features.EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER || ember_features.EMBER_GLIMMER_ALLOW_BACKTRACKING_RERENDER) {
3422
- members.lastRendered = ownMap;
3423
- if (require.has('ember-debug')) {
3424
- //https://github.com/emberjs/ember.js/issues/14732
3425
- members.lastRenderedReferenceMap = ownMap;
3426
- members.lastRenderedTemplateMap = ownMap;
3427
- }
3428
- }
3429
-
3430
- var memberNames = Object.keys(members);
3431
3234
  var META_FIELD = '__ember_meta__';
3235
+ var NODE_STACK = [];
3432
3236
 
3433
3237
  var Meta = function () {
3434
3238
  function Meta(obj, parentMeta) {
@@ -3476,7 +3280,9 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3476
3280
  }
3477
3281
  }
3478
3282
 
3479
- this._initializeListeners();
3283
+ this._listeners = undefined;
3284
+ this._listenersFinalized = false;
3285
+ this._suspendedListeners = undefined;
3480
3286
  }
3481
3287
 
3482
3288
  Meta.prototype.isInitialized = function isInitialized(obj) {
@@ -3603,7 +3409,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3603
3409
 
3604
3410
 
3605
3411
  Meta.prototype.writeDeps = function writeDeps(subkey, itemkey, value) {
3606
- true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot call writeDeps after the object is destroyed.', !this.isMetaDestroyed());
3412
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot modify dependent keys for `' + itemkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3607
3413
 
3608
3414
  var outerMap = this._getOrCreateOwnMap('_deps');
3609
3415
  var innerMap = outerMap[subkey];
@@ -3660,117 +3466,124 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3660
3466
  if (seen[innerKey] === undefined) {
3661
3467
  seen[innerKey] = true;
3662
3468
  calls = calls || [];
3663
- calls.push([innerKey, innerMap[innerKey]]);
3469
+ calls.push(innerKey, innerMap[innerKey]);
3664
3470
  }
3665
3471
  }
3666
3472
  }
3667
3473
  }
3668
3474
  pointer = pointer.parent;
3669
3475
  }
3670
- if (calls !== undefined) {
3671
- for (var i = 0; i < calls.length; i++) {
3672
- var _calls$i = calls[i],
3673
- _innerKey = _calls$i[0],
3674
- value = _calls$i[1];
3675
3476
 
3676
- fn(_innerKey, value);
3477
+ if (calls !== undefined) {
3478
+ for (var i = 0; i < calls.length; i += 2) {
3479
+ fn(calls[i], calls[i + 1]);
3677
3480
  }
3678
3481
  }
3679
3482
  };
3680
3483
 
3681
- Meta.prototype.readInheritedValue = function readInheritedValue(key, subkey) {
3682
- var internalKey = '_' + key;
3484
+ Meta.prototype.writableCache = function writableCache() {
3485
+ return this._getOrCreateOwnMap('_cache');
3486
+ };
3683
3487
 
3684
- var pointer = this;
3488
+ Meta.prototype.readableCache = function readableCache() {
3489
+ return this._cache;
3490
+ };
3685
3491
 
3686
- while (pointer !== undefined) {
3687
- var map = pointer[internalKey];
3688
- if (map !== undefined) {
3689
- var value = map[subkey];
3690
- if (value !== undefined || subkey in map) {
3691
- return value;
3692
- }
3693
- }
3694
- pointer = pointer.parent;
3695
- }
3492
+ Meta.prototype.writableWeak = function writableWeak() {
3493
+ return this._getOrCreateOwnMap('_weak');
3494
+ };
3696
3495
 
3697
- return UNDEFINED;
3496
+ Meta.prototype.readableWeak = function readableWeak() {
3497
+ return this._weak;
3698
3498
  };
3699
3499
 
3700
- Meta.prototype.writeValue = function writeValue(obj, key, value) {
3701
- var descriptor = emberUtils.lookupDescriptor(obj, key);
3702
- var isMandatorySetter = descriptor !== undefined && descriptor.set && descriptor.set.isMandatorySetter;
3500
+ Meta.prototype.writableTags = function writableTags() {
3501
+ return this._getOrCreateOwnMap('_tags');
3502
+ };
3703
3503
 
3704
- if (isMandatorySetter) {
3705
- this.writeValues(key, value);
3706
- } else {
3707
- obj[key] = value;
3504
+ Meta.prototype.readableTags = function readableTags() {
3505
+ return this._tags;
3506
+ };
3507
+
3508
+ Meta.prototype.writableTag = function writableTag(create) {
3509
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot create a new tag for `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3510
+
3511
+ var ret = this._tag;
3512
+ if (ret === undefined) {
3513
+ ret = this._tag = create(this.source);
3708
3514
  }
3515
+ return ret;
3709
3516
  };
3710
3517
 
3711
- emberBabel.createClass(Meta, [{
3712
- key: 'factory',
3713
- set: function (factory) {
3714
- this._factory = factory;
3715
- },
3716
- get: function () {
3717
- return this._factory;
3518
+ Meta.prototype.readableTag = function readableTag() {
3519
+ return this._tag;
3520
+ };
3521
+
3522
+ Meta.prototype.writableChainWatchers = function writableChainWatchers(create) {
3523
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot create a new chain watcher for `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3524
+
3525
+ var ret = this._chainWatchers;
3526
+ if (ret === undefined) {
3527
+ ret = this._chainWatchers = create(this.source);
3718
3528
  }
3719
- }]);
3529
+ return ret;
3530
+ };
3720
3531
 
3721
- return Meta;
3722
- }();
3532
+ Meta.prototype.readableChainWatchers = function readableChainWatchers() {
3533
+ return this._chainWatchers;
3534
+ };
3723
3535
 
3724
- var NODE_STACK = [];
3536
+ Meta.prototype.writableChains = function writableChains(create) {
3537
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot create a new chains for `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3725
3538
 
3726
- for (var name in protoMethods) {
3727
- Meta.prototype[name] = protoMethods[name];
3728
- }
3729
- memberNames.forEach(function (name) {
3730
- return members[name](name, Meta);
3731
- });
3539
+ var ret = this._chains;
3540
+ if (ret === undefined) {
3541
+ if (this.parent) {
3542
+ ret = this._chains = this.parent.writableChains(create).copy(this.source);
3543
+ } else {
3544
+ ret = this._chains = create(this.source);
3545
+ }
3546
+ }
3547
+ return ret;
3548
+ };
3732
3549
 
3733
- // Implements a member that is a lazily created, non-inheritable
3734
- // POJO.
3735
- function ownMap(name, Meta) {
3736
- var key = memberProperty(name);
3737
- var capitalized = capitalize(name);
3738
- Meta.prototype['writable' + capitalized] = function () {
3739
- return this._getOrCreateOwnMap(key);
3550
+ Meta.prototype.readableChains = function readableChains() {
3551
+ return this._getInherited('_chains');
3740
3552
  };
3741
- Meta.prototype['readable' + capitalized] = function () {
3742
- return this[key];
3553
+
3554
+ Meta.prototype.writeWatching = function writeWatching(subkey, value) {
3555
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot update watchers for `hello` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3556
+
3557
+ var map = this._getOrCreateOwnMap('_watching');
3558
+ map[subkey] = value;
3743
3559
  };
3744
- }
3745
3560
 
3746
- // Implements a member that is a lazily created POJO with inheritable
3747
- // values.
3748
- function inheritedMap(name, Meta) {
3749
- var key = memberProperty(name);
3750
- var capitalized = capitalize(name);
3561
+ Meta.prototype.peekWatching = function peekWatching(subkey) {
3562
+ return this._findInherited('_watching', subkey);
3563
+ };
3751
3564
 
3752
- Meta.prototype['write' + capitalized] = function (subkey, value) {
3753
- true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot call write' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed());
3565
+ Meta.prototype.writeMixins = function writeMixins(subkey, value) {
3566
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot add mixins for `' + subkey + '` on `' + emberUtils.toString(this.source) + '` call writeMixins after it has been destroyed.', !this.isMetaDestroyed());
3754
3567
 
3755
- var map = this._getOrCreateOwnMap(key);
3568
+ var map = this._getOrCreateOwnMap('_mixins');
3756
3569
  map[subkey] = value;
3757
3570
  };
3758
3571
 
3759
- Meta.prototype['peek' + capitalized] = function (subkey) {
3760
- return this._findInherited(key, subkey);
3572
+ Meta.prototype.peekMixins = function peekMixins(subkey) {
3573
+ return this._findInherited('_mixins', subkey);
3761
3574
  };
3762
3575
 
3763
- Meta.prototype['forEach' + capitalized] = function (fn) {
3576
+ Meta.prototype.forEachMixins = function forEachMixins(fn) {
3764
3577
  var pointer = this;
3765
3578
  var seen = void 0;
3766
3579
  while (pointer !== undefined) {
3767
- var map = pointer[key];
3580
+ var map = pointer._mixins;
3768
3581
  if (map !== undefined) {
3769
- for (var _key in map) {
3582
+ for (var key in map) {
3770
3583
  seen = seen || Object.create(null);
3771
- if (seen[_key] === undefined) {
3772
- seen[_key] = true;
3773
- fn(_key, map[_key]);
3584
+ if (seen[key] === undefined) {
3585
+ seen[key] = true;
3586
+ fn(key, map[key]);
3774
3587
  }
3775
3588
  }
3776
3589
  }
@@ -3778,76 +3591,94 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3778
3591
  }
3779
3592
  };
3780
3593
 
3781
- Meta.prototype['clear' + capitalized] = function () {
3782
- true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot call clear' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed());
3594
+ Meta.prototype.writeBindings = function writeBindings(subkey, value) {
3595
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot add a binding for `' + subkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3783
3596
 
3784
- this[key] = undefined;
3597
+ var map = this._getOrCreateOwnMap('_bindings');
3598
+ map[subkey] = value;
3785
3599
  };
3786
3600
 
3787
- Meta.prototype['deleteFrom' + capitalized] = function (subkey) {
3788
- delete this._getOrCreateOwnMap(key)[subkey];
3601
+ Meta.prototype.peekBindings = function peekBindings(subkey) {
3602
+ return this._findInherited('_bindings', subkey);
3789
3603
  };
3790
3604
 
3791
- Meta.prototype['hasIn' + capitalized] = function (subkey) {
3792
- return this._findInherited(key, subkey) !== undefined;
3605
+ Meta.prototype.forEachBindings = function forEachBindings(fn) {
3606
+ var pointer = this;
3607
+ var seen = void 0;
3608
+ while (pointer !== undefined) {
3609
+ var map = pointer._bindings;
3610
+ if (map !== undefined) {
3611
+ for (var key in map) {
3612
+ seen = seen || Object.create(null);
3613
+ if (seen[key] === undefined) {
3614
+ seen[key] = true;
3615
+ fn(key, map[key]);
3616
+ }
3617
+ }
3618
+ }
3619
+ pointer = pointer.parent;
3620
+ }
3793
3621
  };
3794
- }
3795
3622
 
3796
- var UNDEFINED = emberUtils.symbol('undefined');
3623
+ Meta.prototype.clearBindings = function clearBindings() {
3624
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot clear bindings on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3797
3625
 
3798
- // Implements a member that provides a non-heritable, lazily-created
3799
- // object using the method you provide.
3800
- function ownCustomObject(name, Meta) {
3801
- var key = memberProperty(name);
3802
- var capitalized = capitalize(name);
3803
- Meta.prototype['writable' + capitalized] = function (create) {
3804
- true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed());
3626
+ this._bindings = undefined;
3627
+ };
3805
3628
 
3806
- var ret = this[key];
3807
- if (ret === undefined) {
3808
- ret = this[key] = create(this.source);
3809
- }
3810
- return ret;
3629
+ Meta.prototype.writeValues = function writeValues(subkey, value) {
3630
+ true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot set the value of `' + subkey + '` on `' + emberUtils.toString(this.source) + '` after it has been destroyed.', !this.isMetaDestroyed());
3631
+
3632
+ var map = this._getOrCreateOwnMap('_values');
3633
+ map[subkey] = value;
3811
3634
  };
3812
- Meta.prototype['readable' + capitalized] = function () {
3813
- return this[key];
3635
+
3636
+ Meta.prototype.peekValues = function peekValues(subkey) {
3637
+ return this._findInherited('_values', subkey);
3814
3638
  };
3815
- }
3816
3639
 
3817
- // Implements a member that provides an inheritable, lazily-created
3818
- // object using the method you provide. We will derived children from
3819
- // their parents by calling your object's `copy()` method.
3820
- function inheritedCustomObject(name, Meta) {
3821
- var key = memberProperty(name);
3822
- var capitalized = capitalize(name);
3823
- Meta.prototype['writable' + capitalized] = function (create) {
3824
- true && !!this.isMetaDestroyed() && emberDebug.assert('Cannot call writable' + capitalized + ' after the object is destroyed.', !this.isMetaDestroyed());
3640
+ Meta.prototype.deleteFromValues = function deleteFromValues(subkey) {
3641
+ delete this._getOrCreateOwnMap('_values')[subkey];
3642
+ };
3825
3643
 
3826
- var ret = this[key];
3827
- if (ret === undefined) {
3828
- if (this.parent) {
3829
- ret = this[key] = this.parent['writable' + capitalized](create).copy(this.source);
3830
- } else {
3831
- ret = this[key] = create(this.source);
3832
- }
3644
+ emberBabel.createClass(Meta, [{
3645
+ key: 'factory',
3646
+ set: function (factory) {
3647
+ this._factory = factory;
3648
+ },
3649
+ get: function () {
3650
+ return this._factory;
3833
3651
  }
3834
- return ret;
3652
+ }]);
3653
+
3654
+ return Meta;
3655
+ }();
3656
+
3657
+ if (ember_features.EMBER_GLIMMER_DETECT_BACKTRACKING_RERENDER || ember_features.EMBER_GLIMMER_ALLOW_BACKTRACKING_RERENDER) {
3658
+ Meta.prototype.writableLastRendered = function () {
3659
+ return this._getOrCreateOwnMap('_lastRendered');
3835
3660
  };
3836
- Meta.prototype['readable' + capitalized] = function () {
3837
- return this._getInherited(key);
3661
+ Meta.prototype.readableLastRendered = function () {
3662
+ return this._lastRendered;
3838
3663
  };
3664
+ {
3665
+ Meta.prototype.writableLastRenderedReferenceMap = function () {
3666
+ return this._getOrCreateOwnMap('_lastRenderedReferenceMap');
3667
+ };
3668
+ Meta.prototype.readableLastRenderedReferenceMap = function () {
3669
+ return this._lastRenderedReferenceMap;
3670
+ };
3671
+ Meta.prototype.writableLastRenderedTemplateMap = function () {
3672
+ return this._getOrCreateOwnMap('_lastRenderedTemplateMap');
3673
+ };
3674
+ Meta.prototype.readableLastRenderedTemplateMap = function () {
3675
+ return this._lastRenderedTemplateMap;
3676
+ };
3677
+ }
3839
3678
  }
3840
3679
 
3841
- function memberProperty(name) {
3842
- return '_' + name;
3843
- }
3844
-
3845
- // there's a more general-purpose capitalize in ember-runtime, but we
3846
- // don't want to make ember-metal depend on ember-runtime.
3847
- function capitalize(name) {
3848
- return name.replace(/^\w/, function (m) {
3849
- return m.toUpperCase();
3850
- });
3680
+ for (var name in protoMethods) {
3681
+ Meta.prototype[name] = protoMethods[name];
3851
3682
  }
3852
3683
 
3853
3684
  var META_DESC = {
@@ -3884,7 +3715,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3884
3715
 
3885
3716
  Meta.prototype.writeValue = function (obj, key, value) {
3886
3717
  var descriptor = emberUtils.lookupDescriptor(obj, key);
3887
- var isMandatorySetter = descriptor !== undefined && descriptor !== null && descriptor.set && descriptor.set.isMandatorySetter;
3718
+ var isMandatorySetter = descriptor !== null && descriptor.set && descriptor.set.isMandatorySetter;
3888
3719
 
3889
3720
  if (isMandatorySetter) {
3890
3721
  this.writeValues(key, value);
@@ -3909,14 +3740,6 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3909
3740
  metaStore.set(obj, meta);
3910
3741
  };
3911
3742
 
3912
- exports.peekMeta = function WeakMap_peekMeta(obj) {
3913
- {
3914
- counters.peekCalls++;
3915
- }
3916
-
3917
- return metaStore.get(obj);
3918
- };
3919
-
3920
3743
  exports.peekMeta = function WeakMap_peekParentMeta(obj) {
3921
3744
  var pointer = obj;
3922
3745
  var meta = void 0;
@@ -3926,7 +3749,10 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3926
3749
  {
3927
3750
  counters.peekCalls++;
3928
3751
  }
3929
- if (meta !== undefined) {
3752
+ // stop if we find a `null` value, since
3753
+ // that means the meta was deleted
3754
+ // any other truthy value is a "real" meta
3755
+ if (meta === null || meta !== undefined) {
3930
3756
  return meta;
3931
3757
  }
3932
3758
 
@@ -3938,10 +3764,14 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3938
3764
  };
3939
3765
  } else {
3940
3766
  setMeta = function Fallback_setMeta(obj, meta) {
3941
- if (obj.__defineNonEnumerable) {
3942
- obj.__defineNonEnumerable(EMBER_META_PROPERTY);
3943
- } else {
3944
- Object.defineProperty(obj, META_FIELD, META_DESC);
3767
+ // if `null` already, just set it to the new value
3768
+ // otherwise define property first
3769
+ if (obj[META_FIELD] !== null) {
3770
+ if (obj.__defineNonEnumerable) {
3771
+ obj.__defineNonEnumerable(EMBER_META_PROPERTY);
3772
+ } else {
3773
+ Object.defineProperty(obj, META_FIELD, META_DESC);
3774
+ }
3945
3775
  }
3946
3776
 
3947
3777
  obj[META_FIELD] = meta;
@@ -3990,7 +3820,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
3990
3820
  var parent = void 0;
3991
3821
 
3992
3822
  // remove this code, in-favor of explicit parent
3993
- if (maybeMeta !== undefined) {
3823
+ if (maybeMeta !== undefined && maybeMeta !== null) {
3994
3824
  if (maybeMeta.source === obj) {
3995
3825
  return maybeMeta;
3996
3826
  }
@@ -4189,23 +4019,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4189
4019
  true && !(keyName !== '') && emberDebug.assert('Cannot call `Ember.get` with an empty string', keyName !== '');
4190
4020
 
4191
4021
  var value = obj[keyName];
4192
- var desc = value !== null && typeof value === 'object' && value.isDescriptor ? value : undefined;
4193
- var ret = void 0;
4022
+ var isDescriptor = value !== null && typeof value === 'object' && value.isDescriptor;
4194
4023
 
4195
- if (desc === undefined && isPath(keyName)) {
4024
+ if (isDescriptor) {
4025
+ return value.get(obj, keyName);
4026
+ } else if (isPath(keyName)) {
4196
4027
  return _getPath(obj, keyName);
4197
- }
4198
-
4199
- if (desc) {
4200
- return desc.get(obj, keyName);
4028
+ } else if (value === undefined && 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {
4029
+ return obj.unknownProperty(keyName);
4201
4030
  } else {
4202
- ret = value;
4203
-
4204
- if (ret === undefined && 'object' === typeof obj && !(keyName in obj) && 'function' === typeof obj.unknownProperty) {
4205
- return obj.unknownProperty(keyName);
4206
- }
4207
-
4208
- return ret;
4031
+ return value;
4209
4032
  }
4210
4033
  }
4211
4034
 
@@ -4229,11 +4052,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4229
4052
  }
4230
4053
 
4231
4054
  function isGettable(obj) {
4232
- if (obj == null) {
4233
- return false;
4234
- }
4235
-
4236
- return ALLOWABLE_TYPES[typeof obj];
4055
+ return obj !== undefined && obj !== null && ALLOWABLE_TYPES[typeof obj];
4237
4056
  }
4238
4057
 
4239
4058
  /**
@@ -4290,29 +4109,20 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4290
4109
  return setPath(obj, keyName, value, tolerant);
4291
4110
  }
4292
4111
 
4293
- var meta$$1 = exports.peekMeta(obj);
4294
- var possibleDesc = obj[keyName];
4295
-
4296
- var desc = void 0,
4297
- currentValue = void 0;
4298
- if (possibleDesc !== null && typeof possibleDesc === 'object' && possibleDesc.isDescriptor) {
4299
- desc = possibleDesc;
4300
- } else {
4301
- currentValue = possibleDesc;
4302
- }
4112
+ var currentValue = obj[keyName];
4113
+ var isDescriptor = currentValue !== null && typeof currentValue === 'object' && currentValue.isDescriptor;
4303
4114
 
4304
- if (desc) {
4115
+ if (isDescriptor) {
4305
4116
  /* computed property */
4306
- desc.set(obj, keyName, value);
4117
+ currentValue.set(obj, keyName, value);
4307
4118
  } else if (obj.setUnknownProperty && currentValue === undefined && !(keyName in obj)) {
4308
4119
  /* unknown property */
4309
4120
  true && !(typeof obj.setUnknownProperty === 'function') && emberDebug.assert('setUnknownProperty must be a function', typeof obj.setUnknownProperty === 'function');
4310
4121
 
4311
4122
  obj.setUnknownProperty(keyName, value);
4312
- } else if (currentValue === value) {
4313
- /* no change */
4314
- return value;
4123
+ } else if (currentValue === value) {/* no change */
4315
4124
  } else {
4125
+ var meta$$1 = exports.peekMeta(obj);
4316
4126
  propertyWillChange(obj, keyName, meta$$1);
4317
4127
 
4318
4128
  if (ember_features.MANDATORY_SETTER) {
@@ -4672,7 +4482,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4672
4482
 
4673
4483
  Additional resources:
4674
4484
  - [New CP syntax RFC](https://github.com/emberjs/rfcs/blob/master/text/0011-improved-cp-syntax.md)
4675
- - [New computed syntax explained in "Ember 1.12 released" ](http://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_new-computed-syntax)
4485
+ - [New computed syntax explained in "Ember 1.12 released" ](https://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_new-computed-syntax)
4676
4486
 
4677
4487
  @class ComputedProperty
4678
4488
  @namespace Ember
@@ -4684,28 +4494,17 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4684
4494
  this._getter = config;
4685
4495
  } else {
4686
4496
  true && !(typeof config === 'object' && !Array.isArray(config)) && emberDebug.assert('Ember.computed expects a function or an object as last argument.', typeof config === 'object' && !Array.isArray(config));
4687
- true && !function () {
4688
- var keys = Object.keys(config);
4689
- for (var i = 0; i < keys.length; i++) {
4690
- if (keys[i] !== 'get' && keys[i] !== 'set') {
4691
- return false;
4692
- }
4693
- }
4694
- return true;
4695
- }() && emberDebug.assert('Config object passed to an Ember.computed can only contain `get` or `set` keys.', function () {
4696
- var keys = Object.keys(config);for (var i = 0; i < keys.length; i++) {
4697
- if (keys[i] !== 'get' && keys[i] !== 'set') {
4698
- return false;
4699
- }
4700
- }return true;
4701
- }());
4497
+ true && !Object.keys(config).every(function (key) {
4498
+ return key === 'get' || key === 'set';
4499
+ }) && emberDebug.assert('Config object passed to an Ember.computed can only contain `get` or `set` keys.', Object.keys(config).every(function (key) {
4500
+ return key === 'get' || key === 'set';
4501
+ }));
4702
4502
 
4703
4503
  this._getter = config.get;
4704
4504
  this._setter = config.set;
4705
4505
  }
4706
4506
  true && !(!!this._getter || !!this._setter) && emberDebug.assert('Computed properties must receive a getter or a setter, you passed none.', !!this._getter || !!this._setter);
4707
4507
 
4708
- this._dependentKeys = undefined;
4709
4508
  this._suspended = undefined;
4710
4509
  this._meta = undefined;
4711
4510
  this._volatile = false;
@@ -4971,9 +4770,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4971
4770
 
4972
4771
  if (hadCachedValue) {
4973
4772
  cache[keyName] = undefined;
4974
- }
4975
-
4976
- if (!hadCachedValue) {
4773
+ } else {
4977
4774
  addDependentKeys(this, obj, keyName, meta$$1);
4978
4775
  }
4979
4776
 
@@ -4989,13 +4786,12 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
4989
4786
  };
4990
4787
 
4991
4788
  /* called before property is overridden */
4992
- ComputedPropertyPrototype.teardown = function (obj, keyName) {
4789
+ ComputedPropertyPrototype.teardown = function (obj, keyName, meta$$1) {
4993
4790
  if (this._volatile) {
4994
4791
  return;
4995
4792
  }
4996
- var meta$$1 = meta(obj);
4997
4793
  var cache = meta$$1.readableCache();
4998
- if (cache && cache[keyName] !== undefined) {
4794
+ if (cache !== undefined && cache[keyName] !== undefined) {
4999
4795
  removeDependentKeys(this, obj, keyName, meta$$1);
5000
4796
  cache[keyName] = undefined;
5001
4797
  }
@@ -5067,7 +4863,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5067
4863
 
5068
4864
  _Note: This is the preferred way to define computed properties when writing third-party
5069
4865
  libraries that depend on or use Ember, since there is no guarantee that the user
5070
- will have [prototype Extensions](http://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/) enabled._
4866
+ will have [prototype Extensions](https://emberjs.com/guides/configuring-ember/disabling-prototype-extensions/) enabled._
5071
4867
 
5072
4868
  The alternative syntax, with prototype extensions, might look like:
5073
4869
 
@@ -5086,17 +4882,16 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5086
4882
  @return {Ember.ComputedProperty} property descriptor instance
5087
4883
  @public
5088
4884
  */
5089
- function computed(func) {
5090
- var args = void 0;
5091
-
5092
- if (arguments.length > 1) {
5093
- args = [].slice.call(arguments);
5094
- func = args.pop();
4885
+ function computed() {
4886
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
4887
+ args[_key] = arguments[_key];
5095
4888
  }
5096
4889
 
4890
+ var func = args.pop();
4891
+
5097
4892
  var cp = new ComputedProperty(func);
5098
4893
 
5099
- if (args) {
4894
+ if (args.length > 0) {
5100
4895
  cp.property.apply(cp, args);
5101
4896
  }
5102
4897
 
@@ -5177,9 +4972,8 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5177
4972
  }
5178
4973
  };
5179
4974
 
5180
- AliasedProperty.prototype.teardown = function teardown(obj, keyName) {
5181
- var meta$$1 = meta(obj);
5182
- if (meta$$1.peekWatching(keyName)) {
4975
+ AliasedProperty.prototype.teardown = function teardown(obj, keyName, meta$$1) {
4976
+ if (meta$$1 && meta$$1.peekWatching(keyName)) {
5183
4977
  removeDependentKeys(this, obj, keyName, meta$$1);
5184
4978
  }
5185
4979
  };
@@ -5848,7 +5642,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
5848
5642
  @public
5849
5643
  */
5850
5644
  function isBlank(obj) {
5851
- return isEmpty(obj) || typeof obj === 'string' && obj.match(/\S/) === null;
5645
+ return isEmpty(obj) || typeof obj === 'string' && /\S/.test(obj) === false;
5852
5646
  }
5853
5647
 
5854
5648
  /**
@@ -6146,7 +5940,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6146
5940
  will be resolved on the target object at the time the scheduled item is
6147
5941
  invoked allowing you to change the target function.
6148
5942
  @param {Object} [arguments*] Optional arguments to be passed to the queued method.
6149
- @return {*} Timer information for use in cancelling, see `run.cancel`.
5943
+ @return {*} Timer information for use in canceling, see `run.cancel`.
6150
5944
  @public
6151
5945
  */
6152
5946
  run$1.schedule = function () /* queue, target, method */{
@@ -6211,7 +6005,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6211
6005
  target at the time the method is invoked.
6212
6006
  @param {Object} [args*] Optional arguments to pass to the timeout.
6213
6007
  @param {Number} wait Number of milliseconds to wait.
6214
- @return {*} Timer information for use in cancelling, see `run.cancel`.
6008
+ @return {*} Timer information for use in canceling, see `run.cancel`.
6215
6009
  @public
6216
6010
  */
6217
6011
  run$1.later = function () /*target, method*/{
@@ -6228,7 +6022,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6228
6022
  If you pass a string it will be resolved on the
6229
6023
  target at the time the method is invoked.
6230
6024
  @param {Object} [args*] Optional arguments to pass to the timeout.
6231
- @return {Object} Timer information for use in cancelling, see `run.cancel`.
6025
+ @return {Object} Timer information for use in canceling, see `run.cancel`.
6232
6026
  @public
6233
6027
  */
6234
6028
  run$1.once = function () {
@@ -6291,7 +6085,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6291
6085
  If you pass a string it will be resolved on the
6292
6086
  target at the time the method is invoked.
6293
6087
  @param {Object} [args*] Optional arguments to pass to the timeout.
6294
- @return {Object} Timer information for use in cancelling, see `run.cancel`.
6088
+ @return {Object} Timer information for use in canceling, see `run.cancel`.
6295
6089
  @public
6296
6090
  */
6297
6091
  run$1.scheduleOnce = function () /*queue, target, method*/{
@@ -6360,7 +6154,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6360
6154
  If you pass a string it will be resolved on the
6361
6155
  target at the time the method is invoked.
6362
6156
  @param {Object} [args*] Optional arguments to pass to the timeout.
6363
- @return {Object} Timer information for use in cancelling, see `run.cancel`.
6157
+ @return {Object} Timer information for use in canceling, see `run.cancel`.
6364
6158
  @public
6365
6159
  */
6366
6160
  run$1.next = function () {
@@ -6418,13 +6212,13 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6418
6212
  // will be executed since we passed in true (immediate)
6419
6213
  }, 100, true);
6420
6214
 
6421
- // the 100ms delay until this method can be called again will be cancelled
6215
+ // the 100ms delay until this method can be called again will be canceled
6422
6216
  run.cancel(debounceImmediate);
6423
6217
  ```
6424
6218
 
6425
6219
  @method cancel
6426
6220
  @param {Object} timer Timer object to cancel
6427
- @return {Boolean} true if cancelled or false/undefined if it wasn't found
6221
+ @return {Boolean} true if canceled or false/undefined if it wasn't found
6428
6222
  @public
6429
6223
  */
6430
6224
  run$1.cancel = function (timer) {
@@ -6497,7 +6291,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6497
6291
  @param {Number} wait Number of milliseconds to wait.
6498
6292
  @param {Boolean} immediate Trigger the function on the leading instead
6499
6293
  of the trailing edge of the wait interval. Defaults to false.
6500
- @return {Array} Timer information for use in cancelling, see `run.cancel`.
6294
+ @return {Array} Timer information for use in canceling, see `run.cancel`.
6501
6295
  @public
6502
6296
  */
6503
6297
  run$1.debounce = function () {
@@ -6540,7 +6334,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
6540
6334
  @param {Number} spacing Number of milliseconds to space out requests.
6541
6335
  @param {Boolean} immediate Trigger the function on the leading instead
6542
6336
  of the trailing edge of the wait interval. Defaults to true.
6543
- @return {Array} Timer information for use in cancelling, see `run.cancel`.
6337
+ @return {Array} Timer information for use in canceling, see `run.cancel`.
6544
6338
  @public
6545
6339
  */
6546
6340
  run$1.throttle = function () {
@@ -7318,7 +7112,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
7318
7112
  /**
7319
7113
  @class Binding
7320
7114
  @namespace Ember
7321
- @deprecated See http://emberjs.com/deprecations/v2.x#toc_ember-binding
7115
+ @deprecated See https://emberjs.com/deprecations/v2.x#toc_ember-binding
7322
7116
  @public
7323
7117
  */
7324
7118
 
@@ -7576,17 +7370,17 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
7576
7370
  true && !!deprecateGlobal && emberDebug.deprecate(objectInfo + deprecateGlobalMessage, !deprecateGlobal, {
7577
7371
  id: 'ember-metal.binding',
7578
7372
  until: '3.0.0',
7579
- url: 'http://emberjs.com/deprecations/v2.x#toc_ember-binding'
7373
+ url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
7580
7374
  });
7581
7375
  true && !!deprecateOneWay && emberDebug.deprecate(objectInfo + deprecateOneWayMessage, !deprecateOneWay, {
7582
7376
  id: 'ember-metal.binding',
7583
7377
  until: '3.0.0',
7584
- url: 'http://emberjs.com/deprecations/v2.x#toc_ember-binding'
7378
+ url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
7585
7379
  });
7586
7380
  true && !!deprecateAlias && emberDebug.deprecate(objectInfo + deprecateAliasMessage, !deprecateAlias, {
7587
7381
  id: 'ember-metal.binding',
7588
7382
  until: '3.0.0',
7589
- url: 'http://emberjs.com/deprecations/v2.x#toc_ember-binding'
7383
+ url: 'https://emberjs.com/deprecations/v2.x#toc_ember-binding'
7590
7384
  });
7591
7385
  }
7592
7386
 
@@ -8535,36 +8329,40 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8535
8329
  @public
8536
8330
  */
8537
8331
  function observer() {
8332
+ var _paths = void 0,
8333
+ func = void 0;
8334
+
8538
8335
  for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
8539
8336
  args[_key5] = arguments[_key5];
8540
8337
  }
8541
8338
 
8542
- var func = args.slice(-1)[0];
8543
- var paths = void 0;
8544
-
8545
- var addWatchedProperty = function (path) {
8546
- paths.push(path);
8547
- };
8548
- var _paths = args.slice(0, -1);
8549
-
8550
- if (typeof func !== 'function') {
8339
+ if (typeof args[args.length - 1] !== 'function') {
8551
8340
  // revert to old, soft-deprecated argument ordering
8552
8341
  true && !false && emberDebug.deprecate('Passing the dependentKeys after the callback function in Ember.observer is deprecated. Ensure the callback function is the last argument.', false, { id: 'ember-metal.observer-argument-order', until: '3.0.0' });
8553
8342
 
8554
- func = args[0];
8555
- _paths = args.slice(1);
8343
+ func = args.shift();
8344
+ _paths = args;
8345
+ } else {
8346
+ func = args.pop();
8347
+ _paths = args;
8556
8348
  }
8557
8349
 
8558
- paths = [];
8350
+ true && !(typeof func === 'function') && emberDebug.assert('Ember.observer called without a function', typeof func === 'function');
8351
+ true && !(_paths.length > 0 && _paths.every(function (p) {
8352
+ return typeof p === 'string' && p.length;
8353
+ })) && emberDebug.assert('Ember.observer called without valid path', _paths.length > 0 && _paths.every(function (p) {
8354
+ return typeof p === 'string' && p.length;
8355
+ }));
8356
+
8357
+ var paths = [];
8358
+ var addWatchedProperty = function (path) {
8359
+ return paths.push(path);
8360
+ };
8559
8361
 
8560
8362
  for (var i = 0; i < _paths.length; ++i) {
8561
8363
  expandProperties(_paths[i], addWatchedProperty);
8562
8364
  }
8563
8365
 
8564
- if (typeof func !== 'function') {
8565
- throw new emberDebug.EmberError('Ember.observer called without a function');
8566
- }
8567
-
8568
8366
  func.__ember_observes__ = paths;
8569
8367
  return func;
8570
8368
  }
@@ -8626,7 +8424,7 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8626
8424
  args[_key6] = arguments[_key6];
8627
8425
  }
8628
8426
 
8629
- var func = args.slice(-1)[0];
8427
+ var func = args[args.length - 1];
8630
8428
  var paths = void 0;
8631
8429
 
8632
8430
  var addWatchedProperty = function (path) {
@@ -8726,6 +8524,15 @@ enifed('ember-metal', ['exports', 'ember-environment', 'ember-utils', 'ember-deb
8726
8524
  return ret;
8727
8525
  }
8728
8526
 
8527
+ function isProxy(value) {
8528
+ if (typeof value === 'object' && value !== null) {
8529
+ var meta$$1 = exports.peekMeta(value);
8530
+ return meta$$1 && meta$$1.isProxy();
8531
+ }
8532
+
8533
+ return false;
8534
+ }
8535
+
8729
8536
  function descriptor(desc) {
8730
8537
  return new Descriptor$1(desc);
8731
8538
  }
@@ -8966,14 +8773,6 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
8966
8773
  EventTarget['mixin'](config);
8967
8774
 
8968
8775
  function configure(name, value) {
8969
- if (name === 'onerror') {
8970
- // handle for legacy users that expect the actual
8971
- // error to be passed to their function added via
8972
- // `RSVP.configure('onerror', someFunctionHere);`
8973
- config['on']('error', value);
8974
- return;
8975
- }
8976
-
8977
8776
  if (arguments.length === 2) {
8978
8777
  config[name] = value;
8979
8778
  } else {
@@ -8982,24 +8781,29 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
8982
8781
  }
8983
8782
 
8984
8783
  function objectOrFunction(x) {
8985
- return typeof x === 'function' || typeof x === 'object' && x !== null;
8784
+ var type = typeof x;
8785
+ return x !== null && (type === 'object' || type === 'function');
8986
8786
  }
8987
8787
 
8988
8788
  function isFunction(x) {
8989
8789
  return typeof x === 'function';
8990
8790
  }
8991
8791
 
8792
+ function isObject(x) {
8793
+ return x !== null && typeof x === 'object';
8794
+ }
8795
+
8992
8796
  function isMaybeThenable(x) {
8993
- return typeof x === 'object' && x !== null;
8797
+ return x !== null && typeof x === 'object';
8994
8798
  }
8995
8799
 
8996
8800
  var _isArray = void 0;
8997
- if (!Array.isArray) {
8801
+ if (Array.isArray) {
8802
+ _isArray = Array.isArray;
8803
+ } else {
8998
8804
  _isArray = function (x) {
8999
8805
  return Object.prototype.toString.call(x) === '[object Array]';
9000
8806
  };
9001
- } else {
9002
- _isArray = Array.isArray;
9003
8807
  }
9004
8808
 
9005
8809
  var isArray = _isArray;
@@ -9010,19 +8814,6 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9010
8814
  return new Date().getTime();
9011
8815
  };
9012
8816
 
9013
- function F() {}
9014
-
9015
- var o_create = Object.create || function (o) {
9016
- if (arguments.length > 1) {
9017
- throw new Error('Second argument not supported');
9018
- }
9019
- if (typeof o !== 'object') {
9020
- throw new TypeError('Argument must be an object');
9021
- }
9022
- F.prototype = o;
9023
- return new F();
9024
- };
9025
-
9026
8817
  var queue = [];
9027
8818
 
9028
8819
  function scheduleFlush() {
@@ -9184,19 +8975,17 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9184
8975
  }
9185
8976
 
9186
8977
  function handleMaybeThenable(promise, maybeThenable, then$$1) {
9187
- if (maybeThenable.constructor === promise.constructor && then$$1 === then && promise.constructor.resolve === resolve$1) {
8978
+ var isOwnThenable = maybeThenable.constructor === promise.constructor && then$$1 === then && promise.constructor.resolve === resolve$1;
8979
+
8980
+ if (isOwnThenable) {
9188
8981
  handleOwnThenable(promise, maybeThenable);
8982
+ } else if (then$$1 === GET_THEN_ERROR) {
8983
+ reject(promise, GET_THEN_ERROR.error);
8984
+ GET_THEN_ERROR.error = null;
8985
+ } else if (isFunction(then$$1)) {
8986
+ handleForeignThenable(promise, maybeThenable, then$$1);
9189
8987
  } else {
9190
- if (then$$1 === GET_THEN_ERROR) {
9191
- reject(promise, GET_THEN_ERROR.error);
9192
- GET_THEN_ERROR.error = null;
9193
- } else if (then$$1 === undefined) {
9194
- fulfill(promise, maybeThenable);
9195
- } else if (isFunction(then$$1)) {
9196
- handleForeignThenable(promise, maybeThenable, then$$1);
9197
- } else {
9198
- fulfill(promise, maybeThenable);
9199
- }
8988
+ fulfill(promise, maybeThenable);
9200
8989
  }
9201
8990
  }
9202
8991
 
@@ -9273,16 +9062,16 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9273
9062
 
9274
9063
  var child = void 0,
9275
9064
  callback = void 0,
9276
- detail = promise._result;
9065
+ result = promise._result;
9277
9066
 
9278
9067
  for (var i = 0; i < subscribers.length; i += 3) {
9279
9068
  child = subscribers[i];
9280
9069
  callback = subscribers[i + settled];
9281
9070
 
9282
9071
  if (child) {
9283
- invokeCallback(settled, child, callback, detail);
9072
+ invokeCallback(settled, child, callback, result);
9284
9073
  } else {
9285
- callback(detail);
9074
+ callback(result);
9286
9075
  }
9287
9076
  }
9288
9077
 
@@ -9295,51 +9084,43 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9295
9084
 
9296
9085
  var TRY_CATCH_ERROR = new ErrorObject();
9297
9086
 
9298
- function tryCatch(callback, detail) {
9087
+ function tryCatch(callback, result) {
9299
9088
  try {
9300
- return callback(detail);
9089
+ return callback(result);
9301
9090
  } catch (e) {
9302
9091
  TRY_CATCH_ERROR.error = e;
9303
9092
  return TRY_CATCH_ERROR;
9304
9093
  }
9305
9094
  }
9306
9095
 
9307
- function invokeCallback(settled, promise, callback, detail) {
9308
- var hasCallback = isFunction(callback),
9309
- value = void 0,
9310
- error = void 0,
9311
- succeeded = void 0,
9312
- failed = void 0;
9096
+ function invokeCallback(state, promise, callback, result) {
9097
+ var hasCallback = isFunction(callback);
9098
+ var value = void 0,
9099
+ error = void 0;
9313
9100
 
9314
9101
  if (hasCallback) {
9315
- value = tryCatch(callback, detail);
9102
+ value = tryCatch(callback, result);
9316
9103
 
9317
9104
  if (value === TRY_CATCH_ERROR) {
9318
- failed = true;
9319
9105
  error = value.error;
9320
9106
  value.error = null; // release
9321
- } else {
9322
- succeeded = true;
9323
- }
9324
-
9325
- if (promise === value) {
9107
+ } else if (value === promise) {
9326
9108
  reject(promise, withOwnPromise());
9327
9109
  return;
9328
9110
  }
9329
9111
  } else {
9330
- value = detail;
9331
- succeeded = true;
9112
+ value = result;
9332
9113
  }
9333
9114
 
9334
9115
  if (promise._state !== PENDING) {
9335
9116
  // noop
9336
- } else if (hasCallback && succeeded) {
9117
+ } else if (hasCallback && error === undefined) {
9337
9118
  resolve(promise, value);
9338
- } else if (failed) {
9119
+ } else if (error !== undefined) {
9339
9120
  reject(promise, error);
9340
- } else if (settled === FULFILLED) {
9121
+ } else if (state === FULFILLED) {
9341
9122
  fulfill(promise, value);
9342
- } else if (settled === REJECTED) {
9123
+ } else if (state === REJECTED) {
9343
9124
  reject(promise, value);
9344
9125
  }
9345
9126
  }
@@ -9381,74 +9162,41 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9381
9162
 
9382
9163
  config.instrument && instrument('chained', parent, child);
9383
9164
 
9384
- if (state) {
9385
- var callback = arguments[state - 1];
9165
+ if (state === PENDING) {
9166
+ subscribe(parent, child, onFulfillment, onRejection);
9167
+ } else {
9168
+ var callback = state === FULFILLED ? onFulfillment : onRejection;
9386
9169
  config.async(function () {
9387
9170
  return invokeCallback(state, child, callback, result);
9388
9171
  });
9389
- } else {
9390
- subscribe(parent, child, onFulfillment, onRejection);
9391
9172
  }
9392
9173
 
9393
9174
  return child;
9394
9175
  }
9395
9176
 
9396
- function makeSettledResult(state, position, value) {
9397
- if (state === FULFILLED) {
9398
- return {
9399
- state: 'fulfilled',
9400
- value: value
9401
- };
9402
- } else {
9403
- return {
9404
- state: 'rejected',
9405
- reason: value
9406
- };
9407
- }
9408
- }
9409
-
9410
9177
  function Enumerator(Constructor, input, abortOnReject, label) {
9411
9178
  this._instanceConstructor = Constructor;
9412
9179
  this.promise = new Constructor(noop, label);
9413
9180
  this._abortOnReject = abortOnReject;
9414
9181
 
9415
- if (this._validateInput(input)) {
9416
- this._input = input;
9417
- this.length = input.length;
9418
- this._remaining = input.length;
9419
-
9420
- this._init();
9421
-
9422
- if (this.length === 0) {
9423
- fulfill(this.promise, this._result);
9424
- } else {
9425
- this.length = this.length || 0;
9426
- this._enumerate();
9427
- if (this._remaining === 0) {
9428
- fulfill(this.promise, this._result);
9429
- }
9430
- }
9431
- } else {
9432
- reject(this.promise, this._validationError());
9433
- }
9182
+ this._init.apply(this, arguments);
9434
9183
  }
9435
9184
 
9436
- Enumerator.prototype._validateInput = function (input) {
9437
- return isArray(input);
9438
- };
9439
-
9440
- Enumerator.prototype._validationError = function () {
9441
- return new Error('Array Methods must be provided an Array');
9442
- };
9185
+ Enumerator.prototype._init = function (Constructor, input) {
9186
+ var len = input.length || 0;
9187
+ this.length = len;
9188
+ this._remaining = len;
9189
+ this._result = new Array(len);
9443
9190
 
9444
- Enumerator.prototype._init = function () {
9445
- this._result = new Array(this.length);
9191
+ this._enumerate(input);
9192
+ if (this._remaining === 0) {
9193
+ fulfill(this.promise, this._result);
9194
+ }
9446
9195
  };
9447
9196
 
9448
- Enumerator.prototype._enumerate = function () {
9197
+ Enumerator.prototype._enumerate = function (input) {
9449
9198
  var length = this.length;
9450
9199
  var promise = this.promise;
9451
- var input = this._input;
9452
9200
 
9453
9201
  for (var i = 0; promise._state === PENDING && i < length; i++) {
9454
9202
  this._eachEntry(input[i], i);
@@ -9495,18 +9243,16 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9495
9243
  var promise = this.promise;
9496
9244
 
9497
9245
  if (promise._state === PENDING) {
9498
- this._remaining--;
9499
-
9500
9246
  if (this._abortOnReject && state === REJECTED) {
9501
9247
  reject(promise, value);
9502
9248
  } else {
9249
+ this._remaining--;
9503
9250
  this._result[i] = this._makeResult(state, i, value);
9251
+ if (this._remaining === 0) {
9252
+ fulfill(promise, this._result);
9253
+ }
9504
9254
  }
9505
9255
  }
9506
-
9507
- if (this._remaining === 0) {
9508
- fulfill(promise, this._result);
9509
- }
9510
9256
  };
9511
9257
 
9512
9258
  Enumerator.prototype._makeResult = function (state, i, value) {
@@ -9523,6 +9269,20 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9523
9269
  });
9524
9270
  };
9525
9271
 
9272
+ function makeSettledResult(state, position, value) {
9273
+ if (state === FULFILLED) {
9274
+ return {
9275
+ state: 'fulfilled',
9276
+ value: value
9277
+ };
9278
+ } else {
9279
+ return {
9280
+ state: 'rejected',
9281
+ reason: value
9282
+ };
9283
+ }
9284
+ }
9285
+
9526
9286
  /**
9527
9287
  `RSVP.Promise.all` accepts an array of promises, and returns a new promise which
9528
9288
  is fulfilled with an array of fulfillment values for the passed promises, or
@@ -9571,6 +9331,9 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9571
9331
  @static
9572
9332
  */
9573
9333
  function all(entries, label) {
9334
+ if (!isArray(entries)) {
9335
+ return this.reject(new TypeError("Promise.all must be called with an array"), label);
9336
+ }
9574
9337
  return new Enumerator(this, entries, true /* abort on reject */, label).promise;
9575
9338
  }
9576
9339
 
@@ -9647,7 +9410,7 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9647
9410
  var promise = new Constructor(noop, label);
9648
9411
 
9649
9412
  if (!isArray(entries)) {
9650
- reject(promise, new TypeError('You must pass an array to race.'));
9413
+ reject(promise, new TypeError('Promise.race must be called with an array'));
9651
9414
  return promise;
9652
9415
  }
9653
9416
 
@@ -9835,241 +9598,306 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
9835
9598
  }
9836
9599
  }
9837
9600
 
9601
+ Promise.prototype._onError = function (reason) {
9602
+ var _this = this;
9603
+
9604
+ config.after(function () {
9605
+ if (_this._onError) {
9606
+ config.trigger('error', reason, _this._label);
9607
+ }
9608
+ });
9609
+ };
9610
+
9611
+ /**
9612
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
9613
+ as the catch block of a try/catch statement.
9614
+
9615
+ ```js
9616
+ function findAuthor(){
9617
+ throw new Error('couldn\'t find that author');
9618
+ }
9619
+
9620
+ // synchronous
9621
+ try {
9622
+ findAuthor();
9623
+ } catch(reason) {
9624
+ // something went wrong
9625
+ }
9626
+
9627
+ // async with promises
9628
+ findAuthor().catch(function(reason){
9629
+ // something went wrong
9630
+ });
9631
+ ```
9632
+
9633
+ @method catch
9634
+ @param {Function} onRejection
9635
+ @param {String} label optional string for labeling the promise.
9636
+ Useful for tooling.
9637
+ @return {Promise}
9638
+ */
9639
+ Promise.prototype.catch = function (onRejection, label) {
9640
+ return this.then(undefined, onRejection, label);
9641
+ };
9642
+
9643
+ /**
9644
+ `finally` will be invoked regardless of the promise's fate just as native
9645
+ try/catch/finally behaves
9646
+
9647
+ Synchronous example:
9648
+
9649
+ ```js
9650
+ findAuthor() {
9651
+ if (Math.random() > 0.5) {
9652
+ throw new Error();
9653
+ }
9654
+ return new Author();
9655
+ }
9656
+
9657
+ try {
9658
+ return findAuthor(); // succeed or fail
9659
+ } catch(error) {
9660
+ return findOtherAuthor();
9661
+ } finally {
9662
+ // always runs
9663
+ // doesn't affect the return value
9664
+ }
9665
+ ```
9666
+
9667
+ Asynchronous example:
9668
+
9669
+ ```js
9670
+ findAuthor().catch(function(reason){
9671
+ return findOtherAuthor();
9672
+ }).finally(function(){
9673
+ // author was either found, or not
9674
+ });
9675
+ ```
9676
+
9677
+ @method finally
9678
+ @param {Function} callback
9679
+ @param {String} label optional string for labeling the promise.
9680
+ Useful for tooling.
9681
+ @return {Promise}
9682
+ */
9683
+ Promise.prototype.finally = function (callback, label) {
9684
+ var promise = this;
9685
+ var constructor = promise.constructor;
9686
+
9687
+ return promise.then(function (value) {
9688
+ return constructor.resolve(callback()).then(function () {
9689
+ return value;
9690
+ });
9691
+ }, function (reason) {
9692
+ return constructor.resolve(callback()).then(function () {
9693
+ throw reason;
9694
+ });
9695
+ }, label);
9696
+ };
9697
+
9838
9698
  Promise.cast = resolve$1; // deprecated
9839
9699
  Promise.all = all;
9840
9700
  Promise.race = race;
9841
9701
  Promise.resolve = resolve$1;
9842
9702
  Promise.reject = reject$1;
9843
9703
 
9844
- Promise.prototype = {
9845
- constructor: Promise,
9704
+ Promise.prototype._guidKey = guidKey;
9846
9705
 
9847
- _guidKey: guidKey,
9848
-
9849
- _onError: function (reason) {
9850
- var promise = this;
9851
- config.after(function () {
9852
- if (promise._onError) {
9853
- config['trigger']('error', reason, promise._label);
9854
- }
9855
- });
9856
- },
9857
-
9858
-
9859
- /**
9860
- The primary way of interacting with a promise is through its `then` method,
9861
- which registers callbacks to receive either a promise's eventual value or the
9862
- reason why the promise cannot be fulfilled.
9863
-
9864
- ```js
9865
- findUser().then(function(user){
9866
- // user is available
9867
- }, function(reason){
9868
- // user is unavailable, and you are given the reason why
9869
- });
9870
- ```
9871
-
9872
- Chaining
9873
- --------
9874
-
9875
- The return value of `then` is itself a promise. This second, 'downstream'
9876
- promise is resolved with the return value of the first promise's fulfillment
9877
- or rejection handler, or rejected if the handler throws an exception.
9878
-
9879
- ```js
9880
- findUser().then(function (user) {
9881
- return user.name;
9882
- }, function (reason) {
9883
- return 'default name';
9884
- }).then(function (userName) {
9885
- // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
9886
- // will be `'default name'`
9887
- });
9888
-
9889
- findUser().then(function (user) {
9890
- throw new Error('Found user, but still unhappy');
9891
- }, function (reason) {
9892
- throw new Error('`findUser` rejected and we\'re unhappy');
9893
- }).then(function (value) {
9894
- // never reached
9895
- }, function (reason) {
9896
- // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
9897
- // If `findUser` rejected, `reason` will be '`findUser` rejected and we\'re unhappy'.
9898
- });
9899
- ```
9900
- If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
9901
-
9902
- ```js
9903
- findUser().then(function (user) {
9904
- throw new PedagogicalException('Upstream error');
9905
- }).then(function (value) {
9906
- // never reached
9907
- }).then(function (value) {
9908
- // never reached
9909
- }, function (reason) {
9910
- // The `PedgagocialException` is propagated all the way down to here
9911
- });
9912
- ```
9913
-
9914
- Assimilation
9915
- ------------
9916
-
9917
- Sometimes the value you want to propagate to a downstream promise can only be
9918
- retrieved asynchronously. This can be achieved by returning a promise in the
9919
- fulfillment or rejection handler. The downstream promise will then be pending
9920
- until the returned promise is settled. This is called *assimilation*.
9921
-
9922
- ```js
9923
- findUser().then(function (user) {
9924
- return findCommentsByAuthor(user);
9925
- }).then(function (comments) {
9926
- // The user's comments are now available
9927
- });
9928
- ```
9929
-
9930
- If the assimliated promise rejects, then the downstream promise will also reject.
9931
-
9932
- ```js
9933
- findUser().then(function (user) {
9934
- return findCommentsByAuthor(user);
9935
- }).then(function (comments) {
9936
- // If `findCommentsByAuthor` fulfills, we'll have the value here
9937
- }, function (reason) {
9938
- // If `findCommentsByAuthor` rejects, we'll have the reason here
9939
- });
9940
- ```
9941
-
9942
- Simple Example
9943
- --------------
9944
-
9945
- Synchronous Example
9946
-
9947
- ```javascript
9948
- let result;
9949
-
9950
- try {
9951
- result = findResult();
9952
- // success
9953
- } catch(reason) {
9954
- // failure
9955
- }
9956
- ```
9957
-
9958
- Errback Example
9959
-
9960
- ```js
9961
- findResult(function(result, err){
9962
- if (err) {
9963
- // failure
9964
- } else {
9965
- // success
9966
- }
9967
- });
9968
- ```
9969
-
9970
- Promise Example;
9971
-
9972
- ```javascript
9973
- findResult().then(function(result){
9974
- // success
9975
- }, function(reason){
9706
+ /**
9707
+ The primary way of interacting with a promise is through its `then` method,
9708
+ which registers callbacks to receive either a promise's eventual value or the
9709
+ reason why the promise cannot be fulfilled.
9710
+
9711
+ ```js
9712
+ findUser().then(function(user){
9713
+ // user is available
9714
+ }, function(reason){
9715
+ // user is unavailable, and you are given the reason why
9716
+ });
9717
+ ```
9718
+
9719
+ Chaining
9720
+ --------
9721
+
9722
+ The return value of `then` is itself a promise. This second, 'downstream'
9723
+ promise is resolved with the return value of the first promise's fulfillment
9724
+ or rejection handler, or rejected if the handler throws an exception.
9725
+
9726
+ ```js
9727
+ findUser().then(function (user) {
9728
+ return user.name;
9729
+ }, function (reason) {
9730
+ return 'default name';
9731
+ }).then(function (userName) {
9732
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
9733
+ // will be `'default name'`
9734
+ });
9735
+
9736
+ findUser().then(function (user) {
9737
+ throw new Error('Found user, but still unhappy');
9738
+ }, function (reason) {
9739
+ throw new Error('`findUser` rejected and we\'re unhappy');
9740
+ }).then(function (value) {
9741
+ // never reached
9742
+ }, function (reason) {
9743
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
9744
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we\'re unhappy'.
9745
+ });
9746
+ ```
9747
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
9748
+
9749
+ ```js
9750
+ findUser().then(function (user) {
9751
+ throw new PedagogicalException('Upstream error');
9752
+ }).then(function (value) {
9753
+ // never reached
9754
+ }).then(function (value) {
9755
+ // never reached
9756
+ }, function (reason) {
9757
+ // The `PedgagocialException` is propagated all the way down to here
9758
+ });
9759
+ ```
9760
+
9761
+ Assimilation
9762
+ ------------
9763
+
9764
+ Sometimes the value you want to propagate to a downstream promise can only be
9765
+ retrieved asynchronously. This can be achieved by returning a promise in the
9766
+ fulfillment or rejection handler. The downstream promise will then be pending
9767
+ until the returned promise is settled. This is called *assimilation*.
9768
+
9769
+ ```js
9770
+ findUser().then(function (user) {
9771
+ return findCommentsByAuthor(user);
9772
+ }).then(function (comments) {
9773
+ // The user's comments are now available
9774
+ });
9775
+ ```
9776
+
9777
+ If the assimliated promise rejects, then the downstream promise will also reject.
9778
+
9779
+ ```js
9780
+ findUser().then(function (user) {
9781
+ return findCommentsByAuthor(user);
9782
+ }).then(function (comments) {
9783
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
9784
+ }, function (reason) {
9785
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
9786
+ });
9787
+ ```
9788
+
9789
+ Simple Example
9790
+ --------------
9791
+
9792
+ Synchronous Example
9793
+
9794
+ ```javascript
9795
+ let result;
9796
+
9797
+ try {
9798
+ result = findResult();
9799
+ // success
9800
+ } catch(reason) {
9801
+ // failure
9802
+ }
9803
+ ```
9804
+
9805
+ Errback Example
9806
+
9807
+ ```js
9808
+ findResult(function(result, err){
9809
+ if (err) {
9976
9810
  // failure
9977
- });
9978
- ```
9979
-
9980
- Advanced Example
9981
- --------------
9982
-
9983
- Synchronous Example
9984
-
9985
- ```javascript
9986
- let author, books;
9987
-
9988
- try {
9989
- author = findAuthor();
9990
- books = findBooksByAuthor(author);
9811
+ } else {
9991
9812
  // success
9992
- } catch(reason) {
9993
- // failure
9994
9813
  }
9995
- ```
9996
-
9997
- Errback Example
9998
-
9999
- ```js
10000
-
10001
- function foundBooks(books) {
10002
-
10003
- }
10004
-
10005
- function failure(reason) {
10006
-
10007
- }
10008
-
10009
- findAuthor(function(author, err){
10010
- if (err) {
10011
- failure(err);
10012
- // failure
10013
- } else {
10014
- try {
10015
- findBoooksByAuthor(author, function(books, err) {
10016
- if (err) {
10017
- failure(err);
10018
- } else {
10019
- try {
10020
- foundBooks(books);
10021
- } catch(reason) {
10022
- failure(reason);
10023
- }
9814
+ });
9815
+ ```
9816
+
9817
+ Promise Example;
9818
+
9819
+ ```javascript
9820
+ findResult().then(function(result){
9821
+ // success
9822
+ }, function(reason){
9823
+ // failure
9824
+ });
9825
+ ```
9826
+
9827
+ Advanced Example
9828
+ --------------
9829
+
9830
+ Synchronous Example
9831
+
9832
+ ```javascript
9833
+ let author, books;
9834
+
9835
+ try {
9836
+ author = findAuthor();
9837
+ books = findBooksByAuthor(author);
9838
+ // success
9839
+ } catch(reason) {
9840
+ // failure
9841
+ }
9842
+ ```
9843
+
9844
+ Errback Example
9845
+
9846
+ ```js
9847
+
9848
+ function foundBooks(books) {
9849
+
9850
+ }
9851
+
9852
+ function failure(reason) {
9853
+
9854
+ }
9855
+
9856
+ findAuthor(function(author, err){
9857
+ if (err) {
9858
+ failure(err);
9859
+ // failure
9860
+ } else {
9861
+ try {
9862
+ findBoooksByAuthor(author, function(books, err) {
9863
+ if (err) {
9864
+ failure(err);
9865
+ } else {
9866
+ try {
9867
+ foundBooks(books);
9868
+ } catch(reason) {
9869
+ failure(reason);
10024
9870
  }
10025
- });
10026
- } catch(error) {
10027
- failure(err);
10028
- }
10029
- // success
9871
+ }
9872
+ });
9873
+ } catch(error) {
9874
+ failure(err);
10030
9875
  }
10031
- });
10032
- ```
10033
-
10034
- Promise Example;
10035
-
10036
- ```javascript
10037
- findAuthor().
10038
- then(findBooksByAuthor).
10039
- then(function(books){
10040
- // found books
10041
- }).catch(function(reason){
10042
- // something went wrong
10043
- });
10044
- ```
10045
-
10046
- @method then
10047
- @param {Function} onFulfillment
10048
- @param {Function} onRejection
10049
- @param {String} label optional string for labeling the promise.
10050
- Useful for tooling.
10051
- @return {Promise}
10052
- */
10053
- then: then,
10054
-
10055
- catch: function (onRejection, label) {
10056
- return this.then(undefined, onRejection, label);
10057
- },
10058
- finally: function (callback, label) {
10059
- var promise = this;
10060
- var constructor = promise.constructor;
10061
-
10062
- return promise.then(function (value) {
10063
- return constructor.resolve(callback()).then(function () {
10064
- return value;
10065
- });
10066
- }, function (reason) {
10067
- return constructor.resolve(callback()).then(function () {
10068
- throw reason;
10069
- });
10070
- }, label);
10071
- }
10072
- };
9876
+ // success
9877
+ }
9878
+ });
9879
+ ```
9880
+
9881
+ Promise Example;
9882
+
9883
+ ```javascript
9884
+ findAuthor().
9885
+ then(findBooksByAuthor).
9886
+ then(function(books){
9887
+ // found books
9888
+ }).catch(function(reason){
9889
+ // something went wrong
9890
+ });
9891
+ ```
9892
+
9893
+ @method then
9894
+ @param {Function} onFulfillment
9895
+ @param {Function} onRejection
9896
+ @param {String} label optional string for labeling the promise.
9897
+ Useful for tooling.
9898
+ @return {Promise}
9899
+ */
9900
+ Promise.prototype.then = then;
10073
9901
 
10074
9902
  function Result() {
10075
9903
  this.value = undefined;
@@ -10347,70 +10175,69 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
10347
10175
  return Promise.all(array, label);
10348
10176
  }
10349
10177
 
10350
- function AllSettled(Constructor, entries, label) {
10351
- this._superConstructor(Constructor, entries, false /* don't abort on reject */, label);
10352
- }
10178
+ var AllSettled = function (_Enumerator) {
10179
+ (0, _emberBabel.inherits)(AllSettled, _Enumerator);
10180
+
10181
+ function AllSettled(Constructor, entries, label) {
10182
+ (0, _emberBabel.classCallCheck)(this, AllSettled);
10183
+ return (0, _emberBabel.possibleConstructorReturn)(this, _Enumerator.call(this, Constructor, entries, false /* don't abort on reject */, label));
10184
+ }
10185
+
10186
+ return AllSettled;
10187
+ }(Enumerator);
10353
10188
 
10354
- AllSettled.prototype = o_create(Enumerator.prototype);
10355
- AllSettled.prototype._superConstructor = Enumerator;
10356
10189
  AllSettled.prototype._makeResult = makeSettledResult;
10357
- AllSettled.prototype._validationError = function () {
10358
- return new Error('allSettled must be called with an array');
10359
- };
10360
10190
 
10361
10191
  /**
10362
- `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
10363
- a fail-fast method, it waits until all the promises have returned and
10364
- shows you all the results. This is useful if you want to handle multiple
10365
- promises' failure states together as a set.
10366
-
10367
- Returns a promise that is fulfilled when all the given promises have been
10368
- settled. The return promise is fulfilled with an array of the states of
10369
- the promises passed into the `promises` array argument.
10370
-
10371
- Each state object will either indicate fulfillment or rejection, and
10372
- provide the corresponding value or reason. The states will take one of
10373
- the following formats:
10374
-
10375
- ```javascript
10376
- { state: 'fulfilled', value: value }
10377
- or
10378
- { state: 'rejected', reason: reason }
10379
- ```
10380
-
10381
- Example:
10382
-
10383
- ```javascript
10384
- let promise1 = RSVP.Promise.resolve(1);
10385
- let promise2 = RSVP.Promise.reject(new Error('2'));
10386
- let promise3 = RSVP.Promise.reject(new Error('3'));
10387
- let promises = [ promise1, promise2, promise3 ];
10388
-
10389
- RSVP.allSettled(promises).then(function(array){
10390
- // array == [
10391
- // { state: 'fulfilled', value: 1 },
10392
- // { state: 'rejected', reason: Error },
10393
- // { state: 'rejected', reason: Error }
10394
- // ]
10395
- // Note that for the second item, reason.message will be '2', and for the
10396
- // third item, reason.message will be '3'.
10397
- }, function(error) {
10398
- // Not run. (This block would only be called if allSettled had failed,
10399
- // for instance if passed an incorrect argument type.)
10400
- });
10401
- ```
10402
-
10403
- @method allSettled
10404
- @static
10405
- @for RSVP
10406
- @param {Array} entries
10407
- @param {String} label - optional string that describes the promise.
10408
- Useful for tooling.
10409
- @return {Promise} promise that is fulfilled with an array of the settled
10410
- states of the constituent promises.
10192
+ `RSVP.allSettled` is similar to `RSVP.all`, but instead of implementing
10193
+ a fail-fast method, it waits until all the promises have returned and
10194
+ shows you all the results. This is useful if you want to handle multiple
10195
+ promises' failure states together as a set.
10196
+ Returns a promise that is fulfilled when all the given promises have been
10197
+ settled. The return promise is fulfilled with an array of the states of
10198
+ the promises passed into the `promises` array argument.
10199
+ Each state object will either indicate fulfillment or rejection, and
10200
+ provide the corresponding value or reason. The states will take one of
10201
+ the following formats:
10202
+ ```javascript
10203
+ { state: 'fulfilled', value: value }
10204
+ or
10205
+ { state: 'rejected', reason: reason }
10206
+ ```
10207
+ Example:
10208
+ ```javascript
10209
+ let promise1 = RSVP.Promise.resolve(1);
10210
+ let promise2 = RSVP.Promise.reject(new Error('2'));
10211
+ let promise3 = RSVP.Promise.reject(new Error('3'));
10212
+ let promises = [ promise1, promise2, promise3 ];
10213
+ RSVP.allSettled(promises).then(function(array){
10214
+ // array == [
10215
+ // { state: 'fulfilled', value: 1 },
10216
+ // { state: 'rejected', reason: Error },
10217
+ // { state: 'rejected', reason: Error }
10218
+ // ]
10219
+ // Note that for the second item, reason.message will be '2', and for the
10220
+ // third item, reason.message will be '3'.
10221
+ }, function(error) {
10222
+ // Not run. (This block would only be called if allSettled had failed,
10223
+ // for instance if passed an incorrect argument type.)
10224
+ });
10225
+ ```
10226
+ @method allSettled
10227
+ @static
10228
+ @for RSVP
10229
+ @param {Array} entries
10230
+ @param {String} label - optional string that describes the promise.
10231
+ Useful for tooling.
10232
+ @return {Promise} promise that is fulfilled with an array of the settled
10233
+ states of the constituent promises.
10411
10234
  */
10412
10235
 
10413
10236
  function allSettled(entries, label) {
10237
+ if (!isArray(entries)) {
10238
+ return Promise.reject(new TypeError("Promise.allSettled must be called with an array"), label);
10239
+ }
10240
+
10414
10241
  return new AllSettled(Promise, entries, label).promise;
10415
10242
  }
10416
10243
 
@@ -10428,48 +10255,52 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
10428
10255
  return Promise.race(array, label);
10429
10256
  }
10430
10257
 
10431
- function PromiseHash(Constructor, object, label) {
10432
- this._superConstructor(Constructor, object, true, label);
10433
- }
10258
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
10434
10259
 
10435
- PromiseHash.prototype = o_create(Enumerator.prototype);
10436
- PromiseHash.prototype._superConstructor = Enumerator;
10437
- PromiseHash.prototype._init = function () {
10438
- this._result = {};
10439
- };
10260
+ var PromiseHash = function (_Enumerator2) {
10261
+ (0, _emberBabel.inherits)(PromiseHash, _Enumerator2);
10440
10262
 
10441
- PromiseHash.prototype._validateInput = function (input) {
10442
- return input && typeof input === 'object';
10443
- };
10263
+ function PromiseHash(Constructor, object) {
10264
+ var abortOnReject = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
10265
+ var label = arguments[3];
10266
+ (0, _emberBabel.classCallCheck)(this, PromiseHash);
10267
+ return (0, _emberBabel.possibleConstructorReturn)(this, _Enumerator2.call(this, Constructor, object, abortOnReject, label));
10268
+ }
10444
10269
 
10445
- PromiseHash.prototype._validationError = function () {
10446
- return new Error('Promise.hash must be called with an object');
10447
- };
10270
+ PromiseHash.prototype._init = function _init(Constructor, object) {
10271
+ this._result = {};
10448
10272
 
10449
- PromiseHash.prototype._enumerate = function () {
10450
- var enumerator = this;
10451
- var promise = enumerator.promise;
10452
- var input = enumerator._input;
10453
- var results = [];
10454
-
10455
- for (var key in input) {
10456
- if (promise._state === PENDING && Object.prototype.hasOwnProperty.call(input, key)) {
10457
- results.push({
10458
- position: key,
10459
- entry: input[key]
10460
- });
10273
+ this._enumerate(object);
10274
+ if (this._remaining === 0) {
10275
+ fulfill(this.promise, this._result);
10461
10276
  }
10462
- }
10277
+ };
10463
10278
 
10464
- var length = results.length;
10465
- enumerator._remaining = length;
10466
- var result = void 0;
10279
+ PromiseHash.prototype._enumerate = function _enumerate(input) {
10280
+ var promise = this.promise;
10281
+ var results = [];
10467
10282
 
10468
- for (var i = 0; promise._state === PENDING && i < length; i++) {
10469
- result = results[i];
10470
- enumerator._eachEntry(result.entry, result.position);
10471
- }
10472
- };
10283
+ for (var key in input) {
10284
+ if (hasOwnProperty.call(input, key)) {
10285
+ results.push({
10286
+ position: key,
10287
+ entry: input[key]
10288
+ });
10289
+ }
10290
+ }
10291
+
10292
+ var length = results.length;
10293
+ this._remaining = length;
10294
+ var result = void 0;
10295
+
10296
+ for (var i = 0; promise._state === PENDING && i < length; i++) {
10297
+ result = results[i];
10298
+ this._eachEntry(result.entry, result.position);
10299
+ }
10300
+ };
10301
+
10302
+ return PromiseHash;
10303
+ }(Enumerator);
10473
10304
 
10474
10305
  /**
10475
10306
  `RSVP.hash` is similar to `RSVP.all`, but takes an object instead of an array
@@ -10560,20 +10391,25 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
10560
10391
  have been fulfilled, or rejected if any of them become rejected.
10561
10392
  */
10562
10393
  function hash(object, label) {
10394
+ if (!isObject(object)) {
10395
+ return Promise.reject(new TypeError("Promise.hash must be called with an object"), label);
10396
+ }
10397
+
10563
10398
  return new PromiseHash(Promise, object, label).promise;
10564
10399
  }
10565
10400
 
10566
- function HashSettled(Constructor, object, label) {
10567
- this._superConstructor(Constructor, object, false, label);
10568
- }
10401
+ var HashSettled = function (_PromiseHash) {
10402
+ (0, _emberBabel.inherits)(HashSettled, _PromiseHash);
10569
10403
 
10570
- HashSettled.prototype = o_create(PromiseHash.prototype);
10571
- HashSettled.prototype._superConstructor = Enumerator;
10572
- HashSettled.prototype._makeResult = makeSettledResult;
10404
+ function HashSettled(Constructor, object, label) {
10405
+ (0, _emberBabel.classCallCheck)(this, HashSettled);
10406
+ return (0, _emberBabel.possibleConstructorReturn)(this, _PromiseHash.call(this, Constructor, object, false, label));
10407
+ }
10573
10408
 
10574
- HashSettled.prototype._validationError = function () {
10575
- return new Error('hashSettled must be called with an object');
10576
- };
10409
+ return HashSettled;
10410
+ }(PromiseHash);
10411
+
10412
+ HashSettled.prototype._makeResult = makeSettledResult;
10577
10413
 
10578
10414
  /**
10579
10415
  `RSVP.hashSettled` is similar to `RSVP.allSettled`, but takes an object
@@ -10676,8 +10512,13 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
10676
10512
  have been settled.
10677
10513
  @static
10678
10514
  */
10515
+
10679
10516
  function hashSettled(object, label) {
10680
- return new HashSettled(Promise, object, label).promise;
10517
+ if (!isObject(object)) {
10518
+ return Promise.reject(new TypeError("RSVP.hashSettled must be called with an object"), label);
10519
+ }
10520
+
10521
+ return new HashSettled(Promise, object, false, label).promise;
10681
10522
  }
10682
10523
 
10683
10524
  /**
@@ -10850,11 +10691,15 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
10850
10691
  @static
10851
10692
  */
10852
10693
  function map(promises, mapFn, label) {
10853
- return Promise.all(promises, label).then(function (values) {
10854
- if (!isFunction(mapFn)) {
10855
- throw new TypeError("You must pass a function as map's second argument.");
10856
- }
10694
+ if (!isArray(promises)) {
10695
+ return Promise.reject(new TypeError("RSVP.map must be called with an array"), label);
10696
+ }
10857
10697
 
10698
+ if (!isFunction(mapFn)) {
10699
+ return Promise.reject(new TypeError("RSVP.map expects a function as a second argument"), label);
10700
+ }
10701
+
10702
+ return Promise.all(promises, label).then(function (values) {
10858
10703
  var length = values.length;
10859
10704
  var results = new Array(length);
10860
10705
 
@@ -10994,12 +10839,16 @@ enifed('rsvp', ['exports', 'ember-babel', 'node-module'], function (exports, _em
10994
10839
  }
10995
10840
 
10996
10841
  function filter(promises, filterFn, label) {
10842
+ if (!isArray(promises) && !(isObject(promises) && promises.then !== undefined)) {
10843
+ return Promise.reject(new TypeError("RSVP.filter must be called with an array or promise"), label);
10844
+ }
10845
+
10846
+ if (!isFunction(filterFn)) {
10847
+ return Promise.reject(new TypeError("RSVP.filter expects function as a second argument"), label);
10848
+ }
10849
+
10997
10850
  var promise = isArray(promises) ? resolveAll(promises, label) : resolveSingle(promises, label);
10998
10851
  return promise.then(function (values) {
10999
- if (!isFunction(filterFn)) {
11000
- throw new TypeError("You must pass a function as filter's second argument.");
11001
- }
11002
-
11003
10852
  var length = values.length;
11004
10853
  var filtered = new Array(length);
11005
10854