traceur-rb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +8 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +87 -0
  10. data/Rakefile +2 -0
  11. data/lib/js/compile.js +31 -0
  12. data/lib/traceur-rb.rb +1 -0
  13. data/lib/traceur.rb +43 -0
  14. data/lib/traceur/compilation_options.rb +65 -0
  15. data/lib/traceur/compiler.rb +33 -0
  16. data/lib/traceur/configuration.rb +47 -0
  17. data/lib/traceur/node.rb +26 -0
  18. data/lib/traceur/node/command_result.rb +28 -0
  19. data/lib/traceur/node/runner.rb +40 -0
  20. data/lib/traceur/version.rb +3 -0
  21. data/spec/examples/classes.js +12 -0
  22. data/spec/integration/examples_spec.rb +28 -0
  23. data/spec/spec_helper.rb +1 -0
  24. data/spec/traceur/compilation_options_spec.rb +31 -0
  25. data/spec/traceur/configuration_spec.rb +54 -0
  26. data/spec/traceur/node_spec.rb +15 -0
  27. data/traceur-rb.gemspec +25 -0
  28. data/vendor/node_modules/.bin/traceur +3 -0
  29. data/vendor/node_modules/traceur/README.md +40 -0
  30. data/vendor/node_modules/traceur/bin/traceur-runtime.js +2101 -0
  31. data/vendor/node_modules/traceur/bin/traceur.js +23034 -0
  32. data/vendor/node_modules/traceur/node_modules/.bin/semver +125 -0
  33. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +208 -0
  34. data/vendor/node_modules/traceur/node_modules/commander/index.js +852 -0
  35. data/vendor/node_modules/traceur/node_modules/commander/package.json +40 -0
  36. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +1 -0
  37. data/vendor/node_modules/traceur/node_modules/q-io/.travis.yml +3 -0
  38. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +122 -0
  39. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +19 -0
  40. data/vendor/node_modules/traceur/node_modules/q-io/README.md +928 -0
  41. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +59 -0
  42. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +44 -0
  43. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +51 -0
  44. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +307 -0
  45. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +499 -0
  46. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +547 -0
  47. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +105 -0
  48. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +355 -0
  49. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +65 -0
  50. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +152 -0
  51. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +24 -0
  52. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +93 -0
  53. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +154 -0
  54. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +178 -0
  55. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +417 -0
  56. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +58 -0
  57. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +78 -0
  58. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +120 -0
  59. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +27 -0
  60. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +209 -0
  61. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +125 -0
  62. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +175 -0
  63. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +75 -0
  64. data/vendor/node_modules/traceur/node_modules/q-io/http.js +378 -0
  65. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +11 -0
  66. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.travis.yml +4 -0
  67. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +78 -0
  68. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +21 -0
  69. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +1285 -0
  70. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +22 -0
  71. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +142 -0
  72. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +57 -0
  73. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +183 -0
  74. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +261 -0
  75. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +186 -0
  76. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +55 -0
  77. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +59 -0
  78. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +236 -0
  79. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +371 -0
  80. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +435 -0
  81. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +247 -0
  82. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +147 -0
  83. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +448 -0
  84. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +139 -0
  85. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +79 -0
  86. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +142 -0
  87. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +60 -0
  88. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +41 -0
  89. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +12 -0
  90. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +7 -0
  91. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +48 -0
  92. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +590 -0
  93. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +49 -0
  94. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +173 -0
  95. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +274 -0
  96. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +59 -0
  97. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +538 -0
  98. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +14 -0
  99. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +6 -0
  100. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +49 -0
  101. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +51 -0
  102. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +269 -0
  103. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +61 -0
  104. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +736 -0
  105. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +40 -0
  106. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +1 -0
  107. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/LICENSE +19 -0
  108. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +66 -0
  109. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +114 -0
  110. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +35 -0
  111. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +84 -0
  112. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +1588 -0
  113. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +77 -0
  114. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +15 -0
  115. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +19 -0
  116. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +96 -0
  117. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +166 -0
  118. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +43 -0
  119. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +40 -0
  120. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +19 -0
  121. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +813 -0
  122. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +71 -0
  123. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +36 -0
  124. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +93 -0
  125. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +1937 -0
  126. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +35 -0
  127. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +6 -0
  128. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +36 -0
  129. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +7 -0
  130. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +38 -0
  131. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +32 -0
  132. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +39 -0
  133. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +2 -0
  134. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +123 -0
  135. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +19 -0
  136. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +3 -0
  137. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +3 -0
  138. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +128 -0
  139. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +53 -0
  140. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +61 -0
  141. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +856 -0
  142. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +1080 -0
  143. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +377 -0
  144. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +290 -0
  145. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
  146. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
  147. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +4 -0
  148. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +16 -0
  149. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +12 -0
  150. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +91 -0
  151. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +12 -0
  152. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +13 -0
  153. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +14 -0
  154. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +146 -0
  155. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
  156. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
  157. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +3 -0
  158. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +22 -0
  159. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +6 -0
  160. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +248 -0
  161. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +53 -0
  162. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +2 -0
  163. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +91 -0
  164. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +548 -0
  165. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +8 -0
  166. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +358 -0
  167. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +133 -0
  168. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +3 -0
  169. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.travis.yml +4 -0
  170. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +20 -0
  171. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +33 -0
  172. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +37 -0
  173. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +125 -0
  174. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +151 -0
  175. data/vendor/node_modules/traceur/node_modules/q-io/package.json +51 -0
  176. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +133 -0
  177. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +47 -0
  178. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +11 -0
  179. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +1 -0
  180. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +33 -0
  181. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +92 -0
  182. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +41 -0
  183. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +57 -0
  184. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +1 -0
  185. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +70 -0
  186. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +109 -0
  187. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +67 -0
  188. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +219 -0
  189. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +20 -0
  190. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +26 -0
  191. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +40 -0
  192. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +37 -0
  193. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +39 -0
  194. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +32 -0
  195. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +26 -0
  196. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +86 -0
  197. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +31 -0
  198. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +73 -0
  199. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +23 -0
  200. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +1 -0
  201. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +22 -0
  202. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +25 -0
  203. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +45 -0
  204. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +38 -0
  205. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +52 -0
  206. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +86 -0
  207. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +1 -0
  208. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +1 -0
  209. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  210. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  211. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +49 -0
  212. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +47 -0
  213. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +186 -0
  214. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +82 -0
  215. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +110 -0
  216. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +96 -0
  217. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +96 -0
  218. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +42 -0
  219. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +111 -0
  220. data/vendor/node_modules/traceur/node_modules/semver/.npmignore +1 -0
  221. data/vendor/node_modules/traceur/node_modules/semver/LICENSE +27 -0
  222. data/vendor/node_modules/traceur/node_modules/semver/Makefile +24 -0
  223. data/vendor/node_modules/traceur/node_modules/semver/README.md +158 -0
  224. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +125 -0
  225. data/vendor/node_modules/traceur/node_modules/semver/foot.js +6 -0
  226. data/vendor/node_modules/traceur/node_modules/semver/head.js +2 -0
  227. data/vendor/node_modules/traceur/node_modules/semver/package.json +31 -0
  228. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +1039 -0
  229. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  230. data/vendor/node_modules/traceur/node_modules/semver/semver.js +1043 -0
  231. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -0
  232. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  233. data/vendor/node_modules/traceur/node_modules/semver/test/amd.js +15 -0
  234. data/vendor/node_modules/traceur/node_modules/semver/test/gtr.js +173 -0
  235. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +584 -0
  236. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +174 -0
  237. data/vendor/node_modules/traceur/node_modules/semver/test/no-module.js +19 -0
  238. data/vendor/node_modules/traceur/package.json +64 -0
  239. data/vendor/node_modules/traceur/src/node/System.js +31 -0
  240. data/vendor/node_modules/traceur/src/node/api.js +124 -0
  241. data/vendor/node_modules/traceur/src/node/command.js +141 -0
  242. data/vendor/node_modules/traceur/src/node/compile-single-file.js +69 -0
  243. data/vendor/node_modules/traceur/src/node/compiler.js +116 -0
  244. data/vendor/node_modules/traceur/src/node/deferred.js +110 -0
  245. data/vendor/node_modules/traceur/src/node/file-util.js +73 -0
  246. data/vendor/node_modules/traceur/src/node/getopt.js +147 -0
  247. data/vendor/node_modules/traceur/src/node/inline-module.js +149 -0
  248. data/vendor/node_modules/traceur/src/node/interpreter.js +33 -0
  249. data/vendor/node_modules/traceur/src/node/nodeLoader.js +41 -0
  250. data/vendor/node_modules/traceur/src/node/require.js +85 -0
  251. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +33 -0
  252. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +33 -0
  253. data/vendor/node_modules/traceur/src/node/traceur.js +32 -0
  254. data/vendor/node_modules/traceur/traceur +3 -0
  255. metadata +359 -0
