renalware-core 2.0.64 → 2.0.67
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/renalware/application.js.erb +2 -2
- data/app/controllers/renalware/admin/users_controller.rb +1 -1
- data/app/controllers/renalware/api/ukrdc/patients_controller.rb +14 -67
- data/app/controllers/renalware/drugs/drugs_controller.rb +1 -1
- data/app/controllers/renalware/hd/protocols_controller.rb +1 -1
- data/app/controllers/renalware/patients/bookmarks_controller.rb +16 -5
- data/app/controllers/renalware/snippets/snippets_controller.rb +1 -1
- data/app/controllers/renalware/system/user_feedback_controller.rb +1 -1
- data/app/documents/renalware/hd/session_document.rb +1 -0
- data/app/models/renalware/admissions/consult_query.rb +1 -1
- data/app/models/renalware/clinical/dry_weight.rb +4 -0
- data/app/models/renalware/clinical/patient.rb +5 -0
- data/app/models/renalware/clinical/patient_dry_weights_query.rb +1 -1
- data/app/models/renalware/directory/person_query.rb +1 -1
- data/app/models/renalware/hd/mdm_patients_query.rb +1 -1
- data/app/models/renalware/hd/patient.rb +6 -0
- data/app/models/renalware/hd/patient_listener.rb +8 -0
- data/app/models/renalware/hd/sessions/ongoing_query.rb +1 -1
- data/app/models/renalware/hd/sessions/patient_query.rb +1 -1
- data/app/models/renalware/letters/descriptions/search_query.rb +1 -1
- data/app/models/renalware/letters/letter_factory.rb +55 -2
- data/app/models/renalware/letters/letter_query.rb +1 -1
- data/app/models/renalware/letters/recipient.rb +11 -0
- data/app/models/renalware/letters/resolve_default_electronic_ccs.rb +47 -0
- data/app/models/renalware/low_clearance/mdm_patients_query.rb +1 -1
- data/app/models/renalware/medications/prescriptions_by_drug_type_query.rb +1 -1
- data/app/models/renalware/medications/prescriptions_query.rb +1 -1
- data/app/models/renalware/patients/bookmarks_query.rb +49 -0
- data/app/models/renalware/patients/patient_search.rb +1 -1
- data/app/models/renalware/pd/mdm_patients_query.rb +1 -1
- data/app/models/renalware/renal/prd_descriptions/search_query.rb +1 -1
- data/app/models/renalware/transplants/live_donors_query.rb +1 -1
- data/app/models/renalware/transplants/mdm_patients_query.rb +1 -1
- data/app/models/renalware/transplants/registrations/wait_list_query.rb +1 -1
- data/app/models/renalware/ukrdc/create_encrypted_patient_xml_files.rb +13 -11
- data/app/models/renalware/ukrdc/create_patient_xml_file.rb +33 -21
- data/app/models/renalware/ukrdc/transmission_log.rb +1 -1
- data/app/models/renalware/ukrdc/xml_renderer.rb +126 -0
- data/app/presenters/renalware/clinical/dry_weight_presenter.rb +4 -0
- data/app/presenters/renalware/clinical/dry_weights_presenter.rb +15 -9
- data/app/presenters/renalware/ukrdc/modality_presenter.rb +8 -0
- data/app/presenters/renalware/ukrdc/patient_presenter.rb +9 -6
- data/app/views/renalware/api/ukrdc/patients/_clinical_relationships.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/_encounters.xml.builder +9 -9
- data/app/views/renalware/api/ukrdc/patients/_family_histories.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/_patient.xml.builder +1 -20
- data/app/views/renalware/api/ukrdc/patients/_program_memberships.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/_surveys.xml.builder +4 -4
- data/app/views/renalware/api/ukrdc/patients/encounters/_hd_session.xml.builder +31 -31
- data/app/views/renalware/api/ukrdc/patients/encounters/_treatment.xml.builder +34 -0
- data/app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder +1 -1
- data/app/views/renalware/api/ukrdc/patients/show.xml.builder +1 -1
- data/app/views/renalware/hd/mdm/_summary.html.slim +12 -4
- data/app/views/renalware/hd/protocols/_recent_pathology.html.slim +4 -0
- data/app/views/renalware/hd/sessions/_form.html.slim +1 -0
- data/app/views/renalware/mdm/_prescription_buttons.html.slim +15 -0
- data/app/views/renalware/mdm/_prescriptions.html.slim +1 -8
- data/app/views/renalware/patients/bookmarks/_bookmark.html.slim +16 -0
- data/app/views/renalware/patients/bookmarks/_table.html.slim +20 -0
- data/app/views/renalware/patients/bookmarks/index.html.slim +3 -1
- data/app/views/renalware/transplants/mdm/_prescriptions.html.slim +1 -8
- data/config/initializers/core_extensions.rb +1 -1
- data/config/initializers/renalware.rb +3 -0
- data/config/locales/renalware/hd/session.en.yml +7 -0
- data/config/locales/renalware/patients/bookmarks.en.yml +12 -0
- data/config/locales/renalware/patients/side_menu.en.yml +1 -1
- data/db/migrate/20150119160039_create_versions.rb +3 -3
- data/db/migrate/20150120155952_create_problem_versions.rb +3 -3
- data/db/migrate/20150203161438_create_medication_prescription_versions.rb +3 -3
- data/db/migrate/20150515155052_users_have_and_belong_to_many_roles.rb +3 -1
- data/db/migrate/20160120203747_create_access_versions.rb +3 -3
- data/db/migrate/20160121175711_create_hd_versions.rb +3 -3
- data/db/migrate/20170217141529_create_clinic_versions.rb +3 -3
- data/db/migrate/20170217161409_create_patient_versions.rb +3 -3
- data/db/migrate/20170605102519_create_clinical_versions.rb +3 -3
- data/db/migrate/20171002175804_add_rr_columns_to_transplant_registration_status_descriptions.rb +9 -7
- data/db/migrate/20171003093347_create_hospital_wards.rb +14 -12
- data/db/migrate/20171003111228_create_aki_alert_actions.rb +6 -4
- data/db/migrate/20171003122425_create_renal_aki_alerts.rb +18 -16
- data/db/migrate/20171004092235_create_hd_dialysates.rb +9 -7
- data/db/migrate/20171004110909_add_dialysate_id_to_profile_and_session.rb +6 -4
- data/db/migrate/20171005081224_create_reporting_bone_audit.rb +3 -1
- data/db/migrate/20171005091202_reporting_audit_changes.rb +5 -3
- data/db/migrate/20171005130109_create_medication_current_prescriptions.rb +3 -1
- data/db/migrate/20171005144505_create_reporting_anaemia_audit.rb +3 -1
- data/db/migrate/20171009104106_add_legacy_patient_id_to_patients.rb +4 -2
- data/db/migrate/20171009181615_add_columns_to_drug_drugs.rb +6 -4
- data/db/migrate/20171012110133_create_research_studies.rb +19 -17
- data/db/migrate/20171012143050_create_research_study_participants.rb +27 -25
- data/db/migrate/20171013145849_set_patients_secure_id.rb +12 -10
- data/db/migrate/20171016152223_add_index_to_diary_slots.rb +14 -12
- data/db/migrate/20171017132738_add_unique_indexes_to_local_patient_ids.rb +11 -9
- data/db/migrate/20171017171625_update_hd_overall_audit_view.rb +7 -5
- data/db/migrate/20171101121130_create_function_to_render_audit_view_as_json.rb +6 -4
- data/db/migrate/20171101162244_create_consults.rb +21 -19
- data/db/migrate/20171106100216_create_pd_audit_view.rb +3 -1
- data/db/migrate/20171109084751_remove_local_patient_id_unique_idx.rb +11 -9
- data/db/migrate/20171113120217_add_uuid_to_hd_sessions.rb +4 -2
- data/db/migrate/20171114120904_add_pathology_snapshot_to_letters.rb +3 -1
- data/db/migrate/20171118160030_add_tags_to_patient_bookmarks.rb +3 -1
- data/db/migrate/20171123123712_add_id_to_roles_users.rb +3 -1
- data/db/migrate/20171123143534_add_pk_to_drug_types_drugs.rb +13 -12
- data/db/migrate/20171123154116_create_renal_versions.rb +11 -9
- data/db/migrate/20171127082158_add_region_to_addresses.rb +3 -1
- data/db/migrate/20171127092158_create_function_to_import_practices.rb +6 -2
- data/db/migrate/20171127092359_create_fn_to_insert_gps.rb +6 -2
- data/db/migrate/20171128163543_add_more_missing_indexes.rb +14 -12
- data/db/migrate/20171204112150_create_consult_sites.rb +13 -9
- data/db/migrate/20171206121652_add_loinc_code_to_observation_descriptions.rb +3 -1
- data/db/migrate/20171206140738_create_fn_to_load_practice_memberships_csv.rb +9 -5
- data/db/migrate/20171208211206_create_user_feedback.rb +7 -5
- data/db/migrate/20171211130716_remove_unused_patients_cols.rb +4 -2
- data/db/migrate/20171211131918_remove_email_from_primary_care_physicians.rb +5 -3
- data/db/migrate/20171211161400_create_pathology_current_table.rb +9 -7
- data/db/migrate/20171213111513_create_fn_to_refresh_current_obs.rb +6 -2
- data/db/migrate/20171214141335_create_trigger_to_update_current_observation_sets.rb +10 -6
- data/db/migrate/20171214190849_enforce_request_id_on_observations.rb +3 -1
- data/db/migrate/20171215122454_add_pathology_observation_set_to_letters.rb +8 -6
- data/db/migrate/20171219154529_create_admission_admissions.rb +25 -23
- data/db/migrate/20180102155055_update_patient_summaries_to_version_5.rb +3 -1
- data/db/migrate/20180105132358_add_emailed_at_to_letter_recipients.rb +4 -2
- data/db/migrate/20180108185400_remove_null_constraint_from_letters_pathology_snapshot.rb +3 -1
- data/db/migrate/20180112151706_create_low_clearance_profiles.rb +43 -41
- data/db/migrate/20180112151813_create_low_clearance_versions.rb +11 -9
- data/db/migrate/20180119121243_create_trigger_to_preprocess_hl7_msg.rb +10 -6
- data/db/migrate/20180121115246_add_include_pathology_in_letter_to_letters_letterheads.rb +3 -1
- data/db/migrate/20180122173922_create_virology_profiles.rb +5 -1
- data/db/migrate/20180125201356_make_obs_set_trigger_change_updated_at.rb +6 -2
- data/db/migrate/20180126142314_add_uuid_to_letters.rb +4 -2
- data/db/migrate/20180130165803_add_deleted_at_indexes.rb +14 -12
- data/db/migrate/20180201090444_add_created_at_to_delayed_jobs_in_hl7_trig_fn.rb +6 -2
- data/db/migrate/20180202184954_create_view_pathology_observation_digests.rb +3 -1
- data/db/migrate/20180206225525_update_fn_update_current_observation_set_from_trigger.rb +6 -2
- data/db/migrate/20180207082540_create_count_estimate_function.rb +6 -2
- data/db/migrate/20180208150629_add_authentication_token_to_users.rb +3 -1
- data/db/migrate/20180213124203_add_cancelled_to_pathology_observations.rb +7 -5
- data/db/migrate/20180213125734_update_fn_update_current_obs_set_trgger.rb +6 -2
- data/db/migrate/20180213171805_add_display_order_cols_to_observation_descriptions.rb +10 -8
- data/db/migrate/20180214124317_add_cols_to_aki_alerts.rb +7 -5
- data/db/migrate/20180216132741_disable_some_audits.rb +6 -4
- data/db/migrate/20180221210458_add_state_index_on_modalities.rb +3 -1
- data/db/migrate/20180222090501_add_partial_index_to_bookmarks.rb +4 -2
- data/db/migrate/20180223100420_add_sent_to_ukrdc_at_to_patients.rb +3 -1
- data/db/migrate/20180226124724_add_patient_id_to_virology_profile.rb +9 -5
- data/db/migrate/20180226132410_create_ukrdc_transmission_logs.rb +12 -10
- data/db/migrate/20180301095040_update_fn_to_upsert_gp_practive_memberships.rb +7 -3
- data/db/migrate/20180305134959_add_display_group_to_observation_desriptions.rb +23 -22
- data/db/migrate/20180306071308_remove_rogue_aki_alerts_column.rb +3 -1
- data/db/migrate/20180306080518_add_state_tracking_cols_to_letters.rb +17 -15
- data/db/migrate/20180307191650_add_dwell_time_to_pd_regime.rb +3 -1
- data/db/migrate/20180307223111_create_system_visits_and_events.rb +42 -39
- data/db/migrate/20180309140316_add_unique_constraint_to_obr_requestor.rb +3 -1
- data/db/migrate/20180311104609_remove_unique_obr_requestor_order_number_index.rb +4 -2
- data/db/migrate/20180313114927_remove_deleted_at_from_admission_consults.rb +3 -1
- data/db/migrate/20180313124819_remove_tx_operation_constraints.rb +7 -5
- data/db/migrate/20180319191942_create_function_to_sort_without_failing_on_nonnumerics.rb +6 -2
- data/db/migrate/20180323150241_update_path_obs_descs_for_letter_groupings.rb +25 -23
- data/db/migrate/20180326155400_add_admin_notes_to_system_user_feedback.rb +4 -2
- data/db/migrate/20180327100423_add_constraints_to_recipient_operations.rb +3 -1
- data/db/migrate/20180328210434_add_rrt_to_admission_consults.rb +3 -1
- data/db/migrate/20180419141524_add_cols_to_hd_patient_statistics.rb +8 -6
- data/db/migrate/20180422090043_update_hd_overall_audit_to_version_6.rb +85 -84
- data/db/migrate/20180427133558_add_code_to_hospitals_wards.rb +3 -1
- data/db/migrate/20180502093256_add_document_to_virology_profiles.rb +22 -21
- data/db/migrate/20180502110638_create_virology_versions.rb +7 -5
- data/db/migrate/20180510151959_update_hd_overall_audit_to_version_7.rb +8 -4
- data/db/migrate/20180511100345_add_notes_to_transplant_registration_statuses.rb +3 -1
- data/db/migrate/20180511140415_add_message_hash_messaging_messages.rb +4 -2
- data/db/migrate/20180511171835_create_unique_indexes_on_obr_obr_codes.rb +5 -3
- data/db/migrate/20180514151627_create_system_messages.rb +10 -8
- data/db/migrate/20180516111411_create_view_patient_current_modalities.rb +3 -1
- data/db/migrate/20180524072633_add_columns_to_dialysates.rb +10 -8
- data/db/migrate/20180524074320_add_columns_to_hd_dialysers.rb +8 -6
- data/db/migrate/20180605114332_create_pseudo_encrypt_function.rb +6 -2
- data/db/migrate/20180605141806_add_external_id_to_research_study_participants.rb +33 -31
- data/db/migrate/20180605175211_add_application_url_to_research_studies.rb +3 -1
- data/db/migrate/20180622130552_add_external_id_to_hd_sessions.rb +4 -2
- data/db/migrate/20180625124431_add_patient_identifier_to_feed_messages.rb +3 -1
- data/db/migrate/20180628132323_add_letter_date_indexes.rb +9 -7
- data/db/migrate/20180702091222_create_hd_providers.rb +5 -3
- data/db/migrate/20180702091237_create_hd_provider_units.rb +8 -6
- data/db/migrate/20180702091352_create_hd_transmission_log.rb +15 -13
- data/db/migrate/20180712143314_add_hidden_to_modality_descriptions.rb +3 -1
- data/db/migrate/20180718172750_update_audit_letters_authors_to_version_3.rb +13 -11
- data/db/migrate/20180725132557_add_days_text_to_hd_schedule_definitions.rb +21 -19
- data/db/migrate/20180725132808_create_hd_schedule_definition_filters_view.rb +3 -1
- data/db/migrate/20180730154454_add_external_session_id_to_hd_transmission_logs.rb +7 -5
- data/db/migrate/20180802103013_add_hd_mdm_missing_indexes.rb +6 -4
- data/db/migrate/20180802132417_add_missing_indexes_2.rb +16 -14
- data/db/migrate/20180802144507_add_missing_foreign_key_indexes.rb +14 -12
- data/db/migrate/20180803131157_add_uuid_to_hd_transmission_logs.rb +7 -1
- data/db/migrate/20180814103916_create_index_on_lower_patient_family_name.rb +5 -3
- data/db/migrate/20180815144429_update_hd_overall_audit_to_version_8.rb +8 -4
- data/db/migrate/20180831134926_create_daily_reports.rb +3 -6
- data/db/migrate/20180907100545_add_page_count_to_letters.rb +3 -1
- data/db/migrate/20181001162513_add_active_to_hospital_wards.rb +3 -1
- data/db/migrate/20181008144324_update_daily_letters_report_view_to_version_2.rb +0 -2
- data/db/migrate/20181008145159_create_reporting_daily_ukrdc_view.rb +0 -4
- data/db/migrate/20181013115138_update_reporting_daily_pathology_view_to_v2.rb +0 -2
- data/db/migrate/20181025170410_add_ukrdc_helper_column_to_patients.rb +0 -2
- data/db/migrate/20181026145459_create_ukrdc_batch_numbers.rb +5 -3
- data/db/migrate/20181106133500_update_hd_overall_audit_to_version_9.rb +0 -2
- data/db/migrate/20181109110616_create_hd_grouped_transmission_logs_view.rb +0 -2
- data/db/migrate/20181126090401_add_warnings_to_hd_transmission_logs.rb +7 -0
- data/db/migrate/20181126123745_refresh_hd_grouped_transmission_logs_view.rb +8 -0
- data/db/migrate/20181217124025_change_ukrdc_transmission_log_error_type.rb +15 -0
- data/db/seeds/default/practices/nhs_practices_sample.csv +2 -2
- data/db/seeds/default/practices/primary_care_physicians_sample.csv +2 -2
- data/lib/core_extensions/active_record/migration_helpers.rb +43 -1
- data/lib/renalware/engine.rb +2 -0
- data/lib/renalware/version.rb +1 -1
- metadata +55 -19
- data/lib/migration_helper.rb +0 -11
- data/vendor/assets/javascripts/renalware/moment.min.js +0 -1
- data/vendor/assets/javascripts/renalware/mousetrap.js +0 -1044
data/lib/renalware/engine.rb
CHANGED
@@ -54,6 +54,8 @@ require "wisper"
|
|
54
54
|
require "wisper/activejob"
|
55
55
|
require "rails-assets-foundation-datepicker"
|
56
56
|
require "rails-assets-select2"
|
57
|
+
require "rails-assets-moment"
|
58
|
+
require "rails-assets-mousetrap"
|
57
59
|
if ENV["RAILS_ENV"] == "development"
|
58
60
|
require "byebug"
|
59
61
|
end
|
data/lib/renalware/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: renalware-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.67
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Airslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_type
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 9.
|
75
|
+
version: 9.4.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 9.
|
82
|
+
version: 9.4.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: chosen-rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -478,14 +478,14 @@ dependencies:
|
|
478
478
|
requirements:
|
479
479
|
- - "~>"
|
480
480
|
- !ruby/object:Gem::Version
|
481
|
-
version: 1.
|
481
|
+
version: 1.9.1
|
482
482
|
type: :runtime
|
483
483
|
prerelease: false
|
484
484
|
version_requirements: !ruby/object:Gem::Requirement
|
485
485
|
requirements:
|
486
486
|
- - "~>"
|
487
487
|
- !ruby/object:Gem::Version
|
488
|
-
version: 1.
|
488
|
+
version: 1.9.1
|
489
489
|
- !ruby/object:Gem::Dependency
|
490
490
|
name: pandoc-ruby
|
491
491
|
requirement: !ruby/object:Gem::Requirement
|
@@ -534,14 +534,14 @@ dependencies:
|
|
534
534
|
requirements:
|
535
535
|
- - "~>"
|
536
536
|
- !ruby/object:Gem::Version
|
537
|
-
version: 2.
|
537
|
+
version: 2.2.0
|
538
538
|
type: :runtime
|
539
539
|
prerelease: false
|
540
540
|
version_requirements: !ruby/object:Gem::Requirement
|
541
541
|
requirements:
|
542
542
|
- - "~>"
|
543
543
|
- !ruby/object:Gem::Version
|
544
|
-
version: 2.
|
544
|
+
version: 2.2.0
|
545
545
|
- !ruby/object:Gem::Dependency
|
546
546
|
name: pg
|
547
547
|
requirement: !ruby/object:Gem::Requirement
|
@@ -604,14 +604,14 @@ dependencies:
|
|
604
604
|
requirements:
|
605
605
|
- - "~>"
|
606
606
|
- !ruby/object:Gem::Version
|
607
|
-
version: 5.2.
|
607
|
+
version: 5.2.2
|
608
608
|
type: :runtime
|
609
609
|
prerelease: false
|
610
610
|
version_requirements: !ruby/object:Gem::Requirement
|
611
611
|
requirements:
|
612
612
|
- - "~>"
|
613
613
|
- !ruby/object:Gem::Version
|
614
|
-
version: 5.2.
|
614
|
+
version: 5.2.2
|
615
615
|
- !ruby/object:Gem::Dependency
|
616
616
|
name: rails-assets-foundation-datepicker
|
617
617
|
requirement: !ruby/object:Gem::Requirement
|
@@ -626,6 +626,34 @@ dependencies:
|
|
626
626
|
- - '='
|
627
627
|
- !ruby/object:Gem::Version
|
628
628
|
version: 1.5.0
|
629
|
+
- !ruby/object:Gem::Dependency
|
630
|
+
name: rails-assets-moment
|
631
|
+
requirement: !ruby/object:Gem::Requirement
|
632
|
+
requirements:
|
633
|
+
- - '='
|
634
|
+
- !ruby/object:Gem::Version
|
635
|
+
version: 2.22.2
|
636
|
+
type: :runtime
|
637
|
+
prerelease: false
|
638
|
+
version_requirements: !ruby/object:Gem::Requirement
|
639
|
+
requirements:
|
640
|
+
- - '='
|
641
|
+
- !ruby/object:Gem::Version
|
642
|
+
version: 2.22.2
|
643
|
+
- !ruby/object:Gem::Dependency
|
644
|
+
name: rails-assets-mousetrap
|
645
|
+
requirement: !ruby/object:Gem::Requirement
|
646
|
+
requirements:
|
647
|
+
- - '='
|
648
|
+
- !ruby/object:Gem::Version
|
649
|
+
version: 1.6.2
|
650
|
+
type: :runtime
|
651
|
+
prerelease: false
|
652
|
+
version_requirements: !ruby/object:Gem::Requirement
|
653
|
+
requirements:
|
654
|
+
- - '='
|
655
|
+
- !ruby/object:Gem::Version
|
656
|
+
version: 1.6.2
|
629
657
|
- !ruby/object:Gem::Dependency
|
630
658
|
name: rails-assets-select2
|
631
659
|
requirement: !ruby/object:Gem::Requirement
|
@@ -646,14 +674,14 @@ dependencies:
|
|
646
674
|
requirements:
|
647
675
|
- - "~>"
|
648
676
|
- !ruby/object:Gem::Version
|
649
|
-
version: 2.1.
|
677
|
+
version: 2.1.1
|
650
678
|
type: :runtime
|
651
679
|
prerelease: false
|
652
680
|
version_requirements: !ruby/object:Gem::Requirement
|
653
681
|
requirements:
|
654
682
|
- - "~>"
|
655
683
|
- !ruby/object:Gem::Version
|
656
|
-
version: 2.1.
|
684
|
+
version: 2.1.1
|
657
685
|
- !ruby/object:Gem::Dependency
|
658
686
|
name: record_tag_helper
|
659
687
|
requirement: !ruby/object:Gem::Requirement
|
@@ -688,14 +716,14 @@ dependencies:
|
|
688
716
|
requirements:
|
689
717
|
- - "~>"
|
690
718
|
- !ruby/object:Gem::Version
|
691
|
-
version: 2.
|
719
|
+
version: 2.1.0
|
692
720
|
type: :runtime
|
693
721
|
prerelease: false
|
694
722
|
version_requirements: !ruby/object:Gem::Requirement
|
695
723
|
requirements:
|
696
724
|
- - "~>"
|
697
725
|
- !ruby/object:Gem::Version
|
698
|
-
version: 2.
|
726
|
+
version: 2.1.0
|
699
727
|
- !ruby/object:Gem::Dependency
|
700
728
|
name: scenic
|
701
729
|
requirement: !ruby/object:Gem::Requirement
|
@@ -716,14 +744,14 @@ dependencies:
|
|
716
744
|
requirements:
|
717
745
|
- - "~>"
|
718
746
|
- !ruby/object:Gem::Version
|
719
|
-
version: 4.
|
747
|
+
version: 4.1.0
|
720
748
|
type: :runtime
|
721
749
|
prerelease: false
|
722
750
|
version_requirements: !ruby/object:Gem::Requirement
|
723
751
|
requirements:
|
724
752
|
- - "~>"
|
725
753
|
- !ruby/object:Gem::Version
|
726
|
-
version: 4.
|
754
|
+
version: 4.1.0
|
727
755
|
- !ruby/object:Gem::Dependency
|
728
756
|
name: sinatra
|
729
757
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1519,6 +1547,7 @@ files:
|
|
1519
1547
|
- app/models/renalware/letters/recipient_params_processor.rb
|
1520
1548
|
- app/models/renalware/letters/relevant_observation_description.rb
|
1521
1549
|
- app/models/renalware/letters/remembered_letter_preferences.rb
|
1550
|
+
- app/models/renalware/letters/resolve_default_electronic_ccs.rb
|
1522
1551
|
- app/models/renalware/letters/revise_letter.rb
|
1523
1552
|
- app/models/renalware/letters/rtf_renderer.rb
|
1524
1553
|
- app/models/renalware/letters/signature.rb
|
@@ -1637,6 +1666,7 @@ files:
|
|
1637
1666
|
- app/models/renalware/patients.rb
|
1638
1667
|
- app/models/renalware/patients/alert.rb
|
1639
1668
|
- app/models/renalware/patients/bookmark.rb
|
1669
|
+
- app/models/renalware/patients/bookmarks_query.rb
|
1640
1670
|
- app/models/renalware/patients/calculate_age.rb
|
1641
1671
|
- app/models/renalware/patients/clear_patient_ukrdc_data.rb
|
1642
1672
|
- app/models/renalware/patients/ethnicity.rb
|
@@ -1768,6 +1798,7 @@ files:
|
|
1768
1798
|
- app/models/renalware/ukrdc/paths.rb
|
1769
1799
|
- app/models/renalware/ukrdc/patients_query.rb
|
1770
1800
|
- app/models/renalware/ukrdc/transmission_log.rb
|
1801
|
+
- app/models/renalware/ukrdc/xml_renderer.rb
|
1771
1802
|
- app/models/renalware/user.rb
|
1772
1803
|
- app/models/renalware/version.rb
|
1773
1804
|
- app/models/renalware/virology.rb
|
@@ -1937,6 +1968,7 @@ files:
|
|
1937
1968
|
- app/presenters/renalware/transplants/patient_presenter.rb
|
1938
1969
|
- app/presenters/renalware/transplants/recipient_dashboard_presenter.rb
|
1939
1970
|
- app/presenters/renalware/transplants/wait_list_registration_presenter.rb
|
1971
|
+
- app/presenters/renalware/ukrdc/modality_presenter.rb
|
1940
1972
|
- app/presenters/renalware/ukrdc/pathology_observation_presenter.rb
|
1941
1973
|
- app/presenters/renalware/ukrdc/patient_presenter.rb
|
1942
1974
|
- app/presenters/string_presenter.rb
|
@@ -2052,6 +2084,7 @@ files:
|
|
2052
2084
|
- app/views/renalware/api/ukrdc/patients/_surveys.xml.builder
|
2053
2085
|
- app/views/renalware/api/ukrdc/patients/diagnoses/_cause_of_death.xml.builder
|
2054
2086
|
- app/views/renalware/api/ukrdc/patients/encounters/_hd_session.xml.builder
|
2087
|
+
- app/views/renalware/api/ukrdc/patients/encounters/_treatment.xml.builder
|
2055
2088
|
- app/views/renalware/api/ukrdc/patients/lab_orders/_lab_order.xml.builder
|
2056
2089
|
- app/views/renalware/api/ukrdc/patients/lab_orders/_result_item.xml.builder
|
2057
2090
|
- app/views/renalware/api/ukrdc/patients/observations/_blood_pressure.xml.builder
|
@@ -2344,6 +2377,7 @@ files:
|
|
2344
2377
|
- app/views/renalware/mdm/_letters.html.slim
|
2345
2378
|
- app/views/renalware/mdm/_measurements.html.slim
|
2346
2379
|
- app/views/renalware/mdm/_pathology.html.slim
|
2380
|
+
- app/views/renalware/mdm/_prescription_buttons.html.slim
|
2347
2381
|
- app/views/renalware/mdm/_prescriptions.html.slim
|
2348
2382
|
- app/views/renalware/mdm/_problems.html.slim
|
2349
2383
|
- app/views/renalware/mdm/_top_navigation.html.slim
|
@@ -2462,8 +2496,10 @@ files:
|
|
2462
2496
|
- app/views/renalware/patients/alerts/destroy.js.erb
|
2463
2497
|
- app/views/renalware/patients/alerts/new.html.slim
|
2464
2498
|
- app/views/renalware/patients/alerts/new.js.erb
|
2499
|
+
- app/views/renalware/patients/bookmarks/_bookmark.html.slim
|
2465
2500
|
- app/views/renalware/patients/bookmarks/_delete.html.slim
|
2466
2501
|
- app/views/renalware/patients/bookmarks/_new.html.slim
|
2502
|
+
- app/views/renalware/patients/bookmarks/_table.html.slim
|
2467
2503
|
- app/views/renalware/patients/bookmarks/index.html.slim
|
2468
2504
|
- app/views/renalware/patients/clinical_summaries/show.html.slim
|
2469
2505
|
- app/views/renalware/patients/patients/_form.html.slim
|
@@ -3345,6 +3381,9 @@ files:
|
|
3345
3381
|
- db/migrate/20181026145459_create_ukrdc_batch_numbers.rb
|
3346
3382
|
- db/migrate/20181106133500_update_hd_overall_audit_to_version_9.rb
|
3347
3383
|
- db/migrate/20181109110616_create_hd_grouped_transmission_logs_view.rb
|
3384
|
+
- db/migrate/20181126090401_add_warnings_to_hd_transmission_logs.rb
|
3385
|
+
- db/migrate/20181126123745_refresh_hd_grouped_transmission_logs_view.rb
|
3386
|
+
- db/migrate/20181217124025_change_ukrdc_transmission_log_error_type.rb
|
3348
3387
|
- db/seeds.rb
|
3349
3388
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.csv
|
3350
3389
|
- db/seeds/default/accesses/access_pd_catheter_insertion_techniques.rb
|
@@ -3489,7 +3528,6 @@ files:
|
|
3489
3528
|
- lib/gpg_encrypt_folder.rb
|
3490
3529
|
- lib/hash_collection.rb
|
3491
3530
|
- lib/inline_image.rb
|
3492
|
-
- lib/migration_helper.rb
|
3493
3531
|
- lib/numeric_inclusion_validator.rb
|
3494
3532
|
- lib/pandoc/templates/default.rtf
|
3495
3533
|
- lib/renalware.rb
|
@@ -3702,8 +3740,6 @@ files:
|
|
3702
3740
|
- vendor/assets/javascripts/renalware/jquery-readyselector.js
|
3703
3741
|
- vendor/assets/javascripts/renalware/masonry.min.js
|
3704
3742
|
- vendor/assets/javascripts/renalware/modernizr.js
|
3705
|
-
- vendor/assets/javascripts/renalware/moment.min.js
|
3706
|
-
- vendor/assets/javascripts/renalware/mousetrap.js
|
3707
3743
|
- vendor/assets/javascripts/renalware/print.min.js
|
3708
3744
|
- vendor/assets/javascripts/renalware/rails.validations.js
|
3709
3745
|
- vendor/assets/javascripts/renalware/rails.validations.simple_form.js
|
data/lib/migration_helper.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module MigrationHelper
|
4
|
-
def within_renalware_schema
|
5
|
-
reversible do |direction|
|
6
|
-
direction.up { connection.execute("SET SEARCH_PATH=renalware,public;") }
|
7
|
-
direction.down { connection.execute("SET SEARCH_PATH=renalware,public;") }
|
8
|
-
end
|
9
|
-
yield if block_given?
|
10
|
-
end
|
11
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var e,i;function c(){return e.apply(null,arguments)}function o(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function u(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return void 0===e}function d(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function h(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function f(e,t){var n,s=[];for(n=0;n<e.length;++n)s.push(t(e[n],n));return s}function m(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _(e,t){for(var n in t)m(t,n)&&(e[n]=t[n]);return m(t,"toString")&&(e.toString=t.toString),m(t,"valueOf")&&(e.valueOf=t.valueOf),e}function y(e,t,n,s){return Ot(e,t,n,s,!0).utc()}function g(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function p(e){if(null==e._isValid){var t=g(e),n=i.call(t.parsedDateParts,function(e){return null!=e}),s=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(s=s&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return s;e._isValid=s}return e._isValid}function v(e){var t=y(NaN);return null!=e?_(g(t),e):g(t).userInvalidated=!0,t}i=Array.prototype.some?Array.prototype.some:function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1};var r=c.momentProperties=[];function w(e,t){var n,s,i;if(l(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),l(t._i)||(e._i=t._i),l(t._f)||(e._f=t._f),l(t._l)||(e._l=t._l),l(t._strict)||(e._strict=t._strict),l(t._tzm)||(e._tzm=t._tzm),l(t._isUTC)||(e._isUTC=t._isUTC),l(t._offset)||(e._offset=t._offset),l(t._pf)||(e._pf=g(t)),l(t._locale)||(e._locale=t._locale),0<r.length)for(n=0;n<r.length;n++)l(i=t[s=r[n]])||(e[s]=i);return e}var t=!1;function M(e){w(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===t&&(t=!0,c.updateOffset(this),t=!1)}function S(e){return e instanceof M||null!=e&&null!=e._isAMomentObject}function D(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function k(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=D(t)),n}function a(e,t,n){var s,i=Math.min(e.length,t.length),r=Math.abs(e.length-t.length),a=0;for(s=0;s<i;s++)(n&&e[s]!==t[s]||!n&&k(e[s])!==k(t[s]))&&a++;return a+r}function Y(e){!1===c.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function n(i,r){var a=!0;return _(function(){if(null!=c.deprecationHandler&&c.deprecationHandler(null,i),a){for(var e,t=[],n=0;n<arguments.length;n++){if(e="","object"==typeof arguments[n]){for(var s in e+="\n["+n+"] ",arguments[0])e+=s+": "+arguments[0][s]+", ";e=e.slice(0,-2)}else e=arguments[n];t.push(e)}Y(i+"\nArguments: "+Array.prototype.slice.call(t).join("")+"\n"+(new Error).stack),a=!1}return r.apply(this,arguments)},r)}var s,O={};function T(e,t){null!=c.deprecationHandler&&c.deprecationHandler(e,t),O[e]||(Y(t),O[e]=!0)}function x(e){return e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function b(e,t){var n,s=_({},e);for(n in t)m(t,n)&&(u(e[n])&&u(t[n])?(s[n]={},_(s[n],e[n]),_(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)m(e,n)&&!m(t,n)&&u(e[n])&&(s[n]=_({},s[n]));return s}function P(e){null!=e&&this.set(e)}c.suppressDeprecationWarnings=!1,c.deprecationHandler=null,s=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)m(e,t)&&n.push(t);return n};var W={};function H(e,t){var n=e.toLowerCase();W[n]=W[n+"s"]=W[t]=e}function R(e){return"string"==typeof e?W[e]||W[e.toLowerCase()]:void 0}function C(e){var t,n,s={};for(n in e)m(e,n)&&(t=R(n))&&(s[t]=e[n]);return s}var F={};function L(e,t){F[e]=t}function U(e,t,n){var s=""+Math.abs(e),i=t-s.length;return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+s}var N=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,G=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,V={},E={};function I(e,t,n,s){var i=s;"string"==typeof s&&(i=function(){return this[s]()}),e&&(E[e]=i),t&&(E[t[0]]=function(){return U(i.apply(this,arguments),t[1],t[2])}),n&&(E[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function A(e,t){return e.isValid()?(t=j(t,e.localeData()),V[t]=V[t]||function(s){var e,i,t,r=s.match(N);for(e=0,i=r.length;e<i;e++)E[r[e]]?r[e]=E[r[e]]:r[e]=(t=r[e]).match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"");return function(e){var t,n="";for(t=0;t<i;t++)n+=x(r[t])?r[t].call(e,s):r[t];return n}}(t),V[t](e)):e.localeData().invalidDate()}function j(e,t){var n=5;function s(e){return t.longDateFormat(e)||e}for(G.lastIndex=0;0<=n&&G.test(e);)e=e.replace(G,s),G.lastIndex=0,n-=1;return e}var Z=/\d/,z=/\d\d/,$=/\d{3}/,q=/\d{4}/,J=/[+-]?\d{6}/,B=/\d\d?/,Q=/\d\d\d\d?/,X=/\d\d\d\d\d\d?/,K=/\d{1,3}/,ee=/\d{1,4}/,te=/[+-]?\d{1,6}/,ne=/\d+/,se=/[+-]?\d+/,ie=/Z|[+-]\d\d:?\d\d/gi,re=/Z|[+-]\d\d(?::?\d\d)?/gi,ae=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,oe={};function ue(e,n,s){oe[e]=x(n)?n:function(e,t){return e&&s?s:n}}function le(e,t){return m(oe,e)?oe[e](t._strict,t._locale):new RegExp(de(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(e,t,n,s,i){return t||n||s||i})))}function de(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}var he={};function ce(e,n){var t,s=n;for("string"==typeof e&&(e=[e]),d(n)&&(s=function(e,t){t[n]=k(e)}),t=0;t<e.length;t++)he[e[t]]=s}function fe(e,i){ce(e,function(e,t,n,s){n._w=n._w||{},i(e,n._w,n,s)})}var me=0,_e=1,ye=2,ge=3,pe=4,ve=5,we=6,Me=7,Se=8;function De(e){return ke(e)?366:365}function ke(e){return e%4==0&&e%100!=0||e%400==0}I("Y",0,0,function(){var e=this.year();return e<=9999?""+e:"+"+e}),I(0,["YY",2],0,function(){return this.year()%100}),I(0,["YYYY",4],0,"year"),I(0,["YYYYY",5],0,"year"),I(0,["YYYYYY",6,!0],0,"year"),H("year","y"),L("year",1),ue("Y",se),ue("YY",B,z),ue("YYYY",ee,q),ue("YYYYY",te,J),ue("YYYYYY",te,J),ce(["YYYYY","YYYYYY"],me),ce("YYYY",function(e,t){t[me]=2===e.length?c.parseTwoDigitYear(e):k(e)}),ce("YY",function(e,t){t[me]=c.parseTwoDigitYear(e)}),ce("Y",function(e,t){t[me]=parseInt(e,10)}),c.parseTwoDigitYear=function(e){return k(e)+(68<k(e)?1900:2e3)};var Ye,Oe=Te("FullYear",!0);function Te(t,n){return function(e){return null!=e?(be(this,t,e),c.updateOffset(this,n),this):xe(this,t)}}function xe(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function be(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&ke(e.year())&&1===e.month()&&29===e.date()?e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Pe(n,e.month())):e._d["set"+(e._isUTC?"UTC":"")+t](n))}function Pe(e,t){if(isNaN(e)||isNaN(t))return NaN;var n,s=(t%(n=12)+n)%n;return e+=(t-s)/12,1===s?ke(e)?29:28:31-s%7%2}Ye=Array.prototype.indexOf?Array.prototype.indexOf:function(e){var t;for(t=0;t<this.length;++t)if(this[t]===e)return t;return-1},I("M",["MM",2],"Mo",function(){return this.month()+1}),I("MMM",0,0,function(e){return this.localeData().monthsShort(this,e)}),I("MMMM",0,0,function(e){return this.localeData().months(this,e)}),H("month","M"),L("month",8),ue("M",B),ue("MM",B,z),ue("MMM",function(e,t){return t.monthsShortRegex(e)}),ue("MMMM",function(e,t){return t.monthsRegex(e)}),ce(["M","MM"],function(e,t){t[_e]=k(e)-1}),ce(["MMM","MMMM"],function(e,t,n,s){var i=n._locale.monthsParse(e,s,n._strict);null!=i?t[_e]=i:g(n).invalidMonth=e});var We=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,He="January_February_March_April_May_June_July_August_September_October_November_December".split("_");var Re="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");function Ce(e,t){var n;if(!e.isValid())return e;if("string"==typeof t)if(/^\d+$/.test(t))t=k(t);else if(!d(t=e.localeData().monthsParse(t)))return e;return n=Math.min(e.date(),Pe(e.year(),t)),e._d["set"+(e._isUTC?"UTC":"")+"Month"](t,n),e}function Fe(e){return null!=e?(Ce(this,e),c.updateOffset(this,!0),this):xe(this,"Month")}var Le=ae;var Ue=ae;function Ne(){function e(e,t){return t.length-e.length}var t,n,s=[],i=[],r=[];for(t=0;t<12;t++)n=y([2e3,t]),s.push(this.monthsShort(n,"")),i.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(s.sort(e),i.sort(e),r.sort(e),t=0;t<12;t++)s[t]=de(s[t]),i[t]=de(i[t]);for(t=0;t<24;t++)r[t]=de(r[t]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+s.join("|")+")","i")}function Ge(e){var t=new Date(Date.UTC.apply(null,arguments));return e<100&&0<=e&&isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e),t}function Ve(e,t,n){var s=7+t-n;return-((7+Ge(e,0,s).getUTCDay()-t)%7)+s-1}function Ee(e,t,n,s,i){var r,a,o=1+7*(t-1)+(7+n-s)%7+Ve(e,s,i);return o<=0?a=De(r=e-1)+o:o>De(e)?(r=e+1,a=o-De(e)):(r=e,a=o),{year:r,dayOfYear:a}}function Ie(e,t,n){var s,i,r=Ve(e.year(),t,n),a=Math.floor((e.dayOfYear()-r-1)/7)+1;return a<1?s=a+Ae(i=e.year()-1,t,n):a>Ae(e.year(),t,n)?(s=a-Ae(e.year(),t,n),i=e.year()+1):(i=e.year(),s=a),{week:s,year:i}}function Ae(e,t,n){var s=Ve(e,t,n),i=Ve(e+1,t,n);return(De(e)-s+i)/7}I("w",["ww",2],"wo","week"),I("W",["WW",2],"Wo","isoWeek"),H("week","w"),H("isoWeek","W"),L("week",5),L("isoWeek",5),ue("w",B),ue("ww",B,z),ue("W",B),ue("WW",B,z),fe(["w","ww","W","WW"],function(e,t,n,s){t[s.substr(0,1)]=k(e)});I("d",0,"do","day"),I("dd",0,0,function(e){return this.localeData().weekdaysMin(this,e)}),I("ddd",0,0,function(e){return this.localeData().weekdaysShort(this,e)}),I("dddd",0,0,function(e){return this.localeData().weekdays(this,e)}),I("e",0,0,"weekday"),I("E",0,0,"isoWeekday"),H("day","d"),H("weekday","e"),H("isoWeekday","E"),L("day",11),L("weekday",11),L("isoWeekday",11),ue("d",B),ue("e",B),ue("E",B),ue("dd",function(e,t){return t.weekdaysMinRegex(e)}),ue("ddd",function(e,t){return t.weekdaysShortRegex(e)}),ue("dddd",function(e,t){return t.weekdaysRegex(e)}),fe(["dd","ddd","dddd"],function(e,t,n,s){var i=n._locale.weekdaysParse(e,s,n._strict);null!=i?t.d=i:g(n).invalidWeekday=e}),fe(["d","e","E"],function(e,t,n,s){t[s]=k(e)});var je="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");var Ze="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");var ze="Su_Mo_Tu_We_Th_Fr_Sa".split("_");var $e=ae;var qe=ae;var Je=ae;function Be(){function e(e,t){return t.length-e.length}var t,n,s,i,r,a=[],o=[],u=[],l=[];for(t=0;t<7;t++)n=y([2e3,1]).day(t),s=this.weekdaysMin(n,""),i=this.weekdaysShort(n,""),r=this.weekdays(n,""),a.push(s),o.push(i),u.push(r),l.push(s),l.push(i),l.push(r);for(a.sort(e),o.sort(e),u.sort(e),l.sort(e),t=0;t<7;t++)o[t]=de(o[t]),u[t]=de(u[t]),l[t]=de(l[t]);this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function Qe(){return this.hours()%12||12}function Xe(e,t){I(e,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)})}function Ke(e,t){return t._meridiemParse}I("H",["HH",2],0,"hour"),I("h",["hh",2],0,Qe),I("k",["kk",2],0,function(){return this.hours()||24}),I("hmm",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)}),I("hmmss",0,0,function(){return""+Qe.apply(this)+U(this.minutes(),2)+U(this.seconds(),2)}),I("Hmm",0,0,function(){return""+this.hours()+U(this.minutes(),2)}),I("Hmmss",0,0,function(){return""+this.hours()+U(this.minutes(),2)+U(this.seconds(),2)}),Xe("a",!0),Xe("A",!1),H("hour","h"),L("hour",13),ue("a",Ke),ue("A",Ke),ue("H",B),ue("h",B),ue("k",B),ue("HH",B,z),ue("hh",B,z),ue("kk",B,z),ue("hmm",Q),ue("hmmss",X),ue("Hmm",Q),ue("Hmmss",X),ce(["H","HH"],ge),ce(["k","kk"],function(e,t,n){var s=k(e);t[ge]=24===s?0:s}),ce(["a","A"],function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e}),ce(["h","hh"],function(e,t,n){t[ge]=k(e),g(n).bigHour=!0}),ce("hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s)),g(n).bigHour=!0}),ce("hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i)),g(n).bigHour=!0}),ce("Hmm",function(e,t,n){var s=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s))}),ce("Hmmss",function(e,t,n){var s=e.length-4,i=e.length-2;t[ge]=k(e.substr(0,s)),t[pe]=k(e.substr(s,2)),t[ve]=k(e.substr(i))});var et,tt=Te("Hours",!0),nt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:He,monthsShort:Re,week:{dow:0,doy:6},weekdays:je,weekdaysMin:ze,weekdaysShort:Ze,meridiemParse:/[ap]\.?m?\.?/i},st={},it={};function rt(e){return e?e.toLowerCase().replace("_","-"):e}function at(e){var t=null;if(!st[e]&&"undefined"!=typeof module&&module&&module.exports)try{t=et._abbr,require("./locale/"+e),ot(t)}catch(e){}return st[e]}function ot(e,t){var n;return e&&((n=l(t)?lt(e):ut(e,t))?et=n:"undefined"!=typeof console&&console.warn&&console.warn("Locale "+e+" not found. Did you forget to load it?")),et._abbr}function ut(e,t){if(null!==t){var n,s=nt;if(t.abbr=e,null!=st[e])T("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),s=st[e]._config;else if(null!=t.parentLocale)if(null!=st[t.parentLocale])s=st[t.parentLocale]._config;else{if(null==(n=at(t.parentLocale)))return it[t.parentLocale]||(it[t.parentLocale]=[]),it[t.parentLocale].push({name:e,config:t}),null;s=n._config}return st[e]=new P(b(s,t)),it[e]&&it[e].forEach(function(e){ut(e.name,e.config)}),ot(e),st[e]}return delete st[e],null}function lt(e){var t;if(e&&e._locale&&e._locale._abbr&&(e=e._locale._abbr),!e)return et;if(!o(e)){if(t=at(e))return t;e=[e]}return function(e){for(var t,n,s,i,r=0;r<e.length;){for(t=(i=rt(e[r]).split("-")).length,n=(n=rt(e[r+1]))?n.split("-"):null;0<t;){if(s=at(i.slice(0,t).join("-")))return s;if(n&&n.length>=t&&a(i,n,!0)>=t-1)break;t--}r++}return et}(e)}function dt(e){var t,n=e._a;return n&&-2===g(e).overflow&&(t=n[_e]<0||11<n[_e]?_e:n[ye]<1||n[ye]>Pe(n[me],n[_e])?ye:n[ge]<0||24<n[ge]||24===n[ge]&&(0!==n[pe]||0!==n[ve]||0!==n[we])?ge:n[pe]<0||59<n[pe]?pe:n[ve]<0||59<n[ve]?ve:n[we]<0||999<n[we]?we:-1,g(e)._overflowDayOfYear&&(t<me||ye<t)&&(t=ye),g(e)._overflowWeeks&&-1===t&&(t=Me),g(e)._overflowWeekday&&-1===t&&(t=Se),g(e).overflow=t),e}function ht(e,t,n){return null!=e?e:null!=t?t:n}function ct(e){var t,n,s,i,r,a=[];if(!e._d){var o,u;for(o=e,u=new Date(c.now()),s=o._useUTC?[u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate()]:[u.getFullYear(),u.getMonth(),u.getDate()],e._w&&null==e._a[ye]&&null==e._a[_e]&&function(e){var t,n,s,i,r,a,o,u;if(null!=(t=e._w).GG||null!=t.W||null!=t.E)r=1,a=4,n=ht(t.GG,e._a[me],Ie(Tt(),1,4).year),s=ht(t.W,1),((i=ht(t.E,1))<1||7<i)&&(u=!0);else{r=e._locale._week.dow,a=e._locale._week.doy;var l=Ie(Tt(),r,a);n=ht(t.gg,e._a[me],l.year),s=ht(t.w,l.week),null!=t.d?((i=t.d)<0||6<i)&&(u=!0):null!=t.e?(i=t.e+r,(t.e<0||6<t.e)&&(u=!0)):i=r}s<1||s>Ae(n,r,a)?g(e)._overflowWeeks=!0:null!=u?g(e)._overflowWeekday=!0:(o=Ee(n,s,i,r,a),e._a[me]=o.year,e._dayOfYear=o.dayOfYear)}(e),null!=e._dayOfYear&&(r=ht(e._a[me],s[me]),(e._dayOfYear>De(r)||0===e._dayOfYear)&&(g(e)._overflowDayOfYear=!0),n=Ge(r,0,e._dayOfYear),e._a[_e]=n.getUTCMonth(),e._a[ye]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=a[t]=s[t];for(;t<7;t++)e._a[t]=a[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[ge]&&0===e._a[pe]&&0===e._a[ve]&&0===e._a[we]&&(e._nextDay=!0,e._a[ge]=0),e._d=(e._useUTC?Ge:function(e,t,n,s,i,r,a){var o=new Date(e,t,n,s,i,r,a);return e<100&&0<=e&&isFinite(o.getFullYear())&&o.setFullYear(e),o}).apply(null,a),i=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[ge]=24),e._w&&void 0!==e._w.d&&e._w.d!==i&&(g(e).weekdayMismatch=!0)}}var ft=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,mt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,_t=/Z|[+-]\d\d(?::?\d\d)?/,yt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],gt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],pt=/^\/?Date\((\-?\d+)/i;function vt(e){var t,n,s,i,r,a,o=e._i,u=ft.exec(o)||mt.exec(o);if(u){for(g(e).iso=!0,t=0,n=yt.length;t<n;t++)if(yt[t][1].exec(u[1])){i=yt[t][0],s=!1!==yt[t][2];break}if(null==i)return void(e._isValid=!1);if(u[3]){for(t=0,n=gt.length;t<n;t++)if(gt[t][1].exec(u[3])){r=(u[2]||" ")+gt[t][0];break}if(null==r)return void(e._isValid=!1)}if(!s&&null!=r)return void(e._isValid=!1);if(u[4]){if(!_t.exec(u[4]))return void(e._isValid=!1);a="Z"}e._f=i+(r||"")+(a||""),kt(e)}else e._isValid=!1}var wt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;function Mt(e,t,n,s,i,r){var a=[function(e){var t=parseInt(e,10);{if(t<=49)return 2e3+t;if(t<=999)return 1900+t}return t}(e),Re.indexOf(t),parseInt(n,10),parseInt(s,10),parseInt(i,10)];return r&&a.push(parseInt(r,10)),a}var St={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function Dt(e){var t,n,s,i=wt.exec(e._i.replace(/\([^)]*\)|[\n\t]/g," ").replace(/(\s\s+)/g," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""));if(i){var r=Mt(i[4],i[3],i[2],i[5],i[6],i[7]);if(t=i[1],n=r,s=e,t&&Ze.indexOf(t)!==new Date(n[0],n[1],n[2]).getDay()&&(g(s).weekdayMismatch=!0,!(s._isValid=!1)))return;e._a=r,e._tzm=function(e,t,n){if(e)return St[e];if(t)return 0;var s=parseInt(n,10),i=s%100;return(s-i)/100*60+i}(i[8],i[9],i[10]),e._d=Ge.apply(null,e._a),e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),g(e).rfc2822=!0}else e._isValid=!1}function kt(e){if(e._f!==c.ISO_8601)if(e._f!==c.RFC_2822){e._a=[],g(e).empty=!0;var t,n,s,i,r,a,o,u,l=""+e._i,d=l.length,h=0;for(s=j(e._f,e._locale).match(N)||[],t=0;t<s.length;t++)i=s[t],(n=(l.match(le(i,e))||[])[0])&&(0<(r=l.substr(0,l.indexOf(n))).length&&g(e).unusedInput.push(r),l=l.slice(l.indexOf(n)+n.length),h+=n.length),E[i]?(n?g(e).empty=!1:g(e).unusedTokens.push(i),a=i,u=e,null!=(o=n)&&m(he,a)&&he[a](o,u._a,u,a)):e._strict&&!n&&g(e).unusedTokens.push(i);g(e).charsLeftOver=d-h,0<l.length&&g(e).unusedInput.push(l),e._a[ge]<=12&&!0===g(e).bigHour&&0<e._a[ge]&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[ge]=function(e,t,n){var s;if(null==n)return t;return null!=e.meridiemHour?e.meridiemHour(t,n):(null!=e.isPM&&((s=e.isPM(n))&&t<12&&(t+=12),s||12!==t||(t=0)),t)}(e._locale,e._a[ge],e._meridiem),ct(e),dt(e)}else Dt(e);else vt(e)}function Yt(e){var t,n,s,i,r=e._i,a=e._f;return e._locale=e._locale||lt(e._l),null===r||void 0===a&&""===r?v({nullInput:!0}):("string"==typeof r&&(e._i=r=e._locale.preparse(r)),S(r)?new M(dt(r)):(h(r)?e._d=r:o(a)?function(e){var t,n,s,i,r;if(0===e._f.length)return g(e).invalidFormat=!0,e._d=new Date(NaN);for(i=0;i<e._f.length;i++)r=0,t=w({},e),null!=e._useUTC&&(t._useUTC=e._useUTC),t._f=e._f[i],kt(t),p(t)&&(r+=g(t).charsLeftOver,r+=10*g(t).unusedTokens.length,g(t).score=r,(null==s||r<s)&&(s=r,n=t));_(e,n||t)}(e):a?kt(e):l(n=(t=e)._i)?t._d=new Date(c.now()):h(n)?t._d=new Date(n.valueOf()):"string"==typeof n?(s=t,null===(i=pt.exec(s._i))?(vt(s),!1===s._isValid&&(delete s._isValid,Dt(s),!1===s._isValid&&(delete s._isValid,c.createFromInputFallback(s)))):s._d=new Date(+i[1])):o(n)?(t._a=f(n.slice(0),function(e){return parseInt(e,10)}),ct(t)):u(n)?function(e){if(!e._d){var t=C(e._i);e._a=f([t.year,t.month,t.day||t.date,t.hour,t.minute,t.second,t.millisecond],function(e){return e&&parseInt(e,10)}),ct(e)}}(t):d(n)?t._d=new Date(n):c.createFromInputFallback(t),p(e)||(e._d=null),e))}function Ot(e,t,n,s,i){var r,a={};return!0!==n&&!1!==n||(s=n,n=void 0),(u(e)&&function(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;var t;for(t in e)if(e.hasOwnProperty(t))return!1;return!0}(e)||o(e)&&0===e.length)&&(e=void 0),a._isAMomentObject=!0,a._useUTC=a._isUTC=i,a._l=n,a._i=e,a._f=t,a._strict=s,(r=new M(dt(Yt(a))))._nextDay&&(r.add(1,"d"),r._nextDay=void 0),r}function Tt(e,t,n,s){return Ot(e,t,n,s,!1)}c.createFromInputFallback=n("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(e){e._d=new Date(e._i+(e._useUTC?" UTC":""))}),c.ISO_8601=function(){},c.RFC_2822=function(){};var xt=n("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?e<this?this:e:v()}),bt=n("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var e=Tt.apply(null,arguments);return this.isValid()&&e.isValid()?this<e?this:e:v()});function Pt(e,t){var n,s;if(1===t.length&&o(t[0])&&(t=t[0]),!t.length)return Tt();for(n=t[0],s=1;s<t.length;++s)t[s].isValid()&&!t[s][e](n)||(n=t[s]);return n}var Wt=["year","quarter","month","week","day","hour","minute","second","millisecond"];function Ht(e){var t=C(e),n=t.year||0,s=t.quarter||0,i=t.month||0,r=t.week||0,a=t.day||0,o=t.hour||0,u=t.minute||0,l=t.second||0,d=t.millisecond||0;this._isValid=function(e){for(var t in e)if(-1===Ye.call(Wt,t)||null!=e[t]&&isNaN(e[t]))return!1;for(var n=!1,s=0;s<Wt.length;++s)if(e[Wt[s]]){if(n)return!1;parseFloat(e[Wt[s]])!==k(e[Wt[s]])&&(n=!0)}return!0}(t),this._milliseconds=+d+1e3*l+6e4*u+1e3*o*60*60,this._days=+a+7*r,this._months=+i+3*s+12*n,this._data={},this._locale=lt(),this._bubble()}function Rt(e){return e instanceof Ht}function Ct(e){return e<0?-1*Math.round(-1*e):Math.round(e)}function Ft(e,n){I(e,0,0,function(){var e=this.utcOffset(),t="+";return e<0&&(e=-e,t="-"),t+U(~~(e/60),2)+n+U(~~e%60,2)})}Ft("Z",":"),Ft("ZZ",""),ue("Z",re),ue("ZZ",re),ce(["Z","ZZ"],function(e,t,n){n._useUTC=!0,n._tzm=Ut(re,e)});var Lt=/([\+\-]|\d\d)/gi;function Ut(e,t){var n=(t||"").match(e);if(null===n)return null;var s=((n[n.length-1]||[])+"").match(Lt)||["-",0,0],i=60*s[1]+k(s[2]);return 0===i?0:"+"===s[0]?i:-i}function Nt(e,t){var n,s;return t._isUTC?(n=t.clone(),s=(S(e)||h(e)?e.valueOf():Tt(e).valueOf())-n.valueOf(),n._d.setTime(n._d.valueOf()+s),c.updateOffset(n,!1),n):Tt(e).local()}function Gt(e){return 15*-Math.round(e._d.getTimezoneOffset()/15)}function Vt(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}c.updateOffset=function(){};var Et=/^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,It=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function At(e,t){var n,s,i,r=e,a=null;return Rt(e)?r={ms:e._milliseconds,d:e._days,M:e._months}:d(e)?(r={},t?r[t]=e:r.milliseconds=e):(a=Et.exec(e))?(n="-"===a[1]?-1:1,r={y:0,d:k(a[ye])*n,h:k(a[ge])*n,m:k(a[pe])*n,s:k(a[ve])*n,ms:k(Ct(1e3*a[we]))*n}):(a=It.exec(e))?(n="-"===a[1]?-1:(a[1],1),r={y:jt(a[2],n),M:jt(a[3],n),w:jt(a[4],n),d:jt(a[5],n),h:jt(a[6],n),m:jt(a[7],n),s:jt(a[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(i=function(e,t){var n;if(!e.isValid()||!t.isValid())return{milliseconds:0,months:0};t=Nt(t,e),e.isBefore(t)?n=Zt(e,t):((n=Zt(t,e)).milliseconds=-n.milliseconds,n.months=-n.months);return n}(Tt(r.from),Tt(r.to)),(r={}).ms=i.milliseconds,r.M=i.months),s=new Ht(r),Rt(e)&&m(e,"_locale")&&(s._locale=e._locale),s}function jt(e,t){var n=e&&parseFloat(e.replace(",","."));return(isNaN(n)?0:n)*t}function Zt(e,t){var n={milliseconds:0,months:0};return n.months=t.month()-e.month()+12*(t.year()-e.year()),e.clone().add(n.months,"M").isAfter(t)&&--n.months,n.milliseconds=+t-+e.clone().add(n.months,"M"),n}function zt(s,i){return function(e,t){var n;return null===t||isNaN(+t)||(T(i,"moment()."+i+"(period, number) is deprecated. Please use moment()."+i+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),n=e,e=t,t=n),$t(this,At(e="string"==typeof e?+e:e,t),s),this}}function $t(e,t,n,s){var i=t._milliseconds,r=Ct(t._days),a=Ct(t._months);e.isValid()&&(s=null==s||s,a&&Ce(e,xe(e,"Month")+a*n),r&&be(e,"Date",xe(e,"Date")+r*n),i&&e._d.setTime(e._d.valueOf()+i*n),s&&c.updateOffset(e,r||a))}At.fn=Ht.prototype,At.invalid=function(){return At(NaN)};var qt=zt(1,"add"),Jt=zt(-1,"subtract");function Bt(e,t){var n=12*(t.year()-e.year())+(t.month()-e.month()),s=e.clone().add(n,"months");return-(n+(t-s<0?(t-s)/(s-e.clone().add(n-1,"months")):(t-s)/(e.clone().add(n+1,"months")-s)))||0}function Qt(e){var t;return void 0===e?this._locale._abbr:(null!=(t=lt(e))&&(this._locale=t),this)}c.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",c.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Xt=n("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(e){return void 0===e?this.localeData():this.locale(e)});function Kt(){return this._locale}function en(e,t){I(0,[e,e.length],0,t)}function tn(e,t,n,s,i){var r;return null==e?Ie(this,s,i).year:((r=Ae(e,s,i))<t&&(t=r),function(e,t,n,s,i){var r=Ee(e,t,n,s,i),a=Ge(r.year,0,r.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}.call(this,e,t,n,s,i))}I(0,["gg",2],0,function(){return this.weekYear()%100}),I(0,["GG",2],0,function(){return this.isoWeekYear()%100}),en("gggg","weekYear"),en("ggggg","weekYear"),en("GGGG","isoWeekYear"),en("GGGGG","isoWeekYear"),H("weekYear","gg"),H("isoWeekYear","GG"),L("weekYear",1),L("isoWeekYear",1),ue("G",se),ue("g",se),ue("GG",B,z),ue("gg",B,z),ue("GGGG",ee,q),ue("gggg",ee,q),ue("GGGGG",te,J),ue("ggggg",te,J),fe(["gggg","ggggg","GGGG","GGGGG"],function(e,t,n,s){t[s.substr(0,2)]=k(e)}),fe(["gg","GG"],function(e,t,n,s){t[s]=c.parseTwoDigitYear(e)}),I("Q",0,"Qo","quarter"),H("quarter","Q"),L("quarter",7),ue("Q",Z),ce("Q",function(e,t){t[_e]=3*(k(e)-1)}),I("D",["DD",2],"Do","date"),H("date","D"),L("date",9),ue("D",B),ue("DD",B,z),ue("Do",function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient}),ce(["D","DD"],ye),ce("Do",function(e,t){t[ye]=k(e.match(B)[0])});var nn=Te("Date",!0);I("DDD",["DDDD",3],"DDDo","dayOfYear"),H("dayOfYear","DDD"),L("dayOfYear",4),ue("DDD",K),ue("DDDD",$),ce(["DDD","DDDD"],function(e,t,n){n._dayOfYear=k(e)}),I("m",["mm",2],0,"minute"),H("minute","m"),L("minute",14),ue("m",B),ue("mm",B,z),ce(["m","mm"],pe);var sn=Te("Minutes",!1);I("s",["ss",2],0,"second"),H("second","s"),L("second",15),ue("s",B),ue("ss",B,z),ce(["s","ss"],ve);var rn,an=Te("Seconds",!1);for(I("S",0,0,function(){return~~(this.millisecond()/100)}),I(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),I(0,["SSS",3],0,"millisecond"),I(0,["SSSS",4],0,function(){return 10*this.millisecond()}),I(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),I(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),I(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),I(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),I(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),H("millisecond","ms"),L("millisecond",16),ue("S",K,Z),ue("SS",K,z),ue("SSS",K,$),rn="SSSS";rn.length<=9;rn+="S")ue(rn,ne);function on(e,t){t[we]=k(1e3*("0."+e))}for(rn="S";rn.length<=9;rn+="S")ce(rn,on);var un=Te("Milliseconds",!1);I("z",0,0,"zoneAbbr"),I("zz",0,0,"zoneName");var ln=M.prototype;function dn(e){return e}ln.add=qt,ln.calendar=function(e,t){var n=e||Tt(),s=Nt(n,this).startOf("day"),i=c.calendarFormat(this,s)||"sameElse",r=t&&(x(t[i])?t[i].call(this,n):t[i]);return this.format(r||this.localeData().calendar(i,this,Tt(n)))},ln.clone=function(){return new M(this)},ln.diff=function(e,t,n){var s,i,r;if(!this.isValid())return NaN;if(!(s=Nt(e,this)).isValid())return NaN;switch(i=6e4*(s.utcOffset()-this.utcOffset()),t=R(t)){case"year":r=Bt(this,s)/12;break;case"month":r=Bt(this,s);break;case"quarter":r=Bt(this,s)/3;break;case"second":r=(this-s)/1e3;break;case"minute":r=(this-s)/6e4;break;case"hour":r=(this-s)/36e5;break;case"day":r=(this-s-i)/864e5;break;case"week":r=(this-s-i)/6048e5;break;default:r=this-s}return n?r:D(r)},ln.endOf=function(e){return void 0===(e=R(e))||"millisecond"===e?this:("date"===e&&(e="day"),this.startOf(e).add(1,"isoWeek"===e?"week":e).subtract(1,"ms"))},ln.format=function(e){e||(e=this.isUtc()?c.defaultFormatUtc:c.defaultFormat);var t=A(this,e);return this.localeData().postformat(t)},ln.from=function(e,t){return this.isValid()&&(S(e)&&e.isValid()||Tt(e).isValid())?At({to:this,from:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},ln.fromNow=function(e){return this.from(Tt(),e)},ln.to=function(e,t){return this.isValid()&&(S(e)&&e.isValid()||Tt(e).isValid())?At({from:this,to:e}).locale(this.locale()).humanize(!t):this.localeData().invalidDate()},ln.toNow=function(e){return this.to(Tt(),e)},ln.get=function(e){return x(this[e=R(e)])?this[e]():this},ln.invalidAt=function(){return g(this).overflow},ln.isAfter=function(e,t){var n=S(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=R(l(t)?"millisecond":t))?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(t).valueOf())},ln.isBefore=function(e,t){var n=S(e)?e:Tt(e);return!(!this.isValid()||!n.isValid())&&("millisecond"===(t=R(l(t)?"millisecond":t))?this.valueOf()<n.valueOf():this.clone().endOf(t).valueOf()<n.valueOf())},ln.isBetween=function(e,t,n,s){return("("===(s=s||"()")[0]?this.isAfter(e,n):!this.isBefore(e,n))&&(")"===s[1]?this.isBefore(t,n):!this.isAfter(t,n))},ln.isSame=function(e,t){var n,s=S(e)?e:Tt(e);return!(!this.isValid()||!s.isValid())&&("millisecond"===(t=R(t||"millisecond"))?this.valueOf()===s.valueOf():(n=s.valueOf(),this.clone().startOf(t).valueOf()<=n&&n<=this.clone().endOf(t).valueOf()))},ln.isSameOrAfter=function(e,t){return this.isSame(e,t)||this.isAfter(e,t)},ln.isSameOrBefore=function(e,t){return this.isSame(e,t)||this.isBefore(e,t)},ln.isValid=function(){return p(this)},ln.lang=Xt,ln.locale=Qt,ln.localeData=Kt,ln.max=bt,ln.min=xt,ln.parsingFlags=function(){return _({},g(this))},ln.set=function(e,t){if("object"==typeof e)for(var n=function(e){var t=[];for(var n in e)t.push({unit:n,priority:F[n]});return t.sort(function(e,t){return e.priority-t.priority}),t}(e=C(e)),s=0;s<n.length;s++)this[n[s].unit](e[n[s].unit]);else if(x(this[e=R(e)]))return this[e](t);return this},ln.startOf=function(e){switch(e=R(e)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===e&&this.weekday(0),"isoWeek"===e&&this.isoWeekday(1),"quarter"===e&&this.month(3*Math.floor(this.month()/3)),this},ln.subtract=Jt,ln.toArray=function(){var e=this;return[e.year(),e.month(),e.date(),e.hour(),e.minute(),e.second(),e.millisecond()]},ln.toObject=function(){var e=this;return{years:e.year(),months:e.month(),date:e.date(),hours:e.hours(),minutes:e.minutes(),seconds:e.seconds(),milliseconds:e.milliseconds()}},ln.toDate=function(){return new Date(this.valueOf())},ln.toISOString=function(e){if(!this.isValid())return null;var t=!0!==e,n=t?this.clone().utc():this;return n.year()<0||9999<n.year()?A(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):x(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",A(n,"Z")):A(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},ln.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e="moment",t="";this.isLocal()||(e=0===this.utcOffset()?"moment.utc":"moment.parseZone",t="Z");var n="["+e+'("]',s=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",i=t+'[")]';return this.format(n+s+"-MM-DD[T]HH:mm:ss.SSS"+i)},ln.toJSON=function(){return this.isValid()?this.toISOString():null},ln.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},ln.unix=function(){return Math.floor(this.valueOf()/1e3)},ln.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},ln.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},ln.year=Oe,ln.isLeapYear=function(){return ke(this.year())},ln.weekYear=function(e){return tn.call(this,e,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)},ln.isoWeekYear=function(e){return tn.call(this,e,this.isoWeek(),this.isoWeekday(),1,4)},ln.quarter=ln.quarters=function(e){return null==e?Math.ceil((this.month()+1)/3):this.month(3*(e-1)+this.month()%3)},ln.month=Fe,ln.daysInMonth=function(){return Pe(this.year(),this.month())},ln.week=ln.weeks=function(e){var t=this.localeData().week(this);return null==e?t:this.add(7*(e-t),"d")},ln.isoWeek=ln.isoWeeks=function(e){var t=Ie(this,1,4).week;return null==e?t:this.add(7*(e-t),"d")},ln.weeksInYear=function(){var e=this.localeData()._week;return Ae(this.year(),e.dow,e.doy)},ln.isoWeeksInYear=function(){return Ae(this.year(),1,4)},ln.date=nn,ln.day=ln.days=function(e){if(!this.isValid())return null!=e?this:NaN;var t,n,s=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=e?(t=e,n=this.localeData(),e="string"!=typeof t?t:isNaN(t)?"number"==typeof(t=n.weekdaysParse(t))?t:null:parseInt(t,10),this.add(e-s,"d")):s},ln.weekday=function(e){if(!this.isValid())return null!=e?this:NaN;var t=(this.day()+7-this.localeData()._week.dow)%7;return null==e?t:this.add(e-t,"d")},ln.isoWeekday=function(e){if(!this.isValid())return null!=e?this:NaN;if(null!=e){var t=(n=e,s=this.localeData(),"string"==typeof n?s.weekdaysParse(n)%7||7:isNaN(n)?null:n);return this.day(this.day()%7?t:t-7)}return this.day()||7;var n,s},ln.dayOfYear=function(e){var t=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==e?t:this.add(e-t,"d")},ln.hour=ln.hours=tt,ln.minute=ln.minutes=sn,ln.second=ln.seconds=an,ln.millisecond=ln.milliseconds=un,ln.utcOffset=function(e,t,n){var s,i=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(null===(e=Ut(re,e)))return this}else Math.abs(e)<16&&!n&&(e*=60);return!this._isUTC&&t&&(s=Gt(this)),this._offset=e,this._isUTC=!0,null!=s&&this.add(s,"m"),i!==e&&(!t||this._changeInProgress?$t(this,At(e-i,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,c.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?i:Gt(this)},ln.utc=function(e){return this.utcOffset(0,e)},ln.local=function(e){return this._isUTC&&(this.utcOffset(0,e),this._isUTC=!1,e&&this.subtract(Gt(this),"m")),this},ln.parseZone=function(){if(null!=this._tzm)this.utcOffset(this._tzm,!1,!0);else if("string"==typeof this._i){var e=Ut(ie,this._i);null!=e?this.utcOffset(e):this.utcOffset(0,!0)}return this},ln.hasAlignedHourOffset=function(e){return!!this.isValid()&&(e=e?Tt(e).utcOffset():0,(this.utcOffset()-e)%60==0)},ln.isDST=function(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},ln.isLocal=function(){return!!this.isValid()&&!this._isUTC},ln.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},ln.isUtc=Vt,ln.isUTC=Vt,ln.zoneAbbr=function(){return this._isUTC?"UTC":""},ln.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},ln.dates=n("dates accessor is deprecated. Use date instead.",nn),ln.months=n("months accessor is deprecated. Use month instead",Fe),ln.years=n("years accessor is deprecated. Use year instead",Oe),ln.zone=n("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",function(e,t){return null!=e?("string"!=typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()}),ln.isDSTShifted=n("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",function(){if(!l(this._isDSTShifted))return this._isDSTShifted;var e={};if(w(e,this),(e=Yt(e))._a){var t=e._isUTC?y(e._a):Tt(e._a);this._isDSTShifted=this.isValid()&&0<a(e._a,t.toArray())}else this._isDSTShifted=!1;return this._isDSTShifted});var hn=P.prototype;function cn(e,t,n,s){var i=lt(),r=y().set(s,t);return i[n](r,e)}function fn(e,t,n){if(d(e)&&(t=e,e=void 0),e=e||"",null!=t)return cn(e,t,n,"month");var s,i=[];for(s=0;s<12;s++)i[s]=cn(e,s,n,"month");return i}function mn(e,t,n,s){"boolean"==typeof e?d(t)&&(n=t,t=void 0):(t=e,e=!1,d(n=t)&&(n=t,t=void 0)),t=t||"";var i,r=lt(),a=e?r._week.dow:0;if(null!=n)return cn(t,(n+a)%7,s,"day");var o=[];for(i=0;i<7;i++)o[i]=cn(t,(i+a)%7,s,"day");return o}hn.calendar=function(e,t,n){var s=this._calendar[e]||this._calendar.sameElse;return x(s)?s.call(t,n):s},hn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.replace(/MMMM|MM|DD|dddd/g,function(e){return e.slice(1)}),this._longDateFormat[e])},hn.invalidDate=function(){return this._invalidDate},hn.ordinal=function(e){return this._ordinal.replace("%d",e)},hn.preparse=dn,hn.postformat=dn,hn.relativeTime=function(e,t,n,s){var i=this._relativeTime[n];return x(i)?i(e,t,n,s):i.replace(/%d/i,e)},hn.pastFuture=function(e,t){var n=this._relativeTime[0<e?"future":"past"];return x(n)?n(t):n.replace(/%s/i,t)},hn.set=function(e){var t,n;for(n in e)x(t=e[n])?this[n]=t:this["_"+n]=t;this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},hn.months=function(e,t){return e?o(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||We).test(t)?"format":"standalone"][e.month()]:o(this._months)?this._months:this._months.standalone},hn.monthsShort=function(e,t){return e?o(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[We.test(t)?"format":"standalone"][e.month()]:o(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},hn.monthsParse=function(e,t,n){var s,i,r;if(this._monthsParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],s=0;s<12;++s)r=y([2e3,s]),this._shortMonthsParse[s]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[s]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:"MMM"===t?-1!==(i=Ye.call(this._shortMonthsParse,a))?i:-1!==(i=Ye.call(this._longMonthsParse,a))?i:null:-1!==(i=Ye.call(this._longMonthsParse,a))?i:-1!==(i=Ye.call(this._shortMonthsParse,a))?i:null}.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),s=0;s<12;s++){if(i=y([2e3,s]),n&&!this._longMonthsParse[s]&&(this._longMonthsParse[s]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[s]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[s]||(r="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[s]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[s].test(e))return s;if(n&&"MMM"===t&&this._shortMonthsParse[s].test(e))return s;if(!n&&this._monthsParse[s].test(e))return s}},hn.monthsRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(m(this,"_monthsRegex")||(this._monthsRegex=Ue),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},hn.monthsShortRegex=function(e){return this._monthsParseExact?(m(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(m(this,"_monthsShortRegex")||(this._monthsShortRegex=Le),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},hn.week=function(e){return Ie(e,this._week.dow,this._week.doy).week},hn.firstDayOfYear=function(){return this._week.doy},hn.firstDayOfWeek=function(){return this._week.dow},hn.weekdays=function(e,t){return e?o(this._weekdays)?this._weekdays[e.day()]:this._weekdays[this._weekdays.isFormat.test(t)?"format":"standalone"][e.day()]:o(this._weekdays)?this._weekdays:this._weekdays.standalone},hn.weekdaysMin=function(e){return e?this._weekdaysMin[e.day()]:this._weekdaysMin},hn.weekdaysShort=function(e){return e?this._weekdaysShort[e.day()]:this._weekdaysShort},hn.weekdaysParse=function(e,t,n){var s,i,r;if(this._weekdaysParseExact)return function(e,t,n){var s,i,r,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],s=0;s<7;++s)r=y([2e3,1]).day(s),this._minWeekdaysParse[s]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[s]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[s]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:null:-1!==(i=Ye.call(this._minWeekdaysParse,a))?i:-1!==(i=Ye.call(this._weekdaysParse,a))?i:-1!==(i=Ye.call(this._shortWeekdaysParse,a))?i:null}.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),s=0;s<7;s++){if(i=y([2e3,1]).day(s),n&&!this._fullWeekdaysParse[s]&&(this._fullWeekdaysParse[s]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[s]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[s]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[s]||(r="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[s]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[s].test(e))return s;if(n&&"ddd"===t&&this._shortWeekdaysParse[s].test(e))return s;if(n&&"dd"===t&&this._minWeekdaysParse[s].test(e))return s;if(!n&&this._weekdaysParse[s].test(e))return s}},hn.weekdaysRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(m(this,"_weekdaysRegex")||(this._weekdaysRegex=$e),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},hn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(m(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=qe),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},hn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(m(this,"_weekdaysRegex")||Be.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(m(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Je),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},hn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},hn.meridiem=function(e,t,n){return 11<e?n?"pm":"PM":n?"am":"AM"},ot("en",{dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===k(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),c.lang=n("moment.lang is deprecated. Use moment.locale instead.",ot),c.langData=n("moment.langData is deprecated. Use moment.localeData instead.",lt);var _n=Math.abs;function yn(e,t,n,s){var i=At(t,n);return e._milliseconds+=s*i._milliseconds,e._days+=s*i._days,e._months+=s*i._months,e._bubble()}function gn(e){return e<0?Math.floor(e):Math.ceil(e)}function pn(e){return 4800*e/146097}function vn(e){return 146097*e/4800}function wn(e){return function(){return this.as(e)}}var Mn=wn("ms"),Sn=wn("s"),Dn=wn("m"),kn=wn("h"),Yn=wn("d"),On=wn("w"),Tn=wn("M"),xn=wn("y");function bn(e){return function(){return this.isValid()?this._data[e]:NaN}}var Pn=bn("milliseconds"),Wn=bn("seconds"),Hn=bn("minutes"),Rn=bn("hours"),Cn=bn("days"),Fn=bn("months"),Ln=bn("years");var Un=Math.round,Nn={ss:44,s:45,m:45,h:22,d:26,M:11};var Gn=Math.abs;function Vn(e){return(0<e)-(e<0)||+e}function En(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n=Gn(this._milliseconds)/1e3,s=Gn(this._days),i=Gn(this._months);t=D((e=D(n/60))/60),n%=60,e%=60;var r=D(i/12),a=i%=12,o=s,u=t,l=e,d=n?n.toFixed(3).replace(/\.?0+$/,""):"",h=this.asSeconds();if(!h)return"P0D";var c=h<0?"-":"",f=Vn(this._months)!==Vn(h)?"-":"",m=Vn(this._days)!==Vn(h)?"-":"",_=Vn(this._milliseconds)!==Vn(h)?"-":"";return c+"P"+(r?f+r+"Y":"")+(a?f+a+"M":"")+(o?m+o+"D":"")+(u||l||d?"T":"")+(u?_+u+"H":"")+(l?_+l+"M":"")+(d?_+d+"S":"")}var In=Ht.prototype;return In.isValid=function(){return this._isValid},In.abs=function(){var e=this._data;return this._milliseconds=_n(this._milliseconds),this._days=_n(this._days),this._months=_n(this._months),e.milliseconds=_n(e.milliseconds),e.seconds=_n(e.seconds),e.minutes=_n(e.minutes),e.hours=_n(e.hours),e.months=_n(e.months),e.years=_n(e.years),this},In.add=function(e,t){return yn(this,e,t,1)},In.subtract=function(e,t){return yn(this,e,t,-1)},In.as=function(e){if(!this.isValid())return NaN;var t,n,s=this._milliseconds;if("month"===(e=R(e))||"year"===e)return t=this._days+s/864e5,n=this._months+pn(t),"month"===e?n:n/12;switch(t=this._days+Math.round(vn(this._months)),e){case"week":return t/7+s/6048e5;case"day":return t+s/864e5;case"hour":return 24*t+s/36e5;case"minute":return 1440*t+s/6e4;case"second":return 86400*t+s/1e3;case"millisecond":return Math.floor(864e5*t)+s;default:throw new Error("Unknown unit "+e)}},In.asMilliseconds=Mn,In.asSeconds=Sn,In.asMinutes=Dn,In.asHours=kn,In.asDays=Yn,In.asWeeks=On,In.asMonths=Tn,In.asYears=xn,In.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*k(this._months/12):NaN},In._bubble=function(){var e,t,n,s,i,r=this._milliseconds,a=this._days,o=this._months,u=this._data;return 0<=r&&0<=a&&0<=o||r<=0&&a<=0&&o<=0||(r+=864e5*gn(vn(o)+a),o=a=0),u.milliseconds=r%1e3,e=D(r/1e3),u.seconds=e%60,t=D(e/60),u.minutes=t%60,n=D(t/60),u.hours=n%24,o+=i=D(pn(a+=D(n/24))),a-=gn(vn(i)),s=D(o/12),o%=12,u.days=a,u.months=o,u.years=s,this},In.clone=function(){return At(this)},In.get=function(e){return e=R(e),this.isValid()?this[e+"s"]():NaN},In.milliseconds=Pn,In.seconds=Wn,In.minutes=Hn,In.hours=Rn,In.days=Cn,In.weeks=function(){return D(this.days()/7)},In.months=Fn,In.years=Ln,In.humanize=function(e){if(!this.isValid())return this.localeData().invalidDate();var t,n,s,i,r,a,o,u,l,d,h,c=this.localeData(),f=(n=!e,s=c,i=At(t=this).abs(),r=Un(i.as("s")),a=Un(i.as("m")),o=Un(i.as("h")),u=Un(i.as("d")),l=Un(i.as("M")),d=Un(i.as("y")),(h=r<=Nn.ss&&["s",r]||r<Nn.s&&["ss",r]||a<=1&&["m"]||a<Nn.m&&["mm",a]||o<=1&&["h"]||o<Nn.h&&["hh",o]||u<=1&&["d"]||u<Nn.d&&["dd",u]||l<=1&&["M"]||l<Nn.M&&["MM",l]||d<=1&&["y"]||["yy",d])[2]=n,h[3]=0<+t,h[4]=s,function(e,t,n,s,i){return i.relativeTime(t||1,!!n,e,s)}.apply(null,h));return e&&(f=c.pastFuture(+this,f)),c.postformat(f)},In.toISOString=En,In.toString=En,In.toJSON=En,In.locale=Qt,In.localeData=Kt,In.toIsoString=n("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",En),In.lang=Xt,I("X",0,0,"unix"),I("x",0,0,"valueOf"),ue("x",se),ue("X",/[+-]?\d+(\.\d{1,3})?/),ce("X",function(e,t,n){n._d=new Date(1e3*parseFloat(e,10))}),ce("x",function(e,t,n){n._d=new Date(k(e))}),c.version="2.22.2",e=Tt,c.fn=ln,c.min=function(){return Pt("isBefore",[].slice.call(arguments,0))},c.max=function(){return Pt("isAfter",[].slice.call(arguments,0))},c.now=function(){return Date.now?Date.now():+new Date},c.utc=y,c.unix=function(e){return Tt(1e3*e)},c.months=function(e,t){return fn(e,t,"months")},c.isDate=h,c.locale=ot,c.invalid=v,c.duration=At,c.isMoment=S,c.weekdays=function(e,t,n){return mn(e,t,n,"weekdays")},c.parseZone=function(){return Tt.apply(null,arguments).parseZone()},c.localeData=lt,c.isDuration=Rt,c.monthsShort=function(e,t){return fn(e,t,"monthsShort")},c.weekdaysMin=function(e,t,n){return mn(e,t,n,"weekdaysMin")},c.defineLocale=ut,c.updateLocale=function(e,t){if(null!=t){var n,s,i=nt;null!=(s=at(e))&&(i=s._config),(n=new P(t=b(i,t))).parentLocale=st[e],st[e]=n,ot(e)}else null!=st[e]&&(null!=st[e].parentLocale?st[e]=st[e].parentLocale:null!=st[e]&&delete st[e]);return st[e]},c.locales=function(){return s(st)},c.weekdaysShort=function(e,t,n){return mn(e,t,n,"weekdaysShort")},c.normalizeUnits=R,c.relativeTimeRounding=function(e){return void 0===e?Un:"function"==typeof e&&(Un=e,!0)},c.relativeTimeThreshold=function(e,t){return void 0!==Nn[e]&&(void 0===t?Nn[e]:(Nn[e]=t,"s"===e&&(Nn.ss=t-1),!0))},c.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},c.prototype=ln,c.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"YYYY-[W]WW",MONTH:"YYYY-MM"},c});
|
@@ -1,1044 +0,0 @@
|
|
1
|
-
/*global define:false */
|
2
|
-
/**
|
3
|
-
* Copyright 2016 Craig Campbell
|
4
|
-
*
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
* you may not use this file except in compliance with the License.
|
7
|
-
* You may obtain a copy of the License at
|
8
|
-
*
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
*
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
* See the License for the specific language governing permissions and
|
15
|
-
* limitations under the License.
|
16
|
-
*
|
17
|
-
* Mousetrap is a simple keyboard shortcut library for Javascript with
|
18
|
-
* no external dependencies
|
19
|
-
*
|
20
|
-
* @version 1.6.0
|
21
|
-
* @url craig.is/killing/mice
|
22
|
-
*/
|
23
|
-
(function(window, document, undefined) {
|
24
|
-
|
25
|
-
// Check if mousetrap is used inside browser, if not, return
|
26
|
-
if (!window) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
|
30
|
-
/**
|
31
|
-
* mapping of special keycodes to their corresponding keys
|
32
|
-
*
|
33
|
-
* everything in this dictionary cannot use keypress events
|
34
|
-
* so it has to be here to map to the correct keycodes for
|
35
|
-
* keyup/keydown events
|
36
|
-
*
|
37
|
-
* @type {Object}
|
38
|
-
*/
|
39
|
-
var _MAP = {
|
40
|
-
8: 'backspace',
|
41
|
-
9: 'tab',
|
42
|
-
13: 'enter',
|
43
|
-
16: 'shift',
|
44
|
-
17: 'ctrl',
|
45
|
-
18: 'alt',
|
46
|
-
20: 'capslock',
|
47
|
-
27: 'esc',
|
48
|
-
32: 'space',
|
49
|
-
33: 'pageup',
|
50
|
-
34: 'pagedown',
|
51
|
-
35: 'end',
|
52
|
-
36: 'home',
|
53
|
-
37: 'left',
|
54
|
-
38: 'up',
|
55
|
-
39: 'right',
|
56
|
-
40: 'down',
|
57
|
-
45: 'ins',
|
58
|
-
46: 'del',
|
59
|
-
91: 'meta',
|
60
|
-
93: 'meta',
|
61
|
-
224: 'meta'
|
62
|
-
};
|
63
|
-
|
64
|
-
/**
|
65
|
-
* mapping for special characters so they can support
|
66
|
-
*
|
67
|
-
* this dictionary is only used incase you want to bind a
|
68
|
-
* keyup or keydown event to one of these keys
|
69
|
-
*
|
70
|
-
* @type {Object}
|
71
|
-
*/
|
72
|
-
var _KEYCODE_MAP = {
|
73
|
-
106: '*',
|
74
|
-
107: '+',
|
75
|
-
109: '-',
|
76
|
-
110: '.',
|
77
|
-
111 : '/',
|
78
|
-
186: ';',
|
79
|
-
187: '=',
|
80
|
-
188: ',',
|
81
|
-
189: '-',
|
82
|
-
190: '.',
|
83
|
-
191: '/',
|
84
|
-
192: '`',
|
85
|
-
219: '[',
|
86
|
-
220: '\\',
|
87
|
-
221: ']',
|
88
|
-
222: '\''
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* this is a mapping of keys that require shift on a US keypad
|
93
|
-
* back to the non shift equivelents
|
94
|
-
*
|
95
|
-
* this is so you can use keyup events with these keys
|
96
|
-
*
|
97
|
-
* note that this will only work reliably on US keyboards
|
98
|
-
*
|
99
|
-
* @type {Object}
|
100
|
-
*/
|
101
|
-
var _SHIFT_MAP = {
|
102
|
-
'~': '`',
|
103
|
-
'!': '1',
|
104
|
-
'@': '2',
|
105
|
-
'#': '3',
|
106
|
-
'$': '4',
|
107
|
-
'%': '5',
|
108
|
-
'^': '6',
|
109
|
-
'&': '7',
|
110
|
-
'*': '8',
|
111
|
-
'(': '9',
|
112
|
-
')': '0',
|
113
|
-
'_': '-',
|
114
|
-
'+': '=',
|
115
|
-
':': ';',
|
116
|
-
'\"': '\'',
|
117
|
-
'<': ',',
|
118
|
-
'>': '.',
|
119
|
-
'?': '/',
|
120
|
-
'|': '\\'
|
121
|
-
};
|
122
|
-
|
123
|
-
/**
|
124
|
-
* this is a list of special strings you can use to map
|
125
|
-
* to modifier keys when you specify your keyboard shortcuts
|
126
|
-
*
|
127
|
-
* @type {Object}
|
128
|
-
*/
|
129
|
-
var _SPECIAL_ALIASES = {
|
130
|
-
'option': 'alt',
|
131
|
-
'command': 'meta',
|
132
|
-
'return': 'enter',
|
133
|
-
'escape': 'esc',
|
134
|
-
'plus': '+',
|
135
|
-
'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
|
136
|
-
};
|
137
|
-
|
138
|
-
/**
|
139
|
-
* variable to store the flipped version of _MAP from above
|
140
|
-
* needed to check if we should use keypress or not when no action
|
141
|
-
* is specified
|
142
|
-
*
|
143
|
-
* @type {Object|undefined}
|
144
|
-
*/
|
145
|
-
var _REVERSE_MAP;
|
146
|
-
|
147
|
-
/**
|
148
|
-
* loop through the f keys, f1 to f19 and add them to the map
|
149
|
-
* programatically
|
150
|
-
*/
|
151
|
-
for (var i = 1; i < 20; ++i) {
|
152
|
-
_MAP[111 + i] = 'f' + i;
|
153
|
-
}
|
154
|
-
|
155
|
-
/**
|
156
|
-
* loop through to map numbers on the numeric keypad
|
157
|
-
*/
|
158
|
-
for (i = 0; i <= 9; ++i) {
|
159
|
-
|
160
|
-
// This needs to use a string cause otherwise since 0 is falsey
|
161
|
-
// mousetrap will never fire for numpad 0 pressed as part of a keydown
|
162
|
-
// event.
|
163
|
-
//
|
164
|
-
// @see https://github.com/ccampbell/mousetrap/pull/258
|
165
|
-
_MAP[i + 96] = i.toString();
|
166
|
-
}
|
167
|
-
|
168
|
-
/**
|
169
|
-
* cross browser add event method
|
170
|
-
*
|
171
|
-
* @param {Element|HTMLDocument} object
|
172
|
-
* @param {string} type
|
173
|
-
* @param {Function} callback
|
174
|
-
* @returns void
|
175
|
-
*/
|
176
|
-
function _addEvent(object, type, callback) {
|
177
|
-
if (object.addEventListener) {
|
178
|
-
object.addEventListener(type, callback, false);
|
179
|
-
return;
|
180
|
-
}
|
181
|
-
|
182
|
-
object.attachEvent('on' + type, callback);
|
183
|
-
}
|
184
|
-
|
185
|
-
/**
|
186
|
-
* takes the event and returns the key character
|
187
|
-
*
|
188
|
-
* @param {Event} e
|
189
|
-
* @return {string}
|
190
|
-
*/
|
191
|
-
function _characterFromEvent(e) {
|
192
|
-
|
193
|
-
// for keypress events we should return the character as is
|
194
|
-
if (e.type == 'keypress') {
|
195
|
-
var character = String.fromCharCode(e.which);
|
196
|
-
|
197
|
-
// if the shift key is not pressed then it is safe to assume
|
198
|
-
// that we want the character to be lowercase. this means if
|
199
|
-
// you accidentally have caps lock on then your key bindings
|
200
|
-
// will continue to work
|
201
|
-
//
|
202
|
-
// the only side effect that might not be desired is if you
|
203
|
-
// bind something like 'A' cause you want to trigger an
|
204
|
-
// event when capital A is pressed caps lock will no longer
|
205
|
-
// trigger the event. shift+a will though.
|
206
|
-
if (!e.shiftKey) {
|
207
|
-
character = character.toLowerCase();
|
208
|
-
}
|
209
|
-
|
210
|
-
return character;
|
211
|
-
}
|
212
|
-
|
213
|
-
// for non keypress events the special maps are needed
|
214
|
-
if (_MAP[e.which]) {
|
215
|
-
return _MAP[e.which];
|
216
|
-
}
|
217
|
-
|
218
|
-
if (_KEYCODE_MAP[e.which]) {
|
219
|
-
return _KEYCODE_MAP[e.which];
|
220
|
-
}
|
221
|
-
|
222
|
-
// if it is not in the special map
|
223
|
-
|
224
|
-
// with keydown and keyup events the character seems to always
|
225
|
-
// come in as an uppercase character whether you are pressing shift
|
226
|
-
// or not. we should make sure it is always lowercase for comparisons
|
227
|
-
return String.fromCharCode(e.which).toLowerCase();
|
228
|
-
}
|
229
|
-
|
230
|
-
/**
|
231
|
-
* checks if two arrays are equal
|
232
|
-
*
|
233
|
-
* @param {Array} modifiers1
|
234
|
-
* @param {Array} modifiers2
|
235
|
-
* @returns {boolean}
|
236
|
-
*/
|
237
|
-
function _modifiersMatch(modifiers1, modifiers2) {
|
238
|
-
return modifiers1.sort().join(',') === modifiers2.sort().join(',');
|
239
|
-
}
|
240
|
-
|
241
|
-
/**
|
242
|
-
* takes a key event and figures out what the modifiers are
|
243
|
-
*
|
244
|
-
* @param {Event} e
|
245
|
-
* @returns {Array}
|
246
|
-
*/
|
247
|
-
function _eventModifiers(e) {
|
248
|
-
var modifiers = [];
|
249
|
-
|
250
|
-
if (e.shiftKey) {
|
251
|
-
modifiers.push('shift');
|
252
|
-
}
|
253
|
-
|
254
|
-
if (e.altKey) {
|
255
|
-
modifiers.push('alt');
|
256
|
-
}
|
257
|
-
|
258
|
-
if (e.ctrlKey) {
|
259
|
-
modifiers.push('ctrl');
|
260
|
-
}
|
261
|
-
|
262
|
-
if (e.metaKey) {
|
263
|
-
modifiers.push('meta');
|
264
|
-
}
|
265
|
-
|
266
|
-
return modifiers;
|
267
|
-
}
|
268
|
-
|
269
|
-
/**
|
270
|
-
* prevents default for this event
|
271
|
-
*
|
272
|
-
* @param {Event} e
|
273
|
-
* @returns void
|
274
|
-
*/
|
275
|
-
function _preventDefault(e) {
|
276
|
-
if (e.preventDefault) {
|
277
|
-
e.preventDefault();
|
278
|
-
return;
|
279
|
-
}
|
280
|
-
|
281
|
-
e.returnValue = false;
|
282
|
-
}
|
283
|
-
|
284
|
-
/**
|
285
|
-
* stops propogation for this event
|
286
|
-
*
|
287
|
-
* @param {Event} e
|
288
|
-
* @returns void
|
289
|
-
*/
|
290
|
-
function _stopPropagation(e) {
|
291
|
-
if (e.stopPropagation) {
|
292
|
-
e.stopPropagation();
|
293
|
-
return;
|
294
|
-
}
|
295
|
-
|
296
|
-
e.cancelBubble = true;
|
297
|
-
}
|
298
|
-
|
299
|
-
/**
|
300
|
-
* determines if the keycode specified is a modifier key or not
|
301
|
-
*
|
302
|
-
* @param {string} key
|
303
|
-
* @returns {boolean}
|
304
|
-
*/
|
305
|
-
function _isModifier(key) {
|
306
|
-
return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
|
307
|
-
}
|
308
|
-
|
309
|
-
/**
|
310
|
-
* reverses the map lookup so that we can look for specific keys
|
311
|
-
* to see what can and can't use keypress
|
312
|
-
*
|
313
|
-
* @return {Object}
|
314
|
-
*/
|
315
|
-
function _getReverseMap() {
|
316
|
-
if (!_REVERSE_MAP) {
|
317
|
-
_REVERSE_MAP = {};
|
318
|
-
for (var key in _MAP) {
|
319
|
-
|
320
|
-
// pull out the numeric keypad from here cause keypress should
|
321
|
-
// be able to detect the keys from the character
|
322
|
-
if (key > 95 && key < 112) {
|
323
|
-
continue;
|
324
|
-
}
|
325
|
-
|
326
|
-
if (_MAP.hasOwnProperty(key)) {
|
327
|
-
_REVERSE_MAP[_MAP[key]] = key;
|
328
|
-
}
|
329
|
-
}
|
330
|
-
}
|
331
|
-
return _REVERSE_MAP;
|
332
|
-
}
|
333
|
-
|
334
|
-
/**
|
335
|
-
* picks the best action based on the key combination
|
336
|
-
*
|
337
|
-
* @param {string} key - character for key
|
338
|
-
* @param {Array} modifiers
|
339
|
-
* @param {string=} action passed in
|
340
|
-
*/
|
341
|
-
function _pickBestAction(key, modifiers, action) {
|
342
|
-
|
343
|
-
// if no action was picked in we should try to pick the one
|
344
|
-
// that we think would work best for this key
|
345
|
-
if (!action) {
|
346
|
-
action = _getReverseMap()[key] ? 'keydown' : 'keypress';
|
347
|
-
}
|
348
|
-
|
349
|
-
// modifier keys don't work as expected with keypress,
|
350
|
-
// switch to keydown
|
351
|
-
if (action == 'keypress' && modifiers.length) {
|
352
|
-
action = 'keydown';
|
353
|
-
}
|
354
|
-
|
355
|
-
return action;
|
356
|
-
}
|
357
|
-
|
358
|
-
/**
|
359
|
-
* Converts from a string key combination to an array
|
360
|
-
*
|
361
|
-
* @param {string} combination like "command+shift+l"
|
362
|
-
* @return {Array}
|
363
|
-
*/
|
364
|
-
function _keysFromString(combination) {
|
365
|
-
if (combination === '+') {
|
366
|
-
return ['+'];
|
367
|
-
}
|
368
|
-
|
369
|
-
combination = combination.replace(/\+{2}/g, '+plus');
|
370
|
-
return combination.split('+');
|
371
|
-
}
|
372
|
-
|
373
|
-
/**
|
374
|
-
* Gets info for a specific key combination
|
375
|
-
*
|
376
|
-
* @param {string} combination key combination ("command+s" or "a" or "*")
|
377
|
-
* @param {string=} action
|
378
|
-
* @returns {Object}
|
379
|
-
*/
|
380
|
-
function _getKeyInfo(combination, action) {
|
381
|
-
var keys;
|
382
|
-
var key;
|
383
|
-
var i;
|
384
|
-
var modifiers = [];
|
385
|
-
|
386
|
-
// take the keys from this pattern and figure out what the actual
|
387
|
-
// pattern is all about
|
388
|
-
keys = _keysFromString(combination);
|
389
|
-
|
390
|
-
for (i = 0; i < keys.length; ++i) {
|
391
|
-
key = keys[i];
|
392
|
-
|
393
|
-
// normalize key names
|
394
|
-
if (_SPECIAL_ALIASES[key]) {
|
395
|
-
key = _SPECIAL_ALIASES[key];
|
396
|
-
}
|
397
|
-
|
398
|
-
// if this is not a keypress event then we should
|
399
|
-
// be smart about using shift keys
|
400
|
-
// this will only work for US keyboards however
|
401
|
-
if (action && action != 'keypress' && _SHIFT_MAP[key]) {
|
402
|
-
key = _SHIFT_MAP[key];
|
403
|
-
modifiers.push('shift');
|
404
|
-
}
|
405
|
-
|
406
|
-
// if this key is a modifier then add it to the list of modifiers
|
407
|
-
if (_isModifier(key)) {
|
408
|
-
modifiers.push(key);
|
409
|
-
}
|
410
|
-
}
|
411
|
-
|
412
|
-
// depending on what the key combination is
|
413
|
-
// we will try to pick the best event for it
|
414
|
-
action = _pickBestAction(key, modifiers, action);
|
415
|
-
|
416
|
-
return {
|
417
|
-
key: key,
|
418
|
-
modifiers: modifiers,
|
419
|
-
action: action
|
420
|
-
};
|
421
|
-
}
|
422
|
-
|
423
|
-
function _belongsTo(element, ancestor) {
|
424
|
-
if (element === null || element === document) {
|
425
|
-
return false;
|
426
|
-
}
|
427
|
-
|
428
|
-
if (element === ancestor) {
|
429
|
-
return true;
|
430
|
-
}
|
431
|
-
|
432
|
-
return _belongsTo(element.parentNode, ancestor);
|
433
|
-
}
|
434
|
-
|
435
|
-
function Mousetrap(targetElement) {
|
436
|
-
var self = this;
|
437
|
-
|
438
|
-
targetElement = targetElement || document;
|
439
|
-
|
440
|
-
if (!(self instanceof Mousetrap)) {
|
441
|
-
return new Mousetrap(targetElement);
|
442
|
-
}
|
443
|
-
|
444
|
-
/**
|
445
|
-
* element to attach key events to
|
446
|
-
*
|
447
|
-
* @type {Element}
|
448
|
-
*/
|
449
|
-
self.target = targetElement;
|
450
|
-
|
451
|
-
/**
|
452
|
-
* a list of all the callbacks setup via Mousetrap.bind()
|
453
|
-
*
|
454
|
-
* @type {Object}
|
455
|
-
*/
|
456
|
-
self._callbacks = {};
|
457
|
-
|
458
|
-
/**
|
459
|
-
* direct map of string combinations to callbacks used for trigger()
|
460
|
-
*
|
461
|
-
* @type {Object}
|
462
|
-
*/
|
463
|
-
self._directMap = {};
|
464
|
-
|
465
|
-
/**
|
466
|
-
* keeps track of what level each sequence is at since multiple
|
467
|
-
* sequences can start out with the same sequence
|
468
|
-
*
|
469
|
-
* @type {Object}
|
470
|
-
*/
|
471
|
-
var _sequenceLevels = {};
|
472
|
-
|
473
|
-
/**
|
474
|
-
* variable to store the setTimeout call
|
475
|
-
*
|
476
|
-
* @type {null|number}
|
477
|
-
*/
|
478
|
-
var _resetTimer;
|
479
|
-
|
480
|
-
/**
|
481
|
-
* temporary state where we will ignore the next keyup
|
482
|
-
*
|
483
|
-
* @type {boolean|string}
|
484
|
-
*/
|
485
|
-
var _ignoreNextKeyup = false;
|
486
|
-
|
487
|
-
/**
|
488
|
-
* temporary state where we will ignore the next keypress
|
489
|
-
*
|
490
|
-
* @type {boolean}
|
491
|
-
*/
|
492
|
-
var _ignoreNextKeypress = false;
|
493
|
-
|
494
|
-
/**
|
495
|
-
* are we currently inside of a sequence?
|
496
|
-
* type of action ("keyup" or "keydown" or "keypress") or false
|
497
|
-
*
|
498
|
-
* @type {boolean|string}
|
499
|
-
*/
|
500
|
-
var _nextExpectedAction = false;
|
501
|
-
|
502
|
-
/**
|
503
|
-
* resets all sequence counters except for the ones passed in
|
504
|
-
*
|
505
|
-
* @param {Object} doNotReset
|
506
|
-
* @returns void
|
507
|
-
*/
|
508
|
-
function _resetSequences(doNotReset) {
|
509
|
-
doNotReset = doNotReset || {};
|
510
|
-
|
511
|
-
var activeSequences = false,
|
512
|
-
key;
|
513
|
-
|
514
|
-
for (key in _sequenceLevels) {
|
515
|
-
if (doNotReset[key]) {
|
516
|
-
activeSequences = true;
|
517
|
-
continue;
|
518
|
-
}
|
519
|
-
_sequenceLevels[key] = 0;
|
520
|
-
}
|
521
|
-
|
522
|
-
if (!activeSequences) {
|
523
|
-
_nextExpectedAction = false;
|
524
|
-
}
|
525
|
-
}
|
526
|
-
|
527
|
-
/**
|
528
|
-
* finds all callbacks that match based on the keycode, modifiers,
|
529
|
-
* and action
|
530
|
-
*
|
531
|
-
* @param {string} character
|
532
|
-
* @param {Array} modifiers
|
533
|
-
* @param {Event|Object} e
|
534
|
-
* @param {string=} sequenceName - name of the sequence we are looking for
|
535
|
-
* @param {string=} combination
|
536
|
-
* @param {number=} level
|
537
|
-
* @returns {Array}
|
538
|
-
*/
|
539
|
-
function _getMatches(character, modifiers, e, sequenceName, combination, level) {
|
540
|
-
var i;
|
541
|
-
var callback;
|
542
|
-
var matches = [];
|
543
|
-
var action = e.type;
|
544
|
-
|
545
|
-
// if there are no events related to this keycode
|
546
|
-
if (!self._callbacks[character]) {
|
547
|
-
return [];
|
548
|
-
}
|
549
|
-
|
550
|
-
// if a modifier key is coming up on its own we should allow it
|
551
|
-
if (action == 'keyup' && _isModifier(character)) {
|
552
|
-
modifiers = [character];
|
553
|
-
}
|
554
|
-
|
555
|
-
// loop through all callbacks for the key that was pressed
|
556
|
-
// and see if any of them match
|
557
|
-
for (i = 0; i < self._callbacks[character].length; ++i) {
|
558
|
-
callback = self._callbacks[character][i];
|
559
|
-
|
560
|
-
// if a sequence name is not specified, but this is a sequence at
|
561
|
-
// the wrong level then move onto the next match
|
562
|
-
if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
|
563
|
-
continue;
|
564
|
-
}
|
565
|
-
|
566
|
-
// if the action we are looking for doesn't match the action we got
|
567
|
-
// then we should keep going
|
568
|
-
if (action != callback.action) {
|
569
|
-
continue;
|
570
|
-
}
|
571
|
-
|
572
|
-
// if this is a keypress event and the meta key and control key
|
573
|
-
// are not pressed that means that we need to only look at the
|
574
|
-
// character, otherwise check the modifiers as well
|
575
|
-
//
|
576
|
-
// chrome will not fire a keypress if meta or control is down
|
577
|
-
// safari will fire a keypress if meta or meta+shift is down
|
578
|
-
// firefox will fire a keypress if meta or control is down
|
579
|
-
if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
|
580
|
-
|
581
|
-
// when you bind a combination or sequence a second time it
|
582
|
-
// should overwrite the first one. if a sequenceName or
|
583
|
-
// combination is specified in this call it does just that
|
584
|
-
//
|
585
|
-
// @todo make deleting its own method?
|
586
|
-
var deleteCombo = !sequenceName && callback.combo == combination;
|
587
|
-
var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
|
588
|
-
if (deleteCombo || deleteSequence) {
|
589
|
-
self._callbacks[character].splice(i, 1);
|
590
|
-
}
|
591
|
-
|
592
|
-
matches.push(callback);
|
593
|
-
}
|
594
|
-
}
|
595
|
-
|
596
|
-
return matches;
|
597
|
-
}
|
598
|
-
|
599
|
-
/**
|
600
|
-
* actually calls the callback function
|
601
|
-
*
|
602
|
-
* if your callback function returns false this will use the jquery
|
603
|
-
* convention - prevent default and stop propogation on the event
|
604
|
-
*
|
605
|
-
* @param {Function} callback
|
606
|
-
* @param {Event} e
|
607
|
-
* @returns void
|
608
|
-
*/
|
609
|
-
function _fireCallback(callback, e, combo, sequence) {
|
610
|
-
|
611
|
-
// if this event should not happen stop here
|
612
|
-
if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
|
613
|
-
return;
|
614
|
-
}
|
615
|
-
|
616
|
-
if (callback(e, combo) === false) {
|
617
|
-
_preventDefault(e);
|
618
|
-
_stopPropagation(e);
|
619
|
-
}
|
620
|
-
}
|
621
|
-
|
622
|
-
/**
|
623
|
-
* handles a character key event
|
624
|
-
*
|
625
|
-
* @param {string} character
|
626
|
-
* @param {Array} modifiers
|
627
|
-
* @param {Event} e
|
628
|
-
* @returns void
|
629
|
-
*/
|
630
|
-
self._handleKey = function(character, modifiers, e) {
|
631
|
-
var callbacks = _getMatches(character, modifiers, e);
|
632
|
-
var i;
|
633
|
-
var doNotReset = {};
|
634
|
-
var maxLevel = 0;
|
635
|
-
var processedSequenceCallback = false;
|
636
|
-
|
637
|
-
// Calculate the maxLevel for sequences so we can only execute the longest callback sequence
|
638
|
-
for (i = 0; i < callbacks.length; ++i) {
|
639
|
-
if (callbacks[i].seq) {
|
640
|
-
maxLevel = Math.max(maxLevel, callbacks[i].level);
|
641
|
-
}
|
642
|
-
}
|
643
|
-
|
644
|
-
// loop through matching callbacks for this key event
|
645
|
-
for (i = 0; i < callbacks.length; ++i) {
|
646
|
-
|
647
|
-
// fire for all sequence callbacks
|
648
|
-
// this is because if for example you have multiple sequences
|
649
|
-
// bound such as "g i" and "g t" they both need to fire the
|
650
|
-
// callback for matching g cause otherwise you can only ever
|
651
|
-
// match the first one
|
652
|
-
if (callbacks[i].seq) {
|
653
|
-
|
654
|
-
// only fire callbacks for the maxLevel to prevent
|
655
|
-
// subsequences from also firing
|
656
|
-
//
|
657
|
-
// for example 'a option b' should not cause 'option b' to fire
|
658
|
-
// even though 'option b' is part of the other sequence
|
659
|
-
//
|
660
|
-
// any sequences that do not match here will be discarded
|
661
|
-
// below by the _resetSequences call
|
662
|
-
if (callbacks[i].level != maxLevel) {
|
663
|
-
continue;
|
664
|
-
}
|
665
|
-
|
666
|
-
processedSequenceCallback = true;
|
667
|
-
|
668
|
-
// keep a list of which sequences were matches for later
|
669
|
-
doNotReset[callbacks[i].seq] = 1;
|
670
|
-
_fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
|
671
|
-
continue;
|
672
|
-
}
|
673
|
-
|
674
|
-
// if there were no sequence matches but we are still here
|
675
|
-
// that means this is a regular match so we should fire that
|
676
|
-
if (!processedSequenceCallback) {
|
677
|
-
_fireCallback(callbacks[i].callback, e, callbacks[i].combo);
|
678
|
-
}
|
679
|
-
}
|
680
|
-
|
681
|
-
// if the key you pressed matches the type of sequence without
|
682
|
-
// being a modifier (ie "keyup" or "keypress") then we should
|
683
|
-
// reset all sequences that were not matched by this event
|
684
|
-
//
|
685
|
-
// this is so, for example, if you have the sequence "h a t" and you
|
686
|
-
// type "h e a r t" it does not match. in this case the "e" will
|
687
|
-
// cause the sequence to reset
|
688
|
-
//
|
689
|
-
// modifier keys are ignored because you can have a sequence
|
690
|
-
// that contains modifiers such as "enter ctrl+space" and in most
|
691
|
-
// cases the modifier key will be pressed before the next key
|
692
|
-
//
|
693
|
-
// also if you have a sequence such as "ctrl+b a" then pressing the
|
694
|
-
// "b" key will trigger a "keypress" and a "keydown"
|
695
|
-
//
|
696
|
-
// the "keydown" is expected when there is a modifier, but the
|
697
|
-
// "keypress" ends up matching the _nextExpectedAction since it occurs
|
698
|
-
// after and that causes the sequence to reset
|
699
|
-
//
|
700
|
-
// we ignore keypresses in a sequence that directly follow a keydown
|
701
|
-
// for the same character
|
702
|
-
var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
|
703
|
-
if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
|
704
|
-
_resetSequences(doNotReset);
|
705
|
-
}
|
706
|
-
|
707
|
-
_ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
|
708
|
-
};
|
709
|
-
|
710
|
-
/**
|
711
|
-
* handles a keydown event
|
712
|
-
*
|
713
|
-
* @param {Event} e
|
714
|
-
* @returns void
|
715
|
-
*/
|
716
|
-
function _handleKeyEvent(e) {
|
717
|
-
|
718
|
-
// normalize e.which for key events
|
719
|
-
// @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
|
720
|
-
if (typeof e.which !== 'number') {
|
721
|
-
e.which = e.keyCode;
|
722
|
-
}
|
723
|
-
|
724
|
-
var character = _characterFromEvent(e);
|
725
|
-
|
726
|
-
// no character found then stop
|
727
|
-
if (!character) {
|
728
|
-
return;
|
729
|
-
}
|
730
|
-
|
731
|
-
// need to use === for the character check because the character can be 0
|
732
|
-
if (e.type == 'keyup' && _ignoreNextKeyup === character) {
|
733
|
-
_ignoreNextKeyup = false;
|
734
|
-
return;
|
735
|
-
}
|
736
|
-
|
737
|
-
self.handleKey(character, _eventModifiers(e), e);
|
738
|
-
}
|
739
|
-
|
740
|
-
/**
|
741
|
-
* called to set a 1 second timeout on the specified sequence
|
742
|
-
*
|
743
|
-
* this is so after each key press in the sequence you have 1 second
|
744
|
-
* to press the next key before you have to start over
|
745
|
-
*
|
746
|
-
* @returns void
|
747
|
-
*/
|
748
|
-
function _resetSequenceTimer() {
|
749
|
-
clearTimeout(_resetTimer);
|
750
|
-
_resetTimer = setTimeout(_resetSequences, 1000);
|
751
|
-
}
|
752
|
-
|
753
|
-
/**
|
754
|
-
* binds a key sequence to an event
|
755
|
-
*
|
756
|
-
* @param {string} combo - combo specified in bind call
|
757
|
-
* @param {Array} keys
|
758
|
-
* @param {Function} callback
|
759
|
-
* @param {string=} action
|
760
|
-
* @returns void
|
761
|
-
*/
|
762
|
-
function _bindSequence(combo, keys, callback, action) {
|
763
|
-
|
764
|
-
// start off by adding a sequence level record for this combination
|
765
|
-
// and setting the level to 0
|
766
|
-
_sequenceLevels[combo] = 0;
|
767
|
-
|
768
|
-
/**
|
769
|
-
* callback to increase the sequence level for this sequence and reset
|
770
|
-
* all other sequences that were active
|
771
|
-
*
|
772
|
-
* @param {string} nextAction
|
773
|
-
* @returns {Function}
|
774
|
-
*/
|
775
|
-
function _increaseSequence(nextAction) {
|
776
|
-
return function() {
|
777
|
-
_nextExpectedAction = nextAction;
|
778
|
-
++_sequenceLevels[combo];
|
779
|
-
_resetSequenceTimer();
|
780
|
-
};
|
781
|
-
}
|
782
|
-
|
783
|
-
/**
|
784
|
-
* wraps the specified callback inside of another function in order
|
785
|
-
* to reset all sequence counters as soon as this sequence is done
|
786
|
-
*
|
787
|
-
* @param {Event} e
|
788
|
-
* @returns void
|
789
|
-
*/
|
790
|
-
function _callbackAndReset(e) {
|
791
|
-
_fireCallback(callback, e, combo);
|
792
|
-
|
793
|
-
// we should ignore the next key up if the action is key down
|
794
|
-
// or keypress. this is so if you finish a sequence and
|
795
|
-
// release the key the final key will not trigger a keyup
|
796
|
-
if (action !== 'keyup') {
|
797
|
-
_ignoreNextKeyup = _characterFromEvent(e);
|
798
|
-
}
|
799
|
-
|
800
|
-
// weird race condition if a sequence ends with the key
|
801
|
-
// another sequence begins with
|
802
|
-
setTimeout(_resetSequences, 10);
|
803
|
-
}
|
804
|
-
|
805
|
-
// loop through keys one at a time and bind the appropriate callback
|
806
|
-
// function. for any key leading up to the final one it should
|
807
|
-
// increase the sequence. after the final, it should reset all sequences
|
808
|
-
//
|
809
|
-
// if an action is specified in the original bind call then that will
|
810
|
-
// be used throughout. otherwise we will pass the action that the
|
811
|
-
// next key in the sequence should match. this allows a sequence
|
812
|
-
// to mix and match keypress and keydown events depending on which
|
813
|
-
// ones are better suited to the key provided
|
814
|
-
for (var i = 0; i < keys.length; ++i) {
|
815
|
-
var isFinal = i + 1 === keys.length;
|
816
|
-
var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
|
817
|
-
_bindSingle(keys[i], wrappedCallback, action, combo, i);
|
818
|
-
}
|
819
|
-
}
|
820
|
-
|
821
|
-
/**
|
822
|
-
* binds a single keyboard combination
|
823
|
-
*
|
824
|
-
* @param {string} combination
|
825
|
-
* @param {Function} callback
|
826
|
-
* @param {string=} action
|
827
|
-
* @param {string=} sequenceName - name of sequence if part of sequence
|
828
|
-
* @param {number=} level - what part of the sequence the command is
|
829
|
-
* @returns void
|
830
|
-
*/
|
831
|
-
function _bindSingle(combination, callback, action, sequenceName, level) {
|
832
|
-
|
833
|
-
// store a direct mapped reference for use with Mousetrap.trigger
|
834
|
-
self._directMap[combination + ':' + action] = callback;
|
835
|
-
|
836
|
-
// make sure multiple spaces in a row become a single space
|
837
|
-
combination = combination.replace(/\s+/g, ' ');
|
838
|
-
|
839
|
-
var sequence = combination.split(' ');
|
840
|
-
var info;
|
841
|
-
|
842
|
-
// if this pattern is a sequence of keys then run through this method
|
843
|
-
// to reprocess each pattern one key at a time
|
844
|
-
if (sequence.length > 1) {
|
845
|
-
_bindSequence(combination, sequence, callback, action);
|
846
|
-
return;
|
847
|
-
}
|
848
|
-
|
849
|
-
info = _getKeyInfo(combination, action);
|
850
|
-
|
851
|
-
// make sure to initialize array if this is the first time
|
852
|
-
// a callback is added for this key
|
853
|
-
self._callbacks[info.key] = self._callbacks[info.key] || [];
|
854
|
-
|
855
|
-
// remove an existing match if there is one
|
856
|
-
_getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
|
857
|
-
|
858
|
-
// add this call back to the array
|
859
|
-
// if it is a sequence put it at the beginning
|
860
|
-
// if not put it at the end
|
861
|
-
//
|
862
|
-
// this is important because the way these are processed expects
|
863
|
-
// the sequence ones to come first
|
864
|
-
self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
|
865
|
-
callback: callback,
|
866
|
-
modifiers: info.modifiers,
|
867
|
-
action: info.action,
|
868
|
-
seq: sequenceName,
|
869
|
-
level: level,
|
870
|
-
combo: combination
|
871
|
-
});
|
872
|
-
}
|
873
|
-
|
874
|
-
/**
|
875
|
-
* binds multiple combinations to the same callback
|
876
|
-
*
|
877
|
-
* @param {Array} combinations
|
878
|
-
* @param {Function} callback
|
879
|
-
* @param {string|undefined} action
|
880
|
-
* @returns void
|
881
|
-
*/
|
882
|
-
self._bindMultiple = function(combinations, callback, action) {
|
883
|
-
for (var i = 0; i < combinations.length; ++i) {
|
884
|
-
_bindSingle(combinations[i], callback, action);
|
885
|
-
}
|
886
|
-
};
|
887
|
-
|
888
|
-
// start!
|
889
|
-
_addEvent(targetElement, 'keypress', _handleKeyEvent);
|
890
|
-
_addEvent(targetElement, 'keydown', _handleKeyEvent);
|
891
|
-
_addEvent(targetElement, 'keyup', _handleKeyEvent);
|
892
|
-
}
|
893
|
-
|
894
|
-
/**
|
895
|
-
* binds an event to mousetrap
|
896
|
-
*
|
897
|
-
* can be a single key, a combination of keys separated with +,
|
898
|
-
* an array of keys, or a sequence of keys separated by spaces
|
899
|
-
*
|
900
|
-
* be sure to list the modifier keys first to make sure that the
|
901
|
-
* correct key ends up getting bound (the last key in the pattern)
|
902
|
-
*
|
903
|
-
* @param {string|Array} keys
|
904
|
-
* @param {Function} callback
|
905
|
-
* @param {string=} action - 'keypress', 'keydown', or 'keyup'
|
906
|
-
* @returns void
|
907
|
-
*/
|
908
|
-
Mousetrap.prototype.bind = function(keys, callback, action) {
|
909
|
-
var self = this;
|
910
|
-
keys = keys instanceof Array ? keys : [keys];
|
911
|
-
self._bindMultiple.call(self, keys, callback, action);
|
912
|
-
return self;
|
913
|
-
};
|
914
|
-
|
915
|
-
/**
|
916
|
-
* unbinds an event to mousetrap
|
917
|
-
*
|
918
|
-
* the unbinding sets the callback function of the specified key combo
|
919
|
-
* to an empty function and deletes the corresponding key in the
|
920
|
-
* _directMap dict.
|
921
|
-
*
|
922
|
-
* TODO: actually remove this from the _callbacks dictionary instead
|
923
|
-
* of binding an empty function
|
924
|
-
*
|
925
|
-
* the keycombo+action has to be exactly the same as
|
926
|
-
* it was defined in the bind method
|
927
|
-
*
|
928
|
-
* @param {string|Array} keys
|
929
|
-
* @param {string} action
|
930
|
-
* @returns void
|
931
|
-
*/
|
932
|
-
Mousetrap.prototype.unbind = function(keys, action) {
|
933
|
-
var self = this;
|
934
|
-
return self.bind.call(self, keys, function() {}, action);
|
935
|
-
};
|
936
|
-
|
937
|
-
/**
|
938
|
-
* triggers an event that has already been bound
|
939
|
-
*
|
940
|
-
* @param {string} keys
|
941
|
-
* @param {string=} action
|
942
|
-
* @returns void
|
943
|
-
*/
|
944
|
-
Mousetrap.prototype.trigger = function(keys, action) {
|
945
|
-
var self = this;
|
946
|
-
if (self._directMap[keys + ':' + action]) {
|
947
|
-
self._directMap[keys + ':' + action]({}, keys);
|
948
|
-
}
|
949
|
-
return self;
|
950
|
-
};
|
951
|
-
|
952
|
-
/**
|
953
|
-
* resets the library back to its initial state. this is useful
|
954
|
-
* if you want to clear out the current keyboard shortcuts and bind
|
955
|
-
* new ones - for example if you switch to another page
|
956
|
-
*
|
957
|
-
* @returns void
|
958
|
-
*/
|
959
|
-
Mousetrap.prototype.reset = function() {
|
960
|
-
var self = this;
|
961
|
-
self._callbacks = {};
|
962
|
-
self._directMap = {};
|
963
|
-
return self;
|
964
|
-
};
|
965
|
-
|
966
|
-
/**
|
967
|
-
* should we stop this event before firing off callbacks
|
968
|
-
*
|
969
|
-
* @param {Event} e
|
970
|
-
* @param {Element} element
|
971
|
-
* @return {boolean}
|
972
|
-
*/
|
973
|
-
Mousetrap.prototype.stopCallback = function(e, element) {
|
974
|
-
var self = this;
|
975
|
-
|
976
|
-
// if the element has the class "mousetrap" then no need to stop
|
977
|
-
if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
|
978
|
-
return false;
|
979
|
-
}
|
980
|
-
|
981
|
-
if (_belongsTo(element, self.target)) {
|
982
|
-
return false;
|
983
|
-
}
|
984
|
-
|
985
|
-
// stop for input, select, and textarea
|
986
|
-
return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
|
987
|
-
};
|
988
|
-
|
989
|
-
/**
|
990
|
-
* exposes _handleKey publicly so it can be overwritten by extensions
|
991
|
-
*/
|
992
|
-
Mousetrap.prototype.handleKey = function() {
|
993
|
-
var self = this;
|
994
|
-
return self._handleKey.apply(self, arguments);
|
995
|
-
};
|
996
|
-
|
997
|
-
/**
|
998
|
-
* allow custom key mappings
|
999
|
-
*/
|
1000
|
-
Mousetrap.addKeycodes = function(object) {
|
1001
|
-
for (var key in object) {
|
1002
|
-
if (object.hasOwnProperty(key)) {
|
1003
|
-
_MAP[key] = object[key];
|
1004
|
-
}
|
1005
|
-
}
|
1006
|
-
_REVERSE_MAP = null;
|
1007
|
-
};
|
1008
|
-
|
1009
|
-
/**
|
1010
|
-
* Init the global mousetrap functions
|
1011
|
-
*
|
1012
|
-
* This method is needed to allow the global mousetrap functions to work
|
1013
|
-
* now that mousetrap is a constructor function.
|
1014
|
-
*/
|
1015
|
-
Mousetrap.init = function() {
|
1016
|
-
var documentMousetrap = Mousetrap(document);
|
1017
|
-
for (var method in documentMousetrap) {
|
1018
|
-
if (method.charAt(0) !== '_') {
|
1019
|
-
Mousetrap[method] = (function(method) {
|
1020
|
-
return function() {
|
1021
|
-
return documentMousetrap[method].apply(documentMousetrap, arguments);
|
1022
|
-
};
|
1023
|
-
} (method));
|
1024
|
-
}
|
1025
|
-
}
|
1026
|
-
};
|
1027
|
-
|
1028
|
-
Mousetrap.init();
|
1029
|
-
|
1030
|
-
// expose mousetrap to the global object
|
1031
|
-
window.Mousetrap = Mousetrap;
|
1032
|
-
|
1033
|
-
// expose as a common js module
|
1034
|
-
if (typeof module !== 'undefined' && module.exports) {
|
1035
|
-
module.exports = Mousetrap;
|
1036
|
-
}
|
1037
|
-
|
1038
|
-
// expose mousetrap as an AMD module
|
1039
|
-
if (typeof define === 'function' && define.amd) {
|
1040
|
-
define(function() {
|
1041
|
-
return Mousetrap;
|
1042
|
-
});
|
1043
|
-
}
|
1044
|
-
}) (typeof window !== 'undefined' ? window : null, typeof window !== 'undefined' ? document : null);
|