traceur-rb 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (410) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +2 -2
  3. data/lib/js/compile.js +7 -15
  4. data/lib/traceur.rb +2 -1
  5. data/lib/traceur/compilation_error.rb +27 -0
  6. data/lib/traceur/compiler.rb +4 -1
  7. data/lib/traceur/configuration.rb +1 -1
  8. data/lib/traceur/node/runner.rb +1 -1
  9. data/lib/traceur/version.rb +1 -1
  10. data/spec/examples/syntax_error.js +3 -0
  11. data/spec/integration/examples_spec.rb +6 -0
  12. data/vendor/node_modules/traceur/LICENSE +202 -0
  13. data/vendor/node_modules/traceur/README.md +5 -5
  14. data/vendor/node_modules/traceur/bin/traceur-runtime.js +1392 -623
  15. data/vendor/node_modules/traceur/bin/traceur.js +24749 -17990
  16. data/vendor/node_modules/traceur/node_modules/.bin/semver +2 -2
  17. data/vendor/node_modules/traceur/node_modules/commander/History.md +222 -0
  18. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +127 -35
  19. data/vendor/node_modules/traceur/node_modules/commander/index.js +261 -93
  20. data/vendor/node_modules/traceur/node_modules/commander/package.json +41 -9
  21. data/vendor/node_modules/traceur/node_modules/glob/LICENSE +15 -0
  22. data/vendor/node_modules/traceur/node_modules/glob/README.md +357 -0
  23. data/vendor/node_modules/traceur/node_modules/glob/common.js +177 -0
  24. data/vendor/node_modules/traceur/node_modules/glob/glob.js +649 -0
  25. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  26. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  27. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/README.md +37 -0
  28. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  29. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  30. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  31. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +34 -0
  32. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  33. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  34. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/package.json +61 -0
  35. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inflight/test.js +97 -0
  36. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  37. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/README.md +42 -0
  38. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  39. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  40. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/package.json +33 -0
  41. data/vendor/node_modules/traceur/node_modules/glob/node_modules/inherits/test.js +25 -0
  42. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
  43. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
  44. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  45. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/README.md +216 -0
  46. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
  47. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
  48. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
  49. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
  50. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
  51. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
  52. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  53. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  54. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  55. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/collections → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match}/.travis.yml +0 -0
  56. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  57. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  58. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  59. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  60. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
  61. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  62. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/url2 → glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map}/.travis.yml +1 -1
  63. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  64. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  65. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  66. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  67. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
  68. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  69. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
  70. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
  71. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
  72. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
  73. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
  74. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
  75. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
  76. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
  77. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
  78. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
  79. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
  80. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
  81. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
  82. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/package.json +60 -0
  83. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  84. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
  85. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  86. data/vendor/node_modules/traceur/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  87. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/LICENSE +27 -0
  88. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/README.md +51 -0
  89. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  90. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  91. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +34 -0
  92. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  93. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  94. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/once.js +21 -0
  95. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/package.json +42 -0
  96. data/vendor/node_modules/traceur/node_modules/glob/node_modules/once/test/once.js +23 -0
  97. data/vendor/node_modules/traceur/node_modules/glob/package.json +72 -0
  98. data/vendor/node_modules/traceur/node_modules/glob/sync.js +409 -0
  99. data/vendor/node_modules/traceur/node_modules/rsvp/.release.json +17 -0
  100. data/vendor/node_modules/traceur/node_modules/rsvp/CHANGELOG.md +165 -0
  101. data/vendor/node_modules/traceur/node_modules/rsvp/LICENSE +19 -0
  102. data/vendor/node_modules/traceur/node_modules/rsvp/README.md +364 -0
  103. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.js +1671 -0
  104. data/vendor/node_modules/traceur/node_modules/rsvp/dist/rsvp.min.js +9 -0
  105. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.js +66 -0
  106. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp.umd.js +50 -0
  107. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/-internal.js +265 -0
  108. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all-settled.js +71 -0
  109. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/all.js +15 -0
  110. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/asap.js +109 -0
  111. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/config.js +28 -0
  112. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/defer.js +45 -0
  113. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/enumerator.js +125 -0
  114. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/events.js +201 -0
  115. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/filter.js +120 -0
  116. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash-settled.js +124 -0
  117. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/hash.js +94 -0
  118. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/instrument.js +41 -0
  119. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/map.js +99 -0
  120. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/node.js +281 -0
  121. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise-hash.js +51 -0
  122. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise.js +496 -0
  123. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/all.js +52 -0
  124. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/race.js +105 -0
  125. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/reject.js +47 -0
  126. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/promise/resolve.js +49 -0
  127. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/race.js +15 -0
  128. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/reject.js +16 -0
  129. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/resolve.js +17 -0
  130. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/rethrow.js +46 -0
  131. data/vendor/node_modules/traceur/node_modules/rsvp/lib/rsvp/utils.js +39 -0
  132. data/vendor/node_modules/traceur/node_modules/rsvp/package.json +100 -0
  133. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/README.md +9 -0
  134. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/bower.json +22 -0
  135. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/composer.json +18 -0
  136. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/package.json +52 -0
  137. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.amd.js +1607 -0
  138. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.js +1566 -0
  139. data/vendor/node_modules/traceur/node_modules/rsvp/rsvp.js/rsvp.min.js +26 -0
  140. data/vendor/node_modules/traceur/node_modules/rsvp/vertx.js +1 -0
  141. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +2 -2
  142. data/vendor/node_modules/traceur/node_modules/semver/package.json +4 -3
  143. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +7 -0
  144. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  145. data/vendor/node_modules/traceur/node_modules/semver/semver.js +7 -0
  146. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -1
  147. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  148. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +8 -4
  149. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +2 -1
  150. data/vendor/node_modules/traceur/node_modules/source-map-support/.npmignore +1 -0
  151. data/vendor/node_modules/traceur/node_modules/{q-io/node_modules/mime/LICENSE → source-map-support/LICENSE.md} +7 -5
  152. data/vendor/node_modules/traceur/node_modules/source-map-support/README.md +165 -0
  153. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/browser-source-map-support.js +89 -0
  154. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/index.html +6 -0
  155. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/require.js +36 -0
  156. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.coffee +13 -0
  157. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.js +24 -0
  158. data/vendor/node_modules/traceur/node_modules/source-map-support/amd-test/script.map +10 -0
  159. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-source-map-support.js +89 -0
  160. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/index.html +6 -0
  161. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.coffee +12 -0
  162. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.js +25 -0
  163. data/vendor/node_modules/traceur/node_modules/source-map-support/browser-test/script.map +10 -0
  164. data/vendor/node_modules/traceur/node_modules/source-map-support/build.js +69 -0
  165. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/index.html +6 -0
  166. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.coffee +12 -0
  167. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.js +25 -0
  168. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/script.map +10 -0
  169. data/vendor/node_modules/traceur/node_modules/source-map-support/header-test/server.js +45 -0
  170. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/.npmignore +2 -0
  171. data/vendor/node_modules/traceur/node_modules/{q-io → source-map-support/node_modules/source-map}/.travis.yml +1 -0
  172. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/CHANGELOG.md +121 -0
  173. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/LICENSE +28 -0
  174. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/Makefile.dryice.js +166 -0
  175. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/README.md +434 -0
  176. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/assert-shim.js +56 -0
  177. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/mini-require.js +152 -0
  178. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-source-map.jsm +20 -0
  179. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/prefix-utils.jsm +18 -0
  180. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-browser.js +8 -0
  181. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-source-map.jsm +6 -0
  182. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/suffix-utils.jsm +21 -0
  183. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-prefix.js +8 -0
  184. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/build/test-suffix.js +3 -0
  185. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map.js +8 -0
  186. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/array-set.js +97 -0
  187. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
  188. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/base64.js +42 -0
  189. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/binary-search.js +81 -0
  190. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js +478 -0
  191. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-generator.js +380 -0
  192. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-node.js +371 -0
  193. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/lib/source-map/util.js +205 -0
  194. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
  195. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/README.md +171 -0
  196. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
  197. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/intercept.js +36 -0
  198. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/node_modules/amdefine/package.json +37 -0
  199. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/package.json +142 -0
  200. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/run-tests.js +62 -0
  201. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-api.js +26 -0
  202. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-array-set.js +104 -0
  203. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
  204. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-base64.js +35 -0
  205. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
  206. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
  207. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-consumer.js +451 -0
  208. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-map-generator.js +417 -0
  209. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/test-source-node.js +365 -0
  210. data/vendor/node_modules/traceur/node_modules/source-map-support/node_modules/source-map/test/source-map/util.js +161 -0
  211. data/vendor/node_modules/traceur/node_modules/source-map-support/package.json +52 -0
  212. data/vendor/node_modules/traceur/node_modules/source-map-support/source-map-support.js +381 -0
  213. data/vendor/node_modules/traceur/node_modules/source-map-support/test.js +359 -0
  214. data/vendor/node_modules/traceur/package.json +234 -20
  215. data/vendor/node_modules/traceur/src/node/NodeCompiler.js +78 -0
  216. data/vendor/node_modules/traceur/src/node/System.js +32 -5
  217. data/vendor/node_modules/traceur/src/node/api.js +28 -93
  218. data/vendor/node_modules/traceur/src/node/command.js +84 -19
  219. data/vendor/node_modules/traceur/src/node/compileAllJsFilesInDir.js +40 -0
  220. data/vendor/node_modules/traceur/src/node/interpreter.js +11 -8
  221. data/vendor/node_modules/traceur/src/node/recursiveModuleCompile.js +171 -0
  222. data/vendor/node_modules/traceur/src/node/require.js +7 -21
  223. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +2 -7
  224. data/vendor/node_modules/traceur/src/node/to-closure-compiler.js +28 -0
  225. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +3 -7
  226. data/vendor/node_modules/traceur/src/node/traceur.js +1 -1
  227. metadata +196 -190
  228. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +0 -1
  229. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +0 -122
  230. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +0 -19
  231. data/vendor/node_modules/traceur/node_modules/q-io/README.md +0 -928
  232. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +0 -59
  233. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +0 -44
  234. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +0 -51
  235. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +0 -307
  236. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +0 -499
  237. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +0 -547
  238. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +0 -105
  239. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +0 -355
  240. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +0 -65
  241. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +0 -152
  242. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +0 -24
  243. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +0 -93
  244. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +0 -154
  245. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +0 -178
  246. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +0 -417
  247. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +0 -58
  248. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +0 -78
  249. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +0 -120
  250. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +0 -27
  251. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +0 -209
  252. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +0 -125
  253. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +0 -175
  254. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +0 -75
  255. data/vendor/node_modules/traceur/node_modules/q-io/http.js +0 -378
  256. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +0 -11
  257. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +0 -78
  258. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +0 -21
  259. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +0 -1285
  260. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +0 -22
  261. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +0 -142
  262. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +0 -57
  263. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +0 -183
  264. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +0 -261
  265. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +0 -186
  266. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +0 -55
  267. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +0 -59
  268. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +0 -236
  269. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +0 -371
  270. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +0 -435
  271. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +0 -247
  272. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +0 -147
  273. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +0 -448
  274. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +0 -139
  275. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +0 -79
  276. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +0 -142
  277. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +0 -60
  278. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +0 -41
  279. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +0 -12
  280. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +0 -7
  281. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +0 -48
  282. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +0 -590
  283. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +0 -49
  284. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +0 -173
  285. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +0 -274
  286. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +0 -59
  287. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +0 -538
  288. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +0 -14
  289. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +0 -6
  290. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +0 -49
  291. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +0 -51
  292. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +0 -269
  293. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +0 -61
  294. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +0 -736
  295. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +0 -40
  296. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +0 -1
  297. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +0 -66
  298. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +0 -114
  299. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +0 -35
  300. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +0 -84
  301. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +0 -1588
  302. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +0 -77
  303. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +0 -15
  304. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +0 -19
  305. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +0 -96
  306. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +0 -166
  307. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +0 -43
  308. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +0 -40
  309. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +0 -19
  310. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +0 -813
  311. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +0 -71
  312. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +0 -36
  313. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +0 -93
  314. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +0 -1937
  315. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +0 -35
  316. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +0 -6
  317. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +0 -36
  318. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +0 -7
  319. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +0 -38
  320. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +0 -32
  321. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +0 -39
  322. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +0 -2
  323. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +0 -123
  324. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +0 -19
  325. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +0 -3
  326. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +0 -3
  327. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +0 -128
  328. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +0 -53
  329. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +0 -61
  330. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +0 -856
  331. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +0 -1080
  332. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +0 -377
  333. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +0 -290
  334. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +0 -3
  335. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +0 -42
  336. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +0 -4
  337. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +0 -16
  338. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +0 -12
  339. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +0 -91
  340. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +0 -12
  341. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +0 -13
  342. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +0 -14
  343. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +0 -146
  344. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +0 -39
  345. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +0 -48
  346. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +0 -3
  347. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +0 -22
  348. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +0 -6
  349. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +0 -248
  350. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +0 -53
  351. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +0 -2
  352. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +0 -91
  353. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +0 -548
  354. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +0 -8
  355. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +0 -358
  356. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +0 -133
  357. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +0 -3
  358. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +0 -20
  359. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +0 -33
  360. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +0 -37
  361. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +0 -125
  362. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +0 -151
  363. data/vendor/node_modules/traceur/node_modules/q-io/package.json +0 -51
  364. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +0 -133
  365. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +0 -47
  366. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +0 -11
  367. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +0 -1
  368. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +0 -33
  369. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +0 -92
  370. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +0 -41
  371. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +0 -57
  372. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +0 -1
  373. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +0 -70
  374. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +0 -109
  375. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +0 -67
  376. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +0 -219
  377. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +0 -20
  378. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +0 -26
  379. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +0 -40
  380. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +0 -37
  381. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +0 -39
  382. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +0 -32
  383. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +0 -26
  384. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +0 -86
  385. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +0 -31
  386. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +0 -73
  387. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +0 -23
  388. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +0 -1
  389. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +0 -22
  390. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +0 -25
  391. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +0 -45
  392. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +0 -38
  393. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +0 -52
  394. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +0 -86
  395. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +0 -1
  396. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +0 -1
  397. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  398. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  399. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +0 -49
  400. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +0 -47
  401. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +0 -186
  402. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +0 -82
  403. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +0 -110
  404. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +0 -96
  405. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +0 -96
  406. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +0 -42
  407. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +0 -111
  408. data/vendor/node_modules/traceur/src/node/compile-single-file.js +0 -69
  409. data/vendor/node_modules/traceur/src/node/compiler.js +0 -116
  410. data/vendor/node_modules/traceur/src/node/inline-module.js +0 -149
