yellow-brick-road 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. data/README.rst +148 -0
  2. data/Rakefile +37 -0
  3. data/lib/tasks/yellow-brick-road_tasks.rake +4 -0
  4. data/lib/yellow-brick-road.rb +6 -0
  5. data/lib/yellow-brick-road/config.rb +15 -0
  6. data/lib/yellow-brick-road/directive_processor.rb +68 -0
  7. data/lib/yellow-brick-road/engine.rb +22 -0
  8. data/lib/yellow-brick-road/soy_processor.rb +56 -0
  9. data/lib/yellow-brick-road/utils.rb +38 -0
  10. data/lib/yellow-brick-road/version.rb +3 -0
  11. data/test/dummy/Rakefile +7 -0
  12. data/test/dummy/app/assets/javascripts/application.js +12 -0
  13. data/test/dummy/app/assets/javascripts/closure-deps.js +4 -0
  14. data/test/dummy/app/assets/javascripts/my-closure/simple.js.soy +14 -0
  15. data/test/dummy/app/assets/javascripts/my-closure/start.js +25 -0
  16. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  17. data/test/dummy/app/controllers/application_controller.rb +7 -0
  18. data/test/dummy/app/helpers/application_helper.rb +2 -0
  19. data/test/dummy/app/views/application/index.html.erb +0 -0
  20. data/test/dummy/app/views/layouts/application.html.erb +18 -0
  21. data/test/dummy/config.ru +4 -0
  22. data/test/dummy/config/application.rb +51 -0
  23. data/test/dummy/config/boot.rb +10 -0
  24. data/test/dummy/config/environment.rb +5 -0
  25. data/test/dummy/config/environments/development.rb +30 -0
  26. data/test/dummy/config/environments/production.rb +60 -0
  27. data/test/dummy/config/environments/test.rb +39 -0
  28. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/dummy/config/initializers/inflections.rb +10 -0
  30. data/test/dummy/config/initializers/mime_types.rb +5 -0
  31. data/test/dummy/config/initializers/secret_token.rb +7 -0
  32. data/test/dummy/config/initializers/session_store.rb +8 -0
  33. data/test/dummy/config/initializers/wrap_parameters.rb +10 -0
  34. data/test/dummy/config/initializers/yellow_brick_road.rb +2 -0
  35. data/test/dummy/config/locales/en.yml +5 -0
  36. data/test/dummy/config/routes.rb +58 -0
  37. data/test/dummy/log/development.log +13924 -0
  38. data/test/dummy/log/test.log +0 -0
  39. data/test/dummy/public/404.html +26 -0
  40. data/test/dummy/public/422.html +26 -0
  41. data/test/dummy/public/500.html +26 -0
  42. data/test/dummy/public/favicon.ico +0 -0
  43. data/test/dummy/script/rails +6 -0
  44. data/test/dummy/tmp/cache/assets/BE0/120/sprockets%2F751842b8c6750008c7310d182600d173 +142 -0
  45. data/test/dummy/tmp/cache/assets/C19/950/sprockets%2F142437f1d8d9424007b4a882a5429333 +1372 -0
  46. data/test/dummy/tmp/cache/assets/C4B/D00/sprockets%2F400f22c081529179ce3d079457de3009 +806 -0
  47. data/test/dummy/tmp/cache/assets/C5A/EE0/sprockets%2Fb711429ed948c503b718d077037780f8 +0 -0
  48. data/test/dummy/tmp/cache/assets/C5B/A80/sprockets%2F508569b474262724c61a461f7777dab7 +1118 -0
  49. data/test/dummy/tmp/cache/assets/C6C/660/sprockets%2F2c298b3b02232a21527680685a3efc30 +9289 -0
  50. data/test/dummy/tmp/cache/assets/C72/8A0/sprockets%2F167b265129e30d87d253c406db305c60 +293 -0
  51. data/test/dummy/tmp/cache/assets/C7E/9F0/sprockets%2F89862076204c62c4593ac20de32da909 +9 -0
  52. data/test/dummy/tmp/cache/assets/C8B/5F0/sprockets%2Fc6a4470b5c21e285e829a99365839b24 +0 -0
  53. data/test/dummy/tmp/cache/assets/C92/D20/sprockets%2F2e618f7805f445889aec94885a500f03 +457 -0
  54. data/test/dummy/tmp/cache/assets/C98/FD0/sprockets%2Fb11442af041f96e87a43a1dc11231745 +283 -0
  55. data/test/dummy/tmp/cache/assets/CA3/520/sprockets%2F5379d7143c6c52b11b88dc0ab5436133 +277 -0
  56. data/test/dummy/tmp/cache/assets/CA5/450/sprockets%2F6bb727c9312a749134ad67323a317f0d +73 -0
  57. data/test/dummy/tmp/cache/assets/CA5/4F0/sprockets%2Feeb7de7771527700af194c0441d29101 +709 -0
  58. data/test/dummy/tmp/cache/assets/CA6/E90/sprockets%2F611f68180f43c4181f06ae5c5f8201e2 +1546 -0
  59. data/test/dummy/tmp/cache/assets/CA7/310/sprockets%2F45664cf816315200b574e029fde6f10a +0 -0
  60. data/test/dummy/tmp/cache/assets/CA9/9D0/sprockets%2F2672e32464cf7267c4ba3d028f54b153 +224 -0
  61. data/test/dummy/tmp/cache/assets/CAB/5A0/sprockets%2F7f50e0289f150c8636ac9253129bc13c +2556 -0
  62. data/test/dummy/tmp/cache/assets/CB5/7E0/sprockets%2F42ff6672683b2029233a800e7539eeee +474 -0
  63. data/test/dummy/tmp/cache/assets/CB6/DC0/sprockets%2F2f9882155bb2d4d3ab5d708951857c60 +494 -0
  64. data/test/dummy/tmp/cache/assets/CBB/680/sprockets%2F1dc336d96fb52df34b458185559922b5 +1018 -0
  65. data/test/dummy/tmp/cache/assets/CBC/640/sprockets%2F67d2e0d9e5129d237e575d2780c64b47 +1260 -0
  66. data/test/dummy/tmp/cache/assets/CBE/550/sprockets%2Fd680cac830e0b3408ba910f0b0421147 +25 -0
  67. data/test/dummy/tmp/cache/assets/CC7/790/sprockets%2F69941f32a12e4f99d4a57f65386d870d +608 -0
  68. data/test/dummy/tmp/cache/assets/CCB/F80/sprockets%2Fa865701ef2ec41155e524772c31a1a2b +1088 -0
  69. data/test/dummy/tmp/cache/assets/CCE/580/sprockets%2F879411ed27ed1c557d57853d8f579b56 +0 -0
  70. data/test/dummy/tmp/cache/assets/CD0/070/sprockets%2F6748fe8481965f260d9c56b7f9f508a2 +1530 -0
  71. data/test/dummy/tmp/cache/assets/CD4/750/sprockets%2Faf3505141ecb3169ce41ce519d136924 +0 -0
  72. data/test/dummy/tmp/cache/assets/CD6/A90/sprockets%2F3f55ac75b9fb8426312116bcb940a580 +2539 -0
  73. data/test/dummy/tmp/cache/assets/CD9/6C0/sprockets%2F5e2458bc52da90ba349a66035e3b6752 +0 -0
  74. data/test/dummy/tmp/cache/assets/CD9/F50/sprockets%2F9008bf696500cfae1d61f045f209181e +256 -0
  75. data/test/dummy/tmp/cache/assets/CDB/B40/sprockets%2F53529a22c994570a0df4742c0bfe61f4 +0 -0
  76. data/test/dummy/tmp/cache/assets/CDC/D10/sprockets%2F1e775b4ff06b4401c07503ce95a839b5 +75 -0
  77. data/test/dummy/tmp/cache/assets/CDE/CD0/sprockets%2F141066798b4acf07053f7e3a6cb4e555 +1613 -0
  78. data/test/dummy/tmp/cache/assets/CE1/760/sprockets%2F245fe11803630fe30d0cf8a869886ab5 +357 -0
  79. data/test/dummy/tmp/cache/assets/CE1/FA0/sprockets%2F863d1650ef066e4a2168bc57c7c0e096 +0 -0
  80. data/test/dummy/tmp/cache/assets/CE2/310/sprockets%2Fd38075d5592ecaf82e43526c03b467c4 +1545 -0
  81. data/test/dummy/tmp/cache/assets/CE2/420/sprockets%2F30f2e8f30477e80cf6416dfe27307c07 +204 -0
  82. data/test/dummy/tmp/cache/assets/CE2/D70/sprockets%2F467c44b63644e0f44dd06a585f36f1a6 +522 -0
  83. data/test/dummy/tmp/cache/assets/CE3/670/sprockets%2Fddd11860b444cd0f9996be0c46762318 +796 -0
  84. data/test/dummy/tmp/cache/assets/CE4/0B0/sprockets%2Ff11535d785c0d34349c64d673bd4b28f +1105 -0
  85. data/test/dummy/tmp/cache/assets/CE4/590/sprockets%2Fd68edcc87a4ae302794093081b45b819 +10 -0
  86. data/test/dummy/tmp/cache/assets/CE4/D60/sprockets%2F61772e4a60b616f74da91b838a2f4f82 +0 -0
  87. data/test/dummy/tmp/cache/assets/CE6/DD0/sprockets%2F2fe073024a2bf26bd98458388b57af37 +1355 -0
  88. data/test/dummy/tmp/cache/assets/CE7/160/sprockets%2Fba1f9939f031b4356ec1869d40fc2747 +1261 -0
  89. data/test/dummy/tmp/cache/assets/CE8/C70/sprockets%2Fc6c9ba3c677b5e2af8520395192c9445 +173 -0
  90. data/test/dummy/tmp/cache/assets/CEA/8B0/sprockets%2Ff77e549cb6d37604105f35d4e67d8c21 +511 -0
  91. data/test/dummy/tmp/cache/assets/CEA/AA0/sprockets%2F5f816982c86d2e6b72b2f5f65c51d070 +1529 -0
  92. data/test/dummy/tmp/cache/assets/CEA/C10/sprockets%2F9dcd541e67c299ab076a44a2183872f8 +0 -0
  93. data/test/dummy/tmp/cache/assets/CF1/5A0/sprockets%2F1a697695edf2bb7b49a2896904218bc7 +115 -0
  94. data/test/dummy/tmp/cache/assets/CF4/480/sprockets%2F5e99c77e93f4a522c84357e62b25e0f7 +43 -0
  95. data/test/dummy/tmp/cache/assets/CF7/460/sprockets%2Fd12ea9733fe3c92456f57f9145569b9c +0 -0
  96. data/test/dummy/tmp/cache/assets/CF7/470/sprockets%2F2897897a166ca3369fecb88f83f211b5 +435 -0
  97. data/test/dummy/tmp/cache/assets/CFA/760/sprockets%2Fa9024adba14091e0635c6874d1db4e22 +0 -0
  98. data/test/dummy/tmp/cache/assets/D01/F30/sprockets%2Fe639a15b6e0cca37d12443b408e1166f +25 -0
  99. data/test/dummy/tmp/cache/assets/D02/9F0/sprockets%2Fb99eae308897fe88cb9414b96824098b +0 -0
  100. data/test/dummy/tmp/cache/assets/D03/330/sprockets%2F1e003cdb3e7dcc9307e84090ad457127 +454 -0
  101. data/test/dummy/tmp/cache/assets/D03/8B0/sprockets%2Ff74632bddf2c0b2018ca7b736309380e +365 -0
  102. data/test/dummy/tmp/cache/assets/D05/0A0/sprockets%2Fe57658220260db13eb5577aef42cb61b +257 -0
  103. data/test/dummy/tmp/cache/assets/D05/920/sprockets%2F909507434dcc270db4853e4c147f0aac +31 -0
  104. data/test/dummy/tmp/cache/assets/D08/510/sprockets%2Fa567be6cb6d7310096f1739b25a5a3f0 +50 -0
  105. data/test/dummy/tmp/cache/assets/D08/9F0/sprockets%2F1d61d2c89ca50957066bacc5b69011f5 +1424 -0
  106. data/test/dummy/tmp/cache/assets/D0A/790/sprockets%2Feb16913e6504c9b0d3be431de39e4751 +300 -0
  107. data/test/dummy/tmp/cache/assets/D0C/C50/sprockets%2Fd6613bee8b40d50459af6b52a7084f34 +796 -0
  108. data/test/dummy/tmp/cache/assets/D0D/030/sprockets%2Fba3f13b4a444679e8bc2549226ec743b +21 -0
  109. data/test/dummy/tmp/cache/assets/D0D/350/sprockets%2F2670bce036d485e15d059c0f1e98f24a +207 -0
  110. data/test/dummy/tmp/cache/assets/D13/270/sprockets%2F497cb163e6317e3fc1565d832f406cfb +348 -0
  111. data/test/dummy/tmp/cache/assets/D13/380/sprockets%2F786d003c9c7fb759dd26c1030c087cf6 +813 -0
  112. data/test/dummy/tmp/cache/assets/D13/7C0/sprockets%2F528d22310a9ab8e6fba08d82844ce795 +0 -0
  113. data/test/dummy/tmp/cache/assets/D15/F60/sprockets%2Fa28394e3f80365b5bc86794dd46daa22 +0 -0
  114. data/test/dummy/tmp/cache/assets/D18/500/sprockets%2Fd22c2d97d1db2154f2f7592906e957ea +1001 -0
  115. data/test/dummy/tmp/cache/assets/D1B/C70/sprockets%2F1c04848b1e1d6e8e33b8581f8c8128ff +223 -0
  116. data/test/dummy/tmp/cache/assets/D1C/600/sprockets%2Fa0601f99147f59ddd6266e6aff077e14 +0 -0
  117. data/test/dummy/tmp/cache/assets/D1E/470/sprockets%2Fb3933e694547b78bf6fb15f44a4623fe +53 -0
  118. data/test/dummy/tmp/cache/assets/D1F/480/sprockets%2F545164168becf42b289efc8708f1db68 +1278 -0
  119. data/test/dummy/tmp/cache/assets/D21/630/sprockets%2F0a14114729c14637f2e8f122acabd1ab +823 -0
  120. data/test/dummy/tmp/cache/assets/D24/A90/sprockets%2F21c8a0d48c51b8585ba03bc112ecd153 +692 -0
  121. data/test/dummy/tmp/cache/assets/D25/D30/sprockets%2F3b937f4c16d2aa0a28fc02a0e922712b +1441 -0
  122. data/test/dummy/tmp/cache/assets/D25/F30/sprockets%2Fe251527c0c018f4b4ad44b2ad7064fb0 +2255 -0
  123. data/test/dummy/tmp/cache/assets/D26/DE0/sprockets%2F761ac1bdb0739cc56fa0c1224b137b09 +0 -0
  124. data/test/dummy/tmp/cache/assets/D2A/C30/sprockets%2F978fe7268754f451c59b9ccb323ffa56 +0 -0
  125. data/test/dummy/tmp/cache/assets/D2B/0F0/sprockets%2Fbf223af03335cfc08a71e549e10c0e27 +2539 -0
  126. data/test/dummy/tmp/cache/assets/D2E/6D0/sprockets%2F9e7fda3affb389313cc50223f01c0324 +0 -0
  127. data/test/dummy/tmp/cache/assets/D2F/110/sprockets%2F3730ffe2ed34c1219d580bd1615ea7b0 +2239 -0
  128. data/test/dummy/tmp/cache/assets/D2F/F10/sprockets%2F9cac242f0bf5ec00079ea3a463e26552 +153 -0
  129. data/test/dummy/tmp/cache/assets/D30/1D0/sprockets%2Fd690a26a0b0ae138c1c48d257a7674bc +589 -0
  130. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  131. data/test/dummy/tmp/cache/assets/D36/940/sprockets%2Fb4ba462ac9f4aac561c36e60367c1378 +572 -0
  132. data/test/dummy/tmp/cache/assets/D37/090/sprockets%2F2f2e71ebbc240014ebf648f0917e854a +798 -0
  133. data/test/dummy/tmp/cache/assets/D3A/440/sprockets%2F6d332243647c841dea36ed822cdfc23e +165 -0
  134. data/test/dummy/tmp/cache/assets/D3B/5A0/sprockets%2F82e05cf8c88ba8cb1c87e50d51372a03 +0 -0
  135. data/test/dummy/tmp/cache/assets/D41/B30/sprockets%2Fba1b93913dd01d83ac9a96df334456f8 +0 -0
  136. data/test/dummy/tmp/cache/assets/D43/D90/sprockets%2F04f3a5926d5a7672456dc7afa73d0c7f +38 -0
  137. data/test/dummy/tmp/cache/assets/D45/1F0/sprockets%2F1bfa855d9c10ff2431a9a548958cc5e4 +83 -0
  138. data/test/dummy/tmp/cache/assets/D45/B10/sprockets%2F643f3d9b216e48df952b7f150a46a7ec +60 -0
  139. data/test/dummy/tmp/cache/assets/D46/040/sprockets%2F199546844e5939721a5afcbcce4ea43a +143 -0
  140. data/test/dummy/tmp/cache/assets/D49/320/sprockets%2Fd8123eb229e34c9f507f7b1876f1c4ee +506 -0
  141. data/test/dummy/tmp/cache/assets/D49/750/sprockets%2Ff41ef1c0832b7294fb15588ff5c783cb +0 -0
  142. data/test/dummy/tmp/cache/assets/D49/930/sprockets%2F1071926698fa55abc71e1b6fd966dfe1 +72 -0
  143. data/test/dummy/tmp/cache/assets/D49/D10/sprockets%2Fb67b8d7cc7579352a91694f9ae10cdb0 +127 -0
  144. data/test/dummy/tmp/cache/assets/D4A/160/sprockets%2Fcbd8988b5e18d153eff6230d72e9046a +516 -0
  145. data/test/dummy/tmp/cache/assets/D4A/2B0/sprockets%2Ffcdf002d38fd938bf7226b46b76706c8 +1101 -0
  146. data/test/dummy/tmp/cache/assets/D4E/2F0/sprockets%2F77cb87ae57f0d8c25cdaa74181a64997 +1441 -0
  147. data/test/dummy/tmp/cache/assets/D4F/060/sprockets%2Fa9e66b39ada7394a29bf44f3a682f665 +511 -0
  148. data/test/dummy/tmp/cache/assets/D50/BD0/sprockets%2F88650dd57ef64075462e6dae757dbe2c +0 -0
  149. data/test/dummy/tmp/cache/assets/D53/CA0/sprockets%2Fa85032e82709a043fbb2ec00e04f2bbd +0 -0
  150. data/test/dummy/tmp/cache/assets/D54/BF0/sprockets%2F91970514ff528e8d2bfd81f1ec83c9c8 +240 -0
  151. data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +10 -0
  152. data/test/dummy/tmp/cache/assets/D56/500/sprockets%2F75ebadd035f1324b194034af92eac3a0 +0 -0
  153. data/test/dummy/tmp/cache/assets/D5A/900/sprockets%2F5729f77d97fdee53b1942cf17f6f05e4 +474 -0
  154. data/test/dummy/tmp/cache/assets/D5A/D50/sprockets%2F81bace3db2c2f1241175ff3c5009d08c +0 -0
  155. data/test/dummy/tmp/cache/assets/D5B/C70/sprockets%2Fe64119a9db7017b7ab3b0da1b6076f0d +44 -0
  156. data/test/dummy/tmp/cache/assets/D5E/4D0/sprockets%2F756f25e4ad861a050cdc41bb8414e4ab +126 -0
  157. data/test/dummy/tmp/cache/assets/D5E/730/sprockets%2Fd30caf70b387c4604326bdda32aeb549 +0 -0
  158. data/test/dummy/tmp/cache/assets/D5E/AA0/sprockets%2F790dd07caaaacb30ceb0174664e90817 +136 -0
  159. data/test/dummy/tmp/cache/assets/D64/D30/sprockets%2Fe4bd8f60a3a446274c3cb2f5d16563ac +590 -0
  160. data/test/dummy/tmp/cache/assets/D66/400/sprockets%2Fecb7401d20daf25605a7afad3a793778 +0 -0
  161. data/test/dummy/tmp/cache/assets/D67/250/sprockets%2F8422eb26855ca9c953a3bf1aeade8004 +0 -0
  162. data/test/dummy/tmp/cache/assets/D69/900/sprockets%2F28ae64f52cb18f77b1a1bd9c51293da4 +0 -0
  163. data/test/dummy/tmp/cache/assets/D6A/870/sprockets%2F1ece6a51b42f9280f4cee9020c94b72e +197 -0
  164. data/test/dummy/tmp/cache/assets/D6B/DD0/sprockets%2F9a0abc735e27fc61dab019788518eba4 +164 -0
  165. data/test/dummy/tmp/cache/assets/D6E/CC0/sprockets%2F8b4fbcec2475e7203b8859baf8e310a3 +0 -0
  166. data/test/dummy/tmp/cache/assets/D72/470/sprockets%2Fbc0c6d850e7c769e83d58eb3e6061b2a +2556 -0
  167. data/test/dummy/tmp/cache/assets/D72/9D0/sprockets%2F9402daf6da6f7eed331a9d78216cb761 +0 -0
  168. data/test/dummy/tmp/cache/assets/D74/070/sprockets%2F91ae68f698a39bd7d0d11150fc46e4cd +418 -0
  169. data/test/dummy/tmp/cache/assets/D74/7F0/sprockets%2F22dad1069ea6a8f29ae757c44e18ec83 +0 -0
  170. data/test/dummy/tmp/cache/assets/D75/3C0/sprockets%2F44e2ae51b97853d8ecda7b264a267c7d +1630 -0
  171. data/test/dummy/tmp/cache/assets/D77/780/sprockets%2Ffa2abdfb0b62867c346f79187b8e42d5 +823 -0
  172. data/test/dummy/tmp/cache/assets/D79/850/sprockets%2F4d540586ed379fd9a70fa0b7ce4f5b27 +306 -0
  173. data/test/dummy/tmp/cache/assets/D7A/B60/sprockets%2F5925c92f48caff053d08853dc69e5bba +0 -0
  174. data/test/dummy/tmp/cache/assets/D81/C90/sprockets%2F19aca5c835efce74878c23e581e2a89e +2239 -0
  175. data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +11228 -0
  176. data/test/dummy/tmp/cache/assets/D8B/B10/sprockets%2Fbb7a2305a8f2832631863bbababb67be +301 -0
  177. data/test/dummy/tmp/cache/assets/D92/3B0/sprockets%2F93dc71f411faf72ec8ef0b5d217b51a0 +505 -0
  178. data/test/dummy/tmp/cache/assets/D92/EE0/sprockets%2Ffd051ea0abf6be6970754aa732e40c8b +289 -0
  179. data/test/dummy/tmp/cache/assets/D93/810/sprockets%2F7dc1ac5e1b83ba5144e34cf156d48a8a +471 -0
  180. data/test/dummy/tmp/cache/assets/D94/020/sprockets%2F35cb4ce22488fb5bdd260508ca47a3fb +239 -0
  181. data/test/dummy/tmp/cache/assets/D94/EC0/sprockets%2F8b900fba18f8e046f5f12e6d1f0ac15b +74 -0
  182. data/test/dummy/tmp/cache/assets/D95/470/sprockets%2F5be5d361a52575c433831b5e8cccbace +9273 -0
  183. data/test/dummy/tmp/cache/assets/D97/9D0/sprockets%2F524a2a94a88c1d392dabcba654e365fc +103 -0
  184. data/test/dummy/tmp/cache/assets/D9D/800/sprockets%2Ff8387220eb4dda9b29a37b5deb9f2a40 +54 -0
  185. data/test/dummy/tmp/cache/assets/D9E/DD0/sprockets%2Fb6b4ffad6485eda046b327a196e8c44a +0 -0
  186. data/test/dummy/tmp/cache/assets/DA1/0A0/sprockets%2F359c94aee6ba2e15fc9666aa4de311c8 +166 -0
  187. data/test/dummy/tmp/cache/assets/DA1/0D0/sprockets%2F798de3c28452e164a7fc1a3a6e8cdb4b +652 -0
  188. data/test/dummy/tmp/cache/assets/DA3/CB0/sprockets%2Fdfad6bb1857a8af91f98ba137c18504e +815 -0
  189. data/test/dummy/tmp/cache/assets/DA4/E10/sprockets%2Fbda7705734ace95f12a7d79df9c14af2 +1354 -0
  190. data/test/dummy/tmp/cache/assets/DA5/E30/sprockets%2F2e6707a119e94a784efbadca18d7e8d1 +129 -0
  191. data/test/dummy/tmp/cache/assets/DA6/4B0/sprockets%2F4f7a708b6aa2d42eb577493dea7cef55 +115 -0
  192. data/test/dummy/tmp/cache/assets/DA8/A10/sprockets%2F0ae5bbb4ca200e74db3b64d72c2be120 +0 -0
  193. data/test/dummy/tmp/cache/assets/DA9/3F0/sprockets%2Fdd0af9cfd65fb7d02fe778c8f6015361 +499 -0
  194. data/test/dummy/tmp/cache/assets/DA9/780/sprockets%2Fe3559a635e8f92dec7727a3db2ae7b4c +813 -0
  195. data/test/dummy/tmp/cache/assets/DAC/0E0/sprockets%2F04cef8243a9ef7321846debc977ea8db +607 -0
  196. data/test/dummy/tmp/cache/assets/DB1/260/sprockets%2Fb879ff7530bf8cc175e0c7e70dc4e79b +0 -0
  197. data/test/dummy/tmp/cache/assets/DB4/4C0/sprockets%2F30a76cbd98dedb56742cd8ecaf858757 +0 -0
  198. data/test/dummy/tmp/cache/assets/DBD/7E0/sprockets%2F236fb1ac5ed9f2e3fe32203acc3a842d +0 -0
  199. data/test/dummy/tmp/cache/assets/DC2/DF0/sprockets%2Fe233bcaba8beff15626c35cb5e0e0936 +845 -0
  200. data/test/dummy/tmp/cache/assets/DC4/600/sprockets%2F59c96aa6c1cbebc61bff6c050a5351d7 +225 -0
  201. data/test/dummy/tmp/cache/assets/DC5/030/sprockets%2Fcb2fe864a0177eec19017c43ce9aa4ad +187 -0
  202. data/test/dummy/tmp/cache/assets/DC8/A60/sprockets%2F9fcb9f5c3f679ce749ee4c3f93869ba6 +74 -0
  203. data/test/dummy/tmp/cache/assets/DCB/D40/sprockets%2Ffd5542bfb7660a8d8cac3a2e46fb01f8 +828 -0
  204. data/test/dummy/tmp/cache/assets/DCC/020/sprockets%2F0c129c5f2784c96fa1dc3da6c19c1efc +128 -0
  205. data/test/dummy/tmp/cache/assets/DCF/520/sprockets%2F975162fb97a3ec7033db5f2fdba4fcd3 +70 -0
  206. data/test/dummy/tmp/cache/assets/DD0/000/sprockets%2F0d5d631cce6f0b078bb29cf98b3d78bb +276 -0
  207. data/test/dummy/tmp/cache/assets/DD0/C90/sprockets%2F84eeca4ef8f5eb29b13f7e1ea3c71324 +591 -0
  208. data/test/dummy/tmp/cache/assets/DD6/710/sprockets%2F9e83f2ebbe3e349efca2de390e15d635 +204 -0
  209. data/test/dummy/tmp/cache/assets/DE1/830/sprockets%2Fd23d3cafef2e2a9055bc103dffc1a023 +208 -0
  210. data/test/dummy/tmp/cache/assets/DEB/470/sprockets%2Fae2de0fcbc2214b71d3f2a875d2bc8c3 +2255 -0
  211. data/test/dummy/tmp/cache/assets/DEE/690/sprockets%2F5d824bcadef29060cc13eed71af4b4d0 +550 -0
  212. data/test/dummy/tmp/cache/assets/DF0/5D0/sprockets%2F25a875eb0a5d4c49bcc3fa39ea0adb26 +567 -0
  213. data/test/dummy/tmp/cache/assets/DF3/E20/sprockets%2Fada770c49a5d6b38d1cc43ed4d51c1fc +0 -0
  214. data/test/dummy/tmp/cache/assets/DF5/C80/sprockets%2F03ad7d7b3a8feba9ed9be82ae2083b20 +340 -0
  215. data/test/dummy/tmp/cache/assets/DF6/560/sprockets%2Fafceb2b55eb108efe4446dfb02b519b8 +0 -0
  216. data/test/dummy/tmp/cache/assets/DFC/030/sprockets%2Fcbdd3679eaba219b4e1ff20677af1c6f +1371 -0
  217. data/test/dummy/tmp/cache/assets/E00/970/sprockets%2F8bc6dde8d05c382dd07cbcec70f54e09 +378 -0
  218. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  219. data/test/dummy/tmp/cache/assets/E12/2F0/sprockets%2F5c45062ecfbe512dcba176ba6ddacc00 +523 -0
  220. data/test/dummy/tmp/cache/assets/E21/5D0/sprockets%2Fd4fe6d611bfb0e63c04de5dbfb128a8a +0 -0
  221. data/test/dummy/tmp/cache/assets/E22/770/sprockets%2F2ccebcabfbb9b59159e4b73b3b30a74d +208 -0
  222. data/test/dummy/tmp/cache/assets/E31/A90/sprockets%2F26b98bbbc15eee9b370c7dcde88d16aa +394 -0
  223. data/test/dummy/tmp/cache/assets/E31/E30/sprockets%2Ffbdafcc4e2f44bb9fc653bcf9625b750 +284 -0
  224. data/test/dummy/tmp/cache/assets/E37/1C0/sprockets%2Fa5eb45fc86dafe2bee4e4fa3f53c4785 +0 -0
  225. data/test/dummy/tmp/cache/assets/E4C/960/sprockets%2F13fd6e4bfdf031acb3dedca8d0f407b4 +1277 -0
  226. data/test/dummy/tmp/cache/assets/E88/330/sprockets%2Fe02d0adb5529ffafcea1b9e5ccf69a5b +669 -0
  227. data/test/dummy/tmp/pids/server.pid +1 -0
  228. data/test/dummy/tmp/simple.js.js +20 -0
  229. data/test/dummy/tmp/soy-1325274421.js +20 -0
  230. data/test/dummy/tmp/soy-1325286267.js +20 -0
  231. data/test/test_helper.rb +10 -0
  232. data/test/yellow-brick-road_test.rb +7 -0
  233. metadata +538 -0