@@ -0,0 +1,40 @@
1
+ require 'open3'
2
+
3
+ module Traceur
4
+ module Node
5
+ class Runner
6
+ def initialize(opts = {})
7
+ @binary = opts.fetch(:binary)
8
+ @modules_path = opts.fetch(:modules_path)
9
+ @env = opts.fetch(:env)
10
+ end
11
+
12
+ def run(opts = {})
13
+ input = opts.fetch(:input) { "" }
14
+ arguments = opts.fetch(:arguments) { [] }
15
+ on_error = opts.fetch(:on_error) { ->{} }
16
+
17
+ Open3.popen3(env, binary, *arguments) do |stdin, stdout, stderr, wait_thr|
18
+ stdin.print input
19
+ stdin.close
20
+
21
+ CommandResult.new(
22
+ stdout: stdout.read,
23
+ stderr: stderr.read,
24
+ status: wait_thr.value
25
+ ).on_error(&on_error)
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def env
32
+ @env.merge("NODE_PATH" => modules_path) do |_, old, new|
33
+ "#{old}:#{new}"
34
+ end
35
+ end
36
+
37
+ attr_reader :binary, :modules_path
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module Traceur
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,12 @@
1
+ export class Greeter {
2
+ constructor(greeting) {
3
+ this.greeting = greeting;
4
+ }
5
+
6
+ greet(name) {
7
+ console.log(`${this.greeting} ${name}!`);
8
+ }
9
+ }
10
+
11
+ var greeter = new Greeter("Hello");
12
+ greeter.greet("world");
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe "Integration tests" do
4
+ def eval_js(script)
5
+ runtime = File.read(Traceur.config.traceur_runtime_path)
6
+ Traceur::Node.eval(runtime + ";" + script)
7
+ end
8
+
9
+ def example_file_path(name)
10
+ File.expand_path("../../examples/#{name}", __FILE__)
11
+ end
12
+
13
+ def example_file(name)
14
+ File.read(example_file_path(name))
15
+ end
16
+
17
+ it "allows compiling strings" do
18
+ compiled = Traceur.compile(example_file('classes.js'))
19
+
20
+ expect(eval_js(compiled)).to eq("Hello world!\n")
21
+ end
22
+
23
+ it "allows compiling files" do
24
+ compiled = Traceur.compile_file(example_file_path('classes.js'))
25
+
26
+ expect(eval_js(compiled)).to eq("Hello world!\n")
27
+ end
28
+ end
@@ -0,0 +1 @@
1
+ require "traceur-rb"
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Traceur::CompilationOptions do
4
+ let(:options) { Traceur::CompilationOptions.new }
5
+
6
+ it "converts snake_case names camelCase" do
7
+ options.some_option_name = "foo"
8
+
9
+ expect(options.to_hash).to eq(someOptionName: "foo")
10
+ end
11
+
12
+ it "allows reading back set names" do
13
+ options.some_option_name = "foo"
14
+
15
+ expect(options.some_option_name).to eq("foo")
16
+ end
17
+
18
+ it "can be initialized with a hash" do
19
+ options = Traceur::CompilationOptions.new(foo: 1, module_name: 'bar')
20
+
21
+ expect(options.to_hash).to eq(foo: 1, moduleName: 'bar')
22
+ end
23
+
24
+ it "can be merged with a hash" do
25
+ options.merge!(foo: 2, bar: 3)
26
+ new_options = options.merge(foo: 1, module_name: 'bar')
27
+
28
+ expect(new_options.to_hash).to eq(foo: 1, bar: 3, moduleName: 'bar')
29
+ expect(options.to_hash).to eq(foo: 2, bar: 3)
30
+ end
31
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe Traceur::Configuration do
4
+ let(:config) { Traceur::Configuration.new }
5
+ let(:root_dir) { File.expand_path("../../..", __FILE__) }
6
+
7
+ it "allows configuring the node binary" do
8
+ config.node_binary = "nodejs"
9
+ expect(config.node_binary).to eq("nodejs")
10
+ end
11
+
12
+ it "allows configuring the node modules path" do
13
+ config.node_modules_path = "/var/lib/node_modules"
14
+ expect(config.node_modules_path).to eq("/var/lib/node_modules")
15
+ end
16
+
17
+ it "allows configuring the traceur runtime script path" do
18
+ config.traceur_runtime_path = "/var/lib/traceur-runtime.js"
19
+ expect(config.traceur_runtime_path).to eq("/var/lib/traceur-runtime.js")
20
+ end
21
+
22
+ it "allows configuring the compile script path" do
23
+ config.compile_script_path = "/my/compile.js"
24
+ expect(config.compile_script_path).to eq("/my/compile.js")
25
+ end
26
+
27
+ it "allows setting default compilation options" do
28
+ config.default_compilation_options.modules = "amd"
29
+
30
+ expect(config.default_compilation_options.modules).to eq("amd")
31
+ end
32
+
33
+ it "allows setting default compilation options in bulk" do
34
+ config.default_compilation_options = {experimental: true, source_map: false}
35
+
36
+ expect(config.default_compilation_options.to_hash).to eq({experimental: true, sourceMap: false})
37
+ end
38
+
39
+ it "defaults node binary to node" do
40
+ expect(config.node_binary).to eq("node")
41
+ end
42
+
43
+ it "defaults node_modules_path to vendor dir bundled with this gem" do
44
+ expect(config.node_modules_path.to_s).to eq(root_dir + "/vendor/node_modules")
45
+ end
46
+
47
+ it "defaults traceur_runtime_path to the bundled version" do
48
+ expect(config.traceur_runtime_path.to_s).to eq(root_dir + "/vendor/node_modules/traceur/bin/traceur-runtime.js")
49
+ end
50
+
51
+ it "defaults compile script path to local file" do
52
+ expect(config.compile_script_path.to_s).to eq(root_dir + "/lib/js/compile.js")
53
+ end
54
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Traceur::Node do
4
+ it "evaluates snippets of javascript in node and returns the standard out" do
5
+ out = Traceur::Node.eval('console.log("Hello world!");')
6
+
7
+ expect(out).to eq("Hello world!\n")
8
+ end
9
+
10
+ it "raises an error if evaluation fails" do
11
+ expect {
12
+ Traceur::Node.eval('undefined.hello();')
13
+ }.to raise_error(Traceur::NodeCommandError)
14
+ end
15
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'traceur/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "traceur-rb"
8
+ spec.version = Traceur::VERSION
9
+ spec.authors = ["Adam Pohorecki"]
10
+ spec.email = ["adam@pohorecki.pl"]
11
+ spec.summary = %q{Ruby wrapper for Google Traceur.}
12
+ spec.description = %q{Wraps Google Traceur, so that it can be invoked from any Ruby application.}
13
+ spec.homepage = "https://github.com/gunpowderlabs/traceur-rb"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "guard-rspec"
25
+ end
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ require('./src/node/command.js');
@@ -0,0 +1,40 @@
1
+ [![Build Status](https://travis-ci.org/google/traceur-compiler.png)](https://travis-ci.org/google/traceur-compiler)
2
+
3
+ <img src="https://raw.github.com/google/traceur-compiler/master/logo/tc.png" alt="Traceur logo" width="200px">
4
+ ## What is Traceur?
5
+
6
+ Traceur is a JavaScript.next-to-JavaScript-of-today compiler that allows you to
7
+ use features from the future **today**. Traceur's goal is to inform the design
8
+ of new JavaScript features which are only valuable if they allow you to write
9
+ better code. Traceur allows you to try out new and proposed
10
+ [language features](https://github.com/google/traceur-compiler/wiki/LanguageFeatures)
11
+ today, helping you say what you mean in your code while informing the standards process.
12
+
13
+ JavaScript's evolution needs your input.
14
+ [Try](https://github.com/google/traceur-compiler/wiki/GettingStarted) out the
15
+ new language features.
16
+ [Tell us](http://groups.google.com/group/traceur-compiler-discuss)
17
+ how they work for you and what's still causing you to use more boilerplate and
18
+ "design patterns" than you prefer.
19
+
20
+ ## What now? What can Traceur do for me?
21
+
22
+ Read the
23
+ [Getting Started](https://github.com/google/traceur-compiler/wiki/GettingStarted)
24
+ page to get up and running. You can use some language features right now and
25
+ even try it out in your browser
26
+ [here](http://google.github.io/traceur-compiler/demo/repl.html).
27
+ Just type in some code and see what Traceur produces. For an idea of what is
28
+ available and what we have in the pipeline, see the
29
+ [Language Features](https://github.com/google/traceur-compiler/wiki/LanguageFeatures)
30
+ page.
31
+
32
+ The JSConf 2011 presentation of Traceur describes the goals of the project and
33
+ what it can do today. Some documentation is on the wiki on this site.
34
+ Extra demos are in the source repository.
35
+
36
+ We also presented Traceur at NodeConf 2011. The video is
37
+ available on [YouTube](http://www.youtube.com/watch?feature=player_detailpage&v=ntDZa7ekFEA).
38
+
39
+ Questions, suggestions, and comments can be directed to the
40
+ [discussion group](http://groups.google.com/group/traceur-compiler-discuss).
@@ -0,0 +1,2101 @@
1
+ (function(global) {
2
+ 'use strict';
3
+ if (global.$traceurRuntime) {
4
+ return;
5
+ }
6
+ var $Object = Object;
7
+ var $TypeError = TypeError;
8
+ var $create = $Object.create;
9
+ var $defineProperties = $Object.defineProperties;
10
+ var $defineProperty = $Object.defineProperty;
11
+ var $freeze = $Object.freeze;
12
+ var $getOwnPropertyDescriptor = $Object.getOwnPropertyDescriptor;
13
+ var $getOwnPropertyNames = $Object.getOwnPropertyNames;
14
+ var $keys = $Object.keys;
15
+ var $hasOwnProperty = $Object.prototype.hasOwnProperty;
16
+ var $toString = $Object.prototype.toString;
17
+ var $preventExtensions = Object.preventExtensions;
18
+ var $seal = Object.seal;
19
+ var $isExtensible = Object.isExtensible;
20
+ function nonEnum(value) {
21
+ return {
22
+ configurable: true,
23
+ enumerable: false,
24
+ value: value,
25
+ writable: true
26
+ };
27
+ }
28
+ var types = {
29
+ void: function voidType() {},
30
+ any: function any() {},
31
+ string: function string() {},
32
+ number: function number() {},
33
+ boolean: function boolean() {}
34
+ };
35
+ var method = nonEnum;
36
+ var counter = 0;
37
+ function newUniqueString() {
38
+ return '__$' + Math.floor(Math.random() * 1e9) + '$' + ++counter + '$__';
39
+ }
40
+ var symbolInternalProperty = newUniqueString();
41
+ var symbolDescriptionProperty = newUniqueString();
42
+ var symbolDataProperty = newUniqueString();
43
+ var symbolValues = $create(null);
44
+ var privateNames = $create(null);
45
+ function createPrivateName() {
46
+ var s = newUniqueString();
47
+ privateNames[s] = true;
48
+ return s;
49
+ }
50
+ function isSymbol(symbol) {
51
+ return typeof symbol === 'object' && symbol instanceof SymbolValue;
52
+ }
53
+ function typeOf(v) {
54
+ if (isSymbol(v))
55
+ return 'symbol';
56
+ return typeof v;
57
+ }
58
+ function Symbol(description) {
59
+ var value = new SymbolValue(description);
60
+ if (!(this instanceof Symbol))
61
+ return value;
62
+ throw new TypeError('Symbol cannot be new\'ed');
63
+ }
64
+ $defineProperty(Symbol.prototype, 'constructor', nonEnum(Symbol));
65
+ $defineProperty(Symbol.prototype, 'toString', method(function() {
66
+ var symbolValue = this[symbolDataProperty];
67
+ if (!getOption('symbols'))
68
+ return symbolValue[symbolInternalProperty];
69
+ if (!symbolValue)
70
+ throw TypeError('Conversion from symbol to string');
71
+ var desc = symbolValue[symbolDescriptionProperty];
72
+ if (desc === undefined)
73
+ desc = '';
74
+ return 'Symbol(' + desc + ')';
75
+ }));
76
+ $defineProperty(Symbol.prototype, 'valueOf', method(function() {
77
+ var symbolValue = this[symbolDataProperty];
78
+ if (!symbolValue)
79
+ throw TypeError('Conversion from symbol to string');
80
+ if (!getOption('symbols'))
81
+ return symbolValue[symbolInternalProperty];
82
+ return symbolValue;
83
+ }));
84
+ function SymbolValue(description) {
85
+ var key = newUniqueString();
86
+ $defineProperty(this, symbolDataProperty, {value: this});
87
+ $defineProperty(this, symbolInternalProperty, {value: key});
88
+ $defineProperty(this, symbolDescriptionProperty, {value: description});
89
+ freeze(this);
90
+ symbolValues[key] = this;
91
+ }
92
+ $defineProperty(SymbolValue.prototype, 'constructor', nonEnum(Symbol));
93
+ $defineProperty(SymbolValue.prototype, 'toString', {
94
+ value: Symbol.prototype.toString,
95
+ enumerable: false
96
+ });
97
+ $defineProperty(SymbolValue.prototype, 'valueOf', {
98
+ value: Symbol.prototype.valueOf,
99
+ enumerable: false
100
+ });
101
+ var hashProperty = createPrivateName();
102
+ var hashPropertyDescriptor = {value: undefined};
103
+ var hashObjectProperties = {
104
+ hash: {value: undefined},
105
+ self: {value: undefined}
106
+ };
107
+ var hashCounter = 0;
108
+ function getOwnHashObject(object) {
109
+ var hashObject = object[hashProperty];
110
+ if (hashObject && hashObject.self === object)
111
+ return hashObject;
112
+ if ($isExtensible(object)) {
113
+ hashObjectProperties.hash.value = hashCounter++;
114
+ hashObjectProperties.self.value = object;
115
+ hashPropertyDescriptor.value = $create(null, hashObjectProperties);
116
+ $defineProperty(object, hashProperty, hashPropertyDescriptor);
117
+ return hashPropertyDescriptor.value;
118
+ }
119
+ return undefined;
120
+ }
121
+ function freeze(object) {
122
+ getOwnHashObject(object);
123
+ return $freeze.apply(this, arguments);
124
+ }
125
+ function preventExtensions(object) {
126
+ getOwnHashObject(object);
127
+ return $preventExtensions.apply(this, arguments);
128
+ }
129
+ function seal(object) {
130
+ getOwnHashObject(object);
131
+ return $seal.apply(this, arguments);
132
+ }
133
+ Symbol.iterator = Symbol();
134
+ freeze(SymbolValue.prototype);
135
+ function toProperty(name) {
136
+ if (isSymbol(name))
137
+ return name[symbolInternalProperty];
138
+ return name;
139
+ }
140
+ function getOwnPropertyNames(object) {
141
+ var rv = [];
142
+ var names = $getOwnPropertyNames(object);
143
+ for (var i = 0; i < names.length; i++) {
144
+ var name = names[i];
145
+ if (!symbolValues[name] && !privateNames[name])
146
+ rv.push(name);
147
+ }
148
+ return rv;
149
+ }
150
+ function getOwnPropertyDescriptor(object, name) {
151
+ return $getOwnPropertyDescriptor(object, toProperty(name));
152
+ }
153
+ function getOwnPropertySymbols(object) {
154
+ var rv = [];
155
+ var names = $getOwnPropertyNames(object);
156
+ for (var i = 0; i < names.length; i++) {
157
+ var symbol = symbolValues[names[i]];
158
+ if (symbol)
159
+ rv.push(symbol);
160
+ }
161
+ return rv;
162
+ }
163
+ function hasOwnProperty(name) {
164
+ return $hasOwnProperty.call(this, toProperty(name));
165
+ }
166
+ function getOption(name) {
167
+ return global.traceur && global.traceur.options[name];
168
+ }
169
+ function setProperty(object, name, value) {
170
+ var sym,
171
+ desc;
172
+ if (isSymbol(name)) {
173
+ sym = name;
174
+ name = name[symbolInternalProperty];
175
+ }
176
+ object[name] = value;
177
+ if (sym && (desc = $getOwnPropertyDescriptor(object, name)))
178
+ $defineProperty(object, name, {enumerable: false});
179
+ return value;
180
+ }
181
+ function defineProperty(object, name, descriptor) {
182
+ if (isSymbol(name)) {
183
+ if (descriptor.enumerable) {
184
+ descriptor = $create(descriptor, {enumerable: {value: false}});
185
+ }
186
+ name = name[symbolInternalProperty];
187
+ }
188
+ $defineProperty(object, name, descriptor);
189
+ return object;
190
+ }
191
+ function polyfillObject(Object) {
192
+ $defineProperty(Object, 'defineProperty', {value: defineProperty});
193
+ $defineProperty(Object, 'getOwnPropertyNames', {value: getOwnPropertyNames});
194
+ $defineProperty(Object, 'getOwnPropertyDescriptor', {value: getOwnPropertyDescriptor});
195
+ $defineProperty(Object.prototype, 'hasOwnProperty', {value: hasOwnProperty});
196
+ $defineProperty(Object, 'freeze', {value: freeze});
197
+ $defineProperty(Object, 'preventExtensions', {value: preventExtensions});
198
+ $defineProperty(Object, 'seal', {value: seal});
199
+ Object.getOwnPropertySymbols = getOwnPropertySymbols;
200
+ }
201
+ function exportStar(object) {
202
+ for (var i = 1; i < arguments.length; i++) {
203
+ var names = $getOwnPropertyNames(arguments[i]);
204
+ for (var j = 0; j < names.length; j++) {
205
+ var name = names[j];
206
+ if (privateNames[name])
207
+ continue;
208
+ (function(mod, name) {
209
+ $defineProperty(object, name, {
210
+ get: function() {
211
+ return mod[name];
212
+ },
213
+ enumerable: true
214
+ });
215
+ })(arguments[i], names[j]);
216
+ }
217
+ }
218
+ return object;
219
+ }
220
+ function isObject(x) {
221
+ return x != null && (typeof x === 'object' || typeof x === 'function');
222
+ }
223
+ function toObject(x) {
224
+ if (x == null)
225
+ throw $TypeError();
226
+ return $Object(x);
227
+ }
228
+ function assertObject(x) {
229
+ if (!isObject(x))
230
+ throw $TypeError(x + ' is not an Object');
231
+ return x;
232
+ }
233
+ function setupGlobals(global) {
234
+ global.Symbol = Symbol;
235
+ global.Reflect = global.Reflect || {};
236
+ global.Reflect.global = global.Reflect.global || global;
237
+ polyfillObject(global.Object);
238
+ }
239
+ setupGlobals(global);
240
+ global.$traceurRuntime = {
241
+ assertObject: assertObject,
242
+ createPrivateName: createPrivateName,
243
+ exportStar: exportStar,
244
+ getOwnHashObject: getOwnHashObject,
245
+ privateNames: privateNames,
246
+ setProperty: setProperty,
247
+ setupGlobals: setupGlobals,
248
+ toObject: toObject,
249
+ isObject: isObject,
250
+ toProperty: toProperty,
251
+ type: types,
252
+ typeof: typeOf,
253
+ defineProperties: $defineProperties,
254
+ defineProperty: $defineProperty,
255
+ getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
256
+ getOwnPropertyNames: $getOwnPropertyNames,
257
+ keys: $keys
258
+ };
259
+ })(typeof global !== 'undefined' ? global : this);
260
+ (function() {
261
+ 'use strict';
262
+ function spread() {
263
+ var rv = [],
264
+ j = 0,
265
+ iterResult;
266
+ for (var i = 0; i < arguments.length; i++) {
267
+ var valueToSpread = arguments[i];
268
+ if (!$traceurRuntime.isObject(valueToSpread)) {
269
+ throw new TypeError('Cannot spread non-object.');
270
+ }
271
+ if (typeof valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)] !== 'function') {
272
+ throw new TypeError('Cannot spread non-iterable object.');
273
+ }
274
+ var iter = valueToSpread[$traceurRuntime.toProperty(Symbol.iterator)]();
275
+ while (!(iterResult = iter.next()).done) {
276
+ rv[j++] = iterResult.value;
277
+ }
278
+ }
279
+ return rv;
280
+ }
281
+ $traceurRuntime.spread = spread;
282
+ })();
283
+ (function() {
284
+ 'use strict';
285
+ var $Object = Object;
286
+ var $TypeError = TypeError;
287
+ var $create = $Object.create;
288
+ var $defineProperties = $traceurRuntime.defineProperties;
289
+ var $defineProperty = $traceurRuntime.defineProperty;
290
+ var $getOwnPropertyDescriptor = $traceurRuntime.getOwnPropertyDescriptor;
291
+ var $getOwnPropertyNames = $traceurRuntime.getOwnPropertyNames;
292
+ var $getPrototypeOf = Object.getPrototypeOf;
293
+ function superDescriptor(homeObject, name) {
294
+ var proto = $getPrototypeOf(homeObject);
295
+ do {
296
+ var result = $getOwnPropertyDescriptor(proto, name);
297
+ if (result)
298
+ return result;
299
+ proto = $getPrototypeOf(proto);
300
+ } while (proto);
301
+ return undefined;
302
+ }
303
+ function superCall(self, homeObject, name, args) {
304
+ return superGet(self, homeObject, name).apply(self, args);
305
+ }
306
+ function superGet(self, homeObject, name) {
307
+ var descriptor = superDescriptor(homeObject, name);
308
+ if (descriptor) {
309
+ if (!descriptor.get)
310
+ return descriptor.value;
311
+ return descriptor.get.call(self);
312
+ }
313
+ return undefined;
314
+ }
315
+ function superSet(self, homeObject, name, value) {
316
+ var descriptor = superDescriptor(homeObject, name);
317
+ if (descriptor && descriptor.set) {
318
+ descriptor.set.call(self, value);
319
+ return value;
320
+ }
321
+ throw $TypeError("super has no setter '" + name + "'.");
322
+ }
323
+ function getDescriptors(object) {
324
+ var descriptors = {},
325
+ name,
326
+ names = $getOwnPropertyNames(object);
327
+ for (var i = 0; i < names.length; i++) {
328
+ var name = names[i];
329
+ descriptors[name] = $getOwnPropertyDescriptor(object, name);
330
+ }
331
+ return descriptors;
332
+ }
333
+ function createClass(ctor, object, staticObject, superClass) {
334
+ $defineProperty(object, 'constructor', {
335
+ value: ctor,
336
+ configurable: true,
337
+ enumerable: false,
338
+ writable: true
339
+ });
340
+ if (arguments.length > 3) {
341
+ if (typeof superClass === 'function')
342
+ ctor.__proto__ = superClass;
343
+ ctor.prototype = $create(getProtoParent(superClass), getDescriptors(object));
344
+ } else {
345
+ ctor.prototype = object;
346
+ }
347
+ $defineProperty(ctor, 'prototype', {
348
+ configurable: false,
349
+ writable: false
350
+ });
351
+ return $defineProperties(ctor, getDescriptors(staticObject));
352
+ }
353
+ function getProtoParent(superClass) {
354
+ if (typeof superClass === 'function') {
355
+ var prototype = superClass.prototype;
356
+ if ($Object(prototype) === prototype || prototype === null)
357
+ return superClass.prototype;
358
+ }
359
+ if (superClass === null)
360
+ return null;
361
+ throw new $TypeError();
362
+ }
363
+ function defaultSuperCall(self, homeObject, args) {
364
+ if ($getPrototypeOf(homeObject) !== null)
365
+ superCall(self, homeObject, 'constructor', args);
366
+ }
367
+ $traceurRuntime.createClass = createClass;
368
+ $traceurRuntime.defaultSuperCall = defaultSuperCall;
369
+ $traceurRuntime.superCall = superCall;
370
+ $traceurRuntime.superGet = superGet;
371
+ $traceurRuntime.superSet = superSet;
372
+ })();
373
+ (function() {
374
+ 'use strict';
375
+ var createPrivateName = $traceurRuntime.createPrivateName;
376
+ var $defineProperties = $traceurRuntime.defineProperties;
377
+ var $defineProperty = $traceurRuntime.defineProperty;
378
+ var $create = Object.create;
379
+ var $TypeError = TypeError;
380
+ function nonEnum(value) {
381
+ return {
382
+ configurable: true,
383
+ enumerable: false,
384
+ value: value,
385
+ writable: true
386
+ };
387
+ }
388
+ var ST_NEWBORN = 0;
389
+ var ST_EXECUTING = 1;
390
+ var ST_SUSPENDED = 2;
391
+ var ST_CLOSED = 3;
392
+ var END_STATE = -2;
393
+ var RETHROW_STATE = -3;
394
+ function getInternalError(state) {
395
+ return new Error('Traceur compiler bug: invalid state in state machine: ' + state);
396
+ }
397
+ function GeneratorContext() {
398
+ this.state = 0;
399
+ this.GState = ST_NEWBORN;
400
+ this.storedException = undefined;
401
+ this.finallyFallThrough = undefined;
402
+ this.sent_ = undefined;
403
+ this.returnValue = undefined;
404
+ this.tryStack_ = [];
405
+ }
406
+ GeneratorContext.prototype = {
407
+ pushTry: function(catchState, finallyState) {
408
+ if (finallyState !== null) {
409
+ var finallyFallThrough = null;
410
+ for (var i = this.tryStack_.length - 1; i >= 0; i--) {
411
+ if (this.tryStack_[i].catch !== undefined) {
412
+ finallyFallThrough = this.tryStack_[i].catch;
413
+ break;
414
+ }
415
+ }
416
+ if (finallyFallThrough === null)
417
+ finallyFallThrough = RETHROW_STATE;
418
+ this.tryStack_.push({
419
+ finally: finallyState,
420
+ finallyFallThrough: finallyFallThrough
421
+ });
422
+ }
423
+ if (catchState !== null) {
424
+ this.tryStack_.push({catch: catchState});
425
+ }
426
+ },
427
+ popTry: function() {
428
+ this.tryStack_.pop();
429
+ },
430
+ get sent() {
431
+ this.maybeThrow();
432
+ return this.sent_;
433
+ },
434
+ set sent(v) {
435
+ this.sent_ = v;
436
+ },
437
+ get sentIgnoreThrow() {
438
+ return this.sent_;
439
+ },
440
+ maybeThrow: function() {
441
+ if (this.action === 'throw') {
442
+ this.action = 'next';
443
+ throw this.sent_;
444
+ }
445
+ },
446
+ end: function() {
447
+ switch (this.state) {
448
+ case END_STATE:
449
+ return this;
450
+ case RETHROW_STATE:
451
+ throw this.storedException;
452
+ default:
453
+ throw getInternalError(this.state);
454
+ }
455
+ },
456
+ handleException: function(ex) {
457
+ this.GState = ST_CLOSED;
458
+ this.state = END_STATE;
459
+ throw ex;
460
+ }
461
+ };
462
+ function nextOrThrow(ctx, moveNext, action, x) {
463
+ switch (ctx.GState) {
464
+ case ST_EXECUTING:
465
+ throw new Error(("\"" + action + "\" on executing generator"));
466
+ case ST_CLOSED:
467
+ if (action == 'next') {
468
+ return {
469
+ value: undefined,
470
+ done: true
471
+ };
472
+ }
473
+ throw x;
474
+ case ST_NEWBORN:
475
+ if (action === 'throw') {
476
+ ctx.GState = ST_CLOSED;
477
+ throw x;
478
+ }
479
+ if (x !== undefined)
480
+ throw $TypeError('Sent value to newborn generator');
481
+ case ST_SUSPENDED:
482
+ ctx.GState = ST_EXECUTING;
483
+ ctx.action = action;
484
+ ctx.sent = x;
485
+ var value = moveNext(ctx);
486
+ var done = value === ctx;
487
+ if (done)
488
+ value = ctx.returnValue;
489
+ ctx.GState = done ? ST_CLOSED : ST_SUSPENDED;
490
+ return {
491
+ value: value,
492
+ done: done
493
+ };
494
+ }
495
+ }
496
+ var ctxName = createPrivateName();
497
+ var moveNextName = createPrivateName();
498
+ function GeneratorFunction() {}
499
+ function GeneratorFunctionPrototype() {}
500
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
501
+ $defineProperty(GeneratorFunctionPrototype, 'constructor', nonEnum(GeneratorFunction));
502
+ GeneratorFunctionPrototype.prototype = {
503
+ constructor: GeneratorFunctionPrototype,
504
+ next: function(v) {
505
+ return nextOrThrow(this[ctxName], this[moveNextName], 'next', v);
506
+ },
507
+ throw: function(v) {
508
+ return nextOrThrow(this[ctxName], this[moveNextName], 'throw', v);
509
+ }
510
+ };
511
+ $defineProperties(GeneratorFunctionPrototype.prototype, {
512
+ constructor: {enumerable: false},
513
+ next: {enumerable: false},
514
+ throw: {enumerable: false}
515
+ });
516
+ Object.defineProperty(GeneratorFunctionPrototype.prototype, Symbol.iterator, nonEnum(function() {
517
+ return this;
518
+ }));
519
+ function createGeneratorInstance(innerFunction, functionObject, self) {
520
+ var moveNext = getMoveNext(innerFunction, self);
521
+ var ctx = new GeneratorContext();
522
+ var object = $create(functionObject.prototype);
523
+ object[ctxName] = ctx;
524
+ object[moveNextName] = moveNext;
525
+ return object;
526
+ }
527
+ function initGeneratorFunction(functionObject) {
528
+ functionObject.prototype = $create(GeneratorFunctionPrototype.prototype);
529
+ functionObject.__proto__ = GeneratorFunctionPrototype;
530
+ return functionObject;
531
+ }
532
+ function AsyncFunctionContext() {
533
+ GeneratorContext.call(this);
534
+ this.err = undefined;
535
+ var ctx = this;
536
+ ctx.result = new Promise(function(resolve, reject) {
537
+ ctx.resolve = resolve;
538
+ ctx.reject = reject;
539
+ });
540
+ }
541
+ AsyncFunctionContext.prototype = $create(GeneratorContext.prototype);
542
+ AsyncFunctionContext.prototype.end = function() {
543
+ switch (this.state) {
544
+ case END_STATE:
545
+ this.resolve(this.returnValue);
546
+ break;
547
+ case RETHROW_STATE:
548
+ this.reject(this.storedException);
549
+ break;
550
+ default:
551
+ this.reject(getInternalError(this.state));
552
+ }
553
+ };
554
+ AsyncFunctionContext.prototype.handleException = function() {
555
+ this.state = RETHROW_STATE;
556
+ };
557
+ function asyncWrap(innerFunction, self) {
558
+ var moveNext = getMoveNext(innerFunction, self);
559
+ var ctx = new AsyncFunctionContext();
560
+ ctx.createCallback = function(newState) {
561
+ return function(value) {
562
+ ctx.state = newState;
563
+ ctx.value = value;
564
+ moveNext(ctx);
565
+ };
566
+ };
567
+ ctx.errback = function(err) {
568
+ handleCatch(ctx, err);
569
+ moveNext(ctx);
570
+ };
571
+ moveNext(ctx);
572
+ return ctx.result;
573
+ }
574
+ function getMoveNext(innerFunction, self) {
575
+ return function(ctx) {
576
+ while (true) {
577
+ try {
578
+ return innerFunction.call(self, ctx);
579
+ } catch (ex) {
580
+ handleCatch(ctx, ex);
581
+ }
582
+ }
583
+ };
584
+ }
585
+ function handleCatch(ctx, ex) {
586
+ ctx.storedException = ex;
587
+ var last = ctx.tryStack_[ctx.tryStack_.length - 1];
588
+ if (!last) {
589
+ ctx.handleException(ex);
590
+ return;
591
+ }
592
+ ctx.state = last.catch !== undefined ? last.catch : last.finally;
593
+ if (last.finallyFallThrough !== undefined)
594
+ ctx.finallyFallThrough = last.finallyFallThrough;
595
+ }
596
+ $traceurRuntime.asyncWrap = asyncWrap;
597
+ $traceurRuntime.initGeneratorFunction = initGeneratorFunction;
598
+ $traceurRuntime.createGeneratorInstance = createGeneratorInstance;
599
+ })();
600
+ (function() {
601
+ function buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
602
+ var out = [];
603
+ if (opt_scheme) {
604
+ out.push(opt_scheme, ':');
605
+ }
606
+ if (opt_domain) {
607
+ out.push('//');
608
+ if (opt_userInfo) {
609
+ out.push(opt_userInfo, '@');
610
+ }
611
+ out.push(opt_domain);
612
+ if (opt_port) {
613
+ out.push(':', opt_port);
614
+ }
615
+ }
616
+ if (opt_path) {
617
+ out.push(opt_path);
618
+ }
619
+ if (opt_queryData) {
620
+ out.push('?', opt_queryData);
621
+ }
622
+ if (opt_fragment) {
623
+ out.push('#', opt_fragment);
624
+ }
625
+ return out.join('');
626
+ }
627
+ ;
628
+ var splitRe = new RegExp('^' + '(?:' + '([^:/?#.]+)' + ':)?' + '(?://' + '(?:([^/?#]*)@)?' + '([\\w\\d\\-\\u0100-\\uffff.%]*)' + '(?::([0-9]+))?' + ')?' + '([^?#]+)?' + '(?:\\?([^#]*))?' + '(?:#(.*))?' + '$');
629
+ var ComponentIndex = {
630
+ SCHEME: 1,
631
+ USER_INFO: 2,
632
+ DOMAIN: 3,
633
+ PORT: 4,
634
+ PATH: 5,
635
+ QUERY_DATA: 6,
636
+ FRAGMENT: 7
637
+ };
638
+ function split(uri) {
639
+ return (uri.match(splitRe));
640
+ }
641
+ function removeDotSegments(path) {
642
+ if (path === '/')
643
+ return '/';
644
+ var leadingSlash = path[0] === '/' ? '/' : '';
645
+ var trailingSlash = path.slice(-1) === '/' ? '/' : '';
646
+ var segments = path.split('/');
647
+ var out = [];
648
+ var up = 0;
649
+ for (var pos = 0; pos < segments.length; pos++) {
650
+ var segment = segments[pos];
651
+ switch (segment) {
652
+ case '':
653
+ case '.':
654
+ break;
655
+ case '..':
656
+ if (out.length)
657
+ out.pop();
658
+ else
659
+ up++;
660
+ break;
661
+ default:
662
+ out.push(segment);
663
+ }
664
+ }
665
+ if (!leadingSlash) {
666
+ while (up-- > 0) {
667
+ out.unshift('..');
668
+ }
669
+ if (out.length === 0)
670
+ out.push('.');
671
+ }
672
+ return leadingSlash + out.join('/') + trailingSlash;
673
+ }
674
+ function joinAndCanonicalizePath(parts) {
675
+ var path = parts[ComponentIndex.PATH] || '';
676
+ path = removeDotSegments(path);
677
+ parts[ComponentIndex.PATH] = path;
678
+ return buildFromEncodedParts(parts[ComponentIndex.SCHEME], parts[ComponentIndex.USER_INFO], parts[ComponentIndex.DOMAIN], parts[ComponentIndex.PORT], parts[ComponentIndex.PATH], parts[ComponentIndex.QUERY_DATA], parts[ComponentIndex.FRAGMENT]);
679
+ }
680
+ function canonicalizeUrl(url) {
681
+ var parts = split(url);
682
+ return joinAndCanonicalizePath(parts);
683
+ }
684
+ function resolveUrl(base, url) {
685
+ var parts = split(url);
686
+ var baseParts = split(base);
687
+ if (parts[ComponentIndex.SCHEME]) {
688
+ return joinAndCanonicalizePath(parts);
689
+ } else {
690
+ parts[ComponentIndex.SCHEME] = baseParts[ComponentIndex.SCHEME];
691
+ }
692
+ for (var i = ComponentIndex.SCHEME; i <= ComponentIndex.PORT; i++) {
693
+ if (!parts[i]) {
694
+ parts[i] = baseParts[i];
695
+ }
696
+ }
697
+ if (parts[ComponentIndex.PATH][0] == '/') {
698
+ return joinAndCanonicalizePath(parts);
699
+ }
700
+ var path = baseParts[ComponentIndex.PATH];
701
+ var index = path.lastIndexOf('/');
702
+ path = path.slice(0, index + 1) + parts[ComponentIndex.PATH];
703
+ parts[ComponentIndex.PATH] = path;
704
+ return joinAndCanonicalizePath(parts);
705
+ }
706
+ function isAbsolute(name) {
707
+ if (!name)
708
+ return false;
709
+ if (name[0] === '/')
710
+ return true;
711
+ var parts = split(name);
712
+ if (parts[ComponentIndex.SCHEME])
713
+ return true;
714
+ return false;
715
+ }
716
+ $traceurRuntime.canonicalizeUrl = canonicalizeUrl;
717
+ $traceurRuntime.isAbsolute = isAbsolute;
718
+ $traceurRuntime.removeDotSegments = removeDotSegments;
719
+ $traceurRuntime.resolveUrl = resolveUrl;
720
+ })();
721
+ (function(global) {
722
+ 'use strict';
723
+ var $__2 = $traceurRuntime.assertObject($traceurRuntime),
724
+ canonicalizeUrl = $__2.canonicalizeUrl,
725
+ resolveUrl = $__2.resolveUrl,
726
+ isAbsolute = $__2.isAbsolute;
727
+ var moduleInstantiators = Object.create(null);
728
+ var baseURL;
729
+ if (global.location && global.location.href)
730
+ baseURL = resolveUrl(global.location.href, './');
731
+ else
732
+ baseURL = '';
733
+ var UncoatedModuleEntry = function UncoatedModuleEntry(url, uncoatedModule) {
734
+ this.url = url;
735
+ this.value_ = uncoatedModule;
736
+ };
737
+ ($traceurRuntime.createClass)(UncoatedModuleEntry, {}, {});
738
+ var UncoatedModuleInstantiator = function UncoatedModuleInstantiator(url, func) {
739
+ $traceurRuntime.superCall(this, $UncoatedModuleInstantiator.prototype, "constructor", [url, null]);
740
+ this.func = func;
741
+ };
742
+ var $UncoatedModuleInstantiator = UncoatedModuleInstantiator;
743
+ ($traceurRuntime.createClass)(UncoatedModuleInstantiator, {getUncoatedModule: function() {
744
+ if (this.value_)
745
+ return this.value_;
746
+ return this.value_ = this.func.call(global);
747
+ }}, {}, UncoatedModuleEntry);
748
+ function getUncoatedModuleInstantiator(name) {
749
+ if (!name)
750
+ return;
751
+ var url = ModuleStore.normalize(name);
752
+ return moduleInstantiators[url];
753
+ }
754
+ ;
755
+ var moduleInstances = Object.create(null);
756
+ var liveModuleSentinel = {};
757
+ function Module(uncoatedModule) {
758
+ var isLive = arguments[1];
759
+ var coatedModule = Object.create(null);
760
+ Object.getOwnPropertyNames(uncoatedModule).forEach((function(name) {
761
+ var getter,
762
+ value;
763
+ if (isLive === liveModuleSentinel) {
764
+ var descr = Object.getOwnPropertyDescriptor(uncoatedModule, name);
765
+ if (descr.get)
766
+ getter = descr.get;
767
+ }
768
+ if (!getter) {
769
+ value = uncoatedModule[name];
770
+ getter = function() {
771
+ return value;
772
+ };
773
+ }
774
+ Object.defineProperty(coatedModule, name, {
775
+ get: getter,
776
+ enumerable: true
777
+ });
778
+ }));
779
+ Object.preventExtensions(coatedModule);
780
+ return coatedModule;
781
+ }
782
+ var ModuleStore = {
783
+ normalize: function(name, refererName, refererAddress) {
784
+ if (typeof name !== "string")
785
+ throw new TypeError("module name must be a string, not " + typeof name);
786
+ if (isAbsolute(name))
787
+ return canonicalizeUrl(name);
788
+ if (/[^\.]\/\.\.\//.test(name)) {
789
+ throw new Error('module name embeds /../: ' + name);
790
+ }
791
+ if (name[0] === '.' && refererName)
792
+ return resolveUrl(refererName, name);
793
+ return canonicalizeUrl(name);
794
+ },
795
+ get: function(normalizedName) {
796
+ var m = getUncoatedModuleInstantiator(normalizedName);
797
+ if (!m)
798
+ return undefined;
799
+ var moduleInstance = moduleInstances[m.url];
800
+ if (moduleInstance)
801
+ return moduleInstance;
802
+ moduleInstance = Module(m.getUncoatedModule(), liveModuleSentinel);
803
+ return moduleInstances[m.url] = moduleInstance;
804
+ },
805
+ set: function(normalizedName, module) {
806
+ normalizedName = String(normalizedName);
807
+ moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, (function() {
808
+ return module;
809
+ }));
810
+ moduleInstances[normalizedName] = module;
811
+ },
812
+ get baseURL() {
813
+ return baseURL;
814
+ },
815
+ set baseURL(v) {
816
+ baseURL = String(v);
817
+ },
818
+ registerModule: function(name, func) {
819
+ var normalizedName = ModuleStore.normalize(name);
820
+ if (moduleInstantiators[normalizedName])
821
+ throw new Error('duplicate module named ' + normalizedName);
822
+ moduleInstantiators[normalizedName] = new UncoatedModuleInstantiator(normalizedName, func);
823
+ },
824
+ bundleStore: Object.create(null),
825
+ register: function(name, deps, func) {
826
+ if (!deps || !deps.length && !func.length) {
827
+ this.registerModule(name, func);
828
+ } else {
829
+ this.bundleStore[name] = {
830
+ deps: deps,
831
+ execute: function() {
832
+ var $__0 = arguments;
833
+ var depMap = {};
834
+ deps.forEach((function(dep, index) {
835
+ return depMap[dep] = $__0[index];
836
+ }));
837
+ var registryEntry = func.call(this, depMap);
838
+ registryEntry.execute.call(this);
839
+ return registryEntry.exports;
840
+ }
841
+ };
842
+ }
843
+ },
844
+ getAnonymousModule: function(func) {
845
+ return new Module(func.call(global), liveModuleSentinel);
846
+ },
847
+ getForTesting: function(name) {
848
+ var $__0 = this;
849
+ if (!this.testingPrefix_) {
850
+ Object.keys(moduleInstances).some((function(key) {
851
+ var m = /(traceur@[^\/]*\/)/.exec(key);
852
+ if (m) {
853
+ $__0.testingPrefix_ = m[1];
854
+ return true;
855
+ }
856
+ }));
857
+ }
858
+ return this.get(this.testingPrefix_ + name);
859
+ }
860
+ };
861
+ ModuleStore.set('@traceur/src/runtime/ModuleStore', new Module({ModuleStore: ModuleStore}));
862
+ var setupGlobals = $traceurRuntime.setupGlobals;
863
+ $traceurRuntime.setupGlobals = function(global) {
864
+ setupGlobals(global);
865
+ };
866
+ $traceurRuntime.ModuleStore = ModuleStore;
867
+ global.System = {
868
+ register: ModuleStore.register.bind(ModuleStore),
869
+ get: ModuleStore.get,
870
+ set: ModuleStore.set,
871
+ normalize: ModuleStore.normalize
872
+ };
873
+ $traceurRuntime.getModuleImpl = function(name) {
874
+ var instantiator = getUncoatedModuleInstantiator(name);
875
+ return instantiator && instantiator.getUncoatedModule();
876
+ };
877
+ })(typeof global !== 'undefined' ? global : this);
878
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/utils", [], function() {
879
+ "use strict";
880
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/utils";
881
+ var toObject = $traceurRuntime.toObject;
882
+ function toUint32(x) {
883
+ return x | 0;
884
+ }
885
+ function isObject(x) {
886
+ return x && (typeof x === 'object' || typeof x === 'function');
887
+ }
888
+ function isCallable(x) {
889
+ return typeof x === 'function';
890
+ }
891
+ function toInteger(x) {
892
+ x = +x;
893
+ if (isNaN(x))
894
+ return 0;
895
+ if (!isFinite(x) || x === 0)
896
+ return x;
897
+ return x > 0 ? Math.floor(x) : Math.ceil(x);
898
+ }
899
+ var MAX_SAFE_LENGTH = Math.pow(2, 53) - 1;
900
+ function toLength(x) {
901
+ var len = toInteger(x);
902
+ return len < 0 ? 0 : Math.min(len, MAX_SAFE_LENGTH);
903
+ }
904
+ function checkIterable(x) {
905
+ return !isObject(x) ? undefined : x[Symbol.iterator];
906
+ }
907
+ function isConstructor(x) {
908
+ return isCallable(x);
909
+ }
910
+ return {
911
+ get toObject() {
912
+ return toObject;
913
+ },
914
+ get toUint32() {
915
+ return toUint32;
916
+ },
917
+ get isObject() {
918
+ return isObject;
919
+ },
920
+ get isCallable() {
921
+ return isCallable;
922
+ },
923
+ get toInteger() {
924
+ return toInteger;
925
+ },
926
+ get toLength() {
927
+ return toLength;
928
+ },
929
+ get checkIterable() {
930
+ return checkIterable;
931
+ },
932
+ get isConstructor() {
933
+ return isConstructor;
934
+ }
935
+ };
936
+ });
937
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/Array", [], function() {
938
+ "use strict";
939
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/Array";
940
+ var $__5 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/utils")),
941
+ isCallable = $__5.isCallable,
942
+ isConstructor = $__5.isConstructor,
943
+ checkIterable = $__5.checkIterable,
944
+ toInteger = $__5.toInteger,
945
+ toLength = $__5.toLength,
946
+ toObject = $__5.toObject;
947
+ function from(arrLike) {
948
+ var mapFn = arguments[1];
949
+ var thisArg = arguments[2];
950
+ var C = this;
951
+ var items = toObject(arrLike);
952
+ var mapping = mapFn !== undefined;
953
+ var k = 0;
954
+ var arr,
955
+ len;
956
+ if (mapping && !isCallable(mapFn)) {
957
+ throw TypeError();
958
+ }
959
+ if (checkIterable(items)) {
960
+ arr = isConstructor(C) ? new C() : [];
961
+ for (var $__3 = items[Symbol.iterator](),
962
+ $__4; !($__4 = $__3.next()).done; ) {
963
+ var item = $__4.value;
964
+ {
965
+ if (mapping) {
966
+ arr[k] = mapFn.call(thisArg, item, k);
967
+ } else {
968
+ arr[k] = item;
969
+ }
970
+ k++;
971
+ }
972
+ }
973
+ arr.length = k;
974
+ return arr;
975
+ }
976
+ len = toLength(items.length);
977
+ arr = isConstructor(C) ? new C(len) : new Array(len);
978
+ for (; k < len; k++) {
979
+ if (mapping) {
980
+ arr[k] = mapFn.call(thisArg, items[k], k);
981
+ } else {
982
+ arr[k] = items[k];
983
+ }
984
+ }
985
+ arr.length = len;
986
+ return arr;
987
+ }
988
+ function fill(value) {
989
+ var start = arguments[1] !== (void 0) ? arguments[1] : 0;
990
+ var end = arguments[2];
991
+ var object = toObject(this);
992
+ var len = toLength(object.length);
993
+ var fillStart = toInteger(start);
994
+ var fillEnd = end !== undefined ? toInteger(end) : len;
995
+ fillStart = fillStart < 0 ? Math.max(len + fillStart, 0) : Math.min(fillStart, len);
996
+ fillEnd = fillEnd < 0 ? Math.max(len + fillEnd, 0) : Math.min(fillEnd, len);
997
+ while (fillStart < fillEnd) {
998
+ object[fillStart] = value;
999
+ fillStart++;
1000
+ }
1001
+ return object;
1002
+ }
1003
+ function find(predicate) {
1004
+ var thisArg = arguments[1];
1005
+ return findHelper(this, predicate, thisArg);
1006
+ }
1007
+ function findIndex(predicate) {
1008
+ var thisArg = arguments[1];
1009
+ return findHelper(this, predicate, thisArg, true);
1010
+ }
1011
+ function findHelper(self, predicate) {
1012
+ var thisArg = arguments[2];
1013
+ var returnIndex = arguments[3] !== (void 0) ? arguments[3] : false;
1014
+ var object = toObject(self);
1015
+ var len = toLength(object.length);
1016
+ if (!isCallable(predicate)) {
1017
+ throw TypeError();
1018
+ }
1019
+ for (var i = 0; i < len; i++) {
1020
+ if (i in object) {
1021
+ var value = object[i];
1022
+ if (predicate.call(thisArg, value, i, object)) {
1023
+ return returnIndex ? i : value;
1024
+ }
1025
+ }
1026
+ }
1027
+ return returnIndex ? -1 : undefined;
1028
+ }
1029
+ return {
1030
+ get from() {
1031
+ return from;
1032
+ },
1033
+ get fill() {
1034
+ return fill;
1035
+ },
1036
+ get find() {
1037
+ return find;
1038
+ },
1039
+ get findIndex() {
1040
+ return findIndex;
1041
+ }
1042
+ };
1043
+ });
1044
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/ArrayIterator", [], function() {
1045
+ "use strict";
1046
+ var $__7;
1047
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/ArrayIterator";
1048
+ var $__8 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/utils")),
1049
+ toObject = $__8.toObject,
1050
+ toUint32 = $__8.toUint32;
1051
+ var ARRAY_ITERATOR_KIND_KEYS = 1;
1052
+ var ARRAY_ITERATOR_KIND_VALUES = 2;
1053
+ var ARRAY_ITERATOR_KIND_ENTRIES = 3;
1054
+ var ArrayIterator = function ArrayIterator() {};
1055
+ ($traceurRuntime.createClass)(ArrayIterator, ($__7 = {}, Object.defineProperty($__7, "next", {
1056
+ value: function() {
1057
+ var iterator = toObject(this);
1058
+ var array = iterator.iteratorObject_;
1059
+ if (!array) {
1060
+ throw new TypeError('Object is not an ArrayIterator');
1061
+ }
1062
+ var index = iterator.arrayIteratorNextIndex_;
1063
+ var itemKind = iterator.arrayIterationKind_;
1064
+ var length = toUint32(array.length);
1065
+ if (index >= length) {
1066
+ iterator.arrayIteratorNextIndex_ = Infinity;
1067
+ return createIteratorResultObject(undefined, true);
1068
+ }
1069
+ iterator.arrayIteratorNextIndex_ = index + 1;
1070
+ if (itemKind == ARRAY_ITERATOR_KIND_VALUES)
1071
+ return createIteratorResultObject(array[index], false);
1072
+ if (itemKind == ARRAY_ITERATOR_KIND_ENTRIES)
1073
+ return createIteratorResultObject([index, array[index]], false);
1074
+ return createIteratorResultObject(index, false);
1075
+ },
1076
+ configurable: true,
1077
+ enumerable: true,
1078
+ writable: true
1079
+ }), Object.defineProperty($__7, Symbol.iterator, {
1080
+ value: function() {
1081
+ return this;
1082
+ },
1083
+ configurable: true,
1084
+ enumerable: true,
1085
+ writable: true
1086
+ }), $__7), {});
1087
+ function createArrayIterator(array, kind) {
1088
+ var object = toObject(array);
1089
+ var iterator = new ArrayIterator;
1090
+ iterator.iteratorObject_ = object;
1091
+ iterator.arrayIteratorNextIndex_ = 0;
1092
+ iterator.arrayIterationKind_ = kind;
1093
+ return iterator;
1094
+ }
1095
+ function createIteratorResultObject(value, done) {
1096
+ return {
1097
+ value: value,
1098
+ done: done
1099
+ };
1100
+ }
1101
+ function entries() {
1102
+ return createArrayIterator(this, ARRAY_ITERATOR_KIND_ENTRIES);
1103
+ }
1104
+ function keys() {
1105
+ return createArrayIterator(this, ARRAY_ITERATOR_KIND_KEYS);
1106
+ }
1107
+ function values() {
1108
+ return createArrayIterator(this, ARRAY_ITERATOR_KIND_VALUES);
1109
+ }
1110
+ return {
1111
+ get entries() {
1112
+ return entries;
1113
+ },
1114
+ get keys() {
1115
+ return keys;
1116
+ },
1117
+ get values() {
1118
+ return values;
1119
+ }
1120
+ };
1121
+ });
1122
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/Map", [], function() {
1123
+ "use strict";
1124
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/Map";
1125
+ var isObject = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/utils")).isObject;
1126
+ var getOwnHashObject = $traceurRuntime.getOwnHashObject;
1127
+ var $hasOwnProperty = Object.prototype.hasOwnProperty;
1128
+ var deletedSentinel = {};
1129
+ function lookupIndex(map, key) {
1130
+ if (isObject(key)) {
1131
+ var hashObject = getOwnHashObject(key);
1132
+ return hashObject && map.objectIndex_[hashObject.hash];
1133
+ }
1134
+ if (typeof key === 'string')
1135
+ return map.stringIndex_[key];
1136
+ return map.primitiveIndex_[key];
1137
+ }
1138
+ function initMap(map) {
1139
+ map.entries_ = [];
1140
+ map.objectIndex_ = Object.create(null);
1141
+ map.stringIndex_ = Object.create(null);
1142
+ map.primitiveIndex_ = Object.create(null);
1143
+ map.deletedCount_ = 0;
1144
+ }
1145
+ var Map = function Map() {
1146
+ var iterable = arguments[0];
1147
+ if (!isObject(this))
1148
+ throw new TypeError('Map called on incompatible type');
1149
+ if ($hasOwnProperty.call(this, 'entries_')) {
1150
+ throw new TypeError('Map can not be reentrantly initialised');
1151
+ }
1152
+ initMap(this);
1153
+ if (iterable !== null && iterable !== undefined) {
1154
+ for (var $__10 = iterable[Symbol.iterator](),
1155
+ $__11; !($__11 = $__10.next()).done; ) {
1156
+ var $__12 = $traceurRuntime.assertObject($__11.value),
1157
+ key = $__12[0],
1158
+ value = $__12[1];
1159
+ {
1160
+ this.set(key, value);
1161
+ }
1162
+ }
1163
+ }
1164
+ };
1165
+ ($traceurRuntime.createClass)(Map, {
1166
+ get size() {
1167
+ return this.entries_.length / 2 - this.deletedCount_;
1168
+ },
1169
+ get: function(key) {
1170
+ var index = lookupIndex(this, key);
1171
+ if (index !== undefined)
1172
+ return this.entries_[index + 1];
1173
+ },
1174
+ set: function(key, value) {
1175
+ var objectMode = isObject(key);
1176
+ var stringMode = typeof key === 'string';
1177
+ var index = lookupIndex(this, key);
1178
+ if (index !== undefined) {
1179
+ this.entries_[index + 1] = value;
1180
+ } else {
1181
+ index = this.entries_.length;
1182
+ this.entries_[index] = key;
1183
+ this.entries_[index + 1] = value;
1184
+ if (objectMode) {
1185
+ var hashObject = getOwnHashObject(key);
1186
+ var hash = hashObject.hash;
1187
+ this.objectIndex_[hash] = index;
1188
+ } else if (stringMode) {
1189
+ this.stringIndex_[key] = index;
1190
+ } else {
1191
+ this.primitiveIndex_[key] = index;
1192
+ }
1193
+ }
1194
+ return this;
1195
+ },
1196
+ has: function(key) {
1197
+ return lookupIndex(this, key) !== undefined;
1198
+ },
1199
+ delete: function(key) {
1200
+ var objectMode = isObject(key);
1201
+ var stringMode = typeof key === 'string';
1202
+ var index;
1203
+ var hash;
1204
+ if (objectMode) {
1205
+ var hashObject = getOwnHashObject(key);
1206
+ if (hashObject) {
1207
+ index = this.objectIndex_[hash = hashObject.hash];
1208
+ delete this.objectIndex_[hash];
1209
+ }
1210
+ } else if (stringMode) {
1211
+ index = this.stringIndex_[key];
1212
+ delete this.stringIndex_[key];
1213
+ } else {
1214
+ index = this.primitiveIndex_[key];
1215
+ delete this.primitiveIndex_[key];
1216
+ }
1217
+ if (index !== undefined) {
1218
+ this.entries_[index] = deletedSentinel;
1219
+ this.entries_[index + 1] = undefined;
1220
+ this.deletedCount_++;
1221
+ }
1222
+ },
1223
+ clear: function() {
1224
+ initMap(this);
1225
+ },
1226
+ forEach: function(callbackFn) {
1227
+ var thisArg = arguments[1];
1228
+ for (var i = 0,
1229
+ len = this.entries_.length; i < len; i += 2) {
1230
+ var key = this.entries_[i];
1231
+ var value = this.entries_[i + 1];
1232
+ if (key === deletedSentinel)
1233
+ continue;
1234
+ callbackFn.call(thisArg, value, key, this);
1235
+ }
1236
+ },
1237
+ entries: $traceurRuntime.initGeneratorFunction(function $__13() {
1238
+ var i,
1239
+ len,
1240
+ key,
1241
+ value;
1242
+ return $traceurRuntime.createGeneratorInstance(function($ctx) {
1243
+ while (true)
1244
+ switch ($ctx.state) {
1245
+ case 0:
1246
+ i = 0, len = this.entries_.length;
1247
+ $ctx.state = 12;
1248
+ break;
1249
+ case 12:
1250
+ $ctx.state = (i < len) ? 8 : -2;
1251
+ break;
1252
+ case 4:
1253
+ i += 2;
1254
+ $ctx.state = 12;
1255
+ break;
1256
+ case 8:
1257
+ key = this.entries_[i];
1258
+ value = this.entries_[i + 1];
1259
+ $ctx.state = 9;
1260
+ break;
1261
+ case 9:
1262
+ $ctx.state = (key === deletedSentinel) ? 4 : 6;
1263
+ break;
1264
+ case 6:
1265
+ $ctx.state = 2;
1266
+ return [key, value];
1267
+ case 2:
1268
+ $ctx.maybeThrow();
1269
+ $ctx.state = 4;
1270
+ break;
1271
+ default:
1272
+ return $ctx.end();
1273
+ }
1274
+ }, $__13, this);
1275
+ }),
1276
+ keys: $traceurRuntime.initGeneratorFunction(function $__14() {
1277
+ var i,
1278
+ len,
1279
+ key,
1280
+ value;
1281
+ return $traceurRuntime.createGeneratorInstance(function($ctx) {
1282
+ while (true)
1283
+ switch ($ctx.state) {
1284
+ case 0:
1285
+ i = 0, len = this.entries_.length;
1286
+ $ctx.state = 12;
1287
+ break;
1288
+ case 12:
1289
+ $ctx.state = (i < len) ? 8 : -2;
1290
+ break;
1291
+ case 4:
1292
+ i += 2;
1293
+ $ctx.state = 12;
1294
+ break;
1295
+ case 8:
1296
+ key = this.entries_[i];
1297
+ value = this.entries_[i + 1];
1298
+ $ctx.state = 9;
1299
+ break;
1300
+ case 9:
1301
+ $ctx.state = (key === deletedSentinel) ? 4 : 6;
1302
+ break;
1303
+ case 6:
1304
+ $ctx.state = 2;
1305
+ return key;
1306
+ case 2:
1307
+ $ctx.maybeThrow();
1308
+ $ctx.state = 4;
1309
+ break;
1310
+ default:
1311
+ return $ctx.end();
1312
+ }
1313
+ }, $__14, this);
1314
+ }),
1315
+ values: $traceurRuntime.initGeneratorFunction(function $__15() {
1316
+ var i,
1317
+ len,
1318
+ key,
1319
+ value;
1320
+ return $traceurRuntime.createGeneratorInstance(function($ctx) {
1321
+ while (true)
1322
+ switch ($ctx.state) {
1323
+ case 0:
1324
+ i = 0, len = this.entries_.length;
1325
+ $ctx.state = 12;
1326
+ break;
1327
+ case 12:
1328
+ $ctx.state = (i < len) ? 8 : -2;
1329
+ break;
1330
+ case 4:
1331
+ i += 2;
1332
+ $ctx.state = 12;
1333
+ break;
1334
+ case 8:
1335
+ key = this.entries_[i];
1336
+ value = this.entries_[i + 1];
1337
+ $ctx.state = 9;
1338
+ break;
1339
+ case 9:
1340
+ $ctx.state = (key === deletedSentinel) ? 4 : 6;
1341
+ break;
1342
+ case 6:
1343
+ $ctx.state = 2;
1344
+ return value;
1345
+ case 2:
1346
+ $ctx.maybeThrow();
1347
+ $ctx.state = 4;
1348
+ break;
1349
+ default:
1350
+ return $ctx.end();
1351
+ }
1352
+ }, $__15, this);
1353
+ })
1354
+ }, {});
1355
+ Object.defineProperty(Map.prototype, Symbol.iterator, {
1356
+ configurable: true,
1357
+ writable: true,
1358
+ value: Map.prototype.entries
1359
+ });
1360
+ return {get Map() {
1361
+ return Map;
1362
+ }};
1363
+ });
1364
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/Object", [], function() {
1365
+ "use strict";
1366
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/Object";
1367
+ var $__16 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/utils")),
1368
+ toInteger = $__16.toInteger,
1369
+ toLength = $__16.toLength,
1370
+ toObject = $__16.toObject,
1371
+ isCallable = $__16.isCallable;
1372
+ var $__16 = $traceurRuntime.assertObject($traceurRuntime),
1373
+ defineProperty = $__16.defineProperty,
1374
+ getOwnPropertyDescriptor = $__16.getOwnPropertyDescriptor,
1375
+ getOwnPropertyNames = $__16.getOwnPropertyNames,
1376
+ keys = $__16.keys,
1377
+ privateNames = $__16.privateNames;
1378
+ function is(left, right) {
1379
+ if (left === right)
1380
+ return left !== 0 || 1 / left === 1 / right;
1381
+ return left !== left && right !== right;
1382
+ }
1383
+ function assign(target) {
1384
+ for (var i = 1; i < arguments.length; i++) {
1385
+ var source = arguments[i];
1386
+ var props = keys(source);
1387
+ var p,
1388
+ length = props.length;
1389
+ for (p = 0; p < length; p++) {
1390
+ var name = props[p];
1391
+ if (privateNames[name])
1392
+ continue;
1393
+ target[name] = source[name];
1394
+ }
1395
+ }
1396
+ return target;
1397
+ }
1398
+ function mixin(target, source) {
1399
+ var props = getOwnPropertyNames(source);
1400
+ var p,
1401
+ descriptor,
1402
+ length = props.length;
1403
+ for (p = 0; p < length; p++) {
1404
+ var name = props[p];
1405
+ if (privateNames[name])
1406
+ continue;
1407
+ descriptor = getOwnPropertyDescriptor(source, props[p]);
1408
+ defineProperty(target, props[p], descriptor);
1409
+ }
1410
+ return target;
1411
+ }
1412
+ return {
1413
+ get is() {
1414
+ return is;
1415
+ },
1416
+ get assign() {
1417
+ return assign;
1418
+ },
1419
+ get mixin() {
1420
+ return mixin;
1421
+ }
1422
+ };
1423
+ });
1424
+ System.register("traceur-runtime@0.0.44/node_modules/rsvp/lib/rsvp/asap", [], function() {
1425
+ "use strict";
1426
+ var __moduleName = "traceur-runtime@0.0.44/node_modules/rsvp/lib/rsvp/asap";
1427
+ var $__default = function asap(callback, arg) {
1428
+ var length = queue.push([callback, arg]);
1429
+ if (length === 1) {
1430
+ scheduleFlush();
1431
+ }
1432
+ };
1433
+ var browserGlobal = (typeof window !== 'undefined') ? window : {};
1434
+ var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
1435
+ function useNextTick() {
1436
+ return function() {
1437
+ process.nextTick(flush);
1438
+ };
1439
+ }
1440
+ function useMutationObserver() {
1441
+ var iterations = 0;
1442
+ var observer = new BrowserMutationObserver(flush);
1443
+ var node = document.createTextNode('');
1444
+ observer.observe(node, {characterData: true});
1445
+ return function() {
1446
+ node.data = (iterations = ++iterations % 2);
1447
+ };
1448
+ }
1449
+ function useSetTimeout() {
1450
+ return function() {
1451
+ setTimeout(flush, 1);
1452
+ };
1453
+ }
1454
+ var queue = [];
1455
+ function flush() {
1456
+ for (var i = 0; i < queue.length; i++) {
1457
+ var tuple = queue[i];
1458
+ var callback = tuple[0],
1459
+ arg = tuple[1];
1460
+ callback(arg);
1461
+ }
1462
+ queue = [];
1463
+ }
1464
+ var scheduleFlush;
1465
+ if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
1466
+ scheduleFlush = useNextTick();
1467
+ } else if (BrowserMutationObserver) {
1468
+ scheduleFlush = useMutationObserver();
1469
+ } else {
1470
+ scheduleFlush = useSetTimeout();
1471
+ }
1472
+ return {get default() {
1473
+ return $__default;
1474
+ }};
1475
+ });
1476
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/Promise", [], function() {
1477
+ "use strict";
1478
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/Promise";
1479
+ var async = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/node_modules/rsvp/lib/rsvp/asap")).default;
1480
+ var promiseRaw = {};
1481
+ function isPromise(x) {
1482
+ return x && typeof x === 'object' && x.status_ !== undefined;
1483
+ }
1484
+ function idResolveHandler(x) {
1485
+ return x;
1486
+ }
1487
+ function idRejectHandler(x) {
1488
+ throw x;
1489
+ }
1490
+ function chain(promise) {
1491
+ var onResolve = arguments[1] !== (void 0) ? arguments[1] : idResolveHandler;
1492
+ var onReject = arguments[2] !== (void 0) ? arguments[2] : idRejectHandler;
1493
+ var deferred = getDeferred(promise.constructor);
1494
+ switch (promise.status_) {
1495
+ case undefined:
1496
+ throw TypeError;
1497
+ case 0:
1498
+ promise.onResolve_.push(onResolve, deferred);
1499
+ promise.onReject_.push(onReject, deferred);
1500
+ break;
1501
+ case +1:
1502
+ promiseEnqueue(promise.value_, [onResolve, deferred]);
1503
+ break;
1504
+ case -1:
1505
+ promiseEnqueue(promise.value_, [onReject, deferred]);
1506
+ break;
1507
+ }
1508
+ return deferred.promise;
1509
+ }
1510
+ function getDeferred(C) {
1511
+ if (this === $Promise) {
1512
+ var promise = promiseInit(new $Promise(promiseRaw));
1513
+ return {
1514
+ promise: promise,
1515
+ resolve: (function(x) {
1516
+ promiseResolve(promise, x);
1517
+ }),
1518
+ reject: (function(r) {
1519
+ promiseReject(promise, r);
1520
+ })
1521
+ };
1522
+ } else {
1523
+ var result = {};
1524
+ result.promise = new C((function(resolve, reject) {
1525
+ result.resolve = resolve;
1526
+ result.reject = reject;
1527
+ }));
1528
+ return result;
1529
+ }
1530
+ }
1531
+ function promiseSet(promise, status, value, onResolve, onReject) {
1532
+ promise.status_ = status;
1533
+ promise.value_ = value;
1534
+ promise.onResolve_ = onResolve;
1535
+ promise.onReject_ = onReject;
1536
+ return promise;
1537
+ }
1538
+ function promiseInit(promise) {
1539
+ return promiseSet(promise, 0, undefined, [], []);
1540
+ }
1541
+ var Promise = function Promise(resolver) {
1542
+ if (resolver === promiseRaw)
1543
+ return;
1544
+ if (typeof resolver !== 'function')
1545
+ throw new TypeError;
1546
+ var promise = promiseInit(this);
1547
+ try {
1548
+ resolver((function(x) {
1549
+ promiseResolve(promise, x);
1550
+ }), (function(r) {
1551
+ promiseReject(promise, r);
1552
+ }));
1553
+ } catch (e) {
1554
+ promiseReject(promise, e);
1555
+ }
1556
+ };
1557
+ ($traceurRuntime.createClass)(Promise, {
1558
+ catch: function(onReject) {
1559
+ return this.then(undefined, onReject);
1560
+ },
1561
+ then: function(onResolve, onReject) {
1562
+ if (typeof onResolve !== 'function')
1563
+ onResolve = idResolveHandler;
1564
+ if (typeof onReject !== 'function')
1565
+ onReject = idRejectHandler;
1566
+ var that = this;
1567
+ var constructor = this.constructor;
1568
+ return chain(this, function(x) {
1569
+ x = promiseCoerce(constructor, x);
1570
+ return x === that ? onReject(new TypeError) : isPromise(x) ? x.then(onResolve, onReject) : onResolve(x);
1571
+ }, onReject);
1572
+ }
1573
+ }, {
1574
+ resolve: function(x) {
1575
+ if (this === $Promise) {
1576
+ return promiseSet(new $Promise(promiseRaw), +1, x);
1577
+ } else {
1578
+ return new this(function(resolve, reject) {
1579
+ resolve(x);
1580
+ });
1581
+ }
1582
+ },
1583
+ reject: function(r) {
1584
+ if (this === $Promise) {
1585
+ return promiseSet(new $Promise(promiseRaw), -1, r);
1586
+ } else {
1587
+ return new this((function(resolve, reject) {
1588
+ reject(r);
1589
+ }));
1590
+ }
1591
+ },
1592
+ cast: function(x) {
1593
+ if (x instanceof this)
1594
+ return x;
1595
+ if (isPromise(x)) {
1596
+ var result = getDeferred(this);
1597
+ chain(x, result.resolve, result.reject);
1598
+ return result.promise;
1599
+ }
1600
+ return this.resolve(x);
1601
+ },
1602
+ all: function(values) {
1603
+ var deferred = getDeferred(this);
1604
+ var resolutions = [];
1605
+ try {
1606
+ var count = values.length;
1607
+ if (count === 0) {
1608
+ deferred.resolve(resolutions);
1609
+ } else {
1610
+ for (var i = 0; i < values.length; i++) {
1611
+ this.resolve(values[i]).then(function(i, x) {
1612
+ resolutions[i] = x;
1613
+ if (--count === 0)
1614
+ deferred.resolve(resolutions);
1615
+ }.bind(undefined, i), (function(r) {
1616
+ deferred.reject(r);
1617
+ }));
1618
+ }
1619
+ }
1620
+ } catch (e) {
1621
+ deferred.reject(e);
1622
+ }
1623
+ return deferred.promise;
1624
+ },
1625
+ race: function(values) {
1626
+ var deferred = getDeferred(this);
1627
+ try {
1628
+ for (var i = 0; i < values.length; i++) {
1629
+ this.resolve(values[i]).then((function(x) {
1630
+ deferred.resolve(x);
1631
+ }), (function(r) {
1632
+ deferred.reject(r);
1633
+ }));
1634
+ }
1635
+ } catch (e) {
1636
+ deferred.reject(e);
1637
+ }
1638
+ return deferred.promise;
1639
+ }
1640
+ });
1641
+ var $Promise = Promise;
1642
+ var $PromiseReject = $Promise.reject;
1643
+ function promiseResolve(promise, x) {
1644
+ promiseDone(promise, +1, x, promise.onResolve_);
1645
+ }
1646
+ function promiseReject(promise, r) {
1647
+ promiseDone(promise, -1, r, promise.onReject_);
1648
+ }
1649
+ function promiseDone(promise, status, value, reactions) {
1650
+ if (promise.status_ !== 0)
1651
+ return;
1652
+ promiseEnqueue(value, reactions);
1653
+ promiseSet(promise, status, value);
1654
+ }
1655
+ function promiseEnqueue(value, tasks) {
1656
+ async((function() {
1657
+ for (var i = 0; i < tasks.length; i += 2) {
1658
+ promiseHandle(value, tasks[i], tasks[i + 1]);
1659
+ }
1660
+ }));
1661
+ }
1662
+ function promiseHandle(value, handler, deferred) {
1663
+ try {
1664
+ var result = handler(value);
1665
+ if (result === deferred.promise)
1666
+ throw new TypeError;
1667
+ else if (isPromise(result))
1668
+ chain(result, deferred.resolve, deferred.reject);
1669
+ else
1670
+ deferred.resolve(result);
1671
+ } catch (e) {
1672
+ try {
1673
+ deferred.reject(e);
1674
+ } catch (e) {}
1675
+ }
1676
+ }
1677
+ var thenableSymbol = '@@thenable';
1678
+ function isObject(x) {
1679
+ return x && (typeof x === 'object' || typeof x === 'function');
1680
+ }
1681
+ function promiseCoerce(constructor, x) {
1682
+ if (!isPromise(x) && isObject(x)) {
1683
+ var then;
1684
+ try {
1685
+ then = x.then;
1686
+ } catch (r) {
1687
+ var promise = $PromiseReject.call(constructor, r);
1688
+ x[thenableSymbol] = promise;
1689
+ return promise;
1690
+ }
1691
+ if (typeof then === 'function') {
1692
+ var p = x[thenableSymbol];
1693
+ if (p) {
1694
+ return p;
1695
+ } else {
1696
+ var deferred = getDeferred(constructor);
1697
+ x[thenableSymbol] = deferred.promise;
1698
+ try {
1699
+ then.call(x, deferred.resolve, deferred.reject);
1700
+ } catch (r) {
1701
+ deferred.reject(r);
1702
+ }
1703
+ return deferred.promise;
1704
+ }
1705
+ }
1706
+ }
1707
+ return x;
1708
+ }
1709
+ return {get Promise() {
1710
+ return Promise;
1711
+ }};
1712
+ });
1713
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/Set", [], function() {
1714
+ "use strict";
1715
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/Set";
1716
+ var isObject = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/utils")).isObject;
1717
+ var Map = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/Map")).Map;
1718
+ var getOwnHashObject = $traceurRuntime.getOwnHashObject;
1719
+ var $hasOwnProperty = Object.prototype.hasOwnProperty;
1720
+ function initSet(set) {
1721
+ set.map_ = new Map();
1722
+ }
1723
+ var Set = function Set() {
1724
+ var iterable = arguments[0];
1725
+ if (!isObject(this))
1726
+ throw new TypeError('Set called on incompatible type');
1727
+ if ($hasOwnProperty.call(this, 'map_')) {
1728
+ throw new TypeError('Set can not be reentrantly initialised');
1729
+ }
1730
+ initSet(this);
1731
+ if (iterable !== null && iterable !== undefined) {
1732
+ for (var $__21 = iterable[Symbol.iterator](),
1733
+ $__22; !($__22 = $__21.next()).done; ) {
1734
+ var item = $__22.value;
1735
+ {
1736
+ this.add(item);
1737
+ }
1738
+ }
1739
+ }
1740
+ };
1741
+ ($traceurRuntime.createClass)(Set, {
1742
+ get size() {
1743
+ return this.map_.size;
1744
+ },
1745
+ has: function(key) {
1746
+ return this.map_.has(key);
1747
+ },
1748
+ add: function(key) {
1749
+ return this.map_.set(key, true);
1750
+ },
1751
+ delete: function(key) {
1752
+ return this.map_.delete(key);
1753
+ },
1754
+ clear: function() {
1755
+ return this.map_.clear();
1756
+ },
1757
+ forEach: function(callbackFn) {
1758
+ var thisArg = arguments[1];
1759
+ var $__19 = this;
1760
+ return this.map_.forEach((function(value, key) {
1761
+ callbackFn.call(thisArg, key, key, $__19);
1762
+ }));
1763
+ },
1764
+ values: $traceurRuntime.initGeneratorFunction(function $__24() {
1765
+ var $__25,
1766
+ $__26;
1767
+ return $traceurRuntime.createGeneratorInstance(function($ctx) {
1768
+ while (true)
1769
+ switch ($ctx.state) {
1770
+ case 0:
1771
+ $__25 = this.map_.keys()[Symbol.iterator]();
1772
+ $ctx.sent = void 0;
1773
+ $ctx.action = 'next';
1774
+ $ctx.state = 12;
1775
+ break;
1776
+ case 12:
1777
+ $__26 = $__25[$ctx.action]($ctx.sentIgnoreThrow);
1778
+ $ctx.state = 9;
1779
+ break;
1780
+ case 9:
1781
+ $ctx.state = ($__26.done) ? 3 : 2;
1782
+ break;
1783
+ case 3:
1784
+ $ctx.sent = $__26.value;
1785
+ $ctx.state = -2;
1786
+ break;
1787
+ case 2:
1788
+ $ctx.state = 12;
1789
+ return $__26.value;
1790
+ default:
1791
+ return $ctx.end();
1792
+ }
1793
+ }, $__24, this);
1794
+ }),
1795
+ keys: $traceurRuntime.initGeneratorFunction(function $__27() {
1796
+ var $__28,
1797
+ $__29;
1798
+ return $traceurRuntime.createGeneratorInstance(function($ctx) {
1799
+ while (true)
1800
+ switch ($ctx.state) {
1801
+ case 0:
1802
+ $__28 = this.map_.keys()[Symbol.iterator]();
1803
+ $ctx.sent = void 0;
1804
+ $ctx.action = 'next';
1805
+ $ctx.state = 12;
1806
+ break;
1807
+ case 12:
1808
+ $__29 = $__28[$ctx.action]($ctx.sentIgnoreThrow);
1809
+ $ctx.state = 9;
1810
+ break;
1811
+ case 9:
1812
+ $ctx.state = ($__29.done) ? 3 : 2;
1813
+ break;
1814
+ case 3:
1815
+ $ctx.sent = $__29.value;
1816
+ $ctx.state = -2;
1817
+ break;
1818
+ case 2:
1819
+ $ctx.state = 12;
1820
+ return $__29.value;
1821
+ default:
1822
+ return $ctx.end();
1823
+ }
1824
+ }, $__27, this);
1825
+ })
1826
+ }, {});
1827
+ Object.defineProperty(Set.prototype, Symbol.iterator, {
1828
+ configurable: true,
1829
+ writable: true,
1830
+ value: Set.prototype.values
1831
+ });
1832
+ return {get Set() {
1833
+ return Set;
1834
+ }};
1835
+ });
1836
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/String", [], function() {
1837
+ "use strict";
1838
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/String";
1839
+ var $toString = Object.prototype.toString;
1840
+ var $indexOf = String.prototype.indexOf;
1841
+ var $lastIndexOf = String.prototype.lastIndexOf;
1842
+ function startsWith(search) {
1843
+ var string = String(this);
1844
+ if (this == null || $toString.call(search) == '[object RegExp]') {
1845
+ throw TypeError();
1846
+ }
1847
+ var stringLength = string.length;
1848
+ var searchString = String(search);
1849
+ var searchLength = searchString.length;
1850
+ var position = arguments.length > 1 ? arguments[1] : undefined;
1851
+ var pos = position ? Number(position) : 0;
1852
+ if (isNaN(pos)) {
1853
+ pos = 0;
1854
+ }
1855
+ var start = Math.min(Math.max(pos, 0), stringLength);
1856
+ return $indexOf.call(string, searchString, pos) == start;
1857
+ }
1858
+ function endsWith(search) {
1859
+ var string = String(this);
1860
+ if (this == null || $toString.call(search) == '[object RegExp]') {
1861
+ throw TypeError();
1862
+ }
1863
+ var stringLength = string.length;
1864
+ var searchString = String(search);
1865
+ var searchLength = searchString.length;
1866
+ var pos = stringLength;
1867
+ if (arguments.length > 1) {
1868
+ var position = arguments[1];
1869
+ if (position !== undefined) {
1870
+ pos = position ? Number(position) : 0;
1871
+ if (isNaN(pos)) {
1872
+ pos = 0;
1873
+ }
1874
+ }
1875
+ }
1876
+ var end = Math.min(Math.max(pos, 0), stringLength);
1877
+ var start = end - searchLength;
1878
+ if (start < 0) {
1879
+ return false;
1880
+ }
1881
+ return $lastIndexOf.call(string, searchString, start) == start;
1882
+ }
1883
+ function contains(search) {
1884
+ if (this == null) {
1885
+ throw TypeError();
1886
+ }
1887
+ var string = String(this);
1888
+ var stringLength = string.length;
1889
+ var searchString = String(search);
1890
+ var searchLength = searchString.length;
1891
+ var position = arguments.length > 1 ? arguments[1] : undefined;
1892
+ var pos = position ? Number(position) : 0;
1893
+ if (isNaN(pos)) {
1894
+ pos = 0;
1895
+ }
1896
+ var start = Math.min(Math.max(pos, 0), stringLength);
1897
+ return $indexOf.call(string, searchString, pos) != -1;
1898
+ }
1899
+ function repeat(count) {
1900
+ if (this == null) {
1901
+ throw TypeError();
1902
+ }
1903
+ var string = String(this);
1904
+ var n = count ? Number(count) : 0;
1905
+ if (isNaN(n)) {
1906
+ n = 0;
1907
+ }
1908
+ if (n < 0 || n == Infinity) {
1909
+ throw RangeError();
1910
+ }
1911
+ if (n == 0) {
1912
+ return '';
1913
+ }
1914
+ var result = '';
1915
+ while (n--) {
1916
+ result += string;
1917
+ }
1918
+ return result;
1919
+ }
1920
+ function codePointAt(position) {
1921
+ if (this == null) {
1922
+ throw TypeError();
1923
+ }
1924
+ var string = String(this);
1925
+ var size = string.length;
1926
+ var index = position ? Number(position) : 0;
1927
+ if (isNaN(index)) {
1928
+ index = 0;
1929
+ }
1930
+ if (index < 0 || index >= size) {
1931
+ return undefined;
1932
+ }
1933
+ var first = string.charCodeAt(index);
1934
+ var second;
1935
+ if (first >= 0xD800 && first <= 0xDBFF && size > index + 1) {
1936
+ second = string.charCodeAt(index + 1);
1937
+ if (second >= 0xDC00 && second <= 0xDFFF) {
1938
+ return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
1939
+ }
1940
+ }
1941
+ return first;
1942
+ }
1943
+ function raw(callsite) {
1944
+ var raw = callsite.raw;
1945
+ var len = raw.length >>> 0;
1946
+ if (len === 0)
1947
+ return '';
1948
+ var s = '';
1949
+ var i = 0;
1950
+ while (true) {
1951
+ s += raw[i];
1952
+ if (i + 1 === len)
1953
+ return s;
1954
+ s += arguments[++i];
1955
+ }
1956
+ }
1957
+ function fromCodePoint() {
1958
+ var codeUnits = [];
1959
+ var floor = Math.floor;
1960
+ var highSurrogate;
1961
+ var lowSurrogate;
1962
+ var index = -1;
1963
+ var length = arguments.length;
1964
+ if (!length) {
1965
+ return '';
1966
+ }
1967
+ while (++index < length) {
1968
+ var codePoint = Number(arguments[index]);
1969
+ if (!isFinite(codePoint) || codePoint < 0 || codePoint > 0x10FFFF || floor(codePoint) != codePoint) {
1970
+ throw RangeError('Invalid code point: ' + codePoint);
1971
+ }
1972
+ if (codePoint <= 0xFFFF) {
1973
+ codeUnits.push(codePoint);
1974
+ } else {
1975
+ codePoint -= 0x10000;
1976
+ highSurrogate = (codePoint >> 10) + 0xD800;
1977
+ lowSurrogate = (codePoint % 0x400) + 0xDC00;
1978
+ codeUnits.push(highSurrogate, lowSurrogate);
1979
+ }
1980
+ }
1981
+ return String.fromCharCode.apply(null, codeUnits);
1982
+ }
1983
+ return {
1984
+ get startsWith() {
1985
+ return startsWith;
1986
+ },
1987
+ get endsWith() {
1988
+ return endsWith;
1989
+ },
1990
+ get contains() {
1991
+ return contains;
1992
+ },
1993
+ get repeat() {
1994
+ return repeat;
1995
+ },
1996
+ get codePointAt() {
1997
+ return codePointAt;
1998
+ },
1999
+ get raw() {
2000
+ return raw;
2001
+ },
2002
+ get fromCodePoint() {
2003
+ return fromCodePoint;
2004
+ }
2005
+ };
2006
+ });
2007
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfills/polyfills", [], function() {
2008
+ "use strict";
2009
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfills/polyfills";
2010
+ var Map = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/Map")).Map;
2011
+ var Set = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/Set")).Set;
2012
+ var Promise = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/Promise")).Promise;
2013
+ var $__30 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/String")),
2014
+ codePointAt = $__30.codePointAt,
2015
+ contains = $__30.contains,
2016
+ endsWith = $__30.endsWith,
2017
+ fromCodePoint = $__30.fromCodePoint,
2018
+ repeat = $__30.repeat,
2019
+ raw = $__30.raw,
2020
+ startsWith = $__30.startsWith;
2021
+ var $__30 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/Array")),
2022
+ fill = $__30.fill,
2023
+ find = $__30.find,
2024
+ findIndex = $__30.findIndex,
2025
+ from = $__30.from;
2026
+ var $__30 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/ArrayIterator")),
2027
+ entries = $__30.entries,
2028
+ keys = $__30.keys,
2029
+ values = $__30.values;
2030
+ var $__30 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/Object")),
2031
+ assign = $__30.assign,
2032
+ is = $__30.is,
2033
+ mixin = $__30.mixin;
2034
+ function maybeDefineMethod(object, name, value) {
2035
+ if (!(name in object)) {
2036
+ Object.defineProperty(object, name, {
2037
+ value: value,
2038
+ configurable: true,
2039
+ enumerable: false,
2040
+ writable: true
2041
+ });
2042
+ }
2043
+ }
2044
+ function maybeAddFunctions(object, functions) {
2045
+ for (var i = 0; i < functions.length; i += 2) {
2046
+ var name = functions[i];
2047
+ var value = functions[i + 1];
2048
+ maybeDefineMethod(object, name, value);
2049
+ }
2050
+ }
2051
+ function polyfillPromise(global) {
2052
+ if (!global.Promise)
2053
+ global.Promise = Promise;
2054
+ }
2055
+ function polyfillCollections(global) {
2056
+ if (!global.Map)
2057
+ global.Map = Map;
2058
+ if (!global.Set)
2059
+ global.Set = Set;
2060
+ }
2061
+ function polyfillString(String) {
2062
+ maybeAddFunctions(String.prototype, ['codePointAt', codePointAt, 'contains', contains, 'endsWith', endsWith, 'startsWith', startsWith, 'repeat', repeat]);
2063
+ maybeAddFunctions(String, ['fromCodePoint', fromCodePoint, 'raw', raw]);
2064
+ }
2065
+ function polyfillArray(Array, Symbol) {
2066
+ maybeAddFunctions(Array.prototype, ['entries', entries, 'keys', keys, 'values', values, 'fill', fill, 'find', find, 'findIndex', findIndex]);
2067
+ maybeAddFunctions(Array, ['from', from]);
2068
+ if (Symbol && Symbol.iterator) {
2069
+ Object.defineProperty(Array.prototype, Symbol.iterator, {
2070
+ value: values,
2071
+ configurable: true,
2072
+ enumerable: false,
2073
+ writable: true
2074
+ });
2075
+ }
2076
+ }
2077
+ function polyfillObject(Object) {
2078
+ maybeAddFunctions(Object, ['assign', assign, 'is', is, 'mixin', mixin]);
2079
+ }
2080
+ function polyfill(global) {
2081
+ polyfillPromise(global);
2082
+ polyfillCollections(global);
2083
+ polyfillString(global.String);
2084
+ polyfillArray(global.Array, global.Symbol);
2085
+ polyfillObject(global.Object);
2086
+ }
2087
+ polyfill(this);
2088
+ var setupGlobals = $traceurRuntime.setupGlobals;
2089
+ $traceurRuntime.setupGlobals = function(global) {
2090
+ setupGlobals(global);
2091
+ polyfill(global);
2092
+ };
2093
+ return {};
2094
+ });
2095
+ System.register("traceur-runtime@0.0.44/src/runtime/polyfill-import", [], function() {
2096
+ "use strict";
2097
+ var __moduleName = "traceur-runtime@0.0.44/src/runtime/polyfill-import";
2098
+ var $__32 = $traceurRuntime.assertObject(System.get("traceur-runtime@0.0.44/src/runtime/polyfills/polyfills"));
2099
+ return {};
2100
+ });
2101
+ System.get("traceur-runtime@0.0.44/src/runtime/polyfill-import" + '');