@@ -0,0 +1,1566 @@
1
+ /*!
2
+ * @overview RSVP - a tiny implementation of Promises/A+.
3
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
4
+ * @license Licensed under MIT license
5
+ * See https://raw.githubusercontent.com/tildeio/rsvp.js/master/LICENSE
6
+ * @version 3.0.15
7
+ */
8
+
9
+ (function() {
10
+ "use strict";
11
+ function $$rsvp$events$$indexOf(callbacks, callback) {
12
+ for (var i=0, l=callbacks.length; i<l; i++) {
13
+ if (callbacks[i] === callback) { return i; }
14
+ }
15
+
16
+ return -1;
17
+ }
18
+
19
+ function $$rsvp$events$$callbacksFor(object) {
20
+ var callbacks = object._promiseCallbacks;
21
+
22
+ if (!callbacks) {
23
+ callbacks = object._promiseCallbacks = {};
24
+ }
25
+
26
+ return callbacks;
27
+ }
28
+
29
+ var $$rsvp$events$$default = {
30
+
31
+ /**
32
+ `RSVP.EventTarget.mixin` extends an object with EventTarget methods. For
33
+ Example:
34
+
35
+ ```javascript
36
+ var object = {};
37
+
38
+ RSVP.EventTarget.mixin(object);
39
+
40
+ object.on('finished', function(event) {
41
+ // handle event
42
+ });
43
+
44
+ object.trigger('finished', { detail: value });
45
+ ```
46
+
47
+ `EventTarget.mixin` also works with prototypes:
48
+
49
+ ```javascript
50
+ var Person = function() {};
51
+ RSVP.EventTarget.mixin(Person.prototype);
52
+
53
+ var yehuda = new Person();
54
+ var tom = new Person();
55
+
56
+ yehuda.on('poke', function(event) {
57
+ console.log('Yehuda says OW');
58
+ });
59
+
60
+ tom.on('poke', function(event) {
61
+ console.log('Tom says OW');
62
+ });
63
+
64
+ yehuda.trigger('poke');
65
+ tom.trigger('poke');
66
+ ```
67
+
68
+ @method mixin
69
+ @for RSVP.EventTarget
70
+ @private
71
+ @param {Object} object object to extend with EventTarget methods
72
+ */
73
+ 'mixin': function(object) {
74
+ object['on'] = this['on'];
75
+ object['off'] = this['off'];
76
+ object['trigger'] = this['trigger'];
77
+ object._promiseCallbacks = undefined;
78
+ return object;
79
+ },
80
+
81
+ /**
82
+ Registers a callback to be executed when `eventName` is triggered
83
+
84
+ ```javascript
85
+ object.on('event', function(eventInfo){
86
+ // handle the event
87
+ });
88
+
89
+ object.trigger('event');
90
+ ```
91
+
92
+ @method on
93
+ @for RSVP.EventTarget
94
+ @private
95
+ @param {String} eventName name of the event to listen for
96
+ @param {Function} callback function to be called when the event is triggered.
97
+ */
98
+ 'on': function(eventName, callback) {
99
+ var allCallbacks = $$rsvp$events$$callbacksFor(this), callbacks;
100
+
101
+ callbacks = allCallbacks[eventName];
102
+
103
+ if (!callbacks) {
104
+ callbacks = allCallbacks[eventName] = [];
105
+ }
106
+
107
+ if ($$rsvp$events$$indexOf(callbacks, callback) === -1) {
108
+ callbacks.push(callback);
109
+ }
110
+ },
111
+
112
+ /**
113
+ You can use `off` to stop firing a particular callback for an event:
114
+
115
+ ```javascript
116
+ function doStuff() { // do stuff! }
117
+ object.on('stuff', doStuff);
118
+
119
+ object.trigger('stuff'); // doStuff will be called
120
+
121
+ // Unregister ONLY the doStuff callback
122
+ object.off('stuff', doStuff);
123
+ object.trigger('stuff'); // doStuff will NOT be called
124
+ ```
125
+
126
+ If you don't pass a `callback` argument to `off`, ALL callbacks for the
127
+ event will not be executed when the event fires. For example:
128
+
129
+ ```javascript
130
+ var callback1 = function(){};
131
+ var callback2 = function(){};
132
+
133
+ object.on('stuff', callback1);
134
+ object.on('stuff', callback2);
135
+
136
+ object.trigger('stuff'); // callback1 and callback2 will be executed.
137
+
138
+ object.off('stuff');
139
+ object.trigger('stuff'); // callback1 and callback2 will not be executed!
140
+ ```
141
+
142
+ @method off
143
+ @for RSVP.EventTarget
144
+ @private
145
+ @param {String} eventName event to stop listening to
146
+ @param {Function} callback optional argument. If given, only the function
147
+ given will be removed from the event's callback queue. If no `callback`
148
+ argument is given, all callbacks will be removed from the event's callback
149
+ queue.
150
+ */
151
+ 'off': function(eventName, callback) {
152
+ var allCallbacks = $$rsvp$events$$callbacksFor(this), callbacks, index;
153
+
154
+ if (!callback) {
155
+ allCallbacks[eventName] = [];
156
+ return;
157
+ }
158
+
159
+ callbacks = allCallbacks[eventName];
160
+
161
+ index = $$rsvp$events$$indexOf(callbacks, callback);
162
+
163
+ if (index !== -1) { callbacks.splice(index, 1); }
164
+ },
165
+
166
+ /**
167
+ Use `trigger` to fire custom events. For example:
168
+
169
+ ```javascript
170
+ object.on('foo', function(){
171
+ console.log('foo event happened!');
172
+ });
173
+ object.trigger('foo');
174
+ // 'foo event happened!' logged to the console
175
+ ```
176
+
177
+ You can also pass a value as a second argument to `trigger` that will be
178
+ passed as an argument to all event listeners for the event:
179
+
180
+ ```javascript
181
+ object.on('foo', function(value){
182
+ console.log(value.name);
183
+ });
184
+
185
+ object.trigger('foo', { name: 'bar' });
186
+ // 'bar' logged to the console
187
+ ```
188
+
189
+ @method trigger
190
+ @for RSVP.EventTarget
191
+ @private
192
+ @param {String} eventName name of the event to be triggered
193
+ @param {Any} options optional value to be passed to any event handlers for
194
+ the given `eventName`
195
+ */
196
+ 'trigger': function(eventName, options) {
197
+ var allCallbacks = $$rsvp$events$$callbacksFor(this), callbacks, callback;
198
+
199
+ if (callbacks = allCallbacks[eventName]) {
200
+ // Don't cache the callbacks.length since it may grow
201
+ for (var i=0; i<callbacks.length; i++) {
202
+ callback = callbacks[i];
203
+
204
+ callback(options);
205
+ }
206
+ }
207
+ }
208
+ };
209
+
210
+ var $$rsvp$config$$config = {
211
+ instrument: false
212
+ };
213
+
214
+ $$rsvp$events$$default['mixin']($$rsvp$config$$config);
215
+
216
+ function $$rsvp$config$$configure(name, value) {
217
+ if (name === 'onerror') {
218
+ // handle for legacy users that expect the actual
219
+ // error to be passed to their function added via
220
+ // `RSVP.configure('onerror', someFunctionHere);`
221
+ $$rsvp$config$$config['on']('error', value);
222
+ return;
223
+ }
224
+
225
+ if (arguments.length === 2) {
226
+ $$rsvp$config$$config[name] = value;
227
+ } else {
228
+ return $$rsvp$config$$config[name];
229
+ }
230
+ }
231
+
232
+ function $$utils$$objectOrFunction(x) {
233
+ return typeof x === 'function' || (typeof x === 'object' && x !== null);
234
+ }
235
+
236
+ function $$utils$$isFunction(x) {
237
+ return typeof x === 'function';
238
+ }
239
+
240
+ function $$utils$$isMaybeThenable(x) {
241
+ return typeof x === 'object' && x !== null;
242
+ }
243
+
244
+ var $$utils$$_isArray;
245
+ if (!Array.isArray) {
246
+ $$utils$$_isArray = function (x) {
247
+ return Object.prototype.toString.call(x) === '[object Array]';
248
+ };
249
+ } else {
250
+ $$utils$$_isArray = Array.isArray;
251
+ }
252
+
253
+ var $$utils$$isArray = $$utils$$_isArray;
254
+
255
+ var $$utils$$now = Date.now || function() { return new Date().getTime(); };
256
+
257
+ function $$utils$$F() { }
258
+
259
+ var $$utils$$o_create = (Object.create || function (o) {
260
+ if (arguments.length > 1) {
261
+ throw new Error('Second argument not supported');
262
+ }
263
+ if (typeof o !== 'object') {
264
+ throw new TypeError('Argument must be an object');
265
+ }
266
+ $$utils$$F.prototype = o;
267
+ return new $$utils$$F();
268
+ });
269
+
270
+ var $$instrument$$queue = [];
271
+
272
+ function $$instrument$$scheduleFlush() {
273
+ setTimeout(function() {
274
+ var entry;
275
+ for (var i = 0; i < $$instrument$$queue.length; i++) {
276
+ entry = $$instrument$$queue[i];
277
+
278
+ var payload = entry.payload;
279
+
280
+ payload.guid = payload.key + payload.id;
281
+ payload.childGuid = payload.key + payload.childId;
282
+ if (payload.error) {
283
+ payload.stack = payload.error.stack;
284
+ }
285
+
286
+ $$rsvp$config$$config['trigger'](entry.name, entry.payload);
287
+ }
288
+ $$instrument$$queue.length = 0;
289
+ }, 50);
290
+ }
291
+
292
+ function $$instrument$$instrument(eventName, promise, child) {
293
+ if (1 === $$instrument$$queue.push({
294
+ name: eventName,
295
+ payload: {
296
+ key: promise._guidKey,
297
+ id: promise._id,
298
+ eventName: eventName,
299
+ detail: promise._result,
300
+ childId: child && child._id,
301
+ label: promise._label,
302
+ timeStamp: $$utils$$now(),
303
+ error: $$rsvp$config$$config["instrument-with-stack"] ? new Error(promise._label) : null
304
+ }})) {
305
+ $$instrument$$scheduleFlush();
306
+ }
307
+ }
308
+ var $$instrument$$default = $$instrument$$instrument;
309
+
310
+ function $$$internal$$withOwnPromise() {
311
+ return new TypeError('A promises callback cannot return that same promise.');
312
+ }
313
+
314
+ function $$$internal$$noop() {}
315
+
316
+ var $$$internal$$PENDING = void 0;
317
+ var $$$internal$$FULFILLED = 1;
318
+ var $$$internal$$REJECTED = 2;
319
+
320
+ var $$$internal$$GET_THEN_ERROR = new $$$internal$$ErrorObject();
321
+
322
+ function $$$internal$$getThen(promise) {
323
+ try {
324
+ return promise.then;
325
+ } catch(error) {
326
+ $$$internal$$GET_THEN_ERROR.error = error;
327
+ return $$$internal$$GET_THEN_ERROR;
328
+ }
329
+ }
330
+
331
+ function $$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) {
332
+ try {
333
+ then.call(value, fulfillmentHandler, rejectionHandler);
334
+ } catch(e) {
335
+ return e;
336
+ }
337
+ }
338
+
339
+ function $$$internal$$handleForeignThenable(promise, thenable, then) {
340
+ $$rsvp$config$$config.async(function(promise) {
341
+ var sealed = false;
342
+ var error = $$$internal$$tryThen(then, thenable, function(value) {
343
+ if (sealed) { return; }
344
+ sealed = true;
345
+ if (thenable !== value) {
346
+ $$$internal$$resolve(promise, value);
347
+ } else {
348
+ $$$internal$$fulfill(promise, value);
349
+ }
350
+ }, function(reason) {
351
+ if (sealed) { return; }
352
+ sealed = true;
353
+
354
+ $$$internal$$reject(promise, reason);
355
+ }, 'Settle: ' + (promise._label || ' unknown promise'));
356
+
357
+ if (!sealed && error) {
358
+ sealed = true;
359
+ $$$internal$$reject(promise, error);
360
+ }
361
+ }, promise);
362
+ }
363
+
364
+ function $$$internal$$handleOwnThenable(promise, thenable) {
365
+ if (thenable._state === $$$internal$$FULFILLED) {
366
+ $$$internal$$fulfill(promise, thenable._result);
367
+ } else if (thenable._state === $$$internal$$REJECTED) {
368
+ thenable._onError = null;
369
+ $$$internal$$reject(promise, thenable._result);
370
+ } else {
371
+ $$$internal$$subscribe(thenable, undefined, function(value) {
372
+ if (thenable !== value) {
373
+ $$$internal$$resolve(promise, value);
374
+ } else {
375
+ $$$internal$$fulfill(promise, value);
376
+ }
377
+ }, function(reason) {
378
+ $$$internal$$reject(promise, reason);
379
+ });
380
+ }
381
+ }
382
+
383
+ function $$$internal$$handleMaybeThenable(promise, maybeThenable) {
384
+ if (maybeThenable.constructor === promise.constructor) {
385
+ $$$internal$$handleOwnThenable(promise, maybeThenable);
386
+ } else {
387
+ var then = $$$internal$$getThen(maybeThenable);
388
+
389
+ if (then === $$$internal$$GET_THEN_ERROR) {
390
+ $$$internal$$reject(promise, $$$internal$$GET_THEN_ERROR.error);
391
+ } else if (then === undefined) {
392
+ $$$internal$$fulfill(promise, maybeThenable);
393
+ } else if ($$utils$$isFunction(then)) {
394
+ $$$internal$$handleForeignThenable(promise, maybeThenable, then);
395
+ } else {
396
+ $$$internal$$fulfill(promise, maybeThenable);
397
+ }
398
+ }
399
+ }
400
+
401
+ function $$$internal$$resolve(promise, value) {
402
+ if (promise === value) {
403
+ $$$internal$$fulfill(promise, value);
404
+ } else if ($$utils$$objectOrFunction(value)) {
405
+ $$$internal$$handleMaybeThenable(promise, value);
406
+ } else {
407
+ $$$internal$$fulfill(promise, value);
408
+ }
409
+ }
410
+
411
+ function $$$internal$$publishRejection(promise) {
412
+ if (promise._onError) {
413
+ promise._onError(promise._result);
414
+ }
415
+
416
+ $$$internal$$publish(promise);
417
+ }
418
+
419
+ function $$$internal$$fulfill(promise, value) {
420
+ if (promise._state !== $$$internal$$PENDING) { return; }
421
+
422
+ promise._result = value;
423
+ promise._state = $$$internal$$FULFILLED;
424
+
425
+ if (promise._subscribers.length === 0) {
426
+ if ($$rsvp$config$$config.instrument) {
427
+ $$instrument$$default('fulfilled', promise);
428
+ }
429
+ } else {
430
+ $$rsvp$config$$config.async($$$internal$$publish, promise);
431
+ }
432
+ }
433
+
434
+ function $$$internal$$reject(promise, reason) {
435
+ if (promise._state !== $$$internal$$PENDING) { return; }
436
+ promise._state = $$$internal$$REJECTED;
437
+ promise._result = reason;
438
+ $$rsvp$config$$config.async($$$internal$$publishRejection, promise);
439
+ }
440
+
441
+ function $$$internal$$subscribe(parent, child, onFulfillment, onRejection) {
442
+ var subscribers = parent._subscribers;
443
+ var length = subscribers.length;
444
+
445
+ parent._onError = null;
446
+
447
+ subscribers[length] = child;
448
+ subscribers[length + $$$internal$$FULFILLED] = onFulfillment;
449
+ subscribers[length + $$$internal$$REJECTED] = onRejection;
450
+
451
+ if (length === 0 && parent._state) {
452
+ $$rsvp$config$$config.async($$$internal$$publish, parent);
453
+ }
454
+ }
455
+
456
+ function $$$internal$$publish(promise) {
457
+ var subscribers = promise._subscribers;
458
+ var settled = promise._state;
459
+
460
+ if ($$rsvp$config$$config.instrument) {
461
+ $$instrument$$default(settled === $$$internal$$FULFILLED ? 'fulfilled' : 'rejected', promise);
462
+ }
463
+
464
+ if (subscribers.length === 0) { return; }
465
+
466
+ var child, callback, detail = promise._result;
467
+
468
+ for (var i = 0; i < subscribers.length; i += 3) {
469
+ child = subscribers[i];
470
+ callback = subscribers[i + settled];
471
+
472
+ if (child) {
473
+ $$$internal$$invokeCallback(settled, child, callback, detail);
474
+ } else {
475
+ callback(detail);
476
+ }
477
+ }
478
+
479
+ promise._subscribers.length = 0;
480
+ }
481
+
482
+ function $$$internal$$ErrorObject() {
483
+ this.error = null;
484
+ }
485
+
486
+ var $$$internal$$TRY_CATCH_ERROR = new $$$internal$$ErrorObject();
487
+
488
+ function $$$internal$$tryCatch(callback, detail) {
489
+ try {
490
+ return callback(detail);
491
+ } catch(e) {
492
+ $$$internal$$TRY_CATCH_ERROR.error = e;
493
+ return $$$internal$$TRY_CATCH_ERROR;
494
+ }
495
+ }
496
+
497
+ function $$$internal$$invokeCallback(settled, promise, callback, detail) {
498
+ var hasCallback = $$utils$$isFunction(callback),
499
+ value, error, succeeded, failed;
500
+
501
+ if (hasCallback) {
502
+ value = $$$internal$$tryCatch(callback, detail);
503
+
504
+ if (value === $$$internal$$TRY_CATCH_ERROR) {
505
+ failed = true;
506
+ error = value.error;
507
+ value = null;
508
+ } else {
509
+ succeeded = true;
510
+ }
511
+
512
+ if (promise === value) {
513
+ $$$internal$$reject(promise, $$$internal$$withOwnPromise());
514
+ return;
515
+ }
516
+
517
+ } else {
518
+ value = detail;
519
+ succeeded = true;
520
+ }
521
+
522
+ if (promise._state !== $$$internal$$PENDING) {
523
+ // noop
524
+ } else if (hasCallback && succeeded) {
525
+ $$$internal$$resolve(promise, value);
526
+ } else if (failed) {
527
+ $$$internal$$reject(promise, error);
528
+ } else if (settled === $$$internal$$FULFILLED) {
529
+ $$$internal$$fulfill(promise, value);
530
+ } else if (settled === $$$internal$$REJECTED) {
531
+ $$$internal$$reject(promise, value);
532
+ }
533
+ }
534
+
535
+ function $$$internal$$initializePromise(promise, resolver) {
536
+ var resolved = false;
537
+ try {
538
+ resolver(function resolvePromise(value){
539
+ if (resolved) { return; }
540
+ resolved = true;
541
+ $$$internal$$resolve(promise, value);
542
+ }, function rejectPromise(reason) {
543
+ if (resolved) { return; }
544
+ resolved = true;
545
+ $$$internal$$reject(promise, reason);
546
+ });
547
+ } catch(e) {
548
+ $$$internal$$reject(promise, e);
549
+ }
550
+ }
551
+
552
+ function $$enumerator$$makeSettledResult(state, position, value) {
553
+ if (state === $$$internal$$FULFILLED) {
554
+ return {
555
+ state: 'fulfilled',
556
+ value: value
557
+ };
558
+ } else {
559
+ return {
560
+ state: 'rejected',
561
+ reason: value
562
+ };
563
+ }
564
+ }
565
+
566
+ function $$enumerator$$Enumerator(Constructor, input, abortOnReject, label) {
567
+ this._instanceConstructor = Constructor;
568
+ this.promise = new Constructor($$$internal$$noop, label);
569
+ this._abortOnReject = abortOnReject;
570
+
571
+ if (this._validateInput(input)) {
572
+ this._input = input;
573
+ this.length = input.length;
574
+ this._remaining = input.length;
575
+
576
+ this._init();
577
+
578
+ if (this.length === 0) {
579
+ $$$internal$$fulfill(this.promise, this._result);
580
+ } else {
581
+ this.length = this.length || 0;
582
+ this._enumerate();
583
+ if (this._remaining === 0) {
584
+ $$$internal$$fulfill(this.promise, this._result);
585
+ }
586
+ }
587
+ } else {
588
+ $$$internal$$reject(this.promise, this._validationError());
589
+ }
590
+ }
591
+
592
+ var $$enumerator$$default = $$enumerator$$Enumerator;
593
+
594
+ $$enumerator$$Enumerator.prototype._validateInput = function(input) {
595
+ return $$utils$$isArray(input);
596
+ };
597
+
598
+ $$enumerator$$Enumerator.prototype._validationError = function() {
599
+ return new Error('Array Methods must be provided an Array');
600
+ };
601
+
602
+ $$enumerator$$Enumerator.prototype._init = function() {
603
+ this._result = new Array(this.length);
604
+ };
605
+
606
+ $$enumerator$$Enumerator.prototype._enumerate = function() {
607
+ var length = this.length;
608
+ var promise = this.promise;
609
+ var input = this._input;
610
+
611
+ for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
612
+ this._eachEntry(input[i], i);
613
+ }
614
+ };
615
+
616
+ $$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) {
617
+ var c = this._instanceConstructor;
618
+ if ($$utils$$isMaybeThenable(entry)) {
619
+ if (entry.constructor === c && entry._state !== $$$internal$$PENDING) {
620
+ entry._onError = null;
621
+ this._settledAt(entry._state, i, entry._result);
622
+ } else {
623
+ this._willSettleAt(c.resolve(entry), i);
624
+ }
625
+ } else {
626
+ this._remaining--;
627
+ this._result[i] = this._makeResult($$$internal$$FULFILLED, i, entry);
628
+ }
629
+ };
630
+
631
+ $$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) {
632
+ var promise = this.promise;
633
+
634
+ if (promise._state === $$$internal$$PENDING) {
635
+ this._remaining--;
636
+
637
+ if (this._abortOnReject && state === $$$internal$$REJECTED) {
638
+ $$$internal$$reject(promise, value);
639
+ } else {
640
+ this._result[i] = this._makeResult(state, i, value);
641
+ }
642
+ }
643
+
644
+ if (this._remaining === 0) {
645
+ $$$internal$$fulfill(promise, this._result);
646
+ }
647
+ };
648
+
649
+ $$enumerator$$Enumerator.prototype._makeResult = function(state, i, value) {
650
+ return value;
651
+ };
652
+
653
+ $$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) {
654
+ var enumerator = this;
655
+
656
+ $$$internal$$subscribe(promise, undefined, function(value) {
657
+ enumerator._settledAt($$$internal$$FULFILLED, i, value);
658
+ }, function(reason) {
659
+ enumerator._settledAt($$$internal$$REJECTED, i, reason);
660
+ });
661
+ };
662
+ function $$promise$all$$all(entries, label) {
663
+ return new $$enumerator$$default(this, entries, true /* abort on reject */, label).promise;
664
+ }
665
+ var $$promise$all$$default = $$promise$all$$all;
666
+ function $$promise$race$$race(entries, label) {
667
+ /*jshint validthis:true */
668
+ var Constructor = this;
669
+
670
+ var promise = new Constructor($$$internal$$noop, label);
671
+
672
+ if (!$$utils$$isArray(entries)) {
673
+ $$$internal$$reject(promise, new TypeError('You must pass an array to race.'));
674
+ return promise;
675
+ }
676
+
677
+ var length = entries.length;
678
+
679
+ function onFulfillment(value) {
680
+ $$$internal$$resolve(promise, value);
681
+ }
682
+
683
+ function onRejection(reason) {
684
+ $$$internal$$reject(promise, reason);
685
+ }
686
+
687
+ for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
688
+ $$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection);
689
+ }
690
+
691
+ return promise;
692
+ }
693
+ var $$promise$race$$default = $$promise$race$$race;
694
+ function $$promise$resolve$$resolve(object, label) {
695
+ /*jshint validthis:true */
696
+ var Constructor = this;
697
+
698
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
699
+ return object;
700
+ }
701
+
702
+ var promise = new Constructor($$$internal$$noop, label);
703
+ $$$internal$$resolve(promise, object);
704
+ return promise;
705
+ }
706
+ var $$promise$resolve$$default = $$promise$resolve$$resolve;
707
+ function $$promise$reject$$reject(reason, label) {
708
+ /*jshint validthis:true */
709
+ var Constructor = this;
710
+ var promise = new Constructor($$$internal$$noop, label);
711
+ $$$internal$$reject(promise, reason);
712
+ return promise;
713
+ }
714
+ var $$promise$reject$$default = $$promise$reject$$reject;
715
+
716
+ var $$rsvp$promise$$guidKey = 'rsvp_' + $$utils$$now() + '-';
717
+ var $$rsvp$promise$$counter = 0;
718
+
719
+ function $$rsvp$promise$$needsResolver() {
720
+ throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
721
+ }
722
+
723
+ function $$rsvp$promise$$needsNew() {
724
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
725
+ }
726
+
727
+ function $$rsvp$promise$$Promise(resolver, label) {
728
+ this._id = $$rsvp$promise$$counter++;
729
+ this._label = label;
730
+ this._state = undefined;
731
+ this._result = undefined;
732
+ this._subscribers = [];
733
+
734
+ if ($$rsvp$config$$config.instrument) {
735
+ $$instrument$$default('created', this);
736
+ }
737
+
738
+ if ($$$internal$$noop !== resolver) {
739
+ if (!$$utils$$isFunction(resolver)) {
740
+ $$rsvp$promise$$needsResolver();
741
+ }
742
+
743
+ if (!(this instanceof $$rsvp$promise$$Promise)) {
744
+ $$rsvp$promise$$needsNew();
745
+ }
746
+
747
+ $$$internal$$initializePromise(this, resolver);
748
+ }
749
+ }
750
+
751
+ var $$rsvp$promise$$default = $$rsvp$promise$$Promise;
752
+
753
+ // deprecated
754
+ $$rsvp$promise$$Promise.cast = $$promise$resolve$$default;
755
+ $$rsvp$promise$$Promise.all = $$promise$all$$default;
756
+ $$rsvp$promise$$Promise.race = $$promise$race$$default;
757
+ $$rsvp$promise$$Promise.resolve = $$promise$resolve$$default;
758
+ $$rsvp$promise$$Promise.reject = $$promise$reject$$default;
759
+
760
+ $$rsvp$promise$$Promise.prototype = {
761
+ constructor: $$rsvp$promise$$Promise,
762
+
763
+ _guidKey: $$rsvp$promise$$guidKey,
764
+
765
+ _onError: function (reason) {
766
+ $$rsvp$config$$config.async(function(promise) {
767
+ setTimeout(function() {
768
+ if (promise._onError) {
769
+ $$rsvp$config$$config['trigger']('error', reason);
770
+ }
771
+ }, 0);
772
+ }, this);
773
+ },
774
+
775
+ /**
776
+ The primary way of interacting with a promise is through its `then` method,
777
+ which registers callbacks to receive either a promise's eventual value or the
778
+ reason why the promise cannot be fulfilled.
779
+
780
+ ```js
781
+ findUser().then(function(user){
782
+ // user is available
783
+ }, function(reason){
784
+ // user is unavailable, and you are given the reason why
785
+ });
786
+ ```
787
+
788
+ Chaining
789
+ --------
790
+
791
+ The return value of `then` is itself a promise. This second, 'downstream'
792
+ promise is resolved with the return value of the first promise's fulfillment
793
+ or rejection handler, or rejected if the handler throws an exception.
794
+
795
+ ```js
796
+ findUser().then(function (user) {
797
+ return user.name;
798
+ }, function (reason) {
799
+ return 'default name';
800
+ }).then(function (userName) {
801
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
802
+ // will be `'default name'`
803
+ });
804
+
805
+ findUser().then(function (user) {
806
+ throw new Error('Found user, but still unhappy');
807
+ }, function (reason) {
808
+ throw new Error('`findUser` rejected and we're unhappy');
809
+ }).then(function (value) {
810
+ // never reached
811
+ }, function (reason) {
812
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
813
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
814
+ });
815
+ ```
816
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
817
+
818
+ ```js
819
+ findUser().then(function (user) {
820
+ throw new PedagogicalException('Upstream error');
821
+ }).then(function (value) {
822
+ // never reached
823
+ }).then(function (value) {
824
+ // never reached
825
+ }, function (reason) {
826
+ // The `PedgagocialException` is propagated all the way down to here
827
+ });
828
+ ```
829
+
830
+ Assimilation
831
+ ------------
832
+
833
+ Sometimes the value you want to propagate to a downstream promise can only be
834
+ retrieved asynchronously. This can be achieved by returning a promise in the
835
+ fulfillment or rejection handler. The downstream promise will then be pending
836
+ until the returned promise is settled. This is called *assimilation*.
837
+
838
+ ```js
839
+ findUser().then(function (user) {
840
+ return findCommentsByAuthor(user);
841
+ }).then(function (comments) {
842
+ // The user's comments are now available
843
+ });
844
+ ```
845
+
846
+ If the assimliated promise rejects, then the downstream promise will also reject.
847
+
848
+ ```js
849
+ findUser().then(function (user) {
850
+ return findCommentsByAuthor(user);
851
+ }).then(function (comments) {
852
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
853
+ }, function (reason) {
854
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
855
+ });
856
+ ```
857
+
858
+ Simple Example
859
+ --------------
860
+
861
+ Synchronous Example
862
+
863
+ ```javascript
864
+ var result;
865
+
866
+ try {
867
+ result = findResult();
868
+ // success
869
+ } catch(reason) {
870
+ // failure
871
+ }
872
+ ```
873
+
874
+ Errback Example
875
+
876
+ ```js
877
+ findResult(function(result, err){
878
+ if (err) {
879
+ // failure
880
+ } else {
881
+ // success
882
+ }
883
+ });
884
+ ```
885
+
886
+ Promise Example;
887
+
888
+ ```javascript
889
+ findResult().then(function(result){
890
+ // success
891
+ }, function(reason){
892
+ // failure
893
+ });
894
+ ```
895
+
896
+ Advanced Example
897
+ --------------
898
+
899
+ Synchronous Example
900
+
901
+ ```javascript
902
+ var author, books;
903
+
904
+ try {
905
+ author = findAuthor();
906
+ books = findBooksByAuthor(author);
907
+ // success
908
+ } catch(reason) {
909
+ // failure
910
+ }
911
+ ```
912
+
913
+ Errback Example
914
+
915
+ ```js
916
+
917
+ function foundBooks(books) {
918
+
919
+ }
920
+
921
+ function failure(reason) {
922
+
923
+ }
924
+
925
+ findAuthor(function(author, err){
926
+ if (err) {
927
+ failure(err);
928
+ // failure
929
+ } else {
930
+ try {
931
+ findBoooksByAuthor(author, function(books, err) {
932
+ if (err) {
933
+ failure(err);
934
+ } else {
935
+ try {
936
+ foundBooks(books);
937
+ } catch(reason) {
938
+ failure(reason);
939
+ }
940
+ }
941
+ });
942
+ } catch(error) {
943
+ failure(err);
944
+ }
945
+ // success
946
+ }
947
+ });
948
+ ```
949
+
950
+ Promise Example;
951
+
952
+ ```javascript
953
+ findAuthor().
954
+ then(findBooksByAuthor).
955
+ then(function(books){
956
+ // found books
957
+ }).catch(function(reason){
958
+ // something went wrong
959
+ });
960
+ ```
961
+
962
+ @method then
963
+ @param {Function} onFulfilled
964
+ @param {Function} onRejected
965
+ @param {String} label optional string for labeling the promise.
966
+ Useful for tooling.
967
+ @return {Promise}
968
+ */
969
+ then: function(onFulfillment, onRejection, label) {
970
+ var parent = this;
971
+ var state = parent._state;
972
+
973
+ if (state === $$$internal$$FULFILLED && !onFulfillment || state === $$$internal$$REJECTED && !onRejection) {
974
+ if ($$rsvp$config$$config.instrument) {
975
+ $$instrument$$default('chained', this, this);
976
+ }
977
+ return this;
978
+ }
979
+
980
+ parent._onError = null;
981
+
982
+ var child = new this.constructor($$$internal$$noop, label);
983
+ var result = parent._result;
984
+
985
+ if ($$rsvp$config$$config.instrument) {
986
+ $$instrument$$default('chained', parent, child);
987
+ }
988
+
989
+ if (state) {
990
+ var callback = arguments[state - 1];
991
+ $$rsvp$config$$config.async(function(){
992
+ $$$internal$$invokeCallback(state, child, callback, result);
993
+ });
994
+ } else {
995
+ $$$internal$$subscribe(parent, child, onFulfillment, onRejection);
996
+ }
997
+
998
+ return child;
999
+ },
1000
+
1001
+ /**
1002
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
1003
+ as the catch block of a try/catch statement.
1004
+
1005
+ ```js
1006
+ function findAuthor(){
1007
+ throw new Error('couldn't find that author');
1008
+ }
1009
+
1010
+ // synchronous
1011
+ try {
1012
+ findAuthor();
1013
+ } catch(reason) {
1014
+ // something went wrong
1015
+ }
1016
+
1017
+ // async with promises
1018
+ findAuthor().catch(function(reason){
1019
+ // something went wrong
1020
+ });
1021
+ ```
1022
+
1023
+ @method catch
1024
+ @param {Function} onRejection
1025
+ @param {String} label optional string for labeling the promise.
1026
+ Useful for tooling.
1027
+ @return {Promise}
1028
+ */
1029
+ 'catch': function(onRejection, label) {
1030
+ return this.then(null, onRejection, label);
1031
+ },
1032
+
1033
+ /**
1034
+ `finally` will be invoked regardless of the promise's fate just as native
1035
+ try/catch/finally behaves
1036
+
1037
+ Synchronous example:
1038
+
1039
+ ```js
1040
+ findAuthor() {
1041
+ if (Math.random() > 0.5) {
1042
+ throw new Error();
1043
+ }
1044
+ return new Author();
1045
+ }
1046
+
1047
+ try {
1048
+ return findAuthor(); // succeed or fail
1049
+ } catch(error) {
1050
+ return findOtherAuther();
1051
+ } finally {
1052
+ // always runs
1053
+ // doesn't affect the return value
1054
+ }
1055
+ ```
1056
+
1057
+ Asynchronous example:
1058
+
1059
+ ```js
1060
+ findAuthor().catch(function(reason){
1061
+ return findOtherAuther();
1062
+ }).finally(function(){
1063
+ // author was either found, or not
1064
+ });
1065
+ ```
1066
+
1067
+ @method finally
1068
+ @param {Function} callback
1069
+ @param {String} label optional string for labeling the promise.
1070
+ Useful for tooling.
1071
+ @return {Promise}
1072
+ */
1073
+ 'finally': function(callback, label) {
1074
+ var constructor = this.constructor;
1075
+
1076
+ return this.then(function(value) {
1077
+ return constructor.resolve(callback()).then(function(){
1078
+ return value;
1079
+ });
1080
+ }, function(reason) {
1081
+ return constructor.resolve(callback()).then(function(){
1082
+ throw reason;
1083
+ });
1084
+ }, label);
1085
+ }
1086
+ };
1087
+
1088
+ function $$rsvp$node$$Result() {
1089
+ this.value = undefined;
1090
+ }
1091
+
1092
+ var $$rsvp$node$$ERROR = new $$rsvp$node$$Result();
1093
+ var $$rsvp$node$$GET_THEN_ERROR = new $$rsvp$node$$Result();
1094
+
1095
+ function $$rsvp$node$$getThen(obj) {
1096
+ try {
1097
+ return obj.then;
1098
+ } catch(error) {
1099
+ $$rsvp$node$$ERROR.value= error;
1100
+ return $$rsvp$node$$ERROR;
1101
+ }
1102
+ }
1103
+
1104
+
1105
+ function $$rsvp$node$$tryApply(f, s, a) {
1106
+ try {
1107
+ f.apply(s, a);
1108
+ } catch(error) {
1109
+ $$rsvp$node$$ERROR.value = error;
1110
+ return $$rsvp$node$$ERROR;
1111
+ }
1112
+ }
1113
+
1114
+ function $$rsvp$node$$makeObject(_, argumentNames) {
1115
+ var obj = {};
1116
+ var name;
1117
+ var i;
1118
+ var length = _.length;
1119
+ var args = new Array(length);
1120
+
1121
+ for (var x = 0; x < length; x++) {
1122
+ args[x] = _[x];
1123
+ }
1124
+
1125
+ for (i = 0; i < argumentNames.length; i++) {
1126
+ name = argumentNames[i];
1127
+ obj[name] = args[i + 1];
1128
+ }
1129
+
1130
+ return obj;
1131
+ }
1132
+
1133
+ function $$rsvp$node$$arrayResult(_) {
1134
+ var length = _.length;
1135
+ var args = new Array(length - 1);
1136
+
1137
+ for (var i = 1; i < length; i++) {
1138
+ args[i - 1] = _[i];
1139
+ }
1140
+
1141
+ return args;
1142
+ }
1143
+
1144
+ function $$rsvp$node$$wrapThenable(then, promise) {
1145
+ return {
1146
+ then: function(onFulFillment, onRejection) {
1147
+ return then.call(promise, onFulFillment, onRejection);
1148
+ }
1149
+ };
1150
+ }
1151
+
1152
+ function $$rsvp$node$$denodeify(nodeFunc, options) {
1153
+ var fn = function() {
1154
+ var self = this;
1155
+ var l = arguments.length;
1156
+ var args = new Array(l + 1);
1157
+ var arg;
1158
+ var promiseInput = false;
1159
+
1160
+ for (var i = 0; i < l; ++i) {
1161
+ arg = arguments[i];
1162
+
1163
+ if (!promiseInput) {
1164
+ // TODO: clean this up
1165
+ promiseInput = $$rsvp$node$$needsPromiseInput(arg);
1166
+ if (promiseInput === $$rsvp$node$$GET_THEN_ERROR) {
1167
+ var p = new $$rsvp$promise$$default($$$internal$$noop);
1168
+ $$$internal$$reject(p, $$rsvp$node$$GET_THEN_ERROR.value);
1169
+ return p;
1170
+ } else if (promiseInput && promiseInput !== true) {
1171
+ arg = $$rsvp$node$$wrapThenable(promiseInput, arg);
1172
+ }
1173
+ }
1174
+ args[i] = arg;
1175
+ }
1176
+
1177
+ var promise = new $$rsvp$promise$$default($$$internal$$noop);
1178
+
1179
+ args[l] = function(err, val) {
1180
+ if (err)
1181
+ $$$internal$$reject(promise, err);
1182
+ else if (options === undefined)
1183
+ $$$internal$$resolve(promise, val);
1184
+ else if (options === true)
1185
+ $$$internal$$resolve(promise, $$rsvp$node$$arrayResult(arguments));
1186
+ else if ($$utils$$isArray(options))
1187
+ $$$internal$$resolve(promise, $$rsvp$node$$makeObject(arguments, options));
1188
+ else
1189
+ $$$internal$$resolve(promise, val);
1190
+ };
1191
+
1192
+ if (promiseInput) {
1193
+ return $$rsvp$node$$handlePromiseInput(promise, args, nodeFunc, self);
1194
+ } else {
1195
+ return $$rsvp$node$$handleValueInput(promise, args, nodeFunc, self);
1196
+ }
1197
+ };
1198
+
1199
+ fn.__proto__ = nodeFunc;
1200
+
1201
+ return fn;
1202
+ }
1203
+
1204
+ var $$rsvp$node$$default = $$rsvp$node$$denodeify;
1205
+
1206
+ function $$rsvp$node$$handleValueInput(promise, args, nodeFunc, self) {
1207
+ var result = $$rsvp$node$$tryApply(nodeFunc, self, args);
1208
+ if (result === $$rsvp$node$$ERROR) {
1209
+ $$$internal$$reject(promise, result.value);
1210
+ }
1211
+ return promise;
1212
+ }
1213
+
1214
+ function $$rsvp$node$$handlePromiseInput(promise, args, nodeFunc, self){
1215
+ return $$rsvp$promise$$default.all(args).then(function(args){
1216
+ var result = $$rsvp$node$$tryApply(nodeFunc, self, args);
1217
+ if (result === $$rsvp$node$$ERROR) {
1218
+ $$$internal$$reject(promise, result.value);
1219
+ }
1220
+ return promise;
1221
+ });
1222
+ }
1223
+
1224
+ function $$rsvp$node$$needsPromiseInput(arg) {
1225
+ if (arg && typeof arg === 'object') {
1226
+ if (arg.constructor === $$rsvp$promise$$default) {
1227
+ return true;
1228
+ } else {
1229
+ return $$rsvp$node$$getThen(arg);
1230
+ }
1231
+ } else {
1232
+ return false;
1233
+ }
1234
+ }
1235
+ function $$rsvp$all$$all(array, label) {
1236
+ return $$rsvp$promise$$default.all(array, label);
1237
+ }
1238
+ var $$rsvp$all$$default = $$rsvp$all$$all;
1239
+
1240
+ function $$rsvp$all$settled$$AllSettled(Constructor, entries, label) {
1241
+ this._superConstructor(Constructor, entries, false /* don't abort on reject */, label);
1242
+ }
1243
+
1244
+ $$rsvp$all$settled$$AllSettled.prototype = $$utils$$o_create($$enumerator$$default.prototype);
1245
+ $$rsvp$all$settled$$AllSettled.prototype._superConstructor = $$enumerator$$default;
1246
+ $$rsvp$all$settled$$AllSettled.prototype._makeResult = $$enumerator$$makeSettledResult;
1247
+ $$rsvp$all$settled$$AllSettled.prototype._validationError = function() {
1248
+ return new Error('allSettled must be called with an array');
1249
+ };
1250
+
1251
+ function $$rsvp$all$settled$$allSettled(entries, label) {
1252
+ return new $$rsvp$all$settled$$AllSettled($$rsvp$promise$$default, entries, label).promise;
1253
+ }
1254
+ var $$rsvp$all$settled$$default = $$rsvp$all$settled$$allSettled;
1255
+ function $$rsvp$race$$race(array, label) {
1256
+ return $$rsvp$promise$$default.race(array, label);
1257
+ }
1258
+ var $$rsvp$race$$default = $$rsvp$race$$race;
1259
+ function $$promise$hash$$PromiseHash(Constructor, object, label) {
1260
+ this._superConstructor(Constructor, object, true, label);
1261
+ }
1262
+
1263
+ var $$promise$hash$$default = $$promise$hash$$PromiseHash;
1264
+
1265
+ $$promise$hash$$PromiseHash.prototype = $$utils$$o_create($$enumerator$$default.prototype);
1266
+ $$promise$hash$$PromiseHash.prototype._superConstructor = $$enumerator$$default;
1267
+ $$promise$hash$$PromiseHash.prototype._init = function() {
1268
+ this._result = {};
1269
+ };
1270
+
1271
+ $$promise$hash$$PromiseHash.prototype._validateInput = function(input) {
1272
+ return input && typeof input === 'object';
1273
+ };
1274
+
1275
+ $$promise$hash$$PromiseHash.prototype._validationError = function() {
1276
+ return new Error('Promise.hash must be called with an object');
1277
+ };
1278
+
1279
+ $$promise$hash$$PromiseHash.prototype._enumerate = function() {
1280
+ var promise = this.promise;
1281
+ var input = this._input;
1282
+ var results = [];
1283
+
1284
+ for (var key in input) {
1285
+ if (promise._state === $$$internal$$PENDING && input.hasOwnProperty(key)) {
1286
+ results.push({
1287
+ position: key,
1288
+ entry: input[key]
1289
+ });
1290
+ }
1291
+ }
1292
+
1293
+ var length = results.length;
1294
+ this._remaining = length;
1295
+ var result;
1296
+
1297
+ for (var i = 0; promise._state === $$$internal$$PENDING && i < length; i++) {
1298
+ result = results[i];
1299
+ this._eachEntry(result.entry, result.position);
1300
+ }
1301
+ };
1302
+ function $$rsvp$hash$$hash(object, label) {
1303
+ return new $$promise$hash$$default($$rsvp$promise$$default, object, label).promise;
1304
+ }
1305
+ var $$rsvp$hash$$default = $$rsvp$hash$$hash;
1306
+
1307
+ function $$rsvp$hash$settled$$HashSettled(Constructor, object, label) {
1308
+ this._superConstructor(Constructor, object, false, label);
1309
+ }
1310
+
1311
+ $$rsvp$hash$settled$$HashSettled.prototype = $$utils$$o_create($$promise$hash$$default.prototype);
1312
+ $$rsvp$hash$settled$$HashSettled.prototype._superConstructor = $$enumerator$$default;
1313
+ $$rsvp$hash$settled$$HashSettled.prototype._makeResult = $$enumerator$$makeSettledResult;
1314
+
1315
+ $$rsvp$hash$settled$$HashSettled.prototype._validationError = function() {
1316
+ return new Error('hashSettled must be called with an object');
1317
+ };
1318
+
1319
+ function $$rsvp$hash$settled$$hashSettled(object, label) {
1320
+ return new $$rsvp$hash$settled$$HashSettled($$rsvp$promise$$default, object, label).promise;
1321
+ }
1322
+ var $$rsvp$hash$settled$$default = $$rsvp$hash$settled$$hashSettled;
1323
+ function $$rsvp$rethrow$$rethrow(reason) {
1324
+ setTimeout(function() {
1325
+ throw reason;
1326
+ });
1327
+ throw reason;
1328
+ }
1329
+ var $$rsvp$rethrow$$default = $$rsvp$rethrow$$rethrow;
1330
+ function $$rsvp$defer$$defer(label) {
1331
+ var deferred = { };
1332
+
1333
+ deferred['promise'] = new $$rsvp$promise$$default(function(resolve, reject) {
1334
+ deferred['resolve'] = resolve;
1335
+ deferred['reject'] = reject;
1336
+ }, label);
1337
+
1338
+ return deferred;
1339
+ }
1340
+ var $$rsvp$defer$$default = $$rsvp$defer$$defer;
1341
+ function $$rsvp$map$$map(promises, mapFn, label) {
1342
+ return $$rsvp$promise$$default.all(promises, label).then(function(values) {
1343
+ if (!$$utils$$isFunction(mapFn)) {
1344
+ throw new TypeError("You must pass a function as map's second argument.");
1345
+ }
1346
+
1347
+ var length = values.length;
1348
+ var results = new Array(length);
1349
+
1350
+ for (var i = 0; i < length; i++) {
1351
+ results[i] = mapFn(values[i]);
1352
+ }
1353
+
1354
+ return $$rsvp$promise$$default.all(results, label);
1355
+ });
1356
+ }
1357
+ var $$rsvp$map$$default = $$rsvp$map$$map;
1358
+ function $$rsvp$resolve$$resolve(value, label) {
1359
+ return $$rsvp$promise$$default.resolve(value, label);
1360
+ }
1361
+ var $$rsvp$resolve$$default = $$rsvp$resolve$$resolve;
1362
+ function $$rsvp$reject$$reject(reason, label) {
1363
+ return $$rsvp$promise$$default.reject(reason, label);
1364
+ }
1365
+ var $$rsvp$reject$$default = $$rsvp$reject$$reject;
1366
+ function $$rsvp$filter$$filter(promises, filterFn, label) {
1367
+ return $$rsvp$promise$$default.all(promises, label).then(function(values) {
1368
+ if (!$$utils$$isFunction(filterFn)) {
1369
+ throw new TypeError("You must pass a function as filter's second argument.");
1370
+ }
1371
+
1372
+ var length = values.length;
1373
+ var filtered = new Array(length);
1374
+
1375
+ for (var i = 0; i < length; i++) {
1376
+ filtered[i] = filterFn(values[i]);
1377
+ }
1378
+
1379
+ return $$rsvp$promise$$default.all(filtered, label).then(function(filtered) {
1380
+ var results = new Array(length);
1381
+ var newLength = 0;
1382
+
1383
+ for (var i = 0; i < length; i++) {
1384
+ if (filtered[i]) {
1385
+ results[newLength] = values[i];
1386
+ newLength++;
1387
+ }
1388
+ }
1389
+
1390
+ results.length = newLength;
1391
+
1392
+ return results;
1393
+ });
1394
+ });
1395
+ }
1396
+ var $$rsvp$filter$$default = $$rsvp$filter$$filter;
1397
+ var $$rsvp$asap$$len = 0;
1398
+
1399
+ function $$rsvp$asap$$asap(callback, arg) {
1400
+ $$rsvp$asap$$queue[$$rsvp$asap$$len] = callback;
1401
+ $$rsvp$asap$$queue[$$rsvp$asap$$len + 1] = arg;
1402
+ $$rsvp$asap$$len += 2;
1403
+ if ($$rsvp$asap$$len === 2) {
1404
+ // If len is 1, that means that we need to schedule an async flush.
1405
+ // If additional callbacks are queued before the queue is flushed, they
1406
+ // will be processed by this flush that we are scheduling.
1407
+ $$rsvp$asap$$scheduleFlush();
1408
+ }
1409
+ }
1410
+
1411
+ var $$rsvp$asap$$default = $$rsvp$asap$$asap;
1412
+
1413
+ var $$rsvp$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined;
1414
+ var $$rsvp$asap$$browserGlobal = $$rsvp$asap$$browserWindow || {};
1415
+ var $$rsvp$asap$$BrowserMutationObserver = $$rsvp$asap$$browserGlobal.MutationObserver || $$rsvp$asap$$browserGlobal.WebKitMutationObserver;
1416
+ var $$rsvp$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
1417
+
1418
+ // test for web worker but not in IE10
1419
+ var $$rsvp$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' &&
1420
+ typeof importScripts !== 'undefined' &&
1421
+ typeof MessageChannel !== 'undefined';
1422
+
1423
+ // node
1424
+ function $$rsvp$asap$$useNextTick() {
1425
+ var nextTick = process.nextTick;
1426
+ // node version 0.10.x displays a deprecation warning when nextTick is used recursively
1427
+ // setImmediate should be used instead instead
1428
+ var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);
1429
+ if (Array.isArray(version) && version[1] === '0' && version[2] === '10') {
1430
+ nextTick = setImmediate;
1431
+ }
1432
+ return function() {
1433
+ nextTick($$rsvp$asap$$flush);
1434
+ };
1435
+ }
1436
+
1437
+ // vertx
1438
+ function $$rsvp$asap$$useVertxTimer() {
1439
+ return function() {
1440
+ vertxNext($$rsvp$asap$$flush);
1441
+ };
1442
+ }
1443
+
1444
+ function $$rsvp$asap$$useMutationObserver() {
1445
+ var iterations = 0;
1446
+ var observer = new $$rsvp$asap$$BrowserMutationObserver($$rsvp$asap$$flush);
1447
+ var node = document.createTextNode('');
1448
+ observer.observe(node, { characterData: true });
1449
+
1450
+ return function() {
1451
+ node.data = (iterations = ++iterations % 2);
1452
+ };
1453
+ }
1454
+
1455
+ // web worker
1456
+ function $$rsvp$asap$$useMessageChannel() {
1457
+ var channel = new MessageChannel();
1458
+ channel.port1.onmessage = $$rsvp$asap$$flush;
1459
+ return function () {
1460
+ channel.port2.postMessage(0);
1461
+ };
1462
+ }
1463
+
1464
+ function $$rsvp$asap$$useSetTimeout() {
1465
+ return function() {
1466
+ setTimeout($$rsvp$asap$$flush, 1);
1467
+ };
1468
+ }
1469
+
1470
+ var $$rsvp$asap$$queue = new Array(1000);
1471
+ function $$rsvp$asap$$flush() {
1472
+ for (var i = 0; i < $$rsvp$asap$$len; i+=2) {
1473
+ var callback = $$rsvp$asap$$queue[i];
1474
+ var arg = $$rsvp$asap$$queue[i+1];
1475
+
1476
+ callback(arg);
1477
+
1478
+ $$rsvp$asap$$queue[i] = undefined;
1479
+ $$rsvp$asap$$queue[i+1] = undefined;
1480
+ }
1481
+
1482
+ $$rsvp$asap$$len = 0;
1483
+ }
1484
+
1485
+ function $$rsvp$asap$$attemptVertex() {
1486
+ try {
1487
+ var vertx = require('vertx');
1488
+ var vertxNext = vertx.runOnLoop || vertx.runOnContext;
1489
+ return $$rsvp$asap$$useVertxTimer();
1490
+ } catch(e) {
1491
+ return $$rsvp$asap$$useSetTimeout();
1492
+ }
1493
+ }
1494
+
1495
+ var $$rsvp$asap$$scheduleFlush;
1496
+ // Decide what async method to use to triggering processing of queued callbacks:
1497
+ if ($$rsvp$asap$$isNode) {
1498
+ $$rsvp$asap$$scheduleFlush = $$rsvp$asap$$useNextTick();
1499
+ } else if ($$rsvp$asap$$BrowserMutationObserver) {
1500
+ $$rsvp$asap$$scheduleFlush = $$rsvp$asap$$useMutationObserver();
1501
+ } else if ($$rsvp$asap$$isWorker) {
1502
+ $$rsvp$asap$$scheduleFlush = $$rsvp$asap$$useMessageChannel();
1503
+ } else if ($$rsvp$asap$$browserWindow === undefined && typeof require === 'function') {
1504
+ $$rsvp$asap$$scheduleFlush = $$rsvp$asap$$attemptVertex();
1505
+ } else {
1506
+ $$rsvp$asap$$scheduleFlush = $$rsvp$asap$$useSetTimeout();
1507
+ }
1508
+
1509
+ // default async is asap;
1510
+ $$rsvp$config$$config.async = $$rsvp$asap$$default;
1511
+ var $$rsvp$$cast = $$rsvp$resolve$$default;
1512
+ function $$rsvp$$async(callback, arg) {
1513
+ $$rsvp$config$$config.async(callback, arg);
1514
+ }
1515
+
1516
+ function $$rsvp$$on() {
1517
+ $$rsvp$config$$config['on'].apply($$rsvp$config$$config, arguments);
1518
+ }
1519
+
1520
+ function $$rsvp$$off() {
1521
+ $$rsvp$config$$config['off'].apply($$rsvp$config$$config, arguments);
1522
+ }
1523
+
1524
+ // Set up instrumentation through `window.__PROMISE_INTRUMENTATION__`
1525
+ if (typeof window !== 'undefined' && typeof window['__PROMISE_INSTRUMENTATION__'] === 'object') {
1526
+ var $$rsvp$$callbacks = window['__PROMISE_INSTRUMENTATION__'];
1527
+ $$rsvp$config$$configure('instrument', true);
1528
+ for (var $$rsvp$$eventName in $$rsvp$$callbacks) {
1529
+ if ($$rsvp$$callbacks.hasOwnProperty($$rsvp$$eventName)) {
1530
+ $$rsvp$$on($$rsvp$$eventName, $$rsvp$$callbacks[$$rsvp$$eventName]);
1531
+ }
1532
+ }
1533
+ }
1534
+
1535
+ var rsvp$umd$$RSVP = {
1536
+ 'race': $$rsvp$race$$default,
1537
+ 'Promise': $$rsvp$promise$$default,
1538
+ 'allSettled': $$rsvp$all$settled$$default,
1539
+ 'hash': $$rsvp$hash$$default,
1540
+ 'hashSettled': $$rsvp$hash$settled$$default,
1541
+ 'denodeify': $$rsvp$node$$default,
1542
+ 'on': $$rsvp$$on,
1543
+ 'off': $$rsvp$$off,
1544
+ 'map': $$rsvp$map$$default,
1545
+ 'filter': $$rsvp$filter$$default,
1546
+ 'resolve': $$rsvp$resolve$$default,
1547
+ 'reject': $$rsvp$reject$$default,
1548
+ 'all': $$rsvp$all$$default,
1549
+ 'rethrow': $$rsvp$rethrow$$default,
1550
+ 'defer': $$rsvp$defer$$default,
1551
+ 'EventTarget': $$rsvp$events$$default,
1552
+ 'configure': $$rsvp$config$$configure,
1553
+ 'async': $$rsvp$$async
1554
+ };
1555
+
1556
+ /* global define:true module:true window: true */
1557
+ if (typeof define === 'function' && define['amd']) {
1558
+ define(function() { return rsvp$umd$$RSVP; });
1559
+ } else if (typeof module !== 'undefined' && module['exports']) {
1560
+ module['exports'] = rsvp$umd$$RSVP;
1561
+ } else if (typeof this !== 'undefined') {
1562
+ this['RSVP'] = rsvp$umd$$RSVP;
1563
+ }
1564
+ }).call(this);
1565
+
1566
+ //# sourceMappingURL=rsvp.js.map