luca 0.9.9 → 0.9.42

Sign up to get free protection for your applications and to get access to all the features.
Files changed (604) hide show
  1. data/CHANGELOG +9 -153
  2. data/Gemfile +1 -10
  3. data/Gemfile.lock +40 -113
  4. data/Guardfile +25 -3
  5. data/README.md +57 -54
  6. data/ROADMAP +32 -15
  7. data/Rakefile +75 -24
  8. data/app.rb +46 -12
  9. data/{app/assets → assets}/images/glyphicons-halflings-white.png +0 -0
  10. data/{app/assets → assets}/images/glyphicons-halflings.png +0 -0
  11. data/assets/javascripts/dependencies/backbone-min.js +37 -0
  12. data/assets/javascripts/dependencies/backbone-query.min.js +1 -0
  13. data/assets/javascripts/dependencies/bootstrap.min.js +7 -0
  14. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-coffeescript.js +0 -0
  15. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-css.js +0 -0
  16. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-html.js +0 -0
  17. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-javascript.js +0 -0
  18. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-less.js +0 -0
  19. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror-vim.js +0 -0
  20. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/codemirror.js +0 -0
  21. data/assets/javascripts/dependencies/coffee-script.js +12189 -0
  22. data/{spec → assets}/javascripts/dependencies/jasmine-html.js +0 -0
  23. data/{spec → assets}/javascripts/dependencies/jasmine.js +0 -0
  24. data/assets/javascripts/dependencies/jquery.js +4 -0
  25. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/modal.js +0 -0
  26. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/modernizr.min.js +0 -0
  27. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/prettify.js +0 -0
  28. data/{spec → assets}/javascripts/dependencies/sinon.js +0 -0
  29. data/{vendor/assets/javascripts → assets/javascripts/dependencies}/spin-min.js +0 -0
  30. data/assets/javascripts/dependencies/underscore-min.js +31 -0
  31. data/assets/javascripts/dependencies/underscore-string.min.js +14 -0
  32. data/assets/javascripts/dependencies.coffee +5 -0
  33. data/assets/javascripts/luca/index.coffee +1 -0
  34. data/assets/javascripts/luca-templates.js +1 -0
  35. data/assets/javascripts/luca-ui-base.coffee +1 -0
  36. data/assets/javascripts/luca-ui-bootstrap.js +1 -0
  37. data/assets/javascripts/luca-ui-development-tools.coffee +9 -0
  38. data/assets/javascripts/luca-ui-full.js +3 -0
  39. data/assets/javascripts/luca-ui-spec.coffee +2 -0
  40. data/assets/javascripts/luca-ui.js +3 -0
  41. data/assets/javascripts/sandbox/application.coffee +57 -0
  42. data/assets/javascripts/sandbox/config.coffee +7 -0
  43. data/assets/javascripts/sandbox/router.coffee +24 -0
  44. data/assets/javascripts/sandbox/templates/builder/component_list.luca +1 -0
  45. data/assets/javascripts/sandbox/templates/builder.luca +2 -0
  46. data/assets/javascripts/sandbox/templates/main.luca +53 -0
  47. data/assets/javascripts/sandbox/templates/sandbox/docs_index.luca +1 -0
  48. data/assets/javascripts/sandbox/templates/sandbox/navigation.luca +8 -0
  49. data/assets/javascripts/sandbox/templates/sandbox/readme.luca +30 -0
  50. data/assets/javascripts/sandbox/templates/sandbox.luca +1 -0
  51. data/assets/javascripts/sandbox/views/builder/builder_canvas.coffee +3 -0
  52. data/assets/javascripts/sandbox/views/builder/builder_editor.coffee +6 -0
  53. data/assets/javascripts/sandbox/views/builder/component_list.coffee +38 -0
  54. data/assets/javascripts/sandbox/views/builder/project_browser.coffee +14 -0
  55. data/assets/javascripts/sandbox/views/builder.coffee +133 -0
  56. data/assets/javascripts/sandbox/views/docs_controller.coffee +7 -0
  57. data/assets/javascripts/sandbox/views/inspector/instance_filter.coffee +18 -0
  58. data/{app/assets/stylesheets/luca/containers/modal_view.scss → assets/javascripts/sandbox/views/inspector/instance_list.coffee} +0 -0
  59. data/assets/javascripts/sandbox/views/inspector.coffee +11 -0
  60. data/assets/javascripts/sandbox/views/top_navigation.coffee +4 -0
  61. data/assets/javascripts/sandbox.coffee +7 -0
  62. data/assets/javascripts/spec-dependencies.coffee +4 -0
  63. data/assets/stylesheets/bootstrap-responsive.min.css +2 -0
  64. data/assets/stylesheets/bootstrap.min.css +727 -0
  65. data/{vendor/assets → assets}/stylesheets/codemirror-blackboard.css +0 -0
  66. data/{vendor/assets → assets}/stylesheets/codemirror-monokai.css +0 -0
  67. data/{vendor/assets → assets}/stylesheets/codemirror.css +0 -0
  68. data/{vendor/assets → assets}/stylesheets/jasmine.css +0 -0
  69. data/assets/stylesheets/luca-ui-bootstrap.css +4 -0
  70. data/assets/stylesheets/luca-ui-development-tools.css +5 -0
  71. data/assets/stylesheets/luca-ui-full.css +3 -0
  72. data/assets/stylesheets/luca-ui-spec.css +3 -0
  73. data/assets/stylesheets/luca-ui.css +3 -0
  74. data/assets/stylesheets/prettify.css +40 -0
  75. data/assets/stylesheets/sandbox/builder.scss +79 -0
  76. data/assets/stylesheets/sandbox/sandbox.scss +18 -0
  77. data/assets/stylesheets/sandbox.css +3 -0
  78. data/assets/stylesheets/themes/amelia-bootstrap.css +826 -0
  79. data/assets/stylesheets/themes/slate-bootstrap.css +797 -0
  80. data/assets/stylesheets/themes/superhero-bootstrap.css +830 -0
  81. data/config.ru +2 -1
  82. data/docs/{old/application.md → application.md} +0 -0
  83. data/docs/{old/collection.md → collection.md} +0 -0
  84. data/docs/{old/collection_manager.md → collection_manager.md} +0 -0
  85. data/docs/{old/container_philosophy.md → container_philosophy.md} +0 -0
  86. data/docs/{old/event_binding_helpers.md → event_binding_helpers.md} +0 -0
  87. data/docs/{old/method_caching_and_computed_properties.md → method_caching_and_computed_properties.md} +0 -0
  88. data/docs/{old/view.md → view.md} +0 -0
  89. data/lib/luca/code_browser.rb +55 -0
  90. data/lib/luca/command_line.rb +69 -0
  91. data/lib/luca/rails/engine.rb +0 -12
  92. data/lib/luca/rails/version.rb +2 -1
  93. data/lib/luca/rails.rb +3 -5
  94. data/lib/luca/template.rb +0 -2
  95. data/lib/luca.rb +1 -25
  96. data/luca.gemspec +7 -16
  97. data/site/assets/bootstrap.min.js +7 -0
  98. data/site/assets/dependencies.js +94 -0
  99. data/site/assets/glyphicons-halflings-white.png +0 -0
  100. data/site/assets/glyphicons-halflings.png +0 -0
  101. data/site/assets/luca-ui-bootstrap.css +1331 -0
  102. data/site/assets/luca-ui-bootstrap.js +9 -0
  103. data/site/assets/luca-ui-development-tools.css +234 -0
  104. data/site/assets/luca-ui-development-tools.js +18561 -0
  105. data/site/assets/luca-ui-development-tools.min.js +15 -0
  106. data/site/assets/luca-ui-full.min.js +8 -0
  107. data/site/assets/luca-ui.min.js +4 -0
  108. data/site/assets/sandbox.css +62 -0
  109. data/site/assets/sandbox.js +469 -0
  110. data/site/docs/application.html +41 -0
  111. data/site/docs/caching.html +43 -0
  112. data/site/docs/collection.html +75 -0
  113. data/site/docs/collection_manager.html +71 -0
  114. data/site/docs/containers.html +118 -0
  115. data/site/docs/events.html +153 -0
  116. data/site/docs/view.html +128 -0
  117. data/site/img/glyphicons-halflings-white.png +0 -0
  118. data/site/img/glyphicons-halflings.png +0 -0
  119. data/site/index.html +20 -0
  120. data/site/source-map.js +1 -0
  121. data/spec/{javascripts/components → components}/application_spec.coffee +0 -0
  122. data/spec/{javascripts/components → components}/collection_loader_view_spec.coffee +0 -0
  123. data/{site/source/app/assets/javascripts/docs/lib/util.coffee → spec/components/controller_spec.coffee} +0 -0
  124. data/spec/{javascripts/components → components}/fields/checkbox_array_spec.coffee +0 -0
  125. data/spec/components/form_view_spec.coffee +80 -0
  126. data/spec/{javascripts/components → components}/grid_view_spec.coffee +0 -0
  127. data/spec/{javascripts/components → components}/record_manager_spec.coffee +0 -0
  128. data/spec/{javascripts/components → components}/template_spec.coffee +0 -0
  129. data/spec/containers/card_view_spec.coffee +50 -0
  130. data/{site/source/app/assets/javascripts/docs/views/components/code_editor/index.coffee → spec/containers/column_view_spec.coffee} +0 -0
  131. data/spec/{javascripts/containers → containers}/modal_view_spec.coffee +0 -0
  132. data/spec/{javascripts/containers → containers}/panel_view_spec.coffee +0 -0
  133. data/spec/{javascripts/components/pagination_control_spec.coffee → containers/split_view_spec.coffee} +0 -0
  134. data/spec/{javascripts/containers → containers}/tab_view_spec.coffee +0 -0
  135. data/spec/{javascripts/containers → containers}/viewport_spec.coffee +0 -0
  136. data/spec/{javascripts/core → core}/collection_spec.coffee +1 -26
  137. data/spec/core/container_spec.coffee +66 -0
  138. data/spec/{javascripts/concerns/paginatable_spec.coffee → core/field_spec.coffee} +0 -0
  139. data/spec/{javascripts/core → core}/model_spec.coffee +3 -26
  140. data/spec/{javascripts/core → core}/observer_spec.coffee +0 -0
  141. data/spec/{javascripts/core → core}/view_spec.coffee +38 -114
  142. data/spec/{javascripts/core/framework_spec.coffee → framework_spec.coffee} +2 -31
  143. data/spec/{javascripts/helper.coffee → helper.coffee} +0 -0
  144. data/spec/{javascripts/managers → managers}/collection_manager_spec.coffee +0 -0
  145. data/spec/{javascripts/managers → managers}/socket_manager_spec.coffee +0 -0
  146. data/src/components/application.coffee +318 -0
  147. data/src/components/base_toolbar.coffee +15 -0
  148. data/{app/assets/javascripts/luca → src}/components/collection_loader_view.coffee +1 -3
  149. data/src/components/collection_view.coffee +131 -0
  150. data/src/components/controller.coffee +63 -0
  151. data/src/components/fields/button_field.coffee +38 -0
  152. data/{app/assets/javascripts/luca → src}/components/fields/checkbox_array.coffee +7 -18
  153. data/{app/assets/javascripts/luca → src}/components/fields/checkbox_field.coffee +10 -19
  154. data/{app/assets/javascripts/luca → src}/components/fields/file_upload_field.coffee +4 -5
  155. data/src/components/fields/hidden_field.coffee +12 -0
  156. data/src/components/fields/label_field.coffee +14 -0
  157. data/src/components/fields/select_field.coffee +97 -0
  158. data/src/components/fields/text_area_field.coffee +40 -0
  159. data/{app/assets/javascripts/luca → src}/components/fields/text_field.coffee +5 -16
  160. data/src/components/fields/type_ahead_field.coffee +22 -0
  161. data/src/components/form_button_toolbar.coffee +25 -0
  162. data/src/components/form_view.coffee +275 -0
  163. data/src/components/grid_view.coffee +269 -0
  164. data/src/components/index.coffee +1 -0
  165. data/src/components/load_mask.coffee +3 -0
  166. data/src/components/nav_bar.coffee +22 -0
  167. data/src/components/page_controller.coffee +2 -0
  168. data/{app/assets/javascripts/luca → src}/components/record_manager.coffee +0 -0
  169. data/{app/assets/javascripts/luca → src}/components/router.coffee +1 -6
  170. data/src/components/table_view.coffee +53 -0
  171. data/src/components/template.coffee +5 -0
  172. data/src/components/toolbar_dialog.coffee +25 -0
  173. data/src/containers/card_view.coffee +93 -0
  174. data/src/containers/column_view.coffee +42 -0
  175. data/{app/assets/javascripts/luca → src}/containers/modal_view.coffee +9 -9
  176. data/src/containers/page_view.coffee +2 -0
  177. data/{app/assets/javascripts/luca → src}/containers/panel_toolbar.coffee +84 -89
  178. data/src/containers/panel_view.coffee +23 -0
  179. data/src/containers/split_view.coffee +8 -0
  180. data/{app/assets/javascripts/luca → src}/containers/tab_view.coffee +21 -27
  181. data/{app/assets/javascripts/luca → src}/containers/viewport.coffee +18 -14
  182. data/{app/assets/javascripts/luca → src}/core/collection.coffee +51 -97
  183. data/src/core/container.coffee +374 -0
  184. data/{tutorials/component-definitions.md → src/core/core.coffee} +0 -0
  185. data/src/core/field.coffee +79 -0
  186. data/src/core/model.coffee +43 -0
  187. data/{app/assets/javascripts/luca → src}/core/observer.coffee +0 -0
  188. data/src/core/panel.coffee +118 -0
  189. data/{app/assets/javascripts/luca/core/registry → src/core}/registry.coffee +43 -63
  190. data/{app/assets/javascripts/luca/util → src/core}/script_loader.coffee +0 -0
  191. data/src/core/view.coffee +264 -0
  192. data/src/define.coffee +110 -0
  193. data/{app/assets/javascripts/luca → src}/framework.coffee +103 -98
  194. data/src/index.coffee +23 -0
  195. data/{app/assets/javascripts/luca → src}/managers/collection_manager.coffee +13 -37
  196. data/src/managers/socket_manager.coffee +54 -0
  197. data/{app/assets/javascripts/luca/concerns → src/modules}/deferrable.coffee +4 -5
  198. data/src/modules/grid_layout.coffee +3 -0
  199. data/{app/assets/javascripts/luca/concerns/loadmaskable.coffee → src/modules/load_mask.coffee} +11 -23
  200. data/{app/assets/javascripts/luca/concerns → src/modules}/local_storage.coffee +0 -0
  201. data/src/plugins/development_tool_helpers.coffee +21 -0
  202. data/src/plugins/events.coffee +54 -0
  203. data/src/samples/definition.coffee +49 -0
  204. data/{tutorials/component-definitions/01_intro.md → src/stylesheets/base.scss} +0 -0
  205. data/{app/assets/stylesheets/luca → src/stylesheets}/components/checkbox_array.scss +1 -1
  206. data/src/stylesheets/components/form_view.scss +59 -0
  207. data/{app/assets/stylesheets/luca → src/stylesheets}/components/grid_view.scss +0 -0
  208. data/{app/assets/stylesheets/luca → src/stylesheets}/components/load_mask.scss +0 -0
  209. data/src/stylesheets/components/toolbar.scss +0 -0
  210. data/{app/assets/stylesheets/luca → src/stylesheets}/components/viewport.scss +4 -1
  211. data/src/stylesheets/containers/container.scss +16 -0
  212. data/src/stylesheets/containers/modal_view.scss +0 -0
  213. data/{app/assets/stylesheets/luca → src/stylesheets}/containers/panels.scss +0 -0
  214. data/{app/assets/stylesheets/luca → src/stylesheets}/containers/tab_view.scss +5 -5
  215. data/{app/assets/stylesheets/luca → src/stylesheets}/normalize.scss +0 -0
  216. data/src/stylesheets/tools/class_browser.scss +32 -0
  217. data/src/stylesheets/tools/code_editor.scss +24 -0
  218. data/src/stylesheets/tools/component_tester.scss +26 -0
  219. data/{app/assets/stylesheets/luca/development → src/stylesheets/tools}/console.scss +0 -0
  220. data/src/templates/components/bootstrap_form_controls.luca +7 -0
  221. data/src/templates/components/collection_loader_view.luca +5 -0
  222. data/src/templates/components/form_alert +0 -0
  223. data/src/templates/components/form_alert.luca +3 -0
  224. data/src/templates/components/grid_view.luca +7 -0
  225. data/src/templates/components/grid_view_empty_text.luca +3 -0
  226. data/src/templates/components/load_mask.luca +3 -0
  227. data/src/templates/components/nav_bar.luca +2 -0
  228. data/src/templates/containers/basic.luca +1 -0
  229. data/src/templates/containers/tab_selector_container.luca +8 -0
  230. data/src/templates/containers/tab_view.luca +2 -0
  231. data/src/templates/containers/toolbar_wrapper.luca +1 -0
  232. data/src/templates/fields/button_field.luca +2 -0
  233. data/src/templates/fields/button_field_link.luca +5 -0
  234. data/src/templates/fields/checkbox_array.luca +4 -0
  235. data/src/templates/fields/checkbox_array_item.luca +4 -0
  236. data/src/templates/fields/checkbox_field.luca +9 -0
  237. data/src/templates/fields/file_upload_field.luca +8 -0
  238. data/src/templates/fields/hidden_field.luca +1 -0
  239. data/src/templates/fields/select_field.luca +8 -0
  240. data/src/templates/fields/text_area_field.luca +8 -0
  241. data/src/templates/fields/text_field.luca +17 -0
  242. data/src/templates/sample/contents.luca +1 -0
  243. data/src/templates/sample/welcome.luca +1 -0
  244. data/src/templates/table_view.luca +4 -0
  245. data/src/tools/application_inspector.coffee +2 -0
  246. data/src/tools/code_editor.coffee +258 -0
  247. data/{app/assets/javascripts/luca/development → src/tools}/code_mirror_field.coffee +1 -2
  248. data/src/tools/coffee_script_editor.coffee +82 -0
  249. data/src/tools/collection_inspector.coffee +4 -0
  250. data/src/tools/collections/components.coffee +59 -0
  251. data/src/tools/collections/instances.coffee +15 -0
  252. data/src/tools/component_tester.coffee +462 -0
  253. data/{app/assets/javascripts/luca/development → src/tools}/console.coffee +24 -55
  254. data/src/tools/models/components.coffee +25 -0
  255. data/src/tools/models/instance.coffee +2 -0
  256. data/src/tools/templates/component_tester/help.luca +14 -0
  257. data/{app/assets/javascripts/luca/util/luca.coffee → src/util.coffee} +6 -90
  258. data/vendor/assets/javascripts/luca-ui-development-tools.js +18533 -0
  259. data/vendor/assets/javascripts/luca-ui-development-tools.min.js +15 -0
  260. data/vendor/assets/javascripts/luca-ui-full.js +4806 -0
  261. data/vendor/assets/javascripts/luca-ui-full.min.js +8 -0
  262. data/vendor/assets/javascripts/luca-ui-templates.js +24 -0
  263. data/vendor/assets/javascripts/luca-ui.js +1703 -4394
  264. data/vendor/assets/javascripts/luca-ui.min.js +4 -5
  265. data/vendor/assets/luca-ui/base.css +85 -0
  266. data/vendor/assets/luca-ui/components/application.js +91 -0
  267. data/vendor/assets/luca-ui/components/base_toolbar.js +23 -0
  268. data/vendor/assets/luca-ui/components/controller.js +38 -0
  269. data/vendor/assets/luca-ui/components/fields/button_field.js +45 -0
  270. data/vendor/assets/luca-ui/components/fields/checkbox_field.js +43 -0
  271. data/vendor/assets/luca-ui/components/fields/file_upload_field.js +20 -0
  272. data/vendor/assets/luca-ui/components/fields/hidden_field.js +20 -0
  273. data/vendor/assets/luca-ui/components/fields/select_field.js +97 -0
  274. data/vendor/assets/luca-ui/components/fields/text_area_field.js +48 -0
  275. data/vendor/assets/luca-ui/components/fields/text_field.js +46 -0
  276. data/vendor/assets/luca-ui/components/fields/type_ahead_field.js +13 -0
  277. data/vendor/assets/luca-ui/components/form_button_toolbar.js +32 -0
  278. data/vendor/assets/luca-ui/components/form_view.css +32 -0
  279. data/vendor/assets/luca-ui/components/form_view.js +207 -0
  280. data/{app/assets/stylesheets/luca/components/table_view.scss → vendor/assets/luca-ui/components/grid_view.css} +51 -60
  281. data/vendor/assets/luca-ui/components/grid_view.js +202 -0
  282. data/vendor/assets/luca-ui/components/record_manager.js +207 -0
  283. data/vendor/assets/luca-ui/components/router.js +36 -0
  284. data/vendor/assets/luca-ui/components/template.js +26 -0
  285. data/vendor/assets/luca-ui/components/toolbar.css +11 -0
  286. data/vendor/assets/luca-ui/containers/card_view.js +98 -0
  287. data/vendor/assets/luca-ui/containers/column_view.js +52 -0
  288. data/vendor/assets/luca-ui/containers/container.css +3 -0
  289. data/vendor/assets/luca-ui/containers/modal_view.css +0 -0
  290. data/vendor/assets/luca-ui/containers/modal_view.js +87 -0
  291. data/vendor/assets/luca-ui/containers/panel_view.js +34 -0
  292. data/vendor/assets/luca-ui/containers/split_view.js +13 -0
  293. data/vendor/assets/luca-ui/containers/tab_view.css +16 -0
  294. data/vendor/assets/luca-ui/containers/tab_view.js +80 -0
  295. data/vendor/assets/luca-ui/containers/viewport.js +18 -0
  296. data/vendor/assets/luca-ui/core/collection.js +221 -0
  297. data/vendor/assets/luca-ui/core/container.js +205 -0
  298. data/vendor/assets/luca-ui/core/field.js +59 -0
  299. data/vendor/assets/luca-ui/core/observer.js +42 -0
  300. data/vendor/assets/luca-ui/core/view.js +127 -0
  301. data/vendor/assets/luca-ui/framework.js +110 -0
  302. data/vendor/assets/luca-ui/index.js +5 -0
  303. data/vendor/assets/luca-ui/managers/collection_manager.js +98 -0
  304. data/vendor/assets/luca-ui/managers/socket_manager.js +52 -0
  305. data/vendor/assets/luca-ui/modules/deferrable.js +21 -0
  306. data/vendor/assets/luca-ui/modules/local_storage.js +81 -0
  307. data/vendor/assets/luca-ui/normalize.css +359 -0
  308. data/vendor/assets/luca-ui/stylesheets/base.css +85 -0
  309. data/vendor/assets/luca-ui/stylesheets/components/form_view.css +32 -0
  310. data/vendor/assets/luca-ui/stylesheets/components/grid_view.css +76 -0
  311. data/vendor/assets/luca-ui/stylesheets/components/toolbar.css +11 -0
  312. data/vendor/assets/luca-ui/stylesheets/containers/container.css +3 -0
  313. data/vendor/assets/luca-ui/stylesheets/containers/modal_view.css +0 -0
  314. data/vendor/assets/luca-ui/stylesheets/containers/tab_view.css +16 -0
  315. data/vendor/assets/luca-ui/stylesheets/normalize.css +359 -0
  316. data/vendor/assets/luca-ui/templates/components/bootstrap_form_controls.js +4 -0
  317. data/vendor/assets/luca-ui/templates/components/form_view.js +4 -0
  318. data/vendor/assets/luca-ui/templates/components/grid_view.js +4 -0
  319. data/vendor/assets/luca-ui/templates/components/grid_view_empty_text.js +4 -0
  320. data/vendor/assets/luca-ui/templates/containers/basic.js +4 -0
  321. data/vendor/assets/luca-ui/templates/containers/tab_selector_container.js +4 -0
  322. data/vendor/assets/luca-ui/templates/containers/tab_view.js +4 -0
  323. data/vendor/assets/luca-ui/templates/containers/toolbar_wrapper.js +4 -0
  324. data/vendor/assets/luca-ui/templates/fields/button_field.js +4 -0
  325. data/vendor/assets/luca-ui/templates/fields/button_field_link.js +4 -0
  326. data/vendor/assets/luca-ui/templates/fields/checkbox_field.js +4 -0
  327. data/vendor/assets/luca-ui/templates/fields/file_upload_field.js +4 -0
  328. data/vendor/assets/luca-ui/templates/fields/hidden_field.js +4 -0
  329. data/vendor/assets/luca-ui/templates/fields/select_field.js +4 -0
  330. data/vendor/assets/luca-ui/templates/fields/text_area_field.js +4 -0
  331. data/vendor/assets/luca-ui/templates/fields/text_field.js +4 -0
  332. data/vendor/assets/luca-ui/templates/sample/contents.js +4 -0
  333. data/vendor/assets/luca-ui/templates/sample/welcome.js +4 -0
  334. data/vendor/assets/stylesheets/luca-ui.css +471 -68
  335. data/views/jasmine.erb +2 -2
  336. metadata +328 -496
  337. data/app/assets/javascripts/luca/basic.coffee +0 -8
  338. data/app/assets/javascripts/luca/components/application.coffee +0 -530
  339. data/app/assets/javascripts/luca/components/collection_view.coffee +0 -211
  340. data/app/assets/javascripts/luca/components/controller.coffee +0 -176
  341. data/app/assets/javascripts/luca/components/fields/base.coffee +0 -144
  342. data/app/assets/javascripts/luca/components/fields/button_field.coffee +0 -91
  343. data/app/assets/javascripts/luca/components/fields/hidden_field.coffee +0 -11
  344. data/app/assets/javascripts/luca/components/fields/label_field.coffee +0 -12
  345. data/app/assets/javascripts/luca/components/fields/select_field.coffee +0 -159
  346. data/app/assets/javascripts/luca/components/fields/text_area_field.coffee +0 -57
  347. data/app/assets/javascripts/luca/components/fields/type_ahead_field.coffee +0 -20
  348. data/app/assets/javascripts/luca/components/form_view.coffee +0 -421
  349. data/app/assets/javascripts/luca/components/grid_layout_view.coffee +0 -42
  350. data/app/assets/javascripts/luca/components/index.coffee +0 -7
  351. data/app/assets/javascripts/luca/components/load_mask.coffee +0 -8
  352. data/app/assets/javascripts/luca/components/multi_collection_view.coffee +0 -92
  353. data/app/assets/javascripts/luca/components/nav_bar.coffee +0 -80
  354. data/app/assets/javascripts/luca/components/page.coffee +0 -70
  355. data/app/assets/javascripts/luca/components/pagination_control.coffee +0 -104
  356. data/app/assets/javascripts/luca/components/simple_collection_view.coffee +0 -10
  357. data/app/assets/javascripts/luca/components/table_view.coffee +0 -93
  358. data/app/assets/javascripts/luca/components/table_view_scrollable.coffee +0 -23
  359. data/app/assets/javascripts/luca/concerns/application_event_bindings.coffee +0 -19
  360. data/app/assets/javascripts/luca/concerns/collection_event_bindings.coffee +0 -47
  361. data/app/assets/javascripts/luca/concerns/development_tool_helpers.coffee +0 -30
  362. data/app/assets/javascripts/luca/concerns/dom_helpers.coffee +0 -61
  363. data/app/assets/javascripts/luca/concerns/enhanced_properties.coffee +0 -23
  364. data/app/assets/javascripts/luca/concerns/filterable.coffee +0 -101
  365. data/app/assets/javascripts/luca/concerns/form_model_bindings.coffee +0 -20
  366. data/app/assets/javascripts/luca/concerns/grid_layout.coffee +0 -15
  367. data/app/assets/javascripts/luca/concerns/modal_view.coffee +0 -63
  368. data/app/assets/javascripts/luca/concerns/model_presenter.coffee +0 -23
  369. data/app/assets/javascripts/luca/concerns/paginatable.coffee +0 -79
  370. data/app/assets/javascripts/luca/concerns/query_collection_bindings.coffee +0 -52
  371. data/app/assets/javascripts/luca/concerns/sortable.coffee +0 -69
  372. data/app/assets/javascripts/luca/concerns/state_model.coffee +0 -58
  373. data/app/assets/javascripts/luca/concerns/templating.coffee +0 -13
  374. data/app/assets/javascripts/luca/config.coffee +0 -54
  375. data/app/assets/javascripts/luca/containers/card_view.coffee +0 -178
  376. data/app/assets/javascripts/luca/containers/container.coffee +0 -711
  377. data/app/assets/javascripts/luca/containers/index.coffee +0 -2
  378. data/app/assets/javascripts/luca/containers/page_controller.coffee +0 -25
  379. data/app/assets/javascripts/luca/core/events.coffee +0 -114
  380. data/app/assets/javascripts/luca/core/index.coffee +0 -12
  381. data/app/assets/javascripts/luca/core/model.coffee +0 -56
  382. data/app/assets/javascripts/luca/core/panel.coffee +0 -124
  383. data/app/assets/javascripts/luca/core/registry/component_definition.coffee +0 -319
  384. data/app/assets/javascripts/luca/core/registry/concerns.coffee +0 -70
  385. data/app/assets/javascripts/luca/core/registry/index.coffee +0 -4
  386. data/app/assets/javascripts/luca/core/registry/meta_data.coffee +0 -99
  387. data/app/assets/javascripts/luca/core/templates.coffee +0 -51
  388. data/app/assets/javascripts/luca/core/view.coffee +0 -383
  389. data/app/assets/javascripts/luca/dependencies.coffee +0 -9
  390. data/app/assets/javascripts/luca/development/code_sync_manager.coffee +0 -173
  391. data/app/assets/javascripts/luca/development/component.coffee +0 -76
  392. data/app/assets/javascripts/luca/development/components.coffee +0 -57
  393. data/app/assets/javascripts/luca/development/index.coffee +0 -5
  394. data/app/assets/javascripts/luca/index.coffee +0 -9
  395. data/app/assets/javascripts/luca/managers/index.coffee +0 -2
  396. data/app/assets/javascripts/luca/managers/socket_manager.coffee +0 -89
  397. data/app/assets/javascripts/luca/templates/components/bootstrap_form_controls.jst.ejs +0 -10
  398. data/app/assets/javascripts/luca/templates/components/collection_loader_view.jst.ejs +0 -6
  399. data/app/assets/javascripts/luca/templates/components/form_alert.jst.ejs +0 -4
  400. data/app/assets/javascripts/luca/templates/components/grid_view.jst.ejs +0 -11
  401. data/app/assets/javascripts/luca/templates/components/grid_view_empty_text.jst.ejs +0 -3
  402. data/app/assets/javascripts/luca/templates/components/load_mask.jst.ejs +0 -5
  403. data/app/assets/javascripts/luca/templates/components/nav_bar.jst.ejs +0 -19
  404. data/app/assets/javascripts/luca/templates/components/pagination.jst.ejs +0 -10
  405. data/app/assets/javascripts/luca/templates/components/table_view.jst.ejs +0 -4
  406. data/app/assets/javascripts/luca/templates/containers/basic.jst.ejs +0 -1
  407. data/app/assets/javascripts/luca/templates/containers/tab_selector_container.jst.ejs +0 -12
  408. data/app/assets/javascripts/luca/templates/containers/tab_view.jst.ejs +0 -2
  409. data/app/assets/javascripts/luca/templates/containers/toolbar_wrapper.jst.ejs +0 -1
  410. data/app/assets/javascripts/luca/templates/fields/button_field.jst.ejs +0 -2
  411. data/app/assets/javascripts/luca/templates/fields/button_field_link.jst.ejs +0 -6
  412. data/app/assets/javascripts/luca/templates/fields/checkbox_array.jst.ejs +0 -4
  413. data/app/assets/javascripts/luca/templates/fields/checkbox_array_item.jst.ejs +0 -3
  414. data/app/assets/javascripts/luca/templates/fields/checkbox_field.jst.ejs +0 -10
  415. data/app/assets/javascripts/luca/templates/fields/file_upload_field.jst.ejs +0 -10
  416. data/app/assets/javascripts/luca/templates/fields/hidden_field.jst.ejs +0 -1
  417. data/app/assets/javascripts/luca/templates/fields/select_field.jst.ejs +0 -11
  418. data/app/assets/javascripts/luca/templates/fields/text_area_field.jst.ejs +0 -11
  419. data/app/assets/javascripts/luca/templates/fields/text_field.jst.ejs +0 -16
  420. data/app/assets/javascripts/luca/util/deprecations.coffee +0 -18
  421. data/app/assets/javascripts/luca/util/index.coffee +0 -4
  422. data/app/assets/javascripts/luca/util/keybindings.coffee +0 -24
  423. data/app/assets/javascripts/luca/util/logging.coffee +0 -30
  424. data/app/assets/javascripts/luca-ui.js +0 -1
  425. data/app/assets/stylesheets/luca/components/form_view.scss +0 -7
  426. data/app/assets/stylesheets/luca/containers/container.scss +0 -19
  427. data/app/assets/stylesheets/luca/development/index.css +0 -3
  428. data/app/assets/stylesheets/luca/index.css +0 -4
  429. data/bin/luca +0 -14
  430. data/docs/framework.json +0 -1
  431. data/docs/luca-framework-documentation.js +0 -1
  432. data/lib/generators/luca/application/application_generator.rb +0 -75
  433. data/lib/generators/luca/application/templates/controller.rb +0 -4
  434. data/lib/generators/luca/application/templates/index.html.erb +0 -19
  435. data/lib/generators/luca/application/templates/index.html.haml +0 -7
  436. data/lib/generators/luca/application/templates/javascripts/application.coffee +0 -18
  437. data/lib/generators/luca/application/templates/javascripts/collection_manager.coffee +0 -2
  438. data/lib/generators/luca/application/templates/javascripts/config.coffee +0 -3
  439. data/lib/generators/luca/application/templates/javascripts/dependencies.coffee +0 -3
  440. data/lib/generators/luca/application/templates/javascripts/home.jst.ejs +0 -2
  441. data/lib/generators/luca/application/templates/javascripts/index.coffee +0 -15
  442. data/lib/generators/luca/application/templates/javascripts/router.coffee +0 -4
  443. data/lib/guard/luca.rb +0 -84
  444. data/lib/luca/asset_compiler.rb +0 -117
  445. data/lib/luca/cli/generate.rb +0 -37
  446. data/lib/luca/cli/server.rb +0 -20
  447. data/lib/luca/cli/sync.rb +0 -40
  448. data/lib/luca/cli/watch.rb +0 -16
  449. data/lib/luca/cli.rb +0 -68
  450. data/lib/luca/collection/endpoint.rb +0 -38
  451. data/lib/luca/collection/file_backend.rb +0 -121
  452. data/lib/luca/collection/redis_backend.rb +0 -153
  453. data/lib/luca/collection.rb +0 -64
  454. data/lib/luca/compiled_asset.rb +0 -61
  455. data/lib/luca/component_definition.rb +0 -356
  456. data/lib/luca/luca_application.rb +0 -258
  457. data/lib/luca/project.rb +0 -73
  458. data/lib/luca/project_harness.rb +0 -96
  459. data/lib/luca/server.rb +0 -7
  460. data/lib/luca/stylesheet.rb +0 -35
  461. data/lib/luca/template_asset.rb +0 -64
  462. data/lib/luca/version.rb +0 -3
  463. data/lib/luca/watcher.rb +0 -72
  464. data/lib/railties/luca/tasks.rake +0 -38
  465. data/site/.bundle/config +0 -2
  466. data/site/.gitignore +0 -5
  467. data/site/.rvmrc +0 -1
  468. data/site/CHANGELOG.md +0 -41
  469. data/site/DOCS.md +0 -41
  470. data/site/Gemfile +0 -8
  471. data/site/Gemfile.lock +0 -134
  472. data/site/LICENSE.md +0 -19
  473. data/site/config.rb +0 -84
  474. data/site/helpers/site_helpers.rb +0 -20
  475. data/site/html5bp-docs/README.md +0 -38
  476. data/site/html5bp-docs/contribute.md +0 -104
  477. data/site/html5bp-docs/crossdomain.md +0 -21
  478. data/site/html5bp-docs/css.md +0 -135
  479. data/site/html5bp-docs/extend.md +0 -507
  480. data/site/html5bp-docs/faq.md +0 -77
  481. data/site/html5bp-docs/htaccess.md +0 -323
  482. data/site/html5bp-docs/html.md +0 -170
  483. data/site/html5bp-docs/js.md +0 -31
  484. data/site/html5bp-docs/misc.md +0 -25
  485. data/site/html5bp-docs/usage.md +0 -109
  486. data/site/readme.md +0 -47
  487. data/site/source/.htaccess +0 -540
  488. data/site/source/404.html +0 -157
  489. data/site/source/app/assets/javascripts/dependencies.js.coffee +0 -6
  490. data/site/source/app/assets/javascripts/docs/application.coffee +0 -64
  491. data/site/source/app/assets/javascripts/docs/collections/docs_documentation.coffee +0 -17
  492. data/site/source/app/assets/javascripts/docs/collections/github_repositories.coffee +0 -7
  493. data/site/source/app/assets/javascripts/docs/collections/index.coffee +0 -1
  494. data/site/source/app/assets/javascripts/docs/collections/luca_documentation.coffee +0 -17
  495. data/site/source/app/assets/javascripts/docs/collections/public_gists.coffee +0 -4
  496. data/site/source/app/assets/javascripts/docs/config.coffee +0 -5
  497. data/site/source/app/assets/javascripts/docs/index.coffee +0 -12
  498. data/site/source/app/assets/javascripts/docs/lib/router.coffee +0 -3
  499. data/site/source/app/assets/javascripts/docs/models/component.coffee +0 -99
  500. data/site/source/app/assets/javascripts/docs/models/github_repository.coffee +0 -3
  501. data/site/source/app/assets/javascripts/docs/models/index.coffee +0 -1
  502. data/site/source/app/assets/javascripts/docs/templates/component_documentation.jst.ejs +0 -55
  503. data/site/source/app/assets/javascripts/docs/templates/examples_browser/overview.jst.ejs +0 -4
  504. data/site/source/app/assets/javascripts/docs/templates/examples_browser/selector.jst.ejs +0 -11
  505. data/site/source/app/assets/javascripts/docs/templates/github_repository.jst.ejs +0 -4
  506. data/site/source/app/assets/javascripts/docs/templates/layouts/main.jst.ejs +0 -4
  507. data/site/source/app/assets/javascripts/docs/templates/left_navigation.jst.ejs +0 -5
  508. data/site/source/app/assets/javascripts/docs/templates/pages/getting_started.jst.ejs +0 -78
  509. data/site/source/app/assets/javascripts/docs/templates/pages/home.jst.ejs +0 -57
  510. data/site/source/app/assets/javascripts/docs/views/components/code_editor.coffee +0 -45
  511. data/site/source/app/assets/javascripts/docs/views/components/component_documentation.coffee +0 -72
  512. data/site/source/app/assets/javascripts/docs/views/index.coffee +0 -3
  513. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/details.coffee +0 -37
  514. data/site/source/app/assets/javascripts/docs/views/pages/browse_source/list.coffee +0 -31
  515. data/site/source/app/assets/javascripts/docs/views/pages/browse_source.coffee +0 -46
  516. data/site/source/app/assets/javascripts/docs/views/pages/component_editor.coffee +0 -10
  517. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/docs.coffee +0 -12
  518. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser/source.coffee +0 -13
  519. data/site/source/app/assets/javascripts/docs/views/pages/examples_browser.coffee +0 -102
  520. data/site/source/app/assets/javascripts/docs/views/pages/home.coffee +0 -10
  521. data/site/source/app/assets/javascripts/docs/views/views/api_browser/index.coffee +0 -43
  522. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/grid_layout_view_example.coffee +0 -14
  523. data/site/source/app/assets/javascripts/docs/views/views/collection_view_examples/table_view_example.coffee +0 -39
  524. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/basic_example.coffee +0 -38
  525. data/site/source/app/assets/javascripts/docs/views/views/form_view_examples/complex_layout.coffee +0 -110
  526. data/site/source/app/assets/javascripts/docs/views/views/top_navigation.coffee +0 -6
  527. data/site/source/app/assets/javascripts/docs-docs.js +0 -1
  528. data/site/source/app/assets/javascripts/luca-docs.js +0 -1
  529. data/site/source/app/assets/javascripts/luca-framework-documentation.js +0 -1
  530. data/site/source/app/assets/javascripts/site.js.coffee +0 -4
  531. data/site/source/app/assets/javascripts/vendor/codemirror.js +0 -4786
  532. data/site/source/app/assets/javascripts/vendor/coffeescript.js +0 -346
  533. data/site/source/app/assets/javascripts/vendor/css.js +0 -465
  534. data/site/source/app/assets/javascripts/vendor/htmlmixed.js +0 -84
  535. data/site/source/app/assets/javascripts/vendor/javascript.js +0 -422
  536. data/site/source/app/assets/javascripts/vendor/js-beautify.js +0 -1353
  537. data/site/source/app/assets/javascripts/vendor/modernizr-2.6.1.min.js +0 -4
  538. data/site/source/app/assets/javascripts/vendor/vim.js +0 -2511
  539. data/site/source/app/assets/stylesheets/docs/api-browser.css.scss +0 -5
  540. data/site/source/app/assets/stylesheets/docs/application.css.scss +0 -35
  541. data/site/source/app/assets/stylesheets/docs/browse-source.css.scss +0 -5
  542. data/site/source/app/assets/stylesheets/docs/scrollable-table.css.scss +0 -5
  543. data/site/source/app/assets/stylesheets/site.css.scss +0 -2
  544. data/site/source/app/assets/stylesheets/vendor/codemirror.css +0 -240
  545. data/site/source/app/assets/stylesheets/vendor/prettify-tomorrow-night-bright.css +0 -160
  546. data/site/source/app/assets/stylesheets/vendor/twilight.css +0 -26
  547. data/site/source/crossdomain.xml +0 -15
  548. data/site/source/documentation.html.haml +0 -1
  549. data/site/source/favicon_base.png +0 -0
  550. data/site/source/humans.txt +0 -15
  551. data/site/source/images/background.png +0 -0
  552. data/site/source/images/middleman.png +0 -0
  553. data/site/source/index.html.haml +0 -1
  554. data/site/source/layouts/layout.haml +0 -55
  555. data/site/source/readme.md +0 -63
  556. data/site/source/robots.txt +0 -3
  557. data/spec/javascripts/components/collection_view_spec.coffee +0 -59
  558. data/spec/javascripts/components/controller_spec.coffee +0 -62
  559. data/spec/javascripts/components/form_view_spec.coffee +0 -162
  560. data/spec/javascripts/components/multi_collection_view_spec.coffee +0 -5
  561. data/spec/javascripts/components/table_view_spec.coffee +0 -17
  562. data/spec/javascripts/concerns/collection_event_bindings_spec.coffee +0 -15
  563. data/spec/javascripts/concerns/dom_helpers_spec.coffee +0 -16
  564. data/spec/javascripts/concerns/filterable_spec.coffee +0 -25
  565. data/spec/javascripts/concerns/model_presenter_spec.coffee +0 -31
  566. data/spec/javascripts/concerns/state_model_spec.coffee +0 -55
  567. data/spec/javascripts/containers/card_view_spec.coffee +0 -108
  568. data/spec/javascripts/core/concerns_spec.coffee +0 -88
  569. data/spec/javascripts/core/container_spec.coffee +0 -287
  570. data/spec/javascripts/core/define_spec.coffee +0 -116
  571. data/spec/javascripts/core/events_spec.coffee +0 -26
  572. data/spec/javascripts/core/field_spec.coffee +0 -4
  573. data/spec/javascripts/core/util_spec.coffee +0 -24
  574. data/spec/javascripts/dependencies/index.coffee +0 -3
  575. data/spec/lib/component_definition_spec.rb +0 -63
  576. data/spec/lib/input_compiler_spec.rb +0 -9
  577. data/spec/lib/luca_application_spec.rb +0 -30
  578. data/spec/support/fixtures/application.coffee +0 -45
  579. data/spec/support/fixtures/component.coffee +0 -34
  580. data/tutorials/component-driven-design.md +0 -140
  581. data/tutorials/structure-of-a-project.md +0 -63
  582. data/vendor/assets/javascripts/backbone-ext.js +0 -21
  583. data/vendor/assets/javascripts/backbone-min.js +0 -42
  584. data/vendor/assets/javascripts/backbone-query.min.js +0 -1
  585. data/vendor/assets/javascripts/bootstrap.min.js +0 -7
  586. data/vendor/assets/javascripts/codemirror-ui.js +0 -503
  587. data/vendor/assets/javascripts/hogan.js +0 -707
  588. data/vendor/assets/javascripts/inflections.js +0 -656
  589. data/vendor/assets/javascripts/jasmine-html.js +0 -190
  590. data/vendor/assets/javascripts/jasmine.js +0 -2476
  591. data/vendor/assets/javascripts/jquery.js +0 -5
  592. data/vendor/assets/javascripts/keymaster.min.js +0 -4
  593. data/vendor/assets/javascripts/luca-dependencies.min.js +0 -8
  594. data/vendor/assets/javascripts/luca-development.min.js +0 -1
  595. data/vendor/assets/javascripts/luca-spec.js +0 -11
  596. data/vendor/assets/javascripts/luca.full.min.js +0 -12
  597. data/vendor/assets/javascripts/luca.min.js +0 -5
  598. data/vendor/assets/javascripts/sinon.js +0 -3469
  599. data/vendor/assets/javascripts/underscore-min.js +0 -1
  600. data/vendor/assets/javascripts/underscore-string.min.js +0 -1
  601. data/vendor/assets/stylesheets/bootstrap-responsive.min.css +0 -9
  602. data/vendor/assets/stylesheets/bootstrap.min.css +0 -9
  603. data/vendor/assets/stylesheets/luca-components.css +0 -202
  604. data/vendor/assets/stylesheets/luca-development.css +0 -23
@@ -1,12 +0,0 @@
1
- /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
2
- //@ sourceMappingURL=jquery.min.map
3
- */(function(a,b){function I(a){var b=a.length,c=t.type(a);return t.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||"function"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function K(a){var b=J[a]={};return t.each(a.match(v)||[],function(a,c){b[c]=!0}),b}function N(a,c,d,e){if(t.acceptData(a)){var f,g,h=t.expando,i="string"==typeof c,j=a.nodeType,l=j?t.cache:a,m=j?a[h]:a[h]&&h;if(m&&l[m]&&(e||l[m].data)||!i||d!==b)return m||(j?a[h]=m=k.pop()||t.guid++:m=h),l[m]||(l[m]={},j||(l[m].toJSON=t.noop)),("object"==typeof c||"function"==typeof c)&&(e?l[m]=t.extend(l[m],c):l[m].data=t.extend(l[m].data,c)),f=l[m],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[t.camelCase(c)]=d),i?(g=f[c],null==g&&(g=f[t.camelCase(c)])):g=f,g}}function O(a,b,c){if(t.acceptData(a)){var d,e,f,g=a.nodeType,h=g?t.cache:a,i=g?a[t.expando]:t.expando;if(h[i]){if(b&&(f=c?h[i]:h[i].data)){t.isArray(b)?b=b.concat(t.map(b,t.camelCase)):b in f?b=[b]:(b=t.camelCase(b),b=b in f?[b]:b.split(" "));for(d=0,e=b.length;e>d;d++)delete f[b[d]];if(!(c?Q:t.isEmptyObject)(f))return}(c||(delete h[i].data,Q(h[i])))&&(g?t.cleanData([a],!0):t.support.deleteExpando||h!=h.window?delete h[i]:h[i]=null)}}}function P(a,c,d){if(d===b&&1===a.nodeType){var e="data-"+c.replace(M,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:L.test(d)?t.parseJSON(d):d}catch(f){}t.data(a,c,d)}else d=b}return d}function Q(a){var b;for(b in a)if(("data"!==b||!t.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function eb(){return!0}function fb(){return!1}function lb(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function mb(a,b,c){if(b=b||0,t.isFunction(b))return t.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return t.grep(a,function(a){return a===b===c});if("string"==typeof b){var d=t.grep(a,function(a){return 1===a.nodeType});if(ib.test(b))return t.filter(b,d,!c);b=t.filter(b,d)}return t.grep(a,function(a){return t.inArray(a,b)>=0===c})}function nb(a){var b=ob.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function Fb(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function Gb(a){var b=a.getAttributeNode("type");return a.type=(b&&b.specified)+"/"+a.type,a}function Hb(a){var b=Ab.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ib(a,b){var c,d=0;for(;null!=(c=a[d]);d++)t._data(c,"globalEval",!b||t._data(b[d],"globalEval"))}function Jb(a,b){if(1===b.nodeType&&t.hasData(a)){var c,d,e,f=t._data(a),g=t._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)t.event.add(b,c,h[c][d])}g.data&&(g.data=t.extend({},g.data))}}function Kb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!t.support.noCloneEvent&&b[t.expando]){e=t._data(b);for(d in e.events)t.removeEvent(b,d,e.handle);b.removeAttribute(t.expando)}"script"===c&&b.text!==a.text?(Gb(b).text=a.text,Hb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),t.support.html5Clone&&a.innerHTML&&!t.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&xb.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}function Lb(a,c){var d,f,g=0,h=typeof a.getElementsByTagName!==e?a.getElementsByTagName(c||"*"):typeof a.querySelectorAll!==e?a.querySelectorAll(c||"*"):b;if(!h)for(h=[],d=a.childNodes||a;null!=(f=d[g]);g++)!c||t.nodeName(f,c)?h.push(f):t.merge(h,Lb(f,c));return c===b||c&&t.nodeName(a,c)?t.merge([a],h):h}function Mb(a){xb.test(a.type)&&(a.defaultChecked=a.checked)}function bc(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=ac.length;while(e--)if(b=ac[e]+c,b in a)return b;return d}function cc(a,b){return a=b||a,"none"===t.css(a,"display")||!t.contains(a.ownerDocument,a)}function dc(a,b){var c,d,e,f=[],g=0,h=a.length;for(;h>g;g++)d=a[g],d.style&&(f[g]=t._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&cc(d)&&(f[g]=t._data(d,"olddisplay",hc(d.nodeName)))):f[g]||(e=cc(d),(c&&"none"!==c||!e)&&t._data(d,"olddisplay",e?c:t.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function ec(a,b,c){var d=Vb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function fc(a,b,c,d,e){var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;for(;4>f;f+=2)"margin"===c&&(g+=t.css(a,c+_b[f],!0,e)),d?("content"===c&&(g-=t.css(a,"padding"+_b[f],!0,e)),"margin"!==c&&(g-=t.css(a,"border"+_b[f]+"Width",!0,e))):(g+=t.css(a,"padding"+_b[f],!0,e),"padding"!==c&&(g+=t.css(a,"border"+_b[f]+"Width",!0,e)));return g}function gc(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ob(a),g=t.support.boxSizing&&"border-box"===t.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Pb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Wb.test(e))return e;d=g&&(t.support.boxSizingReliable||e===a.style[b]),e=parseFloat(e)||0}return e+fc(a,b,c||(g?"border":"content"),d,f)+"px"}function hc(a){var b=f,c=Yb[a];return c||(c=ic(a,b),"none"!==c&&c||(Nb=(Nb||t("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(b.documentElement),b=(Nb[0].contentWindow||Nb[0].contentDocument).document,b.write("<!doctype html><html><body>"),b.close(),c=ic(a,b),Nb.detach()),Yb[a]=c),c}function ic(a,b){var c=t(b.createElement(a)).appendTo(b.body),d=t.css(c[0],"display");return c.remove(),d}function oc(a,b,c,d){var e;if(t.isArray(b))t.each(b,function(b,e){c||kc.test(a)?d(a,e):oc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==t.type(b))d(a,b);else for(e in b)oc(a+"["+e+"]",b[e],c,d)}function Fc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(v)||[];if(t.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Gc(a,c,d,e){function h(i){var j;return f[i]=!0,t.each(a[i]||[],function(a,i){var k=i(c,d,e);return"string"!=typeof k||g||f[k]?g?!(j=k):b:(c.dataTypes.unshift(k),h(k),!1)}),j}var f={},g=a===Cc;return h(c.dataTypes[0])||!f["*"]&&h("*")}function Hc(a,c){var d,e,f=t.ajaxSettings.flatOptions||{};for(e in c)c[e]!==b&&((f[e]?a:d||(d={}))[e]=c[e]);return d&&t.extend(!0,a,d),a}function Ic(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(h in k)h in d&&(c[k[h]]=d[h]);while("*"===j[0])j.shift(),f===b&&(f=a.mimeType||c.getResponseHeader("Content-Type"));if(f)for(h in i)if(i[h]&&i[h].test(f)){j.unshift(h);break}if(j[0]in d)g=j[0];else{for(h in d){if(!j[0]||a.converters[h+" "+j[0]]){g=h;break}e||(e=h)}g=g||e}return g?(g!==j[0]&&j.unshift(g),d[g]):b}function Jc(a,b){var c,d,e,f,g={},h=0,i=a.dataTypes.slice(),j=i[0];if(a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i[1])for(e in a.converters)g[e.toLowerCase()]=a.converters[e];for(;d=i[++h];)if("*"!==d){if("*"!==j&&j!==d){if(e=g[j+" "+d]||g["* "+d],!e)for(c in g)if(f=c.split(" "),f[1]===d&&(e=g[j+" "+f[0]]||g["* "+f[0]])){e===!0?e=g[c]:g[c]!==!0&&(d=f[0],i.splice(h--,0,d));break}if(e!==!0)if(e&&a["throws"])b=e(b);else try{b=e(b)}catch(k){return{state:"parsererror",error:e?k:"No conversion from "+j+" to "+d}}}j=d}return{state:"success",data:b}}function Qc(){try{return new a.XMLHttpRequest}catch(b){}}function Rc(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function Zc(){return setTimeout(function(){Sc=b}),Sc=t.now()}function $c(a,b){t.each(b,function(b,c){var d=(Yc[b]||[]).concat(Yc["*"]),e=0,f=d.length;for(;f>e;e++)if(d[e].call(a,b,c))return})}function _c(a,b,c){var d,e,f=0,g=Xc.length,h=t.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;var b=Sc||Zc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;for(;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:t.extend({},b),opts:t.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Sc||Zc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=t.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(ad(k,j.opts.specialEasing);g>f;f++)if(d=Xc[f].call(j,a,k,j.opts))return d;return $c(j,k),t.isFunction(j.opts.start)&&j.opts.start.call(a,j),t.fx.timer(t.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}function ad(a,b){var c,d,e,f,g;for(e in a)if(d=t.camelCase(e),f=b[d],c=a[e],t.isArray(c)&&(f=c[1],c=a[e]=c[0]),e!==d&&(a[d]=c,delete a[e]),g=t.cssHooks[d],g&&"expand"in g){c=g.expand(c),delete a[d];for(e in c)e in a||(a[e]=c[e],b[e]=f)}else b[d]=f}function bd(a,b,c){var d,e,f,g,h,i,j,k,l,m=this,n=a.style,o={},p=[],q=a.nodeType&&cc(a);c.queue||(k=t._queueHooks(a,"fx"),null==k.unqueued&&(k.unqueued=0,l=k.empty.fire,k.empty.fire=function(){k.unqueued||l()}),k.unqueued++,m.always(function(){m.always(function(){k.unqueued--,t.queue(a,"fx").length||k.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[n.overflow,n.overflowX,n.overflowY],"inline"===t.css(a,"display")&&"none"===t.css(a,"float")&&(t.support.inlineBlockNeedsLayout&&"inline"!==hc(a.nodeName)?n.zoom=1:n.display="inline-block")),c.overflow&&(n.overflow="hidden",t.support.shrinkWrapBlocks||m.always(function(){n.overflow=c.overflow[0],n.overflowX=c.overflow[1],n.overflowY=c.overflow[2]}));for(e in b)if(g=b[e],Uc.exec(g)){if(delete b[e],i=i||"toggle"===g,g===(q?"hide":"show"))continue;p.push(e)}if(f=p.length){h=t._data(a,"fxshow")||t._data(a,"fxshow",{}),"hidden"in h&&(q=h.hidden),i&&(h.hidden=!q),q?t(a).show():m.done(function(){t(a).hide()}),m.done(function(){var b;t._removeData(a,"fxshow");for(b in o)t.style(a,b,o[b])});for(e=0;f>e;e++)d=p[e],j=m.createTween(d,q?h[d]:0),o[d]=h[d]||t.style(a,d),d in h||(h[d]=j.start,q&&(j.end=j.start,j.start="width"===d||"height"===d?1:0))}}function cd(a,b,c,d,e){return new cd.prototype.init(a,b,c,d,e)}function dd(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=_b[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function ed(a){return t.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var c,d,e=typeof b,f=a.document,g=a.location,h=a.jQuery,i=a.$,j={},k=[],l="1.9.1",m=k.concat,n=k.push,o=k.slice,p=k.indexOf,q=j.toString,r=j.hasOwnProperty,s=l.trim,t=function(a,b){return new t.fn.init(a,b,d)},u=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,v=/\S+/g,w=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,x=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,y=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,z=/^[\],:{}\s]*$/,A=/(?:^|:|,)(?:\s*\[)+/g,B=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,C=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,E=/-([\da-z])/gi,F=function(a,b){return b.toUpperCase()},G=function(a){(f.addEventListener||"load"===a.type||"complete"===f.readyState)&&(H(),t.ready())},H=function(){f.addEventListener?(f.removeEventListener("DOMContentLoaded",G,!1),a.removeEventListener("load",G,!1)):(f.detachEvent("onreadystatechange",G),a.detachEvent("onload",G))};t.fn=t.prototype={jquery:l,constructor:t,init:function(a,c,d){var e,g;if(!a)return this;if("string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:x.exec(a),!e||!e[1]&&c)return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a);if(e[1]){if(c=c instanceof t?c[0]:c,t.merge(this,t.parseHTML(e[1],c&&c.nodeType?c.ownerDocument||c:f,!0)),y.test(e[1])&&t.isPlainObject(c))for(e in c)t.isFunction(this[e])?this[e](c[e]):this.attr(e,c[e]);return this}if(g=f.getElementById(e[2]),g&&g.parentNode){if(g.id!==e[2])return d.find(a);this.length=1,this[0]=g}return this.context=f,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):t.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),t.makeArray(a,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return o.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a){var b=t.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return t.each(this,a,b)},ready:function(a){return t.ready.promise().done(a),this},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},map:function(a){return this.pushStack(t.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:n,sort:[].sort,splice:[].splice},t.fn.init.prototype=t.fn,t.extend=t.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),"object"==typeof h||t.isFunction(h)||(h={}),j===i&&(h=this,--i);j>i;i++)if(null!=(f=arguments[i]))for(e in f)a=h[e],d=f[e],h!==d&&(k&&d&&(t.isPlainObject(d)||(c=t.isArray(d)))?(c?(c=!1,g=a&&t.isArray(a)?a:[]):g=a&&t.isPlainObject(a)?a:{},h[e]=t.extend(k,g,d)):d!==b&&(h[e]=d));return h},t.extend({noConflict:function(b){return a.$===t&&(a.$=i),b&&a.jQuery===t&&(a.jQuery=h),t},isReady:!1,readyWait:1,holdReady:function(a){a?t.readyWait++:t.ready(!0)},ready:function(a){if(a===!0?!--t.readyWait:!t.isReady){if(!f.body)return setTimeout(t.ready);t.isReady=!0,a!==!0&&--t.readyWait>0||(c.resolveWith(f,[t]),t.fn.trigger&&t(f).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===t.type(a)},isArray:Array.isArray||function(a){return"array"===t.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[q.call(a)]||"object":typeof a},isPlainObject:function(a){if(!a||"object"!==t.type(a)||a.nodeType||t.isWindow(a))return!1;try{if(a.constructor&&!r.call(a,"constructor")&&!r.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||r.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw Error(a)},parseHTML:function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||f;var d=y.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=t.buildFragment([a],b,e),e&&t(e).remove(),t.merge([],d.childNodes))},parseJSON:function(c){return a.JSON&&a.JSON.parse?a.JSON.parse(c):null===c?c:"string"==typeof c&&(c=t.trim(c),c&&z.test(c.replace(B,"@").replace(C,"]").replace(A,"")))?Function("return "+c)():(t.error("Invalid JSON: "+c),b)},parseXML:function(c){var d,e;if(!c||"string"!=typeof c)return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return d&&d.documentElement&&!d.getElementsByTagName("parsererror").length||t.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&t.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(D,"ms-").replace(E,F)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=I(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:s&&!s.call(" ")?function(a){return null==a?"":s.call(a)}:function(a){return null==a?"":(a+"").replace(w,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(I(Object(a))?t.merge(c,"string"==typeof a?[a]:a):n.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(p)return p.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if("number"==typeof d)for(;d>f;f++)a[e++]=c[f];else while(c[f]!==b)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;for(c=!!c;g>f;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,b,c){var d,e=0,f=a.length,g=I(a),h=[];if(g)for(;f>e;e++)d=b(a[e],e,c),null!=d&&(h[h.length]=d);else for(e in a)d=b(a[e],e,c),null!=d&&(h[h.length]=d);return m.apply([],h)},guid:1,proxy:function(a,c){var d,e,f;return"string"==typeof c&&(f=a[c],c=a,a=f),t.isFunction(a)?(d=o.call(arguments,2),e=function(){return a.apply(c||this,d.concat(o.call(arguments)))},e.guid=a.guid=a.guid||t.guid++,e):b},access:function(a,c,d,e,f,g,h){var i=0,j=a.length,k=null==d;if("object"===t.type(d)){f=!0;for(i in d)t.access(a,c,i,d[i],!0,g,h)}else if(e!==b&&(f=!0,t.isFunction(e)||(h=!0),k&&(h?(c.call(a,e),c=null):(k=c,c=function(a,b,c){return k.call(t(a),c)})),c))for(;j>i;i++)c(a[i],d,h?e:e.call(a[i],i,c(a[i],d)));return f?a:k?c.call(a):j?c(a[0],d):g},now:function(){return(new Date).getTime()}}),t.ready.promise=function(b){if(!c)if(c=t.Deferred(),"complete"===f.readyState)setTimeout(t.ready);else if(f.addEventListener)f.addEventListener("DOMContentLoaded",G,!1),a.addEventListener("load",G,!1);else{f.attachEvent("onreadystatechange",G),a.attachEvent("onload",G);var d=!1;try{d=null==a.frameElement&&f.documentElement}catch(e){}d&&d.doScroll&&function g(){if(!t.isReady){try{d.doScroll("left")}catch(a){return setTimeout(g,50)}H(),t.ready()}}()}return c.promise(b)},t.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()}),d=t(f);var J={};t.Callbacks=function(a){a="string"==typeof a?J[a]||K(a):t.extend({},a);var c,d,e,f,g,h,i=[],j=!a.once&&[],k=function(b){for(d=a.memory&&b,e=!0,g=h||0,h=0,f=i.length,c=!0;i&&f>g;g++)if(i[g].apply(b[0],b[1])===!1&&a.stopOnFalse){d=!1;break}c=!1,i&&(j?j.length&&k(j.shift()):d?i=[]:l.disable())},l={add:function(){if(i){var b=i.length;(function e(b){t.each(b,function(b,c){var d=t.type(c);"function"===d?a.unique&&l.has(c)||i.push(c):c&&c.length&&"string"!==d&&e(c)})})(arguments),c?f=i.length:d&&(h=b,k(d))}return this},remove:function(){return i&&t.each(arguments,function(a,b){var d;while((d=t.inArray(b,i,d))>-1)i.splice(d,1),c&&(f>=d&&f--,g>=d&&g--)}),this},has:function(a){return a?t.inArray(a,i)>-1:!!i&&!!i.length},empty:function(){return i=[],this},disable:function(){return i=j=d=b,this},disabled:function(){return!i},lock:function(){return j=b,d||l.disable(),this},locked:function(){return!j},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],!i||e&&!j||(c?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!e}};return l},t.extend({Deferred:function(a){var b=[["resolve","done",t.Callbacks("once memory"),"resolved"],["reject","fail",t.Callbacks("once memory"),"rejected"],["notify","progress",t.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return t.Deferred(function(c){t.each(b,function(b,f){var g=f[0],h=t.isFunction(a[b])&&a[b];e[f[1]](function(){var a=h&&h.apply(this,arguments);a&&t.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[g+"With"](this===d?c.promise():this,h?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?t.extend(a,d):d}},e={};return d.pipe=d.then,t.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=o.call(arguments),d=c.length,e=1!==d||a&&t.isFunction(a.promise)?d:0,f=1===e?a:t.Deferred(),g=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?o.call(arguments):d,c===h?f.notifyWith(b,c):--e||f.resolveWith(b,c)}},h,i,j;if(d>1)for(h=Array(d),i=Array(d),j=Array(d);d>b;b++)c[b]&&t.isFunction(c[b].promise)?c[b].promise().done(g(b,j,c)).fail(f.reject).progress(g(b,i,h)):--e;return e||f.resolveWith(j,c),f.promise()}}),t.support=function(){var b,c,d,g,h,i,j,k,l,m,n=f.createElement("div");if(n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0],!c||!d||!c.length)return{};h=f.createElement("select"),j=h.appendChild(f.createElement("option")),g=n.getElementsByTagName("input")[0],d.style.cssText="top:1px;float:left;opacity:.5",b={getSetAttribute:"t"!==n.className,leadingWhitespace:3===n.firstChild.nodeType,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:!!g.value,optSelected:j.selected,enctype:!!f.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==f.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===f.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},g.checked=!0,b.noCloneChecked=g.cloneNode(!0).checked,h.disabled=!0,b.optDisabled=!j.disabled;try{delete n.test}catch(o){b.deleteExpando=!1}g=f.createElement("input"),g.setAttribute("value",""),b.input=""===g.getAttribute("value"),g.value="t",g.setAttribute("type","radio"),b.radioValue="t"===g.value,g.setAttribute("checked","t"),g.setAttribute("name","t"),i=f.createDocumentFragment(),i.appendChild(g),b.appendChecked=g.checked,b.checkClone=i.cloneNode(!0).cloneNode(!0).lastChild.checked,n.attachEvent&&(n.attachEvent("onclick",function(){b.noCloneEvent=!1}),n.cloneNode(!0).click());for(m in{submit:!0,change:!0,focusin:!0})n.setAttribute(k="on"+m,"t"),b[m+"Bubbles"]=k in a||n.attributes[k].expando===!1;return n.style.backgroundClip="content-box",n.cloneNode(!0).style.backgroundClip="",b.clearCloneStyle="content-box"===n.style.backgroundClip,t(function(){var c,d,g,h="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",i=f.getElementsByTagName("body")[0];i&&(c=f.createElement("div"),c.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",i.appendChild(c).appendChild(n),n.innerHTML="<table><tr><td></td><td>t</td></tr></table>",g=n.getElementsByTagName("td"),g[0].style.cssText="padding:0;margin:0;border:0;display:none",l=0===g[0].offsetHeight,g[0].style.display="",g[1].style.display="none",b.reliableHiddenOffsets=l&&0===g[0].offsetHeight,n.innerHTML="",n.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=4===n.offsetWidth,b.doesNotIncludeMarginInBodyOffset=1!==i.offsetTop,a.getComputedStyle&&(b.pixelPosition="1%"!==(a.getComputedStyle(n,null)||{}).top,b.boxSizingReliable="4px"===(a.getComputedStyle(n,null)||{width:"4px"}).width,d=n.appendChild(f.createElement("div")),d.style.cssText=n.style.cssText=h,d.style.marginRight=d.style.width="0",n.style.width="1px",b.reliableMarginRight=!parseFloat((a.getComputedStyle(d,null)||{}).marginRight)),typeof n.style.zoom!==e&&(n.innerHTML="",n.style.cssText=h+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=3===n.offsetWidth,n.style.display="block",n.innerHTML="<div></div>",n.firstChild.style.width="5px",b.shrinkWrapBlocks=3!==n.offsetWidth,b.inlineBlockNeedsLayout&&(i.style.zoom=1)),i.removeChild(c),c=n=g=d=null)}),c=h=i=j=d=g=null,b}();var L=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,M=/([A-Z])/g;t.extend({cache:{},expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?t.cache[a[t.expando]]:a[t.expando],!!a&&!Q(a)},data:function(a,b,c){return N(a,b,c)},removeData:function(a,b){return O(a,b)},_data:function(a,b,c){return N(a,b,c,!0)},_removeData:function(a,b){return O(a,b,!0)},acceptData:function(a){if(a.nodeType&&1!==a.nodeType&&9!==a.nodeType)return!1;var b=a.nodeName&&t.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),t.fn.extend({data:function(a,c){var d,e,f=this[0],g=0,h=null;if(a===b){if(this.length&&(h=t.data(f),1===f.nodeType&&!t._data(f,"parsedAttrs"))){for(d=f.attributes;d.length>g;g++)e=d[g].name,e.indexOf("data-")||(e=t.camelCase(e.slice(5)),P(f,e,h[e]));t._data(f,"parsedAttrs",!0)}return h}return"object"==typeof a?this.each(function(){t.data(this,a)}):t.access(this,function(c){return c===b?f?P(f,a,t.data(f,a)):null:(this.each(function(){t.data(this,a,c)}),b)},null,c,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){t.removeData(this,a)})}}),t.extend({queue:function(a,c,d){var e;return a?(c=(c||"fx")+"queue",e=t._data(a,c),d&&(!e||t.isArray(d)?e=t._data(a,c,t.makeArray(d)):e.push(d)),e||[]):b},dequeue:function(a,b){b=b||"fx";var c=t.queue(a,b),d=c.length,e=c.shift(),f=t._queueHooks(a,b),g=function(){t.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),f.cur=e,e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return t._data(a,c)||t._data(a,c,{empty:t.Callbacks("once memory").add(function(){t._removeData(a,b+"queue"),t._removeData(a,c)})})}}),t.fn.extend({queue:function(a,c){var d=2;return"string"!=typeof a&&(c=a,a="fx",d--),d>arguments.length?t.queue(this[0],a):c===b?this:this.each(function(){var b=t.queue(this,a,c);t._queueHooks(this,a),"fx"===a&&"inprogress"!==b[0]&&t.dequeue(this,a)})},dequeue:function(a){return this.each(function(){t.dequeue(this,a)})},delay:function(a,b){return a=t.fx?t.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){var d,e=1,f=t.Deferred(),g=this,h=this.length,i=function(){--e||f.resolveWith(g,[g])};"string"!=typeof a&&(c=a,a=b),a=a||"fx";while(h--)d=t._data(g[h],a+"queueHooks"),d&&d.empty&&(e++,d.empty.add(i));return i(),f.promise(c)}});var R,S,T=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,W=/^(?:a|area)$/i,X=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,Y=/^(?:checked|selected)$/i,Z=t.support.getSetAttribute,$=t.support.input;t.fn.extend({attr:function(a,b){return t.access(this,t.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){t.removeAttr(this,a)})},prop:function(a,b){return t.access(this,t.prop,a,b,arguments.length>1)},removeProp:function(a){return a=t.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g=0,h=this.length,i="string"==typeof a&&a;if(t.isFunction(a))return this.each(function(b){t(this).addClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(v)||[];h>g;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(T," "):" ")){f=0;while(e=b[f++])0>d.indexOf(" "+e+" ")&&(d+=e+" ");c.className=t.trim(d)}return this},removeClass:function(a){var b,c,d,e,f,g=0,h=this.length,i=0===arguments.length||"string"==typeof a&&a;if(t.isFunction(a))return this.each(function(b){t(this).removeClass(a.call(this,b,this.className))});if(i)for(b=(a||"").match(v)||[];h>g;g++)if(c=this[g],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(T," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");c.className=a?t.trim(d):""}return this},toggleClass:function(a,b){var c=typeof a,d="boolean"==typeof b;return t.isFunction(a)?this.each(function(c){t(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===c){var f,g=0,h=t(this),i=b,j=a.match(v)||[];while(f=j[g++])i=d?i:!h.hasClass(f),h[i?"addClass":"removeClass"](f)}else(c===e||"boolean"===c)&&(this.className&&t._data(this,"__className__",this.className),this.className=this.className||a===!1?"":t._data(this,"__className__")||"")})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(T," ").indexOf(b)>=0)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(arguments.length)return e=t.isFunction(a),this.each(function(c){var f,g=t(this);1===this.nodeType&&(f=e?a.call(this,c,g.val()):a,null==f?f="":"number"==typeof f?f+="":t.isArray(f)&&(f=t.map(f,function(a){return null==a?"":a+""})),d=t.valHooks[this.type]||t.valHooks[this.nodeName.toLowerCase()],d&&"set"in d&&d.set(this,f,"value")!==b||(this.value=f))});if(f)return d=t.valHooks[f.type]||t.valHooks[f.nodeName.toLowerCase()],d&&"get"in d&&(c=d.get(f,"value"))!==b?c:(c=f.value,"string"==typeof c?c.replace(U,""):null==c?"":c)}}),t.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;for(;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(t.support.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&t.nodeName(c.parentNode,"optgroup"))){if(b=t(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c=t.makeArray(b);return t(a).find("option").each(function(){this.selected=t.inArray(t(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attr:function(a,c,d){var f,g,h,i=a.nodeType;if(a&&3!==i&&8!==i&&2!==i)return typeof a.getAttribute===e?t.prop(a,c,d):(g=1!==i||!t.isXMLDoc(a),g&&(c=c.toLowerCase(),f=t.attrHooks[c]||(X.test(c)?S:R)),d===b?f&&g&&"get"in f&&null!==(h=f.get(a,c))?h:(typeof a.getAttribute!==e&&(h=a.getAttribute(c)),null==h?b:h):null!==d?f&&g&&"set"in f&&(h=f.set(a,d,c))!==b?h:(a.setAttribute(c,d+""),d):(t.removeAttr(a,c),b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(v);if(f&&1===a.nodeType)while(c=f[e++])d=t.propFix[c]||c,X.test(c)?!Z&&Y.test(c)?a[t.camelCase("default-"+c)]=a[d]=!1:a[d]=!1:t.attr(a,c,""),a.removeAttribute(Z?c:d)},attrHooks:{type:{set:function(a,b){if(!t.support.radioValue&&"radio"===b&&t.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,f,g,h=a.nodeType;if(a&&3!==h&&8!==h&&2!==h)return g=1!==h||!t.isXMLDoc(a),g&&(c=t.propFix[c]||c,f=t.propHooks[c]),d!==b?f&&"set"in f&&(e=f.set(a,d,c))!==b?e:a[c]=d:f&&"get"in f&&null!==(e=f.get(a,c))?e:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):V.test(a.nodeName)||W.test(a.nodeName)&&a.href?0:b}}}}),S={get:function(a,c){var d=t.prop(a,c),e="boolean"==typeof d&&a.getAttribute(c),f="boolean"==typeof d?$&&Z?null!=e:Y.test(c)?a[t.camelCase("default-"+c)]:!!e:a.getAttributeNode(c);return f&&f.value!==!1?c.toLowerCase():b},set:function(a,b,c){return b===!1?t.removeAttr(a,c):$&&Z||!Y.test(c)?a.setAttribute(!Z&&t.propFix[c]||c,c):a[t.camelCase("default-"+c)]=a[c]=!0,c}},$&&Z||(t.attrHooks.value={get:function(a,c){var d=a.getAttributeNode(c);return t.nodeName(a,"input")?a.defaultValue:d&&d.specified?d.value:b},set:function(a,c,d){return t.nodeName(a,"input")?(a.defaultValue=c,b):R&&R.set(a,c,d)}}),Z||(R=t.valHooks.button={get:function(a,c){var d=a.getAttributeNode(c);return d&&("id"===c||"name"===c||"coords"===c?""!==d.value:d.specified)?d.value:b},set:function(a,c,d){var e=a.getAttributeNode(d);return e||a.setAttributeNode(e=a.ownerDocument.createAttribute(d)),e.value=c+="","value"===d||c===a.getAttribute(d)?c:b}},t.attrHooks.contenteditable={get:R.get,set:function(a,b,c){R.set(a,""===b?!1:b,c)}},t.each(["width","height"],function(a,c){t.attrHooks[c]=t.extend(t.attrHooks[c],{set:function(a,d){return""===d?(a.setAttribute(c,"auto"),d):b}})})),t.support.hrefNormalized||
4
- (t.each(["href","src","width","height"],function(a,c){t.attrHooks[c]=t.extend(t.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return null==d?b:d}})}),t.each(["href","src"],function(a,b){t.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}})),t.support.style||(t.attrHooks.style={get:function(a){return a.style.cssText||b},set:function(a,b){return a.style.cssText=b+""}}),t.support.optSelected||(t.propHooks.selected=t.extend(t.propHooks.selected,{get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}})),t.support.enctype||(t.propFix.enctype="encoding"),t.support.checkOn||t.each(["radio","checkbox"],function(){t.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}}),t.each(["radio","checkbox"],function(){t.valHooks[this]=t.extend(t.valHooks[this],{set:function(a,c){return t.isArray(c)?a.checked=t.inArray(t(a).val(),c)>=0:b}})});var _=/^(?:input|select|textarea)$/i,ab=/^key/,bb=/^(?:mouse|contextmenu)|click/,cb=/^(?:focusinfocus|focusoutblur)$/,db=/^([^.]*)(?:\.(.+)|)$/;t.event={global:{},add:function(a,c,d,f,g){var h,i,j,k,l,m,n,o,p,q,r,s=t._data(a);if(s){d.handler&&(k=d,d=k.handler,g=k.selector),d.guid||(d.guid=t.guid++),(i=s.events)||(i=s.events={}),(m=s.handle)||(m=s.handle=function(a){return typeof t===e||a&&t.event.triggered===a.type?b:t.event.dispatch.apply(m.elem,arguments)},m.elem=a),c=(c||"").match(v)||[""],j=c.length;while(j--)h=db.exec(c[j])||[],p=r=h[1],q=(h[2]||"").split(".").sort(),l=t.event.special[p]||{},p=(g?l.delegateType:l.bindType)||p,l=t.event.special[p]||{},n=t.extend({type:p,origType:r,data:f,handler:d,guid:d.guid,selector:g,needsContext:g&&t.expr.match.needsContext.test(g),namespace:q.join(".")},k),(o=i[p])||(o=i[p]=[],o.delegateCount=0,l.setup&&l.setup.call(a,f,q,m)!==!1||(a.addEventListener?a.addEventListener(p,m,!1):a.attachEvent&&a.attachEvent("on"+p,m))),l.add&&(l.add.call(a,n),n.handler.guid||(n.handler.guid=d.guid)),g?o.splice(o.delegateCount++,0,n):o.push(n),t.event.global[p]=!0;a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=t.hasData(a)&&t._data(a);if(q&&(k=q.events)){b=(b||"").match(v)||[""],j=b.length;while(j--)if(h=db.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=t.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=k[n]||[],h=h[2]&&RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--)g=m[f],!e&&p!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g));i&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||t.removeEvent(a,n,q.handle),delete k[n])}else for(n in k)t.event.remove(a,n+b[j],c,d,!0);t.isEmptyObject(k)&&(delete q.handle,t._removeData(a,"events"))}},trigger:function(c,d,e,g){var h,i,j,k,l,m,n,o=[e||f],p=r.call(c,"type")?c.type:c,q=r.call(c,"namespace")?c.namespace.split("."):[];if(j=m=e=e||f,3!==e.nodeType&&8!==e.nodeType&&!cb.test(p+t.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),i=0>p.indexOf(":")&&"on"+p,c=c[t.expando]?c:new t.Event(p,"object"==typeof c&&c),c.isTrigger=!0,c.namespace=q.join("."),c.namespace_re=c.namespace?RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,c.result=b,c.target||(c.target=e),d=null==d?[c]:t.makeArray(d,[c]),l=t.event.special[p]||{},g||!l.trigger||l.trigger.apply(e,d)!==!1)){if(!g&&!l.noBubble&&!t.isWindow(e)){for(k=l.delegateType||p,cb.test(k+p)||(j=j.parentNode);j;j=j.parentNode)o.push(j),m=j;m===(e.ownerDocument||f)&&o.push(m.defaultView||m.parentWindow||a)}n=0;while((j=o[n++])&&!c.isPropagationStopped())c.type=n>1?k:l.bindType||p,h=(t._data(j,"events")||{})[c.type]&&t._data(j,"handle"),h&&h.apply(j,d),h=i&&j[i],h&&t.acceptData(j)&&h.apply&&h.apply(j,d)===!1&&c.preventDefault();if(c.type=p,!(g||c.isDefaultPrevented()||l._default&&l._default.apply(e.ownerDocument,d)!==!1||"click"===p&&t.nodeName(e,"a")||!t.acceptData(e)||!i||!e[p]||t.isWindow(e))){m=e[i],m&&(e[i]=null),t.event.triggered=p;try{e[p]()}catch(s){}t.event.triggered=b,m&&(e[i]=m)}return c.result}},dispatch:function(a){a=t.event.fix(a);var c,d,e,f,g,h=[],i=o.call(arguments),j=(t._data(this,"events")||{})[a.type]||[],k=t.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=t.event.handlers.call(this,a,j),c=0;while((f=h[c++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,d=((t.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),d!==b&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,c){var d,e,f,g,h=[],i=c.delegateCount,j=a.target;if(i&&j.nodeType&&(!a.button||"click"!==a.type))for(;j!=this;j=j.parentNode||this)if(1===j.nodeType&&(j.disabled!==!0||"click"!==a.type)){for(f=[],g=0;i>g;g++)e=c[g],d=e.selector+" ",f[d]===b&&(f[d]=e.needsContext?t(d,this).index(j)>=0:t.find(d,this,null,[j]).length),f[d]&&f.push(e);f.length&&h.push({elem:j,handlers:f})}return c.length>i&&h.push({elem:this,handlers:c.slice(i)}),h},fix:function(a){if(a[t.expando])return a;var b,c,d,e=a.type,g=a,h=this.fixHooks[e];h||(this.fixHooks[e]=h=bb.test(e)?this.mouseHooks:ab.test(e)?this.keyHooks:{}),d=h.props?this.props.concat(h.props):this.props,a=new t.Event(g),b=d.length;while(b--)c=d[b],a[c]=g[c];return a.target||(a.target=g.srcElement||f),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,c){var d,e,g,h=c.button,i=c.fromElement;return null==a.pageX&&null!=c.clientX&&(e=a.target.ownerDocument||f,g=e.documentElement,d=e.body,a.pageX=c.clientX+(g&&g.scrollLeft||d&&d.scrollLeft||0)-(g&&g.clientLeft||d&&d.clientLeft||0),a.pageY=c.clientY+(g&&g.scrollTop||d&&d.scrollTop||0)-(g&&g.clientTop||d&&d.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?c.toElement:i),a.which||h===b||(a.which=1&h?1:2&h?3:4&h?2:0),a}},special:{load:{noBubble:!0},click:{trigger:function(){return t.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):b}},focus:{trigger:function(){if(this!==f.activeElement&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===f.activeElement&&this.blur?(this.blur(),!1):b},delegateType:"focusout"},beforeunload:{postDispatch:function(a){a.result!==b&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=t.extend(new t.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?t.event.trigger(e,null,b):t.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},t.removeEvent=f.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===e&&(a[d]=null),a.detachEvent(d,c))},t.Event=function(a,c){return this instanceof t.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?eb:fb):this.type=a,c&&t.extend(this,c),this.timeStamp=a&&a.timeStamp||t.now(),this[t.expando]=!0,b):new t.Event(a,c)},t.Event.prototype={isDefaultPrevented:fb,isPropagationStopped:fb,isImmediatePropagationStopped:fb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=eb,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=eb,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=eb,this.stopPropagation()}},t.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){t.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!t.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),t.support.submitBubbles||(t.event.special.submit={setup:function(){return t.nodeName(this,"form")?!1:(t.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=t.nodeName(c,"input")||t.nodeName(c,"button")?c.form:b;d&&!t._data(d,"submitBubbles")&&(t.event.add(d,"submit._submit",function(a){a._submit_bubble=!0}),t._data(d,"submitBubbles",!0))}),b)},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&t.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return t.nodeName(this,"form")?!1:(t.event.remove(this,"._submit"),b)}}),t.support.changeBubbles||(t.event.special.change={setup:function(){return _.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(t.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),t.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),t.event.simulate("change",this,a,!0)})),!1):(t.event.add(this,"beforeactivate._change",function(a){var b=a.target;_.test(b.nodeName)&&!t._data(b,"changeBubbles")&&(t.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||t.event.simulate("change",this.parentNode,a,!0)}),t._data(b,"changeBubbles",!0))}),b)},handle:function(a){var c=a.target;return this!==c||a.isSimulated||a.isTrigger||"radio"!==c.type&&"checkbox"!==c.type?a.handleObj.handler.apply(this,arguments):b},teardown:function(){return t.event.remove(this,"._change"),!_.test(this.nodeName)}}),t.support.focusinBubbles||t.each({focus:"focusin",blur:"focusout"},function(a,b){var c=0,d=function(a){t.event.simulate(b,a.target,t.event.fix(a),!0)};t.event.special[b]={setup:function(){0===c++&&f.addEventListener(a,d,!0)},teardown:function(){0===--c&&f.removeEventListener(a,d,!0)}}}),t.fn.extend({on:function(a,c,d,e,f){var g,h;if("object"==typeof a){"string"!=typeof c&&(d=d||c,c=b);for(g in a)this.on(g,c,d,a[g],f);return this}if(null==d&&null==e?(e=c,d=c=b):null==e&&("string"==typeof c?(e=d,d=b):(e=d,d=c,c=b)),e===!1)e=fb;else if(!e)return this;return 1===f&&(h=e,e=function(a){return t().off(a),h.apply(this,arguments)},e.guid=h.guid||(h.guid=t.guid++)),this.each(function(){t.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,c,d){var e,f;if(a&&a.preventDefault&&a.handleObj)return e=a.handleObj,t(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"==typeof a){for(f in a)this.off(f,c,a[f]);return this}return(c===!1||"function"==typeof c)&&(d=c,c=b),d===!1&&(d=fb),this.each(function(){t.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){t.event.trigger(a,b,this)})},triggerHandler:function(a,c){var d=this[0];return d?t.event.trigger(a,c,d,!0):b}}),function(a,b){function db(a){return W.test(a+"")}function eb(){var a,b=[];return a=function(c,d){return b.push(c+=" ")>e.cacheLength&&delete a[b.shift()],a[c]=d}}function fb(a){return a[u]=!0,a}function gb(a){var b=l.createElement("div");try{return a(b)}catch(c){return!1}finally{b=null}}function hb(a,b,c,d){var e,f,g,h,i,j,m,p,q,s;if((b?b.ownerDocument||b:v)!==l&&k(b),b=b||l,c=c||[],!a||"string"!=typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(!n&&!d){if(e=X.exec(a))if(g=e[1]){if(9===h){if(f=b.getElementById(g),!f||!f.parentNode)return c;if(f.id===g)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&r(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return G.apply(c,H.call(b.getElementsByTagName(a),0)),c;if((g=e[3])&&w.getByClassName&&b.getElementsByClassName)return G.apply(c,H.call(b.getElementsByClassName(g),0)),c}if(w.qsa&&!o.test(a)){if(m=!0,p=u,q=b,s=9===h&&a,1===h&&"object"!==b.nodeName.toLowerCase()){j=mb(a),(m=b.getAttribute("id"))?p=m.replace($,"\\$&"):b.setAttribute("id",p),p="[id='"+p+"'] ",i=j.length;while(i--)j[i]=p+nb(j[i]);q=V.test(a)&&b.parentNode||b,s=j.join(",")}if(s)try{return G.apply(c,H.call(q.querySelectorAll(s),0)),c}catch(t){}finally{m||b.removeAttribute("id")}}}return vb(a.replace(P,"$1"),b,c,d)}function ib(a,b){var c=b&&a,d=c&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function jb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function kb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function lb(a){return fb(function(b){return b=+b,fb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function mb(a,b){var c,d,f,g,h,i,j,k=A[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=e.preFilter;while(h){(!c||(d=Q.exec(h)))&&(d&&(h=h.slice(d[0].length)||h),i.push(f=[])),c=!1,(d=R.exec(h))&&(c=d.shift(),f.push({value:c,type:d[0].replace(P," ")}),h=h.slice(c.length));for(g in e.filter)!(d=U[g].exec(h))||j[g]&&!(d=j[g](d))||(c=d.shift(),f.push({value:c,type:g,matches:d}),h=h.slice(c.length));if(!c)break}return b?h.length:h?hb.error(a):A(a,i).slice(0)}function nb(a){var b=0,c=a.length,d="";for(;c>b;b++)d+=a[b].value;return d}function ob(a,b,c){var e=b.dir,f=c&&"parentNode"===e,g=y++;return b.first?function(b,c,d){while(b=b[e])if(1===b.nodeType||f)return a(b,c,d)}:function(b,c,h){var i,j,k,l=x+" "+g;if(h){while(b=b[e])if((1===b.nodeType||f)&&a(b,c,h))return!0}else while(b=b[e])if(1===b.nodeType||f)if(k=b[u]||(b[u]={}),(j=k[e])&&j[0]===l){if((i=j[1])===!0||i===d)return i===!0}else if(j=k[e]=[l],j[1]=a(b,c,h)||d,j[1]===!0)return!0}}function pb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function qb(a,b,c,d,e){var f,g=[],h=0,i=a.length,j=null!=b;for(;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function rb(a,b,c,d,e,f){return d&&!d[u]&&(d=rb(d)),e&&!e[u]&&(e=rb(e,f)),fb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ub(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:qb(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=qb(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?I.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=qb(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function sb(a){var b,c,d,f=a.length,g=e.relative[a[0].type],h=g||e.relative[" "],i=g?1:0,k=ob(function(a){return a===b},h,!0),l=ob(function(a){return I.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];for(;f>i;i++)if(c=e.relative[a[i].type])m=[ob(pb(m),c)];else{if(c=e.filter[a[i].type].apply(null,a[i].matches),c[u]){for(d=++i;f>d;d++)if(e.relative[a[d].type])break;return rb(i>1&&pb(m),i>1&&nb(a.slice(0,i-1)).replace(P,"$1"),c,d>i&&sb(a.slice(i,d)),f>d&&sb(a=a.slice(d)),f>d&&nb(a))}m.push(c)}return pb(m)}function tb(a,b){var c=0,f=b.length>0,g=a.length>0,h=function(h,i,k,m,n){var o,p,q,r=[],s=0,t="0",u=h&&[],v=null!=n,w=j,y=h||g&&e.find.TAG("*",n&&i.parentNode||i),z=x+=null==w?1:Math.random()||.1;for(v&&(j=i!==l&&i,d=c);null!=(o=y[t]);t++){if(g&&o){p=0;while(q=a[p++])if(q(o,i,k)){m.push(o);break}v&&(x=z,d=++c)}f&&((o=!q&&o)&&s--,h&&u.push(o))}if(s+=t,f&&t!==s){p=0;while(q=b[p++])q(u,r,i,k);if(h){if(s>0)while(t--)u[t]||r[t]||(r[t]=F.call(m));r=qb(r)}G.apply(m,r),v&&!h&&r.length>0&&s+b.length>1&&hb.uniqueSort(m)}return v&&(x=z,j=w),u};return f?fb(h):h}function ub(a,b,c){var d=0,e=b.length;for(;e>d;d++)hb(a,b[d],c);return c}function vb(a,b,c,d){var f,g,i,j,k,l=mb(a);if(!d&&1===l.length){if(g=l[0]=l[0].slice(0),g.length>2&&"ID"===(i=g[0]).type&&9===b.nodeType&&!n&&e.relative[g[1].type]){if(b=e.find.ID(i.matches[0].replace(ab,bb),b)[0],!b)return c;a=a.slice(g.shift().value.length)}f=U.needsContext.test(a)?0:g.length;while(f--){if(i=g[f],e.relative[j=i.type])break;if((k=e.find[j])&&(d=k(i.matches[0].replace(ab,bb),V.test(g[0].type)&&b.parentNode||b))){if(g.splice(f,1),a=d.length&&nb(g),!a)return G.apply(c,H.call(d,0)),c;break}}}return h(a,l)(d,b,n,c,V.test(a)),c}function wb(){}var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u="sizzle"+ -(new Date),v=a.document,w={},x=0,y=0,z=eb(),A=eb(),B=eb(),C=typeof b,D=1<<31,E=[],F=E.pop,G=E.push,H=E.slice,I=E.indexOf||function(a){var b=0,c=this.length;for(;c>b;b++)if(this[b]===a)return b;return-1},J="[\\x20\\t\\r\\n\\f]",K="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",L=K.replace("w","w#"),M="([*^$|!~]?=)",N="\\["+J+"*("+K+")"+J+"*(?:"+M+J+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+L+")|)|)"+J+"*\\]",O=":("+K+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+N.replace(3,8)+")*)|.*)\\)|)",P=RegExp("^"+J+"+|((?:^|[^\\\\])(?:\\\\.)*)"+J+"+$","g"),Q=RegExp("^"+J+"*,"+J+"*"),R=RegExp("^"+J+"*([\\x20\\t\\r\\n\\f>+~])"+J+"*"),S=RegExp(O),T=RegExp("^"+L+"$"),U={ID:RegExp("^#("+K+")"),CLASS:RegExp("^\\.("+K+")"),NAME:RegExp("^\\[name=['\"]?("+K+")['\"]?\\]"),TAG:RegExp("^("+K.replace("w","w*")+")"),ATTR:RegExp("^"+N),PSEUDO:RegExp("^"+O),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+J+"*(even|odd|(([+-]|)(\\d*)n|)"+J+"*(?:([+-]|)"+J+"*(\\d+)|))"+J+"*\\)|)","i"),needsContext:RegExp("^"+J+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+J+"*((?:-\\d)?\\d*)"+J+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,W=/^[^{]+\{\s*\[native code/,X=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/'|\\/g,_=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,ab=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,bb=function(a,b){var c="0x"+b-65536;return c!==c?b:0>c?String.fromCharCode(c+65536):String.fromCharCode(55296|c>>10,56320|1023&c)};try{H.call(v.documentElement.childNodes,0)[0].nodeType}catch(cb){H=function(a){var b,c=[];while(b=this[a++])c.push(b);return c}}g=hb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},k=hb.setDocument=function(a){var c=a?a.ownerDocument||a:v;return c!==l&&9===c.nodeType&&c.documentElement?(l=c,m=c.documentElement,n=g(c),w.tagNameNoComments=gb(function(a){return a.appendChild(c.createComment("")),!a.getElementsByTagName("*").length}),w.attributes=gb(function(a){a.innerHTML="<select></select>";var b=typeof a.lastChild.getAttribute("multiple");return"boolean"!==b&&"string"!==b}),w.getByClassName=gb(function(a){return a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",a.getElementsByClassName&&a.getElementsByClassName("e").length?(a.lastChild.className="e",2===a.getElementsByClassName("e").length):!1}),w.getByName=gb(function(a){a.id=u+0,a.innerHTML="<a name='"+u+"'></a><div name='"+u+"'></div>",m.insertBefore(a,m.firstChild);var b=c.getElementsByName&&c.getElementsByName(u).length===2+c.getElementsByName(u+0).length;return w.getIdNotName=!c.getElementById(u),m.removeChild(a),b}),e.attrHandle=gb(function(a){return a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!==C&&"#"===a.firstChild.getAttribute("href")})?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}},w.getIdNotName?(e.find.ID=function(a,b){if(typeof b.getElementById!==C&&!n){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},e.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){return a.getAttribute("id")===b}}):(e.find.ID=function(a,c){if(typeof c.getElementById!==C&&!n){var d=c.getElementById(a);return d?d.id===a||typeof d.getAttributeNode!==C&&d.getAttributeNode("id").value===a?[d]:b:[]}},e.filter.ID=function(a){var b=a.replace(ab,bb);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),e.find.TAG=w.tagNameNoComments?function(a,c){return typeof c.getElementsByTagName!==C?c.getElementsByTagName(a):b}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},e.find.NAME=w.getByName&&function(a,c){return typeof c.getElementsByName!==C?c.getElementsByName(name):b},e.find.CLASS=w.getByClassName&&function(a,c){return typeof c.getElementsByClassName===C||n?b:c.getElementsByClassName(a)},p=[],o=[":focus"],(w.qsa=db(c.querySelectorAll))&&(gb(function(a){a.innerHTML="<select><option selected=''></option></select>",a.querySelectorAll("[selected]").length||o.push("\\["+J+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||o.push(":checked")}),gb(function(a){a.innerHTML="<input type='hidden' i=''/>",a.querySelectorAll("[i^='']").length&&o.push("[*^$]="+J+"*(?:\"\"|'')"),a.querySelectorAll(":enabled").length||o.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),o.push(",.*:")})),(w.matchesSelector=db(q=m.matchesSelector||m.mozMatchesSelector||m.webkitMatchesSelector||m.oMatchesSelector||m.msMatchesSelector))&&gb(function(a){w.disconnectedMatch=q.call(a,"div"),q.call(a,"[s!='']:x"),p.push("!=",O)}),o=RegExp(o.join("|")),p=RegExp(p.join("|")),r=db(m.contains)||m.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!!d&&1===d.nodeType&&!!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},s=m.compareDocumentPosition?function(a,b){var d;return a===b?(i=!0,0):(d=b.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(b))?1&d||a.parentNode&&11===a.parentNode.nodeType?a===c||r(v,a)?-1:b===c||r(v,b)?1:0:4&d?-1:1:a.compareDocumentPosition?-1:1}:function(a,b){var d,e=0,f=a.parentNode,g=b.parentNode,h=[a],j=[b];if(a===b)return i=!0,0;if(!f||!g)return a===c?-1:b===c?1:f?-1:g?1:0;if(f===g)return ib(a,b);d=a;while(d=d.parentNode)h.unshift(d);d=b;while(d=d.parentNode)j.unshift(d);while(h[e]===j[e])e++;return e?ib(h[e],j[e]):h[e]===v?-1:j[e]===v?1:0},i=!1,[0,0].sort(s),w.detectDuplicates=i,l):l},hb.matches=function(a,b){return hb(a,null,null,b)},hb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==l&&k(a),b=b.replace(_,"='$1']"),!(!w.matchesSelector||n||p&&p.test(b)||o.test(b)))try{var c=q.call(a,b);if(c||w.disconnectedMatch||a.document&&11!==a.document.nodeType)return c}catch(d){}return hb(b,l,null,[a]).length>0},hb.contains=function(a,b){return(a.ownerDocument||a)!==l&&k(a),r(a,b)},hb.attr=function(a,b){var c;return(a.ownerDocument||a)!==l&&k(a),n||(b=b.toLowerCase()),(c=e.attrHandle[b])?c(a):n||w.attributes?a.getAttribute(b):((c=a.getAttributeNode(b))||a.getAttribute(b))&&a[b]===!0?b:c&&c.specified?c.value:null},hb.error=function(a){throw Error("Syntax error, unrecognized expression: "+a)},hb.uniqueSort=function(a){var b,c=[],d=1,e=0;if(i=!w.detectDuplicates,a.sort(s),i){for(;b=a[d];d++)b===a[d-1]&&(e=c.push(d));while(e--)a.splice(c[e],1)}return a},f=hb.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=f(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=f(b);return c},e=hb.selectors={cacheLength:50,createPseudo:fb,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ab,bb),a[3]=(a[4]||a[5]||"").replace(ab,bb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||hb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&hb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[5]&&a[2];return U.CHILD.test(a[0])?null:(a[4]?a[2]=a[4]:c&&S.test(c)&&(b=mb(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){return"*"===a?function(){return!0}:(a=a.replace(ab,bb).toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=z[a+" "];return b||(b=RegExp("(^|"+J+")"+a+"("+J+"|$)"))&&z(a,function(a){return b.test(a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=hb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===x&&j[1],m=j[0]===x&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[x,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===x)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[x,m]),l===b))break;return m-=e,m===d||0===m%d&&m/d>=0}}},PSEUDO:function(a,b){var c,d=e.pseudos[a]||e.setFilters[a.toLowerCase()]||hb.error("unsupported pseudo: "+a);return d[u]?d(b):d.length>1?(c=[a,a,"",b],e.setFilters.hasOwnProperty(a.toLowerCase())?fb(function(a,c){var e,f=d(a,b),g=f.length;while(g--)e=I.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:fb(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?fb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:fb(function(a){return function(b){return hb(a,b).length>0}}),contains:fb(function(a){return function(b){return(b.textContent||b.innerText||f(b)).indexOf(a)>-1}}),lang:fb(function(a){return T.test(a||"")||hb.error("unsupported lang: "+a),a=a.replace(ab,bb).toLowerCase(),function(b){var c;do if(c=n?b.getAttribute("xml:lang")||b.getAttribute("lang"):b.lang)return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===m},focus:function(a){return a===l.activeElement&&(!l.hasFocus||l.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeName>"@"||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!e.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:lb(function(){return[0]}),last:lb(function(a,b){return[b-1]}),eq:lb(function(a,b,c){return[0>c?c+b:c]}),even:lb(function(a,b){var c=0;for(;b>c;c+=2)a.push(c);return a}),odd:lb(function(a,b){var c=1;for(;b>c;c+=2)a.push(c);return a}),lt:lb(function(a,b,c){var d=0>c?c+b:c;for(;--d>=0;)a.push(d);return a}),gt:lb(function(a,b,c){var d=0>c?c+b:c;for(;b>++d;)a.push(d);return a})}};for(c in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})e.pseudos[c]=jb(c);for(c in{submit:!0,reset:!0})e.pseudos[c]=kb(c);h=hb.compile=function(a,b){var c,d=[],e=[],f=B[a+" "];if(!f){b||(b=mb(a)),c=b.length;while(c--)f=sb(b[c]),f[u]?d.push(f):e.push(f);f=B(a,tb(e,d))}return f},e.pseudos.nth=e.pseudos.eq,e.filters=wb.prototype=e.pseudos,e.setFilters=new wb,k(),hb.attr=t.attr,t.find=hb,t.expr=hb.selectors,t.expr[":"]=t.expr.pseudos,t.unique=hb.uniqueSort,t.text=hb.getText,t.isXMLDoc=hb.isXML,t.contains=hb.contains}(a);var gb=/Until$/,hb=/^(?:parents|prev(?:Until|All))/,ib=/^.[^:#\[\.,]*$/,jb=t.expr.match.needsContext,kb={children:!0,contents:!0,next:!0,prev:!0};t.fn.extend({find:function(a){var b,c,d,e=this.length;if("string"!=typeof a)return d=this,this.pushStack(t(a).filter(function(){for(b=0;e>b;b++)if(t.contains(d[b],this))return!0}));for(c=[],b=0;e>b;b++)t.find(a,this[b],c);return c=this.pushStack(e>1?t.unique(c):c),c.selector=(this.selector?this.selector+" ":"")+a,c},has:function(a){var b,c=t(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(t.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(mb(this,a,!1))},filter:function(a){return this.pushStack(mb(this,a,!0))},is:function(a){return!!a&&("string"==typeof a?jb.test(a)?t(a,this.context).index(this[0])>=0:t.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c,d=0,e=this.length,f=[],g=jb.test(a)||"string"!=typeof a?t(a,b||this.context):0;for(;e>d;d++){c=this[d];while(c&&c.ownerDocument&&c!==b&&11!==c.nodeType){if(g?g.index(c)>-1:t.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}}return this.pushStack(f.length>1?t.unique(f):f)},index:function(a){return a?"string"==typeof a?t.inArray(this[0],t(a)):t.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){var c="string"==typeof a?t(a,b):t.makeArray(a&&a.nodeType?[a]:a),d=t.merge(this.get(),c);return this.pushStack(t.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),t.fn.andSelf=t.fn.addBack,t.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return t.dir(a,"parentNode")},parentsUntil:function(a,b,c){return t.dir(a,"parentNode",c)},next:function(a){return lb(a,"nextSibling")},prev:function(a){return lb(a,"previousSibling")},nextAll:function(a){return t.dir(a,"nextSibling")},prevAll:function(a){return t.dir(a,"previousSibling")},nextUntil:function(a,b,c){return t.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return t.dir(a,"previousSibling",c)},siblings:function(a){return t.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return t.sibling(a.firstChild)},contents:function(a){return t.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:t.merge([],a.childNodes)}},function(a,b){t.fn[a]=function(c,d){var e=t.map(this,b,c);return gb.test(a)||(d=c),d&&"string"==typeof d&&(e=t.filter(d,e)),e=this.length>1&&!kb[a]?t.unique(e):e,this.length>1&&hb.test(a)&&(e=e.reverse()),this.pushStack(e)}}),t.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),1===b.length?t.find.matchesSelector(b[0],a)?[b[0]]:[]:t.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&9!==f.nodeType&&(d===b||1!==f.nodeType||!t(f).is(d)))1===f.nodeType&&e.push(f),f=f[c];return e},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var ob="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",pb=/ jQuery\d+="(?:null|\d+)"/g,qb=RegExp("<(?:"+ob+")[\\s/>]","i"),rb=/^\s+/,sb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,tb=/<([\w:]+)/,ub=/<tbody/i,vb=/<|&#?\w+;/,wb=/<(?:script|style|link)/i,xb=/^(?:checkbox|radio)$/i,yb=/checked\s*(?:[^=]|=\s*.checked.)/i,zb=/^$|\/(?:java|ecma)script/i,Ab=/^true\/(.*)/,Bb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Cb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>"
5
- ,"</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:t.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Db=nb(f),Eb=Db.appendChild(f.createElement("div"));Cb.optgroup=Cb.option,Cb.tbody=Cb.tfoot=Cb.colgroup=Cb.caption=Cb.thead,Cb.th=Cb.td,t.fn.extend({text:function(a){return t.access(this,function(a){return a===b?t.text(this):this.empty().append((this[0]&&this[0].ownerDocument||f).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(t.isFunction(a))return this.each(function(b){t(this).wrapAll(a.call(this,b))});if(this[0]){var b=t(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return t.isFunction(a)?this.each(function(b){t(this).wrapInner(a.call(this,b))}):this.each(function(){var b=t(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=t.isFunction(a);return this.each(function(c){t(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){t.nodeName(this,"body")||t(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(a,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){var c,d=0;for(;null!=(c=this[d]);d++)(!a||t.filter(a,[c]).length>0)&&(b||1!==c.nodeType||t.cleanData(Lb(c)),c.parentNode&&(b&&t.contains(c.ownerDocument,c)&&Ib(Lb(c,"script")),c.parentNode.removeChild(c)));return this},empty:function(){var a,b=0;for(;null!=(a=this[b]);b++){1===a.nodeType&&t.cleanData(Lb(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&t.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return t.clone(this,a,b)})},html:function(a){return t.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(pb,""):b;if(!("string"!=typeof a||wb.test(a)||!t.support.htmlSerialize&&qb.test(a)||!t.support.leadingWhitespace&&rb.test(a)||Cb[(tb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(sb,"<$1></$2>");try{for(;e>d;d++)c=this[d]||{},1===c.nodeType&&(t.cleanData(Lb(c,!1)),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){var b=t.isFunction(a);return b||"string"==typeof a||(a=t(a).not(this).detach()),this.domManip([a],!0,function(a){var b=this.nextSibling,c=this.parentNode;c&&(t(this).remove(),c.insertBefore(a,b))})},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=m.apply([],a);var e,f,g,h,i,j,k=0,l=this.length,n=this,o=l-1,p=a[0],q=t.isFunction(p);if(q||!(1>=l||"string"!=typeof p||t.support.checkClone)&&yb.test(p))return this.each(function(e){var f=n.eq(e);q&&(a[0]=p.call(this,e,c?f.html():b)),f.domManip(a,c,d)});if(l&&(j=t.buildFragment(a,this[0].ownerDocument,!1,this),e=j.firstChild,1===j.childNodes.length&&(j=e),e)){for(c=c&&t.nodeName(e,"tr"),h=t.map(Lb(j,"script"),Gb),g=h.length;l>k;k++)f=j,k!==o&&(f=t.clone(f,!0,!0),g&&t.merge(h,Lb(f,"script"))),d.call(c&&t.nodeName(this[k],"table")?Fb(this[k],"tbody"):this[k],f,k);if(g)for(i=h[h.length-1].ownerDocument,t.map(h,Hb),k=0;g>k;k++)f=h[k],zb.test(f.type||"")&&!t._data(f,"globalEval")&&t.contains(i,f)&&(f.src?t.ajax({url:f.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):t.globalEval((f.text||f.textContent||f.innerHTML||"").replace(Bb,"")));j=e=null}return this}}),t.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){t.fn[a]=function(a){var c,d=0,e=[],f=t(a),g=f.length-1;for(;g>=d;d++)c=d===g?this:this.clone(!0),t(f[d])[b](c),n.apply(e,c.get());return this.pushStack(e)}}),t.extend({clone:function(a,b,c){var d,e,f,g,h,i=t.contains(a.ownerDocument,a);if(t.support.html5Clone||t.isXMLDoc(a)||!qb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Eb.innerHTML=a.outerHTML,Eb.removeChild(f=Eb.firstChild)),!(t.support.noCloneEvent&&t.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||t.isXMLDoc(a)))for(d=Lb(f),h=Lb(a),g=0;null!=(e=h[g]);++g)d[g]&&Kb(e,d[g]);if(b)if(c)for(h=h||Lb(a),d=d||Lb(f),g=0;null!=(e=h[g]);g++)Jb(e,d[g]);else Jb(a,f);return d=Lb(f,"script"),d.length>0&&Ib(d,!i&&Lb(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){var e,f,g,h,i,j,k,l=a.length,m=nb(b),n=[],o=0;for(;l>o;o++)if(f=a[o],f||0===f)if("object"===t.type(f))t.merge(n,f.nodeType?[f]:f);else if(vb.test(f)){h=h||m.appendChild(b.createElement("div")),i=(tb.exec(f)||["",""])[1].toLowerCase(),k=Cb[i]||Cb._default,h.innerHTML=k[1]+f.replace(sb,"<$1></$2>")+k[2],e=k[0];while(e--)h=h.lastChild;if(!t.support.leadingWhitespace&&rb.test(f)&&n.push(b.createTextNode(rb.exec(f)[0])),!t.support.tbody){f="table"!==i||ub.test(f)?"<table>"!==k[1]||ub.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)t.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}t.merge(n,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=m.lastChild}else n.push(b.createTextNode(f));h&&m.removeChild(h),t.support.appendChecked||t.grep(Lb(n,"input"),Mb),o=0;while(f=n[o++])if((!d||-1===t.inArray(f,d))&&(g=t.contains(f.ownerDocument,f),h=Lb(m.appendChild(f),"script"),g&&Ib(h),c)){e=0;while(f=h[e++])zb.test(f.type||"")&&c.push(f)}return h=null,m},cleanData:function(a,b){var c,d,f,g,h=0,i=t.expando,j=t.cache,l=t.support.deleteExpando,m=t.event.special;for(;null!=(c=a[h]);h++)if((b||t.acceptData(c))&&(f=c[i],g=f&&j[f])){if(g.events)for(d in g.events)m[d]?t.event.remove(c,d):t.removeEvent(c,d,g.handle);j[f]&&(delete j[f],l?delete c[i]:typeof c.removeAttribute!==e?c.removeAttribute(i):c[i]=null,k.push(f))}}});var Nb,Ob,Pb,Qb=/alpha\([^)]*\)/i,Rb=/opacity\s*=\s*([^)]*)/,Sb=/^(top|right|bottom|left)$/,Tb=/^(none|table(?!-c[ea]).+)/,Ub=/^margin/,Vb=RegExp("^("+u+")(.*)$","i"),Wb=RegExp("^("+u+")(?!px)[a-z%]+$","i"),Xb=RegExp("^([+-])=("+u+")","i"),Yb={BODY:"block"},Zb={position:"absolute",visibility:"hidden",display:"block"},$b={letterSpacing:0,fontWeight:400},_b=["Top","Right","Bottom","Left"],ac=["Webkit","O","Moz","ms"];t.fn.extend({css:function(a,c){return t.access(this,function(a,c,d){var e,f,g={},h=0;if(t.isArray(c)){for(f=Ob(a),e=c.length;e>h;h++)g[c[h]]=t.css(a,c[h],!1,f);return g}return d!==b?t.style(a,c,d):t.css(a,c)},a,c,arguments.length>1)},show:function(){return dc(this,!0)},hide:function(){return dc(this)},toggle:function(a){var b="boolean"==typeof a;return this.each(function(){(b?a:cc(this))?t(this).show():t(this).hide()})}}),t.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Pb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":t.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,i=t.camelCase(c),j=a.style;if(c=t.cssProps[i]||(t.cssProps[i]=bc(j,i)),h=t.cssHooks[c]||t.cssHooks[i],d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];if(g=typeof d,"string"===g&&(f=Xb.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(t.css(a,c)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||t.cssNumber[i]||(d+="px"),t.support.clearCloneStyle||""!==d||0!==c.indexOf("background")||(j[c]="inherit"),h&&"set"in h&&(d=h.set(a,d,e))===b)))try{j[c]=d}catch(k){}}},css:function(a,c,d,e){var f,g,h,i=t.camelCase(c);return c=t.cssProps[i]||(t.cssProps[i]=bc(a.style,i)),h=t.cssHooks[c]||t.cssHooks[i],h&&"get"in h&&(g=h.get(a,!0,d)),g===b&&(g=Pb(a,c,e)),"normal"===g&&c in $b&&(g=$b[c]),""===d||d?(f=parseFloat(g),d===!0||t.isNumeric(f)?f||0:g):g},swap:function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e}}),a.getComputedStyle?(Ob=function(b){return a.getComputedStyle(b,null)},Pb=function(a,c,d){var e,f,g,h=d||Ob(a),i=h?h.getPropertyValue(c)||h[c]:b,j=a.style;return h&&(""!==i||t.contains(a.ownerDocument,a)||(i=t.style(a,c)),Wb.test(i)&&Ub.test(c)&&(e=j.width,f=j.minWidth,g=j.maxWidth,j.minWidth=j.maxWidth=j.width=i,i=h.width,j.width=e,j.minWidth=f,j.maxWidth=g)),i}):f.documentElement.currentStyle&&(Ob=function(a){return a.currentStyle},Pb=function(a,c,d){var e,f,g,h=d||Ob(a),i=h?h[c]:b,j=a.style;return null==i&&j&&j[c]&&(i=j[c]),Wb.test(i)&&!Sb.test(c)&&(e=j.left,f=a.runtimeStyle,g=f&&f.left,g&&(f.left=a.currentStyle.left),j.left="fontSize"===c?"1em":i,i=j.pixelLeft+"px",j.left=e,g&&(f.left=g)),""===i?"auto":i}),t.each(["height","width"],function(a,c){t.cssHooks[c]={get:function(a,d,e){return d?0===a.offsetWidth&&Tb.test(t.css(a,"display"))?t.swap(a,Zb,function(){return gc(a,c,e)}):gc(a,c,e):b},set:function(a,b,d){var e=d&&Ob(a);return ec(a,b,d?fc(a,c,d,t.support.boxSizing&&"border-box"===t.css(a,"boxSizing",!1,e),e):0)}}}),t.support.opacity||(t.cssHooks.opacity={get:function(a,b){return Rb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=t.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===t.trim(f.replace(Qb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Qb.test(f)?f.replace(Qb,e):f+" "+e)}}),t(function(){t.support.reliableMarginRight||(t.cssHooks.marginRight={get:function(a,c){return c?t.swap(a,{display:"inline-block"},Pb,[a,"marginRight"]):b}}),!t.support.pixelPosition&&t.fn.position&&t.each(["top","left"],function(a,c){t.cssHooks[c]={get:function(a,d){return d?(d=Pb(a,c),Wb.test(d)?t(a).position()[c]+"px":d):b}}})}),t.expr&&t.expr.filters&&(t.expr.filters.hidden=function(a){return 0>=a.offsetWidth&&0>=a.offsetHeight||!t.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||t.css(a,"display"))},t.expr.filters.visible=function(a){return!t.expr.filters.hidden(a)}),t.each({margin:"",padding:"",border:"Width"},function(a,b){t.cssHooks[a+b]={expand:function(c){var d=0,e={},f="string"==typeof c?c.split(" "):[c];for(;4>d;d++)e[a+_b[d]+b]=f[d]||f[d-2]||f[0];return e}},Ub.test(a)||(t.cssHooks[a+b].set=ec)});var jc=/%20/g,kc=/\[\]$/,lc=/\r?\n/g,mc=/^(?:submit|button|image|reset|file)$/i,nc=/^(?:input|select|textarea|keygen)/i;t.fn.extend({serialize:function(){return t.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=t.prop(this,"elements");return a?t.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!t(this).is(":disabled")&&nc.test(this.nodeName)&&!mc.test(a)&&(this.checked||!xb.test(a))}).map(function(a,b){var c=t(this).val();return null==c?null:t.isArray(c)?t.map(c,function(a){return{name:b.name,value:a.replace(lc,"\r\n")}}):{name:b.name,value:c.replace(lc,"\r\n")}}).get()}}),t.param=function(a,c){var d,e=[],f=function(a,b){b=t.isFunction(b)?b():null==b?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(c===b&&(c=t.ajaxSettings&&t.ajaxSettings.traditional),t.isArray(a)||a.jquery&&!t.isPlainObject(a))t.each(a,function(){f(this.name,this.value)});else for(d in a)oc(d,a[d],c,f);return e.join("&").replace(jc,"+")},t.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){t.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),t.fn.hover=function(a,b){return this.mouseenter(a).mouseleave(b||a)};var pc,qc,rc=t.now(),sc=/\?/,tc=/#.*$/,uc=/([?&])_=[^&]*/,vc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,wc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,xc=/^(?:GET|HEAD)$/,yc=/^\/\//,zc=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Ac=t.fn.load,Bc={},Cc={},Dc="*/".concat("*");try{qc=g.href}catch(Ec){qc=f.createElement("a"),qc.href="",qc=qc.href}pc=zc.exec(qc.toLowerCase())||[],t.fn.load=function(a,c,d){if("string"!=typeof a&&Ac)return Ac.apply(this,arguments);var e,f,g,h=this,i=a.indexOf(" ");return i>=0&&(e=a.slice(i,a.length),a=a.slice(0,i)),t.isFunction(c)?(d=c,c=b):c&&"object"==typeof c&&(g="POST"),h.length>0&&t.ajax({url:a,type:g,dataType:"html",data:c}).done(function(a){f=arguments,h.html(e?t("<div>").append(t.parseHTML(a)).find(e):a)}).complete(d&&function(a,b){h.each(d,f||[a.responseText,b,a])}),this},t.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){t.fn[b]=function(a){return this.on(b,a)}}),t.each(["get","post"],function(a,c){t[c]=function(a,d,e,f){return t.isFunction(d)&&(f=f||e,e=d,d=b),t.ajax({url:a,type:c,dataType:f,data:d,success:e})}}),t.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qc,type:"GET",isLocal:wc.test(pc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":t.parseJSON,"text xml":t.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Hc(Hc(a,t.ajaxSettings),b):Hc(t.ajaxSettings,a)},ajaxPrefilter:Fc(Bc),ajaxTransport:Fc(Cc),ajax:function(a,c){function z(a,c,d,e){var k,r,s,v,w,y=c;2!==u&&(u=2,h&&clearTimeout(h),j=b,g=e||"",x.readyState=a>0?4:0,d&&(v=Ic(l,x,d)),a>=200&&300>a||304===a?(l.ifModified&&(w=x.getResponseHeader("Last-Modified"),w&&(t.lastModified[f]=w),w=x.getResponseHeader("etag"),w&&(t.etag[f]=w)),204===a?(k=!0,y="nocontent"):304===a?(k=!0,y="notmodified"):(k=Jc(l,v),y=k.state,r=k.data,s=k.error,k=!s)):(s=y,(a||!y)&&(y="error",0>a&&(a=0))),x.status=a,x.statusText=(c||y)+"",k?o.resolveWith(m,[r,y,x]):o.rejectWith(m,[x,y,s]),x.statusCode(q),q=b,i&&n.trigger(k?"ajaxSuccess":"ajaxError",[x,l,k?r:s]),p.fireWith(m,[x,y]),i&&(n.trigger("ajaxComplete",[x,l]),--t.active||t.event.trigger("ajaxStop")))}"object"==typeof a&&(c=a,a=b),c=c||{};var d,e,f,g,h,i,j,k,l=t.ajaxSetup({},c),m=l.context||l,n=l.context&&(m.nodeType||m.jquery)?t(m):t.event,o=t.Deferred(),p=t.Callbacks("once memory"),q=l.statusCode||{},r={},s={},u=0,w="canceled",x={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=vc.exec(g))k[b[1].toLowerCase()]=b[2]}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)q[b]=[q[b],a[b]];else x.always(a[x.status]);return this},abort:function(a){var b=a||w;return j&&j.abort(b),z(0,b),this}};if(o.promise(x).complete=p.add,x.success=x.done,x.error=x.fail,l.url=((a||l.url||qc)+"").replace(tc,"").replace(yc,pc[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=t.trim(l.dataType||"*").toLowerCase().match(v)||[""],null==l.crossDomain&&(d=zc.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===pc[1]&&d[2]===pc[2]&&(d[3]||("http:"===d[1]?80:443))==(pc[3]||("http:"===pc[1]?80:443)))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=t.param(l.data,l.traditional)),Gc(Bc,l,c,x),2===u)return x;i=l.global,i&&0===t.active++&&t.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!xc.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(sc.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=uc.test(f)?f.replace(uc,"$1_="+rc++):f+(sc.test(f)?"&":"?")+"_="+rc++)),l.ifModified&&(t.lastModified[f]&&x.setRequestHeader("If-Modified-Since",t.lastModified[f]),t.etag[f]&&x.setRequestHeader("If-None-Match",t.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&x.setRequestHeader("Content-Type",l.contentType),x.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Dc+"; q=0.01":""):l.accepts["*"]);for(e in l.headers)x.setRequestHeader(e,l.headers[e]);if(!l.beforeSend||l.beforeSend.call(m,x,l)!==!1&&2!==u){w="abort";for(e in{success:1,error:1,complete:1})x[e](l[e]);if(j=Gc(Cc,l,c,x)){x.readyState=1,i&&n.trigger("ajaxSend",[x,l]),l.async&&l.timeout>0&&(h=setTimeout(function(){x.abort("timeout")},l.timeout));try{u=1,j.send(r,z)}catch(y){if(!(2>u))throw y;z(-1,y)}}else z(-1,"No Transport");return x}return x.abort()},getScript:function(a,c){return t.get(a,b,c,"script")},getJSON:function(a,b,c){return t.get(a,b,c,"json")}}),t.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return t.globalEval(a),a}}}),t.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),t.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=f.head||t("head")[0]||f.documentElement;return{send:function(b,e){c=f.createElement("script"),c.async=!0,a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,b){(b||!c.readyState||/loaded|complete/.test(c.readyState))&&(c.onload=c.onreadystatechange=null,c.parentNode&&c.parentNode.removeChild(c),c=null,b||e(200,"success"))},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(b,!0)}}}});var Kc=[],Lc=/(=)\?(?=&|$)|\?\?/;t.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Kc.pop()||t.expando+"_"+rc++;return this[a]=!0,a}}),t.ajaxPrefilter("json jsonp",function(c,d,e){var f,g,h,i=c.jsonp!==!1&&(Lc.test(c.url)?"url":"string"==typeof c.data&&!(c.contentType||"").indexOf("application/x-www-form-urlencoded")&&Lc.test(c.data)&&"data");return i||"jsonp"===c.dataTypes[0]?(f=c.jsonpCallback=t.isFunction(c.jsonpCallback)?c.jsonpCallback():c.jsonpCallback,i?c[i]=c[i].replace(Lc,"$1"+f):c.jsonp!==!1&&(c.url+=(sc.test(c.url)?"&":"?")+c.jsonp+"="+f),c.converters["script json"]=function(){return h||t.error(f+" was not called"),h[0]},c.dataTypes[0]="json",g=a[f],a[f]=function(){h=arguments},e.always(function(){a[f]=g,c[f]&&(c.jsonpCallback=d.jsonpCallback,Kc.push(f)),h&&t.isFunction(g)&&g(h[0]),h=g=b}),"script"):b});var Mc,Nc,Oc=0,Pc=a.ActiveXObject&&function(){var a;for(a in Mc)Mc[a](b,!0)};t.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&Qc()||Rc()}:Qc,Nc=t.ajaxSettings.xhr(),t.support.cors=!!Nc&&"withCredentials"in Nc,Nc=t.support.ajax=!!Nc,Nc&&t.ajaxTransport(function(c){if(!c.crossDomain||t.support.cors){var d;return{send:function(e,f){var g,h,i=c.xhr();if(c.username?i.open(c.type,c.url,c.async,c.username,c.password):i.open(c.type,c.url,c.async),c.xhrFields)for(h in c.xhrFields)i[h]=c.xhrFields[h];c.mimeType&&i.overrideMimeType&&i.overrideMimeType(c.mimeType),c.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");try{for(h in e)i.setRequestHeader(h,e[h])}catch(j){}i.send(c.hasContent&&c.data||null),d=function(a,e){var h,j,k,l;try{if(d&&(e||4===i.readyState))if(d=b,g&&(i.onreadystatechange=t.noop,Pc&&delete Mc[g]),e)4!==i.readyState&&i.abort();else{l={},h=i.status,j=i.getAllResponseHeaders(),"string"==typeof i.responseText&&(l.text=i.responseText);try{k=i.statusText}catch(m){k=""}h||!c.isLocal||c.crossDomain?1223===h&&(h=204):h=l.text?200:404}}catch(n){e||f(-1,n)}l&&f(h,k,l,j)},c.async?4===i.readyState?setTimeout(d):(g=++Oc,Pc&&(Mc||(Mc={},t(a).unload(Pc)),Mc[g]=d),i.onreadystatechange=d):d()},abort:function(){d&&d(b,!0)}}}});var Sc,Tc,Uc=/^(?:toggle|show|hide)$/,Vc=RegExp("^(?:([+-])=|)("+u+")([a-z%]*)$","i"),Wc=/queueHooks$/,Xc=[bd],Yc={"*":[function(a,b){var c,d,e=this.createTween(a,b),f=Vc.exec(b),g=e.cur(),h=+g||0,i=1,j=20;if(f){if(c=+f[2],d=f[3]||(t.cssNumber[a]?"":"px"),"px"!==d&&h){h=t.css(e.elem,a,!0)||c||1;do i=i||".5",h/=i,t.style(e.elem,a,h+d);while(i!==(i=e.cur()/g)&&1!==i&&--j)}e.unit=d,e.start=h,e.end=f[1]?h+(f[1]+1)*c:c}return e}]};t.Animation=t.extend(_c,{tweener:function(a,b){t.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");var c,d=0,e=a.length;for(;e>d;d++)c=a[d],Yc[c]=Yc[c]||[],Yc[c].unshift(b)},prefilter:function(a,b){b?Xc.unshift(a):Xc.push(a)}}),t.Tween=cd,cd.prototype={constructor:cd,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(t.cssNumber[c]?"":"px")},cur:function(){var a=cd.propHooks[this.prop];return a&&a.get?a.get(this):cd.propHooks._default.get(this)},run:function(a){var b,c=cd.propHooks[this.prop];return this.pos=b=this.options.duration?t.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):cd.propHooks._default.set(this),this}},cd.prototype.init.prototype=cd.prototype,cd.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=t.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){t.fx.step[a.prop]?t.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[t.cssProps[a.prop]]||t.cssHooks[a.prop])?t.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},cd.propHooks.scrollTop=cd.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},t.each(["toggle","show","hide"],function(a,b){var c=t.fn[b];t.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(dd(b,!0),a,d,e)}}),t.fn.extend({fadeTo:function(a,b,c,d){return this.filter(cc).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=t.isEmptyObject(a),f=t.speed(b,c,d),g=function(){var b=_c(this,t.extend({},a),f);g.finish=function(){b.stop(!0)},(e||t._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,c,d){var e=function(a){var b=a.stop;delete a.stop,b(d)};return"string"!=typeof a&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,c=null!=a&&a+"queueHooks",f=t.timers,g=t._data(this);if(c)g[c]&&g[c].stop&&e(g[c]);else for(c in g)g[c]&&g[c].stop&&Wc.test(c)&&e(g[c]);for(c=f.length;c--;)f[c].elem!==this||null!=a&&f[c].queue!==a||(f[c].anim.stop(d),b=!1,f.splice(c,1));(b||!d)&&t.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=t._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=t.timers,g=d?d.length:0;for(c.finish=!0,t.queue(this,a,[]),e&&e.cur&&e.cur.finish&&e.cur.finish.call(this),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),t.each({slideDown:dd("show"),slideUp:dd("hide"),slideToggle:dd("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){t.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),t.speed=function(a,b,c){var d=a&&"object"==typeof a?t.extend({},a):{complete:c||!c&&b||t.isFunction(a)&&a,duration:a,easing:c&&b||b&&!t.isFunction(b)&&b};return d.duration=t.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in t.fx.speeds?t.fx.speeds[d.duration]:t.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){t.isFunction(d.old)&&d.old.call(this),d.queue&&t.dequeue(this,d.queue)},d},t.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},t.timers=[],t.fx=cd.prototype.init,t.fx.tick=function(){var a,c=t.timers,d=0;for(Sc=t.now();c.length>d;d++)a=c[d],a()||c[d]!==a||c.splice(d--,1);c.length||t.fx.stop(),Sc=b},t.fx.timer=function(a){a()&&t.timers.push(a)&&t.fx.start()},t.fx.interval=13,t.fx.start=function(){Tc||(Tc=setInterval(t.fx.tick,t.fx.interval))},t.fx.stop=function(){clearInterval(Tc),Tc=null},t.fx.speeds={slow:600,fast:200,_default:400},t.fx.step={},t.expr&&t.expr.filters&&(t.expr.filters.animated=function(a){return t.grep(t.timers,function(b){return a===b.elem}).length}),t.fn.offset=function(a){if(arguments.length)return a===b?this:this.each(function(b){t.offset.setOffset(this,a,b)});var c,d,f={top:0,left:0},g=this[0],h=g&&g.ownerDocument;if(h)return c=h.documentElement,t.contains(c,g)?(typeof g.getBoundingClientRect!==e&&(f=g.getBoundingClientRect()),d=ed(h),{top:f.top+(d.pageYOffset||c.scrollTop)-(c.clientTop||0),left:f.left+(d.pageXOffset||c.scrollLeft)-(c.clientLeft||0)}):f},t.offset={setOffset:function(a,b,c){var d=t.css(a,"position");"static"===d&&(a.style.position="relative");var e=t(a),f=e.offset(),g=t.css(a,"top"),h=t.css(a,"left"),i=("absolute"===d||"fixed"===d)&&t.inArray("auto",[g,h])>-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),t.isFunction(b)&&(b=b.call(a,c,f)),null!=b.top&&(j.top=b.top-f.top+l),null!=b.left&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},t.fn.extend({position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===t.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),t.nodeName(a[0],"html")||(c=a.offset()),c.top+=t.css(a[0],"borderTopWidth",!0),c.left+=t.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-t.css(d,"marginTop",!0),left:b.left-c.left-t.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||f.documentElement;while(a&&!t.nodeName(a,"html")&&"static"===t.css(a,"position"))a=a.offsetParent;return a||f.documentElement})}}),t.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);t.fn[a]=function(e){return t.access(this,function(a,e,f){var g=ed(a);return f===b?g?c in g?g[c]:g.document.documentElement[e]:a[e]:(g?g.scrollTo(d?t(g).scrollLeft():f,d?f:t(g).scrollTop()):a[e]=f,b)},a,e,arguments.length,null)}}),t.each({Height:"height",Width:"width"},function(a,c){t.each({padding:"inner"+a,content:c,"":"outer"+a},function(d,e){t.fn[e]=function(e,f){var g=arguments.length&&(d||"boolean"!=typeof e),h=d||(e===!0||f===!0?"margin":"border");return t.access(this,function(c,d,e){var f;return t.isWindow(c)?c.document.documentElement["client"+a]:9===c.nodeType?(f=c.documentElement,Math.max(c.body["scroll"+a],f["scroll"+a],c.body["offset"+a],f["offset"+a],f["client"+a])):e===b?t.css(c,d,h):t.style(c,d,e,h)},c,g?e:b,g,null)}})}),a.jQuery=a.$=t,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return t})})(window),function(){var a=this,b=a._,c={},d=Array.prototype,e=Object.prototype,f=Function.prototype,g=d.push,h=d.slice,i=d.concat,j=e.toString,k=e.hasOwnProperty,l=d.forEach,m=d.map,n=d.reduce,o=d.reduceRight,p=d.filter,q=d.every,r=d.some,s=d.indexOf,t=d.lastIndexOf,u=Array.isArray,v=Object.keys,w=f.bind,x=function(a){return a instanceof x?a:this instanceof x?(this._wrapped=a,void 0):new x(a)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=x),exports._=x):a._=x,x.VERSION="1.4.4";var y=x.each=x.forEach=function(a,b,d){if(null!=a)if(l&&a.forEach===l)a.forEach(b,d);else if(a.length===+a.length){for(var e=0,f=a.length;f>e;e++)if(b.call(d,a[e],e,a)===c)return}else for(var g in a)if(x.has(a,g)&&b.call(d,a[g],g,a)===c)return};x.map=x.collect=function(a,b,c){var d=[];return null==a?d:m&&a.map===m?a.map(b,c):(y(a,function(a,e,f){d[d.length]=b.call(c,a,e,f)}),d)};var z="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),n&&a.reduce===n)return d&&(b=x.bind(b,d)),e?a.reduce(b,c):a.reduce(b);if(y(a,function(a,f,g){e?c=b.call(d,c,a,f,g):(c=a,e=!0)}),!e)throw new TypeError(z);return c},x.reduceRight=x.foldr=function(a,b,c,d){var e=arguments.length>2;if(null==a&&(a=[]),o&&a.reduceRight===o)return d&&(b=x.bind(b,d)),e?a.reduceRight(b,c):a.reduceRight(b);var f=a.length;if(f!==+f){var g=x.keys(a);f=g.length}if(y(a,function(h,i,j){i=g?g[--f]:--f,e?c=b.call(d,c,a[i],i,j):(c=a[i],e=!0)}),!e)throw new TypeError(z);return c},x.find=x.detect=function(a,b,c){var d;return A(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,!0):void 0}),d},x.filter=x.select=function(a,b,c){var d=[];return null==a?d:p&&a.filter===p?a.filter(b,c):(y(a,function(a,e,f){b.call(c,a,e,f)&&(d[d.length]=a)}),d)},x.reject=function(a,b,c){return x.filter(a,function(a,d,e){return!b.call(c,a,d,e)},c)},x.every=x.all=function(a,b,d){b||(b=x.identity);var e=!0;return null==a?e:q&&a.every===q?a.every(b,d):(y(a,function(a,f,g){return(e=e&&b.call(d,a,f,g))?void 0:c}),!!e)};var A=x.some=x.any=function(a,b,d){b||(b=x.identity);var e=!1;return null==a?e:r&&a.some===r?a.some(b,d):(y(a,function(a,f,g){return e||(e=b.call(d,a,f,g))?c:void 0}),!!e)};x.contains=x.include=function(a,b){return null==a?!1:s&&a.indexOf===s?a.indexOf(b)!=-1:A(a,function(a){return a===b})},x.invoke=function(a,b){var c=h.call(arguments,2),d=x.isFunction(b);return x.map(a,function(a){return(d?b:a[b]).apply(a,c)})},x.pluck=function(a,b){return x.map(a,function(a){return a[b]})},x.where=function(a,b,c){return x.isEmpty(b)?c?null:[]:x[c?"find":"filter"](a,function(a){for(var c in b)if(b[c]!==a[c])return!1;return!0})},x.findWhere=function(a,b){return x.where(a,b,!0)},x.max=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.max.apply(Math,a);if(!b&&x.isEmpty(a))return-1/0;var d={computed:-1/0,value:-1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;g>=d.computed&&(d={value:a,computed:g})}),d.value},x.min=function(a,b,c){if(!b&&x.isArray(a)&&a[0]===+a[0]&&65535>a.length)return Math.min.apply(Math,a);if(!b&&x.isEmpty(a))return 1/0;var d={computed:1/0,value:1/0};return y(a,function(a,e,f){var g=b?b.call(c,a,e,f):a;d.computed>g&&(d={value:a,computed:g})}),d.value},x.shuffle=function(a){var b,c=0,d=[];return y(a,function(a){b=x.random(c++),d[c-1]=d[b],d[b]=a}),d};var B=function(a){return x.isFunction(a)?a:function(b){return b[a]}};x.sortBy=function(a,b,c){var d=B(b);return x.pluck(x.map(a,function(a,b,e){return{value:a,index:b,criteria:d.call(c,a,b,e)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;if(c!==d){if(c>d||c===void 0)return 1;if(d>c||d===void 0)return-1}return a.index<b.index?-1:1}),"value")};var C=function(a,b,c,d){var e={},f=B(b||x.identity);return y(a,function(b,g){var h=f.call(c,b,g,a);d(e,h,b)}),e};x.groupBy=function(a,b,c){return C(a,b,c,function(a,b,c){(x.has(a,b)?a[b]:a[b]=[]).push(c)})},x.countBy=function(a,b,c){return C(a,b,c,function(a,b){x.has(a,b)||(a[b]=0),a[b]++})},x.sortedIndex=function(a,b,c,d){c=null==c?x.identity:B(c);for(var e=c.call(d,b),f=0,g=a.length;g>f;){var h=f+g>>>1;e>c.call(d,a[h])?f=h+1:g=h}return f},x.toArray=function(a){return a?x.isArray(a)?h.call(a):a.length===+a.length?x.map(a,x.identity):x.values(a):[]},x.size=function(a){return null==a?0:a.length===+a.length?a.length:x.keys(a).length},x.first=x.head=x.take=function(a,b,c){return null==a?void 0:null==b||c?a[0]:h.call(a,0,b)},x.initial=function(a,b,c){return h.call(a,0,a.length-(null==b||c?1:b))},x.last=function(a,b,c){return null==a?void 0:null==b||c?a[a.length-1]:h.call(a,Math.max(a.length-b,0))},x.rest=x.tail=x.drop=function(a,b,c){return h.call(a,null==b||c?1:b)},x.compact=function(a){return x.filter(a,x.identity)};var D=function(a,b,c){return y(a,function(a){x.isArray(a)?b?g.apply(c,a):D(a,b,c):c.push(a)}),c};x.flatten=function(a,b){return D(a,b,[])},x.without=function(a){return x.difference(a,h.call(arguments,1))},x.uniq=x.unique=function(a,b,c,d){x.isFunction(b)&&(d=c,c=b,b=!1);var e=c?x.map(a,c,d):a,f=[],g=[];return y(e,function(c,d){(b?d&&g[g.length-1]===c:x.contains(g,c))||(g.push(c),f.push(a[d]))}),f},x.union=function(){return x.uniq(i.apply(d,arguments))},x.intersection=function(a){var b=h.call(arguments,1);return x.filter(x.uniq(a),function(a){return x.every(b,function(b){return x.indexOf(b,a)>=0})})},x.difference=function(a){var b=i.apply(d,h.call(arguments,1));return x.filter(a,function(a){return!x.contains(b,a)})},x.zip=function(){for(var a=h.call(arguments),b=x.max(x.pluck(a,"length")),c=Array(b),d=0;b>d;d++)c[d]=x.pluck(a,""+d);return c},x.object=function(a,b){if(null==a)return{};for(var c={},d=0,e=a.length;e>d;d++)b?c[a[d]]=b[d]:c[a[d][0]]=a[d][1
6
- ];return c},x.indexOf=function(a,b,c){if(null==a)return-1;var d=0,e=a.length;if(c){if("number"!=typeof c)return d=x.sortedIndex(a,b),a[d]===b?d:-1;d=0>c?Math.max(0,e+c):c}if(s&&a.indexOf===s)return a.indexOf(b,c);for(;e>d;d++)if(a[d]===b)return d;return-1},x.lastIndexOf=function(a,b,c){if(null==a)return-1;var d=null!=c;if(t&&a.lastIndexOf===t)return d?a.lastIndexOf(b,c):a.lastIndexOf(b);for(var e=d?c:a.length;e--;)if(a[e]===b)return e;return-1},x.range=function(a,b,c){1>=arguments.length&&(b=a||0,a=0),c=arguments[2]||1;for(var d=Math.max(Math.ceil((b-a)/c),0),e=0,f=Array(d);d>e;)f[e++]=a,a+=c;return f},x.bind=function(a,b){if(a.bind===w&&w)return w.apply(a,h.call(arguments,1));var c=h.call(arguments,2);return function(){return a.apply(b,c.concat(h.call(arguments)))}},x.partial=function(a){var b=h.call(arguments,1);return function(){return a.apply(this,b.concat(h.call(arguments)))}},x.bindAll=function(a){var b=h.call(arguments,1);return 0===b.length&&(b=x.functions(a)),y(b,function(b){a[b]=x.bind(a[b],a)}),a},x.memoize=function(a,b){var c={};return b||(b=x.identity),function(){var d=b.apply(this,arguments);return x.has(c,d)?c[d]:c[d]=a.apply(this,arguments)}},x.delay=function(a,b){var c=h.call(arguments,2);return setTimeout(function(){return a.apply(null,c)},b)},x.defer=function(a){return x.delay.apply(x,[a,1].concat(h.call(arguments,1)))},x.throttle=function(a,b){var c,d,e,f,g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)};return function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},x.debounce=function(a,b,c){var d,e;return function(){var f=this,g=arguments,h=function(){d=null,c||(e=a.apply(f,g))},i=c&&!d;return clearTimeout(d),d=setTimeout(h,b),i&&(e=a.apply(f,g)),e}},x.once=function(a){var b,c=!1;return function(){return c?b:(c=!0,b=a.apply(this,arguments),a=null,b)}},x.wrap=function(a,b){return function(){var c=[a];return g.apply(c,arguments),b.apply(this,c)}},x.compose=function(){var a=arguments;return function(){for(var b=arguments,c=a.length-1;c>=0;c--)b=[a[c].apply(this,b)];return b[0]}},x.after=function(a,b){return 0>=a?b():function(){return 1>--a?b.apply(this,arguments):void 0}},x.keys=v||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[];for(var c in a)x.has(a,c)&&(b[b.length]=c);return b},x.values=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push(a[c]);return b},x.pairs=function(a){var b=[];for(var c in a)x.has(a,c)&&b.push([c,a[c]]);return b},x.invert=function(a){var b={};for(var c in a)x.has(a,c)&&(b[a[c]]=c);return b},x.functions=x.methods=function(a){var b=[];for(var c in a)x.isFunction(a[c])&&b.push(c);return b.sort()},x.extend=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)a[c]=b[c]}),a},x.pick=function(a){var b={},c=i.apply(d,h.call(arguments,1));return y(c,function(c){c in a&&(b[c]=a[c])}),b},x.omit=function(a){var b={},c=i.apply(d,h.call(arguments,1));for(var e in a)x.contains(c,e)||(b[e]=a[e]);return b},x.defaults=function(a){return y(h.call(arguments,1),function(b){if(b)for(var c in b)null==a[c]&&(a[c]=b[c])}),a},x.clone=function(a){return x.isObject(a)?x.isArray(a)?a.slice():x.extend({},a):a},x.tap=function(a,b){return b(a),a};var E=function(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;if(null==a||null==b)return a===b;a instanceof x&&(a=a._wrapped),b instanceof x&&(b=b._wrapped);var e=j.call(a);if(e!=j.call(b))return!1;switch(e){case"[object String]":return a==b+"";case"[object Number]":return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if("object"!=typeof a||"object"!=typeof b)return!1;for(var f=c.length;f--;)if(c[f]==a)return d[f]==b;c.push(a),d.push(b);var g=0,h=!0;if("[object Array]"==e){if(g=a.length,h=g==b.length)for(;g--&&(h=E(a[g],b[g],c,d)););}else{var i=a.constructor,k=b.constructor;if(i!==k&&!(x.isFunction(i)&&i instanceof i&&x.isFunction(k)&&k instanceof k))return!1;for(var l in a)if(x.has(a,l)&&(g++,!(h=x.has(b,l)&&E(a[l],b[l],c,d))))break;if(h){for(l in b)if(x.has(b,l)&&!(g--))break;h=!g}}return c.pop(),d.pop(),h};x.isEqual=function(a,b){return E(a,b,[],[])},x.isEmpty=function(a){if(null==a)return!0;if(x.isArray(a)||x.isString(a))return 0===a.length;for(var b in a)if(x.has(a,b))return!1;return!0},x.isElement=function(a){return!!a&&1===a.nodeType},x.isArray=u||function(a){return"[object Array]"==j.call(a)},x.isObject=function(a){return a===Object(a)},y(["Arguments","Function","String","Number","Date","RegExp"],function(a){x["is"+a]=function(b){return j.call(b)=="[object "+a+"]"}}),x.isArguments(arguments)||(x.isArguments=function(a){return!!a&&!!x.has(a,"callee")}),"function"!=typeof /./&&(x.isFunction=function(a){return"function"==typeof a}),x.isFinite=function(a){return isFinite(a)&&!isNaN(parseFloat(a))},x.isNaN=function(a){return x.isNumber(a)&&a!=+a},x.isBoolean=function(a){return a===!0||a===!1||"[object Boolean]"==j.call(a)},x.isNull=function(a){return null===a},x.isUndefined=function(a){return a===void 0},x.has=function(a,b){return k.call(a,b)},x.noConflict=function(){return a._=b,this},x.identity=function(a){return a},x.times=function(a,b,c){for(var d=Array(a),e=0;a>e;e++)d[e]=b.call(c,e);return d},x.random=function(a,b){return null==b&&(b=a,a=0),a+Math.floor(Math.random()*(b-a+1))};var F={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};F.unescape=x.invert(F.escape);var G={escape:RegExp("["+x.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+x.keys(F.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(a){x[a]=function(b){return null==b?"":(""+b).replace(G[a],function(b){return F[a][b]})}}),x.result=function(a,b){if(null==a)return null;var c=a[b];return x.isFunction(c)?c.call(a):c},x.mixin=function(a){y(x.functions(a),function(b){var c=x[b]=a[b];x.prototype[b]=function(){var a=[this._wrapped];return g.apply(a,arguments),L.call(this,c.apply(x,a))}})};var H=0;x.uniqueId=function(a){var b=++H+"";return a?a+b:b},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var I=/(.)^/,J={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},K=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(a,b,c){var d;c=x.defaults({},c,x.templateSettings);var e=RegExp([(c.escape||I).source,(c.interpolate||I).source,(c.evaluate||I).source].join("|")+"|$","g"),f=0,g="__p+='";a.replace(e,function(b,c,d,e,h){return g+=a.slice(f,h).replace(K,function(a){return"\\"+J[a]}),c&&(g+="'+\n((__t=("+c+"))==null?'':_.escape(__t))+\n'"),d&&(g+="'+\n((__t=("+d+"))==null?'':__t)+\n'"),e&&(g+="';\n"+e+"\n__p+='"),f=h+b.length,b}),g+="';\n",c.variable||(g="with(obj||{}){\n"+g+"}\n"),g="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+g+"return __p;\n";try{d=Function(c.variable||"obj","_",g)}catch(h){throw h.source=g,h}if(b)return d(b,x);var i=function(a){return d.call(this,a,x)};return i.source="function("+(c.variable||"obj")+"){\n"+g+"}",i},x.chain=function(a){return x(a).chain()};var L=function(a){return this._chain?x(a).chain():a};x.mixin(x),y(["pop","push","reverse","shift","sort","splice","unshift"],function(a){var b=d[a];x.prototype[a]=function(){var c=this._wrapped;return b.apply(c,arguments),"shift"!=a&&"splice"!=a||0!==c.length||delete c[0],L.call(this,c)}}),y(["concat","join","slice"],function(a){var b=d[a];x.prototype[a]=function(){return L.call(this,b.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),!function(a,b){"use strict";var c=b.prototype.trim,d=b.prototype.trimRight,e=b.prototype.trimLeft,f=function(a){return a*1||0},g=function(a,b){if(b<1)return"";var c="";while(b>0)b&1&&(c+=a),b>>=1,a+=a;return c},h=[].slice,i=function(a){return a==null?"\\s":a.source?a.source:"["+n.escapeRegExp(a)+"]"},j={lt:"<",gt:">",quot:'"',apos:"'",amp:"&"},k={};for(var l in j)k[j[l]]=l;var m=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}var c=g,d=function(){return d.cache.hasOwnProperty(arguments[0])||(d.cache[arguments[0]]=d.parse(arguments[0])),d.format.call(null,d.cache[arguments[0]],arguments)};return d.format=function(d,e){var f=1,g=d.length,h="",i,j=[],k,l,n,o,p,q;for(k=0;k<g;k++){h=a(d[k]);if(h==="string")j.push(d[k]);else if(h==="array"){n=d[k];if(n[2]){i=e[f];for(l=0;l<n[2].length;l++){if(!i.hasOwnProperty(n[2][l]))throw new Error(m('[_.sprintf] property "%s" does not exist',n[2][l]));i=i[n[2][l]]}}else n[1]?i=e[n[1]]:i=e[f++];if(/[^s]/.test(n[8])&&a(i)!="number")throw new Error(m("[_.sprintf] expecting number but found %s",a(i)));switch(n[8]){case"b":i=i.toString(2);break;case"c":i=b.fromCharCode(i);break;case"d":i=parseInt(i,10);break;case"e":i=n[7]?i.toExponential(n[7]):i.toExponential();break;case"f":i=n[7]?parseFloat(i).toFixed(n[7]):parseFloat(i);break;case"o":i=i.toString(8);break;case"s":i=(i=b(i))&&n[7]?i.substring(0,n[7]):i;break;case"u":i=Math.abs(i);break;case"x":i=i.toString(16);break;case"X":i=i.toString(16).toUpperCase()}i=/[def]/.test(n[8])&&n[3]&&i>=0?"+"+i:i,p=n[4]?n[4]=="0"?"0":n[4].charAt(1):" ",q=n[6]-b(i).length,o=n[6]?c(p,q):"",j.push(n[5]?i+o:o+i)}}return j.join("")},d.cache={},d.parse=function(a){var b=a,c=[],d=[],e=0;while(b){if((c=/^[^\x25]+/.exec(b))!==null)d.push(c[0]);else if((c=/^\x25{2}/.exec(b))!==null)d.push("%");else{if((c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b))===null)throw new Error("[_.sprintf] huh?");if(c[2]){e|=1;var f=[],g=c[2],h=[];if((h=/^([a-z_][a-z_\d]*)/i.exec(g))===null)throw new Error("[_.sprintf] huh?");f.push(h[1]);while((g=g.substring(h[0].length))!=="")if((h=/^\.([a-z_][a-z_\d]*)/i.exec(g))!==null)f.push(h[1]);else{if((h=/^\[(\d+)\]/.exec(g))===null)throw new Error("[_.sprintf] huh?");f.push(h[1])}c[2]=f}else e|=2;if(e===3)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");d.push(c)}b=b.substring(c[0].length)}return d},d}(),n={VERSION:"2.3.0",isBlank:function(a){return a==null&&(a=""),/^\s*$/.test(a)},stripTags:function(a){return a==null?"":b(a).replace(/<\/?[^>]+>/g,"")},capitalize:function(a){return a=a==null?"":b(a),a.charAt(0).toUpperCase()+a.slice(1)},chop:function(a,c){return a==null?[]:(a=b(a),c=~~c,c>0?a.match(new RegExp(".{1,"+c+"}","g")):[a])},clean:function(a){return n.strip(a).replace(/\s+/g," ")},count:function(a,c){return a==null||c==null?0:b(a).split(c).length-1},chars:function(a){return a==null?[]:b(a).split("")},swapCase:function(a){return a==null?"":b(a).replace(/\S/g,function(a){return a===a.toUpperCase()?a.toLowerCase():a.toUpperCase()})},escapeHTML:function(a){return a==null?"":b(a).replace(/[&<>"']/g,function(a){return"&"+k[a]+";"})},unescapeHTML:function(a){return a==null?"":b(a).replace(/\&([^;]+);/g,function(a,c){var d;return c in j?j[c]:(d=c.match(/^#x([\da-fA-F]+)$/))?b.fromCharCode(parseInt(d[1],16)):(d=c.match(/^#(\d+)$/))?b.fromCharCode(~~d[1]):a})},escapeRegExp:function(a){return a==null?"":b(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(a,b,c,d){var e=n.chars(a);return e.splice(~~b,~~c,d),e.join("")},insert:function(a,b,c){return n.splice(a,b,0,c)},include:function(a,c){return c===""?!0:a==null?!1:b(a).indexOf(c)!==-1},join:function(){var a=h.call(arguments),b=a.shift();return b==null&&(b=""),a.join(b)},lines:function(a){return a==null?[]:b(a).split("\n")},reverse:function(a){return n.chars(a).reverse().join("")},startsWith:function(a,c){return c===""?!0:a==null||c==null?!1:(a=b(a),c=b(c),a.length>=c.length&&a.slice(0,c.length)===c)},endsWith:function(a,c){return c===""?!0:a==null||c==null?!1:(a=b(a),c=b(c),a.length>=c.length&&a.slice(a.length-c.length)===c)},succ:function(a){return a==null?"":(a=b(a),a.slice(0,-1)+b.fromCharCode(a.charCodeAt(a.length-1)+1))},titleize:function(a){return a==null?"":b(a).replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()})},camelize:function(a){return n.trim(a).replace(/[-_\s]+(.)?/g,function(a,b){return b.toUpperCase()})},underscored:function(a){return n.trim(a).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(a){return n.trim(a).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(a){return n.titleize(b(a).replace(/_/g," ")).replace(/\s/g,"")},humanize:function(a){return n.capitalize(n.underscored(a).replace(/_id$/,"").replace(/_/g," "))},trim:function(a,d){return a==null?"":!d&&c?c.call(a):(d=i(d),b(a).replace(new RegExp("^"+d+"+|"+d+"+$","g"),""))},ltrim:function(a,c){return a==null?"":!c&&e?e.call(a):(c=i(c),b(a).replace(new RegExp("^"+c+"+"),""))},rtrim:function(a,c){return a==null?"":!c&&d?d.call(a):(c=i(c),b(a).replace(new RegExp(c+"+$"),""))},truncate:function(a,c,d){return a==null?"":(a=b(a),d=d||"...",c=~~c,a.length>c?a.slice(0,c)+d:a)},prune:function(a,c,d){if(a==null)return"";a=b(a),c=~~c,d=d!=null?b(d):"...";if(a.length<=c)return a;var e=function(a){return a.toUpperCase()!==a.toLowerCase()?"A":" "},f=a.slice(0,c+1).replace(/.(?=\W*\w*$)/g,e);return f.slice(f.length-2).match(/\w\w/)?f=f.replace(/\s*\S+$/,""):f=n.rtrim(f.slice(0,f.length-1)),(f+d).length>a.length?a:a.slice(0,f.length)+d},words:function(a,b){return n.isBlank(a)?[]:n.trim(a,b).split(b||/\s+/)},pad:function(a,c,d,e){a=a==null?"":b(a),c=~~c;var f=0;d?d.length>1&&(d=d.charAt(0)):d=" ";switch(e){case"right":return f=c-a.length,a+g(d,f);case"both":return f=c-a.length,g(d,Math.ceil(f/2))+a+g(d,Math.floor(f/2));default:return f=c-a.length,g(d,f)+a}},lpad:function(a,b,c){return n.pad(a,b,c)},rpad:function(a,b,c){return n.pad(a,b,c,"right")},lrpad:function(a,b,c){return n.pad(a,b,c,"both")},sprintf:m,vsprintf:function(a,b){return b.unshift(a),m.apply(null,b)},toNumber:function(a,c){if(a==null||a=="")return 0;a=b(a);var d=f(f(a).toFixed(~~c));return d===0&&!a.match(/^0+$/)?Number.NaN:d},numberFormat:function(a,b,c,d){if(isNaN(a)||a==null)return"";a=a.toFixed(~~b),d=d||",";var e=a.split("."),f=e[0],g=e[1]?(c||".")+e[1]:"";return f.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+d)+g},strRight:function(a,c){if(a==null)return"";a=b(a),c=c!=null?b(c):c;var d=c?a.indexOf(c):-1;return~d?a.slice(d+c.length,a.length):a},strRightBack:function(a,c){if(a==null)return"";a=b(a),c=c!=null?b(c):c;var d=c?a.lastIndexOf(c):-1;return~d?a.slice(d+c.length,a.length):a},strLeft:function(a,c){if(a==null)return"";a=b(a),c=c!=null?b(c):c;var d=c?a.indexOf(c):-1;return~d?a.slice(0,d):a},strLeftBack:function(a,b){if(a==null)return"";a+="",b=b!=null?""+b:b;var c=a.lastIndexOf(b);return~c?a.slice(0,c):a},toSentence:function(a,b,c,d){b=b||", ",c=c||" and ";var e=a.slice(),f=e.pop();return a.length>2&&d&&(c=n.rtrim(b)+c),e.length?e.join(b)+c+f:f},toSentenceSerial:function(){var a=h.call(arguments);return a[3]=!0,n.toSentence.apply(n,a)},slugify:function(a){if(a==null)return"";var c="ąàáäâãåæćęèéëêìíïîłńòóöôõøùúüûñçżź",d="aaaaaaaaceeeeeiiiilnoooooouuuunczz",e=new RegExp(i(c),"g");return a=b(a).toLowerCase().replace(e,function(a){var b=c.indexOf(a);return d.charAt(b)||"-"}),n.dasherize(a.replace(/[^\w\s-]/g,""))},surround:function(a,b){return[b,a,b].join("")},quote:function(a){return n.surround(a,'"')},exports:function(){var a={};for(var b in this){if(!this.hasOwnProperty(b)||b.match(/^(?:include|contains|reverse)$/))continue;a[b]=this[b]}return a},repeat:function(a,c,d){if(a==null)return"";c=~~c;if(d==null)return g(b(a),c);for(var e=[];c>0;e[--c]=a);return e.join(d)},levenshtein:function(a,c){if(a==null&&c==null)return 0;if(a==null)return b(c).length;if(c==null)return b(a).length;a=b(a),c=b(c);var d=[],e,f;for(var g=0;g<=c.length;g++)for(var h=0;h<=a.length;h++)g&&h?a.charAt(h-1)===c.charAt(g-1)?f=e:f=Math.min(d[h],d[h-1],e)+1:f=g+h,e=d[h],d[h]=f;return d.pop()}};n.strip=n.trim,n.lstrip=n.ltrim,n.rstrip=n.rtrim,n.center=n.lrpad,n.rjust=n.lpad,n.ljust=n.rpad,n.contains=n.include,n.q=n.quote,typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(module.exports=n),exports._s=n):typeof define=="function"&&define.amd?define("underscore.string",[],function(){return n}):(a._=a._||{},a._.string=a._.str=n)}(this,String);var Hogan={};(function(a,b){function c(a,b,c){function d(){}function e(){}d.prototype=a,e.prototype=a.subs;var f,g=new d;g.subs=new e,g.ib();for(f in b)g.subs[f]=b[f];for(f in c)g.partials[f]=c[f];return g}function j(a){return String(a===null||a===undefined?"":a)}function k(a){return a=j(a),i.test(a)?a.replace(d,"&amp;").replace(e,"&lt;").replace(f,"&gt;").replace(g,"&#39;").replace(h,"&quot;"):a}a.Template=function(a,b,c,d){a=a||{},this.r=a.code||this.r,this.c=c,this.options=d,this.text=b||"",this.partials=a.partials||{},this.subs=a.subs||{},this.ib()},a.Template.prototype={r:function(a,b,c){return""},v:k,t:j,render:function(b,c,d){return this.ri([b],c||{},d)},ri:function(a,b,c){return this.r(a,b,c)},ep:function(a,b){var d=this.partials[a],e=b[d.name];if(d.instance&&d.base==e)return d.instance;if(typeof e=="string"){if(!this.c)throw new Error("No compiler available.");e=this.c.compile(e,this.options)}return e?(this.partials[a].base=e,d.subs&&(e=c(e,d.subs,d.partials)),this.partials[a].instance=e,e):null},rp:function(a,b,c,d){var e=this.ep(a,c);return e?e.ri(b,c,d):""},rs:function(a,b,c){var d=a[a.length-1];if(!l(d)){c(a,b,this);return}for(var e=0;e<d.length;e++)a.push(d[e]),c(a,b,this),a.pop()},s:function(a,b,c,d,e,f,g){var h;return l(a)&&a.length===0?!1:(typeof a=="function"&&(a=this.ms(a,b,c,d,e,f,g)),h=a===""||!!a,!d&&h&&b&&b.push(typeof a=="object"?a:b[b.length-1]),h)},d:function(a,b,c,d){var e=a.split("."),f=this.f(e[0],b,c,d),g=null;if(a==="."&&l(b[b.length-2]))return b[b.length-1];for(var h=1;h<e.length;h++)f&&typeof f=="object"&&f[e[h]]!=null?(g=f,f=f[e[h]]):f="";return d&&!f?!1:(!d&&typeof f=="function"&&(b.push(g),f=this.mv(f,b,c),b.pop()),f)},f:function(a,b,c,d){var e=!1,f=null,g=!1;for(var h=b.length-1;h>=0;h--){f=b[h];if(f&&typeof f=="object"&&f[a]!=null){e=f[a],g=!0;break}}return g?(!d&&typeof e=="function"&&(e=this.mv(e,b,c)),e):d?!1:""},ls:function(a,b,c,d,e){var f=this.options.delimiters;return this.options.delimiters=e,this.b(this.ct(j(a.call(b,d)),b,c)),this.options.delimiters=f,!1},ct:function(a,b,c){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(a,this.options).render(b,c)},b:b?function(a){this.buf.push(a)}:function(a){this.buf+=a},fl:b?function(){var a=this.buf.join("");return this.buf=[],a}:function(){var a=this.buf;return this.buf="",a},ib:function(){this.buf=b?[]:""},ms:function(a,b,c,d,e,f,g){var h=b[b.length-1],i=a.call(h);return typeof i=="function"?d?!0:this.ls(i,h,c,this.text.substring(e,f),g):i},mv:function(a,b,c){var d=b[b.length-1],e=a.call(d);return typeof e=="function"?this.ct(j(e.call(d)),d,c):e},sub:function(a,b,c,d){var e=this.subs[a];e&&e(b,c,this,d)}};var d=/&/g,e=/</g,f=/>/g,g=/\'/g,h=/\"/g,i=/[&<>\"\']/,l=Array.isArray||function(a){return Object.prototype.toString.call(a)==="[object Array]"}})(typeof exports!="undefined"?exports:Hogan),function(a){function g(a){a.n.substr(a.n.length-1)==="}"&&(a.n=a.n.substring(0,a.n.length-1))}function h(a){return a.trim?a.trim():a.replace(/^\s*|\s*$/g,"")}function i(a,b,c){if(b.charAt(c)!=a.charAt(0))return!1;for(var d=1,e=a.length;d<e;d++)if(b.charAt(c+d)!=a.charAt(d))return!1;return!0}function k(b,c,d,e){var f=[],g=null,h=null,i=null;h=d[d.length-1];while(b.length>0){i=b.shift();if(!(!h||h.tag!="<"||i.tag in j))throw new Error("Illegal content in < super tag.");if(a.tags[i.tag]<=a.tags.$||l(i,e))d.push(i),i.nodes=k(b,i.tag,d,e);else{if(i.tag=="/"){if(d.length===0)throw new Error("Closing tag without opener: /"+i.n);g=d.pop();if(i.n!=g.n&&!m(i.n,g.n,e))throw new Error("Nesting error: "+g.n+" vs. "+i.n);return g.end=i.i,f}i.tag=="\n"&&(i.last=b.length==0||b[0].tag=="\n")}f.push(i)}if(d.length>0)throw new Error("missing closing tag: "+d.pop().n);return f}function l(a,b){for(var c=0,d=b.length;c<d;c++)if(b[c].o==a.n)return a.tag="#",!0}function m(a,b,c){for(var d=0,e=c.length;d<e;d++)if(c[d].c==a&&c[d].o==b)return!0}function n(a){var b=[];for(var c in a)b.push('"'+q(c)+'": function(c,p,t,i) {'+a[c]+"}");return"{ "+b.join(",")+" }"}function o(a){var b=[];for(var c in a.partials)b.push('"'+q(c)+'":{name:"'+q(a.partials[c].name)+'", '+o(a.partials[c])+"}");return"partials: {"+b.join(",")+"}, subs: "+n(a.subs)}function q(a){return a.replace(f,"\\\\").replace(c,'\\"').replace(d,"\\n").replace(e,"\\r")}function r(a){return~a.indexOf(".")?"d":"f"}function s(a,b){var c="<"+(b.prefix||""),d=c+a.n+p++;return b.partials[d]={name:a.n,partials:{}},b.code+='t.b(t.rp("'+q(d)+'",c,p,"'+(a.indent||"")+'"));',d}function t(a,b){b.code+="t.b(t.t(t."+r(a.n)+'("'+q(a.n)+'",c,p,0)));'}function u(a){return"t.b("+a+");"}var b=/\S/,c=/\"/g,d=/\n/g,e=/\r/g,f=/\\/g;a.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},a.scan=function(d,e){function w(){p.length>0&&(q.push({tag:"_t",text:new String(p)}),p="")}function x(){var c=!0;for(var d=t;d<q.length;d++){c=a.tags[q[d].tag]<a.tags._v||q[d].tag=="_t"&&q[d].text.match(b)===null;if(!c)return!1}return c}function y(a,b){w();if(a&&x())for(var c=t,d;c<q.length;c++)q[c].text&&((d=q[c+1])&&d.tag==">"&&(d.indent=q[c].text.toString()),q.splice(c,1));else b||q.push({tag:"\n"});r=!1,t=q.length}function z(a,b){var c="="+v,d=a.indexOf(c,b),e=h(a.substring(a.indexOf("=",b)+1,d)).split(" ");return u=e[0],v=e[1],d+c.length-1}var f=d.length,j=0,k=1,l=2,m=j,n=null,o=null,p="",q=[],r=!1,s=0,t=0,u="{{",v="}}";e&&(e=e.split(" "),u=e[0],v=e[1]);for(s=0;s<f;s++)m==j?i(u,d,s)?(--s,w(),m=k):d.charAt(s)=="\n"?y(r):p+=d.charAt(s):m==k?(s+=u.length-1,o=a.tags[d.charAt(s+1)],n=o?d.charAt(s+1):"_v",n=="="?(s=z(d,s),m=j):(o&&s++,m=l),r=s):i(v,d,s)?(q.push({tag:n,n:h(p),otag:u,ctag:v,i:n=="/"?r-u.length:s+v.length}),p="",s+=v.length-1,m=j,n=="{"&&(v=="}}"?s++:g(q[q.length-1]))):p+=d.charAt(s);return y(r,!0),q};var j={_t:!0,"\n":!0,$:!0,"/":!0};a.stringify=function(b,c,d){return"{code: function (c,p,i) { "+a.wrapMain(b.code)+" },"+o(b)+"}"};var p=0;a.generate=function(b,c,d){p=0;var e={code:"",subs:{},partials:{}};return a.walk(b,e),d.asString?this.stringify(e,c,d):this.makeTemplate(e,c,d)},a.wrapMain=function(a){return'var t=this;t.b(i=i||"");'+a+"return t.fl();"},a.template=a.Template,a.makeTemplate=function(a,b,c){var d=this.makePartials(a);return d.code=new Function("c","p","i",this.wrapMain(a.code)),new this.template(d,b,this,c)},a.makePartials=function(a){var b,c={subs:{},partials:a.partials,name:a.name};for(b in c.partials)c.partials[b]=this.makePartials(c.partials[b]);for(b in a.subs)c.subs[b]=new Function("c","p","t","i",a.subs[b]);return c},a.codegen={"#":function(b,c){c.code+="if(t.s(t."+r(b.n)+'("'+q(b.n)+'",c,p,1),'+"c,p,0,"+b.i+","+b.end+',"'+b.otag+" "+b.ctag+'")){'+"t.rs(c,p,"+"function(c,p,t){",a.walk(b.nodes,c),c.code+="});c.pop();}"},"^":function(b,c){c.code+="if(!t.s(t."+r(b.n)+'("'+q(b.n)+'",c,p,1),c,p,1,0,0,"")){',a.walk(b.nodes,c),c.code+="};"},">":s,"<":function(b,c){var d={partials:{},code:"",subs:{},inPartial:!0};a.walk(b.nodes,d);var e=c.partials[s(b,c)];e.subs=d.subs,e.partials=d.partials},$:function(b,c){var d={subs:{},code:"",partials:c.partials,prefix:b.n};a.walk(b.nodes,d),c.subs[b.n]=d.code,c.inPartial||(c.code+='t.sub("'+q(b.n)+'",c,p,i);')},"\n":function(a,b){b.code+=u('"\\n"'+(a.last?"":" + i"))},_v:function(a,b){b.code+="t.b(t.v(t."+r(a.n)+'("'+q(a.n)+'",c,p,0)));'},_t:function(a,b){b.code+=u('"'+q(a.text)+'"')},"{":t,"&":t},a.walk=function(b,c){var d;for(var e=0,f=b.length;e<f;e++)d=a.codegen[b[e].tag],d&&d(b[e],c);return c},a.parse=function(a,b,c){return c=c||{},k(a,"",[],c.sectionTags||[])},a.cache={},a.cacheKey=function(a,b){return[a,!!b.asString,!!b.disableLambda].join("||")},a.compile=function(b,c){c=c||{};var d=a.cacheKey(b,c),e=this.cache[d];return e?e:(e=this.generate(this.parse(this.scan(b,c.delimiters),b,c),b,c),this.cache[d]=e)}}(typeof exports!="undefined"?exports:Hogan),function(){var a=this,b=a.Backbone,c=[],d=c.push,e=c.slice,f=c.splice,g;g="undefined"!=typeof exports?exports:a.Backbone={},g.VERSION="0.9.9";var h=a._;!h&&"undefined"!=typeof require&&(h=require("underscore")),g.$=a.jQuery||a.Zepto||a.ender,g.noConflict=function(){return a.Backbone=b,this},g.emulateHTTP=!1,g.emulateJSON=!1;var i=/\s+/,j=function(a,b,c,d){if(!c)return!0;if("object"==typeof c)for(var e in c)a[b].apply(a,[e,c[e]].concat(d));else{if(!i.test(c))return!0;c=c.split(i),e=0;for(var f=c.length;e<f;e++)a[b].apply(a,[c[e]].concat(d))}},k=function(a,b,c){var d,a=-1,e=b.length;switch(c.length){case 0:for(;++a<e;)(d=b[a]).callback.call(d.ctx);break;case 1:for(;++a<e;)(d=b[a]).callback.call(d.ctx,c[0]);break;case 2:for(;++a<e;)(d=b[a]).callback.call(d.ctx,c[0],c[1]);break;case 3:for(;++a<e;)(d=b[a]).callback.call(d.ctx,c[0],c[1],c[2]);break;default:for(;++a<e;)(d=b[a]).callback.apply(d.ctx,c)}},c=g.Events={on:function(a,b,c){return!j(this,"on",a,[b,c])||!b?this:(this._events||(this._events={}),(this._events[a]||(this._events[a]=[])).push({callback:b,context:c,ctx:c||this}),this)},once:function(a,b,c){if(!j(this,"once",a,[b,c])||!b)return this;var d=this,e=h.once(function(){d.off(a,e),b.apply(this,arguments)});return e._callback=b,this.on(a,e,c),this},off:function(a,b,c){var d,e,f,g,i,k,l,m;if(!this._events||!j(this,"off",a,[b,c]))return this;if(!a&&!b&&!c)return this._events={},this;g=a?[a]:h.keys(this._events),i=0;for(k=g.length;i<k;i++)if(a=g[i],d=this._events[a]){f=[];if(b||c){l=0;for(m=d.length;l<m;l++)e=d[l],(b&&b!==(e.callback._callback||e.callback)||c&&c!==e.context)&&f.push(e)}this._events[a]=f}return this},trigger:function(a){if(!this._events)return this;var b=e.call(arguments,1);if(!j(this,"trigger",a,b))return this;var c=this._events[a],d=this._events.all;return c&&k(this,c,b),d&&k(this,d,arguments),this},listenTo:function(a,b,c){var d=this._listeners||(this._listeners={}),e=a._listenerId||(a._listenerId=h.uniqueId("l"));return d[e]=a,a.on(b,c||this,this),this},stopListening:function(a,b,c){var d=this._listeners;if(d){if(a)a.off(b,c,this),!b&&!c&&delete d[a._listenerId];else{for(var e in d)d[e].off(null,null,this);this._listeners={}}return this}}};c.bind=c.on,c.unbind=c.off,h.extend(g,c);var l=g.Model=function(a,b){var c,d=a||{};this.cid=h.uniqueId("c"),this.changed={},this.attributes={},this._changes=[],b&&b.collection&&(this.collection=b.collection),b&&b.parse&&(d=this.parse(d)),(c=h.result(this,"defaults"))&&h.defaults(d,c),this.set(d,{silent:!0}),this._currentAttributes=h.clone(this.attributes),this._previousAttributes=h.clone(this.attributes),this.initialize.apply(this,arguments)};h.extend(l.prototype,c,{changed:null,idAttribute:"id",initialize:function(){},toJSON:function(){return h.clone(this.attributes)},sync:function(){return g.sync.apply(this,arguments)},get:function(a){return this.attributes[a]},escape:function(a){return h.escape(this.get(a))},has:function(a){return null!=this.get(a)},set:function(a,b,c){var d,e;if(null==a)return this;h.isObject(a)?(e=a,c=b):(e={})[a]=b;var a=c&&c.silent,f=c&&c.unset;if(!this._validate(e,c))return!1;this.idAttribute in e&&(this.id=e[this.idAttribute]);var g=this.attributes;for(d in e)b=e[d],f?delete g[d]:g[d]=b,this._changes.push(d,b);return this._hasComputed=!1,a||this.change(c),this},unset:function(a,b){return this.set(a,void 0,h.extend({},b,{unset:!0}))},clear:function(a){var b={},c;for(c in this.attributes)b[c]=void 0;return this.set(b,h.extend({},a,{unset:!0}))},fetch:function(a){a=a?h.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;return a.success=function(d){if(!b.set(b.parse(d),a))return!1;c&&c(b,d,a)},this.sync("read",this,a)},save:function(a,b,c){var d,e,f;null==a||h.isObject(a)?(d=a,c=b):null!=a&&((d={})[a]=b),c=c?h.clone(c):{};if(c.wait){if(d&&!this._validate(d,c))return!1;e=h.clone(this.attributes)}a=h.extend({},c,{silent:!0});if(d&&!this.set(d,c.wait?a:c)||!d&&!this._validate(null,c))return!1;var g=this,i=c.success;return c.success=function(a){f=!0;var b=g.parse(a);c.wait&&(b=h.extend(d||{},b));if(!g.set(b,c))return!1;i&&i(g,a,c)},b=this.isNew()?"create":c.patch?"patch":"update","patch"==b&&(c.attrs=d),b=this.sync(b,this,c),!f&&c.wait&&(this.clear(a),this.set(e,a)),b},destroy:function(a){var a=a?h.clone(a):{},b=this,c=a.success,d=function(){b.trigger("destroy",b,b.collection,a)};a.success=function(e){(a.wait||b.isNew())&&d(),c&&c(b,e,a)};if(this.isNew())return a.success(),!1;var e=this.sync("delete",this,a);return a.wait||d(),e},url:function(){var a=h.result(this,"urlRoot")||h.result(this.collection,"url")||B();return this.isNew()?a:a+("/"===a.charAt(a.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(a){return a},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(a){var b=this._changing;this._changing=!0;var c=this._computeChanges(!0);this._pending=!!c.length;for(var d=c.length-2;0<=d;d-=2)this.trigger("change:"+c[d],this,c[d+1],a);if(b)return this;for(;this._pending;)this._pending=!1,this.trigger("change",this,a),this._previousAttributes=h.clone(this.attributes);return this._changing=!1,this},hasChanged:function(a){return this._hasComputed||this._computeChanges(),null==a?!h.isEmpty(this.changed):h.has(this.changed,a)},changedAttributes:function(a){if(!a)return this.hasChanged()?h.clone(this.changed):!1;var b,c=!1,d=this._previousAttributes,e;for(e in a)h.isEqual(d[e],b=a[e])||((c||(c={}))[e]=b);return c},_computeChanges:function(a){this.changed={};for(var b={},c=[],d=this._currentAttributes,e=this._changes,f=e.length-2;0<=f;f-=2){var g=e[f],h=e[f+1];b[g]||(b[g]=!0,d[g]!==h&&(this.changed[g]=h,a&&(c.push(g,h),d[g]=h)))}return a&&(this._changes=[]),this._hasComputed=!0,c},previous:function(a){return null==a||!this._previousAttributes?null:this._previousAttributes[a]},previousAttributes:function(){return h.clone(this._previousAttributes)},_validate:function(a,b){if(!this.validate)return!0;var a=h.extend({},this.attributes,a),c=this.validate(a,b);return c?(b&&b.error&&b.error(this,c,b),this.trigger("error",this,c,b),!1):!0}});var m=g.Collection=function(a,b){b||(b={}),b.model&&(this.model=b.model),void 0!==b.comparator&&(this.comparator=b.comparator),this._reset(),this.initialize.apply(this,arguments),a&&this.reset(a,h.extend({silent:!0},b))};h.extend(m.prototype,c,{model:l,initialize:function(){},toJSON:function(a){return this.map(function(b){return b.toJSON(a)})},sync:function(){return g.sync.apply(this,arguments)},add:function(a,b){var c,e,g,i,j=b&&b.at,k=null==(b&&b.sort)?!0:b.sort,a=h.isArray(a)?a.slice():[a];for(c=a.length-1;0<=c;c--)(e=this._prepareModel(a[c],b))?(a[c]=e,(g=null!=e.id&&this._byId[e.id])||this._byCid[e.cid]?(b&&b.merge&&g&&(g.set(e.attributes,b),i=k),a.splice(c,1)):(e.on("all",this._onModelEvent,this),this._byCid[e.cid]=e,null!=e.id&&(this._byId[e.id]=e))):(this.trigger("error",this,a[c],b),a.splice(c,1));a.length&&(i=k),this.length+=a.length,c=[null!=j?j:this.models.length,0],d.apply(c,a),f.apply(this.models,c),i&&this.comparator&&null==j&&this.sort({silent:!0});if(b&&b.silent)return this;for(;e=a.shift();)e.trigger("add",e,this,b);return this},remove:function(a,b){var c,d,e,f;b||(b={}),a=h.isArray(a)?a.slice():[a],c=0;for(d=a.length;c<d;c++)if(f=this.get(a[c]))delete this._byId[f.id],delete this._byCid[f.cid],e=this.indexOf(f),this.models.splice(e,1),this.length--,b.silent||(b.index=e,f.trigger("remove",f,this,b)),this._removeReference(f);return this},push:function(a,b){return a=this._prepareModel(a,b),this.add(a,h.extend({at:this.length},b)),a},pop:function(a){var b=this.at(this.length-1);return this.remove(b,a),b},unshift:function(a,b){return a=this._prepareModel(a,b),this.add(a,h.extend({at:0},b)),a},shift:function(a){var b=this.at(0);return this.remove(b,a),b},slice:function(a,b){return this.models.slice(a,b)},get:function(a){return null==a?void 0:this._byId[null!=a.id?a.id:a]||this._byCid[a.cid||a]},at:function(a){return this.models[a]},where:function(a){return h.isEmpty(a)?[]:this.filter(function(b){for(var c in a)if(a[c]!==b.get(c))return!1;return!0})},sort:function(a){if(!this.comparator)throw Error("Cannot sort a set without a comparator");return h.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(h.bind(this.comparator,this)),(!a||!a.silent)&&this.trigger("sort",this,a),this},pluck:function(a){return h.invoke(this.models,"get",a)},update:function(a,b){var c,d,e,f,g=[],i=[],j={},k=this.model.prototype.idAttribute,b=h.extend({add:!0,merge:!0,remove:!0},b);b.parse&&(a=this.parse(a)),h.isArray(a)||(a=a?[a]:[]);if(b.add&&!b.remove)return this
7
- .add(a,b);d=0;for(e=a.length;d<e;d++)c=a[d],f=this.get(c.id||c.cid||c[k]),b.remove&&f&&(j[f.cid]=!0),(b.add&&!f||b.merge&&f)&&g.push(c);if(b.remove){d=0;for(e=this.models.length;d<e;d++)c=this.models[d],j[c.cid]||i.push(c)}return i.length&&this.remove(i,b),g.length&&this.add(g,b),this},reset:function(a,b){b||(b={}),b.parse&&(a=this.parse(a));for(var c=0,d=this.models.length;c<d;c++)this._removeReference(this.models[c]);return b.previousModels=this.models,this._reset(),a&&this.add(a,h.extend({silent:!0},b)),b.silent||this.trigger("reset",this,b),this},fetch:function(a){a=a?h.clone(a):{},void 0===a.parse&&(a.parse=!0);var b=this,c=a.success;return a.success=function(d){b[a.update?"update":"reset"](d,a),c&&c(b,d,a)},this.sync("read",this,a)},create:function(a,b){var c=this,b=b?h.clone(b):{},a=this._prepareModel(a,b);if(!a)return!1;b.wait||c.add(a,b);var d=b.success;return b.success=function(a,b,e){e.wait&&c.add(a,e),d&&d(a,b,e)},a.save(null,b),a},parse:function(a){return a},clone:function(){return new this.constructor(this.models)},chain:function(){return h(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(a,b){if(a instanceof l)return a.collection||(a.collection=this),a;b||(b={}),b.collection=this;var c=new this.model(a,b);return c._validate(a,b)?c:!1},_removeReference:function(a){this===a.collection&&delete a.collection,a.off("all",this._onModelEvent,this)},_onModelEvent:function(a,b,c,d){("add"===a||"remove"===a)&&c!==this||("destroy"===a&&this.remove(b,d),b&&a==="change:"+b.idAttribute&&(delete this._byId[b.previous(b.idAttribute)],null!=b.id&&(this._byId[b.id]=b)),this.trigger.apply(this,arguments))}}),h.each("forEach each map collect reduce foldl inject reduceRight foldr find detect filter select reject every all some any include contains invoke max min sortedIndex toArray size first head take initial rest tail last without indexOf shuffle lastIndexOf isEmpty".split(" "),function(a){m.prototype[a]=function(){var b=e.call(arguments);return b.unshift(this.models),h[a].apply(h,b)}}),h.each(["groupBy","countBy","sortBy"],function(a){m.prototype[a]=function(b,c){var d=h.isFunction(b)?b:function(a){return a.get(b)};return h[a](this.models,d,c)}});var n=g.Router=function(a){a||(a={}),a.routes&&(this.routes=a.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},o=/\((.*?)\)/g,p=/:\w+/g,q=/\*\w+/g,r=/[\-{}\[\]+?.,\\\^$|#\s]/g;h.extend(n.prototype,c,{initialize:function(){},route:function(a,b,c){return h.isRegExp(a)||(a=this._routeToRegExp(a)),c||(c=this[b]),g.history.route(a,h.bind(function(d){d=this._extractParameters(a,d),c&&c.apply(this,d),this.trigger.apply(this,["route:"+b].concat(d)),g.history.trigger("route",this,b,d)},this)),this},navigate:function(a,b){return g.history.navigate(a,b),this},_bindRoutes:function(){if(this.routes)for(var a,b=h.keys(this.routes);null!=(a=b.pop());)this.route(a,this.routes[a])},_routeToRegExp:function(a){return a=a.replace(r,"\\$&").replace(o,"(?:$1)?").replace(p,"([^/]+)").replace(q,"(.*?)"),RegExp("^"+a+"$")},_extractParameters:function(a,b){return a.exec(b).slice(1)}});var s=g.History=function(){this.handlers=[],h.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},t=/^[#\/]|\s+$/g,u=/^\/+|\/+$/g,v=/msie [\w.]+/,w=/\/$/;s.started=!1,h.extend(s.prototype,c,{interval:50,getHash:function(a){return(a=(a||this).location.href.match(/#(.*)$/))?a[1]:""},getFragment:function(a,b){if(null==a)if(this._hasPushState||!this._wantsHashChange||b){var a=this.location.pathname,c=this.root.replace(w,"");a.indexOf(c)||(a=a.substr(c.length))}else a=this.getHash();return a.replace(t,"")},start:function(a){if(s.started)throw Error("Backbone.history has already been started");s.started=!0,this.options=h.extend({},{root:"/"},this.options,a),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.options.pushState||!this.history||!this.history.pushState);var a=this.getFragment(),b=document.documentMode,b=v.exec(navigator.userAgent.toLowerCase())&&(!b||7>=b);this.root=("/"+this.root+"/").replace(u,"/"),b&&this._wantsHashChange&&(this.iframe=g.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(a)),this._hasPushState?g.$(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!b?g.$(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=a,a=this.location,b=a.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!b)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&b&&a.hash&&(this.fragment=this.getHash().replace(t,""),this.history.replaceState({},document.title,this.root+this.fragment+a.search));if(!this.options.silent)return this.loadUrl()},stop:function(){g.$(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),s.started=!1},route:function(a,b){this.handlers.unshift({route:a,callback:b})},checkUrl:function(){var a=this.getFragment();a===this.fragment&&this.iframe&&(a=this.getFragment(this.getHash(this.iframe)));if(a===this.fragment)return!1;this.iframe&&this.navigate(a),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(a){var b=this.fragment=this.getFragment(a);return h.any(this.handlers,function(a){if(a.route.test(b))return a.callback(b),!0})},navigate:function(a,b){if(!s.started)return!1;if(!b||!0===b)b={trigger:b};a=this.getFragment(a||"");if(this.fragment!==a){this.fragment=a;var c=this.root+a;if(this._hasPushState)this.history[b.replace?"replaceState":"pushState"]({},document.title,c);else{if(!this._wantsHashChange)return this.location.assign(c);this._updateHash(this.location,a,b.replace),this.iframe&&a!==this.getFragment(this.getHash(this.iframe))&&(b.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,a,b.replace))}b.trigger&&this.loadUrl(a)}},_updateHash:function(a,b,c){c?(c=a.href.replace(/(javascript:|#).*$/,""),a.replace(c+"#"+b)):a.hash="#"+b}}),g.history=new s;var x=g.View=function(a){this.cid=h.uniqueId("view"),this._configure(a||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},y=/^(\S+)\s*(.*)$/,z="model collection el id attributes className tagName events".split(" ");h.extend(x.prototype,c,{tagName:"div",$:function(a){return this.$el.find(a)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},make:function(a,b,c){return a=document.createElement(a),b&&g.$(a).attr(b),null!=c&&g.$(a).html(c),a},setElement:function(a,b){return this.$el&&this.undelegateEvents(),this.$el=a instanceof g.$?a:g.$(a),this.el=this.$el[0],!1!==b&&this.delegateEvents(),this},delegateEvents:function(a){if(a||(a=h.result(this,"events"))){this.undelegateEvents();for(var b in a){var c=a[b];h.isFunction(c)||(c=this[a[b]]);if(!c)throw Error('Method "'+a[b]+'" does not exist');var d=b.match(y),e=d[1],d=d[2],c=h.bind(c,this),e=e+(".delegateEvents"+this.cid);""===d?this.$el.bind(e,c):this.$el.delegate(d,e,c)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(a){this.options&&(a=h.extend({},h.result(this,"options"),a)),h.extend(this,h.pick(a,z)),this.options=a},_ensureElement:function(){if(this.el)this.setElement(h.result(this,"el"),!1);else{var a=h.extend({},h.result(this,"attributes"));this.id&&(a.id=h.result(this,"id")),this.className&&(a["class"]=h.result(this,"className")),this.setElement(this.make(h.result(this,"tagName"),a),!1)}}});var A={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};g.sync=function(a,b,c){var d=A[a];h.defaults(c||(c={}),{emulateHTTP:g.emulateHTTP,emulateJSON:g.emulateJSON});var e={type:d,dataType:"json"};c.url||(e.url=h.result(b,"url")||B()),null==c.data&&b&&("create"===a||"update"===a||"patch"===a)&&(e.contentType="application/json",e.data=JSON.stringify(c.attrs||b.toJSON(c))),c.emulateJSON&&(e.contentType="application/x-www-form-urlencoded",e.data=e.data?{model:e.data}:{});if(c.emulateHTTP&&("PUT"===d||"DELETE"===d||"PATCH"===d)){e.type="POST",c.emulateJSON&&(e.data._method=d);var f=c.beforeSend;c.beforeSend=function(a){a.setRequestHeader("X-HTTP-Method-Override",d);if(f)return f.apply(this,arguments)}}"GET"!==e.type&&!c.emulateJSON&&(e.processData=!1);var i=c.success;c.success=function(a,d,e){i&&i(a,d,e),b.trigger("sync",b,a,c)};var j=c.error;return c.error=function(a){j&&j(b,a,c),b.trigger("error",b,a,c)},a=g.ajax(h.extend(e,c)),b.trigger("request",b,a,c),a},g.ajax=function(){return g.$.ajax.apply(g.$,arguments)},l.extend=m.extend=n.extend=x.extend=s.extend=function(a,b){var c=this,d;d=a&&h.has(a,"constructor")?a.constructor:function(){c.apply(this,arguments)},h.extend(d,c,b);var e=function(){this.constructor=d};return e.prototype=c.prototype,d.prototype=new e,a&&h.extend(d.prototype,a),d.__super__=c.prototype,d};var B=function(){throw Error('A "url" property or function must be specified')}}.call(this);var __slice=[].slice,__hasProp={}.hasOwnProperty,__indexOf=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};(function(a){return a("backbone-query",function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;return u=a("underscore"),c=a("backbone"),e=function(a,b){var c,d,e,f;f=[];for(d=0,e=a.length;d<e;d++)c=a[d],b(c)&&f.push(c);return f},p=function(a,b){var c,d,e,f;f=[];for(d=0,e=a.length;d<e;d++)c=a[d],b(c)||f.push(c);return f},d=function(a,b){var c,d,e;for(d=0,e=a.length;d<e;d++){c=a[d];if(b(c))return!0}return!1},j=function(){var a,b,c,d,e;a=1<=arguments.length?__slice.call(arguments,0):[],d={},b=d;while(a.length)c=a.shift(),e=a.length===1?a.shift():{},b=b[c]=e;return d},h=function(a){return u.isRegExp(a)?"$regex":u.isDate(a)?"$date":u.isObject(a)&&!u.isArray(a)?"object":u.isArray(a)?"array":u.isString(a)?"string":u.isNumber(a)?"number":u.isBoolean(a)?"boolean":u.isFunction(a)?"function":!1},m=function(a){var b,c,d,e,f,g,i,k,n,o,p,q,r;u.isArray(a)?g=a:g=function(){var c;c=[];for(b in a){if(!__hasProp.call(a,b))continue;n=a[b],c.push(j(b,n))}return c}(),r=[];for(p=0,q=g.length;p<q;p++){f=g[p];for(b in f){if(!__hasProp.call(f,b))continue;i=f[b],c={key:b},d=h(i);switch(d){case"$regex":case"$date":c.type=d,c.value=i;break;case"object":if(b==="$and"||b==="$or"||b==="$nor"||b==="$not")c.value=m(i),c.type=b,c.key=null;else for(k in i){o=i[k];if(t(k,o)){c.type=k;switch(k){case"$elemMatch":case"$relationMatch":c.value=l(o);break;case"$computed":e=j(b,o),c.value=m(e);break;default:c.value=o}}}break;default:c.type="$equal",c.value=i}c.type==="$equal"&&(d==="object"||d==="array")&&(c.type="$oEqual")}r.push(c)}return r},t=function(a,b){switch(a){case"$in":case"$nin":case"$all":case"$any":return u(b).isArray();case"$size":return u(b).isNumber();case"$regex":return u(b).isRegExp();case"$like":case"$likeI":return u(b).isString();case"$between":return u(b).isArray()&&b.length===2;case"$cb":return u(b).isFunction();default:return!0}},s=function(a,b){switch(a){case"$like":case"$likeI":case"$regex":return u(b).isString();case"$contains":case"$all":case"$any":case"$elemMatch":return u(b).isArray();case"$size":return u(b).isArray()||u(b).isString();case"$in":case"$nin":return b!=null;case"$relationMatch":return b!=null&&b.models;default:return!0}},n=function(a,b,c,e,f){switch(a){case"$equal":return u(c).isArray()?__indexOf.call(c,b)>=0:c===b;case"$oEqual":return u(c).isEqual(b);case"$contains":return __indexOf.call(c,b)>=0;case"$ne":return c!==b;case"$lt":return c<b;case"$gt":return c>b;case"$lte":return c<=b;case"$gte":return c>=b;case"$between":return b[0]<c&&c<b[1];case"$in":return __indexOf.call(b,c)>=0;case"$nin":return __indexOf.call(b,c)<0;case"$all":return u(b).all(function(a){return __indexOf.call(c,a)>=0});case"$any":return u(c).any(function(a){return __indexOf.call(b,a)>=0});case"$size":return c.length===b;case"$exists":case"$has":return c!=null===b;case"$like":return c.indexOf(b)!==-1;case"$likeI":return c.toLowerCase().indexOf(b.toLowerCase())!==-1;case"$regex":return b.test(c);case"$cb":return b.call(e,c);case"$elemMatch":return q(c,b,"elemMatch").length>0;case"$relationMatch":return q(c.models,b,"relationMatch").length>0;case"$computed":return i([e],b,!1,d,"computed");case"$and":case"$or":case"$nor":case"$not":return o[a]([e],b).length===1;default:return!1}},i=function(a,b,c,d,e){return e==null&&(e=!1),d(a,function(a){var d,f,g,h,i;for(h=0,i=b.length;h<i;h++){f=b[h],d=function(){switch(e){case"elemMatch":return a[f.key];case"computed":return a[f.key]();default:return a.get(f.key)}}(),g=s(f.type,d),g&&(g=n(f.type,f.value,d,a,f.key));if(c===g)return c}return!c})},o={$and:function(a,b,c){return i(a,b,!1,e,c)},$or:function(a,b,c){return i(a,b,!0,e,c)},$nor:function(a,b,c){return i(a,b,!0,p,c)},$not:function(a,b,c){return i(a,b,!1,p,c)}},l=function(a){var b,c,d,e,f,g;e=u(a).keys(),b=["$and","$not","$or","$nor"],c=u.intersection(b,e);if(c.length===0)return[{type:"$and",parsedQuery:m(a)}];if(c.length!==e.length){__indexOf.call(c,"$and")<0&&(a.$and={},c.unshift("$and"));for(d in a){if(!__hasProp.call(a,d))continue;g=a[d];if(!(__indexOf.call(b,d)<0))continue;a.$and[d]=g,delete a[d]}}return function(){var b,d,e;e=[];for(b=0,d=c.length;b<d;b++)f=c[b],e.push({type:f,parsedQuery:m(a[f])});return e}()},q=function(a,b,c){var d;return c||(b=l(b)),d=function(a,b){return o[b.type](a,b.parsedQuery,c)},u.reduce(b,d,a)},f=function(a,b,c){var d,e,f,h;return f=JSON.stringify(b),d=(h=a._queryCache)!=null?h:a._queryCache={},e=d[f],e||(e=g(a,b,c),d[f]=e),e},g=function(a,b,c){var d;return d=q(a.models,b),c.sortBy&&(d=r(d,c)),d},r=function(a,b){return u(b.sortBy).isString()?a=u(a).sortBy(function(a){return a.get(b.sortBy)}):u(b.sortBy).isFunction()&&(a=u(a).sortBy(b.sortBy)),b.order==="desc"&&(a=a.reverse()),a},k=function(a,b){var c,d,e,f;return b.offset?e=b.offset:b.page?e=(b.page-1)*b.limit:e=0,c=e+b.limit,d=a.slice(e,c),b.pager&&u.isFunction(b.pager)&&(f=Math.ceil(a.length/b.limit),b.pager(f,d)),d},c.QueryCollection=c.Collection.extend({query:function(a,b){var c;return b==null&&(b={}),b.cache?c=f(this,a,b):c=g(this,a,b),b.limit&&(c=k(c,b)),c},findOne:function(a){return this.query(a)[0]},whereBy:function(a,b){return b==null&&(b={}),new this.constructor(this.query(a,b))},resetQueryCache:function(){return this._queryCache={}}}),b.QueryCollection=c.QueryCollection})}).call(this,typeof define=="function"&&define.amd?define:function(a,b){typeof exports!="undefined"?b(function(a){return require(a)},exports):b(function(a){return this[a==="underscore"?"_":"Backbone"]},{})}),!function(a){a(function(){a.support.transition=function(){var a=function(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},c;for(c in b)if(a.style[c]!==undefined)return b[c]}();return a&&{end:a}}()})}(window.jQuery),!function(a){var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this,c=a.Event("show");this.$element.trigger(c);if(this.isShown||c.isDefaultPrevented())return;a("body").addClass("modal-open"),this.isShown=!0,this.escape(),this.backdrop(function(){var c=a.support.transition&&b.$element.hasClass("fade");b.$element.parent().length||b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in").attr("aria-hidden",!1).focus(),b.enforceFocus(),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();var c=this;b=a.Event("hide"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,a("body").removeClass("modal-open"),this.escape(),a(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),a.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal()},enforceFocus:function(){var b=this;a(document).on("focusin.modal",function(a){b.$element[0]!==a.target&&!b.$element.has(a.target).length&&b.$element.focus()})},escape:function(){var a=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(b){b.which==27&&a.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),b.hideModal()},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),b.hideModal()})},hideModal:function(a){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(this.removeBackdrop,this)):this.removeBackdrop()):b&&b()}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f).one("hide",function(){c.focus()})})})}(window.jQuery),!function(a){function b(){a(d).each(function(){c(a(this)).removeClass("open")})}function c(b){var c=b.attr("data-target"),d;return c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,"")),d=a(c),d.length||(d=b.parent()),d}var d="[data-toggle=dropdown]",e=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};e.prototype={constructor:e,toggle:function(d){var e=a(this),f,g;if(e.is(".disabled, :disabled"))return;return f=c(e),g=f.hasClass("open"),b(),g||(f.toggleClass("open"),e.focus()),!1},keydown:function(b){var d,e,f,g,h,i;if(!/(38|40|27)/.test(b.keyCode))return;d=a(this),b.preventDefault(),b.stopPropagation();if(d.is(".disabled, :disabled"))return;g=c(d),h=g.hasClass("open");if(!h||h&&b.keyCode==27)return d.click();e=a("[role=menu] li:not(.divider) a",g);if(!e.length)return;i=e.index(e.filter(":focus")),b.keyCode==38&&i>0&&i--,b.keyCode==40&&i<e.length-1&&i++,~i||(i=0),e.eq(i).focus()}},a.fn.dropdown=function(b){return this.each(function(){var c=a(this),d=c.data("dropdown");d||c.data("dropdown",d=new e(this)),typeof b=="string"&&d[b].call(c)})},a.fn.dropdown.Constructor=e,a(function(){a("html").on("click.dropdown.data-api touchstart.dropdown.data-api",b),a("body").on("click.dropdown touchstart.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.dropdown.data-api touchstart.dropdown.data-api",d,e.prototype.toggle).on("keydown.dropdown.data-api touchstart.dropdown.data-api",d+", [role=menu]",e.prototype.keydown)})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll-spy.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body"),this.refresh(),this.process()}b.prototype={constructor:b,refresh:function(){var b=this,c;this.offsets=a([]),this.targets=a([]),c=this.$body.find(this.selector).map(function(){var b=a(this),c=b.data("target")||b.attr("href"),d=/^#\w/.test(c)&&a(c);return d&&d.length&&[[d.position().top,c]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},activate:function(b){var c,d;this.activeTarget=b,a(this.selector).parent(".active").removeClass("active"),d=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',c=a(d).parent("li").addClass("active"),c.parent(".dropdown-menu").length&&(c=c.closest("li.dropdown").addClass("active")),c.trigger("activate")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f,g;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],g=a.Event("show",{relatedTarget:e}),b.trigger(g);if(g.isDefaultPrevented())return;f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one(a.support.transition.end,e):e(),f.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger=="click"?this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this)):this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f+"."+this.type,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);if(!c.options.delay||!c.options.delay.show)return c.show();clearTimeout(this.timeout),c.hoverState="in",this.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);this.timeout&&clearTimeout(this.timeout);if(!c.options.delay||!c.options.delay.hide)return c.hide();c.hoverState="out",this.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},hide:function(){function b(){var b=setTimeout(function(){d.off(a.support.transition.end).remove()},500);d.one(a.support.transition.end,function(){clearTimeout(b),d.remove()})}var c=this,d=this.tip();return d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?b():d.remove(),this},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover",title:"",delay:0,html:!0}}(window.jQuery),!function(a){var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content > *")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){var b=function(b,c){this.options=a.extend({},a.fn.affix.defaults,c),this.$window=a(window).on("scroll.affix.data-api",a.proxy(this.checkPosition,this)),this.$element=a(b),this.checkPosition()};b.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var b=a(document).height(),c=this.$window.scrollTop(),d=this.$element.offset(),e=this.options.offset,f=e.bottom,g=e.top,h="affix affix-top affix-bottom",i;typeof e!="object"&&(f=g=e),typeof g=="function"&&(g=e.top()),typeof f=="function"&&(f=e.bottom()),i=this.unpin!=null&&c+this.unpin<=d.top?!1:f!=null&&d.top+this.$element.height()>=b-f?"bottom":g!=null&&c<=g?"top":!1;if(this.affixed===i)return;this.affixed=i,this.unpin=i=="bottom"?d.top-c:null,this.$element.removeClass(h).addClass("affix"+(i?"-"+i:""))},a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("affix"),f=typeof c=="object"&&c;e||d.data("affix",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.defaults={offset:0},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery),!function(a){var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function c(){f.trigger("closed").remove()}var d=a(this),e=d.attr("data-target"),f;e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close"));if(b.isDefaultPrevented())return;f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.on(a.support.transition.end,c):c()},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b,c,d,e;if(this.transitioning)return;b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find("> .accordion-group > .in");if(d&&d.length){e=d.data("collapse");if(e&&e.transitioning)return;d.collapse("hide"),e||d.data("collapse",null)}this.$element[b](0),this.transition("addClass",a.Event("show"),"shown"),a.support.transition&&this.$element[b](this.$element[0][c])},hide:function(){var b;if(this.transitioning)return;b=this.dimension(),this.reset(this.$element[b]()),this.transition("removeClass",a.Event("hide"),"hidden"),this.$element[b](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a!==null?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c.type=="show"&&e.reset
8
- (),e.transitioning=0,e.$element.trigger(d)};this.$element.trigger(c);if(c.isDefaultPrevented())return;this.transitioning=1,this.$element[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();c[a(e).hasClass("in")?"addClass":"removeClass"]("collapsed"),a(e).collapse(f)})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=c,this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(b){return b||(this.paused=!1),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},to:function(b){var c=this.$element.find(".item.active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle()),clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this,j=a.Event("slide",{relatedTarget:e[0]});this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=a.extend({},a.fn.carousel.defaults,typeof c=="object"&&c),g=typeof c=="string"?c:f.slide;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):g?e[g]():f.interval&&e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(a)).change(),this.hide()},updater:function(a){return a},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(c=a.isFunction(this.source)?this.source(this.query,a.proxy(this.process,this)):this.source,c?this.process(c):this)},process:function(b){var c=this;return b=a.grep(b,function(a){return c.matcher(a)}),b=this.sorter(b),b.length?this.render(b.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){var b=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return a.replace(new RegExp("("+b+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.chrome||a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keydown,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},move:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()},keydown:function(b){this.suppressKeyPressRepeat=!~a.inArray(b.keyCode,[40,38,9,13,27]),this.move(b)},keypress:function(a){if(this.suppressKeyPressRepeat)return;this.move(a)},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery),function(a){function b(a,b){var c=a.length;while(c--)if(a[c]===b)return c;return-1}function c(a,c){var d,e,g,h,i;d=a.keyCode,b(u,d)==-1&&u.push(d);if(d==93||d==224)d=91;if(d in q){q[d]=!0;for(g in s)s[g]==d&&(f[g]=!0);return}if(!f.filter.call(this,a))return;if(!(d in p))return;for(h=0;h<p[d].length;h++){e=p[d][h];if(e.scope==c||e.scope=="all"){i=e.mods.length>0;for(g in q)if(!q[g]&&b(e.mods,+g)>-1||q[g]&&b(e.mods,+g)==-1)i=!1;(e.mods.length==0&&!q[16]&&!q[18]&&!q[17]&&!q[91]||i)&&e.method(a,e)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0))}}}function d(a){var c=a.keyCode,d,e=b(u,c);e>=0&&u.splice(e,1);if(c==93||c==224)c=91;if(c in q){q[c]=!1;for(d in s)s[d]==c&&(f[d]=!1)}}function e(){for(o in q)q[o]=!1;for(o in s)f[o]=!1}function f(a,b,c){var d,e,f,g;c===undefined&&(c=b,b="all"),a=a.replace(/\s/g,""),d=a.split(","),d[d.length-1]==""&&(d[d.length-2]+=",");for(f=0;f<d.length;f++){e=[],a=d[f].split("+");if(a.length>1){e=a.slice(0,a.length-1);for(g=0;g<e.length;g++)e[g]=s[e[g]];a=[a[a.length-1]]}a=a[0],a=t[a]||a.toUpperCase().charCodeAt(0),a in p||(p[a]=[]),p[a].push({shortcut:d[f],scope:b,method:c,key:d[f],mods:e})}}function g(a){if(typeof a=="string"){if(a.length!=1)return!1;a=a.toUpperCase().charCodeAt(0)}return b(u,a)!=-1}function h(){return u}function i(a){var b=(a.target||a.srcElement).tagName;return b!="INPUT"&&b!="SELECT"&&b!="TEXTAREA"}function j(a){r=a||"all"}function k(){return r||"all"}function l(a){var b,c,d;for(b in p){c=p[b];for(d=0;d<c.length;)c[d].scope===a?c.splice(d,1):d++}}function m(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,function(){c(window.event)})}function n(){var b=a.key;return a.key=v,b}var o,p={},q={16:!1,18:!1,17:!1,91:!1},r="all",s={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},t={backspace:8,tab:9,clear:12,enter:13,"return":13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,"delete":46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},u=[];for(o=1;o<20;o++)s["f"+o]=111+o;for(o in s)f[o]=!1;m(document,"keydown",function(a){c(a,r)}),m(document,"keyup",d),m(window,"focus",e);var v=a.key;a.key=f,a.key.setScope=j,a.key.getScope=k,a.key.deleteScope=l,a.key.filter=i,a.key.isPressed=g,a.key.getPressedKeyCodes=h,a.key.noConflict=n,typeof module!="undefined"&&(module.exports=key)}(this),function(){}.call(this);(function(){}).call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/bootstrap_form_controls"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="btn-group form-actions">\n <a class="btn btn-primary submit-button">\n <i class="icon icon-ok icon-white"></i>\n Save Changes\n </a>\n <a class="btn reset-button cancel-button">\n <i class="icon icon-remove"></i>\n Cancel\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/collection_loader_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="progress-modal" class="modal" style="display: none">\n <div class="progress progress-info progress-striped active">\n <div class="bar" style="width:0%;"></div>\n </div>\n <div class="message">Initializing...</div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/form_alert"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="',className,'">\n <a class="close" href="#" data-dismiss="alert">x</a>\n ',message,"\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/grid_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-g-view-wrapper">\n <div class="g-view-header"></div>\n <div class="luca-ui-g-view-body">\n <table class="luca-ui-g-view scrollable-table" width="100%" cellpadding=0 cellspacing=0>\n <thead class="fixed"></thead>\n <tbody class="scrollable"></tbody>\n <tfoot></tfoot>\n </table>\n </div>\n <div class="luca-ui-g-view-header"></div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/grid_view_empty_text"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="empty-text empty-text-wrapper">\n <p>',text,"</p>\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/load_mask"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="load-mask">\n <div class="progress progress-striped active">\n <div class="bar" style="width:0%"></div>\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/nav_bar"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="navbar-inner">\n <div class="luca-ui-navbar-body">\n <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n <span class="icon-bar"></span>\n </button>\n\n <a class="brand" href="#">Set @brand</a>\n \n <div class="nav-collapse collapse">\n <ul class="nav">\n <li class="active">\n <a href="#">Home</a>\n </li>\n </ul>\n </div>\n </div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/pagination"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="pagination">\n <a class="btn previous">\n <i class="icon icon-chevron-left"></i>\n </a>\n <div class="pagination-group">\n </div>\n <a class="btn next">\n <i class="icon icon-chevron-right"></i>\n </a>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/components/table_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<thead></thead>\n<tbody class="table-body"></tbody>\n<tfoot></tfoot>\n<caption></caption>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/containers/basic"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div id="',id,'" class="',classes,'" style="',style,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/containers/tab_selector_container"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{}){__p.push('<div id="',cid,'-tab-selector" class="tab-selector-container">\n <ul id="',cid,'-tabs-nav" class="nav nav-tabs">\n ');for(var i=0;i<components.length;i++){__p.push("\n ");var component=components[i];__p.push('\n <li class="tab-selector" data-target="',i,'">\n <a data-target="',i,'">\n ',component.title,"\n </a>\n </li>\n ")}__p.push("\n </ul>\n</div>\n")}return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/containers/tab_view"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<ul id="',cid,'-tabs-selector" class="nav nav-tabs"></ul>\n<div id="',cid,'-tab-view-content" class="tab-content"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/containers/toolbar_wrapper"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="luca-ui-toolbar-wrapper" id="',id,'"></div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/button_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label>&nbsp;</label>\n<input style="',inputStyles,'" class="btn ',input_class,'" value="',input_value,'" type="',input_type,'" id="<%= input_id" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/button_field_link"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<a class="btn ',input_class,'">\n '),icon_class.length&&__p.push('\n <i class="',icon_class,'"></i>\n ',input_value,"\n "),__p.push("\n</a>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/checkbox_array"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<div class="control-group">\n <label for="',input_id,'"><%= label =>\n <div class="controls"><div>\n</div>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/checkbox_array_item"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n <input id="',input_id,'" type="checkbox" name="',input_name,'" value="',value,'" />\n</label>\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/checkbox_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="checkbox" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/file_upload_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n <input type="file" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n</label>\n\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/hidden_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(' <input type="hidden" name="',input_name,'" value="',input_value,'" style="',inputStyles,'" />\n');return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/select_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <select name="',input_name,'" value="',input_value,'" style="',inputStyles,'" ></select>\n '),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/text_area_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push('<label for="',input_id,'">\n ',label,'\n</label>\n<div class="controls">\n <textarea placeholder="',placeHolder,'" name="',input_name,'" style="',inputStyles,'" >',input_value,"</textarea>\n "),helperText&&__p.push('\n <p class="helper-text help-block">\n ',helperText,"\n </p>\n "),__p.push("\n</div>\n");return __p.join("")}}.call(this),function(){this.JST||(this.JST={}),this.JST["luca/templates/fields/text_field"]=function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments)};with(obj||{})__p.push(""),(typeof label!="undefined"&&typeof hideLabel!="undefined"&&!hideLabel||typeof hideLabel=="undefined")&&__p.push('\n<label class="control-label" for="',input_id,'">',label,"</label>\n"),__p.push('\n\n<div class="controls">\n'),typeof addOn!="undefined"&&__p.push('\n <span class="add-on">',addOn,"</span>\n"),__p.push('\n<input type="text" placeholder="',placeHolder,'" name="',input_name,'" style="',inputStyles,'" value="',input_value,'" />\n'),helperText&&__p.push('\n<p class="helper-text help-block">\n ',helperText,"\n</p>\n"),__p.push("\n\n</div>\n");return __p.join("")}}.call(this),function(){var a,b,c=[].slice;b=function(){var a,b,d,e,f;d=arguments[0],a=2<=arguments.length?c.call(arguments,1):[];if(arguments.length===0)return(f=_(Luca.Application.instances).values())!=null?f[0]:void 0;if(_.isString(d)&&(e=Luca.cache(d)))return e;if(_.isString(d)&&(e=Luca.find(d)))return e;if(_.isString(d)&&(e=Luca.registry.find(d)))return e;if(d instanceof jQuery&&(e=Luca.find(d)))return e;if(_.isObject(d)&&d.ctype!=null)return Luca.util.lazyComponent(d);if(_.isFunction(b=_(a).last()))return b()},(window||global).Luca=function(){return b.apply(this,arguments)},Luca.VERSION="0.9.9",_.extend(Luca,{core:{},collections:{},containers:{},components:{},models:{},concerns:{},util:{},fields:{},registry:{},options:{},config:{},logger:function(a){return function(){var b;return b=1<=arguments.length?c.call(arguments,0):[],b.unshift(a),console.log(this,b)}},getHelper:function(){return function(){return b.apply(this,arguments)}}}),_.extend(Luca,Backbone.Events),Luca.setupCollectionSpace=function(a){var b,c;return a==null&&(a={}),b=a.baseParams,c=a.modelBootstrap,b!=null?Luca.Collection.baseParams(b):Luca.warn("You should remember to set the base params for Luca.Collection class. You can do this by defining a property or function on Luca.config.baseParams"),c!=null?Luca.Collection.bootstrap(c):Luca.warn("You should remember to set the model bootstrap location for Luca.Collection. You can do this by defining a property or function on Luca.config.modelBootstrap")},Luca.initialize=function(a,b){var c,d;return b==null&&(b={}),Luca.namespace=a.toLowerCase(),c=Luca.util.resolve(a,window||global)||{},_.defaults(c,{views:{},collections:{},models:{},components:{},lib:{},util:{},concerns:{},register:function(){return Luca.register.apply(this,arguments)},onReady:function(){return Luca.onReady.apply(this,arguments)},getApplication:function(){var a;return(a=Luca.getApplication)!=null?a.apply(this,arguments):void 0},getCollectionManager:function(){var a;return(a=Luca.CollectionManager.get)!=null?a.apply(this,arguments):void 0},route:Luca.routeHelper}),d={},d[a]=_.defaults(Luca.getHelper(),c),_.extend(Luca.config,b),_.extend(window||global,d),Luca.lastNamespace=a,Luca.concern.namespace(""+a+".concerns"),Luca.registry.namespace(""+a+".views"),Luca.Collection.namespace(""+a+".collections"),Luca.on("ready",function(){return Luca.setupCollectionSpace(b)})},Luca.onReady=function(a){return Luca.define.close(),Luca.trigger("ready"),$(function(){return a.apply(this,arguments)})},Luca.find=function(a){return Luca($(a).data("luca-id"))},Luca.supportsEvents=Luca.supportsBackboneEvents=function(a){return Luca.isComponent(a)||_.isFunction(a!=null?a.trigger:void 0)||_.isFunction(a!=null?a.bind:void 0)},Luca.isComponent=function(a){return Luca.isBackboneModel(a)||Luca.isBackboneView(a)||Luca.isBackboneCollection(a)},Luca.isComponentPrototype=function(a){return Luca.isViewPrototype(a)||Luca.isModelPrototype(a)||Luca.isCollectionPrototype(a)},Luca.isBackboneModel=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.set:void 0)&&_.isFunction(a!=null?a.get:void 0)&&_.isObject(a!=null?a.attributes:void 0)},Luca.isBackboneView=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.render:void 0)&&!_.isUndefined(a!=null?a.el:void 0)},Luca.isBackboneCollection=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),_.isFunction(a!=null?a.fetch:void 0)&&_.isFunction(a!=null?a.reset:void 0)},Luca.isViewPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&a.prototype.make!=null&&a.prototype.$!=null&&a.prototype.render!=null},Luca.isModelPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(typeof a.prototype=="function"?a.prototype(a.prototype.save!=null&&a.prototype.changedAttributes!=null):void 0)},Luca.isCollectionPrototype=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&a.prototype!=null&&!Luca.isModelPrototype(a)&&a.prototype.reset!=null&&a.prototype.select!=null&&a.prototype.reject!=null},Luca.inheritanceChain=function(a){return Luca.parentClasses(a)},Luca.parentClasses=function(a){var b,c,d;return b=[],_.isString(a)&&(a=Luca.util.resolve(a)),c=typeof a.componentMetaData=="function"?a.componentMetaData():void 0,c||(c=typeof (d=a.prototype).componentMetaData=="function"?d.componentMetaData():void 0),b=(c!=null?c.classHierarchy():void 0)||[a.displayName||a.prototype.displayName]},Luca.parentClass=function(a,b){var c,d,e,f,g;return b==null&&(b=!0),_.isString(a)&&(a=Luca.util.resolve(a)),c=typeof a.componentMetaData=="function"?(e=a.componentMetaData())!=null?e.meta["super class name"]:void 0:void 0,c||(c=typeof (d=a.prototype).componentMetaData=="function"?(f=d.componentMetaData())!=null?f.meta["super class name"]:void 0:void 0),c||a.displayName||((g=a.prototype)!=null?g.displayName:void 0),b?Luca.util.resolve(c):c},a={module:function(a,b){_.extend(a,b);if(a.included&&_(a.included).isFunction())return a.included.apply(a)},"delete":function(a,b){var c;return c=a[b],delete a[b],c},idle:function(a,b){var c;return b==null&&(b=1e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleShort:function(a,b){var c;return b==null&&(b=100),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleMedium:function(a,b){var c;return b==null&&(b=2e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}},idleLong:function(a,b){var c;return b==null&&(b=5e3),window.DISABLE_IDLE&&(b=0),c=void 0,function(){return c&&window.clearTimeout(c),c=window.setTimeout(_.bind(a,this),b)}}},_.mixin(a)}.call(this),function(){Luca.config.maintainStyleHierarchy=!0,Luca.config.maintainClassHierarchy=!0,Luca.config.autoApplyClassHierarchyAsCssClasses=!0,Luca.config.idAttributeType="integer",Luca.config.apiSortByParameter="sortBy",Luca.config.apiPageParameter="page",Luca.config.apiLimitParameter="limit",Luca.autoRegister=Luca.config.autoRegister=!0,Luca.developmentMode=Luca.config.developmentMode=!1,Luca.enableGlobalObserver=Luca.config.enableGlobalObserver=!1,Luca.config.enableBoostrap=Luca.config.enableBootstrap=!0,Luca.config.fluidWrapperClass="container-fluid",Luca.config.wrapperClass="container",Luca.config.enhancedViewProperties=!0,Luca.keys=Luca.config.keys={ENTER:13,ESCAPE:27,KEYLEFT:37,KEYUP:38,KEYRIGHT:39,KEYDOWN:40,SPACEBAR:32,FORWARDSLASH:191,TAB:9},Luca.config.toolbarContainerClass="toolbar-container",Luca.keyMap=Luca.config.keyMap=_(Luca.keys).inject(function(a,b,c){return a[b]=c.toLowerCase(),a},{}),Luca.config.showWarnings=!0,Luca.config.default_socket_port=9292}.call(this),function(){var currentNamespace,__slice=[].slice;Luca.util.resolve=function(a,b){var c;if(!_.isString(a))return a;try{b||(b=window||global),c=_(a.split(/\./)).inject(function(a,b){return a=a!=null?a[b]:void 0},b)}catch(d){throw console.log("Error resolving",a,b),d}return c},Luca.util.nestedValue=Luca.util.resolve,Luca.util.argumentsLogger=function(a){return function(){return console.log(""+a+" "+(typeof this.identifier=="function"?this.identifier():void 0),arguments)}},Luca.util.read=function(){var a,b;return b=arguments[0],a=2<=arguments.length?__slice.call(arguments,1):[],_.isFunction(b)?b.apply(this,a):b},Luca.util.readAll=function(a){var b,c,d;a==null&&(a={}),c={};for(b in a)d=a[b],c[b]=Luca.util.read(d);return c},Luca.util.classify=function(a){return a==null&&(a=""),_.string.camelize(_.string.capitalize(a))},Luca.util.hook=function(a){var b,c,d;return a==null&&(a=""),c=a.split(":"),d=c.shift(),c=_(c).map(function(a){return _.string.capitalize(a)}),b=d+c.join("")},Luca.util.toCssClass=function(){var a,b,c,d,e;return a=arguments[0],b=2<=arguments.length?__slice.call(arguments,1):[],d=a.split("."),e=function(){var a,e,f;f=[];for(a=0,e=d.length;a<e;a++){c=d[a];if(_(b).indexOf(c)!==-1)continue;c=_.str.underscored(c),c=c.replace(/_/g,"-"),f.push(c)}return f}(),e.join("-")},Luca.util.isIE=function(){try{return Object.defineProperty({},"",{}),!1}catch(a){return!0}},currentNamespace=window||global,Luca.util.namespace=function(namespace){return namespace==null?currentNamespace:(currentNamespace=_.isString(namespace)?Luca.util.resolve(namespace,window||global):namespace,currentNamespace!=null?currentNamespace:currentNamespace=eval("(window||global)."+namespace+" = {}"))},Luca.util.lazyComponent=function(config){var componentClass,constructor,ctype;_.isObject(config)&&(ctype=config.ctype||config.type),_.isString(config)&&(ctype=config),componentClass=Luca.registry.lookup(ctype);if(!componentClass)throw"Invalid Component Type: "+ctype+". Did you forget to register it?";return constructor=eval(componentClass),new constructor(config)},Luca.util.selectProperties=function(a,b,c){var d;return d=_(b).values(),_(d).select(a)},Luca.util.loadScript=function(a,b){var c;return c=document.createElement("script"),c.type="text/javascript",c.readyState&&(c.onreadystatechange=function(){return c.readyState==="loaded"||c.readyState==="complete"?(c.onreadystatechange=null,b()):c.onload=function(){return b()}}),c.src=a,document.body.appendChild(c)},Luca.util.make=function(a,b,c){return a==null&&(a="div"),b==null&&(b={}),c==null&&(c=""),Luca.View.prototype.make.apply(this,arguments)},Luca.util.list=function(a,b,c){var d,e,f,g;b==null&&(b={}),d=c?"ol":"ul",d=Luca.util.make(d,b);if(_.isArray(a))for(f=0,g=a.length;f<g;f++)e=a[f],$(d).append(Luca.util.make("li",{},e));return d.outerHTML},Luca.util.label=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="label"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.badge=function(a,b,c){var d;return a==null&&(a=""),c==null&&(c="badge"),d=c,b!=null&&(d+=" "+c+"-"+b),Luca.util.make("span",{"class":d},a)},Luca.util.setupHooks=function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d;d=Luca.util.hook(a),c=function(){var a;return(a=this[d])!=null?a.apply(this,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);return b.on(a,c,b)})},Luca.util.setupHooksAdvanced=function(a){var b=this;return a||(a=this.hooks),_(a).each(function(a){var c,d,e,f,g,h,i;f=b[Luca.util.hook(a)],_.isArray(f)||(f=[f]),i=[];for(g=0,h=f.length;g<h;g++){d=f[g],e=_.isString(d)?b[d]:void 0,_.isFunction(d)&&(e=d),c=function(){var a;return(a=this[e])!=null?a.apply(this,arguments):void 0};if(a!=null?a.match(/once:/):void 0)c=_.once(c);i.push(b.on(a,c,b))}return i})},Luca.util.rejectBlanks=function(a){var b,c,d;c={};for(b in a)d=a[b],_.isBlank(d)!==!0&&(c[b]=d);return c},Luca.util.enableDropdowns=function(a){var b;return a==null&&(a=".dropdown-toggle"),typeof (b=$(a)).dropdown=="function"?b.dropdown():void 0}}.call(this),function(){var a=[].slice;Luca.stats={},Luca.stats.reset=function(){return Luca.__stats={}},Luca.stats.increment=function(a){var b;return Luca.__stats||(Luca.__stats={}),(b=Luca.__stats)[a]||(b[a]=1),Luca.__stats[a]=Luca.__stats[a]+1,Luca.__stats[a]},Luca.stats.report=function(){var a,b,c,d;console.log("Stats..."),c=Luca.__stats,d=[];for(a in c)b=c[a],d.push(console.log(a,b));return d},Luca.warn=function(){var b;b=1<=arguments.length?a.call(arguments,0):[];if(Luca.config.showWarnings!==!0)return;return Luca.isComponent(this)&&b.unshift(this.identifier()),b.unshift("Warning:"),console.log.apply(console,b)},Luca.log=function(){var b;return b=1<=arguments.length?a.call(arguments,0):[],Luca.isComponent(this)&&b.unshift(this.identifier()),console.log.apply(console,b)}}.call(this),function(){Luca.util.deprecateComponent=function(a,b){var c,d;c=_.template(""+a+" has been renamed to "+b+". Please update your definitions."),(d=Luca.registry.componentAliases)[b]||(d[b]=[]),Luca.registry.componentAliases[b].push(a);if(a!==b)return Luca.registry.deprecatedComponents[a]={message:c({previous:a,newName:b}),newName:b}},Luca.util.checkDeprecationStatusOf=function(a){var b;return(b=Luca.registry.deprecatedComponents[a])?(Luca.log(b.message),b.newName):a}}.call(this),function(){Luca.util.setupKeymaster=Luca.util.setupKeyBindings=function(a,b){b==null&&(b="all");if(!_.isFunction(Luca.key))throw"Keymaster library has not been included.";return{on:function(c){var d,e,f;c.on("before:remove",function(){var a;return(a=Luca.key)!=null?a.deleteScope(b):void 0}),f=[];for(e in a)d=a[e],_.isString(d)&&_.isFunction(c[d])&&(d=c[d]),_.isFunction(d)?(d=_.bind(d,c),f.push(Luca.key(e,b,d))):f.push(void 0);return f}}}}.call(this),function(){}.call(this),function(){Luca.concern=function(a){var b,c;return b=_(Luca.concern.namespaces).detect(function(b){var c;return((c=Luca.util.resolve(b))!=null?c[a]:void 0)!=null}),b||(b="Luca.concerns"),c=Luca.util.resolve(b)[a],c==null&&console.log("Could not find "+a+" in ",Luca.concern.namespaces),c},Luca.concern.namespaces=["Luca.concerns"],Luca.concern.namespace=function(a){return Luca.concern.namespaces.push(a),Luca.concern.namespaces=_(Luca.concern.namespaces).uniq()},Luca.concern.setup=function(){var a,b,c,d,e,f,g,h;if(((d=this.concerns)!=null?d.length:void 0)>0){e=this.concerns,h=[];for(b=0,c=e.length;b<c;b++)a=e[b],h.push((f=Luca.concern(a))!=null?(g=f.__initializer)!=null?g.call(this,this,a):void 0:void 0);return h}},Luca.decorate=function(a){var b,c,d;try{_.isString(a)&&(c=a,b=Luca.util.resolve(c)),_.isFunction(a)&&(b=a),d=b.prototype,c=c||b.displayName,c||(c=d.displayName)}catch(e){throw console.log(e.message),console.log(e.stack),console.log("Error calling Luca.decorate on ",b,d,c),e}return{"with":function(a){var e,f,g,h,i,j,k;g=Luca.concern(a),g.__displayName||(g.__displayName=a),h=_(g).chain().keys().select(function(a){return(""+a).match(/^__/)||a==="classMethods"}),i=_(g).omit(h.value()),_.extend(d,i);if(g.classMethods!=null){k=g.classMethods;for(f in k)e=k[f],b[f]=_.bind(e,b)}return g!=null&&typeof g.__included=="function"&&g.__included(c,b,g),j=d._superClass().prototype.concerns,d.concerns||(d.concerns=[]),d.concerns.push(a),d.concerns=d.concerns.concat(j),d.concerns=_(d.concerns).chain().uniq().compact().value(),d}}}}.call(this),function(){var ComponentDefinition,cd,__slice=[].slice;ComponentDefinition=function(){function ComponentDefinition(a,b){var c;this.autoRegister=b!=null?b:!0,this.namespace=Luca.util.namespace(),this.componentId=this.componentName=a,this.superClassName="Luca.View",this.properties||(this.properties={}),this._classProperties||(this._classProperties={}),a.match(/\./)&&(this.namespaced=!0,c=a.split("."),this.componentId=c.pop(),this.namespace=c.join("."),Luca.registry.addNamespace(c.join("."))),Luca.define.__definitions.push(this)}return ComponentDefinition.create=function(a,b){return b==null&&(b=Luca.config.autoRegister),new ComponentDefinition(a,b)},ComponentDefinition.prototype.isValid=function(){return _.isObject(this.properties)?Luca.util.resolve(this.superClassName)==null?!1:this.componentName==null?!1:!0:!1},ComponentDefinition.prototype.isDefined=function(){return this.defined===!0},ComponentDefinition.prototype.isOpen=function(){return!!this.isValid()&&!this.isDefined()},ComponentDefinition.prototype.meta=function(a,b){var c,d;return d=this.namespace+"."+this.componentId,d=d.replace(/^\./,""),c=Luca.registry.addMetaData(d,a,b),this.properties.componentMetaData=function(){return Luca.registry.getMetaDataFor(d)}},ComponentDefinition.prototype["in"]=function(a){return this.namespace=a,this},ComponentDefinition.prototype.from=function(a){return this.superClassName=a,this},ComponentDefinition.prototype["extends"]=function(a){return this.superClassName=a,this},ComponentDefinition.prototype.extend=function(a){return this.superClassName=a,this},ComponentDefinition.prototype.aliases=function(){var a;return a=1<=arguments.length?__slice.call(arguments,0):[],this._aliases=a,this.meta("aliases",this._aliases),this},ComponentDefinition.prototype.replaces=function(){var a,b,c,d,e;b=1<=arguments.length?__slice.call(arguments,0):[],this._aliases||(this._aliases=[]),e=[];for(c=0,d=b.length;c<d;c++)a=b[c],this._aliases.push(a),e.push(Luca.util.deprecateComponent(a,this.componentName));return e},ComponentDefinition.prototype.triggers=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{hooks:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.hooks.push(a);return this.properties.hooks=_.uniq(this.properties.hooks),this.meta("hooks",this.properties.hooks),this},ComponentDefinition.prototype.includes=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{include:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.include.push(a);return this.properties.include=_.uniq(this.properties.include),this.meta("includes",this.properties.include),this},ComponentDefinition.prototype.mixesIn=function(){var a,b,c,d;b=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties||(this.properties={}),{concerns:[]});for(c=0,d=b.length;c<d;c++)a=b[c],this.properties.concerns.push(a);return this.properties.concerns=_.uniq(this.properties.concerns),this.meta("concerns",this.properties.concerns),this},ComponentDefinition.prototype.contains=function(){var a;return a=1<=arguments.length?__slice.call(arguments,0):[],_.defaults(this.properties,{components:[]}),this.properties.components=a,this},ComponentDefinition.prototype.validatesConfigurationWith=function(a){return a==null&&(a={}),this.meta("configuration validations",a),this.properties.validatable=!0,this},ComponentDefinition.prototype.beforeDefinition=function(a){return this._classProperties.beforeDefinition=a,this},ComponentDefinition.prototype.afterDefinition=function(a){return this._classProperties.afterDefinition=a,this},ComponentDefinition.prototype.classConfiguration=function(a){return a==null&&(a={}),this.meta("class configuration",_.keys(a)),_.defaults(this._classProperties||(this._classProperties={}),a),this},ComponentDefinition.prototype.configuration=function(a){return a==null&&(a={}),this.meta("public configuration",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.publicConfiguration=function(a){return a==null&&(a={}),this.meta("public configuration",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.privateConfiguration=function(a){return a==null&&(a={}),this.meta("private configuration",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.classInterface=function(a){return a==null&&(a={}),this.meta("class interface",_.keys(a)),_.defaults(this._classProperties||(this._classProperties={}),a),this},ComponentDefinition.prototype.methods=function(a){return a==null&&(a={}),this.meta("public interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype["public"]=function(a){return a==null&&(a={}),this.meta("public interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.publicInterface=function(a){return a==null&&(a={}),this.meta("public interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype["private"]=function(a){return a==null&&(a={}),this.meta("private interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.privateInterface=function(a){return a==null&&(a={}),this.meta("private interface",_.keys(a)),_.defaults(this.properties||(this.properties={}),a),this},ComponentDefinition.prototype.definePrototype=function(properties){var alias,at,componentType,definition,include,type_alias,_base,_i,_j,_len,_len1,_ref,_ref1,_ref2,_ref3,_ref4;properties==null&&(properties={}),_.defaults(this.properties||(this.properties={}),properties),at=this.namespaced?Luca.util.resolve(this.namespace,window||global):window||global,this.namespaced&&at==null&&(eval("(window||global)."+this.namespace+" = {}"),at=Luca.util.resolve(this.namespace,window||global)),this.meta("super class name",this.superClassName),this.meta("display name",this.componentName),this.properties.displayName=this.componentName,this.properties.componentMetaData=function(){return Luca.registry.getMetaDataFor(this.displayName)},(_ref=this._classProperties)!=null&&typeof _ref.beforeDefinition=="function"&&_ref.beforeDefinition(this),definition=at[this.componentId]=Luca.extend(this.superClassName,this.componentName,this.properties);if(_.isArray((_ref1=this.properties)!=null?_ref1.include:void 0)){_ref2=this.properties.include;for(_i=0,_len=_ref2.length;_i<_len;_i++)include=_ref2[_i],_.isString(include)&&(include=Luca.util.resolve(include)),include==null&&console.log("Attempt to include module failed. "+include+" not defined."),_.extend(definition.prototype,include)}if(this._aliases!=null){_ref3=this._aliases;for(_j=0,_len1=_ref3.length;_j<_len1;_j++)alias=_ref3[_j],eval(""+alias+" = definition;")}return this.autoRegister===!0&&(Luca.isViewPrototype(definition)&&(componentType="view"),Luca.isCollectionPrototype(definition)&&((_base=Luca.Collection).namespaces||(_base.namespaces=[]),Luca.Collection.namespaces.push(this.namespace),componentType="collection"),Luca.isModelPrototype(definition)&&(componentType="model"),type_alias=_.string.underscored(this.componentId),Luca.registerComponent(type_alias,this.componentName,componentType)),this.defined=!0,_.isEmpty(this._classProperties)||_.extend(definition,this._classProperties),definition!=null&&(_ref4=definition.afterDefinition)!=null&&_ref4.call(definition,this),definition},ComponentDefinition}(),cd=ComponentDefinition.prototype,cd.concerns=cd.behavesAs=cd.uses=cd.mixesIn,cd.register=cd.defines=cd.defaults=cd.exports=cd.defaultProperties=cd.definePrototype,cd.defaultsTo=cd.enhance=cd["with"]=cd.definePrototype,cd.publicMethods=cd.publicInterface,cd.privateMethods=cd.privateInterface,cd.classProperites=cd.classMethods=cd.classInterface,_.extend(Luca.define=ComponentDefinition.create,{__definitions:[],incomplete:function(){return _(Luca.define.__definitions).select(function(a){return a.isOpen()})},close:function(){var a,b,c,d;d=Luca.define.incomplete();for(b=0,c=d.length;b<c;b++)a=d[b],a.isValid()&&a.register();return Luca.define.__definitions.length=0},findDefinition:function(a){return _(Luca.define.__definitions).detect(function(b){return b.componentName===a})}}),Luca.register=function(a){return new ComponentDefinition(a,!0)},_.mixin({def:Luca.define}),Luca.extend=function(a,b,c){var d,e,f,g,h,i,j;c==null&&(c={}),a=Luca.util.checkDeprecationStatusOf(a),f=Luca.util.resolve(a,window||global);if(!_.isFunction(f!=null?f.extend:void 0))throw"Error defining "+
9
- b+". "+a+" is not a valid component to extend from";g=Luca.registry.getMetaDataFor(a),g.descendants().push(b),c.displayName=b,c._superClass=function(){return f.displayName||(f.displayName=a),f},c._super=function(a,b,c){var d;return b==null&&(b=this),c==null&&(c=[]),(d=this._superClass().prototype[a])!=null?d.apply(b,c):void 0},d=f.extend(c);if(_.isArray(c!=null?c.include:void 0)){j=c.include;for(h=0,i=j.length;h<i;h++)e=j[h],_.isString(e)&&(e=Luca.util.resolve(e)),_.extend(d.prototype,e)}return d}}.call(this),function(){var a,b;b={classes:{},model_classes:{},collection_classes:{},namespaces:["Luca.containers","Luca.components"]},a={cid_index:{},name_index:{}},Luca.config.defaultComponentClass=Luca.defaultComponentClass="Luca.View",Luca.config.defaultComponentType=Luca.defaultComponentType="view",Luca.registry.deprecatedComponents={},Luca.registry.componentAliases={},Luca.registry.typeAliases={grid:"grid_view",form:"form_view",text:"text_field",button:"button_field",select:"select_field",card:"card_view",paged:"card_view",wizard:"card_view",collection:"collection_view",list:"collection_view",multi:"collection_multi_view",table:"table_view"},Luca.registerComponent=function(a,c,d){var e,f,g,h,i,j;d==null&&(d="view"),Luca.trigger("component:registered",a,c);switch(d){case"model":e=b.model_classes[a],b.model_classes[a]=c;break;case"collection":e=b.collection_classes[a],b.collection_classes[a]=c;break;case"view":e=b.classes[a],b.classes[a]=c;break;default:e=b.classes[a],b.classes[a]=c}if(e!=null&&Luca.config.developmentMode===!0){g=Luca.registry.findInstancesByClassName(c);if(g.length>0){j=[];for(h=0,i=g.length;h<i;h++)f=g[h],j.push(typeof f.refreshEventBindings=="function"?f.refreshEventBindings():void 0);return j}}},Luca.registry.addNamespace=Luca.registry.namespace=function(a){return b.namespaces.push(a),b.namespaces=_(b.namespaces).uniq()},Luca.registry.namespaces=function(a){return a==null&&(a=!0),_(b.namespaces).map(function(b){return a?Luca.util.resolve(b):b})},Luca.registry.lookup=function(a){var c,d,e,f,g,h;if(c=Luca.registry.typeAliases[a])a=c;return d=b.classes[a],d!=null?d:(e=Luca.util.classify(a),g=Luca.registry.namespaces(),f=(h=_(g).chain().map(function(a){return a[e]}).compact().value())!=null?h[0]:void 0)},Luca.registry.instances=function(){return _(a.cid_index).values()},Luca.registry.findInstancesByClass=function(a){return Luca.registry.findInstancesByClassName(a.displayName)},Luca.registry.findInstancesByClassName=function(a){var b;return _.isString(a)||(a=a.displayName),b=Luca.registry.instances(),_(b).select(function(b){var c,d;return c=b.displayName===a,b.displayName===a||(typeof b._superClass=="function"?(d=b._superClass())!=null?d.displayName:void 0:void 0)===a})},Luca.registry.classes=function(a){return a==null&&(a=!1),_(_.extend({},b.classes,b.model_classes,b.collection_classes)).map(function(b,c){return a?b:{className:b,ctype:c}})},Luca.registry.find=function(a){return Luca.util.resolve(a)||Luca.define.findDefinition(a)},Luca.remove=Luca.registry.removeInstance=function(b){if(b==null)return;return _(a.name_index)["delete"](b),_(a.cid_index)["delete"](b)},Luca.cache=Luca.registry.cacheInstance=function(b,c){var d;if(b==null)return;return(c!=null?c.doNotCache:void 0)===!0?c:(c!=null&&(a.cid_index[b]=c),c=a.cid_index[b],(c!=null?c.component_name:void 0)!=null?a.name_index[c.component_name]=c.cid:(c!=null?c.name:void 0)!=null&&(a.name_index[c.name]=c.cid),c!=null?c:(d=a.name_index[b],a.cid_index[d]))}}.call(this),function(){var a;Luca.registry.componentMetaData={},Luca.registry.getMetaDataFor=function(b){return new a(Luca.registry.componentMetaData[b])},Luca.registry.addMetaData=function(a,b,c){var d,e;return d=(e=Luca.registry.componentMetaData)[a]||(e[a]={}),d[b]=_(c).clone(),d},a=function(){function a(a){this.meta=a!=null?a:{},_.defaults(this.meta,{"super class name":"","display name":"",descendants:[],aliases:[],"public interface":[],"public configuration":[],"private interface":[],"private configuration":[],"class configuration":[],"class interface":[]})}return a.prototype.className=function(){return this.meta["display name"]},a.prototype.superClass=function(){return Luca.util.resolve(this.meta["super class name"])},a.prototype.componentDefinition=function(){return Luca.registry.find(this.meta["display name"])},a.prototype.componentPrototype=function(){var a;return(a=this.componentDefinition())!=null?a.prototype:void 0},a.prototype.prototypeFunctions=function(){return _.functions(this.componentPrototype())},a.prototype.classAttributes=function(){return _.uniq(this.classInterface().concat(this.classConfiguration()))},a.prototype.publicAttributes=function(){return _.uniq(this.publicInterface().concat(this.publicConfiguration()))},a.prototype.privateAttributes=function(){return _.uniq(this.privateInterface().concat(this.privateConfiguration()))},a.prototype.classMethods=function(){var a;return a=_.functions(this.componentDefinition()),_(a).intersection(this.classAttributes())},a.prototype.publicMethods=function(){return _(this.prototypeFunctions()).intersection(this.publicAttributes())},a.prototype.privateMethods=function(){return _(this.prototypeFunctions()).intersection(this.privateAttributes())},a.prototype.classConfiguration=function(){return this.meta["class configuration"]},a.prototype.publicConfiguration=function(){return this.meta["public configuration"]},a.prototype.privateConfiguration=function(){return this.meta["private configuration"]},a.prototype.classInterface=function(){return this.meta["class interface"]},a.prototype.publicInterface=function(){return this.meta["public interface"]},a.prototype.privateInterface=function(){return this.meta["private interface"]},a.prototype.triggers=function(){return this.meta.hooks},a.prototype.hooks=function(){return this.meta.hooks},a.prototype.descendants=function(){return this.meta.descendants},a.prototype.styleHierarchy=function(){var a;return a=_(this.classHierarchy()).map(function(a){return Luca.util.toCssClass(a,"views","components","core","fields","containers")}),_(a).without("backbone-view","luca-view")},a.prototype.classHierarchy=function(){var a,b,c,d,e,f;a=[this.meta["display name"],this.meta["super class name"]],b=(c=this.superClass())!=null?(d=c.prototype)!=null?typeof d.componentMetaData=="function"?d.componentMetaData():void 0:void 0:void 0;while(!!b)a=a.concat(b!=null?b.classHierarchy():void 0),b=(e=b.superClass())!=null?(f=e.prototype)!=null?typeof f.componentMetaData=="function"?f.componentMetaData():void 0:void 0:void 0;return _(a).uniq()},a}()}.call(this),function(){}.call(this),function(){var a=[].slice;Luca.Observer=function(){function b(a){var b=this;this.options=a!=null?a:{},_.extend(this,Backbone.Events),this.type=this.options.type,this.options.debugAll&&this.bind("all",function(a,b,c){return console.log("ALL",a,b,c)})}return b.prototype.relay=function(){var b,c;return c=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],console.log("Relaying",trigger,b),this.trigger("event",c,b),this.trigger("event:"+b[0],c,b.slice(1))},b}(),Luca.Observer.enableObservers=function(a){return a==null&&(a={}),Luca.enableGlobalObserver=!0,Luca.ViewObserver=new Luca.Observer(_.extend(a,{type:"view"})),Luca.CollectionObserver=new Luca.Observer(_.extend(a,{type:"collection"}))}}.call(this),function(){var a=[].slice;Luca.DeferredBindingProxy=function(){function a(a,b,c){var d;this.object=a,c==null&&(c=!0),_.isFunction(b)?d=b:_.isString(b)&&_.isFunction(this.object[b])&&(d=this.object[b]);if(!_.isFunction(d))throw"Must pass a function or a string representing one";c===!0?this.fn=_.bind(function(){return _.defer(d)},this.object):this.fn=_.bind(d,this.object),this}return a.prototype.until=function(a,b){return a!=null&&b==null&&(b=a,a=this.object),a.once(b,this.fn),this.object},a}(),Luca.EventRelayer=function(){function b(a){a==null&&(a={}),this.target=a.target,this.events=a.events,this.prefix=a.prefix,this.source=a.source,this.events.length>0&&this.target&&this.source&&this.setup(),this}return b.prototype.prefixedBy=function(a){return this.prefix=a!=null?a:"",this},b.prototype.from=function(a){return this.source=a,this},b.prototype.to=function(a){return this.target=a,this},b.prototype.setup=function(b){var c,d,e,f,g,h;this.target=b,d=this.prefix,b=this.target,g=this.events,h=[];for(e=0,f=g.length;e<f;e++)c=g[e],console.log("Binding to ",c,d,this.target.name,this.source.name),h.push(this.source.on(c,function(){var b,e;return b=1<=arguments.length?a.call(arguments,0):[],e=_([d,c]).compact().join(":"),b.unshift(e),this.trigger.apply(this,b)},b));return h},b}(),Luca.Events={relays:function(){var b;return b=1<=arguments.length?a.call(arguments,0):[],new Luca.EventRelayer({relayer:this,events:b})},defer:function(a,b){return b==null&&(b=!0),new Luca.DeferredBindingProxy(this,a,b)},once:function(a,b,c){var d;return c||(c=this),d=function(){return b.apply(c,arguments),this.unbind(a,d)},this.bind(a,d)}},Luca.EventsExt={waitUntil:function(a,b){return this.waitFor.call(this,a,b)},waitFor:function(b,c){var d,e;return e=this,d={on:function(a){return a.waitFor.call(a,b,c)},and:function(){var d,f,g,h,i;f=1<=arguments.length?a.call(arguments,0):[],i=[];for(g=0,h=f.length;g<h;g++)d=f[g],d=_.isFunction(d)?d:e[d],i.push(e.once(b,d,c));return i},andThen:function(){return e.and.apply(e,arguments)}}},relayEvent:function(b){var c=this;return{on:function(){var d;return d=1<=arguments.length?a.call(arguments,0):[],{to:function(){var e,f,g,h,i,j;g=1<=arguments.length?a.call(arguments,0):[],j=[];for(h=0,i=g.length;h<i;h++)f=g[h],j.push(function(){var c,g,h,i=this;h=[];for(c=0,g=d.length;c<g;c++)e=d[c],h.push(e.on(b,function(){var c;return c=1<=arguments.length?a.call(arguments,0):[],c.unshift(b),f.trigger.apply(f,c)}));return h}.call(c));return j}}}}}}}.call(this),function(){var a,b;Luca.templates||(Luca.templates={});if(window.JST!=null)for(b in JST){a=JST[b];if(!b.match(/^luca\/templates\//))continue;Luca.templates[b.replace("luca/templates/","")]=a,_(JST)["delete"](b)}Luca.template=function(a,b,c){var d,e,f,g,h;window.JST||(window.JST={});if(_.isFunction(a))return a(b);e=(h=Luca.templates)!=null?h[a]:void 0,d=typeof JST!="undefined"&&JST!==null?JST[a]:void 0,e==null&&d==null&&(f=new RegExp(""+a+"$"),e=_(Luca.templates).detect(function(a,b){return f.exec(b)}),d=_(JST).detect(function(a,b){return f.exec(b)}));if(!e&&!d)throw"Could not find template named "+a;return g=e||d,g instanceof Hogan.template&&b!=null?g.render(b,c):b!=null?g(b):g},Luca.available_templates=function(a){var b;return a==null&&(a=""),b=_(Luca.templates).keys(),a.length>0?_(b).select(function(b){return b.match(a)}):b}}.call(this),function(){Luca.concerns.ApplicationEventBindings={__initializer:function(){var a,b,c,d,e,f,g,h;if(_.isEmpty(this.applicationEvents))return;a=this.app;if(_.isString(a)||_.isUndefined(a))a=(f=Luca.Application)!=null?typeof f.get=="function"?f.get(a):void 0:void 0;if(!Luca.supportsEvents(a))throw"Error binding to the application object on "+(this.name||this.cid);g=this.applicationEvents,h=[];for(c=d=0,e=g.length;d<e;c=++d){b=g[c],_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"Error registering application event "+b+" on "+(this.name||this.cid);h.push(a.on(b,c,this))}return h}}}.call(this),function(){var a,b=[].slice;Luca.concerns.CollectionEventBindings={__initializer:function(){var b=this;this.defer(function(){return Luca.concerns.CollectionEventBindings.__setup.call(b)}).until("after:initialize");if(this.collectionEventBindingsSetup!==!0)return Luca.isBackboneCollection(this.collection)&&(this.collection.on("reset",a("collection:reset"),this),this.collection.on("add",a("collection:add"),this),this.collection.on("remove",a("collection:remove"),this),this.collection.on("change",a("collection:change"),this),this.collection.on("before:fetch",a("collection:fetch"),this)),this.collectionEventBindingsSetup=!0},__setup:function(){var a,b,c,d,e,f,g,h,i;if(_.isEmpty(this.collectionEvents))return;e=this.collectionManager||Luca.CollectionManager.get(),g=this.collectionEvents,i=[];for(f in g){c=g[f],h=f.split(" "),d=h[0],b=h[1],a=e.getOrCreate(d);if(!a)throw"Could not find collection specified by "+d;_.isString(c)&&(c=this[c]);if(!_.isFunction(c))throw"invalid collectionEvents configuration";try{i.push(a.on(b,c,this))}catch(j){throw console.log("Error Binding To Collection in registerCollectionEvents",this),j}}return i}},a=function(a){return function(){var c;return c=1<=arguments.length?b.call(arguments,0):[],c.unshift(a),this.trigger.apply(this,c)}}}.call(this),function(){Luca.concerns.Deferrable={configure_collection:function(a){var b,c,d;a==null&&(a=!0);if(!this.collection)return;_.isString(this.collection)&&(b=(c=Luca.CollectionManager)!=null?c.get():void 0)&&(this.collection=b.getOrCreate(this.collection)),_.isObject(this.collection)&&!Luca.isBackboneCollection(this.collection)&&(this.collection=new Luca.Collection(this.collection.initial_set,this.collection));if((d=this.collection)!=null?d.deferrable_trigger:void 0)this.deferrable_trigger=this.collection.deferrable_trigger;if(a)return this.deferrable=this.collection}}}.call(this),function(){Luca.concerns.DevelopmentToolHelpers={refreshEventBindings:function(){var a,b,c,d,e,f,g,h,i;f=this,console.log("Refreshing Event Bindings ON ",f.name||f.cid),f.undelegateEvents(),b=(typeof f.definitionClass=="function"?(g=f.definitionClass())!=null?g.events:void 0:void 0)||f.events;for(d in b){c=b[d];if(_.isString(c)!==!0)continue;a=typeof f.definitionClass=="function"?(h=f.definitionClass())!=null?h[c]:void 0:void 0,console.log("Rebinding dom event",d,c,a),f.events[d]=a}return f.state!=null&&f.stateful!=null&&(Luca.concerns.StateModel.__setupModelBindings.call(f,"off"),Luca.concerns.StateModel.__setupModelBindings.call(f,"on")),f.isContainer===!0&&!_.isEmpty(f.componentEvents)&&(Luca.Container.prototype.registerComponentEvents.call(this,void 0,"off"),e=typeof f.definitionClass=="function"?(i=f.definitionClass())!=null?i.componentEvents:void 0:void 0,Luca.Container.prototype.registerComponentEvents.call(this,e,"on")),f.delegateEvents()}}}.call(this),function(){Luca.concerns.DomHelpers={__initializer:function(){var a,b,c,d,e,f,g,h,i,j,k,l;b=_(this.additionalClassNames||[]).clone(),this.wrapperClass!=null&&this.$wrap(this.wrapperClass),_.isString(b)&&(b=b.split(" ")),(f=this.gridSpan||this.span)&&b.push("span"+f),(e=this.gridOffset||this.offset)&&b.push("offset"+e),(this.gridRowFluid||this.rowFluid)&&b.push("row-fluid"),(this.gridRow||this.row)&&b.push("row");if(b==null)return;for(g=0,i=b.length;g<i;g++)a=b[g],this.$el.addClass(a);if(Luca.config.autoApplyClassHierarchyAsCssClasses===!0){c=(typeof this.componentMetaData=="function"?(k=this.componentMetaData())!=null?k.styleHierarchy():void 0:void 0)||[],l=[];for(h=0,j=c.length;h<j;h++)d=c[h],d!=="luca-view"&&d!=="backbone-view"&&l.push(this.$el.addClass(d));return l}},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a,"data-wrapper":!0})),this.$el.wrap(a)},$wrapper:function(){return this.$el.parent('[data-wrapper="true"]')},$template:function(a,b){var c;b==null&&(b={});try{return this.$el.html(Luca.template(a,b))}catch(d){return console.log("Error in $template: "+a+" "+(((c=typeof this.identifier==="function"?this.identifier():void 0)!=null?c:this.name)||this.cid))}},$html:function(a){return a!=null?this.$el.html(a):this.$el.html()},$append:function(a){return this.$el.append(a)},$attach:function(){return this.$container().append(this.el)},$bodyEl:function(){return this.$el},$container:function(){return $(this.container)}}}.call(this),function(){Luca.concerns.EnhancedProperties={__initializer:function(){if(Luca.config.enhancedViewProperties!==!0)return;_.isString(this.collection)&&Luca.CollectionManager.get()&&(this.collection=Luca.CollectionManager.get().getOrCreate(this.collection)),this.template!=null&&this.$template(this.template,this);if(_.isString(this.collectionManager))return this.collectionManager=Luca.CollectionManager.get(this.collectionManager)}}}.call(this),function(){var a,b={}.hasOwnProperty,c=function(a,c){function e(){this.constructor=a}for(var d in c)b.call(c,d)&&(a[d]=c[d]);return e.prototype=c.prototype,a.prototype=new e,a.__super__=c.prototype,a};Luca.concerns.Filterable={classMethods:{prepare:function(){var a,b,c;this.trigger("data:refresh");if(!this.isRemote())return;return a=_.clone(this.getRemoteQuery()),b=_.clone(this.getQueryOptions()),c=this.prepareRemoteFilter(a,b),this.collection.applyFilter(c,{remote:!0})}},__included:function(a,b){return _.extend(Luca.Collection.prototype,{__filters:{}})},__initializer:function(a,b){var c,d,e,f=this;if(this.filterable===!1)return;this.filterable===!0&&(this.filterable={}),Luca.isBackboneCollection(this.collection)||(this.collection=typeof (d=Luca.CollectionManager).get=="function"?(e=d.get())!=null?e.getOrCreate(this.collection):void 0:void 0);if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Filterable due to no collection being present on "+(this.name||this.cid)),this.debug("Collection",this.collection);return}return this.getCollection||(this.getCollection=function(){return this.collection}),c=this.getFilterState(),this.querySources||(this.querySources=[]),this.optionsSources||(this.optionsSources=[]),this.query||(this.query={}),this.queryOptions||(this.queryOptions={}),this.querySources.push(function(a){return a==null&&(a={}),f.getFilterState().toQuery()}),this.optionsSources.push(function(a){return a==null&&(a={}),f.getFilterState().toOptions()}),c.on("change",function(){return f.trigger("filter:change")}),this.on("filter:change",Luca.concerns.Filterable.classMethods.prepare,this),b},prepareRemoteFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b.limit!=null&&(a[Luca.config.apiLimitParameter]=b.limit),b.page!=null&&(a[Luca.config.apiPageParameter]=b.page),b.sortBy!=null&&(a[Luca.config.apiSortByParameter]=b.sortBy),a},isRemote:function(){var a;if(this.getQueryOptions().remote===!0)return!0;if(this.remoteFilterFallback===!0&&((a=this.getCollection())!=null?a.length:void 0)===0)return!0},getFilterState:function(){var b,c,d,e,f,g;return g=b=this.filterable||{},c=g.options,d=g.query,!_.isEmpty(b)&&_.isEmpty(d)&&_.isEmpty(c)&&_.extend(c,_(b).pluck("sortBy","page","limit")),(e=this.collection.__filters)[f=this.cid]||(e[f]=new a({query:d||{},options:c||{}}))},setSortBy:function(a,b){return b==null&&(b={}),this.getFilterState().setOption("sortBy",a,b)},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b=_.defaults(b,this.getQueryOptions()),this.getFilterState().clear({silent:!0}),this.getFilterState().set({query:a,options:b},b)}},a=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return c(b,a),b.prototype.defaults={options:{},query:{}},b.prototype.setOption=function(a,b,c){var d;return d={},d[a]=b,this.set("options",_.extend(this.toOptions(),d),c)},b.prototype.setQueryOption=function(a,b,c){var d;return d={},d[a]=b,this.set("query",_.extend(this.toQuery(),d),c)},b.prototype.toOptions=function(){return _.clone(this.toJSON().options)},b.prototype.toQuery=function(){return _.clone(this.toJSON().query)},b.prototype.toRemote=function(){return Luca.concerns.Filterable.prepareRemoteFilter.call(this,this.toQuery(),this.toOptions())},b}(Backbone.Model)}.call(this),function(){Luca.concerns.FormModelBindings={__initializer:function(){if(this.trackModelChanges!==!0)return;return this.on("state:change:currentModel",this.onStateChangeCurrentModel,this),_.bindAll(this,"onStateChangeCurrentModel","unbindFromModel","onModelChange","bindToModel")},onStateChangeCurrentModel:function(a,b,c){Luca.isBackboneModel(c)&&this.unbindFromModel(c);if(Luca.isBackboneModel(b))return this.bindToModel(b)},unbindFromModel:function(a){var b;return(b=a||this.currentModel())!=null?b.unbind("change",this.onModelChange):void 0},onModelChange:function(a){return this.setValues(a,{modelChange:!0})},bindToModel:function(a){var b;return(b=a||this.currentModel())!=null?b.bind("change",this.onModelChange,this):void 0}}}.call(this),function(){Luca.concerns.GridLayout={_initializer:function(){this.gridSpan&&this.$el.addClass("span"+this.gridSpan),this.gridOffset&&this.$el.addClass("offset"+this.gridOffset),this.gridRowFluid&&this.$el.addClass("row-fluid");if(this.gridRow)return this.$el.addClass("row")}}}.call(this),function(){Luca.concerns.LoadMaskable={__initializer:function(){var a=this;if(this.loadMask===!1||this.loadMask==null)return;return this.loadMask===!0&&(this.loadMask={enableEvent:"enable:loadmask",disableEvent:"disable:loadmask"}),this.on("collection:fetch",function(){return a.trigger("enable:loadmask")}),this.on("collection:reset",function(){return a.trigger("disable:loadmask")}),this.on("after:render",function(){this.$el.addClass("with-mask");if(this.$(".load-mask").length===0&&this.loadMaskTemplate!=null)return this.loadMaskTarget().prepend(Luca.template(this.loadMaskTemplate,this)),this.$(".load-mask").hide()},this),this.on(this.loadMask.enableEvent,this.applyLoadMask,this),this.on(this.loadMask.disableEvent,this.applyLoadMask,this)},showLoadMask:function(){return this.trigger("enable:loadmask")},hideLoadMask:function(){return this.trigger("disable:loadmask")},loadMaskTarget:function(){return this.loadMaskEl!=null?this.$(this.loadMaskEl):this.$bodyEl()},disableLoadMask:function(){return this.$(".load-mask .bar").css("width","100%"),this.$(".load-mask").hide(),clearInterval(this.loadMaskInterval)},enableLoadMask:function(){var a,b=this;this.$(".load-mask").show().find(".bar").css("width","0%"),a=this.$(".load-mask .progress").width(),a<20&&(a=this.$el.width())<20&&(a=this.$el.parent().width()),this.loadMaskInterval=setInterval(function(){var a,c;return a=b.$(".load-mask .bar").width(),c=a+12,b.$(".load-mask .bar").css("width",c)},200);if(this.loadMaskTimeout==null)return;return _.delay(function(){return b.disableLoadMask()},this.loadMaskTimeout)},applyLoadMask:function(){return this.$(".load-mask").is(":visible")?this.disableLoadMask():this.enableLoadMask()}}}.call(this),function(){Luca.LocalStore=function(){function a(a){var b;this.name=a,b=localStorage.getItem(this.name),this.data=b&&JSON.parse(b)||{}}return a.prototype.guid=function(){var a;return a=function(){return((1+Math.random())*65536|0).toString(16).substring(1)},a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()},a.prototype.save=function(){return localStorage.setItem(this.name,JSON.stringify(this.data))},a.prototype.create=function(a){return a.id||(a.id=a.attribtues.id=this.guid()),this.data[a.id]=a,this.save(),a},a.prototype.update=function(a){return this.data[a.id]=a,this.save(),a},a.prototype.find=function(a){return this.data[a.id]},a.prototype.findAll=function(){return _.values(this.data)},a.prototype.destroy=function(a){return delete this.data[a.id],this.save(),a},a}(),Backbone.LocalSync=function(a,b,c){var d,e;return e=b.localStorage||b.collection.localStorage,d=function(){switch(a){case"read":return b.id?e.find(b):e.findAll();case"create":return e.create(b);case"update":return e.update(b);case"delete":return e.destroy(b)}}(),d?c.success(d):c.error("Record not found")}}.call(this),function(){Luca.concerns.ModalView={version:3,closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,__initializer:function(){if(this.modal!==!0)return;return this.on("before:render",this.applyModalConfig,this),this},applyModalConfig:function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this.showOnInitialize!==!0&&this.$el.css("display","none"),this},container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.rendered!==!0&&this.render(),this.trigger("before:show"),this.$el.modal("show"),this.trigger("after:show")},hide:function(){return this.trigger("before:hide"),this.$el.modal("hide"),this.trigger("after:hide")},setModalDimensions:function(a,b){var c;_.isObject(a)&&(c=a,a=c.height,b=c.width),a!=null&&this.setModalHeight(a);if(b!=null)return this.setModalWidth(b)},setModalWidth:function(a){return this.$el.css({width:a,"max-width":a,"margin-left":a*.5*-1})},setModalHeight:function(a){return this.$el.css({"max-height":a,"margin-top":a*.5*-1,height:a})}}}.call(this),function(){Luca.concerns.ModelPresenter={classMethods:{getPresenter:function(a){var b;return(b=this.presenters)!=null?b[a]:void 0},registerPresenter:function(a,b){return this.presenters||(this.presenters={}),this.presenters[a]=b}},presentAs:function(a){var b,c=this;try{return b=this.componentMetaData().componentDefinition().getPresenter(a),b==null?this.toJSON():_(b).reduce(function(a,b){return a[b]=c.read(b),a},{})}catch(d){return console.log("Error presentAs",d.stack,d.message),this.toJSON()}}}}.call(this),function(){Luca.concerns.Paginatable={paginatorViewClass:"Luca.components.PaginationControl",paginationSelector:".toolbar.bottom.pagination-container",__included:function(){return _.extend(Luca.Collection.prototype,{__paginators:{}})},__initializer:function(){var a,b,c=this;if(this.paginatable===!1)return;if(_.isNumber(this.paginatable)||_.isString(this.paginatable))this.paginatable={limit:parseInt(this.paginatable),page:1};if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Paginatable due to no collection being present on "+(this.name||this.cid)),this.debug("collection",this.collection);return}return _.bindAll(this,"paginationControl","pager"),a=(this.getCollection||(this.getCollection=function(){return this.collection}))(),b=this.getPaginationState(),this.optionsSources||(this.optionsSources=[]),this.queryOptions||(this.queryOptions={}),this.optionsSources.push(function(){var a;return a=_(b.toJSON()).pick("limit","page","sortBy"),_.extend(a,{pager:c.pager})}),b.on("change:page",function(){return c.trigger("pagination:change")}),this.on("pagination:change",Luca.concerns.Filterable.classMethods.prepare,this),this.on("before:render",this.renderPaginationControl,this)},pager:function(a,b){return this.getPaginationState().set({numberOfPages:a,itemCount:b.length}),this.paginationControl().updateWithPageCount(a,b)},isRemote:function(){return this.getQueryOptions().remote===!0},getPaginationState:function(){var a,b;return(a=this.collection.__paginators)[b=this.cid]||(a[b]=this.paginationControl().state)},paginationContainer:function(){return this.$(">"+this.paginationSelector)},setCurrentPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.getPaginationState().set("page",a,b)},setLimit:function(a,b){return a==null&&(a=0),b==null&&(b={}),this.getPaginationState().set("limit",a,b)},paginationControl:function(){return this.paginator!=null?this.paginator:(_.defaults(this.paginatable||(this.paginatable={}),{page:1,limit:20}),this.paginator=Luca.util.lazyComponent({type:"pagination_control",collection:this.getCollection(),defaultState:this.paginatable,parent:this.name||this.cid,debugMode:this.debugMode}),this.paginator)},renderPaginationControl:function(){var a;return a=this.paginationControl(),this.paginationContainer().append(a.render().$el),a}}}.call(this),function(){Luca.concerns.QueryCollectionBindings={getCollection:function(){return this.collection},loadModels:function(a,b){var c;return a==null&&(a=[]),b==null&&(b={}),(c=this.getCollection())!=null?c.reset(a,b):void 0},applyQuery:function(a,b){return a==null&&(a={}),b==null&&(b={}),this.query=a,this.queryOptions=b,this.refresh(),this},getQuery:function(a){var b,c,d,e,f;a==null&&(a={}),b=this.query||(this.query={}),f=_(this.querySources||[]).compact();for(d=0,e=f.length;d<e;d++)c=f[d],b=_.extend(b,c(a)||{});return Luca.util.readAll(b)},getRemoteQuery:function(a){return a==null&&(a={}),this.getQuery(a)},getLocalQuery:function(a){return a==null&&(a={}),this.getQuery(a)},getQueryOptions:function(a){var b,c,d,e,f;a==null&&(a={}),c=this.queryOptions||(this.queryOptions={}),f=_(this.optionsSources||[]).compact();for(d=0,e=f.length;d<e;d++)b=f[d],c=_.extend(c,b(a)||{});return c},getModels:function(a,b){var c;return((c=this.collection)!=null?c.query:void 0)?(a||(a=this.getLocalQuery()),b||(b=this.getQueryOptions()),b.prepare||(b.prepare=this.prepareQuery),this.collection.query(a,b)):this.collection.models}}}.call(this),function(){var a;Luca.concerns.Sortable={__included:function(a,b){return _.extend(Luca.Collection.prototype,{__sortables:{}})},__initializer:function(){var a,b,c=this;if(this.sortable===!1)return;_.isString(this.sortable)&&(this.sortable={sortBy:this.sortable});if(!Luca.isBackboneCollection(this.collection)){this.debug("Skipping Sortable due to no collection being present on "+(this.name||this.cid)),this.debug("collection",this.collection);return}return a=(this.getCollection||(this.getCollection=function(){return this.collection}))(),b=this.getSortableState(),this.optionsSources||(this.optionsSources=[]),this.queryOptions||(this.queryOptions={}),this.optionsSources.push(function(){return _(b.toJSON()).pick("sortBy","order")}),b.on("change",function(){return c.trigger("sortable:change")}),this.defer(function(){return c.$(".sortable-toggle").on("click",function(a){var b,d;return b=d=c.$(a.target),b=d=d.closest(".sortable-toggle"),c.toggleSortOrderDirection(d.data("sortableSortBy"))})}).until("after:render"),this.on("sortable:change",Luca.concerns.Filterable.classMethods.prepare,this)},isRemote:function(){return this.getQueryOptions().remote===!0},getSortableState:function(){var b,c,d;return b=_(this.sortable||{}).pick("sortBy","order"),(c=this.collection.__sortables)[d=this.cid]||(c[d]=new a(b))},sortBy:function(a,b){return a!=null&&this.setSortBy(a),b!=null&&this.setOrder(b),this},setSortBy:function(a,b){return b==null&&(b={}),this.getSortableState().set("sortBy",a,b),this},toggleSortOrderDirection:function(a){var b,c;return c=this.getSortableState().get("order")||"ASC",b=c==="ASC"?"DESC":"ASC",a||(a=this.getSortableState().get("sortBy")),this.sortBy(a,b)},setOrder:function(a,b){return b==null&&(b={}),this.getSortableState().set("order",a,b),this}},Luca.util.makeSortableToggleElement=function(a,b,c){return $(a).attr("data-sortable-sort-by",b).attr("data-sortable-order",c),$(a)},a=Backbone.Model.extend()}.call(this),function(){var a,b=[].slice;a=Luca.register("Luca.ViewState")["extends"]("Luca.Model"),Luca.concerns.StateModel={__onModelChange:function(){var a,c,d,e,f,g,h,i;a=1<=arguments.length?b.call(arguments,0):[],e=this,d=e.state,(g=this.trigger).call.apply(g,[e,"state:change"].concat(b.call(a))),h=d.changedAttributes(),i=[];for(c in h)f=h[c],i.push(this.trigger.call(e,"state:change:"+c,d,f,d.previous(c)));return i},__initializer:function(){var a,b,c,d,e,f,g;this.stateAttributes!=null&&(this.stateful=this.stateAttributes);if(this.stateful==null)return;d=this,_.isObject(this.stateful)&&this.defaultState==null&&(this.defaultState=this.stateful),this.state||(this.state=new Luca.ViewState(this.defaultState||{})),f=this,this.get=function(){return f.state.get.apply(f.state,arguments)},this.set=function(){return f.state.set.apply(f.state,arguments)},g=this.state.toJSON();for(c in g)e=g[c],b="on"+_.str.capitalize(c)+"Change",a="get"+_.str.capitalize(c),_.isFunction(this[a])||1,_.isFunction(this[b])&&1;return Luca.concerns.StateModel.__setupModelBindings.call(this,"on")},__setupModelBindings:function(a){var b,c,d,e,f,g;a==null&&(a="on"),f=this,g=this.stateChangeEvents;for(b in g)d=g[b],c=_.isString(d)?f[d]:d,b==="*"?f[a]("state:change",c,f):f[a]("state:change:"+b,c,f);return e=f.state,f.state[a]("change",Luca.concerns.StateModel.__onModelChange,f)}}}.call(this),function(){Luca.concerns.Templating={__initializer:function(){var a,b,c;c=Luca.util.read.call(this,this.bodyTemplateVars)||{};if(a=this.bodyTemplate){this.$el.empty();try{b=Luca.template(a,c)}catch(d){console.log("Error Rendering "+a+" in View: "+((typeof this.identifier=="function"?this.identifier():void 0)||this.name||this.cid))}return Luca.View.prototype.$html.call(this,b)}}}}.call(this),function(){var a,b;a=Luca.register("Luca.Model"),a["extends"]("Backbone.Model"),a.includes("Luca.Events"),a.defines({initialize:function(){return Backbone.Model.prototype.initialize(this,arguments),b.call(this),Luca.concern.setup.call(this)},read:function(a){return _.isFunction(this[a])?this[a].call(this):this.get(a)||this[a]},get:function(a){var b;return((b=this.computed)!=null?b.hasOwnProperty(a):void 0)?this._computed[a]:Backbone.Model.prototype.get.call(this,a)}}),b=function(){var a,b,c,d,e=this;if(_.isUndefined(this.computed))return;this._computed={},c=this.computed,d=[];for(a in c)b=c[a],this.on("change:"+a,function(){return e._computed[a]=e.read(a)}),_.isString
10
- (b)&&(b=b.split(",")),d.push(_(b).each(function(b){e.on("change:"+b,function(){return e.trigger("change:"+a)});if(e.has(b))return e.trigger("change:"+a)}));return d},Luca.Model._originalExtend=Backbone.Model.extend,Luca.Model.extend=function(a){var b,c,d,e,f;a==null&&(a={}),a.concerns!=null&&(a.concerns||(a.concerns=a.concerns)),b=Luca.Model._originalExtend.call(this,a);if(a.concerns!=null&&_.isArray(a.concerns)){f=a.concerns;for(d=0,e=f.length;d<e;d++)c=f[d],Luca.decorate(b)["with"](c)}return b}}.call(this),function(){var a;a=Luca.register("Luca.Collection"),a["extends"]("Backbone.QueryCollection"),a.includes("Luca.Events"),a.triggers("after:initialize","before:fetch","after:response"),a.publicConfiguration({model:Luca.Model,cachedMethods:[],remoteFilter:!1,cache_key:void 0,manager:void 0,initialize:function(a,b){var c,d=this;a==null&&(a=[]),this.options=b,_.extend(this,this.options),this._reset(),this.cached&&console.log("The @cached property of Luca.Collection is being deprecated. Please change to cache_key");if(this.cache_key||(this.cache_key=this.cached))this.bootstrap_cache_key=Luca.util.read(this.cache_key);(this.registerAs||this.registerWith)&&console.log("This configuration API is deprecated. use @name and @manager properties instead"),this.name||(this.name=this.registerAs),this.manager||(this.manager=this.registerWith),this.manager!=null&&(this.manager=Luca.util.read(this.manager)),this.name&&!this.manager&&(this.manager=Luca.CollectionManager.get()),this.manager&&(this.name||(this.name=Luca.util.read(this.cache_key)),this.name=Luca.util.read(this.name),!this["private"]&&!this.anonymous&&this.bind("after:initialize",function(){return d.register(d.manager,d.name,d)}));if(this.useLocalStorage===!0&&window.localStorage!=null)throw c=this.bootstrap_cache_key||this.name,"Must specify a cache_key property or method to use localStorage";return _.isArray(this.data)&&this.data.length>0&&(this.memoryCollection=!0),this.useNormalUrl!==!0&&this.__wrapUrl(),Backbone.Collection.prototype.initialize.apply(this,[a,this.options]),a&&this.reset(a,{silent:!0,parse:b!=null?b.parse:void 0}),Luca.concern.setup.call(this),Luca.util.setupHooks.call(this,this.hooks),this.setupMethodCaching(),this.trigger("after:initialize")},__wrapUrl:function(){var a,b,c=this;return _.isFunction(this.url)?this.url=_.wrap(this.url,function(a){var b,d,e,f,g;return g=a.apply(c),e=g.split("?"),e.length>1&&(b=_.last(e)),f=c.queryString(),b&&g.match(b)&&(f=f.replace(b,"")),d=""+g+"?"+f,d.match(/\?$/)&&(d=d.replace(/\?$/,"")),d}):(b=this.url,a=this.queryString(),this.url=_([b,a]).compact().join("?"))},queryString:function(){var a,b=this;return a=_(this.base_params||(this.base_params=Luca.Collection.baseParams())).inject(function(a,b,c){var d;return d=""+c+"="+b,a.push(d),a},[]),_.uniq(a).join("&")},resetFilter:function(){return this.base_params=_(Luca.Collection.baseParams()).clone(),this},applyFilter:function(a,b){return a==null&&(a={}),b==null&&(b={}),b=_(b).clone(),b.remote!=null==1||this.remoteFilter===!0?(this.applyParams(a),this.fetch(_.extend(b,{refresh:!0,remote:!0}))):this.reset(this.query(a,b))},applyParams:function(a){return this.base_params=_(Luca.Collection.baseParams()).clone()||{},_.extend(this.base_params,a),this},register:function(a,b,c){b==null&&(b=""),a||(a=Luca.CollectionManager.get());if(!(b.length>=1))throw"Attempt to register a collection without specifying a key.";_.isString(a)&&(a=Luca.util.resolve(a));if(a==null)throw"Attempt to register with a non existent collection manager.";if(_.isFunction(a.add))return a.add(b,c);if(_.isObject(a))return a[b]=c},loadFromBootstrap:function(){if(!this.bootstrap_cache_key)return;return this.reset(this.cached_models()),this.trigger("bootstrapped",this)},bootstrap:function(){return this.loadFromBootstrap()},cached_models:function(){return Luca.Collection.cache(this.bootstrap_cache_key)},fetch:function(a){var b;a==null&&(a={}),this.trigger("before:fetch",this);if(this.memoryCollection===!0)return this.reset(this.data);if(this.cached_models().length&&a.refresh!==!0&&a.remote!==!0)return this.bootstrap();b=_.isFunction(this.url)?this.url():this.url;if(!(b&&b.length>1||this.localStorage))return!0;this.fetching=!0;try{return Backbone.Collection.prototype.fetch.apply(this,arguments)}catch(c){throw console.log("Error in Collection.fetch",c),c}},onceLoaded:function(a,b){var c,d=this;b==null&&(b={}),_.defaults(b,{autoFetch:!0});if(this.length>0&&!this.fetching){a.apply(this,[this]);return}c=function(){return a.apply(d,[d])},this.bind("reset",function(){return c(),this.unbind("reset",this)});if(!this.fetching&&!!b.autoFetch)return this.fetch()},ifLoaded:function(a,b){var c,d=this;b==null&&(b={scope:this,autoFetch:!0}),c=b.scope||this,this.length>0&&!this.fetching&&a.apply(c,[this]),this.bind("reset",function(b){return a.call(c,b)});if(!(this.fetching===!0||!b.autoFetch||this.length>0))return this.fetch()},parse:function(a){var b;return this.fetching=!1,this.trigger("after:response",a),b=this.root!=null?a[this.root]:a,this.bootstrap_cache_key&&Luca.Collection.cache(this.bootstrap_cache_key,b),b},restoreMethodCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],a.original!=null?(a.args=void 0,d.push(this[b]=a.original)):d.push(void 0);return d},clearMethodCache:function(a){return this._methodCache[a].value=void 0},clearAllMethodsCache:function(){var a,b,c,d;c=this._methodCache,d=[];for(b in c)a=c[b],d.push(this.clearMethodCache(b));return d},setupMethodCaching:function(){var b,c,d;if(((d=this.cachedMethods)!=null?d.length:void 0)>0)return a=this,c=["reset","add","remove"],b=this._methodCache={},_(this.cachedMethods).each(function(d){var e,f,g,h,i;b[d]={name:d,original:a[d],value:void 0},a[d]=function(){var c;return(c=b[d]).value||(c.value=b[d].original.apply(a,arguments))};for(h=0,i=c.length;h<i;h++)f=c[h],a.bind(f,function(){return a.clearAllMethodsCache()});e=d.split(":")[1];if(e)return g=e.split(","),_(g).each(function(b){return a.bind("change:"+b,function(){return a.clearMethodCache({method:d})})})});return},query:function(a,b){var c;return a==null&&(a={}),b==null&&(b={}),Backbone.QueryCollection!=null?(_.isFunction(c=b.prepare||this.prepareQuery)&&(a=c(a)),Backbone.QueryCollection.prototype.query.call(this,a,b)):this.models}}),a.register(),_.extend(Luca.Collection.prototype,{trigger:function(){return Luca.enableGlobalObserver&&(Luca.CollectionObserver||(Luca.CollectionObserver=new Luca.Observer({type:"collection"})),Luca.CollectionObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)}}),Luca.Collection._originalExtend=Backbone.Collection.extend,Luca.Collection.extend=function(a){var b,c,d,e,f;a==null&&(a={}),a.concerns!=null&&(a.concerns||(a.concerns=a.concerns)),b=Luca.Collection._originalExtend.call(this,a);if(a.concerns!=null&&_.isArray(a.concerns)){f=a.concerns;for(d=0,e=f.length;d<e;d++)c=f[d],Luca.decorate(b)["with"](c)}return b},Luca.Collection.namespace=function(a){var b;return _.isString(a)&&(a=Luca.util.resolve(a)),a!=null&&(Luca.Collection.__defaultNamespace=a),(b=Luca.Collection).__defaultNamespace||(b.__defaultNamespace=window||global),Luca.util.read(Luca.Collection.__defaultNamespace)},Luca.Collection.baseParams=function(a){return _.isString(a)&&(a=Luca.util.resolve(a)),a&&(Luca.Collection._baseParams=a),Luca.util.read(Luca.Collection._baseParams)},Luca.Collection.resetBaseParams=function(){return Luca.Collection._baseParams={}},Luca.Collection._bootstrapped_models={},Luca.Collection.bootstrap=function(a){return _.extend(Luca.Collection._bootstrapped_models,a)},Luca.Collection.cache=function(a,b){return b?Luca.Collection._bootstrapped_models[a]=b:Luca.Collection._bootstrapped_models[a]||[]}}.call(this),function(){var a,b,c,d=[].slice;c=Luca.register("Luca.View"),c["extends"]("Backbone.View"),c.includes("Luca.Events","Luca.concerns.DomHelpers","Luca.concerns.DevelopmentToolHelpers"),c.mixesIn("DomHelpers","Templating","EnhancedProperties","CollectionEventBindings","ApplicationEventBindings","StateModel"),c.triggers("before:initialize","after:initialize","before:render","after:render","first:activation","activation","deactivation"),c.publicConfiguration({name:void 0,autoBindEventHandlers:!1,_inheritEvents:void 0}),c.publicMethods({identifier:function(){return(this.displayName||this.type)+":"+(this.name||this.role||this.cid)},remove:function(){return this.trigger("before:remove",this),Luca.remove(this),Backbone.View.prototype.remove.apply(this,arguments)},initialize:function(b){var c,e,f,g,h;this.options=b!=null?b:{},this.trigger("before:initialize",this,this.options),_.extend(this,this.options),(this.autoBindEventHandlers===!0||this.bindAllEvents===!0)&&a.call(this),this.name!=null&&(this.cid=_.uniqueId(this.name)),this.$el.attr("data-luca-id",this.name||this.cid),Luca.registry.cacheInstance(this.cid,this),this.setupHooks(_(Luca.View.prototype.hooks.concat(this.hooks)).uniq()),Luca.concern.setup.call(this),_.isEmpty(this.events)||this.delegateEvents(),this.trigger("after:initialize",this),((f=this.bindMethods)!=null?f.legth:void 0)>0&&_.bindAll.apply(_,[this].concat(d.call(this.bindMethods)));if(!_.isEmpty(this._inheritEvents)){g=this._inheritEvents,h=[];for(c in g)e=g[c],h.push(this.registerEvent(c,e));return h}},debug:function(){var a;a=1<=arguments.length?d.call(arguments,0):[];if(this.debugMode===!0||window.LucaDebugMode===!0)return a.unshift(this.identifier()),console.log.apply(console,a)},trigger:function(){return Luca.enableGlobalObserver&&(Luca.developmentMode===!0||this.observeEvents===!0)&&(Luca.ViewObserver||(Luca.ViewObserver=new Luca.Observer({type:"view"})),Luca.ViewObserver.relay(this,arguments)),Backbone.View.prototype.trigger.apply(this,arguments)},make:function(a,b,c){var d;return d=document.createElement(a),b&&Backbone.$(d).attr(b),c!==null&&Backbone.$(d).html(c),d},registerEvent:function(a,b){this.events||(this.events={});if(_.isObject(a))this.events=_.extend(this.events,a);else if(_.isFunction(b)||_.isString(b)&&this[b]!=null)this.events[a]=b;return this.delegateEvents()}}),c.privateMethods({definitionClass:function(){var a;return(a=Luca.util.resolve(this.displayName,window))!=null?a.prototype:void 0},_collections:function(){return Luca.util.selectProperties(Luca.isBackboneCollection,this)},_models:function(){return Luca.util.selectProperties(Luca.isBackboneModel,this)},_views:function(){return Luca.util.selectProperties(Luca.isBackboneView,this)},setupHooks:Luca.util.setupHooks}),c.afterDefinition(function(){if(Backbone.View.prototype.make==null)return Backbone.View.prototype.make=function(){return console.log("Backbone.View::make has been removed from backbone. You should use Luca.View::make instead."),Luca.View.prototype.make}}),c.register(),Luca.View._originalExtend=Backbone.View.extend,Luca.View.renderStrategies={legacy:function(a){var b,d,e,f,g,h=this;return c=this,this.deferrable?(f=this.deferrable_target,Luca.isBackboneCollection(this.deferrable)||(this.deferrable=this.collection),f||(f=this.deferrable),g=this.deferrable_event?this.deferrable_event:Luca.View.deferrableEvent,d=function(){return a.call(c),this.rendered=!0,c.trigger("after:render",c)},c.defer(d).until(f,g),c.trigger("before:render",this),b=this.deferrable_trigger||this.deferUntil,b==null?f[this.deferrable_method||"fetch"].call(f):(e=_.once(function(){var a,b;return typeof (a=h.deferrable)[b=h.deferrable_method||"fetch"]=="function"?a[b]():void 0}),(this.deferrable_target||this).bind(this.deferrable_trigger,e)),this):(this.trigger("before:render",this),a.apply(this,arguments),this.rendered=!0,this.trigger("after:render",this),this)},improved:function(a){var b,d=this;this.trigger("before:render",this),b=function(){return a.apply(d,arguments),d.trigger("after:render",d)},console.log("doing the improved one",this.deferrable);if(this.deferrable!=null&&!_.isString(this.deferrable))throw"Deferrable property is expected to be a event id";return _.isString(this.deferrable)?(console.log("binding to "+this.deferrable+" on "+this.cid),c.on(this.deferrable,function(){return console.log("did the improved one"),b.call(c),c.unbind(listenForEvent,this)})):b.call(this)}},Luca.View.renderWrapper=function(a){var b;return b=a.render,b||(b=function(){return this.trigger("empty:render")}),a.render=function(){var a;a=Luca.View.renderStrategies[this.renderStrategy||(this.renderStrategy="legacy")];if(!_.isFunction(a))throw"Invalid rendering strategy. Please see Luca.View.renderStrategies";return a.call(this,b),this},a},a=function(){var a,c,d,e,f;e=[this.events,this.componentEvents,this.collectionEvents,this.applicationEvents],f=[];for(c=0,d=e.length;c<d;c++)a=e[c],_.isEmpty(a)||f.push(b.call(this,a));return f},b=function(a){var b,c,d;a==null&&(a={}),d=[];for(b in a){c=a[b];if(_.isString(c))try{d.push(_.bindAll(this,c))}catch(e){d.push(console.log("Error binding to handler - "+c+" = "+e+" "+this.identifier()))}else d.push(void 0)}return d},Luca.View.deferrableEvent="reset",Luca.View.extend=function(a){var b,c,d,e,f;a==null&&(a={}),a=Luca.View.renderWrapper(a),a.concerns!=null&&(a.concerns||(a.concerns=a.concerns)),b=Luca.View._originalExtend.call(this,a);if(a.concerns!=null&&_.isArray(a.concerns)){f=a.concerns;for(d=0,e=f.length;d<e;d++)c=f[d],Luca.decorate(b)["with"](c)}return b}}.call(this),function(){var a;a=Luca.register("Luca.Panel"),a.replaces("Luca.Panel"),a["extends"]("Luca.View"),a.configuration({topToolbar:void 0,bottomToolbar:void 0}),a.publicMethods({applyStyles:function(a,b){var c,d,e;a==null&&(a={}),b==null&&(b=!1),d=b?this.$bodyEl():this.$el;for(c in a)e=a[c],d.css(c,e);return this},$bodyEl:function(){var a,b,c,d;return c=this.bodyTagName||"div",b=this.bodyClassName||"view-body",this.bodyEl||(this.bodyEl=""+c+"."+b),a=this.$(this.bodyEl),a.length>0?a:a.length!==0||this.bodyClassName==null&&this.bodyTagName==null?this.$el:(d=this.make(c,{"class":b,"data-auto-appended":!0}),this.$el.append(d),this.$(this.bodyEl))},$wrap:function(a){return _.isString(a)&&!a.match(/[<>]/)&&(a=this.make("div",{"class":a})),this.$el.wrap(a)},$template:function(a,b){return b==null&&(b={}),this.$html(Luca.template(a,b))},$empty:function(){return this.$bodyEl().empty()},$html:function(a){return a!=null?this.$bodyEl().html(a):this.$bodyEl().html()},$append:function(a){return this.$bodyEl().append(a)}}),a.privateMethods({beforeRender:function(){var a;return(a=Luca.View.prototype.beforeRender)!=null&&a.apply(this,arguments),this.styles!=null&&this.applyStyles(this.styles),this.bodyStyles!=null&&this.applyStyles(this.bodyStyles,!0),typeof this.renderToolbars=="function"?this.renderToolbars():void 0},renderToolbars:function(){var a=this;return _(["top","left","right","bottom"]).each(function(b){var c;if(c=a[""+b+"Toolbar"])return a.renderToolbar(b,c)})},renderToolbar:function(a,b){var c;return a==null&&(a="top"),b==null&&(b={}),b.parent=this,b.orientation=a,c=Luca.util.read(b.container),c||(c=Luca.util.read(b.targetEl)),Luca.Panel.attachToolbar.call(this,b,c)}}),a.classMethods({attachToolbar:function(a,b){var c,d,e,f;return a==null&&(a={}),a.orientation||(a.orientation="top"),a.type||(a.type=a.ctype||(a.ctype=this.toolbarType||"panel_toolbar")),a.additionalClassNames=""+Luca.config.toolbarContainerClass+" "+a.orientation,e=Luca.util.lazyComponent(a),a.orientation==="bottom"&&(this.getBottomToolbar||(this.getBottomToolbar=function(){return e})),a.orientation==="top"&&(this.getTopToolbar||(this.getTopToolbar=function(){return e})),a.orientation==="right"&&(this.getRightToolbar||(this.getRightToolbar=function(){return e})),a.orientation==="left"&&(this.getLeftToolbar||(this.getLeftToolbar=function(){return e})),d=this.bodyClassName||this.bodyTagName,c=a.attachmentAction,c||(c=function(){switch(a.orientation){case"top":case"left":return d&&(b!=null?!b.length:!void 0)>0?"before":"prepend";case"bottom":case"right":return d&&(b!=null?!b.length:!void 0)>0?"after":"append"}}()),f=(b!=null?b.length:void 0)>0?this.$(b):this.$bodyEl(),f[c](e.render().el)}}),a.defines({version:3})}.call(this),function(){}.call(this),function(){var a,b,c;Luca.CollectionManager=function(){function c(a){var c,d,e,f;this.options=a!=null?a:{},_.extend(this,this.options),d=this;if(c=typeof (e=Luca.CollectionManager).get=="function"?e.get(this.name):void 0)throw"Attempt to create a collection manager with a name which already exists";this.collectionNamespace||(this.collectionNamespace=Luca.util.read(Luca.Collection.namespace)),(f=Luca.CollectionManager).instances||(f.instances={}),_.extend(this,Backbone.Events),_.extend(this,Luca.Events),Luca.CollectionManager.instances[this.name]=d,Luca.CollectionManager.get=function(a){return a==null?d:Luca.CollectionManager.instances[a]},this.state=new Luca.Model,this.initialCollections&&this.on("ready",b,this),this.autoStart===!0&&this.trigger("ready")}return c.prototype.name="primary",c.prototype.__collections={},c.prototype.autoStart=!0,c.prototype.relayEvents=!0,c.prototype.add=function(a,b){var c;return(c=this.currentScope())[a]||(c[a]=b)},c.prototype.allCollections=function(){return _(this.currentScope()).values()},c.prototype.create=function(b,c,d){var e,f,g;c==null&&(c={}),d==null&&(d=[]),e=c.base,e||(e=a.call(this,b)),c["private"]&&(c.name="");try{f=new e(d,c)}catch(h){throw console.log("Error creating collection",e,c,b),h}return this.add(b,f),g=this,this.relayEvents===!0&&this.bind("*",function(){return console.log("Relay Events on Collection Manager *",f,arguments)}),f},c.prototype.currentScope=function(){var a,b;return(a=this.getScope())?(b=this.__collections)[a]||(b[a]={}):this.__collections},c.prototype.each=function(a){return _(this.all()).each(a)},c.prototype.get=function(a){return this.currentScope()[a]},c.prototype.getScope=function(){return void 0},c.prototype.destroy=function(a){var b;return b=this.get(a),delete this.currentScope()[a],b},c.prototype.getOrCreate=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.get(a)||this.create(a,b,c,!1)},c.prototype.collectionCountDidChange=function(){if(this.allCollectionsLoaded())return this.trigger("all_collections_loaded"),this.trigger("initial:load")},c.prototype.allCollectionsLoaded=function(){return this.totalCollectionsCount()===this.loadedCollectionsCount()},c.prototype.totalCollectionsCount=function(){return this.state.get("collections_count")},c.prototype.loadedCollectionsCount=function(){return this.state.get("loaded_collections_count")},c.prototype["private"]=function(a,b,c){return b==null&&(b={}),c==null&&(c=[]),this.create(a,b,c,!0)},c}(),Luca.CollectionManager.isRunning=function(){return _.isEmpty(Luca.CollectionManager.instances)!==!0},Luca.CollectionManager.destroyAll=function(){return Luca.CollectionManager.instances={}},Luca.CollectionManager.loadCollectionsByName=function(a,b){var c,d,e,f,g;g=[];for(e=0,f=a.length;e<f;e++)d=a[e],(c=this.getOrCreate(d))?(c.on("reset",function(){return b(c),c.unbind("reset",this)}),g.push(c.fetch())):g.push(void 0);return g},a=function(a){var b,c,d,e;return b=Luca.util.classify(a),_.isString(this.collectionNamespace)&&(this.collectionNamespace=Luca.util.resolve(this.collectionNamespace)),c=(this.collectionNamespace||window||global)[b],c||(c=(this.collectionNamespace||window||global)[""+b+"Collection"]),c==null&&((e=Luca.Collection.namespaces)!=null?e.length:void 0)>0&&(d=_(Luca.Collection.namespaces.reverse()).map(function(a){return Luca.util.resolve(""+a+"."+b)||Luca.util.resolve(""+a+"."+b+"Collection")}),d=_(d).compact(),d.length>0&&(c=d[0])),c},c=function(){var a,b,c=this;return a=function(a){var b;return b=c.state.get("loaded_collections_count"),c.state.set("loaded_collections_count",b+1),c.trigger("collection_loaded",a.name),a.unbind("reset")},b=this.initialCollections,Luca.CollectionManager.loadCollectionsByName.call(this,b,a)},b=function(){var a=this;return this.state.set({loaded_collections_count:0,collections_count:this.initialCollections.length}),this.state.bind("change:loaded_collections_count",function(){return a.collectionCountDidChange()}),this.useProgressLoader&&(this.loaderView||(this.loaderView=new Luca.components.CollectionLoaderView({manager:this,name:"collection_loader_view"}))),c.call(this),this}}.call(this),function(){var a;a=Luca.register("Luca.SocketManager"),a["extends"]("Luca.Model"),a.defines({defaults:{autoStart:!0,providerAvailable:!1,ready:!1,provider:"faye.js"},initialize:function(a){var b,c,d,e=this;return this.attributes=a!=null?a:{},this.providerLibraryIsAvailable()||this.loadProviderSource(),(d=Luca.Model.prototype.initialize)!=null&&d.apply(this,arguments),c=this,b=function(){if(e.isReady())return e.connect()},c.on("change:ready",function(){return b(),c.unbind("change:ready",this)}),c.on("change:providerAvailable",function(){return b(),c.unbind("change:ready",this)}),this.on("ready",_.once(function(){return e.set("ready",!0)})),this.trigger("change")},isReady:function(){return this.get("ready")===!0&&this.get("providerAvailable")===!0},providerLibraryIsAvailable:function(){var a;return a=function(){switch(this.get("provider")){case"socket.io":return"io";case"faye.js":return"Faye.Client"}}.call(this),Luca.util.resolve(a)!=null},connect:function(){switch(this.get("provider")){case"socket.io":return this.client=io.connect(this.get("host"));case"faye.js":return this.client=new Faye.Client(this.get("host")),this.set("client",this.client)}},providerSourceLoaded:function(){return this.set("providerAvailable",!0)},providerSourceUrl:function(){switch(this.get("provider")){case"socket.io":return""+this.get("host")+"/socket.io/socket.io.js";case"faye.js":return""+this.get("host")+"/faye.js"}},loadProviderSource:function(){var a,b=this;return a=document.createElement("script"),a.setAttribute("type","text/javascript"),a.setAttribute("src",this.providerSourceUrl()),a.onload=_.bind(this.providerSourceLoaded,this),Luca.util.isIE()&&(a.onreadystatechange=function(){if(a.readyState==="loaded")return b.providerSourceLoaded()}),document.getElementsByTagName("head")[0].appendChild(a)}})}.call(this),function(){}.call(this),function(){var a,b,c,d,e,f,g,h;b=Luca.register("Luca.Container"),b["extends"]("Luca.Panel"),b.triggers("before:components","before:render:components","before:layout","after:components","after:layout","first:activation"),b.replaces("Luca.Container"),b.publicConfiguration({components:[],defaults:{},extensions:{},componentEvents:{}}),b.privateConfiguration({className:"luca-ui-container",isContainer:!0,generateComponentElements:!1,emptyContainerElements:!1,componentTag:"div",componentClass:"luca-ui-panel",rendered:!1}),b.privateMethods({initialize:function(a){var b,c,d,e;this.options=a!=null?a:{},_.extend(this,this.options),this.components||(this.components=this.fields||(this.fields=this.pages||(this.pages=this.cards||(this.cards=this.views)))),e=this.components;for(c=0,d=e.length;c<d;c++)b=e[c],_.isString(b)&&(b={type:b,role:b,name:b});return _.bindAll(this,"beforeRender"),this.setupHooks(Luca.Container.prototype.hooks),h(this),Luca.View.prototype.initialize.apply(this,arguments)},remove:function(){return Luca.View.prototype.remove.apply(this,arguments),this.eachComponent(function(a){return typeof a.remove=="function"?a.remove():void 0})},beforeRender:function(){var a;return f.call(this),e.call(this),(a=Luca.Panel.prototype.beforeRender)!=null?a.apply(this,arguments):void 0},customizeContainerEl:function(a,b,c){return a},prepareLayout:function(){var c,d,e,f,g,h,i;b=this,this.componentContainers=_(this.components).map(function(c,d){return a.call(b,c,d)}),c=this._().select(function(a){var c;return _.isString(a.container)&&((c=a.container)!=null?c.match(/^\./):void 0)&&b.$(a.container).length>0});if(c.length>0){i=[];for(g=0,h=c.length;g<h;g++)e=c[g],d=_.uniqueId("container"),f=b.$(e.container),f.length>0?($(f).attr("data-container-assignment",d),i.push(e.container+="[data-container-assignment='"+d+"']")):i.push(void 0);return i}},prepareComponents:function(){var a=this;return b=this,_(this.components).each(function(c,d){var e,f,g,h,i,j;e=f=(i=a.componentContainers)!=null?i[d]:void 0,e["class"]=e["class"]||e.className||e.classes,a.generateComponentElements&&(h=a.make(a.componentTag,f,""),a.$append(h)),b.defaults!=null&&(c=_.defaults(c,b.defaults||{})),_.isArray(b.extensions)&&_.isObject((j=b.extensions)!=null?j[d]:void 0)&&(g=b.extensions[d],c=_.extend(c,g)),c.role!=null&&_.isObject(b.extensions)&&_.isObject(b.extensions[c.role])&&(g=b.extensions[c.role],c=_.extend(c,g));if(c.container==null)return a.generateComponentElements&&(c.container="#"+f.id),c.container||(c.container=a.$bodyEl())})},createComponents:function(){var a,c=this;if(this.componentsCreated===!0)return;return a=this.componentIndex={name_index:{},cid_index:{},role_index:{}},b=this,this.components=_(this.components).map(function(a,d){var e,f,h;return e=Luca.isComponent(a)?a:(a.component!=null&&!a.type&&!a.ctype?(a.type=a.component,a.name||(a.name=a.component),a.role||(a.role=a.component)):void 0,a.type||(a.type=a.ctype),a.type==null?a.components!=null?a.type=a.ctype="container":a.type=a.ctype=Luca.defaultComponentType:void 0,a._parentCid||(a._parentCid=b.cid),f=Luca.util.lazyComponent(a)),!e.container&&((h=e.options)!=null?h.container:void 0)&&(e.container=e.options.container),e.getParent||(e.getParent=function(){return Luca(e._parentCid)}),e.container==null&&(console.log(e,d,c),console.error("could not assign container property to component on container "+(c.name||c.cid))),g(e).at(d)["in"](c.componentIndex),e}),this.componentsCreated=!0,a},renderComponents:function(a){return this.debugMode=a!=null?a:"",this.debug("container render components"),b=this,_(this.components).each(function(a){var c;try{return a.trigger("before:attach"),c=b.$(a.container),c.length===0&&(_.isString(a.container)&&1,c.length===0&&(c=this.$(a.container).eq(0))),this.emptyContainerElements===!0&&c.empty(),c.append(a.el),a.trigger("after:attach"),a.render(),a.rendered=!0}catch(d){console.log("Error Rendering Component "+(a.name||a.cid),a),_.isObject(d)&&(console.log(d.message),console.log(d.stack));if(Luca.silenceRenderErrors!=null!=1)throw d}})},firstActivation:function(){var a;return a=this,this.each(function(b,c){var d;if((b!=null?b.previously_activated:void 0)!==!0)return b!=null&&(d=b.trigger)!=null&&d.call(b,"first:activation",b,a),b.previously_activated=!0})},registerComponentEvents:function(a,c){var d,e,f,g,h,i,j,k,l=this;c==null&&(c="on"),b=this,i=a||this.componentEvents||{},k=[];for(h in i){g=i[h],j=h.split(" "),e=j[0],f=j[1];if(!_.isFunction(this[g]))throw console.log("Error registering component event",h,e,f),"Invalid component event definition "+h+". Specified handler is not a method on the container";if(e==="*")k.push(this.eachComponent(function(a){return a.on(f,l[g],b)}));else{d=this.findComponentForEventBinding(e);if(d==null||!Luca.isComponent(d))throw console.log("Error registering component event",h,e,f),"Invalid component event definition: "+e;k.push(d[c](f,this[g],b))}}return k}}),b.publicMethods({_:function(){return _(this.components)},pluck:function(a){return this._().pluck(a)},invoke:function(a){return this._().invoke(a)},select:function(a){return this._().select(a)},detect:function(a){return this._().detect(a)},reject:function(a){return this._().reject(a)},map:function(a){return this._().map(a)},subContainers:function(){return this.select(function(a){return a.isContainer===!0})},roles:function(){return _(this.allChildren()).chain().pluck("role").compact().value()},allChildren:function(){var a,b;return a=this.components,b=_(this.subContainers()).map(function(a){return a!=null?typeof a.allChildren=="function"?a.allChildren():void 0:void 0}),_([a,b]).chain().compact().flatten().value()},find:function(a){return _(this.components).detect(function(b){return b.name===a})},findComponentForEventBinding:function(a,b){return b==null&&(b=!0),this.findComponentByName(a,b)||this.findComponentByGetter(a,b)||this.findComponentByRole(a,b)},findComponentByGetter:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return(b!=null?b.getter:void 0)===a})},findComponentByRole:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return(b!=null?b.role:void 0)===a||(b!=null?b.type:void 0)===a||(b!=null?b.ctype:void 0)===a})},findComponentByType:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return a===(b.type||b.ctype)})},findComponentByName:function(a,b){return b==null&&(b=!1),_(this.allChildren()).detect(function(b){return b.name===a})},findComponentById:function(a,b){return b==null&&(b=!1),this.findComponent(a,"cid_index",b)},findComponent:function(a,b,c){var d,e,f,g;b==null&&(b="name"),c==null&&(c=!1),this.componentsCreated!==!0&&this.createComponents(),e=(g=this.componentIndex)!=null?g[b][a]:void 0,d=this.components[e];if(d)return d;if(c===!0)return f=_(this.components).detect(function(c){return c!=null?typeof c.findComponent=="function"?c.findComponent(a,b,!0):void 0:void 0}),f!=null?typeof f.findComponent=="function"?f.findComponent(a,b,!0):void 0:void 0},each:function(a){return this.eachComponent(a,!1)},eachComponent:function(a,b){var c=this;return b==null&&(b=!0),_(this.components).each(function(c,d){var e;a.call(c,c,d);if(b)return c!=null?(e=c.eachComponent)!=null?e.apply(c,[a,b]):void 0:void 0})},indexOfComponentName:function(a){var b;return b=_(this.components).pluck("name"),_(b).indexOf(a)},indexOf:function(a){if(_.isString(a))return this.indexOfComponentName(a);if(_.isObject(a))return _(this.components).indexOf(a)},activeComponent:function(){return this.activeItem?this.components[this.activeItem]:this},componentElements:function(){return this.$("[data-luca-parent='"+(this.name||this.cid)+"']")},getComponent:function(a){return this.components[a]},isRootComponent:function(){return this.rootComponent===!0||this.getParent==null},getRootComponent:function(){return this.isRootComponent()?this:this.getParent().getRootComponent()},selectByAttribute:function(a,b,c){var d;return b==null&&(b=void 0),c==null&&(c=!1),d=_(this.components).map(function(d){var e,f;return e=[],f=d[a],(f===b||b==null&&f!=null)&&e.push(d),c===!0&&e.push(typeof d.selectByAttribute=="function"?d.selectByAttribute(a,b,!0):void 0),_.compact(e)}),_.flatten(d)}}),b.register(),Luca.Container.componentRenderer=function(a,b){var c;return c=$(b.container)[b.attachWith||"append"],c(b.render().el)},f=function(){return this.trigger("before:layout",this),this.prepareLayout(),this.trigger("after:layout",this)},a=function(a,b){var c,d;return d=[],a.height!=null&&d.push("height: "+(_.isNumber(a.height)?a.height+"px":a.height)),a.width!=null&&d.push("width: "+(_.isNumber(a.width)?a.width+"px":a.width)),a.float&&d.push("float: "+a.float),c={"class":(a!=null?a.classes:void 0)||this.componentClass,id:""+this.cid+"-"+b,style:d.join(";"),"data-luca-parent":this.name||this.cid},this.customizeContainerEl!=null&&(c=this.customizeContainerEl(c,a,b)),c},c=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return(a!=null?a.getter:void 0)!=null}),_(a).each(function(a){var c;return b[c=a.getter]||(b[c]=function(){return a})})},d=function(){var a;return b=this,a=_(this.allChildren()).select(function(a){return(a!=null?a.role:void 0)!=null}),_(a).each(function(a){var c,d;return c=_.str.camelize("get_"+a.role),d=function(){return a},b[c]||(b[c]=_.bind(d,b))})},e=function(){return this.trigger("before:components",this,this.components),this.prepareComponents(),this.trigger("before:create:components",this,this.components),this.createComponents(),this.trigger("before:render:components",this,this.components),this.renderComponents(),this.trigger("after:components",this,this.components),this.skipGetterMethods!==!0&&(c.call(this),d.call(this)),this.registerComponentEvents()},h=function(){return!0},g=function(a){return{at:function(b){return{"in":function(c){a.cid!=null&&(c.cid_index[a.cid]=b),a.role!=null&&(c.role_index[a.role]=b);if(a.name!=null)return c.name_index[a.name]=b}}}}}}.call(this),function(){var a;a=Luca.register("Luca.containers.CardView"),a["extends"]("Luca.Container"),a.publicConfiguration({activeCard:0,components:[]}),a.classInterface({activationContext:"current"}),a.privateConfiguration({hooks:["before:card:switch","after:card:switch"],componentClass:"luca-ui-card",generateComponentElements:!0}),a.publicMethods({atFirst:function(){return this.activeCard===0},atLast:function(){return this.activeCard===this.components.length-1},next:function(){if(this.atLast())return;return this.activate(this.activeCard+1)},previous:function(){if(this.atFirst())return;return this.activate(this.activeCard-1)},cycle:function(){var a;return a=this.atLast()?0:this.activeCard+1,this.activate(a)},find:function(a){return _(this.components).detect(function(b){return b.name===a})},activate:function(
11
- a,b,c){var d,e,f,g=this;b==null&&(b=!1),_.isFunction(b)&&(b=!1,c=b);if(a===this.activeCard)return;f=this.activeComponent(),e=this.getComponent(a);if(e==null){a=this.indexOf(a);if(!(e=this.getComponent(a)))return}b!==!0&&(this.trigger("before:card:switch",f,e),f!=null&&f.trigger("before:deactivation",this,f,e),e!=null&&e.trigger("before:activation",this,f,e),_.defer(function(){return g.$el.data(g.activeAttribute||"active-card",e.name)})),this.componentElements().hide(),e.previously_activated!==!0&&(e.rendered===!0?e.trigger("first:activation"):e.once("after:render",function(){return e.rendered=!0,e.trigger("first:activation")}),e.previously_activated=!0),this.activeCard=a,this.activeComponentElement().show(),b!==!0&&(this.trigger("after:card:switch",f,e),f!=null&&f.trigger("deactivation",this,f,e),e!=null&&e.trigger("activation",this,f,e)),d=this,Luca.containers.CardView.activationContext==="current"&&(d=e);if(_.isFunction(c))return c.apply(d,[this,f,e])}}),a.privateMethods({initialize:function(a){return this.options=a,this.components||(this.components=this.pages||(this.pages=this.cards)),Luca.Container.prototype.initialize.apply(this,arguments),this.setupHooks(this.hooks),this.defer(this.simulateActivationEvent,this).until("after:render")},simulateActivationEvent:function(){var a;a=this.activeComponent();if(a!=null&&(this.visible||this.$el.is(":visible"))){a!=null&&a.trigger("activation",this,a,a);if(!a.previously_activated)return a.trigger("first:activation"),a.previously_activated=!0}},prepareComponents:function(){var a;return(a=Luca.Container.prototype.prepareComponents)!=null&&a.apply(this,arguments),this.componentElements().hide(),this.activeComponentElement().show()},activeComponentElement:function(){return this.componentElements().eq(this.activeCard)},activeComponent:function(){return this.getComponent(this.activeCard)},customizeContainerEl:function(a,b,c){return a.style+=c===this.activeCard?"display:block;":"display:none;",a},firstActivation:function(){var a;if(a=this.activeComponent())return a.trigger("first:activation",this,this.activeComponent())}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.containers.ModalView"),a["extends"]("Luca.Container"),a.publicConfiguration({closeOnEscape:!0,showOnInitialize:!1,backdrop:!1,className:"modal"}),a.publicMethods({container:function(){return $("body")},toggle:function(){return this.$el.modal("toggle")},show:function(){return this.$el.modal("show")},hide:function(){return this.$el.modal("hide")},render:function(){return this.$el.addClass("modal"),this.fade===!0&&this.$el.addClass("fade"),$("body").append(this.$el),this.$el.modal({backdrop:this.backdrop===!0,keyboard:this.closeOnEscape===!0,show:this.showOnInitialize===!0}),this}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.containers.PageController"),a["extends"]("Luca.Container"),a.privateMethods({initialize:function(a){var b,c,d,e;this.options=a!=null?a:{},this.components||(this.components=this.pages||this.options.pages),e=this.components;for(c=0,d=e.length;c<d;c++)b=e[c],b.components||(b.components=b.pages);return Luca.Container.prototype.initialize.apply(this,arguments)}}),a.register()}.call(this),function(){var a,b,c,d;c=Luca.register("Luca.PanelToolbar"),c["extends"]("Luca.View"),c.defines({buttons:[],orientation:"top",autoBindEventHandlers:!0,events:{"click a.btn, click .dropdown-menu li":"clickHandler"},initialize:function(a){var b;this.options=a!=null?a:{},this._super("initialize",this,arguments);if(this.group===!0&&((b=this.buttons)!=null?b.length:void 0)>=0)return this.buttons=[{group:!0,buttons:this.buttons}]},clickHandler:function(a){var b,c,d,e,f;d=e=$(a.target),d.is("i")&&(d=e=$(a.target).parent()),this.selectable===!0&&(e.siblings().removeClass("is-selected"),d.addClass("is-selected"));if(!(b=e.data("eventid")))return;return c=Luca.util.hook(b),f=this.parent||this,_.isFunction(f[c])?f[c].call(this,d,a):f.trigger(b,d,a)},beforeRender:function(){this._super("beforeRender",this,arguments),this.well===!0&&this.$el.addClass("well"),this.selectable===!0&&this.$el.addClass("btn-selectable"),this.$el.addClass("toolbar-"+this.orientation),this.align==="right"&&this.$el.addClass("pull-right");if(this.align==="left")return this.$el.addClass("pull-left")},render:function(){var a,b,c,e;this.$el.empty(),e=d(this.buttons);for(b=0,c=e.length;b<c;b++)a=e[b],this.$el.append(a);return this}}),b=Luca.View.prototype.make,a=function(a,c){var e,f,g,h,i,j,k,l,m,n,o,p;c==null&&(c=!0);if(a.ctype!=null||a.type!=null){a.className||(a.className=""),a.className+="toolbar-component",n=Luca(a).render();if(Luca.isBackboneView(n))return n.$el}return a.spacer?b("div",{"class":"spacer "+a.spacer}):a.text?b("div",{"class":"toolbar-text"},a.text):(p="btn-group",a.wrapper!=null&&(p+=""+a.wrapper),a.align!=null&&(p+="pull-"+a.align+" align-"+a.align),a.selectable===!0&&(p+="btn-selectable"),a.group!=null&&a.buttons!=null?(h=d(a.buttons,!1),b("div",{"class":p},h)):(l=a.label||(a.label=""),a.eventId||(a.eventId=_.string.dasherize(a.label.toLowerCase())),a.icon&&(_.string.isBlank(l)&&(l=" "),a.white&&(o="icon-white"),l="<i class='"+(o||"")+" icon-"+a.icon+"' /> "+l),f={"class":_.compact(["btn",a.classes,a.className]).join(" "),"data-eventId":a.eventId,title:a.title||a.description},a.color!=null&&(f["class"]+=" btn-"+a.color),a.selected!=null&&(f["class"]+=" is-selected"),a.dropdown&&(l=""+l+" <span class='caret'></span>",f["class"]+=" dropdown-toggle",f["data-toggle"]="dropdown",k=function(){var c,d,e,f;e=a.dropdown,f=[];for(c=0,d=e.length;c<d;c++)j=e[c],_.isObject(j)&&(j=_.values(j).reverse()),m=b("a",{},j[1]),f.push(b("li",{"data-eventId":j[0]},m));return f}(),i=b("ul",{"class":"dropdown-menu"},k)),g=b("a",f,l),e="btn-group",a.align!=null&&(e+=" align-"+a.align),c===!0?b("div",{"class":e},[g,i]):g))},d=function(b,c){var d,e,f,g;b==null&&(b=[]),c==null&&(c=!0),g=[];for(e=0,f=b.length;e<f;e++)d=b[e],g.push(a(d,c));return g}}.call(this),function(){var a;a=Luca.register("Luca.containers.TabView"),a["extends"]("Luca.containers.CardView"),a.triggers("before:select","after:select"),a.publicConfiguration({tab_position:"top",tabVerticalOffset:"50px"}),a.privateConfiguration({additionalClassNames:"tabbable",navClass:"nav-tabs",bodyTemplate:"containers/tab_view",bodyClassName:"tab-content",skipGetterMethods:!0}),a.defines({initialize:function(a){return this.options=a!=null?a:{},this.navStyle==="list"&&(this.navClass="nav-list"),Luca.containers.CardView.prototype.initialize.apply(this,arguments),_.bindAll(this,"select","highlightSelectedTab"),this.setupHooks(this.hooks),this.bind("after:card:switch",this.highlightSelectedTab)},activeTabSelector:function(){return this.tabSelectors().eq(this.activeCard||this.activeTab||this.activeItem)},beforeLayout:function(){var a;return this.$el.addClass("tabs-"+this.tab_position),this.activeTabSelector().addClass("active"),this.createTabSelectors(),(a=Luca.containers.CardView.prototype.beforeLayout)!=null?a.apply(this,arguments):void 0},afterRender:function(){var a,b;(b=Luca.containers.CardView.prototype.afterRender)!=null&&b.apply(this,arguments),a=this.tabContainer().attr("id"),this.registerEvent("click #"+a+" li a","tabSelectClickHandler");if(Luca.config.enableBootstrap&&(this.tab_position==="left"||this.tab_position==="right"))return this.tabContainerWrapper().addClass("span2"),this.tabContentWrapper().addClass("span9")},createTabSelectors:function(){return a=this,this.each(function(b,c){var d,e,f,g;b.tabIcon&&(d="<i class='icon-"+b.tabIcon+"'></i>"),e="<a href='#'>"+(d||"")+" "+b.title+"</a>",f=a.make("li",{"class":"tab-selector","data-target":c},e),a.tabContainer().append(f);if(b.navHeading!=null&&((g=a.navHeadings)!=null?!g[b.navHeading]:!void 0))return $(f).before(a.make("li",{"class":"nav-header"},b.navHeading)),a.navHeadings||(a.navHeadings={}),a.navHeadings[b.navHeading]=!0})},highlightSelectedTab:function(){return this.tabSelectors().removeClass("active"),this.activeTabSelector().addClass("active")},tabSelectClickHandler:function(a){var b,c,d;return a!=null&&a.preventDefault(),b=c=$(a.target),b=c||(c=this.tabSelectors()[0]),d=c.parent().data("target"),this.select(d)},select:function(a){return a==null&&(a=0),this.trigger("before:select",this),this.activate(a),this.trigger("after:select",this)},componentElements:function(){return this.$(">.tab-content >."+this.componentClass)},tabContentWrapper:function(){return $("#"+this.cid+"-tab-view-content")},tabContainerWrapper:function(){return $("#"+this.cid+"-tabs-selector")},tabContainer:function(){return this.$("ul."+this.navClass,this.tabContainerWrapper())},tabSelectors:function(){return this.$("li.tab-selector",this.tabContainer())},bodyTemplateVars:function(){return{cid:this.cid,navClass:this.navClass}}})}.call(this),function(){var a;a=Luca.register("Luca.containers.Viewport"),a["extends"]("Luca.Container"),a.defines({fullscreen:!0,fluid:!1,applyWrapper:!0,initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),Luca.config.enableBoostrap===!0&&this.applyWrapper===!0&&(this.wrapperClass=this.fluid===!0?Luca.config.fluidWrapperClass:Luca.config.wrapperClass),Luca.Container.prototype.initialize.apply(this,arguments);if(this.fullscreen===!0)return this.enableFullscreen()},enableFluid:function(){return this.enableWrapper()},disableFluid:function(){return this.disableWrapper()},enableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().addClass(this.wrapperClass)},disableWrapper:function(){if(this.wrapperClass!=null)return this.$el.parent().removeClass(this.wrapperClass)},enableFullscreen:function(){return $("html,body").addClass("luca-ui-fullscreen"),this.$el.addClass("fullscreen-enabled")},disableFullscreen:function(){return $("html,body").removeClass("luca-ui-fullscreen"),this.$el.removeClass("fullscreen-enabled")},beforeRender:function(){var a;(a=Luca.Container.prototype.beforeRender)!=null&&a.apply(this,arguments),this.topNav!=null&&this.renderTopNavigation();if(this.bottomNav!=null)return this.renderBottomNavigation()},height:function(){return this.$el.height()},width:function(){return this.$el.width()},afterRender:function(){var a;(a=Luca.Container.prototype.afterRender)!=null&&a.apply(this,arguments);if(Luca.config.enableBoostrap===!0&&this.containerClassName)return this.$el.children().wrap('<div class="#{ containerClassName }" />')},renderTopNavigation:function(){var a;if(this.topNav==null)return;return _.isString(this.topNav)&&(this.topNav=Luca.util.lazyComponent(this.topNav)),_.isObject(this.topNav)&&((a=this.topNav).ctype||(a.ctype=this.topNav.type||"nav_bar"),Luca.isBackboneView(this.topNav)||(this.topNav=Luca.util.lazyComponent(this.topNav))),this.topNav.app=this,$("body").prepend(this.topNav.render().el)},renderBottomNavigation:function(){}}),Luca.containers.Viewport.defaultWrapperClass=Luca.config.wrapperClass||"container",Luca.containers.Viewport.fluidWrapperClass=Luca.config.fluidWrapperClass||"container-fluid"}.call(this),function(){}.call(this),function(){var a;a=Luca.register("Luca.CollectionView"),a["extends"]("Luca.Panel"),a.replaces("Luca.components.CollectionView"),a.mixesIn("QueryCollectionBindings","LoadMaskable","Filterable","Paginatable","Sortable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a.publicConfiguration({collection:void 0,tagName:"ol",bodyClassName:"collection-ui-panel",itemTagName:"li",itemClassName:"collection-item",itemTemplate:void 0,itemRenderer:void 0,itemProperty:void 0,observeChanges:!1}),a.publicMethods({initialize:function(a){var b,c;this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"refresh");if(this.collection==null&&!this.options.collection)throw console.log("Error on initialize of collection view",this),"Collection Views must specify a collection";if(this.itemTemplate==null&&this.itemRenderer==null&&this.itemProperty==null)throw"Collection Views must specify an item template or item renderer function";_.isString(this.collection)&&(Luca.CollectionManager.get()?this.collection=Luca.CollectionManager.get().getOrCreate(this.collection):console.log("String Collection but no collection manager"));if(!Luca.isBackboneCollection(this.collection))throw console.log("Missing Collection on "+(this.name||this.cid),this,this.collection),"Collection Views must have a valid backbone collection";this.on("data:refresh",this.refresh,this),this.on("collection:reset",this.refresh,this),this.on("collection:remove",this.refresh,this),this.on("collection:add",this.refresh,this),this.observeChanges===!0&&this.on("collection:change",this.refreshModel,this),Luca.Panel.prototype.initialize.apply(this,arguments),b=this;if(((c=this.getCollection())!=null?c.length:void 0)>0)return this.on("after:render",function(){return b.refresh(),b.unbind("after:render",this)})},locateItemElement:function(a){return this.$("."+this.itemClassName+"[data-model-id='"+a+"']")},refresh:function(){var a,b,c;return c=this.getLocalQuery(),b=this.getQueryOptions(),a=this.getModels(c,b),this.$bodyEl().empty(),this.trigger("before:refresh",a,c,b),a.length===0&&this.trigger("empty:results",c,b),this.renderModels(a,c,b),this.trigger("after:refresh",a,c,b),this}}),a.privateMethods({renderModels:function(a,b,c){var d,e,f,g,h;d=0,h=[];for(f=0,g=a.length;f<g;f++)e=a[f],h.push(this.$append(this.makeItem(e,d++)));return h},attributesForItem:function(a,b){return _.extend({},{"class":this.itemClassName,"data-index":a.index,"data-model-id":a.model.get("id")})},contentForItem:function(a){var b,c;return a==null&&(a={}),this.itemTemplate!=null&&(c=Luca.template(this.itemTemplate))?b=c.call(this,a):this.itemRenderer!=null&&_.isFunction(this.itemRenderer)?b=this.itemRenderer.call(this,a,a.model,a.index):this.itemProperty&&a.model!=null?b=a.model.read(this.itemProperty):""},makeItem:function(a,b){var c,d,e;e=this.prepareItem!=null?this.prepareItem.call(this,a,b):{model:a,index:b},c=this.attributesForItem(e,a),d=this.contentForItem(e);try{return Luca.View.prototype.make(this.itemTagName,c,d)}catch(f){return console.log("Error generating DOM element for CollectionView",this,a,b)}},refreshModel:function(a){var b;return b=this.collection.indexOf(a),this.locateItemElement(a.get("id")).empty().append(this.contentForItem({model:a,index:b},a)),this.trigger("model:refreshed",b,a)},registerEvent:function(a,b,c){var d;return c==null&&_.isFunction(b)&&(c=b,b=void 0),d=_([a,""+this.itemTagName+"."+this.itemClassName,b]).compact().join(" "),Luca.View.prototype.registerEvent(d,c)}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.components.SimpleCollectionView"),a["extends"]("Luca.CollectionView"),a.defines({filterable:!1,paginatable:!1,sortable:!1,loadMask:!1})}.call(this),function(){var a;a=Luca.register("Luca.components.GridLayoutView"),a["extends"]("Luca.CollectionView"),a.publicConfiguration({itemsPerRow:3}),a.privateConfiguration({className:"grid-layout-view",tagName:"div",itemTagName:"div"}),a.privateMethods({attributesForItem:function(){var a,b;return a=Luca.CollectionView.prototype.attributesForItem.apply(this,arguments),_.isNumber(this.itemsPerRow)&&this.itemsPerRow>1||(this.itemsPerRow=3),b=parseInt(12/this.itemsPerRow),a["class"]+=" span"+b,a},renderModels:function(a){var b,c,d,e,f,g,h,i;b=0,e=0,f=function(){var f,g,h;h=[];for(f=0,g=a.length;f<g;f++)c=a[f],e++===0&&(d=this.make("div",{"class":"row-fluid"})),$(d).append(this.makeItem(c,b++)),b>0&&b%this.itemsPerRow===0&&(e=0),h.push(d);return h}.call(this),i=[];for(g=0,h=f.length;g<h;g++)d=f[g],i.push(this.$append(d));return i}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.components.TableView"),a["extends"]("Luca.CollectionView"),a.publicConfiguration({widths:[],columns:[],emptyText:"There are no results to display"}),a.privateConfiguration({additionalClassNames:"table",tagName:"table",bodyTemplate:"table_view",bodyTagName:"tbody",bodyClassName:"table-body",stateful:!0,itemTagName:"tr",observeChanges:!0}),a.privateMethods({lastColumn:function(){return this.columns[this.columns.length-1]},eachColumn:function(a,b){var c,d,e,f,g,h;b==null&&(b=this),d=0,g=this.columns,h=[];for(e=0,f=g.length;e<f;e++)c=g[e],h.push(a.call(b,c,d++,this));return h},itemRenderer:function(a,b){return Luca.components.TableView.rowRenderer.call(this,a,b)},initialize:function(a){var b,c,d,e=this;return this.options=a!=null?a:{},Luca.components.CollectionView.prototype.initialize.apply(this,arguments),c=0,this.columns=function(){var a,e,f,g;f=this.columns,g=[];for(a=0,e=f.length;a<e;a++){b=f[a];if(d=this.widths[c])b.width=d;_.isString(b)&&(b={reader:b}),b.header==null&&(b.header=_.str.titleize(_.str.humanize(b.reader))),c++,g.push(b)}return g}.call(this),this.defer(function(){return Luca.components.TableView.renderHeader.call(e,e.columns,e.$("thead"))}).until("after:render")}}),a.classMethods({renderHeader:function(a,b){var c,d,e,f,g,h,i,j,k,l;f=0,this.$(b).append("<tr></tr>");for(h=0,j=a.length;h<j;h++)d=a[h],c={"data-col-index":f++},d.sortable&&(c["class"]="sortable-toggle",c["data-sortable-sort-by"]=d.sortBy||d.sortable,c["data-sortable-order"]=d.order),e=d.header,d.sortable&&(e="<a class='link'>"+d.header+"</a>"),this.$(b).find("tr").append(Luca.View.prototype.make("th",c,e));f=0,l=[];for(i=0,k=a.length;i<k;i++){d=a[i];if(d.width==null)continue;g=this.$("th[data-col-index='"+f++ +"']",b),l.push(g.css("width",d.width))}return l},rowRenderer:function(a,b,c){var d,e,f,g,h,i;d=0,h=this.columns,i=[];for(f=0,g=h.length;f<g;f++)e=h[f],i.push(Luca.components.TableView.renderColumn.call(this,e,a,b,d++));return i},renderColumn:function(a,b,c,d){var e;return e=c.read(a.reader),_.isFunction(a.renderer)&&(e=a.renderer.call(this,e,c,a)),Luca.View.prototype.make("td",{"data-col-index":d},e)}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.components.MultiCollectionView"),a["extends"]("Luca.containers.CardView"),a.mixesIn("QueryCollectionBindings","LoadMaskable","Filterable","Paginatable","Sortable"),a.triggers("before:refresh","after:refresh","refresh","empty:results"),a["private"]({stateful:{activeView:0},initialize:function(a){var b,c,d,e;this.options=a!=null?a:{},this.components||(this.components=this.views),e=this.components;for(c=0,d=e.length;c<d;c++)b=e[c],Luca.components.MultiCollectionView.validateComponent(b);return Luca.containers.CardView.prototype.initialize.apply(this,arguments),this.on("data:refresh",this.refresh,this),this.on("after:card:switch",this.refresh,this),this.on("after:components",Luca.components.MultiCollectionView.propagateCollectionComponents,this)},relayAfterRefresh:function(a,b,c){return this.trigger("after:refresh",a,b,c)},refresh:function(){var a;return(a=this.activeComponent())!=null?a.refresh():void 0}}),a.classMethods({propagateCollectionComponents:function(){var a,b,c,d,e,f,g=this;b=this,e=this.components,f=[];for(c=0,d=e.length;c<d;c++)a=e[c],a.on("after:refresh",function(a,b,c){return g.debug("collection member after refresh"),g.trigger("after:refresh",a,b,c)}),_.extend(a,{collection:b.getCollection(),getQuery:_.bind(b.getQuery,b),getQueryOptions:_.bind(b.getQueryOptions,b)}),b.prepareQuery!=null?f.push(_.extend(a,{prepareQuery:_.bind(b.prepareQuery,b)})):f.push(void 0);return f},validateComponent:function(a){var b;b=a.type||a.ctype;if(b==="collection"||b==="collection_view"||b==="table"||b==="table_view")return;throw"The MultiCollectionView expects to contain multiple collection views"}}),a.defines({version:3})}.call(this),function(){var a;a=Luca.register("Luca.components.ScrollableTable"),a["extends"]("Luca.components.TableView"),a.replaces("Luca.components.GridView"),a.publicConfiguration({maxHeight:void 0}),a.privateMethods({$scrollableWrapperEl:function(){return this.$el.parent(".scrollable-wrapper")},setMaxHeight:function(){var a;return a=this.$scrollableWrapperEl(),a.css({overflow:"auto","max-height":this.maxHeight})},afterRender:function(){return this.$wrap("scrollable-wrapper"),this.setMaxHeight()}}),a.defines({version:1})}.call(this),function(){var a,b=[].slice;a=Luca.register("Luca.Application"),a["extends"]("Luca.containers.Viewport"),a.triggers("controller:change","action:change"),a.publicConfiguration({name:"MyApp",stateful:{},autoBoot:!1,autoStartHistory:"before:render",pushState:!1,startHistorySilently:!1,rootUrl:void 0,useCollectionManager:!0,collectionManager:{},collectionManagerClass:"Luca.CollectionManager",plugin:!1,useController:!0,mainControllerContainer:void 0,keyEvents:{},createRoleBasedGetters:!1,useSocketManager:!1,socketManagerOptions:{}}),a.publicMethods({initialize:function(a){var b,c,d,e=this;this.options=a!=null?a:{},c=this,d=this.name,b=typeof Luca.getApplication=="function"?Luca.getApplication():void 0,Luca.Application.registerInstance(this),Luca.concerns.StateModel.__initializer.call(this),this.setupCollectionManager(),this.setupSocketManager(),Luca.containers.Viewport.prototype.initialize.apply(this,arguments),this.useController===!0&&this.setupMainController(),this.defer(function(){return c.render()}).until(this,"ready"),this.setupRouter(),(this.useKeyHandler===!0||this.useKeyRouter===!0)&&this.keyEvents!=null&&this.setupKeyHandler(),this.plugin!==!0&&!b&&(Luca.getApplication=function(a){return a==null?c:Luca.Application.instances[a]});if(this.autoBoot){if(Luca.util.resolve(this.name))throw"Attempting to override window."+this.name+" when it already exists";$(function(){return window[d]=c,c.boot()})}return Luca.trigger("application:available",this)},activeView:function(){var a;return(a=this.activeSubSection())?this.view(a):this.view(this.activeSection())},activeSection:function(){return this.get("active_section")},activeSubSection:function(){return this.get("active_sub_section")},activePages:function(){var a=this;return console.log("This method will be getting removed in Luca 1.0"),this.$(".luca-controller").map(function(a,b){return $(b).data("active-section")})},boot:function(){var a,b,c,d,e;this.trigger("ready"),d=[this.collectionManager,this.socket,this.router],e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a!=null?a.trigger("ready"):void 0);return e},collection:function(){return this.collectionManager.getOrCreate.apply(this.collectionManager,arguments)},get:function(a){return this.state.get(a)},set:function(a,b,c){return this.state.set.apply(this.state,arguments)},view:function(a){return Luca.cache(a)},navigate_to:function(a,b){return this.getMainController().navigate_to(a,b)}}),a.privateMethods({setupControllerBindings:function(){var a,b,c,d=this;return a=this,(b=this.getMainController())!=null&&b.bind("after:card:switch",function(b,c){return d.state.set({active_section:c.name}),a.trigger("controller:change",b.name,c.name)}),(c=this.getMainController())!=null?c.each(function(b){var c;c=b.type||b.ctype;if(c.match(/controller$/))return b.bind("after:card:switch",function(b,c){return d.state.set({active_sub_section:c.name}),a.trigger("action:change",b.name,c.name)})}):void 0},setupMainController:function(){var a,b,c=this;return this.useController===!0&&(b=this.components||[],a={type:"controller",name:"main_controller",role:"main_controller",components:b},this.mainControllerContainer!=null&&_.extend(a,{container:this.mainControllerContainer}),this.components=[a]),this.getMainController=function(){return c.findComponentByRole("main_controller")},this.defer(this.setupControllerBindings,!1).until("after:components")},setupCollectionManager:function(){var a,b,c,d,e;if(this.useCollectionManager!==!0)return;if(this.collectionManager!=null&&((c=this.collectionManager)!=null?c.get:void 0)!=null)return;_.isString(this.collectionManagerClass)&&(this.collectionManagerClass=Luca.util.resolve(this.collectionManagerClass)),a=this.collectionManagerOptions||{},_.isObject(this.collectionManager)&&!_.isFunction((d=this.collectionManager)!=null?d.get:void 0)&&(a=this.collectionManager,this.collectionManager=void 0),_.isString(this.collectionManager)&&(a={name:this.collectionManager}),this.collectionManager=typeof (b=Luca.CollectionManager).get=="function"?b.get(a.name):void 0;if(!_.isFunction((e=this.collectionManager)!=null?e.get:void 0))return a.autoStart=!1,this.collectionManager=new this.collectionManagerClass(a)},setupSocketManager:function(){if(_.isEmpty(this.socketManagerOptions))return;return _.extend(this.socketManagerOptions,{autoStart:!1}),this.socket=new Luca.SocketManager(this.socketManagerOptions)},setupRouter:function(){var a,b,c,d,e,f,g,h,i,j;if(this.router==null&&this.routes==null)return;f=Luca.Router,_.isString(this.router)&&(f=Luca.util.resolve(this.router)),g=f.prototype,g.routes||(g.routes={}),g.app=this;if(_.isObject(this.routes)){h=this.routes;for(e in h)b=h[e],b.match(/\ /)?(i=b.split(" "),d=i[0],a=i[1]):b.match(/\#/)&&(j=b.split("#"),d=j[0],a=j[1]),c=_.uniqueId(d),g[c]=Luca.Application.routeTo(d).action(a),g.routes[e]=c}this.router=new f(g);if(this.router&&this.autoStartHistory)return this.autoStartHistory===!0&&(this.autoStartHistory="before:render"),this.defer(Luca.Application.startHistory,!1).until(this,this.autoStartHistory)},setupKeyHandler:function(){var a,b,c,d,e,f,g;if(!this.keyEvents)return;(c=this.keyEvents).control_meta||(c.control_meta={}),this.keyEvents.meta_control&&_.extend(this.keyEvents.control_meta,this.keyEvents.meta_control),a=_.bind(this.keyHandler,this),f=this.keypressEvents||["keydown"],g=[];for(d=0,e=f.length;d<e;d++)b=f[d],g.push($(document).on(b,a));return g}}),a.classMethods({instances:{},pageHierarchy:function(){var a,b,c;return a=Luca(),c=a.getMainController(),b=function(a){return a.components==null&&a.pages==null?{}:_(a.components||a.pages).reduce(function(a,c){return a[c.name]=c.name,c.navigate_to!=null&&(a[c.name]=b(c)),a},{})},b(c)},registerInstance:function(a){return Luca.Application.instances[a.name]=a},checkForKeymaster:function(){var a;if(typeof window!="undefined"&&window!==null?(a=window.key)!=null?a.noConflict:void 0:void 0)return Luca.key=window.key.noConflict(),Luca.Application.prototype.setupKeyHandler=function(){if(!this.keyEvents)return;return Luca.util.setupKeymaster(this.keyEvents,"all").on(this)}},routeTo:function(){var a,c,d,e,f,g;return e=1<=arguments.length?b.call(arguments,0):[],d=_(e).last(),c=_(e).first(),a=void 0,g=void 0,f=function(){var f,h,i,j,k,l,m,n,o,p;h=1<=arguments.length?b.call(arguments,0):[],l=this.app||Luca(),i=0,e.length===1&&(m=Luca(c))&&(e=m.controllerPath()),p=[];for(n=0,o=e.length;n<o;n++){k=e[n];if(!_.isString(k))continue;j=e[++i],m=Luca(k),k===d&&(g!=null&&m[g]==null&&m.routeHandler==null&&console.log("You specified a component action to call when a route matches, but it does not exist on the component"),a=g!=null&&m[g]!=null?_.bind(m[g],m):m.routeHandler!=null?m.routeHandler:void 0),a||(a=_.isFunction(j)?_.bind(j,m):_.isObject(j)?(f=j.action&&m[f]!=null)?_.bind(m[f],m):void 0:void 0),p.push(l=l.navigate_to(k,function(){return a!=null?a.apply(m,h):void 0}))}return p},f.action=function(a){return g=a,f},f},startHistory:function(){return Backbone.history.start({pushState:this.pushState,rootUrl:this.rootUrl,silent:this.startHistorySilently})}}),a.afterDefinition(function(){return Luca.routeHelper=Luca.Application.routeTo,Luca.Application.checkForKeymaster()}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.components.CollectionLoaderView"),a["extends"]("Luca.View"),a.defines({className:"luca-ui-collection-loader-view",template:"components/collection_loader_view",initialize:function(a){return this.options=a!=null?a:{},Luca.components.Template.prototype.initialize.apply(this,arguments),this.container||(this.container=$("body")),this.manager||(this.manager=Luca.CollectionManager.get()),this.setupBindings()},modalContainer:function(){return $("#progress-modal",this.el)},setupBindings:function(){var a=this;return this.manager.bind("collection_loaded",function(b){var c,d,e,f;return d=a.manager.loadedCollectionsCount(),f=a.manager.totalCollectionsCount(),e=parseInt(d/f*100),c=_.string.titleize(_.string.humanize(b)),a.modalContainer().find(".progress .bar").attr("style","width: "+e+"%;"),a.modalContainer().find(".message").html("Loaded "+c+"...")}),this.manager.bind("all_collections_loaded",function(){return a.modalContainer().find(".message").html("All done!"),_.delay(function(){return a.modalContainer().modal("hide")},400)})}})}.call(this),function(){var a;a=Luca.register("Luca.components.Controller"),a["extends"]("Luca.containers.CardView"),a.publicConfiguration({tracker:"page",activeAttribute:"active-section",stateful:!0,defaultPage:void 0,defaultCard:0}),a.publicMethods({"default":function(a){return this.navigate_to(this.defaultPage||this.defaultCard,a)},activePage:function(){return this.activeSection()},navigate_to:function(a,b){var c=this;return a||(a=this.defaultCard),this.activate(a,!1,function(a,d,e){var f,g;e.activatedByController===!0?e.trigger("on:controller:reactivation"):(e.trigger("on:controller:activation"),e.activatedByController=!0),c.state.set({active_section:e.name}),c.tracker!=null&&(f=c.app||(typeof Luca.getApplication=="function"?Luca.getApplication():void 0))&&f.state.set(c.tracker,e.name),(g=Luca.key)!=null&&g.setScope(e.name);if(_.isFunction(b))return b.call(e)}),this.find(a)}}),a.classMethods({setupComponentKeyEvents:function(){return this._().each(function(a){if(_.isObject(a.keyEvents)&&a.name!=null)return Luca.util.setupKeymaster(a.keyEvents,a.name).on(a)})},controllerPath:function(){var a,b,c;b=this,c=[b.name],a=!1;while(b&&!a)b=typeof b.getParent=="function"?b.getParent():void 0,(b!=null?b.role:void 0)==="main_controller"&&(a=!0),b!=null&&!a&&c.push(b.name);return c.reverse()}}),a.afterDefinition(function(){return Luca.View.prototype.hooks.push("on:controller:activation")}),a.defines({initialize:function(a){var b;this.options=a,this.defaultCard||(this.defaultCard=this.defaultPage||(this.defaultPage=((b=this.components[0])!=null?b.name:void 0)||0)),this.defaultPage||(this.defaultPage=this.defaultCard),this.defaultState||(this.defaultState={active_section:this.defaultPage}),Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(this.defaultCard==null)throw"Controllers must specify a defaultCard property and/or the first component must have a name";return this._().each(function(a){return a.controllerPath=Luca.components.Controller.controllerPath}),this.on("after:render",this["default"],this),this.on("before:render",Luca.components.Controller.setupComponentKeyEvents,this)},each:function(a){var b=this;return _(this.components).each(function(c){return a.call(b,c)})},activeSection:function(){return this.get("active_section")},pageControllers:function(a){return a==null&&(a=!1),this.controllers.apply(this,arguments)},controllers:function(a){return a==null&&(a=!1),this.select(function(a){var b;return b=a.type||a.ctype,b==="controller"||b==="page_controller"})},availablePages:function(){return this.availableSections.apply(this,arguments)},availableSections:function(){var a,b=this;return console.log("The availableSections()/availablePages() method will be removed in 1.0"),a={},a[this.name]=this.sectionNames(),_(this.controllers()).reduce(function(a,b){return a[b.name]=b.sectionNames(),a},a)},pageNames:function(){return this.sectionNames()},sectionNames:function(a){return a==null&&(a=!1),this.pluck("name")}})}.call(this),function(){var a;a=Luca.register("Luca.core.Field"),a["extends"]("Luca.View"),a.triggers("before:validation","after:validation","on:change"),a.publicConfiguration({className:"luca-ui-field",disabled:void 0,helperText:void 0,label:void 0,labelAlign:"top",placeHolder:void 0,required:void 0,statuses:["warning","error","success"],valueType:"string"}),a.publicMethods({disable:function(){return this.getInputElement().attr("disabled",!0)},enable:function(){return this.getInputElement().attr("disabled",!1)},getValue:function(){var a,b;return a=(b=this.getInputElement())!=null?b.val():void 0,this.getParsedValue(a)},setValue:function(a){var b;return(b=this.getInputElement())!=null?b.val(a):void 0},updateState:function(a){var b,c,d,e;e=this.statuses;for(c=0,d=e.length;c<d;c++)b=e[c],this.$el.removeClass(b);return this.$el.addClass(a)},clearErrors:function(){return this.$el.removeClass("error")},displayErrors:function(a){return this.updateState("error")}}),a.privateMethods({getParsedValue:function(a){if(_.str.isBlank(a))return a;switch(this.valueType){case"integer":return parseInt(a);case"string":return""+a;case"float":return parseFloat(a);default:return a}}}),a.privateConfiguration({isField:!0,template:"fields/text_field"}),a.privateMethods({initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this,this.options),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_class||(this.input_class=""),this.input_type||(this.input_type=""),this.helperText||(this.helperText=""
12
- );if(this.label==null||this.label.length===0)this.label=this.name;return this.required&&((b=this.label)!=null?!b.match(/^\*/):!void 0)&&(this.label||(this.label="*"+this.label)),this.inputStyles||(this.inputStyles=""),this.input_value||(this.input_value=this.value||""),this.disabled&&this.disable(),this.updateState(this.state),this.placeHolder||(this.placeHolder=""),Luca.View.prototype.initialize.apply(this,arguments)},beforeRender:function(){Luca.config.enableBoostrap&&this.$el.addClass("control-group");if(this.required)return this.$el.addClass("required")},change_handler:function(a){return this.trigger("on:change",this,a)},getInputElement:function(){return this.input||(this.input=this.$("input").eq(0))}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.fields.ButtonField"),a["extends"]("Luca.core.Field"),a.triggers("button:click"),a.publicConfiguration({buttonSize:void 0,"class":void 0,icon_class:void 0,label:void 0,text:void 0,white:!1}),a.privateConfiguration({readOnly:!0,input_value:void 0,input_type:"button",icon_class:void 0,input_name:void 0,buttonClasses:""}),a.privateConfiguration({isButton:!0,autoBindEventHandlers:!0,template:"fields/button_field",events:{"click input":"clickHandler"}}),a.privateMethods({clickHandler:function(a){var b,c;return b=c=$(a.currentTarget),this.trigger("button:click")},initialize:function(a){var b;this.options=a!=null?a:{},_.extend(this,this.options),Luca.core.Field.prototype.initialize.apply(this,arguments);if((b=this.icon_class)!=null?b.length:void 0)return this.template="fields/button_field_link"},afterInitialize:function(){var a;this.input_id||(this.input_id=_.uniqueId("button")),this.input_name||(this.input_name=this.name||(this.name=this.input_id)),this.input_value||(this.input_value=this.label||(this.label=this.text)),this.input_class||(this.input_class=this["class"]||(this["class"]=this.buttonClasses)),((a=this.buttonSize)!=null?a.length:void 0)>0&&(this.input_class+=" "+buttonSize.replace(/btn-/,"")),this.icon_class||(this.icon_class=""),this.icon_class.length&&!this.icon_class.match(/^icon-/)&&(this.icon_class="icon-"+this.icon_class);if(this.white)return this.icon_class+=" icon-white"},setValue:function(){return!0}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.fields.CheckboxArray"),a["extends"]("Luca.core.Field"),a.privateConfiguration({template:"fields/checkbox_array",className:"luca-ui-checkbox-array",events:{"click input":"clickHandler"},selectedItems:[]}),a.privateMethods({initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.concerns.Deferrable),_.bindAll(this,"renderCheckboxes","clickHandler","checkSelected"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name")},afterInitialize:function(a){var b;this.options=a!=null?a:{};try{this.configure_collection()}catch(c){console.log("Error Configuring Collection",this,c.message)}b=this;if(!Luca.isBackboneCollection(this.collection))throw"Checkbox Array Fields must specify a @collection property";return this.collection.length>0?this.renderCheckboxes():this.defer("renderCheckboxes").until(this.collection,"reset")},clickHandler:function(a){var b;b=$(a.target);if(b.prop("checked"))return this.selectedItems.push(b.val());if(_(this.selectedItems).include(b.val()))return this.selectedItems=_(this.selectedItems).without(b.val())},controls:function(){return this.$(".controls")},renderCheckboxes:function(){var a=this;return this.controls().empty(),this.selectedItems=[],this.collection.each(function(b){var c,d,e,f,g;return g=b.get(a.valueField),f=b.get(a.displayField),e=_.uniqueId(""+a.cid+"_checkbox"),d=a.make("input",{type:"checkbox","class":"array-checkbox",name:a.input_name,value:g,id:e}),c=a.make("label",{"for":e},d),$(c).append(" "+f),a.controls().append(c)}),this.trigger("checkboxes:rendered",this.checkboxesRendered=!0),this},uncheckAll:function(){return this.allFields().prop("checked",!1)},allFields:function(){return this.controls().find("input[type='checkbox']")}}),a.publicMethods({checkSelected:function(a){var b,c,d,e,f;a!=null&&(this.selectedItems=a),this.uncheckAll(),f=this.selectedItems;for(d=0,e=f.length;d<e;d++)c=f[d],b=this.controls().find("input[value='"+c+"']"),b.prop("checked",!0);return this.selectedItems},getValue:function(){var a,b,c,d,e;d=this.allFields(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],this.$(a).prop("checked")&&e.push(this.$(a).val());return e},setValue:function(a){var b;return this.selectedItems=a,this.checkboxesRendered===!0?this.checkSelected(a):(b=this,this.defer(function(){return b.checkSelected(a)}).until("checkboxes:rendered"))},getValues:function(){return this.getValue()},setValues:function(a){return this.setValue(a)}})}.call(this),function(){var a;a=Luca.register("Luca.fields.CheckboxField"),a["extends"]("Luca.core.Field"),a.triggers("checked","unchecked"),a.publicConfiguration({send_blanks:!0,input_value:1}),a.privateConfiguration({template:"fields/checkbox_field",events:{"change input":"change_handler"}}),a.privateInterface({change_handler:function(a){var b,c;return b=c=$(a.target),b.is(":checked")?this.trigger("checked"):this.trigger("unchecked"),this.trigger("on:change",this,a,b.is(":checked"))},initialize:function(a){return this.options=a!=null?a:{},_.extend(this,this.options),_.bindAll(this,"change_handler"),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name)}}),a.publicInterface({setValue:function(a){return this.getInputElement().attr("checked",a)},getValue:function(){return this.getInputElement().is(":checked")}}),a.defines({version:1})}.call(this),function(){var a;a=Luca.register("Luca.fields.FileUploadField"),a["extends"]("Luca.core.Field"),a.defines({version:1,template:"fields/file_upload_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.helperText||(this.helperText="")}})}.call(this),function(){var a;a=Luca.register("Luca.fields.HiddenField"),a["extends"]("Luca.core.Field"),a.defines({template:"fields/hidden_field",afterInitialize:function(){return this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.input_value||(this.input_value=this.value),this.label||(this.label=this.name)}})}.call(this),function(){var a;a=Luca.register("Luca.components.LabelField"),a["extends"]("Luca.core.Field"),a.defines({formatter:function(a){return a||(a=this.getValue()),_.str.titleize(a)},setValue:function(a){return this.trigger("change",a,this.getValue()),this.getInputElement().attr("value",a),this.$(".value").html(this.formatter(a))}})}.call(this),function(){var a;a=Luca.register("Luca.fields.SelectField"),a["extends"]("Luca.core.Field"),a.triggers("after:select","on:change"),a.publicConfiguration({allowMultiple:!1,includeBlank:!0,blankValue:"",blankText:"Select One",maxDisplayLength:0,retainValue:void 0,label:void 0}),a.privateConfiguration({template:"fields/select_field",events:{"change select":"change_handler"}}),a.publicMethods({setValue:function(a){return this.currentValue=a,Luca.core.Field.prototype.setValue.apply(this,arguments)},getValue:function(){var a,b,c=this;return a=(b=this.getInputElement())!=null?b.val():void 0,this.allowMultiple?_.map(a,function(a){return c.getParsedValue(a)}):this.getParsedValue(a)}}),a.privateMethods({initialize:function(a){this.options=a!=null?a:{},_.extend(this,this.options),_.extend(this,Luca.concerns.Deferrable),_.bindAll(this,"change_handler"),_.isArray(this.collection)&&(this.collection={data:this.collection}),Luca.core.Field.prototype.initialize.apply(this,arguments),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.valueField==="id"&&(this.valueType||(this.valueType=Luca.config.idAttributeType)),this.label||(this.label=this.name);if(this.retainValue==null)return this.retainValue=!0},afterInitialize:function(){var a,b,c;if((a=this.collection)!=null?a.data:void 0)this.valueField||(this.valueField="id"),this.displayField||(this.displayField="name"),this.sortOptionsBy||(this.sortOptionsBy=this.displayField),this.parseData();try{this.configure_collection(this.setAsDeferrable)}catch(d){console.log("Error Configuring Collection",this,d.message)}return(b=this.collection)!=null&&b.bind("before:fetch",this.beforeFetch,this),(c=this.collection)!=null?c.bind("reset",this.populateOptions,this):void 0},parseData:function(){var a=this;return this.collection.data=_(this.collection.data).map(function(b){var c;return _.isArray(b)?(c={},c[a.valueField]=b[0],c[a.displayField]=b[1]||b[0],c):b})},getInputElement:function(){return this.input||(this.input=this.$("select").eq(0))},afterRender:function(){var a,b,c;return((a=this.collection)!=null?(b=a.models)!=null?b.length:void 0:void 0)>0?this.populateOptions():(c=this.collection)!=null?c.trigger("reset"):void 0},beforeFetch:function(){return this.resetOptions()},change_handler:function(a){return this.trigger("on:change",this,a)},resetOptions:function(){this.getInputElement().html("");if(this.allowMultiple)return this.getInputElement().attr({multiple:!0});if(this.includeBlank)return this.getInputElement().append("<option value='"+this.blankValue+"'>"+this.blankText+"</option>")},populateOptions:function(){var a,b,c,d,e,f,g,h,i,j=this;this.resetOptions();if(((i=this.collection)!=null?i.length:void 0)>0){this.sortOptionsBy!=null?c=this.collection.sortBy(function(a){return a.read!=null?a.read(j.sortOptionsBy):a.get(j.sortOptionsBy)}):c=this.collection.models;for(g=0,h=c.length;g<h;g++)b=c[g],f=(typeof b.read=="function"?b.read(this.valueField):void 0)||b.get(this.valueField),a=(typeof b.read=="function"?b.read(this.displayField):void 0)||b.get(this.displayField),this.maxDisplayLength&&this.maxDisplayLength>0&&(a=_.str.truncate(a,this.maxDisplayLength)),this.selected&&f===this.selected&&(e="selected"),d="<option "+e+" value='"+f+"'>"+a+"</option>",this.getInputElement().append(d)}return this.trigger("after:populate:options",this),this.setValue(this.currentValue)}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.fields.TextAreaField"),a["extends"]("Luca.core.Field"),a.defines({autoBindEventHandlers:!0,events:{"blur textarea":"blur_handler","focus textarea":"focus_handler"},template:"fields/text_area_field",height:"200px",width:"90%",keyEventThrottle:300,initialize:function(a){this.options=a!=null?a:{},this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=""),this.inputStyles||(this.inputStyles="height:"+this.height+";width:"+this.width),this.placeHolder||(this.placeHolder=""),Luca.core.Field.prototype.initialize.apply(this,arguments);if(this.enableKeyEvents===!0)return this.keyup_handler=_.debounce(this.keyup_handler,this.keyEventThrottle||10),console.log("Registering Key Events"),this.registerEvent("keyup textarea","keyup_handler"),this.registerEvent("keydown textarea","keyup_handler")},setValue:function(a){return $(this.field()).val(a)},getValue:function(){return $(this.field()).val()},field:function(){return this.input=this.$("textarea")},keyup_handler:function(a){return this.trigger("on:change",this,a),this.trigger("on:keyup",this,a)},blur_handler:function(a){return this.trigger("on:blur",this,a)},focus_handler:function(a){return this.trigger("on:focus",this,a)},change_handler:function(a){return this.trigger("on:change",this,a)}})}.call(this),function(){var a;a=Luca.register("Luca.fields.TextField"),a["extends"]("Luca.core.Field"),a.defines({_inheritEvents:{"blur input":"blur_handler","focus input":"focus_handler","change input":"change_handler"},template:"fields/text_field",autoBindEventHandlers:!0,send_blanks:!0,keyEventThrottle:300,initialize:function(a){return this.options=a!=null?a:{},this.enableKeyEvents&&(this.keyEventThrottle&&(this.keyup_handler=_.debounce(this.keyup_handler,this.keyEventThrottle)),this.registerEvent("keyup input","keyup_handler")),this.input_id||(this.input_id=_.uniqueId("field")),this.input_name||(this.input_name=this.name),this.label||(this.label=this.name),this.input_class||(this.input_class=this["class"]),this.input_value||(this.input_value=this.value||""),this.prepend&&(this.$el.addClass("input-prepend"),this.addOn=this.prepend),this.append&&(this.$el.addClass("input-append"),this.addOn=this.append),this.placeHolder||(this.placeHolder=""),Luca.core.Field.prototype.initialize.apply(this,arguments)},keyup_handler:function(a){return this.trigger("on:change",this,a),this.trigger("on:keyup",this,a)},blur_handler:function(a){return this.trigger("on:blur",this,a)},focus_handler:function(a){return this.trigger("on:focus",this,a)},change_handler:function(a){return this.trigger("on:change",this,a)}})}.call(this),function(){var a;a=Luca.register("Luca.fields.TypeAheadField"),a["extends"]("Luca.fields.TextField"),a.defines({getSource:function(){return Luca.util.read(this.source)||[]},matcher:function(a){return!0},beforeRender:function(){return Luca.fields.TextField.prototype.beforeRender.apply(this,arguments),this.getInputElement().attr("data-provide","typeahead")},afterRender:function(){return Luca.fields.TextField.prototype.afterRender.apply(this,arguments),this.getInputElement().typeahead({matcher:this.matcher,source:this.getSource()})}})}.call(this),function(){var a;a=Luca.register("Luca.components.FormView"),a["extends"]("Luca.Container"),a.mixesIn("LoadMaskable","FormModelBindings"),a.triggers("before:submit","before:reset","before:load","before:load:new","before:load:existing","after:submit","after:reset","after:load","after:load:new","after:load:existing","after:submit:success","after:submit:fatal_error","after:submit:error","state:change:dirty"),a.publicConfiguration({trackDirtyState:!1,trackModelChanges:!1,labelAlign:void 0,fieldLayoutClass:void 0,legend:"",toolbar:!0,toolbarConfig:void 0,defaultToolbar:"Luca.components.FormView.defaultToolbar",loadMask:!0,well:!1,searchForm:!1,horizontalForm:!1,inlineForm:!1,includeBlankValues:void 0}),a.privateConfiguration({tagName:"form",_inheritEvents:{"click .submit-button":"submitHandler","click .reset-button":"resetHandler"},bodyClassName:"form-view-body",stateful:{dirty:!1,currentModel:void 0}}),a.privateMethods({initialize:function(a){var b,c,d,e;this.options=a!=null?a:{},c=this,this.loadMask==null&&(this.loadMask=Luca.config.enableBoostrap),Luca.Container.prototype.initialize.apply(this,arguments),this.components||(this.components=this.fields),_.bindAll(this,"submitHandler","resetHandler","renderToolbars"),e=this._inheritEvents;for(b in e)d=e[b],this.registerEvent(b,d);return this.trackDirtyState===!0&&this.on("after:components",function(){var a,b,d,e,f;e=this.getFields(),f=[];for(b=0,d=e.length;b<d;b++)a=e[b],f.push(a.on("on:change",this.onFieldChange,c));return f},c),this.setupHooks(this.hooks),this.applyStyleClasses(),Luca.components.FormView.setupToolbar.call(this)},onFieldChange:function(a,b){return this.trigger("field:change",a,b),this.state.set("dirty",!0)},getDefaultToolbar:function(){var a;return a=this.toolbarConfig||this.defaultToolbar,Luca.util.resolve(Luca.util.read(a))},applyStyleClasses:function(){Luca.config.enableBoostrap&&this.applyBootstrapStyleClasses(),this.labelAlign&&this.$el.addClass("label-align-"+this.labelAlign);if(this.fieldLayoutClass)return this.$el.addClass(this.fieldLayoutClass)},applyBootstrapStyleClasses:function(){this.labelAlign==="left"&&(this.inlineForm=!0),this.well&&this.$el.addClass("well"),this.searchForm&&this.$el.addClass("form-search"),this.horizontalForm&&this.$el.addClass("form-horizontal");if(this.inlineForm)return this.$el.addClass("form-inline")},resetHandler:function(a){var b,c,d;b=c=$(a!=null?a.target:void 0);if(this.beforeReset!=null){d=this.beforeReset();if(d===!1)return}return this.reset(),this.trigger("after:reset",this)},submitHandler:function(a){var b;if(this.beforeSubmit!=null){b=this.beforeSubmit();if(b===!1)return}else this.trigger("before:submit",this);this.loadMask===!0&&this.trigger("enable:loadmask",this);if(this.hasModel())return this.submit()},afterComponents:function(){var a,b;return(b=Luca.Container.prototype.afterComponents)!=null&&b.apply(this,arguments),a=this,this.eachField(function(b){var c=this;return b.getForm=function(){return a},b.getModel=function(){return a.currentModel()}})},eachField:function(a){return _(this.getFields()).map(a)},getField:function(a){var b;return b=_(this.getFields("name",a)).first(),b!=null?b:_(this.getFields("input_name",a)).first()},getFields:function(a,b){var c;return c=this.selectByAttribute("isField",!0,!0),a!=null&&b!=null&&(c=_(c).select(function(c){var d;return d=c[a],_.isFunction(d)&&(d=d.call(c)),d===b})),c},loadModel:function(a){var b,c,d,e;d=this,c=this.getFields(),this.state.set("dirty",!1),this.trigger("before:load",this,a),a&&((e=a.beforeFormLoad)!=null&&e.apply(a,this),b="before:load:"+(a.isNew()?"new":"existing"),this.trigger(b,this,a)),this.state.set("currentModel",a),this.setValues(a||{},{silent:!0}),this.trigger("after:load",this,a);if(a)return this.trigger("after:load:"+(a.isNew()?"new":"existing"),this,a)},reset:function(){return this.loadModel(this.state.get("currentModel"))},clear:function(){var a=this;return this.state.set("currentModel",typeof this.defaultModel=="function"?this.defaultModel():void 0),_(this.getFields()).each(function(b){try{return b.setValue("")}catch(c){return console.log("Error Clearing",a,b)}})},isDirty:function(){return!!this.state.get("dirty")},setValues:function(a,b){var c,d=this;b==null&&(b={}),a||(a=this.currentModel()),c=this.getFields(),_(c).each(function(b){var c,d;c=b.input_name||b.name;if(a!=null?a[c]:void 0)d=Luca.util.read(a[c]);!d&&Luca.isBackboneModel(a)&&(d=a.get(c));if(b.readOnly!==!0)return b!=null?b.setValue(d):void 0});if(b.silent!=null!=1)return this.applyFormValuesToModel()},getValues:function(a){var b,c=this;return a==null&&(a={}),a.reject_blank==null&&(a.reject_blank=!0),a.skip_buttons==null&&(a.skip_buttons=!0),a.blanks===!1&&(a.reject_blank=!0),b=_(this.getFields()).inject(function(b,d){var e,f,g,h,i;h=d.getValue(),f=d.input_name||d.name,i=!!_.str.isBlank(h)||!!_.isUndefined(h),e=!a.reject_blank&&!d.send_blanks;if(d.includeBlank===!0||c.includeBlankValues===!0)e=!0;return a.debug&&console.log(""+f+" Options",a,"Value",h,"Value Is Blank?",i,"Allow Blanks?",e),a.skip_buttons&&d.isButton?g=!0:(i&&e===!1&&(g=!0),d.input_name==="id"&&i===!0&&(g=!0)),a.debug&&console.log("Skip is true on "+f),g!==!0&&(b[f]=h),b},a.defaults||{}),b},removeErrors:function(){var a,b,c,d,e;this.$(".alert.alert-error").remove(),this.$el.removeClass("error"),d=this.getFields(),e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(a.clearErrors());return e},displayErrors:function(a){var b,c,d,e,f,g,h;e=!1,h=this.getFields();for(f=0,g=h.length;f<g;f++){b=h[f];for(d in a){c=a[d];if(d!==b.input_name)continue;b.displayErrors(c),e=!0}}if(e)return this.$el.addClass("error")},displayValidationErrorsMessage:function(){return this.errorMessage("Please fix the fields with errors")},submit_success_handler:function(a,b,c){return this.trigger("after:submit",this,a,b),this.loadMask===!0&&this.trigger("disable:loadmask",this),b&&(b!=null?b.success:void 0)===!0?this.trigger("after:submit:success",this,a,b):this.trigger("after:submit:error",this,a,b)},submit_fatal_error_handler:function(a,b,c){var d;this.trigger("after:submit",this,a,b),this.trigger("after:submit:fatal_error",this,a,b);try{d=$.parseJSON(b.responseText);if(!d.success&&d.errors!=null)return this.displayValidationErrorsMessage(),this.displayErrors(d.errors)}catch(e){}},submit:function(a,b){var c;a==null&&(a=!0),b==null&&(b={}),_.bindAll(this,"submit_success_handler","submit_fatal_error_handler"),b.success||(b.success=this.submit_success_handler),b.error||(b.error=this.submit_fatal_error_handler),this.removeErrors(),this.applyFormValuesToModel();if(!a)return;return(c=this.currentModel())!=null?c.save(this.currentModel().toJSON(),b):void 0},hasModel:function(){return this.currentModel()!=null},currentModel:function(a){return a==null&&(a={}),(a===!0||(a!=null?a.refresh:void 0)===!0)&&this.applyFormValuesToModel(),this.state.get("currentModel")},applyFormValuesToModel:function(a){var b;return(b=this.currentModel())!=null?b.set(this.getValues(),a):void 0},setLegend:function(a){return this.legend=a,$("fieldset legend",this.el).first().html(this.legend)},flash:function(a){return this.$(".toolbar-container.top").length>0?this.$(".toolbar-container.top").after(a):this.$bodyEl().prepend(a)},successFlashDelay:1500,successMessage:function(a){var b=this;return this.$(".alert.alert-success").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-success",message:a})),_.delay(function(){return b.$(".alert.alert-success").fadeOut()},this.successFlashDelay||0)},errorMessage:function(a){return this.$(".alert.alert-error").remove(),this.flash(Luca.template("components/form_alert",{className:"alert alert-error",message:a}))}}),a.classInterface({setupToolbar:function(){if(this.toolbar!==!1&&!this.topToolbar&&!this.bottomToolbar){if(this.toolbar==="both"||this.toolbar==="top")this.topToolbar=_.clone(this.getDefaultToolbar());if(this.toolbar!=="top")return this.bottomToolbar=_.clone(this.getDefaultToolbar())}},defaultToolbar:{buttons:[{icon:"remove-sign",label:"Reset",eventId:"click:reset",className:"reset-button",align:"right"},{icon:"ok-sign",white:!0,label:"Save Changes",eventId:"click:submit",color:"success",className:"submit-button",align:"right"}]}}),a.defines({version:2})}.call(this),function(){var a;a=Luca.register("Luca.components.LoadMask"),a["extends"]("Luca.View"),a.defines({className:"luca-ui-load-mask",bodyTemplate:"components/load_mask"})}.call(this),function(){var a;a=Luca.register("Luca.components.NavBar"),a["extends"]("Luca.View"),a.publicConfiguration({fixed:!0,position:"top",fluid:void 0,brand:"Luca.js",template:void 0}),a.privateConfiguration({className:"navbar",bodyTemplate:"nav_bar",bodyClassName:"luca-ui-navbar-body",beforeRender:function(){var a;return this.fixed&&this.$el.addClass("navbar-fixed-"+this.position),this.inverse===!0&&this.$el.addClass("navbar-inverse"),this.brand!=null&&(this.$(".brand").attr("href",this.homeLink||"#"),this.$(".brand").html(this.brand)),this.template&&this.navContainer().html(Luca.template(this.template,this)),this.fluid||((a=Luca.getApplication())!=null?a.fluid:void 0)?this.content().addClass(Luca.config.fluidWrapperClass):this.content().addClass(Luca.config.wrapperClass)},render:function(){return this},navContainer:function(){return this.$(".luca-ui-navbar-body .nav-collapse")},content:function(){return this.$(".luca-ui-navbar-body").eq(0)}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.components.Page"),a["extends"]("Luca.Container"),a.privateMethods({initialize:function(a){return this.options=a!=null?a:{},this.assignComponentsToRegions(),this.bodyTemplate=this.options.layout||this.layout,this.bodyTemplate||(this.bodyTemplate=this.options.template||this.template),Luca.Container.prototype.initialize.apply(this,arguments)},assignComponentsToRegions:function(){var a,b,c,d;return this.components||(this.components=[]),a=function(){var a,e;a=this.regions,e=[];for(d in a)c=a[d],_.isString(c)&&(b=Luca.registry.lookup(c))?c={component:c}:_.isString(c)&&Luca.template(c)&&(c={bodyTemplate:c}),e.push(_.extend(c,{container:"[data-region='"+d+"']"}));return e}.call(this),this.components=a}}),a.publicConfiguration({layout:void 0,regions:{}}),a.register()}.call(this),function(){var a;a=Luca.register("Luca.components.PaginationControl"),a["extends"]("Luca.View"),a.defines({template:"components/pagination",stateful:!0,stateChangeEvents:{numberOfPages:"onPageCountChange"},autoBindEventHandlers:!0,events:{"click a[data-page-number]":"selectPage","click a.next":"nextPage","click a.prev":"previousPage"},onPageCountChange:function(){return this.updateWithPageCount(this.get("numberOfPages"))},limit:function(){var a;return parseInt(this.get("limit")||((a=this.collection)!=null?a.length:void 0))},page:function(){return parseInt(this.get("page")||1)},nextPage:function(){if(!this.nextEnabled())return;return this.set("page",this.page()+1)},previousPage:function(){if(!this.previousEnabled())return;return this.set("page",this.page()-1)},selectPage:function(a){var b,c;return b=c=this.$(a.target),b.is("a.page")||(b=c=c.closest("a.page")),c.siblings().removeClass("is-selected"),b.addClass("is-selected"),this.setPage(c.data("page-number"))},setPage:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.set("page",a,b)},setLimit:function(a,b){return a==null&&(a=1),b==null&&(b={}),this.set("limit",a,b)},pageButtonContainer:function(){return this.$(".group")},previousEnabled:function(){return this.page()>1},nextEnabled:function(){return this.page()<this.totalPages()},previousButton:function(){return this.$("a.page.prev")},nextButton:function(){return this.$("a.page.next")},pageButtons:function(){return this.$("a[data-page-number]",this.pageButtonContainer())},updateWithPageCount:function(a,b){var c,d=this;return this.pageCount=a,b==null&&(b=[]),c=b.length,this.pageButtonContainer().empty(),_(this.pageCount).times(function(a){var b,c;return c=a+1,b=d.make("a",{"data-page-number":c,"class":"page"},c),d.pageButtonContainer().append(b)}),this.toggleNavigationButtons(),this.selectActivePageButton(),this},toggleNavigationButtons:function(){this.$("a.next, a.prev").addClass("disabled"),this.nextEnabled()&&this.nextButton().removeClass("disabled");if(this.previousEnabled())return this.previousButton().removeClass("disabled")},selectActivePageButton:function(){return this.activePageButton().addClass("is-selected")},activePageButton:function(){return this.pageButtons().filter("[data-page-number='"+this.page()+"']")},totalPages:function(){return this.pageCount},totalItems:function(){var a;return parseInt(((a=this.collection)!=null?a.length:void 0)||0)},itemsPerPage:function(a,b){return b==null&&(b={}),a!=null&&this.set("limit",a,b),parseInt(this.get("limit"))}})}.call(this),function(){_.def("Luca.components.RecordManager")["extends"]("Luca.containers.CardView")["with"]({events:{"click .record-manager-grid .edit-link":"edit_handler","click .record-manager-filter .filter-button":"filter_handler","click .record-manager-filter .reset-button":"reset_filter_handler","click .add-button":"add_handler","click .refresh-button":"filter_handler","click .back-to-search-button":"back_to_search_handler"},record_manager:!0,initialize:function(a){var b=this;this.options=a!=null?a:{},Luca.containers.CardView.prototype.initialize.apply(this,arguments);if(!this.name)throw"Record Managers must specify a name";return _.bindAll(this,"add_handler","edit_handler","filter_handler","reset_filter_handler"),this.filterConfig&&_.extend(this.components[0][0],this.filterConfig),this.gridConfig&&_.extend(this.components[0][1],this.gridConfig),this.editorConfig&&_.extend(this.components[1][0],this.editorConfig),this.bind("after:card:switch",function(){b.activeCard===0&&b.trigger("activation:search",b);if(b.activeCard===1)return b.trigger("activation:editor",b)})},components:[{ctype:"split_view",relayFirstActivation:!0,components:[{ctype:"form_view"},{ctype:"grid_view"}]},{ctype:"form_view"}],getSearch:function(a,b){return a==null&&(a=!1),b==null&&(b=!0),a===!0&&this.activate(0),b===!0&&this.getEditor().clear(),_.first(this.components)},getFilter:function(){return _.first(this.getSearch().components)},getGrid:function(){return _.last(this.getSearch().components)},getCollection:function(){return this.getGrid().collection},getEditor:function(a,b){var c=this;return a==null&&(a=!1),b==null&&(b=!1),a===!0&&this.activate(1,function(a,b,c){return c.reset()}),_.last(this.components)},beforeRender:function(){var a;return this.$el.addClass(""+this.resource+"-manager"),(a=Luca.containers.CardView.prototype.beforeRender)!=null&&a.apply(this,arguments),this.$el.addClass(""+this.resource+" record-manager"),this.$el.data("resource",this.resource),$(this.getGrid().el).addClass(""+this.resource+" record-manager-grid"),$(this.getFilter().el).addClass(""+this.resource+" record-manager-filter"),$(this.getEditor().el).addClass(""+this.resource+" record-manager-editor")},afterRender:function(){var a,b,c,d,e,f,g=this;return(f=Luca.containers.CardView.prototype.afterRender)!=null&&f.apply(this,arguments),e=this,d=this.getGrid(),c=this.getFilter(),b=this.getEditor(),a=this.getCollection(),d.bind("row:double:click",function(a,c,d){return e.getEditor(!0),b.loadModel(c)}),b.bind("before:submit",function(){return $(".form-view-flash-container",g.el).html(""),$(".form-view-body",g.el).spin("large")}),b.bind("after:submit",function(){return $(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:fatal_error",function(){return $(".form-view-flash-container",g.el).append("<li class='error'>There was an internal server error saving this record. Please contact developers@benchprep.com to report this error.</li>"),$(".form-view-body",g.el).spin(!1)}),b.bind("after:submit:error",function(a,b,c){return _(c.errors).each(function(a){return $(".form-view-flash-container",g.el).append("<li class='error'>"+a+"</li>")})}),b.bind("after:submit:success",function(a,b,c){return $(".form-view-flash-container",g.el).append("<li class='success'>Successfully Saved Record</li>"),b.set(c.result),a.loadModel(b),d.refresh(),_.delay(function(){return $(".form-view-flash-container li.success",g.el).fadeOut(1e3),$(".form-view-flash-container",g.el).html("")},4e3)}),c.eachComponent(function(a){try{return a.bind("on:change",g.filter_handler)}catch(b){return void 0}})},firstActivation:function(){return this.getGrid().trigger("first:activation",this,this.getGrid()),this.getFilter().trigger("first:activation",this,this.getGrid())},reload:function(){var a,b,c,d;return d=this,c=this.getGrid(),b=this.getFilter(),a=this.getEditor(),b.clear(),c.applyFilter()},manageRecord:function(a){var b,c=this;return b=this.getCollection().get(a),b?this.loadModel(b):(console.log("Could Not Find Model, building and fetching"),b=this.buildModel(),b.set({id:a},{silent:!0}),b.fetch({success:function(a,b){return c.loadModel(a)}}))},loadModel:function(a){return this.current_model=a,this.getEditor(!0).loadModel(this.current_model),this.trigger("model:loaded",this.current_model)},currentModel:function(){return this.getEditor(!1).currentModel()},buildModel:function(){var a,b,c;return b=this.getEditor(!1),a=this.getCollection(),a.add([{}],{silent:!0,at:0}),c=a.at(0)},createModel:function(){return this.loadModel(this.buildModel())},reset_filter_handler:function(a){return this.getFilter().clear(),this.getGrid().applyFilter(this.getFilter().getValues())},filter_handler:function(a){return this.getGrid().applyFilter(this.getFilter().getValues())},edit_handler:function(a){var b,c,d,e;return b=d=$(a.currentTarget),e=d.parents("tr").data("record-id"),e&&(c=this.getGrid().collection.get(e)),c||(c=this.getGrid().collection.at(row_index))},add_handler:function(a){var b,c,d;return b=c=$(a.currentTarget),d=c.parents(".record-manager").eq(0).data("resource")},destroy_handler:function(a){},back_to_search_handler:function(){}})}.call(this),function(){var a;a=Luca.register("Luca.Router"),a["extends"]("Backbone.Router"),a.defines({routes:{"":"default"},initialize:function(a){var b,c=this;return this.options=a,_.extend(this,this.options),this.routeHandlers=_(this.routes).values(),_(this.routeHandlers).each(function(a){return c.bind("route:"+a,function(){return c.trigger.apply(c,["change:navigation",a].concat(_(arguments).flatten()))})}),(b=Backbone.Router.initialize)!=null?b.apply(this,arguments):void 0},navigate:function(a,b){return b==null&&(b=!1),Backbone.Router.prototype.navigate.apply(this,arguments),this.buildPathFrom(Backbone.history.getFragment())},buildPathFrom:function(a){var b=this;return _(this.routes).each(function(c,d){var e,f;f=b._routeToRegExp(d);if(f.test(a))return e=b._extractParameters(f,a),b.trigger.apply(b,["change:navigation",c].concat(e))})}})}.call(this),function(){}.call(this);