pul_uv_rails 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (588) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.gitignore +9 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE +202 -0
  8. data/README.md +44 -0
  9. data/Rakefile +6 -0
  10. data/bower.json +27 -0
  11. data/lib/pul_uv_rails.rb +12 -0
  12. data/lib/pul_uv_rails/universal_viewer.rb +34 -0
  13. data/lib/pul_uv_rails/version.rb +3 -0
  14. data/public/universalviewer/.bower.json +32 -0
  15. data/public/universalviewer/.bowerrc +6 -0
  16. data/public/universalviewer/.gitattributes +4 -0
  17. data/public/universalviewer/.gitignore +88 -0
  18. data/public/universalviewer/.gitmodules +6 -0
  19. data/public/universalviewer/.npmignore +19 -0
  20. data/public/universalviewer/.travis.yml +21 -0
  21. data/public/universalviewer/.vscode/settings.json +13 -0
  22. data/public/universalviewer/.vscode/tasks.json +25 -0
  23. data/public/universalviewer/CHANGELOG.md +11 -0
  24. data/public/universalviewer/Gruntfile.js +490 -0
  25. data/public/universalviewer/LICENSE.txt +16 -0
  26. data/public/universalviewer/README.md +98 -0
  27. data/public/universalviewer/app.build.js +14 -0
  28. data/public/universalviewer/bower.json +23 -0
  29. data/public/universalviewer/config.js +56 -0
  30. data/public/universalviewer/dist/uv-2.0.1/app.html +61 -0
  31. data/public/universalviewer/dist/uv-2.0.1/html/uv-pdfcenterpanel-module/viewer.html +363 -0
  32. data/public/universalviewer/dist/uv-2.0.1/l10n/ach/chrome.properties +18 -0
  33. data/public/universalviewer/dist/uv-2.0.1/l10n/ach/viewer.properties +97 -0
  34. data/public/universalviewer/dist/uv-2.0.1/l10n/af/chrome.properties +18 -0
  35. data/public/universalviewer/dist/uv-2.0.1/l10n/af/viewer.properties +140 -0
  36. data/public/universalviewer/dist/uv-2.0.1/l10n/ak/chrome.properties +18 -0
  37. data/public/universalviewer/dist/uv-2.0.1/l10n/ak/viewer.properties +123 -0
  38. data/public/universalviewer/dist/uv-2.0.1/l10n/an/chrome.properties +19 -0
  39. data/public/universalviewer/dist/uv-2.0.1/l10n/an/viewer.properties +161 -0
  40. data/public/universalviewer/dist/uv-2.0.1/l10n/ar/chrome.properties +19 -0
  41. data/public/universalviewer/dist/uv-2.0.1/l10n/ar/viewer.properties +161 -0
  42. data/public/universalviewer/dist/uv-2.0.1/l10n/as/chrome.properties +19 -0
  43. data/public/universalviewer/dist/uv-2.0.1/l10n/as/viewer.properties +161 -0
  44. data/public/universalviewer/dist/uv-2.0.1/l10n/ast/chrome.properties +7 -0
  45. data/public/universalviewer/dist/uv-2.0.1/l10n/ast/viewer.properties +73 -0
  46. data/public/universalviewer/dist/uv-2.0.1/l10n/az/chrome.properties +18 -0
  47. data/public/universalviewer/dist/uv-2.0.1/l10n/az/viewer.properties +139 -0
  48. data/public/universalviewer/dist/uv-2.0.1/l10n/be/chrome.properties +4 -0
  49. data/public/universalviewer/dist/uv-2.0.1/l10n/be/viewer.properties +103 -0
  50. data/public/universalviewer/dist/uv-2.0.1/l10n/bg/chrome.properties +18 -0
  51. data/public/universalviewer/dist/uv-2.0.1/l10n/bg/viewer.properties +124 -0
  52. data/public/universalviewer/dist/uv-2.0.1/l10n/bn-BD/chrome.properties +18 -0
  53. data/public/universalviewer/dist/uv-2.0.1/l10n/bn-BD/viewer.properties +139 -0
  54. data/public/universalviewer/dist/uv-2.0.1/l10n/bn-IN/chrome.properties +18 -0
  55. data/public/universalviewer/dist/uv-2.0.1/l10n/bn-IN/viewer.properties +139 -0
  56. data/public/universalviewer/dist/uv-2.0.1/l10n/br/chrome.properties +19 -0
  57. data/public/universalviewer/dist/uv-2.0.1/l10n/br/viewer.properties +161 -0
  58. data/public/universalviewer/dist/uv-2.0.1/l10n/bs/chrome.properties +8 -0
  59. data/public/universalviewer/dist/uv-2.0.1/l10n/bs/viewer.properties +125 -0
  60. data/public/universalviewer/dist/uv-2.0.1/l10n/ca/chrome.properties +19 -0
  61. data/public/universalviewer/dist/uv-2.0.1/l10n/ca/viewer.properties +161 -0
  62. data/public/universalviewer/dist/uv-2.0.1/l10n/cs/chrome.properties +19 -0
  63. data/public/universalviewer/dist/uv-2.0.1/l10n/cs/viewer.properties +161 -0
  64. data/public/universalviewer/dist/uv-2.0.1/l10n/csb/chrome.properties +8 -0
  65. data/public/universalviewer/dist/uv-2.0.1/l10n/csb/viewer.properties +134 -0
  66. data/public/universalviewer/dist/uv-2.0.1/l10n/cy/chrome.properties +19 -0
  67. data/public/universalviewer/dist/uv-2.0.1/l10n/cy/viewer.properties +161 -0
  68. data/public/universalviewer/dist/uv-2.0.1/l10n/da/chrome.properties +9 -0
  69. data/public/universalviewer/dist/uv-2.0.1/l10n/da/viewer.properties +161 -0
  70. data/public/universalviewer/dist/uv-2.0.1/l10n/de/chrome.properties +19 -0
  71. data/public/universalviewer/dist/uv-2.0.1/l10n/de/viewer.properties +161 -0
  72. data/public/universalviewer/dist/uv-2.0.1/l10n/el/chrome.properties +9 -0
  73. data/public/universalviewer/dist/uv-2.0.1/l10n/el/viewer.properties +131 -0
  74. data/public/universalviewer/dist/uv-2.0.1/l10n/en-GB/chrome.properties +19 -0
  75. data/public/universalviewer/dist/uv-2.0.1/l10n/en-GB/viewer.properties +161 -0
  76. data/public/universalviewer/dist/uv-2.0.1/l10n/en-US/chrome.properties +19 -0
  77. data/public/universalviewer/dist/uv-2.0.1/l10n/en-US/viewer.properties +161 -0
  78. data/public/universalviewer/dist/uv-2.0.1/l10n/en-ZA/chrome.properties +19 -0
  79. data/public/universalviewer/dist/uv-2.0.1/l10n/en-ZA/viewer.properties +161 -0
  80. data/public/universalviewer/dist/uv-2.0.1/l10n/eo/chrome.properties +19 -0
  81. data/public/universalviewer/dist/uv-2.0.1/l10n/eo/viewer.properties +161 -0
  82. data/public/universalviewer/dist/uv-2.0.1/l10n/es-AR/chrome.properties +19 -0
  83. data/public/universalviewer/dist/uv-2.0.1/l10n/es-AR/viewer.properties +167 -0
  84. data/public/universalviewer/dist/uv-2.0.1/l10n/es-CL/chrome.properties +19 -0
  85. data/public/universalviewer/dist/uv-2.0.1/l10n/es-CL/viewer.properties +126 -0
  86. data/public/universalviewer/dist/uv-2.0.1/l10n/es-ES/chrome.properties +8 -0
  87. data/public/universalviewer/dist/uv-2.0.1/l10n/es-ES/viewer.properties +107 -0
  88. data/public/universalviewer/dist/uv-2.0.1/l10n/es-MX/chrome.properties +19 -0
  89. data/public/universalviewer/dist/uv-2.0.1/l10n/es-MX/viewer.properties +161 -0
  90. data/public/universalviewer/dist/uv-2.0.1/l10n/et/chrome.properties +19 -0
  91. data/public/universalviewer/dist/uv-2.0.1/l10n/et/viewer.properties +161 -0
  92. data/public/universalviewer/dist/uv-2.0.1/l10n/eu/chrome.properties +18 -0
  93. data/public/universalviewer/dist/uv-2.0.1/l10n/eu/viewer.properties +136 -0
  94. data/public/universalviewer/dist/uv-2.0.1/l10n/fa/chrome.properties +18 -0
  95. data/public/universalviewer/dist/uv-2.0.1/l10n/fa/viewer.properties +102 -0
  96. data/public/universalviewer/dist/uv-2.0.1/l10n/ff/chrome.properties +18 -0
  97. data/public/universalviewer/dist/uv-2.0.1/l10n/ff/viewer.properties +123 -0
  98. data/public/universalviewer/dist/uv-2.0.1/l10n/fi/chrome.properties +19 -0
  99. data/public/universalviewer/dist/uv-2.0.1/l10n/fi/viewer.properties +161 -0
  100. data/public/universalviewer/dist/uv-2.0.1/l10n/fr/chrome.properties +18 -0
  101. data/public/universalviewer/dist/uv-2.0.1/l10n/fr/viewer.properties +161 -0
  102. data/public/universalviewer/dist/uv-2.0.1/l10n/fy-NL/chrome.properties +9 -0
  103. data/public/universalviewer/dist/uv-2.0.1/l10n/fy-NL/viewer.properties +167 -0
  104. data/public/universalviewer/dist/uv-2.0.1/l10n/ga-IE/chrome.properties +19 -0
  105. data/public/universalviewer/dist/uv-2.0.1/l10n/ga-IE/viewer.properties +161 -0
  106. data/public/universalviewer/dist/uv-2.0.1/l10n/gd/chrome.properties +19 -0
  107. data/public/universalviewer/dist/uv-2.0.1/l10n/gd/viewer.properties +161 -0
  108. data/public/universalviewer/dist/uv-2.0.1/l10n/gl/chrome.properties +8 -0
  109. data/public/universalviewer/dist/uv-2.0.1/l10n/gl/viewer.properties +124 -0
  110. data/public/universalviewer/dist/uv-2.0.1/l10n/gu-IN/chrome.properties +10 -0
  111. data/public/universalviewer/dist/uv-2.0.1/l10n/gu-IN/viewer.properties +108 -0
  112. data/public/universalviewer/dist/uv-2.0.1/l10n/he/chrome.properties +20 -0
  113. data/public/universalviewer/dist/uv-2.0.1/l10n/he/viewer.properties +150 -0
  114. data/public/universalviewer/dist/uv-2.0.1/l10n/hi-IN/chrome.properties +18 -0
  115. data/public/universalviewer/dist/uv-2.0.1/l10n/hi-IN/viewer.properties +136 -0
  116. data/public/universalviewer/dist/uv-2.0.1/l10n/hr/chrome.properties +18 -0
  117. data/public/universalviewer/dist/uv-2.0.1/l10n/hr/viewer.properties +139 -0
  118. data/public/universalviewer/dist/uv-2.0.1/l10n/hu/chrome.properties +19 -0
  119. data/public/universalviewer/dist/uv-2.0.1/l10n/hu/viewer.properties +161 -0
  120. data/public/universalviewer/dist/uv-2.0.1/l10n/hy-AM/chrome.properties +19 -0
  121. data/public/universalviewer/dist/uv-2.0.1/l10n/hy-AM/viewer.properties +161 -0
  122. data/public/universalviewer/dist/uv-2.0.1/l10n/id/chrome.properties +19 -0
  123. data/public/universalviewer/dist/uv-2.0.1/l10n/id/viewer.properties +167 -0
  124. data/public/universalviewer/dist/uv-2.0.1/l10n/is/chrome.properties +19 -0
  125. data/public/universalviewer/dist/uv-2.0.1/l10n/is/viewer.properties +161 -0
  126. data/public/universalviewer/dist/uv-2.0.1/l10n/it/chrome.properties +8 -0
  127. data/public/universalviewer/dist/uv-2.0.1/l10n/it/viewer.properties +107 -0
  128. data/public/universalviewer/dist/uv-2.0.1/l10n/ja/chrome.properties +19 -0
  129. data/public/universalviewer/dist/uv-2.0.1/l10n/ja/viewer.properties +161 -0
  130. data/public/universalviewer/dist/uv-2.0.1/l10n/ka/chrome.properties +18 -0
  131. data/public/universalviewer/dist/uv-2.0.1/l10n/ka/viewer.properties +124 -0
  132. data/public/universalviewer/dist/uv-2.0.1/l10n/kk/chrome.properties +19 -0
  133. data/public/universalviewer/dist/uv-2.0.1/l10n/kk/viewer.properties +161 -0
  134. data/public/universalviewer/dist/uv-2.0.1/l10n/km/chrome.properties +19 -0
  135. data/public/universalviewer/dist/uv-2.0.1/l10n/km/viewer.properties +161 -0
  136. data/public/universalviewer/dist/uv-2.0.1/l10n/kn/chrome.properties +18 -0
  137. data/public/universalviewer/dist/uv-2.0.1/l10n/kn/viewer.properties +123 -0
  138. data/public/universalviewer/dist/uv-2.0.1/l10n/ko/chrome.properties +19 -0
  139. data/public/universalviewer/dist/uv-2.0.1/l10n/ko/viewer.properties +161 -0
  140. data/public/universalviewer/dist/uv-2.0.1/l10n/ku/chrome.properties +18 -0
  141. data/public/universalviewer/dist/uv-2.0.1/l10n/ku/viewer.properties +136 -0
  142. data/public/universalviewer/dist/uv-2.0.1/l10n/lg/chrome.properties +18 -0
  143. data/public/universalviewer/dist/uv-2.0.1/l10n/lg/viewer.properties +100 -0
  144. data/public/universalviewer/dist/uv-2.0.1/l10n/lij/chrome.properties +7 -0
  145. data/public/universalviewer/dist/uv-2.0.1/l10n/lij/viewer.properties +94 -0
  146. data/public/universalviewer/dist/uv-2.0.1/l10n/locale.properties +312 -0
  147. data/public/universalviewer/dist/uv-2.0.1/l10n/lt/chrome.properties +19 -0
  148. data/public/universalviewer/dist/uv-2.0.1/l10n/lt/viewer.properties +161 -0
  149. data/public/universalviewer/dist/uv-2.0.1/l10n/lv/chrome.properties +9 -0
  150. data/public/universalviewer/dist/uv-2.0.1/l10n/lv/viewer.properties +157 -0
  151. data/public/universalviewer/dist/uv-2.0.1/l10n/mai/chrome.properties +18 -0
  152. data/public/universalviewer/dist/uv-2.0.1/l10n/mai/viewer.properties +123 -0
  153. data/public/universalviewer/dist/uv-2.0.1/l10n/mk/chrome.properties +9 -0
  154. data/public/universalviewer/dist/uv-2.0.1/l10n/mk/viewer.properties +126 -0
  155. data/public/universalviewer/dist/uv-2.0.1/l10n/ml/chrome.properties +18 -0
  156. data/public/universalviewer/dist/uv-2.0.1/l10n/ml/viewer.properties +136 -0
  157. data/public/universalviewer/dist/uv-2.0.1/l10n/mn/chrome.properties +15 -0
  158. data/public/universalviewer/dist/uv-2.0.1/l10n/mn/viewer.properties +65 -0
  159. data/public/universalviewer/dist/uv-2.0.1/l10n/mr/chrome.properties +18 -0
  160. data/public/universalviewer/dist/uv-2.0.1/l10n/mr/viewer.properties +119 -0
  161. data/public/universalviewer/dist/uv-2.0.1/l10n/ms/chrome.properties +19 -0
  162. data/public/universalviewer/dist/uv-2.0.1/l10n/ms/viewer.properties +161 -0
  163. data/public/universalviewer/dist/uv-2.0.1/l10n/my/chrome.properties +18 -0
  164. data/public/universalviewer/dist/uv-2.0.1/l10n/my/viewer.properties +123 -0
  165. data/public/universalviewer/dist/uv-2.0.1/l10n/nb-NO/chrome.properties +19 -0
  166. data/public/universalviewer/dist/uv-2.0.1/l10n/nb-NO/viewer.properties +161 -0
  167. data/public/universalviewer/dist/uv-2.0.1/l10n/nl/chrome.properties +19 -0
  168. data/public/universalviewer/dist/uv-2.0.1/l10n/nl/viewer.properties +161 -0
  169. data/public/universalviewer/dist/uv-2.0.1/l10n/nn-NO/chrome.properties +8 -0
  170. data/public/universalviewer/dist/uv-2.0.1/l10n/nn-NO/viewer.properties +136 -0
  171. data/public/universalviewer/dist/uv-2.0.1/l10n/nso/chrome.properties +18 -0
  172. data/public/universalviewer/dist/uv-2.0.1/l10n/nso/viewer.properties +123 -0
  173. data/public/universalviewer/dist/uv-2.0.1/l10n/oc/chrome.properties +19 -0
  174. data/public/universalviewer/dist/uv-2.0.1/l10n/oc/viewer.properties +161 -0
  175. data/public/universalviewer/dist/uv-2.0.1/l10n/or/chrome.properties +18 -0
  176. data/public/universalviewer/dist/uv-2.0.1/l10n/or/viewer.properties +139 -0
  177. data/public/universalviewer/dist/uv-2.0.1/l10n/pa-IN/chrome.properties +10 -0
  178. data/public/universalviewer/dist/uv-2.0.1/l10n/pa-IN/viewer.properties +175 -0
  179. data/public/universalviewer/dist/uv-2.0.1/l10n/pl/chrome.properties +9 -0
  180. data/public/universalviewer/dist/uv-2.0.1/l10n/pl/viewer.properties +149 -0
  181. data/public/universalviewer/dist/uv-2.0.1/l10n/pt-BR/chrome.properties +19 -0
  182. data/public/universalviewer/dist/uv-2.0.1/l10n/pt-BR/viewer.properties +161 -0
  183. data/public/universalviewer/dist/uv-2.0.1/l10n/pt-PT/chrome.properties +19 -0
  184. data/public/universalviewer/dist/uv-2.0.1/l10n/pt-PT/viewer.properties +166 -0
  185. data/public/universalviewer/dist/uv-2.0.1/l10n/rm/chrome.properties +8 -0
  186. data/public/universalviewer/dist/uv-2.0.1/l10n/rm/viewer.properties +127 -0
  187. data/public/universalviewer/dist/uv-2.0.1/l10n/ro/chrome.properties +27 -0
  188. data/public/universalviewer/dist/uv-2.0.1/l10n/ro/viewer.properties +156 -0
  189. data/public/universalviewer/dist/uv-2.0.1/l10n/ru/chrome.properties +8 -0
  190. data/public/universalviewer/dist/uv-2.0.1/l10n/ru/viewer.properties +107 -0
  191. data/public/universalviewer/dist/uv-2.0.1/l10n/rw/chrome.properties +18 -0
  192. data/public/universalviewer/dist/uv-2.0.1/l10n/rw/viewer.properties +123 -0
  193. data/public/universalviewer/dist/uv-2.0.1/l10n/sah/chrome.properties +18 -0
  194. data/public/universalviewer/dist/uv-2.0.1/l10n/sah/viewer.properties +122 -0
  195. data/public/universalviewer/dist/uv-2.0.1/l10n/si/chrome.properties +17 -0
  196. data/public/universalviewer/dist/uv-2.0.1/l10n/si/viewer.properties +98 -0
  197. data/public/universalviewer/dist/uv-2.0.1/l10n/sk/chrome.properties +19 -0
  198. data/public/universalviewer/dist/uv-2.0.1/l10n/sk/viewer.properties +161 -0
  199. data/public/universalviewer/dist/uv-2.0.1/l10n/sl/chrome.properties +8 -0
  200. data/public/universalviewer/dist/uv-2.0.1/l10n/sl/viewer.properties +136 -0
  201. data/public/universalviewer/dist/uv-2.0.1/l10n/son/chrome.properties +18 -0
  202. data/public/universalviewer/dist/uv-2.0.1/l10n/son/viewer.properties +120 -0
  203. data/public/universalviewer/dist/uv-2.0.1/l10n/sq/chrome.properties +19 -0
  204. data/public/universalviewer/dist/uv-2.0.1/l10n/sq/viewer.properties +160 -0
  205. data/public/universalviewer/dist/uv-2.0.1/l10n/sr/chrome.properties +18 -0
  206. data/public/universalviewer/dist/uv-2.0.1/l10n/sr/viewer.properties +123 -0
  207. data/public/universalviewer/dist/uv-2.0.1/l10n/sv-SE/chrome.properties +19 -0
  208. data/public/universalviewer/dist/uv-2.0.1/l10n/sv-SE/viewer.properties +161 -0
  209. data/public/universalviewer/dist/uv-2.0.1/l10n/sw/chrome.properties +18 -0
  210. data/public/universalviewer/dist/uv-2.0.1/l10n/sw/viewer.properties +121 -0
  211. data/public/universalviewer/dist/uv-2.0.1/l10n/ta-LK/chrome.properties +3 -0
  212. data/public/universalviewer/dist/uv-2.0.1/l10n/ta-LK/viewer.properties +50 -0
  213. data/public/universalviewer/dist/uv-2.0.1/l10n/ta/chrome.properties +19 -0
  214. data/public/universalviewer/dist/uv-2.0.1/l10n/ta/viewer.properties +161 -0
  215. data/public/universalviewer/dist/uv-2.0.1/l10n/te/chrome.properties +18 -0
  216. data/public/universalviewer/dist/uv-2.0.1/l10n/te/viewer.properties +145 -0
  217. data/public/universalviewer/dist/uv-2.0.1/l10n/th/chrome.properties +19 -0
  218. data/public/universalviewer/dist/uv-2.0.1/l10n/th/viewer.properties +161 -0
  219. data/public/universalviewer/dist/uv-2.0.1/l10n/tl/chrome.properties +17 -0
  220. data/public/universalviewer/dist/uv-2.0.1/l10n/tl/viewer.properties +83 -0
  221. data/public/universalviewer/dist/uv-2.0.1/l10n/tn/chrome.properties +15 -0
  222. data/public/universalviewer/dist/uv-2.0.1/l10n/tn/viewer.properties +68 -0
  223. data/public/universalviewer/dist/uv-2.0.1/l10n/tr/chrome.properties +19 -0
  224. data/public/universalviewer/dist/uv-2.0.1/l10n/tr/viewer.properties +161 -0
  225. data/public/universalviewer/dist/uv-2.0.1/l10n/uk/chrome.properties +18 -0
  226. data/public/universalviewer/dist/uv-2.0.1/l10n/uk/viewer.properties +136 -0
  227. data/public/universalviewer/dist/uv-2.0.1/l10n/ur/chrome.properties +19 -0
  228. data/public/universalviewer/dist/uv-2.0.1/l10n/ur/viewer.properties +161 -0
  229. data/public/universalviewer/dist/uv-2.0.1/l10n/vi/chrome.properties +18 -0
  230. data/public/universalviewer/dist/uv-2.0.1/l10n/vi/viewer.properties +120 -0
  231. data/public/universalviewer/dist/uv-2.0.1/l10n/wo/chrome.properties +18 -0
  232. data/public/universalviewer/dist/uv-2.0.1/l10n/wo/viewer.properties +116 -0
  233. data/public/universalviewer/dist/uv-2.0.1/l10n/xh/chrome.properties +19 -0
  234. data/public/universalviewer/dist/uv-2.0.1/l10n/xh/viewer.properties +161 -0
  235. data/public/universalviewer/dist/uv-2.0.1/l10n/zh-CN/chrome.properties +19 -0
  236. data/public/universalviewer/dist/uv-2.0.1/l10n/zh-CN/viewer.properties +161 -0
  237. data/public/universalviewer/dist/uv-2.0.1/l10n/zh-TW/chrome.properties +20 -0
  238. data/public/universalviewer/dist/uv-2.0.1/l10n/zh-TW/viewer.properties +162 -0
  239. data/public/universalviewer/dist/uv-2.0.1/l10n/zu/chrome.properties +18 -0
  240. data/public/universalviewer/dist/uv-2.0.1/l10n/zu/viewer.properties +124 -0
  241. data/public/universalviewer/dist/uv-2.0.1/lib/Detector.js +67 -0
  242. data/public/universalviewer/dist/uv-2.0.1/lib/README.md +9 -0
  243. data/public/universalviewer/dist/uv-2.0.1/lib/app.js +9 -0
  244. data/public/universalviewer/dist/uv-2.0.1/lib/bundle.min.js +11 -0
  245. data/public/universalviewer/dist/uv-2.0.1/lib/compatibility.js +559 -0
  246. data/public/universalviewer/dist/uv-2.0.1/lib/embed.js +553 -0
  247. data/public/universalviewer/dist/uv-2.0.1/lib/flashmediaelement.swf +0 -0
  248. data/public/universalviewer/dist/uv-2.0.1/lib/iiif-gallery-component.js +475 -0
  249. data/public/universalviewer/dist/uv-2.0.1/lib/iiif-metadata-component.js +458 -0
  250. data/public/universalviewer/dist/uv-2.0.1/lib/iiif-tree-component.js +293 -0
  251. data/public/universalviewer/dist/uv-2.0.1/lib/l10n.js +1007 -0
  252. data/public/universalviewer/dist/uv-2.0.1/lib/mediaelement-and-player.js +4288 -0
  253. data/public/universalviewer/dist/uv-2.0.1/lib/openseadragon.min.js +15 -0
  254. data/public/universalviewer/dist/uv-2.0.1/lib/pdf.js +8568 -0
  255. data/public/universalviewer/dist/uv-2.0.1/lib/pdf.min.js +197 -0
  256. data/public/universalviewer/dist/uv-2.0.1/lib/pdf.worker.js +42400 -0
  257. data/public/universalviewer/dist/uv-2.0.1/lib/pdf.worker.min.js +891 -0
  258. data/public/universalviewer/dist/uv-2.0.1/lib/pdf_combined.js +937 -0
  259. data/public/universalviewer/dist/uv-2.0.1/lib/pdfobject.js +250 -0
  260. data/public/universalviewer/dist/uv-2.0.1/lib/stats.min.js +7 -0
  261. data/public/universalviewer/dist/uv-2.0.1/lib/three.min.js +870 -0
  262. data/public/universalviewer/dist/uv-2.0.1/lib/uv-mediaelement-extension-dependencies.js +5 -0
  263. data/public/universalviewer/dist/uv-2.0.1/lib/uv-mediaelement-extension.cy-GB.config.json +1 -0
  264. data/public/universalviewer/dist/uv-2.0.1/lib/uv-mediaelement-extension.en-GB.config.json +1 -0
  265. data/public/universalviewer/dist/uv-2.0.1/lib/uv-pdf-extension-dependencies.js +5 -0
  266. data/public/universalviewer/dist/uv-2.0.1/lib/uv-pdf-extension.cy-GB.config.json +1 -0
  267. data/public/universalviewer/dist/uv-2.0.1/lib/uv-pdf-extension.en-GB.config.json +1 -0
  268. data/public/universalviewer/dist/uv-2.0.1/lib/uv-seadragon-extension-dependencies.js +5 -0
  269. data/public/universalviewer/dist/uv-2.0.1/lib/uv-seadragon-extension.cy-GB.config.json +1 -0
  270. data/public/universalviewer/dist/uv-2.0.1/lib/uv-seadragon-extension.en-GB.config.json +1 -0
  271. data/public/universalviewer/dist/uv-2.0.1/lib/uv-virtex-extension-dependencies.js +5 -0
  272. data/public/universalviewer/dist/uv-2.0.1/lib/uv-virtex-extension.cy-GB.config.json +1 -0
  273. data/public/universalviewer/dist/uv-2.0.1/lib/uv-virtex-extension.en-GB.config.json +1 -0
  274. data/public/universalviewer/dist/uv-2.0.1/lib/viewer.js +5861 -0
  275. data/public/universalviewer/dist/uv-2.0.1/lib/viewer.min.js +178 -0
  276. data/public/universalviewer/dist/uv-2.0.1/lib/virtex.js +343 -0
  277. data/public/universalviewer/dist/uv-2.0.1/package.json +70 -0
  278. data/public/universalviewer/dist/uv-2.0.1/schema/uv-mediaelement-extension.cy-GB.schema.json +1 -0
  279. data/public/universalviewer/dist/uv-2.0.1/schema/uv-mediaelement-extension.en-GB.schema.json +1 -0
  280. data/public/universalviewer/dist/uv-2.0.1/schema/uv-pdf-extension.cy-GB.schema.json +1 -0
  281. data/public/universalviewer/dist/uv-2.0.1/schema/uv-pdf-extension.en-GB.schema.json +1 -0
  282. data/public/universalviewer/dist/uv-2.0.1/schema/uv-seadragon-extension.cy-GB.schema.json +1 -0
  283. data/public/universalviewer/dist/uv-2.0.1/schema/uv-seadragon-extension.en-GB.schema.json +1 -0
  284. data/public/universalviewer/dist/uv-2.0.1/schema/uv-virtex-extension.cy-GB.schema.json +1 -0
  285. data/public/universalviewer/dist/uv-2.0.1/schema/uv-virtex-extension.en-GB.schema.json +1 -0
  286. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-mediaelement-extension/theme.css +3178 -0
  287. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-pdf-extension/theme.css +4044 -0
  288. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-seadragon-extension/theme.css +3185 -0
  289. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/css/uv-virtex-extension/theme.css +2455 -0
  290. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-contentleftpanel-module/padlock.png +0 -0
  291. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-contentleftpanel-module/thumb_placeholder.png +0 -0
  292. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-mediaelementcenterpanel-module/bigplay.png +0 -0
  293. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-mediaelementcenterpanel-module/controls-wellcome-bg.png +0 -0
  294. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-mediaelementcenterpanel-module/controls-wellcome.png +0 -0
  295. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-mediaelementcenterpanel-module/loading.gif +0 -0
  296. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-moreinforightpanel-module/copy.png +0 -0
  297. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-osdmobilefooterpanel-module/rotate_right.png +0 -0
  298. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-osdmobilefooterpanel-module/zoom_in.png +0 -0
  299. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-osdmobilefooterpanel-module/zoom_out.png +0 -0
  300. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/first.png +0 -0
  301. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/grid.png +0 -0
  302. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/last.png +0 -0
  303. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/next.png +0 -0
  304. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/one_up.png +0 -0
  305. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/prev.png +0 -0
  306. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/settings.png +0 -0
  307. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pagingheaderpanel-module/two_up.png +0 -0
  308. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-check.svg +11 -0
  309. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-comment.svg +16 -0
  310. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-help.svg +26 -0
  311. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-insert.svg +10 -0
  312. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-key.svg +11 -0
  313. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-newparagraph.svg +11 -0
  314. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-noicon.svg +7 -0
  315. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-note.svg +42 -0
  316. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/annotation-paragraph.svg +16 -0
  317. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next-rtl.png +0 -0
  318. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next-rtl@2x.png +0 -0
  319. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next.png +0 -0
  320. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next@2x.png +0 -0
  321. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous-rtl.png +0 -0
  322. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous-rtl@2x.png +0 -0
  323. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous.png +0 -0
  324. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous@2x.png +0 -0
  325. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/grab.cur +0 -0
  326. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/grabbing.cur +0 -0
  327. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/loading-icon.gif +0 -0
  328. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/loading-small.png +0 -0
  329. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-documentProperties.png +0 -0
  330. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-documentProperties@2x.png +0 -0
  331. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-firstPage.png +0 -0
  332. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-firstPage@2x.png +0 -0
  333. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-handTool.png +0 -0
  334. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-handTool@2x.png +0 -0
  335. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-lastPage.png +0 -0
  336. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-lastPage@2x.png +0 -0
  337. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCcw.png +0 -0
  338. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCcw@2x.png +0 -0
  339. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCw.png +0 -0
  340. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCw@2x.png +0 -0
  341. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/shadow.png +0 -0
  342. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/texture.png +0 -0
  343. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-bookmark.png +0 -0
  344. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-bookmark@2x.png +0 -0
  345. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-download.png +0 -0
  346. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-download@2x.png +0 -0
  347. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-menuArrows.png +0 -0
  348. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-menuArrows@2x.png +0 -0
  349. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-openFile.png +0 -0
  350. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-openFile@2x.png +0 -0
  351. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown-rtl.png +0 -0
  352. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown-rtl@2x.png +0 -0
  353. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown.png +0 -0
  354. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown@2x.png +0 -0
  355. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp-rtl.png +0 -0
  356. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp-rtl@2x.png +0 -0
  357. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp.png +0 -0
  358. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp@2x.png +0 -0
  359. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-presentationMode.png +0 -0
  360. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-presentationMode@2x.png +0 -0
  361. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-print.png +0 -0
  362. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-print@2x.png +0 -0
  363. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-search.png +0 -0
  364. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-search@2x.png +0 -0
  365. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle-rtl.png +0 -0
  366. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle-rtl@2x.png +0 -0
  367. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle.png +0 -0
  368. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle@2x.png +0 -0
  369. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle-rtl.png +0 -0
  370. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle-rtl@2x.png +0 -0
  371. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle.png +0 -0
  372. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle@2x.png +0 -0
  373. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewAttachments.png +0 -0
  374. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline-rtl.png +0 -0
  375. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline-rtl@2x.png +0 -0
  376. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline.png +0 -0
  377. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline@2x.png +0 -0
  378. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewThumbnail.png +0 -0
  379. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewThumbnail@2x.png +0 -0
  380. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomIn.png +0 -0
  381. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomIn@2x.png +0 -0
  382. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomOut.png +0 -0
  383. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomOut@2x.png +0 -0
  384. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/down_arrow.png +0 -0
  385. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/down_arrow_disabled.png +0 -0
  386. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/home.png +0 -0
  387. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/left_arrow.png +0 -0
  388. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/left_arrow_disabled.png +0 -0
  389. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/pixel.gif +0 -0
  390. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/right_arrow.png +0 -0
  391. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/right_arrow_disabled.png +0 -0
  392. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/rotate_right.png +0 -0
  393. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/up_arrow.png +0 -0
  394. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/up_arrow_disabled.png +0 -0
  395. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/zoom_in.png +0 -0
  396. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-seadragoncenterpanel-module/zoom_out.png +0 -0
  397. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/next.png +0 -0
  398. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/placemarker_down.png +0 -0
  399. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/placemarker_down_hover.png +0 -0
  400. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/placemarker_up.png +0 -0
  401. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/prev.png +0 -0
  402. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/search.png +0 -0
  403. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-searchfooterpanel-module/spinner.gif +0 -0
  404. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/arrows_left.png +0 -0
  405. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/arrows_right.png +0 -0
  406. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/bookmark.png +0 -0
  407. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/close.png +0 -0
  408. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/close_attribution.png +0 -0
  409. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/close_information_box.png +0 -0
  410. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/close_message_box.png +0 -0
  411. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/copy.png +0 -0
  412. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/dialogue_arrow.png +0 -0
  413. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/download.png +0 -0
  414. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/embed.png +0 -0
  415. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/error.png +0 -0
  416. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/exit_fullscreen.png +0 -0
  417. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/feedback.png +0 -0
  418. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/fullscreen.png +0 -0
  419. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/hidden_thumb.png +0 -0
  420. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/iiif.png +0 -0
  421. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/minus.png +0 -0
  422. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/modal_bg.gif +0 -0
  423. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/moreinfo.png +0 -0
  424. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/open.png +0 -0
  425. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/plus.png +0 -0
  426. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/print.png +0 -0
  427. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/search_result.png +0 -0
  428. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/settings.png +0 -0
  429. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/share.png +0 -0
  430. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/sprite.png +0 -0
  431. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-shared-module/unavailable.png +0 -0
  432. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-virtexcenterpanel-module/zoom_in.png +0 -0
  433. data/public/universalviewer/dist/uv-2.0.1/themes/uv-cy-GB-theme/img/uv-virtexcenterpanel-module/zoom_out.png +0 -0
  434. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-mediaelement-extension/theme.css +3172 -0
  435. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-pdf-extension/theme.css +4035 -0
  436. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-seadragon-extension/theme.css +3178 -0
  437. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/css/uv-virtex-extension/theme.css +2448 -0
  438. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/hamburger.png +0 -0
  439. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-contentleftpanel-module/padlock.png +0 -0
  440. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-contentleftpanel-module/thumb_placeholder.png +0 -0
  441. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-mediaelementcenterpanel-module/bigplay.png +0 -0
  442. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-mediaelementcenterpanel-module/controls-wellcome-bg.png +0 -0
  443. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-mediaelementcenterpanel-module/controls-wellcome.png +0 -0
  444. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-mediaelementcenterpanel-module/loading.gif +0 -0
  445. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-moreinforightpanel-module/copy.png +0 -0
  446. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-osdmobilefooterpanel-module/rotate_right.png +0 -0
  447. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-osdmobilefooterpanel-module/zoom_in.png +0 -0
  448. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-osdmobilefooterpanel-module/zoom_out.png +0 -0
  449. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/first.png +0 -0
  450. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/grid.png +0 -0
  451. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/last.png +0 -0
  452. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/next.png +0 -0
  453. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/one_up.png +0 -0
  454. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/prev.png +0 -0
  455. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/settings.png +0 -0
  456. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pagingheaderpanel-module/two_up.png +0 -0
  457. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-check.svg +11 -0
  458. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-comment.svg +16 -0
  459. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-help.svg +26 -0
  460. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-insert.svg +10 -0
  461. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-key.svg +11 -0
  462. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-newparagraph.svg +11 -0
  463. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-noicon.svg +7 -0
  464. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-note.svg +42 -0
  465. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/annotation-paragraph.svg +16 -0
  466. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next-rtl.png +0 -0
  467. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next-rtl@2x.png +0 -0
  468. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next.png +0 -0
  469. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-next@2x.png +0 -0
  470. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous-rtl.png +0 -0
  471. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous-rtl@2x.png +0 -0
  472. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous.png +0 -0
  473. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/findbarButton-previous@2x.png +0 -0
  474. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/grab.cur +0 -0
  475. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/grabbing.cur +0 -0
  476. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/loading-icon.gif +0 -0
  477. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/loading-small.png +0 -0
  478. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-documentProperties.png +0 -0
  479. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-documentProperties@2x.png +0 -0
  480. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-firstPage.png +0 -0
  481. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-firstPage@2x.png +0 -0
  482. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-handTool.png +0 -0
  483. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-handTool@2x.png +0 -0
  484. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-lastPage.png +0 -0
  485. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-lastPage@2x.png +0 -0
  486. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCcw.png +0 -0
  487. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCcw@2x.png +0 -0
  488. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCw.png +0 -0
  489. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/secondaryToolbarButton-rotateCw@2x.png +0 -0
  490. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/shadow.png +0 -0
  491. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/texture.png +0 -0
  492. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-bookmark.png +0 -0
  493. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-bookmark@2x.png +0 -0
  494. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-download.png +0 -0
  495. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-download@2x.png +0 -0
  496. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-menuArrows.png +0 -0
  497. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-menuArrows@2x.png +0 -0
  498. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-openFile.png +0 -0
  499. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-openFile@2x.png +0 -0
  500. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown-rtl.png +0 -0
  501. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown-rtl@2x.png +0 -0
  502. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown.png +0 -0
  503. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageDown@2x.png +0 -0
  504. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp-rtl.png +0 -0
  505. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp-rtl@2x.png +0 -0
  506. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp.png +0 -0
  507. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-pageUp@2x.png +0 -0
  508. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-presentationMode.png +0 -0
  509. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-presentationMode@2x.png +0 -0
  510. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-print.png +0 -0
  511. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-print@2x.png +0 -0
  512. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-search.png +0 -0
  513. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-search@2x.png +0 -0
  514. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle-rtl.png +0 -0
  515. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle-rtl@2x.png +0 -0
  516. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle.png +0 -0
  517. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-secondaryToolbarToggle@2x.png +0 -0
  518. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle-rtl.png +0 -0
  519. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle-rtl@2x.png +0 -0
  520. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle.png +0 -0
  521. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-sidebarToggle@2x.png +0 -0
  522. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewAttachments.png +0 -0
  523. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline-rtl.png +0 -0
  524. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline-rtl@2x.png +0 -0
  525. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline.png +0 -0
  526. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewOutline@2x.png +0 -0
  527. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewThumbnail.png +0 -0
  528. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-viewThumbnail@2x.png +0 -0
  529. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomIn.png +0 -0
  530. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomIn@2x.png +0 -0
  531. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomOut.png +0 -0
  532. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-pdfcenterpanel-module/toolbarButton-zoomOut@2x.png +0 -0
  533. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/down_arrow.png +0 -0
  534. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/down_arrow_disabled.png +0 -0
  535. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/home.png +0 -0
  536. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/left_arrow.png +0 -0
  537. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/left_arrow_disabled.png +0 -0
  538. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/pixel.gif +0 -0
  539. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/right_arrow.png +0 -0
  540. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/right_arrow_disabled.png +0 -0
  541. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/rotate_right.png +0 -0
  542. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/up_arrow.png +0 -0
  543. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/up_arrow_disabled.png +0 -0
  544. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/zoom_in.png +0 -0
  545. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-seadragoncenterpanel-module/zoom_out.png +0 -0
  546. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/next.png +0 -0
  547. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/placemarker_down.png +0 -0
  548. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/placemarker_down_hover.png +0 -0
  549. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/placemarker_up.png +0 -0
  550. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/prev.png +0 -0
  551. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/search.png +0 -0
  552. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-searchfooterpanel-module/spinner.gif +0 -0
  553. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/arrows_left.png +0 -0
  554. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/arrows_right.png +0 -0
  555. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/bookmark.png +0 -0
  556. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/close.png +0 -0
  557. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/close_attribution.png +0 -0
  558. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/close_information_box.png +0 -0
  559. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/close_message_box.png +0 -0
  560. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/copy.png +0 -0
  561. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/dialogue_arrow.png +0 -0
  562. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/download.png +0 -0
  563. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/embed.png +0 -0
  564. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/error.png +0 -0
  565. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/exit_fullscreen.png +0 -0
  566. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/feedback.png +0 -0
  567. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/fullscreen.png +0 -0
  568. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/hidden_thumb.png +0 -0
  569. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/iiif.png +0 -0
  570. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/minus.png +0 -0
  571. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/modal_bg.gif +0 -0
  572. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/moreinfo.png +0 -0
  573. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/open.png +0 -0
  574. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/plus.png +0 -0
  575. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/print.png +0 -0
  576. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/search_result.png +0 -0
  577. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/settings.png +0 -0
  578. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/share.png +0 -0
  579. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/sprite.png +0 -0
  580. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-shared-module/unavailable.png +0 -0
  581. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-virtexcenterpanel-module/zoom_in.png +0 -0
  582. data/public/universalviewer/dist/uv-2.0.1/themes/uv-en-GB-theme/img/uv-virtexcenterpanel-module/zoom_out.png +0 -0
  583. data/public/universalviewer/favicon.ico +0 -0
  584. data/public/universalviewer/gulpfile.js +13 -0
  585. data/public/universalviewer/package.json +70 -0
  586. data/public/universalviewer/typings.json +20 -0
  587. data/pul_uv_rails.gemspec +26 -0
  588. metadata +687 -0
@@ -0,0 +1,18 @@
1
+ # Copyright 2012 Mozilla Foundation
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Chrome notification bar messages and buttons
16
+ unsupported_feature=Leli dokhumenti le-PDF lingahle lingaboniswa kahle.
17
+ open_with_different_viewer=Vula ngesibuki esihlukile
18
+ open_with_different_viewer.accessKey=v
@@ -0,0 +1,124 @@
1
+ # Copyright 2012 Mozilla Foundation
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Main toolbar buttons (tooltips and alt text for images)
16
+ previous.title=Ikhasi eledlule
17
+ previous_label=Okudlule
18
+ next.title=Ikhasi elilandelayo
19
+ next_label=Okulandelayo
20
+
21
+ # LOCALIZATION NOTE (page_label, page_of):
22
+ # These strings are concatenated to form the "Page: X of Y" string.
23
+ # Do not translate "{{pageCount}}", it will be substituted with a number
24
+ # representing the total number of pages.
25
+ page_label=Ikhasi:
26
+ page_of=kwe-{{pageCount}}
27
+
28
+ zoom_out.title=Hlehlisela emuva
29
+ zoom_out_label=Hlehlisela emuva
30
+ zoom_in.title=Sondeza eduze
31
+ zoom_in_label=Sondeza eduze
32
+ zoom.title=Lwiza
33
+ print.title=Phrinta
34
+ print_label=Phrinta
35
+ presentation_mode.title=Guqulela kwindlela yesethulo
36
+ presentation_mode_label=Indlelo yesethulo
37
+ open_file.title=Vula ifayela
38
+ open_file_label=Vula
39
+ download.title=Landa
40
+ download_label=Landa
41
+ bookmark.title=Ukubuka kwamanje (kopisha noma vula kwifasitela elisha)
42
+ bookmark_label=Ukubuka kwamanje
43
+
44
+ # Tooltips and alt text for side panel toolbar buttons
45
+ # (the _label strings are alt text for the buttons, the .title strings are
46
+ # tooltips)
47
+ toggle_sidebar.title=I-toggle yebha yaseceleni
48
+ toggle_sidebar_label=i-toggle yebha yaseceleni
49
+ outline.title=Bonisa umugqa waseceleni wedokhumenti
50
+ outline_label=Umugqa waseceleni wedokhumenti
51
+ thumbs.title=Bonisa izithombe ezincane
52
+ thumbs_label=Izithonjana
53
+ findbar.title=Thola kwidokhumenti
54
+ findbar_label=Thola
55
+
56
+ # Thumbnails panel item (tooltip and alt text for images)
57
+ # LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
58
+ # number.
59
+ thumb_page_title=Ikhasi {{page}}
60
+ # LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page
61
+ # number.
62
+ thumb_page_canvas=Isithonjana sekhasi {{page}}
63
+
64
+ # Context menu
65
+ first_page.label=Yiya kwikhasi lokuqala
66
+ last_page.label=Yiya kwikhasi lokugcina
67
+ page_rotate_cw.label=Jikisela ngendlela yewashi
68
+ page_rotate_ccw.label=Jikisela kwelokudla
69
+
70
+ # Find panel button title and messages
71
+ find_label=Thola
72
+ find_previous.title=Thola indawo eyandulelayo okuvela kuyo lomshwana
73
+ find_previous_label=Okudlulile
74
+ find_next.title=Thola enye indawo okuvela kuyo lomshwana
75
+ find_next_label=Okulandelayo
76
+ find_highlight=Gqamisa konke
77
+ find_match_case_label=Fanisa ikheyisi
78
+ find_reached_top=Finyelele phezulu kwidokhumenti, qhubeka kusukaphansi
79
+ find_reached_bottom=Ifinyelele ekupheleni kwedokhumenti, qhubeka kusukaphezulu
80
+ find_not_found=Umshwana awutholakali
81
+
82
+ # Error panel labels
83
+ error_more_info=Ukwaziswa Okwengeziwe
84
+ error_less_info=Ukwazi okuncane
85
+ error_close=Vala
86
+ # LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
87
+ # replaced by the PDF.JS version and build ID.
88
+ error_version_info=PDF.js v{{version}} (build: {{build}})
89
+ # LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
90
+ # english string describing the error.
91
+ error_message=Umlayezo: {{message}}
92
+ # LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
93
+ # trace.
94
+ error_stack=Isitaki: {{stack}}
95
+ # LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
96
+ error_file=Ifayela: {{file}}
97
+ # LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
98
+ error_line=Umugqa: {{line}}
99
+ rendering_error=Iphutha lenzekile uma kunikwa ikhasi.
100
+
101
+ # Predefined zoom values
102
+ page_scale_width=Ububanzi bekhasi
103
+ page_scale_fit=Ukulingana kwekhasi
104
+ page_scale_auto=Ukulwiza okuzenzekalelayo
105
+ page_scale_actual=Usayizi Wangempela
106
+
107
+ # Loading indicator messages
108
+ loading_error_indicator=Iphutha
109
+ loading_error=Kwenzeke iphutha uma kulayishwa i-PDF.
110
+ invalid_file_error=Ifayela le-PDF elingavumelekile noma elonakele.
111
+ missing_file_error=Ifayela le-PDF elilahlekile.
112
+
113
+ # LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
114
+ # "{{type}}" will be replaced with an annotation type from a list defined in
115
+ # the PDF spec (32000-1:2008 Table 169 – Annotation types).
116
+ # Some common types are e.g.: "Check", "Text", "Comment", "Note"
117
+ text_annotation_type.alt=[Amazwibela e-{{type}}]
118
+ request_password=I-PDF ivikeleke ngephasiwedi
119
+ invalid_password=Iphasiwedi Engavumelekile.
120
+
121
+ printing_not_supported=Isixwayiso: Ukuphrinta akuxhasiwe yilesisiphequluli ngokugcwele.
122
+ printing_not_ready=Isixwayiso: I-PDF ayikalayishwa ngokuphelele yiPhrinta.
123
+ web_fonts_disabled=Amafonti e-webhu akutshaziwe: ayikwazi ukusebenzisa amafonti abekiwe e-PDF.
124
+ document_colors_disabled=Amadokhumenti we-PDF awavumelekile ukusebenzisa imibalo yayo: 'Vumela amakhasi ukukhetha imibala yayo' ayisebenzi kusiphequluli.
@@ -0,0 +1,67 @@
1
+
2
+ /**
3
+ * @author alteredq / http://alteredqualia.com/
4
+ * @author mr.doob / http://mrdoob.com/
5
+ */
6
+
7
+ var Detector = {
8
+
9
+ canvas: !! window.CanvasRenderingContext2D,
10
+ webgl: ( function () { try { var canvas = document.createElement( 'canvas' ); return !! ( window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ) ); } catch ( e ) { return false; } } )(),
11
+ workers: !! window.Worker,
12
+ fileapi: window.File && window.FileReader && window.FileList && window.Blob,
13
+
14
+ getWebGLErrorMessage: function () {
15
+
16
+ var element = document.createElement( 'div' );
17
+ element.id = 'webgl-error-message';
18
+ element.style.fontFamily = 'monospace';
19
+ element.style.fontSize = '13px';
20
+ element.style.fontWeight = 'normal';
21
+ element.style.textAlign = 'center';
22
+ element.style.background = '#fff';
23
+ element.style.color = '#000';
24
+ element.style.padding = '1.5em';
25
+ element.style.width = '400px';
26
+ element.style.margin = '5em auto 0';
27
+
28
+ if ( ! this.webgl ) {
29
+
30
+ element.innerHTML = window.WebGLRenderingContext ? [
31
+ 'Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br />',
32
+ 'Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'
33
+ ].join( '\n' ) : [
34
+ 'Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">WebGL</a>.<br/>',
35
+ 'Find out how to get it <a href="http://get.webgl.org/" style="color:#000">here</a>.'
36
+ ].join( '\n' );
37
+
38
+ }
39
+
40
+ return element;
41
+
42
+ },
43
+
44
+ addGetWebGLMessage: function ( parameters ) {
45
+
46
+ var parent, id, element;
47
+
48
+ parameters = parameters || {};
49
+
50
+ parent = parameters.parent !== undefined ? parameters.parent : document.body;
51
+ id = parameters.id !== undefined ? parameters.id : 'oldie';
52
+
53
+ element = Detector.getWebGLErrorMessage();
54
+ element.id = id;
55
+
56
+ parent.appendChild( element );
57
+
58
+ }
59
+
60
+ };
61
+
62
+ // browserify support
63
+ if ( typeof module === 'object' ) {
64
+
65
+ module.exports = Detector;
66
+
67
+ }
@@ -0,0 +1,9 @@
1
+ ## minifying pdf.js
2
+
3
+ https://github.com/DanielRuf/pdf.daniel-ruf.de/blob/master/README.md
4
+
5
+ java -jar C:\google-closure\compiler.jar --language_in=ECMASCRIPT5 --compilation_level SIMPLE_OPTIMIZATIONS --js viewer.js --js_output_file viewer.min.js
6
+ java -jar C:\google-closure\compiler.jar --language_in=ECMASCRIPT5 --compilation_level SIMPLE_OPTIMIZATIONS --js pdf.js --js_output_file pdf.min.js
7
+ java -jar C:\google-closure\compiler.jar --language_in=ECMASCRIPT5 --compilation_level SIMPLE_OPTIMIZATIONS --js pdf.worker.js --js_output_file pdf.worker.min.js
8
+
9
+ (use full path C:\google-closure\compiler.jar)
@@ -0,0 +1,9 @@
1
+ var requirejs,require,define;!function(global){function commentReplace(e,t,i,n){return n||""}function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var i;for(i=0;i<e.length&&(!e[i]||!t(e[i],i,e));i+=1);}}function eachReverse(e,t){if(e){var i;for(i=e.length-1;i>-1&&(!e[i]||!t(e[i],i,e));i-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var i;for(i in e)if(hasProp(e,i)&&t(e[i],i))break}function mixin(e,t,i,n){return t&&eachProp(t,function(t,o){(i||!hasProp(e,o))&&(!n||"object"!=typeof t||!t||isArray(t)||isFunction(t)||t instanceof RegExp?e[o]=t:(e[o]||(e[o]={}),mixin(e[o],t,i,n)))}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,i,n){var o=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return o.requireType=e,o.requireModules=n,i&&(o.originalError=i),o}function newContext(e){function t(e){var t,i;for(t=0;t<e.length;t++)if(i=e[t],"."===i)e.splice(t,1),t-=1;else if(".."===i){if(0===t||1===t&&".."===e[2]||".."===e[t-1])continue;t>0&&(e.splice(t-1,2),t-=2)}}function i(e,i,n){var o,s,r,a,l,h,c,u,p,d,g,f,m=i&&i.split("/"),v=x.map,$=v&&v["*"];if(e&&(e=e.split("/"),c=e.length-1,x.nodeIdCompat&&jsSuffixRegExp.test(e[c])&&(e[c]=e[c].replace(jsSuffixRegExp,"")),"."===e[0].charAt(0)&&m&&(f=m.slice(0,m.length-1),e=f.concat(e)),t(e),e=e.join("/")),n&&v&&(m||$)){r=e.split("/");e:for(a=r.length;a>0;a-=1){if(h=r.slice(0,a).join("/"),m)for(l=m.length;l>0;l-=1)if(s=getOwn(v,m.slice(0,l).join("/")),s&&(s=getOwn(s,h))){u=s,p=a;break e}!d&&$&&getOwn($,h)&&(d=getOwn($,h),g=a)}!u&&d&&(u=d,p=g),u&&(r.splice(0,p,u),e=r.join("/"))}return o=getOwn(x.pkgs,e),o?o:e}function n(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===E.contextName?(t.parentNode.removeChild(t),!0):void 0})}function o(e){var t=getOwn(x.paths,e);return t&&isArray(t)&&t.length>1?(t.shift(),E.require.undef(e),E.makeRequire(null,{skipMap:!0})([e]),!0):void 0}function s(e){var t,i=e?e.indexOf("!"):-1;return i>-1&&(t=e.substring(0,i),e=e.substring(i+1,e.length)),[t,e]}function r(e,t,n,o){var r,a,l,h,c=null,u=t?t.name:null,p=e,d=!0,g="";return e||(d=!1,e="_@r"+(D+=1)),h=s(e),c=h[0],e=h[1],c&&(c=i(c,u,o),a=getOwn(I,c)),e&&(c?g=a&&a.normalize?a.normalize(e,function(e){return i(e,u,o)}):-1===e.indexOf("!")?i(e,u,o):e:(g=i(e,u,o),h=s(g),c=h[0],g=h[1],n=!0,r=E.nameToUrl(g))),l=!c||a||n?"":"_unnormalized"+(A+=1),{prefix:c,name:g,parentMap:t,unnormalized:!!l,url:r,originalName:p,isDefine:d,id:(c?c+"!"+g:g)+l}}function a(e){var t=e.id,i=getOwn(w,t);return i||(i=w[t]=new E.Module(e)),i}function l(e,t,i){var n=e.id,o=getOwn(w,n);!hasProp(I,n)||o&&!o.defineEmitComplete?(o=a(e),o.error&&"error"===t?i(o.error):o.on(t,i)):"defined"===t&&i(I[n])}function h(e,t){var i=e.requireModules,n=!1;t?t(e):(each(i,function(t){var i=getOwn(w,t);i&&(i.error=e,i.events.error&&(n=!0,i.emit("error",e)))}),n||req.onError(e))}function c(){globalDefQueue.length&&(each(globalDefQueue,function(e){var t=e[0];"string"==typeof t&&(E.defQueueMap[t]=!0),R.push(e)}),globalDefQueue=[])}function u(e){delete w[e],delete S[e]}function p(e,t,i){var n=e.map.id;e.error?e.emit("error",e.error):(t[n]=!0,each(e.depMaps,function(n,o){var s=n.id,r=getOwn(w,s);!r||e.depMatched[o]||i[s]||(getOwn(t,s)?(e.defineDep(o,I[s]),e.check()):p(r,t,i))}),i[n]=!0)}function d(){var e,t,i=1e3*x.waitSeconds,s=i&&E.startTime+i<(new Date).getTime(),r=[],a=[],l=!1,c=!0;if(!$){if($=!0,eachProp(S,function(e){var i=e.map,h=i.id;if(e.enabled&&(i.isDefine||a.push(e),!e.error))if(!e.inited&&s)o(h)?(t=!0,l=!0):(r.push(h),n(h));else if(!e.inited&&e.fetched&&i.isDefine&&(l=!0,!i.prefix))return c=!1}),s&&r.length)return e=makeError("timeout","Load timeout for modules: "+r,null,r),e.contextName=E.contextName,h(e);c&&each(a,function(e){p(e,{},{})}),s&&!t||!l||!isBrowser&&!isWebWorker||y||(y=setTimeout(function(){y=0,d()},50)),$=!1}}function g(e){hasProp(I,e[0])||a(r(e[0],null,!0)).init(e[1],e[2])}function f(e,t,i,n){e.detachEvent&&!isOpera?n&&e.detachEvent(n,t):e.removeEventListener(i,t,!1)}function m(e){var t=e.currentTarget||e.srcElement;return f(t,E.onScriptLoad,"load","onreadystatechange"),f(t,E.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function v(){var e;for(c();R.length;){if(e=R.shift(),null===e[0])return h(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));g(e)}E.defQueueMap={}}var $,b,E,_,y,x={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},w={},S={},C={},R=[],I={},T={},O={},D=1,A=1;return _={require:function(e){return e.require?e.require:e.require=E.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?I[e.map.id]=e.exports:e.exports=I[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(x.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}},b=function(e){this.events=getOwn(C,e.id)||{},this.map=e,this.shim=getOwn(x.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},b.prototype={init:function(e,t,i,n){n=n||{},this.inited||(this.factory=t,i?this.on("error",i):this.events.error&&(i=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=i,this.inited=!0,this.ignore=n.ignore,n.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,E.startTime=(new Date).getTime();var e=this.map;return this.shim?void E.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;T[e]||(T[e]=!0,E.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,i=this.map.id,n=this.depExports,o=this.exports,s=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(s)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=E.execCb(i,s,n,o)}catch(r){e=r}else o=E.execCb(i,s,n,o);if(this.map.isDefine&&void 0===o&&(t=this.module,t?o=t.exports:this.usingExports&&(o=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",h(this.error=e)}else o=s;if(this.exports=o,this.map.isDefine&&!this.ignore&&(I[i]=o,req.onResourceLoad)){var a=[];each(this.depMaps,function(e){a.push(e.normalizedMap||e)}),req.onResourceLoad(E,this.map,a)}u(i),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(E.defQueueMap,i)||this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,n=r(e.prefix);this.depMaps.push(n),l(n,"defined",bind(this,function(n){var o,s,c,p=getOwn(O,this.map.id),d=this.map.name,g=this.map.parentMap?this.map.parentMap.name:null,f=E.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(n.normalize&&(d=n.normalize(d,function(e){return i(e,g,!0)})||""),s=r(e.prefix+"!"+d,this.map.parentMap),l(s,"defined",bind(this,function(e){this.map.normalizedMap=s,this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),c=getOwn(w,s.id),void(c&&(this.depMaps.push(s),this.events.error&&c.on("error",bind(this,function(e){this.emit("error",e)})),c.enable()))):p?(this.map.url=E.nameToUrl(p),void this.load()):(o=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),o.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(w,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&u(e.map.id)}),h(e)}),o.fromText=bind(this,function(i,n){var s=e.name,l=r(s),c=useInteractive;n&&(i=n),c&&(useInteractive=!1),a(l),hasProp(x.config,t)&&(x.config[s]=x.config[t]);try{req.exec(i)}catch(u){return h(makeError("fromtexteval","fromText eval for "+t+" failed: "+u,u,[t]))}c&&(useInteractive=!0),this.depMaps.push(l),E.completeLoad(s),f([s],o)}),void n.load(e.name,f,o,x))})),E.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){S[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var i,n,o;if("string"==typeof e){if(e=r(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(_,e.id))return void(this.depExports[t]=o(this));this.depCount+=1,l(e,"defined",bind(this,function(e){this.undefed||(this.defineDep(t,e),this.check())})),this.errback?l(e,"error",bind(this,this.errback)):this.events.error&&l(e,"error",bind(this,function(e){this.emit("error",e)}))}i=e.id,n=w[i],hasProp(_,i)||!n||n.enabled||E.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(w,e.id);t&&!t.enabled&&E.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var i=this.events[e];i||(i=this.events[e]=[]),i.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},E={config:x,contextName:e,registry:w,defined:I,urlFetched:T,defQueue:R,defQueueMap:{},Module:b,makeModuleMap:r,nextTick:req.nextTick,onError:h,configure:function(e){if(e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/"),"string"==typeof e.urlArgs){var t=e.urlArgs;e.urlArgs=function(e,i){return(-1===i.indexOf("?")?"?":"&")+t}}var i=x.shim,n={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(e,t){n[t]?(x[t]||(x[t]={}),mixin(x[t],e,!0,!0)):x[t]=e}),e.bundles&&eachProp(e.bundles,function(e,t){each(e,function(e){e!==t&&(O[e]=t)})}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=E.makeShimExports(e)),i[t]=e}),x.shim=i),e.packages&&each(e.packages,function(e){var t,i;e="string"==typeof e?{name:e}:e,i=e.name,t=e.location,t&&(x.paths[i]=e.location),x.pkgs[i]=e.name+"/"+(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(w,function(e,t){e.inited||e.map.unnormalized||(e.map=r(t,null,!0))}),(e.deps||e.callback)&&E.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,o){function s(i,n,l){var c,u,p;return o.enableBuildCallback&&n&&isFunction(n)&&(n.__requireJsBuild=!0),"string"==typeof i?isFunction(n)?h(makeError("requireargs","Invalid require call"),l):t&&hasProp(_,i)?_[i](w[t.id]):req.get?req.get(E,i,t,s):(u=r(i,t,!1,!0),c=u.id,hasProp(I,c)?I[c]:h(makeError("notloaded",'Module name "'+c+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(v(),E.nextTick(function(){v(),p=a(r(null,t)),p.skipMap=o.skipMap,p.init(i,n,l,{enabled:!0}),d()}),s)}return o=o||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n,o=e.lastIndexOf("."),s=e.split("/")[0],r="."===s||".."===s;return-1!==o&&(!r||o>1)&&(n=e.substring(o,e.length),e=e.substring(0,o)),E.nameToUrl(i(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(I,r(e,t,!1,!0).id)},specified:function(e){return e=r(e,t,!1,!0).id,hasProp(I,e)||hasProp(w,e)}}),t||(s.undef=function(e){c();var i=r(e,t,!0),o=getOwn(w,e);o.undefed=!0,n(e),delete I[e],delete T[i.url],delete C[e],eachReverse(R,function(t,i){t[0]===e&&R.splice(i,1)}),delete E.defQueueMap[e],o&&(o.events.defined&&(C[e]=o.events),u(e))}),s},enable:function(e){var t=getOwn(w,e.id);t&&a(e).enable()},completeLoad:function(e){var t,i,n,s=getOwn(x.shim,e)||{},r=s.exports;for(c();R.length;){if(i=R.shift(),null===i[0]){if(i[0]=e,t)break;t=!0}else i[0]===e&&(t=!0);g(i)}if(E.defQueueMap={},n=getOwn(w,e),!t&&!hasProp(I,e)&&n&&!n.inited){if(!(!x.enforceDefine||r&&getGlobal(r)))return o(e)?void 0:h(makeError("nodefine","No define call for "+e,null,[e]));g([e,s.deps||[],s.exportsFn])}d()},nameToUrl:function(e,t,i){var n,o,s,r,a,l,h,c=getOwn(x.pkgs,e);if(c&&(e=c),h=getOwn(O,e))return E.nameToUrl(h,t,i);if(req.jsExtRegExp.test(e))a=e+(t||"");else{for(n=x.paths,o=e.split("/"),s=o.length;s>0;s-=1)if(r=o.slice(0,s).join("/"),l=getOwn(n,r)){isArray(l)&&(l=l[0]),o.splice(0,s,l);break}a=o.join("/"),a+=t||(/^data\:|^blob\:|\?/.test(a)||i?"":".js"),a=("/"===a.charAt(0)||a.match(/^[\w\+\.\-]+:/)?"":x.baseUrl)+a}return x.urlArgs&&!/^blob\:/.test(a)?a+x.urlArgs(e,a):a},load:function(e,t){req.load(E,e,t)},execCb:function(e,t,i,n){return t.apply(n,i)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=m(e);E.completeLoad(t.id)}},onScriptError:function(e){var t=m(e);if(!o(t.id)){var i=[];return eachProp(w,function(e,n){0!==n.indexOf("_@r")&&each(e.depMaps,function(e){return e.id===t.id?(i.push(n),!0):void 0})}),h(makeError("scripterror",'Script error for "'+t.id+(i.length?'", needed by: '+i.join(", "):'"'),e,[t.id]))}}},E.require=E.makeRequire(),E}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.2.0",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}"undefined"==typeof require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,i,n){var o,s,r=defContextName;return isArray(e)||"string"==typeof e||(s=e,isArray(t)?(e=t,t=i,i=n):e=[]),s&&s.context&&(r=s.context),o=getOwn(contexts,r),o||(o=contexts[r]=req.s.newContext(r)),s&&o.configure(s),o.require(e,t,i)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,i){var n=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return n.type=e.scriptType||"text/javascript",n.charset="utf-8",n.async=!0,n},req.load=function(e,t,i){var n,o=e&&e.config||{};if(isBrowser)return n=req.createNode(o,t,i),n.setAttribute("data-requirecontext",e.contextName),n.setAttribute("data-requiremodule",t),!n.attachEvent||n.attachEvent.toString&&n.attachEvent.toString().indexOf("[native code")<0||isOpera?(n.addEventListener("load",e.onScriptLoad,!1),n.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,n.attachEvent("onreadystatechange",e.onScriptLoad)),n.src=i,o.onNodeCreated&&o.onNodeCreated(n,o,t,i),currentlyAddingScript=n,baseElement?head.insertBefore(n,baseElement):head.appendChild(n),currentlyAddingScript=null,n;if(isWebWorker)try{setTimeout(function(){},0),importScripts(i),e.completeLoad(t)}catch(s){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+i,s,[t]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,i){var n,o;"string"!=typeof e&&(i=t,t=e,e=null),isArray(t)||(i=t,t=null),!t&&isFunction(i)&&(t=[],i.length&&(i.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(e,i){t.push(i)}),t=(1===i.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(n=currentlyAddingScript||getInteractiveScript(),n&&(e||(e=n.getAttribute("data-requiremodule")),o=contexts[n.getAttribute("data-requirecontext")])),o?(o.defQueue.push([e,t,i]),o.defQueueMap[e]=!0):globalDefQueue.push([e,t,i])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}}(this),define("requireLib",function(){}),define("modules/uv-shared-module/BaseCommands",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.namespace="uv.",i.ACCEPT_TERMS=i.namespace+"onAcceptTerms",i.BOOKMARK=i.namespace+"onBookmark",i.CANVAS_INDEX_CHANGE_FAILED=i.namespace+"onCanvasIndexChangeFailed",i.CANVAS_INDEX_CHANGED=i.namespace+"onCanvasIndexChanged",i.CLICKTHROUGH=i.namespace+"onClickthrough",i.CLOSE_ACTIVE_DIALOGUE=i.namespace+"onCloseActiveDialogue",i.CLOSE_LEFT_PANEL=i.namespace+"onCloseLeftPanel",i.CLOSE_RIGHT_PANEL=i.namespace+"onCloseRightPanel",i.CREATED=i.namespace+"onCreated",i.DOWN_ARROW=i.namespace+"onDownArrow",i.DOWNLOAD=i.namespace+"onDownload",i.DROP=i.namespace+"onDrop",i.END=i.namespace+"onEnd",i.ESCAPE=i.namespace+"onEscape",i.EXTERNAL_LINK_CLICKED=i.namespace+"onExternalLinkClicked",i.FEEDBACK=i.namespace+"onFeedback",i.FORBIDDEN=i.namespace+"onForbidden",i.HIDE_CLICKTHROUGH_DIALOGUE=i.namespace+"onHideClickthroughDialogue",i.HIDE_DOWNLOAD_DIALOGUE=i.namespace+"onHideDownloadDialogue",i.HIDE_EMBED_DIALOGUE=i.namespace+"onHideEmbedDialogue",i.HIDE_EXTERNALCONTENT_DIALOGUE=i.namespace+"onHideExternalContentDialogue",i.HIDE_GENERIC_DIALOGUE=i.namespace+"onHideGenericDialogue",i.HIDE_HELP_DIALOGUE=i.namespace+"onHideHelpDialogue",i.HIDE_INFORMATION=i.namespace+"onHideInformation",i.HIDE_LOGIN_DIALOGUE=i.namespace+"onHideLoginDialogue",i.HIDE_MOREINFO_DIALOGUE=i.namespace+"onHideMoreInfoDialogue",i.HIDE_OVERLAY=i.namespace+"onHideOverlay",i.HIDE_RESTRICTED_DIALOGUE=i.namespace+"onHideRestrictedDialogue",i.HIDE_SETTINGS_DIALOGUE=i.namespace+"onHideSettingsDialogue",i.HIDE_SHARE_DIALOGUE=i.namespace+"onHideShareDialogue",i.HOME=i.namespace+"onHome",i.LEFT_ARROW=i.namespace+"onLeftArrow",i.LEFTPANEL_COLLAPSE_FULL_FINISH=i.namespace+"onLeftPanelCollapseFullFinish",i.LEFTPANEL_COLLAPSE_FULL_START=i.namespace+"onLeftPanelCollapseFullStart",i.LEFTPANEL_EXPAND_FULL_FINISH=i.namespace+"onLeftPanelExpandFullFinish",i.LEFTPANEL_EXPAND_FULL_START=i.namespace+"onLeftPanelExpandFullStart",i.LOAD_FAILED=i.namespace+"onLoadFailed",i.LOAD=i.namespace+"onLoad",i.LOGIN_FAILED=i.namespace+"onLoginFailed",i.LOGIN=i.namespace+"onLogin",i.LOGOUT=i.namespace+"onLogout",i.METRIC_CHANGED=i.namespace+"onMetricChanged",i.MINUS=i.namespace+"onMinus",i.NOT_FOUND=i.namespace+"onNotFound",i.OPEN_EXTERNAL_RESOURCE=i.namespace+"onOpenExternalResource",i.OPEN_LEFT_PANEL=i.namespace+"onOpenLeftPanel",i.OPEN_RIGHT_PANEL=i.namespace+"onOpenRightPanel",i.OPEN=i.namespace+"onOpen",i.PAGE_DOWN=i.namespace+"onPageDown",i.PAGE_UP=i.namespace+"onPageUp",i.PARENT_EXIT_FULLSCREEN=i.namespace+"onParentExitFullScreen",i.PLUS=i.namespace+"onPlus",i.REDIRECT=i.namespace+"onRedirect",i.REFRESH=i.namespace+"onRefresh",i.RESIZE=i.namespace+"onResize",i.RESOURCE_DEGRADED=i.namespace+"onResourceDegraded",i.RETRY=i.namespace+"onRetry",i.RETURN=i.namespace+"onReturn",i.RIGHT_ARROW=i.namespace+"onRightArrow",i.RIGHTPANEL_COLLAPSE_FULL_FINISH=i.namespace+"onRightPanelCollapseFullFinish",i.RIGHTPANEL_COLLAPSE_FULL_START=i.namespace+"onRightPanelCollapseFullStart",i.RIGHTPANEL_EXPAND_FULL_FINISH=i.namespace+"onRightPanelExpandFullFinish",i.RIGHTPANEL_EXPAND_FULL_START=i.namespace+"onRightPanelExpandFullStart",i.SEQUENCE_INDEX_CHANGED=i.namespace+"onSequenceIndexChanged",i.SETTINGS_CHANGED=i.namespace+"onSettingsChanged",i.SHOW_CLICKTHROUGH_DIALOGUE=i.namespace+"onShowClickThroughDialogue",i.SHOW_DOWNLOAD_DIALOGUE=i.namespace+"onShowDownloadDialogue",i.SHOW_EMBED_DIALOGUE=i.namespace+"onShowEmbedDialogue",i.SHOW_EXTERNALCONTENT_DIALOGUE=i.namespace+"onShowExternalContentDialogue",i.SHOW_GENERIC_DIALOGUE=i.namespace+"onShowGenericDialogue",i.SHOW_HELP_DIALOGUE=i.namespace+"onShowHelpDialogue",i.SHOW_INFORMATION=i.namespace+"onShowInformation",i.SHOW_LOGIN_DIALOGUE=i.namespace+"onShowLoginDialogue",i.SHOW_MOREINFO_DIALOGUE=i.namespace+"onShowMoreInfoDialogue",i.SHOW_OVERLAY=i.namespace+"onShowOverlay",i.SHOW_RESTRICTED_DIALOGUE=i.namespace+"onShowRestrictedDialogue",i.SHOW_SETTINGS_DIALOGUE=i.namespace+"onShowSettingsDialogue",i.SHOW_SHARE_DIALOGUE=i.namespace+"onShowShareDialogue",i.SHOW_TERMS_OF_USE=i.namespace+"onShowTermsOfUse",i.THUMB_SELECTED=i.namespace+"onThumbSelected",i.TOGGLE_EXPAND_LEFT_PANEL=i.namespace+"onToggleExpandLeftPanel",i.TOGGLE_EXPAND_RIGHT_PANEL=i.namespace+"onToggleExpandRightPanel",i.TOGGLE_FULLSCREEN=i.namespace+"onToggleFullScreen",i.UP_ARROW=i.namespace+"onUpArrow",i.UPDATE_SETTINGS=i.namespace+"onUpdateSettings",i.VIEW_FULL_TERMS=i.namespace+"onViewFullTerms",i.WINDOW_UNLOAD=i.namespace+"onWindowUnload",i}),define("Params",["require","exports"],function(e,t){"use strict";var i;return function(e){e[e.collectionIndex=0]="collectionIndex",e[e.manifestIndex=1]="manifestIndex",e[e.sequenceIndex=2]="sequenceIndex",e[e.canvasIndex=3]="canvasIndex",e[e.xywh=4]="xywh",e[e.rotation=5]="rotation",e[e.highlight=6]="highlight",e[e.anchor=7]="anchor"}(i||(i={})),i}),define("BootstrapParams",["require","exports","./Params"],function(e,t,i){"use strict";var n=function(){function e(){this.paramMap=["c","m","s","cv","xywh","r","h","a"],this.config=Utils.Urls.getQuerystringParameter("config"),this.domain=Utils.Urls.getQuerystringParameter("domain"),this.embedDomain=Utils.Urls.getQuerystringParameter("embedDomain"),this.embedScriptUri=Utils.Urls.getQuerystringParameter("embedScriptUri"),this.isHomeDomain="true"===Utils.Urls.getQuerystringParameter("isHomeDomain"),this.isLightbox="true"===Utils.Urls.getQuerystringParameter("isLightbox"),this.isOnlyInstance="true"===Utils.Urls.getQuerystringParameter("isOnlyInstance"),this.isReload="true"===Utils.Urls.getQuerystringParameter("isReload");var e=Utils.Urls.getQuerystringParameter("jsonp");this.jsonp=null===e?null:!("false"===e||"0"===e),this.manifestUri=Utils.Urls.getQuerystringParameter("manifestUri");var t=Utils.Urls.getQuerystringParameter("locale")||"en-GB";this.setLocale(t),this.collectionIndex=this.getParam(i.collectionIndex),this.manifestIndex=this.getParam(i.manifestIndex),this.sequenceIndex=this.getParam(i.sequenceIndex),this.canvasIndex=this.getParam(i.canvasIndex)}return e.prototype.getLocaleName=function(){return this.localeName},e.prototype.getParam=function(e){if(this.hashParamsAvailable()){var t=parseInt(Utils.Urls.getHashParameter(this.paramMap[e],parent.document));if(t||0===t)return t}return parseInt(Utils.Urls.getQuerystringParameter(this.paramMap[e]))||0},e.prototype.hashParamsAvailable=function(){return this.isHomeDomain&&!this.isReload&&this.isOnlyInstance},e.prototype.setLocale=function(e){this.locale=e,this.locales=[];for(var t=this.locale.split(","),i=0;i<t.length;i++){var n=t[i].split(":");this.locales.push({name:n[0].trim(),label:n[1]?n[1].trim():""})}this.localeName=this.locales[0].name},e}();t.BootstrapParams=n}),define("Bootstrapper",["require","exports","./modules/uv-shared-module/BaseCommands","./BootstrapParams"],function(e,t,i,n){"use strict";var o=function(){function e(e){this.isFullScreen=!1,this.extensions=e}return e.prototype.bootstrap=function(e){var t=this;this.params=new n.BootstrapParams,e&&(this.params=$.extend(!0,this.params,e)),this.params.manifestUri&&($("#app").empty(),$("#app").addClass("loading"),$('link[type*="text/css"]').remove(),jQuery.support.cors=!0,Manifold.loadManifest({iiifResourceUri:this.params.manifestUri,collectionIndex:this.params.collectionIndex,manifestIndex:this.params.manifestIndex,sequenceIndex:this.params.sequenceIndex,canvasIndex:this.params.canvasIndex,locale:this.params.localeName}).then(function(e){var i=e.getTrackingLabel();i+=", URI: "+t.params.embedDomain,window.trackingLabel=i;var n=e.getSequenceByIndex(t.params.sequenceIndex);if(!n)return void t.notFound();var o=e.getCanvasByIndex(t.params.canvasIndex);if(!o)return void t.notFound();var s=o.getType(),r=t.extensions[s.toString()];if(!r){var a=o.getProperty("format");r=t.extensions[a]}return r?(r.helper=e,void t.featureDetect(function(){t.configure(r,function(e){t.injectCss(r,e,function(){t.createExtension(r,e)})})})):void alert("No matching UV extension found.")})["catch"](function(){this.notFound()}))},e.prototype.isCORSEnabled=function(){return null===this.params.jsonp?Modernizr.cors:!this.params.jsonp},e.prototype.notFound=function(){try{return void parent.$(parent.document).trigger(i.NOT_FOUND)}catch(e){}},e.prototype.featureDetect=function(e){yepnope({test:window.btoa&&window.atob,nope:"lib/base64.min.js",complete:function(){e()}})},e.prototype.configure=function(e,t){var i=this,n=this;this.getConfigExtension(e,function(o){var s=window.DEBUG?"extensions/"+e.name+"/build/"+n.params.getLocaleName()+".config.json":"lib/"+e.name+"."+n.params.getLocaleName()+".config.json";$.getJSON(s,function(n){i.extendConfig(e,n,o,t)})})},e.prototype.extendConfig=function(e,t,i,n){t.name=e.name,i&&(t.uri=this.params.config,$.extend(!0,t,i)),n(t)},e.prototype.getConfigExtension=function(e,t){var i=sessionStorage.getItem(e.name+"."+this.params.localeName);if(i)t(JSON.parse(i));else if(this.params.config)if(this.isCORSEnabled())$.getJSON(this.params.config,function(e){t(e)});else{var n={url:this.params.config,type:"GET",dataType:"jsonp",jsonp:"callback",jsonpCallback:"configExtensionCallback"};$.ajax(n),window.configExtensionCallback=function(e){t(e)}}else t(null)},e.prototype.injectCss=function(e,t,i){var n=window.DEBUG?"extensions/"+e.name+"/build/"+t.options.theme+".css":"themes/"+t.options.theme+"/css/"+e.name+"/theme.css";yepnope.injectCss(n,function(){i()})},e.prototype.createExtension=function(e,t){this.config=t;var i=e.helper;this.extension=new e.type(this),this.extension.helper=i,this.extension.name=e.name,this.extension.create()},e}();return o}),define("modules/uv-shared-module/Panel",["require","exports","./BaseCommands"],function(e,t,i){"use strict";var n=function(){function e(e,t,i){this.isResized=!1,this.$element=e,this.fitToParentWidth=t||!1,this.fitToParentHeight=i||!1,this.create()}return e.prototype.create=function(){var e=this;$.subscribe(i.RESIZE,function(){e.resize()})},e.prototype.resize=function(){var e=this.$element.parent();this.fitToParentWidth&&this.$element.width(e.width()),this.fitToParentHeight&&this.$element.height(e.height()),this.isResized=!0},e}();return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/BaseView",["require","exports","./Panel"],function(e,t,i){"use strict";var n=function(e){function t(t,i,n){return e.call(this,t,i,n)||this}return __extends(t,e),t.prototype.create=function(){this.bootstrapper=$("body > #app").data("bootstrapper"),e.prototype.create.call(this),this.extension=this.bootstrapper.extension,this.config={},this.config.content={},this.config.options={},this.content=this.config.content,this.options=this.config.options;var t=this;t.modules&&t.modules.length&&(t.modules=t.modules.reverse(),$.each(t.modules,function(e,i){t.config=$.extend(!0,t.config,t.extension.config.modules[i])}))},t.prototype.init=function(){},t.prototype.setConfig=function(e){this.modules||(this.modules=[]),this.modules.push(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/Dialogue",["require","exports","./BaseView","./BaseCommands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t,!1,!1)||this;return i.allowClose=!0,i.isActive=!1,i.isUnopened=!0,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("dialogue"),e.prototype.create.call(this),$.subscribe(n.CLOSE_ACTIVE_DIALOGUE,function(){t.isActive&&t.allowClose&&t.close()}),$.subscribe(n.ESCAPE,function(){t.isActive&&t.allowClose&&t.close()}),this.$top=$('<div class="top"></div>'),this.$element.append(this.$top),this.$closeButton=$('<a href="#" class="close" tabindex="0">'+this.content.close+"</a>"),this.$top.append(this.$closeButton),this.$middle=$('<div class="middle"></div>'),this.$element.append(this.$middle),this.$content=$('<div class="content"></div>'),this.$middle.append(this.$content),this.$bottom=$('<div class="bottom"></div>'),this.$element.append(this.$bottom),this.$closeButton.on("click",function(e){e.preventDefault(),t.close()}),this.returnFunc=this.close},t.prototype.enableClose=function(){this.allowClose=!0,this.$closeButton.show()},t.prototype.disableClose=function(){this.allowClose=!1,this.$closeButton.hide()},t.prototype.setDockedPosition=function(){var e=Math.floor(this.extension.height()-this.$element.outerHeight(!0)),t=0,i=0;if(this.$triggerButton){var n=Math.normalise(this.$triggerButton.offset().left,0,this.extension.width());t=Math.floor(this.extension.width()*n-this.$element.width()*n),i=this.$element.width()*n}this.$bottom.css("backgroundPosition",i+"px 0px"),this.$element.css({top:e,left:t})},t.prototype.open=function(e){var t=this;this.$element.show(),e&&e.length?(this.$triggerButton=e,this.$bottom.show()):this.$bottom.hide(),this.isActive=!0,setTimeout(function(){var e=t.$element.find(".default");if(e.length)e.focus();else{var i=t.$element.find("input:visible").first();i.length?i.focus():t.$closeButton.focus()}},1),$.publish(n.SHOW_OVERLAY),this.isUnopened&&(this.isUnopened=!1,this.afterFirstOpen()),this.resize()},t.prototype.afterFirstOpen=function(){},t.prototype.close=function(){this.isActive&&(this.$element.hide(),this.isActive=!1,$.publish(this.closeCommand),$.publish(n.HIDE_OVERLAY))},t.prototype.resize=function(){e.prototype.resize.call(this),this.$element.css({top:Math.floor(this.extension.height()/2-this.$element.height()/2),left:Math.floor(this.extension.width()/2-this.$element.width()/2)})},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);
2
+ };return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/ClickThroughDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("clickThroughDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_CLICKTHROUGH_DIALOGUE,this.closeCommand=i.HIDE_CLICKTHROUGH_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> <div class="buttons"> <a class="acceptTerms btn btn-primary" href="#" target="_parent"></a> </div> </div>'),this.$message=this.$content.find(".message"),this.$acceptTermsButton=this.$content.find(".acceptTerms"),this.$acceptTermsButton.text("Accept Terms and Open"),this.$element.hide(),this.$acceptTermsButton.on("click",function(e){e.preventDefault(),t.close(),$.publish(i.ACCEPT_TERMS),t.acceptCallback&&t.acceptCallback()})},t.prototype.open=function(){e.prototype.open.call(this),this.$title.text(this.resource.clickThroughService.getProperty("label")),this.$message.html(this.resource.clickThroughService.getProperty("description")),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.resize()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o}),define("modules/uv-shared-module/InformationArgs",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.informationType=e,this.param=t}return e}();return i}),define("modules/uv-shared-module/InformationType",["require","exports"],function(e,t){"use strict";var i;return function(e){e[e.AUTH_CORS_ERROR=0]="AUTH_CORS_ERROR",e[e.DEGRADED_RESOURCE=1]="DEGRADED_RESOURCE"}(i||(i={})),i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/LoginDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("loginDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_LOGIN_DIALOGUE,this.closeCommand=i.HIDE_LOGIN_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.loginCallback=i.loginCallback,t.logoutCallback=i.logoutCallback,t.options=i.options,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> <div class="buttons"> <a class="logout btn btn-primary" href="#" target="_parent"></a> <a class="login btn btn-primary" href="#" target="_parent"></a> <a class="cancel btn btn-primary" href="#"></a> </div> </div>'),this.$message=this.$content.find(".message"),this.$loginButton=this.$content.find(".login"),this.$loginButton.text(this.content.login),this.$logoutButton=this.$content.find(".logout"),this.$logoutButton.text(this.content.logout),this.$cancelButton=this.$content.find(".cancel"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$loginButton.on("click",function(e){e.preventDefault(),t.close(),t.loginCallback&&t.loginCallback()}),this.$logoutButton.on("click",function(e){e.preventDefault(),t.close(),t.logoutCallback&&t.logoutCallback()}),this.$cancelButton.on("click",function(e){e.preventDefault(),t.close()}),this.updateLogoutButton()},t.prototype.open=function(){e.prototype.open.call(this),this.$title.text(this.resource.loginService.getProperty("label"));var t=this.resource.loginService.getProperty("description");this.options.warningMessage&&(t='<span class="warning">'+this.extension.config.content[this.options.warningMessage]+'</span><span class="description">'+t+"</span>"),this.updateLogoutButton(),this.$message.html(t),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.options.showCancelButton?this.$cancelButton.show():this.$cancelButton.hide(),this.resize()},t.prototype.updateLogoutButton=function(){this.extension.isLoggedIn?this.$logoutButton.show():this.$logoutButton.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o}),define("modules/uv-shared-module/LoginWarningMessages",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.FORBIDDEN="forbiddenResourceMessage",i}),define("modules/uv-shared-module/Metric",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.minWidth=e,this.maxWidth=t}return e}();return i}),define("modules/uv-shared-module/Metrics",["require","exports","./Metric"],function(e,t,i){"use strict";var n=function(){function e(){}return e}();return n.MOBILE_LANDSCAPE=new i(0,640),n.LAPTOP=new i(640,1/0),n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/RestrictedDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("restrictedDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_RESTRICTED_DIALOGUE,this.closeCommand=i.HIDE_RESTRICTED_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.options=i.options,t.resource=i.resource,t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$content.append(' <div> <p class="message scroll"></p> <div class="buttons"> <a class="cancel btn btn-primary" href="#" target="_parent"></a> </div> </div>'),this.$message=this.$content.find(".message"),this.$message.targetBlank(),this.$cancelButton=this.$content.find(".cancel"),this.$cancelButton.text(this.content.cancel),this.$element.hide(),this.$cancelButton.on("click",function(e){e.preventDefault(),t.close()})},t.prototype.open=function(){e.prototype.open.call(this),this.isAccepted=!1,this.$title.text(this.resource.restrictedService.getProperty("label"));var t=this.resource.restrictedService.getProperty("description");this.$message.html(t),this.$message.targetBlank(),this.$message.find("a").on("click",function(){var e=$(this).attr("href");$.publish(i.EXTERNAL_LINK_CLICKED,[e])}),this.resize()},t.prototype.close=function(){e.prototype.close.call(this),!this.isAccepted&&this.acceptCallback&&(this.isAccepted=!0,this.acceptCallback())},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/GenericDialogue",["require","exports","./BaseCommands","./Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("genericDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_GENERIC_DIALOGUE,this.closeCommand=i.HIDE_GENERIC_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.acceptCallback=i.acceptCallback,t.showMessage(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$message=$("<p></p>"),this.$content.append(this.$message),this.$acceptButton=$('<a href="#" class="btn btn-primary accept default"></a>'),this.$content.append(this.$acceptButton),this.$acceptButton.text(this.content.ok),this.$acceptButton.onPressed(function(){t.accept()}),this.returnFunc=function(){t.isActive&&t.accept()},this.$element.hide()},t.prototype.accept=function(){$.publish(i.CLOSE_ACTIVE_DIALOGUE),this.acceptCallback&&this.acceptCallback()},t.prototype.showMessage=function(e){this.$message.html(e.message),e.buttonText?this.$acceptButton.text(e.buttonText):this.$acceptButton.text(this.content.ok),e.allowClose===!1&&this.disableClose(),this.open()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/Shell",["require","exports","./BaseCommands","./BaseView","./GenericDialogue"],function(e,t,i,n,o){"use strict";var s=function(e){function t(i){var n=this;return t.$element=i,n=e.call(this,t.$element,!0,!0)||this}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),$.subscribe(i.SHOW_OVERLAY,function(){t.$overlays.show()}),$.subscribe(i.HIDE_OVERLAY,function(){t.$overlays.hide()}),t.$headerPanel=$('<div class="headerPanel"></div>'),t.$element.append(t.$headerPanel),t.$mainPanel=$('<div class="mainPanel"></div>'),t.$element.append(t.$mainPanel),t.$centerPanel=$('<div class="centerPanel"></div>'),t.$mainPanel.append(t.$centerPanel),t.$leftPanel=$('<div class="leftPanel"></div>'),t.$mainPanel.append(t.$leftPanel),t.$rightPanel=$('<div class="rightPanel"></div>'),t.$mainPanel.append(t.$rightPanel),t.$footerPanel=$('<div class="footerPanel"></div>'),t.$element.append(t.$footerPanel),t.$mobileFooterPanel=$('<div class="footerPanel mobile"></div>'),t.$element.append(t.$mobileFooterPanel),t.$overlays=$('<div class="overlays"></div>'),t.$element.append(t.$overlays),t.$genericDialogue=$('<div class="overlay genericDialogue"></div>'),t.$overlays.append(t.$genericDialogue),t.$overlays.on("click",function(e){$(e.target).hasClass("overlays")&&(e.preventDefault(),$.publish(i.CLOSE_ACTIVE_DIALOGUE))}),new o(t.$genericDialogue)},t.prototype.resize=function(){e.prototype.resize.call(this),t.$overlays.width(this.extension.width()),t.$overlays.height(this.extension.height());var i=this.$element.height()-parseInt(t.$mainPanel.css("marginTop"))-(t.$headerPanel.is(":visible")?t.$headerPanel.height():0)-(t.$footerPanel.is(":visible")?t.$footerPanel.height():0)-(t.$mobileFooterPanel.is(":visible")?t.$mobileFooterPanel.height():0);t.$mainPanel.height(i)},t}(n);return s}),define("modules/uv-shared-module/BaseExtension",["require","exports","./BaseCommands","../../BootstrapParams","../../modules/uv-dialogues-module/ClickThroughDialogue","./InformationArgs","./InformationType","../../modules/uv-dialogues-module/LoginDialogue","./LoginWarningMessages","../../modules/uv-shared-module/Metrics","../../Params","../../modules/uv-dialogues-module/RestrictedDialogue","./Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p){"use strict";var d=function(){function t(e){this.isCreated=!1,this.isLoggedIn=!1,this.shifted=!1,this.tabbing=!1,this.bootstrapper=e,this.config=this.bootstrapper.config,this.jsonp=this.bootstrapper.params.jsonp,this.locale=this.bootstrapper.params.getLocaleName(),this.isHomeDomain=this.bootstrapper.params.isHomeDomain,this.isReload=this.bootstrapper.params.isReload,this.embedDomain=this.bootstrapper.params.embedDomain,this.isOnlyInstance=this.bootstrapper.params.isOnlyInstance,this.embedScriptUri=this.bootstrapper.params.embedScriptUri,this.domain=this.bootstrapper.params.domain,this.isLightbox=this.bootstrapper.params.isLightbox}return t.prototype.create=function(e){var t=this,o=this;this.$element=$("#app"),this.$element.data("bootstrapper",this.bootstrapper);var s=$(window);if(this.embedWidth=s.width(),this.embedHeight=s.height(),this.$element.width(this.embedWidth),this.$element.height(this.embedHeight),!this.isReload&&Utils.Documents.isInIFrame()&&(this.bootstrapper.socket=new easyXDM.Socket({onMessage:function(e,i){e=$.parseJSON(e),t.handleParentFrameEvent(e)}})),this.triggerSocket(i.LOAD,{bootstrapper:{config:this.bootstrapper.config,params:this.bootstrapper.params},settings:this.getSettings(),preview:this.getSharePreview()}),this.$element.empty(),this.$element.removeClass(),this.$element.addClass("browser-"+window.browserDetect.browser),this.$element.addClass("browser-version-"+window.browserDetect.version),this.isHomeDomain||this.$element.addClass("embedded"),this.isLightbox&&this.$element.addClass("lightbox"),$(document).on("mousemove",function(e){t.mouseX=e.pageX,t.mouseY=e.pageY}),!this.isReload){window.onresize=function(){var e=$(window);$("body").height(e.height()),t.resize()};var r=Utils.Documents.getHiddenProp();if(r){var a=r.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(a,function(){Utils.Documents.isHidden()||t.resize()})}Utils.Bools.getBool(this.config.options.dropEnabled,!0)&&this.$element.on("drop",function(e){e.preventDefault();var o=e.originalEvent.dataTransfer.getData("URL"),s=Utils.Urls.getUrlParts(o),r=Utils.Urls.getQuerystringParameterFromString("manifest",s.search);if(r){t.triggerSocket(i.DROP,r);var a=new n.BootstrapParams;a.manifestUri=r,t.reload(a)}}),this.$element.on("dragover",function(e){e.preventDefault()}),$(document).on("keyup keydown",function(e){t.shifted=e.shiftKey,t.tabbing=e.keyCode===KeyCodes.KeyDown.Tab}),$(document).keydown(function(e){var t=null,n=!0;e.ctrlKey||e.altKey||e.shiftKey||(e.keyCode===KeyCodes.KeyDown.Enter&&(t=i.RETURN,n=!1),e.keyCode===KeyCodes.KeyDown.Escape&&(t=i.ESCAPE),e.keyCode===KeyCodes.KeyDown.PageUp&&(t=i.PAGE_UP),e.keyCode===KeyCodes.KeyDown.PageDown&&(t=i.PAGE_DOWN),e.keyCode===KeyCodes.KeyDown.End&&(t=i.END),e.keyCode===KeyCodes.KeyDown.Home&&(t=i.HOME),(e.keyCode===KeyCodes.KeyDown.NumpadPlus||171===e.keyCode||e.keyCode===KeyCodes.KeyDown.Equals)&&(t=i.PLUS,n=!1),(e.keyCode===KeyCodes.KeyDown.NumpadMinus||173===e.keyCode||e.keyCode===KeyCodes.KeyDown.Dash)&&(t=i.MINUS,n=!1),o.useArrowKeysToNavigate()&&(e.keyCode===KeyCodes.KeyDown.LeftArrow&&(t=i.LEFT_ARROW),e.keyCode===KeyCodes.KeyDown.UpArrow&&(t=i.UP_ARROW),e.keyCode===KeyCodes.KeyDown.RightArrow&&(t=i.RIGHT_ARROW),e.keyCode===KeyCodes.KeyDown.DownArrow&&(t=i.DOWN_ARROW))),t&&(n&&e.preventDefault(),$.publish(t))}),this.bootstrapper.params.isHomeDomain&&Utils.Documents.isInIFrame()&&$.subscribe(i.PARENT_EXIT_FULLSCREEN,function(){t.isOverlayActive()&&$.publish(i.ESCAPE),$.publish(i.ESCAPE),$.publish(i.RESIZE)})}this.$element.append('<a href="/" id="top"></a>'),this.$element.append('<iframe id="commsFrame" style="display:none"></iframe>'),$.subscribe(i.ACCEPT_TERMS,function(){t.triggerSocket(i.ACCEPT_TERMS)}),$.subscribe(i.LOGIN_FAILED,function(){t.triggerSocket(i.LOGIN_FAILED),t.showMessage(t.config.content.authorisationFailedMessage)}),$.subscribe(i.LOGIN,function(){t.isLoggedIn=!0,t.triggerSocket(i.LOGIN)}),$.subscribe(i.LOGOUT,function(){t.isLoggedIn=!1,t.triggerSocket(i.LOGOUT)}),$.subscribe(i.BOOKMARK,function(){t.bookmark(),t.triggerSocket(i.BOOKMARK)}),$.subscribe(i.CANVAS_INDEX_CHANGE_FAILED,function(){t.triggerSocket(i.CANVAS_INDEX_CHANGE_FAILED)}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,n){t.triggerSocket(i.CANVAS_INDEX_CHANGED,n)}),$.subscribe(i.CLICKTHROUGH,function(){t.triggerSocket(i.CLICKTHROUGH)}),$.subscribe(i.CLOSE_ACTIVE_DIALOGUE,function(){t.triggerSocket(i.CLOSE_ACTIVE_DIALOGUE)}),$.subscribe(i.CLOSE_LEFT_PANEL,function(){t.triggerSocket(i.CLOSE_LEFT_PANEL),t.resize()}),$.subscribe(i.CLOSE_RIGHT_PANEL,function(){t.triggerSocket(i.CLOSE_RIGHT_PANEL),t.resize()}),$.subscribe(i.CREATED,function(){t.isCreated=!0,t.triggerSocket(i.CREATED)}),$.subscribe(i.DOWN_ARROW,function(){t.triggerSocket(i.DOWN_ARROW)}),$.subscribe(i.DOWNLOAD,function(e,n){t.triggerSocket(i.DOWNLOAD,n)}),$.subscribe(i.END,function(){t.triggerSocket(i.END)}),$.subscribe(i.ESCAPE,function(){t.triggerSocket(i.ESCAPE),t.isFullScreen()&&!t.isOverlayActive()&&$.publish(i.TOGGLE_FULLSCREEN)}),$.subscribe(i.EXTERNAL_LINK_CLICKED,function(e,n){t.triggerSocket(i.EXTERNAL_LINK_CLICKED,n)}),$.subscribe(i.FEEDBACK,function(){t.feedback()}),$.subscribe(i.FORBIDDEN,function(){t.triggerSocket(i.FORBIDDEN),$.publish(i.OPEN_EXTERNAL_RESOURCE)}),$.subscribe(i.HIDE_DOWNLOAD_DIALOGUE,function(){t.triggerSocket(i.HIDE_DOWNLOAD_DIALOGUE)}),$.subscribe(i.HIDE_EMBED_DIALOGUE,function(){t.triggerSocket(i.HIDE_EMBED_DIALOGUE)}),$.subscribe(i.HIDE_EXTERNALCONTENT_DIALOGUE,function(){t.triggerSocket(i.HIDE_EXTERNALCONTENT_DIALOGUE)}),$.subscribe(i.HIDE_GENERIC_DIALOGUE,function(){t.triggerSocket(i.HIDE_GENERIC_DIALOGUE)}),$.subscribe(i.HIDE_HELP_DIALOGUE,function(){t.triggerSocket(i.HIDE_HELP_DIALOGUE)}),$.subscribe(i.HIDE_INFORMATION,function(){t.triggerSocket(i.HIDE_INFORMATION)}),$.subscribe(i.HIDE_LOGIN_DIALOGUE,function(){t.triggerSocket(i.HIDE_LOGIN_DIALOGUE)}),$.subscribe(i.HIDE_OVERLAY,function(){t.triggerSocket(i.HIDE_OVERLAY)}),$.subscribe(i.HIDE_RESTRICTED_DIALOGUE,function(){t.triggerSocket(i.HIDE_RESTRICTED_DIALOGUE)}),$.subscribe(i.HIDE_SETTINGS_DIALOGUE,function(){t.triggerSocket(i.HIDE_SETTINGS_DIALOGUE)}),$.subscribe(i.HOME,function(){t.triggerSocket(i.HOME)}),$.subscribe(i.LEFT_ARROW,function(){t.triggerSocket(i.LEFT_ARROW)}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(){t.triggerSocket(i.LEFTPANEL_COLLAPSE_FULL_FINISH)}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_START,function(){t.triggerSocket(i.LEFTPANEL_COLLAPSE_FULL_START)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_FINISH,function(){t.triggerSocket(i.LEFTPANEL_EXPAND_FULL_FINISH)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(){t.triggerSocket(i.LEFTPANEL_EXPAND_FULL_START)}),$.subscribe(i.LOAD_FAILED,function(){t.triggerSocket(i.LOAD_FAILED),_.isNull(o.lastCanvasIndex)||o.lastCanvasIndex===o.helper.canvasIndex||t.viewCanvas(o.lastCanvasIndex)}),$.subscribe(i.NOT_FOUND,function(){t.triggerSocket(i.NOT_FOUND)}),$.subscribe(i.OPEN,function(){t.triggerSocket(i.OPEN);var e=String.format(t.config.options.openTemplate,t.helper.iiifResourceUri);window.open(e)}),$.subscribe(i.OPEN_LEFT_PANEL,function(){t.triggerSocket(i.OPEN_LEFT_PANEL),t.resize()}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(){t.triggerSocket(i.OPEN_EXTERNAL_RESOURCE)}),$.subscribe(i.OPEN_RIGHT_PANEL,function(){t.triggerSocket(i.OPEN_RIGHT_PANEL),t.resize()}),$.subscribe(i.PAGE_DOWN,function(){t.triggerSocket(i.PAGE_DOWN)}),$.subscribe(i.PAGE_UP,function(){t.triggerSocket(i.PAGE_UP)}),$.subscribe(i.RESOURCE_DEGRADED,function(e,n){t.triggerSocket(i.RESOURCE_DEGRADED),t.handleDegraded(n)}),$.subscribe(i.RETURN,function(){t.triggerSocket(i.RETURN)}),$.subscribe(i.RIGHT_ARROW,function(){t.triggerSocket(i.RIGHT_ARROW)}),$.subscribe(i.RIGHTPANEL_COLLAPSE_FULL_FINISH,function(){t.triggerSocket(i.RIGHTPANEL_COLLAPSE_FULL_FINISH)}),$.subscribe(i.RIGHTPANEL_COLLAPSE_FULL_START,function(){t.triggerSocket(i.RIGHTPANEL_COLLAPSE_FULL_START)}),$.subscribe(i.RIGHTPANEL_EXPAND_FULL_FINISH,function(){t.triggerSocket(i.RIGHTPANEL_EXPAND_FULL_FINISH)}),$.subscribe(i.RIGHTPANEL_EXPAND_FULL_START,function(){t.triggerSocket(i.RIGHTPANEL_EXPAND_FULL_START)}),$.subscribe(i.SEQUENCE_INDEX_CHANGED,function(){t.triggerSocket(i.SEQUENCE_INDEX_CHANGED)}),$.subscribe(i.SETTINGS_CHANGED,function(e,n){t.triggerSocket(i.SETTINGS_CHANGED,n)}),$.subscribe(i.SHOW_DOWNLOAD_DIALOGUE,function(){t.triggerSocket(i.SHOW_DOWNLOAD_DIALOGUE)}),$.subscribe(i.SHOW_EMBED_DIALOGUE,function(){t.triggerSocket(i.SHOW_EMBED_DIALOGUE)}),$.subscribe(i.SHOW_EXTERNALCONTENT_DIALOGUE,function(){t.triggerSocket(i.SHOW_EXTERNALCONTENT_DIALOGUE)}),$.subscribe(i.SHOW_GENERIC_DIALOGUE,function(){t.triggerSocket(i.SHOW_GENERIC_DIALOGUE)}),$.subscribe(i.SHOW_HELP_DIALOGUE,function(){t.triggerSocket(i.SHOW_HELP_DIALOGUE)}),$.subscribe(i.SHOW_INFORMATION,function(){t.triggerSocket(i.SHOW_INFORMATION)}),$.subscribe(i.SHOW_LOGIN_DIALOGUE,function(){t.triggerSocket(i.SHOW_LOGIN_DIALOGUE)}),$.subscribe(i.SHOW_CLICKTHROUGH_DIALOGUE,function(){t.triggerSocket(i.SHOW_CLICKTHROUGH_DIALOGUE)}),$.subscribe(i.SHOW_RESTRICTED_DIALOGUE,function(){t.triggerSocket(i.SHOW_RESTRICTED_DIALOGUE)}),$.subscribe(i.SHOW_OVERLAY,function(){t.triggerSocket(i.SHOW_OVERLAY)}),$.subscribe(i.SHOW_SETTINGS_DIALOGUE,function(){t.triggerSocket(i.SHOW_SETTINGS_DIALOGUE)}),$.subscribe(i.SHOW_TERMS_OF_USE,function(){t.triggerSocket(i.SHOW_TERMS_OF_USE);var e=t.helper.getAttribution();t.showMessage(e)}),$.subscribe(i.THUMB_SELECTED,function(e,n){t.triggerSocket(i.THUMB_SELECTED,n.index)}),$.subscribe(i.TOGGLE_FULLSCREEN,function(){$("#top").focus(),t.bootstrapper.isFullScreen=!t.bootstrapper.isFullScreen,t.triggerSocket(i.TOGGLE_FULLSCREEN,{isFullScreen:t.bootstrapper.isFullScreen,overrideFullScreen:t.config.options.overrideFullScreen})}),$.subscribe(i.UP_ARROW,function(){t.triggerSocket(i.UP_ARROW)}),$.subscribe(i.UPDATE_SETTINGS,function(){t.triggerSocket(i.UPDATE_SETTINGS)}),$.subscribe(i.VIEW_FULL_TERMS,function(){t.triggerSocket(i.VIEW_FULL_TERMS)}),$.subscribe(i.WINDOW_UNLOAD,function(){t.triggerSocket(i.WINDOW_UNLOAD)}),this.shell=new p(this.$element),e?this.loadDependencies(e):this.getDependencies(function(e){t.loadDependencies(e)})},t.prototype.createModules=function(){this.$clickThroughDialogue=$('<div class="overlay clickthrough"></div>'),p.$overlays.append(this.$clickThroughDialogue),this.clickThroughDialogue=new o(this.$clickThroughDialogue),this.$restrictedDialogue=$('<div class="overlay login"></div>'),p.$overlays.append(this.$restrictedDialogue),this.restrictedDialogue=new u(this.$restrictedDialogue),this.$loginDialogue=$('<div class="overlay login"></div>'),p.$overlays.append(this.$loginDialogue),this.loginDialogue=new a(this.$loginDialogue)},t.prototype.modulesCreated=function(){},t.prototype.getDependencies=function(t){var i=this,n=window.DEBUG?"../../extensions/"+this.name+"/dependencies":this.name+"-dependencies",o=$("script[data-requiremodule]").filter(function(){var e=$(this).attr("data-requiremodule");return-1!=e.indexOf(i.name)&&-1!=e.indexOf("dependencies")});o.length?t(null):e([n],function(e){for(var n=window.DEBUG?"../../extensions/"+i.name+"/lib/":"",o=0;o<e.dependencies.length;o++)e.dependencies[o]=n+e.dependencies[o];t(e)})},t.prototype.loadDependencies=function(t){var i=this;t?e(t.dependencies,function(){i.dependenciesLoaded()}):i.dependenciesLoaded()},t.prototype.dependenciesLoaded=function(){this.createModules(),this.modulesCreated(),$.publish(i.RESIZE),$.publish(i.CREATED),this.setParams(),this.setDefaultFocus(),this.viewCanvas(this.getCanvasIndexParam())},t.prototype.setParams=function(){this.isHomeDomain&&(this.setParam(c.collectionIndex,this.helper.collectionIndex),this.setParam(c.manifestIndex,this.helper.manifestIndex),this.setParam(c.sequenceIndex,this.helper.sequenceIndex),this.setParam(c.canvasIndex,this.helper.canvasIndex))},t.prototype.setDefaultFocus=function(){var e=this;setTimeout(function(){e.config.options.allowStealFocus&&$("[tabindex=0]").focus()},1)},t.prototype.width=function(){return $(window).width()},t.prototype.height=function(){return $(window).height()},t.prototype.triggerSocket=function(e,t){jQuery(document).trigger(e,[t]),this.bootstrapper.socket&&this.bootstrapper.socket.postMessage(JSON.stringify({eventName:e,eventObject:t}))},t.prototype.redirect=function(e){this.triggerSocket(i.REDIRECT,e)},t.prototype.refresh=function(){this.triggerSocket(i.REFRESH,null)},t.prototype._updateMetric=function(){for(var e=Object.keys(h),t=0;t<e.length;t++){var n=h[e[t]];this.width()>n.minWidth&&this.width()<=n.maxWidth&&this.metric!==n&&(this.metric=n,$.publish(i.METRIC_CHANGED))}},t.prototype.resize=function(){this._updateMetric(),$.publish(i.RESIZE)},t.prototype.handleParentFrameEvent=function(e){var t=this;Utils.Async.waitFor(function(){return t.isCreated},function(){switch(e.eventName){case i.TOGGLE_FULLSCREEN:$.publish(i.TOGGLE_FULLSCREEN,e.eventObject);break;case i.PARENT_EXIT_FULLSCREEN:$.publish(i.PARENT_EXIT_FULLSCREEN)}})},t.prototype.reload=function(e){var t=new n.BootstrapParams;e&&(t=$.extend(t,e)),t.isReload=!0,$.disposePubSub(),this.bootstrapper.bootstrap(t)},t.prototype.getCanvasIndexParam=function(){return this.bootstrapper.params.getParam(c.canvasIndex)},t.prototype.getSequenceIndexParam=function(){return this.bootstrapper.params.getParam(c.sequenceIndex)},t.prototype.isSeeAlsoEnabled=function(){return this.config.options.seeAlsoEnabled!==!1},t.prototype.getShareUrl=function(){if(this.isDeepLinkingEnabled())return Utils.Documents.isInIFrame()?parent.document.location.href:document.location.href;if(this.helper.hasRelatedPage()){var e=this.helper.getRelated();return e&&e.length&&(e=e[0]),e["@id"]}return null},t.prototype.getIIIFShareUrl=function(){return this.helper.iiifResourceUri+"?manifest="+this.helper.iiifResourceUri},t.prototype.addTimestamp=function(e){return e+"?t="+Utils.Dates.getTimeStamp()},t.prototype.isDeepLinkingEnabled=function(){return this.isHomeDomain&&this.isOnlyInstance},t.prototype.isOnHomeDomain=function(){return this.isDeepLinkingEnabled()},t.prototype.getDomain=function(){var e=Utils.Urls.getUrlParts(this.helper.iiifResourceUri);return e.host},t.prototype.getEmbedDomain=function(){return this.embedDomain},t.prototype.getSettings=function(){if(Utils.Bools.getBool(this.config.options.saveUserSettings,!1)){var e=Utils.Storage.get("uv.settings",Utils.StorageType.local);if(e)return $.extend(this.config.options,e.value)}return this.config.options},t.prototype.updateSettings=function(e){if(Utils.Bools.getBool(this.config.options.saveUserSettings,!1)){var t=Utils.Storage.get("uv.settings",Utils.StorageType.local);t&&(e=$.extend(t.value,e)),Utils.Storage.set("uv.settings",e,31536e4,Utils.StorageType.local)}this.config.options=$.extend(this.config.options,e)},t.prototype.sanitize=function(e){var t=document.createElement("div"),i=$(t);i.html(e);var n=new Sanitize({elements:["a","b","br","img","p","i","span"],attributes:{a:["href"],img:["src","alt"]},protocols:{a:{href:["http","https"]}}});return i.html(n.clean_node(t)),i.html()},t.prototype.getLocales=function(){if(this.locales)return this.locales;var e=this.config.localisation.locales.clone(),t=this.bootstrapper.params.locales,i=[];$.each(t,function(t,n){var o=_.filter(e,function(e){return e.name===n.name});if(o.length){var s=o[0];n.label&&(s.label=n.label),s.added=!0,i.push(s)}});var n=Utils.Bools.getBool(this.config.options.limitLocales,!1);return n||$.each(e,function(e,t){t.added||i.push(t),delete t.added}),this.locales=i},t.prototype.getAlternateLocale=function(){for(var e,t=this.getLocales(),i=0;i<t.length;i++){var n=t[i];n.name!==this.locale&&(e=n)}return n},t.prototype.changeLocale=function(e){var t=this.locales.clone(),i=t.indexOfTest(function(t){return t.name===e});t.move(i,0);var o=this.serializeLocales(t),s=new n.BootstrapParams;s.setLocale(o),this.reload(s)},t.prototype.serializeLocales=function(e){for(var t="",i=0;i<e.length;i++){var n=e[i];i>0&&(t+=","),t+=n.name,n.label&&(t+=":"+n.label)}return t},t.prototype.getSerializedLocales=function(){return this.serializeLocales(this.locales)},t.prototype.getSharePreview=function(){var e={};e.title=this.helper.getLabel();var t=this.helper.getCurrentCanvas(),i=t.getProperty("thumbnail");return i&&_.isString(i)||(i=t.getCanonicalImageUri(this.config.options.bookmarkThumbWidth)),e.image=i,e},t.prototype.getPagedIndices=function(e){return"undefined"==typeof e&&(e=this.helper.canvasIndex),[e]},t.prototype.getCurrentCanvases=function(){for(var e=this.getPagedIndices(this.helper.canvasIndex),t=[],i=0;i<e.length;i++){var n=e[i],o=this.helper.getCanvasByIndex(n);t.push(o)}return t},t.prototype.getCanvasLabels=function(e){var t=this.getPagedIndices(),i="";if(1===t.length)i=e;else for(var n=1;n<=t.length;n++)i.length&&(i+=","),i+=e+" "+n;return i},t.prototype.getCurrentCanvasRange=function(){var e=this.helper.getCanvasRange(this.helper.getCurrentCanvas());return e},t.prototype.getExternalResources=function(e){var t=this,n=this.getPagedIndices(),o=[];_.each(n,function(i){var n=t.helper.getCanvasByIndex(i),s=new Manifold.ExternalResource(n,t.helper.getInfoUri);if(s.index=i,e){var r=_.find(e,function(e){return e.dataUri===s.dataUri});r?o.push(r):o.push(s)}else o.push(s)});var s=this.config.options.tokenStorage;return new Promise(function(e){manifesto.Utils.loadExternalResources(o,s,t.clickThrough,t.restricted,t.login,t.getAccessToken,t.storeAccessToken,t.getStoredAccessToken,t.handleExternalResourceResponse).then(function(i){t.resources=$.map(i,function(e){return e.data.index=e.index,_.toPlainObject(e.data)}),e(t.resources)})["catch"](function(e){switch(e.name){case manifesto.StatusCodes.AUTHORIZATION_FAILED.toString():$.publish(i.LOGIN_FAILED);break;case manifesto.StatusCodes.FORBIDDEN.toString():$.publish(i.FORBIDDEN);break;case manifesto.StatusCodes.RESTRICTED.toString():break;default:t.showMessage(e.message||e)}})})},t.prototype.getParam=function(e){var t;return this.isDeepLinkingEnabled()&&(t=Utils.Urls.getHashParameter(this.bootstrapper.params.paramMap[e],parent.document)),t||(t=Utils.Urls.getQuerystringParameter(this.bootstrapper.params.paramMap[e])),t},t.prototype.setParam=function(e,t){this.isDeepLinkingEnabled()&&Utils.Urls.setHashParameter(this.bootstrapper.params.paramMap[e],t,parent.document)},t.prototype.viewCanvas=function(e){this.helper.isCanvasIndexOutOfRange(e)&&(this.showMessage(this.config.content.canvasIndexOutOfRange),e=0),this.lastCanvasIndex=this.helper.canvasIndex,this.helper.canvasIndex=e,$.publish(i.CANVAS_INDEX_CHANGED,[e]),$.publish(i.OPEN_EXTERNAL_RESOURCE),this.setParam(c.canvasIndex,e)},t.prototype.showMessage=function(e,t,n,o){this.closeActiveDialogue(),$.publish(i.SHOW_GENERIC_DIALOGUE,[{message:e,acceptCallback:t,buttonText:n,allowClose:o}])},t.prototype.closeActiveDialogue=function(){$.publish(i.CLOSE_ACTIVE_DIALOGUE)},t.prototype.isOverlayActive=function(){return p.$overlays.is(":visible")},t.prototype.viewManifest=function(e){var t=new n.BootstrapParams;t.manifestUri=this.helper.iiifResourceUri,t.collectionIndex=this.helper.getCollectionIndex(e),t.manifestIndex=e.index,t.sequenceIndex=0,t.canvasIndex=0,this.reload(t)},t.prototype.viewCollection=function(e){var t=new n.BootstrapParams;t.manifestUri=this.helper.iiifResourceUri,t.collectionIndex=e.index,t.manifestIndex=0,t.sequenceIndex=0,t.canvasIndex=0,this.reload(t)},t.prototype.isFullScreen=function(){return this.bootstrapper.isFullScreen},t.prototype.isHeaderPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.headerPanelEnabled,!0)},t.prototype.isLeftPanelEnabled=function(){if(Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)){if(this.helper.hasParentCollection())return!0;if(this.helper.isMultiCanvas()&&this.helper.getViewingHint().toString()!==manifesto.ViewingHint.continuous().toString())return!0;
3
+ }return!1},t.prototype.isRightPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.rightPanelEnabled,!0)},t.prototype.isFooterPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.footerPanelEnabled,!0)},t.prototype.useArrowKeysToNavigate=function(){return Utils.Bools.getBool(this.config.options.useArrowKeysToNavigate,!0)},t.prototype.bookmark=function(){},t.prototype.feedback=function(){this.triggerSocket(i.FEEDBACK,new n.BootstrapParams)},t.prototype.getBookmarkUri=function(){var e=parent.document.URL,t=Utils.Urls.getUrlParts(e),i=t.pathname+t.search+parent.document.location.hash;return i.startsWith("/")||(i="/"+i),i},t.prototype.clickThrough=function(e){return new Promise(function(t){$.publish(i.SHOW_CLICKTHROUGH_DIALOGUE,[{resource:e,acceptCallback:function(){var n=window.open(e.clickThroughService.id),o=window.setInterval(function(){n.closed&&(window.clearInterval(o),$.publish(i.CLICKTHROUGH),t())},500)}}])})},t.prototype.restricted=function(e){return new Promise(function(t,n){$.publish(i.SHOW_RESTRICTED_DIALOGUE,[{resource:e,acceptCallback:function(){$.publish(i.LOAD_FAILED),n(e)}}])})},t.prototype.login=function(e){return new Promise(function(t){var n={};e.status===HTTPStatusCode.FORBIDDEN&&(n.warningMessage=l.FORBIDDEN,n.showCancelButton=!0),$.publish(i.SHOW_LOGIN_DIALOGUE,[{resource:e,loginCallback:function(){var n=window.open(e.loginService.id+"?t="+(new Date).getTime()),o=window.setInterval(function(){n.closed&&(window.clearInterval(o),$.publish(i.LOGIN),t())},500)},logoutCallback:function(){var n=window.open(e.logoutService.id+"?t="+(new Date).getTime()),o=window.setInterval(function(){n.closed&&(window.clearInterval(o),$.publish(i.LOGOUT),t())},500)},options:n}])})},t.prototype.getAccessToken=function(e,t){return new Promise(function(i,n){var o=e.tokenService.id,s=o+"|"+(new Date).getTime(),r=function(e){window.removeEventListener("message",r);var o=e.data;o.error?t?n(o.errorDescription):i(null):i(o)};window.addEventListener("message",r,!1);var a=o+"?messageId="+s;$("#commsFrame").prop("src",a)})},t.prototype.storeAccessToken=function(e,t,i){return new Promise(function(n,o){Utils.Storage.set(e.tokenService.id,t,t.expiresIn,new Utils.StorageType(i)),n()})},t.prototype.getStoredAccessToken=function(e,t){return new Promise(function(i,n){var o,s=[];if(e.tokenService&&(o=Utils.Storage.get(e.tokenService.id,new Utils.StorageType(t))),o)s.push(o);else for(var r=Utils.Urls.getUrlParts(e.dataUri).hostname,a=Utils.Storage.getItems(new Utils.StorageType(t)),l=0;l<a.length;l++)o=a[l],o.key.contains(r)&&s.push(o);s=_.sortBy(s,function(e){return e.expiresAt});var h;s.length&&(h=s.last().value),i(h)})},t.prototype.handleExternalResourceResponse=function(e){return new Promise(function(t,n){if(e.isResponseHandled=!0,e.status===HTTPStatusCode.OK)t(e);else if(e.status===HTTPStatusCode.MOVED_TEMPORARILY)t(e),$.publish(i.RESOURCE_DEGRADED,[e]);else if(e.error.status===HTTPStatusCode.UNAUTHORIZED||e.error.status===HTTPStatusCode.INTERNAL_SERVER_ERROR)if(Modernizr.cors)n(e.error.statusText);else{var o=new s(r.AUTH_CORS_ERROR,null);$.publish(i.SHOW_INFORMATION,[o]),t(e)}else if(e.error.status===HTTPStatusCode.FORBIDDEN){var a=new Error;a.message="Forbidden",a.name=manifesto.StatusCodes.FORBIDDEN.toString(),n(a)}else n(e.error.statusText)})},t.prototype.handleDegraded=function(e){var t=new s(r.DEGRADED_RESOURCE,e);$.publish(i.SHOW_INFORMATION,[t])},t}();return d}),define("modules/uv-shared-module/Bookmark",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i}),define("extensions/uv-mediaelement-extension/Commands",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.namespace="mediaelementExtension.",i.MEDIA_ENDED=i.namespace+"onMediaEnded",i.MEDIA_PAUSED=i.namespace+"onMediaPaused",i.MEDIA_PLAYED=i.namespace+"onMediaPlayed",i}),define("modules/uv-shared-module/DownloadOption",["require","exports"],function(e,t){"use strict";var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e}();return i.currentViewAsJpg=new i("currentViewAsJpg"),i.dynamicCanvasRenderings=new i("dynamicCanvasRenderings"),i.dynamicImageRenderings=new i("dynamicImageRenderings"),i.dynamicSequenceRenderings=new i("dynamicSequenceRenderings"),i.entireFileAsOriginal=new i("entireFileAsOriginal"),i.selection=new i("selection"),i.wholeImageHighRes=new i("wholeImageHighRes"),i.wholeImagesHighRes=new i("wholeImagesHighRes"),i.wholeImageLowResAsJpg=new i("wholeImageLowResAsJpg"),i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/DownloadDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue","../uv-shared-module/DownloadOption"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_DOWNLOAD_DIALOGUE,this.closeCommand=i.HIDE_DOWNLOAD_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1>"+this.content.title+"</h1>"),this.$content.append(this.$title),this.$noneAvailable=$('<div class="noneAvailable">'+this.content.noneAvailable+"</div>"),this.$content.append(this.$noneAvailable),this.$downloadOptions=$('<ol class="options"></ol>'),this.$content.append(this.$downloadOptions),this.$footer=$('<div class="footer"></div>'),this.$content.append(this.$footer),this.$termsOfUseButton=$('<a href="#">'+this.extension.config.content.termsOfUse+"</a>"),this.$footer.append(this.$termsOfUseButton),this.$termsOfUseButton.onPressed(function(){$.publish(i.SHOW_TERMS_OF_USE)}),this.$element.hide(),this.updateTermsOfUseButton()},t.prototype.addEntireFileDownloadOptions=function(){var e=this;if(this.isDownloadOptionAvailable(o.entireFileAsOriginal)){this.$downloadOptions.empty();var t=this.extension.helper.getCurrentCanvas(),i=!1;$.each(t.getRenderings(),function(t,n){var o=n.getFormat(),s="";o&&(s=o.toString()),e.addEntireFileDownloadOption(n.id,Manifesto.TranslationCollection.getValue(n.getLabel()),s),i=!0}),i||this.addEntireFileDownloadOption(t.id,null,null)}},t.prototype.addEntireFileDownloadOption=function(e,t,i){t?t+=" ({0})":t=this.content.entireFileAsOriginal;var n;n=i?Utils.Files.simplifyMimeType(i):this.getFileExtension(e),this.$downloadOptions.append('<li><a href="'+e+'" target="_blank" download tabindex="0">'+String.format(t,n)+"</li>")},t.prototype.updateNoneAvailable=function(){this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show()},t.prototype.updateTermsOfUseButton=function(){var e=this.extension.helper.getAttribution();Utils.Bools.getBool(this.extension.config.options.termsOfUseEnabled,!1)&&e?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()},t.prototype.getFileExtension=function(e){return e.split(".").pop()},t.prototype.isDownloadOptionAvailable=function(e){switch(e){case o.entireFileAsOriginal:this.extension.helper.manifest.getService(manifesto.ServiceProfile.uiExtensions());if(!this.extension.helper.isUIEnabled("mediaDownload"))return!1}return!0},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){this.setDockedPosition()},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.updateNoneAvailable(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/ShareDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t)||this;return i.aspectRatio=.75,i.isEmbedViewVisible=!1,i.isShareViewVisible=!1,i.maxHeight=i.maxWidth*i.aspectRatio,i.maxWidth=8e3,i.minHeight=i.minWidth*i.aspectRatio,i.minWidth=200,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("shareDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_SHARE_DIALOGUE,this.closeCommand=i.HIDE_SHARE_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i),t.isShareAvailable()?t.openShareView():t.openEmbedView()}),$.subscribe(this.closeCommand,function(e){t.close()}),$.subscribe(i.SHOW_EMBED_DIALOGUE,function(e,i){t.open(i),t.openEmbedView()}),this.$tabs=$('<div class="tabs"></div>'),this.$content.append(this.$tabs),this.$shareButton=$('<a class="share tab default" tabindex="0">'+this.content.share+"</a>"),this.$shareButton.prop("title",this.content.share),this.$tabs.append(this.$shareButton),this.$embedButton=$('<a class="embed tab" tabindex="0">'+this.content.embed+"</a>"),this.$embedButton.prop("title",this.content.embed),this.$tabs.append(this.$embedButton),this.$tabsContent=$('<div class="tabsContent"></div>'),this.$content.append(this.$tabsContent),this.$footer=$('<div class="footer"></div>'),this.$content.append(this.$footer),this.$shareView=$('<div class="shareView view"></div>'),this.$tabsContent.append(this.$shareView),this.$shareHeader=$('<div class="header"></div>'),this.$shareView.append(this.$shareHeader),this.$shareLink=$('<a class="shareLink" onclick="return false;"></a>'),this.$shareView.append(this.$shareLink),this.$shareInput=$('<input class="shareInput" type="text" readonly="true" />'),this.$shareView.append(this.$shareInput),this.$shareFrame=$('<iframe class="shareFrame"></iframe>'),this.$shareView.append(this.$shareFrame),this.$embedView=$('<div class="embedView view"></div>'),this.$tabsContent.append(this.$embedView),this.$embedHeader=$('<div class="header"></div>'),this.$embedView.append(this.$embedHeader),this.$code=$('<input class="code" type="text" readonly="true" />'),this.$embedView.append(this.$code),this.$customSize=$('<div class="customSize"></div>'),this.$embedView.append(this.$customSize),this.$size=$('<span class="size">'+this.content.size+"</span>"),this.$customSize.append(this.$size),this.$customSizeDropDown=$('<select id="size"></select>'),this.$customSize.append(this.$customSizeDropDown),this.$customSizeDropDown.append('<option value="small" data-width="560" data-height="420">560 x 420</option>'),this.$customSizeDropDown.append('<option value="medium" data-width="640" data-height="480">640 x 480</option>'),this.$customSizeDropDown.append('<option value="large" data-width="800" data-height="600">800 x 600</option>'),this.$customSizeDropDown.append('<option value="custom">'+this.content.customSize+"</option>"),this.$widthInput=$('<input class="width" type="text" maxlength="10" />'),this.$customSize.append(this.$widthInput),this.$x=$('<span class="x">x</span>'),this.$customSize.append(this.$x),this.$heightInput=$('<input class="height" type="text" maxlength="10" />'),this.$customSize.append(this.$heightInput);var n=this.extension.getIIIFShareUrl();this.$iiifButton=$('<a class="imageBtn iiif" href="'+n+'" title="'+this.content.iiif+'" target="_blank"></a>'),this.$footer.append(this.$iiifButton),this.$termsOfUseButton=$('<a href="#">'+this.extension.config.content.termsOfUse+"</a>"),this.$footer.append(this.$termsOfUseButton),this.$widthInput.on("keydown",function(e){return Utils.Numbers.numericalInput(e)}),this.$heightInput.on("keydown",function(e){return Utils.Numbers.numericalInput(e)}),this.$shareInput.focus(function(){$(this).select()}),this.$code.focus(function(){$(this).select()}),this.$shareButton.onPressed(function(){t.openShareView()}),this.$embedButton.onPressed(function(){t.openEmbedView()}),this.$customSizeDropDown.change(function(){t.update()}),this.$widthInput.change(function(){t.updateHeightRatio(),t.update()}),this.$heightInput.change(function(){t.updateWidthRatio(),t.update()}),this.$termsOfUseButton.onPressed(function(){$.publish(i.SHOW_TERMS_OF_USE)}),this.$element.hide(),this.update()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.update()},t.prototype.getShareUrl=function(){return this.extension.getShareUrl()},t.prototype.isShareAvailable=function(){return!!this.getShareUrl()},t.prototype.update=function(){this.isShareAvailable()?this.$shareButton.show():this.$shareButton.hide();var e=this.getSelectedSize();"custom"===e.val()?(this.$widthInput.show(),this.$x.show(),this.$heightInput.show()):(this.$widthInput.hide(),this.$x.hide(),this.$heightInput.hide(),this.currentWidth=Number(e.data("width")),this.currentHeight=Number(e.data("height")),this.$widthInput.val(String(this.currentWidth)),this.$heightInput.val(String(this.currentHeight))),this.updateInstructions(),this.updateShareOptions(),this.updateShareFrame(),this.updateTermsOfUseButton()},t.prototype.updateShareOptions=function(){this.$shareInput.val(this.getShareUrl()),this.$shareLink.prop("href",this.getShareUrl()),this.$shareLink.text(this.getShareUrl()),$.browser.mobile?(this.$shareInput.hide(),this.$shareLink.show()):(this.$shareInput.show(),this.$shareLink.hide())},t.prototype.updateInstructions=function(){Utils.Bools.getBool(this.options.instructionsEnabled,!1)?(this.$shareHeader.show(),this.$embedHeader.show(),this.$shareHeader.text(this.content.shareInstructions),this.$embedHeader.text(this.content.embedInstructions)):(this.$shareHeader.hide(),this.$embedHeader.hide())},t.prototype.getSelectedSize=function(){return this.$customSizeDropDown.find(":selected")},t.prototype.updateWidthRatio=function(){this.currentHeight=Number(this.$heightInput.val()),this.currentHeight<this.minHeight?(this.currentHeight=this.minHeight,this.$heightInput.val(String(this.currentHeight))):this.currentHeight>this.maxHeight&&(this.currentHeight=this.maxHeight,this.$heightInput.val(String(this.currentHeight))),this.currentWidth=Math.floor(this.currentHeight/this.aspectRatio),this.$widthInput.val(String(this.currentWidth))},t.prototype.updateHeightRatio=function(){this.currentWidth=Number(this.$widthInput.val()),this.currentWidth<this.minWidth?(this.currentWidth=this.minWidth,this.$widthInput.val(String(this.currentWidth))):this.currentWidth>this.maxWidth&&(this.currentWidth=this.maxWidth,this.$widthInput.val(String(this.currentWidth))),this.currentHeight=Math.floor(this.currentWidth*this.aspectRatio),this.$heightInput.val(String(this.currentHeight))},t.prototype.updateShareFrame=function(){var e=this.extension.helper.getShareServiceUrl();Utils.Bools.getBool(this.config.options.shareFrameEnabled,!0)&&e?(this.$shareFrame.prop("src",e),this.$shareFrame.show()):this.$shareFrame.hide()},t.prototype.updateTermsOfUseButton=function(){var e=this.extension.helper.getAttribution();Utils.Bools.getBool(this.extension.config.options.termsOfUseEnabled,!1)&&e?this.$termsOfUseButton.show():this.$termsOfUseButton.hide()},t.prototype.openShareView=function(){this.isShareViewVisible=!0,this.isEmbedViewVisible=!1,this.$embedView.hide(),this.$shareView.show(),this.$shareButton.addClass("on default"),this.$embedButton.removeClass("on default"),this.resize()},t.prototype.openEmbedView=function(){this.isShareViewVisible=!1,this.isEmbedViewVisible=!0,this.$embedView.show(),this.$shareView.hide(),this.$shareButton.removeClass("on default"),this.$embedButton.addClass("on default"),this.resize()},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.getViews=function(){return this.$tabsContent.find(".view")},t.prototype.equaliseViewHeights=function(){this.getViews().equaliseHeight(!0)},t.prototype.resize=function(){this.equaliseViewHeights(),this.setDockedPosition()},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/FooterPanel",["require","exports","./BaseCommands","./BaseView","./Metrics"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("footerPanel"),e.prototype.create.call(this),$.subscribe(i.TOGGLE_FULLSCREEN,function(){t.updateFullScreenButton()}),$.subscribe(i.METRIC_CHANGED,function(){t.updateMinimisedButtons(),t.updateMoreInfoButton()}),$.subscribe(i.SETTINGS_CHANGED,function(){t.updateDownloadButton()}),this.$options=$('<div class="options"></div>'),this.$element.append(this.$options),this.$feedbackButton=$('<a class="feedback" title="'+this.content.feedback+'" tabindex="0">'+this.content.feedback+"</a>"),this.$options.prepend(this.$feedbackButton),this.$openButton=$('<a class="open" title="'+this.content.open+'" tabindex="0">'+this.content.open+"</a>"),this.$options.prepend(this.$openButton),this.$bookmarkButton=$('<a class="bookmark" title="'+this.content.bookmark+'" tabindex="0">'+this.content.bookmark+"</a>"),this.$options.prepend(this.$bookmarkButton),this.$shareButton=$('<a href="#" class="share" title="'+this.content.share+'" tabindex="0">'+this.content.share+"</a>"),this.$options.append(this.$shareButton),this.$embedButton=$('<a href="#" class="embed" title="'+this.content.embed+'" tabindex="0">'+this.content.embed+"</a>"),this.$options.append(this.$embedButton),this.$downloadButton=$('<a class="download" title="'+this.content.download+'" tabindex="0">'+this.content.download+"</a>"),this.$options.prepend(this.$downloadButton),this.$moreInfoButton=$('<a href="#" class="moreInfo" title="'+this.content.moreInfo+'" tabindex="0">'+this.content.moreInfo+"</a>"),this.$options.prepend(this.$moreInfoButton),this.$fullScreenBtn=$('<a href="#" class="fullScreen" title="'+this.content.fullScreen+'" tabindex="0">'+this.content.fullScreen+"</a>"),this.$options.append(this.$fullScreenBtn),this.$openButton.onPressed(function(){$.publish(i.OPEN)}),this.$feedbackButton.onPressed(function(){$.publish(i.FEEDBACK)}),this.$bookmarkButton.onPressed(function(){$.publish(i.BOOKMARK)}),this.$shareButton.onPressed(function(){$.publish(i.SHOW_SHARE_DIALOGUE,[t.$shareButton])}),this.$embedButton.onPressed(function(){$.publish(i.SHOW_EMBED_DIALOGUE,[t.$embedButton])}),this.$downloadButton.onPressed(function(){$.publish(i.SHOW_DOWNLOAD_DIALOGUE,[t.$downloadButton])}),this.$moreInfoButton.onPressed(function(){$.publish(i.SHOW_MOREINFO_DIALOGUE,[t.$moreInfoButton])}),this.$fullScreenBtn.on("click",function(e){e.preventDefault(),$.publish(i.TOGGLE_FULLSCREEN)}),Utils.Bools.getBool(this.options.embedEnabled,!0)||this.$embedButton.hide(),this.updateMoreInfoButton(),this.updateOpenButton(),this.updateFeedbackButton(),this.updateBookmarkButton(),this.updateEmbedButton(),this.updateDownloadButton(),this.updateFullScreenButton(),this.updateShareButton(),this.updateMinimisedButtons()},t.prototype.updateMinimisedButtons=function(){return Utils.Bools.getBool(this.options.minimiseButtons,!1)?void this.$options.addClass("minimiseButtons"):void(this.extension.metric===o.MOBILE_LANDSCAPE?this.$options.addClass("minimiseButtons"):this.$options.removeClass("minimiseButtons"))},t.prototype.updateMoreInfoButton=function(){var e=Utils.Bools.getBool(this.options.moreInfoEnabled,!1);e&&this.extension.metric===o.MOBILE_LANDSCAPE?this.$moreInfoButton.show():this.$moreInfoButton.hide()},t.prototype.updateOpenButton=function(){var e=Utils.Bools.getBool(this.options.openEnabled,!1);e&&!this.extension.isHomeDomain?this.$openButton.show():this.$openButton.hide()},t.prototype.updateFullScreenButton=function(){Utils.Bools.getBool(this.options.fullscreenEnabled,!0)||this.$fullScreenBtn.hide(),this.extension.isLightbox&&this.$fullScreenBtn.addClass("lightbox"),this.extension.isFullScreen()?(this.$fullScreenBtn.swapClass("fullScreen","exitFullscreen"),this.$fullScreenBtn.text(this.content.exitFullScreen),this.$fullScreenBtn.attr("title",this.content.exitFullScreen)):(this.$fullScreenBtn.swapClass("exitFullscreen","fullScreen"),this.$fullScreenBtn.text(this.content.fullScreen),this.$fullScreenBtn.attr("title",this.content.fullScreen))},t.prototype.updateEmbedButton=function(){this.extension.helper.isUIEnabled("embed")&&Utils.Bools.getBool(this.options.embedEnabled,!1)?$.browser.mobile||this.$embedButton.show():this.$embedButton.hide()},t.prototype.updateShareButton=function(){this.extension.helper.isUIEnabled("share")&&Utils.Bools.getBool(this.options.shareEnabled,!0)?this.$shareButton.show():this.$shareButton.hide()},t.prototype.updateDownloadButton=function(){var e=Utils.Bools.getBool(this.options.downloadEnabled,!0);e?this.$downloadButton.show():this.$downloadButton.hide()},t.prototype.updateFeedbackButton=function(){var e=Utils.Bools.getBool(this.options.feedbackEnabled,!1);e?this.$feedbackButton.show():this.$feedbackButton.hide()},t.prototype.updateBookmarkButton=function(){var e=Utils.Bools.getBool(this.options.bookmarkEnabled,!1);e?this.$bookmarkButton.show():this.$bookmarkButton.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return s}),define("modules/uv-shared-module/Information",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.message=e,this.actions=t}return e}();return i}),define("modules/uv-shared-module/InformationAction",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i}),define("modules/uv-shared-module/InformationFactory",["require","exports","./BaseCommands","./Information","./InformationAction","./InformationType"],function(e,t,i,n,o,s){"use strict";var r=function(){function e(e){this.extension=e}return e.prototype.Get=function(e){switch(e.informationType){case s.AUTH_CORS_ERROR:return new n(this.extension.config.content.authCORSError,[]);case s.DEGRADED_RESOURCE:var t=[],r=new o;return r.label=this.extension.config.content.degradedResourceLogin,r.action=function(){$.publish(i.HIDE_INFORMATION),$.publish(i.OPEN_EXTERNAL_RESOURCE,[[e.param]])},t.push(r),new n(this.extension.config.content.degradedResourceMessage,t)}},e}();return r});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/HeaderPanel",["require","exports","./BaseCommands","./BaseView","../uv-shared-module/InformationFactory"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t,!1,!1)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("headerPanel"),e.prototype.create.call(this),$.subscribe(i.SHOW_INFORMATION,function(e,i){t.showInformation(i)}),$.subscribe(i.HIDE_INFORMATION,function(){t.hideInformation()}),this.$options=$('<div class="options"></div>'),this.$element.append(this.$options),this.$centerOptions=$('<div class="centerOptions"></div>'),this.$options.append(this.$centerOptions),this.$rightOptions=$('<div class="rightOptions"></div>'),this.$options.append(this.$rightOptions),this.$localeToggleButton=$('<a class="localeToggle" tabindex="0"></a>'),this.$rightOptions.append(this.$localeToggleButton),this.$settingsButton=$('<a class="imageBtn settings" tabindex="0"></a>'),this.$settingsButton.attr("title",this.content.settings),this.$rightOptions.append(this.$settingsButton),this.$informationBox=$('<div class="informationBox"> <div class="message"></div> <div class="actions"></div> <div class="close"></div> </div>'),this.$element.append(this.$informationBox),this.$informationBox.hide(),this.$informationBox.find(".close").attr("title",this.content.close),this.$informationBox.find(".close").on("click",function(e){e.preventDefault(),$.publish(i.HIDE_INFORMATION)}),this.$localeToggleButton.on("click",function(){t.extension.changeLocale(String(t.$localeToggleButton.data("locale")))}),this.$settingsButton.onPressed(function(){$.publish(i.SHOW_SETTINGS_DIALOGUE)}),this.updateLocaleToggle(),this.updateSettingsButton()},t.prototype.updateLocaleToggle=function(){if(!this.localeToggleIsVisible())return void this.$localeToggleButton.hide();var e=this.extension.getAlternateLocale(),t=e.name.split("-")[0].toUpperCase();this.$localeToggleButton.data("locale",e.name),this.$localeToggleButton.attr("title",e.label),this.$localeToggleButton.text(t)},t.prototype.updateSettingsButton=function(){var e=Utils.Bools.getBool(this.options.settingsButtonEnabled,!0);e?this.$settingsButton.show():this.$settingsButton.hide()},t.prototype.localeToggleIsVisible=function(){return this.extension.getLocales().length>1&&Utils.Bools.getBool(this.options.localeToggleEnabled,!1)},t.prototype.showInformation=function(e){var t=new o(this.extension);this.information=t.Get(e);var i=this.$informationBox.find(".message");i.html(this.information.message).find("a").attr("target","_top");var n=this.$informationBox.find(".actions");n.empty();for(var s=0;s<this.information.actions.length;s++){var r=this.information.actions[s],a=$('<a href="#" class="btn btn-default">'+r.label+"</a>");a.on("click",r.action),n.append(a)}this.$informationBox.show(),this.$element.addClass("showInformation"),this.extension.resize()},t.prototype.hideInformation=function(){this.$element.removeClass("showInformation"),this.$informationBox.hide(),this.extension.resize()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateSettings=function(e){this.extension.updateSettings(e),$.publish(i.UPDATE_SETTINGS,[e])},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$element.width(),i=t/2,n=this.$centerOptions.outerWidth(),o=i-n/2;if(this.$centerOptions.css({left:o}),this.$informationBox.is(":visible")){var s=this.$informationBox.find(".actions"),r=this.$informationBox.find(".message");r.width(this.$element.width()-r.horizontalMargins()-s.outerWidth(!0)-this.$informationBox.find(".close").outerWidth(!0)-1),r.ellipsisFill(this.information.message)}this.extension.width()<this.extension.config.options.minWidthBreakPoint?this.localeToggleIsVisible()&&this.$localeToggleButton.hide():this.localeToggleIsVisible()&&this.$localeToggleButton.show()},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/HelpDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("helpDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_HELP_DIALOGUE,this.closeCommand=i.HIDE_HELP_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$scroll=$('<div class="scroll"></div>'),this.$content.append(this.$scroll),this.$message=$("<p></p>"),this.$scroll.append(this.$message),this.$title.text(this.content.title),this.$message.html(this.content.text),this.$message.targetBlank(),this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/CenterPanel",["require","exports","./Shell","./BaseView"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t,!1,!0)||this}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$title=$('<div class="title"></div>'),this.$element.append(this.$title),this.$content=$('<div id="content" class="content"></div>'),this.$element.append(this.$content),this.$attribution=$('<div class="attribution"> <div class="header"> <div class="title"></div> <div class="close"></div> </div> <div class="main"> <div class="attribution-text"></div> <div class="license"></div> <div class="logo"></div> </div> </div>'),this.$attribution.find(".header .title").text(this.content.attribution),this.$content.append(this.$attribution),this.$attribution.hide(),this.$closeAttributionButton=this.$attribution.find(".header .close"),this.$closeAttributionButton.on("click",function(e){e.preventDefault(),t.$attribution.hide()}),Utils.Bools.getBool(this.options.titleEnabled,!0)||this.$title.hide()},t.prototype.updateAttribution=function(){var e=this,t=this.extension.helper.getAttribution(),i=Utils.Bools.getBool(this.options.attributionEnabled,!0);if(t&&i){this.$attribution.show();var n=this.$attribution.find(".attribution-text"),o=this.$attribution.find(".license"),s=this.$attribution.find(".logo");
4
+ n.html(this.extension.sanitize(t)),n.find("img").one("load",function(){e.resize()}).each(function(){this.complete&&$(this).load()}),n.targetBlank(),n.toggleExpandText(this.options.trimAttributionCount,function(){e.resize()}),o.hide(),s.hide()}},t.prototype.resize=function(){e.prototype.resize.call(this);var t=i.$leftPanel.is(":visible")?Math.floor(i.$leftPanel.width()):0,n=i.$rightPanel.is(":visible")?Math.floor(i.$rightPanel.width()):0,o=Math.floor(this.$element.parent().width()-t-n);this.$element.css({left:t,width:o});var s;s=this.options&&this.options.titleEnabled===!1?0:this.$title.height(),this.$content.height(this.$element.height()-s),this.$content.width(this.$element.width()),this.$attribution&&this.$attribution.is(":visible")&&this.$attribution.css("top",this.$content.height()-this.$attribution.outerHeight()-this.$attribution.verticalMargins())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-mediaelement-extension/Commands","../uv-shared-module/CenterPanel"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("mediaelementCenterPanel"),e.prototype.create.call(this);var t=this;this.extension.isVideo()&&$.subscribe(i.TOGGLE_FULLSCREEN,function(e){t.bootstrapper.isFullScreen?(t.$container.css("backgroundColor","#000"),t.player.enterFullScreen(!1)):(t.$container.css("backgroundColor","transparent"),t.player.exitFullScreen(!1))}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.openMedia(i)}),this.$container=$('<div class="container"></div>'),this.$content.append(this.$container),this.title=this.extension.helper.getLabel()},t.prototype.openMedia=function(e){var t=this,i=this;this.extension.getExternalResources(e).then(function(){t.$container.empty();var e=t.extension.helper.getCurrentCanvas();t.mediaHeight=t.config.defaultHeight,t.mediaWidth=t.config.defaultWidth,t.$container.height(t.mediaHeight),t.$container.width(t.mediaWidth);var o=Utils.Dates.getTimeStamp(),s=t.extension.getPosterImageUri(),r=s?' poster="'+s+'"':"",a=[];if($.each(e.getRenderings(),function(e,t){a.push({type:t.getFormat().toString(),src:t.id})}),t.extension.isVideo())t.media=t.$container.append('<video id="'+o+'" type="video/mp4" class="mejs-uv" controls="controls" preload="none"'+r+"></video>"),t.player=new MediaElementPlayer("#"+o,{type:["video/mp4","video/webm","video/flv"],plugins:["flash"],alwaysShowControls:!1,autosizeProgress:!1,success:function(e){e.addEventListener("canplay",function(e){i.resize()}),e.addEventListener("play",function(e){$.publish(n.MEDIA_PLAYED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("pause",function(e){Math.floor(i.player.media.currentTime)!=Math.floor(i.player.media.duration)&&$.publish(n.MEDIA_PAUSED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("ended",function(e){$.publish(n.MEDIA_ENDED,[Math.floor(i.player.media.duration)])}),e.setSrc(a);try{e.load()}catch(t){}}});else{var l=0;for(var h in a)if("audio/mp3"===a[h].type){l=h;break}t.media=t.$container.append('<audio id="'+o+'" type="'+a[l].type+'" src="'+a[l].src+'" class="mejs-uv" controls="controls" preload="none"'+r+"></audio>"),t.player=new MediaElementPlayer("#"+o,{plugins:["flash"],alwaysShowControls:!1,autosizeProgress:!1,defaultVideoWidth:i.mediaWidth,defaultVideoHeight:i.mediaHeight,success:function(e){e.addEventListener("canplay",function(e){i.resize()}),e.addEventListener("play",function(e){$.publish(n.MEDIA_PLAYED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("pause",function(e){Math.floor(i.player.media.currentTime)!=Math.floor(i.player.media.duration)&&$.publish(n.MEDIA_PAUSED,[Math.floor(i.player.media.currentTime)])}),e.addEventListener("ended",function(e){$.publish(n.MEDIA_ENDED,[Math.floor(i.player.media.duration)])});try{e.load()}catch(t){}}})}t.resize()})},t.prototype.resize=function(){if(e.prototype.resize.call(this),"Firefox"===window.browserDetect.browser&&window.browserDetect.version<13)this.$container.width(this.mediaWidth),this.$container.height(this.mediaHeight);else{var t=Utils.Measurements.Dimensions.fitRect(this.mediaWidth,this.mediaHeight,this.$content.width(),this.$content.height());this.$container.height(t.height),this.$container.width(t.width)}this.player&&!this.extension.isFullScreen()&&this.player.resize();var i=Math.floor((this.$content.width()-this.$container.width())/2),n=Math.floor((this.$content.height()-this.$container.height())/2);this.$container.css({left:i,top:n}),this.$title.ellipsisFill(this.title)},t}(o);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/BaseExpandPanel",["require","exports","./BaseView"],function(e,t,i){"use strict";var n=function(e){function t(t){var i=e.call(this,t,!1,!0)||this;return i.isExpanded=!1,i.isFullyExpanded=!1,i.isUnopened=!0,i.autoToggled=!1,i.expandFullEnabled=!0,i}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$top=$('<div class="top"></div>'),this.$element.append(this.$top),this.$title=$('<div class="title"></div>'),this.$title.prop("title",this.content.title),this.$top.append(this.$title),this.$expandFullButton=$('<a class="expandFullButton" tabindex="0"></a>'),this.$expandFullButton.prop("title",this.content.expandFull),this.$top.append(this.$expandFullButton),Utils.Bools.getBool(this.config.options.expandFullEnabled,!0)||this.$expandFullButton.hide(),this.$collapseButton=$('<div class="collapseButton" tabindex="0"></div>'),this.$collapseButton.prop("title",this.content.collapse),this.$top.append(this.$collapseButton),this.$closed=$('<div class="closed"></div>'),this.$element.append(this.$closed),this.$expandButton=$('<a class="expandButton" tabindex="0"></a>'),this.$expandButton.prop("title",this.content.expand),this.$closed.append(this.$expandButton),this.$closedTitle=$('<a class="title"></a>'),this.$closedTitle.prop("title",this.content.title),this.$closed.append(this.$closedTitle),this.$main=$('<div class="main"></div>'),this.$element.append(this.$main),this.$expandButton.onPressed(function(){t.toggle()}),this.$expandFullButton.onPressed(function(){t.expandFull()}),this.$closedTitle.onPressed(function(){t.toggle()}),this.$title.onPressed(function(){t.isFullyExpanded?t.collapseFull():t.toggle()}),this.$collapseButton.onPressed(function(){t.isFullyExpanded?t.collapseFull():t.toggle()}),this.$top.hide(),this.$main.hide()},t.prototype.init=function(){e.prototype.init.call(this)},t.prototype.setTitle=function(e){this.$title.text(e),this.$closedTitle.text(e)},t.prototype.toggle=function(e){var t=this;e?this.autoToggled=!0:this.autoToggled=!1,this.isExpanded&&(this.$top.hide(),this.$main.hide(),this.$closed.show()),this.$element.stop().animate({width:this.getTargetWidth(),left:this.getTargetLeft()},this.options.panelAnimationDuration,function(){t.toggled()})},t.prototype.toggled=function(){this.toggleStart(),this.isExpanded=!this.isExpanded,this.isExpanded&&(this.$closed.hide(),this.$top.show(),this.$main.show()),this.toggleFinish(),this.isUnopened=!1},t.prototype.expandFull=function(){var e=this;this.isExpanded||this.toggled();var t=this.getFullTargetWidth(),i=this.getFullTargetLeft();this.expandFullStart(),this.$element.stop().animate({width:t,left:i},this.options.panelAnimationDuration,function(){e.expandFullFinish()})},t.prototype.collapseFull=function(){var e=this,t=this.getTargetWidth(),i=this.getTargetLeft();this.collapseFullStart(),this.$element.stop().animate({width:t,left:i},this.options.panelAnimationDuration,function(){e.collapseFullFinish()})},t.prototype.getTargetWidth=function(){return 0},t.prototype.getTargetLeft=function(){return 0},t.prototype.getFullTargetWidth=function(){return 0},t.prototype.getFullTargetLeft=function(){return 0},t.prototype.toggleStart=function(){},t.prototype.toggleFinish=function(){this.isExpanded&&!this.autoToggled?this.focusCollapseButton():this.focusExpandButton()},t.prototype.expandFullStart=function(){},t.prototype.expandFullFinish=function(){this.isFullyExpanded=!0,this.$expandFullButton.hide(),this.focusCollapseButton()},t.prototype.collapseFullStart=function(){},t.prototype.collapseFullFinish=function(){this.isFullyExpanded=!1,this.expandFullEnabled&&this.$expandFullButton.show(),this.focusExpandFullButton()},t.prototype.focusExpandButton=function(){var e=this;setTimeout(function(){e.$expandButton.focus()},1)},t.prototype.focusExpandFullButton=function(){var e=this;setTimeout(function(){e.$expandFullButton.focus()},1)},t.prototype.focusCollapseButton=function(){var e=this;setTimeout(function(){e.$collapseButton.focus()},1)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$main.height(this.$element.parent().height()-this.$top.outerHeight(!0))},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/RightPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){e.prototype.create.call(this),this.$element.width(this.options.panelCollapsedWidth)},t.prototype.init=function(){var t=this;e.prototype.init.call(this);var n=Utils.Bools.getBool(this.extension.getSettings().rightPanelOpen,this.options.panelOpen);n&&this.toggle(!0),$.subscribe(i.TOGGLE_EXPAND_RIGHT_PANEL,function(){t.isFullyExpanded?t.collapseFull():t.expandFull()})},t.prototype.getTargetWidth=function(){return this.isExpanded?this.options.panelCollapsedWidth:this.options.panelExpandedWidth},t.prototype.getTargetLeft=function(){return this.isExpanded?this.$element.parent().width()-this.options.panelCollapsedWidth:this.$element.parent().width()-this.options.panelExpandedWidth},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.isExpanded?$.publish(i.OPEN_RIGHT_PANEL):$.publish(i.CLOSE_RIGHT_PANEL),this.extension.updateSettings({rightPanelOpen:this.isExpanded})},t.prototype.resize=function(){e.prototype.resize.call(this),this.$element.css({left:Math.floor(this.$element.parent().width()-this.$element.outerWidth())})},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-moreinforightpanel-module/MoreInfoRightPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/RightPanel"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("moreInfoRightPanel"),e.prototype.create.call(this),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.databind()}),this.setTitle(this.config.content.title),this.$metadata=$('<div class="iiif-metadata-component"></div>'),this.$main.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent({target:this.$metadata[0],data:this._getData()})},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.databind()},t.prototype.databind=function(){this.component.options.data=this._getData(),this.component.set(null)},t.prototype._getData=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:this.extension.getCanvasLabels(this.content.page),content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),helper:this.extension.helper,licenseFormatter:null,limit:this.config.options.textLimit||4,limitType:IIIFComponents.MetadataComponentOptions.LimitType.LINES,manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this.extension.getCurrentCanvasRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:function(t){return e.extension.sanitize(t)},showAllLanguages:this.config.options.showAllLanguages}},t.prototype.resize=function(){e.prototype.resize.call(this),this.$main.height(this.$element.height()-this.$top.height()-this.$main.verticalMargins())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/LeftPanel",["require","exports","./BaseCommands","./BaseExpandPanel"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),this.$element.width(this.options.panelCollapsedWidth),$.subscribe(i.TOGGLE_EXPAND_LEFT_PANEL,function(){t.isFullyExpanded?t.collapseFull():t.expandFull()})},t.prototype.init=function(){e.prototype.init.call(this);var t=Utils.Bools.getBool(this.extension.getSettings().leftPanelOpen,this.options.panelOpen);t&&this.toggle(!0)},t.prototype.getTargetWidth=function(){return this.isFullyExpanded||!this.isExpanded?this.options.panelExpandedWidth:this.options.panelCollapsedWidth},t.prototype.getFullTargetWidth=function(){return this.$element.parent().width()},t.prototype.toggleFinish=function(){e.prototype.toggleFinish.call(this),this.isExpanded?$.publish(i.OPEN_LEFT_PANEL):$.publish(i.CLOSE_LEFT_PANEL),this.extension.updateSettings({leftPanelOpen:this.isExpanded})},t.prototype.resize=function(){e.prototype.resize.call(this),this.isFullyExpanded&&this.$element.width(this.$element.parent().width())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-shared-module/ThumbsView",["require","exports","./BaseCommands","./BaseView"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t,!0,!0)||this;return i.isCreated=!1,i.isOpen=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;e.prototype.create.call(this),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.selectIndex(parseInt(i))}),$.subscribe(i.LOGIN,function(){t.loadThumbs()}),$.subscribe(i.CLICKTHROUGH,function(){t.loadThumbs()}),this.$thumbs=$('<div class="thumbs"></div>'),this.$element.append(this.$thumbs),this.$thumbs.addClass(this.extension.helper.getViewingDirection().toString());var n=this;$.templates({thumbsTemplate:'<div id="thumb{{>index}}" class="{{:~className()}}" data-src="{{>uri}}" data-visible="{{>visible}}" data-index="{{>index}}"> <div class="wrap" style="height:{{>height + ~extraHeight()}}px"></div> <div class="info"> <span class="index">{{:#index + 1}}</span> <span class="label" title="{{>label}}">{{>label}}&nbsp;</span> <span class="searchResults" title="{{:~searchResultsTitle()}}">{{>data.searchResults}}</span> </div> </div> {{if ~separator()}} <div class="separator"></div> {{/if}}'});var o=this.options.thumbsExtraHeight;$.views.helpers({separator:function(){return!1},extraHeight:function(){return o},className:function(){var e="thumb";0===this.data.index&&(e+=" first"),this.data.uri||(e+=" placeholder");var t=n.extension.helper.getViewingDirection().toString();return e+=t===manifesto.ViewingDirection.topToBottom().toString()||t===manifesto.ViewingDirection.bottomToTop().toString()?" oneCol":" twoCol"},searchResultsTitle:function(){var e=Number(this.data.data.searchResults);return e?e>1?String.format(n.content.searchResults,e):String.format(n.content.searchResult,e):void 0}}),this.$element.on("scroll",function(){t.scrollStop()},100),this.resize()},t.prototype.databind=function(){this.thumbs&&(this._thumbsCache=null,this.createThumbs(),this.loadThumbs(0),this.selectIndex(this.extension.helper.canvasIndex))},t.prototype.createThumbs=function(){var e=this;if(this.thumbs){for(var t=[],n=0;n<this.thumbs.length;n++){var o=this.thumbs[n];t.push(o.height)}for(var s=Math.median(t),n=0;n<this.thumbs.length;n++){var o=this.thumbs[n];o.height=s}this.$thumbs.link($.templates.thumbsTemplate,this.thumbs),this.$thumbs.undelegate(".thumb","click"),this.$thumbs.delegate(".thumb","click",function(t){t.preventDefault();var n=$.view(this).data;e.lastThumbClickedIndex=n.index,$.publish(i.THUMB_SELECTED,[n])}),this.setLabel(),this.isCreated=!0}},t.prototype.selectAll=function(e){},t.prototype.scrollStop=function(){var e=1/((this.$thumbs.height()-this.$element.height())/this.$element.scrollTop());e>1&&(e=1);var t=Math.floor((this.thumbs.length-1)*e);this.loadThumbs(t)},t.prototype.loadThumbs=function(e){if(this.thumbs&&this.thumbs.length){_.isUndefined(e)&&(e=this.extension.helper.canvasIndex);for(var t=e,i=this.options.thumbsLoadRange,n={start:t>i?t-i:0,end:t<this.thumbs.length-1-i?t+i:this.thumbs.length-1},o=this.options.thumbsImageFadeInDuration,s=n.start;s<=n.end;s++){var r=this.getThumbByIndex(s),a=r.find(".wrap");if(!a.hasClass("loading")&&!a.hasClass("loaded")){var l=r.attr("data-visible");if("false"!==l){a.removeClass("loadingFailed"),a.addClass("loading");var h=r.attr("data-src");h+="?t="+Utils.Dates.getTimeStamp();var c=$('<img src="'+h+'" />');$(c).hide().load(function(){$(this).fadeIn(o,function(){$(this).parent().swapClass("loading","loaded")})}).error(function(){$(this).parent().swapClass("loading","loadingFailed")}),a.append(c)}else a.addClass("hidden")}}}},t.prototype.show=function(){var e=this;this.isOpen=!0,this.$element.show(),setTimeout(function(){e.selectIndex(e.extension.helper.canvasIndex)},1)},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.isPDF=function(){return this.extension.helper.getElementType().toString().contains("pdf")},t.prototype.setLabel=function(){$(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").show()},t.prototype.addSelectedClassToThumbs=function(e){this.getThumbByIndex(e).addClass("selected")},t.prototype.selectIndex=function(e){if(-1!==e&&this.thumbs&&this.thumbs.length){this.getAllThumbs().removeClass("selected"),this.$selectedThumb=this.getThumbByIndex(e),this.addSelectedClassToThumbs(e);var t=this.extension.getPagedIndices(e);~t.indexOf(this.lastThumbClickedIndex)||this.$element.scrollTop(this.$selectedThumb.position().top),this.loadThumbs(e)}},t.prototype.getAllThumbs=function(){return this._thumbsCache||(this._thumbsCache=this.$thumbs.find(".thumb")),this._thumbsCache},t.prototype.getThumbByIndex=function(e){return this.$thumbs.find('[data-index="'+e+'"]')},t.prototype.scrollToThumb=function(e){var t=this.getThumbByIndex(e);this.$element.scrollTop(t.position().top)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-resourcesleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView"],function(e,t,i){"use strict";var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-resourcesleftpanel-module/ResourcesLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/LeftPanel","./ThumbsView"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("resourcesLeftPanel"),e.prototype.create.call(this),this.setTitle(this.content.title),this.$tabsContent=$('<div class="tabsContent"></div>'),this.$main.append(this.$tabsContent),this.$views=$('<div class="views"></div>'),this.$tabsContent.append(this.$views),this.$thumbsView=$('<div class="thumbsView"></div>'),this.$views.append(this.$thumbsView),this.$resourcesView=$('<div class="resourcesView"></div>'),this.$resources=$("<ul></ul>"),this.$resourcesView.append(this.$resources),this.$views.append(this.$resourcesView),this.thumbsView=new o(this.$thumbsView),this.dataBind()},t.prototype.dataBind=function(){this.dataBindThumbsView();var e=this.extension.helper.getResources();0===e.length&&this.$resourcesView.hide();for(var t=0;t<e.length;t++){var i=e[t],n=i.getResource(),o=$('<li><a href="'+n.id+'" target="_blank">'+Manifesto.TranslationCollection.getValue(n.getLabel())+" ("+Utils.Files.simplifyMimeType(n.getFormat().toString())+")</li>");this.$resources.append(o)}},t.prototype.dataBindThumbsView=function(){if(this.thumbsView){var e,t,i=this.extension.helper.getViewingDirection().toString();i===manifesto.ViewingDirection.topToBottom().toString()||i===manifesto.ViewingDirection.bottomToTop().toString()?(e=this.config.options.oneColThumbWidth,t=this.config.options.oneColThumbHeight):(e=this.config.options.twoColThumbWidth,t=this.config.options.twoColThumbHeight),"undefined"==typeof e&&(e=100),"undefined"==typeof t&&(t=100),this.thumbsView.thumbs=this.extension.helper.getThumbs(e,t),this.thumbsView.thumbs.length<2&&this.$thumbsView.hide(),this.thumbsView.databind()}},t.prototype.expandFullStart=function(){e.prototype.expandFullStart.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_START)},t.prototype.expandFullFinish=function(){e.prototype.expandFullFinish.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_FINISH)},t.prototype.collapseFullStart=function(){e.prototype.collapseFullStart.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_START)},t.prototype.collapseFullFinish=function(){e.prototype.collapseFullFinish.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_FINISH)},t.prototype.resize=function(){e.prototype.resize.call(this),this.$views.height(this.$main.height()),this.$resources.height(this.$main.height())},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/SettingsDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_SETTINGS_DIALOGUE,this.closeCommand=i.HIDE_SETTINGS_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open()}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$scroll=$('<div class="scroll"></div>'),this.$content.append(this.$scroll),this.$version=$('<div class="version"></div>'),this.$content.append(this.$version),this.$website=$('<div class="website"></div>'),this.$content.append(this.$website),this.$locale=$('<div class="setting locale"></div>'),this.$scroll.append(this.$locale),this.$localeLabel=$('<label for="locale">'+this.content.locale+"</label>"),this.$locale.append(this.$localeLabel),this.$localeDropDown=$('<select id="locale"></select>'),this.$locale.append(this.$localeDropDown),this.$title.text(this.content.title),this.$website.html(this.content.website),this.$website.targetBlank();for(var n=this.extension.getLocales(),o=0;o<n.length;o++){var s=n[o];this.$localeDropDown.append('<option value="'+s.name+'">'+s.label+"</option>")}this.$localeDropDown.val(this.extension.locale),this.$localeDropDown.change(function(){t.extension.changeLocale(t.$localeDropDown.val())}),this.extension.getLocales().length<2&&this.$locale.hide(),this.$element.hide()},t.prototype.getSettings=function(){return this.extension.getSettings()},t.prototype.updateSettings=function(e){this.extension.updateSettings(e),$.publish(n.UPDATE_SETTINGS,[e])},t.prototype.open=function(){var t=this;e.prototype.open.call(this),window.DEBUG||$.getJSON("package.json",function(e){t.$version.text("v"+e.version)})},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(o);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-mediaelement-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./Commands","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-dialogues-module/HelpDialogue","../../modules/uv-mediaelementcenterpanel-module/MediaElementCenterPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d,g,f){"use strict";var m=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t),$(window).bind("enterfullscreen",function(){$.publish(i.TOGGLE_FULLSCREEN)}),$(window).bind("exitfullscreen",function(){$.publish(i.TOGGLE_FULLSCREEN)}),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){f.$centerPanel.hide(),f.$rightPanel.hide()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){f.$centerPanel.show(),f.$rightPanel.show(),n.resize()}),$.subscribe(s.MEDIA_ENDED,function(e){n.triggerSocket(s.MEDIA_ENDED)}),$.subscribe(s.MEDIA_PAUSED,function(e){n.triggerSocket(s.MEDIA_PAUSED)}),$.subscribe(s.MEDIA_PLAYED,function(e){n.triggerSocket(s.MEDIA_PLAYED)})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new h(f.$headerPanel):f.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new d(f.$leftPanel)),this.centerPanel=new u(f.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new p(f.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new l(f.$footerPanel):f.$footerPanel.hide(),this.$helpDialogue=$('<div class="overlay help"></div>'),f.$overlays.append(this.$helpDialogue),this.helpDialogue=new c(this.$helpDialogue),this.$downloadDialogue=$('<div class="overlay download"></div>'),f.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),f.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),f.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new g(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()},t.prototype.isLeftPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence()||this.helper.hasResources())},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.extensions.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,this.isVideo()?n.type=manifesto.ElementType.movingimage().toString():n.type=manifesto.ElementType.sound().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t.prototype.getPosterImageUri=function(){return this.helper.getCurrentCanvas().getProperty("thumbnail")},t.prototype.isVideo=function(){var e=this.helper.getElementType();return e.toString()===manifesto.ElementType.movingimage().toString()},t}(n);return m});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this;
5
+ }return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.$downloadOptions.find("li:visible").length?this.$noneAvailable.hide():this.$noneAvailable.show(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-pdfcenterpanel-module/PDFCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel","../../Params"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("pdfCenterPanel"),e.prototype.create.call(this),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.openMedia(i)})},t.prototype.openMedia=function(e){var t=this,i=this;this.extension.getExternalResources(e).then(function(){var e=t.extension.helper.getCurrentCanvas(),n=e.id,s=window.browserDetect.browser,r=window.browserDetect.version;if("Explorer"===s&&10>r||!t.config.options.usePdfJs)new PDFObject({url:n,id:"PDF"}).embed("content");else{var a;a=window.DEBUG?"modules/uv-pdfcenterpanel-module/html/viewer.html":"html/uv-pdfcenterpanel-module/viewer.html",t.$content.load(a,function(){window.DEBUG?PDFJS.workerSrc="extensions/uv-pdf-extension/lib/pdf.worker.min.js":PDFJS.workerSrc="lib/pdf.worker.min.js",PDFJS.DEFAULT_URL=n;var e=1+parseInt(i.extension.getParam(o.anchor))||0;PDFView.initialBookmark="page="+e,window.webViewerLoad(),t.resize()})}})},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(n);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-pdf-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-pdfcenterpanel-module/PDFCenterPanel","../../modules/uv-resourcesleftpanel-module/ResourcesLeftPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d){"use strict";var g=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t.index)}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){d.$centerPanel.hide(),d.$rightPanel.hide()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){d.$centerPanel.show(),d.$rightPanel.show(),n.resize()}),$.subscribe(i.SHOW_OVERLAY,function(e,t){n.IsOldIE()&&n.centerPanel.$element.hide()}),$.subscribe(i.HIDE_OVERLAY,function(e,t){n.IsOldIE()&&n.centerPanel.$element.show()})},t.prototype.IsOldIE=function(){var e=window.browserDetect.browser,t=window.browserDetect.version;return"Explorer"===e&&9>=t?!0:!1},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new l(d.$headerPanel):d.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new u(d.$leftPanel)),this.centerPanel=new c(d.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new h(d.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new a(d.$footerPanel):d.$footerPanel.hide(),this.$downloadDialogue=$('<div class="overlay download"></div>'),d.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new s(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),d.$overlays.append(this.$shareDialogue),this.shareDialogue=new r(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),d.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new p(this.$settingsDialogue),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init()},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.document().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t}(n);return g}),define("extensions/uv-seadragon-extension/Commands",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.namespace="seadragonExtension.",i.CLEAR_SEARCH=i.namespace+"onClearSearch",i.CURRENT_VIEW_URI=i.namespace+"onCurrentViewUri",i.FIRST=i.namespace+"onFirst",i.GALLERY_DECREASE_SIZE=i.namespace+"onGalleryDecreaseSize",i.GALLERY_INCREASE_SIZE=i.namespace+"onGalleryIncreaseSize",i.GALLERY_THUMB_SELECTED=i.namespace+"onGalleryThumbSelected",i.HIDE_MULTISELECT_DIALOGUE=i.namespace+"onHideMultiSelectDialogue",i.IMAGE_SEARCH=i.namespace+"onImageSearch",i.LAST=i.namespace+"onLast",i.MODE_CHANGED=i.namespace+"onModeChanged",i.MULTISELECT_CHANGE=i.namespace+"onMultiSelectChange",i.MULTISELECTION_MADE=i.namespace+"onMultiSelectionMade",i.NEXT_SEARCH_RESULT=i.namespace+"onNextSearchResult",i.NEXT=i.namespace+"onNext",i.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE=i.namespace+"onNextImagesSearchResultUnavailable",i.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE=i.namespace+"onPrevImagesSearchResultUnavailable",i.OPEN_THUMBS_VIEW=i.namespace+"onOpenThumbsView",i.OPEN_TREE_VIEW=i.namespace+"onOpenTreeView",i.PAGE_SEARCH=i.namespace+"onPageSearch",i.PAGING_TOGGLED=i.namespace+"onPagingToggled",i.PREV_SEARCH_RESULT=i.namespace+"onPrevSearchResult",i.PREV=i.namespace+"onPrev",i.PRINT=i.namespace+"onPrint",i.ROTATE=i.namespace+"onRotate",i.SEADRAGON_ANIMATION_FINISH=i.namespace+"onAnimationfinish",i.SEADRAGON_ANIMATION_START=i.namespace+"onAnimationStart",i.SEADRAGON_ANIMATION=i.namespace+"onAnimation",i.SEADRAGON_OPEN=i.namespace+"onOpen",i.SEADRAGON_RESIZE=i.namespace+"onResize",i.SEADRAGON_ROTATION=i.namespace+"onRotation",i.SEARCH_PREVIEW_FINISH=i.namespace+"onSearchPreviewFinish",i.SEARCH_PREVIEW_START=i.namespace+"onSearchPreviewStart",i.SEARCH_RESULT_CANVAS_CHANGED=i.namespace+"onSearchResultCanvasChanged",i.SEARCH_RESULT_RECT_CHANGED=i.namespace+"onSearchResultRectChanged",i.SEARCH_RESULTS_EMPTY=i.namespace+"onSearchResultsEmpty",i.SEARCH_RESULTS=i.namespace+"onSearchResults",i.SEARCH_RESULTS_CLEARED=i.namespace+"onSearchResultsCleared",i.SEARCH=i.namespace+"onSearch",i.SHOW_MULTISELECT_DIALOGUE=i.namespace+"onShowMultiSelectDialogue",i.THUMB_MULTISELECTED=i.namespace+"onThumbMultiSelected",i.TREE_NODE_MULTISELECTED=i.namespace+"onTreeNodeMultiSelected",i.TREE_NODE_SELECTED=i.namespace+"onTreeNodeSelected",i.VIEW_PAGE=i.namespace+"onViewPage",i.ZOOM_IN=i.namespace+"onZoomIn",i.ZOOM_OUT=i.namespace+"onZoomOut",i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/GalleryView",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/BaseView","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){var i=e.call(this,t,!0,!0)||this;return i.isOpen=!1,i}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$gallery=$('<div class="iiif-gallery-component"></div>'),this.$element.append(this.$gallery)},t.prototype.setup=function(){this.component=new IIIFComponents.GalleryComponent({target:this.$gallery[0],data:this.galleryData}),this.component.on("thumbSelected",function(e){var t=e[0];$.publish(o.GALLERY_THUMB_SELECTED,[t]),$.publish(i.THUMB_SELECTED,[t])}),this.component.on("decreaseSize",function(){$.publish(o.GALLERY_DECREASE_SIZE)}),this.component.on("increaseSize",function(){$.publish(o.GALLERY_INCREASE_SIZE)})},t.prototype.databind=function(){this.component.options.data=this.galleryData,this.component.set(null),this.resize()},t.prototype.show=function(){var e=this;this.isOpen=!0,this.$element.show(),setTimeout(function(){e.component.selectIndex(e.extension.helper.canvasIndex)},10)},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$gallery.find(".main"),i=this.$gallery.find(".header");t.height(this.$element.height()-i.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/Mode",["require","exports"],function(e,t){"use strict";var i=function(){function e(e){this.value=e}return e.prototype.toString=function(){return this.value},e}();return i.image=new i("image"),i.page=new i("page"),i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/ThumbsView",["require","exports","../uv-shared-module/ThumbsView","../../extensions/uv-seadragon-extension/Commands","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o){"use strict";var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("contentLeftPanel"),e.prototype.create.call(this),$.subscribe(n.MODE_CHANGED,function(e,i){t.setLabel()}),$.subscribe(n.SEARCH_PREVIEW_START,function(e,i){t.searchPreviewStart(i)}),$.subscribe(n.SEARCH_PREVIEW_FINISH,function(){t.searchPreviewFinish()}),this.extension.helper.isPaged()&&this.$thumbs.addClass("paged");var i=this;$.views.helpers({separator:function(){return i.extension.helper.isVerticallyAligned()?!0:i.extension.helper.isPaged()?(this.data.index-1)%2==0?!1:!0:!1}})},t.prototype.addSelectedClassToThumbs=function(e){if(this.extension.isPagingSettingEnabled())for(var t=this.extension.getPagedIndices(e),i=0;i<t.length;i++)this.getThumbByIndex(t[i]).addClass("selected");else this.getThumbByIndex(e).addClass("selected")},t.prototype.isPageModeEnabled=function(){return"function"==typeof this.extension.getMode?this.config.options.pageModeEnabled&&this.extension.getMode().toString()===o.page.toString():this.config.options.pageModeEnabled},t.prototype.searchPreviewStart=function(e){this.scrollToThumb(e);var t=this.getThumbByIndex(e);t.addClass("searchpreview")},t.prototype.searchPreviewFinish=function(){this.scrollToThumb(this.extension.helper.canvasIndex),this.getAllThumbs().removeClass("searchpreview")},t.prototype.setLabel=function(){this.isPDF()?($(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").hide()):this.isPageModeEnabled()?($(this.$thumbs).find("span.index").hide(),$(this.$thumbs).find("span.label").show()):($(this.$thumbs).find("span.index").show(),$(this.$thumbs).find("span.label").hide())},t}(i);return s});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/TreeView",["require","exports","../uv-shared-module/BaseView","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t,!0,!0)||this;return i.isOpen=!1,i}return __extends(t,e),t.prototype.create=function(){this.setConfig("contentLeftPanel"),e.prototype.create.call(this),this.$tree=$('<div class="iiif-tree-component"></div>'),this.$element.append(this.$tree)},t.prototype.setup=function(){this.component=new IIIFComponents.TreeComponent({target:this.$tree[0],data:this.treeData}),this.component.on("treeNodeSelected",function(e){var t=e[0];$.publish(n.TREE_NODE_SELECTED,[t])}),this.component.on("treeNodeMultiSelected",function(e){var t=e[0];$.publish(n.TREE_NODE_MULTISELECTED,[t])})},t.prototype.databind=function(){this.component.options.data=this.treeData,this.component.set(null),this.resize()},t.prototype.show=function(){this.isOpen=!0,this.$element.show()},t.prototype.hide=function(){this.isOpen=!1,this.$element.hide()},t.prototype.selectNode=function(e){this.component.selectNode(e)},t.prototype.deselectCurrentNode=function(){this.component.deselectCurrentNode()},t.prototype.getNodeById=function(e){return this.component.getNodeById(e)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-contentleftpanel-module/ContentLeftPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","./GalleryView","../uv-shared-module/LeftPanel","../uv-shared-module/Metrics","../../extensions/uv-seadragon-extension/Mode","./ThumbsView","./TreeView"],function(e,t,i,n,o,s,r,a,l,h){"use strict";var c=function(e){function t(t){var i=e.call(this,t)||this;return i.expandFullEnabled=!1,i.isThumbsViewOpen=!1,i.isTreeViewOpen=!1,i.treeSortType=Manifold.TreeSortType.NONE,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("contentLeftPanel"),e.prototype.create.call(this);$.subscribe(i.SETTINGS_CHANGED,function(){t.databind()}),$.subscribe(n.GALLERY_THUMB_SELECTED,function(){t.collapseFull()}),$.subscribe(i.METRIC_CHANGED,function(){t.extension.metric===r.MOBILE_LANDSCAPE&&t.isFullyExpanded&&t.collapseFull()}),$.subscribe(n.SEARCH_RESULTS,function(){t.databindThumbsView(),t.databindGalleryView()}),$.subscribe(n.SEARCH_RESULTS_CLEARED,function(){t.databindThumbsView(),t.databindGalleryView()}),$.subscribe(n.SEARCH_RESULTS_EMPTY,function(){t.databindThumbsView(),t.databindGalleryView()}),$.subscribe(i.CANVAS_INDEX_CHANGED,function(e,i){t.isFullyExpanded&&t.collapseFull(),t.selectCurrentTreeNode(),t.updateTreeTabBySelection()}),this.$tabs=$('<div class="tabs"></div>'),this.$main.append(this.$tabs),this.$treeButton=$('<a class="index tab" tabindex="0">'+this.content.index+"</a>"),this.$tabs.append(this.$treeButton),this.$thumbsButton=$('<a class="thumbs tab" tabindex="0">'+this.content.thumbnails+"</a>"),this.$thumbsButton.prop("title",this.content.thumbnails),this.$tabs.append(this.$thumbsButton),this.$tabsContent=$('<div class="tabsContent"></div>'),this.$main.append(this.$tabsContent),this.$options=$('<div class="options"></div>'),this.$tabsContent.append(this.$options),this.$topOptions=$('<div class="top"></div>'),this.$options.append(this.$topOptions),this.$treeSelect=$("<select></select>"),this.$topOptions.append(this.$treeSelect),this.$bottomOptions=$('<div class="bottom"></div>'),this.$options.append(this.$bottomOptions),this.$leftOptions=$('<div class="left"></div>'),this.$bottomOptions.append(this.$leftOptions),this.$rightOptions=$('<div class="right"></div>'),this.$bottomOptions.append(this.$rightOptions),this.$treeViewOptions=$('<div class="treeView"></div>'),this.$leftOptions.append(this.$treeViewOptions),this.$sortByLabel=$('<span class="sort">'+this.content.sortBy+"</span>"),this.$treeViewOptions.append(this.$sortByLabel),this.$sortButtonGroup=$('<div class="btn-group"></div>'),this.$treeViewOptions.append(this.$sortButtonGroup),this.$sortByDateButton=$('<button class="btn tabindex="0"">'+this.content.date+"</button>"),this.$sortButtonGroup.append(this.$sortByDateButton),this.$sortByVolumeButton=$('<button class="btn" tabindex="0">'+this.content.volume+"</button>"),this.$sortButtonGroup.append(this.$sortByVolumeButton),this.$views=$('<div class="views"></div>'),this.$tabsContent.append(this.$views),this.$treeView=$('<div class="treeView"></div>'),this.$views.append(this.$treeView),this.$thumbsView=$('<div class="thumbsView" tabindex="0"></div>'),this.$views.append(this.$thumbsView),this.$galleryView=$('<div class="galleryView"></div>'),this.$views.append(this.$galleryView),this.$treeSelect.hide(),this.$treeSelect.change(function(){t.databindTreeView(),t.selectCurrentTreeNode(),t.updateTreeTabBySelection()}),this.$sortByDateButton.on("click",function(){t.sortByDate()}),this.$sortByVolumeButton.on("click",function(){t.sortByVolume()}),this.$treeViewOptions.hide(),this.$treeButton.onPressed(function(){t.openTreeView(),$.publish(n.OPEN_TREE_VIEW)}),this.$thumbsButton.onPressed(function(){t.openThumbsView(),$.publish(n.OPEN_THUMBS_VIEW)}),this.setTitle(this.content.title),this.$sortByVolumeButton.addClass("on");var o=this.options.tabOrder;if(o){o=o.toLowerCase(),o=o.replace(/ /g,"");var s=o.split(",");"thumbs"===s[0]?(this.$treeButton.before(this.$thumbsButton),this.$thumbsButton.addClass("first")):this.$treeButton.addClass("first")}},t.prototype.createTreeView=function(){this.treeView=new h(this.$treeView),this.treeView.treeData=this.getTreeData(),this.treeView.setup(),this.databindTreeView();var e=this.extension.helper.getTopRanges();if(e.length>1)for(var t=0;t<e.length;t++){var i=e[t];this.$treeSelect.append('<option value="'+i.id+'">'+Manifesto.TranslationCollection.getValue(i.getLabel())+"</option>")}this.updateTreeViewOptions()},t.prototype.databind=function(){this.databindThumbsView(),this.databindTreeView(),this.databindGalleryView()},t.prototype.updateTreeViewOptions=function(){var e=this.getTree();this.isCollection()&&this.extension.helper.treeHasNavDates(e)?this.$treeViewOptions.show():this.$treeViewOptions.hide(),this.$treeSelect.find("option").length?this.$treeSelect.show():this.$treeSelect.hide()},t.prototype.sortByDate=function(){this.treeSortType=Manifold.TreeSortType.DATE,this.treeView.treeData=this.getTreeData(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.addClass("on"),this.$sortByVolumeButton.removeClass("on"),this.resize()},t.prototype.sortByVolume=function(){this.treeSortType=Manifold.TreeSortType.NONE,this.treeView.treeData=this.getTreeData(),this.treeView.databind(),this.selectCurrentTreeNode(),this.$sortByDateButton.removeClass("on"),this.$sortByVolumeButton.addClass("on"),this.resize()},t.prototype.isCollection=function(){var e=this.getTree();return e.data.type===manifesto.TreeNodeType.collection().toString()},t.prototype.databindTreeView=function(){this.treeView&&(this.treeView.treeData=this.getTreeData(),this.treeView.databind(),this.selectCurrentTreeNode())},t.prototype.getTreeData=function(){return{branchNodesSelectable:!1,helper:this.extension.helper,topRangeIndex:this.getSelectedTopRangeIndex(),treeSortType:this.treeSortType}},t.prototype.updateTreeTabByCanvasIndex=function(){var e=this.extension.helper.getTopRanges();if(e.length>1){var t=this.getCurrentCanvasTopRangeIndex(),i=e[t];this.setTreeTabTitle(Manifesto.TranslationCollection.getValue(i.getLabel()))}else this.setTreeTabTitle(this.content.index)},t.prototype.setTreeTabTitle=function(e){this.$treeButton.text(e),this.$treeButton.prop("title",e)},t.prototype.updateTreeTabBySelection=function(){var e,t=this.extension.helper.getTopRanges();t.length>1&&(e=this.treeView?this.getSelectedTree().text():Manifesto.TranslationCollection.getValue(t[0].getLabel())),e?this.setTreeTabTitle(e):this.setTreeTabTitle(this.content.index)},t.prototype.getViewingDirection=function(){return this.extension.helper.getViewingDirection()},t.prototype.createThumbsView=function(){this.thumbsView=new l(this.$thumbsView),this.databindThumbsView()},t.prototype.databindThumbsView=function(){if(this.thumbsView){var e,t,i=this.getViewingDirection().toString();i===manifesto.ViewingDirection.topToBottom().toString()||i===manifesto.ViewingDirection.bottomToTop().toString()?(e=this.config.options.oneColThumbWidth,t=this.config.options.oneColThumbHeight):(e=this.config.options.twoColThumbWidth,t=this.config.options.twoColThumbHeight);var n=this.extension.helper.getThumbs(e,t);i===manifesto.ViewingDirection.bottomToTop().toString()&&n.reverse();var o=this.extension.searchResults;if(o&&o.length)for(var s=0;s<o.length;s++){var r=o[s],a=n.en().where(function(e){return e.index===r.canvasIndex}).first(),l=$.extend(!0,{},a.data);l.searchResults=r.rects.length,a.data=l}this.thumbsView.thumbs=n,this.thumbsView.databind()}},t.prototype.createGalleryView=function(){this.galleryView=new o(this.$galleryView),this.galleryView.galleryData=this.getGalleryData(),this.galleryView.setup(),this.databindGalleryView()},t.prototype.databindGalleryView=function(){this.galleryView&&(this.galleryView.galleryData=this.getGalleryData(),this.galleryView.databind())},t.prototype.getGalleryData=function(){return{helper:this.extension.helper,chunkedResizingThreshold:this.config.options.galleryThumbChunkedResizingThreshold,content:this.config.content,debug:!1,imageFadeInDuration:300,initialZoom:6,minLabelWidth:20,pageModeEnabled:this.isPageModeEnabled(),scrollStopDuration:100,searchResults:this.extension.searchResults,sizingEnabled:Modernizr.inputtypes.range,thumbHeight:this.config.options.galleryThumbHeight,thumbLoadPadding:this.config.options.galleryThumbLoadPadding,thumbWidth:this.config.options.galleryThumbWidth,viewingDirection:this.getViewingDirection()}},t.prototype.isPageModeEnabled=function(){return"function"==typeof this.extension.getMode?Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)&&this.extension.getMode().toString()===a.page.toString():Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)},t.prototype.getSelectedTree=function(){return this.$treeSelect.find(":selected")},t.prototype.getSelectedTopRangeIndex=function(){var e=this.getSelectedTree().index();return-1===e&&(e=0),e},t.prototype.getTree=function(){var e=this.getSelectedTopRangeIndex();return this.extension.helper.getTree(e,Manifold.TreeSortType.NONE)},t.prototype.toggleFinish=function(){if(e.prototype.toggleFinish.call(this),this.isUnopened){var t=Utils.Bools.getBool(this.config.options.treeEnabled,!0),i=Utils.Bools.getBool(this.config.options.thumbsEnabled,!0),n=this.getTree();n&&n.nodes.length||(t=!1),t&&i||this.$tabs.hide(),i&&this.defaultToThumbsView()?this.openThumbsView():t&&this.openTreeView()}},t.prototype.defaultToThumbsView=function(){var e=Utils.Bools.getBool(this.config.options.defaultToTreeEnabled,!1),t=this.config.options.defaultToTreeIfGreaterThan||0,i=this.getTree();return e&&i.nodes.length>t?!1:!0},t.prototype.expandFullStart=function(){e.prototype.expandFullStart.call(this),$.publish(i.LEFTPANEL_EXPAND_FULL_START)},t.prototype.expandFullFinish=function(){e.prototype.expandFullFinish.call(this),this.$treeButton.hasClass("on")?this.openTreeView():this.$thumbsButton.hasClass("on")&&this.openThumbsView(),$.publish(i.LEFTPANEL_EXPAND_FULL_FINISH)},t.prototype.collapseFullStart=function(){e.prototype.collapseFullStart.call(this),$.publish(i.LEFTPANEL_COLLAPSE_FULL_START)},t.prototype.collapseFullFinish=function(){e.prototype.collapseFullFinish.call(this),this.$thumbsButton.hasClass("on")&&this.openThumbsView(),$.publish(i.LEFTPANEL_COLLAPSE_FULL_FINISH)},t.prototype.openTreeView=function(){this.isTreeViewOpen=!0,this.isThumbsViewOpen=!1,this.treeView||this.createTreeView(),this.$treeButton.addClass("on"),this.$thumbsButton.removeClass("on"),this.treeView.show(),this.thumbsView&&this.thumbsView.hide(),this.galleryView&&this.galleryView.hide(),this.updateTreeViewOptions(),this.selectCurrentTreeNode(),this.resize(),this.treeView.resize()},t.prototype.openThumbsView=function(){this.isTreeViewOpen=!1,this.isThumbsViewOpen=!0,this.thumbsView||this.createThumbsView(),this.isFullyExpanded&&!this.galleryView&&this.createGalleryView(),this.$treeButton.removeClass("on"),this.$thumbsButton.addClass("on"),this.treeView&&this.treeView.hide(),this.$treeSelect.hide(),this.$treeViewOptions.hide(),this.resize(),this.isFullyExpanded?(this.thumbsView.hide(),this.galleryView&&this.galleryView.show(),this.galleryView&&this.galleryView.resize()):(this.galleryView&&this.galleryView.hide(),this.thumbsView.show(),this.thumbsView.resize())},t.prototype.selectTopRangeIndex=function(e){this.$treeSelect.prop("selectedIndex",e)},t.prototype.getCurrentCanvasTopRangeIndex=function(){var e=-1,t=this.extension.getCurrentCanvasRange();return t&&(e=Number(t.path.split("/")[0])),e},t.prototype.selectCurrentTreeNode=function(){if(this.treeView){var e,t=this.getCurrentCanvasTopRangeIndex(),i=this.getSelectedTopRangeIndex(),n=t===i;if(-1!=t){var o=this.extension.getCurrentCanvasRange();o&&o.treeNode&&(e=this.treeView.getNodeById(o.treeNode.id))}e&&n?this.treeView.selectNode(e):this.treeView.deselectCurrentNode()}},t.prototype.resize=function(){e.prototype.resize.call(this),this.$tabsContent.height(this.$main.height()-(this.$tabs.is(":visible")?this.$tabs.height():0)-this.$tabsContent.verticalPadding()),this.$views.height(this.$tabsContent.height()-this.$options.outerHeight())},t}(s);return c}),define("modules/uv-shared-module/Point",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t){this.x=e,this.y=t}return e}();return i}),define("extensions/uv-seadragon-extension/CroppedImageDimensions",["require","exports","../../modules/uv-shared-module/Point"],function(e,t,i){"use strict";var n=Utils.Measurements.Size,o=function(){function e(){this.region=new n(0,0),this.regionPos=new i(0,0),this.size=new n(0,0)}return e}();return o}),define("extensions/uv-seadragon-extension/DownloadType",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i.CURRENTVIEW="currentView",i.ENTIREDOCUMENTASPDF="entireDocumentAsPdf",i.ENTIREDOCUMENTASTEXT="entireDocumentAsText",i.WHOLEIMAGEHIGHRES="wholeImageHighRes",i.WHOLEIMAGESHIGHRES="wholeImageHighRes",i.WHOLEIMAGELOWRES="wholeImageLowRes",i.UNKNOWN="unknown",i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/DownloadDialogue",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-dialogues-module/DownloadDialogue","./Commands","../../modules/uv-shared-module/DownloadOption","./DownloadType"],function(e,t,i,n,o,s,r){"use strict";var a=Utils.Measurements.Size,l=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("downloadDialogue"),e.prototype.create.call(this),this.$imageOptionsContainer=$('<li class="group image"></li>'),this.$downloadOptions.append(this.$imageOptionsContainer),this.$imageOptions=$("<ul></ul>"),this.$imageOptionsContainer.append(this.$imageOptions),this.$currentViewAsJpgButton=$('<li class="option single"><input id="'+s.currentViewAsJpg.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label for="'+s.currentViewAsJpg.toString()+'"></label></li>'),this.$imageOptions.append(this.$currentViewAsJpgButton),this.$currentViewAsJpgButton.hide(),this.$wholeImageHighResButton=$('<li class="option single"><input id="'+s.wholeImageHighRes.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label id="'+s.wholeImageHighRes.toString()+'label" for="'+s.wholeImageHighRes.toString()+'"></label></li>'),this.$imageOptions.append(this.$wholeImageHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImagesHighResButton=$('<li class="option multiple"><input id="'+s.wholeImagesHighRes.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label id="'+s.wholeImagesHighRes.toString()+'label" for="'+s.wholeImagesHighRes.toString()+'"></label></li>'),this.$imageOptions.append(this.$wholeImagesHighResButton),this.$wholeImageHighResButton.hide(),this.$wholeImageLowResAsJpgButton=$('<li class="option single"><input id="'+s.wholeImageLowResAsJpg.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label for="'+s.wholeImageLowResAsJpg.toString()+'">'+this.content.wholeImageLowResAsJpg+"</label></li>"),this.$imageOptions.append(this.$wholeImageLowResAsJpgButton),this.$wholeImageLowResAsJpgButton.hide(),this.$canvasOptionsContainer=$('<li class="group canvas"></li>'),this.$downloadOptions.append(this.$canvasOptionsContainer),this.$canvasOptions=$("<ul></ul>"),this.$canvasOptionsContainer.append(this.$canvasOptions),this.$sequenceOptionsContainer=$('<li class="group sequence"></li>'),this.$downloadOptions.append(this.$sequenceOptionsContainer),this.$sequenceOptions=$("<ul></ul>"),this.$sequenceOptionsContainer.append(this.$sequenceOptions),this.$selectionButton=$('<li class="option"><input id="'+s.selection.toString()+'" type="radio" name="downloadOptions" tabindex="0" /><label id="'+s.selection.toString()+'label" for="'+s.selection.toString()+'"></label></li>'),
6
+ this.$sequenceOptions.append(this.$selectionButton),this.$selectionButton.hide(),this.$buttonsContainer=$('<div class="buttons"></div>'),this.$content.append(this.$buttonsContainer),this.$downloadButton=$('<a class="btn btn-primary" href="#" tabindex="0">'+this.content.download+"</a>"),this.$buttonsContainer.append(this.$downloadButton),this.$explanatoryTextTemplate=$('<span class="explanatory"></span>');var n=this;this.$downloadButton.on("click",function(e){e.preventDefault();var a=n.getSelectedOption(),l=a.attr("id"),h=a.attr("title"),c=a.data("mime"),u=r.UNKNOWN,p=t.extension.helper.getCurrentCanvas();if(t.renderingUrls[l])c&&(-1!==c.toLowerCase().indexOf("pdf")?u=r.ENTIREDOCUMENTASPDF:-1!==c.toLowerCase().indexOf("txt")&&(u=r.ENTIREDOCUMENTASTEXT)),(u=r.ENTIREDOCUMENTASPDF)&&window.open(t.renderingUrls[l]);else switch(l){case s.currentViewAsJpg.toString():var d=n.extension.getViewer();window.open(n.extension.getCroppedImageUri(p,d)),u=r.CURRENTVIEW;break;case s.selection.toString():Utils.Async.waitFor(function(){return!t.isActive},function(){$.publish(o.SHOW_MULTISELECT_DIALOGUE)});break;case s.wholeImageHighRes.toString():window.open(t.getCanvasHighResImageUri(t.extension.helper.getCurrentCanvas())),u=r.WHOLEIMAGEHIGHRES;break;case s.wholeImagesHighRes.toString():for(var g=t.extension.getPagedIndices(),f=0;f<g.length;f++)window.open(t.getCanvasHighResImageUri(t.extension.helper.getCanvasByIndex(g[f])));u=r.WHOLEIMAGESHIGHRES;break;case s.wholeImageLowResAsJpg.toString():window.open(n.extension.getConfinedImageUri(p,n.options.confinedImageSize)),u=r.WHOLEIMAGELOWRES}$.publish(i.DOWNLOAD,[{type:u,label:h}]),t.close()})},t.prototype.open=function(t){e.prototype.open.call(this,t);var i=this.extension.helper.getCurrentCanvas(),n=this.extension.getViewerRotation(),o=n%180==0;if(this.isDownloadOptionAvailable(s.currentViewAsJpg)){var r=this.$currentViewAsJpgButton.find("input"),a=this.$currentViewAsJpgButton.find("label"),l=this.content.currentViewAsJpg,h=this.extension.getViewer(),c=this.extension.getCroppedImageDimensions(i,h);if(c?(l=o?String.format(l,c.size.width,c.size.height):String.format(l,c.size.height,c.size.width),a.text(l),r.prop("title",l),this.$currentViewAsJpgButton.data("width",c.size.width),this.$currentViewAsJpgButton.data("height",c.size.height),this.$currentViewAsJpgButton.show()):this.$currentViewAsJpgButton.hide(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.currentViewAsJpgExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$currentViewAsJpgButton.hide();if(this.isDownloadOptionAvailable(s.wholeImageHighRes)){var r=this.$wholeImageHighResButton.find("input"),a=this.$wholeImageHighResButton.find("label"),d=this.getCanvasMimeType(this.extension.helper.getCurrentCanvas());d=d?Utils.Files.simplifyMimeType(d):"?";var g=this.getCanvasComputedDimensions(this.extension.helper.getCurrentCanvas());if(g){var l=o?String.format(this.content.wholeImageHighRes,g.width,g.height,d):String.format(this.content.wholeImageHighRes,g.height,g.width,d);a.text(l),r.prop("title",l),this.$wholeImageHighResButton.data("width",g.width),this.$wholeImageHighResButton.data("height",g.height),this.$wholeImageHighResButton.show()}else this.$wholeImageHighResButton.hide();if(Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.wholeImageHighResExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$wholeImageHighResButton.hide();if(this.isDownloadOptionAvailable(s.wholeImagesHighRes)){var r=this.$wholeImagesHighResButton.find("input"),a=this.$wholeImagesHighResButton.find("label"),d=this.getCanvasMimeType(this.extension.helper.getCurrentCanvas());d=d?Utils.Files.simplifyMimeType(d):"?";var l=String.format(this.content.wholeImagesHighRes,d);if(a.text(l),r.prop("title",l),this.$wholeImagesHighResButton.show(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.wholeImagesHighResExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$wholeImagesHighResButton.hide();if(this.isDownloadOptionAvailable(s.wholeImageLowResAsJpg)){var r=this.$wholeImageLowResAsJpgButton.find("input"),a=this.$wholeImageLowResAsJpgButton.find("label"),g=this.extension.getConfinedImageDimensions(i,this.options.confinedImageSize),l=o?String.format(this.content.wholeImageLowResAsJpg,g.width,g.height):String.format(this.content.wholeImageLowResAsJpg,g.height,g.width);if(a.text(l),r.prop("title",l),this.$wholeImageLowResAsJpgButton.data("width",g.width),this.$wholeImageLowResAsJpgButton.data("height",g.height),this.$wholeImageLowResAsJpgButton.show(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.wholeImageLowResAsJpgExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$wholeImageLowResAsJpgButton.hide();if(this.isDownloadOptionAvailable(s.selection)){var r=this.$selectionButton.find("input"),a=this.$selectionButton.find("label");if(a.text(this.content.downloadSelection),r.prop("title",this.content.downloadSelection),this.$selectionButton.show(),Utils.Bools.getBool(this.options.optionsExplanatoryTextEnabled,!1)){var u=this.content.selectionExplanation;if(u){var p=this.$explanatoryTextTemplate.clone();p.text(u),a.append(p)}}}else this.$selectionButton.hide();if(this.resetDynamicDownloadOptions(),this.isDownloadOptionAvailable(s.dynamicImageRenderings))for(var f=i.getImages(),m=0;m<f.length;m++)this.addDownloadOptionsForRenderings(f[m].getResource(),this.content.entireFileAsOriginal,s.dynamicImageRenderings);if(this.isDownloadOptionAvailable(s.dynamicCanvasRenderings)&&this.addDownloadOptionsForRenderings(i,this.content.entireFileAsOriginal,s.dynamicCanvasRenderings),this.isDownloadOptionAvailable(s.dynamicSequenceRenderings)&&this.addDownloadOptionsForRenderings(this.extension.helper.getCurrentSequence(),this.content.entireDocument,s.dynamicSequenceRenderings),this.isDownloadOptionAvailable(s.currentViewAsJpg)){var v=parseInt(this.$currentViewAsJpgButton.data("width").toString()),b=parseInt(this.$currentViewAsJpgButton.data("height").toString()),E=parseInt(this.$wholeImageHighResButton.data("width").toString()),_=parseInt(this.$wholeImageHighResButton.data("height").toString()),y=v/E*100,x=b/_*100,w=this.options.currentViewDisabledPercentage;y>=w&&x>=w?this.$currentViewAsJpgButton.hide():this.$currentViewAsJpgButton.show()}var S=this.$imageOptions.find("li.single");S=S.sort(function(e,t){var i=$(e).data("width");i?i=parseInt(i.toString()):0;var n=$(e).data("height");n?n=parseInt(n.toString()):0;var o=$(t).data("width");o?o=parseInt(o.toString()):0;var s=$(t).data("height");s?s=parseInt(s.toString()):0;var r=i*n,a=o*s;return a>r?-1:r>a?1:0}),S.detach().appendTo(this.$imageOptions);var C=this.$downloadOptions.find("li.group");C.each(function(e,t){var i=$(t);i.show(),i.find("li.option:hidden").length===i.find("li.option").length&&i.hide()}),this.$downloadOptions.find("li.group:visible").last().addClass("lastVisible"),this.$downloadOptions.find("li.option:visible").length?(this.$downloadOptions.find("li.option input:visible:first").prop("checked",!0),this.$noneAvailable.hide(),this.$downloadButton.show()):(this.$noneAvailable.show(),this.$downloadButton.hide()),this.resize()},t.prototype.resetDynamicDownloadOptions=function(){this.renderingUrls=[],this.renderingUrlsCount=0,this.$downloadOptions.find("li.dynamic").remove()},t.prototype.addDownloadOptionsForRenderings=function(e,t,i){for(var n=e.getRenderings(),o=0;o<n.length;o++){var r=n[o];if(r){var a=Manifesto.TranslationCollection.getValue(r.getLabel()),l="downloadOption"+ ++this.renderingUrlsCount;a?a+=" ({0})":a=t;var h=Utils.Files.simplifyMimeType(r.getFormat().toString());a=String.format(a,h),this.renderingUrls[l]=r.id;var c=$('<li class="option dynamic"><input id="'+l+'" data-mime="'+h+'" title="'+a+'" type="radio" name="downloadOptions" tabindex="0" /><label for="'+l+'">'+a+"</label></li>");switch(i){case s.dynamicImageRenderings:this.$imageOptions.append(c);break;case s.dynamicCanvasRenderings:this.$canvasOptions.append(c);break;case s.dynamicSequenceRenderings:this.$sequenceOptions.append(c)}}}},t.prototype.getSelectedOption=function(){return this.$downloadOptions.find("li.option input:checked")},t.prototype.getCanvasImageResource=function(e){var t=e.getImages();return t[0]?t[0].getResource():null},t.prototype.getCanvasHighResImageUri=function(e){var t=this.getCanvasComputedDimensions(e);if(t){var i=t.width,n=e.getCanonicalImageUri(i),o=n.split("/"),s=this.extension.getViewerRotation();return o[o.length-2]=String(s),n=o.join("/")}return""},t.prototype.getCanvasMimeType=function(e){var t=this.getCanvasImageResource(e),i=t.getFormat();return i?i.toString():null},t.prototype.getCanvasDimensions=function(e){return e.externalResource.data?new a(e.externalResource.data.width,e.externalResource.data.height):new a(0,0)},t.prototype.getCanvasMaxDimensions=function(e){return e.externalResource.data&&e.externalResource.data.profile[1]?new a(e.externalResource.data.profile[1].maxWidth,e.externalResource.data.profile[1].maxHeight):null},t.prototype.getCanvasComputedDimensions=function(e){var t=this.getCanvasDimensions(e),i=this.getCanvasMaxDimensions(e);if(!i)return null;var n=t.width,o=t.height;if(!_.isUndefined(i.width)&&i.width<t.width)if(n=i.width,_.isUndefined(i.height)){var s=Math.normalise(i.width,0,t.width);o=Math.floor(t.height*s)}else o=i.height;return new a(n,o)},t.prototype.isDownloadOptionAvailable=function(t){switch(t){case s.currentViewAsJpg:case s.dynamicCanvasRenderings:case s.dynamicImageRenderings:case s.wholeImageHighRes:if(!this.extension.isPagingSettingEnabled()||this.extension.isPagingSettingEnabled()&&this.extension.resources&&1===this.extension.resources.length){var i=this.getCanvasMaxDimensions(this.extension.helper.getCurrentCanvas());if(i){if(_.isUndefined(i.width))return!0;if(i.width<=this.options.maxImageWidth)return!0}}return!1;case s.wholeImagesHighRes:return this.extension.isPagingSettingEnabled()&&this.extension.resources&&this.extension.resources.length>1?!0:!1;case s.wholeImageLowResAsJpg:var n=this.getCanvasComputedDimensions(this.extension.helper.getCurrentCanvas());return n?!this.extension.isPagingSettingEnabled()&&n.width>this.options.confinedImageSize:!1;case s.selection:return this.options.selectionEnabled;default:return e.prototype.isDownloadOptionAvailable.call(this,t)}},t}(n);return l});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/ExternalContentDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("externalContentDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_EXTERNALCONTENT_DIALOGUE,this.closeCommand=i.HIDE_EXTERNALCONTENT_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(),t.$iframe.prop("src",i.uri)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.$iframe=$("<iframe></iframe>"),this.$content.append(this.$iframe),this.$element.hide()},t.prototype.resize=function(){e.prototype.resize.call(this),this.$iframe.width(this.$content.width()),this.$iframe.height(this.$content.height())},t}(n);return o}),define("modules/uv-shared-module/AutoComplete",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t,i,n,o,s,r){void 0===o&&(o=300),void 0===s&&(s=2),void 0===r&&(r=!1);var a=this;this._validKeyDownCodes=[KeyCodes.KeyDown.Backspace,KeyCodes.KeyDown.Spacebar,KeyCodes.KeyDown.Tab,KeyCodes.KeyDown.LeftArrow,KeyCodes.KeyDown.RightArrow,KeyCodes.KeyDown.Delete],this._validKeyPressCodes=[KeyCodes.KeyPress.GraveAccent,KeyCodes.KeyPress.DoubleQuote],this._lastKeyDownWasValid=!1,this._$element=e,this._autoCompleteFunc=t,this._delay=o,this._minChars=s,this._onSelect=n,this._parseResultsFunc=i,this._positionAbove=r,this._$searchResultsList=$('<ul class="autocomplete"></ul>'),this._positionAbove?this._$element.parent().prepend(this._$searchResultsList):this._$element.parent().append(this._$searchResultsList),this._$searchResultTemplate=$('<li class="result"><a href="#" tabindex="-1"></a></li>');var l=function(){var e=0;return function(t,i){clearTimeout(e),e=setTimeout(t,i)}}(),h=this;this._$element.on("keydown",function(e){var t=e.originalEvent;h._lastKeyDownWasValid=h._isValidKeyDown(t);var i=Utils.Keyboard.getCharCode(t),n=!1;i===KeyCodes.KeyDown.LeftArrow?n=!0:i===KeyCodes.KeyDown.RightArrow&&(n=!0),n&&(t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation())}),this._$element.on("keypress",function(e){var t=h._isValidKeyPress(e.originalEvent);return h._lastKeyDownWasValid||t?!0:(e.preventDefault(),!1)}),this._$element.on("keyup",function(e){if(!h._getSelectedListItem().length&&e.keyCode===KeyCodes.KeyDown.Enter)return void h._onSelect(h._getTerms());if(h._$searchResultsList.is(":visible")&&h._results.length)if(e.keyCode===KeyCodes.KeyDown.Enter)h._searchForItem(h._getSelectedListItem());else{if(e.keyCode===KeyCodes.KeyDown.DownArrow)return void h._setSelectedResultIndex(1);if(e.keyCode===KeyCodes.KeyDown.UpArrow)return void h._setSelectedResultIndex(-1)}e.keyCode!==KeyCodes.KeyDown.Enter&&l(function(){var e=h._getTerms();e&&e.length>h._minChars&&!e.contains(" ")?h._search(e):(h._clearResults(),h._hideResults())},h._delay)}),$(document).on("mouseup",function(e){0===a._$searchResultsList.parent().has($(e.target)[0]).length&&(a._clearResults(),a._hideResults())}),this._hideResults()}return e.prototype._isValidKeyDown=function(e){var t=this._validKeyDownCodes.contains(Utils.Keyboard.getCharCode(e));return t},e.prototype._isValidKeyPress=function(e){var t=Utils.Keyboard.getCharCode(e),i=String.fromCharCode(t),n=i.isAlphanumeric()||this._validKeyPressCodes.contains(t);return n},e.prototype._getTerms=function(){return this._$element.val().trim()},e.prototype._setSelectedResultIndex=function(e){var t;t=1===e?this._selectedResultIndex+1:this._selectedResultIndex-1;var i=this._$searchResultsList.find("li");0>t?t=i.length-1:t>i.length-1&&(t=0),this._selectedResultIndex=t,i.removeClass("selected");var n=i.eq(this._selectedResultIndex);n.addClass("selected");var o=n.outerHeight(!0)*this._selectedResultIndex;this._$searchResultsList.scrollTop(o)},e.prototype._search=function(e){this._results=[],this._clearResults(),this._showResults(),this._$searchResultsList.append('<li class="loading"></li>'),this._updateListPosition();var t=this;this._autoCompleteFunc(e,function(e){t._listResults(e)})},e.prototype._clearResults=function(){this._$searchResultsList.empty()},e.prototype._hideResults=function(){this._$searchResultsList.hide()},e.prototype._showResults=function(){this._selectedResultIndex=-1,this._$searchResultsList.show()},e.prototype._updateListPosition=function(){this._positionAbove?this._$searchResultsList.css({top:-1*this._$searchResultsList.outerHeight(!0)}):this._$searchResultsList.css({top:this._$element.outerHeight(!0)})},e.prototype._listResults=function(e){if(this._results=this._parseResultsFunc(e),this._clearResults(),!this._results.length)return void this._hideResults();for(var t=0;t<this._results.length;t++){var i=this._results[t],n=this._$searchResultTemplate.clone(),o=n.find("a");o.text(i),this._$searchResultsList.append(n)}this._updateListPosition();var s=this;this._$searchResultsList.find("li").on("click",function(e){e.preventDefault(),s._searchForItem($(this))})},e.prototype._searchForItem=function(e){var t=e.find("a").text();this._$element.val(t),this._hideResults(),this._onSelect(t),this._clearResults(),this._hideResults()},e.prototype._getSelectedListItem=function(){return this._$searchResultsList.find("li.selected")},e}();return i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-searchfooterpanel-module/FooterPanel",["require","exports","../uv-shared-module/AutoComplete","../uv-shared-module/BaseCommands","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o,s,r){"use strict";var a=function(e){function t(t){var i=e.call(this,t)||this;return i.placemarkerTouched=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("searchFooterPanel"),e.prototype.create.call(this),$.subscribe(n.CANVAS_INDEX_CHANGED,function(e,i){t.canvasIndexChanged(),t.setCurrentSearchResultPlacemarker(),t.updatePrevButton(),t.updateNextButton()}),$.subscribe(s.MODE_CHANGED,function(e,i){t.settingsChanged()}),$.subscribe(s.SEARCH,function(e,i){t.terms=i}),$.subscribe(s.SEARCH_RESULTS,function(e,i){t.displaySearchResults(i.terms,i.results),t.setCurrentSearchResultPlacemarker()}),$.subscribe(s.SEARCH_RESULTS_EMPTY,function(){t.hideSearchSpinner()}),$.subscribe(s.SEARCH_RESULT_RECT_CHANGED,function(){t.updatePrevButton(),t.updateNextButton()}),this.$printButton=$('<a class="print" title="'+this.content.print+'" tabindex="0">'+this.content.print+"</a>"),this.$options.prepend(this.$printButton),this.$searchContainer=$('<div class="search"></div>'),this.$element.prepend(this.$searchContainer),this.$searchOptions=$('<div class="searchOptions"></div>'),this.$searchContainer.append(this.$searchOptions),this.$searchLabel=$('<span class="label">'+this.content.searchWithin+"</span>"),this.$searchOptions.append(this.$searchLabel),this.$searchTextContainer=$('<div class="searchTextContainer"></div>'),this.$searchOptions.append(this.$searchTextContainer),this.$searchText=$('<input class="searchText" type="text" maxlength="100" value="'+this.content.enterKeyword+'" />'),this.$searchTextContainer.append(this.$searchText),this.$searchButton=$('<a class="imageButton searchButton" tabindex="0"></a>'),this.$searchTextContainer.append(this.$searchButton),this.$searchPagerContainer=$('<div class="searchPager"></div>'),this.$element.prepend(this.$searchPagerContainer),this.$searchPagerControls=$('<div class="controls"></div>'),this.$searchPagerContainer.prepend(this.$searchPagerControls),this.$previousResultButton=$('<a class="previousResult" title="'+this.content.previousResult+'">'+this.content.previousResult+"</a>"),this.$searchPagerControls.append(this.$previousResultButton),this.$searchResultsInfo=$('<div class="searchResultsInfo"><span class="number">x</span> <span class="foundFor"></span> \'<span class="terms">y</span>\'</div>'),this.$searchPagerControls.append(this.$searchResultsInfo),this.$clearSearchResultsButton=$('<a class="clearSearch" title="'+this.content.clearSearch+'">'+this.content.clearSearch+"</a>"),this.$searchResultsInfo.append(this.$clearSearchResultsButton),this.$nextResultButton=$('<a class="nextResult" title="'+this.content.nextResult+'">'+this.content.nextResult+"</a>"),this.$searchPagerControls.append(this.$nextResultButton),this.$searchResultsContainer=$('<div class="searchResults"></div>'),this.$element.prepend(this.$searchResultsContainer),this.$line=$('<div class="line"></div>'),this.$searchResultsContainer.append(this.$line),this.$pagePositionMarker=$('<div class="positionPlacemarker"></div>'),this.$searchResultsContainer.append(this.$pagePositionMarker),this.$pagePositionLabel=$('<div class="label"></div>'),this.$searchResultsContainer.append(this.$pagePositionLabel),this.$placemarkerDetails=$('<div class="placeMarkerDetails"></div>'),this.$searchResultsContainer.append(this.$placemarkerDetails),this.$placemarkerDetailsTop=$("<h1></h1>"),this.$placemarkerDetails.append(this.$placemarkerDetailsTop),this.$placemarkerDetailsBottom=$("<p></p>"),this.$placemarkerDetails.append(this.$placemarkerDetailsBottom),this.$searchPagerContainer.hide(),this.$placemarkerDetails.hide();var o=this;this.$searchButton.on("click",function(e){e.preventDefault(),t.search(t.$searchText.val())}),this.$searchText.on("focus",function(){t.$searchText.val()===t.content.enterKeyword&&t.$searchText.val("")}),this.$placemarkerDetails.on("mouseover",function(){$.publish(s.SEARCH_PREVIEW_START,[t.currentPlacemarkerIndex])}),this.$placemarkerDetails.on("mouseleave",function(){$(this).hide(),$.publish(s.SEARCH_PREVIEW_FINISH);var e=o.getSearchResultPlacemarkers();e.removeClass("hover")}),this.$placemarkerDetails.on("click",function(e){$.publish(s.VIEW_PAGE,[t.currentPlacemarkerIndex])}),this.$previousResultButton.on("click",function(e){e.preventDefault(),$.publish(s.PREV_SEARCH_RESULT)}),this.$nextResultButton.on("click",function(e){e.preventDefault(),$.publish(s.NEXT_SEARCH_RESULT)}),this.$clearSearchResultsButton.on("click",function(e){e.preventDefault(),$.publish(s.CLEAR_SEARCH),t.clearSearchResults()}),this.extension.isSearchWithinEnabled()||(this.$searchContainer.hide(),this.$searchPagerContainer.hide(),this.$searchResultsContainer.hide(),this.$element.addClass("min")),1===this.extension.helper.getTotalCanvases()&&this.$searchResultsContainer.hide();var r=this.extension.getAutoCompleteUri();r?new i(this.$searchText,function(e,t){$.getJSON(String.format(r,e),function(e){t(e)})},function(e){return $.map(e.terms,function(e){return e.match})},function(e){t.search(e)},300,2,!0):this.$searchText.on("keyup",function(e){e.keyCode===KeyCodes.KeyDown.Enter&&o.search(o.$searchText.val())}),this.$printButton.onPressed(function(){$.publish(s.PRINT)}),this.updatePrintButton();var a=Utils.Bools.getBool(this.config.options.positionMarkerEnabled,!0);a||(this.$pagePositionMarker.hide(),this.$pagePositionLabel.hide())},t.prototype.isZoomToSearchResultEnabled=function(){return Utils.Bools.getBool(this.extension.config.options.zoomToSearchResultEnabled,!0)},t.prototype.isPreviousButtonEnabled=function(){var e=this.extension.helper.canvasIndex,t=this.getFirstSearchResultCanvasIndex(),i=this.getCurrentSearchResultRectIndex();return this.isZoomToSearchResultEnabled()&&this.extension.currentSearchResultRect?t>e?!1:e===t&&0===i?!1:!0:e>t},t.prototype.isCanvasIndexLessThanFirstSearchResultIndex=function(){var e=this.extension.searchResults;return this.extension.helper.canvasIndex<=e[0].canvasIndex},t.prototype.isNextButtonEnabled=function(){var e=this.extension.helper.canvasIndex,t=this.getLastSearchResultCanvasIndex(),i=this.getCurrentSearchResultRectIndex();return this.isZoomToSearchResultEnabled()&&this.extension.currentSearchResultRect?e>t?!1:e===t&&i===this.getLastSearchResultRectIndex()?!1:!0:t>e},t.prototype.getSearchResults=function(){return this.extension.searchResults},t.prototype.getCurrentSearchResultRectIndex=function(){return this.extension.getCurrentSearchResultRectIndex()},t.prototype.getFirstSearchResultCanvasIndex=function(){var e=this.getSearchResults(),t=e[0].canvasIndex;return t},t.prototype.getLastSearchResultCanvasIndex=function(){var e=this.getSearchResults(),t=e[e.length-1].canvasIndex;return t},t.prototype.getLastSearchResultRectIndex=function(){return this.extension.getLastSearchResultRectIndex()},t.prototype.updateNextButton=function(){var e=this.extension.searchResults;e&&e.length&&(this.isNextButtonEnabled()?this.$nextResultButton.removeClass("disabled"):this.$nextResultButton.addClass("disabled"))},t.prototype.updatePrevButton=function(){var e=this.extension.searchResults;e&&e.length&&(this.isPreviousButtonEnabled()?this.$previousResultButton.removeClass("disabled"):this.$previousResultButton.addClass("disabled"))},t.prototype.updatePrintButton=function(){var e=Utils.Bools.getBool(this.options.printEnabled,!1);e?this.$printButton.show():this.$printButton.hide()},t.prototype.search=function(e){return this.terms=e,""===this.terms||this.terms===this.content.enterKeyword?void this.extension.showMessage(this.config.modules.genericDialogue.content.emptyValue,function(){this.$searchText.focus()}):(this.$searchText.blur(),this.showSearchSpinner(),void $.publish(s.SEARCH,[this.terms]))},t.prototype.getSearchResultPlacemarkers=function(){return this.$searchResultsContainer.find(".searchResultPlacemarker")},t.prototype.setCurrentSearchResultPlacemarker=function(){var e=this.getSearchResultPlacemarkers();e.parent().find(".current").removeClass("current");var t=$('.searchResultPlacemarker[data-index="'+this.extension.helper.canvasIndex+'"]');t.addClass("current")},t.prototype.positionSearchResultPlacemarkers=function(){var e=this.extension.searchResults;if(e.length){var t=this.getSearchResultPlacemarkers();t.remove();for(var i=this.getPageLineRatio(),n=this.$line.position().top,o=this.$line.position().left,s=this,r=0;r<e.length;r++){var a=e[r],l=a.canvasIndex*i,h=$('<div class="searchResultPlacemarker" data-index="'+a.canvasIndex+'"></div>');h[0].ontouchstart=function(e){s.onPlacemarkerTouchStart.call(this,s)},h.click(function(e){s.onPlacemarkerClick.call(this,s)}),h.mouseenter(function(e){s.onPlacemarkerMouseEnter.call(this,s)}),h.mouseleave(function(e){s.onPlacemarkerMouseLeave.call(this,e,s)}),this.$searchResultsContainer.append(h);var c=n-h.height(),u=o+l-h.width()/2;h.css({top:c,left:u})}}},t.prototype.onPlacemarkerTouchStart=function(e){e.placemarkerTouched=!0;var t=$(this),i=parseInt(t.attr("data-index"));$.publish(s.VIEW_PAGE,[i])},t.prototype.onPlacemarkerClick=function(e){if(!e.placemarkerTouched){e.placemarkerTouched=!1;var t=$(this),i=parseInt(t.attr("data-index"));$.publish(s.VIEW_PAGE,[i])}},t.prototype.onPlacemarkerMouseEnter=function(e){if(!e.placemarkerTouched){var t=$(this);t.addClass("hover");var i=parseInt(t.attr("data-index"));$.publish(s.SEARCH_PREVIEW_START,[i]);var n=e.getSearchResultPlacemarkers(),o=n.index(t[0]);e.currentPlacemarkerIndex=i,e.$placemarkerDetails.show();var a="{0} {1}",l=e.extension.getMode();if(l.toString()===r.page.toString()){var h=e.extension.helper.getCanvasByIndex(i),c=Manifesto.TranslationCollection.getValue(h.getLabel());""===c&&(c=this.extension.helper.manifest.options.defaultLabel),a=String.format(a,e.content.pageCaps,c)}else a=String.format(a,e.content.imageCaps,i+1);e.$placemarkerDetailsTop.html(a);var u,p=e.extension.searchResults[o],d=Utils.Strings.ellipsis(e.terms,e.options.elideDetailsTermsCount);1===p.rects.length?(u=e.content.instanceFound,u=String.format(u,d)):(u=e.content.instancesFound,u=String.format(u,p.rects.length,d)),e.$placemarkerDetailsBottom.html(u);var g=t.position(),f=g.top-e.$placemarkerDetails.height(),m=g.left;m<e.$placemarkerDetails.width()/2?m=0-t.width()/2:m>e.$line.width()-e.$placemarkerDetails.width()/2?m=e.$line.width()-e.$placemarkerDetails.width()+t.width()/2:m-=e.$placemarkerDetails.width()/2,e.$placemarkerDetails.css({top:f,left:m})}},t.prototype.onPlacemarkerMouseLeave=function(e,t){$.publish(s.SEARCH_PREVIEW_FINISH);var i=$(this),n=e.toElement||e.relatedTarget,o=$(n).closest(t.$placemarkerDetails).length;n!=t.$placemarkerDetails.get(0)&&0===o&&(t.$placemarkerDetails.hide(),i.removeClass("hover"))},t.prototype.setPageMarkerPosition=function(){if(null!=this.extension.helper.canvasIndex){var e=this.getPageLineRatio(),t=this.$line.position().top,i=this.$line.position().left,n=this.extension.helper.canvasIndex*e,o=t,s=i+n;this.$pagePositionMarker.css({top:o,left:s});var r=this.$line.width();s+this.$pagePositionLabel.outerWidth(!0)>r?(s-=this.$pagePositionLabel.outerWidth(!0),this.$pagePositionLabel.removeClass("right"),this.$pagePositionLabel.addClass("left")):(this.$pagePositionLabel.removeClass("left"),this.$pagePositionLabel.addClass("right")),this.$pagePositionLabel.css({top:o,left:s})}},t.prototype.clearSearchResults=function(){this.extension.searchResults=[];var e=this.getSearchResultPlacemarkers();e.remove(),this.$searchText.val(this.content.enterKeyword),this.$searchContainer.show(),this.$searchPagerContainer.hide(),this.$searchText.focus()},t.prototype.getPageLineRatio=function(){var e=this.$line.width();return 1===this.extension.helper.getTotalCanvases()?0:e/(this.extension.helper.getTotalCanvases()-1)},t.prototype.canvasIndexChanged=function(){this.setPageMarkerPosition(),this.setPlacemarkerLabel()},t.prototype.settingsChanged=function(){this.setPlacemarkerLabel()},t.prototype.setPlacemarkerLabel=function(){var e=this.content.displaying,t=this.extension.helper.canvasIndex;if(this.isPageModeEnabled()){var i=this.extension.helper.getCanvasByIndex(t),n=Manifesto.TranslationCollection.getValue(i.getLabel());""===n&&(n=this.content.defaultLabel);var o=this.extension.helper.getLastCanvasLabel(!0);this.$pagePositionLabel.html(String.format(e,this.content.page,this.extension.sanitize(n),this.extension.sanitize(o)))}else this.$pagePositionLabel.html(String.format(e,this.content.image,t+1,this.extension.helper.getTotalCanvases()))},t.prototype.isPageModeEnabled=function(){return this.config.options.pageModeEnabled&&this.extension.getMode().toString()===r.page.toString()},t.prototype.showSearchSpinner=function(){this.$searchText.addClass("searching")},t.prototype.hideSearchSpinner=function(){this.$searchText.removeClass("searching")},t.prototype.displaySearchResults=function(e,t){if(t){this.hideSearchSpinner(),this.positionSearchResultPlacemarkers(),this.$searchContainer.hide(),this.$searchPagerControls.css({left:0});var i=this.$searchPagerContainer.find(".number");i.text(this.extension.getTotalSearchResultRects());var n=this.$searchResultsInfo.find(".foundFor");1===t.length?n.html(this.content.resultFoundFor):n.html(this.content.resultsFoundFor);var o=this.$searchPagerContainer.find(".terms");o.html(Utils.Strings.ellipsis(e,this.options.elideResultsTermsCount)),o.prop("title",e),this.$searchPagerContainer.show(),this.resize()}},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.extension.searchResults;t&&t.length&&this.positionSearchResultPlacemarkers(),this.setPageMarkerPosition(),this.$searchPagerContainer.width(this.$element.width());var i=this.$element.width()/2;this.$searchPagerControls.css({left:i-this.$searchPagerControls.width()/2}),this.$searchOptions.css({left:i-this.$searchOptions.outerWidth()/2})},t}(o);return a});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-osdmobilefooterpanel-module/MobileFooter",["require","exports","../uv-shared-module/FooterPanel","../../extensions/uv-seadragon-extension/Commands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("mobileFooterPanel"),e.prototype.create.call(this),this.$spacer=$('<div class="spacer"></div>'),this.$options.prepend(this.$spacer),this.$rotateButton=$('<a class="rotate" title="'+this.content.rotateRight+'" tabindex="0">'+this.content.rotateRight+"</a>"),this.$options.prepend(this.$rotateButton),this.$zoomOutButton=$('<a class="zoomOut" title="'+this.content.zoomOut+'" tabindex="0">'+this.content.zoomOut+"</a>"),this.$options.prepend(this.$zoomOutButton),this.$zoomInButton=$('<a class="zoomIn" title="'+this.content.zoomIn+'" tabindex="0">'+this.content.zoomIn+"</a>"),this.$options.prepend(this.$zoomInButton),this.$zoomInButton.onPressed(function(){$.publish(n.ZOOM_IN)}),this.$zoomOutButton.onPressed(function(){$.publish(n.ZOOM_OUT)}),this.$rotateButton.onPressed(function(){$.publish(n.ROTATE)})},t.prototype.resize=function(){
7
+ e.prototype.resize.call(this),this.$options.css("left",Math.floor(this.$element.width()/2-this.$options.width()/2))},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-dialogues-module/MoreInfoDialogue",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/Dialogue"],function(e,t,i,n){"use strict";var o=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("moreInfoDialogue"),e.prototype.create.call(this),this.openCommand=i.SHOW_MOREINFO_DIALOGUE,this.closeCommand=i.HIDE_MOREINFO_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open(i)}),$.subscribe(this.closeCommand,function(e){t.close()}),this.config.content=this.extension.config.modules.moreInfoRightPanel.content,this.config.options=this.extension.config.modules.moreInfoRightPanel.options,this.$title=$("<h1>"+this.config.content.title+"</h1>"),this.$content.append(this.$title),this.$metadata=$('<div class="iiif-metadata-component"></div>'),this.$content.append(this.$metadata),this.component=new IIIFComponents.MetadataComponent({target:this.$metadata[0],data:this._getData()}),this.$element.hide()},t.prototype.open=function(t){e.prototype.open.call(this,t),this.component.set(null)},t.prototype._getData=function(){var e=this;return{canvasDisplayOrder:this.config.options.canvasDisplayOrder,canvases:this.extension.getCurrentCanvases(),canvasExclude:this.config.options.canvasExclude,canvasLabels:this.extension.getCanvasLabels(this.content.page),content:this.config.content,copiedMessageDuration:2e3,copyToClipboardEnabled:Utils.Bools.getBool(this.config.options.copyToClipboardEnabled,!1),helper:this.extension.helper,licenseFormatter:null,limit:this.config.options.textLimit||4,limitType:IIIFComponents.MetadataComponentOptions.LimitType.LINES,manifestDisplayOrder:this.config.options.manifestDisplayOrder,manifestExclude:this.config.options.manifestExclude,range:this.extension.getCurrentCanvasRange(),rtlLanguageCodes:this.config.options.rtlLanguageCodes,sanitizer:function(t){return e.extension.sanitize(t)},showAllLanguages:this.config.options.showAllLanguages}},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){this.setDockedPosition()},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-multiselectdialogue-module/MultiSelectDialogue",["require","exports","../../extensions/uv-seadragon-extension/Commands","../../modules/uv-shared-module/Dialogue","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o){"use strict";var s=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("multiSelectDialogue"),e.prototype.create.call(this);var n=this;this.openCommand=i.SHOW_MULTISELECT_DIALOGUE,this.closeCommand=i.HIDE_MULTISELECT_DIALOGUE,$.subscribe(this.openCommand,function(e,i){t.open();var n=t.extension.helper.getMultiSelectState();n.setEnabled(!0),t.component.set(null)}),$.subscribe(this.closeCommand,function(e){t.close();var i=t.extension.helper.getMultiSelectState();i.setEnabled(!1)}),this.$title=$("<h1></h1>"),this.$content.append(this.$title),this.$title.text(this.content.title),this.$gallery=$('<div class="iiif-gallery-component"></div>'),this.$content.append(this.$gallery),this.data={helper:this.extension.helper,chunkedResizingThreshold:this.config.options.galleryThumbChunkedResizingThreshold,content:this.config.content,debug:!1,imageFadeInDuration:300,initialZoom:4,minLabelWidth:20,pageModeEnabled:this.isPageModeEnabled(),searchResults:[],scrollStopDuration:100,sizingEnabled:!0,thumbHeight:this.config.options.galleryThumbHeight,thumbLoadPadding:this.config.options.galleryThumbLoadPadding,thumbWidth:this.config.options.galleryThumbWidth,viewingDirection:this.extension.helper.getViewingDirection()},this.component=new IIIFComponents.GalleryComponent({target:this.$gallery[0],data:this.data});var o=this.$gallery.find("a.select");o.addClass("btn btn-primary"),this.component.on("multiSelectionMade",function(e){var t=e[0];$.publish(i.MULTISELECTION_MADE,[t]),n.close()}),this.$element.hide()},t.prototype.isPageModeEnabled=function(){return Utils.Bools.getBool(this.config.options.pageModeEnabled,!0)&&this.extension.getMode().toString()===o.page.toString()},t.prototype.open=function(){e.prototype.open.call(this)},t.prototype.close=function(){e.prototype.close.call(this)},t.prototype.resize=function(){e.prototype.resize.call(this);var t=this.$gallery.find(".main"),i=this.$gallery.find(".header");t.height(this.$content.height()-this.$title.outerHeight()-this.$title.verticalMargins()-i.height())},t}(n);return s}),define("extensions/uv-seadragon-extension/MultiSelectionArgs",["require","exports"],function(e,t){"use strict";var i=function(){function e(){}return e}();return i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-pagingheaderpanel-module/PagingHeaderPanel",["require","exports","../uv-shared-module/AutoComplete","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Commands","../uv-shared-module/HeaderPanel","../../extensions/uv-seadragon-extension/Mode"],function(e,t,i,n,o,s,r){"use strict";var a=function(e){function t(t){var i=e.call(this,t)||this;return i.firstButtonEnabled=!1,i.lastButtonEnabled=!1,i.nextButtonEnabled=!1,i.prevButtonEnabled=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;if(this.setConfig("pagingHeaderPanel"),e.prototype.create.call(this),$.subscribe(n.CANVAS_INDEX_CHANGED,function(e,i){t.canvasIndexChanged(i)}),$.subscribe(n.SETTINGS_CHANGED,function(e){t.modeChanged(),t.updatePagingToggle()}),$.subscribe(n.CANVAS_INDEX_CHANGE_FAILED,function(e){t.setSearchFieldValue(t.extension.helper.canvasIndex)}),$.subscribe(n.LEFTPANEL_EXPAND_FULL_START,function(e){t.openGallery()}),$.subscribe(n.LEFTPANEL_COLLAPSE_FULL_START,function(e){t.closeGallery()}),this.$prevOptions=$('<div class="prevOptions"></div>'),this.$centerOptions.append(this.$prevOptions),this.$firstButton=$('<a class="imageBtn first" tabindex="0"></a>'),this.$prevOptions.append(this.$firstButton),this.$prevButton=$('<a class="imageBtn prev" tabindex="0"></a>'),this.$prevOptions.append(this.$prevButton),this.$modeOptions=$('<div class="mode"></div>'),this.$centerOptions.append(this.$modeOptions),this.$imageModeLabel=$('<label for="image">'+this.content.image+"</label>"),this.$modeOptions.append(this.$imageModeLabel),this.$imageModeOption=$('<input type="radio" id="image" name="mode" tabindex="0"/>'),this.$modeOptions.append(this.$imageModeOption),this.$pageModeLabel=$('<label for="page"></label>'),this.$modeOptions.append(this.$pageModeLabel),this.$pageModeOption=$('<input type="radio" id="page" name="mode" tabindex="0"/>'),this.$modeOptions.append(this.$pageModeOption),this.$search=$('<div class="search"></div>'),this.$centerOptions.append(this.$search),this.$searchText=$('<input class="searchText" maxlength="50" type="text" tabindex="0"/>'),this.$search.append(this.$searchText),Utils.Bools.getBool(this.options.autoCompleteBoxEnabled,!0))this.$searchText.hide(),this.$autoCompleteBox=$('<input class="autocompleteText" type="text" maxlength="100" />'),this.$search.append(this.$autoCompleteBox),new i(this.$autoCompleteBox,function(e,i){var n=[],o=t.extension.helper.getCanvases();if(t.isPageModeEnabled())for(var s=0;s<o.length;s++){var r=o[s],a=Manifesto.TranslationCollection.getValue(r.getLabel());a.startsWith(e)&&n.push(a)}else for(var s=0;s<o.length;s++){var r=o[s];r.index.toString().startsWith(e)&&n.push(r.index.toString())}i(n)},function(e){return e},function(e){t.search(e)},300,0);else if(Utils.Bools.getBool(this.options.imageSelectionBoxEnabled,!0)){this.$selectionBoxOptions=$('<div class="image-selectionbox-options"></div>'),this.$centerOptions.append(this.$selectionBoxOptions),this.$imageSelectionBox=$('<select class="image-selectionbox" name="image-select" tabindex="0" ></select>'),this.$selectionBoxOptions.append(this.$imageSelectionBox);for(var s=0;s<this.extension.helper.getTotalCanvases();s++){var a=this.extension.helper.getCanvasByIndex(s),l=this.extension.sanitize(Manifesto.TranslationCollection.getValue(a.getLabel()));this.$imageSelectionBox.append("<option value="+s+">"+l+"</option>")}this.$imageSelectionBox.change(function(){var e=parseInt(t.$imageSelectionBox.val());$.publish(o.IMAGE_SEARCH,[e])})}this.$total=$('<span class="total"></span>'),this.$search.append(this.$total),this.$searchButton=$('<a class="go btn btn-primary" tabindex="0">'+this.content.go+"</a>"),this.$search.append(this.$searchButton),this.$nextOptions=$('<div class="nextOptions"></div>'),this.$centerOptions.append(this.$nextOptions),this.$nextButton=$('<a class="imageBtn next" tabindex="0"></a>'),this.$nextOptions.append(this.$nextButton),this.$lastButton=$('<a class="imageBtn last" tabindex="0"></a>'),this.$nextOptions.append(this.$lastButton),this.isPageModeEnabled()?(this.$pageModeOption.attr("checked","checked"),this.$pageModeOption.removeAttr("disabled"),this.$pageModeLabel.removeClass("disabled")):(this.$imageModeOption.attr("checked","checked"),this.$pageModeOption.attr("disabled","disabled"),this.$pageModeLabel.addClass("disabled")),this.extension.helper.getManifestType().toString()===manifesto.ManifestType.manuscript().toString()?this.$pageModeLabel.text(this.content.folio):this.$pageModeLabel.text(this.content.page),this.$galleryButton=$('<a class="imageBtn gallery" title="'+this.content.gallery+'" tabindex="0"></a>'),this.$rightOptions.prepend(this.$galleryButton),this.$pagingToggleButtons=$('<div class="pagingToggleButtons"></div>'),this.$rightOptions.prepend(this.$pagingToggleButtons),this.$oneUpButton=$('<a class="imageBtn one-up" title="'+this.content.oneUp+'" tabindex="0"></a>'),this.$pagingToggleButtons.append(this.$oneUpButton),this.$twoUpButton=$('<a class="imageBtn two-up" title="'+this.content.twoUp+'" tabindex="0"></a>'),this.$pagingToggleButtons.append(this.$twoUpButton),this.updatePagingToggle(),this.updateGalleryButton(),this.$oneUpButton.onPressed(function(){var e=!1;t.updateSettings({pagingEnabled:e}),$.publish(o.PAGING_TOGGLED,[e])}),this.$twoUpButton.onPressed(function(){var e=!0;t.updateSettings({pagingEnabled:e}),$.publish(o.PAGING_TOGGLED,[e])}),this.$galleryButton.onPressed(function(){$.publish(n.TOGGLE_EXPAND_LEFT_PANEL)}),this.setTitles(),this.setTotal();var h=this.extension.helper.getViewingDirection();1===this.extension.helper.getTotalCanvases()&&this.$centerOptions.hide(),this.$firstButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.topToBottom().toString():case manifesto.ViewingDirection.bottomToTop().toString():$.publish(o.FIRST);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.LAST)}}),this.$prevButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(o.PREV);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.NEXT)}}),this.$nextButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(o.NEXT);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.PREV)}}),this.$lastButton.onPressed(function(){switch(h.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.topToBottom().toString():case manifesto.ViewingDirection.bottomToTop().toString():$.publish(o.LAST);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(o.FIRST)}}),this.config.options.pageModeEnabled?(this.$imageModeOption.on("click",function(e){$.publish(o.MODE_CHANGED,[r.image.toString()])}),this.$pageModeOption.on("click",function(e){$.publish(o.MODE_CHANGED,[r.page.toString()])})):(this.$imageModeOption.hide(),this.$pageModeLabel.hide(),this.$pageModeOption.hide()),this.$searchText.onEnter(function(){t.$searchText.blur(),t.search(t.$searchText.val())}),this.$searchText.click(function(){$(this).select()}),this.$searchButton.onPressed(function(){t.options.autoCompleteBoxEnabled?t.search(t.$autoCompleteBox.val()):t.search(t.$searchText.val())}),this.options.modeOptionsEnabled===!1&&(this.$modeOptions.hide(),this.$centerOptions.addClass("modeOptionsDisabled")),this.options.imageSelectionBoxEnabled===!0&&this.options.autoCompleteBoxEnabled!==!0&&this.$search.hide(),this.options.helpEnabled===!1&&this.$helpButton.hide(),Utils.Bools.getBool(this.options.pagingToggleEnabled,!0)||this.$pagingToggleButtons.hide()},t.prototype.openGallery=function(){this.$oneUpButton.removeClass("on"),this.$twoUpButton.removeClass("on"),this.$galleryButton.addClass("on")},t.prototype.closeGallery=function(){this.updatePagingToggle(),this.$galleryButton.removeClass("on")},t.prototype.isPageModeEnabled=function(){return this.config.options.pageModeEnabled&&this.extension.getMode().toString()===r.page.toString()},t.prototype.setTitles=function(){this.isPageModeEnabled()?(this.$firstButton.prop("title",this.content.firstPage),this.$prevButton.prop("title",this.content.previousPage),this.$nextButton.prop("title",this.content.nextPage),this.$lastButton.prop("title",this.content.lastPage)):(this.$firstButton.prop("title",this.content.firstImage),this.$prevButton.prop("title",this.content.previousImage),this.$nextButton.prop("title",this.content.nextImage),this.$lastButton.prop("title",this.content.lastImage)),this.$searchButton.prop("title",this.content.go)},t.prototype.updatePagingToggle=function(){return this.pagingToggleIsVisible()?void(this.extension.isPagingSettingEnabled()?(this.$oneUpButton.removeClass("on"),this.$twoUpButton.addClass("on")):(this.$twoUpButton.removeClass("on"),this.$oneUpButton.addClass("on"))):void this.$pagingToggleButtons.hide()},t.prototype.pagingToggleIsVisible=function(){return Utils.Bools.getBool(this.options.pagingToggleEnabled,!0)&&this.extension.helper.isPagingAvailable()},t.prototype.updateGalleryButton=function(){this.galleryIsVisible()||this.$galleryButton.hide()},t.prototype.galleryIsVisible=function(){return Utils.Bools.getBool(this.options.galleryButtonEnabled,!0)&&this.extension.isLeftPanelEnabled()},t.prototype.setTotal=function(){var e=this.content.of;this.isPageModeEnabled()?this.$total.html(String.format(e,this.extension.helper.getLastCanvasLabel(!0))):this.$total.html(String.format(e,this.extension.helper.getTotalCanvases()))},t.prototype.setSearchFieldValue=function(e){var t,i=this.extension.helper.getCanvasByIndex(e);if(this.isPageModeEnabled()){var n=Manifesto.TranslationCollection.getValue(i.getLabel());t="-"===n?"":n}else e+=1,t=e;this.options.autoCompleteBoxEnabled?this.$autoCompleteBox.val(t):this.$searchText.val(t)},t.prototype.search=function(e){if(!e)return this.extension.showMessage(this.content.emptyValue),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);if(this.isPageModeEnabled())$.publish(o.PAGE_SEARCH,[e]);else{var t;if(t=this.options.autoCompleteBoxEnabled?parseInt(this.$autoCompleteBox.val(),10):parseInt(this.$searchText.val(),10),t-=1,isNaN(t))return this.extension.showMessage(this.extension.config.modules.genericDialogue.content.invalidNumber),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);var i=this.extension.helper.getCanvasByIndex(t);if(!i)return this.extension.showMessage(this.extension.config.modules.genericDialogue.content.pageNotFound),void $.publish(n.CANVAS_INDEX_CHANGE_FAILED);$.publish(o.IMAGE_SEARCH,[t])}},t.prototype.canvasIndexChanged=function(e){this.setSearchFieldValue(e),this.options.imageSelectionBoxEnabled===!0&&this.options.autoCompleteBoxEnabled!==!0&&this.$imageSelectionBox.val(e);var t=this.extension.helper.getViewingDirection();t.toString()===manifesto.ViewingDirection.rightToLeft().toString()?(this.extension.helper.isFirstCanvas()?(this.disableLastButton(),this.disableNextButton()):(this.enableLastButton(),this.enableNextButton()),this.extension.helper.isLastCanvas()?(this.disableFirstButton(),this.disablePrevButton()):(this.enableFirstButton(),this.enablePrevButton())):(this.extension.helper.isFirstCanvas()?(this.disableFirstButton(),this.disablePrevButton()):(this.enableFirstButton(),this.enablePrevButton()),this.extension.helper.isLastCanvas()?(this.disableLastButton(),this.disableNextButton()):(this.enableLastButton(),this.enableNextButton()))},t.prototype.disableFirstButton=function(){this.firstButtonEnabled=!1,this.$firstButton.disable()},t.prototype.enableFirstButton=function(){this.firstButtonEnabled=!0,this.$firstButton.enable()},t.prototype.disableLastButton=function(){this.lastButtonEnabled=!1,this.$lastButton.disable()},t.prototype.enableLastButton=function(){this.lastButtonEnabled=!0,this.$lastButton.enable()},t.prototype.disablePrevButton=function(){this.prevButtonEnabled=!1,this.$prevButton.disable()},t.prototype.enablePrevButton=function(){this.prevButtonEnabled=!0,this.$prevButton.enable()},t.prototype.disableNextButton=function(){this.nextButtonEnabled=!1,this.$nextButton.disable()},t.prototype.enableNextButton=function(){this.nextButtonEnabled=!0,this.$nextButton.enable()},t.prototype.modeChanged=function(){this.setSearchFieldValue(this.extension.helper.canvasIndex),this.setTitles(),this.setTotal()},t.prototype.resize=function(){e.prototype.resize.call(this),this.extension.width()<this.extension.config.options.minWidthBreakPoint?(this.pagingToggleIsVisible()&&this.$pagingToggleButtons.hide(),this.galleryIsVisible()&&this.$galleryButton.hide()):(this.pagingToggleIsVisible()&&this.$pagingToggleButtons.show(),this.galleryIsVisible()&&this.$galleryButton.show())},t}(s);return a}),define("extensions/uv-seadragon-extension/Bounds",["require","exports"],function(e,t){"use strict";var i=function(){function e(e,t,i,n){this.x=e,this.y=t,this.w=i,this.h=n}return e.prototype.toString=function(){return this.x+","+this.y+","+this.w+","+this.h},e.fromString=function(t){var i=t.split(",");return new e(Number(i[0]),Number(i[1]),Number(i[2]),Number(i[3]))},e}();return i});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../../extensions/uv-seadragon-extension/Bounds","../uv-shared-module/CenterPanel","../../extensions/uv-seadragon-extension/Commands","../uv-shared-module/Metrics","../../Params"],function(e,t,i,n,o,s,r,a){"use strict";var l=function(e){function t(t){var i=e.call(this,t)||this;return i.controlsVisible=!1,i.isCreated=!1,i.isFirstLoad=!0,i.nextButtonEnabled=!1,i.prevButtonEnabled=!1,i}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("seadragonCenterPanel"),e.prototype.create.call(this),this.$viewer=$('<div id="viewer"></div>'),this.$content.prepend(this.$viewer),$.subscribe(i.SETTINGS_CHANGED,function(e,i){t.viewer.gestureSettingsMouse.clickToZoom=i.clickToZoomEnabled}),$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,i){t.whenResized(function(){t.isCreated||t.createUI(),t.openMedia(i)})}),$.subscribe(s.CLEAR_SEARCH,function(){t.whenCreated(function(){t.extension.currentSearchResultRect=null,t.clearSearchResults()})}),$.subscribe(s.VIEW_PAGE,function(){t.extension.previousSearchResultRect=null,t.extension.currentSearchResultRect=null}),$.subscribe(s.NEXT_SEARCH_RESULT,function(){t.whenCreated(function(){t.nextSearchResult()})}),$.subscribe(s.PREV_SEARCH_RESULT,function(){t.whenCreated(function(){t.prevSearchResult()})}),$.subscribe(s.ZOOM_IN,function(){t.whenCreated(function(){t.zoomIn()})}),$.subscribe(s.ZOOM_OUT,function(){t.whenCreated(function(){t.zoomOut()})}),$.subscribe(s.ROTATE,function(){t.whenCreated(function(){t.rotateRight()})}),$.subscribe(i.METRIC_CHANGED,function(){t.whenCreated(function(){t.updateResponsiveView()})})},t.prototype.whenResized=function(e){var t=this;Utils.Async.waitFor(function(){return t.isResized},e)},t.prototype.whenCreated=function(e){var t=this;Utils.Async.waitFor(function(){return t.isCreated},e)},t.prototype.zoomIn=function(){this.viewer.viewport.zoomTo(2*this.viewer.viewport.getZoom(!0))},t.prototype.zoomOut=function(){this.viewer.viewport.zoomTo(.5*this.viewer.viewport.getZoom(!0))},t.prototype.rotateRight=function(){this.viewer.viewport.setRotation(this.viewer.viewport.getRotation()+90)},t.prototype.updateResponsiveView=function(){this.setNavigatorVisible(),this.extension.metric===r.MOBILE_LANDSCAPE?(this.viewer.autoHideControls=!1,this.$viewportNavButtons.hide()):(this.viewer.autoHideControls=!0,this.$viewportNavButtons.show())},t.prototype.createUI=function(){var e=this;this.$spinner=$('<div class="spinner"></div>'),this.$content.append(this.$spinner),this.updateAttribution();var t=window.DEBUG?"modules/uv-seadragoncenterpanel-module/img/":"themes/"+this.extension.config.options.theme+"/img/uv-seadragoncenterpanel-module/";window.openSeadragonViewer=this.viewer=OpenSeadragon({id:"viewer",ajaxWithCredentials:!1,showNavigationControl:!0,showNavigator:!0,showRotationControl:!0,showHomeControl:Utils.Bools.getBool(this.config.options.showHomeControl,!1),showFullPageControl:!1,defaultZoomLevel:this.config.options.defaultZoomLevel||0,maxZoomPixelRatio:this.config.options.maxZoomPixelRatio||2,controlsFadeDelay:this.config.options.controlsFadeDelay||250,controlsFadeLength:this.config.options.controlsFadeLength||250,navigatorPosition:this.config.options.navigatorPosition||"BOTTOM_RIGHT",animationTime:this.config.options.animationTime||1.2,visibilityRatio:this.config.options.visibilityRatio||.5,constrainDuringPan:Utils.Bools.getBool(this.config.options.constrainDuringPan,!1),immediateRender:Utils.Bools.getBool(this.config.options.immediateRender,!1),blendTime:this.config.options.blendTime||0,autoHideControls:Utils.Bools.getBool(this.config.options.autoHideControls,!0),prefixUrl:t,gestureSettingsMouse:{clickToZoom:!!this.extension.config.options.clickToZoomEnabled},navImages:{zoomIn:{REST:"zoom_in.png",GROUP:"zoom_in.png",HOVER:"zoom_in.png",DOWN:"zoom_in.png"},zoomOut:{REST:"zoom_out.png",GROUP:"zoom_out.png",HOVER:"zoom_out.png",DOWN:"zoom_out.png"},home:{REST:"home.png",GROUP:"home.png",HOVER:"home.png",DOWN:"home.png"},rotateright:{REST:"rotate_right.png",GROUP:"rotate_right.png",HOVER:"rotate_right.png",DOWN:"rotate_right.png"},rotateleft:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"},next:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"},previous:{REST:"pixel.gif",GROUP:"pixel.gif",HOVER:"pixel.gif",DOWN:"pixel.gif"}}}),this.$zoomInButton=this.$viewer.find('div[title="Zoom in"]'),this.$zoomInButton.attr("tabindex",0),this.$zoomInButton.prop("title",this.content.zoomIn),this.$zoomInButton.addClass("zoomIn viewportNavButton"),this.$zoomOutButton=this.$viewer.find('div[title="Zoom out"]'),this.$zoomOutButton.attr("tabindex",0),this.$zoomOutButton.prop("title",this.content.zoomOut),this.$zoomOutButton.addClass("zoomOut viewportNavButton"),this.$goHomeButton=this.$viewer.find('div[title="Go home"]'),this.$goHomeButton.attr("tabindex",0),this.$goHomeButton.prop("title",this.content.goHome),this.$goHomeButton.addClass("goHome viewportNavButton"),this.$rotateButton=this.$viewer.find('div[title="Rotate right"]'),this.$rotateButton.attr("tabindex",0),this.$rotateButton.prop("title",this.content.rotateRight),this.$rotateButton.addClass("rotate viewportNavButton"),this.$viewportNavButtonsContainer=this.$viewer.find(".openseadragon-container > div:not(.openseadragon-canvas):first"),this.$viewportNavButtons=this.$viewportNavButtonsContainer.find(".viewportNavButton"),this.$canvas=$(this.viewer.canvas),window.DEBUG||this.$canvas.on("contextmenu",function(e){return!1}),this.$navigator=this.$viewer.find(".navigator"),this.setNavigatorVisible(),this.$element.on("mousemove",function(t){e.controlsVisible||(e.controlsVisible=!0,e.viewer.setControlsEnabled(!0))}),this.$element.on("mouseleave",function(t){e.controlsVisible&&(e.controlsVisible=!1,e.viewer.setControlsEnabled(!1))}),this.$element.on("mousemove",function(t){if(!e.$viewer.find(".navigator").ismouseover()){if(!e.controlsVisible)return;e.controlsVisible=!1,e.viewer.setControlsEnabled(!1)}},this.config.options.controlsFadeAfterInactive),this.viewer.addHandler("tile-drawn",function(){e.$spinner.hide()}),this.viewer.addHandler("resize",function(t){$.publish(s.SEADRAGON_RESIZE,[t]),e.viewerResize(t)}),this.viewer.addHandler("animation-start",function(e){$.publish(s.SEADRAGON_ANIMATION_START,[e])}),this.viewer.addHandler("animation",function(e){$.publish(s.SEADRAGON_ANIMATION,[e])}),this.viewer.addHandler("animation-finish",function(t){e.currentBounds=e.getViewportBounds(),e.updateVisibleSearchResultRects(),$.publish(s.SEADRAGON_ANIMATION_FINISH,[t])}),this.viewer.addHandler("rotate",function(e){$.publish(s.SEADRAGON_ROTATION,[e.degrees])}),this.title=this.extension.helper.getLabel(),this.createNavigationButtons(),this.hidePrevButton(),this.hideNextButton(),this.isCreated=!0,this.resize()},t.prototype.createNavigationButtons=function(){var e=this.extension.helper.getViewingDirection();switch(this.$prevButton=$('<div class="paging btn prev" tabindex="0"></div>'),this.$prevButton.prop("title",this.content.previous),this.$nextButton=$('<div class="paging btn next" tabindex="0"></div>'),this.$nextButton.prop("title",this.content.next),this.viewer.addControl(this.$prevButton[0],{anchor:OpenSeadragon.ControlAnchor.TOP_LEFT}),this.viewer.addControl(this.$nextButton[0],{anchor:OpenSeadragon.ControlAnchor.TOP_RIGHT}),e.toString()){case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():this.$prevButton.addClass("vertical"),this.$nextButton.addClass("vertical")}var t=this;this.$prevButton.onPressed(function(i){if(i.preventDefault(),OpenSeadragon.cancelEvent(i),t.prevButtonEnabled)switch(e.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(s.PREV);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(s.NEXT)}}),this.$nextButton.onPressed(function(i){if(i.preventDefault(),OpenSeadragon.cancelEvent(i),t.nextButtonEnabled)switch(e.toString()){case manifesto.ViewingDirection.leftToRight().toString():case manifesto.ViewingDirection.bottomToTop().toString():case manifesto.ViewingDirection.topToBottom().toString():$.publish(s.NEXT);break;case manifesto.ViewingDirection.rightToLeft().toString():$.publish(s.PREV)}})},t.prototype.openMedia=function(e){var t=this;this.$spinner.show(),this.items=[],this.extension.getExternalResources(e).then(function(e){t.viewer.close(),e=t.getPagePositions(e);for(var i=0;i<e.length;i++){var n=e[i];t.viewer.addTiledImage({tileSource:n,x:n.x,y:n.y,width:n.width,success:function(i){t.items.push(i),t.items.length===e.length&&t.openPagesHandler(),t.resize()}})}})},t.prototype.getPagePositions=function(e){var t,i,n,o,s,r;if(e.length>1)if(2===e.length)this.extension.helper.isVerticallyAligned()?(n=e[0],n.y=0,o=e[1],o.y=n.height+this.config.options.pageGap):(t=e[0],t.x=0,i=e[1],i.x=t.width+this.config.options.pageGap);else if(this.extension.helper.isVerticallyAligned())if(this.extension.helper.isTopToBottom())for(var a=0;a<e.length-1;a++)s=e[a],r=e[a+1],r.y=(s.y||0)+s.height;else for(var a=e.length;a>0;a--)s=e[a],r=e[a-1],r.y=(s.y||0)-s.height;else if(this.extension.helper.isLeftToRight())for(var a=0;a<e.length-1;a++)s=e[a],r=e[a+1],r.x=(s.x||0)+s.width;else for(var a=e.length-1;a>0;a--)s=e[a],r=e[a-1],r.x=(s.x||0)-s.width;return e},t.prototype.openPagesHandler=function(){if($.publish(s.SEADRAGON_OPEN),this.extension.helper.isMultiCanvas()&&!this.extension.helper.isContinuous()){this.showPrevButton(),this.showNextButton(),$(".navigator").addClass("extraMargin");var e=this.extension.helper.getViewingDirection();e.toString()===manifesto.ViewingDirection.rightToLeft().toString()?(this.extension.helper.isFirstCanvas()?this.disableNextButton():this.enableNextButton(),this.extension.helper.isLastCanvas()?this.disablePrevButton():this.enablePrevButton()):(this.extension.helper.isFirstCanvas()?this.disablePrevButton():this.enablePrevButton(),this.extension.helper.isLastCanvas()?this.disableNextButton():this.enableNextButton())}this.setNavigatorVisible(),this.overlaySearchResults(),this.updateBounds();var t=this.getInitialSearchResultRect();this.extension.previousSearchResultRect=null,this.extension.currentSearchResultRect=null,t&&this.isZoomToSearchResultEnabled()&&this.zoomToSearchResult(t),this.isFirstLoad=!1},t.prototype.updateBounds=function(){var e=this.extension.getSettings();this.isFirstLoad?(this.initialRotation=this.extension.getParam(a.rotation),this.initialRotation&&this.viewer.viewport.setRotation(parseInt(this.initialRotation)),this.initialBounds=this.extension.getParam(a.xywh),this.initialBounds&&(this.initialBounds=n.fromString(this.initialBounds),this.currentBounds=this.initialBounds,this.fitToBounds(this.currentBounds))):e.preserveViewport?this.fitToBounds(this.currentBounds):this.goHome()},t.prototype.goHome=function(){this.viewer.viewport.goHome(!0)},t.prototype.disablePrevButton=function(){this.prevButtonEnabled=!1,this.$prevButton.addClass("disabled")},t.prototype.enablePrevButton=function(){this.prevButtonEnabled=!0,this.$prevButton.removeClass("disabled")},t.prototype.hidePrevButton=function(){this.disablePrevButton(),this.$prevButton.hide()},t.prototype.showPrevButton=function(){this.enablePrevButton(),this.$prevButton.show()},t.prototype.disableNextButton=function(){this.nextButtonEnabled=!1,this.$nextButton.addClass("disabled")},t.prototype.enableNextButton=function(){this.nextButtonEnabled=!0,this.$nextButton.removeClass("disabled")},t.prototype.hideNextButton=function(){this.disableNextButton(),this.$nextButton.hide()},t.prototype.showNextButton=function(){this.enableNextButton(),this.$nextButton.show()},t.prototype.serialiseBounds=function(e){return e.x+","+e.y+","+e.width+","+e.height},t.prototype.fitToBounds=function(e,t){void 0===t&&(t=!0);var i=new OpenSeadragon.Rect;i.x=Number(e.x),i.y=Number(e.y),i.width=Number(e.w),i.height=Number(e.h),this.viewer.viewport.fitBoundsWithConstraints(i,t)},t.prototype.getCroppedImageBounds=function(){if(!this.viewer||!this.viewer.viewport)return null;var e=this.extension.helper.getCurrentCanvas(),t=this.extension.getCroppedImageDimensions(e,this.viewer),i=new n(t.regionPos.x,t.regionPos.y,t.region.width,t.region.height);return i.toString()},t.prototype.getViewportBounds=function(){if(!this.viewer||!this.viewer.viewport)return null;var e=this.viewer.viewport.getBounds(!0),t=new n(Math.floor(e.x),Math.floor(e.y),Math.floor(e.width),Math.floor(e.height));
8
+ return t},t.prototype.viewerResize=function(e){if(e.viewport){var t=e.viewport.getCenter(!0);t&&setTimeout(function(){e.viewport.panTo(t,!0)},1)}},t.prototype.clearSearchResults=function(){this.$canvas.find(".searchOverlay").hide()},t.prototype.overlaySearchResults=function(){for(var e=this.getSearchResultsForCurrentImages(),t=0;t<e.length;t++)for(var i=e[t],n=this.getSearchOverlayRects(i),o=0;o<n.length;o++){var s=n[o],r=document.createElement("div");r.id="searchResult-"+s.canvasIndex+"-"+s.resultIndex,r.className="searchOverlay",r.title=this.extension.sanitize(s.chars),this.viewer.addOverlay(r,s)}},t.prototype.getSearchResultsForCurrentImages=function(){var e=[],t=this.extension.searchResults;if(!t.length)return e;for(var i=this.extension.getPagedIndices(),n=0;n<i.length;n++)for(var o=i[n],s=0;s<t.length;s++)if(t[s].canvasIndex===o){e.push(t[s]);break}return e},t.prototype.getSearchResultRectsForCurrentImages=function(){var e=this.getSearchResultsForCurrentImages();return e.en().selectMany(function(e){return e.rects}).toArray()},t.prototype.updateVisibleSearchResultRects=function(){for(var e=this.getSearchResultRectsForCurrentImages(),t=0;t<e.length;t++){var i=e[t],n=this.viewer.viewport.getBounds();i.isVisible=Utils.Measurements.Dimensions.hitRect(n.x,n.y,n.width,n.height,i.viewportX,i.viewportY)}},t.prototype.getSearchResultRectIndex=function(e){var t=this.getSearchResultRectsForCurrentImages();return t.indexOf(e)},t.prototype.isZoomToSearchResultEnabled=function(){return Utils.Bools.getBool(this.extension.config.options.zoomToSearchResultEnabled,!0)},t.prototype.nextSearchResult=function(){for(var e,t=this.getSearchResultRectsForCurrentImages(),i=this.getSearchResultRectIndex(this.extension.currentSearchResultRect),n=i+1;n<t.length;n++){var o=t[n];e=o;break}e&&this.isZoomToSearchResultEnabled()?o.canvasIndex>this.extension.helper.canvasIndex?(this.extension.currentSearchResultRect=o,$.publish(s.SEARCH_RESULT_CANVAS_CHANGED,[o])):this.zoomToSearchResult(o):$.publish(s.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE)},t.prototype.prevSearchResult=function(){for(var e,t=this.getSearchResultRectsForCurrentImages(),i=this.getSearchResultRectIndex(this.extension.currentSearchResultRect),n=i-1;n>=0;n--){var o=t[n];e=o;break}e&&this.isZoomToSearchResultEnabled()?o.canvasIndex<this.extension.helper.canvasIndex?(this.extension.currentSearchResultRect=o,$.publish(s.SEARCH_RESULT_CANVAS_CHANGED,[o])):this.zoomToSearchResult(o):$.publish(s.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE)},t.prototype.getSearchResultRectByIndex=function(e){var t=this.getSearchResultRectsForCurrentImages();return t.length?t[e]:null},t.prototype.getInitialSearchResultRect=function(){var e=this,t=this.getSearchResultRectsForCurrentImages();return t.length?this.extension.previousSearchResultRect&&this.extension.previousSearchResultRect.canvasIndex>this.extension.helper.canvasIndex?t.en().where(function(t){return t.canvasIndex===e.extension.helper.canvasIndex}).last():t.en().where(function(t){return t.canvasIndex===e.extension.helper.canvasIndex}).first():null},t.prototype.zoomToSearchResult=function(e){this.extension.previousSearchResultRect=this.extension.currentSearchResultRect||e,this.extension.currentSearchResultRect=e,this.fitToBounds(new n(e.viewportX,e.viewportY,e.width,e.height),!1),this.highlightSearchResultRect(e),$.publish(s.SEARCH_RESULT_RECT_CHANGED)},t.prototype.highlightSearchResultRect=function(e){var t=$("#searchResult-"+e.canvasIndex+"-"+e.index);t.addClass("current"),$(".searchOverlay").not(t).removeClass("current")},t.prototype.getSearchOverlayRects=function(e){var t=[],i=this.extension.resources.en().where(function(t){return t.index===e.canvasIndex}).first(),n=this.extension.resources.indexOf(i),o=(this.extension.resources[n].width,0);n>0&&(o=this.extension.resources[n-1].width);for(var s=0;s<e.rects.length;s++){var r=e.rects[s],a=r.x+o+(n>0?this.config.options.pageGap:0),l=r.y,h=r.width,c=r.height,u=new OpenSeadragon.Rect(a,l,h,c);r.viewportX=a,r.viewportY=l,u.canvasIndex=r.canvasIndex,u.resultIndex=r.index,u.chars=r.chars,t.push(u)}return t},t.prototype.resize=function(){var t=this;if(e.prototype.resize.call(this),this.$viewer.height(this.$content.height()-this.$viewer.verticalMargins()),this.$viewer.width(this.$content.width()-this.$viewer.horizontalMargins()),this.isCreated){this.$title.ellipsisFill(this.extension.sanitize(this.title)),this.$spinner.css("top",this.$content.height()/2-this.$spinner.height()/2),this.$spinner.css("left",this.$content.width()/2-this.$spinner.width()/2);var i=this.extension.helper.getViewingDirection();if(this.extension.helper.isMultiCanvas()&&this.$prevButton&&this.$nextButton){var n=Math.floor(this.$content.width()/2);switch(i.toString()){case manifesto.ViewingDirection.bottomToTop().toString():this.$prevButton.addClass("down"),this.$nextButton.addClass("up"),this.$prevButton.css("left",n-this.$prevButton.outerWidth()/2),this.$prevButton.css("top",this.$content.height()-this.$prevButton.height()),this.$nextButton.css("left",-1*n-this.$nextButton.outerWidth()/2);break;case manifesto.ViewingDirection.topToBottom().toString():this.$prevButton.css("left",n-this.$prevButton.outerWidth()/2),this.$nextButton.css("left",-1*n-this.$nextButton.outerWidth()/2),this.$nextButton.css("top",this.$content.height()-this.$nextButton.height());break;default:this.$prevButton.css("top",(this.$content.height()-this.$prevButton.height())/2),this.$nextButton.css("top",(this.$content.height()-this.$nextButton.height())/2)}}setTimeout(function(){if(t.extension.helper.isContinuous())if(t.extension.helper.isHorizontallyAligned()){var e=t.$viewer.width()-t.$viewer.rightMargin();t.$navigator.width(e)}else t.$navigator.height(t.$viewer.height())},100)}},t.prototype.setFocus=function(){this.$canvas.is(":focus")||this.extension.config.options.allowStealFocus&&this.$canvas.focus()},t.prototype.setNavigatorVisible=function(){var e=Utils.Bools.getBool(this.extension.getSettings().navigatorEnabled,!0)&&this.extension.metric!==r.MOBILE_LANDSCAPE;this.viewer.navigator.setVisible(e),e?this.$navigator.show():this.$navigator.hide()},t}(o);return l});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("settingsDialogue"),e.prototype.create.call(this),this.$navigatorEnabled=$('<div class="setting navigatorEnabled"></div>'),this.$scroll.append(this.$navigatorEnabled),this.$navigatorEnabledCheckbox=$('<input id="navigatorEnabled" type="checkbox" tabindex="0" />'),this.$navigatorEnabled.append(this.$navigatorEnabledCheckbox),this.$navigatorEnabledLabel=$('<label for="navigatorEnabled">'+this.content.navigatorEnabled+"</label>"),this.$navigatorEnabled.append(this.$navigatorEnabledLabel),this.$pagingEnabled=$('<div class="setting pagingEnabled"></div>'),this.$scroll.append(this.$pagingEnabled),this.$pagingEnabledCheckbox=$('<input id="pagingEnabled" type="checkbox" tabindex="0" />'),this.$pagingEnabled.append(this.$pagingEnabledCheckbox),this.$pagingEnabledLabel=$('<label for="pagingEnabled">'+this.content.pagingEnabled+"</label>"),this.$pagingEnabled.append(this.$pagingEnabledLabel),this.$clickToZoomEnabled=$('<div class="setting clickToZoom"></div>'),this.$scroll.append(this.$clickToZoomEnabled),this.$clickToZoomEnabledCheckbox=$('<input id="clickToZoomEnabled" type="checkbox" />'),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledCheckbox),this.$clickToZoomEnabledLabel=$('<label for="clickToZoomEnabled">'+this.content.clickToZoomEnabled+"</label>"),this.$clickToZoomEnabled.append(this.$clickToZoomEnabledLabel),this.$preserveViewport=$('<div class="setting preserveViewport"></div>'),this.$scroll.append(this.$preserveViewport),this.$preserveViewportCheckbox=$('<input id="preserveViewport" type="checkbox" tabindex="0" />'),this.$preserveViewport.append(this.$preserveViewportCheckbox),this.$preserveViewportLabel=$('<label for="preserveViewport">'+this.content.preserveViewport+"</label>"),this.$preserveViewport.append(this.$preserveViewportLabel),this.$navigatorEnabledCheckbox.change(function(){var e={};t.$navigatorEnabledCheckbox.is(":checked")?e.navigatorEnabled=!0:e.navigatorEnabled=!1,t.updateSettings(e)}),this.$clickToZoomEnabledCheckbox.change(function(){var e={};t.$clickToZoomEnabledCheckbox.is(":checked")?e.clickToZoomEnabled=!0:e.clickToZoomEnabled=!1,t.updateSettings(e)}),this.$pagingEnabledCheckbox.change(function(){var e={};t.$pagingEnabledCheckbox.is(":checked")?e.pagingEnabled=!0:e.pagingEnabled=!1,t.updateSettings(e)}),this.$preserveViewportCheckbox.change(function(){var e={};t.$preserveViewportCheckbox.is(":checked")?e.preserveViewport=!0:e.preserveViewport=!1,t.updateSettings(e)})},t.prototype.open=function(){e.prototype.open.call(this);var t=this.getSettings();t.navigatorEnabled?this.$navigatorEnabledCheckbox.prop("checked",!0):this.$navigatorEnabledCheckbox.removeAttr("checked"),t.clickToZoomEnabled?this.$clickToZoomEnabledCheckbox.prop("checked",!0):this.$clickToZoomEnabledCheckbox.removeAttr("checked"),this.extension.helper.isPagingAvailable()?t.pagingEnabled?this.$pagingEnabledCheckbox.prop("checked",!0):this.$pagingEnabledCheckbox.removeAttr("checked"):this.$pagingEnabled.hide(),t.preserveViewport?this.$preserveViewportCheckbox.prop("checked",!0):this.$preserveViewportCheckbox.removeAttr("checked")},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue","./Commands"],function(e,t,i,n){"use strict";var o=function(e){function t(t){var i=e.call(this,t)||this;return $.subscribe(n.SEADRAGON_OPEN,function(){i.update()}),$.subscribe(n.SEADRAGON_ANIMATION_FINISH,function(){i.update()}),i}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this);var t=this.extension.getViewportBounds(),i=this.extension.getViewerRotation();this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight,t,i),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-seadragon-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","./Commands","../../modules/uv-contentleftpanel-module/ContentLeftPanel","./CroppedImageDimensions","./DownloadDialogue","../../modules/uv-dialogues-module/ExternalContentDialogue","../../modules/uv-searchfooterpanel-module/FooterPanel","../../modules/uv-dialogues-module/HelpDialogue","../../modules/uv-shared-module/Metrics","../../modules/uv-osdmobilefooterpanel-module/MobileFooter","./Mode","../../modules/uv-dialogues-module/MoreInfoDialogue","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","../../modules/uv-multiselectdialogue-module/MultiSelectDialogue","./MultiSelectionArgs","../../modules/uv-pagingheaderpanel-module/PagingHeaderPanel","../../Params","../../modules/uv-shared-module/Point","../../modules/uv-seadragoncenterpanel-module/SeadragonCenterPanel","./SettingsDialogue","./ShareDialogue","../../modules/uv-shared-module/Shell"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d,g,f,m,v,b,E,y,x,w,S,C,R){"use strict";var I=Manifold.SearchResult,T=Utils.Measurements.Size,O=function(e){function t(t){var i=e.call(this,t)||this;return i.currentRotation=0,i.isSearching=!1,i.searchResults=[],i}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t);$.subscribe(i.METRIC_CHANGED,function(){if(n.metric===p.MOBILE_LANDSCAPE){var e={};e.pagingEnabled=!1,n.updateSettings(e),$.publish(i.UPDATE_SETTINGS),R.$rightPanel.hide()}else R.$rightPanel.show()}),$.subscribe(s.CLEAR_SEARCH,function(e){n.searchResults=null,$.publish(s.SEARCH_RESULTS_CLEARED),n.triggerSocket(s.CLEAR_SEARCH)}),$.subscribe(i.DOWN_ARROW,function(e){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(i.END,function(e){n.viewPage(n.helper.getLastPageIndex())}),$.subscribe(s.FIRST,function(e){n.triggerSocket(s.FIRST),n.viewPage(n.helper.getFirstPageIndex())}),$.subscribe(s.GALLERY_DECREASE_SIZE,function(e){n.triggerSocket(s.GALLERY_DECREASE_SIZE)}),$.subscribe(s.GALLERY_INCREASE_SIZE,function(e){n.triggerSocket(s.GALLERY_INCREASE_SIZE)}),$.subscribe(s.GALLERY_THUMB_SELECTED,function(e){n.triggerSocket(s.GALLERY_THUMB_SELECTED)}),$.subscribe(i.HOME,function(e){n.viewPage(n.helper.getFirstPageIndex())}),$.subscribe(s.IMAGE_SEARCH,function(e,t){n.triggerSocket(s.IMAGE_SEARCH,t),n.viewPage(t)}),$.subscribe(s.LAST,function(e){n.triggerSocket(s.LAST),n.viewPage(n.helper.getLastPageIndex())}),$.subscribe(i.LEFT_ARROW,function(e){n.useArrowKeysToNavigate()?n.viewPage(n.getPrevPageIndex()):n.centerPanel.setFocus()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_START,function(e){n.metric!==p.MOBILE_LANDSCAPE&&R.$rightPanel.show()}),$.subscribe(i.LEFTPANEL_COLLAPSE_FULL_FINISH,function(e){R.$centerPanel.show(),n.resize()}),$.subscribe(i.LEFTPANEL_EXPAND_FULL_START,function(e){R.$centerPanel.hide(),R.$rightPanel.hide()}),$.subscribe(i.MINUS,function(e){n.centerPanel.setFocus()}),$.subscribe(s.MODE_CHANGED,function(e,t){n.triggerSocket(s.MODE_CHANGED,t),n.mode=new g(t);var o=n.getSettings();$.publish(i.SETTINGS_CHANGED,[o])}),$.subscribe(s.MULTISELECTION_MADE,function(e,t){var i=new b;i.manifestUri=n.helper.iiifResourceUri,i.allCanvases=t.length===n.helper.getCanvases().length,i.canvases=t,i.format=n.config.options.multiSelectionMimeType,i.sequence=n.helper.getCurrentSequence().id,n.triggerSocket(s.MULTISELECTION_MADE,i)}),$.subscribe(s.NEXT,function(e){n.triggerSocket(s.NEXT),n.viewPage(n.getNextPageIndex())}),$.subscribe(s.NEXT_SEARCH_RESULT,function(){n.triggerSocket(s.NEXT_SEARCH_RESULT)}),$.subscribe(s.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE,function(){n.triggerSocket(s.NEXT_IMAGES_SEARCH_RESULT_UNAVAILABLE),n.nextSearchResult()}),$.subscribe(s.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE,function(){n.triggerSocket(s.PREV_IMAGES_SEARCH_RESULT_UNAVAILABLE),n.prevSearchResult()}),$.subscribe(s.OPEN_THUMBS_VIEW,function(e){n.triggerSocket(s.OPEN_THUMBS_VIEW)}),$.subscribe(s.OPEN_TREE_VIEW,function(e){n.triggerSocket(s.OPEN_TREE_VIEW)}),$.subscribe(i.PAGE_DOWN,function(e){n.viewPage(n.getNextPageIndex())}),$.subscribe(s.PAGE_SEARCH,function(e,t){n.triggerSocket(s.PAGE_SEARCH,t),n.viewLabel(t)}),$.subscribe(i.PAGE_UP,function(e){n.viewPage(n.getPrevPageIndex())}),$.subscribe(s.PAGING_TOGGLED,function(e,t){n.triggerSocket(s.PAGING_TOGGLED,t)}),$.subscribe(i.PLUS,function(e){n.centerPanel.setFocus()}),$.subscribe(s.PREV,function(e){n.triggerSocket(s.PREV),n.viewPage(n.getPrevPageIndex())}),$.subscribe(s.PREV_SEARCH_RESULT,function(){n.triggerSocket(s.PREV_SEARCH_RESULT)}),$.subscribe(s.PRINT,function(){n.print()}),$.subscribe(i.RIGHT_ARROW,function(e){n.useArrowKeysToNavigate()?n.viewPage(n.getNextPageIndex()):n.centerPanel.setFocus()}),$.subscribe(s.SEADRAGON_ANIMATION,function(){n.triggerSocket(s.SEADRAGON_ANIMATION)}),$.subscribe(s.SEADRAGON_ANIMATION_FINISH,function(e,t){n.centerPanel&&n.centerPanel.currentBounds&&n.setParam(y.xywh,n.centerPanel.getViewportBounds().toString());var i=n.helper.getCurrentCanvas();n.triggerSocket(s.CURRENT_VIEW_URI,{cropUri:n.getCroppedImageUri(i,n.getViewer()),fullUri:n.getConfinedImageUri(i,i.getWidth())})}),$.subscribe(s.SEADRAGON_ANIMATION_START,function(){n.triggerSocket(s.SEADRAGON_ANIMATION_START)}),$.subscribe(s.SEADRAGON_OPEN,function(){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(s.SEADRAGON_RESIZE,function(){n.triggerSocket(s.SEADRAGON_RESIZE)}),$.subscribe(s.SEADRAGON_ROTATION,function(e,t){n.triggerSocket(s.SEADRAGON_ROTATION),n.currentRotation=t,n.setParam(y.rotation,t)}),$.subscribe(s.SEARCH,function(e,t){n.triggerSocket(s.SEARCH,t),n.searchWithin(t)}),$.subscribe(s.SEARCH_PREVIEW_FINISH,function(e){n.triggerSocket(s.SEARCH_PREVIEW_FINISH)}),$.subscribe(s.SEARCH_PREVIEW_START,function(e){n.triggerSocket(s.SEARCH_PREVIEW_START)}),$.subscribe(s.SEARCH_RESULTS,function(e,t){n.triggerSocket(s.SEARCH_RESULTS,t)}),$.subscribe(s.SEARCH_RESULT_CANVAS_CHANGED,function(e,t){n.viewPage(t.canvasIndex)}),$.subscribe(s.SEARCH_RESULTS_EMPTY,function(e){n.triggerSocket(s.SEARCH_RESULTS_EMPTY)}),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewPage(t.index)}),$.subscribe(s.TREE_NODE_SELECTED,function(e,t){n.triggerSocket(s.TREE_NODE_SELECTED,t.data.path),n.treeNodeSelected(t)}),$.subscribe(i.UP_ARROW,function(e){n.useArrowKeysToNavigate()||n.centerPanel.setFocus()}),$.subscribe(i.UPDATE_SETTINGS,function(e){n.viewPage(n.helper.canvasIndex,!0);var t=n.getSettings();$.publish(i.SETTINGS_CHANGED,[t])}),$.subscribe(s.VIEW_PAGE,function(e,t){n.triggerSocket(s.VIEW_PAGE,t),n.viewPage(t)}),Utils.Async.waitFor(function(){return n.centerPanel&&n.centerPanel.isCreated},function(){n.checkForSearchParam(),n.checkForRotationParam()})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new E(R.$headerPanel):R.$headerPanel.hide(),this.isLeftPanelEnabled()?this.leftPanel=new r(R.$leftPanel):R.$leftPanel.hide(),this.centerPanel=new w(R.$centerPanel),this.isRightPanelEnabled()?this.rightPanel=new m(R.$rightPanel):R.$rightPanel.hide(),this.isFooterPanelEnabled()?(this.footerPanel=new c(R.$footerPanel),this.mobileFooterPanel=new d(R.$mobileFooterPanel)):R.$footerPanel.hide(),this.$helpDialogue=$('<div class="overlay help"></div>'),R.$overlays.append(this.$helpDialogue),this.helpDialogue=new u(this.$helpDialogue),this.$moreInfoDialogue=$('<div class="overlay moreInfo"></div>'),R.$overlays.append(this.$moreInfoDialogue),this.moreInfoDialogue=new f(this.$moreInfoDialogue),this.$multiSelectDialogue=$('<div class="overlay multiSelect"></div>'),R.$overlays.append(this.$multiSelectDialogue),this.multiSelectDialogue=new v(this.$multiSelectDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),R.$overlays.append(this.$shareDialogue),this.shareDialogue=new C(this.$shareDialogue),this.$downloadDialogue=$('<div class="overlay download"></div>'),R.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new l(this.$downloadDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),R.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new S(this.$settingsDialogue),this.$externalContentDialogue=$('<div class="overlay externalContent"></div>'),R.$overlays.append(this.$externalContentDialogue),this.externalContentDialogue=new h(this.$externalContentDialogue),this.isHeaderPanelEnabled()&&this.headerPanel.init(),this.isLeftPanelEnabled()&&this.leftPanel.init(),this.isRightPanelEnabled()&&this.rightPanel.init(),this.isFooterPanelEnabled()&&this.footerPanel.init()},t.prototype.checkForSearchParam=function(){if(this.isDeepLinkingEnabled()){var e=this.getParam(y.highlight);e&&(e.replace(/\+/g," ").replace(/"/g,""),$.publish(s.SEARCH,[e]))}},t.prototype.checkForRotationParam=function(){if(this.isDeepLinkingEnabled()){var e=Number(this.getParam(y.rotation));e&&$.publish(s.SEADRAGON_ROTATION,[e])}},t.prototype.viewPage=function(e,t){if(-1!==e){if(this.helper.isCanvasIndexOutOfRange(e)&&(this.showMessage(this.config.content.canvasIndexOutOfRange),e=0),this.isPagingSettingEnabled()&&!t){var i=this.getPagedIndices(e);if(i.contains(this.helper.canvasIndex))return void this.viewCanvas(e)}this.viewCanvas(e)}},t.prototype.getViewer=function(){return this.centerPanel.viewer},t.prototype.getMode=function(){if(this.mode)return this.mode;switch(this.helper.getManifestType().toString()){case manifesto.ManifestType.monograph().toString():return g.page;case manifesto.ManifestType.manuscript().toString():return g.page;default:return g.image}},t.prototype.getViewportBounds=function(){if(!this.centerPanel)return null;var e=this.centerPanel.getViewportBounds();return e?e.toString():null},t.prototype.getViewerRotation=function(){return this.centerPanel?this.currentRotation:null},t.prototype.viewRange=function(e){var t=this.helper.getRangeByPath(e);if(t){var i=t.getCanvasIds()[0],n=this.helper.getCanvasIndexById(i);this.viewPage(n)}},t.prototype.viewLabel=function(e){if(!e)return this.showMessage(this.config.modules.genericDialogue.content.emptyValue),void $.publish(i.CANVAS_INDEX_CHANGE_FAILED);var t=this.helper.getCanvasIndexByLabel(e);-1!=t?this.viewPage(t):(this.showMessage(this.config.modules.genericDialogue.content.pageNotFound),$.publish(i.CANVAS_INDEX_CHANGE_FAILED))},t.prototype.treeNodeSelected=function(e){var t=e.data;if(t.type)switch(t.type){case manifesto.IIIFResourceType.manifest().toString():this.viewManifest(t);break;case manifesto.IIIFResourceType.collection().toString():this.viewCollection(t);break;default:this.viewRange(t.path)}},t.prototype.clearSearch=function(){this.searchResults=[],this.viewPage(this.helper.canvasIndex)},t.prototype.prevSearchResult=function(){for(var e,t=this.searchResults.length-1;t>=0;t--){var i=this.searchResults[t];if(i.canvasIndex<=this.getPrevPageIndex()){e=i,this.viewPage(e.canvasIndex);break}}},t.prototype.nextSearchResult=function(){for(var e,t=0;t<this.searchResults.length;t++){var i=this.searchResults[t];if(i.canvasIndex>=this.getNextPageIndex()){e=i,this.viewPage(i.canvasIndex);break}}},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getCroppedImageUri(t,this.getViewer()),n.thumb=t.getCanonicalImageUri(this.config.options.bookmarkThumbWidth),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.image().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.print=function(){window.print(),this.triggerSocket(s.PRINT)},t.prototype.getCroppedImageDimensions=function(e,t){if(!t)return null;if(!t.viewport)return null;if(!e.getHeight()||!e.getWidth())return null;var i=t.viewport.getBounds(!0),n=new a,o=Math.floor(i.width),s=Math.floor(i.height),r=Math.floor(i.x),l=Math.floor(i.y);r+o>e.getWidth()?o=e.getWidth()-r:0>r&&(o+=r,r=0),l+s>e.getHeight()?s=e.getHeight()-l:0>l&&(s+=l,l=0),o=Math.min(o,e.getWidth()),s=Math.min(s,e.getHeight());var h=o,c=s;if(e.externalResource.data&&e.externalResource.data.profile&&e.externalResource.data.profile[1]){var u=new T(e.externalResource.data.profile[1].maxWidth,e.externalResource.data.profile[1].maxHeight);if(!_.isUndefined(u.width)&&!_.isUndefined(u.height)){if(o>u.width){var p=u.width;s=Math.round(p*(s/o)),o=p}if(s>u.height){var d=u.height;o=Math.round(o/s*d),s=d}}}return n.region=new T(h,c),n.regionPos=new x(r,l),n.size=new T(o,s),n},t.prototype.getCroppedImageUri=function(e,t){if(!t)return null;if(!t.viewport)return null;var i=this.getCroppedImageDimensions(e,t),n=this.getImageBaseUri(e),o=this.getImageId(e),s=i.regionPos.x+","+i.regionPos.y+","+i.region.width+","+i.region.height,r=i.size.width+","+i.size.height,a=this.getViewerRotation(),l="default";return n+"/"+o+"/"+s+"/"+r+"/"+a+"/"+l+".jpg"},t.prototype.getConfinedImageDimensions=function(e,t){var i=new T(0,0);i.width=t;var n=Math.normalise(t,0,e.getWidth());return i.height=Math.floor(e.getHeight()*n),i},t.prototype.getConfinedImageUri=function(e,t){var i=this.getImageBaseUri(e),n=this.getImageId(e),o="full",s=this.getConfinedImageDimensions(e,t),r=s.width+","+s.height,a=this.getViewerRotation(),l="default";return i+"/"+n+"/"+o+"/"+r+"/"+a+"/"+l+".jpg"},t.prototype.getImageId=function(e){var t=this.getInfoUri(e);return t=t.substr(0,t.lastIndexOf("/")),t.substr(t.lastIndexOf("/")+1)},t.prototype.getImageBaseUri=function(e){var t=this.getInfoUri(e);return t=t.substr(0,t.lastIndexOf("/")),t.substr(0,t.lastIndexOf("/"))},t.prototype.getInfoUri=function(e){var t,i=e.getImages();if(i&&i.length)for(var n=i[0],o=n.getResource(),s=o.getServices(),r=0;r<s.length;r++){var a=s[r],l=a.id;_.endsWith(l,"/")||(l+="/"),manifesto.Utils.isImageProfile(a.getProfile())&&(t=l+"info.json")}return t||(t=window.DEBUG?"/src/extensions/uv-seadragon-extension/lib/imageunavailable.json":"lib/imageunavailable.json"),t},t.prototype.getEmbedScript=function(e,t,i,n,o){var s=this.config.uri||"",r=String.format(e,this.getSerializedLocales(),s,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,n,o,t,i,this.embedScriptUri);return r},t.prototype.getPrevPageIndex=function(e){_.isUndefined(e)&&(e=this.helper.canvasIndex);var t;if(this.isPagingSettingEnabled()){var i=this.getPagedIndices(e);t=this.helper.isRightToLeft()?i.last()-1:i[0]-1}else t=e-1;return t},t.prototype.isSearchWithinEnabled=function(){return Utils.Bools.getBool(this.config.options.searchWithinEnabled,!1)&&this.helper.getSearchWithinService()?!0:!1},t.prototype.isPagingSettingEnabled=function(){return this.helper.isPagingAvailable()?this.getSettings().pagingEnabled:!1},t.prototype.getNextPageIndex=function(e){_.isUndefined(e)&&(e=this.helper.canvasIndex);var t;if(this.isPagingSettingEnabled()){var i=this.getPagedIndices(e);t=this.helper.isRightToLeft()?i[0]+1:i.last()+1}else t=e+1;return t>this.helper.getTotalCanvases()-1?-1:t},t.prototype.getAutoCompleteService=function(){var e=this.helper.getSearchWithinService();return e?e.getService(manifesto.ServiceProfile.autoComplete()):null},t.prototype.getAutoCompleteUri=function(){var e=this.getAutoCompleteService();return e?e.id+"?q={0}":null},t.prototype.getSearchWithinServiceUri=function(){var e=this.helper.getSearchWithinService();if(!e)return null;var t=e.id;return t+="?q={0}"},t.prototype.searchWithin=function(e){var t=this;if(!this.isSearching){this.isSearching=!0,this.searchResults=[];var i=this,n=this.getSearchWithinServiceUri();n=String.format(n,e),this.getSearchResults(n,e,this.searchResults,function(n){t.isSearching=!1,n.length?(t.searchResults=n.sort(function(e,t){return e.canvasIndex-t.canvasIndex}),$.publish(s.SEARCH_RESULTS,[{terms:e,results:n}]),i.viewPage(i.helper.canvasIndex,!0)):i.showMessage(i.config.modules.genericDialogue.content.noMatches,function(){$.publish(s.SEARCH_RESULTS_EMPTY)})})}},t.prototype.getSearchResults=function(e,t,i,n){var o=this;$.getJSON(e,function(e){e.resources&&e.resources.length&&(i=i.concat(o.parseSearchJson(e,i))),e.next?o.getSearchResults(e.next,t,i,n):n(i)})},t.prototype.parseSearchJson=function(e,t){for(var i=[],n=0;n<e.resources.length;n++){var o=e.resources[n],s=this.helper.getCanvasIndexById(o.on.match(/(.*)#/)[1]),r=new I(o,s),a=i.en().where(function(e){return e.canvasIndex===r.canvasIndex}).first();a?a.addRect(o):i.push(r)}return i.sort(function(e,t){return e.canvasIndex-t.canvasIndex}),i},t.prototype.getSearchResultRects=function(){return this.searchResults.en().selectMany(function(e){return e.rects}).toArray()},t.prototype.getCurrentSearchResultRectIndex=function(){var e=this.getSearchResultRects();return e.indexOf(this.currentSearchResultRect)},t.prototype.getTotalSearchResultRects=function(){var e=this.getSearchResultRects();return e.length},t.prototype.isFirstSearchResultRect=function(){return 0===this.getCurrentSearchResultRectIndex()},t.prototype.getLastSearchResultRectIndex=function(){return this.getTotalSearchResultRects()-1},t.prototype.getPagedIndices=function(e){_.isUndefined(e)&&(e=this.helper.canvasIndex);var t=[];return this.helper.isContinuous()?t=$.map(this.helper.getCanvases(),function(e,t){return t}):this.isPagingSettingEnabled()?(t=this.helper.isFirstCanvas(e)||this.helper.isLastCanvas(e)&&this.helper.isTotalCanvasesEven()?[e]:e%2?[e,e+1]:[e-1,e],this.helper.isRightToLeft()&&(t=t.reverse())):t.push(this.helper.canvasIndex),t},t}(n);return O});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/DownloadDialogue",["require","exports","../../modules/uv-dialogues-module/DownloadDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("downloadDialogue"),e.prototype.create.call(this)},t.prototype.open=function(t){e.prototype.open.call(this,t),this.addEntireFileDownloadOptions(),this.updateNoneAvailable(),this.resize()},t.prototype.isDownloadOptionAvailable=function(t){return e.prototype.isDownloadOptionAvailable.call(this,t)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/ShareDialogue",["require","exports","../../modules/uv-dialogues-module/ShareDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("shareDialogue"),e.prototype.create.call(this)},t.prototype.update=function(){e.prototype.update.call(this),this.code=this.extension.getEmbedScript(this.options.embedTemplate,this.currentWidth,this.currentHeight),this.$code.val(this.code)},t.prototype.resize=function(){e.prototype.resize.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/SettingsDialogue",["require","exports","../../modules/uv-dialogues-module/SettingsDialogue"],function(e,t,i){"use strict";var n=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){this.setConfig("settingsDialogue"),e.prototype.create.call(this)},t}(i);return n});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("modules/uv-virtexcenterpanel-module/VirtexCenterPanel",["require","exports","../uv-shared-module/BaseCommands","../uv-shared-module/CenterPanel"],function(e,t,i,n){"use strict";var o=function(e){
9
+ function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(){var t=this;this.setConfig("virtexCenterPanel"),e.prototype.create.call(this);var n=this;$.subscribe(i.OPEN_EXTERNAL_RESOURCE,function(e,t){n.openMedia(t)}),this.$navigation=$('<div class="navigation"></div>'),this.$content.prepend(this.$navigation),this.$zoomInButton=$('<a class="imageBtn zoomIn" title="'+this.content.zoomIn+'"></a>'),this.$navigation.append(this.$zoomInButton),this.$zoomOutButton=$('<a class="imageBtn zoomOut" title="'+this.content.zoomOut+'"></a>'),this.$navigation.append(this.$zoomOutButton),this.$viewport=$('<div class="virtex"></div>'),this.$content.prepend(this.$viewport),this.title=this.extension.helper.getLabel(),this.updateAttribution(),this.$zoomInButton.on("click",function(e){e.preventDefault(),t.viewport.zoomIn()}),this.$zoomOutButton.on("click",function(e){e.preventDefault(),t.viewport.zoomOut()})},t.prototype.openMedia=function(e){var t=this;this.extension.getExternalResources(e).then(function(){t.$viewport.empty();var e=t.extension.helper.getCurrentCanvas();t.viewport=virtex.create({element:"#content .virtex",object:e.id,showStats:t.options.showStats}),t.resize()})},t.prototype.resize=function(){e.prototype.resize.call(this),this.$title.ellipsisFill(this.title),this.$viewport.width(this.$content.width()),this.$viewport.height(this.$content.height())},t}(n);return o});var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();define("extensions/uv-virtex-extension/Extension",["require","exports","../../modules/uv-shared-module/BaseCommands","../../modules/uv-shared-module/BaseExtension","../../modules/uv-shared-module/Bookmark","../../modules/uv-contentleftpanel-module/ContentLeftPanel","./DownloadDialogue","./ShareDialogue","../../modules/uv-shared-module/FooterPanel","../../modules/uv-shared-module/HeaderPanel","../../modules/uv-moreinforightpanel-module/MoreInfoRightPanel","./SettingsDialogue","../../modules/uv-shared-module/Shell","../../modules/uv-virtexcenterpanel-module/VirtexCenterPanel"],function(e,t,i,n,o,s,r,a,l,h,c,u,p,d){"use strict";var g=function(e){function t(t){return e.call(this,t)||this}return __extends(t,e),t.prototype.create=function(t){var n=this;e.prototype.create.call(this,t),$.subscribe(i.THUMB_SELECTED,function(e,t){n.viewCanvas(t)})},t.prototype.createModules=function(){e.prototype.createModules.call(this),this.isHeaderPanelEnabled()?this.headerPanel=new h(p.$headerPanel):p.$headerPanel.hide(),this.isLeftPanelEnabled()&&(this.leftPanel=new s(p.$leftPanel)),this.centerPanel=new d(p.$centerPanel),this.isRightPanelEnabled()&&(this.rightPanel=new c(p.$rightPanel)),this.isFooterPanelEnabled()?this.footerPanel=new l(p.$footerPanel):p.$footerPanel.hide(),this.$downloadDialogue=$('<div class="overlay download"></div>'),p.$overlays.append(this.$downloadDialogue),this.downloadDialogue=new r(this.$downloadDialogue),this.$shareDialogue=$('<div class="overlay share"></div>'),p.$overlays.append(this.$shareDialogue),this.shareDialogue=new a(this.$shareDialogue),this.$settingsDialogue=$('<div class="overlay settings"></div>'),p.$overlays.append(this.$settingsDialogue),this.settingsDialogue=new u(this.$settingsDialogue),this.isLeftPanelEnabled()?this.leftPanel.init():p.$leftPanel.hide(),this.isRightPanelEnabled()?this.rightPanel.init():p.$rightPanel.hide()},t.prototype.isLeftPanelEnabled=function(){return Utils.Bools.getBool(this.config.options.leftPanelEnabled,!0)&&(this.helper.isMultiCanvas()||this.helper.isMultiSequence())},t.prototype.bookmark=function(){e.prototype.bookmark.call(this);var t=this.helper.getCurrentCanvas(),n=new o;n.index=this.helper.canvasIndex,n.label=Manifesto.TranslationCollection.getValue(t.getLabel()),n.path=this.getBookmarkUri(),n.thumb=t.getProperty("thumbnail"),n.title=this.helper.getLabel(),n.trackingLabel=window.trackingLabel,n.type=manifesto.ElementType.physicalobject().toString(),this.triggerSocket(i.BOOKMARK,n)},t.prototype.getEmbedScript=function(e,t,i){var n=this.config.uri||"",o=String.format(e,this.getSerializedLocales(),n,this.helper.iiifResourceUri,this.helper.collectionIndex,this.helper.manifestIndex,this.helper.sequenceIndex,this.helper.canvasIndex,t,i,this.embedScriptUri);return o},t}(n);return g}),"function"==typeof jQuery&&define("jquery",[],function(){return jQuery}),require(["Bootstrapper","extensions/uv-mediaelement-extension/Extension","extensions/uv-pdf-extension/Extension","extensions/uv-seadragon-extension/Extension","extensions/uv-virtex-extension/Extension"],function(e,t,i,n,o){var s={};s[manifesto.ElementType.canvas().toString()]={type:n,name:"uv-seadragon-extension"},s[manifesto.ElementType.movingimage().toString()]={type:t,name:"uv-mediaelement-extension"},s[manifesto.ElementType.physicalobject().toString()]={type:o,name:"uv-virtex-extension"},s[manifesto.ElementType.sound().toString()]={type:t,name:"uv-mediaelement-extension"},s[manifesto.RenderingFormat.pdf().toString()]={type:i,name:"uv-pdf-extension"};var r=new e(s);r.bootstrap()}),define("app",function(){});
@@ -0,0 +1,11 @@
1
+ function Sanitize(){var i,options;for(options=arguments[0]||{},this.config={},this.config.elements=options.elements?options.elements:[],this.config.attributes=options.attributes?options.attributes:{},this.config.attributes[Sanitize.ALL]=this.config.attributes[Sanitize.ALL]?this.config.attributes[Sanitize.ALL]:[],this.config.allow_comments=!!options.allow_comments&&options.allow_comments,this.allowed_elements={},this.config.protocols=options.protocols?options.protocols:{},this.config.add_attributes=options.add_attributes?options.add_attributes:{},this.dom=options.dom?options.dom:document,i=0;i<this.config.elements.length;i++)this.allowed_elements[this.config.elements[i]]=!0;if(this.config.remove_element_contents={},this.config.remove_all_contents=!1,options.remove_contents)if(options.remove_contents instanceof Array)for(i=0;i<options.remove_contents.length;i++)this.config.remove_element_contents[options.remove_contents[i]]=!0;else this.config.remove_all_contents=!0;this.transformers=options.transformers?options.transformers:[]}window.browserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"Other",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"Unknown","Explorer"==this.browser&&"7"==this.version&&navigator.userAgent.match(/Trident/i)&&(this.version=this.searchVersionIE())},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;if(this.versionSearchString=data[i].subString,dataString.indexOf(data[i].subString)!=-1)return data[i].identity}},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index!=-1)return parseFloat(dataString.substring(index+this.versionSearchString.length+1))},searchVersionIE:function(){var ver,ua=navigator.userAgent.toString().toLowerCase(),match=/(trident)(?:.*rv:([\w.]+))?/.exec(ua)||/(msie) ([\w.]+)/.exec(ua)||["",null,-1];try{ver=match[2].split(".")[0]}catch(err){ver="unknown"}return ver},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer"},{string:navigator.userAgent,subString:"Trident",identity:"Explorer"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"Safari",identity:"Safari"},{string:navigator.userAgent,subString:"Opera",identity:"Opera"}]},window.browserDetect.init(),function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|android|ipad|playbook|silk|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))}(navigator.userAgent||navigator.vendor||window.opera),function(factory){factory(jQuery)}(function($){if($.support.cors||!$.ajaxTransport||!window.XDomainRequest)return $;var httpRegEx=/^(https?:)?\/\//i,getOrPostRegEx=/^get|post$/i,sameSchemeRegEx=new RegExp("^(//|"+location.protocol+")","i");return $.ajaxTransport("* text html xml json",function(options,userOptions,jqXHR){if(options.crossDomain&&options.async&&getOrPostRegEx.test(options.type)&&httpRegEx.test(options.url)&&sameSchemeRegEx.test(options.url)){var xdr=null;return{send:function(headers,complete){var postData="",userType=(userOptions.dataType||"").toLowerCase();xdr=new XDomainRequest,/^\d+$/.test(userOptions.timeout)&&(xdr.timeout=userOptions.timeout),xdr.ontimeout=function(){complete(500,"timeout")},xdr.onload=function(){var allResponseHeaders="Content-Length: "+xdr.responseText.length+"\r\nContent-Type: "+xdr.contentType,status={code:200,message:"success"},responses={text:xdr.responseText};try{if("html"===userType||/text\/html/i.test(xdr.contentType))responses.html=xdr.responseText;else if("json"===userType||"text"!==userType&&/\/json/i.test(xdr.contentType))try{responses.json=$.parseJSON(xdr.responseText)}catch(e){status.code=500,status.message="parseerror"}else if("xml"===userType||"text"!==userType&&/\/xml/i.test(xdr.contentType)){var doc=new ActiveXObject("Microsoft.XMLDOM");doc.async=!1;try{doc.loadXML(xdr.responseText)}catch(e){doc=void 0}if(!doc||!doc.documentElement||doc.getElementsByTagName("parsererror").length)throw status.code=500,status.message="parseerror","Invalid XML: "+xdr.responseText;responses.xml=doc}}catch(parseMessage){throw parseMessage}finally{complete(status.code,status.message,responses,allResponseHeaders)}},xdr.onprogress=function(){},xdr.onerror=function(){complete(401,"error",{text:xdr.responseText})},userOptions.data&&(postData="string"===$.type(userOptions.data)?userOptions.data:$.param(userOptions.data)),xdr.open(options.type,options.url),xdr.send(postData)},abort:function(){xdr&&xdr.abort()}}}}),$}),window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function x(a,b){return typeof a===b}function A(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)p[c[d]]=c[d]in k;return p.list&&(p.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),p}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var e,f,h,d=0,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e="text"!==k.type,e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&"textfield"!==h.getComputedStyle(k,null).WebkitAppearance&&0!==k.offsetHeight,g.removeChild(k)):/^(search|tel)$/.test(f)||(e=/^(url|email)$/.test(f)?k.checkValidity&&k.checkValidity()===!1:k.value!=l)),o[a[d]]=!!e;return o}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var s,u,d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",n=({}.toString,{}),o={},p={},q=[],r=q.slice,t={}.hasOwnProperty;u=x(t,"undefined")||x(t.call,"undefined")?function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")}:function(a,b){return t.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if("function"!=typeof c)throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e});for(var B in n)u(n,B)&&(s=B.toLowerCase(),e[s]=n[B](),q.push((e[s]?"":"no-")+s));return e.input||A(),e.addTest=function(a,b){if("object"==typeof a)for(var d in a)u(a,d)&&e.addTest(d,a[d]);else{if(a=a.toLowerCase(),e[a]!==c)return e;b="function"==typeof b?b():b,"undefined"!=typeof f&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},v(""),i=k=null,e._version=d,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var A,B,l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}};B=function(a){function b(a){var e,f,g,a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a};for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var c,b=0;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var m,n,h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var l,o,k=b.createElement("script"),e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var j,e=b.createElement("link"),c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},Modernizr.addTest("cors",!!(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest)),Sanitize.REGEX_PROTOCOL=/^([A-Za-z0-9\+\-\.\&\;\*\s]*?)(?:\:|&*0*58|&*x0*3a)/i,Sanitize.RELATIVE="__RELATIVE__",Sanitize.ALL="__ALL__",Sanitize.prototype.clean_node=function(container){function _array_index(needle,haystack){var i;for(i=0;i<haystack.length;i++)if(haystack[i]==needle)return i;return-1}function _merge_arrays_uniq(){var i,j,result=[],uniq_hash={};for(i=0;i<arguments.length;i++)if(arguments[i]&&arguments[i].length)for(j=0;j<arguments[i].length;j++)uniq_hash[arguments[i][j]]||(uniq_hash[arguments[i][j]]=!0,result.push(arguments[i][j]));return result}function _clean(elem){var clone;switch(elem.nodeType){case 1:_clean_element.call(this,elem);break;case 3:clone=elem.cloneNode(!1),this.current_element.appendChild(clone);break;case 5:clone=elem.cloneNode(!1),this.current_element.appendChild(clone);break;case 8:this.config.allow_comments&&(clone=elem.cloneNode(!1),this.current_element.appendChild(clone));break;default:console&&console.log&&console.log("unknown node type",elem.nodeType)}}function _clean_element(elem){var i,parent_element,name,allowed_attributes,attr,attr_name,attr_node,protocols,del,attr_ok,transform=_transform_element.call(this,elem);if(elem=transform.node,name=elem.nodeName.toLowerCase(),parent_element=this.current_element,this.allowed_elements[name]||transform.whitelist){this.current_element=this.dom.createElement(elem.nodeName),parent_element.appendChild(this.current_element);var attrs=this.config.attributes;for(allowed_attributes=_merge_arrays_uniq(attrs[name],attrs[Sanitize.ALL],transform.attr_whitelist),i=0;i<allowed_attributes.length;i++)attr_name=allowed_attributes[i],attr=elem.attributes[attr_name],attr&&(attr_ok=!0,this.config.protocols[name]&&this.config.protocols[name][attr_name]&&(protocols=this.config.protocols[name][attr_name],del=attr.value.toLowerCase().match(Sanitize.REGEX_PROTOCOL),attr_ok=del?_array_index(del[1],protocols)!=-1:_array_index(Sanitize.RELATIVE,protocols)!=-1),attr_ok&&(attr_node=document.createAttribute(attr_name),attr_node.value=attr.value,this.current_element.setAttributeNode(attr_node)));if(this.config.add_attributes[name])for(attr_name in this.config.add_attributes[name])attr_node=document.createAttribute(attr_name),attr_node.value=this.config.add_attributes[name][attr_name],this.current_element.setAttributeNode(attr_node)}else if(_array_index(elem,this.whitelist_nodes)!=-1){for(this.current_element=elem.cloneNode(!0);this.current_element.childNodes.length>0;)this.current_element.removeChild(this.current_element.firstChild);parent_element.appendChild(this.current_element)}if(!this.config.remove_all_contents&&!this.config.remove_element_contents[name])for(i=0;i<elem.childNodes.length;i++)_clean.call(this,elem.childNodes[i]);this.current_element.normalize&&this.current_element.normalize(),this.current_element=parent_element}function _transform_element(node){var i,j,transform,output={attr_whitelist:[],node:node,whitelist:!1};for(i=0;i<this.transformers.length;i++)if(transform=this.transformers[i]({allowed_elements:this.allowed_elements,config:this.config,node:node,node_name:node.nodeName.toLowerCase(),whitelist_nodes:this.whitelist_nodes,dom:this.dom}),null!=transform){if("object"!=typeof transform)throw new Error("transformer output must be an object or null");if(transform.whitelist_nodes&&transform.whitelist_nodes instanceof Array)for(j=0;j<transform.whitelist_nodes.length;j++)_array_index(transform.whitelist_nodes[j],this.whitelist_nodes)==-1&&this.whitelist_nodes.push(transform.whitelist_nodes[j]);output.whitelist=!!transform.whitelist,transform.attr_whitelist&&(output.attr_whitelist=_merge_arrays_uniq(output.attr_whitelist,transform.attr_whitelist)),output.node=transform.node?transform.node:output.node}return output}var fragment=this.dom.createDocumentFragment();for(this.current_element=fragment,this.whitelist_nodes=[],i=0;i<container.childNodes.length;i++)_clean.call(this,container.childNodes[i]);return fragment.normalize&&fragment.normalize(),fragment},"function"==typeof define&&define("sanitize",[],function(){return Sanitize}),function(window,doc,undef){yepnope.injectCss=function(href,cb,attrs,timeout,err,internal){function poll(){try{for(var sheets=document.styleSheets,j=0,k=sheets.length;j<k;j++)if(sheets[j].ownerNode.id==id&&sheets[j].cssRules.length)return onload();throw new Error}catch(e){setTimeout(poll,20)}}var ref,done,i,link=document.createElement("link"),onload=function(){done||(done=1,link.removeAttribute("id"),setTimeout(cb,0))},id="yn"+ +new Date;cb=internal?yepnope.executeStack:cb||function(){},timeout=timeout||yepnope.errorTimeout,link.href=href,link.rel="stylesheet",link.type="text/css",link.id=id;for(i in attrs)link.setAttribute(i,attrs[i]);err||(ref=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0],ref.parentNode.insertBefore(link,ref),link.onload=onload,poll())}}(this,this.document),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.TinyEmitter=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){function E(){}E.prototype={on:function(name,callback,ctx){var e=this.e||(this.e={});return(e[name]||(e[name]=[])).push({fn:callback,ctx:ctx}),this},once:function(name,callback,ctx){function listener(){self.off(name,listener),callback.apply(ctx,arguments)}var self=this;return listener._=callback,this.on(name,listener,ctx)},emit:function(name){var data=[].slice.call(arguments,1),evtArr=((this.e||(this.e={}))[name]||[]).slice(),i=0,len=evtArr.length;for(i;i<len;i++)evtArr[i].fn.apply(evtArr[i].ctx,data);return this},off:function(name,callback){var e=this.e||(this.e={}),evts=e[name],liveEvents=[];if(evts&&callback)for(var i=0,len=evts.length;i<len;i++)evts[i].fn!==callback&&evts[i].fn._!==callback&&liveEvents.push(evts[i]);return liveEvents.length?e[name]=liveEvents:delete e[name],this}},module.exports=E},{}]},{},[1])(1)}),!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.baseComponent=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){var _Components;!function(_Components){function applyMixins(derivedCtor,baseCtors){baseCtors.forEach(function(baseCtor){Object.getOwnPropertyNames(baseCtor.prototype).forEach(function(name){derivedCtor.prototype[name]=baseCtor.prototype[name]})})}var BaseComponent=function(){function BaseComponent(options){this.options=options,this.options.data=$.extend(this.data(),options.data)}return BaseComponent.prototype._init=function(){return this._$element=$(this.options.target),this._$element.length?(this._$element.empty(),!0):(console.warn("element not found"),!1)},BaseComponent.prototype.data=function(){return{}},BaseComponent.prototype.fire=function(event){for(var args=[],_i=1;_i<arguments.length;_i++)args[_i-1]=arguments[_i];return this.emit(event,args)},BaseComponent.prototype._resize=function(){},BaseComponent.prototype.set=function(data){},BaseComponent}();_Components.BaseComponent=BaseComponent,_Components.applyMixins=applyMixins,applyMixins(BaseComponent,[TinyEmitter])}(_Components||(_Components={})),function(g){g._Components||(g._Components=_Components)}(global)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}),function($){function documentHandler(){var $current=this===document?$(this):$(this).contents();$current.mousemove(function(e){jQuery.mlp={x:e.pageX,y:e.pageY}}),$current.find("iframe").load(documentHandler)}$.fn.checkboxButton=function(onClick){return this.each(function(){var $this=$(this);$this.on("click",function(e){var tagName=e.target.tagName,$checkbox=$(this).find(":checkbox");"INPUT"!==tagName&&(e.preventDefault(),$checkbox.prop("checked",!$checkbox.prop("checked")));var checked=$checkbox.is(":checked");onClick.call(this,checked)})})},$.fn.disable=function(){return this.each(function(){var $this=$(this);$this.addClass("disabled"),$this.data("tabindex",$this.attr("tabindex")),$this.removeAttr("tabindex")})},$.fn.ellipsis=function(chars){return this.each(function(){var $self=$(this),text=$self.text();if(text.length>chars){var trimmedText=text.substr(0,chars);trimmedText=trimmedText.substr(0,Math.min(trimmedText.length,trimmedText.lastIndexOf(" "))),$self.empty().html(trimmedText+"&hellip;")}})},$.fn.ellipsisFill=function(text){var textPassed=!0;return text||(textPassed=!1),this.each(function(){var $self=$(this);if(textPassed||(text=$self.text()),$self.empty(),$self.spanElem=$('<span title="'+text+'"></span>'),$self.append($self.spanElem),$self.css("overflow","hidden"),$self.spanElem.css("white-space","nowrap"),$self.spanElem.html(text),$self.spanElem.width()>$self.width())for(var lastText;$self.spanElem.width()>$self.width();){var t=$self.spanElem.html();if(t=t.substring(0,t.lastIndexOf(" "))+"&hellip;",t===lastText)break;$self.spanElem.html(t),lastText=t}})},$.fn.ellipsisFixed=function(chars,buttonText){return this.each(function(){var $self=$(this),text=$self.text();$self.empty();var $span=$("<span></span>"),$ellipsis=$('<a href="#" title="more" class="ellipsis"></a>');if(buttonText?$ellipsis.html(buttonText):$ellipsis.html("&hellip;"),$ellipsis.click(function(e){e.preventDefault();var $this=$(this);$span.html(text),$this.remove()}),text.length>chars){var trimmedText=text.substr(0,chars);trimmedText=trimmedText.substr(0,Math.min(trimmedText.length,trimmedText.lastIndexOf(" "))),$span.html(trimmedText+"&nbsp;"),$span.append($ellipsis)}else $span.html(text);$self.append($span)})},$.fn.ellipsisHtmlFixed=function(chars,cb){return this.each(function(){var $self=$(this),expandedText=$self.html(),$trunc=$("<span></span>");if($trunc.html($self.html().replace(/\s[\s]*/g," ").trim()),!($trunc.text().trim().length<=chars)){for(;$trunc.text().trim().length>chars;)$trunc.removeLastWord(chars);var collapsedText=$trunc.html(),expanded=!1;$self.toggle=function(){$self.empty();var $toggleButton=$('<a href="#" class="toggle"></a>');expanded?($self.html(expandedText+" "),$toggleButton.text("less"),$toggleButton.toggleClass("less","more")):($self.html(collapsedText+"&hellip; "),$toggleButton.text("more"),$toggleButton.toggleClass("more","less")),$toggleButton.one("click",function(e){e.preventDefault(),$self.toggle()}),expanded=!expanded,$self.append($toggleButton),cb&&cb()},$self.toggle()}})},$.fn.enable=function(){return this.each(function(){var $this=$(this);$this.removeClass("disabled"),$this.attr("tabindex",$this.data("tabindex"))})},$.fn.equaliseHeight=function(reset,average){var maxHeight=-1,minHeight=Number.MAX_VALUE,heights=[];reset&&this.each(function(){$(this).height("auto")}),this.each(function(){var currentHeight=$(this).height();heights.push(currentHeight),maxHeight=maxHeight>currentHeight?maxHeight:currentHeight,minHeight=minHeight<currentHeight?minHeight:currentHeight});var finalHeight=maxHeight;return average&&(finalHeight=Math.median(heights)),this.each(function(){$(this).height(finalHeight)}),this},$.fn.getVisibleElementWithGreatestTabIndex=function(){var $self=$(this),maxTabIndex=0,$elementWithGreatestTabIndex=null;return $self.find("*:visible[tabindex]").each(function(idx,el){var $el=$(el),tabIndex=parseInt($el.attr("tabindex"));tabIndex>maxTabIndex&&(maxTabIndex=tabIndex,$elementWithGreatestTabIndex=$el)}),$elementWithGreatestTabIndex},$.fn.horizontalMargins=function(){var $self=$(this);return parseInt($self.css("marginLeft"))+parseInt($self.css("marginRight"))},$.fn.leftMargin=function(){var $self=$(this);return parseInt($self.css("marginLeft"))},$.fn.rightMargin=function(){var $self=$(this);return parseInt($self.css("marginRight"))},$.fn.horizontalPadding=function(){var $self=$(this);return parseInt($self.css("paddingLeft"))+parseInt($self.css("paddingRight"))},$.fn.leftPadding=function(){var $self=$(this);return parseInt($self.css("paddingLeft"))},$.fn.rightPadding=function(){var $self=$(this);return parseInt($self.css("paddingRight"))},$.mlp={x:0,y:0},$(documentHandler),$.fn.ismouseover=function(overThis){var result=!1;return this.eq(0).each(function(){var $current=$(this).is("iframe")?$(this).contents().find("body"):$(this),offset=$current.offset();result=offset.left<=$.mlp.x&&offset.left+$current.outerWidth()>$.mlp.x&&offset.top<=$.mlp.y&&offset.top+$current.outerHeight()>$.mlp.y}),result};var timer,on=$.fn.on;$.fn.on=function(){var args=Array.apply(null,arguments),last=args[args.length-1];if(isNaN(last)||1===last&&args.pop())return on.apply(this,args);var delay=args.pop(),fn=args.pop();return args.push(function(){var self=this,params=arguments;clearTimeout(timer),timer=setTimeout(function(){fn.apply(self,params)},delay)}),on.apply(this,args)},$.fn.onEnter=function(cb){return this.each(function(){var $this=$(this);$this.on("keyup",function(e){13===e.keyCode&&(e.preventDefault(),cb())})})},$.fn.onPressed=function(cb){return this.each(function(){var $this=$(this);$this.on("touchstart click",function(e){e.preventDefault(),cb(e)}),$this.on("keyup",function(e){13===e.keyCode&&(e.preventDefault(),cb(e))})})},$.fn.removeLastWord=function(chars,depth){return"undefined"==typeof chars&&(chars=8),"undefined"==typeof depth&&(depth=0),this.each(function(){var $self=$(this);if($self.contents().length>0){var $lastElement=$self.contents().last();if(3===$lastElement[0].nodeType){var words=$lastElement.text().trim().split(" ");if(words.length>1)return words.splice(words.length-1,1),void($lastElement[0].data=words.join(" "));if("undefined"!=typeof chars&&1===words.length&&words[0].length>chars)return void($lastElement[0].data=words.join(" ").substring(0,chars))}$lastElement.removeLastWord(chars,depth+1)}else depth>0&&$self.remove()})},$.fn.swapClass=function(removeClass,addClass){return this.each(function(){$(this).removeClass(removeClass).addClass(addClass)})},$.fn.targetBlank=function(){return this.each(function(){$(this).find("a").prop("target","_blank")})},$.fn.toggleClass=function(class1,class2){return this.each(function(){var $this=$(this);$this.hasClass(class1)?$(this).removeClass(class1).addClass(class2):$(this).removeClass(class2).addClass(class1)})},$.fn.toggleExpandText=function(chars,lessText,moreText,cb){return this.each(function(){var $self=$(this),expandedText=$self.html();if(!(chars>expandedText.length)){var expanded=!1,collapsedText=expandedText.substr(0,chars);collapsedText=collapsedText.substr(0,Math.min(collapsedText.length,collapsedText.lastIndexOf(" "))),$self.toggle=function(){$self.empty();var $toggleButton=$('<a href="#" class="toggle"></a>');expanded?($self.html(expandedText+"&nbsp;"),$toggleButton.text(lessText),$toggleButton.toggleClass("less","more")):($self.html(collapsedText+"&nbsp;"),$toggleButton.text(moreText),$toggleButton.toggleClass("more","less")),$toggleButton.one("click",function(e){e.preventDefault(),$self.toggle()}),expanded=!expanded,$self.append($toggleButton),cb&&cb()},$self.toggle()}})},$.fn.toggleExpandTextByLines=function(lines,lessText,moreText,cb){return this.each(function(){for(var $self=$(this),expandedText=$self.html(),$buttonPad=$('<span>&hellip; <a href="#" class="toggle more">morepad</a></span>'),stringsByLine=[expandedText],lastHeight=$self.height();$self.text().length>0;){$self.removeLastWord();var html=$self.html();$self.append($buttonPad),lastHeight>$self.height()&&(stringsByLine.unshift(html),lastHeight=$self.height()),$buttonPad.remove()}if(stringsByLine.length<=lines)return void $self.html(expandedText);var collapsedText=stringsByLine[lines-1],expanded=!1;$self.toggle=function(){$self.empty();var $toggleButton=$('<a href="#" class="toggle"></a>');expanded?($self.html(expandedText+" "),$toggleButton.text(lessText),$toggleButton.toggleClass("less","more")):($self.html(collapsedText+"&hellip; "),$toggleButton.text(moreText),$toggleButton.toggleClass("more","less")),$toggleButton.one("click",function(e){e.preventDefault(),$self.toggle()}),expanded=!expanded,$self.append($toggleButton),cb&&cb()},$self.toggle()})},$.fn.toggleText=function(text1,text2){return this.each(function(){var $this=$(this);$this.text()===text1?$(this).text(text2):$(this).text(text1)})},$.fn.updateAttr=function(attrName,oldVal,newVal){return this.each(function(){var $this=$(this),attr=$this.attr(attrName);attr&&0===attr.indexOf(oldVal)&&(attr=attr.replace(oldVal,newVal),$this.attr(attrName,attr))})},$.fn.verticalMargins=function(){var $self=$(this);return parseInt($self.css("marginTop"))+parseInt($self.css("marginBottom"))},$.fn.verticalPadding=function(){var $self=$(this);return parseInt($self.css("paddingTop"))+parseInt($self.css("paddingBottom"))}}(jQuery),!function(a){var b=null;a.initPubSub=function(){b=a({})},a.subscribe=function(){b||a.initPubSub(),b.on.apply(b,arguments)},a.unsubscribe=function(){b||a.initPubSub(),b.off.apply(b,arguments)},a.disposePubSub=function(){b=null},a.publish=function(){b||a.initPubSub(),b.trigger.apply(b,arguments)}}(jQuery);var KeyCodes;!function(KeyCodes){var KeyDown;!function(KeyDown){KeyDown.Backspace=8,KeyDown.Tab=9,KeyDown.Enter=13,KeyDown.Shift=16,KeyDown.Ctrl=17,KeyDown.Alt=18,KeyDown.PauseBreak=19,KeyDown.CapsLock=20,KeyDown.Escape=27,KeyDown.Spacebar=32,KeyDown.PageUp=33,KeyDown.PageDown=34,KeyDown.End=35,KeyDown.Home=36,KeyDown.LeftArrow=37,KeyDown.UpArrow=38,KeyDown.RightArrow=39,KeyDown.DownArrow=40,KeyDown.PrintScrn=44,KeyDown.Insert=45,KeyDown.Delete=46,KeyDown.Zero=48,KeyDown.One=49,KeyDown.Two=50,KeyDown.Three=51,KeyDown.Four=52,KeyDown.Five=53,KeyDown.Six=54,KeyDown.Seven=55,KeyDown.Eight=56,KeyDown.Nine=57,KeyDown.a=65,KeyDown.b=66,KeyDown.c=67,KeyDown.d=68,KeyDown.e=69,KeyDown.f=70,KeyDown.g=71,KeyDown.h=72,KeyDown.i=73,KeyDown.j=74,KeyDown.k=75,KeyDown.l=76,KeyDown.m=77,KeyDown.n=78,KeyDown.o=79,KeyDown.p=80,KeyDown.q=81,KeyDown.r=82,KeyDown.s=83,KeyDown.t=84,KeyDown.u=85,KeyDown.v=86,KeyDown.w=87,KeyDown.x=88,KeyDown.y=89,KeyDown.z=90,KeyDown.LeftWindowKey=91,KeyDown.RightWindowKey=92,KeyDown.SelectKey=93,KeyDown.Numpad0=96,KeyDown.Numpad1=97,KeyDown.Numpad2=98,KeyDown.Numpad3=99,KeyDown.Numpad4=100,KeyDown.Numpad5=101,KeyDown.Numpad6=102,KeyDown.Numpad7=103,KeyDown.Numpad8=104,KeyDown.Numpad9=105,KeyDown.Multiply=106,KeyDown.NumpadPlus=107,KeyDown.NumpadMinus=109,KeyDown.DecimalPoint=110,KeyDown.Divide=111,KeyDown.F1=112,KeyDown.F2=113,KeyDown.F3=114,KeyDown.F4=115,KeyDown.F5=116,
2
+ KeyDown.F6=117,KeyDown.F7=118,KeyDown.F8=119,KeyDown.F9=120,KeyDown.F10=121,KeyDown.F11=122,KeyDown.F12=123,KeyDown.NumLock=144,KeyDown.ScrollLock=145,KeyDown.Semicolon=186,KeyDown.Equals=187,KeyDown.Comma=188,KeyDown.LessThan=188,KeyDown.Dash=189,KeyDown.Period=190,KeyDown.GreaterThan=190,KeyDown.ForwardSlash=191,KeyDown.QuestionMark=191,KeyDown.GraveAccent=192,KeyDown.Tilde=192,KeyDown.OpenCurlyBracket=219,KeyDown.OpenSquareBracket=219,KeyDown.BackSlash=220,KeyDown.VerticalPipe=220,KeyDown.CloseCurlyBracket=221,KeyDown.CloseSquareBracket=221,KeyDown.Quote=222,KeyDown.CommandFF=224}(KeyDown=KeyCodes.KeyDown||(KeyCodes.KeyDown={}))}(KeyCodes||(KeyCodes={}));var KeyCodes;!function(KeyCodes){var KeyPress;!function(KeyPress){KeyPress.Backspace=8,KeyPress.Enter=13,KeyPress.Spacebar=32,KeyPress.Hash=35,KeyPress.GraveAccent=39,KeyPress.ForwardSlash=32,KeyPress.DoubleQuote=34,KeyPress.Asterisk=42,KeyPress.Plus=43,KeyPress.Comma=44,KeyPress.Minus=45,KeyPress.Period=46,KeyPress.ForwardSlash=47,KeyPress.Zero=48,KeyPress.One=49,KeyPress.Two=50,KeyPress.Three=51,KeyPress.Four=52,KeyPress.Five=53,KeyPress.Six=54,KeyPress.Seven=55,KeyPress.Eight=56,KeyPress.Nine=57,KeyPress.Colon=58,KeyPress.Semicolon=59,KeyPress.LessThan=60,KeyPress.Equals=61,KeyPress.GreaterThan=62,KeyPress.QuestionMark=63,KeyPress.At=64,KeyPress.OpenSquareBracket=91,KeyPress.BackSlash=92,KeyPress.CloseSquareBracket=93,KeyPress.a=97,KeyPress.b=98,KeyPress.c=99,KeyPress.d=100,KeyPress.e=101,KeyPress.f=102,KeyPress.g=103,KeyPress.h=104,KeyPress.i=105,KeyPress.j=106,KeyPress.k=107,KeyPress.l=108,KeyPress.m=109,KeyPress.n=110,KeyPress.o=111,KeyPress.p=112,KeyPress.q=113,KeyPress.r=114,KeyPress.s=115,KeyPress.t=116,KeyPress.u=117,KeyPress.v=118,KeyPress.w=119,KeyPress.x=120,KeyPress.y=121,KeyPress.z=122,KeyPress.OpenCurlyBracket=123,KeyPress.VerticalPipe=124,KeyPress.CloseCurlyBracket=125,KeyPress.Tilde=126}(KeyPress=KeyCodes.KeyPress||(KeyCodes.KeyPress={}))}(KeyCodes||(KeyCodes={}));var exjs;!function(r){r.version="0.4.0"}(exjs||(exjs={}));var exjs;!function(r){Array.isArray||(Array.isArray=function(r){return"[object Array]"===Object.prototype.toString.call(r)})}(exjs||(exjs={}));var exjs;!function(r){var e=function(){function r(){}return r.prototype.getEnumerator=function(){return{moveNext:function(){return!1},current:void 0}},r.prototype.aggregate=function(r,e){for(var t=r,n=this.getEnumerator();n.moveNext();)t=e(t,n.current);return t},r.prototype.all=function(r){if(r)for(var e=this.getEnumerator(),t=0;e.moveNext();){if(!r(e.current,t))return!1;t++}return!0},r.prototype.any=function(r){for(var e=this.getEnumerator(),t=0;e.moveNext();){if(!r)return!0;if(r(e.current,t))return!0;t++}return!1},r.prototype.append=function(){for(var r=[],e=0;e<arguments.length;e++)r[e-0]=arguments[e];throw new Error("Not implemented")},r.prototype.apply=function(r){throw new Error("Not implemented")},r.prototype.at=function(r){for(var e=this.getEnumerator(),t=0;e.moveNext();){if(t===r)return e.current;t++}},r.prototype.average=function(r){var e=0,t=0;r=r||function(r){if("number"!=typeof r)throw new Error("Object is not a number.");return r};for(var n=this.getEnumerator();n.moveNext();)t+=r(n.current),e++;return 0===e?0:t/e},r.prototype.concat=function(r){throw new Error("Not implemented")},r.prototype.count=function(r){for(var e=0,t=this.getEnumerator();t.moveNext();)(!r||r(t.current))&&e++;return e},r.prototype.difference=function(r,e){return e=e||function(r,e){return r===e},r instanceof Array&&(r=r.en()),{intersection:this.intersect(r,e).toArray().en(),aNotB:this.except(r,e).toArray().en(),bNotA:r.except(this,e).toArray().en()}},r.prototype.distinct=function(r){throw new Error("Not implemented")},r.prototype.except=function(r,e){throw new Error("Not implemented")},r.prototype.first=function(r){for(var e=this.getEnumerator();e.moveNext();)if(!r||r(e.current))return e.current},r.prototype.firstIndex=function(r){for(var e=this.getEnumerator(),t=0;e.moveNext();t++)if(!r||r(e.current))return t;return-1},r.prototype.forEach=function(r){for(var e=this.getEnumerator();e.moveNext();)r(e.current)},r.prototype.groupBy=function(r,e){throw new Error("Not implemented")},r.prototype.intersect=function(r,e){throw new Error("Not implemented")},r.prototype.join=function(r,e,t,n,o){throw new Error("Not implemented")},r.prototype.last=function(r){for(var e,t=this.getEnumerator();t.moveNext();)(!r||r(t.current))&&(e=t.current);return e},r.prototype.lastIndex=function(r){for(var e=-1,t=this.getEnumerator(),n=0;t.moveNext();n++)(!r||r(t.current))&&(e=n);return e},r.prototype.max=function(r){var e=this.getEnumerator();if(!e.moveNext())return 0;r=r||function(r){if("number"!=typeof r)throw new Error("Object is not a number.");return r};for(var t=r(e.current);e.moveNext();)t=Math.max(t,r(e.current));return t},r.prototype.min=function(r){var e=this.getEnumerator();if(!e.moveNext())return 0;r=r||function(r){if("number"!=typeof r)throw new Error("Object is not a number.");return r};for(var t=r(e.current);e.moveNext();)t=Math.min(t,r(e.current));return t},r.prototype.orderBy=function(r,e){throw new Error("Not implemented")},r.prototype.orderByDescending=function(r,e){throw new Error("Not implemented")},r.prototype.prepend=function(){for(var r=[],e=0;e<arguments.length;e++)r[e-0]=arguments[e];throw new Error("Not implemented")},r.prototype.reverse=function(){throw new Error("Not implemented")},r.prototype.select=function(r){throw new Error("Not implemented")},r.prototype.selectMany=function(r){throw new Error("Not implemented")},r.prototype.skip=function(r){throw new Error("Not implemented")},r.prototype.skipWhile=function(r){throw new Error("Not implemented")},r.prototype.standardDeviation=function(r){var e=this.average(r),t=0,n=0;r=r||function(r){if("number"!=typeof r)throw new Error("Object is not a number.");return r};for(var o=this.getEnumerator();o.moveNext();){var u=r(o.current)-e;t+=u*u,n++}return Math.sqrt(t/n)},r.prototype.sum=function(r){var e=0;r=r||function(r){if("number"!=typeof r)throw new Error("Object is not a number.");return r};for(var t=this.getEnumerator();t.moveNext();)e+=r(t.current);return e},r.prototype.take=function(r){throw new Error("Not implemented")},r.prototype.takeWhile=function(r){throw new Error("Not implemented")},r.prototype.traverse=function(r){throw new Error("Not implemented")},r.prototype.traverseUnique=function(r,e){throw new Error("Not implemented")},r.prototype.toArray=function(){for(var r=[],e=this.getEnumerator();e.moveNext();)r.push(e.current);return r},r.prototype.toMap=function(r,e){throw new Error("Not implemented")},r.prototype.toList=function(){throw new Error("Not implemented")},r.prototype.union=function(r,e){throw new Error("Not implemented")},r.prototype.where=function(r){throw new Error("Not implemented")},r.prototype.zip=function(r,e){throw new Error("Not implemented")},r}();r.Enumerable=e}(exjs||(exjs={}));var Symbol,exjs;!function(r){function e(r){var e;return{next:function(){var t={done:!0,value:void 0};return r&&(e=e||r.getEnumerator())?(t.done=!e.moveNext(),t.value=e.current,t):t}}}Symbol&&Symbol.iterator&&(r.Enumerable.prototype[Symbol.iterator]=function(){return e(this)})}(exjs||(exjs={}));var exjs;!function(r){var e=function(){function e(r){this.size=0,this._keys=[],this._values=[];var e;if(r instanceof Array?e=r.en():r&&r.getEnumerator instanceof Function&&(e=r),e)for(var t=e.getEnumerator();t&&t.moveNext();)this.set(t.current[0],t.current[1])}return e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this.size=0},e.prototype["delete"]=function(r){var e=this._keys.indexOf(r);return e>-1&&(this._keys.splice(e,1),this._values.splice(e,1),this.size--,!0)},e.prototype.entries=function(){var e=this;return r.range(0,this.size).select(function(r){return[e._keys[r],e._values[r]]})},e.prototype.forEach=function(r,e){null==e&&(e=this);for(var t=0,n=this._keys,o=this._values,u=n.length;u>t;t++)r.call(e,o[t],n[t],this)},e.prototype.get=function(r){var e=this._keys.indexOf(r);return this._values[e]},e.prototype.has=function(r){return this._keys.indexOf(r)>-1},e.prototype.keys=function(){return this._keys.en()},e.prototype.set=function(r,e){var t=this._keys.indexOf(r);t>-1?this._values[t]=e:(this._keys.push(r),this._values.push(e),this.size++)},e.prototype.values=function(){return this._values.en()},e}();r.Map3=e,r.Enumerable.prototype.toMap=function(r,t){for(var n=new e,o=this.getEnumerator();o.moveNext();)n.set(r(o.current),t(o.current));return n},r.List&&(r.List.prototype.toMap=r.Enumerable.prototype.toMap)}(exjs||(exjs={})),function(r){r.Map||(r.Map=exjs.Map3)}("undefined"==typeof window?global:window);var exjs;!function(r){function e(e){var t=new r.Enumerable;return t.getEnumerator=function(){var r={current:void 0,moveNext:function(){return e(r)}};return r},t}r.anonymous=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(2>o){if(t=t||r.getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||e.en().getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.append=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o-0]=arguments[o];var u=new r.Enumerable;return u.getEnumerator=function(){return e(t,n)},u},r.List&&(r.List.prototype.append=r.Enumerable.prototype.append)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),!!t.moveNext()&&(e(o.current=t.current,n),n++,!0)}};return o}r.Enumerable.prototype.apply=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.apply=r.Enumerable.prototype.apply)}(exjs||(exjs={}));var __extends=this&&this.__extends||function(r,e){function t(){this.constructor=r}for(var n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t)},exjs;!function(r){function e(r){var e=r.length,t={moveNext:void 0,current:void 0},n=-1;return t.moveNext=function(){return n++,n>=e?(t.current=void 0,!1):(t.current=r[n],!0)},t}function t(){return this&&Array.isArray(this)?new n(this):new r.Enumerable}var n=function(r){function t(t){r.call(this),this.getEnumerator=function(){return e(t)},this.toArray=function(){return t.slice(0)}}return __extends(t,r),t}(r.Enumerable);try{Object.defineProperty(Array.prototype,"en",{value:t,enumerable:!1,writable:!1,configurable:!1})}catch(o){Array.prototype.en=t}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=!1,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),o.current=void 0,t.moveNext()?(o.current=t.current,!0):!n&&(n=!0,t=e.getEnumerator(),!!t.moveNext()&&(o.current=t.current,!0))}};return o}r.Enumerable.prototype.concat=function(t){var n=this,o=t instanceof Array?t.en():t,u=new r.Enumerable;return u.getEnumerator=function(){return e(n,o)},u},r.List&&(r.List.prototype.concat=r.Enumerable.prototype.concat)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=[],o={current:void 0,moveNext:function(){if(t||(t=r.getEnumerator()),o.current=void 0,!e){for(;t.moveNext();)if(n.indexOf(t.current)<0)return n.push(o.current=t.current),!0;return!1}for(;t.moveNext();){for(var u=0,i=n.length,c=!1;i>u&&!c;u++)c=!!e(n[u],t.current);if(!c)return n.push(o.current=t.current),!0}return!1}};return o}r.Enumerable.prototype.distinct=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.distinct=r.Enumerable.prototype.distinct)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,t){t=t||function(r,e){return r===e};var n,o={current:void 0,moveNext:function(){for(n||(n=r.getEnumerator()),o.current=void 0;n.moveNext();){for(var u=!1,i=e.getEnumerator();i.moveNext()&&!u;)u=t(n.current,i.current);if(!u)return o.current=n.current,!0}return!1}};return o}r.Enumerable.prototype.except=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.except=r.Enumerable.prototype.except)}(exjs||(exjs={})),Function.prototype.fromJson=function(r,e){function t(r,e){if(null==r)return r;if(e instanceof Function)return e(r);if(e instanceof Array){if(e=e[0],!(e instanceof Function&&r instanceof Array))return;for(var t=[],n=0;n<r.length;n++)t.push(e(r[n]));return t}}var n=new this;if(null==r)return n;var o=[];for(var u in e){var i=t(r[u],e[u]);void 0!==i&&(n[u]=i,o.push(u))}for(var u in this.$jsonMappings)if(!(o.indexOf(u)>-1)){var i=t(r[u],this.$jsonMappings[u]);void 0!==i&&(n[u]=i,o.push(u))}for(var u in r)o.indexOf(u)>-1||(n[u]=r[u]);return n};var exjs;!function(r){function e(r,e,n){var o,u=0,i={current:void 0,moveNext:function(){return o||(o=t(r,e,n)),i.current=void 0,!(u>=o.length)&&(i.current=o[u],u++,!0)}};return i}function t(r,e,t){t=t||function(r,e){return r===e};for(var o,u=[],i=[],c=r.getEnumerator();c.moveNext();){o=e(c.current);for(var a=-1,p=0,s=i.length;s>p;p++)if(t(o,i[p])){a=p;break}var f;0>a?(i.push(o),u.push(f=new n(o))):f=u[a],f._add(c.current)}return u}var n=function(r){function e(e){var t=this;r.call(this),this.key=e,this._arr=[],this.getEnumerator=function(){return t._arr.en().getEnumerator()}}return __extends(e,r),e.prototype._add=function(r){this._arr.push(r)},e}(r.Enumerable);r.Enumerable.prototype.groupBy=function(t,n){var o=this,u=new r.Enumerable;return u.getEnumerator=function(){return e(o,t,n)},u},r.List&&(r.List.prototype.groupBy=r.Enumerable.prototype.groupBy)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u={current:void 0,moveNext:function(){for(o||(o=r.en(e).distinct().getEnumerator()),u.current=void 0;o.moveNext();){for(var i=!1,c=t.getEnumerator();c.moveNext()&&!i;)i=n(o.current,c.current);if(i)return u.current=o.current,!0}return!1}};return u}r.Enumerable.prototype.intersect=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.intersect=r.Enumerable.prototype.intersect)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n,o,u,i){i=i||function(r,e){return r===e};var c,a,p=0,s={current:void 0,moveNext:function(){if(s.current=void 0,!c){if(c=e.getEnumerator(),!c.moveNext())return!1;a=r.en(t).toArray()}var f;do{for(;p<a.length;p++)if(f=a[p],i(n(c.current),o(f)))return p++,s.current=u(c.current,f),!0;p=0}while(c.moveNext());return!1}};return s}r.Enumerable.prototype.join=function(t,n,o,u,i){var c=this,a=t instanceof Array?t.en():t,p=new r.Enumerable;return p.getEnumerator=function(){return e(c,a,n,o,u,i)},p},r.List&&(r.List.prototype.join=r.Enumerable.prototype.join)}(exjs||(exjs={}));var exjs;!function(r){function e(){this.constructor=t}r.Enumerable.prototype.toList=function(){for(var r=new t,e=this.getEnumerator();e.moveNext();)r.push(e.current);return r};var t=function(r){function e(){r.apply(this,arguments)}return __extends(e,r),e.prototype.toString=function(){throw new Error("Not implemented")},e.prototype.toLocaleString=function(){throw new Error("Not implemented")},e.prototype.pop=function(){throw new Error("Not implemented")},e.prototype.push=function(){for(var r=[],e=0;e<arguments.length;e++)r[e-0]=arguments[e];throw new Error("Not implemented")},e.prototype.shift=function(){throw new Error("Not implemented")},e.prototype.slice=function(r,e){throw new Error("Not implemented")},e.prototype.sort=function(r){throw new Error("Not implemented")},e.prototype.splice=function(){throw new Error("Not implemented")},e.prototype.unshift=function(){for(var r=[],e=0;e<arguments.length;e++)r[e-0]=arguments[e];throw new Error("Not implemented")},e.prototype.indexOf=function(r,e){throw new Error("Not implemented")},e.prototype.lastIndexOf=function(r,e){throw new Error("Not implemented")},e.prototype.every=function(r,e){throw new Error("Not implemented")},e.prototype.some=function(r,e){throw new Error("Not implemented")},e.prototype.forEach=function(r,e){throw new Error("Not implemented")},e.prototype.map=function(r,e){throw new Error("Not implemented")},e.prototype.filter=function(r,e){throw new Error("Not implemented")},e.prototype.reduce=function(r,e){throw new Error("Not implemented")},e.prototype.reduceRight=function(r,e){throw new Error("Not implemented")},e.prototype.remove=function(r){throw new Error("Not implemented")},e.prototype.removeWhere=function(r){throw new Error("Not implemented")},e}(r.Enumerable);r.List=t;for(var n in Array)Array.hasOwnProperty(n)&&(t[n]=Array[n]);e.prototype=Array.prototype,t.prototype=new e;for(var o in r.Enumerable.prototype)"getEnumerator"!==o&&(t.prototype[o]=r.Enumerable.prototype[o]);t.prototype.getEnumerator=function(){var r=this,e=r.length,t={moveNext:void 0,current:void 0},n=-1;return t.moveNext=function(){return n++,n>=e?(t.current=void 0,!1):(t.current=r[n],!0)},t},t.prototype.remove=function(r){return this.removeWhere(function(e){return e===r}).any()},t.prototype.removeWhere=function(r){for(var e,t=[],n=this.length-1;n>=0;n--)e=this[n],r(e,n)===!0&&(this.splice(n,1),t.push(e));return t.en().reverse()}}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,n,o){return new t(r,e,n,o)}var t=function(e){function t(r,t,n,o){e.call(this),this.Source=r,o=o||function(r,e){return r>e?1:e>r?-1:0};var u=n===!0?-1:1;this.Sorter=function(r,e){return u*o(t(r),t(e))}}return __extends(t,e),t.prototype.getEnumerator=function(){var e,t=this.Source,n=this.Sorter,o=0,u={current:void 0,moveNext:function(){return e||(e=r.en(t).toArray(),e.sort(n)),u.current=void 0,!(o>=e.length)&&(u.current=e[o],o++,!0)}};return u},t.prototype.thenBy=function(r,e){return new n(this,r,(!1),e)},t.prototype.thenByDescending=function(r,e){return new n(this,r,(!0),e)},t}(r.Enumerable),n=function(r){function e(e,t,n,o){r.call(this,e,t,n,o);var u=e.Sorter,i=this.Sorter;this.Sorter=function(r,e){return u(r,e)||i(r,e)}}return __extends(e,r),e}(t),o=r.Enumerable.prototype;o.orderBy=function(r,t){return e(this,r,!1,t)},o.orderByDescending=function(r,t){return e(this,r,!0,t)},r.List&&(r.List.prototype.orderBy=r.Enumerable.prototype.orderBy,r.List.prototype.orderByDescending=r.Enumerable.prototype.orderByDescending)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n,o=1,u={current:void 0,moveNext:function(){if(2>o){if(t=t||e.en().getEnumerator(),t.moveNext())return u.current=t.current,!0;o++}return n=n||r.getEnumerator(),n.moveNext()?(u.current=n.current,!0):(u.current=void 0,!1)}};return u}r.Enumerable.prototype.prepend=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o-0]=arguments[o];var u=new r.Enumerable;return u.getEnumerator=function(){return e(t,n)},u},r.List&&(r.List.prototype.prepend=r.Enumerable.prototype.prepend)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e,t){var n=r-t,o={current:void 0,moveNext:function(){return n+=t,!(n>=e)&&(o.current=n,!0)}};return o}function t(t,n,o){if(t=t||0,n=n||0,t>n)throw new Error("Start cannot be greater than end.");null==o&&(o=1);var u=new r.Enumerable;return u.getEnumerator=function(){return e(t,n,o)},u}r.range=t}(exjs||(exjs={}));var exjs;!function(r){function e(e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.en(e).toArray(),n=t.length),n--,o.current=t[n],n>=0}};return o}r.Enumerable.prototype.reverse=function(){var t=this,n=new r.Enumerable;return n.getEnumerator=function(){return e(t)},n},r.List&&(r.List.prototype.reverse=r.Enumerable.prototype.reverse)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){if(e=e||0,0===e)return Math.round(r);var t=Math.pow(10,e);return Math.round(r*t)/t}r.round=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),!!t.moveNext()&&(o.current=e(t.current,n),n++,!0)}};return o}function t(e,t){var n,o,u={current:void 0,moveNext:function(){for(u.current=void 0,n||(n=e.getEnumerator());!o||!o.moveNext();){if(!n.moveNext())return!1;o=r.selectorEnumerator(t(n.current))}return u.current=o.current,!0}};return u}r.Enumerable.prototype.select=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.selectMany=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.select=r.Enumerable.prototype.select,r.List.prototype.selectMany=r.Enumerable.prototype.selectMany)}(exjs||(exjs={}));var exjs;!function(r){function e(r){return Array.isArray(r)?r.en().getEnumerator():null!=r&&"function"==typeof r.getEnumerator?r.getEnumerator():null}r.selectorEnumerator=e}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;e>o;o++)if(!t.moveNext())return!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}function t(r,e){var t,n={current:void 0,moveNext:function(){if(!t){t=r.getEnumerator();for(var o=0;t.moveNext();o++)if(!e(n.current=t.current,o))return!0;return n.current=void 0,!1}return t.moveNext()?(n.current=t.current,!0):(n.current=void 0,!1)}};return n}r.Enumerable.prototype.skip=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.skipWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.skip=r.Enumerable.prototype.skip,r.List.prototype.skipWhile=r.Enumerable.prototype.skipWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),n++,!(n>e)&&(o.current=void 0,!!t.moveNext()&&(o.current=t.current,!0))}};return o}function t(r,e){var t,n=0,o={current:void 0,moveNext:function(){return t||(t=r.getEnumerator()),t.moveNext()&&e(t.current,n)?(n++,o.current=t.current,!0):(o.current=void 0,!1)}};return o}r.Enumerable.prototype.take=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.takeWhile=function(e){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return t(n,e)},o},r.List&&(r.List.prototype.take=r.Enumerable.prototype.take,r.List.prototype.takeWhile=r.Enumerable.prototype.takeWhile)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t){var n,o=!1,u=[],i={current:void 0,moveNext:function(){if(o){if(null==n)return!1;u.push(n),n=r.selectorEnumerator(t(i.current))}else n=e.getEnumerator(),o=!0;for(;!(n&&n.moveNext()||u.length<1);)n=u.pop();return i.current=null==n?void 0:n.current,void 0!==i.current}};return i}function t(e,t,n){var o,u=!1,i=[],c={current:void 0,moveNext:function(){if(u){if(null==o)return!1;i.push(o),o=r.selectorEnumerator(t(c.current))}else o=e.getEnumerator(),u=!0;do{for(;!(o&&o.moveNext()||i.length<1);)o=i.pop();c.current=null==o?void 0:o.current}while(n(c.current));return void 0!==c.current}};return c}r.Enumerable.prototype.traverse=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.Enumerable.prototype.traverseUnique=function(e,n){var o=this,u=[],i=new r.Enumerable;return n?i.getEnumerator=function(){return t(o,e,function(r){return!!u.some(function(e){return n(r,e)})||(u.push(r),!1)})}:i.getEnumerator=function(){return t(o,e,function(r){return u.indexOf(r)>-1||(u.push(r),!1)})},i},r.List&&(r.List.prototype.traverse=r.Enumerable.prototype.traverse,r.List.prototype.traverseUnique=r.Enumerable.prototype.traverseUnique)}(exjs||(exjs={}));var exjs;!function(r){function e(e,t,n){n=n||function(r,e){return r===e};var o,u,i=[],c={current:void 0,moveNext:function(){if(o||(o=r.en(e).distinct().getEnumerator()),c.current=void 0,!u&&o.moveNext())return i.push(c.current=o.current),!0;for(u=u||r.en(t).distinct().getEnumerator();u.moveNext();){for(var a=0,p=!1,s=i.length;s>a&&!p;a++)p=n(i[a],u.current);if(!p)return c.current=u.current,!0}return!1}};return c}r.Enumerable.prototype.union=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.union=r.Enumerable.prototype.union)}(exjs||(exjs={}));var exjs;!function(r){function e(r,e){var t,n={current:void 0,moveNext:function(){t||(t=r.getEnumerator());for(var o;t.moveNext();)if(e(o=t.current))return n.current=o,!0;return!1}};return n}r.Enumerable.prototype.where=function(t){var n=this,o=new r.Enumerable;return o.getEnumerator=function(){return e(n,t)},o},r.List&&(r.List.prototype.where=r.Enumerable.prototype.where)}(exjs||(exjs={}));var exjs;!function(r){function e(e){var n=new r.Enumerable;return n.getEnumerator=function(){return t(e)},n}function t(r){var e=r.getEnumerator(),t={current:void 0,moveNext:void 0};return t.moveNext=function(){return e.moveNext()?(t.current=e.current,!0):(t.current=void 0,!1)},t}r.en=e}(exjs||(exjs={}));var ex=exjs.en,exjs;!function(r){function e(r,e,t){var n,o,u={current:void 0,moveNext:function(){return n||(n=r.getEnumerator()),o||(o=e.getEnumerator()),u.current=void 0,!(!n.moveNext()||!o.moveNext())&&(u.current=t(n.current,o.current),!0)}};return u}r.Enumerable.prototype.zip=function(t,n){var o=this,u=t instanceof Array?t.en():t,i=new r.Enumerable;return i.getEnumerator=function(){return e(o,u,n)},i},r.List&&(r.List.prototype.zip=r.Enumerable.prototype.zip)}(exjs||(exjs={})),Array.prototype.clone||(Array.prototype.clone=function(){return this.slice(0)}),Array.prototype.contains||(Array.prototype.contains=function(val){return this.indexOf(val)!==-1}),Array.prototype.indexOf||(Array.prototype.indexOf=function(searchElement,fromIndex){var i=fromIndex||0,j=this.length;for(i;i<j;i++)if(this[i]===searchElement)return i;return-1}),Array.prototype.indexOfTest=function(test,fromIndex){var i=fromIndex||0,j=this.length;for(i;i<j;i++)if(test(this[i]))return i;return-1},Array.prototype.insert=function(item,index){this.splice(index,0,item)},Array.prototype.last||(Array.prototype.last=function(){return this[this.length-1]}),Array.prototype.map||(Array.prototype.map=function(callback,thisArg){var T,A,k;if(null==this)throw new TypeError(" this is null or not defined");var O=Object(this),len=O.length>>>0;if("function"!=typeof callback)throw new TypeError(callback+" is not a function");for(arguments.length>1&&(T=thisArg),A=new Array(len),k=0;k<len;){var kValue,mappedValue;k in O&&(kValue=O[k],mappedValue=callback.call(T,kValue,k,O),A[k]=mappedValue),k++}return A}),Array.prototype.move=function(fromIndex,toIndex){this.splice(toIndex,0,this.splice(fromIndex,1)[0])},Array.prototype.remove=function(item){var index=this.indexOf(item);index>-1&&this.splice(index,1)},Array.prototype.removeAt=function(index){this.splice(index,1)},Math.clamp=function(value,min,max){return Math.min(Math.max(value,min),max)},Math.constrain=function(value,low,high){return Math.clamp(value,low,high)},Math.degreesToRadians=function(degrees){return Math.TAU*(degrees/360)},Math.distanceBetween=function(x1,y1,x2,y2){return Math.sqrt(Math.sq(x2-x1)+Math.sq(y2-y1))},Math.lerp=function(start,stop,amount){return start+(stop-start)*amount},Math.mag=function(a,b,c){return Math.sqrt(a*a+b*b+c*c)},Math.map=function(value,start1,stop1,start2,stop2){return start2+(stop2-start2)*((value-start1)/(stop1-start1))},Math.median=function(values){values.sort(function(a,b){return a-b});var half=Math.floor(values.length/2);return values.length%2?values[half]:(values[half-1]+values[half])/2},Math.normalise=function(num,min,max){return(num-min)/(max-min)},Math.radiansToDegrees=function(radians){return 360*radians/Math.TAU},Math.randomBetween=function(low,high){return high||(high=low,low=0),low>=high?low:low+(high-low)*Math.random()},Math.roundToDecimalPlace=function(num,dec){return Math.round(num*Math.pow(10,dec))/Math.pow(10,dec)},Math.sq=function(n){return n*n},Math.TAU=2*Math.PI,Number.prototype.isInteger||(Number.prototype.isInteger=function(){return this%1===0}),"function"!=typeof Object.create&&(Object.create=function(o,props){function F(){}F.prototype=o;var result=new F;if("object"==typeof props)for(var prop in props)props.hasOwnProperty(prop)&&(result[prop]=props[prop].value);return result}),Object.keys||(Object.keys=function(){var hasOwnProperty=Object.prototype.hasOwnProperty,hasDontEnumBug=!{toString:null}.propertyIsEnumerable("toString"),dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],dontEnumsLength=dontEnums.length;return function(obj){if("object"!=typeof obj&&"function"!=typeof obj||null===obj)throw new TypeError("Object.keys called on non-object");var result=[];for(var prop in obj)hasOwnProperty.call(obj,prop)&&result.push(prop);if(hasDontEnumBug)for(var i=0;i<dontEnumsLength;i++)hasOwnProperty.call(obj,dontEnums[i])&&result.push(dontEnums[i]);return result}}()),String.prototype.b64_to_utf8=function(){return decodeURIComponent(escape(window.atob(this)))},String.prototype.contains=function(str){return this.indexOf(str)!==-1},String.prototype.endsWith||(String.prototype.endsWith=function(str){return this.indexOf(str,this.length-str.length)!==-1}),String.format=function(){for(var s=arguments[0],i=0;i<arguments.length-1;i++){var reg=new RegExp("\\{"+i+"\\}","gm");s=s.replace(reg,arguments[i+1])}return s},String.prototype.hashCode=function(){var i,chr,len,hash=0;if(0===this.length)return hash.toString();for(i=0,len=this.length;i<len;i++)chr=this.charCodeAt(i),hash=(hash<<5)-hash+chr,hash|=0;return hash.toString()},String.prototype.isAlphanumeric=function(){return/^[a-zA-Z0-9]*$/.test(this)},String.prototype.ltrim=function(){return this.replace(/^\s+/,"")},String.prototype.rtrim=function(){return this.replace(/\s+$/,"")},String.prototype.startsWith||(String.prototype.startsWith=function(str){return 0==this.indexOf(str)}),String.prototype.toCssClass=function(){return this.replace(/[^a-z0-9]/g,function(s){var c=s.charCodeAt(0);return 32==c?"-":c>=65&&c<=90?"_"+s.toLowerCase():"__"+("000"+c.toString(16)).slice(-4)})},String.prototype.toFileName=function(){return this.replace(/[^a-z0-9]/gi,"_").toLowerCase()},String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}),String.prototype.utf8_to_b64=function(){return window.btoa(unescape(encodeURIComponent(this)))};var HTTPStatusCode;!function(HTTPStatusCode){HTTPStatusCode.CONTINUE=100,HTTPStatusCode.SWITCHING_PROTOCOLS=101,HTTPStatusCode.PROCESSING=102,HTTPStatusCode.OK=200,HTTPStatusCode.CREATED=201,HTTPStatusCode.ACCEPTED=202,HTTPStatusCode.NON_AUTHORITATIVE_INFORMATION=203,HTTPStatusCode.NO_CONTENT=204,HTTPStatusCode.RESET_CONTENT=205,HTTPStatusCode.PARTIAL_CONTENT=206,HTTPStatusCode.MULTI_STATUS=207,HTTPStatusCode.MULTIPLE_CHOICES=300,HTTPStatusCode.MOVED_PERMANENTLY=301,HTTPStatusCode.MOVED_TEMPORARILY=302,HTTPStatusCode.SEE_OTHER=303,HTTPStatusCode.NOT_MODIFIED=304,HTTPStatusCode.USE_PROXY=305,HTTPStatusCode.TEMPORARY_REDIRECT=307,HTTPStatusCode.BAD_REQUEST=400,HTTPStatusCode.UNAUTHORIZED=401,HTTPStatusCode.PAYMENT_REQUIRED=402,HTTPStatusCode.FORBIDDEN=403,HTTPStatusCode.NOT_FOUND=404,HTTPStatusCode.METHOD_NOT_ALLOWED=405,HTTPStatusCode.NOT_ACCEPTABLE=406,HTTPStatusCode.PROXY_AUTHENTICATION_REQUIRED=407,HTTPStatusCode.REQUEST_TIME_OUT=408,HTTPStatusCode.CONFLICT=409,HTTPStatusCode.GONE=410,HTTPStatusCode.LENGTH_REQUIRED=411,HTTPStatusCode.PRECONDITION_FAILED=412,HTTPStatusCode.REQUEST_ENTITY_TOO_LARGE=413,HTTPStatusCode.REQUEST_URI_TOO_LARGE=414,HTTPStatusCode.UNSUPPORTED_MEDIA_TYPE=415,HTTPStatusCode.REQUESTED_RANGE_NOT_SATISFIABLE=416,HTTPStatusCode.EXPECTATION_FAILED=417,HTTPStatusCode.IM_A_TEAPOT=418,HTTPStatusCode.UNPROCESSABLE_ENTITY=422,HTTPStatusCode.LOCKED=423,HTTPStatusCode.FAILED_DEPENDENCY=424,HTTPStatusCode.UNORDERED_COLLECTION=425,HTTPStatusCode.UPGRADE_REQUIRED=426,HTTPStatusCode.PRECONDITION_REQUIRED=428,HTTPStatusCode.TOO_MANY_REQUESTS=429,HTTPStatusCode.REQUEST_HEADER_FIELDS_TOO_LARGE=431,HTTPStatusCode.INTERNAL_SERVER_ERROR=500,HTTPStatusCode.NOT_IMPLEMENTED=501,
3
+ HTTPStatusCode.BAD_GATEWAY=502,HTTPStatusCode.SERVICE_UNAVAILABLE=503,HTTPStatusCode.GATEWAY_TIME_OUT=504,HTTPStatusCode.HTTP_VERSION_NOT_SUPPORTED=505,HTTPStatusCode.VARIANT_ALSO_NEGOTIATES=506,HTTPStatusCode.INSUFFICIENT_STORAGE=507,HTTPStatusCode.BANDWIDTH_LIMIT_EXCEEDED=509,HTTPStatusCode.NOT_EXTENDED=510,HTTPStatusCode.NETWORK_AUTHENTICATION_REQUIRED=511}(HTTPStatusCode||(HTTPStatusCode={})),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.manifesto=f()}}(function(){var define;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){var Manifesto;!function(Manifesto){var StringValue=function(){function StringValue(value){this.value="",value&&(this.value=value.toLowerCase())}return StringValue.prototype.toString=function(){return this.value},StringValue}();Manifesto.StringValue=StringValue}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var AnnotationMotivation=function(_super){function AnnotationMotivation(){_super.apply(this,arguments)}return __extends(AnnotationMotivation,_super),AnnotationMotivation.prototype.bookmarking=function(){return new AnnotationMotivation(AnnotationMotivation.BOOKMARKING.toString())},AnnotationMotivation.prototype.classifying=function(){return new AnnotationMotivation(AnnotationMotivation.CLASSIFYING.toString())},AnnotationMotivation.prototype.commenting=function(){return new AnnotationMotivation(AnnotationMotivation.COMMENTING.toString())},AnnotationMotivation.prototype.describing=function(){return new AnnotationMotivation(AnnotationMotivation.DESCRIBING.toString())},AnnotationMotivation.prototype.editing=function(){return new AnnotationMotivation(AnnotationMotivation.EDITING.toString())},AnnotationMotivation.prototype.highlighting=function(){return new AnnotationMotivation(AnnotationMotivation.HIGHLIGHTING.toString())},AnnotationMotivation.prototype.identifying=function(){return new AnnotationMotivation(AnnotationMotivation.IDENTIFYING.toString())},AnnotationMotivation.prototype.linking=function(){return new AnnotationMotivation(AnnotationMotivation.LINKING.toString())},AnnotationMotivation.prototype.moderating=function(){return new AnnotationMotivation(AnnotationMotivation.MODERATING.toString())},AnnotationMotivation.prototype.painting=function(){return new AnnotationMotivation(AnnotationMotivation.PAINTING.toString())},AnnotationMotivation.prototype.questioning=function(){return new AnnotationMotivation(AnnotationMotivation.QUESTIONING.toString())},AnnotationMotivation.prototype.replying=function(){return new AnnotationMotivation(AnnotationMotivation.REPLYING.toString())},AnnotationMotivation.prototype.tagging=function(){return new AnnotationMotivation(AnnotationMotivation.TAGGING.toString())},AnnotationMotivation.prototype.transcribing=function(){return new AnnotationMotivation(AnnotationMotivation.TRANSCRIBING.toString())},AnnotationMotivation.BOOKMARKING=new AnnotationMotivation("oa:bookmarking"),AnnotationMotivation.CLASSIFYING=new AnnotationMotivation("oa:classifying"),AnnotationMotivation.COMMENTING=new AnnotationMotivation("oa:commenting"),AnnotationMotivation.DESCRIBING=new AnnotationMotivation("oa:describing"),AnnotationMotivation.EDITING=new AnnotationMotivation("oa:editing"),AnnotationMotivation.HIGHLIGHTING=new AnnotationMotivation("oa:highlighting"),AnnotationMotivation.IDENTIFYING=new AnnotationMotivation("oa:identifying"),AnnotationMotivation.LINKING=new AnnotationMotivation("oa:linking"),AnnotationMotivation.MODERATING=new AnnotationMotivation("oa:moderating"),AnnotationMotivation.PAINTING=new AnnotationMotivation("sc:painting"),AnnotationMotivation.QUESTIONING=new AnnotationMotivation("oa:questioning"),AnnotationMotivation.REPLYING=new AnnotationMotivation("oa:replying"),AnnotationMotivation.TAGGING=new AnnotationMotivation("oa:tagging"),AnnotationMotivation.TRANSCRIBING=new AnnotationMotivation("oad:transcribing"),AnnotationMotivation}(Manifesto.StringValue);Manifesto.AnnotationMotivation=AnnotationMotivation}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ElementType=function(_super){function ElementType(){_super.apply(this,arguments)}return __extends(ElementType,_super),ElementType.prototype.canvas=function(){return new ElementType(ElementType.CANVAS.toString())},ElementType.prototype.document=function(){return new ElementType(ElementType.DOCUMENT.toString())},ElementType.prototype.image=function(){return new ElementType(ElementType.IMAGE.toString())},ElementType.prototype.movingimage=function(){return new ElementType(ElementType.MOVINGIMAGE.toString())},ElementType.prototype.physicalobject=function(){return new ElementType(ElementType.PHYSICALOBJECT.toString())},ElementType.prototype.sound=function(){return new ElementType(ElementType.SOUND.toString())},ElementType.CANVAS=new ElementType("sc:canvas"),ElementType.DOCUMENT=new ElementType("foaf:document"),ElementType.IMAGE=new ElementType("dcTypes:image"),ElementType.MOVINGIMAGE=new ElementType("dctypes:movingimage"),ElementType.PHYSICALOBJECT=new ElementType("dctypes:physicalobject"),ElementType.SOUND=new ElementType("dctypes:sound"),ElementType}(Manifesto.StringValue);Manifesto.ElementType=ElementType}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var IIIFResourceType=function(_super){function IIIFResourceType(){_super.apply(this,arguments)}return __extends(IIIFResourceType,_super),IIIFResourceType.prototype.annotation=function(){return new IIIFResourceType(IIIFResourceType.ANNOTATION.toString())},IIIFResourceType.prototype.canvas=function(){return new IIIFResourceType(IIIFResourceType.CANVAS.toString())},IIIFResourceType.prototype.collection=function(){return new IIIFResourceType(IIIFResourceType.COLLECTION.toString())},IIIFResourceType.prototype.manifest=function(){return new IIIFResourceType(IIIFResourceType.MANIFEST.toString())},IIIFResourceType.prototype.range=function(){return new IIIFResourceType(IIIFResourceType.RANGE.toString())},IIIFResourceType.prototype.sequence=function(){return new IIIFResourceType(IIIFResourceType.SEQUENCE.toString())},IIIFResourceType.ANNOTATION=new IIIFResourceType("oa:annotation"),IIIFResourceType.CANVAS=new IIIFResourceType("sc:canvas"),IIIFResourceType.COLLECTION=new IIIFResourceType("sc:collection"),IIIFResourceType.MANIFEST=new IIIFResourceType("sc:manifest"),IIIFResourceType.RANGE=new IIIFResourceType("sc:range"),IIIFResourceType.SEQUENCE=new IIIFResourceType("sc:sequence"),IIIFResourceType}(Manifesto.StringValue);Manifesto.IIIFResourceType=IIIFResourceType}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ManifestType=function(_super){function ManifestType(){_super.apply(this,arguments)}return __extends(ManifestType,_super),ManifestType.prototype.empty=function(){return new ManifestType(ManifestType.EMPTY.toString())},ManifestType.prototype.manuscript=function(){return new ManifestType(ManifestType.MANUSCRIPT.toString())},ManifestType.prototype.monograph=function(){return new ManifestType(ManifestType.MONOGRAPH.toString())},ManifestType.EMPTY=new ManifestType(""),ManifestType.MANUSCRIPT=new ManifestType("manuscript"),ManifestType.MONOGRAPH=new ManifestType("monograph"),ManifestType}(Manifesto.StringValue);Manifesto.ManifestType=ManifestType}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var RenderingFormat=function(_super){function RenderingFormat(){_super.apply(this,arguments)}return __extends(RenderingFormat,_super),RenderingFormat.prototype.pdf=function(){return new RenderingFormat(RenderingFormat.PDF.toString())},RenderingFormat.prototype.doc=function(){return new RenderingFormat(RenderingFormat.DOC.toString())},RenderingFormat.prototype.docx=function(){return new RenderingFormat(RenderingFormat.DOCX.toString())},RenderingFormat.PDF=new RenderingFormat("application/pdf"),RenderingFormat.DOC=new RenderingFormat("application/msword"),RenderingFormat.DOCX=new RenderingFormat("application/vnd.openxmlformats-officedocument.wordprocessingml.document"),RenderingFormat}(Manifesto.StringValue);Manifesto.RenderingFormat=RenderingFormat}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ResourceFormat=function(_super){function ResourceFormat(){_super.apply(this,arguments)}return __extends(ResourceFormat,_super),ResourceFormat.prototype.jpgimage=function(){return new ResourceFormat(ResourceFormat.JPGIMAGE.toString())},ResourceFormat.prototype.pdf=function(){return new ResourceFormat(ResourceFormat.PDF.toString())},ResourceFormat.JPGIMAGE=new ResourceFormat("image/jpeg"),ResourceFormat.PDF=new ResourceFormat("application/pdf"),ResourceFormat}(Manifesto.StringValue);Manifesto.ResourceFormat=ResourceFormat}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ResourceType=function(_super){function ResourceType(){_super.apply(this,arguments)}return __extends(ResourceType,_super),ResourceType.prototype.image=function(){return new ResourceType(ResourceType.IMAGE.toString())},ResourceType.IMAGE=new ResourceType("dctypes:image"),ResourceType}(Manifesto.StringValue);Manifesto.ResourceType=ResourceType}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ServiceProfile=function(_super){function ServiceProfile(){_super.apply(this,arguments)}return __extends(ServiceProfile,_super),ServiceProfile.prototype.autoComplete=function(){return new ServiceProfile(ServiceProfile.AUTOCOMPLETE.toString())},ServiceProfile.prototype.iiif1ImageLevel1=function(){return new ServiceProfile(ServiceProfile.IIIF1IMAGELEVEL1.toString())},ServiceProfile.prototype.iiif1ImageLevel2=function(){return new ServiceProfile(ServiceProfile.IIIF1IMAGELEVEL2.toString())},ServiceProfile.prototype.iiif2ImageLevel1=function(){return new ServiceProfile(ServiceProfile.IIIF2IMAGELEVEL1.toString())},ServiceProfile.prototype.iiif2ImageLevel2=function(){return new ServiceProfile(ServiceProfile.IIIF2IMAGELEVEL2.toString())},ServiceProfile.prototype.ixif=function(){return new ServiceProfile(ServiceProfile.IXIF.toString())},ServiceProfile.prototype.login=function(){return new ServiceProfile(ServiceProfile.LOGIN.toString())},ServiceProfile.prototype.clickThrough=function(){return new ServiceProfile(ServiceProfile.CLICKTHROUGH.toString())},ServiceProfile.prototype.restricted=function(){return new ServiceProfile(ServiceProfile.RESTRICTED.toString())},ServiceProfile.prototype.logout=function(){return new ServiceProfile(ServiceProfile.LOGOUT.toString())},ServiceProfile.prototype.otherManifestations=function(){return new ServiceProfile(ServiceProfile.OTHERMANIFESTATIONS.toString())},ServiceProfile.prototype.searchWithin=function(){return new ServiceProfile(ServiceProfile.SEARCHWITHIN.toString())},ServiceProfile.prototype.stanfordIIIFImageCompliance1=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString())},ServiceProfile.prototype.stanfordIIIFImageCompliance2=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString())},ServiceProfile.prototype.stanfordIIIFImageConformance1=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString())},ServiceProfile.prototype.stanfordIIIFImageConformance2=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString())},ServiceProfile.prototype.stanfordIIIF1ImageCompliance1=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString())},ServiceProfile.prototype.stanfordIIIF1ImageCompliance2=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString())},ServiceProfile.prototype.stanfordIIIF1ImageConformance1=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString())},ServiceProfile.prototype.stanfordIIIF1ImageConformance2=function(){return new ServiceProfile(ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString())},ServiceProfile.prototype.token=function(){return new ServiceProfile(ServiceProfile.TOKEN.toString())},ServiceProfile.prototype.trackingExtensions=function(){return new ServiceProfile(ServiceProfile.TRACKINGEXTENSIONS.toString())},ServiceProfile.prototype.uiExtensions=function(){return new ServiceProfile(ServiceProfile.UIEXTENSIONS.toString())},ServiceProfile.prototype.printExtensions=function(){return new ServiceProfile(ServiceProfile.PRINTEXTENSIONS.toString())},ServiceProfile.prototype.shareExtensions=function(){return new ServiceProfile(ServiceProfile.SHAREEXTENSIONS.toString())},ServiceProfile.AUTOCOMPLETE=new ServiceProfile("http://iiif.io/api/search/0/autocomplete"),ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0=new ServiceProfile("http://library.stanford.edu/iiif/image-api/compliance.html#level0"),ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1=new ServiceProfile("http://library.stanford.edu/iiif/image-api/compliance.html#level1"),ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2=new ServiceProfile("http://library.stanford.edu/iiif/image-api/compliance.html#level2"),ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0=new ServiceProfile("http://library.stanford.edu/iiif/image-api/conformance.html#level0"),ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1=new ServiceProfile("http://library.stanford.edu/iiif/image-api/conformance.html#level1"),ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2=new ServiceProfile("http://library.stanford.edu/iiif/image-api/conformance.html#level2"),ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0=new ServiceProfile("http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0"),ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1=new ServiceProfile("http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1"),ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2=new ServiceProfile("http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2"),ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0=new ServiceProfile("http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0"),ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1=new ServiceProfile("http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1"),ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2=new ServiceProfile("http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2"),ServiceProfile.IIIF1IMAGELEVEL0=new ServiceProfile("http://iiif.io/api/image/1/level0.json"),ServiceProfile.IIIF1IMAGELEVEL0PROFILE=new ServiceProfile("http://iiif.io/api/image/1/profiles/level0.json"),ServiceProfile.IIIF1IMAGELEVEL1=new ServiceProfile("http://iiif.io/api/image/1/level1.json"),ServiceProfile.IIIF1IMAGELEVEL1PROFILE=new ServiceProfile("http://iiif.io/api/image/1/profiles/level1.json"),ServiceProfile.IIIF1IMAGELEVEL2=new ServiceProfile("http://iiif.io/api/image/1/level2.json"),ServiceProfile.IIIF1IMAGELEVEL2PROFILE=new ServiceProfile("http://iiif.io/api/image/1/profiles/level2.json"),ServiceProfile.IIIF2IMAGELEVEL0=new ServiceProfile("http://iiif.io/api/image/2/level0.json"),ServiceProfile.IIIF2IMAGELEVEL0PROFILE=new ServiceProfile("http://iiif.io/api/image/2/profiles/level0.json"),ServiceProfile.IIIF2IMAGELEVEL1=new ServiceProfile("http://iiif.io/api/image/2/level1.json"),ServiceProfile.IIIF2IMAGELEVEL1PROFILE=new ServiceProfile("http://iiif.io/api/image/2/profiles/level1.json"),ServiceProfile.IIIF2IMAGELEVEL2=new ServiceProfile("http://iiif.io/api/image/2/level2.json"),ServiceProfile.IIIF2IMAGELEVEL2PROFILE=new ServiceProfile("http://iiif.io/api/image/2/profiles/level2.json"),ServiceProfile.IXIF=new ServiceProfile("http://wellcomelibrary.org/ld/ixif/0/alpha.json"),ServiceProfile.LOGIN=new ServiceProfile("http://iiif.io/api/auth/0/login"),ServiceProfile.CLICKTHROUGH=new ServiceProfile("http://iiif.io/api/auth/0/login/clickthrough"),ServiceProfile.RESTRICTED=new ServiceProfile("http://iiif.io/api/auth/0/login/restricted"),ServiceProfile.LOGOUT=new ServiceProfile("http://iiif.io/api/auth/0/logout"),ServiceProfile.OTHERMANIFESTATIONS=new ServiceProfile("http://iiif.io/api/otherManifestations.json"),ServiceProfile.SEARCHWITHIN=new ServiceProfile("http://iiif.io/api/search/0/search"),ServiceProfile.TOKEN=new ServiceProfile("http://iiif.io/api/auth/0/token"),ServiceProfile.TRACKINGEXTENSIONS=new ServiceProfile("http://universalviewer.io/tracking-extensions-profile"),ServiceProfile.UIEXTENSIONS=new ServiceProfile("http://universalviewer.io/ui-extensions-profile"),ServiceProfile.PRINTEXTENSIONS=new ServiceProfile("http://universalviewer.io/print-extensions-profile"),ServiceProfile.SHAREEXTENSIONS=new ServiceProfile("http://universalviewer.io/share-extensions-profile"),ServiceProfile}(Manifesto.StringValue);Manifesto.ServiceProfile=ServiceProfile}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ViewingDirection=function(_super){function ViewingDirection(){_super.apply(this,arguments)}return __extends(ViewingDirection,_super),ViewingDirection.prototype.leftToRight=function(){return new ViewingDirection(ViewingDirection.LEFTTORIGHT.toString())},ViewingDirection.prototype.rightToLeft=function(){return new ViewingDirection(ViewingDirection.RIGHTTOLEFT.toString())},ViewingDirection.prototype.topToBottom=function(){return new ViewingDirection(ViewingDirection.TOPTOBOTTOM.toString())},ViewingDirection.prototype.bottomToTop=function(){return new ViewingDirection(ViewingDirection.BOTTOMTOTOP.toString())},ViewingDirection.LEFTTORIGHT=new ViewingDirection("left-to-right"),ViewingDirection.RIGHTTOLEFT=new ViewingDirection("right-to-left"),ViewingDirection.TOPTOBOTTOM=new ViewingDirection("top-to-bottom"),ViewingDirection.BOTTOMTOTOP=new ViewingDirection("bottom-to-top"),ViewingDirection}(Manifesto.StringValue);Manifesto.ViewingDirection=ViewingDirection}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ViewingHint=function(_super){function ViewingHint(){_super.apply(this,arguments)}return __extends(ViewingHint,_super),ViewingHint.prototype.continuous=function(){return new ViewingHint(ViewingHint.CONTINUOUS.toString())},ViewingHint.prototype.empty=function(){return new ViewingHint(ViewingHint.EMPTY.toString())},ViewingHint.prototype.individuals=function(){return new ViewingHint(ViewingHint.INDIVIDUALS.toString())},ViewingHint.prototype.nonPaged=function(){return new ViewingHint(ViewingHint.NONPAGED.toString())},ViewingHint.prototype.paged=function(){return new ViewingHint(ViewingHint.PAGED.toString())},ViewingHint.prototype.top=function(){return new ViewingHint(ViewingHint.TOP.toString())},ViewingHint.CONTINUOUS=new ViewingHint("continuous"),ViewingHint.EMPTY=new ViewingHint(""),ViewingHint.INDIVIDUALS=new ViewingHint("individuals"),ViewingHint.NONPAGED=new ViewingHint("non-paged"),ViewingHint.PAGED=new ViewingHint("paged"),ViewingHint.TOP=new ViewingHint("top"),ViewingHint}(Manifesto.StringValue);Manifesto.ViewingHint=ViewingHint}(Manifesto||(Manifesto={}));var Manifesto;!function(Manifesto){var JSONLDResource=function(){function JSONLDResource(jsonld){this.__jsonld=jsonld,this.context=this.getProperty("@context"),this.id=this.getProperty("@id")}return JSONLDResource.prototype.getProperty=function(name){return this.__jsonld?this.__jsonld[name]:null},JSONLDResource}();Manifesto.JSONLDResource=JSONLDResource}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var ManifestResource=function(_super){function ManifestResource(jsonld,options){_super.call(this,jsonld),this.options=options}return __extends(ManifestResource,_super),ManifestResource.prototype.getIIIFResourceType=function(){return new Manifesto.IIIFResourceType(this.getProperty("@type"))},ManifestResource.prototype.getLabel=function(){return Manifesto.TranslationCollection.parse(this.getProperty("label"),this.options.locale)},ManifestResource.prototype.getMetadata=function(){var _metadata=this.getProperty("metadata"),metadata=[];if(!_metadata)return metadata;for(var i=0;i<_metadata.length;i++){var item=_metadata[i],metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.parse(item),metadata.push(metadataItem)}return metadata},ManifestResource.prototype.getRendering=function(format){var renderings=this.getRenderings();"string"!=typeof format&&(format=format.toString());for(var i=0;i<renderings.length;i++){var rendering=renderings[i];if(rendering.getFormat().toString()===format)return rendering}return null},ManifestResource.prototype.getRenderings=function(){var rendering;rendering=this.__jsonld?this.__jsonld.rendering:this.rendering;var renderings=[];if(!rendering)return renderings;_isArray(rendering)||(rendering=[rendering]);for(var i=0;i<rendering.length;i++){var r=rendering[i];renderings.push(new Manifesto.Rendering(r,this.options))}return renderings},ManifestResource.prototype.getService=function(profile){return Manifesto.Utils.getService(this,profile)},ManifestResource.prototype.getServices=function(){return Manifesto.Utils.getServices(this)},ManifestResource.prototype.isAnnotation=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.ANNOTATION.toString()},ManifestResource.prototype.isCanvas=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.CANVAS.toString()},ManifestResource.prototype.isCollection=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.COLLECTION.toString()},ManifestResource.prototype.isManifest=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.MANIFEST.toString()},ManifestResource.prototype.isRange=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.RANGE.toString()},ManifestResource.prototype.isSequence=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.SEQUENCE.toString()},ManifestResource}(Manifesto.JSONLDResource);Manifesto.ManifestResource=ManifestResource}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Element=function(_super){function Element(jsonld,options){_super.call(this,jsonld,options)}return __extends(Element,_super),Element.prototype.getResources=function(){var resources=[];if(!this.__jsonld.resources)return resources;for(var i=0;i<this.__jsonld.resources.length;i++){var a=this.__jsonld.resources[i],annotation=new Manifesto.Annotation(a,this.options);resources.push(annotation)}return resources},Element.prototype.getType=function(){return new Manifesto.ElementType(this.getProperty("@type"))},Element}(Manifesto.ManifestResource);Manifesto.Element=Element}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},_endsWith=require("lodash.endswith"),_last=require("lodash.last");!function(Manifesto){var Canvas=function(_super){function Canvas(jsonld,options){_super.call(this,jsonld,options)}return __extends(Canvas,_super),Canvas.prototype.getCanonicalImageUri=function(w){var id,size,region="full",rotation=0,quality="default",width=w;if(this.externalResource&&this.externalResource.data&&this.externalResource.data["@id"])id=this.externalResource.data["@id"],width||(width=this.externalResource.data.width),this.externalResource.data["@context"]&&(this.externalResource.data["@context"].indexOf("/1.0/context.json")>-1||this.externalResource.data["@context"].indexOf("/1.1/context.json")>-1||this.externalResource.data["@context"].indexOf("/1/context.json")>-1)&&(quality="native");else{var images=this.getImages();if(images&&images.length){var firstImage=images[0],resource=firstImage.getResource(),services=resource.getServices();if(width||(width=resource.getWidth()),services.length){var service=services[0];id=service.id,quality=Manifesto.Utils.getImageQuality(service.getProfile())}}if(!id)return"undefined"==typeof this.__jsonld.thumbnail?null:this.__jsonld.thumbnail}size=width+",";var uri=[id,region,size,rotation,quality+".jpg"].join("/");return uri},Canvas.prototype.getImages=function(){var images=[];if(!this.__jsonld.images)return images;for(var i=0;i<this.__jsonld.images.length;i++){var a=this.__jsonld.images[i],annotation=new Manifesto.Annotation(a,this.options);images.push(annotation)}return images},Canvas.prototype.getIndex=function(){return this.getProperty("index")},Canvas.prototype.getWidth=function(){return this.getProperty("width")},Canvas.prototype.getHeight=function(){return this.getProperty("height")},Canvas}(Manifesto.Element);Manifesto.Canvas=Canvas}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},_assign=require("lodash.assign");!function(Manifesto){var IIIFResource=function(_super){function IIIFResource(jsonld,options){_super.call(this,jsonld,options),this.index=-1,this.isLoaded=!1;var defaultOptions={defaultLabel:"-",locale:"en-GB",resource:this,pessimisticAccessControl:!1};this.options=_assign(defaultOptions,options)}return __extends(IIIFResource,_super),IIIFResource.prototype.getAttribution=function(){var attribution=this.getProperty("attribution");return attribution?Manifesto.TranslationCollection.parse(attribution,this.options.locale):[]},IIIFResource.prototype.getDescription=function(){var description=this.getProperty("description");return description?Manifesto.TranslationCollection.parse(description,this.options.locale):[]},IIIFResource.prototype.getIIIFResourceType=function(){return new Manifesto.IIIFResourceType(this.getProperty("@type"))},IIIFResource.prototype.getLogo=function(){var logo=this.getProperty("logo");return logo?_isString(logo)?logo:logo["@id"]:null},IIIFResource.prototype.getLicense=function(){return Manifesto.Utils.getLocalisedValue(this.getProperty("license"),this.options.locale)},IIIFResource.prototype.getNavDate=function(){return new Date(this.getProperty("navDate"))},IIIFResource.prototype.getRelated=function(){return this.getProperty("related")},IIIFResource.prototype.getSeeAlso=function(){return this.getProperty("seeAlso")},IIIFResource.prototype.getLabel=function(){var label=this.getProperty("label");return label?Manifesto.TranslationCollection.parse(label,this.options.locale):[]},IIIFResource.prototype.getDefaultTree=function(){return this.defaultTree=new Manifesto.TreeNode("root"),this.defaultTree.data=this,this.defaultTree},IIIFResource.prototype.isCollection=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.COLLECTION.toString()},IIIFResource.prototype.isManifest=function(){return this.getIIIFResourceType().toString()===Manifesto.IIIFResourceType.MANIFEST.toString()},IIIFResource.prototype.load=function(){var that=this;return new Promise(function(resolve,reject){if(that.isLoaded)resolve(that);else{var options=that.options;options.navDate=that.getNavDate(),Manifesto.Utils.loadResource(that.__jsonld["@id"]).then(function(data){that.parentLabel=Manifesto.TranslationCollection.getValue(that.getLabel(),options.locale);var parsed=Manifesto.Deserialiser.parse(data,options);that=_assign(that,parsed),that.index=options.index,resolve(that)})}})},IIIFResource}(Manifesto.ManifestResource);Manifesto.IIIFResource=IIIFResource}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},_isArray=require("lodash.isarray"),_map=require("lodash.map");!function(Manifesto){var Manifest=function(_super){function Manifest(jsonld,options){if(_super.call(this,jsonld,options),this.index=0,this._allRanges=null,this._sequences=null,this._topRanges=[],this.__jsonld.structures&&this.__jsonld.structures.length)for(var topRanges=this._getTopRanges(),i=0;i<topRanges.length;i++){var range=topRanges[i];this._parseRanges(range,String(i))}}return __extends(Manifest,_super),Manifest.prototype.getDefaultTree=function(){if(_super.prototype.getDefaultTree.call(this),this.defaultTree.data.type=Manifesto.TreeNodeType.MANIFEST.toString(),!this.isLoaded)return this.defaultTree;var topRanges=this.getTopRanges();return topRanges.length&&topRanges[0].getTree(this.defaultTree),Manifesto.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},Manifest.prototype._getTopRanges=function(){var topRanges=[];if(this.__jsonld.structures&&this.__jsonld.structures.length){for(var i=0;i<this.__jsonld.structures.length;i++){var json=this.__jsonld.structures[i];json.viewingHint===Manifesto.ViewingHint.TOP.toString()&&topRanges.push(json)}if(!topRanges.length){var range={};range.ranges=this.__jsonld.structures,topRanges.push(range)}}return topRanges},Manifest.prototype.getTopRanges=function(){return this._topRanges},Manifest.prototype._getRangeById=function(id){if(this.__jsonld.structures&&this.__jsonld.structures.length)for(var i=0;i<this.__jsonld.structures.length;i++){var r=this.__jsonld.structures[i];if(r["@id"]===id)return r}return null},Manifest.prototype._parseRangeCanvas=function(json,range){},Manifest.prototype._parseRanges=function(r,path,parentRange){
4
+ var range,id;if(_isString(r)&&(id=r,r=this._getRangeById(id)),!r)return void console.warn("Range:",id,"does not exist");if(range=new Manifesto.Range(r,this.options),range.parentRange=parentRange,range.path=path,parentRange?parentRange.members.push(range):this._topRanges.push(range),r.ranges)for(var i=0;i<r.ranges.length;i++)this._parseRanges(r.ranges[i],path+"/"+i,range);if(r.members)for(var _loop_1=function(i){var child=r.members[i];return r.members.en().where(function(m){return m.id===child.id}).first()?"continue":void("sc:range"===child["@type"].toLowerCase()&&this_1._parseRanges(child,path+"/"+i,range))},this_1=this,i=0;i<r.members.length;i++){_loop_1(i)}},Manifest.prototype.getAllRanges=function(){if(null!=this._allRanges)return this._allRanges;this._allRanges=[];for(var topRanges=this.getTopRanges(),i=0;i<topRanges.length;i++){var topRange=topRanges[i];topRange.id&&this._allRanges.push(topRange);var subRanges=topRange.getRanges();this._allRanges=this._allRanges.concat(subRanges.en().traverseUnique(function(range){return range.getRanges()}).toArray())}return this._allRanges},Manifest.prototype.getRangeById=function(id){for(var ranges=this.getAllRanges(),i=0;i<ranges.length;i++){var range=ranges[i];if(range.id===id)return range}return null},Manifest.prototype.getRangeByPath=function(path){for(var ranges=this.getAllRanges(),i=0;i<ranges.length;i++){var range=ranges[i];if(range.path===path)return range}return null},Manifest.prototype.getSequences=function(){if(null!=this._sequences)return this._sequences;this._sequences=[];var children=this.__jsonld.mediaSequences||this.__jsonld.sequences;if(children)for(var i=0;i<children.length;i++){var s=children[i],sequence=new Manifesto.Sequence(s,this.options);this._sequences.push(sequence)}return this._sequences},Manifest.prototype.getSequenceByIndex=function(sequenceIndex){return this.getSequences()[sequenceIndex]},Manifest.prototype.getTotalSequences=function(){return this.getSequences().length},Manifest.prototype.getManifestType=function(){var service=this.getService(Manifesto.ServiceProfile.UIEXTENSIONS);return service?new Manifesto.ManifestType(service.getProperty("manifestType")):new Manifesto.ManifestType("")},Manifest.prototype.getTrackingLabel=function(){var service=this.getService(Manifesto.ServiceProfile.TRACKINGEXTENSIONS);return service?service.getProperty("trackingLabel"):""},Manifest.prototype.isMultiSequence=function(){return this.getTotalSequences()>1},Manifest.prototype.isPagingEnabled=function(){return this.getViewingHint().toString()===Manifesto.ViewingHint.PAGED.toString()},Manifest.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?new Manifesto.ViewingDirection(this.getProperty("viewingDirection")):Manifesto.ViewingDirection.LEFTTORIGHT},Manifest.prototype.getViewingHint=function(){return this.getProperty("viewingHint")?new Manifesto.ViewingHint(this.getProperty("viewingHint")):Manifesto.ViewingHint.EMPTY},Manifest}(Manifesto.IIIFResource);Manifesto.Manifest=Manifest}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Collection=function(_super){function Collection(jsonld,options){_super.call(this,jsonld,options),this.members=[],this._collections=null,this._manifests=null,jsonld.__collection=this}return __extends(Collection,_super),Collection.prototype.getCollections=function(){return this._collections?this._collections:this._collections=this.members.en().where(function(m){return m.isCollection()}).toArray()},Collection.prototype.getManifests=function(){return this._manifests?this._manifests:this._manifests=this.members.en().where(function(m){return m.isManifest()}).toArray()},Collection.prototype.getCollectionByIndex=function(collectionIndex){var collection=this.getCollections()[collectionIndex];return collection.options.index=collectionIndex,collection.load()},Collection.prototype.getManifestByIndex=function(manifestIndex){var manifest=this.getManifests()[manifestIndex];return manifest.options.index=manifestIndex,manifest.load()},Collection.prototype.getTotalCollections=function(){return this.getCollections().length},Collection.prototype.getTotalManifests=function(){return this.getManifests().length},Collection.prototype.getTotalMembers=function(){return this.members.length},Collection.prototype.getDefaultTree=function(){return _super.prototype.getDefaultTree.call(this),this.defaultTree.data.type=Manifesto.TreeNodeType.COLLECTION.toString(),this._parseManifests(this),this._parseCollections(this),Manifesto.Utils.generateTreeNodeIds(this.defaultTree),this.defaultTree},Collection.prototype._parseManifests=function(parentCollection){if(parentCollection.getManifests()&&parentCollection.getManifests().length)for(var i=0;i<parentCollection.getManifests().length;i++){var manifest=parentCollection.getManifests()[i],tree=manifest.getDefaultTree();tree.label=manifest.parentLabel||Manifesto.TranslationCollection.getValue(manifest.getLabel(),this.options.locale)||"manifest "+(i+1),tree.navDate=manifest.getNavDate(),tree.data.id=manifest.id,tree.data.type=Manifesto.TreeNodeType.MANIFEST.toString(),parentCollection.defaultTree.addNode(tree)}},Collection.prototype._parseCollections=function(parentCollection){if(parentCollection.getCollections()&&parentCollection.getCollections().length)for(var i=0;i<parentCollection.getCollections().length;i++){var collection=parentCollection.getCollections()[i],tree=collection.getDefaultTree();tree.label=collection.parentLabel||Manifesto.TranslationCollection.getValue(collection.getLabel(),this.options.locale)||"collection "+(i+1),tree.navDate=collection.getNavDate(),tree.data.id=collection.id,tree.data.type=Manifesto.TreeNodeType.COLLECTION.toString(),parentCollection.defaultTree.addNode(tree),this._parseCollections(collection)}},Collection}(Manifesto.IIIFResource);Manifesto.Collection=Collection}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Range=function(_super){function Range(jsonld,options){_super.call(this,jsonld,options),this._canvases=null,this._ranges=null,this.members=[]}return __extends(Range,_super),Range.prototype.getCanvasIds=function(){return this.__jsonld.canvases?this.__jsonld.canvases:[]},Range.prototype.getCanvases=function(){return this._canvases?this._canvases:this._canvases=this.members.en().where(function(m){return m.isCanvas()}).toArray()},Range.prototype.getRanges=function(){return this._ranges?this._ranges:this._ranges=this.members.en().where(function(m){return m.isRange()}).toArray()},Range.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?new Manifesto.ViewingDirection(this.getProperty("viewingDirection")):null},Range.prototype.getViewingHint=function(){return this.getProperty("viewingHint")?new Manifesto.ViewingHint(this.getProperty("viewingHint")):null},Range.prototype.getTree=function(treeRoot){treeRoot.data=this,this.treeNode=treeRoot;var ranges=this.getRanges();if(ranges&&ranges.length)for(var i=0;i<ranges.length;i++){var range=ranges[i],node=new Manifesto.TreeNode;treeRoot.addNode(node),this._parseTreeNode(node,range)}return Manifesto.Utils.generateTreeNodeIds(treeRoot),treeRoot},Range.prototype._parseTreeNode=function(node,range){node.label=Manifesto.TranslationCollection.getValue(range.getLabel(),this.options.locale),node.data=range,node.data.type=Manifesto.TreeNodeType.RANGE.toString(),range.treeNode=node;var ranges=range.getRanges();if(ranges&&ranges.length)for(var i=0;i<ranges.length;i++){var childRange=ranges[i],childNode=new Manifesto.TreeNode;node.addNode(childNode),this._parseTreeNode(childNode,childRange)}},Range}(Manifesto.ManifestResource);Manifesto.Range=Range}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Rendering=function(_super){function Rendering(jsonld,options){_super.call(this,jsonld,options)}return __extends(Rendering,_super),Rendering.prototype.getFormat=function(){return new Manifesto.RenderingFormat(this.getProperty("format"))},Rendering}(Manifesto.ManifestResource);Manifesto.Rendering=Rendering}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},_last=require("lodash.last");!function(Manifesto){var Sequence=function(_super){function Sequence(jsonld,options){_super.call(this,jsonld,options),this.canvases=null}return __extends(Sequence,_super),Sequence.prototype.getCanvases=function(){if(null!=this.canvases)return this.canvases;this.canvases=[];var children=this.__jsonld.elements||this.__jsonld.canvases;if(children)for(var i=0;i<children.length;i++){var c=children[i],canvas=new Manifesto.Canvas(c,this.options);canvas.index=i,this.canvases.push(canvas)}return this.canvases},Sequence.prototype.getCanvasById=function(id){for(var i=0;i<this.getTotalCanvases();i++){var canvas=this.getCanvasByIndex(i);if(canvas.id===id)return canvas}return null},Sequence.prototype.getCanvasByIndex=function(canvasIndex){return this.getCanvases()[canvasIndex]},Sequence.prototype.getCanvasIndexById=function(id){for(var i=0;i<this.getTotalCanvases();i++){var canvas=this.getCanvasByIndex(i);if(canvas.id===id)return i}return null},Sequence.prototype.getCanvasIndexByLabel=function(label,foliated){label=label.trim(),isNaN(label)||(label=parseInt(label,10).toString(),foliated&&(label+="r"));for(var match,regExp,regStr,labelPart1,labelPart2,doublePageRegExp=/(\d*)\D+(\d*)/,i=0;i<this.getTotalCanvases();i++){var canvas=this.getCanvasByIndex(i);if(Manifesto.TranslationCollection.getValue(canvas.getLabel(),this.options.locale)===label)return i;if(match=doublePageRegExp.exec(label),match&&(labelPart1=match[1],labelPart2=match[2],labelPart2&&(regStr="^"+labelPart1+"\\D+"+labelPart2+"$",regExp=new RegExp(regStr),regExp.test(canvas.getLabel()))))return i}return-1},Sequence.prototype.getLastCanvasLabel=function(alphanumeric){for(var i=this.getTotalCanvases()-1;i>=0;i--){var canvas=this.getCanvasByIndex(i),label=Manifesto.TranslationCollection.getValue(canvas.getLabel(),this.options.locale);if(alphanumeric){var regExp=/^[a-zA-Z0-9]*$/;if(regExp.test(label))return label}else if(label)return label}return this.options.defaultLabel},Sequence.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},Sequence.prototype.getNextPageIndex=function(canvasIndex,pagingEnabled){var index;if(pagingEnabled){var indices=this.getPagedIndices(canvasIndex);index=this.getViewingDirection().toString()===Manifesto.ViewingDirection.RIGHTTOLEFT.toString()?indices[0]+1:_last(indices)+1}else index=canvasIndex+1;return index>this.getLastPageIndex()?-1:index},Sequence.prototype.getPagedIndices=function(canvasIndex,pagingEnabled){var indices=[];return pagingEnabled?(indices=this.isFirstCanvas(canvasIndex)||this.isLastCanvas(canvasIndex)?[canvasIndex]:canvasIndex%2?[canvasIndex,canvasIndex+1]:[canvasIndex-1,canvasIndex],this.getViewingDirection().toString()===Manifesto.ViewingDirection.RIGHTTOLEFT.toString()&&(indices=indices.reverse())):indices.push(canvasIndex),indices},Sequence.prototype.getPrevPageIndex=function(canvasIndex,pagingEnabled){var index;if(pagingEnabled){var indices=this.getPagedIndices(canvasIndex);index=this.getViewingDirection().toString()===Manifesto.ViewingDirection.RIGHTTOLEFT.toString()?_last(indices)-1:indices[0]-1}else index=canvasIndex-1;return index},Sequence.prototype.getStartCanvasIndex=function(){var startCanvas=this.getStartCanvas();if(startCanvas)for(var i=0;i<this.getTotalCanvases();i++){var canvas=this.getCanvasByIndex(i);if(canvas.id===startCanvas)return i}return 0},Sequence.prototype.getThumbs=function(width,height){for(var thumbs=[],totalCanvases=this.getTotalCanvases(),i=0;i<totalCanvases;i++){var canvas=this.getCanvasByIndex(i);thumbs.push(new Manifesto.Thumb(width,canvas))}return thumbs},Sequence.prototype.getStartCanvas=function(){return this.getProperty("startCanvas")},Sequence.prototype.getTotalCanvases=function(){return this.getCanvases().length},Sequence.prototype.getViewingDirection=function(){return this.getProperty("viewingDirection")?new Manifesto.ViewingDirection(this.getProperty("viewingDirection")):this.options.resource.getViewingDirection?this.options.resource.getViewingDirection():Manifesto.ViewingDirection.LEFTTORIGHT},Sequence.prototype.getViewingHint=function(){return this.getProperty("viewingHint")?new Manifesto.ViewingHint(this.getProperty("viewingHint")):Manifesto.ViewingHint.EMPTY},Sequence.prototype.isCanvasIndexOutOfRange=function(canvasIndex){return canvasIndex>this.getTotalCanvases()-1},Sequence.prototype.isFirstCanvas=function(canvasIndex){return 0===canvasIndex},Sequence.prototype.isLastCanvas=function(canvasIndex){return canvasIndex===this.getTotalCanvases()-1},Sequence.prototype.isMultiCanvas=function(){return this.getTotalCanvases()>1},Sequence.prototype.isPagingEnabled=function(){return this.getViewingHint().toString()===Manifesto.ViewingHint.PAGED.toString()},Sequence.prototype.isTotalCanvasesEven=function(){return this.getTotalCanvases()%2===0},Sequence}(Manifesto.ManifestResource);Manifesto.Sequence=Sequence}(Manifesto||(Manifesto={}));var Manifesto,_isString=require("lodash.isstring");!function(Manifesto){var Deserialiser=function(){function Deserialiser(){}return Deserialiser.parse=function(manifest,options){return this.parseJson(JSON.parse(manifest),options)},Deserialiser.parseJson=function(json,options){var resource;switch(options&&options.navDate&&!isNaN(options.navDate.getTime())&&(json.navDate=options.navDate.toString()),json["@type"]){case"sc:Collection":resource=this.parseCollection(json,options);break;case"sc:Manifest":resource=this.parseManifest(json,options);break;default:return null}return resource.isLoaded=!0,resource},Deserialiser.parseCollection=function(json,options){var collection=new Manifesto.Collection(json,options);return options?collection.index=options.index||0:collection.index=0,this.parseCollections(collection,options),this.parseManifests(collection,options),this.parseMembers(collection,options),collection},Deserialiser.parseCollections=function(collection,options){var children=collection.__jsonld.collections;if(children)for(var i=0;i<children.length;i++){options&&(options.index=i);var child=this.parseCollection(children[i],options);child.index=i,child.parentCollection=collection,collection.members.push(child)}},Deserialiser.parseManifest=function(json,options){var manifest=new Manifesto.Manifest(json,options);return manifest},Deserialiser.parseManifests=function(collection,options){var children=collection.__jsonld.manifests;if(children)for(var i=0;i<children.length;i++){var child=this.parseManifest(children[i],options);child.index=i,child.parentCollection=collection,collection.members.push(child)}},Deserialiser.parseMember=function(json,options){return"sc:manifest"===json["@type"].toLowerCase()?this.parseManifest(json,options):"sc:collection"===json["@type"].toLowerCase()?this.parseCollection(json,options):void 0},Deserialiser.parseMembers=function(collection,options){var children=collection.__jsonld.members;if(children)for(var i=0;i<children.length;i++){options&&(options.index=i);var child=this.parseMember(children[i],options);collection.members.en().where(function(m){return m.id===child.id}).first()||(child.index=i,child.parentCollection=collection,collection.members.push(child))}},Deserialiser}();Manifesto.Deserialiser=Deserialiser;var Serialiser=function(){function Serialiser(){}return Serialiser.serialise=function(manifest){return""},Serialiser}();Manifesto.Serialiser=Serialiser}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},_endsWith=require("lodash.endswith"),_isArray=require("lodash.isarray");!function(Manifesto){var Service=function(_super){function Service(jsonld,options){_super.call(this,jsonld,options)}return __extends(Service,_super),Service.prototype.getProfile=function(){var profile=this.getProperty("profile");return profile||(profile=this.getProperty("dcterms:conformsTo")),_isArray(profile)?new Manifesto.ServiceProfile(profile[0]):new Manifesto.ServiceProfile(profile)},Service.prototype.getDescription=function(){return Manifesto.Utils.getLocalisedValue(this.getProperty("description"),this.options.locale)},Service.prototype.getInfoUri=function(){var infoUri=this.id;return _endsWith(infoUri,"/")||(infoUri+="/"),infoUri+="info.json"},Service}(Manifesto.ManifestResource);Manifesto.Service=Service}(Manifesto||(Manifesto={}));var Manifesto;!function(Manifesto){var Thumb=function(){function Thumb(width,canvas){this.data=canvas,this.index=canvas.index,this.width=width;var heightRatio=canvas.getHeight()/canvas.getWidth();heightRatio?this.height=Math.floor(this.width*heightRatio):this.height=width,this.uri=canvas.getCanonicalImageUri(width),this.label=Manifesto.TranslationCollection.getValue(canvas.getLabel())}return Thumb}();Manifesto.Thumb=Thumb}(Manifesto||(Manifesto={}));var Manifesto;!function(Manifesto){var TreeNode=function(){function TreeNode(label,data){this.label=label,this.data=data||{},this.nodes=[]}return TreeNode.prototype.addNode=function(node){this.nodes.push(node),node.parentNode=this},TreeNode.prototype.isCollection=function(){return this.data.type===Manifesto.TreeNodeType.COLLECTION.toString()},TreeNode.prototype.isManifest=function(){return this.data.type===Manifesto.TreeNodeType.MANIFEST.toString()},TreeNode.prototype.isRange=function(){return this.data.type===Manifesto.TreeNodeType.RANGE.toString()},TreeNode}();Manifesto.TreeNode=TreeNode}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var TreeNodeType=function(_super){function TreeNodeType(){_super.apply(this,arguments)}return __extends(TreeNodeType,_super),TreeNodeType.prototype.collection=function(){return new TreeNodeType(TreeNodeType.COLLECTION.toString())},TreeNodeType.prototype.manifest=function(){return new TreeNodeType(TreeNodeType.MANIFEST.toString())},TreeNodeType.prototype.range=function(){return new TreeNodeType(TreeNodeType.RANGE.toString())},TreeNodeType.COLLECTION=new TreeNodeType("sc:collection"),TreeNodeType.MANIFEST=new TreeNodeType("sc:manifest"),TreeNodeType.RANGE=new TreeNodeType("sc:range"),TreeNodeType}(Manifesto.StringValue);Manifesto.TreeNodeType=TreeNodeType}(Manifesto||(Manifesto={}));var Manifesto,http=require("http"),https=require("https"),url=require("url");!function(Manifesto){var Utils=function(){function Utils(){}return Utils.getImageQuality=function(profile){var p=profile.toString();return p===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString()||p===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString()||p===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString()||p===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString()||p===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString()||p===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString()||p===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString()||p===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString()||p===Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString()||p===Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString()||p===Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString()||p===Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()?"native":"default"},Utils.getInexactLocale=function(locale){return locale.indexOf("-")!==-1?locale.substr(0,locale.indexOf("-")):locale},Utils.getLocalisedValue=function(resource,locale){if(!_isArray(resource))return resource;for(var i=0;i<resource.length;i++){var value=resource[i],language=value["@language"];if(locale===language)return value["@value"]}for(var match=locale.substr(0,locale.indexOf("-")),i=0;i<resource.length;i++){var value=resource[i],language=value["@language"];if(language===match)return value["@value"]}return null},Utils.generateTreeNodeIds=function(treeNode,index){void 0===index&&(index=0);var id;id=treeNode.parentNode?treeNode.parentNode.id+"-"+index:"0",treeNode.id=id;for(var i=0;i<treeNode.nodes.length;i++){var n=treeNode.nodes[i];Utils.generateTreeNodeIds(n,i)}},Utils.isImageProfile=function(profile){return profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString()},Utils.isLevel0ImageProfile=function(profile){return profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE0.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL0.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL0PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL0.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL0PROFILE.toString()},Utils.isLevel1ImageProfile=function(profile){return profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE1.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL1.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL1PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL1.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL1PROFILE.toString()},Utils.isLevel2ImageProfile=function(profile){return profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECOMPLIANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECOMPLIANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIFIMAGECONFORMANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.STANFORDIIIF1IMAGECONFORMANCE2.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL2.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF1IMAGELEVEL2PROFILE.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL2.toString()||profile.toString()===Manifesto.ServiceProfile.IIIF2IMAGELEVEL2PROFILE.toString()},Utils.loadResource=function(uri){return new Promise(function(resolve,reject){var request,u=url.parse(uri),opts={host:u.hostname,port:u.port,path:u.path,method:"GET",withCredentials:!1};request="https:"===u.protocol?https.request(opts,function(response){var result="";response.on("data",function(chunk){result+=chunk}),response.on("end",function(){resolve(result)})}):http.request(opts,function(response){var result="";response.on("data",function(chunk){result+=chunk}),response.on("end",function(){resolve(result)})}),request.on("error",function(error){reject(error)}),request.end()})},Utils.loadExternalResource=function(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,getStoredAccessToken,handleResourceResponse,options){return new Promise(function(resolve,reject){options&&options.pessimisticAccessControl?resource.getData().then(function(){resource.isAccessControlled()?resource.clickThroughService?resolve(clickThrough(resource)):resource.restrictedService?resolve(restricted(resource)):login(resource).then(function(){getAccessToken(resource,!0).then(function(token){resource.getData(token).then(function(){resolve(handleResourceResponse(resource))})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))}):resolve(resource)})["catch"](function(message){reject(Utils.createInternalServerError(message))}):getStoredAccessToken(resource,tokenStorageStrategy).then(function(storedAccessToken){storedAccessToken?resource.getData(storedAccessToken).then(function(){resource.status===HTTPStatusCode.OK?resolve(handleResourceResponse(resource)):Utils.authorize(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,getStoredAccessToken).then(function(){resolve(handleResourceResponse(resource))})["catch"](function(error){reject(resource.restrictedService?Utils.createRestrictedError():Utils.createAuthorizationFailedError())})})["catch"](function(error){reject(Utils.createAuthorizationFailedError())}):Utils.authorize(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,getStoredAccessToken).then(function(){resolve(handleResourceResponse(resource))})["catch"](function(error){reject(Utils.createAuthorizationFailedError())})})["catch"](function(error){reject(Utils.createAuthorizationFailedError())})})},Utils.createError=function(name,message){var error=new Error;return error.message=message,error.name=name,error},Utils.createAuthorizationFailedError=function(){return Utils.createError(manifesto.StatusCodes.AUTHORIZATION_FAILED.toString(),"Authorization failed")},Utils.createRestrictedError=function(){return Utils.createError(manifesto.StatusCodes.RESTRICTED.toString(),"Restricted")},Utils.createInternalServerError=function(message){return Utils.createError(manifesto.StatusCodes.INTERNAL_SERVER_ERROR.toString(),message)},Utils.loadExternalResources=function(resources,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,getStoredAccessToken,handleResourceResponse,options){return new Promise(function(resolve,reject){var promises=_map(resources,function(resource){return Utils.loadExternalResource(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,getStoredAccessToken,handleResourceResponse,options)});Promise.all(promises).then(function(){resolve(resources)})["catch"](function(error){reject(error)})})},Utils.authorize=function(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,getStoredAccessToken){return new Promise(function(resolve,reject){resource.getData().then(function(){resource.isAccessControlled()?getStoredAccessToken(resource,tokenStorageStrategy).then(function(storedAccessToken){storedAccessToken?resource.getData(storedAccessToken).then(function(){resource.status===HTTPStatusCode.OK?resolve(resource):Utils.showAuthInteraction(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,resolve,reject)})["catch"](function(message){reject(Utils.createInternalServerError(message))}):getAccessToken(resource,!1).then(function(accessToken){accessToken?storeAccessToken(resource,accessToken,tokenStorageStrategy).then(function(){resource.getData(accessToken).then(function(){resource.status===HTTPStatusCode.OK?resolve(resource):Utils.showAuthInteraction(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,resolve,reject)})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))}):Utils.showAuthInteraction(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,resolve,reject)})})["catch"](function(message){reject(Utils.createInternalServerError(message))}):resolve(resource)})})},Utils.showAuthInteraction=function(resource,tokenStorageStrategy,clickThrough,restricted,login,getAccessToken,storeAccessToken,resolve,reject){resource.status!==HTTPStatusCode.MOVED_TEMPORARILY||resource.isResponseHandled?resource.restrictedService?resolve(restricted(resource)):resource.clickThroughService&&!resource.isResponseHandled?clickThrough(resource).then(function(){getAccessToken(resource,!0).then(function(accessToken){storeAccessToken(resource,accessToken,tokenStorageStrategy).then(function(){resource.getData(accessToken).then(function(){resolve(resource)})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))})}):login(resource).then(function(){getAccessToken(resource,!0).then(function(accessToken){storeAccessToken(resource,accessToken,tokenStorageStrategy).then(function(){resource.getData(accessToken).then(function(){resolve(resource)})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))})})["catch"](function(message){reject(Utils.createInternalServerError(message))})}):resolve(resource)},Utils.getService=function(resource,profile){var services=this.getServices(resource);"string"!=typeof profile&&(profile=profile.toString());for(var i=0;i<services.length;i++){var service=services[i];if(service.getProfile().toString()===profile)return service}return null},Utils.getResourceById=function(parentResource,id){return[parentResource.__jsonld].en().traverseUnique(function(x){return Utils.getAllArrays(x);
5
+ }).first(function(r){return r["@id"]===id})},Utils.getAllArrays=function(obj){var all=[].en();if(!obj)return all;for(var key in obj){var val=obj[key];_isArray(val)&&(all=all.concat(val))}return all},Utils.getServices=function(resource){var service;service=resource.__jsonld?resource.__jsonld.service:resource.service;var services=[];if(!service)return services;_isArray(service)||(service=[service]);for(var i=0;i<service.length;i++){var s=service[i];if(_isString(s)){var r=this.getResourceById(resource.options.resource,s);r&&services.push(new Manifesto.Service(r.__jsonld||r,resource.options))}else services.push(new Manifesto.Service(s,resource.options))}return services},Utils}();Manifesto.Utils=Utils}(Manifesto||(Manifesto={}));var Manifesto;!function(Manifesto){var MetadataItem=function(){function MetadataItem(defaultLocale){this.defaultLocale=defaultLocale}return MetadataItem.prototype.parse=function(resource){this.resource=resource,this.label=Manifesto.TranslationCollection.parse(this.resource.label,this.defaultLocale),this.value=Manifesto.TranslationCollection.parse(this.resource.value,this.defaultLocale)},MetadataItem.prototype.getLabel=function(){return this.label?Manifesto.TranslationCollection.getValue(this.label,this.defaultLocale):null},MetadataItem.prototype.setLabel=function(value){var _this=this;if(this.label&&this.label.length){var t=this.label.en().where(function(x){return x.locale===_this.defaultLocale||x.locale===Manifesto.Utils.getInexactLocale(_this.defaultLocale)}).first();t&&(t.value=value)}},MetadataItem.prototype.getValue=function(){if(this.value){var locale=this.defaultLocale;return this.label.length&&this.label[0].locale&&(locale=this.label[0].locale),Manifesto.TranslationCollection.getValue(this.value,locale)}return null},MetadataItem.prototype.setValue=function(value){var _this=this;if(this.value&&this.value.length){var t=this.value.en().where(function(x){return x.locale===_this.defaultLocale||x.locale===Manifesto.Utils.getInexactLocale(_this.defaultLocale)}).first();t&&(t.value=value)}},MetadataItem}();Manifesto.MetadataItem=MetadataItem}(Manifesto||(Manifesto={}));var Manifesto;!function(Manifesto){var Translation=function(){function Translation(value,locale){this.value=value,this.locale=locale}return Translation}();Manifesto.Translation=Translation}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var TranslationCollection=function(_super){function TranslationCollection(){_super.apply(this,arguments)}return __extends(TranslationCollection,_super),TranslationCollection.parse=function(translation,defaultLocale){var t,tc=[];if(!translation)return tc;if(!_isArray(translation))return _isString(translation)?(t=new Manifesto.Translation(translation,defaultLocale),tc.push(t),tc):(t=new Manifesto.Translation(translation["@value"],translation["@language"]||defaultLocale),tc.push(t),tc);for(var i=0;i<translation.length;i++){var value=translation[i];t=_isString(value)?new Manifesto.Translation(value,defaultLocale):new Manifesto.Translation(value["@value"],value["@language"]||defaultLocale),tc.push(t)}return tc},TranslationCollection.getValue=function(translationCollection,locale){if(translationCollection.length){if(locale){var translation=translationCollection.en().where(function(t){return t.locale===locale||Manifesto.Utils.getInexactLocale(t.locale)===Manifesto.Utils.getInexactLocale(locale)}).first();if(translation)return translation.value}return translationCollection[0].value}return null},TranslationCollection}(Array);Manifesto.TranslationCollection=TranslationCollection}(Manifesto||(Manifesto={})),global.manifesto=global.Manifesto=module.exports={AnnotationMotivation:new Manifesto.AnnotationMotivation,ElementType:new Manifesto.ElementType,IIIFResourceType:new Manifesto.IIIFResourceType,ManifestType:new Manifesto.ManifestType,MetadataItem:Manifesto.MetadataItem,RenderingFormat:new Manifesto.RenderingFormat,ResourceFormat:new Manifesto.ResourceFormat,ResourceType:new Manifesto.ResourceType,ServiceProfile:new Manifesto.ServiceProfile,Translation:Manifesto.Translation,TranslationCollection:Manifesto.TranslationCollection,TreeNode:Manifesto.TreeNode,TreeNodeType:new Manifesto.TreeNodeType,Utils:Manifesto.Utils,ViewingDirection:new Manifesto.ViewingDirection,ViewingHint:new Manifesto.ViewingHint,StatusCodes:{AUTHORIZATION_FAILED:1,FORBIDDEN:2,INTERNAL_SERVER_ERROR:3,RESTRICTED:4},create:function(manifest,options){return Manifesto.Deserialiser.parse(manifest,options)},loadManifest:function(uri){return Manifesto.Utils.loadResource(uri)}};var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Annotation=function(_super){function Annotation(jsonld,options){_super.call(this,jsonld,options)}return __extends(Annotation,_super),Annotation.prototype.getMotivation=function(){var motivation=this.getProperty("motivation");return motivation?new Manifesto.AnnotationMotivation(motivation.toLowerCase()):null},Annotation.prototype.getOn=function(){return this.getProperty("on")},Annotation.prototype.getResource=function(){return new Manifesto.Resource(this.getProperty("resource"),this.options)},Annotation}(Manifesto.ManifestResource);Manifesto.Annotation=Annotation}(Manifesto||(Manifesto={}));var Manifesto,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifesto){var Resource=function(_super){function Resource(jsonld,options){_super.call(this,jsonld,options)}return __extends(Resource,_super),Resource.prototype.getFormat=function(){var format=this.getProperty("format");return format?new Manifesto.ResourceFormat(format.toLowerCase()):null},Resource.prototype.getType=function(){var type=this.getProperty("@type");return type?new Manifesto.ResourceType(type.toLowerCase()):null},Resource.prototype.getWidth=function(){return this.getProperty("width")},Resource.prototype.getHeight=function(){return this.getProperty("height")},Resource.prototype.getMaxWidth=function(){return this.getProperty("maxWidth")},Resource.prototype.getMaxHeight=function(){var maxHeight=this.getProperty("maxHeight");if(!maxHeight)return this.getMaxWidth()},Resource}(Manifesto.ManifestResource);Manifesto.Resource=Resource}(Manifesto||(Manifesto={}))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{http:49,https:9,"lodash.assign":25,"lodash.endswith":26,"lodash.isarray":28,"lodash.isstring":29,"lodash.last":32,"lodash.map":33,url:55}],2:[function(require,module,exports){"use strict";function placeHoldersCount(b64){var len=b64.length;if(len%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===b64[len-2]?2:"="===b64[len-1]?1:0}function byteLength(b64){return 3*b64.length/4-placeHoldersCount(b64)}function toByteArray(b64){var i,j,l,tmp,placeHolders,arr,len=b64.length;placeHolders=placeHoldersCount(b64),arr=new Arr(3*len/4-placeHolders),l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i<l;i+=4,j+=3)tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)],arr[L++]=tmp>>16&255,arr[L++]=tmp>>8&255,arr[L++]=255&tmp;return 2===placeHolders?(tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4,arr[L++]=255&tmp):1===placeHolders&&(tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2,arr[L++]=tmp>>8&255,arr[L++]=255&tmp),arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[63&num]}function encodeChunk(uint8,start,end){for(var tmp,output=[],i=start;i<end;i+=3)tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2],output.push(tripletToBase64(tmp));return output.join("")}function fromByteArray(uint8){for(var tmp,len=uint8.length,extraBytes=len%3,output="",parts=[],maxChunkLength=16383,i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength)parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength));return 1===extraBytes?(tmp=uint8[len-1],output+=lookup[tmp>>2],output+=lookup[tmp<<4&63],output+="=="):2===extraBytes&&(tmp=(uint8[len-2]<<8)+uint8[len-1],output+=lookup[tmp>>10],output+=lookup[tmp>>4&63],output+=lookup[tmp<<2&63],output+="="),parts.push(output),parts.join("")}exports.byteLength=byteLength,exports.toByteArray=toByteArray,exports.fromByteArray=fromByteArray;for(var lookup=[],revLookup=[],Arr="undefined"!=typeof Uint8Array?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,len=code.length;i<len;++i)lookup[i]=code[i],revLookup[code.charCodeAt(i)]=i;revLookup["-".charCodeAt(0)]=62,revLookup["_".charCodeAt(0)]=63},{}],3:[function(require,module,exports){},{}],4:[function(require,module,exports){(function(global){"use strict";var buffer=require("buffer"),Buffer=buffer.Buffer,SlowBuffer=buffer.SlowBuffer,MAX_LEN=buffer.kMaxLength||2147483647;exports.alloc=function(size,fill,encoding){if("function"==typeof Buffer.alloc)return Buffer.alloc(size,fill,encoding);if("number"==typeof encoding)throw new TypeError("encoding must not be number");if("number"!=typeof size)throw new TypeError("size must be a number");if(size>MAX_LEN)throw new RangeError("size is too large");var enc=encoding,_fill=fill;void 0===_fill&&(enc=void 0,_fill=0);var buf=new Buffer(size);if("string"==typeof _fill)for(var fillBuf=new Buffer(_fill,enc),flen=fillBuf.length,i=-1;++i<size;)buf[i]=fillBuf[i%flen];else buf.fill(_fill);return buf},exports.allocUnsafe=function(size){if("function"==typeof Buffer.allocUnsafe)return Buffer.allocUnsafe(size);if("number"!=typeof size)throw new TypeError("size must be a number");if(size>MAX_LEN)throw new RangeError("size is too large");return new Buffer(size)},exports.from=function(value,encodingOrOffset,length){if("function"==typeof Buffer.from&&(!global.Uint8Array||Uint8Array.from!==Buffer.from))return Buffer.from(value,encodingOrOffset,length);if("number"==typeof value)throw new TypeError('"value" argument must not be a number');if("string"==typeof value)return new Buffer(value,encodingOrOffset);if("undefined"!=typeof ArrayBuffer&&value instanceof ArrayBuffer){var offset=encodingOrOffset;if(1===arguments.length)return new Buffer(value);"undefined"==typeof offset&&(offset=0);var len=length;if("undefined"==typeof len&&(len=value.byteLength-offset),offset>=value.byteLength)throw new RangeError("'offset' is out of bounds");if(len>value.byteLength-offset)throw new RangeError("'length' is out of bounds");return new Buffer(value.slice(offset,offset+len))}if(Buffer.isBuffer(value)){var out=new Buffer(value.length);return value.copy(out,0,0,value.length),out}if(value){if(Array.isArray(value)||"undefined"!=typeof ArrayBuffer&&value.buffer instanceof ArrayBuffer||"length"in value)return new Buffer(value);if("Buffer"===value.type&&Array.isArray(value.data))return new Buffer(value.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},exports.allocUnsafeSlow=function(size){if("function"==typeof Buffer.allocUnsafeSlow)return Buffer.allocUnsafeSlow(size);if("number"!=typeof size)throw new TypeError("size must be a number");if(size>=MAX_LEN)throw new RangeError("size is too large");return new SlowBuffer(size)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:5}],5:[function(require,module,exports){(function(global){"use strict";function typedArraySupport(){try{var arr=new Uint8Array(1);return arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===arr.foo()&&"function"==typeof arr.subarray&&0===arr.subarray(1,1).byteLength}catch(e){return!1}}function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()<length)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(that=new Uint8Array(length),that.__proto__=Buffer.prototype):(null===that&&(that=new Buffer(length)),that.length=length),that}function Buffer(arg,encodingOrOffset,length){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(arg,encodingOrOffset,length);if("number"==typeof arg){if("string"==typeof encodingOrOffset)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,arg)}return from(this,arg,encodingOrOffset,length)}function from(that,value,encodingOrOffset,length){if("number"==typeof value)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&value instanceof ArrayBuffer?fromArrayBuffer(that,value,encodingOrOffset,length):"string"==typeof value?fromString(that,value,encodingOrOffset):fromObject(that,value)}function assertSize(size){if("number"!=typeof size)throw new TypeError('"size" argument must be a number');if(size<0)throw new RangeError('"size" argument must not be negative')}function alloc(that,size,fill,encoding){return assertSize(size),size<=0?createBuffer(that,size):void 0!==fill?"string"==typeof encoding?createBuffer(that,size).fill(fill,encoding):createBuffer(that,size).fill(fill):createBuffer(that,size)}function allocUnsafe(that,size){if(assertSize(size),that=createBuffer(that,size<0?0:0|checked(size)),!Buffer.TYPED_ARRAY_SUPPORT)for(var i=0;i<size;++i)that[i]=0;return that}function fromString(that,string,encoding){if("string"==typeof encoding&&""!==encoding||(encoding="utf8"),!Buffer.isEncoding(encoding))throw new TypeError('"encoding" must be a valid string encoding');var length=0|byteLength(string,encoding);that=createBuffer(that,length);var actual=that.write(string,encoding);return actual!==length&&(that=that.slice(0,actual)),that}function fromArrayLike(that,array){var length=array.length<0?0:0|checked(array.length);that=createBuffer(that,length);for(var i=0;i<length;i+=1)that[i]=255&array[i];return that}function fromArrayBuffer(that,array,byteOffset,length){if(array.byteLength,byteOffset<0||array.byteLength<byteOffset)throw new RangeError("'offset' is out of bounds");if(array.byteLength<byteOffset+(length||0))throw new RangeError("'length' is out of bounds");return array=void 0===byteOffset&&void 0===length?new Uint8Array(array):void 0===length?new Uint8Array(array,byteOffset):new Uint8Array(array,byteOffset,length),Buffer.TYPED_ARRAY_SUPPORT?(that=array,that.__proto__=Buffer.prototype):that=fromArrayLike(that,array),that}function fromObject(that,obj){if(Buffer.isBuffer(obj)){var len=0|checked(obj.length);return that=createBuffer(that,len),0===that.length?that:(obj.copy(that,0,0,len),that)}if(obj){if("undefined"!=typeof ArrayBuffer&&obj.buffer instanceof ArrayBuffer||"length"in obj)return"number"!=typeof obj.length||isnan(obj.length)?createBuffer(that,0):fromArrayLike(that,obj);if("Buffer"===obj.type&&isArray(obj.data))return fromArrayLike(that,obj.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|length}function SlowBuffer(length){return+length!=length&&(length=0),Buffer.alloc(+length)}function byteLength(string,encoding){if(Buffer.isBuffer(string))return string.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(string)||string instanceof ArrayBuffer))return string.byteLength;"string"!=typeof string&&(string=""+string);var len=string.length;if(0===len)return 0;for(var loweredCase=!1;;)switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case void 0:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*len;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase(),loweredCase=!0}}function slowToString(encoding,start,end){var loweredCase=!1;if((void 0===start||start<0)&&(start=0),start>this.length)return"";if((void 0===end||end>this.length)&&(end=this.length),end<=0)return"";if(end>>>=0,start>>>=0,end<=start)return"";for(encoding||(encoding="utf8");;)switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase(),loweredCase=!0}}function swap(b,n,m){var i=b[n];b[n]=b[m],b[m]=i}function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(0===buffer.length)return-1;if("string"==typeof byteOffset?(encoding=byteOffset,byteOffset=0):byteOffset>2147483647?byteOffset=2147483647:byteOffset<-2147483648&&(byteOffset=-2147483648),byteOffset=+byteOffset,isNaN(byteOffset)&&(byteOffset=dir?0:buffer.length-1),byteOffset<0&&(byteOffset=buffer.length+byteOffset),byteOffset>=buffer.length){if(dir)return-1;byteOffset=buffer.length-1}else if(byteOffset<0){if(!dir)return-1;byteOffset=0}if("string"==typeof val&&(val=Buffer.from(val,encoding)),Buffer.isBuffer(val))return 0===val.length?-1:arrayIndexOf(buffer,val,byteOffset,encoding,dir);if("number"==typeof val)return val=255&val,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?dir?Uint8Array.prototype.indexOf.call(buffer,val,byteOffset):Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset):arrayIndexOf(buffer,[val],byteOffset,encoding,dir);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){function read(buf,i){return 1===indexSize?buf[i]:buf.readUInt16BE(i*indexSize)}var indexSize=1,arrLength=arr.length,valLength=val.length;if(void 0!==encoding&&(encoding=String(encoding).toLowerCase(),"ucs2"===encoding||"ucs-2"===encoding||"utf16le"===encoding||"utf-16le"===encoding)){if(arr.length<2||val.length<2)return-1;indexSize=2,arrLength/=2,valLength/=2,byteOffset/=2}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++)if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1&&(foundIndex=i),i-foundIndex+1===valLength)return foundIndex*indexSize}else foundIndex!==-1&&(i-=i-foundIndex),foundIndex=-1}else for(byteOffset+valLength>arrLength&&(byteOffset=arrLength-valLength),i=byteOffset;i>=0;i--){for(var found=!0,j=0;j<valLength;j++)if(read(arr,i+j)!==read(val,j)){found=!1;break}if(found)return i}return-1}function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;length?(length=Number(length),length>remaining&&(length=remaining)):length=remaining;var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");length>strLen/2&&(length=strLen/2);for(var i=0;i<length;++i){var parsed=parseInt(string.substr(2*i,2),16);if(isNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}function base64Slice(buf,start,end){return 0===start&&end===buf.length?base64.fromByteArray(buf):base64.fromByteArray(buf.slice(start,end))}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);for(var res=[],i=start;i<end;){var firstByte=buf[i],codePoint=null,bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:firstByte<128&&(codePoint=firstByte);break;case 2:secondByte=buf[i+1],128===(192&secondByte)&&(tempCodePoint=(31&firstByte)<<6|63&secondByte,tempCodePoint>127&&(codePoint=tempCodePoint));break;case 3:secondByte=buf[i+1],thirdByte=buf[i+2],128===(192&secondByte)&&128===(192&thirdByte)&&(tempCodePoint=(15&firstByte)<<12|(63&secondByte)<<6|63&thirdByte,tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)&&(codePoint=tempCodePoint));break;case 4:secondByte=buf[i+1],thirdByte=buf[i+2],fourthByte=buf[i+3],128===(192&secondByte)&&128===(192&thirdByte)&&128===(192&fourthByte)&&(tempCodePoint=(15&firstByte)<<18|(63&secondByte)<<12|(63&thirdByte)<<6|63&fourthByte,tempCodePoint>65535&&tempCodePoint<1114112&&(codePoint=tempCodePoint))}}null===codePoint?(codePoint=65533,bytesPerSequence=1):codePoint>65535&&(codePoint-=65536,res.push(codePoint>>>10&1023|55296),codePoint=56320|1023&codePoint),res.push(codePoint),i+=bytesPerSequence}return decodeCodePointsArray(res)}function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH)return String.fromCharCode.apply(String,codePoints);for(var res="",i=0;i<len;)res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH));return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(127&buf[i]);return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i)ret+=String.fromCharCode(buf[i]);return ret}function hexSlice(buf,start,end){var len=buf.length;(!start||start<0)&&(start=0),(!end||end<0||end>len)&&(end=len);for(var out="",i=start;i<end;++i)out+=toHex(buf[i]);return out}function utf16leSlice(buf,start,end){for(var bytes=buf.slice(start,end),res="",i=0;i<bytes.length;i+=2)res+=String.fromCharCode(bytes[i]+256*bytes[i+1]);return res}function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}function objectWriteUInt16(buf,value,offset,littleEndian){value<0&&(value=65535+value+1);for(var i=0,j=Math.min(buf.length-offset,2);i<j;++i)buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>8*(littleEndian?i:1-i)}function objectWriteUInt32(buf,value,offset,littleEndian){value<0&&(value=4294967295+value+1);for(var i=0,j=Math.min(buf.length-offset,4);i<j;++i)buf[offset+i]=value>>>8*(littleEndian?i:3-i)&255}function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38),ieee754.write(buf,value,offset,littleEndian,23,4),offset+4}function writeDouble(buf,value,offset,littleEndian,noAssert){return noAssert||checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308),ieee754.write(buf,value,offset,littleEndian,52,8),offset+8}function base64clean(str){if(str=stringtrim(str).replace(INVALID_BASE64_RE,""),str.length<2)return"";for(;str.length%4!==0;)str+="=";return str}function stringtrim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function toHex(n){return n<16?"0"+n.toString(16):n.toString(16)}function utf8ToBytes(string,units){units=units||1/0;for(var codePoint,length=string.length,leadSurrogate=null,bytes=[],i=0;i<length;++i){if(codePoint=string.charCodeAt(i),codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){(units-=3)>-1&&bytes.push(239,191,189);continue}if(i+1===length){(units-=3)>-1&&bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){(units-=3)>-1&&bytes.push(239,191,189),leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else leadSurrogate&&(units-=3)>-1&&bytes.push(239,191,189);if(leadSurrogate=null,codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,63&codePoint|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,63&codePoint|128)}else{if(!(codePoint<1114112))throw new Error("Invalid code point");if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,63&codePoint|128)}}return bytes}function asciiToBytes(str){for(var byteArray=[],i=0;i<str.length;++i)byteArray.push(255&str.charCodeAt(i));return byteArray}function utf16leToBytes(str,units){for(var c,hi,lo,byteArray=[],i=0;i<str.length&&!((units-=2)<0);++i)c=str.charCodeAt(i),hi=c>>8,lo=c%256,byteArray.push(lo),byteArray.push(hi);return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length&&!(i+offset>=dst.length||i>=src.length);++i)dst[i+offset]=src[i];return i}function isnan(val){return val!==val}var base64=require("base64-js"),ieee754=require("ieee754"),isArray=require("isarray");exports.Buffer=Buffer,exports.SlowBuffer=SlowBuffer,exports.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==global.TYPED_ARRAY_SUPPORT?global.TYPED_ARRAY_SUPPORT:typedArraySupport(),exports.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(arr){return arr.__proto__=Buffer.prototype,arr},Buffer.from=function(value,encodingOrOffset,length){return from(null,value,encodingOrOffset,length)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(size,fill,encoding){return alloc(null,size,fill,encoding)},Buffer.allocUnsafe=function(size){return allocUnsafe(null,size)},Buffer.allocUnsafeSlow=function(size){return allocUnsafe(null,size)},Buffer.isBuffer=function(b){return!(null==b||!b._isBuffer)},Buffer.compare=function(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var x=a.length,y=b.length,i=0,len=Math.min(x,y);i<len;++i)if(a[i]!==b[i]){x=a[i],y=b[i];break}return x<y?-1:y<x?1:0},Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function(list,length){if(!isArray(list))throw new TypeError('"list" argument must be an Array of Buffers');if(0===list.length)return Buffer.alloc(0);var i;if(void 0===length)for(length=0,i=0;i<list.length;++i)length+=list[i].length;var buffer=Buffer.allocUnsafe(length),pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf))throw new TypeError('"list" argument must be an Array of Buffers');buf.copy(buffer,pos),pos+=buf.length}return buffer},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function(){var len=this.length;if(len%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<len;i+=2)swap(this,i,i+1);return this},Buffer.prototype.swap32=function(){var len=this.length;if(len%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<len;i+=4)swap(this,i,i+3),swap(this,i+1,i+2);return this},Buffer.prototype.swap64=function(){var len=this.length;if(len%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<len;i+=8)swap(this,i,i+7),swap(this,i+1,i+6),swap(this,i+2,i+5),swap(this,i+3,i+4);return this},Buffer.prototype.toString=function(){var length=0|this.length;return 0===length?"":0===arguments.length?utf8Slice(this,0,length):slowToString.apply(this,arguments)},Buffer.prototype.equals=function(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");return this===b||0===Buffer.compare(this,b)},Buffer.prototype.inspect=function(){var str="",max=exports.INSPECT_MAX_BYTES;return this.length>0&&(str=this.toString("hex",0,max).match(/.{2}/g).join(" "),this.length>max&&(str+=" ... ")),"<Buffer "+str+">"},Buffer.prototype.compare=function(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target))throw new TypeError("Argument must be a Buffer");if(void 0===start&&(start=0),void 0===end&&(end=target?target.length:0),void 0===thisStart&&(thisStart=0),void 0===thisEnd&&(thisEnd=this.length),start<0||end>target.length||thisStart<0||thisEnd>this.length)throw new RangeError("out of range index");if(thisStart>=thisEnd&&start>=end)return 0;if(thisStart>=thisEnd)return-1;if(start>=end)return 1;if(start>>>=0,end>>>=0,thisStart>>>=0,thisEnd>>>=0,this===target)return 0;for(var x=thisEnd-thisStart,y=end-start,len=Math.min(x,y),thisCopy=this.slice(thisStart,thisEnd),targetCopy=target.slice(start,end),i=0;i<len;++i)if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i],y=targetCopy[i];break}return x<y?-1:y<x?1:0},Buffer.prototype.includes=function(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1},Buffer.prototype.indexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!0)},Buffer.prototype.lastIndexOf=function(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,!1)},Buffer.prototype.write=function(string,offset,length,encoding){if(void 0===offset)encoding="utf8",length=this.length,offset=0;else if(void 0===length&&"string"==typeof offset)encoding=offset,length=this.length,offset=0;else{if(!isFinite(offset))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");offset=0|offset,isFinite(length)?(length=0|length,void 0===encoding&&(encoding="utf8")):(encoding=length,length=void 0)}var remaining=this.length-offset;if((void 0===length||length>remaining)&&(length=remaining),string.length>0&&(length<0||offset<0)||offset>this.length)throw new RangeError("Attempt to write outside buffer bounds");encoding||(encoding="utf8");for(var loweredCase=!1;;)switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase(),loweredCase=!0}},Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var MAX_ARGUMENTS_LENGTH=4096;Buffer.prototype.slice=function(start,end){var len=this.length;start=~~start,end=void 0===end?len:~~end,start<0?(start+=len,start<0&&(start=0)):start>len&&(start=len),end<0?(end+=len,end<0&&(end=0)):end>len&&(end=len),end<start&&(end=start);var newBuf;if(Buffer.TYPED_ARRAY_SUPPORT)newBuf=this.subarray(start,end),newBuf.__proto__=Buffer.prototype;else{
6
+ var sliceLen=end-start;newBuf=new Buffer(sliceLen,(void 0));for(var i=0;i<sliceLen;++i)newBuf[i]=this[i+start]}return newBuf},Buffer.prototype.readUIntLE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return val},Buffer.prototype.readUIntBE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset+--byteLength],mul=1;byteLength>0&&(mul*=256);)val+=this[offset+--byteLength]*mul;return val},Buffer.prototype.readUInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),this[offset]},Buffer.prototype.readUInt16LE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]|this[offset+1]<<8},Buffer.prototype.readUInt16BE=function(offset,noAssert){return noAssert||checkOffset(offset,2,this.length),this[offset]<<8|this[offset+1]},Buffer.prototype.readUInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+16777216*this[offset+3]},Buffer.prototype.readUInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),16777216*this[offset]+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])},Buffer.prototype.readIntLE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var val=this[offset],mul=1,i=0;++i<byteLength&&(mul*=256);)val+=this[offset+i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readIntBE=function(offset,byteLength,noAssert){offset=0|offset,byteLength=0|byteLength,noAssert||checkOffset(offset,byteLength,this.length);for(var i=byteLength,mul=1,val=this[offset+--i];i>0&&(mul*=256);)val+=this[offset+--i]*mul;return mul*=128,val>=mul&&(val-=Math.pow(2,8*byteLength)),val},Buffer.prototype.readInt8=function(offset,noAssert){return noAssert||checkOffset(offset,1,this.length),128&this[offset]?(255-this[offset]+1)*-1:this[offset]},Buffer.prototype.readInt16LE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt16BE=function(offset,noAssert){noAssert||checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return 32768&val?4294901760|val:val},Buffer.prototype.readInt32LE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24},Buffer.prototype.readInt32BE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]},Buffer.prototype.readFloatLE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!0,23,4)},Buffer.prototype.readFloatBE=function(offset,noAssert){return noAssert||checkOffset(offset,4,this.length),ieee754.read(this,offset,!1,23,4)},Buffer.prototype.readDoubleLE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!0,52,8)},Buffer.prototype.readDoubleBE=function(offset,noAssert){return noAssert||checkOffset(offset,8,this.length),ieee754.read(this,offset,!1,52,8)},Buffer.prototype.writeUIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,byteLength=0|byteLength,!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1,i=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,byteLength=0|byteLength,!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1,mul=1;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)this[offset+i]=value/mul&255;return offset+byteLength},Buffer.prototype.writeUInt8=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),this[offset]=255&value,offset+1},Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset+3]=value>>>24,this[offset+2]=value>>>16,this[offset+1]=value>>>8,this[offset]=255&value):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeIntLE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0,mul=1,sub=0;for(this[offset]=255&value;++i<byteLength&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i-1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeIntBE=function(value,offset,byteLength,noAssert){if(value=+value,offset=0|offset,!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1,mul=1,sub=0;for(this[offset+i]=255&value;--i>=0&&(mul*=256);)value<0&&0===sub&&0!==this[offset+i+1]&&(sub=1),this[offset+i]=(value/mul>>0)-sub&255;return offset+byteLength},Buffer.prototype.writeInt8=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(value=Math.floor(value)),value<0&&(value=255+value+1),this[offset]=255&value,offset+1},Buffer.prototype.writeInt16LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8):objectWriteUInt16(this,value,offset,!0),offset+2},Buffer.prototype.writeInt16BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>8,this[offset+1]=255&value):objectWriteUInt16(this,value,offset,!1),offset+2},Buffer.prototype.writeInt32LE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=255&value,this[offset+1]=value>>>8,this[offset+2]=value>>>16,this[offset+3]=value>>>24):objectWriteUInt32(this,value,offset,!0),offset+4},Buffer.prototype.writeInt32BE=function(value,offset,noAssert){return value=+value,offset=0|offset,noAssert||checkInt(this,value,offset,4,2147483647,-2147483648),value<0&&(value=4294967295+value+1),Buffer.TYPED_ARRAY_SUPPORT?(this[offset]=value>>>24,this[offset+1]=value>>>16,this[offset+2]=value>>>8,this[offset+3]=255&value):objectWriteUInt32(this,value,offset,!1),offset+4},Buffer.prototype.writeFloatLE=function(value,offset,noAssert){return writeFloat(this,value,offset,!0,noAssert)},Buffer.prototype.writeFloatBE=function(value,offset,noAssert){return writeFloat(this,value,offset,!1,noAssert)},Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){return writeDouble(this,value,offset,!0,noAssert)},Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){return writeDouble(this,value,offset,!1,noAssert)},Buffer.prototype.copy=function(target,targetStart,start,end){if(start||(start=0),end||0===end||(end=this.length),targetStart>=target.length&&(targetStart=target.length),targetStart||(targetStart=0),end>0&&end<start&&(end=start),end===start)return 0;if(0===target.length||0===this.length)return 0;if(targetStart<0)throw new RangeError("targetStart out of bounds");if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");end>this.length&&(end=this.length),target.length-targetStart<end-start&&(end=target.length-targetStart+start);var i,len=end-start;if(this===target&&start<targetStart&&targetStart<end)for(i=len-1;i>=0;--i)target[i+targetStart]=this[i+start];else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(i=0;i<len;++i)target[i+targetStart]=this[i+start];else Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart);return len},Buffer.prototype.fill=function(val,start,end,encoding){if("string"==typeof val){if("string"==typeof start?(encoding=start,start=0,end=this.length):"string"==typeof end&&(encoding=end,end=this.length),1===val.length){var code=val.charCodeAt(0);code<256&&(val=code)}if(void 0!==encoding&&"string"!=typeof encoding)throw new TypeError("encoding must be a string");if("string"==typeof encoding&&!Buffer.isEncoding(encoding))throw new TypeError("Unknown encoding: "+encoding)}else"number"==typeof val&&(val=255&val);if(start<0||this.length<start||this.length<end)throw new RangeError("Out of range index");if(end<=start)return this;start>>>=0,end=void 0===end?this.length:end>>>0,val||(val=0);var i;if("number"==typeof val)for(i=start;i<end;++i)this[i]=val;else{var bytes=Buffer.isBuffer(val)?val:utf8ToBytes(new Buffer(val,encoding).toString()),len=bytes.length;for(i=0;i<end-start;++i)this[i+start]=bytes[i%len]}return this};var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":2,ieee754:10,isarray:13}],6:[function(require,module,exports){module.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],7:[function(require,module,exports){(function(Buffer){function isArray(arg){return Array.isArray?Array.isArray(arg):"[object Array]"===objectToString(arg)}function isBoolean(arg){return"boolean"==typeof arg}function isNull(arg){return null===arg}function isNullOrUndefined(arg){return null==arg}function isNumber(arg){return"number"==typeof arg}function isString(arg){return"string"==typeof arg}function isSymbol(arg){return"symbol"==typeof arg}function isUndefined(arg){return void 0===arg}function isRegExp(re){return"[object RegExp]"===objectToString(re)}function isObject(arg){return"object"==typeof arg&&null!==arg}function isDate(d){return"[object Date]"===objectToString(d)}function isError(e){return"[object Error]"===objectToString(e)||e instanceof Error}function isFunction(arg){return"function"==typeof arg}function isPrimitive(arg){return null===arg||"boolean"==typeof arg||"number"==typeof arg||"string"==typeof arg||"symbol"==typeof arg||"undefined"==typeof arg}function objectToString(o){return Object.prototype.toString.call(o)}exports.isArray=isArray,exports.isBoolean=isBoolean,exports.isNull=isNull,exports.isNullOrUndefined=isNullOrUndefined,exports.isNumber=isNumber,exports.isString=isString,exports.isSymbol=isSymbol,exports.isUndefined=isUndefined,exports.isRegExp=isRegExp,exports.isObject=isObject,exports.isDate=isDate,exports.isError=isError,exports.isFunction=isFunction,exports.isPrimitive=isPrimitive,exports.isBuffer=Buffer.isBuffer}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":12}],8:[function(require,module,exports){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return"function"==typeof arg}function isNumber(arg){return"number"==typeof arg}function isObject(arg){return"object"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),"error"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length)){if(er=arguments[1],er instanceof Error)throw er;var err=new Error('Uncaught, unspecified "error" event. ('+er+")");throw err.context=er,err}if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:args=Array.prototype.slice.call(arguments,1),handler.apply(this,args)}else if(isObject(handler))for(args=Array.prototype.slice.call(arguments,1),listeners=handler.slice(),len=listeners.length,i=0;i<len;i++)listeners[i].apply(this,args);return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned&&(m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[type].length),"function"==typeof console.trace&&console.trace())),this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError("listener must be a function");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit("removeListener",type,listener);else if(isObject(list)){for(i=length;i-- >0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(position<0)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit("removeListener",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)"removeListener"!==key&&this.removeAllListeners(key);return this.removeAllListeners("removeListener"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else if(listeners)for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.prototype.listenerCount=function(type){if(this._events){var evlistener=this._events[type];if(isFunction(evlistener))return 1;if(evlistener)return evlistener.length}return 0},EventEmitter.listenerCount=function(emitter,type){return emitter.listenerCount(type)}},{}],9:[function(require,module,exports){var http=require("http"),https=module.exports;for(var key in http)http.hasOwnProperty(key)&&(https[key]=http[key]);https.request=function(params,cb){return params||(params={}),params.scheme="https",params.protocol="https:",http.request.call(this,params,cb)}},{http:49}],10:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];for(i+=d,e=s&(1<<-nBits)-1,s>>=-nBits,nBits+=eLen;nBits>0;e=256*e+buffer[offset+i],i+=d,nBits-=8);for(m=e&(1<<-nBits)-1,e>>=-nBits,nBits+=mLen;nBits>0;m=256*m+buffer[offset+i],i+=d,nBits-=8);if(0===e)e=1-eBias;else{if(e===eMax)return m?NaN:(s?-1:1)*(1/0);m+=Math.pow(2,mLen),e-=eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)},exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=8*nBytes-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=23===mLen?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||0===value&&1/value<0?1:0;for(value=Math.abs(value),isNaN(value)||value===1/0?(m=isNaN(value)?1:0,e=eMax):(e=Math.floor(Math.log(value)/Math.LN2),value*(c=Math.pow(2,-e))<1&&(e--,c*=2),value+=e+eBias>=1?rt/c:rt*Math.pow(2,1-eBias),value*c>=2&&(e++,c/=2),e+eBias>=eMax?(m=0,e=eMax):e+eBias>=1?(m=(value*c-1)*Math.pow(2,mLen),e+=eBias):(m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen),e=0));mLen>=8;buffer[offset+i]=255&m,i+=d,m/=256,mLen-=8);for(e=e<<mLen|m,eLen+=mLen;eLen>0;buffer[offset+i]=255&e,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=128*s}},{}],11:[function(require,module,exports){"function"==typeof Object.create?module.exports=function(ctor,superCtor){ctor.super_=superCtor,ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:!1,writable:!0,configurable:!0}})}:module.exports=function(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype,ctor.prototype=new TempCtor,ctor.prototype.constructor=ctor}},{}],12:[function(require,module,exports){function isBuffer(obj){return!!obj.constructor&&"function"==typeof obj.constructor.isBuffer&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return"function"==typeof obj.readFloatLE&&"function"==typeof obj.slice&&isBuffer(obj.slice(0,0))}module.exports=function(obj){return null!=obj&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)}},{}],13:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return"[object Array]"==toString.call(arr)}},{}],14:[function(require,module,exports){function arrayMap(array,iteratee){for(var index=-1,length=array.length,result=Array(length);++index<length;)result[index]=iteratee(array[index],index,array);return result}module.exports=arrayMap},{}],15:[function(require,module,exports){function baseAssign(object,source){return null==source?object:baseCopy(source,keys(source),object)}var baseCopy=require("lodash._basecopy"),keys=require("lodash.keys");module.exports=baseAssign},{"lodash._basecopy":17,"lodash.keys":31}],16:[function(require,module,exports){function baseToString(value){return null==value?"":value+""}function baseCallback(func,thisArg,argCount){var type=typeof func;return"function"==type?void 0===thisArg?func:bindCallback(func,thisArg,argCount):null==func?identity:"object"==type?baseMatches(func):void 0===thisArg?property(func):baseMatchesProperty(func,thisArg)}function baseGet(object,path,pathKey){if(null!=object){void 0!==pathKey&&pathKey in toObject(object)&&(path=[pathKey]);for(var index=0,length=path.length;null!=object&&index<length;)object=object[path[index++]];return index&&index==length?object:void 0}}function baseIsMatch(object,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(null==object)return!length;for(object=toObject(object);index--;){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return!1}for(;++index<length;){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(void 0===objValue&&!(key in object))return!1}else{var result=customizer?customizer(objValue,srcValue,key):void 0;if(!(void 0===result?baseIsEqual(srcValue,objValue,customizer,!0):result))return!1}}return!0}function baseMatches(source){var matchData=getMatchData(source);if(1==matchData.length&&matchData[0][2]){var key=matchData[0][0],value=matchData[0][1];return function(object){return null!=object&&(object[key]===value&&(void 0!==value||key in toObject(object)))}}return function(object){return baseIsMatch(object,matchData)}}function baseMatchesProperty(path,srcValue){var isArr=isArray(path),isCommon=isKey(path)&&isStrictComparable(srcValue),pathKey=path+"";return path=toPath(path),function(object){if(null==object)return!1;var key=pathKey;if(object=toObject(object),(isArr||!isCommon)&&!(key in object)){if(object=1==path.length?object:baseGet(object,baseSlice(path,0,-1)),null==object)return!1;key=last(path),object=toObject(object)}return object[key]===srcValue?void 0!==srcValue||key in object:baseIsEqual(srcValue,object[key],void 0,!0)}}function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function basePropertyDeep(path){var pathKey=path+"";return path=toPath(path),function(object){return baseGet(object,path,pathKey)}}function baseSlice(array,start,end){var index=-1,length=array.length;start=null==start?0:+start||0,start<0&&(start=-start>length?0:length+start),end=void 0===end||end>length?length:+end||0,end<0&&(end+=length),length=start>end?0:end-start>>>0,start>>>=0;for(var result=Array(length);++index<length;)result[index]=array[index+start];return result}function getMatchData(object){for(var result=pairs(object),length=result.length;length--;)result[length][2]=isStrictComparable(result[length][1]);return result}function isKey(value,object){var type=typeof value;if("string"==type&&reIsPlainProp.test(value)||"number"==type)return!0;if(isArray(value))return!1;var result=!reIsDeepProp.test(value);return result||null!=object&&value in toObject(object)}function isStrictComparable(value){return value===value&&!isObject(value)}function toObject(value){return isObject(value)?value:Object(value)}function toPath(value){if(isArray(value))return value;var result=[];return baseToString(value).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}),result}function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function identity(value){return value}function property(path){return isKey(path)?baseProperty(path):basePropertyDeep(path)}var baseIsEqual=require("lodash._baseisequal"),bindCallback=require("lodash._bindcallback"),isArray=require("lodash.isarray"),pairs=require("lodash.pairs"),reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,reEscapeChar=/\\(\\)?/g;module.exports=baseCallback},{"lodash._baseisequal":19,"lodash._bindcallback":20,"lodash.isarray":28,"lodash.pairs":34}],17:[function(require,module,exports){function baseCopy(source,props,object){object||(object={});for(var index=-1,length=props.length;++index<length;){var key=props[index];object[key]=source[key]}return object}module.exports=baseCopy},{}],18:[function(require,module,exports){function baseForOwn(object,iteratee){return baseFor(object,iteratee,keys)}function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){var length=collection?getLength(collection):0;if(!isLength(length))return eachFunc(collection,iteratee);for(var index=fromRight?length:-1,iterable=toObject(collection);(fromRight?index--:++index<length)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var iterable=toObject(object),props=keysFunc(object),length=props.length,index=fromRight?length:-1;fromRight?index--:++index<length;){var key=props[index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}var keys=require("lodash.keys"),MAX_SAFE_INTEGER=9007199254740991,baseEach=createBaseEach(baseForOwn),baseFor=createBaseFor(),getLength=baseProperty("length");module.exports=baseEach},{"lodash.keys":31}],19:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}function arraySome(array,predicate){for(var index=-1,length=array.length;++index<length;)if(predicate(array[index],index,array))return!0;return!1}function baseIsEqual(value,other,customizer,isLoose,stackA,stackB){return value===other||(null==value||null==other||!isObject(value)&&!isObjectLike(other)?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,isLoose,stackA,stackB))}function baseIsEqualDeep(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=objToString.call(object),objTag==argsTag?objTag=objectTag:objTag!=objectTag&&(objIsArr=isTypedArray(object))),othIsArr||(othTag=objToString.call(other),othTag==argsTag?othTag=objectTag:othTag!=objectTag&&(othIsArr=isTypedArray(other)));var objIsObj=objTag==objectTag,othIsObj=othTag==objectTag,isSameTag=objTag==othTag;if(isSameTag&&!objIsArr&&!objIsObj)return equalByTag(object,other,objTag);if(!isLoose){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped)return equalFunc(objIsWrapped?object.value():object,othIsWrapped?other.value():other,customizer,isLoose,stackA,stackB)}if(!isSameTag)return!1;stackA||(stackA=[]),stackB||(stackB=[]);for(var length=stackA.length;length--;)if(stackA[length]==object)return stackB[length]==other;stackA.push(object),stackB.push(other);var result=(objIsArr?equalArrays:equalObjects)(object,other,equalFunc,customizer,isLoose,stackA,stackB);return stackA.pop(),stackB.pop(),result}function equalArrays(array,other,equalFunc,customizer,isLoose,stackA,stackB){var index=-1,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isLoose&&othLength>arrLength))return!1;for(;++index<arrLength;){var arrValue=array[index],othValue=other[index],result=customizer?customizer(isLoose?othValue:arrValue,isLoose?arrValue:othValue,index):void 0;if(void 0!==result){if(result)continue;return!1}if(isLoose){if(!arraySome(other,function(othValue){return arrValue===othValue||equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB)}))return!1}else if(arrValue!==othValue&&!equalFunc(arrValue,othValue,customizer,isLoose,stackA,stackB))return!1}return!0}function equalByTag(object,other,tag){switch(tag){case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:object==+other;case regexpTag:case stringTag:return object==other+""}return!1}function equalObjects(object,other,equalFunc,customizer,isLoose,stackA,stackB){var objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isLoose)return!1;for(var index=objLength;index--;){var key=objProps[index];if(!(isLoose?key in other:hasOwnProperty.call(other,key)))return!1}for(var skipCtor=isLoose;++index<objLength;){key=objProps[index];var objValue=object[key],othValue=other[key],result=customizer?customizer(isLoose?othValue:objValue,isLoose?objValue:othValue,key):void 0;if(!(void 0===result?equalFunc(objValue,othValue,customizer,isLoose,stackA,stackB):result))return!1;skipCtor||(skipCtor="constructor"==key)}if(!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&"constructor"in object&&"constructor"in other&&!("function"==typeof objCtor&&objCtor instanceof objCtor&&"function"==typeof othCtor&&othCtor instanceof othCtor))return!1}return!0}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}var isArray=require("lodash.isarray"),isTypedArray=require("lodash.istypedarray"),keys=require("lodash.keys"),argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",stringTag="[object String]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString;module.exports=baseIsEqual},{"lodash.isarray":28,"lodash.istypedarray":30,"lodash.keys":31}],20:[function(require,module,exports){function bindCallback(func,thisArg,argCount){if("function"!=typeof func)return identity;if(void 0===thisArg)return func;switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function identity(value){return value}module.exports=bindCallback},{}],21:[function(require,module,exports){function createAssigner(assigner){return restParam(function(object,sources){
7
+ var index=-1,length=null==object?0:sources.length,customizer=length>2?sources[length-2]:void 0,guard=length>2?sources[2]:void 0,thisArg=length>1?sources[length-1]:void 0;for("function"==typeof customizer?(customizer=bindCallback(customizer,thisArg,5),length-=2):(customizer="function"==typeof thisArg?thisArg:void 0,length-=customizer?1:0),guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?void 0:customizer,length=1);++index<length;){var source=sources[index];source&&assigner(object,source,customizer)}return object})}var bindCallback=require("lodash._bindcallback"),isIterateeCall=require("lodash._isiterateecall"),restParam=require("lodash.restparam");module.exports=createAssigner},{"lodash._bindcallback":20,"lodash._isiterateecall":23,"lodash.restparam":35}],22:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}function getNative(object,key){var value=null==object?void 0:object[key];return isNative(value)?value:void 0}function isFunction(value){return isObject(value)&&objToString.call(value)==funcTag}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isNative(value){return null!=value&&(isFunction(value)?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value))}var funcTag="[object Function]",reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");module.exports=getNative},{}],23:[function(require,module,exports){function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function isArrayLike(value){return null!=value&&isLength(getLength(value))}function isIndex(value,length){return value="number"==typeof value||reIsUint.test(value)?+value:-1,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&value%1==0&&value<length}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;if("number"==type?isArrayLike(object)&&isIndex(index,object.length):"string"==type&&index in object){var other=object[index];return value===value?value===other:other!==other}return!1}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}var reIsUint=/^\d+$/,MAX_SAFE_INTEGER=9007199254740991,getLength=baseProperty("length");module.exports=isIterateeCall},{}],24:[function(require,module,exports){(function(global){function checkGlobal(value){return value&&value.Object===Object?value:null}var objectTypes={"function":!0,object:!0},freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType?exports:void 0,freeModule=objectTypes[typeof module]&&module&&!module.nodeType?module:void 0,freeGlobal=checkGlobal(freeExports&&freeModule&&"object"==typeof global&&global),freeSelf=checkGlobal(objectTypes[typeof self]&&self),freeWindow=checkGlobal(objectTypes[typeof window]&&window),thisGlobal=checkGlobal(objectTypes[typeof this]&&this),root=freeGlobal||freeWindow!==(thisGlobal&&thisGlobal.window)&&freeWindow||freeSelf||thisGlobal||Function("return this")();module.exports=root}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],25:[function(require,module,exports){function assignWith(object,source,customizer){for(var index=-1,props=keys(source),length=props.length;++index<length;){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);(result===result?result===value:value!==value)&&(void 0!==value||key in object)||(object[key]=result)}return object}var baseAssign=require("lodash._baseassign"),createAssigner=require("lodash._createassigner"),keys=require("lodash.keys"),assign=createAssigner(function(object,source,customizer){return customizer?assignWith(object,source,customizer):baseAssign(object,source)});module.exports=assign},{"lodash._baseassign":15,"lodash._createassigner":21,"lodash.keys":31}],26:[function(require,module,exports){function baseClamp(number,lower,upper){return number===number&&(void 0!==upper&&(number=number<=upper?number:upper),void 0!==lower&&(number=number>=lower?number:lower)),number}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function isSymbol(value){return"symbol"==typeof value||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toInteger(value){if(!value)return 0===value?value:0;if(value=toNumber(value),value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}var remainder=value%1;return value===value?remainder?value-remainder:value:0}function toNumber(value){if(isObject(value)){var other=isFunction(value.valueOf)?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?value:+value;value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toString(value){if("string"==typeof value)return value;if(null==value)return"";if(isSymbol(value))return Symbol?symbolToString.call(value):"";var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result}function endsWith(string,target,position){string=toString(string),target="string"==typeof target?target:target+"";var length=string.length;return position=void 0===position?length:baseClamp(toInteger(position),0,length),position-=target.length,position>=0&&string.indexOf(target,position)==position}var root=require("lodash._root"),INFINITY=1/0,MAX_INTEGER=1.7976931348623157e308,NAN=NaN,funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,objectProto=Object.prototype,objectToString=objectProto.toString,Symbol=root.Symbol,symbolProto=Symbol?Symbol.prototype:void 0,symbolToString=Symbol?symbolProto.toString:void 0;module.exports=endsWith},{"lodash._root":24}],27:[function(require,module,exports){function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable;module.exports=isArguments},{}],28:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}function getNative(object,key){var value=null==object?void 0:object[key];return isNative(value)?value:void 0}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isFunction(value){return isObject(value)&&objToString.call(value)==funcTag}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isNative(value){return null!=value&&(isFunction(value)?reIsNative.test(fnToString.call(value)):isObjectLike(value)&&reIsHostCtor.test(value))}var arrayTag="[object Array]",funcTag="[object Function]",reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,fnToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,objToString=objectProto.toString,reIsNative=RegExp("^"+fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nativeIsArray=getNative(Array,"isArray"),MAX_SAFE_INTEGER=9007199254740991,isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag};module.exports=isArray},{}],29:[function(require,module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}function isString(value){return"string"==typeof value||isObjectLike(value)&&objToString.call(value)==stringTag}var stringTag="[object String]",objectProto=Object.prototype,objToString=objectProto.toString;module.exports=isString},{}],30:[function(require,module,exports){function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObjectLike(value){return!!value&&"object"==typeof value}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objectToString.call(value)]}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isTypedArray},{}],31:[function(require,module,exports){function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function isArrayLike(value){return null!=value&&isLength(getLength(value))}function isIndex(value,length){return value="number"==typeof value||reIsUint.test(value)?+value:-1,length=null==length?MAX_SAFE_INTEGER:length,value>-1&&value%1==0&&value<length}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function shimKeys(object){for(var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length,allowIndexes=!!length&&isLength(length)&&(isArray(object)||isArguments(object)),index=-1,result=[];++index<propsLength;){var key=props[index];(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key))&&result.push(key)}return result}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function keysIn(object){if(null==object)return[];isObject(object)||(object=Object(object));var length=object.length;length=length&&isLength(length)&&(isArray(object)||isArguments(object))&&length||0;for(var Ctor=object.constructor,index=-1,isProto="function"==typeof Ctor&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;++index<length;)result[index]=index+"";for(var key in object)skipIndexes&&isIndex(key,length)||"constructor"==key&&(isProto||!hasOwnProperty.call(object,key))||result.push(key);return result}var getNative=require("lodash._getnative"),isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray"),reIsUint=/^\d+$/,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,nativeKeys=getNative(Object,"keys"),MAX_SAFE_INTEGER=9007199254740991,getLength=baseProperty("length"),keys=nativeKeys?function(object){var Ctor=null==object?void 0:object.constructor;return"function"==typeof Ctor&&Ctor.prototype===object||"function"!=typeof object&&isArrayLike(object)?shimKeys(object):isObject(object)?nativeKeys(object):[]}:shimKeys;module.exports=keys},{"lodash._getnative":22,"lodash.isarguments":27,"lodash.isarray":28}],32:[function(require,module,exports){function last(array){var length=array?array.length:0;return length?array[length-1]:void 0}module.exports=last},{}],33:[function(require,module,exports){function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];return baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)}),result}function baseProperty(key){return function(object){return null==object?void 0:object[key]}}function isArrayLike(value){return null!=value&&isLength(getLength(value))}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function map(collection,iteratee,thisArg){var func=isArray(collection)?arrayMap:baseMap;return iteratee=baseCallback(iteratee,thisArg,3),func(collection,iteratee)}var arrayMap=require("lodash._arraymap"),baseCallback=require("lodash._basecallback"),baseEach=require("lodash._baseeach"),isArray=require("lodash.isarray"),MAX_SAFE_INTEGER=9007199254740991,getLength=baseProperty("length");module.exports=map},{"lodash._arraymap":14,"lodash._basecallback":16,"lodash._baseeach":18,"lodash.isarray":28}],34:[function(require,module,exports){function toObject(value){return isObject(value)?value:Object(value)}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function pairs(object){object=toObject(object);for(var index=-1,props=keys(object),length=props.length,result=Array(length);++index<length;){var key=props[index];result[index]=[key,object[key]]}return result}var keys=require("lodash.keys");module.exports=pairs},{"lodash.keys":31}],35:[function(require,module,exports){function restParam(func,start){if("function"!=typeof func)throw new TypeError(FUNC_ERROR_TEXT);return start=nativeMax(void 0===start?func.length-1:+start||0,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),rest=Array(length);++index<length;)rest[index]=args[start+index];switch(start){case 0:return func.call(this,rest);case 1:return func.call(this,args[0],rest);case 2:return func.call(this,args[0],args[1],rest)}var otherArgs=Array(start+1);for(index=-1;++index<start;)otherArgs[index]=args[index];return otherArgs[start]=rest,func.apply(this,otherArgs)}}var FUNC_ERROR_TEXT="Expected a function",nativeMax=Math.max;module.exports=restParam},{}],36:[function(require,module,exports){(function(process){"use strict";function nextTick(fn,arg1,arg2,arg3){if("function"!=typeof fn)throw new TypeError('"callback" argument must be a function');var args,i,len=arguments.length;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick(function(){fn.call(null,arg1)});case 3:return process.nextTick(function(){fn.call(null,arg1,arg2)});case 4:return process.nextTick(function(){fn.call(null,arg1,arg2,arg3)});default:for(args=new Array(len-1),i=0;i<args.length;)args[i++]=arguments[i];return process.nextTick(function(){fn.apply(null,args)})}}!process.version||0===process.version.indexOf("v0.")||0===process.version.indexOf("v1.")&&0!==process.version.indexOf("v1.8.")?module.exports=nextTick:module.exports=process.nextTick}).call(this,require("_process"))},{_process:37}],37:[function(require,module,exports){function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(fun){if(cachedSetTimeout===setTimeout)return setTimeout(fun,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(fun,0);try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout)return clearTimeout(marker);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(marker);try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}function cleanUpNextTick(){draining&&currentQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=runTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,runClearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var cachedSetTimeout,cachedClearTimeout,process=module.exports={};!function(){try{cachedSetTimeout="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(e){cachedSetTimeout=defaultSetTimout}try{cachedClearTimeout="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(e){cachedClearTimeout=defaultClearTimeout}}();var currentQueue,queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},{}],38:[function(require,module,exports){(function(global){!function(root){function error(type){throw new RangeError(errors[type])}function map(array,fn){for(var length=array.length,result=[];length--;)result[length]=fn(array[length]);return result}function mapDomain(string,fn){var parts=string.split("@"),result="";parts.length>1&&(result=parts[0]+"@",string=parts[1]),string=string.replace(regexSeparators,".");var labels=string.split("."),encoded=map(labels,fn).join(".");return result+encoded}function ucs2decode(string){for(var value,extra,output=[],counter=0,length=string.length;counter<length;)value=string.charCodeAt(counter++),value>=55296&&value<=56319&&counter<length?(extra=string.charCodeAt(counter++),56320==(64512&extra)?output.push(((1023&value)<<10)+(1023&extra)+65536):(output.push(value),counter--)):output.push(value);return output}function ucs2encode(array){return map(array,function(value){var output="";return value>65535&&(value-=65536,output+=stringFromCharCode(value>>>10&1023|55296),value=56320|1023&value),output+=stringFromCharCode(value)}).join("")}function basicToDigit(codePoint){return codePoint-48<10?codePoint-22:codePoint-65<26?codePoint-65:codePoint-97<26?codePoint-97:base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((0!=flag)<<5)}function adapt(delta,numPoints,firstTime){var k=0;for(delta=firstTime?floor(delta/damp):delta>>1,delta+=floor(delta/numPoints);delta>baseMinusTMin*tMax>>1;k+=base)delta=floor(delta/baseMinusTMin);return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var out,basic,j,index,oldi,w,k,digit,t,baseMinusT,output=[],inputLength=input.length,i=0,n=initialN,bias=initialBias;for(basic=input.lastIndexOf(delimiter),basic<0&&(basic=0),j=0;j<basic;++j)input.charCodeAt(j)>=128&&error("not-basic"),output.push(input.charCodeAt(j));for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;index>=inputLength&&error("invalid-input"),digit=basicToDigit(input.charCodeAt(index++)),(digit>=base||digit>floor((maxInt-i)/w))&&error("overflow"),i+=digit*w,t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(digit<t);k+=base)baseMinusT=base-t,w>floor(maxInt/baseMinusT)&&error("overflow"),w*=baseMinusT;out=output.length+1,bias=adapt(i-oldi,out,0==oldi),floor(i/out)>maxInt-n&&error("overflow"),n+=floor(i/out),i%=out,output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,inputLength,handledCPCountPlusOne,baseMinusT,qMinusT,output=[];for(input=ucs2decode(input),inputLength=input.length,n=initialN,delta=0,bias=initialBias,j=0;j<inputLength;++j)currentValue=input[j],currentValue<128&&output.push(stringFromCharCode(currentValue));for(handledCPCount=basicLength=output.length,basicLength&&output.push(delimiter);handledCPCount<inputLength;){for(m=maxInt,j=0;j<inputLength;++j)currentValue=input[j],currentValue>=n&&currentValue<m&&(m=currentValue);for(handledCPCountPlusOne=handledCPCount+1,m-n>floor((maxInt-delta)/handledCPCountPlusOne)&&error("overflow"),delta+=(m-n)*handledCPCountPlusOne,n=m,j=0;j<inputLength;++j)if(currentValue=input[j],currentValue<n&&++delta>maxInt&&error("overflow"),currentValue==n){for(q=delta,k=base;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias,!(q<t);k+=base)qMinusT=q-t,baseMinusT=base-t,output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0))),q=floor(qMinusT/baseMinusT);output.push(stringFromCharCode(digitToBasic(q,0))),bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength),delta=0,++handledCPCount}++delta,++n}return output.join("")}function toUnicode(input){return mapDomain(input,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(input){return mapDomain(input,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}var freeExports="object"==typeof exports&&exports&&!exports.nodeType&&exports,freeModule="object"==typeof module&&module&&!module.nodeType&&module,freeGlobal="object"==typeof global&&global;freeGlobal.global!==freeGlobal&&freeGlobal.window!==freeGlobal&&freeGlobal.self!==freeGlobal||(root=freeGlobal);var punycode,key,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^\x20-\x7E]/,regexSeparators=/[\x2E\u3002\uFF0E\uFF61]/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode;if(punycode={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return punycode});else if(freeExports&&freeModule)if(module.exports==freeExports)freeModule.exports=punycode;else for(key in punycode)punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);else root.punycode=punycode}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],39:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&",eq=eq||"=";var obj={};if("string"!=typeof qs||0===qs.length)return obj;var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;options&&"number"==typeof options.maxKeys&&(maxKeys=options.maxKeys);var len=qs.length;maxKeys>0&&len>maxKeys&&(len=maxKeys);for(var i=0;i<len;++i){var kstr,vstr,k,v,x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq);idx>=0?(kstr=x.substr(0,idx),vstr=x.substr(idx+1)):(kstr=x,vstr=""),k=decodeURIComponent(kstr),v=decodeURIComponent(vstr),hasOwnProperty(obj,k)?isArray(obj[k])?obj[k].push(v):obj[k]=[obj[k],v]:obj[k]=v}return obj};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)}},{}],40:[function(require,module,exports){"use strict";function map(xs,f){if(xs.map)return xs.map(f);for(var res=[],i=0;i<xs.length;i++)res.push(f(xs[i],i));return res}var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){return sep=sep||"&",eq=eq||"=",null===obj&&(obj=void 0),"object"==typeof obj?map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;return isArray(obj[k])?map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep):ks+encodeURIComponent(stringifyPrimitive(obj[k]))}).join(sep):name?encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj)):""};var isArray=Array.isArray||function(xs){return"[object Array]"===Object.prototype.toString.call(xs)},objectKeys=Object.keys||function(obj){var res=[];for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&res.push(key);return res}},{}],41:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode"),exports.encode=exports.stringify=require("./encode")},{"./decode":39,"./encode":40}],42:[function(require,module,exports){"use strict";function Duplex(options){return this instanceof Duplex?(Readable.call(this,options),Writable.call(this,options),options&&options.readable===!1&&(this.readable=!1),options&&options.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,options&&options.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",onend)):new Duplex(options)}function onend(){this.allowHalfOpen||this._writableState.ended||processNextTick(onEndNT,this)}function onEndNT(self){self.end()}var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};module.exports=Duplex;var processNextTick=require("process-nextick-args"),util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable"),Writable=require("./_stream_writable");util.inherits(Duplex,Readable);for(var keys=objectKeys(Writable.prototype),v=0;v<keys.length;v++){var method=keys[v];Duplex.prototype[method]||(Duplex.prototype[method]=Writable.prototype[method])}},{"./_stream_readable":44,"./_stream_writable":46,"core-util-is":7,inherits:11,"process-nextick-args":36}],43:[function(require,module,exports){"use strict";function PassThrough(options){return this instanceof PassThrough?void Transform.call(this,options):new PassThrough(options)}module.exports=PassThrough;var Transform=require("./_stream_transform"),util=require("core-util-is");util.inherits=require("inherits"),util.inherits(PassThrough,Transform),PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":45,"core-util-is":7,inherits:11}],44:[function(require,module,exports){(function(process){"use strict";function prependListener(emitter,event,fn){return"function"==typeof emitter.prependListener?emitter.prependListener(event,fn):void(emitter._events&&emitter._events[event]?isArray(emitter._events[event])?emitter._events[event].unshift(fn):emitter._events[event]=[fn,emitter._events[event]]:emitter.on(event,fn))}function ReadableState(options,stream){Duplex=Duplex||require("./_stream_duplex"),options=options||{},this.objectMode=!!options.objectMode,stream instanceof Duplex&&(this.objectMode=this.objectMode||!!options.readableObjectMode);var hwm=options.highWaterMark,defaultHwm=this.objectMode?16:16384;this.highWaterMark=hwm||0===hwm?hwm:defaultHwm,this.highWaterMark=~~this.highWaterMark,this.buffer=new BufferList,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=options.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,options.encoding&&(StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this.decoder=new StringDecoder(options.encoding),this.encoding=options.encoding)}function Readable(options){return Duplex=Duplex||require("./_stream_duplex"),this instanceof Readable?(this._readableState=new ReadableState(options,this),this.readable=!0,options&&"function"==typeof options.read&&(this._read=options.read),void Stream.call(this)):new Readable(options)}function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er)stream.emit("error",er);else if(null===chunk)state.reading=!1,onEofChunk(stream,state);else if(state.objectMode||chunk&&chunk.length>0)if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var _e=new Error("stream.unshift() after end event");stream.emit("error",_e)}else{var skipAdd;!state.decoder||addToFront||encoding||(chunk=state.decoder.write(chunk),skipAdd=!state.objectMode&&0===chunk.length),addToFront||(state.reading=!1),skipAdd||(state.flowing&&0===state.length&&!state.sync?(stream.emit("data",chunk),stream.read(0)):(state.length+=state.objectMode?1:chunk.length,addToFront?state.buffer.unshift(chunk):state.buffer.push(chunk),state.needReadable&&emitReadable(stream))),maybeReadMore(stream,state)}else addToFront||(state.reading=!1);return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||0===state.length)}function computeNewHighWaterMark(n){return n>=MAX_HWM?n=MAX_HWM:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function howMuchToRead(n,state){return n<=0||0===state.length&&state.ended?0:state.objectMode?1:n!==n?state.flowing&&state.length?state.buffer.head.data.length:state.length:(n>state.highWaterMark&&(state.highWaterMark=computeNewHighWaterMark(n)),n<=state.length?n:state.ended?state.length:(state.needReadable=!0,0))}function chunkInvalid(state,chunk){var er=null;return Buffer.isBuffer(chunk)||"string"==typeof chunk||null===chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk")),er}function onEofChunk(stream,state){if(!state.ended){if(state.decoder){var chunk=state.decoder.end();chunk&&chunk.length&&(state.buffer.push(chunk),state.length+=state.objectMode?1:chunk.length)}state.ended=!0,emitReadable(stream)}}function emitReadable(stream){var state=stream._readableState;state.needReadable=!1,state.emittedReadable||(debug("emitReadable",state.flowing),state.emittedReadable=!0,state.sync?processNextTick(emitReadable_,stream):emitReadable_(stream))}function emitReadable_(stream){debug("emit readable"),stream.emit("readable"),flow(stream)}function maybeReadMore(stream,state){state.readingMore||(state.readingMore=!0,
8
+ processNextTick(maybeReadMore_,stream,state))}function maybeReadMore_(stream,state){for(var len=state.length;!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark&&(debug("maybeReadMore read 0"),stream.read(0),len!==state.length);)len=state.length;state.readingMore=!1}function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain),state.awaitDrain&&state.awaitDrain--,0===state.awaitDrain&&EElistenerCount(src,"data")&&(state.flowing=!0,flow(src))}}function nReadingNextTick(self){debug("readable nexttick read 0"),self.read(0)}function resume(stream,state){state.resumeScheduled||(state.resumeScheduled=!0,processNextTick(resume_,stream,state))}function resume_(stream,state){state.reading||(debug("resume read 0"),stream.read(0)),state.resumeScheduled=!1,state.awaitDrain=0,stream.emit("resume"),flow(stream),state.flowing&&!state.reading&&stream.read(0)}function flow(stream){var state=stream._readableState;for(debug("flow",state.flowing);state.flowing&&null!==stream.read(););}function fromList(n,state){if(0===state.length)return null;var ret;return state.objectMode?ret=state.buffer.shift():!n||n>=state.length?(ret=state.decoder?state.buffer.join(""):1===state.buffer.length?state.buffer.head.data:state.buffer.concat(state.length),state.buffer.clear()):ret=fromListPartial(n,state.buffer,state.decoder),ret}function fromListPartial(n,list,hasStrings){var ret;return n<list.head.data.length?(ret=list.head.data.slice(0,n),list.head.data=list.head.data.slice(n)):ret=n===list.head.data.length?list.shift():hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list),ret}function copyFromBufferString(n,list){var p=list.head,c=1,ret=p.data;for(n-=ret.length;p=p.next;){var str=p.data,nb=n>str.length?str.length:n;if(ret+=nb===str.length?str:str.slice(0,n),n-=nb,0===n){nb===str.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p,p.data=str.slice(nb));break}++c}return list.length-=c,ret}function copyFromBuffer(n,list){var ret=bufferShim.allocUnsafe(n),p=list.head,c=1;for(p.data.copy(ret),n-=p.data.length;p=p.next;){var buf=p.data,nb=n>buf.length?buf.length:n;if(buf.copy(ret,ret.length-n,0,nb),n-=nb,0===n){nb===buf.length?(++c,p.next?list.head=p.next:list.head=list.tail=null):(list.head=p,p.data=buf.slice(nb));break}++c}return list.length-=c,ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');state.endEmitted||(state.ended=!0,processNextTick(endReadableNT,state,stream))}function endReadableNT(state,stream){state.endEmitted||0!==state.length||(state.endEmitted=!0,stream.readable=!1,stream.emit("end"))}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++)f(xs[i],i)}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++)if(xs[i]===x)return i;return-1}module.exports=Readable;var processNextTick=require("process-nextick-args"),isArray=require("isarray");Readable.ReadableState=ReadableState;var Stream,EElistenerCount=(require("events").EventEmitter,function(emitter,type){return emitter.listeners(type).length});!function(){try{Stream=require("stream")}catch(_){}finally{Stream||(Stream=require("events").EventEmitter)}}();var Buffer=require("buffer").Buffer,bufferShim=require("buffer-shims"),util=require("core-util-is");util.inherits=require("inherits");var debugUtil=require("util"),debug=void 0;debug=debugUtil&&debugUtil.debuglog?debugUtil.debuglog("stream"):function(){};var StringDecoder,BufferList=require("./internal/streams/BufferList");util.inherits(Readable,Stream);var Duplex,Duplex;Readable.prototype.push=function(chunk,encoding){var state=this._readableState;return state.objectMode||"string"!=typeof chunk||(encoding=encoding||state.defaultEncoding,encoding!==state.encoding&&(chunk=bufferShim.from(chunk,encoding),encoding="")),readableAddChunk(this,state,chunk,encoding,!1)},Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",!0)},Readable.prototype.isPaused=function(){return this._readableState.flowing===!1},Readable.prototype.setEncoding=function(enc){return StringDecoder||(StringDecoder=require("string_decoder/").StringDecoder),this._readableState.decoder=new StringDecoder(enc),this._readableState.encoding=enc,this};var MAX_HWM=8388608;Readable.prototype.read=function(n){debug("read",n),n=parseInt(n,10);var state=this._readableState,nOrig=n;if(0!==n&&(state.emittedReadable=!1),0===n&&state.needReadable&&(state.length>=state.highWaterMark||state.ended))return debug("read: emitReadable",state.length,state.ended),0===state.length&&state.ended?endReadable(this):emitReadable(this),null;if(n=howMuchToRead(n,state),0===n&&state.ended)return 0===state.length&&endReadable(this),null;var doRead=state.needReadable;debug("need readable",doRead),(0===state.length||state.length-n<state.highWaterMark)&&(doRead=!0,debug("length less than watermark",doRead)),state.ended||state.reading?(doRead=!1,debug("reading or ended",doRead)):doRead&&(debug("do read"),state.reading=!0,state.sync=!0,0===state.length&&(state.needReadable=!0),this._read(state.highWaterMark),state.sync=!1,state.reading||(n=howMuchToRead(nOrig,state)));var ret;return ret=n>0?fromList(n,state):null,null===ret?(state.needReadable=!0,n=0):state.length-=n,0===state.length&&(state.ended||(state.needReadable=!0),nOrig!==n&&state.ended&&endReadable(this)),null!==ret&&this.emit("data",ret),ret},Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))},Readable.prototype.pipe=function(dest,pipeOpts){function onunpipe(readable){debug("onunpipe"),readable===src&&cleanup()}function onend(){debug("onend"),dest.end()}function cleanup(){debug("cleanup"),dest.removeListener("close",onclose),dest.removeListener("finish",onfinish),dest.removeListener("drain",ondrain),dest.removeListener("error",onerror),dest.removeListener("unpipe",onunpipe),src.removeListener("end",onend),src.removeListener("end",cleanup),src.removeListener("data",ondata),cleanedUp=!0,!state.awaitDrain||dest._writableState&&!dest._writableState.needDrain||ondrain()}function ondata(chunk){debug("ondata"),increasedAwaitDrain=!1;var ret=dest.write(chunk);!1!==ret||increasedAwaitDrain||((1===state.pipesCount&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp&&(debug("false write response, pause",src._readableState.awaitDrain),src._readableState.awaitDrain++,increasedAwaitDrain=!0),src.pause())}function onerror(er){debug("onerror",er),unpipe(),dest.removeListener("error",onerror),0===EElistenerCount(dest,"error")&&dest.emit("error",er)}function onclose(){dest.removeListener("finish",onfinish),unpipe()}function onfinish(){debug("onfinish"),dest.removeListener("close",onclose),unpipe()}function unpipe(){debug("unpipe"),src.unpipe(dest)}var src=this,state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest)}state.pipesCount+=1,debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==!1)&&dest!==process.stdout&&dest!==process.stderr,endFn=doEnd?onend:cleanup;state.endEmitted?processNextTick(endFn):src.once("end",endFn),dest.on("unpipe",onunpipe);var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=!1,increasedAwaitDrain=!1;return src.on("data",ondata),prependListener(dest,"error",onerror),dest.once("close",onclose),dest.once("finish",onfinish),dest.emit("pipe",src),state.flowing||(debug("pipe resume"),src.resume()),dest},Readable.prototype.unpipe=function(dest){var state=this._readableState;if(0===state.pipesCount)return this;if(1===state.pipesCount)return dest&&dest!==state.pipes?this:(dest||(dest=state.pipes),state.pipes=null,state.pipesCount=0,state.flowing=!1,dest&&dest.emit("unpipe",this),this);if(!dest){var dests=state.pipes,len=state.pipesCount;state.pipes=null,state.pipesCount=0,state.flowing=!1;for(var _i=0;_i<len;_i++)dests[_i].emit("unpipe",this);return this}var i=indexOf(state.pipes,dest);return i===-1?this:(state.pipes.splice(i,1),state.pipesCount-=1,1===state.pipesCount&&(state.pipes=state.pipes[0]),dest.emit("unpipe",this),this)},Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if("data"===ev)this._readableState.flowing!==!1&&this.resume();else if("readable"===ev){var state=this._readableState;state.endEmitted||state.readableListening||(state.readableListening=state.needReadable=!0,state.emittedReadable=!1,state.reading?state.length&&emitReadable(this,state):processNextTick(nReadingNextTick,this))}return res},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.resume=function(){var state=this._readableState;return state.flowing||(debug("resume"),state.flowing=!0,resume(this,state)),this},Readable.prototype.pause=function(){return debug("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(debug("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(stream){var state=this._readableState,paused=!1,self=this;stream.on("end",function(){if(debug("wrapped end"),state.decoder&&!state.ended){var chunk=state.decoder.end();chunk&&chunk.length&&self.push(chunk)}self.push(null)}),stream.on("data",function(chunk){if(debug("wrapped data"),state.decoder&&(chunk=state.decoder.write(chunk)),(!state.objectMode||null!==chunk&&void 0!==chunk)&&(state.objectMode||chunk&&chunk.length)){var ret=self.push(chunk);ret||(paused=!0,stream.pause())}});for(var i in stream)void 0===this[i]&&"function"==typeof stream[i]&&(this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i));var events=["error","close","destroy","pause","resume"];return forEach(events,function(ev){stream.on(ev,self.emit.bind(self,ev))}),self._read=function(n){debug("wrapped _read",n),paused&&(paused=!1,stream.resume())},self},Readable._fromList=fromList}).call(this,require("_process"))},{"./_stream_duplex":42,"./internal/streams/BufferList":47,_process:37,buffer:5,"buffer-shims":4,"core-util-is":7,events:8,inherits:11,isarray:13,"process-nextick-args":36,"string_decoder/":53,util:3}],45:[function(require,module,exports){"use strict";function TransformState(stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=!1;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null,ts.writecb=null,null!==data&&void 0!==data&&stream.push(data),cb(er);var rs=stream._readableState;rs.reading=!1,(rs.needReadable||rs.length<rs.highWaterMark)&&stream._read(rs.highWaterMark)}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options),this._transformState=new TransformState(this);var stream=this;this._readableState.needReadable=!0,this._readableState.sync=!1,options&&("function"==typeof options.transform&&(this._transform=options.transform),"function"==typeof options.flush&&(this._flush=options.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(er){done(stream,er)}):done(stream)})}function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState,ts=stream._transformState;if(ws.length)throw new Error("Calling transform done when ws.length != 0");if(ts.transforming)throw new Error("Calling transform done when still transforming");return stream.push(null)}module.exports=Transform;var Duplex=require("./_stream_duplex"),util=require("core-util-is");util.inherits=require("inherits"),util.inherits(Transform,Duplex),Transform.prototype.push=function(chunk,encoding){return this._transformState.needTransform=!1,Duplex.prototype.push.call(this,chunk,encoding)},Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("Not implemented")},Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;if(ts.writecb=cb,ts.writechunk=chunk,ts.writeencoding=encoding,!ts.transforming){var rs=this._readableState;(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)&&this._read(rs.highWaterMark)}},Transform.prototype._read=function(n){var ts=this._transformState;null!==ts.writechunk&&ts.writecb&&!ts.transforming?(ts.transforming=!0,this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)):ts.needTransform=!0}},{"./_stream_duplex":42,"core-util-is":7,inherits:11}],46:[function(require,module,exports){(function(process){"use strict";function nop(){}function WriteReq(chunk,encoding,cb){this.chunk=chunk,this.encoding=encoding,this.callback=cb,this.next=null}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex"),options=options||{},this.objectMode=!!options.objectMode,stream instanceof Duplex&&(this.objectMode=this.objectMode||!!options.writableObjectMode);var hwm=options.highWaterMark,defaultHwm=this.objectMode?16:16384;this.highWaterMark=hwm||0===hwm?hwm:defaultHwm,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var noDecode=options.decodeStrings===!1;this.decodeStrings=!noDecode,this.defaultEncoding=options.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(er){onwrite(stream,er)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(options){return Duplex=Duplex||require("./_stream_duplex"),this instanceof Writable||this instanceof Duplex?(this._writableState=new WritableState(options,this),this.writable=!0,options&&("function"==typeof options.write&&(this._write=options.write),"function"==typeof options.writev&&(this._writev=options.writev)),void Stream.call(this)):new Writable(options)}function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er),processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=!0,er=!1;return null===chunk?er=new TypeError("May not write null values to stream"):Buffer.isBuffer(chunk)||"string"==typeof chunk||void 0===chunk||state.objectMode||(er=new TypeError("Invalid non-string/buffer chunk")),er&&(stream.emit("error",er),processNextTick(cb,er),valid=!1),valid}function decodeChunk(state,chunk,encoding){return state.objectMode||state.decodeStrings===!1||"string"!=typeof chunk||(chunk=bufferShim.from(chunk,encoding)),chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding),Buffer.isBuffer(chunk)&&(encoding="buffer");var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(ret||(state.needDrain=!0),state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest=new WriteReq(chunk,encoding,cb),last?last.next=state.lastBufferedRequest:state.bufferedRequest=state.lastBufferedRequest,state.bufferedRequestCount+=1}else doWrite(stream,state,!1,len,chunk,encoding,cb);return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len,state.writecb=cb,state.writing=!0,state.sync=!0,writev?stream._writev(chunk,state.onwrite):stream._write(chunk,encoding,state.onwrite),state.sync=!1}function onwriteError(stream,state,sync,er,cb){--state.pendingcb,sync?processNextTick(cb,er):cb(er),stream._writableState.errorEmitted=!0,stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=!1,state.writecb=null,state.length-=state.writelen,state.writelen=0}function onwrite(stream,er){var state=stream._writableState,sync=state.sync,cb=state.writecb;if(onwriteStateUpdate(state),er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state);finished||state.corked||state.bufferProcessing||!state.bufferedRequest||clearBuffer(stream,state),sync?asyncWrite(afterWrite,stream,state,finished,cb):afterWrite(stream,state,finished,cb)}}function afterWrite(stream,state,finished,cb){finished||onwriteDrain(stream,state),state.pendingcb--,cb(),finishMaybe(stream,state)}function onwriteDrain(stream,state){0===state.length&&state.needDrain&&(state.needDrain=!1,stream.emit("drain"))}function clearBuffer(stream,state){state.bufferProcessing=!0;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount,buffer=new Array(l),holder=state.corkedRequestsFree;holder.entry=entry;for(var count=0;entry;)buffer[count]=entry,entry=entry.next,count+=1;doWrite(stream,state,!0,state.length,buffer,"",holder.finish),state.pendingcb++,state.lastBufferedRequest=null,holder.next?(state.corkedRequestsFree=holder.next,holder.next=null):state.corkedRequestsFree=new CorkedRequest(state)}else{for(;entry;){var chunk=entry.chunk,encoding=entry.encoding,cb=entry.callback,len=state.objectMode?1:chunk.length;if(doWrite(stream,state,!1,len,chunk,encoding,cb),entry=entry.next,state.writing)break}null===entry&&(state.lastBufferedRequest=null)}state.bufferedRequestCount=0,state.bufferedRequest=entry,state.bufferProcessing=!1}function needFinish(state){return state.ending&&0===state.length&&null===state.bufferedRequest&&!state.finished&&!state.writing}function prefinish(stream,state){state.prefinished||(state.prefinished=!0,stream.emit("prefinish"))}function finishMaybe(stream,state){var need=needFinish(state);return need&&(0===state.pendingcb?(prefinish(stream,state),state.finished=!0,stream.emit("finish")):prefinish(stream,state)),need}function endWritable(stream,state,cb){state.ending=!0,finishMaybe(stream,state),cb&&(state.finished?processNextTick(cb):stream.once("finish",cb)),state.ended=!0,stream.writable=!1}function CorkedRequest(state){var _this=this;this.next=null,this.entry=null,this.finish=function(err){var entry=_this.entry;for(_this.entry=null;entry;){var cb=entry.callback;state.pendingcb--,cb(err),entry=entry.next}state.corkedRequestsFree?state.corkedRequestsFree.next=_this:state.corkedRequestsFree=_this}}module.exports=Writable;var processNextTick=require("process-nextick-args"),asyncWrite=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:processNextTick;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var Stream,internalUtil={deprecate:require("util-deprecate")};!function(){try{Stream=require("stream")}catch(_){}finally{Stream||(Stream=require("events").EventEmitter)}}();var Buffer=require("buffer").Buffer,bufferShim=require("buffer-shims");util.inherits(Writable,Stream);var Duplex;WritableState.prototype.getBuffer=function(){for(var current=this.bufferedRequest,out=[];current;)out.push(current),current=current.next;return out},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(_){}}();var Duplex;Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState,ret=!1;return"function"==typeof encoding&&(cb=encoding,encoding=null),Buffer.isBuffer(chunk)?encoding="buffer":encoding||(encoding=state.defaultEncoding),"function"!=typeof cb&&(cb=nop),state.ended?writeAfterEnd(this,cb):validChunk(this,state,chunk,cb)&&(state.pendingcb++,ret=writeOrBuffer(this,state,chunk,encoding,cb)),ret},Writable.prototype.cork=function(){var state=this._writableState;state.corked++},Writable.prototype.uncork=function(){var state=this._writableState;state.corked&&(state.corked--,state.writing||state.corked||state.finished||state.bufferProcessing||!state.bufferedRequest||clearBuffer(this,state))},Writable.prototype.setDefaultEncoding=function(encoding){if("string"==typeof encoding&&(encoding=encoding.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);return this._writableState.defaultEncoding=encoding,this},Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;"function"==typeof chunk?(cb=chunk,chunk=null,encoding=null):"function"==typeof encoding&&(cb=encoding,encoding=null),null!==chunk&&void 0!==chunk&&this.write(chunk,encoding),state.corked&&(state.corked=1,this.uncork()),state.ending||state.finished||endWritable(this,state,cb)}}).call(this,require("_process"))},{"./_stream_duplex":42,_process:37,buffer:5,"buffer-shims":4,"core-util-is":7,events:8,inherits:11,"process-nextick-args":36,"util-deprecate":57}],47:[function(require,module,exports){"use strict";function BufferList(){this.head=null,this.tail=null,this.length=0}var bufferShim=(require("buffer").Buffer,require("buffer-shims"));module.exports=BufferList,BufferList.prototype.push=function(v){var entry={data:v,next:null};this.length>0?this.tail.next=entry:this.head=entry,this.tail=entry,++this.length},BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};0===this.length&&(this.tail=entry),this.head=entry,++this.length},BufferList.prototype.shift=function(){if(0!==this.length){var ret=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,ret}},BufferList.prototype.clear=function(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function(s){if(0===this.length)return"";for(var p=this.head,ret=""+p.data;p=p.next;)ret+=s+p.data;return ret},BufferList.prototype.concat=function(n){if(0===this.length)return bufferShim.alloc(0);if(1===this.length)return this.head.data;for(var ret=bufferShim.allocUnsafe(n>>>0),p=this.head,i=0;p;)p.data.copy(ret,i),i+=p.data.length,p=p.next;return ret}},{buffer:5,"buffer-shims":4}],48:[function(require,module,exports){(function(process){var Stream=function(){try{return require("stream")}catch(_){}}();exports=module.exports=require("./lib/_stream_readable.js"),exports.Stream=Stream||exports,exports.Readable=exports,exports.Writable=require("./lib/_stream_writable.js"),exports.Duplex=require("./lib/_stream_duplex.js"),exports.Transform=require("./lib/_stream_transform.js"),exports.PassThrough=require("./lib/_stream_passthrough.js"),!process.browser&&"disable"===process.env.READABLE_STREAM&&Stream&&(module.exports=Stream)}).call(this,require("_process"))},{"./lib/_stream_duplex.js":42,"./lib/_stream_passthrough.js":43,"./lib/_stream_readable.js":44,"./lib/_stream_transform.js":45,"./lib/_stream_writable.js":46,_process:37}],49:[function(require,module,exports){(function(global){var ClientRequest=require("./lib/request"),extend=require("xtend"),statusCodes=require("builtin-status-codes"),url=require("url"),http=exports;http.request=function(opts,cb){opts="string"==typeof opts?url.parse(opts):extend(opts);var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?"http:":"",protocol=opts.protocol||defaultProtocol,host=opts.hostname||opts.host,port=opts.port,path=opts.path||"/";host&&host.indexOf(":")!==-1&&(host="["+host+"]"),opts.url=(host?protocol+"//"+host:"")+(port?":"+port:"")+path,opts.method=(opts.method||"GET").toUpperCase(),opts.headers=opts.headers||{};var req=new ClientRequest(opts);return cb&&req.on("response",cb),req},http.get=function(opts,cb){var req=http.request(opts,cb);return req.end(),req},http.Agent=function(){},http.Agent.defaultMaxSockets=4,http.STATUS_CODES=statusCodes,http.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":51,"builtin-status-codes":6,url:55,xtend:58}],50:[function(require,module,exports){(function(global){function checkTypeSupport(type){try{return xhr.responseType=type,xhr.responseType===type}catch(e){}return!1}function isFunction(value){return"function"==typeof value}exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream),exports.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),exports.blobConstructor=!0}catch(e){}var xhr=new global.XMLHttpRequest;xhr.open("GET",global.location.host?"/":"https://example.com");var haveArrayBuffer="undefined"!=typeof global.ArrayBuffer,haveSlice=haveArrayBuffer&&isFunction(global.ArrayBuffer.prototype.slice);exports.arraybuffer=haveArrayBuffer&&checkTypeSupport("arraybuffer"),exports.msstream=!exports.fetch&&haveSlice&&checkTypeSupport("ms-stream"),exports.mozchunkedarraybuffer=!exports.fetch&&haveArrayBuffer&&checkTypeSupport("moz-chunked-arraybuffer"),exports.overrideMimeType=isFunction(xhr.overrideMimeType),exports.vbArray=isFunction(global.VBArray),xhr=null}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],51:[function(require,module,exports){(function(process,global,Buffer){function decideMode(preferBinary,useFetch){return capability.fetch&&useFetch?"fetch":capability.mozchunkedarraybuffer?"moz-chunked-arraybuffer":capability.msstream?"ms-stream":capability.arraybuffer&&preferBinary?"arraybuffer":capability.vbArray&&preferBinary?"text:vbarray":"text"}function statusValid(xhr){try{var status=xhr.status;return null!==status&&0!==status}catch(e){return!1}}var capability=require("./capability"),inherits=require("inherits"),response=require("./response"),stream=require("readable-stream"),toArrayBuffer=require("to-arraybuffer"),IncomingMessage=response.IncomingMessage,rStates=response.readyStates,ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self),self._opts=opts,self._body=[],self._headers={},opts.auth&&self.setHeader("Authorization","Basic "+new Buffer(opts.auth).toString("base64")),Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name])});var preferBinary,useFetch=!0;if("disable-fetch"===opts.mode)useFetch=!1,preferBinary=!0;else if("prefer-streaming"===opts.mode)preferBinary=!1;else if("allow-wrong-content-type"===opts.mode)preferBinary=!capability.overrideMimeType;else{if(opts.mode&&"default"!==opts.mode&&"prefer-fast"!==opts.mode)throw new Error("Invalid value for opts.mode");preferBinary=!0}self._mode=decideMode(preferBinary,useFetch),self.on("finish",function(){self._onFinish()})};inherits(ClientRequest,stream.Writable),ClientRequest.prototype.setHeader=function(name,value){var self=this,lowerName=name.toLowerCase();unsafeHeaders.indexOf(lowerName)===-1&&(self._headers[lowerName]={name:name,value:value})},ClientRequest.prototype.getHeader=function(name){var self=this;return self._headers[name.toLowerCase()].value},ClientRequest.prototype.removeHeader=function(name){var self=this;delete self._headers[name.toLowerCase()]},ClientRequest.prototype._onFinish=function(){var self=this;if(!self._destroyed){var body,opts=self._opts,headersObj=self._headers;if("POST"!==opts.method&&"PUT"!==opts.method&&"PATCH"!==opts.method||(body=capability.blobConstructor?new global.Blob(self._body.map(function(buffer){return toArrayBuffer(buffer)}),{type:(headersObj["content-type"]||{}).value||""}):Buffer.concat(self._body).toString()),"fetch"===self._mode){var headers=Object.keys(headersObj).map(function(name){return[headersObj[name].name,headersObj[name].value]});global.fetch(self._opts.url,{method:self._opts.method,headers:headers,body:body,mode:"cors",credentials:opts.withCredentials?"include":"same-origin"}).then(function(response){self._fetchResponse=response,self._connect()},function(reason){self.emit("error",reason)})}else{var xhr=self._xhr=new global.XMLHttpRequest;try{xhr.open(self._opts.method,self._opts.url,!0)}catch(err){return void process.nextTick(function(){self.emit("error",err)})}"responseType"in xhr&&(xhr.responseType=self._mode.split(":")[0]),"withCredentials"in xhr&&(xhr.withCredentials=!!opts.withCredentials),"text"===self._mode&&"overrideMimeType"in xhr&&xhr.overrideMimeType("text/plain; charset=x-user-defined"),Object.keys(headersObj).forEach(function(name){xhr.setRequestHeader(headersObj[name].name,headersObj[name].value)}),self._response=null,xhr.onreadystatechange=function(){switch(xhr.readyState){case rStates.LOADING:case rStates.DONE:self._onXHRProgress()}},"moz-chunked-arraybuffer"===self._mode&&(xhr.onprogress=function(){self._onXHRProgress()}),xhr.onerror=function(){self._destroyed||self.emit("error",new Error("XHR error"))};try{xhr.send(body)}catch(err){return void process.nextTick(function(){self.emit("error",err)})}}}},ClientRequest.prototype._onXHRProgress=function(){var self=this;statusValid(self._xhr)&&!self._destroyed&&(self._response||self._connect(),self._response._onXHRProgress())},ClientRequest.prototype._connect=function(){var self=this;self._destroyed||(self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode),self.emit("response",self._response))},ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk),cb()},ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(){var self=this;self._destroyed=!0,self._response&&(self._response._destroyed=!0),self._xhr&&self._xhr.abort()},ClientRequest.prototype.end=function(data,encoding,cb){var self=this;"function"==typeof data&&(cb=data,data=void 0),stream.Writable.prototype.end.call(self,data,encoding,cb)},ClientRequest.prototype.flushHeaders=function(){},ClientRequest.prototype.setTimeout=function(){},ClientRequest.prototype.setNoDelay=function(){},ClientRequest.prototype.setSocketKeepAlive=function(){};var unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer)},{"./capability":50,"./response":52,_process:37,buffer:5,inherits:11,"readable-stream":48,"to-arraybuffer":54}],52:[function(require,module,exports){(function(process,global,Buffer){var capability=require("./capability"),inherits=require("inherits"),stream=require("readable-stream"),rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},IncomingMessage=exports.IncomingMessage=function(xhr,response,mode){function read(){reader.read().then(function(result){if(!self._destroyed){if(result.done)return void self.push(null);self.push(new Buffer(result.value)),read()}})}var self=this;if(stream.Readable.call(self),self._mode=mode,self.headers={},self.rawHeaders=[],self.trailers={},self.rawTrailers=[],self.on("end",function(){process.nextTick(function(){self.emit("close")})}),"fetch"===mode){self._fetchResponse=response,self.url=response.url,self.statusCode=response.status,self.statusMessage=response.statusText;for(var header,_i,_it=response.headers[Symbol.iterator]();header=(_i=_it.next()).value,!_i.done;)self.headers[header[0].toLowerCase()]=header[1],self.rawHeaders.push(header[0],header[1]);var reader=response.body.getReader();read()}else{self._xhr=xhr,self._pos=0,self.url=xhr.responseURL,self.statusCode=xhr.status,self.statusMessage=xhr.statusText;var headers=xhr.getAllResponseHeaders().split(/\r?\n/);if(headers.forEach(function(header){var matches=header.match(/^([^:]+):\s*(.*)/);if(matches){var key=matches[1].toLowerCase();
9
+ "set-cookie"===key?(void 0===self.headers[key]&&(self.headers[key]=[]),self.headers[key].push(matches[2])):void 0!==self.headers[key]?self.headers[key]+=", "+matches[2]:self.headers[key]=matches[2],self.rawHeaders.push(matches[1],matches[2])}}),self._charset="x-user-defined",!capability.overrideMimeType){var mimeType=self.rawHeaders["mime-type"];if(mimeType){var charsetMatch=mimeType.match(/;\s*charset=([^;])(;|$)/);charsetMatch&&(self._charset=charsetMatch[1].toLowerCase())}self._charset||(self._charset="utf-8")}}};inherits(IncomingMessage,stream.Readable),IncomingMessage.prototype._read=function(){},IncomingMessage.prototype._onXHRProgress=function(){var self=this,xhr=self._xhr,response=null;switch(self._mode){case"text:vbarray":if(xhr.readyState!==rStates.DONE)break;try{response=new global.VBArray(xhr.responseBody).toArray()}catch(e){}if(null!==response){self.push(new Buffer(response));break}case"text":try{response=xhr.responseText}catch(e){self._mode="text:vbarray";break}if(response.length>self._pos){var newData=response.substr(self._pos);if("x-user-defined"===self._charset){for(var buffer=new Buffer(newData.length),i=0;i<newData.length;i++)buffer[i]=255&newData.charCodeAt(i);self.push(buffer)}else self.push(newData,self._charset);self._pos=response.length}break;case"arraybuffer":if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response,self.push(new Buffer(new Uint8Array(response)));break;case"moz-chunked-arraybuffer":if(response=xhr.response,xhr.readyState!==rStates.LOADING||!response)break;self.push(new Buffer(new Uint8Array(response)));break;case"ms-stream":if(response=xhr.response,xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader;reader.onprogress=function(){reader.result.byteLength>self._pos&&(self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos)))),self._pos=reader.result.byteLength)},reader.onload=function(){self.push(null)},reader.readAsArrayBuffer(response)}self._xhr.readyState===rStates.DONE&&"ms-stream"!==self._mode&&self.push(null)}}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},require("buffer").Buffer)},{"./capability":50,_process:37,buffer:5,inherits:11,"readable-stream":48}],53:[function(require,module,exports){function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding))throw new Error("Unknown encoding: "+encoding)}function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2,this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3,this.charLength=this.charReceived?3:0}var Buffer=require("buffer").Buffer,isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},StringDecoder=exports.StringDecoder=function(encoding){switch(this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,""),assertEncoding(encoding),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=base64DetectIncompleteChar;break;default:return void(this.write=passThroughWrite)}this.charBuffer=new Buffer(6),this.charReceived=0,this.charLength=0};StringDecoder.prototype.write=function(buffer){for(var charStr="";this.charLength;){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;if(buffer.copy(this.charBuffer,this.charReceived,0,available),this.charReceived+=available,this.charReceived<this.charLength)return"";buffer=buffer.slice(available,buffer.length),charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(!(charCode>=55296&&charCode<=56319)){if(this.charReceived=this.charLength=0,0===buffer.length)return charStr;break}this.charLength+=this.surrogateSize,charStr=""}this.detectIncompleteChar(buffer);var end=buffer.length;this.charLength&&(buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end),end-=this.charReceived),charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1,charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;return this.charLength+=size,this.charReceived+=size,this.charBuffer.copy(this.charBuffer,size,0,size),buffer.copy(this.charBuffer,0,0,size),charStr.substring(0,end)}return charStr},StringDecoder.prototype.detectIncompleteChar=function(buffer){for(var i=buffer.length>=3?3:buffer.length;i>0;i--){var c=buffer[buffer.length-i];if(1==i&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i},StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length&&(res=this.write(buffer)),this.charReceived){var cr=this.charReceived,buf=this.charBuffer,enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res}},{buffer:5}],54:[function(require,module,exports){var Buffer=require("buffer").Buffer;module.exports=function(buf){if(buf instanceof Uint8Array){if(0===buf.byteOffset&&buf.byteLength===buf.buffer.byteLength)return buf.buffer;if("function"==typeof buf.buffer.slice)return buf.buffer.slice(buf.byteOffset,buf.byteOffset+buf.byteLength)}if(Buffer.isBuffer(buf)){for(var arrayCopy=new Uint8Array(buf.length),len=buf.length,i=0;i<len;i++)arrayCopy[i]=buf[i];return arrayCopy.buffer}throw new Error("Argument must be a Buffer")}},{buffer:5}],55:[function(require,module,exports){"use strict";function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util.isObject(url)&&url instanceof Url)return url;var u=new Url;return u.parse(url,parseQueryString,slashesDenoteHost),u}function urlFormat(obj){return util.isString(obj)&&(obj=urlParse(obj)),obj instanceof Url?obj.format():Url.prototype.format.call(obj)}function urlResolve(source,relative){return urlParse(source,!1,!0).resolve(relative)}function urlResolveObject(source,relative){return source?urlParse(source,!1,!0).resolveObject(relative):relative}var punycode=require("punycode"),util=require("./util");exports.parse=urlParse,exports.resolve=urlResolve,exports.resolveObject=urlResolveObject,exports.format=urlFormat,exports.Url=Url;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r","\n","\t"],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require("querystring");Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util.isString(url))throw new TypeError("Parameter 'url' must be a string, not "+typeof url);var queryIndex=url.indexOf("?"),splitter=queryIndex!==-1&&queryIndex<url.indexOf("#")?"?":"#",uSplit=url.split(splitter),slashRegex=/\\/g;uSplit[0]=uSplit[0].replace(slashRegex,"/"),url=uSplit.join(splitter);var rest=url;if(rest=rest.trim(),!slashesDenoteHost&&1===url.split("#").length){var simplePath=simplePathPattern.exec(rest);if(simplePath)return this.path=rest,this.href=rest,this.pathname=simplePath[1],simplePath[2]?(this.search=simplePath[2],parseQueryString?this.query=querystring.parse(this.search.substr(1)):this.query=this.search.substr(1)):parseQueryString&&(this.search="",this.query={}),this}var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto,rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes="//"===rest.substr(0,2);!slashes||proto&&hostlessProtocol[proto]||(rest=rest.substr(2),this.slashes=!0)}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){for(var hostEnd=-1,i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);hec!==-1&&(hostEnd===-1||hec<hostEnd)&&(hostEnd=hec)}var auth,atSign;atSign=hostEnd===-1?rest.lastIndexOf("@"):rest.lastIndexOf("@",hostEnd),atSign!==-1&&(auth=rest.slice(0,atSign),rest=rest.slice(atSign+1),this.auth=decodeURIComponent(auth)),hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);hec!==-1&&(hostEnd===-1||hec<hostEnd)&&(hostEnd=hec)}hostEnd===-1&&(hostEnd=rest.length),this.host=rest.slice(0,hostEnd),rest=rest.slice(hostEnd),this.parseHost(),this.hostname=this.hostname||"";var ipv6Hostname="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!ipv6Hostname)for(var hostparts=this.hostname.split(/\./),i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(part&&!part.match(hostnamePartPattern)){for(var newpart="",j=0,k=part.length;j<k;j++)newpart+=part.charCodeAt(j)>127?"x":part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);bit&&(validParts.push(bit[1]),notHost.unshift(bit[2])),notHost.length&&(rest="/"+notHost.join(".")+rest),this.hostname=validParts.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),ipv6Hostname||(this.hostname=punycode.toASCII(this.hostname));var p=this.port?":"+this.port:"",h=this.hostname||"";this.host=h+p,this.href+=this.host,ipv6Hostname&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==rest[0]&&(rest="/"+rest))}if(!unsafeProtocol[lowerProto])for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];if(rest.indexOf(ae)!==-1){var esc=encodeURIComponent(ae);esc===ae&&(esc=escape(ae)),rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");hash!==-1&&(this.hash=rest.substr(hash),rest=rest.slice(0,hash));var qm=rest.indexOf("?");if(qm!==-1?(this.search=rest.substr(qm),this.query=rest.substr(qm+1),parseQueryString&&(this.query=querystring.parse(this.query)),rest=rest.slice(0,qm)):parseQueryString&&(this.search="",this.query={}),rest&&(this.pathname=rest),slashedProtocol[lowerProto]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var p=this.pathname||"",s=this.search||"";this.path=p+s}return this.href=this.format(),this},Url.prototype.format=function(){var auth=this.auth||"";auth&&(auth=encodeURIComponent(auth),auth=auth.replace(/%3A/i,":"),auth+="@");var protocol=this.protocol||"",pathname=this.pathname||"",hash=this.hash||"",host=!1,query="";this.host?host=auth+this.host:this.hostname&&(host=auth+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(host+=":"+this.port)),this.query&&util.isObject(this.query)&&Object.keys(this.query).length&&(query=querystring.stringify(this.query));var search=this.search||query&&"?"+query||"";return protocol&&":"!==protocol.substr(-1)&&(protocol+=":"),this.slashes||(!protocol||slashedProtocol[protocol])&&host!==!1?(host="//"+(host||""),pathname&&"/"!==pathname.charAt(0)&&(pathname="/"+pathname)):host||(host=""),hash&&"#"!==hash.charAt(0)&&(hash="#"+hash),search&&"?"!==search.charAt(0)&&(search="?"+search),pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)}),search=search.replace("#","%23"),protocol+host+pathname+search+hash},Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,!1,!0)).format()},Url.prototype.resolveObject=function(relative){if(util.isString(relative)){var rel=new Url;rel.parse(relative,!1,!0),relative=rel}for(var result=new Url,tkeys=Object.keys(this),tk=0;tk<tkeys.length;tk++){var tkey=tkeys[tk];result[tkey]=this[tkey]}if(result.hash=relative.hash,""===relative.href)return result.href=result.format(),result;if(relative.slashes&&!relative.protocol){for(var rkeys=Object.keys(relative),rk=0;rk<rkeys.length;rk++){var rkey=rkeys[rk];"protocol"!==rkey&&(result[rkey]=relative[rkey])}return slashedProtocol[result.protocol]&&result.hostname&&!result.pathname&&(result.path=result.pathname="/"),result.href=result.format(),result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){for(var keys=Object.keys(relative),v=0;v<keys.length;v++){var k=keys[v];result[k]=relative[k]}return result.href=result.format(),result}if(result.protocol=relative.protocol,relative.host||hostlessProtocol[relative.protocol])result.pathname=relative.pathname;else{for(var relPath=(relative.pathname||"").split("/");relPath.length&&!(relative.host=relPath.shift()););relative.host||(relative.host=""),relative.hostname||(relative.hostname=""),""!==relPath[0]&&relPath.unshift(""),relPath.length<2&&relPath.unshift(""),result.pathname=relPath.join("/")}if(result.search=relative.search,result.query=relative.query,result.host=relative.host||"",result.auth=relative.auth,result.hostname=relative.hostname||relative.host,result.port=relative.port,result.pathname||result.search){var p=result.pathname||"",s=result.search||"";result.path=p+s}return result.slashes=result.slashes||relative.slashes,result.href=result.format(),result}var isSourceAbs=result.pathname&&"/"===result.pathname.charAt(0),isRelAbs=relative.host||relative.pathname&&"/"===relative.pathname.charAt(0),mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic&&(result.hostname="",result.port=null,result.host&&(""===srcPath[0]?srcPath[0]=result.host:srcPath.unshift(result.host)),result.host="",relative.protocol&&(relative.hostname=null,relative.port=null,relative.host&&(""===relPath[0]?relPath[0]=relative.host:relPath.unshift(relative.host)),relative.host=null),mustEndAbs=mustEndAbs&&(""===relPath[0]||""===srcPath[0])),isRelAbs)result.host=relative.host||""===relative.host?relative.host:result.host,result.hostname=relative.hostname||""===relative.hostname?relative.hostname:result.hostname,result.search=relative.search,result.query=relative.query,srcPath=relPath;else if(relPath.length)srcPath||(srcPath=[]),srcPath.pop(),srcPath=srcPath.concat(relPath),result.search=relative.search,result.query=relative.query;else if(!util.isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=!!(result.host&&result.host.indexOf("@")>0)&&result.host.split("@");authInHost&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift())}return result.search=relative.search,result.query=relative.query,util.isNull(result.pathname)&&util.isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.href=result.format(),result}if(!srcPath.length)return result.pathname=null,result.search?result.path="/"+result.search:result.path=null,result.href=result.format(),result;for(var last=srcPath.slice(-1)[0],hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&("."===last||".."===last)||""===last,up=0,i=srcPath.length;i>=0;i--)last=srcPath[i],"."===last?srcPath.splice(i,1):".."===last?(srcPath.splice(i,1),up++):up&&(srcPath.splice(i,1),up--);if(!mustEndAbs&&!removeAllDots)for(;up--;up)srcPath.unshift("..");!mustEndAbs||""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0)||srcPath.unshift(""),hasTrailingSlash&&"/"!==srcPath.join("/").substr(-1)&&srcPath.push("");var isAbsolute=""===srcPath[0]||srcPath[0]&&"/"===srcPath[0].charAt(0);if(psychotic){result.hostname=result.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=!!(result.host&&result.host.indexOf("@")>0)&&result.host.split("@");authInHost&&(result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift())}return mustEndAbs=mustEndAbs||result.host&&srcPath.length,mustEndAbs&&!isAbsolute&&srcPath.unshift(""),srcPath.length?result.pathname=srcPath.join("/"):(result.pathname=null,result.path=null),util.isNull(result.pathname)&&util.isNull(result.search)||(result.path=(result.pathname?result.pathname:"")+(result.search?result.search:"")),result.auth=relative.auth||result.auth,result.slashes=result.slashes||relative.slashes,result.href=result.format(),result},Url.prototype.parseHost=function(){var host=this.host,port=portPattern.exec(host);port&&(port=port[0],":"!==port&&(this.port=port.substr(1)),host=host.substr(0,host.length-port.length)),host&&(this.hostname=host)}},{"./util":56,punycode:38,querystring:41}],56:[function(require,module,exports){"use strict";module.exports={isString:function(arg){return"string"==typeof arg},isObject:function(arg){return"object"==typeof arg&&null!==arg},isNull:function(arg){return null===arg},isNullOrUndefined:function(arg){return null==arg}}},{}],57:[function(require,module,exports){(function(global){function deprecate(fn,msg){function deprecated(){if(!warned){if(config("throwDeprecation"))throw new Error(msg);config("traceDeprecation")?console.trace(msg):console.warn(msg),warned=!0}return fn.apply(this,arguments)}if(config("noDeprecation"))return fn;var warned=!1;return deprecated}function config(name){try{if(!global.localStorage)return!1}catch(_){return!1}var val=global.localStorage[name];return null!=val&&"true"===String(val).toLowerCase()}module.exports=deprecate}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],58:[function(require,module,exports){function extend(){for(var target={},i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source)hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target}module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty},{}]},{},[1])(1)}),function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.manifold=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var Manifold;!function(Manifold){var StringValue=function(){function StringValue(value){this.value="",value&&(this.value=value.toLowerCase())}return StringValue.prototype.toString=function(){return this.value},StringValue}();Manifold.StringValue=StringValue}(Manifold||(Manifold={}));var Manifold,__extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)};!function(Manifold){var TreeSortType=function(_super){function TreeSortType(){_super.apply(this,arguments)}return __extends(TreeSortType,_super),TreeSortType.prototype.date=function(){return new TreeSortType(TreeSortType.DATE.toString())},TreeSortType.prototype.none=function(){return new TreeSortType(TreeSortType.NONE.toString())},TreeSortType.DATE=new TreeSortType("date"),TreeSortType.NONE=new TreeSortType("none"),TreeSortType}(Manifold.StringValue);Manifold.TreeSortType=TreeSortType}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var Bootstrapper=function(){function Bootstrapper(options){this._options=options,this._options.locale=this._options.locale||"en-GB"}return Bootstrapper.prototype.bootstrap=function(){var that=this;return new Promise(function(resolve,reject){var msie=that._msieversion();if(msie>0&&msie<11)if(9===msie){var settings={url:that._options.iiifResourceUri,type:"GET",dataType:"jsonp",jsonp:"callback",jsonpCallback:"manifestCallback"};$.ajax(settings),window.manifestCallback=function(json){that._loaded(that,JSON.stringify(json),resolve,reject)}}else 10===msie&&$.getJSON(that._options.iiifResourceUri,function(json){that._loaded(that,JSON.stringify(json),resolve,reject)});else manifesto.loadManifest(that._options.iiifResourceUri).then(function(json){that._loaded(that,json,resolve,reject)})})},Bootstrapper.prototype._loaded=function(bootstrapper,json,resolve,reject){var iiifResource=manifesto.create(json,{locale:bootstrapper._options.locale});if(bootstrapper._options.iiifResource||(bootstrapper._options.iiifResource=iiifResource),iiifResource.getIIIFResourceType().toString()===manifesto.IIIFResourceType.collection().toString()){var collections=iiifResource.getCollections();collections&&collections.length?iiifResource.getCollectionByIndex(bootstrapper._options.collectionIndex).then(function(collection){collection||reject("Collection index not found"),0===collection.getTotalManifests()&&0===bootstrapper._options.manifestIndex&&collection.getTotalCollections()>0&&(bootstrapper._options.collectionIndex=0,bootstrapper._options.iiifResourceUri=collection.id,bootstrapper.bootstrap()),collection.getManifestByIndex(bootstrapper._options.manifestIndex).then(function(manifest){bootstrapper._options.manifest=manifest;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)})}):iiifResource.getManifestByIndex(bootstrapper._options.manifestIndex).then(function(manifest){bootstrapper._options.manifest=manifest;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)})}else{bootstrapper._options.manifest=iiifResource;var helper=new Manifold.Helper(bootstrapper._options);resolve(helper)}},Bootstrapper.prototype._msieversion=function(){var ua=window.navigator.userAgent,msie=ua.indexOf("MSIE ");return msie>0?parseInt(ua.substring(msie+5,ua.indexOf(".",msie))):0},Bootstrapper}();Manifold.Bootstrapper=Bootstrapper}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var ExternalResource=function(){function ExternalResource(resource,dataUriFunc){this.isResponseHandled=!1,resource.externalResource=this,this.dataUri=dataUriFunc(resource),this._parseAuthServices(resource)}return ExternalResource.prototype._parseAuthServices=function(resource){this.clickThroughService=manifesto.Utils.getService(resource,manifesto.ServiceProfile.clickThrough().toString()),this.loginService=manifesto.Utils.getService(resource,manifesto.ServiceProfile.login().toString()),this.restrictedService=manifesto.Utils.getService(resource,manifesto.ServiceProfile.restricted().toString()),this.clickThroughService?(this.logoutService=this.clickThroughService.getService(manifesto.ServiceProfile.logout().toString()),this.tokenService=this.clickThroughService.getService(manifesto.ServiceProfile.token().toString())):this.loginService?(this.logoutService=this.loginService.getService(manifesto.ServiceProfile.logout().toString()),this.tokenService=this.loginService.getService(manifesto.ServiceProfile.token().toString())):this.restrictedService&&(this.logoutService=this.restrictedService.getService(manifesto.ServiceProfile.logout().toString()),this.tokenService=this.restrictedService.getService(manifesto.ServiceProfile.token().toString()))},ExternalResource.prototype.isAccessControlled=function(){return!!(this.clickThroughService||this.loginService||this.restrictedService)},ExternalResource.prototype.hasServiceDescriptor=function(){return this.dataUri.endsWith("info.json")},ExternalResource.prototype.getData=function(accessToken){var that=this;return that.data={},new Promise(function(resolve,reject){var type="GET";if(!that.hasServiceDescriptor()){if(!that.isAccessControlled())return that.status=HTTPStatusCode.OK,void resolve(that);type="HEAD"}$.ajax({url:that.dataUri,type:type,dataType:"json",beforeSend:function(xhr){accessToken&&xhr.setRequestHeader("Authorization","Bearer "+accessToken.accessToken)}}).done(function(data){if(data){var uri=unescape(data["@id"]);that.data=data,that._parseAuthServices(that.data),uri.endsWith("/info.json")&&(uri=uri.substr(0,uri.lastIndexOf("/")));var dataUri=that.dataUri;dataUri.endsWith("/info.json")&&(dataUri=dataUri.substr(0,dataUri.lastIndexOf("/"))),uri!==dataUri&&that.loginService?that.status=HTTPStatusCode.MOVED_TEMPORARILY:that.status=HTTPStatusCode.OK,resolve(that)}else that.status=HTTPStatusCode.OK,resolve(that)}).fail(function(error){that.status=error.status,that.error=error,error.responseJSON&&that._parseAuthServices(error.responseJSON),resolve(that)})})},ExternalResource}();Manifold.ExternalResource=ExternalResource}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var Helper=function(){function Helper(options){this.options=options,this.iiifResource=this.options.iiifResource,this.iiifResourceUri=this.options.iiifResourceUri,this.manifest=this.options.manifest,this.collectionIndex=this.options.collectionIndex||0,this.manifestIndex=this.options.manifestIndex||0,this.sequenceIndex=this.options.sequenceIndex||0,this.canvasIndex=this.options.canvasIndex||0}return Helper.prototype.getAutoCompleteService=function(){var service=this.getSearchWithinService();return service?service.getService(manifesto.ServiceProfile.autoComplete()):null},Helper.prototype.getAttribution=function(){return Manifesto.TranslationCollection.getValue(this.manifest.getAttribution())},Helper.prototype.getCanvases=function(){return this.getCurrentSequence().getCanvases()},Helper.prototype.getCanvasById=function(id){return this.getCurrentSequence().getCanvasById(id)},Helper.prototype.getCanvasesById=function(ids){for(var canvases=[],i=0;i<ids.length;i++){var id=ids[i];canvases.push(this.getCanvasById(id))}return canvases},Helper.prototype.getCanvasByIndex=function(index){return this.getCurrentSequence().getCanvasByIndex(index)},Helper.prototype.getCanvasIndexById=function(id){return this.getCurrentSequence().getCanvasIndexById(id)},Helper.prototype.getCanvasIndexByLabel=function(label){var foliated=this.getManifestType().toString()===manifesto.ManifestType.manuscript().toString();return this.getCurrentSequence().getCanvasIndexByLabel(label,foliated)},Helper.prototype.getCanvasRange=function(canvas,path){var ranges=this.getCanvasRanges(canvas);if(path){for(var i=0;i<ranges.length;i++){var range=ranges[i];if(range.path===path)return range}return null}return ranges[0]},Helper.prototype.getCanvasRanges=function(canvas){return canvas.ranges?canvas.ranges:(canvas.ranges=this.manifest.getAllRanges().en().where(function(range){return range.getCanvasIds().en().any(function(c){return c===canvas.id})}).toArray(),canvas.ranges)},Helper.prototype.getCollectionIndex=function(iiifResource){var index;return iiifResource.parentCollection&&(index=iiifResource.parentCollection.index),index},Helper.prototype.getCurrentCanvas=function(){return this.getCurrentSequence().getCanvasByIndex(this.canvasIndex)},Helper.prototype.getCurrentElement=function(){return this.getCanvasByIndex(this.canvasIndex)},Helper.prototype.getCurrentSequence=function(){return this.getSequenceByIndex(this.sequenceIndex)},Helper.prototype.getElementType=function(element){return element||(element=this.getCurrentCanvas()),element.getType()},Helper.prototype.getFirstPageIndex=function(){return 0},Helper.prototype.getInfoUri=function(canvas){var images=canvas.getImages();if(images&&images.length){for(var infoUri,firstImage=images[0],resource=firstImage.getResource(),services=resource.getServices(),i=0;i<services.length;i++){var service=services[i],id=service.id;id.endsWith("/")||(id+="/"),manifesto.Utils.isImageProfile(service.getProfile())&&(infoUri=id+"info.json")}return infoUri}var service=canvas.getService(manifesto.ServiceProfile.ixif());return service?service.getInfoUri():canvas.id},Helper.prototype.getLabel=function(){return Manifesto.TranslationCollection.getValue(this.manifest.getLabel())},Helper.prototype.getLastCanvasLabel=function(alphanumeric){return this.getCurrentSequence().getLastCanvasLabel(alphanumeric)},Helper.prototype.getLastPageIndex=function(){return this.getTotalCanvases()-1},Helper.prototype.getLicense=function(){return this.manifest.getLicense()},Helper.prototype.getLogo=function(){return this.manifest.getLogo()},Helper.prototype.getManifestType=function(){var manifestType=this.manifest.getManifestType();return""===manifestType.toString()&&(manifestType=manifesto.ManifestType.monograph()),manifestType},Helper.prototype.getMetadata=function(options){var metadataGroups=[],manifestMetadata=this.manifest.getMetadata(),manifestGroup=new Manifold.MetadataGroup(this.manifest);if(manifestMetadata&&manifestMetadata.length&&manifestGroup.addMetadata(manifestMetadata,!0),this.manifest.getDescription().length){var metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.label=[new Manifesto.Translation("description",this.options.locale)],metadataItem.value=this.manifest.getDescription(),metadataItem.isRootLevel=!0,manifestGroup.addItem(metadataItem)}if(this.manifest.getAttribution().length){var metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.label=[new Manifesto.Translation("attribution",this.options.locale)],metadataItem.value=this.manifest.getAttribution(),metadataItem.isRootLevel=!0,manifestGroup.addItem(metadataItem)}if(this.manifest.getLicense()){var item={label:"license",value:options&&options.licenseFormatter?options.licenseFormatter.format(this.manifest.getLicense()):this.manifest.getLicense()},metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.parse(item),metadataItem.isRootLevel=!0,manifestGroup.addItem(metadataItem)}if(this.manifest.getLogo()){var item={label:"logo",value:'<img src="'+this.manifest.getLogo()+'"/>'},metadataItem=new Manifesto.MetadataItem(this.options.locale);metadataItem.parse(item),metadataItem.isRootLevel=!0,manifestGroup.addItem(metadataItem)}return metadataGroups.push(manifestGroup),options?this._parseMetadataOptions(options,metadataGroups):metadataGroups},Helper.prototype._parseMetadataOptions=function(options,metadataGroups){var sequence=this.getCurrentSequence(),sequenceMetadata=sequence.getMetadata();if(sequenceMetadata&&sequenceMetadata.length){var sequenceGroup=new Manifold.MetadataGroup(sequence);sequenceGroup.addMetadata(sequenceMetadata),metadataGroups.push(sequenceGroup)}if(options.range){var rangeGroups=this._getRangeMetadata([],options.range);rangeGroups=rangeGroups.reverse(),metadataGroups=metadataGroups.concat(rangeGroups)}if(options.canvases&&options.canvases.length)for(var i=0;i<options.canvases.length;i++){var canvas=options.canvases[i],canvasMetadata=canvas.getMetadata();if(canvasMetadata&&canvasMetadata.length){var canvasGroup=new Manifold.MetadataGroup(canvas);canvasGroup.addMetadata(canvas.getMetadata()),metadataGroups.push(canvasGroup)}for(var images=canvas.getImages(),j=0;j<images.length;j++){var image=images[j],imageMetadata=image.getMetadata();if(imageMetadata&&imageMetadata.length){var imageGroup=new Manifold.MetadataGroup(image);imageGroup.addMetadata(imageMetadata),metadataGroups.push(imageGroup)}}}return metadataGroups},Helper.prototype._getRangeMetadata=function(metadataGroups,range){var rangeMetadata=range.getMetadata();if(rangeMetadata&&rangeMetadata.length){var rangeGroup=new Manifold.MetadataGroup(range);rangeGroup.addMetadata(rangeMetadata),metadataGroups.push(rangeGroup);
10
+ }return range.parentRange?this._getRangeMetadata(metadataGroups,range.parentRange):metadataGroups},Helper.prototype.getMultiSelectState=function(){return this._multiSelectState||(this._multiSelectState=new Manifold.MultiSelectState,this._multiSelectState.ranges=this.getRanges().clone(),this._multiSelectState.canvases=this.getCurrentSequence().getCanvases().clone()),this._multiSelectState},Helper.prototype.getRanges=function(){return this.manifest.getAllRanges()},Helper.prototype.getRangeByPath=function(path){return this.manifest.getRangeByPath(path)},Helper.prototype.getRangeCanvases=function(range){var ids=range.getCanvasIds();return this.getCanvasesById(ids)},Helper.prototype.getRelated=function(){return this.manifest.getRelated()},Helper.prototype.getResources=function(){var element=this.getCurrentElement();return element.getResources()},Helper.prototype.getSearchWithinService=function(){return this.manifest.getService(manifesto.ServiceProfile.searchWithin())},Helper.prototype.getSeeAlso=function(){return this.manifest.getSeeAlso()},Helper.prototype.getSequenceByIndex=function(index){return this.manifest.getSequenceByIndex(index)},Helper.prototype.getShareServiceUrl=function(){var url,shareService=this.manifest.getService(manifesto.ServiceProfile.shareExtensions());return shareService&&(shareService.length&&(shareService=shareService[0]),url=shareService.__jsonld.shareUrl),url},Helper.prototype.getSortedTreeNodesByDate=function(sortedTree,tree){var all=tree.nodes.en().traverseUnique(function(node){return node.nodes}).where(function(n){return n.data.type===manifesto.TreeNodeType.collection().toString()||n.data.type===manifesto.TreeNodeType.manifest().toString()}).toArray(),manifests=tree.nodes.en().traverseUnique(function(n){return n.nodes}).where(function(n){return n.data.type===manifesto.TreeNodeType.manifest().toString()}).toArray();this.createDecadeNodes(sortedTree,all),this.sortDecadeNodes(sortedTree),this.createYearNodes(sortedTree,all),this.sortYearNodes(sortedTree),this.createMonthNodes(sortedTree,manifests),this.sortMonthNodes(sortedTree),this.createDateNodes(sortedTree,manifests),this.pruneDecadeNodes(sortedTree)},Helper.prototype.getStartCanvasIndex=function(){return this.getCurrentSequence().getStartCanvasIndex()},Helper.prototype.getThumbs=function(width,height){return this.getCurrentSequence().getThumbs(width,height)},Helper.prototype.getTopRanges=function(){return this.manifest.getTopRanges()},Helper.prototype.getTotalCanvases=function(){return this.getCurrentSequence().getTotalCanvases()},Helper.prototype.getTrackingLabel=function(){return this.manifest.getTrackingLabel()},Helper.prototype.getTree=function(topRangeIndex,sortType){void 0===topRangeIndex&&(topRangeIndex=0),void 0===sortType&&(sortType=Manifold.TreeSortType.NONE);var tree;if(this.iiifResource.isCollection())tree=this.iiifResource.getDefaultTree();else{var topRanges=this.iiifResource.getTopRanges(),root=new manifesto.TreeNode;if(root.label="root",root.data=this.iiifResource,!topRanges.length)return root;var range=topRanges[topRangeIndex];tree=range.getTree(root)}var sortedTree=new manifesto.TreeNode;switch(sortType.toString()){case Manifold.TreeSortType.DATE.toString():if(this.treeHasNavDates(tree)){this.getSortedTreeNodesByDate(sortedTree,tree);break}default:sortedTree=tree}return sortedTree},Helper.prototype.treeHasNavDates=function(tree){var node=tree.nodes.en().traverseUnique(function(node){return node.nodes}).where(function(n){return!isNaN(n.navDate)}).first();return!!node},Helper.prototype.getViewingDirection=function(){var viewingDirection=this.getCurrentSequence().getViewingDirection();return viewingDirection.toString()||(viewingDirection=this.manifest.getViewingDirection()),viewingDirection},Helper.prototype.getViewingHint=function(){var viewingHint=this.getCurrentSequence().getViewingHint();return viewingHint.toString()||(viewingHint=this.manifest.getViewingHint()),viewingHint},Helper.prototype.hasParentCollection=function(){return!!this.manifest.parentCollection},Helper.prototype.hasRelatedPage=function(){var related=this.getRelated();return!!related&&(related.length&&(related=related[0]),"text/html"===related.format)},Helper.prototype.hasResources=function(){return this.getResources().length>0},Helper.prototype.isBottomToTop=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.bottomToTop().toString()},Helper.prototype.isCanvasIndexOutOfRange=function(index){return this.getCurrentSequence().isCanvasIndexOutOfRange(index)},Helper.prototype.isContinuous=function(){return this.getViewingHint().toString()===manifesto.ViewingHint.continuous().toString()},Helper.prototype.isFirstCanvas=function(index){return"undefined"!=typeof index?this.getCurrentSequence().isFirstCanvas(index):this.getCurrentSequence().isFirstCanvas(this.canvasIndex)},Helper.prototype.isHorizontallyAligned=function(){return this.isLeftToRight()||this.isRightToLeft()},Helper.prototype.isLastCanvas=function(index){return"undefined"!=typeof index?this.getCurrentSequence().isLastCanvas(index):this.getCurrentSequence().isLastCanvas(this.canvasIndex)},Helper.prototype.isLeftToRight=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.leftToRight().toString()},Helper.prototype.isMultiCanvas=function(){return this.getCurrentSequence().isMultiCanvas()},Helper.prototype.isMultiSequence=function(){return this.manifest.isMultiSequence()},Helper.prototype.isPaged=function(){return this.getViewingHint().toString()===manifesto.ViewingHint.paged().toString()},Helper.prototype.isPagingAvailable=function(){return this.isPagingEnabled()&&this.getTotalCanvases()>2},Helper.prototype.isPagingEnabled=function(){return this.manifest.isPagingEnabled()||this.getCurrentSequence().isPagingEnabled()},Helper.prototype.isRightToLeft=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.rightToLeft().toString()},Helper.prototype.isTopToBottom=function(){return this.getViewingDirection().toString()===manifesto.ViewingDirection.topToBottom().toString()},Helper.prototype.isTotalCanvasesEven=function(){return this.getCurrentSequence().isTotalCanvasesEven()},Helper.prototype.isUIEnabled=function(name){var uiExtensions=this.manifest.getService(manifesto.ServiceProfile.uiExtensions());if(uiExtensions){var disableUI=uiExtensions.getProperty("disableUI");if(disableUI&&(disableUI.contains(name)||disableUI.contains(name.toLowerCase())))return!1}return!0},Helper.prototype.isVerticallyAligned=function(){return this.isTopToBottom()||this.isBottomToTop()},Helper.prototype.createDateNodes=function(rootNode,nodes){for(var i=0;i<nodes.length;i++){var node=nodes[i],year=this.getNodeYear(node),month=this.getNodeMonth(node),dateNode=new manifesto.TreeNode;dateNode.id=node.id,dateNode.label=this.getNodeDisplayDate(node),dateNode.data=node.data,dateNode.data.type=manifesto.TreeNodeType.manifest().toString(),dateNode.data.year=year,dateNode.data.month=month;var decadeNode=this.getDecadeNode(rootNode,year);if(decadeNode){var yearNode=this.getYearNode(decadeNode,year);if(yearNode){var monthNode=this.getMonthNode(yearNode,month);monthNode&&monthNode.addNode(dateNode)}}}},Helper.prototype.createDecadeNodes=function(rootNode,nodes){for(var decadeNode,i=0;i<nodes.length;i++){var node=nodes[i],year=this.getNodeYear(node),endYear=(Number(year.toString().substr(2,1)),Number(year.toString().substr(0,3)+"9"));this.getDecadeNode(rootNode,year)||(decadeNode=new manifesto.TreeNode,decadeNode.label=year+" - "+endYear,decadeNode.navDate=node.navDate,decadeNode.data.startYear=year,decadeNode.data.endYear=endYear,rootNode.addNode(decadeNode))}},Helper.prototype.createMonthNodes=function(rootNode,nodes){for(var monthNode,i=0;i<nodes.length;i++){var node=nodes[i],year=this.getNodeYear(node),month=this.getNodeMonth(node),decadeNode=this.getDecadeNode(rootNode,year),yearNode=this.getYearNode(decadeNode,year);decadeNode&&yearNode&&!this.getMonthNode(yearNode,month)&&(monthNode=new manifesto.TreeNode,monthNode.label=this.getNodeDisplayMonth(node),monthNode.navDate=node.navDate,monthNode.data.year=year,monthNode.data.month=month,yearNode.addNode(monthNode))}},Helper.prototype.createYearNodes=function(rootNode,nodes){for(var yearNode,i=0;i<nodes.length;i++){var node=nodes[i],year=this.getNodeYear(node),decadeNode=this.getDecadeNode(rootNode,year);decadeNode&&!this.getYearNode(decadeNode,year)&&(yearNode=new manifesto.TreeNode,yearNode.label=year.toString(),yearNode.navDate=node.navDate,yearNode.data.year=year,decadeNode.addNode(yearNode))}},Helper.prototype.getDecadeNode=function(rootNode,year){for(var i=0;i<rootNode.nodes.length;i++){var n=rootNode.nodes[i];if(year>=n.data.startYear&&year<=n.data.endYear)return n}return null},Helper.prototype.getMonthNode=function(yearNode,month){for(var i=0;i<yearNode.nodes.length;i++){var n=yearNode.nodes[i];if(month===this.getNodeMonth(n))return n}return null},Helper.prototype.getNodeDisplayDate=function(node){return node.navDate.toDateString()},Helper.prototype.getNodeDisplayMonth=function(node){var months=["January","February","March","April","May","June","July","August","September","October","November","December"];return months[node.navDate.getMonth()]},Helper.prototype.getNodeMonth=function(node){return node.navDate.getMonth()},Helper.prototype.getNodeYear=function(node){return node.navDate.getFullYear()},Helper.prototype.getYearNode=function(decadeNode,year){for(var i=0;i<decadeNode.nodes.length;i++){var n=decadeNode.nodes[i];if(year===this.getNodeYear(n))return n}return null},Helper.prototype.pruneDecadeNodes=function(rootNode){for(var pruned=[],i=0;i<rootNode.nodes.length;i++){var n=rootNode.nodes[i];n.nodes.length||pruned.push(n)}for(var j=0;j<pruned.length;j++){var p=pruned[j];rootNode.nodes.remove(p)}},Helper.prototype.sortDecadeNodes=function(rootNode){rootNode.nodes=rootNode.nodes.sort(function(a,b){return a.data.startYear-b.data.startYear})},Helper.prototype.sortMonthNodes=function(rootNode){for(var _this=this,i=0;i<rootNode.nodes.length;i++)for(var decadeNode=rootNode.nodes[i],j=0;j<decadeNode.nodes.length;j++){var monthNode=decadeNode.nodes[j];monthNode.nodes=monthNode.nodes.sort(function(a,b){return _this.getNodeMonth(a)-_this.getNodeMonth(b)})}},Helper.prototype.sortYearNodes=function(rootNode){for(var _this=this,i=0;i<rootNode.nodes.length;i++){var decadeNode=rootNode.nodes[i];decadeNode.nodes=decadeNode.nodes.sort(function(a,b){return _this.getNodeYear(a)-_this.getNodeYear(b)})}},Helper}();Manifold.Helper=Helper}(Manifold||(Manifold={}));var Manifold;!function(Manifold){function loadManifest(options){var bootstrapper=new Manifold.Bootstrapper(options);return bootstrapper.bootstrap()}Manifold.loadManifest=loadManifest}(Manifold||(Manifold={})),function(w){w.Manifold||(w.Manifold=Manifold)}(window);var Manifold;!function(Manifold){var MetadataGroup=function(){function MetadataGroup(resource,label){this.items=[],this.resource=resource,this.label=label}return MetadataGroup.prototype.addItem=function(item){this.items.push(item)},MetadataGroup.prototype.addMetadata=function(metadata,isRootLevel){void 0===isRootLevel&&(isRootLevel=!1);for(var i=0;i<metadata.length;i++){var item=metadata[i];item.isRootLevel=isRootLevel,this.addItem(item)}},MetadataGroup}();Manifold.MetadataGroup=MetadataGroup}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var MetadataOptions=function(){function MetadataOptions(){}return MetadataOptions}();Manifold.MetadataOptions=MetadataOptions}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var MultiSelectState=function(){function MultiSelectState(){this.isEnabled=!1,this.ranges=[],this.canvases=[]}return MultiSelectState.prototype.allCanvasesSelected=function(){return this.canvases.length>0&&this.getAllSelectedCanvases().length===this.canvases.length},MultiSelectState.prototype.allRangesSelected=function(){return this.ranges.length>0&&this.getAllSelectedRanges().length===this.ranges.length},MultiSelectState.prototype.allSelected=function(){return this.allRangesSelected()&&this.allCanvasesSelected()},MultiSelectState.prototype.getAll=function(){return this.canvases.concat(this.ranges)},MultiSelectState.prototype.getAllSelectedCanvases=function(){return this.canvases.en().where(function(c){return c.multiSelected}).toArray()},MultiSelectState.prototype.getAllSelectedRanges=function(){return this.ranges.en().where(function(r){return r.multiSelected}).toArray()},MultiSelectState.prototype.getCanvasById=function(id){return this.canvases.en().where(function(c){return c.id===id}).first()},MultiSelectState.prototype.getCanvasesByIds=function(ids){for(var canvases=[],i=0;i<ids.length;i++){var id=ids[i];canvases.push(this.getCanvasById(id))}return canvases},MultiSelectState.prototype.getRangeCanvases=function(range){var ids=range.getCanvasIds();return this.getCanvasesByIds(ids)},MultiSelectState.prototype.selectAll=function(selected){this.selectRanges(this.ranges,selected),this.selectCanvases(this.canvases,selected)},MultiSelectState.prototype.selectCanvas=function(canvas,selected){var c=this.canvases.en().where(function(c){return c.id===canvas.id}).first();c.multiSelected=selected},MultiSelectState.prototype.selectAllCanvases=function(selected){this.selectCanvases(this.canvases,selected)},MultiSelectState.prototype.selectCanvases=function(canvases,selected){for(var j=0;j<canvases.length;j++){var canvas=canvases[j];canvas.multiSelected=selected}},MultiSelectState.prototype.selectRange=function(range,selected){var r=this.ranges.en().where(function(r){return r.id===range.id}).first();r.multiSelected=selected;var canvases=this.getRangeCanvases(r);this.selectCanvases(canvases,selected)},MultiSelectState.prototype.selectAllRanges=function(selected){this.selectRanges(this.ranges,selected)},MultiSelectState.prototype.selectRanges=function(ranges,selected){for(var i=0;i<ranges.length;i++){var range=ranges[i];range.multiSelected=selected;var canvases=this.getCanvasesByIds(range.getCanvasIds());this.selectCanvases(canvases,selected)}},MultiSelectState.prototype.setEnabled=function(enabled){this.isEnabled=enabled;for(var items=this.getAll(),i=0;i<items.length;i++){var item=items[i];item.multiSelectEnabled=this.isEnabled,enabled||(item.multiSelected=!1)}},MultiSelectState}();Manifold.MultiSelectState=MultiSelectState}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var SearchResult=function(){function SearchResult(resource,canvasIndex){this.rects=[],this.canvasIndex=canvasIndex,this.addRect(resource)}return SearchResult.prototype.addRect=function(resource){var rect=new Manifold.SearchResultRect(resource);rect.canvasIndex=this.canvasIndex,rect.index=this.rects.length,this.rects.push(rect),this.rects.sort(function(a,b){return a.index-b.index})},SearchResult}();Manifold.SearchResult=SearchResult}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var SearchResultRect=function(){function SearchResultRect(result){this.isVisible=!0;var xywh=result.on.match(/.*xywh=(\d*),(\d*),(\d*),(\d*)/);this.x=Number(xywh[1]),this.y=Number(xywh[2]),this.width=Number(xywh[3]),this.height=Number(xywh[4]),this.chars=result.resource.chars}return SearchResultRect}();Manifold.SearchResultRect=SearchResultRect}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var Translation=function(){function Translation(value,locale){this.value=value,this.locale=locale}return Translation}();Manifold.Translation=Translation}(Manifold||(Manifold={}));var Manifold;!function(Manifold){var UriLabeller=function(){function UriLabeller(labels){this.labels=labels}return UriLabeller.prototype.format=function(url){if(url.indexOf("<a")!=-1)return url;var label=this.labels[url]?this.labels[url]:url;return'<a href="'+url+'">'+label+"</a>"},UriLabeller}();Manifold.UriLabeller=UriLabeller}(Manifold||(Manifold={}))},{}]},{},[1])(1)}),function(t,e,o){"use strict";function r(t,e,r,p){r=r||"width";var n,l,m,c=(e.match(s)||[])[2],f="px"===c?1:d[c+"toPx"],u=/r?em/i;if(f||u.test(c)&&!p)t=f?t:"rem"===c?i:"fontSize"===r?t.parentNode||t:t,f=f||parseFloat(a(t,"fontSize")),m=parseFloat(e)*f;else{n=t.style,l=n[r];try{n[r]=e}catch(x){return 0}m=n[r]?parseFloat(a(t,r)):0,n[r]=l!==o?l:null}return m}function a(t,e){var o,n,i,l,d,c=/^top|bottom/,f=["paddingTop","paddingBottom","borderTop","borderBottom"],u=4;if(o=m?m(t)[e]:(n=t.style["pixel"+e.charAt(0).toUpperCase()+e.slice(1)])?n+"px":"fontSize"===e?r(t,"1em","left",1)+"px":t.currentStyle[e],i=(o.match(s)||[])[2],"%"===i&&p)if(c.test(e)){for(l=(d=t.parentNode||t).offsetHeight;u--;)l-=parseFloat(a(d,f[u]));o=parseFloat(o)/100*l+"px"}else o=r(t,o);else("auto"===o||i&&"px"!==i)&&m?o=0:i&&"px"!==i&&!m&&(o=r(t,o)+"px");return o}var p,n=e.createElement("test"),i=e.documentElement,l=e.defaultView,m=l&&l.getComputedStyle,s=/^(-?[\d+\.\-]+)([a-z]+|%)$/i,d={},c=[1/25.4,1/2.54,1/72,1/6],f=["mm","cm","pt","pc","in","mozmm"],u=6;for(i.appendChild(n),m&&(n.style.marginTop="1%",p="1%"===m(n).marginTop);u--;)d[f[u]+"toPx"]=c[u]?c[u]*d.inToPx:r(n,"1"+f[u]);i.removeChild(n),n=o,t.Length={toPx:r}}(this,this.document);var Utils;!function(Utils){var Async=function(){function Async(){}return Async.waitFor=function(test,successCallback,failureCallback,interval,maxTries,numTries){interval||(interval=200),maxTries||(maxTries=100),numTries||(numTries=0),numTries+=1,numTries>maxTries?failureCallback&&failureCallback():test()?successCallback():setTimeout(function(){Async.waitFor(test,successCallback,failureCallback,interval,maxTries,numTries)},interval)},Async}();Utils.Async=Async}(Utils||(Utils={}));var Utils;!function(Utils){var Bools=function(){function Bools(){}return Bools.getBool=function(val,defaultVal){return null===val||"undefined"==typeof val?defaultVal:val},Bools}();Utils.Bools=Bools}(Utils||(Utils={}));var Utils;!function(Utils){var Clipboard=function(){function Clipboard(){}return Clipboard.copy=function(text){var $tempDiv=$("<div style='position:absolute;left:-9999px'>"),brRegex=/<br\s*[\/]?>/gi;text=text.replace(brRegex,"\n"),$("body").append($tempDiv),$tempDiv.append(text);var $tempInput=$("<textarea>");$tempDiv.append($tempInput),$tempInput.val($tempDiv.text()).select(),document.execCommand("copy"),$tempDiv.remove()},Clipboard.supportsCopy=function(){return document.queryCommandSupported&&document.queryCommandSupported("copy")},Clipboard}();Utils.Clipboard=Clipboard}(Utils||(Utils={}));var __extends=this&&this.__extends||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},Utils;!function(Utils){var Collections;!function(Collections){function defaultCompare(a,b){return a<b?-1:a===b?0:1}function defaultEquals(a,b){return a===b}function defaultToString(item){return null===item?"COLLECTION_NULL":collections.isUndefined(item)?"COLLECTION_UNDEFINED":collections.isString(item)?"$s"+item:"$o"+item.toString()}function makeString(item,join){if(void 0===join&&(join=","),null===item)return"COLLECTION_NULL";if(collections.isUndefined(item))return"COLLECTION_UNDEFINED";if(collections.isString(item))return item.toString();var toret="{",first=!0;for(var prop in item)has(item,prop)&&(first?first=!1:toret+=join,toret=toret+prop+":"+item[prop]);return toret+"}"}function isFunction(func){return"function"==typeof func}function isUndefined(obj){return"undefined"==typeof obj}function isString(obj){return"[object String]"===Object.prototype.toString.call(obj)}function reverseCompareFunction(compareFunction){return collections.isFunction(compareFunction)?function(d,v){return compareFunction(d,v)*-1}:function(a,b){return a<b?1:a===b?0:-1}}function compareToEquals(compareFunction){return function(a,b){return 0===compareFunction(a,b)}}var collections=Collections,_hasOwnProperty=Object.prototype.hasOwnProperty,has=function(obj,prop){return _hasOwnProperty.call(obj,prop)};Collections.defaultCompare=defaultCompare,Collections.defaultEquals=defaultEquals,Collections.defaultToString=defaultToString,Collections.makeString=makeString,Collections.isFunction=isFunction,Collections.isUndefined=isUndefined,Collections.isString=isString,Collections.reverseCompareFunction=reverseCompareFunction,Collections.compareToEquals=compareToEquals;var arrays;!function(arrays){function indexOf(array,item,equalsFunction){for(var equals=equalsFunction||collections.defaultEquals,length=array.length,i=0;i<length;i++)if(equals(array[i],item))return i;return-1}function lastIndexOf(array,item,equalsFunction){for(var equals=equalsFunction||collections.defaultEquals,length=array.length,i=length-1;i>=0;i--)if(equals(array[i],item))return i;return-1}function contains(array,item,equalsFunction){return arrays.indexOf(array,item,equalsFunction)>=0}function remove(array,item,equalsFunction){var index=arrays.indexOf(array,item,equalsFunction);return!(index<0)&&(array.splice(index,1),!0)}function frequency(array,item,equalsFunction){for(var equals=equalsFunction||collections.defaultEquals,length=array.length,freq=0,i=0;i<length;i++)equals(array[i],item)&&freq++;return freq}function equals(array1,array2,equalsFunction){var equals=equalsFunction||collections.defaultEquals;if(array1.length!==array2.length)return!1;for(var length=array1.length,i=0;i<length;i++)if(!equals(array1[i],array2[i]))return!1;return!0}function copy(array){return array.concat()}function swap(array,i,j){if(i<0||i>=array.length||j<0||j>=array.length)return!1;var temp=array[i];return array[i]=array[j],array[j]=temp,!0}function toString(array){return"["+array.toString()+"]"}function forEach(array,callback){for(var lenght=array.length,i=0;i<lenght;i++)if(callback(array[i])===!1)return}arrays.indexOf=indexOf,arrays.lastIndexOf=lastIndexOf,arrays.contains=contains,arrays.remove=remove,arrays.frequency=frequency,arrays.equals=equals,arrays.copy=copy,arrays.swap=swap,arrays.toString=toString,arrays.forEach=forEach}(arrays=Collections.arrays||(Collections.arrays={}));var LinkedList=function(){function LinkedList(){this.firstNode=null,this.lastNode=null,this.nElements=0}return LinkedList.prototype.add=function(item,index){if(collections.isUndefined(index)&&(index=this.nElements),index<0||index>this.nElements||collections.isUndefined(item))return!1;var newNode=this.createNode(item);if(0===this.nElements)this.firstNode=newNode,this.lastNode=newNode;else if(index===this.nElements)this.lastNode.next=newNode,this.lastNode=newNode;else if(0===index)newNode.next=this.firstNode,this.firstNode=newNode;else{var prev=this.nodeAtIndex(index-1);newNode.next=prev.next,prev.next=newNode}return this.nElements++,!0},LinkedList.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},LinkedList.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},LinkedList.prototype.elementAtIndex=function(index){var node=this.nodeAtIndex(index);if(null!==node)return node.element},LinkedList.prototype.indexOf=function(item,equalsFunction){var equalsF=equalsFunction||collections.defaultEquals;if(collections.isUndefined(item))return-1;for(var currentNode=this.firstNode,index=0;null!==currentNode;){if(equalsF(currentNode.element,item))return index;index++,currentNode=currentNode.next}return-1},LinkedList.prototype.contains=function(item,equalsFunction){return this.indexOf(item,equalsFunction)>=0},LinkedList.prototype.remove=function(item,equalsFunction){var equalsF=equalsFunction||collections.defaultEquals;if(this.nElements<1||collections.isUndefined(item))return!1;for(var previous=null,currentNode=this.firstNode;null!==currentNode;){if(equalsF(currentNode.element,item))return currentNode===this.firstNode?(this.firstNode=this.firstNode.next,currentNode===this.lastNode&&(this.lastNode=null)):currentNode===this.lastNode?(this.lastNode=previous,previous.next=currentNode.next,currentNode.next=null):(previous.next=currentNode.next,currentNode.next=null),this.nElements--,!0;previous=currentNode,currentNode=currentNode.next}return!1},LinkedList.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},LinkedList.prototype.equals=function(other,equalsFunction){var eqF=equalsFunction||collections.defaultEquals;return other instanceof collections.LinkedList&&(this.size()===other.size()&&this.equalsAux(this.firstNode,other.firstNode,eqF))},LinkedList.prototype.equalsAux=function(n1,n2,eqF){for(;null!==n1;){if(!eqF(n1.element,n2.element))return!1;n1=n1.next,n2=n2.next}return!0},LinkedList.prototype.removeElementAtIndex=function(index){if(!(index<0||index>=this.nElements)){var element;if(1===this.nElements)element=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var previous=this.nodeAtIndex(index-1);null===previous?(element=this.firstNode.element,this.firstNode=this.firstNode.next):previous.next===this.lastNode&&(element=this.lastNode.element,this.lastNode=previous),null!==previous&&(element=previous.next.element,previous.next=previous.next.next)}return this.nElements--,element}},LinkedList.prototype.forEach=function(callback){for(var currentNode=this.firstNode;null!==currentNode&&callback(currentNode.element)!==!1;)currentNode=currentNode.next},LinkedList.prototype.reverse=function(){for(var previous=null,current=this.firstNode,temp=null;null!==current;)temp=current.next,current.next=previous,previous=current,current=temp;temp=this.firstNode,this.firstNode=this.lastNode,this.lastNode=temp},LinkedList.prototype.toArray=function(){for(var array=[],currentNode=this.firstNode;null!==currentNode;)array.push(currentNode.element),currentNode=currentNode.next;return array},LinkedList.prototype.size=function(){return this.nElements},LinkedList.prototype.isEmpty=function(){return this.nElements<=0},LinkedList.prototype.toString=function(){return collections.arrays.toString(this.toArray())},LinkedList.prototype.nodeAtIndex=function(index){if(index<0||index>=this.nElements)return null;if(index===this.nElements-1)return this.lastNode;for(var node=this.firstNode,i=0;i<index;i++)node=node.next;return node},LinkedList.prototype.createNode=function(item){return{element:item,next:null}},LinkedList}();Collections.LinkedList=LinkedList;var Dictionary=function(){function Dictionary(toStrFunction){this.table={},this.nElements=0,this.toStr=toStrFunction||collections.defaultToString}return Dictionary.prototype.getValue=function(key){var pair=this.table["$"+this.toStr(key)];if(!collections.isUndefined(pair))return pair.value},Dictionary.prototype.setValue=function(key,value){if(!collections.isUndefined(key)&&!collections.isUndefined(value)){var ret,k="$"+this.toStr(key),previousElement=this.table[k];return collections.isUndefined(previousElement)?(this.nElements++,ret=void 0):ret=previousElement.value,this.table[k]={key:key,value:value},ret}},Dictionary.prototype.remove=function(key){var k="$"+this.toStr(key),previousElement=this.table[k];if(!collections.isUndefined(previousElement))return delete this.table[k],this.nElements--,previousElement.value},Dictionary.prototype.keys=function(){var array=[];for(var name in this.table)if(has(this.table,name)){var pair=this.table[name];array.push(pair.key)}return array},Dictionary.prototype.values=function(){var array=[];for(var name in this.table)if(has(this.table,name)){var pair=this.table[name];array.push(pair.value)}return array},Dictionary.prototype.forEach=function(callback){for(var name in this.table)if(has(this.table,name)){var pair=this.table[name],ret=callback(pair.key,pair.value);if(ret===!1)return}},Dictionary.prototype.containsKey=function(key){return!collections.isUndefined(this.getValue(key))},Dictionary.prototype.clear=function(){this.table={},this.nElements=0},Dictionary.prototype.size=function(){return this.nElements},Dictionary.prototype.isEmpty=function(){return this.nElements<=0},Dictionary.prototype.toString=function(){var toret="{";return this.forEach(function(k,v){toret=toret+"\n\t"+k.toString()+" : "+v.toString()}),toret+"\n}"},Dictionary}();Collections.Dictionary=Dictionary;var LinkedDictionaryPair=function(){function LinkedDictionaryPair(key,value){this.key=key,this.value=value}return LinkedDictionaryPair.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},LinkedDictionaryPair}(),LinkedDictionary=function(_super){function LinkedDictionary(toStrFunction){_super.call(this,toStrFunction),this.head=new LinkedDictionaryPair(null,null),this.tail=new LinkedDictionaryPair(null,null),this.head.next=this.tail,this.tail.prev=this.head}return __extends(LinkedDictionary,_super),LinkedDictionary.prototype.appendToTail=function(entry){var lastNode=this.tail.prev;lastNode.next=entry,entry.prev=lastNode,entry.next=this.tail,this.tail.prev=entry},LinkedDictionary.prototype.getLinkedDictionaryPair=function(key){if(!collections.isUndefined(key)){var k="$"+this.toStr(key),pair=this.table[k];return pair}},LinkedDictionary.prototype.getValue=function(key){var pair=this.getLinkedDictionaryPair(key);if(!collections.isUndefined(pair))return pair.value},LinkedDictionary.prototype.remove=function(key){var pair=this.getLinkedDictionaryPair(key);if(!collections.isUndefined(pair))return _super.prototype.remove.call(this,key),pair.unlink(),pair.value},LinkedDictionary.prototype.clear=function(){_super.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},LinkedDictionary.prototype.replace=function(oldPair,newPair){var k="$"+this.toStr(newPair.key);newPair.next=oldPair.next,newPair.prev=oldPair.prev,this.remove(oldPair.key),newPair.prev.next=newPair,newPair.next.prev=newPair,this.table[k]=newPair,++this.nElements},LinkedDictionary.prototype.setValue=function(key,value){if(!collections.isUndefined(key)&&!collections.isUndefined(value)){var existingPair=this.getLinkedDictionaryPair(key),newPair=new LinkedDictionaryPair(key,value),k="$"+this.toStr(key);return collections.isUndefined(existingPair)?(this.appendToTail(newPair),this.table[k]=newPair,void++this.nElements):(this.replace(existingPair,newPair),existingPair.value)}},LinkedDictionary.prototype.keys=function(){var array=[];return this.forEach(function(key,value){array.push(key)}),array},LinkedDictionary.prototype.values=function(){var array=[];return this.forEach(function(key,value){array.push(value)}),array},LinkedDictionary.prototype.forEach=function(callback){for(var crawlNode=this.head.next;null!=crawlNode.next;){var ret=callback(crawlNode.key,crawlNode.value);if(ret===!1)return;crawlNode=crawlNode.next}},LinkedDictionary}(Dictionary);Collections.LinkedDictionary=LinkedDictionary;var MultiDictionary=function(){function MultiDictionary(toStrFunction,valuesEqualsFunction,allowDuplicateValues){void 0===allowDuplicateValues&&(allowDuplicateValues=!1),this.dict=new Dictionary(toStrFunction),this.equalsF=valuesEqualsFunction||collections.defaultEquals,this.allowDuplicate=allowDuplicateValues}return MultiDictionary.prototype.getValue=function(key){var values=this.dict.getValue(key);return collections.isUndefined(values)?[]:collections.arrays.copy(values)},MultiDictionary.prototype.setValue=function(key,value){if(collections.isUndefined(key)||collections.isUndefined(value))return!1;if(!this.containsKey(key))return this.dict.setValue(key,[value]),!0;var array=this.dict.getValue(key);return!(!this.allowDuplicate&&collections.arrays.contains(array,value,this.equalsF))&&(array.push(value),!0)},MultiDictionary.prototype.remove=function(key,value){if(collections.isUndefined(value)){var v=this.dict.remove(key);return!collections.isUndefined(v)}var array=this.dict.getValue(key);return!!collections.arrays.remove(array,value,this.equalsF)&&(0===array.length&&this.dict.remove(key),!0)},MultiDictionary.prototype.keys=function(){return this.dict.keys()},MultiDictionary.prototype.values=function(){for(var values=this.dict.values(),array=[],i=0;i<values.length;i++)for(var v=values[i],j=0;j<v.length;j++)array.push(v[j]);return array},MultiDictionary.prototype.containsKey=function(key){return this.dict.containsKey(key)},MultiDictionary.prototype.clear=function(){this.dict.clear()},MultiDictionary.prototype.size=function(){
11
+ return this.dict.size()},MultiDictionary.prototype.isEmpty=function(){return this.dict.isEmpty()},MultiDictionary}();Collections.MultiDictionary=MultiDictionary;var Heap=function(){function Heap(compareFunction){this.data=[],this.compare=compareFunction||collections.defaultCompare}return Heap.prototype.leftChildIndex=function(nodeIndex){return 2*nodeIndex+1},Heap.prototype.rightChildIndex=function(nodeIndex){return 2*nodeIndex+2},Heap.prototype.parentIndex=function(nodeIndex){return Math.floor((nodeIndex-1)/2)},Heap.prototype.minIndex=function(leftChild,rightChild){return rightChild>=this.data.length?leftChild>=this.data.length?-1:leftChild:this.compare(this.data[leftChild],this.data[rightChild])<=0?leftChild:rightChild},Heap.prototype.siftUp=function(index){for(var parent=this.parentIndex(index);index>0&&this.compare(this.data[parent],this.data[index])>0;)collections.arrays.swap(this.data,parent,index),index=parent,parent=this.parentIndex(index)},Heap.prototype.siftDown=function(nodeIndex){for(var min=this.minIndex(this.leftChildIndex(nodeIndex),this.rightChildIndex(nodeIndex));min>=0&&this.compare(this.data[nodeIndex],this.data[min])>0;)collections.arrays.swap(this.data,min,nodeIndex),nodeIndex=min,min=this.minIndex(this.leftChildIndex(nodeIndex),this.rightChildIndex(nodeIndex))},Heap.prototype.peek=function(){return this.data.length>0?this.data[0]:void 0},Heap.prototype.add=function(element){if(!collections.isUndefined(element))return this.data.push(element),this.siftUp(this.data.length-1),!0},Heap.prototype.removeRoot=function(){if(this.data.length>0){var obj=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),obj}},Heap.prototype.contains=function(element){var equF=collections.compareToEquals(this.compare);return collections.arrays.contains(this.data,element,equF)},Heap.prototype.size=function(){return this.data.length},Heap.prototype.isEmpty=function(){return this.data.length<=0},Heap.prototype.clear=function(){this.data.length=0},Heap.prototype.forEach=function(callback){collections.arrays.forEach(this.data,callback)},Heap}();Collections.Heap=Heap;var Stack=function(){function Stack(){this.list=new LinkedList}return Stack.prototype.push=function(elem){return this.list.add(elem,0)},Stack.prototype.add=function(elem){return this.list.add(elem,0)},Stack.prototype.pop=function(){return this.list.removeElementAtIndex(0)},Stack.prototype.peek=function(){return this.list.first()},Stack.prototype.size=function(){return this.list.size()},Stack.prototype.contains=function(elem,equalsFunction){return this.list.contains(elem,equalsFunction)},Stack.prototype.isEmpty=function(){return this.list.isEmpty()},Stack.prototype.clear=function(){this.list.clear()},Stack.prototype.forEach=function(callback){this.list.forEach(callback)},Stack}();Collections.Stack=Stack;var Queue=function(){function Queue(){this.list=new LinkedList}return Queue.prototype.enqueue=function(elem){return this.list.add(elem)},Queue.prototype.add=function(elem){return this.list.add(elem)},Queue.prototype.dequeue=function(){if(0!==this.list.size()){var el=this.list.first();return this.list.removeElementAtIndex(0),el}},Queue.prototype.peek=function(){if(0!==this.list.size())return this.list.first()},Queue.prototype.size=function(){return this.list.size()},Queue.prototype.contains=function(elem,equalsFunction){return this.list.contains(elem,equalsFunction)},Queue.prototype.isEmpty=function(){return this.list.size()<=0},Queue.prototype.clear=function(){this.list.clear()},Queue.prototype.forEach=function(callback){this.list.forEach(callback)},Queue}();Collections.Queue=Queue;var PriorityQueue=function(){function PriorityQueue(compareFunction){this.heap=new Heap(collections.reverseCompareFunction(compareFunction))}return PriorityQueue.prototype.enqueue=function(element){return this.heap.add(element)},PriorityQueue.prototype.add=function(element){return this.heap.add(element)},PriorityQueue.prototype.dequeue=function(){if(0!==this.heap.size()){var el=this.heap.peek();return this.heap.removeRoot(),el}},PriorityQueue.prototype.peek=function(){return this.heap.peek()},PriorityQueue.prototype.contains=function(element){return this.heap.contains(element)},PriorityQueue.prototype.isEmpty=function(){return this.heap.isEmpty()},PriorityQueue.prototype.size=function(){return this.heap.size()},PriorityQueue.prototype.clear=function(){this.heap.clear()},PriorityQueue.prototype.forEach=function(callback){this.heap.forEach(callback)},PriorityQueue}();Collections.PriorityQueue=PriorityQueue;var Set=function(){function Set(toStringFunction){this.dictionary=new Dictionary(toStringFunction)}return Set.prototype.contains=function(element){return this.dictionary.containsKey(element)},Set.prototype.add=function(element){return!this.contains(element)&&!collections.isUndefined(element)&&(this.dictionary.setValue(element,element),!0)},Set.prototype.intersection=function(otherSet){var set=this;this.forEach(function(element){return otherSet.contains(element)||set.remove(element),!0})},Set.prototype.union=function(otherSet){var set=this;otherSet.forEach(function(element){return set.add(element),!0})},Set.prototype.difference=function(otherSet){var set=this;otherSet.forEach(function(element){return set.remove(element),!0})},Set.prototype.isSubsetOf=function(otherSet){if(this.size()>otherSet.size())return!1;var isSub=!0;return this.forEach(function(element){return!!otherSet.contains(element)||(isSub=!1,!1)}),isSub},Set.prototype.remove=function(element){return!!this.contains(element)&&(this.dictionary.remove(element),!0)},Set.prototype.forEach=function(callback){this.dictionary.forEach(function(k,v){return callback(v)})},Set.prototype.toArray=function(){return this.dictionary.values()},Set.prototype.isEmpty=function(){return this.dictionary.isEmpty()},Set.prototype.size=function(){return this.dictionary.size()},Set.prototype.clear=function(){this.dictionary.clear()},Set.prototype.toString=function(){return collections.arrays.toString(this.toArray())},Set}();Collections.Set=Set;var Bag=function(){function Bag(toStrFunction){this.toStrF=toStrFunction||collections.defaultToString,this.dictionary=new Dictionary(this.toStrF),this.nElements=0}return Bag.prototype.add=function(element,nCopies){if(void 0===nCopies&&(nCopies=1),collections.isUndefined(element)||nCopies<=0)return!1;if(this.contains(element))this.dictionary.getValue(element).copies+=nCopies;else{var node={value:element,copies:nCopies};this.dictionary.setValue(element,node)}return this.nElements+=nCopies,!0},Bag.prototype.count=function(element){return this.contains(element)?this.dictionary.getValue(element).copies:0},Bag.prototype.contains=function(element){return this.dictionary.containsKey(element)},Bag.prototype.remove=function(element,nCopies){if(void 0===nCopies&&(nCopies=1),collections.isUndefined(element)||nCopies<=0)return!1;if(this.contains(element)){var node=this.dictionary.getValue(element);return nCopies>node.copies?this.nElements-=node.copies:this.nElements-=nCopies,node.copies-=nCopies,node.copies<=0&&this.dictionary.remove(element),!0}return!1},Bag.prototype.toArray=function(){for(var a=[],values=this.dictionary.values(),vl=values.length,i=0;i<vl;i++)for(var node=values[i],element=node.value,copies=node.copies,j=0;j<copies;j++)a.push(element);return a},Bag.prototype.toSet=function(){for(var toret=new Set(this.toStrF),elements=this.dictionary.values(),l=elements.length,i=0;i<l;i++){var value=elements[i].value;toret.add(value)}return toret},Bag.prototype.forEach=function(callback){this.dictionary.forEach(function(k,v){for(var value=v.value,copies=v.copies,i=0;i<copies;i++)if(callback(value)===!1)return!1;return!0})},Bag.prototype.size=function(){return this.nElements},Bag.prototype.isEmpty=function(){return 0===this.nElements},Bag.prototype.clear=function(){this.nElements=0,this.dictionary.clear()},Bag}();Collections.Bag=Bag;var BSTree=function(){function BSTree(compareFunction){this.root=null,this.compare=compareFunction||collections.defaultCompare,this.nElements=0}return BSTree.prototype.add=function(element){return!collections.isUndefined(element)&&(null!==this.insertNode(this.createNode(element))&&(this.nElements++,!0))},BSTree.prototype.clear=function(){this.root=null,this.nElements=0},BSTree.prototype.isEmpty=function(){return 0===this.nElements},BSTree.prototype.size=function(){return this.nElements},BSTree.prototype.contains=function(element){return!collections.isUndefined(element)&&null!==this.searchNode(this.root,element)},BSTree.prototype.remove=function(element){var node=this.searchNode(this.root,element);return null!==node&&(this.removeNode(node),this.nElements--,!0)},BSTree.prototype.inorderTraversal=function(callback){this.inorderTraversalAux(this.root,callback,{stop:!1})},BSTree.prototype.preorderTraversal=function(callback){this.preorderTraversalAux(this.root,callback,{stop:!1})},BSTree.prototype.postorderTraversal=function(callback){this.postorderTraversalAux(this.root,callback,{stop:!1})},BSTree.prototype.levelTraversal=function(callback){this.levelTraversalAux(this.root,callback)},BSTree.prototype.minimum=function(){if(!this.isEmpty())return this.minimumAux(this.root).element},BSTree.prototype.maximum=function(){if(!this.isEmpty())return this.maximumAux(this.root).element},BSTree.prototype.forEach=function(callback){this.inorderTraversal(callback)},BSTree.prototype.toArray=function(){var array=[];return this.inorderTraversal(function(element){return array.push(element),!0}),array},BSTree.prototype.height=function(){return this.heightAux(this.root)},BSTree.prototype.searchNode=function(node,element){for(var cmp=null;null!==node&&0!==cmp;)cmp=this.compare(element,node.element),cmp<0?node=node.leftCh:cmp>0&&(node=node.rightCh);return node},BSTree.prototype.transplant=function(n1,n2){null===n1.parent?this.root=n2:n1===n1.parent.leftCh?n1.parent.leftCh=n2:n1.parent.rightCh=n2,null!==n2&&(n2.parent=n1.parent)},BSTree.prototype.removeNode=function(node){if(null===node.leftCh)this.transplant(node,node.rightCh);else if(null===node.rightCh)this.transplant(node,node.leftCh);else{var y=this.minimumAux(node.rightCh);y.parent!==node&&(this.transplant(y,y.rightCh),y.rightCh=node.rightCh,y.rightCh.parent=y),this.transplant(node,y),y.leftCh=node.leftCh,y.leftCh.parent=y}},BSTree.prototype.inorderTraversalAux=function(node,callback,signal){null===node||signal.stop||(this.inorderTraversalAux(node.leftCh,callback,signal),signal.stop||(signal.stop=callback(node.element)===!1,signal.stop||this.inorderTraversalAux(node.rightCh,callback,signal)))},BSTree.prototype.levelTraversalAux=function(node,callback){var queue=new Queue;for(null!==node&&queue.enqueue(node);!queue.isEmpty();){if(node=queue.dequeue(),callback(node.element)===!1)return;null!==node.leftCh&&queue.enqueue(node.leftCh),null!==node.rightCh&&queue.enqueue(node.rightCh)}},BSTree.prototype.preorderTraversalAux=function(node,callback,signal){null===node||signal.stop||(signal.stop=callback(node.element)===!1,signal.stop||(this.preorderTraversalAux(node.leftCh,callback,signal),signal.stop||this.preorderTraversalAux(node.rightCh,callback,signal)))},BSTree.prototype.postorderTraversalAux=function(node,callback,signal){null===node||signal.stop||(this.postorderTraversalAux(node.leftCh,callback,signal),signal.stop||(this.postorderTraversalAux(node.rightCh,callback,signal),signal.stop||(signal.stop=callback(node.element)===!1)))},BSTree.prototype.minimumAux=function(node){for(;null!==node.leftCh;)node=node.leftCh;return node},BSTree.prototype.maximumAux=function(node){for(;null!==node.rightCh;)node=node.rightCh;return node},BSTree.prototype.heightAux=function(node){return null===node?-1:Math.max(this.heightAux(node.leftCh),this.heightAux(node.rightCh))+1},BSTree.prototype.insertNode=function(node){for(var parent=null,position=this.root,cmp=null;null!==position;){if(cmp=this.compare(node.element,position.element),0===cmp)return null;cmp<0?(parent=position,position=position.leftCh):(parent=position,position=position.rightCh)}return node.parent=parent,null===parent?this.root=node:this.compare(node.element,parent.element)<0?parent.leftCh=node:parent.rightCh=node,node},BSTree.prototype.createNode=function(element){return{element:element,leftCh:null,rightCh:null,parent:null}},BSTree}();Collections.BSTree=BSTree}(Collections=Utils.Collections||(Utils.Collections={}))}(Utils||(Utils={}));var Utils;!function(Utils){var Colors=function(){function Colors(){}return Colors.float32ColorToARGB=function(float32Color){var a=(4278190080&float32Color)>>>24,r=(16711680&float32Color)>>>16,g=(65280&float32Color)>>>8,b=255&float32Color,result=[a,r,g,b];return result},Colors._componentToHex=function(c){var hex=c.toString(16);return 1==hex.length?"0"+hex:hex},Colors.rgbToHexString=function(rgb){return Colors.coalesce(rgb),"#"+Colors._componentToHex(rgb[0])+Colors._componentToHex(rgb[1])+Colors._componentToHex(rgb[2])},Colors.argbToHexString=function(argb){return"#"+Colors._componentToHex(argb[0])+Colors._componentToHex(argb[1])+Colors._componentToHex(argb[2])+Colors._componentToHex(argb[3])},Colors.coalesce=function(arr){for(var i=1;i<arr.length;i++)"undefined"==typeof arr[i]&&(arr[i]=arr[i-1])},Colors}();Utils.Colors=Colors}(Utils||(Utils={}));var Utils;!function(Utils){var Dates=function(){function Dates(){}return Dates.getTimeStamp=function(){return(new Date).getTime()},Dates}();Utils.Dates=Dates}(Utils||(Utils={}));var Utils;!function(Utils){var Device=function(){function Device(){}return Device.getPixelRatio=function(ctx){var dpr=window.devicePixelRatio||1,bsr=ctx.webkitBackingStorePixelRatio||ctx.mozBackingStorePixelRatio||ctx.msBackingStorePixelRatio||ctx.oBackingStorePixelRatio||ctx.backingStorePixelRatio||1;return dpr/bsr},Device.isTouch=function(){return!!("ontouchstart"in window)||window.navigator.msMaxTouchPoints>0},Device}();Utils.Device=Device}(Utils||(Utils={}));var Utils;!function(Utils){var Documents=function(){function Documents(){}return Documents.isInIFrame=function(){try{return window.self!==window.top}catch(e){return!0}},Documents.supportsFullscreen=function(){var doc=document.documentElement,support=doc.requestFullscreen||doc.mozRequestFullScreen||doc.webkitRequestFullScreen||doc.msRequestFullscreen;return void 0!=support},Documents.isHidden=function(){var prop=Documents.getHiddenProp();return!!prop&&document[prop]},Documents.getHiddenProp=function(){var prefixes=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var i=0;i<prefixes.length;i++)if(prefixes[i]+"Hidden"in document)return prefixes[i]+"Hidden";return null},Documents}();Utils.Documents=Documents}(Utils||(Utils={}));var Utils;!function(Utils){var Events=function(){function Events(){}return Events.debounce=function(fn,debounceDuration){return debounceDuration=debounceDuration||100,function(){if(!fn.debouncing){var args=Array.prototype.slice.apply(arguments);fn.lastReturnVal=fn.apply(window,args),fn.debouncing=!0}return clearTimeout(fn.debounceTimeout),fn.debounceTimeout=setTimeout(function(){fn.debouncing=!1},debounceDuration),fn.lastReturnVal}},Events}();Utils.Events=Events}(Utils||(Utils={}));var Utils;!function(Utils){var Files=function(){function Files(){}return Files.simplifyMimeType=function(mime){switch(mime){case"text/plain":return"txt";case"image/jpeg":return"jpg";case"application/msword":return"doc";case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return"docx";default:var parts=mime.split("/");return parts[parts.length-1]}},Files}();Utils.Files=Files}(Utils||(Utils={}));var Utils;!function(Utils){var Keyboard=function(){function Keyboard(){}return Keyboard.getCharCode=function(e){var charCode="number"==typeof e.which?e.which:e.keyCode;return charCode},Keyboard}();Utils.Keyboard=Keyboard}(Utils||(Utils={}));var Utils;!function(Utils){var Maths;!function(Maths){var Vector=function(){function Vector(x,y){this.X=x,this.Y=y}return Vector.prototype.get=function(){return new Vector(this.X,this.Y)},Vector.prototype.set=function(x,y){this.X=x,this.Y=y},Vector.prototype.add=function(v){this.X+=v.X,this.Y+=v.Y},Vector.add=function(v1,v2){return new Vector(v1.X+v2.X,v1.Y+v2.Y)},Vector.prototype.sub=function(v){this.X-=v.X,this.Y-=v.Y},Vector.sub=function(v1,v2){return new Vector(v1.X-v2.X,v1.Y-v2.Y)},Vector.prototype.mult=function(n){this.X=this.X*n,this.Y=this.Y*n},Vector.mult=function(v1,v2){return new Vector(v1.X*v2.X,v1.Y*v2.Y)},Vector.multN=function(v1,n){return new Vector(v1.X*n,v1.Y*n)},Vector.prototype.Div=function(n){this.X=this.X/n,this.Y=this.Y/n},Vector.div=function(v1,v2){return new Vector(v1.X/v2.X,v1.Y/v2.Y)},Vector.divN=function(v1,n){return new Vector(v1.X/n,v1.Y/n)},Vector.prototype.mag=function(){return Math.sqrt(this.X*this.X+this.Y*this.Y)},Vector.prototype.magSq=function(){return this.X*this.X+this.Y*this.Y},Vector.prototype.normalise=function(){var m=this.mag();0!=m&&1!=m&&this.Div(m)},Vector.prototype.limit=function(max){this.magSq()>max*max&&(this.normalise(),this.mult(max))},Vector.prototype.equals=function(v){return this.X==v.X&&this.Y==v.Y},Vector.prototype.heading=function(){var angle=Math.atan2(-this.Y,this.X);return-1*angle},Vector.random2D=function(){return Vector.fromAngle(Math.random()*Math.TAU)},Vector.fromAngle=function(angle){return new Vector(Math.cos(angle),Math.sin(angle))},Vector}();Maths.Vector=Vector}(Maths=Utils.Maths||(Utils.Maths={}))}(Utils||(Utils={}));var Utils;!function(Utils){var Measurements;!function(Measurements){var Size=function(){function Size(width,height){this.width=width,this.height=height}return Size}();Measurements.Size=Size;var Dimensions=function(){function Dimensions(){}return Dimensions.fitRect=function(width1,height1,width2,height2){var width,height,scale,ratio1=height1/width1,ratio2=height2/width2;return ratio1<ratio2&&(scale=width2/width1,width=width1*scale,height=height1*scale),ratio2<ratio1&&(scale=height2/height1,width=width1*scale,height=height1*scale),new Size(Math.floor(width),Math.floor(height))},Dimensions.hitRect=function(x,y,w,h,mx,my){return mx>x&&mx<x+w&&my>y&&my<y+h},Dimensions}();Measurements.Dimensions=Dimensions}(Measurements=Utils.Measurements||(Utils.Measurements={}))}(Utils||(Utils={}));var Utils;!function(Utils){var Numbers=function(){function Numbers(){}return Numbers.numericalInput=function(event){return 46==event.keyCode||8==event.keyCode||9==event.keyCode||27==event.keyCode||65==event.keyCode&&event.ctrlKey===!0||event.keyCode>=35&&event.keyCode<=39||(!(event.shiftKey||(event.keyCode<48||event.keyCode>57)&&(event.keyCode<96||event.keyCode>105))||(event.preventDefault(),!1))},Numbers}();Utils.Numbers=Numbers}(Utils||(Utils={}));var Utils;!function(Utils){var Storage=function(){function Storage(){}return Storage.clear=function(storageType){switch(void 0===storageType&&(storageType=Utils.StorageType.memory),storageType.value){case Utils.StorageType.memory.value:this._memoryStorage={};break;case Utils.StorageType.session.value:sessionStorage.clear();break;case Utils.StorageType.local.value:localStorage.clear()}},Storage.clearExpired=function(storageType){void 0===storageType&&(storageType=Utils.StorageType.memory);for(var items=this.getItems(storageType),i=0;i<items.length;i++){var item=items[i];this._isExpired(item)&&this.remove(item.key)}},Storage.get=function(key,storageType){void 0===storageType&&(storageType=Utils.StorageType.memory);var data;switch(storageType.value){case Utils.StorageType.memory.value:data=this._memoryStorage[key];break;case Utils.StorageType.session.value:data=sessionStorage.getItem(key);break;case Utils.StorageType.local.value:data=localStorage.getItem(key)}if(!data)return null;var item=JSON.parse(data);return this._isExpired(item)?null:(item.key=key,item)},Storage._isExpired=function(item){return!((new Date).getTime()<item.expiresAt)},Storage.getItems=function(storageType){void 0===storageType&&(storageType=Utils.StorageType.memory);var items=[];switch(storageType.value){case Utils.StorageType.memory.value:for(var keys=Object.keys(this._memoryStorage),i=0;i<keys.length;i++){var item=this.get(keys[i],Utils.StorageType.memory);item&&items.push(item)}break;case Utils.StorageType.session.value:for(var i=0;i<sessionStorage.length;i++){var key=sessionStorage.key(i),item=this.get(key,Utils.StorageType.session);item&&items.push(item)}break;case Utils.StorageType.local.value:for(var i=0;i<localStorage.length;i++){var key=localStorage.key(i),item=this.get(key,Utils.StorageType.local);item&&items.push(item)}}return items},Storage.remove=function(key,storageType){switch(void 0===storageType&&(storageType=Utils.StorageType.memory),storageType.value){case Utils.StorageType.memory.value:delete this._memoryStorage[key];break;case Utils.StorageType.session.value:sessionStorage.removeItem(key);break;case Utils.StorageType.local.value:localStorage.removeItem(key)}},Storage.set=function(key,value,expirationSecs,storageType){void 0===storageType&&(storageType=Utils.StorageType.memory);var expirationMS=1e3*expirationSecs,record=new Utils.StorageItem;switch(record.value=value,record.expiresAt=(new Date).getTime()+expirationMS,storageType.value){case Utils.StorageType.memory.value:this._memoryStorage[key]=JSON.stringify(record);break;case Utils.StorageType.session.value:sessionStorage.setItem(key,JSON.stringify(record));break;case Utils.StorageType.local.value:localStorage.setItem(key,JSON.stringify(record))}return record},Storage._memoryStorage={},Storage}();Utils.Storage=Storage}(Utils||(Utils={}));var Utils;!function(Utils){var StorageItem=function(){function StorageItem(){}return StorageItem}();Utils.StorageItem=StorageItem}(Utils||(Utils={}));var Utils;!function(Utils){var StorageType=function(){function StorageType(value){this.value=value}return StorageType.prototype.toString=function(){return this.value},StorageType.memory=new StorageType("memory"),StorageType.session=new StorageType("session"),StorageType.local=new StorageType("local"),StorageType}();Utils.StorageType=StorageType}(Utils||(Utils={}));var Utils;!function(Utils){var Strings=function(){function Strings(){}return Strings.ellipsis=function(text,chars){if(text.length<=chars)return text;var trimmedText=text.substr(0,chars),lastSpaceIndex=trimmedText.lastIndexOf(" ");return lastSpaceIndex!=-1&&(trimmedText=trimmedText.substr(0,Math.min(trimmedText.length,lastSpaceIndex))),trimmedText+"&hellip;"},Strings.htmlDecode=function(encoded){var div=document.createElement("div");return div.innerHTML=encoded,div.firstChild.nodeValue},Strings}();Utils.Strings=Strings}(Utils||(Utils={}));var Utils;!function(Utils){var Urls=function(){function Urls(){}return Urls.getHashParameter=function(key,doc){doc||(doc=window.document);var regex=new RegExp("#.*[?&]"+key+"=([^&]+)(&|$)"),match=regex.exec(doc.location.hash);return match?decodeURIComponent(match[1].replace(/\+/g," ")):null},Urls.setHashParameter=function(key,value,doc){doc||(doc=window.document);var kvp=this.updateURIKeyValuePair(doc.location.hash.replace("#?",""),key,value),newHash="#?"+kvp,url=doc.URL,index=url.indexOf("#");index!=-1&&(url=url.substr(0,url.indexOf("#"))),doc.location.replace(url+newHash)},Urls.getQuerystringParameter=function(key,w){return w||(w=window),this.getQuerystringParameterFromString(key,w.location.search)},Urls.getQuerystringParameterFromString=function(key,querystring){key=key.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regex=new RegExp("[\\?&]"+key+"=([^&#]*)"),match=regex.exec(querystring);return match?decodeURIComponent(match[1].replace(/\+/g," ")):null},Urls.setQuerystringParameter=function(key,value,doc){doc||(doc=window.document);var kvp=this.updateURIKeyValuePair(doc.location.hash.replace("#?",""),key,value);window.location.search=kvp},Urls.updateURIKeyValuePair=function(uriSegment,key,value){key=encodeURIComponent(key),value=encodeURIComponent(value);var kvp=uriSegment.split("&");""==kvp[0]&&kvp.shift();for(var x,i=kvp.length;i--;)if(x=kvp[i].split("="),x[0]==key){x[1]=value,kvp[i]=x.join("=");break}return i<0&&(kvp[kvp.length]=[key,value].join("=")),kvp.join("&")},Urls.getUrlParts=function(url){var a=document.createElement("a");return a.href=url,a},Urls.convertToRelativeUrl=function(url){var parts=this.getUrlParts(url),relUri=parts.pathname+parts.searchWithin;return relUri.startsWith("/")||(relUri="/"+relUri),relUri},Urls}();Utils.Urls=Urls}(Utils||(Utils={}));
@@ -0,0 +1,559 @@
1
+ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
+ /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
3
+ /* Copyright 2012 Mozilla Foundation
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
+ /* globals VBArray, PDFJS */
18
+
19
+ 'use strict';
20
+
21
+ // Initializing PDFJS global object here, it case if we need to change/disable
22
+ // some PDF.js features, e.g. range requests
23
+ if (typeof PDFJS === 'undefined') {
24
+ (typeof window !== 'undefined' ? window : this).PDFJS = {};
25
+ }
26
+
27
+ // Checking if the typed arrays are supported
28
+ (function checkTypedArrayCompatibility() {
29
+ if (typeof Uint8Array !== 'undefined') {
30
+ // some mobile versions do not support subarray (e.g. safari 5 / iOS)
31
+ if (typeof Uint8Array.prototype.subarray === 'undefined') {
32
+ Uint8Array.prototype.subarray = function subarray(start, end) {
33
+ return new Uint8Array(this.slice(start, end));
34
+ };
35
+ Float32Array.prototype.subarray = function subarray(start, end) {
36
+ return new Float32Array(this.slice(start, end));
37
+ };
38
+ }
39
+
40
+ // some mobile version might not support Float64Array
41
+ if (typeof Float64Array === 'undefined') {
42
+ window.Float64Array = Float32Array;
43
+ }
44
+ return;
45
+ }
46
+
47
+ function subarray(start, end) {
48
+ return new TypedArray(this.slice(start, end));
49
+ }
50
+
51
+ function setArrayOffset(array, offset) {
52
+ if (arguments.length < 2) {
53
+ offset = 0;
54
+ }
55
+ for (var i = 0, n = array.length; i < n; ++i, ++offset) {
56
+ this[offset] = array[i] & 0xFF;
57
+ }
58
+ }
59
+
60
+ function TypedArray(arg1) {
61
+ var result, i, n;
62
+ if (typeof arg1 === 'number') {
63
+ result = [];
64
+ for (i = 0; i < arg1; ++i) {
65
+ result[i] = 0;
66
+ }
67
+ } else if ('slice' in arg1) {
68
+ result = arg1.slice(0);
69
+ } else {
70
+ result = [];
71
+ for (i = 0, n = arg1.length; i < n; ++i) {
72
+ result[i] = arg1[i];
73
+ }
74
+ }
75
+
76
+ result.subarray = subarray;
77
+ result.buffer = result;
78
+ result.byteLength = result.length;
79
+ result.set = setArrayOffset;
80
+
81
+ if (typeof arg1 === 'object' && arg1.buffer) {
82
+ result.buffer = arg1.buffer;
83
+ }
84
+ return result;
85
+ }
86
+
87
+ window.Uint8Array = TypedArray;
88
+ window.Int8Array = TypedArray;
89
+
90
+ // we don't need support for set, byteLength for 32-bit array
91
+ // so we can use the TypedArray as well
92
+ window.Uint32Array = TypedArray;
93
+ window.Int32Array = TypedArray;
94
+ window.Uint16Array = TypedArray;
95
+ window.Float32Array = TypedArray;
96
+ window.Float64Array = TypedArray;
97
+ })();
98
+
99
+ // URL = URL || webkitURL
100
+ (function normalizeURLObject() {
101
+ if (!window.URL) {
102
+ window.URL = window.webkitURL;
103
+ }
104
+ })();
105
+
106
+ // Object.create() ?
107
+ (function checkObjectCreateCompatibility() {
108
+ if (typeof Object.create !== 'undefined') {
109
+ return;
110
+ }
111
+
112
+ Object.create = function objectCreate(proto) {
113
+ function Constructor() {}
114
+ Constructor.prototype = proto;
115
+ return new Constructor();
116
+ };
117
+ })();
118
+
119
+ // Object.defineProperty() ?
120
+ (function checkObjectDefinePropertyCompatibility() {
121
+ if (typeof Object.defineProperty !== 'undefined') {
122
+ var definePropertyPossible = true;
123
+ try {
124
+ // some browsers (e.g. safari) cannot use defineProperty() on DOM objects
125
+ // and thus the native version is not sufficient
126
+ Object.defineProperty(new Image(), 'id', { value: 'test' });
127
+ // ... another test for android gb browser for non-DOM objects
128
+ var Test = function Test() {};
129
+ Test.prototype = { get id() { } };
130
+ Object.defineProperty(new Test(), 'id',
131
+ { value: '', configurable: true, enumerable: true, writable: false });
132
+ } catch (e) {
133
+ definePropertyPossible = false;
134
+ }
135
+ if (definePropertyPossible) {
136
+ return;
137
+ }
138
+ }
139
+
140
+ Object.defineProperty = function objectDefineProperty(obj, name, def) {
141
+ delete obj[name];
142
+ if ('get' in def) {
143
+ obj.__defineGetter__(name, def['get']);
144
+ }
145
+ if ('set' in def) {
146
+ obj.__defineSetter__(name, def['set']);
147
+ }
148
+ if ('value' in def) {
149
+ obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
150
+ this.__defineGetter__(name, function objectDefinePropertyGetter() {
151
+ return value;
152
+ });
153
+ return value;
154
+ });
155
+ obj[name] = def.value;
156
+ }
157
+ };
158
+ })();
159
+
160
+ // Object.keys() ?
161
+ (function checkObjectKeysCompatibility() {
162
+ if (typeof Object.keys !== 'undefined') {
163
+ return;
164
+ }
165
+
166
+ Object.keys = function objectKeys(obj) {
167
+ var result = [];
168
+ for (var i in obj) {
169
+ if (obj.hasOwnProperty(i)) {
170
+ result.push(i);
171
+ }
172
+ }
173
+ return result;
174
+ };
175
+ })();
176
+
177
+ // No readAsArrayBuffer ?
178
+ (function checkFileReaderReadAsArrayBuffer() {
179
+ if (typeof FileReader === 'undefined') {
180
+ return; // FileReader is not implemented
181
+ }
182
+ var frPrototype = FileReader.prototype;
183
+ // Older versions of Firefox might not have readAsArrayBuffer
184
+ if ('readAsArrayBuffer' in frPrototype) {
185
+ return; // readAsArrayBuffer is implemented
186
+ }
187
+ Object.defineProperty(frPrototype, 'readAsArrayBuffer', {
188
+ value: function fileReaderReadAsArrayBuffer(blob) {
189
+ var fileReader = new FileReader();
190
+ var originalReader = this;
191
+ fileReader.onload = function fileReaderOnload(evt) {
192
+ var data = evt.target.result;
193
+ var buffer = new ArrayBuffer(data.length);
194
+ var uint8Array = new Uint8Array(buffer);
195
+
196
+ for (var i = 0, ii = data.length; i < ii; i++) {
197
+ uint8Array[i] = data.charCodeAt(i);
198
+ }
199
+
200
+ Object.defineProperty(originalReader, 'result', {
201
+ value: buffer,
202
+ enumerable: true,
203
+ writable: false,
204
+ configurable: true
205
+ });
206
+
207
+ var event = document.createEvent('HTMLEvents');
208
+ event.initEvent('load', false, false);
209
+ originalReader.dispatchEvent(event);
210
+ };
211
+ fileReader.readAsBinaryString(blob);
212
+ }
213
+ });
214
+ })();
215
+
216
+ // No XMLHttpRequest.response ?
217
+ (function checkXMLHttpRequestResponseCompatibility() {
218
+ var xhrPrototype = XMLHttpRequest.prototype;
219
+ if (!('overrideMimeType' in xhrPrototype)) {
220
+ // IE10 might have response, but not overrideMimeType
221
+ Object.defineProperty(xhrPrototype, 'overrideMimeType', {
222
+ value: function xmlHttpRequestOverrideMimeType(mimeType) {}
223
+ });
224
+ }
225
+ if ('response' in xhrPrototype ||
226
+ 'mozResponseArrayBuffer' in xhrPrototype ||
227
+ 'mozResponse' in xhrPrototype ||
228
+ 'responseArrayBuffer' in xhrPrototype) {
229
+ return;
230
+ }
231
+ // IE9 ?
232
+ if (typeof VBArray !== 'undefined') {
233
+ Object.defineProperty(xhrPrototype, 'response', {
234
+ get: function xmlHttpRequestResponseGet() {
235
+ return new Uint8Array(new VBArray(this.responseBody).toArray());
236
+ }
237
+ });
238
+ return;
239
+ }
240
+
241
+ // other browsers
242
+ function responseTypeSetter() {
243
+ // will be only called to set "arraybuffer"
244
+ this.overrideMimeType('text/plain; charset=x-user-defined');
245
+ }
246
+ if (typeof xhrPrototype.overrideMimeType === 'function') {
247
+ Object.defineProperty(xhrPrototype, 'responseType',
248
+ { set: responseTypeSetter });
249
+ }
250
+ function responseGetter() {
251
+ var text = this.responseText;
252
+ var i, n = text.length;
253
+ var result = new Uint8Array(n);
254
+ for (i = 0; i < n; ++i) {
255
+ result[i] = text.charCodeAt(i) & 0xFF;
256
+ }
257
+ return result;
258
+ }
259
+ Object.defineProperty(xhrPrototype, 'response', { get: responseGetter });
260
+ })();
261
+
262
+ // window.btoa (base64 encode function) ?
263
+ (function checkWindowBtoaCompatibility() {
264
+ if ('btoa' in window) {
265
+ return;
266
+ }
267
+
268
+ var digits =
269
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
270
+
271
+ window.btoa = function windowBtoa(chars) {
272
+ var buffer = '';
273
+ var i, n;
274
+ for (i = 0, n = chars.length; i < n; i += 3) {
275
+ var b1 = chars.charCodeAt(i) & 0xFF;
276
+ var b2 = chars.charCodeAt(i + 1) & 0xFF;
277
+ var b3 = chars.charCodeAt(i + 2) & 0xFF;
278
+ var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
279
+ var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
280
+ var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
281
+ buffer += (digits.charAt(d1) + digits.charAt(d2) +
282
+ digits.charAt(d3) + digits.charAt(d4));
283
+ }
284
+ return buffer;
285
+ };
286
+ })();
287
+
288
+ // window.atob (base64 encode function) ?
289
+ (function checkWindowAtobCompatibility() {
290
+ if ('atob' in window) {
291
+ return;
292
+ }
293
+
294
+ // https://github.com/davidchambers/Base64.js
295
+ var digits =
296
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
297
+ window.atob = function (input) {
298
+ input = input.replace(/=+$/, '');
299
+ if (input.length % 4 == 1) {
300
+ throw new Error('bad atob input');
301
+ }
302
+ for (
303
+ // initialize result and counters
304
+ var bc = 0, bs, buffer, idx = 0, output = '';
305
+ // get next character
306
+ buffer = input.charAt(idx++);
307
+ // character found in table?
308
+ // initialize bit storage and add its ascii value
309
+ ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
310
+ // and if not first of each 4 characters,
311
+ // convert the first 8 bits to one ascii character
312
+ bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
313
+ ) {
314
+ // try to find character in table (0-63, not found => -1)
315
+ buffer = digits.indexOf(buffer);
316
+ }
317
+ return output;
318
+ };
319
+ })();
320
+
321
+ // Function.prototype.bind ?
322
+ (function checkFunctionPrototypeBindCompatibility() {
323
+ if (typeof Function.prototype.bind !== 'undefined') {
324
+ return;
325
+ }
326
+
327
+ Function.prototype.bind = function functionPrototypeBind(obj) {
328
+ var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
329
+ var bound = function functionPrototypeBindBound() {
330
+ var args = headArgs.concat(Array.prototype.slice.call(arguments));
331
+ return fn.apply(obj, args);
332
+ };
333
+ return bound;
334
+ };
335
+ })();
336
+
337
+ // HTMLElement dataset property
338
+ (function checkDatasetProperty() {
339
+ var div = document.createElement('div');
340
+ if ('dataset' in div) {
341
+ return; // dataset property exists
342
+ }
343
+
344
+ Object.defineProperty(HTMLElement.prototype, 'dataset', {
345
+ get: function() {
346
+ if (this._dataset) {
347
+ return this._dataset;
348
+ }
349
+
350
+ var dataset = {};
351
+ for (var j = 0, jj = this.attributes.length; j < jj; j++) {
352
+ var attribute = this.attributes[j];
353
+ if (attribute.name.substring(0, 5) != 'data-') {
354
+ continue;
355
+ }
356
+ var key = attribute.name.substring(5).replace(/\-([a-z])/g,
357
+ function(all, ch) {
358
+ return ch.toUpperCase();
359
+ });
360
+ dataset[key] = attribute.value;
361
+ }
362
+
363
+ Object.defineProperty(this, '_dataset', {
364
+ value: dataset,
365
+ writable: false,
366
+ enumerable: false
367
+ });
368
+ return dataset;
369
+ },
370
+ enumerable: true
371
+ });
372
+ })();
373
+
374
+ // HTMLElement classList property
375
+ (function checkClassListProperty() {
376
+ var div = document.createElement('div');
377
+ if ('classList' in div) {
378
+ return; // classList property exists
379
+ }
380
+
381
+ function changeList(element, itemName, add, remove) {
382
+ var s = element.className || '';
383
+ var list = s.split(/\s+/g);
384
+ if (list[0] === '') {
385
+ list.shift();
386
+ }
387
+ var index = list.indexOf(itemName);
388
+ if (index < 0 && add) {
389
+ list.push(itemName);
390
+ }
391
+ if (index >= 0 && remove) {
392
+ list.splice(index, 1);
393
+ }
394
+ element.className = list.join(' ');
395
+ return (index >= 0);
396
+ }
397
+
398
+ var classListPrototype = {
399
+ add: function(name) {
400
+ changeList(this.element, name, true, false);
401
+ },
402
+ contains: function(name) {
403
+ return changeList(this.element, name, false, false);
404
+ },
405
+ remove: function(name) {
406
+ changeList(this.element, name, false, true);
407
+ },
408
+ toggle: function(name) {
409
+ changeList(this.element, name, true, true);
410
+ }
411
+ };
412
+
413
+ Object.defineProperty(HTMLElement.prototype, 'classList', {
414
+ get: function() {
415
+ if (this._classList) {
416
+ return this._classList;
417
+ }
418
+
419
+ var classList = Object.create(classListPrototype, {
420
+ element: {
421
+ value: this,
422
+ writable: false,
423
+ enumerable: true
424
+ }
425
+ });
426
+ Object.defineProperty(this, '_classList', {
427
+ value: classList,
428
+ writable: false,
429
+ enumerable: false
430
+ });
431
+ return classList;
432
+ },
433
+ enumerable: true
434
+ });
435
+ })();
436
+
437
+ // Check console compatibility
438
+ (function checkConsoleCompatibility() {
439
+ if (!('console' in window)) {
440
+ window.console = {
441
+ log: function() {},
442
+ error: function() {},
443
+ warn: function() {}
444
+ };
445
+ } else if (!('bind' in console.log)) {
446
+ // native functions in IE9 might not have bind
447
+ console.log = (function(fn) {
448
+ return function(msg) { return fn(msg); };
449
+ })(console.log);
450
+ console.error = (function(fn) {
451
+ return function(msg) { return fn(msg); };
452
+ })(console.error);
453
+ console.warn = (function(fn) {
454
+ return function(msg) { return fn(msg); };
455
+ })(console.warn);
456
+ }
457
+ })();
458
+
459
+ // Check onclick compatibility in Opera
460
+ (function checkOnClickCompatibility() {
461
+ // workaround for reported Opera bug DSK-354448:
462
+ // onclick fires on disabled buttons with opaque content
463
+ function ignoreIfTargetDisabled(event) {
464
+ if (isDisabled(event.target)) {
465
+ event.stopPropagation();
466
+ }
467
+ }
468
+ function isDisabled(node) {
469
+ return node.disabled || (node.parentNode && isDisabled(node.parentNode));
470
+ }
471
+ if (navigator.userAgent.indexOf('Opera') != -1) {
472
+ // use browser detection since we cannot feature-check this bug
473
+ document.addEventListener('click', ignoreIfTargetDisabled, true);
474
+ }
475
+ })();
476
+
477
+ // Checks if possible to use URL.createObjectURL()
478
+ (function checkOnBlobSupport() {
479
+ // sometimes IE loosing the data created with createObjectURL(), see #3977
480
+ if (navigator.userAgent.indexOf('Trident') >= 0) {
481
+ PDFJS.disableCreateObjectURL = true;
482
+ }
483
+ })();
484
+
485
+ // Checks if navigator.language is supported
486
+ (function checkNavigatorLanguage() {
487
+ if ('language' in navigator &&
488
+ /^[a-z]+(-[A-Z]+)?$/.test(navigator.language)) {
489
+ return;
490
+ }
491
+ function formatLocale(locale) {
492
+ var split = locale.split(/[-_]/);
493
+ split[0] = split[0].toLowerCase();
494
+ if (split.length > 1) {
495
+ split[1] = split[1].toUpperCase();
496
+ }
497
+ return split.join('-');
498
+ }
499
+ var language = navigator.language || navigator.userLanguage || 'en-US';
500
+ PDFJS.locale = formatLocale(language);
501
+ })();
502
+
503
+ (function checkRangeRequests() {
504
+ // Safari has issues with cached range requests see:
505
+ // https://github.com/mozilla/pdf.js/issues/3260
506
+ // Last tested with version 6.0.4.
507
+ var isSafari = Object.prototype.toString.call(
508
+ window.HTMLElement).indexOf('Constructor') > 0;
509
+
510
+ // Older versions of Android (pre 3.0) has issues with range requests, see:
511
+ // https://github.com/mozilla/pdf.js/issues/3381.
512
+ // Make sure that we only match webkit-based Android browsers,
513
+ // since Firefox/Fennec works as expected.
514
+ var regex = /Android\s[0-2][^\d]/;
515
+ var isOldAndroid = regex.test(navigator.userAgent);
516
+
517
+ if (isSafari || isOldAndroid) {
518
+ PDFJS.disableRange = true;
519
+ }
520
+ })();
521
+
522
+ // Check if the browser supports manipulation of the history.
523
+ (function checkHistoryManipulation() {
524
+ if (!window.history.pushState) {
525
+ PDFJS.disableHistory = true;
526
+ }
527
+ })();
528
+
529
+ (function checkSetPresenceInImageData() {
530
+ if (window.CanvasPixelArray) {
531
+ if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
532
+ window.CanvasPixelArray.prototype.set = function(arr) {
533
+ for (var i = 0, ii = this.length; i < ii; i++) {
534
+ this[i] = arr[i];
535
+ }
536
+ };
537
+ }
538
+ }
539
+ })();
540
+
541
+ (function checkStorages() {
542
+ // Feature test as per http://diveintohtml5.info/storage.html
543
+ // The additional localStorage call is to get around a FF quirk, see
544
+ // bug #495747 in bugzilla
545
+ try {
546
+ if ('localStorage' in window && window['localStorage'] !== null) {
547
+ return;
548
+ }
549
+ } catch (e) { }
550
+ window.localStorage = {
551
+ data: Object.create(null),
552
+ getItem: function (key) {
553
+ return this.data[key];
554
+ },
555
+ setItem: function (key, value) {
556
+ this.data[key] = value;
557
+ }
558
+ };
559
+ })();