@macallumharvey/first-test-wet 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (362) hide show
  1. package/dist/first-test-wet.cjs.development.js.map +1 -1
  2. package/dist/first-test-wet.cjs.production.min.js.map +1 -1
  3. package/dist/first-test-wet.esm.js.map +1 -1
  4. package/package.json +1 -1
  5. package/src/WetModal.tsx +1 -0
  6. package/src/theme-wet-boew/assets/favicon-mobile.png +0 -0
  7. package/src/theme-wet-boew/assets/favicon.ico +0 -0
  8. package/src/theme-wet-boew/assets/logo.png +0 -0
  9. package/src/theme-wet-boew/assets/logo.svg +14 -0
  10. package/src/theme-wet-boew/css/ie8-theme.css +17370 -0
  11. package/src/theme-wet-boew/css/ie8-theme.min.css +193 -0
  12. package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.js → theme-wet-boew/css/ie8-wet-boew.css} +12 -10
  13. package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.min.js → theme-wet-boew/css/ie8-wet-boew.min.css} +7 -7
  14. package/src/theme-wet-boew/css/theme.css +11357 -0
  15. package/src/theme-wet-boew/css/theme.min.css +6 -0
  16. package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.js → theme-wet-boew/css/wet-boew.css} +12 -10
  17. package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.min.js → theme-wet-boew/css/wet-boew.min.css} +6 -7
  18. package/src/theme-wet-boew/payload.json +66 -0
  19. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/mediacontrols.html +32 -33
  20. package/src/wet-boew/assets/sprites_share.png +0 -0
  21. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/noscript.css +112 -112
  22. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/noscript.min.css +5 -5
  23. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datalist.css +32 -32
  24. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datepicker.css +47 -47
  25. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/details.css +28 -28
  26. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/mathml.css +16 -16
  27. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/meter.css +24 -24
  28. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/progress.css +8 -8
  29. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/slider.css +229 -229
  30. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.svg +287 -287
  31. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/additional-methods.js +1511 -1511
  32. package/src/wet-boew/js/deps/additional-methods.min.js +9 -0
  33. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/geomap-lib.js +3758 -3770
  34. package/src/wet-boew/js/deps/geomap-lib.min.js +1 -0
  35. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.dataTables.js +15345 -15733
  36. package/src/wet-boew/js/deps/jquery.dataTables.min.js +4 -0
  37. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.canvas.js +345 -345
  38. package/src/wet-boew/js/deps/jquery.flot.canvas.min.js +1 -0
  39. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.js +3168 -3168
  40. package/src/wet-boew/js/deps/jquery.flot.min.js +1 -0
  41. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.orderBars.js +282 -282
  42. package/src/wet-boew/js/deps/jquery.flot.orderBars.min.js +1 -0
  43. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.pie.js +820 -820
  44. package/src/wet-boew/js/deps/jquery.flot.pie.min.js +1 -0
  45. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.magnific-popup.js +2060 -2060
  46. package/src/wet-boew/js/deps/jquery.magnific-popup.min.js +4 -0
  47. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.validate.js +1660 -1660
  48. package/src/wet-boew/js/deps/jquery.validate.min.js +9 -0
  49. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/json-patch.js +314 -314
  50. package/src/wet-boew/js/deps/json-patch.min.js +1 -0
  51. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jsonpointer.js +349 -349
  52. package/src/wet-boew/js/deps/jsonpointer.min.js +1 -0
  53. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-apollo.js +53 -53
  54. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-basic.js +49 -49
  55. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-clj.js +64 -64
  56. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-css.js +160 -160
  57. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-dart.js +92 -92
  58. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-erlang.js +94 -94
  59. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-go.js +59 -59
  60. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-hs.js +102 -102
  61. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lasso.js +67 -67
  62. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lisp.js +95 -95
  63. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-llvm.js +63 -63
  64. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-logtalk.js +50 -50
  65. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lua.js +60 -60
  66. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-matlab.js +183 -183
  67. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-matlab.min.js +1 -1
  68. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-ml.js +57 -57
  69. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-mumps.js +140 -140
  70. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-n.js +67 -67
  71. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-pascal.js +49 -49
  72. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-proto.js +37 -37
  73. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-r.js +59 -59
  74. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rd.js +50 -50
  75. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rust.js +81 -81
  76. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-scala.js +56 -56
  77. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-sql.js +59 -59
  78. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-swift.js +60 -60
  79. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tcl.js +63 -63
  80. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tex.js +49 -49
  81. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vb.js +67 -67
  82. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vhdl.js +51 -51
  83. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-wiki.js +55 -55
  84. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-xq.js +71 -71
  85. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-yaml.js +45 -45
  86. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/ol.js +1008 -1008
  87. package/src/wet-boew/js/deps/ol.min.js +1 -0
  88. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/prettify.js +1742 -1742
  89. package/src/wet-boew/js/deps/prettify.min.js +1 -0
  90. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/proj4.js +2 -2
  91. package/src/wet-boew/js/deps/proj4.min.js +1 -0
  92. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/run_prettify.js +1998 -1998
  93. package/src/wet-boew/js/deps/run_prettify.min.js +1 -0
  94. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/tableparser.js +2216 -2216
  95. package/src/wet-boew/js/deps/tableparser.min.js +1 -0
  96. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/unorm.js +452 -452
  97. package/src/wet-boew/js/deps/unorm.min.js +1 -0
  98. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/af.js +246 -254
  99. package/src/wet-boew/js/i18n/af.min.js +7 -0
  100. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ar.js +284 -292
  101. package/src/wet-boew/js/i18n/ar.min.js +7 -0
  102. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/bg.js +284 -292
  103. package/src/wet-boew/js/i18n/bg.min.js +7 -0
  104. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/cs.js +285 -293
  105. package/src/wet-boew/js/i18n/cs.min.js +7 -0
  106. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/de.js +354 -362
  107. package/src/wet-boew/js/i18n/de.min.js +7 -0
  108. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/el.js +284 -292
  109. package/src/wet-boew/js/i18n/el.min.js +7 -0
  110. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/en.js +246 -254
  111. package/src/wet-boew/js/i18n/en.min.js +7 -0
  112. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/es.js +287 -295
  113. package/src/wet-boew/js/i18n/es.min.js +7 -0
  114. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/et.js +282 -290
  115. package/src/wet-boew/js/i18n/et.min.js +7 -0
  116. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/fr.js +313 -321
  117. package/src/wet-boew/js/i18n/fr.min.js +7 -0
  118. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hi.js +246 -254
  119. package/src/wet-boew/js/i18n/hi.min.js +7 -0
  120. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hu.js +284 -292
  121. package/src/wet-boew/js/i18n/hu.min.js +7 -0
  122. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hy.js +246 -254
  123. package/src/wet-boew/js/i18n/hy.min.js +7 -0
  124. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/id.js +283 -291
  125. package/src/wet-boew/js/i18n/id.min.js +7 -0
  126. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/is.js +282 -290
  127. package/src/wet-boew/js/i18n/is.min.js +7 -0
  128. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/it.js +311 -319
  129. package/src/wet-boew/js/i18n/it.min.js +7 -0
  130. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/iu.js +246 -254
  131. package/src/wet-boew/js/i18n/iu.min.js +7 -0
  132. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ja.js +285 -293
  133. package/src/wet-boew/js/i18n/ja.min.js +7 -0
  134. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ko.js +284 -292
  135. package/src/wet-boew/js/i18n/ko.min.js +7 -0
  136. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/lt.js +284 -292
  137. package/src/wet-boew/js/i18n/lt.min.js +7 -0
  138. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/lv.js +284 -292
  139. package/src/wet-boew/js/i18n/lv.min.js +7 -0
  140. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/nl.js +318 -326
  141. package/src/wet-boew/js/i18n/nl.min.js +7 -0
  142. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pl.js +287 -295
  143. package/src/wet-boew/js/i18n/pl.min.js +7 -0
  144. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pt-BR.js +246 -254
  145. package/src/wet-boew/js/i18n/pt-BR.min.js +7 -0
  146. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pt.js +270 -278
  147. package/src/wet-boew/js/i18n/pt.min.js +7 -0
  148. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ru.js +284 -292
  149. package/src/wet-boew/js/i18n/ru.min.js +7 -0
  150. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/sk.js +282 -290
  151. package/src/wet-boew/js/i18n/sk.min.js +7 -0
  152. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/sq.js +246 -254
  153. package/src/wet-boew/js/i18n/sq.min.js +7 -0
  154. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/th.js +284 -292
  155. package/src/wet-boew/js/i18n/th.min.js +7 -0
  156. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/tr.js +286 -294
  157. package/src/wet-boew/js/i18n/tr.min.js +7 -0
  158. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/uk.js +284 -292
  159. package/src/wet-boew/js/i18n/uk.min.js +7 -0
  160. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/vi.js +284 -292
  161. package/src/wet-boew/js/i18n/vi.min.js +7 -0
  162. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/zh-Hans.js +246 -254
  163. package/src/wet-boew/js/i18n/zh-Hans.min.js +7 -0
  164. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/zh.js +285 -293
  165. package/src/wet-boew/js/i18n/zh.min.js +7 -0
  166. package/src/wet-boew/js/ie8-wet-boew.js +3992 -0
  167. package/src/wet-boew/js/ie8-wet-boew.min.js +7 -0
  168. package/src/wet-boew/js/ie8-wet-boew2.js +15294 -0
  169. package/src/wet-boew/js/ie8-wet-boew2.min.js +7 -0
  170. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.js +9814 -9814
  171. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.min.js +4 -4
  172. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist.js +423 -419
  173. package/src/wet-boew/js/polyfills/datalist.min.js +8 -0
  174. package/src/wet-boew/js/polyfills/datalist.min.js.map +1 -0
  175. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist_dynamic.js +50 -50
  176. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist_dynamic.min.js +7 -7
  177. package/src/wet-boew/js/polyfills/datalist_dynamic.min.js.map +1 -0
  178. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datepicker.js +338 -338
  179. package/src/wet-boew/js/polyfills/datepicker.min.js +8 -0
  180. package/src/wet-boew/js/polyfills/datepicker.min.js.map +1 -0
  181. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/details.js +126 -126
  182. package/src/wet-boew/js/polyfills/details.min.js +8 -0
  183. package/src/wet-boew/js/polyfills/details.min.js.map +1 -0
  184. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/jawsariafixes.js +47 -47
  185. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/jawsariafixes.min.js +15 -15
  186. package/src/wet-boew/js/polyfills/jawsariafixes.min.js.map +1 -0
  187. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/meter.js +140 -140
  188. package/src/wet-boew/js/polyfills/meter.min.js +8 -0
  189. package/src/wet-boew/js/polyfills/meter.min.js.map +1 -0
  190. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/mobile.js +783 -784
  191. package/src/wet-boew/js/polyfills/mobile.min.js +8 -0
  192. package/src/wet-boew/js/polyfills/mobile.min.js.map +1 -0
  193. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/progress.js +107 -107
  194. package/src/wet-boew/js/polyfills/progress.min.js +8 -0
  195. package/src/wet-boew/js/polyfills/progress.min.js.map +1 -0
  196. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider.js +1343 -1343
  197. package/src/wet-boew/js/polyfills/slider.min.js +9 -0
  198. package/src/wet-boew/js/polyfills/slider.min.js.map +1 -0
  199. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider_wrapper.js +73 -73
  200. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider_wrapper.min.js +7 -7
  201. package/src/wet-boew/js/polyfills/slider_wrapper.min.js.map +1 -0
  202. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/svg.js +29 -29
  203. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/svg.min.js +7 -7
  204. package/src/wet-boew/js/polyfills/svg.min.js.map +1 -0
  205. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/test.js +603 -603
  206. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/test.min.js +7 -7
  207. package/src/wet-boew/js/polyfills/test.min.js.map +1 -0
  208. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/wet-boew.js +17714 -20264
  209. package/src/wet-boew/js/wet-boew.min.js +9 -0
  210. package/src/wet-boew/js/wet-boew.min.js.map +1 -0
  211. package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/payload.json +1721 -1721
  212. package/src/wet-boew-cdn-4.0.81.1/Licence-fr.txt +0 -1
  213. package/src/wet-boew-cdn-4.0.81.1/License-en.txt +0 -1
  214. package/src/wet-boew-cdn-4.0.81.1/assets/sprites_share.png +0 -0
  215. package/src/wet-boew-cdn-4.0.81.1/js/deps/additional-methods.min.js +0 -9
  216. package/src/wet-boew-cdn-4.0.81.1/js/deps/geomap-lib.min.js +0 -1
  217. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.dataTables.min.js +0 -4
  218. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.canvas.min.js +0 -1
  219. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.min.js +0 -1
  220. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.orderBars.min.js +0 -1
  221. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.pie.min.js +0 -1
  222. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.magnific-popup.min.js +0 -4
  223. package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.validate.min.js +0 -9
  224. package/src/wet-boew-cdn-4.0.81.1/js/deps/json-patch.min.js +0 -1
  225. package/src/wet-boew-cdn-4.0.81.1/js/deps/jsonpointer.min.js +0 -1
  226. package/src/wet-boew-cdn-4.0.81.1/js/deps/ol.min.js +0 -1
  227. package/src/wet-boew-cdn-4.0.81.1/js/deps/prettify.min.js +0 -1
  228. package/src/wet-boew-cdn-4.0.81.1/js/deps/proj4.min.js +0 -1
  229. package/src/wet-boew-cdn-4.0.81.1/js/deps/run_prettify.min.js +0 -1
  230. package/src/wet-boew-cdn-4.0.81.1/js/deps/tableparser.min.js +0 -1
  231. package/src/wet-boew-cdn-4.0.81.1/js/deps/unorm.min.js +0 -1
  232. package/src/wet-boew-cdn-4.0.81.1/js/i18n/af.min.js +0 -7
  233. package/src/wet-boew-cdn-4.0.81.1/js/i18n/ar.min.js +0 -7
  234. package/src/wet-boew-cdn-4.0.81.1/js/i18n/bg.min.js +0 -7
  235. package/src/wet-boew-cdn-4.0.81.1/js/i18n/cs.min.js +0 -7
  236. package/src/wet-boew-cdn-4.0.81.1/js/i18n/de.min.js +0 -7
  237. package/src/wet-boew-cdn-4.0.81.1/js/i18n/el.min.js +0 -7
  238. package/src/wet-boew-cdn-4.0.81.1/js/i18n/en.min.js +0 -7
  239. package/src/wet-boew-cdn-4.0.81.1/js/i18n/es.min.js +0 -7
  240. package/src/wet-boew-cdn-4.0.81.1/js/i18n/et.min.js +0 -7
  241. package/src/wet-boew-cdn-4.0.81.1/js/i18n/fr.min.js +0 -7
  242. package/src/wet-boew-cdn-4.0.81.1/js/i18n/hi.min.js +0 -7
  243. package/src/wet-boew-cdn-4.0.81.1/js/i18n/hu.min.js +0 -7
  244. package/src/wet-boew-cdn-4.0.81.1/js/i18n/hy.min.js +0 -7
  245. package/src/wet-boew-cdn-4.0.81.1/js/i18n/id.min.js +0 -7
  246. package/src/wet-boew-cdn-4.0.81.1/js/i18n/is.min.js +0 -7
  247. package/src/wet-boew-cdn-4.0.81.1/js/i18n/it.min.js +0 -7
  248. package/src/wet-boew-cdn-4.0.81.1/js/i18n/iu.min.js +0 -7
  249. package/src/wet-boew-cdn-4.0.81.1/js/i18n/ja.min.js +0 -7
  250. package/src/wet-boew-cdn-4.0.81.1/js/i18n/ko.min.js +0 -7
  251. package/src/wet-boew-cdn-4.0.81.1/js/i18n/lt.min.js +0 -7
  252. package/src/wet-boew-cdn-4.0.81.1/js/i18n/lv.min.js +0 -7
  253. package/src/wet-boew-cdn-4.0.81.1/js/i18n/nl.min.js +0 -7
  254. package/src/wet-boew-cdn-4.0.81.1/js/i18n/pl.min.js +0 -7
  255. package/src/wet-boew-cdn-4.0.81.1/js/i18n/pt-BR.min.js +0 -7
  256. package/src/wet-boew-cdn-4.0.81.1/js/i18n/pt.min.js +0 -7
  257. package/src/wet-boew-cdn-4.0.81.1/js/i18n/ru.min.js +0 -7
  258. package/src/wet-boew-cdn-4.0.81.1/js/i18n/sk.min.js +0 -7
  259. package/src/wet-boew-cdn-4.0.81.1/js/i18n/sq.min.js +0 -7
  260. package/src/wet-boew-cdn-4.0.81.1/js/i18n/th.min.js +0 -7
  261. package/src/wet-boew-cdn-4.0.81.1/js/i18n/tr.min.js +0 -7
  262. package/src/wet-boew-cdn-4.0.81.1/js/i18n/uk.min.js +0 -7
  263. package/src/wet-boew-cdn-4.0.81.1/js/i18n/vi.min.js +0 -7
  264. package/src/wet-boew-cdn-4.0.81.1/js/i18n/zh-Hans.min.js +0 -7
  265. package/src/wet-boew-cdn-4.0.81.1/js/i18n/zh.min.js +0 -7
  266. package/src/wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.min.js.map +0 -1
  267. package/src/wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.min.js.map +0 -1
  268. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist.min.js +0 -8
  269. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist.min.js.map +0 -1
  270. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist_dynamic.min.js.map +0 -1
  271. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datepicker.min.js +0 -8
  272. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datepicker.min.js.map +0 -1
  273. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/details.min.js +0 -8
  274. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/details.min.js.map +0 -1
  275. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/jawsariafixes.min.js.map +0 -1
  276. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/meter.min.js +0 -8
  277. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/meter.min.js.map +0 -1
  278. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/mobile.min.js +0 -8
  279. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/mobile.min.js.map +0 -1
  280. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/progress.min.js +0 -8
  281. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/progress.min.js.map +0 -1
  282. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider.min.js +0 -9
  283. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider.min.js.map +0 -1
  284. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider_wrapper.min.js.map +0 -1
  285. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/svg.min.js.map +0 -1
  286. package/src/wet-boew-cdn-4.0.81.1/js/polyfills/test.min.js.map +0 -1
  287. package/src/wet-boew-cdn-4.0.81.1/js/wet-boew.min.js +0 -9
  288. package/src/wet-boew-cdn-4.0.81.1/js/wet-boew.min.js.map +0 -1
  289. package/src/wet-boew-cdn-4.0.81.1/package.json +0 -15
  290. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/cloud-popup-relative.png +0 -0
  291. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/fd-slider-sprite.png +0 -0
  292. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/loading.png +0 -0
  293. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-minus-mini.png +0 -0
  294. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-plus-mini.png +0 -0
  295. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-world-mini.png +0 -0
  296. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datalist.min.css +0 -0
  297. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datepicker.min.css +0 -0
  298. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/details.min.css +0 -0
  299. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/mathml.min.css +0 -0
  300. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/meter.min.css +0 -0
  301. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/progress.min.css +0 -0
  302. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/slider.min.css +0 -0
  303. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.eot +0 -0
  304. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.ttf +0 -0
  305. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.woff +0 -0
  306. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.woff2 +0 -0
  307. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/mml-chtml.js +0 -0
  308. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
  309. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
  310. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
  311. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
  312. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
  313. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
  314. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
  315. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
  316. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
  317. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
  318. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
  319. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
  320. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
  321. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
  322. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
  323. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
  324. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
  325. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
  326. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
  327. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
  328. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
  329. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
  330. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
  331. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-apollo.min.js +0 -0
  332. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-basic.min.js +0 -0
  333. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-clj.min.js +0 -0
  334. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-css.min.js +0 -0
  335. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-dart.min.js +0 -0
  336. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-erlang.min.js +0 -0
  337. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-go.min.js +0 -0
  338. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-hs.min.js +0 -0
  339. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lasso.min.js +0 -0
  340. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lisp.min.js +0 -0
  341. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-llvm.min.js +0 -0
  342. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-logtalk.min.js +0 -0
  343. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lua.min.js +0 -0
  344. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-ml.min.js +0 -0
  345. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-mumps.min.js +0 -0
  346. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-n.min.js +0 -0
  347. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-pascal.min.js +0 -0
  348. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-proto.min.js +0 -0
  349. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-r.min.js +0 -0
  350. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rd.min.js +0 -0
  351. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rust.min.js +0 -0
  352. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-scala.min.js +0 -0
  353. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-sql.min.js +0 -0
  354. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-swift.min.js +0 -0
  355. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tcl.min.js +0 -0
  356. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tex.min.js +0 -0
  357. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vb.min.js +0 -0
  358. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vhdl.min.js +0 -0
  359. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-wiki.min.js +0 -0
  360. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-xq.min.js +0 -0
  361. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-yaml.min.js +0 -0
  362. /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.min.map +0 -0
