hyrax 3.1.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +8 -11
  3. data/.dassie/.env +1 -2
  4. data/.dassie/Gemfile +8 -4
  5. data/.dassie/app/controllers/catalog_controller.rb +6 -0
  6. data/.dassie/app/models/user.rb +0 -2
  7. data/.dassie/config/analytics.yml +12 -5
  8. data/.dassie/config/environments/development.rb +2 -0
  9. data/.dassie/config/initializers/hyrax.rb +13 -1
  10. data/.dassie/db/migrate/20210921150120_enable_uuid_extension.valkyrie_engine.rb +7 -0
  11. data/.dassie/db/migrate/20210921150121_create_orm_resources.valkyrie_engine.rb +19 -0
  12. data/.dassie/db/migrate/20210921150122_add_model_type_to_orm_resources.valkyrie_engine.rb +7 -0
  13. data/.dassie/db/migrate/20210921150123_change_model_type_to_internal_model.valkyrie_engine.rb +7 -0
  14. data/.dassie/db/migrate/20210921150124_create_path_gin_index.valkyrie_engine.rb +7 -0
  15. data/.dassie/db/migrate/20210921150125_create_internal_resource_index.valkyrie_engine.rb +7 -0
  16. data/.dassie/db/migrate/20210921150126_create_updated_at_index.valkyrie_engine.rb +7 -0
  17. data/.dassie/db/migrate/20210921150127_add_optimistic_locking_to_orm_resources.valkyrie_engine.rb +7 -0
  18. data/.dassie/db/migrate/20211130181150_create_default_administrative_set.rb +8 -0
  19. data/.dassie/db/schema.rb +20 -1
  20. data/.env +7 -4
  21. data/.github/workflows/main.yml +17 -0
  22. data/.github/workflows/release.yml +17 -0
  23. data/.gitignore +4 -0
  24. data/.regen +1 -1
  25. data/.rubocop_fixme.yml +3 -1
  26. data/CONTAINERS.md +13 -10
  27. data/Dockerfile +4 -4
  28. data/README.md +37 -0
  29. data/app/actors/hyrax/actors/base_actor.rb +1 -1
  30. data/app/actors/hyrax/actors/collections_membership_actor.rb +3 -3
  31. data/app/actors/hyrax/actors/file_actor.rb +6 -4
  32. data/app/actors/hyrax/actors/file_set_actor.rb +2 -0
  33. data/app/actors/hyrax/actors/transfer_request_actor.rb +3 -7
  34. data/app/assets/javascripts/hyrax/admin/graphs.es6 +34 -37
  35. data/app/assets/javascripts/hyrax/analytics_events.js +75 -0
  36. data/app/assets/javascripts/hyrax/autocomplete/linked_data.es6 +1 -3
  37. data/app/assets/javascripts/hyrax/collapse.js +24 -0
  38. data/app/assets/javascripts/hyrax/collections.js +1 -2
  39. data/app/assets/javascripts/hyrax/ga_events.js +2 -8
  40. data/app/assets/javascripts/hyrax/reports-buttons.js +33 -0
  41. data/app/assets/javascripts/hyrax.js +2 -1
  42. data/app/assets/stylesheets/_bootstrap-default-overrides.scss +9 -0
  43. data/app/assets/stylesheets/hyrax/_styles.scss +5 -0
  44. data/app/authorities/qa/authorities/collections.rb +4 -5
  45. data/app/authorities/qa/authorities/find_works.rb +1 -1
  46. data/app/controllers/concerns/hyrax/breadcrumbs_for_collection_analytics.rb +26 -0
  47. data/app/controllers/concerns/hyrax/breadcrumbs_for_works_analytics.rb +26 -0
  48. data/app/controllers/concerns/hyrax/collections_controller_behavior.rb +13 -5
  49. data/app/controllers/concerns/hyrax/controller.rb +56 -2
  50. data/app/controllers/concerns/hyrax/works_controller_behavior.rb +83 -59
  51. data/app/controllers/hyrax/admin/admin_sets_controller.rb +105 -36
  52. data/app/controllers/hyrax/admin/analytics/analytics_controller.rb +40 -0
  53. data/app/controllers/hyrax/admin/analytics/collection_reports_controller.rb +61 -0
  54. data/app/controllers/hyrax/admin/analytics/work_reports_controller.rb +122 -0
  55. data/app/controllers/hyrax/admin/permission_template_accesses_controller.rb +17 -21
  56. data/app/controllers/hyrax/batch_edits_controller.rb +12 -3
  57. data/app/controllers/hyrax/batch_uploads_controller.rb +4 -0
  58. data/app/controllers/hyrax/citations_controller.rb +1 -1
  59. data/app/controllers/hyrax/collections_controller.rb +6 -1
  60. data/app/controllers/hyrax/dashboard/collection_members_controller.rb +12 -9
  61. data/app/controllers/hyrax/dashboard/collections_controller.rb +119 -37
  62. data/app/controllers/hyrax/dashboard/nest_collections_controller.rb +75 -39
  63. data/app/controllers/hyrax/dashboard_controller.rb +8 -0
  64. data/app/controllers/hyrax/my_controller.rb +4 -4
  65. data/app/controllers/hyrax/stats_controller.rb +3 -1
  66. data/app/controllers/hyrax/workflow_actions_controller.rb +8 -5
  67. data/app/forms/hyrax/forms/administrative_set_form.rb +80 -0
  68. data/app/forms/hyrax/forms/batch_edit_form.rb +1 -1
  69. data/app/forms/hyrax/forms/collection_form.rb +2 -2
  70. data/app/forms/hyrax/forms/dashboard/nest_collection_form.rb +33 -8
  71. data/app/forms/hyrax/forms/pcdm_collection_form.rb +68 -0
  72. data/app/forms/hyrax/forms/permission_template_form.rb +17 -9
  73. data/app/forms/hyrax/forms/resource_form.rb +24 -15
  74. data/app/forms/hyrax/forms/workflow_action_form.rb +4 -0
  75. data/app/helpers/hyrax/collections_helper.rb +14 -0
  76. data/app/helpers/hyrax/hyrax_helper_behavior.rb +9 -0
  77. data/app/helpers/hyrax/membership_helper.rb +1 -1
  78. data/app/helpers/hyrax/trophy_helper.rb +1 -1
  79. data/app/helpers/hyrax/url_helper.rb +1 -1
  80. data/app/indexers/hyrax/administrative_set_indexer.rb +12 -6
  81. data/app/indexers/hyrax/deep_indexing_service.rb +1 -1
  82. data/app/indexers/hyrax/file_set_indexer.rb +1 -0
  83. data/app/indexers/hyrax/pcdm_collection_indexer.rb +5 -1
  84. data/app/indexers/hyrax/thumbnail_indexer.rb +31 -0
  85. data/app/indexers/hyrax/valkyrie_file_set_indexer.rb +7 -7
  86. data/app/indexers/hyrax/valkyrie_indexer.rb +4 -2
  87. data/app/indexers/hyrax/valkyrie_work_indexer.rb +13 -0
  88. data/app/inputs/controlled_vocabulary_input.rb +2 -0
  89. data/app/jobs/change_depositor_event_job.rb +47 -0
  90. data/app/jobs/characterize_job.rb +66 -3
  91. data/app/jobs/concerns/hyrax/members_permission_job_behavior.rb +1 -1
  92. data/app/jobs/content_depositor_change_event_job.rb +2 -1
  93. data/app/jobs/hyrax/propagate_change_depositor_job.rb +32 -0
  94. data/app/jobs/inherit_permissions_job.rb +1 -1
  95. data/app/jobs/valkyrie_create_derivatives_job.rb +25 -0
  96. data/app/jobs/valkyrie_ingest_job.rb +124 -0
  97. data/app/models/admin_set.rb +18 -7
  98. data/app/models/collection_branding_info.rb +8 -6
  99. data/app/models/concerns/hyrax/ability/admin_set_ability.rb +31 -7
  100. data/app/models/concerns/hyrax/ability/collection_ability.rb +35 -20
  101. data/app/models/concerns/hyrax/ability/collection_type_ability.rb +1 -1
  102. data/app/models/concerns/hyrax/ability.rb +28 -7
  103. data/app/models/concerns/hyrax/collection_behavior.rb +2 -2
  104. data/app/models/concerns/hyrax/file_set/characterization.rb +7 -1
  105. data/app/models/concerns/hyrax/solr_document/metadata.rb +2 -0
  106. data/app/models/concerns/hyrax/solr_document_behavior.rb +11 -5
  107. data/app/models/file_download_stat.rb +4 -4
  108. data/app/models/hyrax/administrative_set.rb +43 -2
  109. data/app/models/hyrax/collection_type.rb +2 -2
  110. data/app/models/hyrax/default_administrative_set.rb +42 -0
  111. data/app/models/hyrax/file_metadata.rb +5 -1
  112. data/app/models/hyrax/file_set.rb +42 -1
  113. data/app/models/hyrax/pcdm_collection.rb +56 -0
  114. data/app/models/hyrax/permission.rb +1 -1
  115. data/app/models/hyrax/permission_template.rb +30 -10
  116. data/app/models/hyrax/statistic.rb +31 -4
  117. data/app/models/hyrax/work.rb +92 -0
  118. data/app/models/hyrax/workflow_action_info.rb +16 -0
  119. data/app/models/proxy_deposit_request.rb +1 -1
  120. data/app/models/sipity/comment.rb +17 -0
  121. data/app/models/sipity.rb +11 -2
  122. data/app/presenters/hyrax/admin/dashboard_presenter.rb +8 -6
  123. data/app/presenters/hyrax/admin/repository_growth_presenter.rb +10 -5
  124. data/app/presenters/hyrax/admin/user_activity_presenter.rb +8 -12
  125. data/app/presenters/hyrax/admin_set_presenter.rb +10 -5
  126. data/app/presenters/hyrax/collection_presenter.rb +3 -3
  127. data/app/presenters/hyrax/file_set_presenter.rb +2 -0
  128. data/app/presenters/hyrax/menu_presenter.rb +4 -0
  129. data/app/presenters/hyrax/pcdm_member_presenter_factory.rb +3 -3
  130. data/app/presenters/hyrax/work_show_presenter.rb +11 -3
  131. data/app/presenters/hyrax/work_usage.rb +1 -0
  132. data/app/search_builders/hyrax/README.md +1 -1
  133. data/app/search_builders/hyrax/abstract_type_relation.rb +4 -2
  134. data/app/search_builders/hyrax/dashboard/collections_search_builder.rb +2 -2
  135. data/app/search_builders/hyrax/dashboard/managed_search_filters.rb +44 -4
  136. data/app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb +2 -2
  137. data/app/search_builders/hyrax/exposed_models_relation.rb +1 -1
  138. data/app/search_builders/hyrax/filter_by_type.rb +1 -2
  139. data/app/search_builders/hyrax/my/collections_search_builder.rb +12 -5
  140. data/app/services/hyrax/access_control_list.rb +13 -0
  141. data/app/services/hyrax/admin_set_create_service.rb +179 -51
  142. data/app/services/hyrax/analytics/google/events.rb +37 -0
  143. data/app/services/hyrax/analytics/google/events_daily.rb +72 -0
  144. data/app/services/hyrax/analytics/google/visits.rb +44 -0
  145. data/app/services/hyrax/analytics/google/visits_daily.rb +49 -0
  146. data/app/services/hyrax/analytics/google.rb +204 -0
  147. data/app/services/hyrax/analytics/matomo.rb +193 -0
  148. data/app/services/hyrax/analytics/results.rb +79 -0
  149. data/app/services/hyrax/analytics.rb +12 -82
  150. data/app/services/hyrax/change_content_depositor_service.rb +2 -2
  151. data/app/services/hyrax/change_depositor_service.rb +70 -0
  152. data/app/services/hyrax/characterization/valkyrie_characterization_service.rb +134 -0
  153. data/app/services/hyrax/collection_types/permissions_service.rb +1 -1
  154. data/app/services/hyrax/collections/collection_member_service.rb +12 -2
  155. data/app/services/hyrax/collections/nested_collection_query_service.rb +31 -14
  156. data/app/services/hyrax/collections/permissions_create_service.rb +81 -79
  157. data/app/services/hyrax/collections/permissions_service.rb +1 -1
  158. data/app/services/hyrax/curation_concern.rb +24 -2
  159. data/app/services/hyrax/custom_queries/navigators/child_file_sets_navigator.rb +45 -0
  160. data/app/services/hyrax/custom_queries/navigators/child_filesets_navigator.rb +7 -2
  161. data/app/services/hyrax/custom_queries/navigators/parent_work_navigator.rb +54 -0
  162. data/app/services/hyrax/default_middleware_stack.rb +14 -0
  163. data/app/services/hyrax/ensure_well_formed_admin_set_service.rb +3 -3
  164. data/app/services/hyrax/file_set_derivatives_service.rb +21 -2
  165. data/app/services/hyrax/file_set_type_service.rb +2 -5
  166. data/app/services/hyrax/listeners/acl_index_listener.rb +3 -1
  167. data/app/services/hyrax/listeners/active_fedora_acl_index_listener.rb +4 -1
  168. data/app/services/hyrax/listeners/batch_notification_listener.rb +3 -1
  169. data/app/services/hyrax/listeners/file_metadata_listener.rb +38 -0
  170. data/app/services/hyrax/listeners/file_set_lifecycle_listener.rb +6 -2
  171. data/app/services/hyrax/listeners/file_set_lifecycle_notification_listener.rb +6 -2
  172. data/app/services/hyrax/listeners/member_cleanup_listener.rb +26 -3
  173. data/app/services/hyrax/listeners/metadata_index_listener.rb +72 -11
  174. data/app/services/hyrax/listeners/object_lifecycle_listener.rb +9 -3
  175. data/app/services/hyrax/listeners/proxy_deposit_listener.rb +16 -8
  176. data/app/services/hyrax/listeners/trophy_cleanup_listener.rb +3 -0
  177. data/app/services/hyrax/listeners/workflow_listener.rb +3 -1
  178. data/app/services/hyrax/listeners.rb +8 -0
  179. data/app/services/hyrax/location_service.rb +33 -0
  180. data/app/services/hyrax/multiple_membership_checker.rb +44 -1
  181. data/app/services/hyrax/permission_manager.rb +4 -4
  182. data/app/services/hyrax/resource_visibility_propagator.rb +1 -1
  183. data/app/services/hyrax/restriction_service.rb +4 -0
  184. data/app/services/hyrax/simple_schema_loader.rb +5 -1
  185. data/app/services/hyrax/solr_query_service.rb +12 -7
  186. data/app/services/hyrax/solr_service.rb +1 -1
  187. data/app/services/hyrax/statistics/collections/over_time.rb +2 -1
  188. data/app/services/hyrax/statistics/users/over_time.rb +8 -5
  189. data/app/services/hyrax/statistics/works/over_time.rb +10 -0
  190. data/app/services/hyrax/thumbnail_path_service.rb +1 -1
  191. data/app/services/hyrax/work_uploads_handler.rb +2 -9
  192. data/app/services/hyrax/workflow/abstract_notification.rb +2 -2
  193. data/app/services/hyrax/workflow/action_taken_service.rb +16 -4
  194. data/app/services/hyrax/workflow/activate_object.rb +5 -4
  195. data/app/services/hyrax/workflow/changes_required_notification.rb +5 -4
  196. data/app/services/hyrax/workflow/deactivate_object.rb +7 -5
  197. data/app/services/hyrax/workflow/deposited_notification.rb +8 -4
  198. data/app/services/hyrax/workflow/grant_edit_to_depositor.rb +7 -3
  199. data/app/services/hyrax/workflow/grant_read_to_depositor.rb +10 -3
  200. data/app/services/hyrax/workflow/revoke_edit_from_depositor.rb +8 -2
  201. data/app/services/hyrax/workflow/workflow_action_service.rb +4 -1
  202. data/app/validators/hyrax/collection_membership_validator.rb +38 -0
  203. data/app/views/catalog/_index_header_list_hyrax_pcdm_collection.html.erb +4 -0
  204. data/app/views/hyrax/admin/admin_sets/_form.html.erb +1 -1
  205. data/app/views/hyrax/admin/admin_sets/_form_participant_table.html.erb +2 -2
  206. data/app/views/hyrax/admin/admin_sets/_form_participants.html.erb +2 -2
  207. data/app/views/hyrax/admin/admin_sets/_form_visibility.html.erb +2 -2
  208. data/app/views/hyrax/admin/admin_sets/_form_workflow.erb +1 -1
  209. data/app/views/hyrax/admin/analytics/_date_range_form.html.erb +11 -0
  210. data/app/views/hyrax/admin/analytics/collection_reports/_custom_range.html.erb +39 -0
  211. data/app/views/hyrax/admin/analytics/collection_reports/_monthly_summary.html.erb +48 -0
  212. data/app/views/hyrax/admin/analytics/collection_reports/_summary.html.erb +55 -0
  213. data/app/views/hyrax/admin/analytics/collection_reports/_top_collections.html.erb +55 -0
  214. data/app/views/hyrax/admin/analytics/collection_reports/index.html.erb +70 -0
  215. data/app/views/hyrax/admin/analytics/collection_reports/show.html.erb +94 -0
  216. data/app/views/hyrax/admin/analytics/work_reports/_custom_range.html.erb +43 -0
  217. data/app/views/hyrax/admin/analytics/work_reports/_monthly_summary.html.erb +35 -0
  218. data/app/views/hyrax/admin/analytics/work_reports/_summary.html.erb +60 -0
  219. data/app/views/hyrax/admin/analytics/work_reports/_top_file_set_downloads.html.erb +33 -0
  220. data/app/views/hyrax/admin/analytics/work_reports/_top_works.html.erb +40 -0
  221. data/app/views/hyrax/admin/analytics/work_reports/_work_counts.html.erb +18 -0
  222. data/app/views/hyrax/admin/analytics/work_reports/_work_files.html.erb +41 -0
  223. data/app/views/hyrax/admin/analytics/work_reports/index.html.erb +77 -0
  224. data/app/views/hyrax/admin/analytics/work_reports/show.html.erb +90 -0
  225. data/app/views/hyrax/admin/collection_types/index.html.erb +1 -1
  226. data/app/views/hyrax/admin/stats/show.html.erb +1 -1
  227. data/app/views/hyrax/base/_form.html.erb +1 -1
  228. data/app/views/hyrax/base/_form_child_work_relationships.html.erb +1 -1
  229. data/app/views/hyrax/base/_relationships_parent_row.html.erb +0 -1
  230. data/app/views/hyrax/base/show.html.erb +6 -0
  231. data/app/views/hyrax/collections/show.html.erb +4 -0
  232. data/app/views/hyrax/dashboard/_repository_growth.html.erb +5 -5
  233. data/app/views/hyrax/dashboard/_resource_type_graph.html.erb +41 -0
  234. data/app/views/hyrax/dashboard/_sidebar.html.erb +4 -1
  235. data/app/views/hyrax/dashboard/_tabs.html.erb +11 -0
  236. data/app/views/hyrax/dashboard/_user_activity.html.erb +17 -23
  237. data/app/views/hyrax/dashboard/_user_activity_graph.html.erb +55 -0
  238. data/app/views/hyrax/dashboard/_visibility_graph.html.erb +31 -0
  239. data/app/views/hyrax/dashboard/_work_type_graph.html.erb +41 -0
  240. data/app/views/hyrax/dashboard/collections/_collection_title.html.erb +1 -1
  241. data/app/views/hyrax/dashboard/collections/_default_group.html.erb +2 -2
  242. data/app/views/hyrax/dashboard/collections/_form.html.erb +24 -17
  243. data/app/views/hyrax/dashboard/collections/_form_discovery.html.erb +6 -3
  244. data/app/views/hyrax/dashboard/collections/_form_share.html.erb +2 -2
  245. data/app/views/hyrax/dashboard/collections/_form_share_table.html.erb +3 -3
  246. data/app/views/hyrax/dashboard/collections/_list_collections.html.erb +2 -2
  247. data/app/views/hyrax/dashboard/collections/_sort_and_per_page.html.erb +1 -1
  248. data/app/views/hyrax/dashboard/show_admin.html.erb +24 -45
  249. data/app/views/hyrax/dashboard/sidebar/_activity.html.erb +22 -0
  250. data/app/views/hyrax/dashboard/works/_default_group.html.erb +1 -1
  251. data/app/views/hyrax/dashboard/works/_list_works.html.erb +1 -1
  252. data/app/views/hyrax/file_sets/_actions.html.erb +4 -3
  253. data/app/views/hyrax/file_sets/show.html.erb +6 -0
  254. data/app/views/hyrax/homepage/index.html.erb +1 -1
  255. data/app/views/hyrax/my/_work_action_menu.html.erb +8 -9
  256. data/app/views/hyrax/my/collections/_default_group.html.erb +2 -2
  257. data/app/views/hyrax/my/collections/_list_collections.html.erb +2 -2
  258. data/app/views/hyrax/my/collections/_modal_collection_types_to_create.html.erb +1 -1
  259. data/app/views/hyrax/my/collections/index.html.erb +4 -3
  260. data/app/views/hyrax/my/works/_default_group.html.erb +1 -1
  261. data/app/views/hyrax/my/works/_list_works.html.erb +1 -2
  262. data/app/views/hyrax/my/works/index.html.erb +4 -2
  263. data/app/views/hyrax/stats/_downloads.html.erb +18 -0
  264. data/app/views/hyrax/stats/_pageviews.html.erb +18 -0
  265. data/app/views/hyrax/stats/work.html.erb +17 -9
  266. data/app/views/layouts/_head_tag_content.html.erb +7 -2
  267. data/app/views/layouts/hyrax/dashboard.html.erb +1 -0
  268. data/app/views/layouts/hyrax.html.erb +1 -0
  269. data/app/views/{_ga.html.erb → shared/_ga.html.erb} +3 -7
  270. data/app/views/shared/_matomo.html.erb +15 -0
  271. data/app/views/shared/_read_only.html.erb +5 -0
  272. data/chart/hyrax/Chart.yaml +2 -2
  273. data/chart/hyrax/README.md +22 -1
  274. data/chart/hyrax/templates/deployment.yaml +6 -0
  275. data/chart/hyrax/values.yaml +1 -1
  276. data/config/features.rb +3 -0
  277. data/config/i18n-tasks.yml +2 -2
  278. data/config/initializers/1_healthz.rb +1 -0
  279. data/config/initializers/listeners.rb +5 -5
  280. data/config/locales/hyrax.de.yml +200 -5
  281. data/config/locales/hyrax.en.yml +202 -21
  282. data/config/locales/hyrax.es.yml +204 -9
  283. data/config/locales/hyrax.fr.yml +196 -1
  284. data/config/locales/hyrax.it.yml +197 -2
  285. data/config/locales/hyrax.pt-BR.yml +196 -1
  286. data/config/locales/hyrax.zh.yml +196 -1
  287. data/config/metadata/basic_metadata.yaml +2 -0
  288. data/config/metadata/core_metadata.yaml +1 -1
  289. data/config/routes.rb +4 -0
  290. data/db/seeds.rb +1 -1
  291. data/docker-compose.yml +48 -42
  292. data/documentation/developing-your-hyrax-based-app.md +2 -2
  293. data/documentation/legacyREADME.md +1 -1
  294. data/hyrax.gemspec +4 -2
  295. data/lib/generators/hyrax/templates/catalog_controller.rb +3 -1
  296. data/lib/generators/hyrax/templates/config/analytics.yml +13 -7
  297. data/lib/generators/hyrax/templates/config/initializers/hyrax.rb +10 -13
  298. data/lib/generators/hyrax/templates/db/migrate/20211130181150_create_default_administrative_set.rb.erb +8 -0
  299. data/lib/generators/hyrax/work/templates/feature_spec.rb.erb +4 -2
  300. data/lib/generators/hyrax/work_resource/templates/indexer_spec.rb.erb +1 -0
  301. data/lib/hyrax/administrative_set_name.rb +18 -0
  302. data/lib/hyrax/collection_name.rb +8 -2
  303. data/lib/hyrax/configuration.rb +104 -4
  304. data/lib/hyrax/controlled_vocabularies/location.rb +9 -2
  305. data/lib/hyrax/controlled_vocabularies/resource_label_caching.rb +42 -0
  306. data/lib/hyrax/controlled_vocabularies.rb +1 -0
  307. data/lib/hyrax/engine.rb +7 -6
  308. data/lib/hyrax/form_fields.rb +1 -0
  309. data/lib/hyrax/publisher.rb +61 -0
  310. data/lib/hyrax/resource_sync/change_list_writer.rb +2 -2
  311. data/lib/hyrax/resource_sync/resource_list_writer.rb +2 -2
  312. data/lib/hyrax/specs/capybara.rb +1 -1
  313. data/lib/hyrax/specs/shared_specs/hydra_works.rb +13 -4
  314. data/lib/hyrax/specs/shared_specs/indexers.rb +120 -0
  315. data/lib/hyrax/transactions/admin_set_create.rb +23 -0
  316. data/lib/hyrax/transactions/admin_set_destroy.rb +22 -0
  317. data/lib/hyrax/transactions/admin_set_update.rb +21 -0
  318. data/lib/hyrax/transactions/collection_create.rb +25 -0
  319. data/lib/hyrax/transactions/collection_destroy.rb +22 -0
  320. data/lib/hyrax/transactions/collection_update.rb +21 -0
  321. data/lib/hyrax/transactions/container.rb +118 -17
  322. data/lib/hyrax/transactions/create_work.rb +3 -0
  323. data/lib/hyrax/transactions/destroy_work.rb +3 -0
  324. data/lib/hyrax/transactions/steps/add_to_collections.rb +13 -1
  325. data/lib/hyrax/transactions/steps/apply_collection_permission_template.rb +2 -0
  326. data/lib/hyrax/transactions/steps/apply_collection_type_permissions.rb +29 -0
  327. data/lib/hyrax/transactions/steps/apply_permission_template.rb +2 -0
  328. data/lib/hyrax/transactions/steps/apply_visibility.rb +2 -0
  329. data/lib/hyrax/transactions/steps/change_depositor.rb +46 -0
  330. data/lib/hyrax/transactions/steps/check_for_empty_admin_set.rb +36 -0
  331. data/lib/hyrax/transactions/steps/delete_access_control.rb +32 -0
  332. data/lib/hyrax/transactions/steps/delete_resource.rb +19 -3
  333. data/lib/hyrax/transactions/steps/destroy_work.rb +3 -1
  334. data/lib/hyrax/transactions/steps/ensure_permission_template.rb +2 -0
  335. data/lib/hyrax/transactions/steps/save.rb +37 -7
  336. data/lib/hyrax/transactions/steps/save_access_control.rb +2 -2
  337. data/lib/hyrax/transactions/steps/save_work.rb +3 -0
  338. data/lib/hyrax/transactions/steps/set_collection_type_gid.rb +35 -0
  339. data/lib/hyrax/transactions/steps/set_user_as_creator.rb +41 -0
  340. data/lib/hyrax/transactions/steps/update_work_members.rb +51 -0
  341. data/lib/hyrax/transactions/update_work.rb +4 -3
  342. data/lib/hyrax/transactions/work_create.rb +1 -1
  343. data/lib/hyrax/transactions/work_destroy.rb +2 -1
  344. data/lib/hyrax/transactions/work_update.rb +19 -0
  345. data/lib/hyrax/version.rb +1 -1
  346. data/lib/tasks/default_admin_set.rake +12 -11
  347. data/lib/tasks/regenerate_derivatives.rake +1 -1
  348. data/lib/wings/attribute_transformer.rb +5 -1
  349. data/lib/wings/setup.rb +18 -1
  350. data/lib/wings/valkyrie/persister.rb +16 -0
  351. data/lib/wings/valkyrie/query_service.rb +2 -1
  352. data/lib/wings/valkyrie/storage.rb +7 -1
  353. data/template.rb +1 -1
  354. data/vendor/assets/javascripts/morris/morris.min.js +1 -7
  355. data/vendor/assets/stylesheets/morris.js/0.5.1/morris.css +1 -1
  356. metadata +121 -17
  357. data/app/views/hyrax/dashboard/_repository_objects.html.erb +0 -28