@@ -0,0 +1,418 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325441615.328232: @value{ I" length:EFi�-I" digest;
2
+ F"%c8d08e4d609d897ba5bbad514b23dd30I" source;
3
+ FI"�-// Copyright 2005 The Closure Library Authors. All Rights Reserved.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 (the "License");
6
+ // you may not use this file except in compliance with the License.
7
+ // You may obtain a copy of the License at
8
+ //
9
+ // http://www.apache.org/licenses/LICENSE-2.0
10
+ //
11
+ // Unless required by applicable law or agreed to in writing, software
12
+ // distributed under the License is distributed on an "AS-IS" BASIS,
13
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ // See the License for the specific language governing permissions and
15
+ // limitations under the License.
16
+
17
+ /**
18
+ * @fileoverview A patched, standardized event object for browser events.
19
+ *
20
+ * <pre>
21
+ * The patched event object contains the following members:
22
+ * - type {string} Event type, e.g. 'click'
23
+ * - timestamp {Date} A date object for when the event was fired
24
+ * - target {Object} The element that actually triggered the event
25
+ * - currentTarget {Object} The element the listener is attached to
26
+ * - relatedTarget {Object} For mouseover and mouseout, the previous object
27
+ * - offsetX {number} X-coordinate relative to target
28
+ * - offsetY {number} Y-coordinate relative to target
29
+ * - clientX {number} X-coordinate relative to viewport
30
+ * - clientY {number} Y-coordinate relative to viewport
31
+ * - screenX {number} X-coordinate relative to the edge of the screen
32
+ * - screenY {number} Y-coordinate relative to the edge of the screen
33
+ * - button {number} Mouse button. Use isButton() to test.
34
+ * - keyCode {number} Key-code
35
+ * - ctrlKey {boolean} Was ctrl key depressed
36
+ * - altKey {boolean} Was alt key depressed
37
+ * - shiftKey {boolean} Was shift key depressed
38
+ * - metaKey {boolean} Was meta key depressed
39
+ * - state {Object} History state object
40
+ *
41
+ * NOTE: The keyCode member contains the raw browser keyCode. For normalized
42
+ * key and character code use {@link goog.events.KeyHandler}.
43
+ * </pre>
44
+ *
45
+ */
46
+
47
+
48
+ goog.provide('goog.events.BrowserEvent');
49
+ goog.provide('goog.events.BrowserEvent.MouseButton');
50
+
51
+ goog.require('goog.events.BrowserFeature');
52
+ goog.require('goog.events.Event');
53
+ goog.require('goog.events.EventType');
54
+ goog.require('goog.reflect');
55
+ goog.require('goog.userAgent');
56
+
57
+
58
+
59
+ /**
60
+ * Accepts a browser event object and creates a patched, cross browser event
61
+ * object.
62
+ * The content of this object will not be initialized if no event object is
63
+ * provided. If this is the case, init() needs to be invoked separately.
64
+ * @param {Event=} opt_e Browser event object.
65
+ * @param {Node=} opt_currentTarget Current target for event.
66
+ * @constructor
67
+ * @extends {goog.events.Event}
68
+ */
69
+ goog.events.BrowserEvent = function(opt_e, opt_currentTarget) {
70
+ if (opt_e) {
71
+ this.init(opt_e, opt_currentTarget);
72
+ }
73
+ };
74
+ goog.inherits(goog.events.BrowserEvent, goog.events.Event);
75
+
76
+
77
+ /**
78
+ * Normalized button constants for the mouse.
79
+ * @enum {number}
80
+ */
81
+ goog.events.BrowserEvent.MouseButton = {
82
+ LEFT: 0,
83
+ MIDDLE: 1,
84
+ RIGHT: 2
85
+ };
86
+
87
+
88
+ /**
89
+ * Static data for mapping mouse buttons.
90
+ * @type {Array.<number>}
91
+ */
92
+ goog.events.BrowserEvent.IEButtonMap = [
93
+ 1, // LEFT
94
+ 4, // MIDDLE
95
+ 2 // RIGHT
96
+ ];
97
+
98
+
99
+ /**
100
+ * Target that fired the event.
101
+ * @override
102
+ * @type {Node}
103
+ */
104
+ goog.events.BrowserEvent.prototype.target = null;
105
+
106
+
107
+ /**
108
+ * Node that had the listener attached.
109
+ * @override
110
+ * @type {Node|undefined}
111
+ */
112
+ goog.events.BrowserEvent.prototype.currentTarget;
113
+
114
+
115
+ /**
116
+ * For mouseover and mouseout events, the related object for the event.
117
+ * @type {Node}
118
+ */
119
+ goog.events.BrowserEvent.prototype.relatedTarget = null;
120
+
121
+
122
+ /**
123
+ * X-coordinate relative to target.
124
+ * @type {number}
125
+ */
126
+ goog.events.BrowserEvent.prototype.offsetX = 0;
127
+
128
+
129
+ /**
130
+ * Y-coordinate relative to target.
131
+ * @type {number}
132
+ */
133
+ goog.events.BrowserEvent.prototype.offsetY = 0;
134
+
135
+
136
+ /**
137
+ * X-coordinate relative to the window.
138
+ * @type {number}
139
+ */
140
+ goog.events.BrowserEvent.prototype.clientX = 0;
141
+
142
+
143
+ /**
144
+ * Y-coordinate relative to the window.
145
+ * @type {number}
146
+ */
147
+ goog.events.BrowserEvent.prototype.clientY = 0;
148
+
149
+
150
+ /**
151
+ * X-coordinate relative to the monitor.
152
+ * @type {number}
153
+ */
154
+ goog.events.BrowserEvent.prototype.screenX = 0;
155
+
156
+
157
+ /**
158
+ * Y-coordinate relative to the monitor.
159
+ * @type {number}
160
+ */
161
+ goog.events.BrowserEvent.prototype.screenY = 0;
162
+
163
+
164
+ /**
165
+ * Which mouse button was pressed.
166
+ * @type {number}
167
+ */
168
+ goog.events.BrowserEvent.prototype.button = 0;
169
+
170
+
171
+ /**
172
+ * Keycode of key press.
173
+ * @type {number}
174
+ */
175
+ goog.events.BrowserEvent.prototype.keyCode = 0;
176
+
177
+
178
+ /**
179
+ * Keycode of key press.
180
+ * @type {number}
181
+ */
182
+ goog.events.BrowserEvent.prototype.charCode = 0;
183
+
184
+
185
+ /**
186
+ * Whether control was pressed at time of event.
187
+ * @type {boolean}
188
+ */
189
+ goog.events.BrowserEvent.prototype.ctrlKey = false;
190
+
191
+
192
+ /**
193
+ * Whether alt was pressed at time of event.
194
+ * @type {boolean}
195
+ */
196
+ goog.events.BrowserEvent.prototype.altKey = false;
197
+
198
+
199
+ /**
200
+ * Whether shift was pressed at time of event.
201
+ * @type {boolean}
202
+ */
203
+ goog.events.BrowserEvent.prototype.shiftKey = false;
204
+
205
+
206
+ /**
207
+ * Whether the meta key was pressed at time of event.
208
+ * @type {boolean}
209
+ */
210
+ goog.events.BrowserEvent.prototype.metaKey = false;
211
+
212
+
213
+ /**
214
+ * History state object, only set for PopState events where it's a copy of the
215
+ * state object provided to pushState or replaceState.
216
+ * @type {Object}
217
+ */
218
+ goog.events.BrowserEvent.prototype.state;
219
+
220
+
221
+ /**
222
+ * Whether the default platform modifier key was pressed at time of event.
223
+ * (This is control for all platforms except Mac, where it's Meta.
224
+ * @type {boolean}
225
+ */
226
+ goog.events.BrowserEvent.prototype.platformModifierKey = false;
227
+
228
+
229
+ /**
230
+ * The browser event object.
231
+ * @type {Event}
232
+ * @private
233
+ */
234
+ goog.events.BrowserEvent.prototype.event_ = null;
235
+
236
+
237
+ /**
238
+ * Accepts a browser event object and creates a patched, cross browser event
239
+ * object.
240
+ * @param {Event} e Browser event object.
241
+ * @param {Node=} opt_currentTarget Current target for event.
242
+ */
243
+ goog.events.BrowserEvent.prototype.init = function(e, opt_currentTarget) {
244
+ var type = this.type = e.type;
245
+ goog.events.Event.call(this, type);
246
+
247
+ // TODO(nicksantos): Change this.target to type EventTarget.
248
+ this.target = /** @type {Node} */ (e.target) || e.srcElement;
249
+
250
+ this.currentTarget = opt_currentTarget;
251
+
252
+ var relatedTarget = /** @type {Node} */ (e.relatedTarget);
253
+ if (relatedTarget) {
254
+ // There's a bug in FireFox where sometimes, relatedTarget will be a
255
+ // chrome element, and accessing any property of it will get a permission
256
+ // denied exception. See:
257
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=497780
258
+ if (goog.userAgent.GECKO) {
259
+ if (!goog.reflect.canAccessProperty(relatedTarget, 'nodeName')) {
260
+ relatedTarget = null;
261
+ }
262
+ }
263
+ // TODO(arv): Use goog.events.EventType when it has been refactored into its
264
+ // own file.
265
+ } else if (type == goog.events.EventType.MOUSEOVER) {
266
+ relatedTarget = e.fromElement;
267
+ } else if (type == goog.events.EventType.MOUSEOUT) {
268
+ relatedTarget = e.toElement;
269
+ }
270
+
271
+ this.relatedTarget = relatedTarget;
272
+
273
+ // Webkit emits a lame warning whenever layerX/layerY is accessed.
274
+ // http://code.google.com/p/chromium/issues/detail?id=101733
275
+ this.offsetX = (goog.userAgent.WEBKIT || e.offsetX !== undefined) ?
276
+ e.offsetX : e.layerX;
277
+ this.offsetY = (goog.userAgent.WEBKIT || e.offsetY !== undefined) ?
278
+ e.offsetY : e.layerY;
279
+
280
+ this.clientX = e.clientX !== undefined ? e.clientX : e.pageX;
281
+ this.clientY = e.clientY !== undefined ? e.clientY : e.pageY;
282
+ this.screenX = e.screenX || 0;
283
+ this.screenY = e.screenY || 0;
284
+
285
+ this.button = e.button;
286
+
287
+ this.keyCode = e.keyCode || 0;
288
+ this.charCode = e.charCode || (type == 'keypress' ? e.keyCode : 0);
289
+ this.ctrlKey = e.ctrlKey;
290
+ this.altKey = e.altKey;
291
+ this.shiftKey = e.shiftKey;
292
+ this.metaKey = e.metaKey;
293
+ this.platformModifierKey = goog.userAgent.MAC ? e.metaKey : e.ctrlKey;
294
+ this.state = e.state;
295
+ this.event_ = e;
296
+ delete this.returnValue_;
297
+ delete this.propagationStopped_;
298
+ };
299
+
300
+
301
+ /**
302
+ * Tests to see which button was pressed during the event. This is really only
303
+ * useful in IE and Gecko browsers. And in IE, it's only useful for
304
+ * mousedown/mouseup events, because click only fires for the left mouse button.
305
+ *
306
+ * Safari 2 only reports the left button being clicked, and uses the value '1'
307
+ * instead of 0. Opera only reports a mousedown event for the middle button, and
308
+ * no mouse events for the right button. Opera has default behavior for left and
309
+ * middle click that can only be overridden via a configuration setting.
310
+ *
311
+ * There's a nice table of this mess at http://www.unixpapa.com/js/mouse.html.
312
+ *
313
+ * @param {goog.events.BrowserEvent.MouseButton} button The button
314
+ * to test for.
315
+ * @return {boolean} True if button was pressed.
316
+ */
317
+ goog.events.BrowserEvent.prototype.isButton = function(button) {
318
+ if (!goog.events.BrowserFeature.HAS_W3C_BUTTON) {
319
+ if (this.type == 'click') {
320
+ return button == goog.events.BrowserEvent.MouseButton.LEFT;
321
+ } else {
322
+ return !!(this.event_.button &
323
+ goog.events.BrowserEvent.IEButtonMap[button]);
324
+ }
325
+ } else {
326
+ return this.event_.button == button;
327
+ }
328
+ };
329
+
330
+
331
+ /**
332
+ * Whether this has an "action"-producing mouse button.
333
+ *
334
+ * By definition, this includes left-click on windows/linux, and left-click
335
+ * without the ctrl key on Macs.
336
+ *
337
+ * @return {boolean} The result.
338
+ */
339
+ goog.events.BrowserEvent.prototype.isMouseActionButton = function() {
340
+ // Webkit does not ctrl+click to be a right-click, so we
341
+ // normalize it to behave like Gecko and Opera.
342
+ return this.isButton(goog.events.BrowserEvent.MouseButton.LEFT) &&
343
+ !(goog.userAgent.WEBKIT && goog.userAgent.MAC && this.ctrlKey);
344
+ };
345
+
346
+
347
+ /**
348
+ * @override
349
+ */
350
+ goog.events.BrowserEvent.prototype.stopPropagation = function() {
351
+ goog.events.BrowserEvent.superClass_.stopPropagation.call(this);
352
+ if (this.event_.stopPropagation) {
353
+ this.event_.stopPropagation();
354
+ } else {
355
+ this.event_.cancelBubble = true;
356
+ }
357
+ };
358
+
359
+
360
+ /**
361
+ * @override
362
+ */
363
+ goog.events.BrowserEvent.prototype.preventDefault = function() {
364
+ goog.events.BrowserEvent.superClass_.preventDefault.call(this);
365
+ var be = this.event_;
366
+ if (!be.preventDefault) {
367
+ be.returnValue = false;
368
+ if (goog.events.BrowserFeature.SET_KEY_CODE_TO_PREVENT_DEFAULT) {
369
+ /** @preserveTry */
370
+ try {
371
+ // Most keys can be prevented using returnValue. Some special keys
372
+ // require setting the keyCode to -1 as well:
373
+ //
374
+ // In IE7:
375
+ // F3, F5, F10, F11, Ctrl+P, Crtl+O, Ctrl+F (these are taken from IE6)
376
+ //
377
+ // In IE8:
378
+ // Ctrl+P, Crtl+O, Ctrl+F (F1-F12 cannot be stopped through the event)
379
+ //
380
+ // We therefore do this for all function keys as well as when Ctrl key
381
+ // is pressed.
382
+ var VK_F1 = 112;
383
+ var VK_F12 = 123;
384
+ if (be.ctrlKey || be.keyCode >= VK_F1 && be.keyCode <= VK_F12) {
385
+ be.keyCode = -1;
386
+ }
387
+ } catch (ex) {
388
+ // IE throws an 'access denied' exception when trying to change
389
+ // keyCode in some situations (e.g. srcElement is input[type=file],
390
+ // or srcElement is an anchor tag rewritten by parent's innerHTML).
391
+ // Do nothing in this case.
392
+ }
393
+ }
394
+ } else {
395
+ be.preventDefault();
396
+ }
397
+ };
398
+
399
+
400
+ /**
401
+ * @return {Event} The underlying browser event object.
402
+ */
403
+ goog.events.BrowserEvent.prototype.getBrowserEvent = function() {
404
+ return this.event_;
405
+ };
406
+
407
+
408
+ /** @override */
409
+ goog.events.BrowserEvent.prototype.disposeInternal = function() {
410
+ goog.events.BrowserEvent.superClass_.disposeInternal.call(this);
411
+ this.event_ = null;
412
+ this.target = null;
413
+ this.currentTarget = null;
414
+ this.relatedTarget = null;
415
+ };
416
+ ;
417
+ FI"
418
+ F"%1c058194db00fb2a6229f85516c458ee
@@ -0,0 +1,1630 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325441614.17247: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%91f08fb44713c87b9df1b7d3e2652d8cI"logical_path;
5
+ FI"closure/goog/uri/uri.js;
6
+ TI"
7
+ F"i/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/uri/uri.jsI"content_type;
8
+ FI"application/javascript;
9
+ FI"
10
+ mtime;
11
+ FI"2011-12-30T02:16:25+00:00;
12
+ FI" body;
13
+ FI"0�// Copyright 2006 The Closure Library Authors. All Rights Reserved.
14
+ //
15
+ // Licensed under the Apache License, Version 2.0 (the "License");
16
+ // you may not use this file except in compliance with the License.
17
+ // You may obtain a copy of the License at
18
+ //
19
+ // http://www.apache.org/licenses/LICENSE-2.0
20
+ //
21
+ // Unless required by applicable law or agreed to in writing, software
22
+ // distributed under the License is distributed on an "AS-IS" BASIS,
23
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ // See the License for the specific language governing permissions and
25
+ // limitations under the License.
26
+
27
+ /**
28
+ * @fileoverview Class for parsing and formatting URIs.
29
+ *
30
+ * Use goog.Uri(string) to parse a URI string. Use goog.Uri.create(...) to
31
+ * create a new instance of the goog.Uri object from Uri parts.
32
+ *
33
+ * e.g: <code>var myUri = new goog.Uri(window.location);</code>
34
+ *
35
+ * Implements RFC 3986 for parsing/formatting URIs.
36
+ * http://gbiv.com/protocols/uri/rfc/rfc3986.html
37
+ *
38
+ * Some changes have been made to the interface (more like .NETs), though the
39
+ * internal representation is now of un-encoded parts, this will change the
40
+ * behavior slightly.
41
+ *
42
+ */
43
+
44
+
45
+ goog.provide('goog.Uri');
46
+ goog.provide('goog.Uri.QueryData');
47
+
48
+ goog.require('goog.array');
49
+ goog.require('goog.string');
50
+ goog.require('goog.structs');
51
+ goog.require('goog.structs.Map');
52
+ goog.require('goog.uri.utils');
53
+ goog.require('goog.uri.utils.ComponentIndex');
54
+
55
+
56
+
57
+ /**
58
+ * This class contains setters and getters for the parts of the URI.
59
+ * The <code>getXyz</code>/<code>setXyz</code> methods return the decoded part
60
+ * -- so<code>goog.Uri.parse('/foo%20bar').getPath()</code> will return the
61
+ * decoded path, <code>/foo bar</code>.
62
+ *
63
+ * The constructor accepts an optional unparsed, raw URI string. The parser
64
+ * is relaxed, so special characters that aren't escaped but don't cause
65
+ * ambiguities will not cause parse failures.
66
+ *
67
+ * All setters return <code>this</code> and so may be chained, a la
68
+ * <code>goog.Uri.parse('/foo').setFragment('part').toString()</code>.
69
+ *
70
+ * @param {*=} opt_uri Optional string URI to parse
71
+ * (use goog.Uri.create() to create a URI from parts), or if
72
+ * a goog.Uri is passed, a clone is created.
73
+ * @param {boolean=} opt_ignoreCase If true, #getParameterValue will ignore
74
+ * the case of the parameter name.
75
+ *
76
+ * @constructor
77
+ */
78
+ goog.Uri = function(opt_uri, opt_ignoreCase) {
79
+ // Parse in the uri string
80
+ var m;
81
+ if (opt_uri instanceof goog.Uri) {
82
+ this.setIgnoreCase(opt_ignoreCase == null ?
83
+ opt_uri.getIgnoreCase() : opt_ignoreCase);
84
+ this.setScheme(opt_uri.getScheme());
85
+ this.setUserInfo(opt_uri.getUserInfo());
86
+ this.setDomain(opt_uri.getDomain());
87
+ this.setPort(opt_uri.getPort());
88
+ this.setPath(opt_uri.getPath());
89
+ this.setQueryData(opt_uri.getQueryData().clone());
90
+ this.setFragment(opt_uri.getFragment());
91
+ } else if (opt_uri && (m = goog.uri.utils.split(String(opt_uri)))) {
92
+ // Set the parts -- decoding as we do so.
93
+ this.setIgnoreCase(!!opt_ignoreCase);
94
+ // COMPATABILITY NOTE - In IE, unmatched fields may be empty strings,
95
+ // whereas in other browsers they will be undefined.
96
+ this.setScheme(m[goog.uri.utils.ComponentIndex.SCHEME] || '', true);
97
+ this.setUserInfo(m[goog.uri.utils.ComponentIndex.USER_INFO] || '', true);
98
+ this.setDomain(m[goog.uri.utils.ComponentIndex.DOMAIN] || '', true);
99
+ this.setPort(m[goog.uri.utils.ComponentIndex.PORT]);
100
+ this.setPath(m[goog.uri.utils.ComponentIndex.PATH] || '', true);
101
+
102
+ this.setQuery(m[goog.uri.utils.ComponentIndex.QUERY_DATA] || '', true);
103
+
104
+ this.setFragment(m[goog.uri.utils.ComponentIndex.FRAGMENT] || '', true);
105
+
106
+ } else {
107
+ this.setIgnoreCase(!!opt_ignoreCase);
108
+ this.queryData_ = new goog.Uri.QueryData(null, this, this.ignoreCase_);
109
+ }
110
+ };
111
+
112
+
113
+ /**
114
+ * Parameter name added to stop caching.
115
+ * @type {string}
116
+ */
117
+ goog.Uri.RANDOM_PARAM = goog.uri.utils.StandardQueryParam.RANDOM;
118
+
119
+
120
+ /**
121
+ * Scheme such as "http".
122
+ * @type {string}
123
+ * @private
124
+ */
125
+ goog.Uri.prototype.scheme_ = '';
126
+
127
+
128
+ /**
129
+ * User credentials in the form "username:password".
130
+ * @type {string}
131
+ * @private
132
+ */
133
+ goog.Uri.prototype.userInfo_ = '';
134
+
135
+
136
+ /**
137
+ * Domain part, e.g. "www.google.com".
138
+ * @type {string}
139
+ * @private
140
+ */
141
+ goog.Uri.prototype.domain_ = '';
142
+
143
+
144
+ /**
145
+ * Port, e.g. 8080.
146
+ * @type {?number}
147
+ * @private
148
+ */
149
+ goog.Uri.prototype.port_ = null;
150
+
151
+
152
+ /**
153
+ * Path, e.g. "/tests/img.png".
154
+ * @type {string}
155
+ * @private
156
+ */
157
+ goog.Uri.prototype.path_ = '';
158
+
159
+
160
+ /**
161
+ * Object representing query data.
162
+ * @type {!goog.Uri.QueryData}
163
+ * @private
164
+ */
165
+ goog.Uri.prototype.queryData_;
166
+
167
+
168
+ /**
169
+ * The fragment without the #.
170
+ * @type {string}
171
+ * @private
172
+ */
173
+ goog.Uri.prototype.fragment_ = '';
174
+
175
+
176
+ /**
177
+ * Whether or not this Uri should be treated as Read Only.
178
+ * @type {boolean}
179
+ * @private
180
+ */
181
+ goog.Uri.prototype.isReadOnly_ = false;
182
+
183
+
184
+ /**
185
+ * Whether or not to ignore case when comparing query params.
186
+ * @type {boolean}
187
+ * @private
188
+ */
189
+ goog.Uri.prototype.ignoreCase_ = false;
190
+
191
+
192
+ /**
193
+ * @return {string} The string form of the url.
194
+ */
195
+ goog.Uri.prototype.toString = function() {
196
+ if (this.cachedToString_) {
197
+ return this.cachedToString_;
198
+ }
199
+
200
+ var out = [];
201
+
202
+ if (this.scheme_) {
203
+ out.push(goog.Uri.encodeSpecialChars_(
204
+ this.scheme_, goog.Uri.reDisallowedInSchemeOrUserInfo_), ':');
205
+ }
206
+
207
+ if (this.domain_) {
208
+ out.push('//');
209
+
210
+ if (this.userInfo_) {
211
+ out.push(goog.Uri.encodeSpecialChars_(
212
+ this.userInfo_, goog.Uri.reDisallowedInSchemeOrUserInfo_), '@');
213
+ }
214
+
215
+ out.push(goog.Uri.encodeString_(this.domain_));
216
+
217
+ if (this.port_ != null) {
218
+ out.push(':', String(this.getPort()));
219
+ }
220
+ }
221
+
222
+ if (this.path_) {
223
+ if (this.hasDomain() && this.path_.charAt(0) != '/') {
224
+ out.push('/');
225
+ }
226
+ out.push(goog.Uri.encodeSpecialChars_(
227
+ this.path_,
228
+ this.path_.charAt(0) == '/' ?
229
+ goog.Uri.reDisallowedInAbsolutePath_ :
230
+ goog.Uri.reDisallowedInRelativePath_));
231
+ }
232
+
233
+ var query = String(this.queryData_);
234
+ if (query) {
235
+ out.push('?', query);
236
+ }
237
+
238
+ if (this.fragment_) {
239
+ out.push('#', goog.Uri.encodeSpecialChars_(
240
+ this.fragment_, goog.Uri.reDisallowedInFragment_));
241
+ }
242
+ return this.cachedToString_ = out.join('');
243
+ };
244
+
245
+
246
+ /**
247
+ * Resolves a relative url string to a this base uri.
248
+ *
249
+ * There are several kinds of relative urls:<br>
250
+ * 1. foo - replaces the last part of the path, the whole query and fragment<br>
251
+ * 2. /foo - replaces the the path, the query and fragment<br>
252
+ * 3. //foo - replaces everything from the domain on. foo is a domain name<br>
253
+ * 4. ?foo - replace the query and fragment<br>
254
+ * 5. #foo - replace the fragment only
255
+ *
256
+ * Additionally, if relative url has a non-empty path, all ".." and "."
257
+ * segments will be resolved, as described in RFC 3986.
258
+ *
259
+ * @param {goog.Uri} relativeUri The relative url to resolve.
260
+ * @return {!goog.Uri} The resolved URI.
261
+ */
262
+ goog.Uri.prototype.resolve = function(relativeUri) {
263
+
264
+ var absoluteUri = this.clone();
265
+
266
+ // we satisfy these conditions by looking for the first part of relativeUri
267
+ // that is not blank and applying defaults to the rest
268
+
269
+ var overridden = relativeUri.hasScheme();
270
+
271
+ if (overridden) {
272
+ absoluteUri.setScheme(relativeUri.getScheme());
273
+ } else {
274
+ overridden = relativeUri.hasUserInfo();
275
+ }
276
+
277
+ if (overridden) {
278
+ absoluteUri.setUserInfo(relativeUri.getUserInfo());
279
+ } else {
280
+ overridden = relativeUri.hasDomain();
281
+ }
282
+
283
+ if (overridden) {
284
+ absoluteUri.setDomain(relativeUri.getDomain());
285
+ } else {
286
+ overridden = relativeUri.hasPort();
287
+ }
288
+
289
+ var path = relativeUri.getPath();
290
+ if (overridden) {
291
+ absoluteUri.setPort(relativeUri.getPort());
292
+ } else {
293
+ overridden = relativeUri.hasPath();
294
+ if (overridden) {
295
+ // resolve path properly
296
+ if (path.charAt(0) != '/') {
297
+ // path is relative
298
+ if (this.hasDomain() && !this.hasPath()) {
299
+ // RFC 3986, section 5.2.3, case 1
300
+ path = '/' + path;
301
+ } else {
302
+ // RFC 3986, section 5.2.3, case 2
303
+ var lastSlashIndex = absoluteUri.getPath().lastIndexOf('/');
304
+ if (lastSlashIndex != -1) {
305
+ path = absoluteUri.getPath().substr(0, lastSlashIndex + 1) + path;
306
+ }
307
+ }
308
+ }
309
+ path = goog.Uri.removeDotSegments(path);
310
+ }
311
+ }
312
+
313
+ if (overridden) {
314
+ absoluteUri.setPath(path);
315
+ } else {
316
+ overridden = relativeUri.hasQuery();
317
+ }
318
+
319
+ if (overridden) {
320
+ absoluteUri.setQuery(relativeUri.getDecodedQuery());
321
+ } else {
322
+ overridden = relativeUri.hasFragment();
323
+ }
324
+
325
+ if (overridden) {
326
+ absoluteUri.setFragment(relativeUri.getFragment());
327
+ }
328
+
329
+ return absoluteUri;
330
+ };
331
+
332
+
333
+ /**
334
+ * Clones the URI instance.
335
+ * @return {!goog.Uri} New instance of the URI objcet.
336
+ */
337
+ goog.Uri.prototype.clone = function() {
338
+ return goog.Uri.create(this.scheme_, this.userInfo_, this.domain_,
339
+ this.port_, this.path_, this.queryData_.clone(),
340
+ this.fragment_, this.ignoreCase_);
341
+ };
342
+
343
+
344
+ /**
345
+ * @return {string} The encoded scheme/protocol for the URI.
346
+ */
347
+ goog.Uri.prototype.getScheme = function() {
348
+ return this.scheme_;
349
+ };
350
+
351
+
352
+ /**
353
+ * Sets the scheme/protocol.
354
+ * @param {string} newScheme New scheme value.
355
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
356
+ * @return {!goog.Uri} Reference to this URI object.
357
+ */
358
+ goog.Uri.prototype.setScheme = function(newScheme, opt_decode) {
359
+ this.enforceReadOnly();
360
+ delete this.cachedToString_;
361
+ this.scheme_ = opt_decode ? goog.Uri.decodeOrEmpty_(newScheme) : newScheme;
362
+
363
+ // remove an : at the end of the scheme so somebody can pass in
364
+ // window.location.protocol
365
+ if (this.scheme_) {
366
+ this.scheme_ = this.scheme_.replace(/:$/, '');
367
+ }
368
+ return this;
369
+ };
370
+
371
+
372
+ /**
373
+ * @return {boolean} Whether the scheme has been set.
374
+ */
375
+ goog.Uri.prototype.hasScheme = function() {
376
+ return !!this.scheme_;
377
+ };
378
+
379
+
380
+ /**
381
+ * @return {string} The decoded user info.
382
+ */
383
+ goog.Uri.prototype.getUserInfo = function() {
384
+ return this.userInfo_;
385
+ };
386
+
387
+
388
+ /**
389
+ * Sets the userInfo.
390
+ * @param {string} newUserInfo New userInfo value.
391
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
392
+ * @return {!goog.Uri} Reference to this URI object.
393
+ */
394
+ goog.Uri.prototype.setUserInfo = function(newUserInfo, opt_decode) {
395
+ this.enforceReadOnly();
396
+ delete this.cachedToString_;
397
+ this.userInfo_ = opt_decode ? goog.Uri.decodeOrEmpty_(newUserInfo) :
398
+ newUserInfo;
399
+ return this;
400
+ };
401
+
402
+
403
+ /**
404
+ * @return {boolean} Whether the user info has been set.
405
+ */
406
+ goog.Uri.prototype.hasUserInfo = function() {
407
+ return !!this.userInfo_;
408
+ };
409
+
410
+
411
+ /**
412
+ * @return {string} The decoded domain.
413
+ */
414
+ goog.Uri.prototype.getDomain = function() {
415
+ return this.domain_;
416
+ };
417
+
418
+
419
+ /**
420
+ * Sets the domain.
421
+ * @param {string} newDomain New domain value.
422
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
423
+ * @return {!goog.Uri} Reference to this URI object.
424
+ */
425
+ goog.Uri.prototype.setDomain = function(newDomain, opt_decode) {
426
+ this.enforceReadOnly();
427
+ delete this.cachedToString_;
428
+ this.domain_ = opt_decode ? goog.Uri.decodeOrEmpty_(newDomain) : newDomain;
429
+ return this;
430
+ };
431
+
432
+
433
+ /**
434
+ * @return {boolean} Whether the domain has been set.
435
+ */
436
+ goog.Uri.prototype.hasDomain = function() {
437
+ return !!this.domain_;
438
+ };
439
+
440
+
441
+ /**
442
+ * @return {?number} The port number.
443
+ */
444
+ goog.Uri.prototype.getPort = function() {
445
+ return this.port_;
446
+ };
447
+
448
+
449
+ /**
450
+ * Sets the port number.
451
+ * @param {*} newPort Port number. Will be explicitly casted to a number.
452
+ * @return {!goog.Uri} Reference to this URI object.
453
+ */
454
+ goog.Uri.prototype.setPort = function(newPort) {
455
+ this.enforceReadOnly();
456
+ delete this.cachedToString_;
457
+
458
+ if (newPort) {
459
+ newPort = Number(newPort);
460
+ if (isNaN(newPort) || newPort < 0) {
461
+ throw Error('Bad port number ' + newPort);
462
+ }
463
+ this.port_ = newPort;
464
+ } else {
465
+ this.port_ = null;
466
+ }
467
+
468
+ return this;
469
+ };
470
+
471
+
472
+ /**
473
+ * @return {boolean} Whether the port has been set.
474
+ */
475
+ goog.Uri.prototype.hasPort = function() {
476
+ return this.port_ != null;
477
+ };
478
+
479
+
480
+ /**
481
+ * @return {string} The decoded path.
482
+ */
483
+ goog.Uri.prototype.getPath = function() {
484
+ return this.path_;
485
+ };
486
+
487
+
488
+ /**
489
+ * Sets the path.
490
+ * @param {string} newPath New path value.
491
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
492
+ * @return {!goog.Uri} Reference to this URI object.
493
+ */
494
+ goog.Uri.prototype.setPath = function(newPath, opt_decode) {
495
+ this.enforceReadOnly();
496
+ delete this.cachedToString_;
497
+ this.path_ = opt_decode ? goog.Uri.decodeOrEmpty_(newPath) : newPath;
498
+ return this;
499
+ };
500
+
501
+
502
+ /**
503
+ * @return {boolean} Whether the path has been set.
504
+ */
505
+ goog.Uri.prototype.hasPath = function() {
506
+ return !!this.path_;
507
+ };
508
+
509
+
510
+ /**
511
+ * @return {boolean} Whether the query string has been set.
512
+ */
513
+ goog.Uri.prototype.hasQuery = function() {
514
+ return this.queryData_.toString() !== '';
515
+ };
516
+
517
+
518
+ /**
519
+ * Sets the query data.
520
+ * @param {goog.Uri.QueryData|string|undefined} queryData QueryData object.
521
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
522
+ * Applies only if queryData is a string.
523
+ * @return {!goog.Uri} Reference to this URI object.
524
+ */
525
+ goog.Uri.prototype.setQueryData = function(queryData, opt_decode) {
526
+ this.enforceReadOnly();
527
+ delete this.cachedToString_;
528
+
529
+ if (queryData instanceof goog.Uri.QueryData) {
530
+ this.queryData_ = queryData;
531
+ this.queryData_.uri_ = this;
532
+ this.queryData_.setIgnoreCase(this.ignoreCase_);
533
+ } else {
534
+ // QueryData accepts encoded query string,
535
+ // so encode it if opt_decode flag is not true.
536
+ if (!opt_decode) {
537
+ queryData = goog.Uri.encodeSpecialChars_(queryData,
538
+ goog.Uri.reDisallowedInQuery_);
539
+ }
540
+ this.queryData_ =
541
+ new goog.Uri.QueryData(queryData, this, this.ignoreCase_);
542
+ }
543
+
544
+ return this;
545
+ };
546
+
547
+
548
+ /**
549
+ * Sets the URI query.
550
+ * @param {string} newQuery New query value.
551
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
552
+ * @return {!goog.Uri} Reference to this URI object.
553
+ */
554
+ goog.Uri.prototype.setQuery = function(newQuery, opt_decode) {
555
+ return this.setQueryData(newQuery, opt_decode);
556
+ };
557
+
558
+
559
+ /**
560
+ * @return {string} The encoded URI query, not including the ?.
561
+ */
562
+ goog.Uri.prototype.getEncodedQuery = function() {
563
+ return this.queryData_.toString();
564
+ };
565
+
566
+
567
+ /**
568
+ * @return {string} The decoded URI query, not including the ?.
569
+ */
570
+ goog.Uri.prototype.getDecodedQuery = function() {
571
+ return this.queryData_.toDecodedString();
572
+ };
573
+
574
+
575
+ /**
576
+ * Returns the query data.
577
+ * @return {goog.Uri.QueryData} QueryData object.
578
+ */
579
+ goog.Uri.prototype.getQueryData = function() {
580
+ return this.queryData_;
581
+ };
582
+
583
+
584
+ /**
585
+ * @return {string} The encoded URI query, not including the ?.
586
+ *
587
+ * Warning: This method, unlike other getter methods, returns encoded
588
+ * value, instead of decoded one.
589
+ */
590
+ goog.Uri.prototype.getQuery = function() {
591
+ return this.getEncodedQuery();
592
+ };
593
+
594
+
595
+ /**
596
+ * Sets the value of the named query parameters, clearing previous values for
597
+ * that key.
598
+ *
599
+ * @param {string} key The parameter to set.
600
+ * @param {*} value The new value.
601
+ * @return {!goog.Uri} Reference to this URI object.
602
+ */
603
+ goog.Uri.prototype.setParameterValue = function(key, value) {
604
+ this.enforceReadOnly();
605
+ delete this.cachedToString_;
606
+
607
+ this.queryData_.set(key, value);
608
+ return this;
609
+ };
610
+
611
+
612
+ /**
613
+ * Sets the values of the named query parameters, clearing previous values for
614
+ * that key. Not new values will currently be moved to the end of the query
615
+ * string.
616
+ *
617
+ * So, <code>goog.Uri.parse('foo?a=b&c=d&e=f').setParameterValues('c', ['new'])
618
+ * </code> yields <tt>foo?a=b&e=f&c=new</tt>.</p>
619
+ *
620
+ * @param {string} key The parameter to set.
621
+ * @param {*} values The new values. If values is a single
622
+ * string then it will be treated as the sole value.
623
+ * @return {!goog.Uri} Reference to this URI object.
624
+ */
625
+ goog.Uri.prototype.setParameterValues = function(key, values) {
626
+ this.enforceReadOnly();
627
+ delete this.cachedToString_;
628
+
629
+ if (!goog.isArray(values)) {
630
+ values = [String(values)];
631
+ }
632
+
633
+ // TODO(nicksantos): This cast shouldn't be necessary.
634
+ this.queryData_.setValues(key, /** @type {Array} */ (values));
635
+
636
+ return this;
637
+ };
638
+
639
+
640
+ /**
641
+ * Returns the value<b>s</b> for a given cgi parameter as a list of decoded
642
+ * query parameter values.
643
+ * @param {string} name The parameter to get values for.
644
+ * @return {Array} The values for a given cgi parameter as a list of
645
+ * decoded query parameter values.
646
+ */
647
+ goog.Uri.prototype.getParameterValues = function(name) {
648
+ return this.queryData_.getValues(name);
649
+ };
650
+
651
+
652
+ /**
653
+ * Returns the first value for a given cgi parameter or undefined if the given
654
+ * parameter name does not appear in the query string.
655
+ * @param {string} paramName Unescaped parameter name.
656
+ * @return {*} The first value for a given cgi parameter or
657
+ * undefined if the given parameter name does not appear in the query
658
+ * string.
659
+ */
660
+ goog.Uri.prototype.getParameterValue = function(paramName) {
661
+ return this.queryData_.get(paramName);
662
+ };
663
+
664
+
665
+ /**
666
+ * @return {string} The URI fragment, not including the #.
667
+ */
668
+ goog.Uri.prototype.getFragment = function() {
669
+ return this.fragment_;
670
+ };
671
+
672
+
673
+ /**
674
+ * Sets the URI fragment.
675
+ * @param {string} newFragment New fragment value.
676
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
677
+ * @return {!goog.Uri} Reference to this URI object.
678
+ */
679
+ goog.Uri.prototype.setFragment = function(newFragment, opt_decode) {
680
+ this.enforceReadOnly();
681
+ delete this.cachedToString_;
682
+ this.fragment_ = opt_decode ? goog.Uri.decodeOrEmpty_(newFragment) :
683
+ newFragment;
684
+ return this;
685
+ };
686
+
687
+
688
+ /**
689
+ * @return {boolean} Whether the URI has a fragment set.
690
+ */
691
+ goog.Uri.prototype.hasFragment = function() {
692
+ return !!this.fragment_;
693
+ };
694
+
695
+
696
+ /**
697
+ * Returns true if this has the same domain as that of uri2.
698
+ * @param {goog.Uri} uri2 The URI object to compare to.
699
+ * @return {boolean} true if same domain; false otherwise.
700
+ */
701
+ goog.Uri.prototype.hasSameDomainAs = function(uri2) {
702
+ return ((!this.hasDomain() && !uri2.hasDomain()) ||
703
+ this.getDomain() == uri2.getDomain()) &&
704
+ ((!this.hasPort() && !uri2.hasPort()) ||
705
+ this.getPort() == uri2.getPort());
706
+ };
707
+
708
+
709
+ /**
710
+ * Adds a random parameter to the Uri.
711
+ * @return {!goog.Uri} Reference to this Uri object.
712
+ */
713
+ goog.Uri.prototype.makeUnique = function() {
714
+ this.enforceReadOnly();
715
+ this.setParameterValue(goog.Uri.RANDOM_PARAM, goog.string.getRandomString());
716
+
717
+ return this;
718
+ };
719
+
720
+
721
+ /**
722
+ * Removes the named query parameter.
723
+ *
724
+ * @param {string} key The parameter to remove.
725
+ * @return {!goog.Uri} Reference to this URI object.
726
+ */
727
+ goog.Uri.prototype.removeParameter = function(key) {
728
+ this.enforceReadOnly();
729
+ this.queryData_.remove(key);
730
+ return this;
731
+ };
732
+
733
+
734
+ /**
735
+ * Sets whether Uri is read only. If this goog.Uri is read-only,
736
+ * enforceReadOnly_ will be called at the start of any function that may modify
737
+ * this Uri.
738
+ * @param {boolean} isReadOnly whether this goog.Uri should be read only.
739
+ * @return {!goog.Uri} Reference to this Uri object.
740
+ */
741
+ goog.Uri.prototype.setReadOnly = function(isReadOnly) {
742
+ this.isReadOnly_ = isReadOnly;
743
+ return this;
744
+ };
745
+
746
+
747
+ /**
748
+ * @return {boolean} Whether the URI is read only.
749
+ */
750
+ goog.Uri.prototype.isReadOnly = function() {
751
+ return this.isReadOnly_;
752
+ };
753
+
754
+
755
+ /**
756
+ * Checks if this Uri has been marked as read only, and if so, throws an error.
757
+ * This should be called whenever any modifying function is called.
758
+ */
759
+ goog.Uri.prototype.enforceReadOnly = function() {
760
+ if (this.isReadOnly_) {
761
+ throw Error('Tried to modify a read-only Uri');
762
+ }
763
+ };
764
+
765
+
766
+ /**
767
+ * Sets whether to ignore case.
768
+ * NOTE: If there are already key/value pairs in the QueryData, and
769
+ * ignoreCase_ is set to false, the keys will all be lower-cased.
770
+ * @param {boolean} ignoreCase whether this goog.Uri should ignore case.
771
+ * @return {!goog.Uri} Reference to this Uri object.
772
+ */
773
+ goog.Uri.prototype.setIgnoreCase = function(ignoreCase) {
774
+ this.ignoreCase_ = ignoreCase;
775
+ if (this.queryData_) {
776
+ this.queryData_.setIgnoreCase(ignoreCase);
777
+ }
778
+ return this;
779
+ };
780
+
781
+
782
+ /**
783
+ * @return {boolean} Whether to ignore case.
784
+ */
785
+ goog.Uri.prototype.getIgnoreCase = function() {
786
+ return this.ignoreCase_;
787
+ };
788
+
789
+
790
+ //==============================================================================
791
+ // Static members
792
+ //==============================================================================
793
+
794
+
795
+ /**
796
+ * Creates a uri from the string form. Basically an alias of new goog.Uri().
797
+ * If a Uri object is passed to parse then it will return a clone of the object.
798
+ *
799
+ * @param {*} uri Raw URI string or instance of Uri
800
+ * object.
801
+ * @param {boolean=} opt_ignoreCase Whether to ignore the case of parameter
802
+ * names in #getParameterValue.
803
+ * @return {!goog.Uri} The new URI object.
804
+ */
805
+ goog.Uri.parse = function(uri, opt_ignoreCase) {
806
+ return uri instanceof goog.Uri ?
807
+ uri.clone() : new goog.Uri(uri, opt_ignoreCase);
808
+ };
809
+
810
+
811
+ /**
812
+ * Creates a new goog.Uri object from unencoded parts.
813
+ *
814
+ * @param {?string=} opt_scheme Scheme/protocol or full URI to parse.
815
+ * @param {?string=} opt_userInfo username:password.
816
+ * @param {?string=} opt_domain www.google.com.
817
+ * @param {?number=} opt_port 9830.
818
+ * @param {?string=} opt_path /some/path/to/a/file.html.
819
+ * @param {string|goog.Uri.QueryData=} opt_query a=1&b=2.
820
+ * @param {?string=} opt_fragment The fragment without the #.
821
+ * @param {boolean=} opt_ignoreCase Whether to ignore parameter name case in
822
+ * #getParameterValue.
823
+ *
824
+ * @return {!goog.Uri} The new URI object.
825
+ */
826
+ goog.Uri.create = function(opt_scheme, opt_userInfo, opt_domain, opt_port,
827
+ opt_path, opt_query, opt_fragment, opt_ignoreCase) {
828
+
829
+ var uri = new goog.Uri(null, opt_ignoreCase);
830
+
831
+ // Only set the parts if they are defined and not empty strings.
832
+ opt_scheme && uri.setScheme(opt_scheme);
833
+ opt_userInfo && uri.setUserInfo(opt_userInfo);
834
+ opt_domain && uri.setDomain(opt_domain);
835
+ opt_port && uri.setPort(opt_port);
836
+ opt_path && uri.setPath(opt_path);
837
+ opt_query && uri.setQueryData(opt_query);
838
+ opt_fragment && uri.setFragment(opt_fragment);
839
+
840
+ return uri;
841
+ };
842
+
843
+
844
+ /**
845
+ * Resolves a relative Uri against a base Uri, accepting both strings and
846
+ * Uri objects.
847
+ *
848
+ * @param {*} base Base Uri.
849
+ * @param {*} rel Relative Uri.
850
+ * @return {!goog.Uri} Resolved uri.
851
+ */
852
+ goog.Uri.resolve = function(base, rel) {
853
+ if (!(base instanceof goog.Uri)) {
854
+ base = goog.Uri.parse(base);
855
+ }
856
+
857
+ if (!(rel instanceof goog.Uri)) {
858
+ rel = goog.Uri.parse(rel);
859
+ }
860
+
861
+ return base.resolve(rel);
862
+ };
863
+
864
+
865
+ /**
866
+ * Removes dot segments in given path component, as described in
867
+ * RFC 3986, section 5.2.4.
868
+ *
869
+ * @param {string} path A non-empty path component.
870
+ * @return {string} Path component with removed dot segments.
871
+ */
872
+ goog.Uri.removeDotSegments = function(path) {
873
+ if (path == '..' || path == '.') {
874
+ return '';
875
+
876
+ } else if (!goog.string.contains(path, './') &&
877
+ !goog.string.contains(path, '/.')) {
878
+ // This optimization detects uris which do not contain dot-segments,
879
+ // and as a consequence do not require any processing.
880
+ return path;
881
+
882
+ } else {
883
+ var leadingSlash = goog.string.startsWith(path, '/');
884
+ var segments = path.split('/');
885
+ var out = [];
886
+
887
+ for (var pos = 0; pos < segments.length; ) {
888
+ var segment = segments[pos++];
889
+
890
+ if (segment == '.') {
891
+ if (leadingSlash && pos == segments.length) {
892
+ out.push('');
893
+ }
894
+ } else if (segment == '..') {
895
+ if (out.length > 1 || out.length == 1 && out[0] != '') {
896
+ out.pop();
897
+ }
898
+ if (leadingSlash && pos == segments.length) {
899
+ out.push('');
900
+ }
901
+ } else {
902
+ out.push(segment);
903
+ leadingSlash = true;
904
+ }
905
+ }
906
+
907
+ return out.join('/');
908
+ }
909
+ };
910
+
911
+
912
+ /**
913
+ * Decodes a value or returns the empty string if it isn't defined or empty.
914
+ * @param {string|undefined} val Value to decode.
915
+ * @return {string} Decoded value.
916
+ * @private
917
+ */
918
+ goog.Uri.decodeOrEmpty_ = function(val) {
919
+ // Don't use UrlDecode() here because val is not a query parameter.
920
+ return val ? decodeURIComponent(val) : '';
921
+ };
922
+
923
+
924
+ /**
925
+ * URI encode a string, or return null if it's not a string.
926
+ * @param {*} unescapedPart Unescaped string.
927
+ * @return {?string} Escaped string.
928
+ * @private
929
+ */
930
+ goog.Uri.encodeString_ = function(unescapedPart) {
931
+ if (goog.isString(unescapedPart)) {
932
+ return encodeURIComponent(unescapedPart);
933
+ }
934
+ return null;
935
+ };
936
+
937
+
938
+ /**
939
+ * Regular expression used for determining if a string needs to be encoded.
940
+ * @type {RegExp}
941
+ * @private
942
+ */
943
+ goog.Uri.encodeSpecialRegExp_ = /^[a-zA-Z0-9\-_.!~*'():\/;?]*$/;
944
+
945
+
946
+ /**
947
+ * If unescapedPart is non null, then escapes any characters in it that aren't
948
+ * valid characters in a url and also escapes any special characters that
949
+ * appear in extra.
950
+ *
951
+ * @param {*} unescapedPart The string to encode.
952
+ * @param {RegExp} extra A character set of characters in [\01-\177].
953
+ * @return {?string} null iff unescapedPart == null.
954
+ * @private
955
+ */
956
+ goog.Uri.encodeSpecialChars_ = function(unescapedPart, extra) {
957
+ var ret = null;
958
+ if (goog.isString(unescapedPart)) {
959
+ ret = unescapedPart;
960
+ // Checking if the search matches before calling encodeURI avoids an extra
961
+ // allocation in IE6
962
+ if (!goog.Uri.encodeSpecialRegExp_.test(ret)) {
963
+ ret = encodeURI(unescapedPart);
964
+ }
965
+ // Checking if the search matches before calling replace avoids an extra
966
+ // allocation in IE6
967
+ if (ret.search(extra) >= 0) {
968
+ ret = ret.replace(extra, goog.Uri.encodeChar_);
969
+ }
970
+ }
971
+ return ret;
972
+ };
973
+
974
+
975
+ /**
976
+ * Converts a character in [\01-\177] to its unicode character equivalent.
977
+ * @param {string} ch One character string.
978
+ * @return {string} Encoded string.
979
+ * @private
980
+ */
981
+ goog.Uri.encodeChar_ = function(ch) {
982
+ var n = ch.charCodeAt(0);
983
+ return '%' + ((n >> 4) & 0xf).toString(16) + (n & 0xf).toString(16);
984
+ };
985
+
986
+
987
+ /**
988
+ * Regular expression for characters that are disallowed in the scheme or
989
+ * userInfo part of the URI.
990
+ * @type {RegExp}
991
+ * @private
992
+ */
993
+ goog.Uri.reDisallowedInSchemeOrUserInfo_ = /[#\/\?@]/g;
994
+
995
+
996
+ /**
997
+ * Regular expression for characters that are disallowed in a relative path.
998
+ * @type {RegExp}
999
+ * @private
1000
+ */
1001
+ goog.Uri.reDisallowedInRelativePath_ = /[\#\?:]/g;
1002
+
1003
+
1004
+ /**
1005
+ * Regular expression for characters that are disallowed in an absolute path.
1006
+ * @type {RegExp}
1007
+ * @private
1008
+ */
1009
+ goog.Uri.reDisallowedInAbsolutePath_ = /[\#\?]/g;
1010
+
1011
+
1012
+ /**
1013
+ * Regular expression for characters that are disallowed in the query.
1014
+ * @type {RegExp}
1015
+ * @private
1016
+ */
1017
+ goog.Uri.reDisallowedInQuery_ = /[\#\?@]/g;
1018
+
1019
+
1020
+ /**
1021
+ * Regular expression for characters that are disallowed in the fragment.
1022
+ * @type {RegExp}
1023
+ * @private
1024
+ */
1025
+ goog.Uri.reDisallowedInFragment_ = /#/g;
1026
+
1027
+
1028
+ /**
1029
+ * Checks whether two URIs have the same domain.
1030
+ * @param {string} uri1String First URI string.
1031
+ * @param {string} uri2String Second URI string.
1032
+ * @return {boolean} true if the two URIs have the same domain; false otherwise.
1033
+ */
1034
+ goog.Uri.haveSameDomain = function(uri1String, uri2String) {
1035
+ // Differs from goog.uri.utils.haveSameDomain, since this ignores scheme.
1036
+ // TODO(gboyer): Have this just call goog.uri.util.haveSameDomain.
1037
+ var pieces1 = goog.uri.utils.split(uri1String);
1038
+ var pieces2 = goog.uri.utils.split(uri2String);
1039
+ return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] ==
1040
+ pieces2[goog.uri.utils.ComponentIndex.DOMAIN] &&
1041
+ pieces1[goog.uri.utils.ComponentIndex.PORT] ==
1042
+ pieces2[goog.uri.utils.ComponentIndex.PORT];
1043
+ };
1044
+
1045
+
1046
+
1047
+ /**
1048
+ * Class used to represent URI query parameters. It is essentially a hash of
1049
+ * name-value pairs, though a name can be present more than once.
1050
+ *
1051
+ * Has the same interface as the collections in goog.structs.
1052
+ *
1053
+ * @param {?string=} opt_query Optional encoded query string to parse into
1054
+ * the object.
1055
+ * @param {goog.Uri=} opt_uri Optional uri object that should have its cache
1056
+ * invalidated when this object updates.
1057
+ * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter
1058
+ * name in #get.
1059
+ * @constructor
1060
+ */
1061
+ goog.Uri.QueryData = function(opt_query, opt_uri, opt_ignoreCase) {
1062
+ /**
1063
+ * Encoded query string, or null if it requires computing from the key map.
1064
+ * @type {?string}
1065
+ * @private
1066
+ */
1067
+ this.encodedQuery_ = opt_query || null;
1068
+
1069
+ /**
1070
+ * Reference to a uri object which uses the query data. This allows the
1071
+ * QueryData object to invalidate the cache.
1072
+ * @type {goog.Uri}
1073
+ * @private
1074
+ */
1075
+ this.uri_ = opt_uri || null;
1076
+
1077
+ /**
1078
+ * If true, ignore the case of the parameter name in #get.
1079
+ * @type {boolean}
1080
+ * @private
1081
+ */
1082
+ this.ignoreCase_ = !!opt_ignoreCase;
1083
+ };
1084
+
1085
+
1086
+ /**
1087
+ * If the underlying key map is not yet initialized, it parses the
1088
+ * query string and fills the map with parsed data.
1089
+ * @private
1090
+ */
1091
+ goog.Uri.QueryData.prototype.ensureKeyMapInitialized_ = function() {
1092
+ if (!this.keyMap_) {
1093
+ this.keyMap_ = new goog.structs.Map();
1094
+ this.count_ = 0;
1095
+
1096
+ if (this.encodedQuery_) {
1097
+ var pairs = this.encodedQuery_.split('&');
1098
+ for (var i = 0; i < pairs.length; i++) {
1099
+ var indexOfEquals = pairs[i].indexOf('=');
1100
+ var name = null;
1101
+ var value = null;
1102
+ if (indexOfEquals >= 0) {
1103
+ name = pairs[i].substring(0, indexOfEquals);
1104
+ value = pairs[i].substring(indexOfEquals + 1);
1105
+ } else {
1106
+ name = pairs[i];
1107
+ }
1108
+ name = goog.string.urlDecode(name);
1109
+ name = this.getKeyName_(name);
1110
+ this.add(name, value ? goog.string.urlDecode(value) : '');
1111
+ }
1112
+ }
1113
+ }
1114
+ };
1115
+
1116
+
1117
+ /**
1118
+ * Creates a new query data instance from a map of names and values.
1119
+ *
1120
+ * @param {!goog.structs.Map|!Object} map Map of string parameter names to
1121
+ * string parameter values.
1122
+ * @param {goog.Uri=} opt_uri URI object that should have its cache
1123
+ * invalidated when this object updates.
1124
+ * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter
1125
+ * name in #get.
1126
+ * @return {!goog.Uri.QueryData} The populated query data instance.
1127
+ */
1128
+ goog.Uri.QueryData.createFromMap = function(map, opt_uri, opt_ignoreCase) {
1129
+ var keys = goog.structs.getKeys(map);
1130
+ if (typeof keys == 'undefined') {
1131
+ throw Error('Keys are undefined');
1132
+ }
1133
+ return goog.Uri.QueryData.createFromKeysValues(
1134
+ keys,
1135
+ goog.structs.getValues(map),
1136
+ opt_uri,
1137
+ opt_ignoreCase);
1138
+ };
1139
+
1140
+
1141
+ /**
1142
+ * Creates a new query data instance from parallel arrays of parameter names
1143
+ * and values. Allows for duplicate parameter names. Throws an error if the
1144
+ * lengths of the arrays differ.
1145
+ *
1146
+ * @param {Array.<string>} keys Parameter names.
1147
+ * @param {Array} values Parameter values.
1148
+ * @param {goog.Uri=} opt_uri URI object that should have its cache
1149
+ * invalidated when this object updates.
1150
+ * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter
1151
+ * name in #get.
1152
+ * @return {!goog.Uri.QueryData} The populated query data instance.
1153
+ */
1154
+ goog.Uri.QueryData.createFromKeysValues = function(
1155
+ keys, values, opt_uri, opt_ignoreCase) {
1156
+ if (keys.length != values.length) {
1157
+ throw Error('Mismatched lengths for keys/values');
1158
+ }
1159
+ var queryData = new goog.Uri.QueryData(null, opt_uri, opt_ignoreCase);
1160
+ for (var i = 0; i < keys.length; i++) {
1161
+ queryData.add(keys[i], values[i]);
1162
+ }
1163
+ return queryData;
1164
+ };
1165
+
1166
+
1167
+ /**
1168
+ * The map containing name/value or name/array-of-values pairs.
1169
+ * May be null if it requires parsing from the query string.
1170
+ *
1171
+ * We need to use a Map because we cannot guarantee that the key names will
1172
+ * not be problematic for IE.
1173
+ *
1174
+ * @type {Object}
1175
+ * @private
1176
+ */
1177
+ goog.Uri.QueryData.prototype.keyMap_ = null;
1178
+
1179
+
1180
+ /**
1181
+ * The number of params, or null if it requires computing.
1182
+ * @type {?number}
1183
+ * @private
1184
+ */
1185
+ goog.Uri.QueryData.prototype.count_ = null;
1186
+
1187
+
1188
+ /**
1189
+ * Decoded query string, or null if it requires computing.
1190
+ * @type {?string}
1191
+ * @private
1192
+ */
1193
+ goog.Uri.QueryData.decodedQuery_ = null;
1194
+
1195
+
1196
+ /**
1197
+ * @return {?number} The number of parameters.
1198
+ */
1199
+ goog.Uri.QueryData.prototype.getCount = function() {
1200
+ this.ensureKeyMapInitialized_();
1201
+ return this.count_;
1202
+ };
1203
+
1204
+
1205
+ /**
1206
+ * Adds a key value pair.
1207
+ * @param {string} key Name.
1208
+ * @param {*} value Value.
1209
+ * @return {!goog.Uri.QueryData} Instance of this object.
1210
+ */
1211
+ goog.Uri.QueryData.prototype.add = function(key, value) {
1212
+ this.ensureKeyMapInitialized_();
1213
+ this.invalidateCache_();
1214
+
1215
+ key = this.getKeyName_(key);
1216
+ if (!this.containsKey(key)) {
1217
+ this.keyMap_.set(key, value);
1218
+ } else {
1219
+ var current = this.keyMap_.get(key);
1220
+ if (goog.isArray(current)) {
1221
+ current.push(value);
1222
+ } else {
1223
+ this.keyMap_.set(key, [current, value]);
1224
+ }
1225
+ }
1226
+
1227
+ this.count_++;
1228
+
1229
+ return this;
1230
+ };
1231
+
1232
+
1233
+ /**
1234
+ * Removes all the params with the given key.
1235
+ * @param {string} key Name.
1236
+ * @return {boolean} Whether any parameter was removed.
1237
+ */
1238
+ goog.Uri.QueryData.prototype.remove = function(key) {
1239
+ this.ensureKeyMapInitialized_();
1240
+
1241
+ key = this.getKeyName_(key);
1242
+ if (this.keyMap_.containsKey(key)) {
1243
+ this.invalidateCache_();
1244
+
1245
+ // we need to get it to know how many to decrement the count with
1246
+ var old = this.keyMap_.get(key);
1247
+ if (goog.isArray(old)) {
1248
+ this.count_ -= old.length;
1249
+ } else {
1250
+ this.count_--;
1251
+ }
1252
+ return this.keyMap_.remove(key);
1253
+ }
1254
+ return false;
1255
+ };
1256
+
1257
+
1258
+ /**
1259
+ * Clears the parameters.
1260
+ */
1261
+ goog.Uri.QueryData.prototype.clear = function() {
1262
+ this.invalidateCache_();
1263
+ if (this.keyMap_) {
1264
+ this.keyMap_.clear();
1265
+ }
1266
+ this.count_ = 0;
1267
+ };
1268
+
1269
+
1270
+ /**
1271
+ * @return {boolean} Whether we have any parameters.
1272
+ */
1273
+ goog.Uri.QueryData.prototype.isEmpty = function() {
1274
+ this.ensureKeyMapInitialized_();
1275
+ return this.count_ == 0;
1276
+ };
1277
+
1278
+
1279
+ /**
1280
+ * Whether there is a parameter with the given name
1281
+ * @param {string} key The parameter name to check for.
1282
+ * @return {boolean} Whether there is a parameter with the given name.
1283
+ */
1284
+ goog.Uri.QueryData.prototype.containsKey = function(key) {
1285
+ this.ensureKeyMapInitialized_();
1286
+ key = this.getKeyName_(key);
1287
+ return this.keyMap_.containsKey(key);
1288
+ };
1289
+
1290
+
1291
+ /**
1292
+ * Whether there is a parameter with the given value.
1293
+ * @param {*} value The value to check for.
1294
+ * @return {boolean} Whether there is a parameter with the given value.
1295
+ */
1296
+ goog.Uri.QueryData.prototype.containsValue = function(value) {
1297
+ // NOTE(arv): This solution goes through all the params even if it was the
1298
+ // first param. We can get around this by not reusing code or by switching to
1299
+ // iterators.
1300
+ var vals = this.getValues();
1301
+ return goog.array.contains(vals, value);
1302
+ };
1303
+
1304
+
1305
+ /**
1306
+ * Returns all the keys of the parameters. If a key is used multiple times
1307
+ * it will be included multiple times in the returned array
1308
+ * @return {Array} All the keys of the parameters.
1309
+ */
1310
+ goog.Uri.QueryData.prototype.getKeys = function() {
1311
+ this.ensureKeyMapInitialized_();
1312
+ // We need to get the values to know how many keys to add.
1313
+ var vals = this.keyMap_.getValues(); // Array.<Array|String>
1314
+ var keys = this.keyMap_.getKeys(); // Array.<String>
1315
+ var rv = [];
1316
+ for (var i = 0; i < keys.length; i++) {
1317
+ var val = vals[i];
1318
+ if (goog.isArray(val)) {
1319
+ for (var j = 0; j < val.length; j++) {
1320
+ rv.push(keys[i]);
1321
+ }
1322
+ } else {
1323
+ rv.push(keys[i]);
1324
+ }
1325
+ }
1326
+ return rv;
1327
+ };
1328
+
1329
+
1330
+ /**
1331
+ * Returns all the values of the parameters with the given name. If the query
1332
+ * data has no such key this will return an empty array. If no key is given
1333
+ * all values wil be returned.
1334
+ * @param {string=} opt_key The name of the parameter to get the values for.
1335
+ * @return {Array} All the values of the parameters with the given name.
1336
+ */
1337
+ goog.Uri.QueryData.prototype.getValues = function(opt_key) {
1338
+ this.ensureKeyMapInitialized_();
1339
+ var rv;
1340
+ if (opt_key) {
1341
+ var key = this.getKeyName_(opt_key);
1342
+ if (this.containsKey(key)) {
1343
+ var value = this.keyMap_.get(key);
1344
+ if (goog.isArray(value)) {
1345
+ return value;
1346
+ } else {
1347
+ rv = [];
1348
+ rv.push(value);
1349
+ }
1350
+ } else {
1351
+ rv = [];
1352
+ }
1353
+ } else {
1354
+ // return all values
1355
+ var vals = this.keyMap_.getValues(); // Array.<Array|String>
1356
+ rv = [];
1357
+ for (var i = 0; i < vals.length; i++) {
1358
+ var val = vals[i];
1359
+ if (goog.isArray(val)) {
1360
+ goog.array.extend(rv, val);
1361
+ } else {
1362
+ rv.push(val);
1363
+ }
1364
+ }
1365
+ }
1366
+ return rv;
1367
+ };
1368
+
1369
+
1370
+ /**
1371
+ * Sets a key value pair and removes all other keys with the same value.
1372
+ *
1373
+ * @param {string} key Name.
1374
+ * @param {*} value Value.
1375
+ * @return {!goog.Uri.QueryData} Instance of this object.
1376
+ */
1377
+ goog.Uri.QueryData.prototype.set = function(key, value) {
1378
+ this.ensureKeyMapInitialized_();
1379
+ this.invalidateCache_();
1380
+
1381
+ key = this.getKeyName_(key);
1382
+ if (this.containsKey(key)) {
1383
+ var old = this.keyMap_.get(key);
1384
+ if (goog.isArray(old)) {
1385
+ this.count_ -= old.length;
1386
+ } else {
1387
+ this.count_--;
1388
+ }
1389
+ }
1390
+
1391
+ this.keyMap_.set(key, value);
1392
+ this.count_++;
1393
+ return this;
1394
+ };
1395
+
1396
+
1397
+ /**
1398
+ * Returns the first value associated with the key. If the query data has no
1399
+ * such key this will return undefined or the optional default.
1400
+ * @param {string} key The name of the parameter to get the value for.
1401
+ * @param {*=} opt_default The default value to return if the query data
1402
+ * has no such key.
1403
+ * @return {*} The first value associated with the key.
1404
+ */
1405
+ goog.Uri.QueryData.prototype.get = function(key, opt_default) {
1406
+ this.ensureKeyMapInitialized_();
1407
+ key = this.getKeyName_(key);
1408
+ if (this.containsKey(key)) {
1409
+ var val = this.keyMap_.get(key);
1410
+ if (goog.isArray(val)) {
1411
+ return val[0];
1412
+ } else {
1413
+ return val;
1414
+ }
1415
+ } else {
1416
+ return opt_default;
1417
+ }
1418
+ };
1419
+
1420
+
1421
+ /**
1422
+ * Sets the values for a key, if the key has already got values defined, this
1423
+ * will override the existing values then remove any left over
1424
+ * @param {string} key The key to set values for.
1425
+ * @param {Array} values The values to set.
1426
+ */
1427
+ goog.Uri.QueryData.prototype.setValues = function(key, values) {
1428
+ this.ensureKeyMapInitialized_();
1429
+ this.invalidateCache_();
1430
+
1431
+ key = this.getKeyName_(key);
1432
+ if (this.containsKey(key)) {
1433
+ var old = this.keyMap_.get(key);
1434
+ if (goog.isArray(old)) {
1435
+ this.count_ -= old.length;
1436
+ } else {
1437
+ this.count_--;
1438
+ }
1439
+ }
1440
+
1441
+ if (values.length > 0) {
1442
+ this.keyMap_.set(key, values);
1443
+ this.count_ += values.length;
1444
+ }
1445
+ };
1446
+
1447
+
1448
+ /**
1449
+ * @return {string} Encoded query string.
1450
+ */
1451
+ goog.Uri.QueryData.prototype.toString = function() {
1452
+ if (this.encodedQuery_) {
1453
+ return this.encodedQuery_;
1454
+ }
1455
+
1456
+ if (!this.keyMap_) {
1457
+ return '';
1458
+ }
1459
+
1460
+ var sb = [];
1461
+
1462
+ // this used to use this.getKeys and this.getVals but that generates a lot
1463
+ // allocations than just iterating over the keys
1464
+ var count = 0;
1465
+ var keys = this.keyMap_.getKeys();
1466
+ for (var i = 0; i < keys.length; i++) {
1467
+ var key = keys[i];
1468
+ var encodedKey = goog.string.urlEncode(key);
1469
+ var val = this.keyMap_.get(key);
1470
+ if (goog.isArray(val)) {
1471
+ for (var j = 0; j < val.length; j++) {
1472
+ if (count > 0) {
1473
+ sb.push('&');
1474
+ }
1475
+ sb.push(encodedKey);
1476
+ // Check for empty string, null and undefined get encoded
1477
+ // into the url as literal strings
1478
+ if (val[j] !== '') {
1479
+ sb.push('=', goog.string.urlEncode(val[j]));
1480
+ }
1481
+ count++;
1482
+ }
1483
+ } else {
1484
+ if (count > 0) {
1485
+ sb.push('&');
1486
+ }
1487
+ sb.push(encodedKey);
1488
+ // Check for empty string, null and undefined get encoded
1489
+ // into the url as literal strings
1490
+ if (val !== '') {
1491
+ sb.push('=', goog.string.urlEncode(val));
1492
+ }
1493
+ count++;
1494
+ }
1495
+ }
1496
+
1497
+ return this.encodedQuery_ = sb.join('');
1498
+ };
1499
+
1500
+
1501
+ /**
1502
+ * @return {string} Decoded query string.
1503
+ */
1504
+ goog.Uri.QueryData.prototype.toDecodedString = function() {
1505
+ if (!this.decodedQuery_) {
1506
+ this.decodedQuery_ = goog.Uri.decodeOrEmpty_(this.toString());
1507
+ }
1508
+
1509
+ return this.decodedQuery_;
1510
+ };
1511
+
1512
+
1513
+ /**
1514
+ * Invalidate the cache.
1515
+ * @private
1516
+ */
1517
+ goog.Uri.QueryData.prototype.invalidateCache_ = function() {
1518
+ delete this.decodedQuery_;
1519
+ delete this.encodedQuery_;
1520
+ if (this.uri_) {
1521
+ delete this.uri_.cachedToString_;
1522
+ }
1523
+ };
1524
+
1525
+
1526
+ /**
1527
+ * Removes all keys that are not in the provided list. (Modifies this object.)
1528
+ * @param {Array.<string>} keys The desired keys.
1529
+ * @return {!goog.Uri.QueryData} a reference to this object.
1530
+ */
1531
+ goog.Uri.QueryData.prototype.filterKeys = function(keys) {
1532
+ this.ensureKeyMapInitialized_();
1533
+ goog.structs.forEach(this.keyMap_,
1534
+ /** @this {goog.Uri.QueryData} */
1535
+ function(value, key, map) {
1536
+ if (!goog.array.contains(keys, key)) {
1537
+ this.remove(key);
1538
+ }
1539
+ }, this);
1540
+ return this;
1541
+ };
1542
+
1543
+
1544
+ /**
1545
+ * Clone the query data instance.
1546
+ * @return {!goog.Uri.QueryData} New instance of the QueryData object.
1547
+ */
1548
+ goog.Uri.QueryData.prototype.clone = function() {
1549
+ var rv = new goog.Uri.QueryData();
1550
+ if (this.decodedQuery_) {
1551
+ rv.decodedQuery_ = this.decodedQuery_;
1552
+ }
1553
+ if (this.encodedQuery_) {
1554
+ rv.encodedQuery_ = this.encodedQuery_;
1555
+ }
1556
+ if (this.keyMap_) {
1557
+ rv.keyMap_ = this.keyMap_.clone();
1558
+ }
1559
+ return rv;
1560
+ };
1561
+
1562
+
1563
+ /**
1564
+ * Helper function to get the key name from a JavaScript object. Converts
1565
+ * the object to a string, and to lower case if necessary.
1566
+ * @private
1567
+ * @param {*} arg The object to get a key name from.
1568
+ * @return {string} valid key name which can be looked up in #keyMap_.
1569
+ */
1570
+ goog.Uri.QueryData.prototype.getKeyName_ = function(arg) {
1571
+ var keyName = String(arg);
1572
+ if (this.ignoreCase_) {
1573
+ keyName = keyName.toLowerCase();
1574
+ }
1575
+ return keyName;
1576
+ };
1577
+
1578
+
1579
+ /**
1580
+ * Ignore case in parameter names.
1581
+ * NOTE: If there are already key/value pairs in the QueryData, and
1582
+ * ignoreCase_ is set to false, the keys will all be lower-cased.
1583
+ * @param {boolean} ignoreCase whether this goog.Uri should ignore case.
1584
+ */
1585
+ goog.Uri.QueryData.prototype.setIgnoreCase = function(ignoreCase) {
1586
+ var resetKeys = ignoreCase && !this.ignoreCase_;
1587
+ if (resetKeys) {
1588
+ this.ensureKeyMapInitialized_();
1589
+ this.invalidateCache_();
1590
+ goog.structs.forEach(this.keyMap_,
1591
+ /** @this {goog.Uri.QueryData} */
1592
+ function(value, key, map) {
1593
+ var lowerCase = key.toLowerCase();
1594
+ if (key != lowerCase) {
1595
+ this.remove(key);
1596
+ this.add(lowerCase, value);
1597
+ }
1598
+ }, this);
1599
+ }
1600
+ this.ignoreCase_ = ignoreCase;
1601
+ };
1602
+
1603
+
1604
+ /**
1605
+ * Extends a query data object with another query data or map like object. This
1606
+ * operates 'in-place', it does not create a new QueryData object.
1607
+ *
1608
+ * @param {...(goog.Uri.QueryData|goog.structs.Map|Object)} var_args The object
1609
+ * from which key value pairs will be copied.
1610
+ */
1611
+ goog.Uri.QueryData.prototype.extend = function(var_args) {
1612
+ for (var i = 0; i < arguments.length; i++) {
1613
+ var data = arguments[i];
1614
+ goog.structs.forEach(data,
1615
+ /** @this {goog.Uri.QueryData} */
1616
+ function(value, key) {
1617
+ this.add(key, value);
1618
+ }, this);
1619
+ }
1620
+ };
1621
+ ;
1622
+ FI"asset_paths;
1623
+ F["i/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/uri/uri.jsI"dependency_paths;
1624
+ F[{I" path;
1625
+ F"i/Volumes/Development/dev-web/yellow-brick-road/vendor/assets/closure-library/closure/goog/uri/uri.jsI"
1626
+ mtime;
1627
+ FIu: Time
1628
+ T: offsetiI"hexdigest;
1629
+ F"%1ea0217d880682cc00e37005319cd644I"
1630
+ F"%46dde6621c301f4928e3b34efee9e3b5