@@ -0,0 +1,3992 @@
1
+ /*!
2
+ * Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)
3
+ * wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
4
+ * v4.0.53 - 2022-09-29
5
+ *
6
+ *//*! Modernizr (Custom Build) | MIT & BSD */
7
+ // Copyright 2006 Google Inc.
8
+ //
9
+ // Licensed under the Apache License, Version 2.0 (the "License");
10
+ // you may not use this file except in compliance with the License.
11
+ // You may obtain a copy of the License at
12
+ //
13
+ // http://www.apache.org/licenses/LICENSE-2.0
14
+ //
15
+ // Unless required by applicable law or agreed to in writing, software
16
+ // distributed under the License is distributed on an "AS IS" BASIS,
17
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ // See the License for the specific language governing permissions and
19
+ // limitations under the License.
20
+
21
+
22
+ // Known Issues:
23
+ //
24
+ // * Patterns only support repeat.
25
+ // * Radial gradient are not implemented. The VML version of these look very
26
+ // different from the canvas one.
27
+ // * Clipping paths are not implemented.
28
+ // * Coordsize. The width and height attribute have higher priority than the
29
+ // width and height style values which isn't correct.
30
+ // * Painting mode isn't implemented.
31
+ // * Canvas width/height should is using content-box by default. IE in
32
+ // Quirks mode will draw the canvas using border-box. Either change your
33
+ // doctype to HTML5
34
+ // (http://www.whatwg.org/specs/web-apps/current-work/#the-doctype)
35
+ // or use Box Sizing Behavior from WebFX
36
+ // (http://webfx.eae.net/dhtml/boxsizing/boxsizing.html)
37
+ // * Non uniform scaling does not correctly scale strokes.
38
+ // * Optimize. There is always room for speed improvements.
39
+
40
+ // Only add this code if we do not already have a canvas implementation
41
+ if (!document.createElement('canvas').getContext) {
42
+
43
+ (function() {
44
+
45
+ // alias some functions to make (compiled) code shorter
46
+ var m = Math;
47
+ var mr = m.round;
48
+ var ms = m.sin;
49
+ var mc = m.cos;
50
+ var abs = m.abs;
51
+ var sqrt = m.sqrt;
52
+
53
+ // this is used for sub pixel precision
54
+ var Z = 10;
55
+ var Z2 = Z / 2;
56
+
57
+ /**
58
+ * This funtion is assigned to the <canvas> elements as element.getContext().
59
+ * @this {HTMLElement}
60
+ * @return {CanvasRenderingContext2D_}
61
+ */
62
+ function getContext() {
63
+ return this.context_ ||
64
+ (this.context_ = new CanvasRenderingContext2D_(this));
65
+ }
66
+
67
+ var slice = Array.prototype.slice;
68
+
69
+ /**
70
+ * Binds a function to an object. The returned function will always use the
71
+ * passed in {@code obj} as {@code this}.
72
+ *
73
+ * Example:
74
+ *
75
+ * g = bind(f, obj, a, b)
76
+ * g(c, d) // will do f.call(obj, a, b, c, d)
77
+ *
78
+ * @param {Function} f The function to bind the object to
79
+ * @param {Object} obj The object that should act as this when the function
80
+ * is called
81
+ * @param {*} var_args Rest arguments that will be used as the initial
82
+ * arguments when the function is called
83
+ * @return {Function} A new function that has bound this
84
+ */
85
+ function bind(f, obj, var_args) {
86
+ var a = slice.call(arguments, 2);
87
+ return function() {
88
+ return f.apply(obj, a.concat(slice.call(arguments)));
89
+ };
90
+ }
91
+
92
+ function encodeHtmlAttribute(s) {
93
+ return String(s).replace(/&/g, '&amp;').replace(/"/g, '&quot;');
94
+ }
95
+
96
+ function addNamespace(doc, prefix, urn) {
97
+ if (!doc.namespaces[prefix]) {
98
+ doc.namespaces.add(prefix, urn, '#default#VML');
99
+ }
100
+ }
101
+
102
+ function addNamespacesAndStylesheet(doc) {
103
+ addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml');
104
+ addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office');
105
+
106
+ // Setup default CSS. Only add one style sheet per document
107
+ if (!doc.styleSheets['ex_canvas_']) {
108
+ var ss = doc.createStyleSheet();
109
+ ss.owningElement.id = 'ex_canvas_';
110
+ ss.cssText = 'canvas{display:inline-block;overflow:hidden;' +
111
+ // default size is 300x150 in Gecko and Opera
112
+ 'text-align:left;width:300px;height:150px}';
113
+ }
114
+ }
115
+
116
+ // Add namespaces and stylesheet at startup.
117
+ addNamespacesAndStylesheet(document);
118
+
119
+ var G_vmlCanvasManager_ = {
120
+ init: function(opt_doc) {
121
+ var doc = opt_doc || document;
122
+ // Create a dummy element so that IE will allow canvas elements to be
123
+ // recognized.
124
+ doc.createElement('canvas');
125
+ doc.attachEvent('onreadystatechange', bind(this.init_, this, doc));
126
+ },
127
+
128
+ init_: function(doc) {
129
+ // find all canvas elements
130
+ var els = doc.getElementsByTagName('canvas');
131
+ for (var i = 0; i < els.length; i++) {
132
+ this.initElement(els[i]);
133
+ }
134
+ },
135
+
136
+ /**
137
+ * Public initializes a canvas element so that it can be used as canvas
138
+ * element from now on. This is called automatically before the page is
139
+ * loaded but if you are creating elements using createElement you need to
140
+ * make sure this is called on the element.
141
+ * @param {HTMLElement} el The canvas element to initialize.
142
+ * @return {HTMLElement} the element that was created.
143
+ */
144
+ initElement: function(el) {
145
+ if (!el.getContext) {
146
+ el.getContext = getContext;
147
+
148
+ // Add namespaces and stylesheet to document of the element.
149
+ addNamespacesAndStylesheet(el.ownerDocument);
150
+
151
+ // Remove fallback content. There is no way to hide text nodes so we
152
+ // just remove all childNodes. We could hide all elements and remove
153
+ // text nodes but who really cares about the fallback content.
154
+ el.innerHTML = '';
155
+
156
+ // do not use inline function because that will leak memory
157
+ el.attachEvent('onpropertychange', onPropertyChange);
158
+ el.attachEvent('onresize', onResize);
159
+
160
+ var attrs = el.attributes;
161
+ if (attrs.width && attrs.width.specified) {
162
+ // TODO: use runtimeStyle and coordsize
163
+ // el.getContext().setWidth_(attrs.width.nodeValue);
164
+ el.style.width = attrs.width.nodeValue + 'px';
165
+ } else {
166
+ el.width = el.clientWidth;
167
+ }
168
+ if (attrs.height && attrs.height.specified) {
169
+ // TODO: use runtimeStyle and coordsize
170
+ // el.getContext().setHeight_(attrs.height.nodeValue);
171
+ el.style.height = attrs.height.nodeValue + 'px';
172
+ } else {
173
+ el.height = el.clientHeight;
174
+ }
175
+ //el.getContext().setCoordsize_()
176
+ }
177
+ return el;
178
+ }
179
+ };
180
+
181
+ function onPropertyChange(e) {
182
+ var el = e.srcElement;
183
+
184
+ switch (e.propertyName) {
185
+ case 'width':
186
+ el.getContext().clearRect();
187
+ el.style.width = el.attributes.width.nodeValue + 'px';
188
+ // In IE8 this does not trigger onresize.
189
+ el.firstChild.style.width = el.clientWidth + 'px';
190
+ break;
191
+ case 'height':
192
+ el.getContext().clearRect();
193
+ el.style.height = el.attributes.height.nodeValue + 'px';
194
+ el.firstChild.style.height = el.clientHeight + 'px';
195
+ break;
196
+ }
197
+ }
198
+
199
+ function onResize(e) {
200
+ var el = e.srcElement;
201
+ if (el.firstChild) {
202
+ el.firstChild.style.width = el.clientWidth + 'px';
203
+ el.firstChild.style.height = el.clientHeight + 'px';
204
+ }
205
+ }
206
+
207
+ G_vmlCanvasManager_.init();
208
+
209
+ // precompute "00" to "FF"
210
+ var decToHex = [];
211
+ for (var i = 0; i < 16; i++) {
212
+ for (var j = 0; j < 16; j++) {
213
+ decToHex[i * 16 + j] = i.toString(16) + j.toString(16);
214
+ }
215
+ }
216
+
217
+ function createMatrixIdentity() {
218
+ return [
219
+ [1, 0, 0],
220
+ [0, 1, 0],
221
+ [0, 0, 1]
222
+ ];
223
+ }
224
+
225
+ function matrixMultiply(m1, m2) {
226
+ var result = createMatrixIdentity();
227
+
228
+ for (var x = 0; x < 3; x++) {
229
+ for (var y = 0; y < 3; y++) {
230
+ var sum = 0;
231
+
232
+ for (var z = 0; z < 3; z++) {
233
+ sum += m1[x][z] * m2[z][y];
234
+ }
235
+
236
+ result[x][y] = sum;
237
+ }
238
+ }
239
+ return result;
240
+ }
241
+
242
+ function copyState(o1, o2) {
243
+ o2.fillStyle = o1.fillStyle;
244
+ o2.lineCap = o1.lineCap;
245
+ o2.lineJoin = o1.lineJoin;
246
+ o2.lineWidth = o1.lineWidth;
247
+ o2.miterLimit = o1.miterLimit;
248
+ o2.shadowBlur = o1.shadowBlur;
249
+ o2.shadowColor = o1.shadowColor;
250
+ o2.shadowOffsetX = o1.shadowOffsetX;
251
+ o2.shadowOffsetY = o1.shadowOffsetY;
252
+ o2.strokeStyle = o1.strokeStyle;
253
+ o2.globalAlpha = o1.globalAlpha;
254
+ o2.font = o1.font;
255
+ o2.textAlign = o1.textAlign;
256
+ o2.textBaseline = o1.textBaseline;
257
+ o2.arcScaleX_ = o1.arcScaleX_;
258
+ o2.arcScaleY_ = o1.arcScaleY_;
259
+ o2.lineScale_ = o1.lineScale_;
260
+ }
261
+
262
+ var colorData = {
263
+ aliceblue: '#F0F8FF',
264
+ antiquewhite: '#FAEBD7',
265
+ aquamarine: '#7FFFD4',
266
+ azure: '#F0FFFF',
267
+ beige: '#F5F5DC',
268
+ bisque: '#FFE4C4',
269
+ black: '#000000',
270
+ blanchedalmond: '#FFEBCD',
271
+ blueviolet: '#8A2BE2',
272
+ brown: '#A52A2A',
273
+ burlywood: '#DEB887',
274
+ cadetblue: '#5F9EA0',
275
+ chartreuse: '#7FFF00',
276
+ chocolate: '#D2691E',
277
+ coral: '#FF7F50',
278
+ cornflowerblue: '#6495ED',
279
+ cornsilk: '#FFF8DC',
280
+ crimson: '#DC143C',
281
+ cyan: '#00FFFF',
282
+ darkblue: '#00008B',
283
+ darkcyan: '#008B8B',
284
+ darkgoldenrod: '#B8860B',
285
+ darkgray: '#A9A9A9',
286
+ darkgreen: '#006400',
287
+ darkgrey: '#A9A9A9',
288
+ darkkhaki: '#BDB76B',
289
+ darkmagenta: '#8B008B',
290
+ darkolivegreen: '#556B2F',
291
+ darkorange: '#FF8C00',
292
+ darkorchid: '#9932CC',
293
+ darkred: '#8B0000',
294
+ darksalmon: '#E9967A',
295
+ darkseagreen: '#8FBC8F',
296
+ darkslateblue: '#483D8B',
297
+ darkslategray: '#2F4F4F',
298
+ darkslategrey: '#2F4F4F',
299
+ darkturquoise: '#00CED1',
300
+ darkviolet: '#9400D3',
301
+ deeppink: '#FF1493',
302
+ deepskyblue: '#00BFFF',
303
+ dimgray: '#696969',
304
+ dimgrey: '#696969',
305
+ dodgerblue: '#1E90FF',
306
+ firebrick: '#B22222',
307
+ floralwhite: '#FFFAF0',
308
+ forestgreen: '#228B22',
309
+ gainsboro: '#DCDCDC',
310
+ ghostwhite: '#F8F8FF',
311
+ gold: '#FFD700',
312
+ goldenrod: '#DAA520',
313
+ grey: '#808080',
314
+ greenyellow: '#ADFF2F',
315
+ honeydew: '#F0FFF0',
316
+ hotpink: '#FF69B4',
317
+ indianred: '#CD5C5C',
318
+ indigo: '#4B0082',
319
+ ivory: '#FFFFF0',
320
+ khaki: '#F0E68C',
321
+ lavender: '#E6E6FA',
322
+ lavenderblush: '#FFF0F5',
323
+ lawngreen: '#7CFC00',
324
+ lemonchiffon: '#FFFACD',
325
+ lightblue: '#ADD8E6',
326
+ lightcoral: '#F08080',
327
+ lightcyan: '#E0FFFF',
328
+ lightgoldenrodyellow: '#FAFAD2',
329
+ lightgreen: '#90EE90',
330
+ lightgrey: '#D3D3D3',
331
+ lightpink: '#FFB6C1',
332
+ lightsalmon: '#FFA07A',
333
+ lightseagreen: '#20B2AA',
334
+ lightskyblue: '#87CEFA',
335
+ lightslategray: '#778899',
336
+ lightslategrey: '#778899',
337
+ lightsteelblue: '#B0C4DE',
338
+ lightyellow: '#FFFFE0',
339
+ limegreen: '#32CD32',
340
+ linen: '#FAF0E6',
341
+ magenta: '#FF00FF',
342
+ mediumaquamarine: '#66CDAA',
343
+ mediumblue: '#0000CD',
344
+ mediumorchid: '#BA55D3',
345
+ mediumpurple: '#9370DB',
346
+ mediumseagreen: '#3CB371',
347
+ mediumslateblue: '#7B68EE',
348
+ mediumspringgreen: '#00FA9A',
349
+ mediumturquoise: '#48D1CC',
350
+ mediumvioletred: '#C71585',
351
+ midnightblue: '#191970',
352
+ mintcream: '#F5FFFA',
353
+ mistyrose: '#FFE4E1',
354
+ moccasin: '#FFE4B5',
355
+ navajowhite: '#FFDEAD',
356
+ oldlace: '#FDF5E6',
357
+ olivedrab: '#6B8E23',
358
+ orange: '#FFA500',
359
+ orangered: '#FF4500',
360
+ orchid: '#DA70D6',
361
+ palegoldenrod: '#EEE8AA',
362
+ palegreen: '#98FB98',
363
+ paleturquoise: '#AFEEEE',
364
+ palevioletred: '#DB7093',
365
+ papayawhip: '#FFEFD5',
366
+ peachpuff: '#FFDAB9',
367
+ peru: '#CD853F',
368
+ pink: '#FFC0CB',
369
+ plum: '#DDA0DD',
370
+ powderblue: '#B0E0E6',
371
+ rosybrown: '#BC8F8F',
372
+ royalblue: '#4169E1',
373
+ saddlebrown: '#8B4513',
374
+ salmon: '#FA8072',
375
+ sandybrown: '#F4A460',
376
+ seagreen: '#2E8B57',
377
+ seashell: '#FFF5EE',
378
+ sienna: '#A0522D',
379
+ skyblue: '#87CEEB',
380
+ slateblue: '#6A5ACD',
381
+ slategray: '#708090',
382
+ slategrey: '#708090',
383
+ snow: '#FFFAFA',
384
+ springgreen: '#00FF7F',
385
+ steelblue: '#4682B4',
386
+ tan: '#D2B48C',
387
+ thistle: '#D8BFD8',
388
+ tomato: '#FF6347',
389
+ turquoise: '#40E0D0',
390
+ violet: '#EE82EE',
391
+ wheat: '#F5DEB3',
392
+ whitesmoke: '#F5F5F5',
393
+ yellowgreen: '#9ACD32'
394
+ };
395
+
396
+
397
+ function getRgbHslContent(styleString) {
398
+ var start = styleString.indexOf('(', 3);
399
+ var end = styleString.indexOf(')', start + 1);
400
+ var parts = styleString.substring(start + 1, end).split(',');
401
+ // add alpha if needed
402
+ if (parts.length != 4 || styleString.charAt(3) != 'a') {
403
+ parts[3] = 1;
404
+ }
405
+ return parts;
406
+ }
407
+
408
+ function percent(s) {
409
+ return parseFloat(s) / 100;
410
+ }
411
+
412
+ function clamp(v, min, max) {
413
+ return Math.min(max, Math.max(min, v));
414
+ }
415
+
416
+ function hslToRgb(parts){
417
+ var r, g, b, h, s, l;
418
+ h = parseFloat(parts[0]) / 360 % 360;
419
+ if (h < 0)
420
+ h++;
421
+ s = clamp(percent(parts[1]), 0, 1);
422
+ l = clamp(percent(parts[2]), 0, 1);
423
+ if (s == 0) {
424
+ r = g = b = l; // achromatic
425
+ } else {
426
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
427
+ var p = 2 * l - q;
428
+ r = hueToRgb(p, q, h + 1 / 3);
429
+ g = hueToRgb(p, q, h);
430
+ b = hueToRgb(p, q, h - 1 / 3);
431
+ }
432
+
433
+ return '#' + decToHex[Math.floor(r * 255)] +
434
+ decToHex[Math.floor(g * 255)] +
435
+ decToHex[Math.floor(b * 255)];
436
+ }
437
+
438
+ function hueToRgb(m1, m2, h) {
439
+ if (h < 0)
440
+ h++;
441
+ if (h > 1)
442
+ h--;
443
+
444
+ if (6 * h < 1)
445
+ return m1 + (m2 - m1) * 6 * h;
446
+ else if (2 * h < 1)
447
+ return m2;
448
+ else if (3 * h < 2)
449
+ return m1 + (m2 - m1) * (2 / 3 - h) * 6;
450
+ else
451
+ return m1;
452
+ }
453
+
454
+ var processStyleCache = {};
455
+
456
+ function processStyle(styleString) {
457
+ if (styleString in processStyleCache) {
458
+ return processStyleCache[styleString];
459
+ }
460
+
461
+ var str, alpha = 1;
462
+
463
+ styleString = String(styleString);
464
+ if (styleString.charAt(0) == '#') {
465
+ str = styleString;
466
+ } else if (/^rgb/.test(styleString)) {
467
+ var parts = getRgbHslContent(styleString);
468
+ var str = '#', n;
469
+ for (var i = 0; i < 3; i++) {
470
+ if (parts[i].indexOf('%') != -1) {
471
+ n = Math.floor(percent(parts[i]) * 255);
472
+ } else {
473
+ n = +parts[i];
474
+ }
475
+ str += decToHex[clamp(n, 0, 255)];
476
+ }
477
+ alpha = +parts[3];
478
+ } else if (/^hsl/.test(styleString)) {
479
+ var parts = getRgbHslContent(styleString);
480
+ str = hslToRgb(parts);
481
+ alpha = parts[3];
482
+ } else {
483
+ str = colorData[styleString] || styleString;
484
+ }
485
+ return processStyleCache[styleString] = {color: str, alpha: alpha};
486
+ }
487
+
488
+ var DEFAULT_STYLE = {
489
+ style: 'normal',
490
+ variant: 'normal',
491
+ weight: 'normal',
492
+ size: 10,
493
+ family: 'sans-serif'
494
+ };
495
+
496
+ // Internal text style cache
497
+ var fontStyleCache = {};
498
+
499
+ function processFontStyle(styleString) {
500
+ if (fontStyleCache[styleString]) {
501
+ return fontStyleCache[styleString];
502
+ }
503
+
504
+ var el = document.createElement('div');
505
+ var style = el.style;
506
+ try {
507
+ style.font = styleString;
508
+ } catch (ex) {
509
+ // Ignore failures to set to invalid font.
510
+ }
511
+
512
+ return fontStyleCache[styleString] = {
513
+ style: style.fontStyle || DEFAULT_STYLE.style,
514
+ variant: style.fontVariant || DEFAULT_STYLE.variant,
515
+ weight: style.fontWeight || DEFAULT_STYLE.weight,
516
+ size: style.fontSize || DEFAULT_STYLE.size,
517
+ family: style.fontFamily || DEFAULT_STYLE.family
518
+ };
519
+ }
520
+
521
+ function getComputedStyle(style, element) {
522
+ var computedStyle = {};
523
+
524
+ for (var p in style) {
525
+ computedStyle[p] = style[p];
526
+ }
527
+
528
+ // Compute the size
529
+ var canvasFontSize = parseFloat(element.currentStyle.fontSize),
530
+ fontSize = parseFloat(style.size);
531
+
532
+ if (typeof style.size == 'number') {
533
+ computedStyle.size = style.size;
534
+ } else if (style.size.indexOf('px') != -1) {
535
+ computedStyle.size = fontSize;
536
+ } else if (style.size.indexOf('em') != -1) {
537
+ computedStyle.size = canvasFontSize * fontSize;
538
+ } else if(style.size.indexOf('%') != -1) {
539
+ computedStyle.size = (canvasFontSize / 100) * fontSize;
540
+ } else if (style.size.indexOf('pt') != -1) {
541
+ computedStyle.size = fontSize / .75;
542
+ } else {
543
+ computedStyle.size = canvasFontSize;
544
+ }
545
+
546
+ // Different scaling between normal text and VML text. This was found using
547
+ // trial and error to get the same size as non VML text.
548
+ computedStyle.size *= 0.981;
549
+
550
+ return computedStyle;
551
+ }
552
+
553
+ function buildStyle(style) {
554
+ return style.style + ' ' + style.variant + ' ' + style.weight + ' ' +
555
+ style.size + 'px ' + style.family;
556
+ }
557
+
558
+ var lineCapMap = {
559
+ 'butt': 'flat',
560
+ 'round': 'round'
561
+ };
562
+
563
+ function processLineCap(lineCap) {
564
+ return lineCapMap[lineCap] || 'square';
565
+ }
566
+
567
+ /**
568
+ * This class implements CanvasRenderingContext2D interface as described by
569
+ * the WHATWG.
570
+ * @param {HTMLElement} canvasElement The element that the 2D context should
571
+ * be associated with
572
+ */
573
+ function CanvasRenderingContext2D_(canvasElement) {
574
+ this.m_ = createMatrixIdentity();
575
+
576
+ this.mStack_ = [];
577
+ this.aStack_ = [];
578
+ this.currentPath_ = [];
579
+
580
+ // Canvas context properties
581
+ this.strokeStyle = '#000';
582
+ this.fillStyle = '#000';
583
+
584
+ this.lineWidth = 1;
585
+ this.lineJoin = 'miter';
586
+ this.lineCap = 'butt';
587
+ this.miterLimit = Z * 1;
588
+ this.globalAlpha = 1;
589
+ this.font = '10px sans-serif';
590
+ this.textAlign = 'left';
591
+ this.textBaseline = 'alphabetic';
592
+ this.canvas = canvasElement;
593
+
594
+ var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' +
595
+ canvasElement.clientHeight + 'px;overflow:hidden;position:absolute';
596
+ var el = canvasElement.ownerDocument.createElement('div');
597
+ el.style.cssText = cssText;
598
+ canvasElement.appendChild(el);
599
+
600
+ var overlayEl = el.cloneNode(false);
601
+ // Use a non transparent background.
602
+ overlayEl.style.backgroundColor = 'red';
603
+ overlayEl.style.filter = 'alpha(opacity=0)';
604
+ canvasElement.appendChild(overlayEl);
605
+
606
+ this.element_ = el;
607
+ this.arcScaleX_ = 1;
608
+ this.arcScaleY_ = 1;
609
+ this.lineScale_ = 1;
610
+ }
611
+
612
+ var contextPrototype = CanvasRenderingContext2D_.prototype;
613
+ contextPrototype.clearRect = function() {
614
+ if (this.textMeasureEl_) {
615
+ this.textMeasureEl_.removeNode(true);
616
+ this.textMeasureEl_ = null;
617
+ }
618
+ this.element_.innerHTML = '';
619
+ };
620
+
621
+ contextPrototype.beginPath = function() {
622
+ // TODO: Branch current matrix so that save/restore has no effect
623
+ // as per safari docs.
624
+ this.currentPath_ = [];
625
+ };
626
+
627
+ contextPrototype.moveTo = function(aX, aY) {
628
+ var p = getCoords(this, aX, aY);
629
+ this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
630
+ this.currentX_ = p.x;
631
+ this.currentY_ = p.y;
632
+ };
633
+
634
+ contextPrototype.lineTo = function(aX, aY) {
635
+ var p = getCoords(this, aX, aY);
636
+ this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
637
+
638
+ this.currentX_ = p.x;
639
+ this.currentY_ = p.y;
640
+ };
641
+
642
+ contextPrototype.bezierCurveTo = function(aCP1x, aCP1y,
643
+ aCP2x, aCP2y,
644
+ aX, aY) {
645
+ var p = getCoords(this, aX, aY);
646
+ var cp1 = getCoords(this, aCP1x, aCP1y);
647
+ var cp2 = getCoords(this, aCP2x, aCP2y);
648
+ bezierCurveTo(this, cp1, cp2, p);
649
+ };
650
+
651
+ // Helper function that takes the already fixed cordinates.
652
+ function bezierCurveTo(self, cp1, cp2, p) {
653
+ self.currentPath_.push({
654
+ type: 'bezierCurveTo',
655
+ cp1x: cp1.x,
656
+ cp1y: cp1.y,
657
+ cp2x: cp2.x,
658
+ cp2y: cp2.y,
659
+ x: p.x,
660
+ y: p.y
661
+ });
662
+ self.currentX_ = p.x;
663
+ self.currentY_ = p.y;
664
+ }
665
+
666
+ contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) {
667
+ // the following is lifted almost directly from
668
+ // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes
669
+
670
+ var cp = getCoords(this, aCPx, aCPy);
671
+ var p = getCoords(this, aX, aY);
672
+
673
+ var cp1 = {
674
+ x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_),
675
+ y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_)
676
+ };
677
+ var cp2 = {
678
+ x: cp1.x + (p.x - this.currentX_) / 3.0,
679
+ y: cp1.y + (p.y - this.currentY_) / 3.0
680
+ };
681
+
682
+ bezierCurveTo(this, cp1, cp2, p);
683
+ };
684
+
685
+ contextPrototype.arc = function(aX, aY, aRadius,
686
+ aStartAngle, aEndAngle, aClockwise) {
687
+ aRadius *= Z;
688
+ var arcType = aClockwise ? 'at' : 'wa';
689
+
690
+ var xStart = aX + mc(aStartAngle) * aRadius - Z2;
691
+ var yStart = aY + ms(aStartAngle) * aRadius - Z2;
692
+
693
+ var xEnd = aX + mc(aEndAngle) * aRadius - Z2;
694
+ var yEnd = aY + ms(aEndAngle) * aRadius - Z2;
695
+
696
+ // IE won't render arches drawn counter clockwise if xStart == xEnd.
697
+ if (xStart == xEnd && !aClockwise) {
698
+ xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something
699
+ // that can be represented in binary
700
+ }
701
+
702
+ var p = getCoords(this, aX, aY);
703
+ var pStart = getCoords(this, xStart, yStart);
704
+ var pEnd = getCoords(this, xEnd, yEnd);
705
+
706
+ this.currentPath_.push({type: arcType,
707
+ x: p.x,
708
+ y: p.y,
709
+ radius: aRadius,
710
+ xStart: pStart.x,
711
+ yStart: pStart.y,
712
+ xEnd: pEnd.x,
713
+ yEnd: pEnd.y});
714
+
715
+ };
716
+
717
+ contextPrototype.rect = function(aX, aY, aWidth, aHeight) {
718
+ this.moveTo(aX, aY);
719
+ this.lineTo(aX + aWidth, aY);
720
+ this.lineTo(aX + aWidth, aY + aHeight);
721
+ this.lineTo(aX, aY + aHeight);
722
+ this.closePath();
723
+ };
724
+
725
+ contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) {
726
+ var oldPath = this.currentPath_;
727
+ this.beginPath();
728
+
729
+ this.moveTo(aX, aY);
730
+ this.lineTo(aX + aWidth, aY);
731
+ this.lineTo(aX + aWidth, aY + aHeight);
732
+ this.lineTo(aX, aY + aHeight);
733
+ this.closePath();
734
+ this.stroke();
735
+
736
+ this.currentPath_ = oldPath;
737
+ };
738
+
739
+ contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) {
740
+ var oldPath = this.currentPath_;
741
+ this.beginPath();
742
+
743
+ this.moveTo(aX, aY);
744
+ this.lineTo(aX + aWidth, aY);
745
+ this.lineTo(aX + aWidth, aY + aHeight);
746
+ this.lineTo(aX, aY + aHeight);
747
+ this.closePath();
748
+ this.fill();
749
+
750
+ this.currentPath_ = oldPath;
751
+ };
752
+
753
+ contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) {
754
+ var gradient = new CanvasGradient_('gradient');
755
+ gradient.x0_ = aX0;
756
+ gradient.y0_ = aY0;
757
+ gradient.x1_ = aX1;
758
+ gradient.y1_ = aY1;
759
+ return gradient;
760
+ };
761
+
762
+ contextPrototype.createRadialGradient = function(aX0, aY0, aR0,
763
+ aX1, aY1, aR1) {
764
+ var gradient = new CanvasGradient_('gradientradial');
765
+ gradient.x0_ = aX0;
766
+ gradient.y0_ = aY0;
767
+ gradient.r0_ = aR0;
768
+ gradient.x1_ = aX1;
769
+ gradient.y1_ = aY1;
770
+ gradient.r1_ = aR1;
771
+ return gradient;
772
+ };
773
+
774
+ contextPrototype.drawImage = function(image, var_args) {
775
+ var dx, dy, dw, dh, sx, sy, sw, sh;
776
+
777
+ // to find the original width we overide the width and height
778
+ var oldRuntimeWidth = image.runtimeStyle.width;
779
+ var oldRuntimeHeight = image.runtimeStyle.height;
780
+ image.runtimeStyle.width = 'auto';
781
+ image.runtimeStyle.height = 'auto';
782
+
783
+ // get the original size
784
+ var w = image.width;
785
+ var h = image.height;
786
+
787
+ // and remove overides
788
+ image.runtimeStyle.width = oldRuntimeWidth;
789
+ image.runtimeStyle.height = oldRuntimeHeight;
790
+
791
+ if (arguments.length == 3) {
792
+ dx = arguments[1];
793
+ dy = arguments[2];
794
+ sx = sy = 0;
795
+ sw = dw = w;
796
+ sh = dh = h;
797
+ } else if (arguments.length == 5) {
798
+ dx = arguments[1];
799
+ dy = arguments[2];
800
+ dw = arguments[3];
801
+ dh = arguments[4];
802
+ sx = sy = 0;
803
+ sw = w;
804
+ sh = h;
805
+ } else if (arguments.length == 9) {
806
+ sx = arguments[1];
807
+ sy = arguments[2];
808
+ sw = arguments[3];
809
+ sh = arguments[4];
810
+ dx = arguments[5];
811
+ dy = arguments[6];
812
+ dw = arguments[7];
813
+ dh = arguments[8];
814
+ } else {
815
+ throw Error('Invalid number of arguments');
816
+ }
817
+
818
+ var d = getCoords(this, dx, dy);
819
+
820
+ var w2 = sw / 2;
821
+ var h2 = sh / 2;
822
+
823
+ var vmlStr = [];
824
+
825
+ var W = 10;
826
+ var H = 10;
827
+
828
+ // For some reason that I've now forgotten, using divs didn't work
829
+ vmlStr.push(' <g_vml_:group',
830
+ ' coordsize="', Z * W, ',', Z * H, '"',
831
+ ' coordorigin="0,0"' ,
832
+ ' style="width:', W, 'px;height:', H, 'px;position:absolute;');
833
+
834
+ // If filters are necessary (rotation exists), create them
835
+ // filters are bog-slow, so only create them if abbsolutely necessary
836
+ // The following check doesn't account for skews (which don't exist
837
+ // in the canvas spec (yet) anyway.
838
+
839
+ if (this.m_[0][0] != 1 || this.m_[0][1] ||
840
+ this.m_[1][1] != 1 || this.m_[1][0]) {
841
+ var filter = [];
842
+
843
+ // Note the 12/21 reversal
844
+ filter.push('M11=', this.m_[0][0], ',',
845
+ 'M12=', this.m_[1][0], ',',
846
+ 'M21=', this.m_[0][1], ',',
847
+ 'M22=', this.m_[1][1], ',',
848
+ 'Dx=', mr(d.x / Z), ',',
849
+ 'Dy=', mr(d.y / Z), '');
850
+
851
+ // Bounding box calculation (need to minimize displayed area so that
852
+ // filters don't waste time on unused pixels.
853
+ var max = d;
854
+ var c2 = getCoords(this, dx + dw, dy);
855
+ var c3 = getCoords(this, dx, dy + dh);
856
+ var c4 = getCoords(this, dx + dw, dy + dh);
857
+
858
+ max.x = m.max(max.x, c2.x, c3.x, c4.x);
859
+ max.y = m.max(max.y, c2.y, c3.y, c4.y);
860
+
861
+ vmlStr.push('padding:0 ', mr(max.x / Z), 'px ', mr(max.y / Z),
862
+ 'px 0;filter:progid:DXImageTransform.Microsoft.Matrix(',
863
+ filter.join(''), ", sizingmethod='clip');");
864
+
865
+ } else {
866
+ vmlStr.push('top:', mr(d.y / Z), 'px;left:', mr(d.x / Z), 'px;');
867
+ }
868
+
869
+ vmlStr.push(' ">' ,
870
+ '<g_vml_:image src="', image.src, '"',
871
+ ' style="width:', Z * dw, 'px;',
872
+ ' height:', Z * dh, 'px"',
873
+ ' cropleft="', sx / w, '"',
874
+ ' croptop="', sy / h, '"',
875
+ ' cropright="', (w - sx - sw) / w, '"',
876
+ ' cropbottom="', (h - sy - sh) / h, '"',
877
+ ' />',
878
+ '</g_vml_:group>');
879
+
880
+ this.element_.insertAdjacentHTML('BeforeEnd', vmlStr.join(''));
881
+ };
882
+
883
+ contextPrototype.stroke = function(aFill) {
884
+ var lineStr = [];
885
+ var lineOpen = false;
886
+
887
+ var W = 10;
888
+ var H = 10;
889
+
890
+ lineStr.push('<g_vml_:shape',
891
+ ' filled="', !!aFill, '"',
892
+ ' style="position:absolute;width:', W, 'px;height:', H, 'px;"',
893
+ ' coordorigin="0,0"',
894
+ ' coordsize="', Z * W, ',', Z * H, '"',
895
+ ' stroked="', !aFill, '"',
896
+ ' path="');
897
+
898
+ var newSeq = false;
899
+ var min = {x: null, y: null};
900
+ var max = {x: null, y: null};
901
+
902
+ for (var i = 0; i < this.currentPath_.length; i++) {
903
+ var p = this.currentPath_[i];
904
+ var c;
905
+
906
+ switch (p.type) {
907
+ case 'moveTo':
908
+ c = p;
909
+ lineStr.push(' m ', mr(p.x), ',', mr(p.y));
910
+ break;
911
+ case 'lineTo':
912
+ lineStr.push(' l ', mr(p.x), ',', mr(p.y));
913
+ break;
914
+ case 'close':
915
+ lineStr.push(' x ');
916
+ p = null;
917
+ break;
918
+ case 'bezierCurveTo':
919
+ lineStr.push(' c ',
920
+ mr(p.cp1x), ',', mr(p.cp1y), ',',
921
+ mr(p.cp2x), ',', mr(p.cp2y), ',',
922
+ mr(p.x), ',', mr(p.y));
923
+ break;
924
+ case 'at':
925
+ case 'wa':
926
+ lineStr.push(' ', p.type, ' ',
927
+ mr(p.x - this.arcScaleX_ * p.radius), ',',
928
+ mr(p.y - this.arcScaleY_ * p.radius), ' ',
929
+ mr(p.x + this.arcScaleX_ * p.radius), ',',
930
+ mr(p.y + this.arcScaleY_ * p.radius), ' ',
931
+ mr(p.xStart), ',', mr(p.yStart), ' ',
932
+ mr(p.xEnd), ',', mr(p.yEnd));
933
+ break;
934
+ }
935
+
936
+
937
+ // TODO: Following is broken for curves due to
938
+ // move to proper paths.
939
+
940
+ // Figure out dimensions so we can do gradient fills
941
+ // properly
942
+ if (p) {
943
+ if (min.x == null || p.x < min.x) {
944
+ min.x = p.x;
945
+ }
946
+ if (max.x == null || p.x > max.x) {
947
+ max.x = p.x;
948
+ }
949
+ if (min.y == null || p.y < min.y) {
950
+ min.y = p.y;
951
+ }
952
+ if (max.y == null || p.y > max.y) {
953
+ max.y = p.y;
954
+ }
955
+ }
956
+ }
957
+ lineStr.push(' ">');
958
+
959
+ if (!aFill) {
960
+ appendStroke(this, lineStr);
961
+ } else {
962
+ appendFill(this, lineStr, min, max);
963
+ }
964
+
965
+ lineStr.push('</g_vml_:shape>');
966
+
967
+ this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
968
+ };
969
+
970
+ function appendStroke(ctx, lineStr) {
971
+ var a = processStyle(ctx.strokeStyle);
972
+ var color = a.color;
973
+ var opacity = a.alpha * ctx.globalAlpha;
974
+ var lineWidth = ctx.lineScale_ * ctx.lineWidth;
975
+
976
+ // VML cannot correctly render a line if the width is less than 1px.
977
+ // In that case, we dilute the color to make the line look thinner.
978
+ if (lineWidth < 1) {
979
+ opacity *= lineWidth;
980
+ }
981
+
982
+ lineStr.push(
983
+ '<g_vml_:stroke',
984
+ ' opacity="', opacity, '"',
985
+ ' joinstyle="', ctx.lineJoin, '"',
986
+ ' miterlimit="', ctx.miterLimit, '"',
987
+ ' endcap="', processLineCap(ctx.lineCap), '"',
988
+ ' weight="', lineWidth, 'px"',
989
+ ' color="', color, '" />'
990
+ );
991
+ }
992
+
993
+ function appendFill(ctx, lineStr, min, max) {
994
+ var fillStyle = ctx.fillStyle;
995
+ var arcScaleX = ctx.arcScaleX_;
996
+ var arcScaleY = ctx.arcScaleY_;
997
+ var width = max.x - min.x;
998
+ var height = max.y - min.y;
999
+ if (fillStyle instanceof CanvasGradient_) {
1000
+ // TODO: Gradients transformed with the transformation matrix.
1001
+ var angle = 0;
1002
+ var focus = {x: 0, y: 0};
1003
+
1004
+ // additional offset
1005
+ var shift = 0;
1006
+ // scale factor for offset
1007
+ var expansion = 1;
1008
+
1009
+ if (fillStyle.type_ == 'gradient') {
1010
+ var x0 = fillStyle.x0_ / arcScaleX;
1011
+ var y0 = fillStyle.y0_ / arcScaleY;
1012
+ var x1 = fillStyle.x1_ / arcScaleX;
1013
+ var y1 = fillStyle.y1_ / arcScaleY;
1014
+ var p0 = getCoords(ctx, x0, y0);
1015
+ var p1 = getCoords(ctx, x1, y1);
1016
+ var dx = p1.x - p0.x;
1017
+ var dy = p1.y - p0.y;
1018
+ angle = Math.atan2(dx, dy) * 180 / Math.PI;
1019
+
1020
+ // The angle should be a non-negative number.
1021
+ if (angle < 0) {
1022
+ angle += 360;
1023
+ }
1024
+
1025
+ // Very small angles produce an unexpected result because they are
1026
+ // converted to a scientific notation string.
1027
+ if (angle < 1e-6) {
1028
+ angle = 0;
1029
+ }
1030
+ } else {
1031
+ var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_);
1032
+ focus = {
1033
+ x: (p0.x - min.x) / width,
1034
+ y: (p0.y - min.y) / height
1035
+ };
1036
+
1037
+ width /= arcScaleX * Z;
1038
+ height /= arcScaleY * Z;
1039
+ var dimension = m.max(width, height);
1040
+ shift = 2 * fillStyle.r0_ / dimension;
1041
+ expansion = 2 * fillStyle.r1_ / dimension - shift;
1042
+ }
1043
+
1044
+ // We need to sort the color stops in ascending order by offset,
1045
+ // otherwise IE won't interpret it correctly.
1046
+ var stops = fillStyle.colors_;
1047
+ stops.sort(function(cs1, cs2) {
1048
+ return cs1.offset - cs2.offset;
1049
+ });
1050
+
1051
+ var length = stops.length;
1052
+ var color1 = stops[0].color;
1053
+ var color2 = stops[length - 1].color;
1054
+ var opacity1 = stops[0].alpha * ctx.globalAlpha;
1055
+ var opacity2 = stops[length - 1].alpha * ctx.globalAlpha;
1056
+
1057
+ var colors = [];
1058
+ for (var i = 0; i < length; i++) {
1059
+ var stop = stops[i];
1060
+ colors.push(stop.offset * expansion + shift + ' ' + stop.color);
1061
+ }
1062
+
1063
+ // When colors attribute is used, the meanings of opacity and o:opacity2
1064
+ // are reversed.
1065
+ lineStr.push('<g_vml_:fill type="', fillStyle.type_, '"',
1066
+ ' method="none" focus="100%"',
1067
+ ' color="', color1, '"',
1068
+ ' color2="', color2, '"',
1069
+ ' colors="', colors.join(','), '"',
1070
+ ' opacity="', opacity2, '"',
1071
+ ' g_o_:opacity2="', opacity1, '"',
1072
+ ' angle="', angle, '"',
1073
+ ' focusposition="', focus.x, ',', focus.y, '" />');
1074
+ } else if (fillStyle instanceof CanvasPattern_) {
1075
+ if (width && height) {
1076
+ var deltaLeft = -min.x;
1077
+ var deltaTop = -min.y;
1078
+ lineStr.push('<g_vml_:fill',
1079
+ ' position="',
1080
+ deltaLeft / width * arcScaleX * arcScaleX, ',',
1081
+ deltaTop / height * arcScaleY * arcScaleY, '"',
1082
+ ' type="tile"',
1083
+ // TODO: Figure out the correct size to fit the scale.
1084
+ //' size="', w, 'px ', h, 'px"',
1085
+ ' src="', fillStyle.src_, '" />');
1086
+ }
1087
+ } else {
1088
+ var a = processStyle(ctx.fillStyle);
1089
+ var color = a.color;
1090
+ var opacity = a.alpha * ctx.globalAlpha;
1091
+ lineStr.push('<g_vml_:fill color="', color, '" opacity="', opacity,
1092
+ '" />');
1093
+ }
1094
+ }
1095
+
1096
+ contextPrototype.fill = function() {
1097
+ this.stroke(true);
1098
+ };
1099
+
1100
+ contextPrototype.closePath = function() {
1101
+ this.currentPath_.push({type: 'close'});
1102
+ };
1103
+
1104
+ function getCoords(ctx, aX, aY) {
1105
+ var m = ctx.m_;
1106
+ return {
1107
+ x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2,
1108
+ y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2
1109
+ };
1110
+ };
1111
+
1112
+ contextPrototype.save = function() {
1113
+ var o = {};
1114
+ copyState(this, o);
1115
+ this.aStack_.push(o);
1116
+ this.mStack_.push(this.m_);
1117
+ this.m_ = matrixMultiply(createMatrixIdentity(), this.m_);
1118
+ };
1119
+
1120
+ contextPrototype.restore = function() {
1121
+ if (this.aStack_.length) {
1122
+ copyState(this.aStack_.pop(), this);
1123
+ this.m_ = this.mStack_.pop();
1124
+ }
1125
+ };
1126
+
1127
+ function matrixIsFinite(m) {
1128
+ return isFinite(m[0][0]) && isFinite(m[0][1]) &&
1129
+ isFinite(m[1][0]) && isFinite(m[1][1]) &&
1130
+ isFinite(m[2][0]) && isFinite(m[2][1]);
1131
+ }
1132
+
1133
+ function setM(ctx, m, updateLineScale) {
1134
+ if (!matrixIsFinite(m)) {
1135
+ return;
1136
+ }
1137
+ ctx.m_ = m;
1138
+
1139
+ if (updateLineScale) {
1140
+ // Get the line scale.
1141
+ // Determinant of this.m_ means how much the area is enlarged by the
1142
+ // transformation. So its square root can be used as a scale factor
1143
+ // for width.
1144
+ var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];
1145
+ ctx.lineScale_ = sqrt(abs(det));
1146
+ }
1147
+ }
1148
+
1149
+ contextPrototype.translate = function(aX, aY) {
1150
+ var m1 = [
1151
+ [1, 0, 0],
1152
+ [0, 1, 0],
1153
+ [aX, aY, 1]
1154
+ ];
1155
+
1156
+ setM(this, matrixMultiply(m1, this.m_), false);
1157
+ };
1158
+
1159
+ contextPrototype.rotate = function(aRot) {
1160
+ var c = mc(aRot);
1161
+ var s = ms(aRot);
1162
+
1163
+ var m1 = [
1164
+ [c, s, 0],
1165
+ [-s, c, 0],
1166
+ [0, 0, 1]
1167
+ ];
1168
+
1169
+ setM(this, matrixMultiply(m1, this.m_), false);
1170
+ };
1171
+
1172
+ contextPrototype.scale = function(aX, aY) {
1173
+ this.arcScaleX_ *= aX;
1174
+ this.arcScaleY_ *= aY;
1175
+ var m1 = [
1176
+ [aX, 0, 0],
1177
+ [0, aY, 0],
1178
+ [0, 0, 1]
1179
+ ];
1180
+
1181
+ setM(this, matrixMultiply(m1, this.m_), true);
1182
+ };
1183
+
1184
+ contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
1185
+ var m1 = [
1186
+ [m11, m12, 0],
1187
+ [m21, m22, 0],
1188
+ [dx, dy, 1]
1189
+ ];
1190
+
1191
+ setM(this, matrixMultiply(m1, this.m_), true);
1192
+ };
1193
+
1194
+ contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
1195
+ var m = [
1196
+ [m11, m12, 0],
1197
+ [m21, m22, 0],
1198
+ [dx, dy, 1]
1199
+ ];
1200
+
1201
+ setM(this, m, true);
1202
+ };
1203
+
1204
+ /**
1205
+ * The text drawing function.
1206
+ * The maxWidth argument isn't taken in account, since no browser supports
1207
+ * it yet.
1208
+ */
1209
+ contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) {
1210
+ var m = this.m_,
1211
+ delta = 1000,
1212
+ left = 0,
1213
+ right = delta,
1214
+ offset = {x: 0, y: 0},
1215
+ lineStr = [];
1216
+
1217
+ var fontStyle = getComputedStyle(processFontStyle(this.font),
1218
+ this.element_);
1219
+
1220
+ var fontStyleString = buildStyle(fontStyle);
1221
+
1222
+ var elementStyle = this.element_.currentStyle;
1223
+ var textAlign = this.textAlign.toLowerCase();
1224
+ switch (textAlign) {
1225
+ case 'left':
1226
+ case 'center':
1227
+ case 'right':
1228
+ break;
1229
+ case 'end':
1230
+ textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left';
1231
+ break;
1232
+ case 'start':
1233
+ textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left';
1234
+ break;
1235
+ default:
1236
+ textAlign = 'left';
1237
+ }
1238
+
1239
+ // 1.75 is an arbitrary number, as there is no info about the text baseline
1240
+ switch (this.textBaseline) {
1241
+ case 'hanging':
1242
+ case 'top':
1243
+ offset.y = fontStyle.size / 1.75;
1244
+ break;
1245
+ case 'middle':
1246
+ break;
1247
+ default:
1248
+ case null:
1249
+ case 'alphabetic':
1250
+ case 'ideographic':
1251
+ case 'bottom':
1252
+ offset.y = -fontStyle.size / 2.25;
1253
+ break;
1254
+ }
1255
+
1256
+ switch(textAlign) {
1257
+ case 'right':
1258
+ left = delta;
1259
+ right = 0.05;
1260
+ break;
1261
+ case 'center':
1262
+ left = right = delta / 2;
1263
+ break;
1264
+ }
1265
+
1266
+ var d = getCoords(this, x + offset.x, y + offset.y);
1267
+
1268
+ lineStr.push('<g_vml_:line from="', -left ,' 0" to="', right ,' 0.05" ',
1269
+ ' coordsize="100 100" coordorigin="0 0"',
1270
+ ' filled="', !stroke, '" stroked="', !!stroke,
1271
+ '" style="position:absolute;width:1px;height:1px;">');
1272
+
1273
+ if (stroke) {
1274
+ appendStroke(this, lineStr);
1275
+ } else {
1276
+ // TODO: Fix the min and max params.
1277
+ appendFill(this, lineStr, {x: -left, y: 0},
1278
+ {x: right, y: fontStyle.size});
1279
+ }
1280
+
1281
+ var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' +
1282
+ m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0';
1283
+
1284
+ var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z);
1285
+
1286
+ lineStr.push('<g_vml_:skew on="t" matrix="', skewM ,'" ',
1287
+ ' offset="', skewOffset, '" origin="', left ,' 0" />',
1288
+ '<g_vml_:path textpathok="true" />',
1289
+ '<g_vml_:textpath on="true" string="',
1290
+ encodeHtmlAttribute(text),
1291
+ '" style="v-text-align:', textAlign,
1292
+ ';font:', encodeHtmlAttribute(fontStyleString),
1293
+ '" /></g_vml_:line>');
1294
+
1295
+ this.element_.insertAdjacentHTML('beforeEnd', lineStr.join(''));
1296
+ };
1297
+
1298
+ contextPrototype.fillText = function(text, x, y, maxWidth) {
1299
+ this.drawText_(text, x, y, maxWidth, false);
1300
+ };
1301
+
1302
+ contextPrototype.strokeText = function(text, x, y, maxWidth) {
1303
+ this.drawText_(text, x, y, maxWidth, true);
1304
+ };
1305
+
1306
+ contextPrototype.measureText = function(text) {
1307
+ if (!this.textMeasureEl_) {
1308
+ var s = '<span style="position:absolute;' +
1309
+ 'top:-20000px;left:0;padding:0;margin:0;border:none;' +
1310
+ 'white-space:pre;"></span>';
1311
+ this.element_.insertAdjacentHTML('beforeEnd', s);
1312
+ this.textMeasureEl_ = this.element_.lastChild;
1313
+ }
1314
+ var doc = this.element_.ownerDocument;
1315
+ this.textMeasureEl_.innerHTML = '';
1316
+ this.textMeasureEl_.style.font = this.font;
1317
+ // Don't use innerHTML or innerText because they allow markup/whitespace.
1318
+ this.textMeasureEl_.appendChild(doc.createTextNode(text));
1319
+ return {width: this.textMeasureEl_.offsetWidth};
1320
+ };
1321
+
1322
+ /******** STUBS ********/
1323
+ contextPrototype.clip = function() {
1324
+ // TODO: Implement
1325
+ };
1326
+
1327
+ contextPrototype.arcTo = function() {
1328
+ // TODO: Implement
1329
+ };
1330
+
1331
+ contextPrototype.createPattern = function(image, repetition) {
1332
+ return new CanvasPattern_(image, repetition);
1333
+ };
1334
+
1335
+ // Gradient / Pattern Stubs
1336
+ function CanvasGradient_(aType) {
1337
+ this.type_ = aType;
1338
+ this.x0_ = 0;
1339
+ this.y0_ = 0;
1340
+ this.r0_ = 0;
1341
+ this.x1_ = 0;
1342
+ this.y1_ = 0;
1343
+ this.r1_ = 0;
1344
+ this.colors_ = [];
1345
+ }
1346
+
1347
+ CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) {
1348
+ aColor = processStyle(aColor);
1349
+ this.colors_.push({offset: aOffset,
1350
+ color: aColor.color,
1351
+ alpha: aColor.alpha});
1352
+ };
1353
+
1354
+ function CanvasPattern_(image, repetition) {
1355
+ assertImageIsValid(image);
1356
+ switch (repetition) {
1357
+ case 'repeat':
1358
+ case null:
1359
+ case '':
1360
+ this.repetition_ = 'repeat';
1361
+ break
1362
+ case 'repeat-x':
1363
+ case 'repeat-y':
1364
+ case 'no-repeat':
1365
+ this.repetition_ = repetition;
1366
+ break;
1367
+ default:
1368
+ throwException('SYNTAX_ERR');
1369
+ }
1370
+
1371
+ this.src_ = image.src;
1372
+ this.width_ = image.width;
1373
+ this.height_ = image.height;
1374
+ }
1375
+
1376
+ function throwException(s) {
1377
+ throw new DOMException_(s);
1378
+ }
1379
+
1380
+ function assertImageIsValid(img) {
1381
+ if (!img || img.nodeType != 1 || img.tagName != 'IMG') {
1382
+ throwException('TYPE_MISMATCH_ERR');
1383
+ }
1384
+ if (img.readyState != 'complete') {
1385
+ throwException('INVALID_STATE_ERR');
1386
+ }
1387
+ }
1388
+
1389
+ function DOMException_(s) {
1390
+ this.code = this[s];
1391
+ this.message = s +': DOM Exception ' + this.code;
1392
+ }
1393
+ var p = DOMException_.prototype = new Error;
1394
+ p.INDEX_SIZE_ERR = 1;
1395
+ p.DOMSTRING_SIZE_ERR = 2;
1396
+ p.HIERARCHY_REQUEST_ERR = 3;
1397
+ p.WRONG_DOCUMENT_ERR = 4;
1398
+ p.INVALID_CHARACTER_ERR = 5;
1399
+ p.NO_DATA_ALLOWED_ERR = 6;
1400
+ p.NO_MODIFICATION_ALLOWED_ERR = 7;
1401
+ p.NOT_FOUND_ERR = 8;
1402
+ p.NOT_SUPPORTED_ERR = 9;
1403
+ p.INUSE_ATTRIBUTE_ERR = 10;
1404
+ p.INVALID_STATE_ERR = 11;
1405
+ p.SYNTAX_ERR = 12;
1406
+ p.INVALID_MODIFICATION_ERR = 13;
1407
+ p.NAMESPACE_ERR = 14;
1408
+ p.INVALID_ACCESS_ERR = 15;
1409
+ p.VALIDATION_ERR = 16;
1410
+ p.TYPE_MISMATCH_ERR = 17;
1411
+
1412
+ // set up externs
1413
+ G_vmlCanvasManager = G_vmlCanvasManager_;
1414
+ CanvasRenderingContext2D = CanvasRenderingContext2D_;
1415
+ CanvasGradient = CanvasGradient_;
1416
+ CanvasPattern = CanvasPattern_;
1417
+ DOMException = DOMException_;
1418
+ })();
1419
+
1420
+ } // if
1421
+
1422
+ /**
1423
+ * @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
1424
+ */
1425
+ ;(function(window, document) {
1426
+ /*jshint evil:true */
1427
+ /** version */
1428
+ var version = '3.7.3';
1429
+
1430
+ /** Preset options */
1431
+ var options = window.html5 || {};
1432
+
1433
+ /** Used to skip problem elements */
1434
+ var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;
1435
+
1436
+ /** Not all elements can be cloned in IE **/
1437
+ var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;
1438
+
1439
+ /** Detect whether the browser supports default html5 styles */
1440
+ var supportsHtml5Styles;
1441
+
1442
+ /** Name of the expando, to work with multiple documents or to re-shiv one document */
1443
+ var expando = '_html5shiv';
1444
+
1445
+ /** The id for the the documents expando */
1446
+ var expanID = 0;
1447
+
1448
+ /** Cached data for each document */
1449
+ var expandoData = {};
1450
+
1451
+ /** Detect whether the browser supports unknown elements */
1452
+ var supportsUnknownElements;
1453
+
1454
+ (function() {
1455
+ try {
1456
+ var a = document.createElement('a');
1457
+ a.innerHTML = '<xyz></xyz>';
1458
+ //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles
1459
+ supportsHtml5Styles = ('hidden' in a);
1460
+
1461
+ supportsUnknownElements = a.childNodes.length == 1 || (function() {
1462
+ // assign a false positive if unable to shiv
1463
+ (document.createElement)('a');
1464
+ var frag = document.createDocumentFragment();
1465
+ return (
1466
+ typeof frag.cloneNode == 'undefined' ||
1467
+ typeof frag.createDocumentFragment == 'undefined' ||
1468
+ typeof frag.createElement == 'undefined'
1469
+ );
1470
+ }());
1471
+ } catch(e) {
1472
+ // assign a false positive if detection fails => unable to shiv
1473
+ supportsHtml5Styles = true;
1474
+ supportsUnknownElements = true;
1475
+ }
1476
+
1477
+ }());
1478
+
1479
+ /*--------------------------------------------------------------------------*/
1480
+
1481
+ /**
1482
+ * Creates a style sheet with the given CSS text and adds it to the document.
1483
+ * @private
1484
+ * @param {Document} ownerDocument The document.
1485
+ * @param {String} cssText The CSS text.
1486
+ * @returns {StyleSheet} The style element.
1487
+ */
1488
+ function addStyleSheet(ownerDocument, cssText) {
1489
+ var p = ownerDocument.createElement('p'),
1490
+ parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;
1491
+
1492
+ p.innerHTML = 'x<style>' + cssText + '</style>';
1493
+ return parent.insertBefore(p.lastChild, parent.firstChild);
1494
+ }
1495
+
1496
+ /**
1497
+ * Returns the value of `html5.elements` as an array.
1498
+ * @private
1499
+ * @returns {Array} An array of shived element node names.
1500
+ */
1501
+ function getElements() {
1502
+ var elements = html5.elements;
1503
+ return typeof elements == 'string' ? elements.split(' ') : elements;
1504
+ }
1505
+
1506
+ /**
1507
+ * Extends the built-in list of html5 elements
1508
+ * @memberOf html5
1509
+ * @param {String|Array} newElements whitespace separated list or array of new element names to shiv
1510
+ * @param {Document} ownerDocument The context document.
1511
+ */
1512
+ function addElements(newElements, ownerDocument) {
1513
+ var elements = html5.elements;
1514
+ if(typeof elements != 'string'){
1515
+ elements = elements.join(' ');
1516
+ }
1517
+ if(typeof newElements != 'string'){
1518
+ newElements = newElements.join(' ');
1519
+ }
1520
+ html5.elements = elements +' '+ newElements;
1521
+ shivDocument(ownerDocument);
1522
+ }
1523
+
1524
+ /**
1525
+ * Returns the data associated to the given document
1526
+ * @private
1527
+ * @param {Document} ownerDocument The document.
1528
+ * @returns {Object} An object of data.
1529
+ */
1530
+ function getExpandoData(ownerDocument) {
1531
+ var data = expandoData[ownerDocument[expando]];
1532
+ if (!data) {
1533
+ data = {};
1534
+ expanID++;
1535
+ ownerDocument[expando] = expanID;
1536
+ expandoData[expanID] = data;
1537
+ }
1538
+ return data;
1539
+ }
1540
+
1541
+ /**
1542
+ * returns a shived element for the given nodeName and document
1543
+ * @memberOf html5
1544
+ * @param {String} nodeName name of the element
1545
+ * @param {Document} ownerDocument The context document.
1546
+ * @returns {Object} The shived element.
1547
+ */
1548
+ function createElement(nodeName, ownerDocument, data){
1549
+ if (!ownerDocument) {
1550
+ ownerDocument = document;
1551
+ }
1552
+ if(supportsUnknownElements){
1553
+ return ownerDocument.createElement(nodeName);
1554
+ }
1555
+ if (!data) {
1556
+ data = getExpandoData(ownerDocument);
1557
+ }
1558
+ var node;
1559
+
1560
+ if (data.cache[nodeName]) {
1561
+ node = data.cache[nodeName].cloneNode();
1562
+ } else if (saveClones.test(nodeName)) {
1563
+ node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();
1564
+ } else {
1565
+ node = data.createElem(nodeName);
1566
+ }
1567
+
1568
+ // Avoid adding some elements to fragments in IE < 9 because
1569
+ // * Attributes like `name` or `type` cannot be set/changed once an element
1570
+ // is inserted into a document/fragment
1571
+ // * Link elements with `src` attributes that are inaccessible, as with
1572
+ // a 403 response, will cause the tab/window to crash
1573
+ // * Script elements appended to fragments will execute when their `src`
1574
+ // or `text` property is set
1575
+ return node.canHaveChildren && !reSkip.test(nodeName) && !node.tagUrn ? data.frag.appendChild(node) : node;
1576
+ }
1577
+
1578
+ /**
1579
+ * returns a shived DocumentFragment for the given document
1580
+ * @memberOf html5
1581
+ * @param {Document} ownerDocument The context document.
1582
+ * @returns {Object} The shived DocumentFragment.
1583
+ */
1584
+ function createDocumentFragment(ownerDocument, data){
1585
+ if (!ownerDocument) {
1586
+ ownerDocument = document;
1587
+ }
1588
+ if(supportsUnknownElements){
1589
+ return ownerDocument.createDocumentFragment();
1590
+ }
1591
+ data = data || getExpandoData(ownerDocument);
1592
+ var clone = data.frag.cloneNode(),
1593
+ i = 0,
1594
+ elems = getElements(),
1595
+ l = elems.length;
1596
+ for(;i<l;i++){
1597
+ clone.createElement(elems[i]);
1598
+ }
1599
+ return clone;
1600
+ }
1601
+
1602
+ /**
1603
+ * Shivs the `createElement` and `createDocumentFragment` methods of the document.
1604
+ * @private
1605
+ * @param {Document|DocumentFragment} ownerDocument The document.
1606
+ * @param {Object} data of the document.
1607
+ */
1608
+ function shivMethods(ownerDocument, data) {
1609
+ if (!data.cache) {
1610
+ data.cache = {};
1611
+ data.createElem = ownerDocument.createElement;
1612
+ data.createFrag = ownerDocument.createDocumentFragment;
1613
+ data.frag = data.createFrag();
1614
+ }
1615
+
1616
+
1617
+ ownerDocument.createElement = function(nodeName) {
1618
+ //abort shiv
1619
+ if (!html5.shivMethods) {
1620
+ return data.createElem(nodeName);
1621
+ }
1622
+ return createElement(nodeName, ownerDocument, data);
1623
+ };
1624
+
1625
+ ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +
1626
+ 'var n=f.cloneNode(),c=n.createElement;' +
1627
+ 'h.shivMethods&&(' +
1628
+ // unroll the `createElement` calls
1629
+ getElements().join().replace(/[\w\-:]+/g, function(nodeName) {
1630
+ data.createElem(nodeName);
1631
+ data.frag.createElement(nodeName);
1632
+ return 'c("' + nodeName + '")';
1633
+ }) +
1634
+ ');return n}'
1635
+ )(html5, data.frag);
1636
+ }
1637
+
1638
+ /*--------------------------------------------------------------------------*/
1639
+
1640
+ /**
1641
+ * Shivs the given document.
1642
+ * @memberOf html5
1643
+ * @param {Document} ownerDocument The document to shiv.
1644
+ * @returns {Document} The shived document.
1645
+ */
1646
+ function shivDocument(ownerDocument) {
1647
+ if (!ownerDocument) {
1648
+ ownerDocument = document;
1649
+ }
1650
+ var data = getExpandoData(ownerDocument);
1651
+
1652
+ if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {
1653
+ data.hasCSS = !!addStyleSheet(ownerDocument,
1654
+ // corrects block display not defined in IE6/7/8/9
1655
+ 'article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}' +
1656
+ // adds styling not present in IE6/7/8/9
1657
+ 'mark{background:#FF0;color:#000}' +
1658
+ // hides non-rendered elements
1659
+ 'template{display:none}'
1660
+ );
1661
+ }
1662
+ if (!supportsUnknownElements) {
1663
+ shivMethods(ownerDocument, data);
1664
+ }
1665
+ return ownerDocument;
1666
+ }
1667
+
1668
+ /*--------------------------------------------------------------------------*/
1669
+
1670
+ /**
1671
+ * The `html5` object is exposed so that more elements can be shived and
1672
+ * existing shiving can be detected on iframes.
1673
+ * @type Object
1674
+ * @example
1675
+ *
1676
+ * // options can be changed before the script is included
1677
+ * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };
1678
+ */
1679
+ var html5 = {
1680
+
1681
+ /**
1682
+ * An array or space separated string of node names of the elements to shiv.
1683
+ * @memberOf html5
1684
+ * @type Array|String
1685
+ */
1686
+ 'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video',
1687
+
1688
+ /**
1689
+ * current version of html5shiv
1690
+ */
1691
+ 'version': version,
1692
+
1693
+ /**
1694
+ * A flag to indicate that the HTML5 style sheet should be inserted.
1695
+ * @memberOf html5
1696
+ * @type Boolean
1697
+ */
1698
+ 'shivCSS': (options.shivCSS !== false),
1699
+
1700
+ /**
1701
+ * Is equal to true if a browser supports creating unknown/HTML5 elements
1702
+ * @memberOf html5
1703
+ * @type boolean
1704
+ */
1705
+ 'supportsUnknownElements': supportsUnknownElements,
1706
+
1707
+ /**
1708
+ * A flag to indicate that the document's `createElement` and `createDocumentFragment`
1709
+ * methods should be overwritten.
1710
+ * @memberOf html5
1711
+ * @type Boolean
1712
+ */
1713
+ 'shivMethods': (options.shivMethods !== false),
1714
+
1715
+ /**
1716
+ * A string to describe the type of `html5` object ("default" or "default print").
1717
+ * @memberOf html5
1718
+ * @type String
1719
+ */
1720
+ 'type': 'default',
1721
+
1722
+ // shivs the document according to the specified `html5` object options
1723
+ 'shivDocument': shivDocument,
1724
+
1725
+ //creates a shived element
1726
+ createElement: createElement,
1727
+
1728
+ //creates a shived documentFragment
1729
+ createDocumentFragment: createDocumentFragment,
1730
+
1731
+ //extends list of elements
1732
+ addElements: addElements
1733
+ };
1734
+
1735
+ /*--------------------------------------------------------------------------*/
1736
+
1737
+ // expose html5
1738
+ window.html5 = html5;
1739
+
1740
+ // shiv the document
1741
+ shivDocument(document);
1742
+
1743
+ /*------------------------------- Print Shiv -------------------------------*/
1744
+
1745
+ /** Used to filter media types */
1746
+ var reMedia = /^$|\b(?:all|print)\b/;
1747
+
1748
+ /** Used to namespace printable elements */
1749
+ var shivNamespace = 'html5shiv';
1750
+
1751
+ /** Detect whether the browser supports shivable style sheets */
1752
+ var supportsShivableSheets = !supportsUnknownElements && (function() {
1753
+ // assign a false negative if unable to shiv
1754
+ var docEl = document.documentElement;
1755
+ return !(
1756
+ typeof document.namespaces == 'undefined' ||
1757
+ typeof document.parentWindow == 'undefined' ||
1758
+ typeof docEl.applyElement == 'undefined' ||
1759
+ typeof docEl.removeNode == 'undefined' ||
1760
+ typeof window.attachEvent == 'undefined'
1761
+ );
1762
+ }());
1763
+
1764
+ /*--------------------------------------------------------------------------*/
1765
+
1766
+ /**
1767
+ * Wraps all HTML5 elements in the given document with printable elements.
1768
+ * (eg. the "header" element is wrapped with the "html5shiv:header" element)
1769
+ * @private
1770
+ * @param {Document} ownerDocument The document.
1771
+ * @returns {Array} An array wrappers added.
1772
+ */
1773
+ function addWrappers(ownerDocument) {
1774
+ var node,
1775
+ nodes = ownerDocument.getElementsByTagName('*'),
1776
+ index = nodes.length,
1777
+ reElements = RegExp('^(?:' + getElements().join('|') + ')$', 'i'),
1778
+ result = [];
1779
+
1780
+ while (index--) {
1781
+ node = nodes[index];
1782
+ if (reElements.test(node.nodeName)) {
1783
+ result.push(node.applyElement(createWrapper(node)));
1784
+ }
1785
+ }
1786
+ return result;
1787
+ }
1788
+
1789
+ /**
1790
+ * Creates a printable wrapper for the given element.
1791
+ * @private
1792
+ * @param {Element} element The element.
1793
+ * @returns {Element} The wrapper.
1794
+ */
1795
+ function createWrapper(element) {
1796
+ var node,
1797
+ nodes = element.attributes,
1798
+ index = nodes.length,
1799
+ wrapper = element.ownerDocument.createElement(shivNamespace + ':' + element.nodeName);
1800
+
1801
+ // copy element attributes to the wrapper
1802
+ while (index--) {
1803
+ node = nodes[index];
1804
+ node.specified && wrapper.setAttribute(node.nodeName, node.nodeValue);
1805
+ }
1806
+ // copy element styles to the wrapper
1807
+ wrapper.style.cssText = element.style.cssText;
1808
+ return wrapper;
1809
+ }
1810
+
1811
+ /**
1812
+ * Shivs the given CSS text.
1813
+ * (eg. header{} becomes html5shiv\:header{})
1814
+ * @private
1815
+ * @param {String} cssText The CSS text to shiv.
1816
+ * @returns {String} The shived CSS text.
1817
+ */
1818
+ function shivCssText(cssText) {
1819
+ var pair,
1820
+ parts = cssText.split('{'),
1821
+ index = parts.length,
1822
+ reElements = RegExp('(^|[\\s,>+~])(' + getElements().join('|') + ')(?=[[\\s,>+~#.:]|$)', 'gi'),
1823
+ replacement = '$1' + shivNamespace + '\\:$2';
1824
+
1825
+ while (index--) {
1826
+ pair = parts[index] = parts[index].split('}');
1827
+ pair[pair.length - 1] = pair[pair.length - 1].replace(reElements, replacement);
1828
+ parts[index] = pair.join('}');
1829
+ }
1830
+ return parts.join('{');
1831
+ }
1832
+
1833
+ /**
1834
+ * Removes the given wrappers, leaving the original elements.
1835
+ * @private
1836
+ * @params {Array} wrappers An array of printable wrappers.
1837
+ */
1838
+ function removeWrappers(wrappers) {
1839
+ var index = wrappers.length;
1840
+ while (index--) {
1841
+ wrappers[index].removeNode();
1842
+ }
1843
+ }
1844
+
1845
+ /*--------------------------------------------------------------------------*/
1846
+
1847
+ /**
1848
+ * Shivs the given document for print.
1849
+ * @memberOf html5
1850
+ * @param {Document} ownerDocument The document to shiv.
1851
+ * @returns {Document} The shived document.
1852
+ */
1853
+ function shivPrint(ownerDocument) {
1854
+ var shivedSheet,
1855
+ wrappers,
1856
+ data = getExpandoData(ownerDocument),
1857
+ namespaces = ownerDocument.namespaces,
1858
+ ownerWindow = ownerDocument.parentWindow;
1859
+
1860
+ if (!supportsShivableSheets || ownerDocument.printShived) {
1861
+ return ownerDocument;
1862
+ }
1863
+ if (typeof namespaces[shivNamespace] == 'undefined') {
1864
+ namespaces.add(shivNamespace);
1865
+ }
1866
+
1867
+ function removeSheet() {
1868
+ clearTimeout(data._removeSheetTimer);
1869
+ if (shivedSheet) {
1870
+ shivedSheet.removeNode(true);
1871
+ }
1872
+ shivedSheet= null;
1873
+ }
1874
+
1875
+ ownerWindow.attachEvent('onbeforeprint', function() {
1876
+
1877
+ removeSheet();
1878
+
1879
+ var imports,
1880
+ length,
1881
+ sheet,
1882
+ collection = ownerDocument.styleSheets,
1883
+ cssText = [],
1884
+ index = collection.length,
1885
+ sheets = Array(index);
1886
+
1887
+ // convert styleSheets collection to an array
1888
+ while (index--) {
1889
+ sheets[index] = collection[index];
1890
+ }
1891
+ // concat all style sheet CSS text
1892
+ while ((sheet = sheets.pop())) {
1893
+ // IE does not enforce a same origin policy for external style sheets...
1894
+ // but has trouble with some dynamically created stylesheets
1895
+ if (!sheet.disabled && reMedia.test(sheet.media)) {
1896
+
1897
+ try {
1898
+ imports = sheet.imports;
1899
+ length = imports.length;
1900
+ } catch(er){
1901
+ length = 0;
1902
+ }
1903
+
1904
+ for (index = 0; index < length; index++) {
1905
+ sheets.push(imports[index]);
1906
+ }
1907
+
1908
+ try {
1909
+ cssText.push(sheet.cssText);
1910
+ } catch(er){}
1911
+ }
1912
+ }
1913
+
1914
+ // wrap all HTML5 elements with printable elements and add the shived style sheet
1915
+ cssText = shivCssText(cssText.reverse().join(''));
1916
+ wrappers = addWrappers(ownerDocument);
1917
+ shivedSheet = addStyleSheet(ownerDocument, cssText);
1918
+
1919
+ });
1920
+
1921
+ ownerWindow.attachEvent('onafterprint', function() {
1922
+ // remove wrappers, leaving the original elements, and remove the shived style sheet
1923
+ removeWrappers(wrappers);
1924
+ clearTimeout(data._removeSheetTimer);
1925
+ data._removeSheetTimer = setTimeout(removeSheet, 500);
1926
+ });
1927
+
1928
+ ownerDocument.printShived = true;
1929
+ return ownerDocument;
1930
+ }
1931
+
1932
+ /*--------------------------------------------------------------------------*/
1933
+
1934
+ // expose API
1935
+ html5.type += ' print';
1936
+ html5.shivPrint = shivPrint;
1937
+
1938
+ // shiv for print
1939
+ shivPrint(document);
1940
+
1941
+ if(typeof module == 'object' && module.exports){
1942
+ module.exports = html5;
1943
+ }
1944
+
1945
+ }(typeof window !== "undefined" ? window : this, document));
1946
+
1947
+ // Copyright 2009-2012 by contributors, MIT License
1948
+ // vim: ts=4 sts=4 sw=4 expandtab
1949
+
1950
+ //Add semicolon to prevent IIFE from being passed as argument to concated code.
1951
+ ;
1952
+ // Module systems magic dance
1953
+ (function (definition) {
1954
+ // RequireJS
1955
+ if (typeof define == "function") {
1956
+ define(definition);
1957
+ // YUI3
1958
+ } else if (typeof YUI == "function") {
1959
+ YUI.add("es5", definition);
1960
+ // CommonJS and <script>
1961
+ } else {
1962
+ definition();
1963
+ }
1964
+ })(function () {
1965
+
1966
+ /**
1967
+ * Brings an environment as close to ECMAScript 5 compliance
1968
+ * as is possible with the facilities of erstwhile engines.
1969
+ *
1970
+ * Annotated ES5: http://es5.github.com/ (specific links below)
1971
+ * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
1972
+ * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
1973
+ */
1974
+
1975
+ // ES-5 15.1.2.2
1976
+ if (parseInt('08') !== 8) {
1977
+ parseInt = (function (origParseInt) {
1978
+ var hexRegex = /^0[xX]/;
1979
+ return function parseIntES5(str, radix) {
1980
+ str = String(str).trim();
1981
+ if (!+radix) {
1982
+ radix = hexRegex.test(str) ? 16 : 10;
1983
+ }
1984
+ return origParseInt(str, radix);
1985
+ };
1986
+ }(parseInt));
1987
+ }
1988
+
1989
+ //
1990
+ // Function
1991
+ // ========
1992
+ //
1993
+
1994
+ // ES-5 15.3.4.5
1995
+ // http://es5.github.com/#x15.3.4.5
1996
+
1997
+ function Empty() {}
1998
+
1999
+ if (!Function.prototype.bind) {
2000
+ Function.prototype.bind = function bind(that) { // .length is 1
2001
+ // 1. Let Target be the this value.
2002
+ var target = this;
2003
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
2004
+ if (typeof target != "function") {
2005
+ throw new TypeError("Function.prototype.bind called on incompatible " + target);
2006
+ }
2007
+ // 3. Let A be a new (possibly empty) internal list of all of the
2008
+ // argument values provided after thisArg (arg1, arg2 etc), in order.
2009
+ // XXX slicedArgs will stand in for "A" if used
2010
+ var args = _Array_slice_.call(arguments, 1); // for normal call
2011
+ // 4. Let F be a new native ECMAScript object.
2012
+ // 11. Set the [[Prototype]] internal property of F to the standard
2013
+ // built-in Function prototype object as specified in 15.3.3.1.
2014
+ // 12. Set the [[Call]] internal property of F as described in
2015
+ // 15.3.4.5.1.
2016
+ // 13. Set the [[Construct]] internal property of F as described in
2017
+ // 15.3.4.5.2.
2018
+ // 14. Set the [[HasInstance]] internal property of F as described in
2019
+ // 15.3.4.5.3.
2020
+ var binder = function () {
2021
+
2022
+ if (this instanceof bound) {
2023
+ // 15.3.4.5.2 [[Construct]]
2024
+ // When the [[Construct]] internal method of a function object,
2025
+ // F that was created using the bind function is called with a
2026
+ // list of arguments ExtraArgs, the following steps are taken:
2027
+ // 1. Let target be the value of F's [[TargetFunction]]
2028
+ // internal property.
2029
+ // 2. If target has no [[Construct]] internal method, a
2030
+ // TypeError exception is thrown.
2031
+ // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
2032
+ // property.
2033
+ // 4. Let args be a new list containing the same values as the
2034
+ // list boundArgs in the same order followed by the same
2035
+ // values as the list ExtraArgs in the same order.
2036
+ // 5. Return the result of calling the [[Construct]] internal
2037
+ // method of target providing args as the arguments.
2038
+
2039
+ var result = target.apply(
2040
+ this,
2041
+ args.concat(_Array_slice_.call(arguments))
2042
+ );
2043
+ if (Object(result) === result) {
2044
+ return result;
2045
+ }
2046
+ return this;
2047
+
2048
+ } else {
2049
+ // 15.3.4.5.1 [[Call]]
2050
+ // When the [[Call]] internal method of a function object, F,
2051
+ // which was created using the bind function is called with a
2052
+ // this value and a list of arguments ExtraArgs, the following
2053
+ // steps are taken:
2054
+ // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
2055
+ // property.
2056
+ // 2. Let boundThis be the value of F's [[BoundThis]] internal
2057
+ // property.
2058
+ // 3. Let target be the value of F's [[TargetFunction]] internal
2059
+ // property.
2060
+ // 4. Let args be a new list containing the same values as the
2061
+ // list boundArgs in the same order followed by the same
2062
+ // values as the list ExtraArgs in the same order.
2063
+ // 5. Return the result of calling the [[Call]] internal method
2064
+ // of target providing boundThis as the this value and
2065
+ // providing args as the arguments.
2066
+
2067
+ // equiv: target.call(this, ...boundArgs, ...args)
2068
+ return target.apply(
2069
+ that,
2070
+ args.concat(_Array_slice_.call(arguments))
2071
+ );
2072
+
2073
+ }
2074
+
2075
+ };
2076
+
2077
+ // 15. If the [[Class]] internal property of Target is "Function", then
2078
+ // a. Let L be the length property of Target minus the length of A.
2079
+ // b. Set the length own property of F to either 0 or L, whichever is
2080
+ // larger.
2081
+ // 16. Else set the length own property of F to 0.
2082
+
2083
+ var boundLength = Math.max(0, target.length - args.length);
2084
+
2085
+ // 17. Set the attributes of the length own property of F to the values
2086
+ // specified in 15.3.5.1.
2087
+ var boundArgs = [];
2088
+ for (var i = 0; i < boundLength; i++) {
2089
+ boundArgs.push("$" + i);
2090
+ }
2091
+
2092
+ // XXX Build a dynamic function with desired amount of arguments is the only
2093
+ // way to set the length property of a function.
2094
+ // In environments where Content Security Policies enabled (Chrome extensions,
2095
+ // for ex.) all use of eval or Function costructor throws an exception.
2096
+ // However in all of these environments Function.prototype.bind exists
2097
+ // and so this code will never be executed.
2098
+ var bound = Function("binder", "return function(" + boundArgs.join(",") + "){return binder.apply(this,arguments)}")(binder);
2099
+
2100
+ if (target.prototype) {
2101
+ Empty.prototype = target.prototype;
2102
+ bound.prototype = new Empty();
2103
+ // Clean up dangling references.
2104
+ Empty.prototype = null;
2105
+ }
2106
+
2107
+ // TODO
2108
+ // 18. Set the [[Extensible]] internal property of F to true.
2109
+
2110
+ // TODO
2111
+ // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
2112
+ // 20. Call the [[DefineOwnProperty]] internal method of F with
2113
+ // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
2114
+ // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
2115
+ // false.
2116
+ // 21. Call the [[DefineOwnProperty]] internal method of F with
2117
+ // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
2118
+ // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
2119
+ // and false.
2120
+
2121
+ // TODO
2122
+ // NOTE Function objects created using Function.prototype.bind do not
2123
+ // have a prototype property or the [[Code]], [[FormalParameters]], and
2124
+ // [[Scope]] internal properties.
2125
+ // XXX can't delete prototype in pure-js.
2126
+
2127
+ // 22. Return F.
2128
+ return bound;
2129
+ };
2130
+ }
2131
+
2132
+ // Shortcut to an often accessed properties, in order to avoid multiple
2133
+ // dereference that costs universally.
2134
+ // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
2135
+ // us it in defining shortcuts.
2136
+ var call = Function.prototype.call;
2137
+ var prototypeOfArray = Array.prototype;
2138
+ var prototypeOfObject = Object.prototype;
2139
+ var _Array_slice_ = prototypeOfArray.slice;
2140
+ // Having a toString local variable name breaks in Opera so use _toString.
2141
+ var _toString = call.bind(prototypeOfObject.toString);
2142
+ var owns = call.bind(prototypeOfObject.hasOwnProperty);
2143
+
2144
+ // If JS engine supports accessors creating shortcuts.
2145
+ var defineGetter;
2146
+ var defineSetter;
2147
+ var lookupGetter;
2148
+ var lookupSetter;
2149
+ var supportsAccessors;
2150
+ if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
2151
+ defineGetter = call.bind(prototypeOfObject.__defineGetter__);
2152
+ defineSetter = call.bind(prototypeOfObject.__defineSetter__);
2153
+ lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
2154
+ lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
2155
+ }
2156
+
2157
+ //
2158
+ // Array
2159
+ // =====
2160
+ //
2161
+
2162
+ // ES5 15.4.4.12
2163
+ // http://es5.github.com/#x15.4.4.12
2164
+ // Default value for second param
2165
+ // [bugfix, ielt9, old browsers]
2166
+ // IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12"
2167
+ if ([1,2].splice(0).length != 2) {
2168
+ var array_splice = Array.prototype.splice;
2169
+ var array_push = Array.prototype.push;
2170
+ var array_unshift = Array.prototype.unshift;
2171
+
2172
+ if (function() { // test IE < 9 to splice bug - see issue #138
2173
+ function makeArray(l) {
2174
+ var a = [];
2175
+ while (l--) {
2176
+ a.unshift(l)
2177
+ }
2178
+ return a
2179
+ }
2180
+
2181
+ var array = []
2182
+ , lengthBefore
2183
+ ;
2184
+
2185
+ array.splice.bind(array, 0, 0).apply(null, makeArray(20));
2186
+ array.splice.bind(array, 0, 0).apply(null, makeArray(26));
2187
+
2188
+ lengthBefore = array.length; //20
2189
+ array.splice(5, 0, "XXX"); // add one element
2190
+
2191
+ if (lengthBefore + 1 == array.length) {
2192
+ return true;// has right splice implementation without bugs
2193
+ }
2194
+ // else {
2195
+ // IE8 bug
2196
+ // }
2197
+ }()) {//IE 6/7
2198
+ Array.prototype.splice = function(start, deleteCount) {
2199
+ if (!arguments.length) {
2200
+ return [];
2201
+ } else {
2202
+ return array_splice.apply(this, [
2203
+ start === void 0 ? 0 : start,
2204
+ deleteCount === void 0 ? (this.length - start) : deleteCount
2205
+ ].concat(_Array_slice_.call(arguments, 2)))
2206
+ }
2207
+ };
2208
+ }
2209
+ else {//IE8
2210
+ Array.prototype.splice = function(start, deleteCount) {
2211
+ var result
2212
+ , args = _Array_slice_.call(arguments, 2)
2213
+ , addElementsCount = args.length
2214
+ ;
2215
+
2216
+ if (!arguments.length) {
2217
+ return [];
2218
+ }
2219
+
2220
+ if (start === void 0) { // default
2221
+ start = 0;
2222
+ }
2223
+ if (deleteCount === void 0) { // default
2224
+ deleteCount = this.length - start;
2225
+ }
2226
+
2227
+ if (addElementsCount > 0) {
2228
+ if (deleteCount <= 0) {
2229
+ if (start == this.length) { // tiny optimisation #1
2230
+ array_push.apply(this, args);
2231
+ return [];
2232
+ }
2233
+
2234
+ if (start == 0) { // tiny optimisation #2
2235
+ array_unshift.apply(this, args);
2236
+ return [];
2237
+ }
2238
+ }
2239
+
2240
+ // Array.prototype.splice implementation
2241
+ result = _Array_slice_.call(this, start, start + deleteCount);// delete part
2242
+ args.push.apply(args, _Array_slice_.call(this, start + deleteCount, this.length));// right part
2243
+ args.unshift.apply(args, _Array_slice_.call(this, 0, start));// left part
2244
+
2245
+ // delete all items from this array and replace it to 'left part' + _Array_slice_.call(arguments, 2) + 'right part'
2246
+ args.unshift(0, this.length);
2247
+
2248
+ array_splice.apply(this, args);
2249
+
2250
+ return result;
2251
+ }
2252
+
2253
+ return array_splice.call(this, start, deleteCount);
2254
+ }
2255
+
2256
+ }
2257
+ }
2258
+
2259
+ // ES5 15.4.4.12
2260
+ // http://es5.github.com/#x15.4.4.13
2261
+ // Return len+argCount.
2262
+ // [bugfix, ielt8]
2263
+ // IE < 8 bug: [].unshift(0) == undefined but should be "1"
2264
+ if ([].unshift(0) != 1) {
2265
+ var array_unshift = Array.prototype.unshift;
2266
+ Array.prototype.unshift = function() {
2267
+ array_unshift.apply(this, arguments);
2268
+ return this.length;
2269
+ };
2270
+ }
2271
+
2272
+ // ES5 15.4.3.2
2273
+ // http://es5.github.com/#x15.4.3.2
2274
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
2275
+ if (!Array.isArray) {
2276
+ Array.isArray = function isArray(obj) {
2277
+ return _toString(obj) == "[object Array]";
2278
+ };
2279
+ }
2280
+
2281
+ // The IsCallable() check in the Array functions
2282
+ // has been replaced with a strict check on the
2283
+ // internal class of the object to trap cases where
2284
+ // the provided function was actually a regular
2285
+ // expression literal, which in V8 and
2286
+ // JavaScriptCore is a typeof "function". Only in
2287
+ // V8 are regular expression literals permitted as
2288
+ // reduce parameters, so it is desirable in the
2289
+ // general case for the shim to match the more
2290
+ // strict and common behavior of rejecting regular
2291
+ // expressions.
2292
+
2293
+ // ES5 15.4.4.18
2294
+ // http://es5.github.com/#x15.4.4.18
2295
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
2296
+
2297
+ // Check failure of by-index access of string characters (IE < 9)
2298
+ // and failure of `0 in boxedString` (Rhino)
2299
+ var boxedString = Object("a"),
2300
+ splitString = boxedString[0] != "a" || !(0 in boxedString);
2301
+ // Check node 0.6.21 bug where third parameter is not boxed
2302
+ var boxedForEach = true;
2303
+ if (Array.prototype.forEach) {
2304
+ Array.prototype.forEach.call("foo", function(item, i, obj) {
2305
+ if (typeof obj !== 'object') boxedForEach = false;
2306
+ });
2307
+ }
2308
+
2309
+ if (!Array.prototype.forEach || !boxedForEach) {
2310
+ Array.prototype.forEach = function forEach(fun /*, thisp*/) {
2311
+ var object = toObject(this),
2312
+ self = splitString && _toString(this) == "[object String]" ?
2313
+ this.split("") :
2314
+ object,
2315
+ thisp = arguments[1],
2316
+ i = -1,
2317
+ length = self.length >>> 0;
2318
+
2319
+ // If no callback function or if callback is not a callable function
2320
+ if (_toString(fun) != "[object Function]") {
2321
+ throw new TypeError(); // TODO message
2322
+ }
2323
+
2324
+ while (++i < length) {
2325
+ if (i in self) {
2326
+ // Invoke the callback function with call, passing arguments:
2327
+ // context, property value, property key, thisArg object
2328
+ // context
2329
+ fun.call(thisp, self[i], i, object);
2330
+ }
2331
+ }
2332
+ };
2333
+ }
2334
+
2335
+ // ES5 15.4.4.19
2336
+ // http://es5.github.com/#x15.4.4.19
2337
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
2338
+ if (!Array.prototype.map) {
2339
+ Array.prototype.map = function map(fun /*, thisp*/) {
2340
+ var object = toObject(this),
2341
+ self = splitString && _toString(this) == "[object String]" ?
2342
+ this.split("") :
2343
+ object,
2344
+ length = self.length >>> 0,
2345
+ result = Array(length),
2346
+ thisp = arguments[1];
2347
+
2348
+ // If no callback function or if callback is not a callable function
2349
+ if (_toString(fun) != "[object Function]") {
2350
+ throw new TypeError(fun + " is not a function");
2351
+ }
2352
+
2353
+ for (var i = 0; i < length; i++) {
2354
+ if (i in self)
2355
+ result[i] = fun.call(thisp, self[i], i, object);
2356
+ }
2357
+ return result;
2358
+ };
2359
+ }
2360
+
2361
+ // ES5 15.4.4.20
2362
+ // http://es5.github.com/#x15.4.4.20
2363
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
2364
+ if (!Array.prototype.filter) {
2365
+ Array.prototype.filter = function filter(fun /*, thisp */) {
2366
+ var object = toObject(this),
2367
+ self = splitString && _toString(this) == "[object String]" ?
2368
+ this.split("") :
2369
+ object,
2370
+ length = self.length >>> 0,
2371
+ result = [],
2372
+ value,
2373
+ thisp = arguments[1];
2374
+
2375
+ // If no callback function or if callback is not a callable function
2376
+ if (_toString(fun) != "[object Function]") {
2377
+ throw new TypeError(fun + " is not a function");
2378
+ }
2379
+
2380
+ for (var i = 0; i < length; i++) {
2381
+ if (i in self) {
2382
+ value = self[i];
2383
+ if (fun.call(thisp, value, i, object)) {
2384
+ result.push(value);
2385
+ }
2386
+ }
2387
+ }
2388
+ return result;
2389
+ };
2390
+ }
2391
+
2392
+ // ES5 15.4.4.16
2393
+ // http://es5.github.com/#x15.4.4.16
2394
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
2395
+ if (!Array.prototype.every) {
2396
+ Array.prototype.every = function every(fun /*, thisp */) {
2397
+ var object = toObject(this),
2398
+ self = splitString && _toString(this) == "[object String]" ?
2399
+ this.split("") :
2400
+ object,
2401
+ length = self.length >>> 0,
2402
+ thisp = arguments[1];
2403
+
2404
+ // If no callback function or if callback is not a callable function
2405
+ if (_toString(fun) != "[object Function]") {
2406
+ throw new TypeError(fun + " is not a function");
2407
+ }
2408
+
2409
+ for (var i = 0; i < length; i++) {
2410
+ if (i in self && !fun.call(thisp, self[i], i, object)) {
2411
+ return false;
2412
+ }
2413
+ }
2414
+ return true;
2415
+ };
2416
+ }
2417
+
2418
+ // ES5 15.4.4.17
2419
+ // http://es5.github.com/#x15.4.4.17
2420
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
2421
+ if (!Array.prototype.some) {
2422
+ Array.prototype.some = function some(fun /*, thisp */) {
2423
+ var object = toObject(this),
2424
+ self = splitString && _toString(this) == "[object String]" ?
2425
+ this.split("") :
2426
+ object,
2427
+ length = self.length >>> 0,
2428
+ thisp = arguments[1];
2429
+
2430
+ // If no callback function or if callback is not a callable function
2431
+ if (_toString(fun) != "[object Function]") {
2432
+ throw new TypeError(fun + " is not a function");
2433
+ }
2434
+
2435
+ for (var i = 0; i < length; i++) {
2436
+ if (i in self && fun.call(thisp, self[i], i, object)) {
2437
+ return true;
2438
+ }
2439
+ }
2440
+ return false;
2441
+ };
2442
+ }
2443
+
2444
+ // ES5 15.4.4.21
2445
+ // http://es5.github.com/#x15.4.4.21
2446
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
2447
+ if (!Array.prototype.reduce) {
2448
+ Array.prototype.reduce = function reduce(fun /*, initial*/) {
2449
+ var object = toObject(this),
2450
+ self = splitString && _toString(this) == "[object String]" ?
2451
+ this.split("") :
2452
+ object,
2453
+ length = self.length >>> 0;
2454
+
2455
+ // If no callback function or if callback is not a callable function
2456
+ if (_toString(fun) != "[object Function]") {
2457
+ throw new TypeError(fun + " is not a function");
2458
+ }
2459
+
2460
+ // no value to return if no initial value and an empty array
2461
+ if (!length && arguments.length == 1) {
2462
+ throw new TypeError("reduce of empty array with no initial value");
2463
+ }
2464
+
2465
+ var i = 0;
2466
+ var result;
2467
+ if (arguments.length >= 2) {
2468
+ result = arguments[1];
2469
+ } else {
2470
+ do {
2471
+ if (i in self) {
2472
+ result = self[i++];
2473
+ break;
2474
+ }
2475
+
2476
+ // if array contains no values, no initial value to return
2477
+ if (++i >= length) {
2478
+ throw new TypeError("reduce of empty array with no initial value");
2479
+ }
2480
+ } while (true);
2481
+ }
2482
+
2483
+ for (; i < length; i++) {
2484
+ if (i in self) {
2485
+ result = fun.call(void 0, result, self[i], i, object);
2486
+ }
2487
+ }
2488
+
2489
+ return result;
2490
+ };
2491
+ }
2492
+
2493
+ // ES5 15.4.4.22
2494
+ // http://es5.github.com/#x15.4.4.22
2495
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
2496
+ if (!Array.prototype.reduceRight) {
2497
+ Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
2498
+ var object = toObject(this),
2499
+ self = splitString && _toString(this) == "[object String]" ?
2500
+ this.split("") :
2501
+ object,
2502
+ length = self.length >>> 0;
2503
+
2504
+ // If no callback function or if callback is not a callable function
2505
+ if (_toString(fun) != "[object Function]") {
2506
+ throw new TypeError(fun + " is not a function");
2507
+ }
2508
+
2509
+ // no value to return if no initial value, empty array
2510
+ if (!length && arguments.length == 1) {
2511
+ throw new TypeError("reduceRight of empty array with no initial value");
2512
+ }
2513
+
2514
+ var result, i = length - 1;
2515
+ if (arguments.length >= 2) {
2516
+ result = arguments[1];
2517
+ } else {
2518
+ do {
2519
+ if (i in self) {
2520
+ result = self[i--];
2521
+ break;
2522
+ }
2523
+
2524
+ // if array contains no values, no initial value to return
2525
+ if (--i < 0) {
2526
+ throw new TypeError("reduceRight of empty array with no initial value");
2527
+ }
2528
+ } while (true);
2529
+ }
2530
+
2531
+ if (i < 0) {
2532
+ return result;
2533
+ }
2534
+
2535
+ do {
2536
+ if (i in this) {
2537
+ result = fun.call(void 0, result, self[i], i, object);
2538
+ }
2539
+ } while (i--);
2540
+
2541
+ return result;
2542
+ };
2543
+ }
2544
+
2545
+ // ES5 15.4.4.14
2546
+ // http://es5.github.com/#x15.4.4.14
2547
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
2548
+ if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
2549
+ Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
2550
+ var self = splitString && _toString(this) == "[object String]" ?
2551
+ this.split("") :
2552
+ toObject(this),
2553
+ length = self.length >>> 0;
2554
+
2555
+ if (!length) {
2556
+ return -1;
2557
+ }
2558
+
2559
+ var i = 0;
2560
+ if (arguments.length > 1) {
2561
+ i = toInteger(arguments[1]);
2562
+ }
2563
+
2564
+ // handle negative indices
2565
+ i = i >= 0 ? i : Math.max(0, length + i);
2566
+ for (; i < length; i++) {
2567
+ if (i in self && self[i] === sought) {
2568
+ return i;
2569
+ }
2570
+ }
2571
+ return -1;
2572
+ };
2573
+ }
2574
+
2575
+ // ES5 15.4.4.15
2576
+ // http://es5.github.com/#x15.4.4.15
2577
+ // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
2578
+ if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
2579
+ Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
2580
+ var self = splitString && _toString(this) == "[object String]" ?
2581
+ this.split("") :
2582
+ toObject(this),
2583
+ length = self.length >>> 0;
2584
+
2585
+ if (!length) {
2586
+ return -1;
2587
+ }
2588
+ var i = length - 1;
2589
+ if (arguments.length > 1) {
2590
+ i = Math.min(i, toInteger(arguments[1]));
2591
+ }
2592
+ // handle negative indices
2593
+ i = i >= 0 ? i : length - Math.abs(i);
2594
+ for (; i >= 0; i--) {
2595
+ if (i in self && sought === self[i]) {
2596
+ return i;
2597
+ }
2598
+ }
2599
+ return -1;
2600
+ };
2601
+ }
2602
+
2603
+ //
2604
+ // Object
2605
+ // ======
2606
+ //
2607
+
2608
+ // ES5 15.2.3.14
2609
+ // http://es5.github.com/#x15.2.3.14
2610
+ if (!Object.keys) {
2611
+ // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
2612
+ var hasDontEnumBug = true,
2613
+ dontEnums = [
2614
+ "toString",
2615
+ "toLocaleString",
2616
+ "valueOf",
2617
+ "hasOwnProperty",
2618
+ "isPrototypeOf",
2619
+ "propertyIsEnumerable",
2620
+ "constructor"
2621
+ ],
2622
+ dontEnumsLength = dontEnums.length;
2623
+
2624
+ for (var key in {"toString": null}) {
2625
+ hasDontEnumBug = false;
2626
+ }
2627
+
2628
+ Object.keys = function keys(object) {
2629
+
2630
+ if (
2631
+ (typeof object != "object" && typeof object != "function") ||
2632
+ object === null
2633
+ ) {
2634
+ throw new TypeError("Object.keys called on a non-object");
2635
+ }
2636
+
2637
+ var keys = [];
2638
+ for (var name in object) {
2639
+ if (owns(object, name)) {
2640
+ keys.push(name);
2641
+ }
2642
+ }
2643
+
2644
+ if (hasDontEnumBug) {
2645
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
2646
+ var dontEnum = dontEnums[i];
2647
+ if (owns(object, dontEnum)) {
2648
+ keys.push(dontEnum);
2649
+ }
2650
+ }
2651
+ }
2652
+ return keys;
2653
+ };
2654
+
2655
+ }
2656
+
2657
+ //
2658
+ // Date
2659
+ // ====
2660
+ //
2661
+
2662
+ // ES5 15.9.5.43
2663
+ // http://es5.github.com/#x15.9.5.43
2664
+ // This function returns a String value represent the instance in time
2665
+ // represented by this Date object. The format of the String is the Date Time
2666
+ // string format defined in 15.9.1.15. All fields are present in the String.
2667
+ // The time zone is always UTC, denoted by the suffix Z. If the time value of
2668
+ // this object is not a finite Number a RangeError exception is thrown.
2669
+ var negativeDate = -62198755200000,
2670
+ negativeYearString = "-000001";
2671
+ if (
2672
+ !Date.prototype.toISOString ||
2673
+ (new Date(negativeDate).toISOString().indexOf(negativeYearString) === -1)
2674
+ ) {
2675
+ Date.prototype.toISOString = function toISOString() {
2676
+ var result, length, value, year, month;
2677
+ if (!isFinite(this)) {
2678
+ throw new RangeError("Date.prototype.toISOString called on non-finite value.");
2679
+ }
2680
+
2681
+ year = this.getUTCFullYear();
2682
+
2683
+ month = this.getUTCMonth();
2684
+ // see https://github.com/es-shims/es5-shim/issues/111
2685
+ year += Math.floor(month / 12);
2686
+ month = (month % 12 + 12) % 12;
2687
+
2688
+ // the date time string format is specified in 15.9.1.15.
2689
+ result = [month + 1, this.getUTCDate(),
2690
+ this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
2691
+ year = (
2692
+ (year < 0 ? "-" : (year > 9999 ? "+" : "")) +
2693
+ ("00000" + Math.abs(year))
2694
+ .slice(0 <= year && year <= 9999 ? -4 : -6)
2695
+ );
2696
+
2697
+ length = result.length;
2698
+ while (length--) {
2699
+ value = result[length];
2700
+ // pad months, days, hours, minutes, and seconds to have two
2701
+ // digits.
2702
+ if (value < 10) {
2703
+ result[length] = "0" + value;
2704
+ }
2705
+ }
2706
+ // pad milliseconds to have three digits.
2707
+ return (
2708
+ year + "-" + result.slice(0, 2).join("-") +
2709
+ "T" + result.slice(2).join(":") + "." +
2710
+ ("000" + this.getUTCMilliseconds()).slice(-3) + "Z"
2711
+ );
2712
+ };
2713
+ }
2714
+
2715
+
2716
+ // ES5 15.9.5.44
2717
+ // http://es5.github.com/#x15.9.5.44
2718
+ // This function provides a String representation of a Date object for use by
2719
+ // JSON.stringify (15.12.3).
2720
+ var dateToJSONIsSupported = false;
2721
+ try {
2722
+ dateToJSONIsSupported = (
2723
+ Date.prototype.toJSON &&
2724
+ new Date(NaN).toJSON() === null &&
2725
+ new Date(negativeDate).toJSON().indexOf(negativeYearString) !== -1 &&
2726
+ Date.prototype.toJSON.call({ // generic
2727
+ toISOString: function () {
2728
+ return true;
2729
+ }
2730
+ })
2731
+ );
2732
+ } catch (e) {
2733
+ }
2734
+ if (!dateToJSONIsSupported) {
2735
+ Date.prototype.toJSON = function toJSON(key) {
2736
+ // When the toJSON method is called with argument key, the following
2737
+ // steps are taken:
2738
+
2739
+ // 1. Let O be the result of calling ToObject, giving it the this
2740
+ // value as its argument.
2741
+ // 2. Let tv be toPrimitive(O, hint Number).
2742
+ var o = Object(this),
2743
+ tv = toPrimitive(o),
2744
+ toISO;
2745
+ // 3. If tv is a Number and is not finite, return null.
2746
+ if (typeof tv === "number" && !isFinite(tv)) {
2747
+ return null;
2748
+ }
2749
+ // 4. Let toISO be the result of calling the [[Get]] internal method of
2750
+ // O with argument "toISOString".
2751
+ toISO = o.toISOString;
2752
+ // 5. If IsCallable(toISO) is false, throw a TypeError exception.
2753
+ if (typeof toISO != "function") {
2754
+ throw new TypeError("toISOString property is not callable");
2755
+ }
2756
+ // 6. Return the result of calling the [[Call]] internal method of
2757
+ // toISO with O as the this value and an empty argument list.
2758
+ return toISO.call(o);
2759
+
2760
+ // NOTE 1 The argument is ignored.
2761
+
2762
+ // NOTE 2 The toJSON function is intentionally generic; it does not
2763
+ // require that its this value be a Date object. Therefore, it can be
2764
+ // transferred to other kinds of objects for use as a method. However,
2765
+ // it does require that any such object have a toISOString method. An
2766
+ // object is free to use the argument key to filter its
2767
+ // stringification.
2768
+ };
2769
+ }
2770
+
2771
+ // ES5 15.9.4.2
2772
+ // http://es5.github.com/#x15.9.4.2
2773
+ // based on work shared by Daniel Friesen (dantman)
2774
+ // http://gist.github.com/303249
2775
+ if (!Date.parse || "Date.parse is buggy") {
2776
+ // XXX global assignment won't work in embeddings that use
2777
+ // an alternate object for the context.
2778
+ Date = (function(NativeDate) {
2779
+
2780
+ // Date.length === 7
2781
+ function Date(Y, M, D, h, m, s, ms) {
2782
+ var length = arguments.length;
2783
+ if (this instanceof NativeDate) {
2784
+ var date = length == 1 && String(Y) === Y ? // isString(Y)
2785
+ // We explicitly pass it through parse:
2786
+ new NativeDate(Date.parse(Y)) :
2787
+ // We have to manually make calls depending on argument
2788
+ // length here
2789
+ length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
2790
+ length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
2791
+ length >= 5 ? new NativeDate(Y, M, D, h, m) :
2792
+ length >= 4 ? new NativeDate(Y, M, D, h) :
2793
+ length >= 3 ? new NativeDate(Y, M, D) :
2794
+ length >= 2 ? new NativeDate(Y, M) :
2795
+ length >= 1 ? new NativeDate(Y) :
2796
+ new NativeDate();
2797
+ // Prevent mixups with unfixed Date object
2798
+ date.constructor = Date;
2799
+ return date;
2800
+ }
2801
+ return NativeDate.apply(this, arguments);
2802
+ };
2803
+
2804
+ // 15.9.1.15 Date Time String Format.
2805
+ var isoDateExpression = new RegExp("^" +
2806
+ "(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign +
2807
+ // 6-digit extended year
2808
+ "(?:-(\\d{2})" + // optional month capture
2809
+ "(?:-(\\d{2})" + // optional day capture
2810
+ "(?:" + // capture hours:minutes:seconds.milliseconds
2811
+ "T(\\d{2})" + // hours capture
2812
+ ":(\\d{2})" + // minutes capture
2813
+ "(?:" + // optional :seconds.milliseconds
2814
+ ":(\\d{2})" + // seconds capture
2815
+ "(?:(\\.\\d{1,}))?" + // milliseconds capture
2816
+ ")?" +
2817
+ "(" + // capture UTC offset component
2818
+ "Z|" + // UTC capture
2819
+ "(?:" + // offset specifier +/-hours:minutes
2820
+ "([-+])" + // sign capture
2821
+ "(\\d{2})" + // hours offset capture
2822
+ ":(\\d{2})" + // minutes offset capture
2823
+ ")" +
2824
+ ")?)?)?)?" +
2825
+ "$");
2826
+
2827
+ var months = [
2828
+ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
2829
+ ];
2830
+
2831
+ function dayFromMonth(year, month) {
2832
+ var t = month > 1 ? 1 : 0;
2833
+ return (
2834
+ months[month] +
2835
+ Math.floor((year - 1969 + t) / 4) -
2836
+ Math.floor((year - 1901 + t) / 100) +
2837
+ Math.floor((year - 1601 + t) / 400) +
2838
+ 365 * (year - 1970)
2839
+ );
2840
+ }
2841
+
2842
+ function toUTC(t) {
2843
+ return Number(new NativeDate(1970, 0, 1, 0, 0, 0, t));
2844
+ }
2845
+
2846
+ // Copy any custom methods a 3rd party library may have added
2847
+ for (var key in NativeDate) {
2848
+ Date[key] = NativeDate[key];
2849
+ }
2850
+
2851
+ // Copy "native" methods explicitly; they may be non-enumerable
2852
+ Date.now = NativeDate.now;
2853
+ Date.UTC = NativeDate.UTC;
2854
+ Date.prototype = NativeDate.prototype;
2855
+ Date.prototype.constructor = Date;
2856
+
2857
+ // Upgrade Date.parse to handle simplified ISO 8601 strings
2858
+ Date.parse = function parse(string) {
2859
+ var match = isoDateExpression.exec(string);
2860
+ if (match) {
2861
+ // parse months, days, hours, minutes, seconds, and milliseconds
2862
+ // provide default values if necessary
2863
+ // parse the UTC offset component
2864
+ var year = Number(match[1]),
2865
+ month = Number(match[2] || 1) - 1,
2866
+ day = Number(match[3] || 1) - 1,
2867
+ hour = Number(match[4] || 0),
2868
+ minute = Number(match[5] || 0),
2869
+ second = Number(match[6] || 0),
2870
+ millisecond = Math.floor(Number(match[7] || 0) * 1000),
2871
+ // When time zone is missed, local offset should be used
2872
+ // (ES 5.1 bug)
2873
+ // see https://bugs.ecmascript.org/show_bug.cgi?id=112
2874
+ isLocalTime = Boolean(match[4] && !match[8]),
2875
+ signOffset = match[9] === "-" ? 1 : -1,
2876
+ hourOffset = Number(match[10] || 0),
2877
+ minuteOffset = Number(match[11] || 0),
2878
+ result;
2879
+ if (
2880
+ hour < (
2881
+ minute > 0 || second > 0 || millisecond > 0 ?
2882
+ 24 : 25
2883
+ ) &&
2884
+ minute < 60 && second < 60 && millisecond < 1000 &&
2885
+ month > -1 && month < 12 && hourOffset < 24 &&
2886
+ minuteOffset < 60 && // detect invalid offsets
2887
+ day > -1 &&
2888
+ day < (
2889
+ dayFromMonth(year, month + 1) -
2890
+ dayFromMonth(year, month)
2891
+ )
2892
+ ) {
2893
+ result = (
2894
+ (dayFromMonth(year, month) + day) * 24 +
2895
+ hour +
2896
+ hourOffset * signOffset
2897
+ ) * 60;
2898
+ result = (
2899
+ (result + minute + minuteOffset * signOffset) * 60 +
2900
+ second
2901
+ ) * 1000 + millisecond;
2902
+ if (isLocalTime) {
2903
+ result = toUTC(result);
2904
+ }
2905
+ if (-8.64e15 <= result && result <= 8.64e15) {
2906
+ return result;
2907
+ }
2908
+ }
2909
+ return NaN;
2910
+ }
2911
+ return NativeDate.parse.apply(this, arguments);
2912
+ };
2913
+
2914
+ return Date;
2915
+ })(Date);
2916
+ }
2917
+
2918
+ // ES5 15.9.4.4
2919
+ // http://es5.github.com/#x15.9.4.4
2920
+ if (!Date.now) {
2921
+ Date.now = function now() {
2922
+ return new Date().getTime();
2923
+ };
2924
+ }
2925
+
2926
+
2927
+ //
2928
+ // Number
2929
+ // ======
2930
+ //
2931
+
2932
+ // ES5.1 15.7.4.5
2933
+ // http://es5.github.com/#x15.7.4.5
2934
+ if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") {
2935
+ // Hide these variables and functions
2936
+ (function () {
2937
+ var base, size, data, i;
2938
+
2939
+ base = 1e7;
2940
+ size = 6;
2941
+ data = [0, 0, 0, 0, 0, 0];
2942
+
2943
+ function multiply(n, c) {
2944
+ var i = -1;
2945
+ while (++i < size) {
2946
+ c += n * data[i];
2947
+ data[i] = c % base;
2948
+ c = Math.floor(c / base);
2949
+ }
2950
+ }
2951
+
2952
+ function divide(n) {
2953
+ var i = size, c = 0;
2954
+ while (--i >= 0) {
2955
+ c += data[i];
2956
+ data[i] = Math.floor(c / n);
2957
+ c = (c % n) * base;
2958
+ }
2959
+ }
2960
+
2961
+ function toString() {
2962
+ var i = size;
2963
+ var s = '';
2964
+ while (--i >= 0) {
2965
+ if (s !== '' || i === 0 || data[i] !== 0) {
2966
+ var t = String(data[i]);
2967
+ if (s === '') {
2968
+ s = t;
2969
+ } else {
2970
+ s += '0000000'.slice(0, 7 - t.length) + t;
2971
+ }
2972
+ }
2973
+ }
2974
+ return s;
2975
+ }
2976
+
2977
+ function pow(x, n, acc) {
2978
+ return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc)));
2979
+ }
2980
+
2981
+ function log(x) {
2982
+ var n = 0;
2983
+ while (x >= 4096) {
2984
+ n += 12;
2985
+ x /= 4096;
2986
+ }
2987
+ while (x >= 2) {
2988
+ n += 1;
2989
+ x /= 2;
2990
+ }
2991
+ return n;
2992
+ }
2993
+
2994
+ Number.prototype.toFixed = function (fractionDigits) {
2995
+ var f, x, s, m, e, z, j, k;
2996
+
2997
+ // Test for NaN and round fractionDigits down
2998
+ f = Number(fractionDigits);
2999
+ f = f !== f ? 0 : Math.floor(f);
3000
+
3001
+ if (f < 0 || f > 20) {
3002
+ throw new RangeError("Number.toFixed called with invalid number of decimals");
3003
+ }
3004
+
3005
+ x = Number(this);
3006
+
3007
+ // Test for NaN
3008
+ if (x !== x) {
3009
+ return "NaN";
3010
+ }
3011
+
3012
+ // If it is too big or small, return the string value of the number
3013
+ if (x <= -1e21 || x >= 1e21) {
3014
+ return String(x);
3015
+ }
3016
+
3017
+ s = "";
3018
+
3019
+ if (x < 0) {
3020
+ s = "-";
3021
+ x = -x;
3022
+ }
3023
+
3024
+ m = "0";
3025
+
3026
+ if (x > 1e-21) {
3027
+ // 1e-21 < x < 1e21
3028
+ // -70 < log2(x) < 70
3029
+ e = log(x * pow(2, 69, 1)) - 69;
3030
+ z = (e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1));
3031
+ z *= 0x10000000000000; // Math.pow(2, 52);
3032
+ e = 52 - e;
3033
+
3034
+ // -18 < e < 122
3035
+ // x = z / 2 ^ e
3036
+ if (e > 0) {
3037
+ multiply(0, z);
3038
+ j = f;
3039
+
3040
+ while (j >= 7) {
3041
+ multiply(1e7, 0);
3042
+ j -= 7;
3043
+ }
3044
+
3045
+ multiply(pow(10, j, 1), 0);
3046
+ j = e - 1;
3047
+
3048
+ while (j >= 23) {
3049
+ divide(1 << 23);
3050
+ j -= 23;
3051
+ }
3052
+
3053
+ divide(1 << j);
3054
+ multiply(1, 1);
3055
+ divide(2);
3056
+ m = toString();
3057
+ } else {
3058
+ multiply(0, z);
3059
+ multiply(1 << (-e), 0);
3060
+ m = toString() + '0.00000000000000000000'.slice(2, 2 + f);
3061
+ }
3062
+ }
3063
+
3064
+ if (f > 0) {
3065
+ k = m.length;
3066
+
3067
+ if (k <= f) {
3068
+ m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m;
3069
+ } else {
3070
+ m = s + m.slice(0, k - f) + '.' + m.slice(k - f);
3071
+ }
3072
+ } else {
3073
+ m = s + m;
3074
+ }
3075
+
3076
+ return m;
3077
+ }
3078
+ }());
3079
+ }
3080
+
3081
+
3082
+ //
3083
+ // String
3084
+ // ======
3085
+ //
3086
+
3087
+
3088
+ // ES5 15.5.4.14
3089
+ // http://es5.github.com/#x15.5.4.14
3090
+
3091
+ // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
3092
+ // Many browsers do not split properly with regular expressions or they
3093
+ // do not perform the split correctly under obscure conditions.
3094
+ // See http://blog.stevenlevithan.com/archives/cross-browser-split
3095
+ // I've tested in many browsers and this seems to cover the deviant ones:
3096
+ // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
3097
+ // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
3098
+ // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
3099
+ // [undefined, "t", undefined, "e", ...]
3100
+ // ''.split(/.?/) should be [], not [""]
3101
+ // '.'.split(/()()/) should be ["."], not ["", "", "."]
3102
+
3103
+ var string_split = String.prototype.split;
3104
+ if (
3105
+ 'ab'.split(/(?:ab)*/).length !== 2 ||
3106
+ '.'.split(/(.?)(.?)/).length !== 4 ||
3107
+ 'tesst'.split(/(s)*/)[1] === "t" ||
3108
+ ''.split(/.?/).length ||
3109
+ '.'.split(/()()/).length > 1
3110
+ ) {
3111
+ (function () {
3112
+ var compliantExecNpcg = /()??/.exec("")[1] === void 0; // NPCG: nonparticipating capturing group
3113
+
3114
+ String.prototype.split = function (separator, limit) {
3115
+ var string = this;
3116
+ if (separator === void 0 && limit === 0)
3117
+ return [];
3118
+
3119
+ // If `separator` is not a regex, use native split
3120
+ if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
3121
+ return string_split.apply(this, arguments);
3122
+ }
3123
+
3124
+ var output = [],
3125
+ flags = (separator.ignoreCase ? "i" : "") +
3126
+ (separator.multiline ? "m" : "") +
3127
+ (separator.extended ? "x" : "") + // Proposed for ES6
3128
+ (separator.sticky ? "y" : ""), // Firefox 3+
3129
+ lastLastIndex = 0,
3130
+ // Make `global` and avoid `lastIndex` issues by working with a copy
3131
+ separator = new RegExp(separator.source, flags + "g"),
3132
+ separator2, match, lastIndex, lastLength;
3133
+ string += ""; // Type-convert
3134
+ if (!compliantExecNpcg) {
3135
+ // Doesn't need flags gy, but they don't hurt
3136
+ separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
3137
+ }
3138
+ /* Values for `limit`, per the spec:
3139
+ * If undefined: 4294967295 // Math.pow(2, 32) - 1
3140
+ * If 0, Infinity, or NaN: 0
3141
+ * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
3142
+ * If negative number: 4294967296 - Math.floor(Math.abs(limit))
3143
+ * If other: Type-convert, then use the above rules
3144
+ */
3145
+ limit = limit === void 0 ?
3146
+ -1 >>> 0 : // Math.pow(2, 32) - 1
3147
+ limit >>> 0; // ToUint32(limit)
3148
+ while (match = separator.exec(string)) {
3149
+ // `separator.lastIndex` is not reliable cross-browser
3150
+ lastIndex = match.index + match[0].length;
3151
+ if (lastIndex > lastLastIndex) {
3152
+ output.push(string.slice(lastLastIndex, match.index));
3153
+ // Fix browsers whose `exec` methods don't consistently return `undefined` for
3154
+ // nonparticipating capturing groups
3155
+ if (!compliantExecNpcg && match.length > 1) {
3156
+ match[0].replace(separator2, function () {
3157
+ for (var i = 1; i < arguments.length - 2; i++) {
3158
+ if (arguments[i] === void 0) {
3159
+ match[i] = void 0;
3160
+ }
3161
+ }
3162
+ });
3163
+ }
3164
+ if (match.length > 1 && match.index < string.length) {
3165
+ Array.prototype.push.apply(output, match.slice(1));
3166
+ }
3167
+ lastLength = match[0].length;
3168
+ lastLastIndex = lastIndex;
3169
+ if (output.length >= limit) {
3170
+ break;
3171
+ }
3172
+ }
3173
+ if (separator.lastIndex === match.index) {
3174
+ separator.lastIndex++; // Avoid an infinite loop
3175
+ }
3176
+ }
3177
+ if (lastLastIndex === string.length) {
3178
+ if (lastLength || !separator.test("")) {
3179
+ output.push("");
3180
+ }
3181
+ } else {
3182
+ output.push(string.slice(lastLastIndex));
3183
+ }
3184
+ return output.length > limit ? output.slice(0, limit) : output;
3185
+ };
3186
+ }());
3187
+
3188
+ // [bugfix, chrome]
3189
+ // If separator is undefined, then the result array contains just one String,
3190
+ // which is the this value (converted to a String). If limit is not undefined,
3191
+ // then the output array is truncated so that it contains no more than limit
3192
+ // elements.
3193
+ // "0".split(undefined, 0) -> []
3194
+ } else if ("0".split(void 0, 0).length) {
3195
+ String.prototype.split = function(separator, limit) {
3196
+ if (separator === void 0 && limit === 0) return [];
3197
+ return string_split.apply(this, arguments);
3198
+ }
3199
+ }
3200
+
3201
+
3202
+ // ECMA-262, 3rd B.2.3
3203
+ // Note an ECMAScript standart, although ECMAScript 3rd Edition has a
3204
+ // non-normative section suggesting uniform semantics and it should be
3205
+ // normalized across all browsers
3206
+ // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
3207
+ if ("".substr && "0b".substr(-1) !== "b") {
3208
+ var string_substr = String.prototype.substr;
3209
+ /**
3210
+ * Get the substring of a string
3211
+ * @param {integer} start where to start the substring
3212
+ * @param {integer} length how many characters to return
3213
+ * @return {string}
3214
+ */
3215
+ String.prototype.substr = function(start, length) {
3216
+ return string_substr.call(
3217
+ this,
3218
+ start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,
3219
+ length
3220
+ );
3221
+ }
3222
+ }
3223
+
3224
+ // ES5 15.5.4.20
3225
+ // http://es5.github.com/#x15.5.4.20
3226
+ var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
3227
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
3228
+ "\u2029\uFEFF";
3229
+ if (!String.prototype.trim || ws.trim()) {
3230
+ // http://blog.stevenlevithan.com/archives/faster-trim-javascript
3231
+ // http://perfectionkills.com/whitespace-deviations/
3232
+ ws = "[" + ws + "]";
3233
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
3234
+ trimEndRegexp = new RegExp(ws + ws + "*$");
3235
+ String.prototype.trim = function trim() {
3236
+ if (this === void 0 || this === null) {
3237
+ throw new TypeError("can't convert "+this+" to object");
3238
+ }
3239
+ return String(this)
3240
+ .replace(trimBeginRegexp, "")
3241
+ .replace(trimEndRegexp, "");
3242
+ };
3243
+ }
3244
+
3245
+ //
3246
+ // Util
3247
+ // ======
3248
+ //
3249
+
3250
+ // ES5 9.4
3251
+ // http://es5.github.com/#x9.4
3252
+ // http://jsperf.com/to-integer
3253
+
3254
+ function toInteger(n) {
3255
+ n = +n;
3256
+ if (n !== n) { // isNaN
3257
+ n = 0;
3258
+ } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
3259
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
3260
+ }
3261
+ return n;
3262
+ }
3263
+
3264
+ function isPrimitive(input) {
3265
+ var type = typeof input;
3266
+ return (
3267
+ input === null ||
3268
+ type === "undefined" ||
3269
+ type === "boolean" ||
3270
+ type === "number" ||
3271
+ type === "string"
3272
+ );
3273
+ }
3274
+
3275
+ function toPrimitive(input) {
3276
+ var val, valueOf, toString;
3277
+ if (isPrimitive(input)) {
3278
+ return input;
3279
+ }
3280
+ valueOf = input.valueOf;
3281
+ if (typeof valueOf === "function") {
3282
+ val = valueOf.call(input);
3283
+ if (isPrimitive(val)) {
3284
+ return val;
3285
+ }
3286
+ }
3287
+ toString = input.toString;
3288
+ if (typeof toString === "function") {
3289
+ val = toString.call(input);
3290
+ if (isPrimitive(val)) {
3291
+ return val;
3292
+ }
3293
+ }
3294
+ throw new TypeError();
3295
+ }
3296
+
3297
+ // ES5 9.9
3298
+ // http://es5.github.com/#x9.9
3299
+ var toObject = function (o) {
3300
+ if (o == null) { // this matches both null and undefined
3301
+ throw new TypeError("can't convert "+o+" to object");
3302
+ }
3303
+ return Object(o);
3304
+ };
3305
+
3306
+ });
3307
+
3308
+ /**
3309
+ * @title WET-BOEW Vapour loader
3310
+ * @overview Helper methods for WET
3311
+ * @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
3312
+ * @author WET Community
3313
+ */
3314
+ /*
3315
+ * Vapour Object that will store tombstone data for plugins to leverage
3316
+ */
3317
+ ( function( $, window, document, undef ) {
3318
+ "use strict";
3319
+
3320
+ /**
3321
+ * @method getUrlParts
3322
+ * @param {String} url of URL to examine
3323
+ * @return {Object} of the parts of passed URL
3324
+ */
3325
+ var getUrlParts = function( url ) {
3326
+ var a = document.createElement( "a" );
3327
+ a.href = url;
3328
+ return {
3329
+ href: a.href,
3330
+ absolute: a.href,
3331
+ host: a.host,
3332
+ hostname: a.hostname,
3333
+ port: a.port,
3334
+ pathname: a.pathname.replace( /^([^/])/, "/$1" ), // Prefix pathname with a slash in browsers that don't natively do it (i.e. all versions of IE and possibly early versions of Edge). See pull request #8110.
3335
+ protocol: a.protocol,
3336
+ hash: a.hash,
3337
+ search: a.search,
3338
+
3339
+ // A collection of the parameters of the query string part of the URL.
3340
+ params: ( function() {
3341
+ var queryString = a.search.replace( /(^\?)/, "" );
3342
+ if ( !queryString ) {
3343
+ return {};
3344
+ }
3345
+ return queryString.split( "&" ).map( function( n ) {
3346
+ return ( n = n.split( "=" ), this[ n[ 0 ] ] = decodeURIComponent( n[ 1 ] ), this );
3347
+ }.bind( {} ) )[ 0 ];
3348
+ }() )
3349
+ };
3350
+ },
3351
+
3352
+ /**
3353
+ * @variable seed
3354
+ * @return a unique number for auto-generating ids
3355
+ */
3356
+ seed = 0,
3357
+
3358
+ /**
3359
+ * @variable $src
3360
+ * @return {jQuery Element} of wb script element
3361
+ */
3362
+ $src = $( "script[src*='wet-boew.js'],script[src*='wet-boew.min.js'],script[data-wb-core]" )
3363
+ .last(),
3364
+
3365
+ /**
3366
+ * @variable i18n
3367
+ * @return {string} of WET document language
3368
+ */
3369
+ lang = ( function( ele ) {
3370
+ let lang = document.documentElement.lang;
3371
+ const shortLangLength = 2;
3372
+
3373
+ // Perform extra checks if the page uses a long language code
3374
+ if ( lang.length > shortLangLength ) {
3375
+ let longLangs = [ "pt-BR", "zh-Hans" ]; // Built-in long language codes
3376
+
3377
+ // Check if any custom long language codes have been specified
3378
+ // Specify by adding data-wb-core and data-lang-long="en-CA en-US etc" attributes to WET's script element (e.g. wet-boew.js or wet-boew.min.js)
3379
+ if ( ele[ 0 ].hasAttribute( "data-wb-core" ) && ele[ 0 ].hasAttribute( "data-lang-long" ) ) {
3380
+ const longLangsCustom = ele.attr( "data-lang-long" ).split( " " );
3381
+
3382
+ // Add extra language codes to the beginning of the longLangs array to match them more quickly
3383
+ longLangs = longLangsCustom.concat( longLangs );
3384
+ }
3385
+
3386
+ // Shorten the language code if it doesn't exist in the longLangs array
3387
+ if ( longLangs.indexOf( lang ) === -1 ) {
3388
+ lang = lang.substring( 0, shortLangLength );
3389
+ }
3390
+ }
3391
+
3392
+ return lang;
3393
+ }( $src ) ),
3394
+
3395
+ paths = ( function( ele ) {
3396
+ var paths = {};
3397
+
3398
+ paths.home = ele.prop( "src" )
3399
+ .split( "?" )[ 0 ].split( "/" )
3400
+ .slice( 0, -1 )
3401
+ .join( "/" );
3402
+ paths.asset = paths.home + "/../assets";
3403
+ paths.template = paths.home + "/assets/templates";
3404
+ paths.dep = paths.home + "/deps";
3405
+ paths.js = paths.home;
3406
+ paths.css = paths.home.substring( 0, paths.home.length - 2 ) + "css";
3407
+ paths.mode = ele.prop( "src" ).indexOf( ".min" ) < 0 ? "" : ".min";
3408
+
3409
+ if ( ele[ 0 ].hasAttribute( "data-wb-core" ) ) {
3410
+ $.extend( paths, {
3411
+ home: ele.attr( "data-home" ),
3412
+ asset: ele.attr( "data-asset" ),
3413
+ template: ele.attr( "data-template" ),
3414
+ dep: ele.attr( "data-dep" ),
3415
+ js: ele.attr( "data-js" ),
3416
+ css: ele.attr( "data-css" ),
3417
+ mode: ele.attr( "data-mode" )
3418
+ } );
3419
+ }
3420
+
3421
+ return paths;
3422
+ }( $src ) ),
3423
+
3424
+ /**
3425
+ * @variable oldie
3426
+ * @return {integer} of IE version
3427
+ */
3428
+ oldie = ( function() {
3429
+ var undef,
3430
+ v = 3,
3431
+ div = document.createElement( "div" ),
3432
+ all = div.getElementsByTagName( "i" );
3433
+
3434
+ while ( (
3435
+ div.innerHTML = "<!--[if gt IE " + ( v += 1 ) + "]><i></i><![endif]-->",
3436
+ all[ 0 ]
3437
+ ) ) { /* empty */ }
3438
+
3439
+ return v > 4 ? v : undef;
3440
+ }() ),
3441
+
3442
+ /**
3443
+ * @variable currentpage
3444
+ * @return {Object} of parts of the current page URL
3445
+ */
3446
+ currentpage = getUrlParts( window.location.href ),
3447
+
3448
+ /**
3449
+ * @variable disabled
3450
+ * @return {boolean} of state of disabled flag
3451
+ */
3452
+ disabled = ( function() {
3453
+ var disabledSaved = "false",
3454
+ disabled;
3455
+
3456
+ try {
3457
+ disabledSaved = localStorage.getItem( "wbdisable" ) || disabledSaved;
3458
+ } catch ( e ) {
3459
+
3460
+ /* swallow error */
3461
+ }
3462
+
3463
+ disabled = currentpage.params.wbdisable || disabledSaved;
3464
+ return ( typeof disabled === "string" ) ? ( disabled.toLowerCase() === "true" ) : Boolean( disabled );
3465
+ }() ),
3466
+
3467
+ /*-----------------------------
3468
+ * Core Library Object
3469
+ *-----------------------------
3470
+ */
3471
+ wb = {
3472
+ "/": paths.home,
3473
+ "/assets": paths.asset,
3474
+ "/templates": paths.template,
3475
+ "/deps": paths.dep,
3476
+ lang: lang,
3477
+ mode: paths.mode,
3478
+ doc: $( document ),
3479
+ win: $( window ),
3480
+ html: $( "html" ),
3481
+ pageUrlParts: currentpage,
3482
+ getUrlParts: getUrlParts,
3483
+ isDisabled: disabled,
3484
+ isStarted: false,
3485
+ isReady: false,
3486
+ ignoreHashChange: false,
3487
+ initQueue: 0,
3488
+
3489
+ getPath: function( property ) {
3490
+ return Object.prototype.hasOwnProperty.call( this, property ) ? this[ property ] : undef;
3491
+ },
3492
+
3493
+ getMode: function() {
3494
+ return this.mode;
3495
+ },
3496
+
3497
+ getId: function() {
3498
+ return "wb-auto-" + ( seed += 1 );
3499
+ },
3500
+
3501
+ init: function( event, componentName, selector, noAutoId ) {
3502
+ var eventTarget = event.target,
3503
+ isEvent = !!eventTarget,
3504
+ node = isEvent ? eventTarget : event,
3505
+ initedClass = componentName + "-inited",
3506
+ isDocumentNode = node === document;
3507
+
3508
+ // Filter out any events triggered by descendants and only initializes
3509
+ // the element once (if is an event and document node is not the target)
3510
+ if ( !isEvent || isDocumentNode || ( event.currentTarget === node &&
3511
+ node.className.indexOf( initedClass ) === -1 ) ) {
3512
+
3513
+ this.initQueue += 1;
3514
+ this.remove( selector );
3515
+ if ( !isDocumentNode ) {
3516
+ node.className += " " + initedClass;
3517
+
3518
+ if ( !noAutoId && !node.id ) {
3519
+ node.id = wb.getId();
3520
+ }
3521
+ }
3522
+
3523
+ return node;
3524
+ }
3525
+
3526
+ return undef;
3527
+ },
3528
+
3529
+ ready: function( $elm, componentName, context ) {
3530
+ if ( $elm ) {
3531
+
3532
+ // Trigger any nested elements (excluding nested within nested)
3533
+ $elm
3534
+ .find( wb.allSelectors )
3535
+ .addClass( "wb-init" )
3536
+ .filter( ":not(#" + $elm.attr( "id" ) + " .wb-init .wb-init)" )
3537
+ .trigger( "timerpoke.wb" );
3538
+
3539
+ // Identify that the component is ready
3540
+ $elm.trigger( "wb-ready." + componentName, context );
3541
+ this.initQueue -= 1;
3542
+ } else {
3543
+ this.doc.trigger( "wb-ready." + componentName, context );
3544
+ }
3545
+
3546
+ // Identify that global initialization is complete
3547
+ if ( !this.isReady && this.isStarted && this.initQueue < 1 ) {
3548
+ this.isReady = true;
3549
+ this.doc.trigger( "wb-ready.wb" );
3550
+ }
3551
+ },
3552
+
3553
+ // Lets load some variables into wb for IE detection
3554
+ other: !oldie,
3555
+ desktop: ( window.orientation === undefined ),
3556
+ ie: !!oldie,
3557
+ ie6: ( oldie === 6 ),
3558
+ ie7: ( oldie === 7 ),
3559
+ ie8: ( oldie === 8 ),
3560
+ ie9: ( oldie === 9 ),
3561
+ ielt7: ( oldie < 7 ),
3562
+ ielt8: ( oldie < 8 ),
3563
+ ielt9: ( oldie < 9 ),
3564
+ ielt10: ( oldie < 10 ),
3565
+ ie11: ( !!navigator.userAgent.match( /Trident\/7\./ ) ),
3566
+
3567
+ selectors: [],
3568
+
3569
+ resizeEvents: "xxsmallview.wb xsmallview.wb smallview.wb mediumview.wb largeview.wb xlargeview.wb",
3570
+
3571
+ // For Charts and Geomap
3572
+ drawColours: [
3573
+ "#8d201c",
3574
+ "#EE8310",
3575
+ "#2a7da6",
3576
+ "#5a306b",
3577
+ "#285228",
3578
+ "#154055",
3579
+ "#555555",
3580
+ "#f6d200",
3581
+ "#d73d38",
3582
+ "#418541",
3583
+ "#87aec9",
3584
+ "#23447e",
3585
+ "#999999"
3586
+ ],
3587
+
3588
+ // Get and generate a unique session id
3589
+ sessionGUID: function() {
3590
+ var sessionId = sessionStorage.getItem( "wb-session-GUID" );
3591
+ if ( !sessionId ) {
3592
+ sessionId = wb.guid();
3593
+ sessionStorage.setItem( "wb-session-GUID", sessionId );
3594
+ }
3595
+ return sessionId;
3596
+ },
3597
+
3598
+ // Add a selector to be targeted by timerpoke
3599
+ add: function( selector ) {
3600
+ var exists = false,
3601
+ len = wb.selectors.length,
3602
+ i;
3603
+
3604
+ // Lets ensure we are not running if things are disabled
3605
+ if ( wb.isDisabled && selector !== "#wb-tphp" ) {
3606
+ return 0;
3607
+ }
3608
+
3609
+ // Check to see if the selector is already targeted
3610
+ for ( i = 0; i !== len; i += 1 ) {
3611
+ if ( wb.selectors[ i ] === selector ) {
3612
+ exists = true;
3613
+ break;
3614
+ }
3615
+ }
3616
+
3617
+ // Add the selector if it isn't already targeted
3618
+ if ( !exists ) {
3619
+ wb.selectors.push( selector );
3620
+ }
3621
+ },
3622
+
3623
+ // Remove a selector targeted by timerpoke
3624
+ remove: function( selector ) {
3625
+ var len = this.selectors.length,
3626
+ i;
3627
+
3628
+ for ( i = 0; i !== len; i += 1 ) {
3629
+ if ( this.selectors[ i ] === selector ) {
3630
+ this.selectors.splice( i, 1 );
3631
+ break;
3632
+ }
3633
+ }
3634
+ },
3635
+
3636
+ // Handles triggering of timerpoke events
3637
+ timerpoke: function( initial ) {
3638
+ var selectorsLocal = wb.selectors.slice( 0 ),
3639
+ len = selectorsLocal.length,
3640
+ selector, $elms, $foundElms, i;
3641
+
3642
+ if ( initial ) {
3643
+ $foundElms = $();
3644
+ for ( i = 0; i !== len; i += 1 ) {
3645
+ selector = selectorsLocal[ i ];
3646
+ $elms = $( selector );
3647
+ if ( $elms.length !== 0 ) {
3648
+ $foundElms = $foundElms.add( $elms );
3649
+
3650
+ // If the selector returns no elements, remove the selector
3651
+ } else {
3652
+ wb.remove( selector );
3653
+ }
3654
+ }
3655
+
3656
+ // Keep only the non-nested plugin/polyfill elements
3657
+ $elms = $foundElms.filter( ":not(.wb-init .wb-init)" ).addClass( "wb-init" );
3658
+ } else {
3659
+ $elms = $( selectorsLocal.join( ", " ) );
3660
+ }
3661
+ $elms.trigger( "timerpoke.wb" );
3662
+ },
3663
+
3664
+ start: function() {
3665
+
3666
+ // Save a copy of all the possible selectors
3667
+ wb.allSelectors = wb.selectors.join( ", " );
3668
+
3669
+ // Initiate timerpoke events right way
3670
+ wb.timerpoke( true );
3671
+ this.isStarted = true;
3672
+ this.ready();
3673
+
3674
+ // Initiate timerpoke events again every half second
3675
+ setInterval( wb.timerpoke, 500 );
3676
+ },
3677
+
3678
+ i18nDict: {},
3679
+ i18n: function( key, state, mixin ) {
3680
+ var dictionary = wb.i18nDict,
3681
+
3682
+ // eg. 000 or 001 ie. 0 or 1
3683
+ truthiness = ( typeof key === "string" && key !== "" ) |
3684
+
3685
+ // eg. 000 or 010 ie. 0 or 2
3686
+ ( typeof state === "string" && state !== "" ) << 1 |
3687
+
3688
+ // eg. 000 or 100 ie. 0 or 4
3689
+ ( typeof mixin === "string" && mixin !== "" ) << 2;
3690
+
3691
+ switch ( truthiness ) {
3692
+ case 1:
3693
+
3694
+ // only key was provided
3695
+ return dictionary[ key ];
3696
+
3697
+ case 3:
3698
+
3699
+ // key and state were provided
3700
+ return dictionary[ key ][ state ];
3701
+
3702
+ case 7:
3703
+
3704
+ // key, state, and mixin were provided
3705
+ return dictionary[ key ][ state ].replace( "[MIXIN]", mixin );
3706
+ default:
3707
+ return "";
3708
+ }
3709
+ },
3710
+
3711
+ hashString: function( str ) {
3712
+
3713
+ // Sources:
3714
+ // https://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
3715
+ // https://jsperf.com/hashing-strings
3716
+ var hash = 0,
3717
+ chr, i;
3718
+
3719
+ if ( str.length === 0 ) {
3720
+ return hash;
3721
+ }
3722
+
3723
+ for ( i = 0; i < str.length; i++ ) {
3724
+ chr = str.charCodeAt( i );
3725
+ hash = ( ( hash << 5 ) - hash ) + chr;
3726
+
3727
+ // Convert to 32bit integer
3728
+ hash = hash & hash;
3729
+ }
3730
+
3731
+ return hash;
3732
+ },
3733
+
3734
+ stripWhitespace: function( str ) {
3735
+ return str.replace( /\s+/g, "" );
3736
+ },
3737
+
3738
+ // Core function to deal with the dependency racing issue
3739
+ whenLibReady: function( testCallback, readyCallback ) {
3740
+ if ( testCallback() ) {
3741
+ readyCallback();
3742
+ } else {
3743
+ setTimeout( function() {
3744
+ wb.whenLibReady( testCallback, readyCallback );
3745
+ }, 50 );
3746
+ }
3747
+
3748
+ }
3749
+ };
3750
+
3751
+ window.wb = wb;
3752
+
3753
+ /*-----------------------------
3754
+ * Yepnope Prefixes
3755
+ *-----------------------------*/
3756
+ /*
3757
+ * Establish the base path to be more flexible in terms of WCMS where JS can
3758
+ * reside in theme folders and not in the root of sites
3759
+ * @TODO: For modularity the prefixes where written independently as we are
3760
+ * flushing out some use cases on better grouping and optimization of polyfills.
3761
+ * Once this more hashed out, we could optimize the prefixes down to one or two
3762
+ * prefixes "site" and "disabled" to thin out the codeblock a bit more
3763
+ * increase performance due to redundant chaining of the prefixes.
3764
+ */
3765
+
3766
+ /**
3767
+ * @prefix: site! - adds the root js directory of yepnope resources
3768
+ */
3769
+ yepnope.addPrefix( "site", function( resourceObj ) {
3770
+ resourceObj.url = paths.js + "/" + resourceObj.url;
3771
+ return resourceObj;
3772
+ } );
3773
+
3774
+ /**
3775
+ * @prefix: plyfll! - builds the path for the polyfill resource
3776
+ */
3777
+ yepnope.addPrefix( "plyfll", function( resourceObj ) {
3778
+ var path,
3779
+ url = resourceObj.url;
3780
+
3781
+ if ( disabled && url.indexOf( "svg" ) === -1 ) {
3782
+ resourceObj.bypass = true;
3783
+ } else if ( !paths.mode ) {
3784
+ url = url.replace( ".min", "" );
3785
+ }
3786
+
3787
+ if ( url.indexOf( ".css" ) !== -1 ) {
3788
+ resourceObj.forceCSS = true;
3789
+ path = paths.css;
3790
+ } else {
3791
+ path = paths.js;
3792
+ }
3793
+ resourceObj.url = path + "/polyfills/" + url;
3794
+
3795
+ return resourceObj;
3796
+ } );
3797
+
3798
+ /**
3799
+ * @prefix: i18n! - adds the correct document language for our i18n library
3800
+ */
3801
+ yepnope.addPrefix( "i18n", function( resourceObj ) {
3802
+ resourceObj.url = paths.js + "/" + resourceObj.url + lang + paths.mode + ".js";
3803
+ return resourceObj;
3804
+ } );
3805
+
3806
+ /**
3807
+ * @prefix: mthjx! - adds the root directory of MathJax resources
3808
+ */
3809
+ yepnope.addPrefix( "mthjx", function( resourceObj ) {
3810
+ resourceObj.url = paths.js + "/MathJax/" + resourceObj.url;
3811
+ return resourceObj;
3812
+ } );
3813
+
3814
+ /*-----------------------------
3815
+ * Deps loading, call "complete" callback when the deps is ready if a testReady is defined
3816
+ *-----------------------------*/
3817
+ wb.modernizrLoad = Modernizr.load;
3818
+ Modernizr.load = function( options ) {
3819
+ var i, i_len, i_cache,
3820
+ testReady, complete;
3821
+ if ( !$.isArray( options ) ) {
3822
+ options = [ options ];
3823
+ }
3824
+ i_len = options.length;
3825
+ for ( i = 0; i !== i_len; i += 1 ) {
3826
+ i_cache = options[ i ];
3827
+ testReady = i_cache.testReady;
3828
+ complete = i_cache.complete;
3829
+ if ( testReady && complete ) {
3830
+ i_cache.complete = wb.whenLibReady( testReady, complete );
3831
+ }
3832
+ }
3833
+ wb.modernizrLoad( options );
3834
+ };
3835
+
3836
+ /*-----------------------------
3837
+ * Modernizr Polyfill Loading
3838
+ *-----------------------------*/
3839
+ Modernizr.load( [
3840
+ {
3841
+ test: Modernizr.details,
3842
+ nope: [
3843
+ "plyfll!details.min.js",
3844
+ "plyfll!details.min.css"
3845
+ ]
3846
+ }, {
3847
+ test: Modernizr.input.list,
3848
+ nope: [
3849
+ "plyfll!datalist.min.js",
3850
+ "plyfll!datalist.min.css"
3851
+ ]
3852
+ }, {
3853
+ test: Modernizr.inputtypes.date,
3854
+ nope: [
3855
+ "plyfll!datepicker.min.js",
3856
+ "plyfll!datepicker.min.css"
3857
+ ]
3858
+ }, {
3859
+ test: Modernizr.inputtypes.range,
3860
+ nope: [
3861
+ "plyfll!slider.min.js",
3862
+ "plyfll!slider_wrapper.min.js",
3863
+ "plyfll!slider.min.css"
3864
+ ],
3865
+ callback: function( url ) {
3866
+ if ( url === "slider.min.js" ) {
3867
+ window.fdSlider.onDomReady();
3868
+ }
3869
+ }
3870
+ }, {
3871
+ test: Modernizr.progressbar,
3872
+ nope: [
3873
+ "plyfll!progress.min.js",
3874
+ "plyfll!progress.min.css"
3875
+ ]
3876
+ }, {
3877
+ test: Modernizr.mathml,
3878
+
3879
+ // Cleanup Modernizr test and add selector to global timer
3880
+ complete: function() {
3881
+ var componentName = "wb-math",
3882
+ selector = "math",
3883
+ math = document.getElementsByTagName( selector ),
3884
+ $document = wb.doc;
3885
+
3886
+ // Cleanup elements that Modernizr.mathml test leaves behind.
3887
+ if ( math.length ) {
3888
+ document.body.removeChild( math[ math.length - 1 ].parentNode );
3889
+ }
3890
+
3891
+ // Defer loading the polyfill till an element is detected due to the size
3892
+ if ( !Modernizr.mathml ) {
3893
+ let isTrident = new Boolean( window.navigator.msSaveOrOpenBlob );
3894
+
3895
+ // Bind the init event of the plugin
3896
+ $document.one( "timerpoke.wb wb-init." + componentName, selector, function() {
3897
+
3898
+ // Start initialization
3899
+ wb.init( document, componentName, selector );
3900
+
3901
+ // Disable MathJax's context menu to more closely mimic native MathML implementations
3902
+ window.MathJax = {
3903
+ options: {
3904
+ enableMenu: false
3905
+ }
3906
+ };
3907
+
3908
+ // Extra tasks for IE11
3909
+ if ( isTrident ) {
3910
+
3911
+ // Load an ES6 polyfill
3912
+ Modernizr.load( "timeout=500!https://polyfill.io/v3/polyfill.min.js?features=es6" );
3913
+
3914
+ // Specify the CDN's font URL
3915
+ // Note: IE11 is unable to resolve this on its own
3916
+ window.MathJax.chtml = {
3917
+ fontURL: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2"
3918
+ };
3919
+ }
3920
+
3921
+ // Load the MathML dependency. Since the polyfill is only loaded
3922
+ // when !Modernizr.mathml, we can skip the test here.
3923
+ Modernizr.load( [ {
3924
+
3925
+ // Load latest version of MathJax 3 from a CDN
3926
+ // Also load a CSS workaround for a MathJax 3.2.0 bug (refer to CSS file for details)
3927
+ load: [
3928
+ "timeout=500!https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js",
3929
+ "plyfll!mathml.min.css"
3930
+ ],
3931
+ complete: function() {
3932
+
3933
+ // Wait a moment to reduce the risk of a race condition
3934
+ setTimeout( function() {
3935
+
3936
+ // Specify a font URL for a local copy of MathJax 3 for IE11
3937
+ // Note: Useful if IE11 has internet access but fails to reach the CDN
3938
+ if ( isTrident && !window.MathJax.startup ) {
3939
+ window.MathJax.chtml.fontURL = paths.js + "/MathJax/output/chtml/fonts/woff-v2";
3940
+ }
3941
+
3942
+ // Fall back on a local copy of MathJax 3 if the CDN is unreachable
3943
+ // Note: Won't work with IE11 in isolated networks (ES6 polyfill has no local fallback)
3944
+ Modernizr.load( [ {
3945
+ test: window.MathJax.startup,
3946
+ nope: "mthjx!mml-chtml.js",
3947
+ complete: function() {
3948
+
3949
+ // Try loading a local copy of MathJax 2 as a last dith effort
3950
+ Modernizr.load( [ {
3951
+ test: window.MathJax.startup,
3952
+ nope: "mthjx!MathJax.js?config=Accessible",
3953
+ complete: function() {
3954
+
3955
+ // Identify that initialization has completed
3956
+ wb.ready( $document, componentName );
3957
+ }
3958
+ } ] );
3959
+ }
3960
+ } ] );
3961
+ }, 100 );
3962
+ }
3963
+ } ] );
3964
+ } );
3965
+
3966
+ wb.add( selector );
3967
+ }
3968
+ }
3969
+ }, {
3970
+ test: Modernizr.meter,
3971
+ nope: [
3972
+ "plyfll!meter.min.js",
3973
+ "plyfll!meter.min.css"
3974
+ ]
3975
+ }, {
3976
+ test: Modernizr.touch,
3977
+ yep: "plyfll!mobile.min.js"
3978
+ }, {
3979
+ test: Modernizr.svg,
3980
+ nope: "plyfll!svg.min.js"
3981
+ }, {
3982
+ load: "i18n!i18n/",
3983
+ testReady: function() {
3984
+ return wb.i18nDict.tphp;
3985
+ },
3986
+ complete: function() {
3987
+ wb.start();
3988
+ }
3989
+ }
3990
+ ] );
3991
+
3992
+ } )( jQuery, window, document );