data/lib/wings/setup.rb CHANGED
@@ -42,6 +42,21 @@ module ActiveFedora
42
42
  def self.properties
43
43
  metadata.properties
44
44
  end
45
+
46
+ def self.default_sort_params
47
+ ["system_create_dtsi asc"]
48
+ end
49
+ end
50
+
51
+ module WithMetadata
52
+ class MetadataNode
53
+ ##
54
+ # @note fcrepo rejects `:file_hash` updates. the attribute is managed by
55
+ # the data store. always drop it from changed attributes.
56
+ def changed_attributes
57
+ super.except(:file_hash)
58
+ end
59
+ end
45
60
  end
46
61
 
47
62
  module Associations
@@ -78,8 +93,10 @@ Valkyrie.config.storage_adapter = :active_fedora
78
93
  custom_queries = [Hyrax::CustomQueries::Navigators::CollectionMembers,
79
94
  Hyrax::CustomQueries::Navigators::ChildCollectionsNavigator,
80
95
  Hyrax::CustomQueries::Navigators::ParentCollectionsNavigator,
81
- Hyrax::CustomQueries::Navigators::ChildFilesetsNavigator,
96
+ Hyrax::CustomQueries::Navigators::ChildFileSetsNavigator,
97
+ Hyrax::CustomQueries::Navigators::ChildFilesetsNavigator, # deprecated; use ChildFileSetsNavigator
82
98
  Hyrax::CustomQueries::Navigators::ChildWorksNavigator,
99
+ Hyrax::CustomQueries::Navigators::ParentWorkNavigator,
83
100
  Hyrax::CustomQueries::Navigators::FindFiles,
84
101
  Wings::CustomQueries::FindAccessControl, # override Hyrax::CustomQueries::FindAccessControl
85
102
  Wings::CustomQueries::FindCollectionsByType,
@@ -34,6 +34,9 @@ module Wings
34
34
 
35
35
  resource_factory.to_resource(object: af_object)
36
36
  rescue ActiveFedora::RecordInvalid, RuntimeError => err
37
+ raise MissingOrUnsavedFileError.new(err.message, obj: af_object) if
38
+ err.message == 'Save the file first'
39
+
37
40
  raise FailedSaveError.new(err.message, obj: af_object)
38
41
  end
39
42
 
@@ -69,10 +72,23 @@ module Wings
69
72
 
70
73
  def initialize(msg = nil, obj:)
71
74
  self.obj = obj
75
+ msg = "Failed to save object {obj}.\n" + msg
72
76
  super(msg)
73
77
  end
74
78
  end
75
79
 
80
+ class MissingOrUnsavedFileError < FailedSaveError
81
+ def initialize(msg = nil, obj:)
82
+ msg = "Wings tried to save metadata for a file which has not " \
83
+ "been saved. Fedora creates a metadata node when the file is " \
84
+ "created, so it's not possible to add metadata for a file " \
85
+ "until the file contents are persisted.\n Use the " \
86
+ "Hyrax.storage_adapter to save the file before trying to " \
87
+ "save metadata.\n" + msg
88
+ super(msg, obj: obj)
89
+ end
90
+ end
91
+
76
92
  private
77
93
 
78
94
  ##
@@ -168,9 +168,10 @@ module Wings
168
168
  id ||= resource.id
169
169
  raise ArgumentError, "Resource has no id; is it persisted?" unless id
170
170
 
171
+ property = Hyrax.config.admin_set_predicate.qname.last if property.to_sym == :admin_set_id
171
172
  active_fedora_model = model ? model_class_for(model) : ActiveFedora::Base
172
-
173
173
  uri = active_fedora_model.id_to_uri(id.to_s)
174
+
174
175
  active_fedora_model.where("+(#{property}_ssim: \"#{uri}\" OR #{property}_ssim: \"#{id}\")").map do |obj|
175
176
  resource_factory.to_resource(object: obj)
176
177
  end
@@ -28,6 +28,12 @@ module Wings
28
28
  super
29
29
  end
30
30
 
31
+ ##
32
+ # @api private
33
+ def self.cast_to_valkyrie_id(id)
34
+ ::Valkyrie::ID.new(id.to_s.sub(/^.+\/\//, PROTOCOL))
35
+ end
36
+
31
37
  ##
32
38
  # @param key [Symbol] the key for plugin behavior to check support for
33
39
  #
@@ -140,7 +146,7 @@ module Wings
140
146
  end
141
147
 
142
148
  def cast_to_valkyrie_id(id)
143
- ::Valkyrie::ID.new(id.to_s.sub(/^.+\/\//, PROTOCOL))
149
+ self.class.cast_to_valkyrie_id(id)
144
150
  end
145
151
  end
146
152
  end
data/template.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  # Hack for https://github.com/rails/rails/issues/35153
3
3
  gsub_file 'Gemfile', /^gem ["']sqlite3["']$/, 'gem "sqlite3", "~> 1.3.0"'
4
- gem 'hyrax', '3.1.0'
4
+ gem 'hyrax', '3.4.0'
5
5
  run 'bundle install'
6
6
  generate 'hyrax:install', '-f'
@@ -1,7 +1 @@
1
- /* @license
2
- morris.js v0.5.0
3
- Copyright 2014 Olly Smith All rights reserved.
4
- Licensed under the BSD-2-Clause License.
5
- */
6
- (function(){var a,b,c,d,e=[].slice,f=function(a,b){return function(){return a.apply(b,arguments)}},g={}.hasOwnProperty,h=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},i=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};b=window.Morris={},a=jQuery,b.EventEmitter=function(){function a(){}return a.prototype.on=function(a,b){return null==this.handlers&&(this.handlers={}),null==this.handlers[a]&&(this.handlers[a]=[]),this.handlers[a].push(b),this},a.prototype.fire=function(){var a,b,c,d,f,g,h;if(c=arguments[0],a=2<=arguments.length?e.call(arguments,1):[],null!=this.handlers&&null!=this.handlers[c]){for(g=this.handlers[c],h=[],d=0,f=g.length;f>d;d++)b=g[d],h.push(b.apply(null,a));return h}},a}(),b.commas=function(a){var b,c,d,e;return null!=a?(d=0>a?"-":"",b=Math.abs(a),c=Math.floor(b).toFixed(0),d+=c.replace(/(?=(?:\d{3})+$)(?!^)/g,","),e=b.toString(),e.length>c.length&&(d+=e.slice(c.length)),d):"-"},b.pad2=function(a){return(10>a?"0":"")+a},b.Grid=function(c){function d(b){this.resizeHandler=f(this.resizeHandler,this);var c=this;if(this.el="string"==typeof b.element?a(document.getElementById(b.element)):a(b.element),null==this.el||0===this.el.length)throw new Error("Graph container element not found");"static"===this.el.css("position")&&this.el.css("position","relative"),this.options=a.extend({},this.gridDefaults,this.defaults||{},b),"string"==typeof this.options.units&&(this.options.postUnits=b.units),this.raphael=new Raphael(this.el[0]),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.selectFrom=null,this.init&&this.init(),this.setData(this.options.data),this.el.bind("mousemove",function(a){var b,d,e,f,g;return d=c.el.offset(),g=a.pageX-d.left,c.selectFrom?(b=c.data[c.hitTest(Math.min(g,c.selectFrom))]._x,e=c.data[c.hitTest(Math.max(g,c.selectFrom))]._x,f=e-b,c.selectionRect.attr({x:b,width:f})):c.fire("hovermove",g,a.pageY-d.top)}),this.el.bind("mouseleave",function(){return c.selectFrom&&(c.selectionRect.hide(),c.selectFrom=null),c.fire("hoverout")}),this.el.bind("touchstart touchmove touchend",function(a){var b,d;return d=a.originalEvent.touches[0]||a.originalEvent.changedTouches[0],b=c.el.offset(),c.fire("hovermove",d.pageX-b.left,d.pageY-b.top)}),this.el.bind("click",function(a){var b;return b=c.el.offset(),c.fire("gridclick",a.pageX-b.left,a.pageY-b.top)}),this.options.rangeSelect&&(this.selectionRect=this.raphael.rect(0,0,0,this.el.innerHeight()).attr({fill:this.options.rangeSelectColor,stroke:!1}).toBack().hide(),this.el.bind("mousedown",function(a){var b;return b=c.el.offset(),c.startRange(a.pageX-b.left)}),this.el.bind("mouseup",function(a){var b;return b=c.el.offset(),c.endRange(a.pageX-b.left),c.fire("hovermove",a.pageX-b.left,a.pageY-b.top)})),this.options.resize&&a(window).bind("resize",function(){return null!=c.timeoutId&&window.clearTimeout(c.timeoutId),c.timeoutId=window.setTimeout(c.resizeHandler,100)}),this.el.css("-webkit-tap-highlight-color","rgba(0,0,0,0)"),this.postInit&&this.postInit()}return h(d,c),d.prototype.gridDefaults={dateFormat:null,axes:!0,grid:!0,gridLineColor:"#aaa",gridStrokeWidth:.5,gridTextColor:"#888",gridTextSize:12,gridTextFamily:"sans-serif",gridTextWeight:"normal",hideHover:!1,yLabelFormat:null,xLabelAngle:0,numLines:5,padding:25,parseTime:!0,postUnits:"",preUnits:"",ymax:"auto",ymin:"auto 0",goals:[],goalStrokeWidth:1,goalLineColors:["#666633","#999966","#cc6666","#663333"],events:[],eventStrokeWidth:1,eventLineColors:["#005a04","#ccffbb","#3a5f0b","#005502"],rangeSelect:null,rangeSelectColor:"#eef",resize:!1},d.prototype.setData=function(a,c){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;return null==c&&(c=!0),this.options.data=a,null==a||0===a.length?(this.data=[],this.raphael.clear(),null!=this.hover&&this.hover.hide(),void 0):(o=this.cumulative?0:null,p=this.cumulative?0:null,this.options.goals.length>0&&(h=Math.min.apply(Math,this.options.goals),g=Math.max.apply(Math,this.options.goals),p=null!=p?Math.min(p,h):h,o=null!=o?Math.max(o,g):g),this.data=function(){var c,d,g;for(g=[],f=c=0,d=a.length;d>c;f=++c)j=a[f],i={src:j},i.label=j[this.options.xkey],this.options.parseTime?(i.x=b.parseDate(i.label),this.options.dateFormat?i.label=this.options.dateFormat(i.x):"number"==typeof i.label&&(i.label=new Date(i.label).toString())):(i.x=f,this.options.xLabelFormat&&(i.label=this.options.xLabelFormat(i))),l=0,i.y=function(){var a,b,c,d;for(c=this.options.ykeys,d=[],e=a=0,b=c.length;b>a;e=++a)n=c[e],q=j[n],"string"==typeof q&&(q=parseFloat(q)),null!=q&&"number"!=typeof q&&(q=null),null!=q&&(this.cumulative?l+=q:null!=o?(o=Math.max(q,o),p=Math.min(q,p)):o=p=q),this.cumulative&&null!=l&&(o=Math.max(l,o),p=Math.min(l,p)),d.push(q);return d}.call(this),g.push(i);return g}.call(this),this.options.parseTime&&(this.data=this.data.sort(function(a,b){return(a.x>b.x)-(b.x>a.x)})),this.xmin=this.data[0].x,this.xmax=this.data[this.data.length-1].x,this.events=[],this.options.events.length>0&&(this.events=this.options.parseTime?function(){var a,c,e,f;for(e=this.options.events,f=[],a=0,c=e.length;c>a;a++)d=e[a],f.push(b.parseDate(d));return f}.call(this):this.options.events,this.xmax=Math.max(this.xmax,Math.max.apply(Math,this.events)),this.xmin=Math.min(this.xmin,Math.min.apply(Math,this.events))),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),this.ymin=this.yboundary("min",p),this.ymax=this.yboundary("max",o),this.ymin===this.ymax&&(p&&(this.ymin-=1),this.ymax+=1),((r=this.options.axes)===!0||"both"===r||"y"===r||this.options.grid===!0)&&(this.options.ymax===this.gridDefaults.ymax&&this.options.ymin===this.gridDefaults.ymin?(this.grid=this.autoGridLines(this.ymin,this.ymax,this.options.numLines),this.ymin=Math.min(this.ymin,this.grid[0]),this.ymax=Math.max(this.ymax,this.grid[this.grid.length-1])):(k=(this.ymax-this.ymin)/(this.options.numLines-1),this.grid=function(){var a,b,c,d;for(d=[],m=a=b=this.ymin,c=this.ymax;k>0?c>=a:a>=c;m=a+=k)d.push(m);return d}.call(this))),this.dirty=!0,c?this.redraw():void 0)},d.prototype.yboundary=function(a,b){var c,d;return c=this.options["y"+a],"string"==typeof c?"auto"===c.slice(0,4)?c.length>5?(d=parseInt(c.slice(5),10),null==b?d:Math[a](b,d)):null!=b?b:0:parseInt(c,10):c},d.prototype.autoGridLines=function(a,b,c){var d,e,f,g,h,i,j,k,l;return h=b-a,l=Math.floor(Math.log(h)/Math.log(10)),j=Math.pow(10,l),e=Math.floor(a/j)*j,d=Math.ceil(b/j)*j,i=(d-e)/(c-1),1===j&&i>1&&Math.ceil(i)!==i&&(i=Math.ceil(i),d=e+i*(c-1)),0>e&&d>0&&(e=Math.floor(a/i)*i,d=Math.ceil(b/i)*i),1>i?(g=Math.floor(Math.log(i)/Math.log(10)),f=function(){var a,b;for(b=[],k=a=e;i>0?d>=a:a>=d;k=a+=i)b.push(parseFloat(k.toFixed(1-g)));return b}()):f=function(){var a,b;for(b=[],k=a=e;i>0?d>=a:a>=d;k=a+=i)b.push(k);return b}(),f},d.prototype._calc=function(){var a,b,c,d,e,f,g,h;return e=this.el.width(),c=this.el.height(),(this.elementWidth!==e||this.elementHeight!==c||this.dirty)&&(this.elementWidth=e,this.elementHeight=c,this.dirty=!1,this.left=this.options.padding,this.right=this.elementWidth-this.options.padding,this.top=this.options.padding,this.bottom=this.elementHeight-this.options.padding,((g=this.options.axes)===!0||"both"===g||"y"===g)&&(f=function(){var a,c,d,e;for(d=this.grid,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(this.measureText(this.yAxisFormat(b)).width);return e}.call(this),this.left+=Math.max.apply(Math,f)),((h=this.options.axes)===!0||"both"===h||"x"===h)&&(a=function(){var a,b,c;for(c=[],d=a=0,b=this.data.length;b>=0?b>a:a>b;d=b>=0?++a:--a)c.push(this.measureText(this.data[d].text,-this.options.xLabelAngle).height);return c}.call(this),this.bottom-=Math.max.apply(Math,a)),this.width=Math.max(1,this.right-this.left),this.height=Math.max(1,this.bottom-this.top),this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin),this.calc)?this.calc():void 0},d.prototype.transY=function(a){return this.bottom-(a-this.ymin)*this.dy},d.prototype.transX=function(a){return 1===this.data.length?(this.left+this.right)/2:this.left+(a-this.xmin)*this.dx},d.prototype.redraw=function(){return this.raphael.clear(),this._calc(),this.drawGrid(),this.drawGoals(),this.drawEvents(),this.draw?this.draw():void 0},d.prototype.measureText=function(a,b){var c,d;return null==b&&(b=0),d=this.raphael.text(100,100,a).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).rotate(b),c=d.getBBox(),d.remove(),c},d.prototype.yAxisFormat=function(a){return this.yLabelFormat(a)},d.prototype.yLabelFormat=function(a){return"function"==typeof this.options.yLabelFormat?this.options.yLabelFormat(a):""+this.options.preUnits+b.commas(a)+this.options.postUnits},d.prototype.drawGrid=function(){var a,b,c,d,e,f,g,h;if(this.options.grid!==!1||(e=this.options.axes)===!0||"both"===e||"y"===e){for(f=this.grid,h=[],c=0,d=f.length;d>c;c++)a=f[c],b=this.transY(a),((g=this.options.axes)===!0||"both"===g||"y"===g)&&this.drawYAxisLabel(this.left-this.options.padding/2,b,this.yAxisFormat(a)),this.options.grid?h.push(this.drawGridLine("M"+this.left+","+b+"H"+(this.left+this.width))):h.push(void 0);return h}},d.prototype.drawGoals=function(){var a,b,c,d,e,f,g;for(f=this.options.goals,g=[],c=d=0,e=f.length;e>d;c=++d)b=f[c],a=this.options.goalLineColors[c%this.options.goalLineColors.length],g.push(this.drawGoal(b,a));return g},d.prototype.drawEvents=function(){var a,b,c,d,e,f,g;for(f=this.events,g=[],c=d=0,e=f.length;e>d;c=++d)b=f[c],a=this.options.eventLineColors[c%this.options.eventLineColors.length],g.push(this.drawEvent(b,a));return g},d.prototype.drawGoal=function(a,b){return this.raphael.path("M"+this.left+","+this.transY(a)+"H"+this.right).attr("stroke",b).attr("stroke-width",this.options.goalStrokeWidth)},d.prototype.drawEvent=function(a,b){return this.raphael.path("M"+this.transX(a)+","+this.bottom+"V"+this.top).attr("stroke",b).attr("stroke-width",this.options.eventStrokeWidth)},d.prototype.drawYAxisLabel=function(a,b,c){return this.raphael.text(a,b,c).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor).attr("text-anchor","end")},d.prototype.drawGridLine=function(a){return this.raphael.path(a).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth)},d.prototype.startRange=function(a){return this.hover.hide(),this.selectFrom=a,this.selectionRect.attr({x:a,width:0}).show()},d.prototype.endRange=function(a){var b,c;return this.selectFrom?(c=Math.min(this.selectFrom,a),b=Math.max(this.selectFrom,a),this.options.rangeSelect.call(this.el,{start:this.data[this.hitTest(c)].x,end:this.data[this.hitTest(b)].x}),this.selectFrom=null):void 0},d.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},d}(b.EventEmitter),b.parseDate=function(a){var b,c,d,e,f,g,h,i,j,k,l;return"number"==typeof a?a:(c=a.match(/^(\d+) Q(\d)$/),e=a.match(/^(\d+)-(\d+)$/),f=a.match(/^(\d+)-(\d+)-(\d+)$/),h=a.match(/^(\d+) W(\d+)$/),i=a.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),j=a.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),c?new Date(parseInt(c[1],10),3*parseInt(c[2],10)-1,1).getTime():e?new Date(parseInt(e[1],10),parseInt(e[2],10)-1,1).getTime():f?new Date(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10)).getTime():h?(k=new Date(parseInt(h[1],10),0,1),4!==k.getDay()&&k.setMonth(0,1+(4-k.getDay()+7)%7),k.getTime()+6048e5*parseInt(h[2],10)):i?i[6]?(g=0,"Z"!==i[6]&&(g=60*parseInt(i[8],10)+parseInt(i[9],10),"+"===i[7]&&(g=0-g)),Date.UTC(parseInt(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10)+g)):new Date(parseInt(i[1],10),parseInt(i[2],10)-1,parseInt(i[3],10),parseInt(i[4],10),parseInt(i[5],10)).getTime():j?(l=parseFloat(j[6]),b=Math.floor(l),d=Math.round(1e3*(l-b)),j[8]?(g=0,"Z"!==j[8]&&(g=60*parseInt(j[10],10)+parseInt(j[11],10),"+"===j[9]&&(g=0-g)),Date.UTC(parseInt(j[1],10),parseInt(j[2],10)-1,parseInt(j[3],10),parseInt(j[4],10),parseInt(j[5],10)+g,b,d)):new Date(parseInt(j[1],10),parseInt(j[2],10)-1,parseInt(j[3],10),parseInt(j[4],10),parseInt(j[5],10),b,d).getTime()):new Date(parseInt(a,10),0,1).getTime())},b.Hover=function(){function c(c){null==c&&(c={}),this.options=a.extend({},b.Hover.defaults,c),this.el=a("<div class='"+this.options["class"]+"'></div>"),this.el.hide(),this.options.parent.append(this.el)}return c.defaults={"class":"morris-hover morris-default-style"},c.prototype.update=function(a,b,c){return a?(this.html(a),this.show(),this.moveTo(b,c)):this.hide()},c.prototype.html=function(a){return this.el.html(a)},c.prototype.moveTo=function(a,b){var c,d,e,f,g,h;return g=this.options.parent.innerWidth(),f=this.options.parent.innerHeight(),d=this.el.outerWidth(),c=this.el.outerHeight(),e=Math.min(Math.max(0,a-d/2),g-d),null!=b?(h=b-c-10,0>h&&(h=b+10,h+c>f&&(h=f/2-c/2))):h=f/2-c/2,this.el.css({left:e+"px",top:parseInt(h)+"px"})},c.prototype.show=function(){return this.el.show()},c.prototype.hide=function(){return this.el.hide()},c}(),b.Line=function(a){function c(a){return this.hilight=f(this.hilight,this),this.onHoverOut=f(this.onHoverOut,this),this.onHoverMove=f(this.onHoverMove,this),this.onGridClick=f(this.onGridClick,this),this instanceof b.Line?(c.__super__.constructor.call(this,a),void 0):new b.Line(a)}return h(c,a),c.prototype.init=function(){return"always"!==this.options.hideHover?(this.hover=new b.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut),this.on("gridclick",this.onGridClick)):void 0},c.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],pointStrokeWidths:[1],pointStrokeColors:["#ffffff"],pointFillColors:[],smooth:!0,xLabels:"auto",xLabelFormat:null,xLabelMargin:24,hideHover:!1},c.prototype.calc=function(){return this.calcPoints(),this.generatePaths()},c.prototype.calcPoints=function(){var a,b,c,d,e,f;for(e=this.data,f=[],c=0,d=e.length;d>c;c++)a=e[c],a._x=this.transX(a.x),a._y=function(){var c,d,e,f;for(e=a.y,f=[],c=0,d=e.length;d>c;c++)b=e[c],null!=b?f.push(this.transY(b)):f.push(b);return f}.call(this),f.push(a._ymax=Math.min.apply(Math,[this.bottom].concat(function(){var c,d,e,f;for(e=a._y,f=[],c=0,d=e.length;d>c;c++)b=e[c],null!=b&&f.push(b);return f}())));return f},c.prototype.hitTest=function(a){var b,c,d,e,f;if(0===this.data.length)return null;for(f=this.data.slice(1),b=d=0,e=f.length;e>d&&(c=f[b],!(a<(c._x+this.data[b]._x)/2));b=++d);return b},c.prototype.onGridClick=function(a,b){var c;return c=this.hitTest(a),this.fire("click",c,this.data[c].src,a,b)},c.prototype.onHoverMove=function(a){var b;return b=this.hitTest(a),this.displayHoverForRow(b)},c.prototype.onHoverOut=function(){return this.options.hideHover!==!1?this.displayHoverForRow(null):void 0},c.prototype.displayHoverForRow=function(a){var b;return null!=a?((b=this.hover).update.apply(b,this.hoverContentForRow(a)),this.hilight(a)):(this.hover.hide(),this.hilight())},c.prototype.hoverContentForRow=function(a){var b,c,d,e,f,g,h;for(d=this.data[a],b="<div class='morris-hover-row-label'>"+d.label+"</div>",h=d.y,c=f=0,g=h.length;g>f;c=++f)e=h[c],b+="<div class='morris-hover-point' style='color: "+this.colorFor(d,c,"label")+"'>\n "+this.options.labels[c]+":\n "+this.yLabelFormat(e)+"\n</div>";return"function"==typeof this.options.hoverCallback&&(b=this.options.hoverCallback(a,this.options,b,d.src)),[b,d._x,d._ymax]},c.prototype.generatePaths=function(){var a,c,d,e;return this.paths=function(){var f,g,h,j;for(j=[],c=f=0,g=this.options.ykeys.length;g>=0?g>f:f>g;c=g>=0?++f:--f)e="boolean"==typeof this.options.smooth?this.options.smooth:(h=this.options.ykeys[c],i.call(this.options.smooth,h)>=0),a=function(){var a,b,e,f;for(e=this.data,f=[],a=0,b=e.length;b>a;a++)d=e[a],void 0!==d._y[c]&&f.push({x:d._x,y:d._y[c]});return f}.call(this),a.length>1?j.push(b.Line.createPath(a,e,this.bottom)):j.push(null);return j}.call(this)},c.prototype.draw=function(){var a;return((a=this.options.axes)===!0||"both"===a||"x"===a)&&this.drawXAxis(),this.drawSeries(),this.options.hideHover===!1?this.displayHoverForRow(this.data.length-1):void 0},c.prototype.drawXAxis=function(){var a,c,d,e,f,g,h,i,j,k,l=this;for(h=this.bottom+this.options.padding/2,f=null,e=null,a=function(a,b){var c,d,g,i,j;return c=l.drawXAxisLabel(l.transX(b),h,a),j=c.getBBox(),c.transform("r"+-l.options.xLabelAngle),d=c.getBBox(),c.transform("t0,"+d.height/2+"..."),0!==l.options.xLabelAngle&&(i=-.5*j.width*Math.cos(l.options.xLabelAngle*Math.PI/180),c.transform("t"+i+",0...")),d=c.getBBox(),(null==f||f>=d.x+d.width||null!=e&&e>=d.x)&&d.x>=0&&d.x+d.width<l.el.width()?(0!==l.options.xLabelAngle&&(g=1.25*l.options.gridTextSize/Math.sin(l.options.xLabelAngle*Math.PI/180),e=d.x-g),f=d.x-l.options.xLabelMargin):c.remove()},d=this.options.parseTime?1===this.data.length&&"auto"===this.options.xLabels?[[this.data[0].label,this.data[0].x]]:b.labelSeries(this.xmin,this.xmax,this.width,this.options.xLabels,this.options.xLabelFormat):function(){var a,b,c,d;for(c=this.data,d=[],a=0,b=c.length;b>a;a++)g=c[a],d.push([g.label,g.x]);return d}.call(this),d.reverse(),k=[],i=0,j=d.length;j>i;i++)c=d[i],k.push(a(c[0],c[1]));return k},c.prototype.drawSeries=function(){var a,b,c,d,e,f;for(this.seriesPoints=[],a=b=d=this.options.ykeys.length-1;0>=d?0>=b:b>=0;a=0>=d?++b:--b)this._drawLineFor(a);for(f=[],a=c=e=this.options.ykeys.length-1;0>=e?0>=c:c>=0;a=0>=e?++c:--c)f.push(this._drawPointFor(a));return f},c.prototype._drawPointFor=function(a){var b,c,d,e,f,g;for(this.seriesPoints[a]=[],f=this.data,g=[],d=0,e=f.length;e>d;d++)c=f[d],b=null,null!=c._y[a]&&(b=this.drawLinePoint(c._x,c._y[a],this.colorFor(c,a,"point"),a)),g.push(this.seriesPoints[a].push(b));return g},c.prototype._drawLineFor=function(a){var b;return b=this.paths[a],null!==b?this.drawLinePath(b,this.colorFor(null,a,"line"),a):void 0},c.createPath=function(a,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r;for(k="",c&&(g=b.Line.gradients(a)),l={y:null},h=q=0,r=a.length;r>q;h=++q)e=a[h],null!=e.y&&(null!=l.y?c?(f=g[h],j=g[h-1],i=(e.x-l.x)/4,m=l.x+i,o=Math.min(d,l.y+i*j),n=e.x-i,p=Math.min(d,e.y-i*f),k+="C"+m+","+o+","+n+","+p+","+e.x+","+e.y):k+="L"+e.x+","+e.y:c&&null==g[h]||(k+="M"+e.x+","+e.y)),l=e;return k},c.gradients=function(a){var b,c,d,e,f,g,h,i;for(c=function(a,b){return(a.y-b.y)/(a.x-b.x)},i=[],d=g=0,h=a.length;h>g;d=++g)b=a[d],null!=b.y?(e=a[d+1]||{y:null},f=a[d-1]||{y:null},null!=f.y&&null!=e.y?i.push(c(f,e)):null!=f.y?i.push(c(f,b)):null!=e.y?i.push(c(b,e)):i.push(null)):i.push(null);return i},c.prototype.hilight=function(a){var b,c,d,e,f;if(null!==this.prevHilight&&this.prevHilight!==a)for(b=c=0,e=this.seriesPoints.length-1;e>=0?e>=c:c>=e;b=e>=0?++c:--c)this.seriesPoints[b][this.prevHilight]&&this.seriesPoints[b][this.prevHilight].animate(this.pointShrinkSeries(b));if(null!==a&&this.prevHilight!==a)for(b=d=0,f=this.seriesPoints.length-1;f>=0?f>=d:d>=f;b=f>=0?++d:--d)this.seriesPoints[b][a]&&this.seriesPoints[b][a].animate(this.pointGrowSeries(b));return this.prevHilight=a},c.prototype.colorFor=function(a,b,c){return"function"==typeof this.options.lineColors?this.options.lineColors.call(this,a,b,c):"point"===c?this.options.pointFillColors[b%this.options.pointFillColors.length]||this.options.lineColors[b%this.options.lineColors.length]:this.options.lineColors[b%this.options.lineColors.length]},c.prototype.drawXAxisLabel=function(a,b,c){return this.raphael.text(a,b,c).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor)},c.prototype.drawLinePath=function(a,b,c){return this.raphael.path(a).attr("stroke",b).attr("stroke-width",this.lineWidthForSeries(c))},c.prototype.drawLinePoint=function(a,b,c,d){return this.raphael.circle(a,b,this.pointSizeForSeries(d)).attr("fill",c).attr("stroke-width",this.pointStrokeWidthForSeries(d)).attr("stroke",this.pointStrokeColorForSeries(d))},c.prototype.pointStrokeWidthForSeries=function(a){return this.options.pointStrokeWidths[a%this.options.pointStrokeWidths.length]},c.prototype.pointStrokeColorForSeries=function(a){return this.options.pointStrokeColors[a%this.options.pointStrokeColors.length]},c.prototype.lineWidthForSeries=function(a){return this.options.lineWidth instanceof Array?this.options.lineWidth[a%this.options.lineWidth.length]:this.options.lineWidth},c.prototype.pointSizeForSeries=function(a){return this.options.pointSize instanceof Array?this.options.pointSize[a%this.options.pointSize.length]:this.options.pointSize},c.prototype.pointGrowSeries=function(a){return Raphael.animation({r:this.pointSizeForSeries(a)+3},25,"linear")},c.prototype.pointShrinkSeries=function(a){return Raphael.animation({r:this.pointSizeForSeries(a)},25,"linear")},c}(b.Grid),b.labelSeries=function(c,d,e,f,g){var h,i,j,k,l,m,n,o,p,q,r;if(j=200*(d-c)/e,i=new Date(c),n=b.LABEL_SPECS[f],void 0===n)for(r=b.AUTO_LABEL_ORDER,p=0,q=r.length;q>p;p++)if(k=r[p],m=b.LABEL_SPECS[k],j>=m.span){n=m;break}for(void 0===n&&(n=b.LABEL_SPECS.second),g&&(n=a.extend({},n,{fmt:g})),h=n.start(i),l=[];(o=h.getTime())<=d;)o>=c&&l.push([n.fmt(h),o]),n.incr(h);return l},c=function(a){return{span:60*a*1e3,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours())},fmt:function(a){return""+b.pad2(a.getHours())+":"+b.pad2(a.getMinutes())},incr:function(b){return b.setUTCMinutes(b.getUTCMinutes()+a)}}},d=function(a){return{span:1e3*a,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes())},fmt:function(a){return""+b.pad2(a.getHours())+":"+b.pad2(a.getMinutes())+":"+b.pad2(a.getSeconds())},incr:function(b){return b.setUTCSeconds(b.getUTCSeconds()+a)}}},b.LABEL_SPECS={decade:{span:1728e8,start:function(a){return new Date(a.getFullYear()-a.getFullYear()%10,0,1)},fmt:function(a){return""+a.getFullYear()},incr:function(a){return a.setFullYear(a.getFullYear()+10)}},year:{span:1728e7,start:function(a){return new Date(a.getFullYear(),0,1)},fmt:function(a){return""+a.getFullYear()},incr:function(a){return a.setFullYear(a.getFullYear()+1)}},month:{span:24192e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),1)},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)},incr:function(a){return a.setMonth(a.getMonth()+1)}},week:{span:6048e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)+"-"+b.pad2(a.getDate())},incr:function(a){return a.setDate(a.getDate()+7)}},day:{span:864e5,start:function(a){return new Date(a.getFullYear(),a.getMonth(),a.getDate())},fmt:function(a){return""+a.getFullYear()+"-"+b.pad2(a.getMonth()+1)+"-"+b.pad2(a.getDate())},incr:function(a){return a.setDate(a.getDate()+1)}},hour:c(60),"30min":c(30),"15min":c(15),"10min":c(10),"5min":c(5),minute:c(1),"30sec":d(30),"15sec":d(15),"10sec":d(10),"5sec":d(5),second:d(1)},b.AUTO_LABEL_ORDER=["decade","year","month","week","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],b.Area=function(c){function d(c){var f;return this instanceof b.Area?(f=a.extend({},e,c),this.cumulative=!f.behaveLikeLine,"auto"===f.fillOpacity&&(f.fillOpacity=f.behaveLikeLine?.8:1),d.__super__.constructor.call(this,f),void 0):new b.Area(c)}var e;return h(d,c),e={fillOpacity:"auto",behaveLikeLine:!1},d.prototype.calcPoints=function(){var a,b,c,d,e,f,g;for(f=this.data,g=[],d=0,e=f.length;e>d;d++)a=f[d],a._x=this.transX(a.x),b=0,a._y=function(){var d,e,f,g;for(f=a.y,g=[],d=0,e=f.length;e>d;d++)c=f[d],this.options.behaveLikeLine?g.push(this.transY(c)):(b+=c||0,g.push(this.transY(b)));return g}.call(this),g.push(a._ymax=Math.max.apply(Math,a._y));return g},d.prototype.drawSeries=function(){var a,b,c,d,e,f,g,h;for(this.seriesPoints=[],b=this.options.behaveLikeLine?function(){f=[];for(var a=0,b=this.options.ykeys.length-1;b>=0?b>=a:a>=b;b>=0?a++:a--)f.push(a);return f}.apply(this):function(){g=[];for(var a=e=this.options.ykeys.length-1;0>=e?0>=a:a>=0;0>=e?a++:a--)g.push(a);return g}.apply(this),h=[],c=0,d=b.length;d>c;c++)a=b[c],this._drawFillFor(a),this._drawLineFor(a),h.push(this._drawPointFor(a));return h},d.prototype._drawFillFor=function(a){var b;return b=this.paths[a],null!==b?(b+="L"+this.transX(this.xmax)+","+this.bottom+"L"+this.transX(this.xmin)+","+this.bottom+"Z",this.drawFilledPath(b,this.fillForSeries(a))):void 0},d.prototype.fillForSeries=function(a){var b;return b=Raphael.rgb2hsl(this.colorFor(this.data[a],a,"line")),Raphael.hsl(b.h,this.options.behaveLikeLine?.9*b.s:.75*b.s,Math.min(.98,this.options.behaveLikeLine?1.2*b.l:1.25*b.l))},d.prototype.drawFilledPath=function(a,b){return this.raphael.path(a).attr("fill",b).attr("fill-opacity",this.options.fillOpacity).attr("stroke","none")},d}(b.Line),b.Bar=function(c){function d(c){return this.onHoverOut=f(this.onHoverOut,this),this.onHoverMove=f(this.onHoverMove,this),this.onGridClick=f(this.onGridClick,this),this instanceof b.Bar?(d.__super__.constructor.call(this,a.extend({},c,{parseTime:!1})),void 0):new b.Bar(c)}return h(d,c),d.prototype.init=function(){return this.cumulative=this.options.stacked,"always"!==this.options.hideHover?(this.hover=new b.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut),this.on("gridclick",this.onGridClick)):void 0},d.prototype.defaults={barSizeRatio:.75,barGap:3,barColors:["#0b62a4","#7a92a3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],barOpacity:1,barRadius:[0,0,0,0],xLabelMargin:50},d.prototype.calc=function(){var a;return this.calcBars(),this.options.hideHover===!1?(a=this.hover).update.apply(a,this.hoverContentForRow(this.data.length-1)):void 0},d.prototype.calcBars=function(){var a,b,c,d,e,f,g;for(f=this.data,g=[],a=d=0,e=f.length;e>d;a=++d)b=f[a],b._x=this.left+this.width*(a+.5)/this.data.length,g.push(b._y=function(){var a,d,e,f;for(e=b.y,f=[],a=0,d=e.length;d>a;a++)c=e[a],null!=c?f.push(this.transY(c)):f.push(null);return f}.call(this));return g},d.prototype.draw=function(){var a;return((a=this.options.axes)===!0||"both"===a||"x"===a)&&this.drawXAxis(),this.drawSeries()},d.prototype.drawXAxis=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m;for(j=this.bottom+(this.options.xAxisLabelTopPadding||this.options.padding/2),g=null,f=null,m=[],a=k=0,l=this.data.length;l>=0?l>k:k>l;a=l>=0?++k:--k)h=this.data[this.data.length-1-a],b=this.drawXAxisLabel(h._x,j,h.label),i=b.getBBox(),b.transform("r"+-this.options.xLabelAngle),c=b.getBBox(),b.transform("t0,"+c.height/2+"..."),0!==this.options.xLabelAngle&&(e=-.5*i.width*Math.cos(this.options.xLabelAngle*Math.PI/180),b.transform("t"+e+",0...")),(null==g||g>=c.x+c.width||null!=f&&f>=c.x)&&c.x>=0&&c.x+c.width<this.el.width()?(0!==this.options.xLabelAngle&&(d=1.25*this.options.gridTextSize/Math.sin(this.options.xLabelAngle*Math.PI/180),f=c.x-d),m.push(g=c.x-this.options.xLabelMargin)):m.push(b.remove());return m},d.prototype.drawSeries=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;return c=this.width/this.options.data.length,h=this.options.stacked?1:this.options.ykeys.length,a=(c*this.options.barSizeRatio-this.options.barGap*(h-1))/h,this.options.barSize&&(a=Math.min(a,this.options.barSize)),l=c-a*h-this.options.barGap*(h-1),g=l/2,o=this.ymin<=0&&this.ymax>=0?this.transY(0):null,this.bars=function(){var h,l,p,q;for(p=this.data,q=[],d=h=0,l=p.length;l>h;d=++h)i=p[d],e=0,q.push(function(){var h,l,p,q;for(p=i._y,q=[],j=h=0,l=p.length;l>h;j=++h)n=p[j],null!==n?(o?(m=Math.min(n,o),b=Math.max(n,o)):(m=n,b=this.bottom),f=this.left+d*c+g,this.options.stacked||(f+=j*(a+this.options.barGap)),k=b-m,this.options.verticalGridCondition&&this.options.verticalGridCondition(i.x)&&this.drawBar(this.left+d*c,this.top,c,Math.abs(this.top-this.bottom),this.options.verticalGridColor,this.options.verticalGridOpacity,this.options.barRadius),this.options.stacked&&(m-=e),this.drawBar(f,m,a,k,this.colorFor(i,j,"bar"),this.options.barOpacity,this.options.barRadius),q.push(e+=k)):q.push(null);return q}.call(this));return q}.call(this)},d.prototype.colorFor=function(a,b,c){var d,e;return"function"==typeof this.options.barColors?(d={x:a.x,y:a.y[b],label:a.label},e={index:b,key:this.options.ykeys[b],label:this.options.labels[b]},this.options.barColors.call(this,d,e,c)):this.options.barColors[b%this.options.barColors.length]},d.prototype.hitTest=function(a){return 0===this.data.length?null:(a=Math.max(Math.min(a,this.right),this.left),Math.min(this.data.length-1,Math.floor((a-this.left)/(this.width/this.data.length))))},d.prototype.onGridClick=function(a,b){var c;return c=this.hitTest(a),this.fire("click",c,this.data[c].src,a,b)},d.prototype.onHoverMove=function(a){var b,c;return b=this.hitTest(a),(c=this.hover).update.apply(c,this.hoverContentForRow(b))},d.prototype.onHoverOut=function(){return this.options.hideHover!==!1?this.hover.hide():void 0},d.prototype.hoverContentForRow=function(a){var b,c,d,e,f,g,h,i;for(d=this.data[a],b="<div class='morris-hover-row-label'>"+d.label+"</div>",i=d.y,c=g=0,h=i.length;h>g;c=++g)f=i[c],b+="<div class='morris-hover-point' style='color: "+this.colorFor(d,c,"label")+"'>\n "+this.options.labels[c]+":\n "+this.yLabelFormat(f)+"\n</div>";return"function"==typeof this.options.hoverCallback&&(b=this.options.hoverCallback(a,this.options,b,d.src)),e=this.left+(a+.5)*this.width/this.data.length,[b,e]},d.prototype.drawXAxisLabel=function(a,b,c){var d;return d=this.raphael.text(a,b,c).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor)},d.prototype.drawBar=function(a,b,c,d,e,f,g){var h,i;return h=Math.max.apply(Math,g),i=0===h||h>d?this.raphael.rect(a,b,c,d):this.raphael.path(this.roundedRect(a,b,c,d,g)),i.attr("fill",e).attr("fill-opacity",f).attr("stroke","none")},d.prototype.roundedRect=function(a,b,c,d,e){return null==e&&(e=[0,0,0,0]),["M",a,e[0]+b,"Q",a,b,a+e[0],b,"L",a+c-e[1],b,"Q",a+c,b,a+c,b+e[1],"L",a+c,b+d-e[2],"Q",a+c,b+d,a+c-e[2],b+d,"L",a+e[3],b+d,"Q",a,b+d,a,b+d-e[3],"Z"]},d}(b.Grid),b.Donut=function(c){function d(c){this.resizeHandler=f(this.resizeHandler,this),this.select=f(this.select,this),this.click=f(this.click,this);var d=this;if(!(this instanceof b.Donut))return new b.Donut(c);if(this.options=a.extend({},this.defaults,c),this.el="string"==typeof c.element?a(document.getElementById(c.element)):a(c.element),null===this.el||0===this.el.length)throw new Error("Graph placeholder not found.");void 0!==c.data&&0!==c.data.length&&(this.raphael=new Raphael(this.el[0]),this.options.resize&&a(window).bind("resize",function(){return null!=d.timeoutId&&window.clearTimeout(d.timeoutId),d.timeoutId=window.setTimeout(d.resizeHandler,100)}),this.setData(c.data))}return h(d,c),d.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],backgroundColor:"#FFFFFF",labelColor:"#000000",formatter:b.commas,resize:!1},d.prototype.redraw=function(){var a,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;for(this.raphael.clear(),c=this.el.width()/2,d=this.el.height()/2,n=(Math.min(c,d)-10)/3,l=0,u=this.values,o=0,r=u.length;r>o;o++)m=u[o],l+=m;for(i=5/(2*n),a=1.9999*Math.PI-i*this.data.length,g=0,f=0,this.segments=[],v=this.values,e=p=0,s=v.length;s>p;e=++p)m=v[e],j=g+i+a*(m/l),k=new b.DonutSegment(c,d,2*n,n,g,j,this.data[e].color||this.options.colors[f%this.options.colors.length],this.options.backgroundColor,f,this.raphael),k.render(),this.segments.push(k),k.on("hover",this.select),k.on("click",this.click),g=j,f+=1;for(this.text1=this.drawEmptyDonutLabel(c,d-10,this.options.labelColor,15,800),this.text2=this.drawEmptyDonutLabel(c,d+10,this.options.labelColor,14),h=Math.max.apply(Math,this.values),f=0,w=this.values,x=[],q=0,t=w.length;t>q;q++){if(m=w[q],m===h){this.select(f);
7
- break}x.push(f+=1)}return x},d.prototype.setData=function(a){var b;return this.data=a,this.values=function(){var a,c,d,e;for(d=this.data,e=[],a=0,c=d.length;c>a;a++)b=d[a],e.push(parseFloat(b.value));return e}.call(this),this.redraw()},d.prototype.click=function(a){return this.fire("click",a,this.data[a])},d.prototype.select=function(a){var b,c,d,e,f,g;for(g=this.segments,e=0,f=g.length;f>e;e++)c=g[e],c.deselect();return d=this.segments[a],d.select(),b=this.data[a],this.setLabels(b.label,this.options.formatter(b.value,b))},d.prototype.setLabels=function(a,b){var c,d,e,f,g,h,i,j;return c=2*(Math.min(this.el.width()/2,this.el.height()/2)-10)/3,f=1.8*c,e=c/2,d=c/3,this.text1.attr({text:a,transform:""}),g=this.text1.getBBox(),h=Math.min(f/g.width,e/g.height),this.text1.attr({transform:"S"+h+","+h+","+(g.x+g.width/2)+","+(g.y+g.height)}),this.text2.attr({text:b,transform:""}),i=this.text2.getBBox(),j=Math.min(f/i.width,d/i.height),this.text2.attr({transform:"S"+j+","+j+","+(i.x+i.width/2)+","+i.y})},d.prototype.drawEmptyDonutLabel=function(a,b,c,d,e){var f;return f=this.raphael.text(a,b,"").attr("font-size",d).attr("fill",c),null!=e&&f.attr("font-weight",e),f},d.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},d}(b.EventEmitter),b.DonutSegment=function(a){function b(a,b,c,d,e,g,h,i,j,k){this.cx=a,this.cy=b,this.inner=c,this.outer=d,this.color=h,this.backgroundColor=i,this.index=j,this.raphael=k,this.deselect=f(this.deselect,this),this.select=f(this.select,this),this.sin_p0=Math.sin(e),this.cos_p0=Math.cos(e),this.sin_p1=Math.sin(g),this.cos_p1=Math.cos(g),this.is_long=g-e>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(b,a),b.prototype.calcArcPoints=function(a){return[this.cx+a*this.sin_p0,this.cy+a*this.cos_p0,this.cx+a*this.sin_p1,this.cy+a*this.cos_p1]},b.prototype.calcSegment=function(a,b){var c,d,e,f,g,h,i,j,k,l;return k=this.calcArcPoints(a),c=k[0],e=k[1],d=k[2],f=k[3],l=this.calcArcPoints(b),g=l[0],i=l[1],h=l[2],j=l[3],"M"+c+","+e+("A"+a+","+a+",0,"+this.is_long+",0,"+d+","+f)+("L"+h+","+j)+("A"+b+","+b+",0,"+this.is_long+",1,"+g+","+i)+"Z"},b.prototype.calcArc=function(a){var b,c,d,e,f;return f=this.calcArcPoints(a),b=f[0],d=f[1],c=f[2],e=f[3],"M"+b+","+d+("A"+a+","+a+",0,"+this.is_long+",0,"+c+","+e)},b.prototype.render=function(){var a=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return a.fire("hover",a.index)},function(){return a.fire("click",a.index)})},b.prototype.drawDonutArc=function(a,b){return this.raphael.path(a).attr({stroke:b,"stroke-width":2,opacity:0})},b.prototype.drawDonutSegment=function(a,b,c,d,e){return this.raphael.path(a).attr({fill:b,stroke:c,"stroke-width":3}).hover(d).click(e)},b.prototype.select=function(){return this.selected?void 0:(this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0)},b.prototype.deselect=function(){return this.selected?(this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1):void 0},b}(b.EventEmitter)}).call(this);
1
+ (function(){var t,i,e,n,o=[].slice,s=function(t,i){return function(){return t.apply(i,arguments)}},r={}.hasOwnProperty,h=function(t,i){for(var e in i)r.call(i,e)&&(t[e]=i[e]);function n(){this.constructor=t}return n.prototype=i.prototype,t.prototype=new n,t.__super__=i.prototype,t},a=[].indexOf||function(t){for(var i=0,e=this.length;i<e;i++)if(i in this&&this[i]===t)return i;return-1};i=window.Morris={},t=jQuery,i.EventEmitter=function(){function t(){}return t.prototype.on=function(t,i){return null==this.handlers&&(this.handlers={}),null==this.handlers[t]&&(this.handlers[t]=[]),this.handlers[t].push(i),this},t.prototype.fire=function(){var t,i,e,n,s,r,h;if(e=arguments[0],t=2<=arguments.length?o.call(arguments,1):[],null!=this.handlers&&null!=this.handlers[e]){for(h=[],n=0,s=(r=this.handlers[e]).length;n<s;n++)i=r[n],h.push(i.apply(null,t));return h}},t}(),i.commas=function(t){var i,e,n,o;return null!=t?(n=t<0?"-":"",i=Math.abs(t),n+=(e=Math.floor(i).toFixed(0)).replace(/(?=(?:\d{3})+$)(?!^)/g,","),(o=i.toString()).length>e.length&&(n+=o.slice(e.length)),n):"-"},i.pad2=function(t){return(t<10?"0":"")+t},i.Grid=function(e){function n(i){this.resizeHandler=s(this.resizeHandler,this);var e=this;if("string"==typeof i.element?this.el=t(document.getElementById(i.element)):this.el=t(i.element),null==this.el||0===this.el.length)throw new Error("Graph container element not found");"static"===this.el.css("position")&&this.el.css("position","relative"),this.options=t.extend({},this.gridDefaults,this.defaults||{},i),"string"==typeof this.options.units&&(this.options.postUnits=i.units),this.raphael=new Raphael(this.el[0]),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.selectFrom=null,this.init&&this.init(),this.setData(this.options.data),this.el.bind("mousemove",function(t){var i,n,o,s;return n=e.el.offset(),s=t.pageX-n.left,e.selectFrom?(i=e.data[e.hitTest(Math.min(s,e.selectFrom))]._x,o=e.data[e.hitTest(Math.max(s,e.selectFrom))]._x-i,e.selectionRect.attr({x:i,width:o})):e.fire("hovermove",s,t.pageY-n.top)}),this.el.bind("mouseleave",function(t){return e.selectFrom&&(e.selectionRect.hide(),e.selectFrom=null),e.fire("hoverout")}),this.el.bind("touchstart touchmove touchend",function(t){var i,n;return n=t.originalEvent.touches[0]||t.originalEvent.changedTouches[0],i=e.el.offset(),e.fire("hover",n.pageX-i.left,n.pageY-i.top),n}),this.el.bind("click",function(t){var i;return i=e.el.offset(),e.fire("gridclick",t.pageX-i.left,t.pageY-i.top)}),this.options.rangeSelect&&(this.selectionRect=this.raphael.rect(0,0,0,this.el.innerHeight()).attr({fill:this.options.rangeSelectColor,stroke:!1}).toBack().hide(),this.el.bind("mousedown",function(t){var i;return i=e.el.offset(),e.startRange(t.pageX-i.left)}),this.el.bind("mouseup",function(t){var i;return i=e.el.offset(),e.endRange(t.pageX-i.left),e.fire("hovermove",t.pageX-i.left,t.pageY-i.top)})),this.options.resize&&t(window).bind("resize",function(t){return null!=e.timeoutId&&window.clearTimeout(e.timeoutId),e.timeoutId=window.setTimeout(e.resizeHandler,100)}),this.postInit&&this.postInit()}return h(n,e),n.prototype.gridDefaults={dateFormat:null,axes:!0,grid:!0,gridLineColor:"#aaa",gridStrokeWidth:.5,gridTextColor:"#888",gridTextSize:12,gridTextFamily:"sans-serif",gridTextWeight:"normal",gridIntegers:!1,hideHover:!1,yLabelFormat:null,xLabelAngle:0,numLines:5,padding:25,parseTime:!0,postUnits:"",preUnits:"",ymax:"auto",ymin:"auto 0",goals:[],goalStrokeWidth:1,goalLineColors:["#666633","#999966","#cc6666","#663333"],events:[],eventStrokeWidth:1,eventLineColors:["#005a04","#ccffbb","#3a5f0b","#005502"],rangeSelect:null,rangeSelectColor:"#eef",resize:!1},n.prototype.setData=function(t,e){var n,o,s,r,h,a,l,p,u,c,d,f,g,m,y;return null==e&&(e=!0),this.options.data=t,null==t||0===t.length?(this.data=[],this.raphael.clear(),void(null!=this.hover&&this.hover.hide())):(f=this.cumulative?0:null,g=this.cumulative?0:null,this.options.goals.length>0&&(h=Math.min.apply(Math,this.options.goals),r=Math.max.apply(Math,this.options.goals),g=null!=g?Math.min(g,h):h,f=null!=f?Math.max(f,r):r),this.data=function(){var e,n,r;for(r=[],s=e=0,n=t.length;e<n;s=++e)l=t[s],(a={src:l}).label=l[this.options.xkey],this.options.parseTime?(a.x=i.parseDate(a.label),this.options.dateFormat?a.label=this.options.dateFormat(a.x):"number"==typeof a.label&&(a.label=new Date(a.label).toString())):(a.x=s,this.options.xLabelFormat&&(a.label=this.options.xLabelFormat(a))),u=0,a.y=function(){var t,i,e,n;for(e=this.options.ykeys,n=[],o=t=0,i=e.length;t<i;o=++t)d=e[o],"string"==typeof(m=l[d])&&(m=parseFloat(m)),null!=m&&"number"!=typeof m&&(m=null),null!=m&&(this.cumulative?u+=m:null!=f?(f=Math.max(m,f),g=Math.min(m,g)):f=g=m),this.cumulative&&null!=u&&(f=Math.max(u,f),g=Math.min(u,g)),n.push(m);return n}.call(this),r.push(a);return r}.call(this),this.options.parseTime&&(this.data=this.data.sort(function(t,i){return(t.x>i.x)-(i.x>t.x)})),this.xmin=this.data[0].x,this.xmax=this.data[this.data.length-1].x,this.events=[],this.options.events.length>0&&(this.options.parseTime?this.events=function(){var t,e,o,s;for(s=[],t=0,e=(o=this.options.events).length;t<e;t++)n=o[t],s.push(i.parseDate(n));return s}.call(this):this.events=this.options.events,this.xmax=Math.max(this.xmax,Math.max.apply(Math,this.events)),this.xmin=Math.min(this.xmin,Math.min.apply(Math,this.events))),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),this.ymin=this.yboundary("min",g),this.ymax=this.yboundary("max",f),this.ymin===this.ymax&&(g&&(this.ymin-=1),this.ymax+=1),!0!==(y=this.options.axes)&&"both"!==y&&"y"!==y&&!0!==this.options.grid||(this.options.ymax===this.gridDefaults.ymax&&this.options.ymin===this.gridDefaults.ymin?(this.grid=this.autoGridLines(this.ymin,this.ymax,this.options.numLines),this.ymin=Math.min(this.ymin,this.grid[0]),this.ymax=Math.max(this.ymax,this.grid[this.grid.length-1])):(p=(this.ymax-this.ymin)/(this.options.numLines-1),this.options.gridIntegers&&(p=Math.max(1,Math.round(p))),this.grid=function(){var t,i,e;for(e=[],c=t=this.ymin,i=this.ymax;p>0?t<=i:t>=i;c=t+=p)e.push(c);return e}.call(this))),this.dirty=!0,e?this.redraw():void 0)},n.prototype.yboundary=function(t,i){var e,n;return"string"==typeof(e=this.options["y"+t])?"auto"===e.slice(0,4)?e.length>5?(n=parseInt(e.slice(5),10),null==i?n:Math[t](i,n)):null!=i?i:0:parseInt(e,10):e},n.prototype.autoGridLines=function(t,i,e){var n,o,s,r,h,a,l,p,u;return h=i-t,u=Math.floor(Math.log(h)/Math.log(10)),l=Math.pow(10,u),o=Math.floor(t/l)*l,n=Math.ceil(i/l)*l,a=(n-o)/(e-1),1===l&&a>1&&Math.ceil(a)!==a&&(a=Math.ceil(a),n=o+a*(e-1)),o<0&&n>0&&(o=Math.floor(t/a)*a,n=Math.ceil(i/a)*a),a<1?(r=Math.floor(Math.log(a)/Math.log(10)),s=function(){var t,i;for(i=[],p=t=o;a>0?t<=n:t>=n;p=t+=a)i.push(parseFloat(p.toFixed(1-r)));return i}()):s=function(){var t,i;for(i=[],p=t=o;a>0?t<=n:t>=n;p=t+=a)i.push(p);return i}(),s},n.prototype._calc=function(){var t,i,e,n,o,s,r,h;if(o=this.el.width(),e=this.el.height(),(this.elementWidth!==o||this.elementHeight!==e||this.dirty)&&(this.elementWidth=o,this.elementHeight=e,this.dirty=!1,this.left=this.options.padding,this.right=this.elementWidth-this.options.padding,this.top=this.options.padding,this.bottom=this.elementHeight-this.options.padding,!0!==(r=this.options.axes)&&"both"!==r&&"y"!==r||(s=function(){var t,e,n,o;for(o=[],t=0,e=(n=this.grid).length;t<e;t++)i=n[t],o.push(this.measureText(this.yAxisFormat(i)).width);return o}.call(this),this.left+=Math.max.apply(Math,s)),!0!==(h=this.options.axes)&&"both"!==h&&"x"!==h||(t=function(){var t,i,e;for(e=[],n=t=0,i=this.data.length;0<=i?t<i:t>i;n=0<=i?++t:--t)e.push(this.measureText(this.data[n].text,-this.options.xLabelAngle).height);return e}.call(this),this.bottom-=Math.max.apply(Math,t)),this.width=Math.max(1,this.right-this.left),this.height=Math.max(1,this.bottom-this.top),this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin),this.calc))return this.calc()},n.prototype.transY=function(t){return this.bottom-(t-this.ymin)*this.dy},n.prototype.transX=function(t){return 1===this.data.length?(this.left+this.right)/2:this.left+(t-this.xmin)*this.dx},n.prototype.redraw=function(){if(this.raphael.clear(),this._calc(),this.drawGrid(),this.drawGoals(),this.drawEvents(),this.draw)return this.draw()},n.prototype.measureText=function(t,i){var e,n;return null==i&&(i=0),e=(n=this.raphael.text(100,100,t).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).rotate(i)).getBBox(),n.remove(),e},n.prototype.yAxisFormat=function(t){return this.yLabelFormat(t)},n.prototype.yLabelFormat=function(t){return"function"==typeof this.options.yLabelFormat?this.options.yLabelFormat(t):""+this.options.preUnits+i.commas(t)+this.options.postUnits},n.prototype.drawGrid=function(){var t,i,e,n,o,s,r,h;if(!1!==this.options.grid||!0===(o=this.options.axes)||"both"===o||"y"===o){for(h=[],e=0,n=(s=this.grid).length;e<n;e++)t=s[e],i=this.transY(t),!0!==(r=this.options.axes)&&"both"!==r&&"y"!==r||this.drawYAxisLabel(this.left-this.options.padding/2,i,this.yAxisFormat(t)),this.options.grid?h.push(this.drawGridLine("M"+this.left+","+i+"H"+(this.left+this.width))):h.push(void 0);return h}},n.prototype.drawGoals=function(){var t,i,e,n,o,s,r;for(r=[],e=n=0,o=(s=this.options.goals).length;n<o;e=++n)i=s[e],t=this.options.goalLineColors[e%this.options.goalLineColors.length],r.push(this.drawGoal(i,t));return r},n.prototype.drawEvents=function(){var t,i,e,n,o,s,r;for(r=[],e=n=0,o=(s=this.events).length;n<o;e=++n)i=s[e],t=this.options.eventLineColors[e%this.options.eventLineColors.length],r.push(this.drawEvent(i,t));return r},n.prototype.drawGoal=function(t,i){return this.raphael.path("M"+this.left+","+this.transY(t)+"H"+this.right).attr("stroke",i).attr("stroke-width",this.options.goalStrokeWidth)},n.prototype.drawEvent=function(t,i){return this.raphael.path("M"+this.transX(t)+","+this.bottom+"V"+this.top).attr("stroke",i).attr("stroke-width",this.options.eventStrokeWidth)},n.prototype.drawYAxisLabel=function(t,i,e){return this.raphael.text(t,i,e).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor).attr("text-anchor","end")},n.prototype.drawGridLine=function(t){return this.raphael.path(t).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth)},n.prototype.startRange=function(t){return this.hover.hide(),this.selectFrom=t,this.selectionRect.attr({x:t,width:0}).show()},n.prototype.endRange=function(t){var i,e;if(this.selectFrom)return e=Math.min(this.selectFrom,t),i=Math.max(this.selectFrom,t),this.options.rangeSelect.call(this.el,{start:this.data[this.hitTest(e)].x,end:this.data[this.hitTest(i)].x}),this.selectFrom=null},n.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},n}(i.EventEmitter),i.parseDate=function(t){var i,e,n,o,s,r,h,a,l,p,u;return"number"==typeof t?t:(e=t.match(/^(\d+) Q(\d)$/),o=t.match(/^(\d+)-(\d+)$/),s=t.match(/^(\d+)-(\d+)-(\d+)$/),h=t.match(/^(\d+) W(\d+)$/),a=t.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),l=t.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),e?new Date(parseInt(e[1],10),3*parseInt(e[2],10)-1,1).getTime():o?new Date(parseInt(o[1],10),parseInt(o[2],10)-1,1).getTime():s?new Date(parseInt(s[1],10),parseInt(s[2],10)-1,parseInt(s[3],10)).getTime():h?(4!==(p=new Date(parseInt(h[1],10),0,1)).getDay()&&p.setMonth(0,1+(4-p.getDay()+7)%7),p.getTime()+6048e5*parseInt(h[2],10)):a?a[6]?(r=0,"Z"!==a[6]&&(r=60*parseInt(a[8],10)+parseInt(a[9],10),"+"===a[7]&&(r=0-r)),Date.UTC(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)+r)):new Date(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)).getTime():l?(u=parseFloat(l[6]),i=Math.floor(u),n=Math.round(1e3*(u-i)),l[8]?(r=0,"Z"!==l[8]&&(r=60*parseInt(l[10],10)+parseInt(l[11],10),"+"===l[9]&&(r=0-r)),Date.UTC(parseInt(l[1],10),parseInt(l[2],10)-1,parseInt(l[3],10),parseInt(l[4],10),parseInt(l[5],10)+r,i,n)):new Date(parseInt(l[1],10),parseInt(l[2],10)-1,parseInt(l[3],10),parseInt(l[4],10),parseInt(l[5],10),i,n).getTime()):new Date(parseInt(t,10),0,1).getTime())},i.Hover=function(){function e(e){null==e&&(e={}),this.options=t.extend({},i.Hover.defaults,e),this.el=t("<div class='"+this.options.class+"'></div>"),this.el.hide(),this.options.parent.append(this.el)}return e.defaults={class:"morris-hover morris-default-style"},e.prototype.update=function(t,i,e){return this.html(t),this.show(),this.moveTo(i,e)},e.prototype.html=function(t){return this.el.html(t)},e.prototype.moveTo=function(t,i){var e,n,o,s,r,h;return r=this.options.parent.innerWidth(),s=this.options.parent.innerHeight(),n=this.el.outerWidth(),e=this.el.outerHeight(),o=Math.min(Math.max(0,t-n/2),r-n),null!=i?(h=i-e-10)<0&&(h=i+10)+e>s&&(h=s/2-e/2):h=s/2-e/2,this.el.css({left:o+"px",top:parseInt(h)+"px"})},e.prototype.show=function(){return this.el.show()},e.prototype.hide=function(){return this.el.hide()},e}(),i.Line=function(t){function e(t){if(this.hilight=s(this.hilight,this),this.onHoverOut=s(this.onHoverOut,this),this.onHoverMove=s(this.onHoverMove,this),this.onGridClick=s(this.onGridClick,this),!(this instanceof i.Line))return new i.Line(t);e.__super__.constructor.call(this,t)}return h(e,t),e.prototype.init=function(){if("always"!==this.options.hideHover)return this.hover=new i.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut),this.on("gridclick",this.onGridClick)},e.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],pointStrokeWidths:[1],pointStrokeColors:["#ffffff"],pointFillColors:[],smooth:!0,xLabels:"auto",xLabelFormat:null,xLabelMargin:24,continuousLine:!0,hideHover:!1},e.prototype.calc=function(){return this.calcPoints(),this.generatePaths()},e.prototype.calcPoints=function(){var t,i,e,n,o,s;for(s=[],e=0,n=(o=this.data).length;e<n;e++)(t=o[e])._x=this.transX(t.x),t._y=function(){var e,n,o,s;for(s=[],e=0,n=(o=t.y).length;e<n;e++)null!=(i=o[e])?s.push(this.transY(i)):s.push(i);return s}.call(this),s.push(t._ymax=Math.min.apply(Math,[this.bottom].concat(function(){var e,n,o,s;for(s=[],e=0,n=(o=t._y).length;e<n;e++)null!=(i=o[e])&&s.push(i);return s}())));return s},e.prototype.hitTest=function(t){var i,e,n,o;if(0===this.data.length)return null;for(i=e=0,n=(o=this.data.slice(1)).length;e<n&&!(t<(o[i]._x+this.data[i]._x)/2);i=++e);return i},e.prototype.onGridClick=function(t,i){var e;return e=this.hitTest(t),this.fire("click",e,this.data[e].src,t,i)},e.prototype.onHoverMove=function(t,i){var e;return e=this.hitTest(t),this.displayHoverForRow(e)},e.prototype.onHoverOut=function(){if(!1!==this.options.hideHover)return this.displayHoverForRow(null)},e.prototype.displayHoverForRow=function(t){var i;return null!=t?((i=this.hover).update.apply(i,this.hoverContentForRow(t)),this.hilight(t)):(this.hover.hide(),this.hilight())},e.prototype.hoverContentForRow=function(t){var i,e,n,o,s,r,h;for(i="<div class='morris-hover-row-label'>"+(n=this.data[t]).label+"</div>",e=s=0,r=(h=n.y).length;s<r;e=++s)o=h[e],i+="<div class='morris-hover-point' style='color: "+this.colorFor(n,e,"label")+"'>\n "+this.options.labels[e]+":\n "+this.yLabelFormat(o)+"\n</div>";return"function"==typeof this.options.hoverCallback&&(i=this.options.hoverCallback(t,this.options,i,n.src)),[i,n._x,n._ymax]},e.prototype.generatePaths=function(){var t,e,n,o,s;return this.paths=function(){var r,h,l,p;for(p=[],n=r=0,h=this.options.ykeys.length;0<=h?r<h:r>h;n=0<=h?++r:--r)s="boolean"==typeof this.options.smooth?this.options.smooth:(l=this.options.ykeys[n],a.call(this.options.smooth,l)>=0),e=function(){var t,i,e,s;for(s=[],t=0,i=(e=this.data).length;t<i;t++)void 0!==(o=e[t])._y[n]&&s.push({x:o._x,y:o._y[n]});return s}.call(this),this.options.continuousLine&&(e=function(){var i,n,o;for(o=[],i=0,n=e.length;i<n;i++)null!==(t=e[i]).y&&o.push(t);return o}()),e.length>1?p.push(i.Line.createPath(e,s,this.bottom)):p.push(null);return p}.call(this)},e.prototype.draw=function(){var t;if(!0!==(t=this.options.axes)&&"both"!==t&&"x"!==t||this.drawXAxis(),this.drawSeries(),!1===this.options.hideHover)return this.displayHoverForRow(this.data.length-1)},e.prototype.drawXAxis=function(){var t,e,n,o,s,r,h,a,l,p,u=this;for(h=this.bottom+this.options.padding/2,s=null,o=null,t=function(t,i){var e,n,r,a,l;return l=(e=u.drawXAxisLabel(u.transX(i),h,t)).getBBox(),e.transform("r"+-u.options.xLabelAngle),n=e.getBBox(),e.transform("t0,"+n.height/2+"..."),0!==u.options.xLabelAngle&&(a=-.5*l.width*Math.cos(u.options.xLabelAngle*Math.PI/180),e.transform("t"+a+",0...")),n=e.getBBox(),(null==s||s>=n.x+n.width||null!=o&&o>=n.x)&&n.x>=0&&n.x+n.width<u.el.width()?(0!==u.options.xLabelAngle&&(r=1.25*u.options.gridTextSize/Math.sin(u.options.xLabelAngle*Math.PI/180),o=n.x-r),s=n.x-u.options.xLabelMargin):e.remove()},(n=this.options.parseTime?1===this.data.length&&"auto"===this.options.xLabels?[[this.data[0].label,this.data[0].x]]:i.labelSeries(this.xmin,this.xmax,this.width,this.options.xLabels,this.options.xLabelFormat):function(){var t,i,e,n;for(n=[],t=0,i=(e=this.data).length;t<i;t++)r=e[t],n.push([r.label,r.x]);return n}.call(this)).reverse(),p=[],a=0,l=n.length;a<l;a++)e=n[a],p.push(t(e[0],e[1]));return p},e.prototype.drawSeries=function(){var t,i,e,n,o,s;for(this.seriesPoints=[],t=i=n=this.options.ykeys.length-1;n<=0?i<=0:i>=0;t=n<=0?++i:--i)this._drawLineFor(t);for(s=[],t=e=o=this.options.ykeys.length-1;o<=0?e<=0:e>=0;t=o<=0?++e:--e)s.push(this._drawPointFor(t));return s},e.prototype._drawPointFor=function(t){var i,e,n,o,s,r;for(this.seriesPoints[t]=[],r=[],n=0,o=(s=this.data).length;n<o;n++)i=null,null!=(e=s[n])._y[t]&&(i=this.drawLinePoint(e._x,e._y[t],this.colorFor(e,t,"point"),t)),r.push(this.seriesPoints[t].push(i));return r},e.prototype._drawLineFor=function(t){var i;if(null!==(i=this.paths[t]))return this.drawLinePath(i,this.colorFor(null,t,"line"),t)},e.createPath=function(t,e,n){var o,s,r,h,a,l,p,u,c,d;for(p="",e&&(r=i.Line.gradients(t)),u={y:null},h=c=0,d=t.length;c<d;h=++c)null!=(o=t[h]).y&&(null!=u.y?e?(s=r[h],l=r[h-1],a=(o.x-u.x)/4,p+="C"+(u.x+a)+","+Math.min(n,u.y+a*l)+","+(o.x-a)+","+Math.min(n,o.y-a*s)+","+o.x+","+o.y):p+="L"+o.x+","+o.y:e&&null==r[h]||(p+="M"+o.x+","+o.y)),u=o;return p},e.gradients=function(t){var i,e,n,o,s,r,h,a;for(e=function(t,i){return(t.y-i.y)/(t.x-i.x)},a=[],n=r=0,h=t.length;r<h;n=++r)null!=(i=t[n]).y?(o=t[n+1]||{y:null},null!=(s=t[n-1]||{y:null}).y&&null!=o.y?a.push(e(s,o)):null!=s.y?a.push(e(s,i)):null!=o.y?a.push(e(i,o)):a.push(null)):a.push(null);return a},e.prototype.hilight=function(t){var i,e,n,o,s;if(null!==this.prevHilight&&this.prevHilight!==t)for(i=e=0,o=this.seriesPoints.length-1;0<=o?e<=o:e>=o;i=0<=o?++e:--e)this.seriesPoints[i][this.prevHilight]&&this.seriesPoints[i][this.prevHilight].animate(this.pointShrinkSeries(i));if(null!==t&&this.prevHilight!==t)for(i=n=0,s=this.seriesPoints.length-1;0<=s?n<=s:n>=s;i=0<=s?++n:--n)this.seriesPoints[i][t]&&this.seriesPoints[i][t].animate(this.pointGrowSeries(i));return this.prevHilight=t},e.prototype.colorFor=function(t,i,e){return"function"==typeof this.options.lineColors?this.options.lineColors.call(this,t,i,e):"point"===e&&this.options.pointFillColors[i%this.options.pointFillColors.length]||this.options.lineColors[i%this.options.lineColors.length]},e.prototype.drawXAxisLabel=function(t,i,e){return this.raphael.text(t,i,e).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor)},e.prototype.drawLinePath=function(t,i,e){return this.raphael.path(t).attr("stroke",i).attr("stroke-width",this.lineWidthForSeries(e))},e.prototype.drawLinePoint=function(t,i,e,n){return this.raphael.circle(t,i,this.pointSizeForSeries(n)).attr("fill",e).attr("stroke-width",this.pointStrokeWidthForSeries(n)).attr("stroke",this.pointStrokeColorForSeries(n))},e.prototype.pointStrokeWidthForSeries=function(t){return this.options.pointStrokeWidths[t%this.options.pointStrokeWidths.length]},e.prototype.pointStrokeColorForSeries=function(t){return this.options.pointStrokeColors[t%this.options.pointStrokeColors.length]},e.prototype.lineWidthForSeries=function(t){return this.options.lineWidth instanceof Array?this.options.lineWidth[t%this.options.lineWidth.length]:this.options.lineWidth},e.prototype.pointSizeForSeries=function(t){return this.options.pointSize instanceof Array?this.options.pointSize[t%this.options.pointSize.length]:this.options.pointSize},e.prototype.pointGrowSeries=function(t){return Raphael.animation({r:this.pointSizeForSeries(t)+3},25,"linear")},e.prototype.pointShrinkSeries=function(t){return Raphael.animation({r:this.pointSizeForSeries(t)},25,"linear")},e}(i.Grid),i.labelSeries=function(e,n,o,s,r){var h,a,l,p,u,c,d,f,g,m,y;if(l=200*(n-e)/o,a=new Date(e),void 0===(d=i.LABEL_SPECS[s]))for(g=0,m=(y=i.AUTO_LABEL_ORDER).length;g<m;g++)if(p=y[g],l>=(c=i.LABEL_SPECS[p]).span){d=c;break}for(void 0===d&&(d=i.LABEL_SPECS.second),r&&(d=t.extend({},d,{fmt:r})),h=d.start(a),u=[];(f=h.getTime())<=n;)f>=e&&u.push([d.fmt(h),f]),d.incr(h);return u},e=function(t){return{span:60*t*1e3,start:function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours())},fmt:function(t){return i.pad2(t.getHours())+":"+i.pad2(t.getMinutes())},incr:function(i){return i.setUTCMinutes(i.getUTCMinutes()+t)}}},n=function(t){return{span:1e3*t,start:function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes())},fmt:function(t){return i.pad2(t.getHours())+":"+i.pad2(t.getMinutes())+":"+i.pad2(t.getSeconds())},incr:function(i){return i.setUTCSeconds(i.getUTCSeconds()+t)}}},i.LABEL_SPECS={decade:{span:1728e8,start:function(t){return new Date(t.getFullYear()-t.getFullYear()%10,0,1)},fmt:function(t){return""+t.getFullYear()},incr:function(t){return t.setFullYear(t.getFullYear()+10)}},year:{span:1728e7,start:function(t){return new Date(t.getFullYear(),0,1)},fmt:function(t){return""+t.getFullYear()},incr:function(t){return t.setFullYear(t.getFullYear()+1)}},month:{span:24192e5,start:function(t){return new Date(t.getFullYear(),t.getMonth(),1)},fmt:function(t){return t.getFullYear()+"-"+i.pad2(t.getMonth()+1)},incr:function(t){return t.setMonth(t.getMonth()+1)}},week:{span:6048e5,start:function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())},fmt:function(t){return t.getFullYear()+"-"+i.pad2(t.getMonth()+1)+"-"+i.pad2(t.getDate())},incr:function(t){return t.setDate(t.getDate()+7)}},day:{span:864e5,start:function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())},fmt:function(t){return t.getFullYear()+"-"+i.pad2(t.getMonth()+1)+"-"+i.pad2(t.getDate())},incr:function(t){return t.setDate(t.getDate()+1)}},hour:e(60),"30min":e(30),"15min":e(15),"10min":e(10),"5min":e(5),minute:e(1),"30sec":n(30),"15sec":n(15),"10sec":n(10),"5sec":n(5),second:n(1)},i.AUTO_LABEL_ORDER=["decade","year","month","week","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],i.Area=function(e){var n;function o(e){var s;if(!(this instanceof i.Area))return new i.Area(e);s=t.extend({},n,e),this.cumulative=!s.behaveLikeLine,"auto"===s.fillOpacity&&(s.fillOpacity=s.behaveLikeLine?.8:1),o.__super__.constructor.call(this,s)}return h(o,e),n={fillOpacity:"auto",behaveLikeLine:!1},o.prototype.calcPoints=function(){var t,i,e,n,o,s,r;for(r=[],n=0,o=(s=this.data).length;n<o;n++)(t=s[n])._x=this.transX(t.x),i=0,t._y=function(){var n,o,s,r;for(r=[],n=0,o=(s=t.y).length;n<o;n++)e=s[n],this.options.behaveLikeLine?r.push(this.transY(e)):(i+=e||0,r.push(this.transY(i)));return r}.call(this),r.push(t._ymax=Math.max.apply(Math,t._y));return r},o.prototype.drawSeries=function(){var t,i,e,n,o,s,r,h;for(this.seriesPoints=[],h=[],e=0,n=(i=this.options.behaveLikeLine?function(){s=[];for(var t=0,i=this.options.ykeys.length-1;0<=i?t<=i:t>=i;0<=i?t++:t--)s.push(t);return s}.apply(this):function(){r=[];for(var t=o=this.options.ykeys.length-1;o<=0?t<=0:t>=0;o<=0?t++:t--)r.push(t);return r}.apply(this)).length;e<n;e++)t=i[e],this._drawFillFor(t),this._drawLineFor(t),h.push(this._drawPointFor(t));return h},o.prototype._drawFillFor=function(t){var i;if(null!==(i=this.paths[t]))return i=i+"L"+this.transX(this.xmax)+","+this.bottom+"L"+this.transX(this.xmin)+","+this.bottom+"Z",this.drawFilledPath(i,this.fillForSeries(t))},o.prototype.fillForSeries=function(t){var i;return i=Raphael.rgb2hsl(this.colorFor(this.data[t],t,"line")),Raphael.hsl(i.h,this.options.behaveLikeLine?.9*i.s:.75*i.s,Math.min(.98,this.options.behaveLikeLine?1.2*i.l:1.25*i.l))},o.prototype.drawFilledPath=function(t,i){return this.raphael.path(t).attr("fill",i).attr("fill-opacity",this.options.fillOpacity).attr("stroke","none")},o}(i.Line),i.Bar=function(e){function n(e){if(this.onHoverOut=s(this.onHoverOut,this),this.onHoverMove=s(this.onHoverMove,this),this.onGridClick=s(this.onGridClick,this),!(this instanceof i.Bar))return new i.Bar(e);n.__super__.constructor.call(this,t.extend({},e,{parseTime:!1}))}return h(n,e),n.prototype.init=function(){if(this.cumulative=this.options.stacked,"always"!==this.options.hideHover)return this.hover=new i.Hover({parent:this.el}),this.on("hovermove",this.onHoverMove),this.on("hoverout",this.onHoverOut),this.on("gridclick",this.onGridClick)},n.prototype.defaults={barSizeRatio:.75,barGap:3,barColors:["#0b62a4","#7a92a3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],barOpacity:1,barRadius:[0,0,0,0],xLabelMargin:50},n.prototype.calc=function(){var t;if(this.calcBars(),!1===this.options.hideHover)return(t=this.hover).update.apply(t,this.hoverContentForRow(this.data.length-1))},n.prototype.calcBars=function(){var t,i,e,n,o,s,r;for(r=[],t=n=0,o=(s=this.data).length;n<o;t=++n)(i=s[t])._x=this.left+this.width*(t+.5)/this.data.length,r.push(i._y=function(){var t,n,o,s;for(s=[],t=0,n=(o=i.y).length;t<n;t++)null!=(e=o[t])?s.push(this.transY(e)):s.push(null);return s}.call(this));return r},n.prototype.draw=function(){var t;return!0!==(t=this.options.axes)&&"both"!==t&&"x"!==t||this.drawXAxis(),this.drawSeries()},n.prototype.drawXAxis=function(){var t,i,e,n,o,s,r,h,a,l,p,u,c;for(l=this.bottom+(this.options.xAxisLabelTopPadding||this.options.padding/2),r=null,s=null,c=[],t=p=0,u=this.data.length;0<=u?p<u:p>u;t=0<=u?++p:--p)h=this.data[this.data.length-1-t],a=(i=this.drawXAxisLabel(h._x,l,h.label)).getBBox(),i.transform("r"+-this.options.xLabelAngle),e=i.getBBox(),i.transform("t0,"+e.height/2+"..."),0!==this.options.xLabelAngle&&(o=-.5*a.width*Math.cos(this.options.xLabelAngle*Math.PI/180),i.transform("t"+o+",0...")),(null==r||r>=e.x+e.width||null!=s&&s>=e.x)&&e.x>=0&&e.x+e.width<this.el.width()?(0!==this.options.xLabelAngle&&(n=1.25*this.options.gridTextSize/Math.sin(this.options.xLabelAngle*Math.PI/180),s=e.x-n),c.push(r=e.x-this.options.xLabelMargin)):c.push(i.remove());return c},n.prototype.drawSeries=function(){var t,i,e,n,o,s,r,h,a,l,p,u,c,d;return e=this.width/this.options.data.length,h=null!=this.options.stacked?1:this.options.ykeys.length,t=(e*this.options.barSizeRatio-this.options.barGap*(h-1))/h,r=e*(1-this.options.barSizeRatio)/2,d=this.ymin<=0&&this.ymax>=0?this.transY(0):null,this.bars=function(){var h,f,g,m;for(g=this.data,m=[],n=h=0,f=g.length;h<f;n=++h)a=g[n],o=0,m.push(function(){var h,f,g,m;for(g=a._y,m=[],l=h=0,f=g.length;h<f;l=++h)null!==(c=g[l])?(d?(u=Math.min(c,d),i=Math.max(c,d)):(u=c,i=this.bottom),s=this.left+n*e+r,this.options.stacked||(s+=l*(t+this.options.barGap)),p=i-u,this.options.stacked&&(u-=o),this.drawBar(s,u,t,p,this.colorFor(a,l,"bar"),this.options.barOpacity,this.options.barRadius),m.push(o+=p)):m.push(null);return m}.call(this));return m}.call(this)},n.prototype.colorFor=function(t,i,e){var n,o;return"function"==typeof this.options.barColors?(n={x:t.x,y:t.y[i],label:t.label},o={index:i,key:this.options.ykeys[i],label:this.options.labels[i]},this.options.barColors.call(this,n,o,e)):this.options.barColors[i%this.options.barColors.length]},n.prototype.hitTest=function(t){return 0===this.data.length?null:(t=Math.max(Math.min(t,this.right),this.left),Math.min(this.data.length-1,Math.floor((t-this.left)/(this.width/this.data.length))))},n.prototype.onGridClick=function(t,i){var e;return e=this.hitTest(t),this.fire("click",e,this.data[e].src,t,i)},n.prototype.onHoverMove=function(t,i){var e,n;return e=this.hitTest(t),(n=this.hover).update.apply(n,this.hoverContentForRow(e))},n.prototype.onHoverOut=function(){if(!1!==this.options.hideHover)return this.hover.hide()},n.prototype.hoverContentForRow=function(t){var i,e,n,o,s,r,h;for(i="<div class='morris-hover-row-label'>"+(n=this.data[t]).label+"</div>",e=s=0,r=(h=n.y).length;s<r;e=++s)o=h[e],i+="<div class='morris-hover-point' style='color: "+this.colorFor(n,e,"label")+"'>\n "+this.options.labels[e]+":\n "+this.yLabelFormat(o)+"\n</div>";return"function"==typeof this.options.hoverCallback&&(i=this.options.hoverCallback(t,this.options,i,n.src)),[i,this.left+(t+.5)*this.width/this.data.length]},n.prototype.drawXAxisLabel=function(t,i,e){return this.raphael.text(t,i,e).attr("font-size",this.options.gridTextSize).attr("font-family",this.options.gridTextFamily).attr("font-weight",this.options.gridTextWeight).attr("fill",this.options.gridTextColor)},n.prototype.drawBar=function(t,i,e,n,o,s,r){var h;return(0===(h=Math.max.apply(Math,r))||h>n?this.raphael.rect(t,i,e,n):this.raphael.path(this.roundedRect(t,i,e,n,r))).attr("fill",o).attr("fill-opacity",s).attr("stroke","none")},n.prototype.roundedRect=function(t,i,e,n,o){return null==o&&(o=[0,0,0,0]),["M",t,o[0]+i,"Q",t,i,t+o[0],i,"L",t+e-o[1],i,"Q",t+e,i,t+e,i+o[1],"L",t+e,i+n-o[2],"Q",t+e,i+n,t+e-o[2],i+n,"L",t+o[3],i+n,"Q",t,i+n,t,i+n-o[3],"Z"]},n}(i.Grid),i.Donut=function(e){function n(e){this.resizeHandler=s(this.resizeHandler,this),this.select=s(this.select,this),this.click=s(this.click,this);var n=this;if(!(this instanceof i.Donut))return new i.Donut(e);if(this.options=t.extend({},this.defaults,e),"string"==typeof e.element?this.el=t(document.getElementById(e.element)):this.el=t(e.element),null===this.el||0===this.el.length)throw new Error("Graph placeholder not found.");void 0!==e.data&&0!==e.data.length&&(this.raphael=new Raphael(this.el[0]),this.options.resize&&t(window).bind("resize",function(t){return null!=n.timeoutId&&window.clearTimeout(n.timeoutId),n.timeoutId=window.setTimeout(n.resizeHandler,100)}),this.setData(e.data))}return h(n,e),n.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],backgroundColor:"#FFFFFF",labelColor:"#000000",formatter:i.commas,resize:!1},n.prototype.redraw=function(){var t,e,n,o,s,r,h,a,l,p,u,c,d,f,g,m,y,v,x,w,b,M;for(this.raphael.clear(),e=this.el.width()/2,n=this.el.height()/2,c=(Math.min(e,n)-10)/3,u=0,d=0,m=(x=this.values).length;d<m;d++)u+=x[d];for(a=5/(2*c),t=1.9999*Math.PI-a*this.data.length,r=0,s=0,this.segments=[],o=f=0,y=(w=this.values).length;f<y;o=++f)l=r+a+t*(w[o]/u),(p=new i.DonutSegment(e,n,2*c,c,r,l,this.data[o].color||this.options.colors[s%this.options.colors.length],this.options.backgroundColor,s,this.raphael)).render(),this.segments.push(p),p.on("hover",this.select),p.on("click",this.click),r=l,s+=1;for(this.text1=this.drawEmptyDonutLabel(e,n-10,this.options.labelColor,15,800),this.text2=this.drawEmptyDonutLabel(e,n+10,this.options.labelColor,14),h=Math.max.apply(Math,this.values),s=0,M=[],g=0,v=(b=this.values).length;g<v;g++){if(b[g]===h){this.select(s);break}M.push(s+=1)}return M},n.prototype.setData=function(t){var i;return this.data=t,this.values=function(){var t,e,n,o;for(o=[],t=0,e=(n=this.data).length;t<e;t++)i=n[t],o.push(parseFloat(i.value));return o}.call(this),this.redraw()},n.prototype.click=function(t){return this.fire("click",t,this.data[t])},n.prototype.select=function(t){var i,e,n,o;for(e=0,n=(o=this.segments).length;e<n;e++)o[e].deselect();return this.segments[t].select(),i=this.data[t],this.setLabels(i.label,this.options.formatter(i.value,i))},n.prototype.setLabels=function(t,i){var e,n,o,s,r,h,a,l;return s=1.8*(e=2*(Math.min(this.el.width()/2,this.el.height()/2)-10)/3),o=e/2,n=e/3,this.text1.attr({text:t,transform:""}),r=this.text1.getBBox(),h=Math.min(s/r.width,o/r.height),this.text1.attr({transform:"S"+h+","+h+","+(r.x+r.width/2)+","+(r.y+r.height)}),this.text2.attr({text:i,transform:""}),a=this.text2.getBBox(),l=Math.min(s/a.width,n/a.height),this.text2.attr({transform:"S"+l+","+l+","+(a.x+a.width/2)+","+a.y})},n.prototype.drawEmptyDonutLabel=function(t,i,e,n,o){var s;return s=this.raphael.text(t,i,"").attr("font-size",n).attr("fill",e),null!=o&&s.attr("font-weight",o),s},n.prototype.resizeHandler=function(){return this.timeoutId=null,this.raphael.setSize(this.el.width(),this.el.height()),this.redraw()},n}(i.EventEmitter),i.DonutSegment=function(t){function i(t,i,e,n,o,r,h,a,l,p){this.cx=t,this.cy=i,this.inner=e,this.outer=n,this.color=h,this.backgroundColor=a,this.index=l,this.raphael=p,this.deselect=s(this.deselect,this),this.select=s(this.select,this),this.sin_p0=Math.sin(o),this.cos_p0=Math.cos(o),this.sin_p1=Math.sin(r),this.cos_p1=Math.cos(r),this.is_long=r-o>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return h(i,t),i.prototype.calcArcPoints=function(t){return[this.cx+t*this.sin_p0,this.cy+t*this.cos_p0,this.cx+t*this.sin_p1,this.cy+t*this.cos_p1]},i.prototype.calcSegment=function(t,i){var e,n,o,s,r,h,a,l,p,u;return e=(p=this.calcArcPoints(t))[0],o=p[1],n=p[2],s=p[3],r=(u=this.calcArcPoints(i))[0],a=u[1],h=u[2],l=u[3],"M"+e+","+o+"A"+t+","+t+",0,"+this.is_long+",0,"+n+","+s+"L"+h+","+l+"A"+i+","+i+",0,"+this.is_long+",1,"+r+","+a+"Z"},i.prototype.calcArc=function(t){var i,e,n,o,s;return i=(s=this.calcArcPoints(t))[0],n=s[1],e=s[2],o=s[3],"M"+i+","+n+"A"+t+","+t+",0,"+this.is_long+",0,"+e+","+o},i.prototype.render=function(){var t=this;return this.arc=this.drawDonutArc(this.hilight,this.color),this.seg=this.drawDonutSegment(this.path,this.color,this.backgroundColor,function(){return t.fire("hover",t.index)},function(){return t.fire("click",t.index)})},i.prototype.drawDonutArc=function(t,i){return this.raphael.path(t).attr({stroke:i,"stroke-width":2,opacity:0})},i.prototype.drawDonutSegment=function(t,i,e,n,o){return this.raphael.path(t).attr({fill:i,stroke:e,"stroke-width":3}).hover(n).click(o)},i.prototype.select=function(){if(!this.selected)return this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0},i.prototype.deselect=function(){if(this.selected)return this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1},i}(i.EventEmitter)}).call(this);
@@ -1,2 +1,2 @@
1
- .morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0}
1
+ .morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,1);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0}
2
2
  .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0}