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,256 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325458072.9642959: @value{I"
2
+ class:EFI"BundledAsset;
3
+ FI"id;
4
+ F"%c43af05db163aafa98d202944365cf5bI"logical_path;
5
+ FI" closure/goog/dom/classes.js;
6
+ TI"
7
+ F"f/Volumes/Development/dev-web/yellow-brick-road/vendor/closure-library/closure/goog/dom/classes.jsI"content_type;
8
+ FI"application/javascript;
9
+ FI"
10
+ mtime;
11
+ FI"2011-12-30T02:16:24+00:00;
12
+ FI" body;
13
+ FI"%// 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 Utilities for adding, removing and setting classes.
29
+ *
30
+ */
31
+
32
+
33
+
34
+ goog.provide('goog.dom.classes');
35
+
36
+ goog.require('goog.array');
37
+
38
+
39
+ /**
40
+ * Sets the entire class name of an element.
41
+ * @param {Node} element DOM node to set class of.
42
+ * @param {string} className Class name(s) to apply to element.
43
+ */
44
+ goog.dom.classes.set = function(element, className) {
45
+ element.className = className;
46
+ };
47
+
48
+
49
+ /**
50
+ * Gets an array of class names on an element
51
+ * @param {Node} element DOM node to get class of.
52
+ * @return {Array} Class names on {@code element}.
53
+ */
54
+ goog.dom.classes.get = function(element) {
55
+ var className = element.className;
56
+ // Some types of elements don't have a className in IE (e.g. iframes).
57
+ // Furthermore, in Firefox, className is not a string when the element is
58
+ // an SVG element.
59
+ return className && typeof className.split == 'function' ?
60
+ className.split(/\s+/) : [];
61
+ };
62
+
63
+
64
+ /**
65
+ * Adds a class or classes to an element. Does not add multiples of class names.
66
+ * @param {Node} element DOM node to add class to.
67
+ * @param {...string} var_args Class names to add.
68
+ * @return {boolean} Whether class was added (or all classes were added).
69
+ */
70
+ goog.dom.classes.add = function(element, var_args) {
71
+ var classes = goog.dom.classes.get(element);
72
+ var args = goog.array.slice(arguments, 1);
73
+
74
+ var b = goog.dom.classes.add_(classes, args);
75
+ element.className = classes.join(' ');
76
+
77
+ return b;
78
+ };
79
+
80
+
81
+ /**
82
+ * Removes a class or classes from an element.
83
+ * @param {Node} element DOM node to remove class from.
84
+ * @param {...string} var_args Class name(s) to remove.
85
+ * @return {boolean} Whether all classes in {@code var_args} were found and
86
+ * removed.
87
+ */
88
+ goog.dom.classes.remove = function(element, var_args) {
89
+ var classes = goog.dom.classes.get(element);
90
+ var args = goog.array.slice(arguments, 1);
91
+
92
+ var b = goog.dom.classes.remove_(classes, args);
93
+ element.className = classes.join(' ');
94
+
95
+ return b;
96
+ };
97
+
98
+
99
+ /**
100
+ * Helper method for {@link goog.dom.classes.add} and
101
+ * {@link goog.dom.classes.addRemove}. Adds one or more classes to the supplied
102
+ * classes array.
103
+ * @param {Array.<string>} classes All class names for the element, will be
104
+ * updated to have the classes supplied in {@code args} added.
105
+ * @param {Array.<string>} args Class names to add.
106
+ * @return {boolean} Whether all classes in were added.
107
+ * @private
108
+ */
109
+ goog.dom.classes.add_ = function(classes, args) {
110
+ var rv = 0;
111
+ for (var i = 0; i < args.length; i++) {
112
+ if (!goog.array.contains(classes, args[i])) {
113
+ classes.push(args[i]);
114
+ rv++;
115
+ }
116
+ }
117
+ return rv == args.length;
118
+ };
119
+
120
+
121
+ /**
122
+ * Helper method for {@link goog.dom.classes.remove} and
123
+ * {@link goog.dom.classes.addRemove}. Removes one or more classes from the
124
+ * supplied classes array.
125
+ * @param {Array.<string>} classes All class names for the element, will be
126
+ * updated to have the classes supplied in {@code args} removed.
127
+ * @param {Array.<string>} args Class names to remove.
128
+ * @return {boolean} Whether all classes in were found and removed.
129
+ * @private
130
+ */
131
+ goog.dom.classes.remove_ = function(classes, args) {
132
+ var rv = 0;
133
+ for (var i = 0; i < classes.length; i++) {
134
+ if (goog.array.contains(args, classes[i])) {
135
+ goog.array.splice(classes, i--, 1);
136
+ rv++;
137
+ }
138
+ }
139
+ return rv == args.length;
140
+ };
141
+
142
+
143
+ /**
144
+ * Switches a class on an element from one to another without disturbing other
145
+ * classes. If the fromClass isn't removed, the toClass won't be added.
146
+ * @param {Node} element DOM node to swap classes on.
147
+ * @param {string} fromClass Class to remove.
148
+ * @param {string} toClass Class to add.
149
+ * @return {boolean} Whether classes were switched.
150
+ */
151
+ goog.dom.classes.swap = function(element, fromClass, toClass) {
152
+ var classes = goog.dom.classes.get(element);
153
+
154
+ var removed = false;
155
+ for (var i = 0; i < classes.length; i++) {
156
+ if (classes[i] == fromClass) {
157
+ goog.array.splice(classes, i--, 1);
158
+ removed = true;
159
+ }
160
+ }
161
+
162
+ if (removed) {
163
+ classes.push(toClass);
164
+ element.className = classes.join(' ');
165
+ }
166
+
167
+ return removed;
168
+ };
169
+
170
+
171
+ /**
172
+ * Adds zero or more classes to an element and removes zero or more as a single
173
+ * operation. Unlike calling {@link goog.dom.classes.add} and
174
+ * {@link goog.dom.classes.remove} separately, this is more efficient as it only
175
+ * parses the class property once.
176
+ *
177
+ * If a class is in both the remove and add lists, it will be added. Thus,
178
+ * you can use this instead of {@link goog.dom.classes.swap} when you have
179
+ * more than two class names that you want to swap.
180
+ *
181
+ * @param {Node} element DOM node to swap classes on.
182
+ * @param {string|Array.<string>|null} classesToRemove Class or classes to
183
+ * remove, if null no classes are removed.
184
+ * @param {string|Array.<string>|null} classesToAdd Class or classes to add, if
185
+ * null no classes are added.
186
+ */
187
+ goog.dom.classes.addRemove = function(element, classesToRemove, classesToAdd) {
188
+ var classes = goog.dom.classes.get(element);
189
+ if (goog.isString(classesToRemove)) {
190
+ goog.array.remove(classes, classesToRemove);
191
+ } else if (goog.isArray(classesToRemove)) {
192
+ goog.dom.classes.remove_(classes, classesToRemove);
193
+ }
194
+
195
+ if (goog.isString(classesToAdd) &&
196
+ !goog.array.contains(classes, classesToAdd)) {
197
+ classes.push(classesToAdd);
198
+ } else if (goog.isArray(classesToAdd)) {
199
+ goog.dom.classes.add_(classes, classesToAdd);
200
+ }
201
+
202
+ element.className = classes.join(' ');
203
+ };
204
+
205
+
206
+ /**
207
+ * Returns true if an element has a class.
208
+ * @param {Node} element DOM node to test.
209
+ * @param {string} className Class name to test for.
210
+ * @return {boolean} Whether element has the class.
211
+ */
212
+ goog.dom.classes.has = function(element, className) {
213
+ return goog.array.contains(goog.dom.classes.get(element), className);
214
+ };
215
+
216
+
217
+ /**
218
+ * Adds or removes a class depending on the enabled argument.
219
+ * @param {Node} element DOM node to add or remove the class on.
220
+ * @param {string} className Class name to add or remove.
221
+ * @param {boolean} enabled Whether to add or remove the class (true adds,
222
+ * false removes).
223
+ */
224
+ goog.dom.classes.enable = function(element, className, enabled) {
225
+ if (enabled) {
226
+ goog.dom.classes.add(element, className);
227
+ } else {
228
+ goog.dom.classes.remove(element, className);
229
+ }
230
+ };
231
+
232
+
233
+ /**
234
+ * Removes a class if an element has it, and adds it the element doesn't have
235
+ * it. Won't affect other classes on the node.
236
+ * @param {Node} element DOM node to toggle class on.
237
+ * @param {string} className Class to toggle.
238
+ * @return {boolean} True if class was added, false if it was removed
239
+ * (in other words, whether element has the class after this function has
240
+ * been called).
241
+ */
242
+ goog.dom.classes.toggle = function(element, className) {
243
+ var add = !goog.dom.classes.has(element, className);
244
+ goog.dom.classes.enable(element, className, add);
245
+ return add;
246
+ };
247
+ ;
248
+ FI"asset_paths;
249
+ F["f/Volumes/Development/dev-web/yellow-brick-road/vendor/closure-library/closure/goog/dom/classes.jsI"dependency_paths;
250
+ F[{I" path;
251
+ F"f/Volumes/Development/dev-web/yellow-brick-road/vendor/closure-library/closure/goog/dom/classes.jsI"
252
+ mtime;
253
+ FIu: Time
254
+ T: offsetiI"hexdigest;
255
+ F"%afe16d90ef6698eeee0daf89e1735ef6I"
256
+ F"%46dde6621c301f4928e3b34efee9e3b5
@@ -0,0 +1,75 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325441615.19896: @value{ I" length:EFi�I" digest;
2
+ F"%79ab8321a0f631f34d2e7692dc3efb51I" source;
3
+ FI"�// Copyright 2010 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 Browser capability checks for the events package.
19
+ *
20
+ */
21
+
22
+
23
+
24
+ goog.provide('goog.events.BrowserFeature');
25
+
26
+ goog.require('goog.userAgent');
27
+
28
+
29
+ /**
30
+ * Enum of browser capabilities.
31
+ * @enum {boolean}
32
+ */
33
+ goog.events.BrowserFeature = {
34
+ /**
35
+ * Whether the button attribute of the event is W3C compliant. False in
36
+ * Internet Explorer prior to version 9; document-version dependent.
37
+ */
38
+ HAS_W3C_BUTTON: !goog.userAgent.IE || goog.userAgent.isDocumentMode(9),
39
+
40
+ /**
41
+ * Whether the browser supports full W3C event model.
42
+ */
43
+ HAS_W3C_EVENT_SUPPORT: !goog.userAgent.IE || goog.userAgent.isDocumentMode(9),
44
+
45
+ /**
46
+ * To prevent default in IE7 for certain keydown events we need set the
47
+ * keyCode to -1.
48
+ */
49
+ SET_KEY_CODE_TO_PREVENT_DEFAULT: goog.userAgent.IE &&
50
+ !goog.userAgent.isVersion('8'),
51
+
52
+ /**
53
+ * Whether the {@code navigator.onLine} property is supported.
54
+ */
55
+ HAS_NAVIGATOR_ONLINE_PROPERTY: !goog.userAgent.WEBKIT ||
56
+ goog.userAgent.isVersion('528'),
57
+
58
+ /**
59
+ * Whether HTML5 network online/offline events are supported.
60
+ */
61
+ HAS_HTML5_NETWORK_EVENT_SUPPORT:
62
+ goog.userAgent.GECKO && goog.userAgent.isVersion('1.9b') ||
63
+ goog.userAgent.IE && goog.userAgent.isVersion('8') ||
64
+ goog.userAgent.OPERA && goog.userAgent.isVersion('9.5') ||
65
+ goog.userAgent.WEBKIT && goog.userAgent.isVersion('528'),
66
+
67
+ /**
68
+ * Whether HTML5 network events fire on the window or otherwise document.body.
69
+ */
70
+ HTML5_NETWORK_EVENTS_FIRE_ON_WINDOW: !goog.userAgent.GECKO ||
71
+ goog.userAgent.isVersion('8')
72
+ };
73
+ ;
74
+ FI"
75
+ F"%f4e51612a1595a23af172b5991f1e711
@@ -0,0 +1,1613 @@
1
+ o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1325441614.190603: @value{ I" length:EFi0�I" digest;
2
+ F"%adc7d4fb1179417e150c38f64c1fa62cI" source;
3
+ FI"0�// Copyright 2006 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 Class for parsing and formatting URIs.
19
+ *
20
+ * Use goog.Uri(string) to parse a URI string. Use goog.Uri.create(...) to
21
+ * create a new instance of the goog.Uri object from Uri parts.
22
+ *
23
+ * e.g: <code>var myUri = new goog.Uri(window.location);</code>
24
+ *
25
+ * Implements RFC 3986 for parsing/formatting URIs.
26
+ * http://gbiv.com/protocols/uri/rfc/rfc3986.html
27
+ *
28
+ * Some changes have been made to the interface (more like .NETs), though the
29
+ * internal representation is now of un-encoded parts, this will change the
30
+ * behavior slightly.
31
+ *
32
+ */
33
+
34
+
35
+ goog.provide('goog.Uri');
36
+ goog.provide('goog.Uri.QueryData');
37
+
38
+ goog.require('goog.array');
39
+ goog.require('goog.string');
40
+ goog.require('goog.structs');
41
+ goog.require('goog.structs.Map');
42
+ goog.require('goog.uri.utils');
43
+ goog.require('goog.uri.utils.ComponentIndex');
44
+
45
+
46
+
47
+ /**
48
+ * This class contains setters and getters for the parts of the URI.
49
+ * The <code>getXyz</code>/<code>setXyz</code> methods return the decoded part
50
+ * -- so<code>goog.Uri.parse('/foo%20bar').getPath()</code> will return the
51
+ * decoded path, <code>/foo bar</code>.
52
+ *
53
+ * The constructor accepts an optional unparsed, raw URI string. The parser
54
+ * is relaxed, so special characters that aren't escaped but don't cause
55
+ * ambiguities will not cause parse failures.
56
+ *
57
+ * All setters return <code>this</code> and so may be chained, a la
58
+ * <code>goog.Uri.parse('/foo').setFragment('part').toString()</code>.
59
+ *
60
+ * @param {*=} opt_uri Optional string URI to parse
61
+ * (use goog.Uri.create() to create a URI from parts), or if
62
+ * a goog.Uri is passed, a clone is created.
63
+ * @param {boolean=} opt_ignoreCase If true, #getParameterValue will ignore
64
+ * the case of the parameter name.
65
+ *
66
+ * @constructor
67
+ */
68
+ goog.Uri = function(opt_uri, opt_ignoreCase) {
69
+ // Parse in the uri string
70
+ var m;
71
+ if (opt_uri instanceof goog.Uri) {
72
+ this.setIgnoreCase(opt_ignoreCase == null ?
73
+ opt_uri.getIgnoreCase() : opt_ignoreCase);
74
+ this.setScheme(opt_uri.getScheme());
75
+ this.setUserInfo(opt_uri.getUserInfo());
76
+ this.setDomain(opt_uri.getDomain());
77
+ this.setPort(opt_uri.getPort());
78
+ this.setPath(opt_uri.getPath());
79
+ this.setQueryData(opt_uri.getQueryData().clone());
80
+ this.setFragment(opt_uri.getFragment());
81
+ } else if (opt_uri && (m = goog.uri.utils.split(String(opt_uri)))) {
82
+ // Set the parts -- decoding as we do so.
83
+ this.setIgnoreCase(!!opt_ignoreCase);
84
+ // COMPATABILITY NOTE - In IE, unmatched fields may be empty strings,
85
+ // whereas in other browsers they will be undefined.
86
+ this.setScheme(m[goog.uri.utils.ComponentIndex.SCHEME] || '', true);
87
+ this.setUserInfo(m[goog.uri.utils.ComponentIndex.USER_INFO] || '', true);
88
+ this.setDomain(m[goog.uri.utils.ComponentIndex.DOMAIN] || '', true);
89
+ this.setPort(m[goog.uri.utils.ComponentIndex.PORT]);
90
+ this.setPath(m[goog.uri.utils.ComponentIndex.PATH] || '', true);
91
+
92
+ this.setQuery(m[goog.uri.utils.ComponentIndex.QUERY_DATA] || '', true);
93
+
94
+ this.setFragment(m[goog.uri.utils.ComponentIndex.FRAGMENT] || '', true);
95
+
96
+ } else {
97
+ this.setIgnoreCase(!!opt_ignoreCase);
98
+ this.queryData_ = new goog.Uri.QueryData(null, this, this.ignoreCase_);
99
+ }
100
+ };
101
+
102
+
103
+ /**
104
+ * Parameter name added to stop caching.
105
+ * @type {string}
106
+ */
107
+ goog.Uri.RANDOM_PARAM = goog.uri.utils.StandardQueryParam.RANDOM;
108
+
109
+
110
+ /**
111
+ * Scheme such as "http".
112
+ * @type {string}
113
+ * @private
114
+ */
115
+ goog.Uri.prototype.scheme_ = '';
116
+
117
+
118
+ /**
119
+ * User credentials in the form "username:password".
120
+ * @type {string}
121
+ * @private
122
+ */
123
+ goog.Uri.prototype.userInfo_ = '';
124
+
125
+
126
+ /**
127
+ * Domain part, e.g. "www.google.com".
128
+ * @type {string}
129
+ * @private
130
+ */
131
+ goog.Uri.prototype.domain_ = '';
132
+
133
+
134
+ /**
135
+ * Port, e.g. 8080.
136
+ * @type {?number}
137
+ * @private
138
+ */
139
+ goog.Uri.prototype.port_ = null;
140
+
141
+
142
+ /**
143
+ * Path, e.g. "/tests/img.png".
144
+ * @type {string}
145
+ * @private
146
+ */
147
+ goog.Uri.prototype.path_ = '';
148
+
149
+
150
+ /**
151
+ * Object representing query data.
152
+ * @type {!goog.Uri.QueryData}
153
+ * @private
154
+ */
155
+ goog.Uri.prototype.queryData_;
156
+
157
+
158
+ /**
159
+ * The fragment without the #.
160
+ * @type {string}
161
+ * @private
162
+ */
163
+ goog.Uri.prototype.fragment_ = '';
164
+
165
+
166
+ /**
167
+ * Whether or not this Uri should be treated as Read Only.
168
+ * @type {boolean}
169
+ * @private
170
+ */
171
+ goog.Uri.prototype.isReadOnly_ = false;
172
+
173
+
174
+ /**
175
+ * Whether or not to ignore case when comparing query params.
176
+ * @type {boolean}
177
+ * @private
178
+ */
179
+ goog.Uri.prototype.ignoreCase_ = false;
180
+
181
+
182
+ /**
183
+ * @return {string} The string form of the url.
184
+ */
185
+ goog.Uri.prototype.toString = function() {
186
+ if (this.cachedToString_) {
187
+ return this.cachedToString_;
188
+ }
189
+
190
+ var out = [];
191
+
192
+ if (this.scheme_) {
193
+ out.push(goog.Uri.encodeSpecialChars_(
194
+ this.scheme_, goog.Uri.reDisallowedInSchemeOrUserInfo_), ':');
195
+ }
196
+
197
+ if (this.domain_) {
198
+ out.push('//');
199
+
200
+ if (this.userInfo_) {
201
+ out.push(goog.Uri.encodeSpecialChars_(
202
+ this.userInfo_, goog.Uri.reDisallowedInSchemeOrUserInfo_), '@');
203
+ }
204
+
205
+ out.push(goog.Uri.encodeString_(this.domain_));
206
+
207
+ if (this.port_ != null) {
208
+ out.push(':', String(this.getPort()));
209
+ }
210
+ }
211
+
212
+ if (this.path_) {
213
+ if (this.hasDomain() && this.path_.charAt(0) != '/') {
214
+ out.push('/');
215
+ }
216
+ out.push(goog.Uri.encodeSpecialChars_(
217
+ this.path_,
218
+ this.path_.charAt(0) == '/' ?
219
+ goog.Uri.reDisallowedInAbsolutePath_ :
220
+ goog.Uri.reDisallowedInRelativePath_));
221
+ }
222
+
223
+ var query = String(this.queryData_);
224
+ if (query) {
225
+ out.push('?', query);
226
+ }
227
+
228
+ if (this.fragment_) {
229
+ out.push('#', goog.Uri.encodeSpecialChars_(
230
+ this.fragment_, goog.Uri.reDisallowedInFragment_));
231
+ }
232
+ return this.cachedToString_ = out.join('');
233
+ };
234
+
235
+
236
+ /**
237
+ * Resolves a relative url string to a this base uri.
238
+ *
239
+ * There are several kinds of relative urls:<br>
240
+ * 1. foo - replaces the last part of the path, the whole query and fragment<br>
241
+ * 2. /foo - replaces the the path, the query and fragment<br>
242
+ * 3. //foo - replaces everything from the domain on. foo is a domain name<br>
243
+ * 4. ?foo - replace the query and fragment<br>
244
+ * 5. #foo - replace the fragment only
245
+ *
246
+ * Additionally, if relative url has a non-empty path, all ".." and "."
247
+ * segments will be resolved, as described in RFC 3986.
248
+ *
249
+ * @param {goog.Uri} relativeUri The relative url to resolve.
250
+ * @return {!goog.Uri} The resolved URI.
251
+ */
252
+ goog.Uri.prototype.resolve = function(relativeUri) {
253
+
254
+ var absoluteUri = this.clone();
255
+
256
+ // we satisfy these conditions by looking for the first part of relativeUri
257
+ // that is not blank and applying defaults to the rest
258
+
259
+ var overridden = relativeUri.hasScheme();
260
+
261
+ if (overridden) {
262
+ absoluteUri.setScheme(relativeUri.getScheme());
263
+ } else {
264
+ overridden = relativeUri.hasUserInfo();
265
+ }
266
+
267
+ if (overridden) {
268
+ absoluteUri.setUserInfo(relativeUri.getUserInfo());
269
+ } else {
270
+ overridden = relativeUri.hasDomain();
271
+ }
272
+
273
+ if (overridden) {
274
+ absoluteUri.setDomain(relativeUri.getDomain());
275
+ } else {
276
+ overridden = relativeUri.hasPort();
277
+ }
278
+
279
+ var path = relativeUri.getPath();
280
+ if (overridden) {
281
+ absoluteUri.setPort(relativeUri.getPort());
282
+ } else {
283
+ overridden = relativeUri.hasPath();
284
+ if (overridden) {
285
+ // resolve path properly
286
+ if (path.charAt(0) != '/') {
287
+ // path is relative
288
+ if (this.hasDomain() && !this.hasPath()) {
289
+ // RFC 3986, section 5.2.3, case 1
290
+ path = '/' + path;
291
+ } else {
292
+ // RFC 3986, section 5.2.3, case 2
293
+ var lastSlashIndex = absoluteUri.getPath().lastIndexOf('/');
294
+ if (lastSlashIndex != -1) {
295
+ path = absoluteUri.getPath().substr(0, lastSlashIndex + 1) + path;
296
+ }
297
+ }
298
+ }
299
+ path = goog.Uri.removeDotSegments(path);
300
+ }
301
+ }
302
+
303
+ if (overridden) {
304
+ absoluteUri.setPath(path);
305
+ } else {
306
+ overridden = relativeUri.hasQuery();
307
+ }
308
+
309
+ if (overridden) {
310
+ absoluteUri.setQuery(relativeUri.getDecodedQuery());
311
+ } else {
312
+ overridden = relativeUri.hasFragment();
313
+ }
314
+
315
+ if (overridden) {
316
+ absoluteUri.setFragment(relativeUri.getFragment());
317
+ }
318
+
319
+ return absoluteUri;
320
+ };
321
+
322
+
323
+ /**
324
+ * Clones the URI instance.
325
+ * @return {!goog.Uri} New instance of the URI objcet.
326
+ */
327
+ goog.Uri.prototype.clone = function() {
328
+ return goog.Uri.create(this.scheme_, this.userInfo_, this.domain_,
329
+ this.port_, this.path_, this.queryData_.clone(),
330
+ this.fragment_, this.ignoreCase_);
331
+ };
332
+
333
+
334
+ /**
335
+ * @return {string} The encoded scheme/protocol for the URI.
336
+ */
337
+ goog.Uri.prototype.getScheme = function() {
338
+ return this.scheme_;
339
+ };
340
+
341
+
342
+ /**
343
+ * Sets the scheme/protocol.
344
+ * @param {string} newScheme New scheme value.
345
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
346
+ * @return {!goog.Uri} Reference to this URI object.
347
+ */
348
+ goog.Uri.prototype.setScheme = function(newScheme, opt_decode) {
349
+ this.enforceReadOnly();
350
+ delete this.cachedToString_;
351
+ this.scheme_ = opt_decode ? goog.Uri.decodeOrEmpty_(newScheme) : newScheme;
352
+
353
+ // remove an : at the end of the scheme so somebody can pass in
354
+ // window.location.protocol
355
+ if (this.scheme_) {
356
+ this.scheme_ = this.scheme_.replace(/:$/, '');
357
+ }
358
+ return this;
359
+ };
360
+
361
+
362
+ /**
363
+ * @return {boolean} Whether the scheme has been set.
364
+ */
365
+ goog.Uri.prototype.hasScheme = function() {
366
+ return !!this.scheme_;
367
+ };
368
+
369
+
370
+ /**
371
+ * @return {string} The decoded user info.
372
+ */
373
+ goog.Uri.prototype.getUserInfo = function() {
374
+ return this.userInfo_;
375
+ };
376
+
377
+
378
+ /**
379
+ * Sets the userInfo.
380
+ * @param {string} newUserInfo New userInfo value.
381
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
382
+ * @return {!goog.Uri} Reference to this URI object.
383
+ */
384
+ goog.Uri.prototype.setUserInfo = function(newUserInfo, opt_decode) {
385
+ this.enforceReadOnly();
386
+ delete this.cachedToString_;
387
+ this.userInfo_ = opt_decode ? goog.Uri.decodeOrEmpty_(newUserInfo) :
388
+ newUserInfo;
389
+ return this;
390
+ };
391
+
392
+
393
+ /**
394
+ * @return {boolean} Whether the user info has been set.
395
+ */
396
+ goog.Uri.prototype.hasUserInfo = function() {
397
+ return !!this.userInfo_;
398
+ };
399
+
400
+
401
+ /**
402
+ * @return {string} The decoded domain.
403
+ */
404
+ goog.Uri.prototype.getDomain = function() {
405
+ return this.domain_;
406
+ };
407
+
408
+
409
+ /**
410
+ * Sets the domain.
411
+ * @param {string} newDomain New domain value.
412
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
413
+ * @return {!goog.Uri} Reference to this URI object.
414
+ */
415
+ goog.Uri.prototype.setDomain = function(newDomain, opt_decode) {
416
+ this.enforceReadOnly();
417
+ delete this.cachedToString_;
418
+ this.domain_ = opt_decode ? goog.Uri.decodeOrEmpty_(newDomain) : newDomain;
419
+ return this;
420
+ };
421
+
422
+
423
+ /**
424
+ * @return {boolean} Whether the domain has been set.
425
+ */
426
+ goog.Uri.prototype.hasDomain = function() {
427
+ return !!this.domain_;
428
+ };
429
+
430
+
431
+ /**
432
+ * @return {?number} The port number.
433
+ */
434
+ goog.Uri.prototype.getPort = function() {
435
+ return this.port_;
436
+ };
437
+
438
+
439
+ /**
440
+ * Sets the port number.
441
+ * @param {*} newPort Port number. Will be explicitly casted to a number.
442
+ * @return {!goog.Uri} Reference to this URI object.
443
+ */
444
+ goog.Uri.prototype.setPort = function(newPort) {
445
+ this.enforceReadOnly();
446
+ delete this.cachedToString_;
447
+
448
+ if (newPort) {
449
+ newPort = Number(newPort);
450
+ if (isNaN(newPort) || newPort < 0) {
451
+ throw Error('Bad port number ' + newPort);
452
+ }
453
+ this.port_ = newPort;
454
+ } else {
455
+ this.port_ = null;
456
+ }
457
+
458
+ return this;
459
+ };
460
+
461
+
462
+ /**
463
+ * @return {boolean} Whether the port has been set.
464
+ */
465
+ goog.Uri.prototype.hasPort = function() {
466
+ return this.port_ != null;
467
+ };
468
+
469
+
470
+ /**
471
+ * @return {string} The decoded path.
472
+ */
473
+ goog.Uri.prototype.getPath = function() {
474
+ return this.path_;
475
+ };
476
+
477
+
478
+ /**
479
+ * Sets the path.
480
+ * @param {string} newPath New path value.
481
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
482
+ * @return {!goog.Uri} Reference to this URI object.
483
+ */
484
+ goog.Uri.prototype.setPath = function(newPath, opt_decode) {
485
+ this.enforceReadOnly();
486
+ delete this.cachedToString_;
487
+ this.path_ = opt_decode ? goog.Uri.decodeOrEmpty_(newPath) : newPath;
488
+ return this;
489
+ };
490
+
491
+
492
+ /**
493
+ * @return {boolean} Whether the path has been set.
494
+ */
495
+ goog.Uri.prototype.hasPath = function() {
496
+ return !!this.path_;
497
+ };
498
+
499
+
500
+ /**
501
+ * @return {boolean} Whether the query string has been set.
502
+ */
503
+ goog.Uri.prototype.hasQuery = function() {
504
+ return this.queryData_.toString() !== '';
505
+ };
506
+
507
+
508
+ /**
509
+ * Sets the query data.
510
+ * @param {goog.Uri.QueryData|string|undefined} queryData QueryData object.
511
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
512
+ * Applies only if queryData is a string.
513
+ * @return {!goog.Uri} Reference to this URI object.
514
+ */
515
+ goog.Uri.prototype.setQueryData = function(queryData, opt_decode) {
516
+ this.enforceReadOnly();
517
+ delete this.cachedToString_;
518
+
519
+ if (queryData instanceof goog.Uri.QueryData) {
520
+ this.queryData_ = queryData;
521
+ this.queryData_.uri_ = this;
522
+ this.queryData_.setIgnoreCase(this.ignoreCase_);
523
+ } else {
524
+ // QueryData accepts encoded query string,
525
+ // so encode it if opt_decode flag is not true.
526
+ if (!opt_decode) {
527
+ queryData = goog.Uri.encodeSpecialChars_(queryData,
528
+ goog.Uri.reDisallowedInQuery_);
529
+ }
530
+ this.queryData_ =
531
+ new goog.Uri.QueryData(queryData, this, this.ignoreCase_);
532
+ }
533
+
534
+ return this;
535
+ };
536
+
537
+
538
+ /**
539
+ * Sets the URI query.
540
+ * @param {string} newQuery New query value.
541
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
542
+ * @return {!goog.Uri} Reference to this URI object.
543
+ */
544
+ goog.Uri.prototype.setQuery = function(newQuery, opt_decode) {
545
+ return this.setQueryData(newQuery, opt_decode);
546
+ };
547
+
548
+
549
+ /**
550
+ * @return {string} The encoded URI query, not including the ?.
551
+ */
552
+ goog.Uri.prototype.getEncodedQuery = function() {
553
+ return this.queryData_.toString();
554
+ };
555
+
556
+
557
+ /**
558
+ * @return {string} The decoded URI query, not including the ?.
559
+ */
560
+ goog.Uri.prototype.getDecodedQuery = function() {
561
+ return this.queryData_.toDecodedString();
562
+ };
563
+
564
+
565
+ /**
566
+ * Returns the query data.
567
+ * @return {goog.Uri.QueryData} QueryData object.
568
+ */
569
+ goog.Uri.prototype.getQueryData = function() {
570
+ return this.queryData_;
571
+ };
572
+
573
+
574
+ /**
575
+ * @return {string} The encoded URI query, not including the ?.
576
+ *
577
+ * Warning: This method, unlike other getter methods, returns encoded
578
+ * value, instead of decoded one.
579
+ */
580
+ goog.Uri.prototype.getQuery = function() {
581
+ return this.getEncodedQuery();
582
+ };
583
+
584
+
585
+ /**
586
+ * Sets the value of the named query parameters, clearing previous values for
587
+ * that key.
588
+ *
589
+ * @param {string} key The parameter to set.
590
+ * @param {*} value The new value.
591
+ * @return {!goog.Uri} Reference to this URI object.
592
+ */
593
+ goog.Uri.prototype.setParameterValue = function(key, value) {
594
+ this.enforceReadOnly();
595
+ delete this.cachedToString_;
596
+
597
+ this.queryData_.set(key, value);
598
+ return this;
599
+ };
600
+
601
+
602
+ /**
603
+ * Sets the values of the named query parameters, clearing previous values for
604
+ * that key. Not new values will currently be moved to the end of the query
605
+ * string.
606
+ *
607
+ * So, <code>goog.Uri.parse('foo?a=b&c=d&e=f').setParameterValues('c', ['new'])
608
+ * </code> yields <tt>foo?a=b&e=f&c=new</tt>.</p>
609
+ *
610
+ * @param {string} key The parameter to set.
611
+ * @param {*} values The new values. If values is a single
612
+ * string then it will be treated as the sole value.
613
+ * @return {!goog.Uri} Reference to this URI object.
614
+ */
615
+ goog.Uri.prototype.setParameterValues = function(key, values) {
616
+ this.enforceReadOnly();
617
+ delete this.cachedToString_;
618
+
619
+ if (!goog.isArray(values)) {
620
+ values = [String(values)];
621
+ }
622
+
623
+ // TODO(nicksantos): This cast shouldn't be necessary.
624
+ this.queryData_.setValues(key, /** @type {Array} */ (values));
625
+
626
+ return this;
627
+ };
628
+
629
+
630
+ /**
631
+ * Returns the value<b>s</b> for a given cgi parameter as a list of decoded
632
+ * query parameter values.
633
+ * @param {string} name The parameter to get values for.
634
+ * @return {Array} The values for a given cgi parameter as a list of
635
+ * decoded query parameter values.
636
+ */
637
+ goog.Uri.prototype.getParameterValues = function(name) {
638
+ return this.queryData_.getValues(name);
639
+ };
640
+
641
+
642
+ /**
643
+ * Returns the first value for a given cgi parameter or undefined if the given
644
+ * parameter name does not appear in the query string.
645
+ * @param {string} paramName Unescaped parameter name.
646
+ * @return {*} The first value for a given cgi parameter or
647
+ * undefined if the given parameter name does not appear in the query
648
+ * string.
649
+ */
650
+ goog.Uri.prototype.getParameterValue = function(paramName) {
651
+ return this.queryData_.get(paramName);
652
+ };
653
+
654
+
655
+ /**
656
+ * @return {string} The URI fragment, not including the #.
657
+ */
658
+ goog.Uri.prototype.getFragment = function() {
659
+ return this.fragment_;
660
+ };
661
+
662
+
663
+ /**
664
+ * Sets the URI fragment.
665
+ * @param {string} newFragment New fragment value.
666
+ * @param {boolean=} opt_decode Optional param for whether to decode new value.
667
+ * @return {!goog.Uri} Reference to this URI object.
668
+ */
669
+ goog.Uri.prototype.setFragment = function(newFragment, opt_decode) {
670
+ this.enforceReadOnly();
671
+ delete this.cachedToString_;
672
+ this.fragment_ = opt_decode ? goog.Uri.decodeOrEmpty_(newFragment) :
673
+ newFragment;
674
+ return this;
675
+ };
676
+
677
+
678
+ /**
679
+ * @return {boolean} Whether the URI has a fragment set.
680
+ */
681
+ goog.Uri.prototype.hasFragment = function() {
682
+ return !!this.fragment_;
683
+ };
684
+
685
+
686
+ /**
687
+ * Returns true if this has the same domain as that of uri2.
688
+ * @param {goog.Uri} uri2 The URI object to compare to.
689
+ * @return {boolean} true if same domain; false otherwise.
690
+ */
691
+ goog.Uri.prototype.hasSameDomainAs = function(uri2) {
692
+ return ((!this.hasDomain() && !uri2.hasDomain()) ||
693
+ this.getDomain() == uri2.getDomain()) &&
694
+ ((!this.hasPort() && !uri2.hasPort()) ||
695
+ this.getPort() == uri2.getPort());
696
+ };
697
+
698
+
699
+ /**
700
+ * Adds a random parameter to the Uri.
701
+ * @return {!goog.Uri} Reference to this Uri object.
702
+ */
703
+ goog.Uri.prototype.makeUnique = function() {
704
+ this.enforceReadOnly();
705
+ this.setParameterValue(goog.Uri.RANDOM_PARAM, goog.string.getRandomString());
706
+
707
+ return this;
708
+ };
709
+
710
+
711
+ /**
712
+ * Removes the named query parameter.
713
+ *
714
+ * @param {string} key The parameter to remove.
715
+ * @return {!goog.Uri} Reference to this URI object.
716
+ */
717
+ goog.Uri.prototype.removeParameter = function(key) {
718
+ this.enforceReadOnly();
719
+ this.queryData_.remove(key);
720
+ return this;
721
+ };
722
+
723
+
724
+ /**
725
+ * Sets whether Uri is read only. If this goog.Uri is read-only,
726
+ * enforceReadOnly_ will be called at the start of any function that may modify
727
+ * this Uri.
728
+ * @param {boolean} isReadOnly whether this goog.Uri should be read only.
729
+ * @return {!goog.Uri} Reference to this Uri object.
730
+ */
731
+ goog.Uri.prototype.setReadOnly = function(isReadOnly) {
732
+ this.isReadOnly_ = isReadOnly;
733
+ return this;
734
+ };
735
+
736
+
737
+ /**
738
+ * @return {boolean} Whether the URI is read only.
739
+ */
740
+ goog.Uri.prototype.isReadOnly = function() {
741
+ return this.isReadOnly_;
742
+ };
743
+
744
+
745
+ /**
746
+ * Checks if this Uri has been marked as read only, and if so, throws an error.
747
+ * This should be called whenever any modifying function is called.
748
+ */
749
+ goog.Uri.prototype.enforceReadOnly = function() {
750
+ if (this.isReadOnly_) {
751
+ throw Error('Tried to modify a read-only Uri');
752
+ }
753
+ };
754
+
755
+
756
+ /**
757
+ * Sets whether to ignore case.
758
+ * NOTE: If there are already key/value pairs in the QueryData, and
759
+ * ignoreCase_ is set to false, the keys will all be lower-cased.
760
+ * @param {boolean} ignoreCase whether this goog.Uri should ignore case.
761
+ * @return {!goog.Uri} Reference to this Uri object.
762
+ */
763
+ goog.Uri.prototype.setIgnoreCase = function(ignoreCase) {
764
+ this.ignoreCase_ = ignoreCase;
765
+ if (this.queryData_) {
766
+ this.queryData_.setIgnoreCase(ignoreCase);
767
+ }
768
+ return this;
769
+ };
770
+
771
+
772
+ /**
773
+ * @return {boolean} Whether to ignore case.
774
+ */
775
+ goog.Uri.prototype.getIgnoreCase = function() {
776
+ return this.ignoreCase_;
777
+ };
778
+
779
+
780
+ //==============================================================================
781
+ // Static members
782
+ //==============================================================================
783
+
784
+
785
+ /**
786
+ * Creates a uri from the string form. Basically an alias of new goog.Uri().
787
+ * If a Uri object is passed to parse then it will return a clone of the object.
788
+ *
789
+ * @param {*} uri Raw URI string or instance of Uri
790
+ * object.
791
+ * @param {boolean=} opt_ignoreCase Whether to ignore the case of parameter
792
+ * names in #getParameterValue.
793
+ * @return {!goog.Uri} The new URI object.
794
+ */
795
+ goog.Uri.parse = function(uri, opt_ignoreCase) {
796
+ return uri instanceof goog.Uri ?
797
+ uri.clone() : new goog.Uri(uri, opt_ignoreCase);
798
+ };
799
+
800
+
801
+ /**
802
+ * Creates a new goog.Uri object from unencoded parts.
803
+ *
804
+ * @param {?string=} opt_scheme Scheme/protocol or full URI to parse.
805
+ * @param {?string=} opt_userInfo username:password.
806
+ * @param {?string=} opt_domain www.google.com.
807
+ * @param {?number=} opt_port 9830.
808
+ * @param {?string=} opt_path /some/path/to/a/file.html.
809
+ * @param {string|goog.Uri.QueryData=} opt_query a=1&b=2.
810
+ * @param {?string=} opt_fragment The fragment without the #.
811
+ * @param {boolean=} opt_ignoreCase Whether to ignore parameter name case in
812
+ * #getParameterValue.
813
+ *
814
+ * @return {!goog.Uri} The new URI object.
815
+ */
816
+ goog.Uri.create = function(opt_scheme, opt_userInfo, opt_domain, opt_port,
817
+ opt_path, opt_query, opt_fragment, opt_ignoreCase) {
818
+
819
+ var uri = new goog.Uri(null, opt_ignoreCase);
820
+
821
+ // Only set the parts if they are defined and not empty strings.
822
+ opt_scheme && uri.setScheme(opt_scheme);
823
+ opt_userInfo && uri.setUserInfo(opt_userInfo);
824
+ opt_domain && uri.setDomain(opt_domain);
825
+ opt_port && uri.setPort(opt_port);
826
+ opt_path && uri.setPath(opt_path);
827
+ opt_query && uri.setQueryData(opt_query);
828
+ opt_fragment && uri.setFragment(opt_fragment);
829
+
830
+ return uri;
831
+ };
832
+
833
+
834
+ /**
835
+ * Resolves a relative Uri against a base Uri, accepting both strings and
836
+ * Uri objects.
837
+ *
838
+ * @param {*} base Base Uri.
839
+ * @param {*} rel Relative Uri.
840
+ * @return {!goog.Uri} Resolved uri.
841
+ */
842
+ goog.Uri.resolve = function(base, rel) {
843
+ if (!(base instanceof goog.Uri)) {
844
+ base = goog.Uri.parse(base);
845
+ }
846
+
847
+ if (!(rel instanceof goog.Uri)) {
848
+ rel = goog.Uri.parse(rel);
849
+ }
850
+
851
+ return base.resolve(rel);
852
+ };
853
+
854
+
855
+ /**
856
+ * Removes dot segments in given path component, as described in
857
+ * RFC 3986, section 5.2.4.
858
+ *
859
+ * @param {string} path A non-empty path component.
860
+ * @return {string} Path component with removed dot segments.
861
+ */
862
+ goog.Uri.removeDotSegments = function(path) {
863
+ if (path == '..' || path == '.') {
864
+ return '';
865
+
866
+ } else if (!goog.string.contains(path, './') &&
867
+ !goog.string.contains(path, '/.')) {
868
+ // This optimization detects uris which do not contain dot-segments,
869
+ // and as a consequence do not require any processing.
870
+ return path;
871
+
872
+ } else {
873
+ var leadingSlash = goog.string.startsWith(path, '/');
874
+ var segments = path.split('/');
875
+ var out = [];
876
+
877
+ for (var pos = 0; pos < segments.length; ) {
878
+ var segment = segments[pos++];
879
+
880
+ if (segment == '.') {
881
+ if (leadingSlash && pos == segments.length) {
882
+ out.push('');
883
+ }
884
+ } else if (segment == '..') {
885
+ if (out.length > 1 || out.length == 1 && out[0] != '') {
886
+ out.pop();
887
+ }
888
+ if (leadingSlash && pos == segments.length) {
889
+ out.push('');
890
+ }
891
+ } else {
892
+ out.push(segment);
893
+ leadingSlash = true;
894
+ }
895
+ }
896
+
897
+ return out.join('/');
898
+ }
899
+ };
900
+
901
+
902
+ /**
903
+ * Decodes a value or returns the empty string if it isn't defined or empty.
904
+ * @param {string|undefined} val Value to decode.
905
+ * @return {string} Decoded value.
906
+ * @private
907
+ */
908
+ goog.Uri.decodeOrEmpty_ = function(val) {
909
+ // Don't use UrlDecode() here because val is not a query parameter.
910
+ return val ? decodeURIComponent(val) : '';
911
+ };
912
+
913
+
914
+ /**
915
+ * URI encode a string, or return null if it's not a string.
916
+ * @param {*} unescapedPart Unescaped string.
917
+ * @return {?string} Escaped string.
918
+ * @private
919
+ */
920
+ goog.Uri.encodeString_ = function(unescapedPart) {
921
+ if (goog.isString(unescapedPart)) {
922
+ return encodeURIComponent(unescapedPart);
923
+ }
924
+ return null;
925
+ };
926
+
927
+
928
+ /**
929
+ * Regular expression used for determining if a string needs to be encoded.
930
+ * @type {RegExp}
931
+ * @private
932
+ */
933
+ goog.Uri.encodeSpecialRegExp_ = /^[a-zA-Z0-9\-_.!~*'():\/;?]*$/;
934
+
935
+
936
+ /**
937
+ * If unescapedPart is non null, then escapes any characters in it that aren't
938
+ * valid characters in a url and also escapes any special characters that
939
+ * appear in extra.
940
+ *
941
+ * @param {*} unescapedPart The string to encode.
942
+ * @param {RegExp} extra A character set of characters in [\01-\177].
943
+ * @return {?string} null iff unescapedPart == null.
944
+ * @private
945
+ */
946
+ goog.Uri.encodeSpecialChars_ = function(unescapedPart, extra) {
947
+ var ret = null;
948
+ if (goog.isString(unescapedPart)) {
949
+ ret = unescapedPart;
950
+ // Checking if the search matches before calling encodeURI avoids an extra
951
+ // allocation in IE6
952
+ if (!goog.Uri.encodeSpecialRegExp_.test(ret)) {
953
+ ret = encodeURI(unescapedPart);
954
+ }
955
+ // Checking if the search matches before calling replace avoids an extra
956
+ // allocation in IE6
957
+ if (ret.search(extra) >= 0) {
958
+ ret = ret.replace(extra, goog.Uri.encodeChar_);
959
+ }
960
+ }
961
+ return ret;
962
+ };
963
+
964
+
965
+ /**
966
+ * Converts a character in [\01-\177] to its unicode character equivalent.
967
+ * @param {string} ch One character string.
968
+ * @return {string} Encoded string.
969
+ * @private
970
+ */
971
+ goog.Uri.encodeChar_ = function(ch) {
972
+ var n = ch.charCodeAt(0);
973
+ return '%' + ((n >> 4) & 0xf).toString(16) + (n & 0xf).toString(16);
974
+ };
975
+
976
+
977
+ /**
978
+ * Regular expression for characters that are disallowed in the scheme or
979
+ * userInfo part of the URI.
980
+ * @type {RegExp}
981
+ * @private
982
+ */
983
+ goog.Uri.reDisallowedInSchemeOrUserInfo_ = /[#\/\?@]/g;
984
+
985
+
986
+ /**
987
+ * Regular expression for characters that are disallowed in a relative path.
988
+ * @type {RegExp}
989
+ * @private
990
+ */
991
+ goog.Uri.reDisallowedInRelativePath_ = /[\#\?:]/g;
992
+
993
+
994
+ /**
995
+ * Regular expression for characters that are disallowed in an absolute path.
996
+ * @type {RegExp}
997
+ * @private
998
+ */
999
+ goog.Uri.reDisallowedInAbsolutePath_ = /[\#\?]/g;
1000
+
1001
+
1002
+ /**
1003
+ * Regular expression for characters that are disallowed in the query.
1004
+ * @type {RegExp}
1005
+ * @private
1006
+ */
1007
+ goog.Uri.reDisallowedInQuery_ = /[\#\?@]/g;
1008
+
1009
+
1010
+ /**
1011
+ * Regular expression for characters that are disallowed in the fragment.
1012
+ * @type {RegExp}
1013
+ * @private
1014
+ */
1015
+ goog.Uri.reDisallowedInFragment_ = /#/g;
1016
+
1017
+
1018
+ /**
1019
+ * Checks whether two URIs have the same domain.
1020
+ * @param {string} uri1String First URI string.
1021
+ * @param {string} uri2String Second URI string.
1022
+ * @return {boolean} true if the two URIs have the same domain; false otherwise.
1023
+ */
1024
+ goog.Uri.haveSameDomain = function(uri1String, uri2String) {
1025
+ // Differs from goog.uri.utils.haveSameDomain, since this ignores scheme.
1026
+ // TODO(gboyer): Have this just call goog.uri.util.haveSameDomain.
1027
+ var pieces1 = goog.uri.utils.split(uri1String);
1028
+ var pieces2 = goog.uri.utils.split(uri2String);
1029
+ return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] ==
1030
+ pieces2[goog.uri.utils.ComponentIndex.DOMAIN] &&
1031
+ pieces1[goog.uri.utils.ComponentIndex.PORT] ==
1032
+ pieces2[goog.uri.utils.ComponentIndex.PORT];
1033
+ };
1034
+
1035
+
1036
+
1037
+ /**
1038
+ * Class used to represent URI query parameters. It is essentially a hash of
1039
+ * name-value pairs, though a name can be present more than once.
1040
+ *
1041
+ * Has the same interface as the collections in goog.structs.
1042
+ *
1043
+ * @param {?string=} opt_query Optional encoded query string to parse into
1044
+ * the object.
1045
+ * @param {goog.Uri=} opt_uri Optional uri object that should have its cache
1046
+ * invalidated when this object updates.
1047
+ * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter
1048
+ * name in #get.
1049
+ * @constructor
1050
+ */
1051
+ goog.Uri.QueryData = function(opt_query, opt_uri, opt_ignoreCase) {
1052
+ /**
1053
+ * Encoded query string, or null if it requires computing from the key map.
1054
+ * @type {?string}
1055
+ * @private
1056
+ */
1057
+ this.encodedQuery_ = opt_query || null;
1058
+
1059
+ /**
1060
+ * Reference to a uri object which uses the query data. This allows the
1061
+ * QueryData object to invalidate the cache.
1062
+ * @type {goog.Uri}
1063
+ * @private
1064
+ */
1065
+ this.uri_ = opt_uri || null;
1066
+
1067
+ /**
1068
+ * If true, ignore the case of the parameter name in #get.
1069
+ * @type {boolean}
1070
+ * @private
1071
+ */
1072
+ this.ignoreCase_ = !!opt_ignoreCase;
1073
+ };
1074
+
1075
+
1076
+ /**
1077
+ * If the underlying key map is not yet initialized, it parses the
1078
+ * query string and fills the map with parsed data.
1079
+ * @private
1080
+ */
1081
+ goog.Uri.QueryData.prototype.ensureKeyMapInitialized_ = function() {
1082
+ if (!this.keyMap_) {
1083
+ this.keyMap_ = new goog.structs.Map();
1084
+ this.count_ = 0;
1085
+
1086
+ if (this.encodedQuery_) {
1087
+ var pairs = this.encodedQuery_.split('&');
1088
+ for (var i = 0; i < pairs.length; i++) {
1089
+ var indexOfEquals = pairs[i].indexOf('=');
1090
+ var name = null;
1091
+ var value = null;
1092
+ if (indexOfEquals >= 0) {
1093
+ name = pairs[i].substring(0, indexOfEquals);
1094
+ value = pairs[i].substring(indexOfEquals + 1);
1095
+ } else {
1096
+ name = pairs[i];
1097
+ }
1098
+ name = goog.string.urlDecode(name);
1099
+ name = this.getKeyName_(name);
1100
+ this.add(name, value ? goog.string.urlDecode(value) : '');
1101
+ }
1102
+ }
1103
+ }
1104
+ };
1105
+
1106
+
1107
+ /**
1108
+ * Creates a new query data instance from a map of names and values.
1109
+ *
1110
+ * @param {!goog.structs.Map|!Object} map Map of string parameter names to
1111
+ * string parameter values.
1112
+ * @param {goog.Uri=} opt_uri URI object that should have its cache
1113
+ * invalidated when this object updates.
1114
+ * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter
1115
+ * name in #get.
1116
+ * @return {!goog.Uri.QueryData} The populated query data instance.
1117
+ */
1118
+ goog.Uri.QueryData.createFromMap = function(map, opt_uri, opt_ignoreCase) {
1119
+ var keys = goog.structs.getKeys(map);
1120
+ if (typeof keys == 'undefined') {
1121
+ throw Error('Keys are undefined');
1122
+ }
1123
+ return goog.Uri.QueryData.createFromKeysValues(
1124
+ keys,
1125
+ goog.structs.getValues(map),
1126
+ opt_uri,
1127
+ opt_ignoreCase);
1128
+ };
1129
+
1130
+
1131
+ /**
1132
+ * Creates a new query data instance from parallel arrays of parameter names
1133
+ * and values. Allows for duplicate parameter names. Throws an error if the
1134
+ * lengths of the arrays differ.
1135
+ *
1136
+ * @param {Array.<string>} keys Parameter names.
1137
+ * @param {Array} values Parameter values.
1138
+ * @param {goog.Uri=} opt_uri URI object that should have its cache
1139
+ * invalidated when this object updates.
1140
+ * @param {boolean=} opt_ignoreCase If true, ignore the case of the parameter
1141
+ * name in #get.
1142
+ * @return {!goog.Uri.QueryData} The populated query data instance.
1143
+ */
1144
+ goog.Uri.QueryData.createFromKeysValues = function(
1145
+ keys, values, opt_uri, opt_ignoreCase) {
1146
+ if (keys.length != values.length) {
1147
+ throw Error('Mismatched lengths for keys/values');
1148
+ }
1149
+ var queryData = new goog.Uri.QueryData(null, opt_uri, opt_ignoreCase);
1150
+ for (var i = 0; i < keys.length; i++) {
1151
+ queryData.add(keys[i], values[i]);
1152
+ }
1153
+ return queryData;
1154
+ };
1155
+
1156
+
1157
+ /**
1158
+ * The map containing name/value or name/array-of-values pairs.
1159
+ * May be null if it requires parsing from the query string.
1160
+ *
1161
+ * We need to use a Map because we cannot guarantee that the key names will
1162
+ * not be problematic for IE.
1163
+ *
1164
+ * @type {Object}
1165
+ * @private
1166
+ */
1167
+ goog.Uri.QueryData.prototype.keyMap_ = null;
1168
+
1169
+
1170
+ /**
1171
+ * The number of params, or null if it requires computing.
1172
+ * @type {?number}
1173
+ * @private
1174
+ */
1175
+ goog.Uri.QueryData.prototype.count_ = null;
1176
+
1177
+
1178
+ /**
1179
+ * Decoded query string, or null if it requires computing.
1180
+ * @type {?string}
1181
+ * @private
1182
+ */
1183
+ goog.Uri.QueryData.decodedQuery_ = null;
1184
+
1185
+
1186
+ /**
1187
+ * @return {?number} The number of parameters.
1188
+ */
1189
+ goog.Uri.QueryData.prototype.getCount = function() {
1190
+ this.ensureKeyMapInitialized_();
1191
+ return this.count_;
1192
+ };
1193
+
1194
+
1195
+ /**
1196
+ * Adds a key value pair.
1197
+ * @param {string} key Name.
1198
+ * @param {*} value Value.
1199
+ * @return {!goog.Uri.QueryData} Instance of this object.
1200
+ */
1201
+ goog.Uri.QueryData.prototype.add = function(key, value) {
1202
+ this.ensureKeyMapInitialized_();
1203
+ this.invalidateCache_();
1204
+
1205
+ key = this.getKeyName_(key);
1206
+ if (!this.containsKey(key)) {
1207
+ this.keyMap_.set(key, value);
1208
+ } else {
1209
+ var current = this.keyMap_.get(key);
1210
+ if (goog.isArray(current)) {
1211
+ current.push(value);
1212
+ } else {
1213
+ this.keyMap_.set(key, [current, value]);
1214
+ }
1215
+ }
1216
+
1217
+ this.count_++;
1218
+
1219
+ return this;
1220
+ };
1221
+
1222
+
1223
+ /**
1224
+ * Removes all the params with the given key.
1225
+ * @param {string} key Name.
1226
+ * @return {boolean} Whether any parameter was removed.
1227
+ */
1228
+ goog.Uri.QueryData.prototype.remove = function(key) {
1229
+ this.ensureKeyMapInitialized_();
1230
+
1231
+ key = this.getKeyName_(key);
1232
+ if (this.keyMap_.containsKey(key)) {
1233
+ this.invalidateCache_();
1234
+
1235
+ // we need to get it to know how many to decrement the count with
1236
+ var old = this.keyMap_.get(key);
1237
+ if (goog.isArray(old)) {
1238
+ this.count_ -= old.length;
1239
+ } else {
1240
+ this.count_--;
1241
+ }
1242
+ return this.keyMap_.remove(key);
1243
+ }
1244
+ return false;
1245
+ };
1246
+
1247
+
1248
+ /**
1249
+ * Clears the parameters.
1250
+ */
1251
+ goog.Uri.QueryData.prototype.clear = function() {
1252
+ this.invalidateCache_();
1253
+ if (this.keyMap_) {
1254
+ this.keyMap_.clear();
1255
+ }
1256
+ this.count_ = 0;
1257
+ };
1258
+
1259
+
1260
+ /**
1261
+ * @return {boolean} Whether we have any parameters.
1262
+ */
1263
+ goog.Uri.QueryData.prototype.isEmpty = function() {
1264
+ this.ensureKeyMapInitialized_();
1265
+ return this.count_ == 0;
1266
+ };
1267
+
1268
+
1269
+ /**
1270
+ * Whether there is a parameter with the given name
1271
+ * @param {string} key The parameter name to check for.
1272
+ * @return {boolean} Whether there is a parameter with the given name.
1273
+ */
1274
+ goog.Uri.QueryData.prototype.containsKey = function(key) {
1275
+ this.ensureKeyMapInitialized_();
1276
+ key = this.getKeyName_(key);
1277
+ return this.keyMap_.containsKey(key);
1278
+ };
1279
+
1280
+
1281
+ /**
1282
+ * Whether there is a parameter with the given value.
1283
+ * @param {*} value The value to check for.
1284
+ * @return {boolean} Whether there is a parameter with the given value.
1285
+ */
1286
+ goog.Uri.QueryData.prototype.containsValue = function(value) {
1287
+ // NOTE(arv): This solution goes through all the params even if it was the
1288
+ // first param. We can get around this by not reusing code or by switching to
1289
+ // iterators.
1290
+ var vals = this.getValues();
1291
+ return goog.array.contains(vals, value);
1292
+ };
1293
+
1294
+
1295
+ /**
1296
+ * Returns all the keys of the parameters. If a key is used multiple times
1297
+ * it will be included multiple times in the returned array
1298
+ * @return {Array} All the keys of the parameters.
1299
+ */
1300
+ goog.Uri.QueryData.prototype.getKeys = function() {
1301
+ this.ensureKeyMapInitialized_();
1302
+ // We need to get the values to know how many keys to add.
1303
+ var vals = this.keyMap_.getValues(); // Array.<Array|String>
1304
+ var keys = this.keyMap_.getKeys(); // Array.<String>
1305
+ var rv = [];
1306
+ for (var i = 0; i < keys.length; i++) {
1307
+ var val = vals[i];
1308
+ if (goog.isArray(val)) {
1309
+ for (var j = 0; j < val.length; j++) {
1310
+ rv.push(keys[i]);
1311
+ }
1312
+ } else {
1313
+ rv.push(keys[i]);
1314
+ }
1315
+ }
1316
+ return rv;
1317
+ };
1318
+
1319
+
1320
+ /**
1321
+ * Returns all the values of the parameters with the given name. If the query
1322
+ * data has no such key this will return an empty array. If no key is given
1323
+ * all values wil be returned.
1324
+ * @param {string=} opt_key The name of the parameter to get the values for.
1325
+ * @return {Array} All the values of the parameters with the given name.
1326
+ */
1327
+ goog.Uri.QueryData.prototype.getValues = function(opt_key) {
1328
+ this.ensureKeyMapInitialized_();
1329
+ var rv;
1330
+ if (opt_key) {
1331
+ var key = this.getKeyName_(opt_key);
1332
+ if (this.containsKey(key)) {
1333
+ var value = this.keyMap_.get(key);
1334
+ if (goog.isArray(value)) {
1335
+ return value;
1336
+ } else {
1337
+ rv = [];
1338
+ rv.push(value);
1339
+ }
1340
+ } else {
1341
+ rv = [];
1342
+ }
1343
+ } else {
1344
+ // return all values
1345
+ var vals = this.keyMap_.getValues(); // Array.<Array|String>
1346
+ rv = [];
1347
+ for (var i = 0; i < vals.length; i++) {
1348
+ var val = vals[i];
1349
+ if (goog.isArray(val)) {
1350
+ goog.array.extend(rv, val);
1351
+ } else {
1352
+ rv.push(val);
1353
+ }
1354
+ }
1355
+ }
1356
+ return rv;
1357
+ };
1358
+
1359
+
1360
+ /**
1361
+ * Sets a key value pair and removes all other keys with the same value.
1362
+ *
1363
+ * @param {string} key Name.
1364
+ * @param {*} value Value.
1365
+ * @return {!goog.Uri.QueryData} Instance of this object.
1366
+ */
1367
+ goog.Uri.QueryData.prototype.set = function(key, value) {
1368
+ this.ensureKeyMapInitialized_();
1369
+ this.invalidateCache_();
1370
+
1371
+ key = this.getKeyName_(key);
1372
+ if (this.containsKey(key)) {
1373
+ var old = this.keyMap_.get(key);
1374
+ if (goog.isArray(old)) {
1375
+ this.count_ -= old.length;
1376
+ } else {
1377
+ this.count_--;
1378
+ }
1379
+ }
1380
+
1381
+ this.keyMap_.set(key, value);
1382
+ this.count_++;
1383
+ return this;
1384
+ };
1385
+
1386
+
1387
+ /**
1388
+ * Returns the first value associated with the key. If the query data has no
1389
+ * such key this will return undefined or the optional default.
1390
+ * @param {string} key The name of the parameter to get the value for.
1391
+ * @param {*=} opt_default The default value to return if the query data
1392
+ * has no such key.
1393
+ * @return {*} The first value associated with the key.
1394
+ */
1395
+ goog.Uri.QueryData.prototype.get = function(key, opt_default) {
1396
+ this.ensureKeyMapInitialized_();
1397
+ key = this.getKeyName_(key);
1398
+ if (this.containsKey(key)) {
1399
+ var val = this.keyMap_.get(key);
1400
+ if (goog.isArray(val)) {
1401
+ return val[0];
1402
+ } else {
1403
+ return val;
1404
+ }
1405
+ } else {
1406
+ return opt_default;
1407
+ }
1408
+ };
1409
+
1410
+
1411
+ /**
1412
+ * Sets the values for a key, if the key has already got values defined, this
1413
+ * will override the existing values then remove any left over
1414
+ * @param {string} key The key to set values for.
1415
+ * @param {Array} values The values to set.
1416
+ */
1417
+ goog.Uri.QueryData.prototype.setValues = function(key, values) {
1418
+ this.ensureKeyMapInitialized_();
1419
+ this.invalidateCache_();
1420
+
1421
+ key = this.getKeyName_(key);
1422
+ if (this.containsKey(key)) {
1423
+ var old = this.keyMap_.get(key);
1424
+ if (goog.isArray(old)) {
1425
+ this.count_ -= old.length;
1426
+ } else {
1427
+ this.count_--;
1428
+ }
1429
+ }
1430
+
1431
+ if (values.length > 0) {
1432
+ this.keyMap_.set(key, values);
1433
+ this.count_ += values.length;
1434
+ }
1435
+ };
1436
+
1437
+
1438
+ /**
1439
+ * @return {string} Encoded query string.
1440
+ */
1441
+ goog.Uri.QueryData.prototype.toString = function() {
1442
+ if (this.encodedQuery_) {
1443
+ return this.encodedQuery_;
1444
+ }
1445
+
1446
+ if (!this.keyMap_) {
1447
+ return '';
1448
+ }
1449
+
1450
+ var sb = [];
1451
+
1452
+ // this used to use this.getKeys and this.getVals but that generates a lot
1453
+ // allocations than just iterating over the keys
1454
+ var count = 0;
1455
+ var keys = this.keyMap_.getKeys();
1456
+ for (var i = 0; i < keys.length; i++) {
1457
+ var key = keys[i];
1458
+ var encodedKey = goog.string.urlEncode(key);
1459
+ var val = this.keyMap_.get(key);
1460
+ if (goog.isArray(val)) {
1461
+ for (var j = 0; j < val.length; j++) {
1462
+ if (count > 0) {
1463
+ sb.push('&');
1464
+ }
1465
+ sb.push(encodedKey);
1466
+ // Check for empty string, null and undefined get encoded
1467
+ // into the url as literal strings
1468
+ if (val[j] !== '') {
1469
+ sb.push('=', goog.string.urlEncode(val[j]));
1470
+ }
1471
+ count++;
1472
+ }
1473
+ } else {
1474
+ if (count > 0) {
1475
+ sb.push('&');
1476
+ }
1477
+ sb.push(encodedKey);
1478
+ // Check for empty string, null and undefined get encoded
1479
+ // into the url as literal strings
1480
+ if (val !== '') {
1481
+ sb.push('=', goog.string.urlEncode(val));
1482
+ }
1483
+ count++;
1484
+ }
1485
+ }
1486
+
1487
+ return this.encodedQuery_ = sb.join('');
1488
+ };
1489
+
1490
+
1491
+ /**
1492
+ * @return {string} Decoded query string.
1493
+ */
1494
+ goog.Uri.QueryData.prototype.toDecodedString = function() {
1495
+ if (!this.decodedQuery_) {
1496
+ this.decodedQuery_ = goog.Uri.decodeOrEmpty_(this.toString());
1497
+ }
1498
+
1499
+ return this.decodedQuery_;
1500
+ };
1501
+
1502
+
1503
+ /**
1504
+ * Invalidate the cache.
1505
+ * @private
1506
+ */
1507
+ goog.Uri.QueryData.prototype.invalidateCache_ = function() {
1508
+ delete this.decodedQuery_;
1509
+ delete this.encodedQuery_;
1510
+ if (this.uri_) {
1511
+ delete this.uri_.cachedToString_;
1512
+ }
1513
+ };
1514
+
1515
+
1516
+ /**
1517
+ * Removes all keys that are not in the provided list. (Modifies this object.)
1518
+ * @param {Array.<string>} keys The desired keys.
1519
+ * @return {!goog.Uri.QueryData} a reference to this object.
1520
+ */
1521
+ goog.Uri.QueryData.prototype.filterKeys = function(keys) {
1522
+ this.ensureKeyMapInitialized_();
1523
+ goog.structs.forEach(this.keyMap_,
1524
+ /** @this {goog.Uri.QueryData} */
1525
+ function(value, key, map) {
1526
+ if (!goog.array.contains(keys, key)) {
1527
+ this.remove(key);
1528
+ }
1529
+ }, this);
1530
+ return this;
1531
+ };
1532
+
1533
+
1534
+ /**
1535
+ * Clone the query data instance.
1536
+ * @return {!goog.Uri.QueryData} New instance of the QueryData object.
1537
+ */
1538
+ goog.Uri.QueryData.prototype.clone = function() {
1539
+ var rv = new goog.Uri.QueryData();
1540
+ if (this.decodedQuery_) {
1541
+ rv.decodedQuery_ = this.decodedQuery_;
1542
+ }
1543
+ if (this.encodedQuery_) {
1544
+ rv.encodedQuery_ = this.encodedQuery_;
1545
+ }
1546
+ if (this.keyMap_) {
1547
+ rv.keyMap_ = this.keyMap_.clone();
1548
+ }
1549
+ return rv;
1550
+ };
1551
+
1552
+
1553
+ /**
1554
+ * Helper function to get the key name from a JavaScript object. Converts
1555
+ * the object to a string, and to lower case if necessary.
1556
+ * @private
1557
+ * @param {*} arg The object to get a key name from.
1558
+ * @return {string} valid key name which can be looked up in #keyMap_.
1559
+ */
1560
+ goog.Uri.QueryData.prototype.getKeyName_ = function(arg) {
1561
+ var keyName = String(arg);
1562
+ if (this.ignoreCase_) {
1563
+ keyName = keyName.toLowerCase();
1564
+ }
1565
+ return keyName;
1566
+ };
1567
+
1568
+
1569
+ /**
1570
+ * Ignore case in parameter names.
1571
+ * NOTE: If there are already key/value pairs in the QueryData, and
1572
+ * ignoreCase_ is set to false, the keys will all be lower-cased.
1573
+ * @param {boolean} ignoreCase whether this goog.Uri should ignore case.
1574
+ */
1575
+ goog.Uri.QueryData.prototype.setIgnoreCase = function(ignoreCase) {
1576
+ var resetKeys = ignoreCase && !this.ignoreCase_;
1577
+ if (resetKeys) {
1578
+ this.ensureKeyMapInitialized_();
1579
+ this.invalidateCache_();
1580
+ goog.structs.forEach(this.keyMap_,
1581
+ /** @this {goog.Uri.QueryData} */
1582
+ function(value, key, map) {
1583
+ var lowerCase = key.toLowerCase();
1584
+ if (key != lowerCase) {
1585
+ this.remove(key);
1586
+ this.add(lowerCase, value);
1587
+ }
1588
+ }, this);
1589
+ }
1590
+ this.ignoreCase_ = ignoreCase;
1591
+ };
1592
+
1593
+
1594
+ /**
1595
+ * Extends a query data object with another query data or map like object. This
1596
+ * operates 'in-place', it does not create a new QueryData object.
1597
+ *
1598
+ * @param {...(goog.Uri.QueryData|goog.structs.Map|Object)} var_args The object
1599
+ * from which key value pairs will be copied.
1600
+ */
1601
+ goog.Uri.QueryData.prototype.extend = function(var_args) {
1602
+ for (var i = 0; i < arguments.length; i++) {
1603
+ var data = arguments[i];
1604
+ goog.structs.forEach(data,
1605
+ /** @this {goog.Uri.QueryData} */
1606
+ function(value, key) {
1607
+ this.add(key, value);
1608
+ }, this);
1609
+ }
1610
+ };
1611
+ ;
1612
+ FI"
1613
+ F"%91f08fb44713c87b9df1b7d3e2652d8c