From 765286e7fa0984bcfd39e5c79eaa50b9cb5a848c Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 8 Sep 2026 02:19:11 +0530 Subject: [PATCH] feat(medical-store): ABDM-compatible multi-building pharmacy, POS desktop keyboard workflow, unit dispensing, and split payments --- .gitignore | 14 + HMS_MEDICAL_STORE_SESSION.md | 77 + .../gradle/gradle-daemon-jvm.properties | 13 + .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 46175 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + android_opd_queue_tv/gradlew | 248 + android_opd_queue_tv/gradlew.bat | 93 + app/Config/Routes.php | 48 + app/Controllers/Api/v1/MedicalStoreApi.php | 2167 +++++++++ app/Controllers/Setting/MedicalStoreAdmin.php | 452 ++ app/Libraries/FhirR4Builder.php | 229 + app/Views/Setting/Admin/index.php | 7 + .../MedicalStore/medical_store_index.php | 686 +++ public/App/MedicalStore/index.html | 4111 +++++++++++++++++ public/App/MedicalStore/manifest.json | 17 + public/App/MedicalStore/sw.js | 21 + public/App/index.html | 16 +- scratch/add_discount_columns.php | 23 + scratch/add_split_payment_columns.php | 43 + scratch/analyze_diffs.php | 51 + scratch/babel.min.js | 4 + scratch/bundle.js | 912 ++++ scratch/bundle_with_pdf.json | 1483 ++++++ scratch/bundle_without_pdf.json | 1426 ++++++ scratch/check_all_bundles.php | 23 + scratch/check_all_dbs.php | 26 + scratch/check_all_orgs.php | 17 + scratch/check_all_tables_ipd9.php | 18 + scratch/check_api_doctors.php | 8 + scratch/check_careplan_spec.php | 7 + scratch/check_ci4_db.php | 14 + scratch/check_comp_cat.php | 13 + scratch/check_comp_category_sd.php | 13 + scratch/check_comp_enc.php | 7 + scratch/check_comp_slices.php | 7 + scratch/check_cond_cat_binding.php | 10 + scratch/check_cond_dates.php | 7 + scratch/check_cond_req.php | 7 + scratch/check_cp_req.php | 7 + scratch/check_db_health_records.php | 21 + scratch/check_db_hospital.php | 9 + scratch/check_dc_entries.php | 12 + scratch/check_diag_use.php | 11 + scratch/check_discharge_pdf.php | 21 + scratch/check_discount_schema.php | 11 + scratch/check_docref_desc.php | 7 + scratch/check_docref_req.php | 7 + scratch/check_doctor_master.php | 6 + scratch/check_enc_bindings.php | 13 + scratch/check_enc_elements.php | 18 + scratch/check_enc_sd.php | 9 + scratch/check_encounter_req.php | 7 + scratch/check_example_encounters.php | 10 + scratch/check_file_upload_table.php | 19 + scratch/check_full_563.php | 27 + scratch/check_h_settings.php | 7 + scratch/check_health_doc_db.php | 40 + scratch/check_health_records.php | 16 + scratch/check_hms_data_ci4.php | 11 + scratch/check_hospital_keys.php | 6 + scratch/check_imm_loc.php | 8 + scratch/check_imm_ms.php | 8 + scratch/check_init_bundle.php | 21 + scratch/check_init_imm.php | 14 + scratch/check_invoice_attachment.php | 15 + scratch/check_invoice_elements.php | 16 + scratch/check_invoice_files.php | 15 + scratch/check_invoice_record_diff.php | 20 + scratch/check_invoice_record_sd.php | 20 + scratch/check_invoice_slicing.php | 10 + scratch/check_ipd9.php | 13 + scratch/check_ipd_009.php | 20 + scratch/check_ipd_6_meds.php | 38 + scratch/check_ipd_9_content.php | 18 + scratch/check_ipd_9_meds.php | 18 + scratch/check_ipd_9_summary.php | 15 + scratch/check_ipd_data.php | 34 + scratch/check_ipd_db.php | 19 + scratch/check_ipd_nursing_entries.php | 8 + scratch/check_ipd_tables.php | 7 + scratch/check_items_units.php | 7 + scratch/check_lab_enc.php | 7 + scratch/check_lab_entries.php | 12 + scratch/check_lab_real.php | 7 + scratch/check_master_dosage_when.php | 14 + scratch/check_med_masters.php | 20 + scratch/check_med_tables.php | 11 + scratch/check_media_0.php | 6 + scratch/check_mr_binding.php | 10 + scratch/check_mr_req.php | 7 + scratch/check_mst_stores_columns.php | 7 + scratch/check_mysql_ipd.php | 17 + scratch/check_nursing_table.php | 8 + scratch/check_opd_dates.php | 8 + scratch/check_opd_dose_when.php | 14 + scratch/check_opd_prescription_cols.php | 14 + scratch/check_opd_table.php | 20 + scratch/check_org_elements.php | 9 + scratch/check_org_must_support.php | 7 + scratch/check_org_type_binding.php | 7 + scratch/check_p11.php | 5 + scratch/check_p6_mr.php | 8 + scratch/check_patient_age.php | 14 + scratch/check_patient_age2.php | 20 + scratch/check_proc_req.php | 7 + scratch/check_radio_real.php | 4 + scratch/check_rec10.php | 5 + scratch/check_recent_ipds.php | 14 + scratch/check_recent_steps.php | 14 + scratch/check_records_boot.php | 17 + scratch/check_request3_org.php | 39 + scratch/check_rx_entries.php | 15 + scratch/check_sample_items.php | 11 + scratch/check_schema.php | 11 + scratch/check_sd_elements.php | 14 + scratch/check_sd_imm.php | 16 + scratch/check_section_entries.php | 11 + scratch/check_seed_meds.php | 15 + scratch/check_step0_bundle.php | 32 + scratch/check_step563_org.php | 11 + scratch/check_store1_stock.php | 13 + scratch/check_syntax.cjs | 13 + scratch/check_transcript.php | 13 + scratch/check_unit_schema.php | 10 + scratch/clean_db_remarks.php | 17 + scratch/clean_med_history_bundle.json | 1205 +++++ scratch/compare_bundles.php | 18 + scratch/compare_clinical.php | 33 + scratch/compare_exact.php | 76 + scratch/compare_examples.php | 29 + scratch/compare_immunization_07.php | 24 + scratch/compare_sample07.php | 76 + scratch/compare_user_with_ex04.php | 54 + scratch/debug_ipd_sql.php | 37 + scratch/deep_compare_07.php | 37 + scratch/deep_validate_bundle.php | 57 + scratch/deep_verify.php | 42 + scratch/desc_patient_master.php | 15 + scratch/diff_all_fields.php | 74 + scratch/discharge_output.html | 0 scratch/dump_2632.php | 4 + scratch/dump_bundle.php | 20 + scratch/dump_comp_07.php | 3 + scratch/dump_example_07_details.php | 15 + scratch/dump_sample_07_complete.php | 20 + scratch/enqueue_func.txt | Bin 0 -> 20778 bytes scratch/extract_sample07_strings.php | 21 + scratch/extracted_app.jsx | 2716 +++++++++++ scratch/fhir_1.json | 987 ++++ scratch/find_aciloc.php | 29 + scratch/find_build_methods.php | 7 + scratch/find_hosp.php | 7 + scratch/find_imm_files.php | 8 + scratch/find_imm_tb.php | 7 + scratch/find_media.php | 7 + scratch/find_org.php | 7 + scratch/find_treatment_tables.php | 9 + scratch/generate_narrow_screenshot.php | 29 + scratch/generate_pwa_icons.php | 33 + scratch/generate_user_updated_bundle.php | 49 + scratch/generated_clean_bundle.json | 1294 ++++++ scratch/inspect_compositions.php | 25 + scratch/inspect_cond_mr_ex04.php | 17 + scratch/inspect_ddcc.php | 6 + scratch/inspect_details_ex04.php | 18 + scratch/inspect_dump.php | 18 + scratch/inspect_ex04.php | 18 + scratch/inspect_ex04_enc.php | 8 + scratch/inspect_ex04_patient.php | 8 + scratch/inspect_example_07.php | 10 + scratch/inspect_generate_res.php | 81 + scratch/inspect_invoice_bundle.php | 26 + scratch/inspect_opconsult.php | 18 + scratch/inspect_opconsult_05.php | 20 + scratch/inspect_our_mr.php | 9 + scratch/inspect_seed_mr.php | 29 + scratch/inspect_wellness_sd.php | 21 + scratch/last_user_message.json | 300 ++ scratch/list_discharge_slices.php | 30 + scratch/list_mr_elements.php | 16 + scratch/list_slices.php | 9 + scratch/make_sample_07.php | 13 + scratch/migrate_medical_store.php | 525 +++ scratch/print_comp_ex04.php | 5 + scratch/read_2580.php | 11 + scratch/read_line0.php | 5 + scratch/read_sample_fhir.php | 9 + scratch/read_thinking_2587.php | 15 + scratch/read_transcript.php | 8 + scratch/resource_diffs.txt | 699 +++ scratch/sample07_map.php | 52 + scratch/sample_07_full.json | 399 ++ scratch/save_f1.php | 995 ++++ scratch/search_all_mr_examples.php | 38 + scratch/search_dept.php | 16 + scratch/search_meal.php | 19 + scratch/sync_invoice_seq.php | 30 + scratch/sync_seed_meds.php | 36 + scratch/test_add_fields.php | 41 + scratch/test_age_helper.php | 12 + scratch/test_api_endpoints.php | 57 + scratch/test_babel.cjs | 32 + scratch/test_build_payload.php | 53 + scratch/test_build_source_5.php | 100 + scratch/test_bundle.json | 288 ++ scratch/test_bundle_no_na.php | 52 + scratch/test_bw_meds.php | 14 + scratch/test_canonical_imm.php | 82 + scratch/test_clean_generator.php | 102 + scratch/test_clean_med_history.php | 615 +++ scratch/test_clean_output.php | 23 + scratch/test_cleanup_summary.php | 26 + scratch/test_device_and_marg.php | 187 + scratch/test_discharge_9.php | 31 + scratch/test_discount_feature.php | 77 + scratch/test_enriched.php | 1452 ++++++ scratch/test_final_html.php | 51 + scratch/test_full_org_builder.php | 129 + scratch/test_gen_doc5.php | 32 + scratch/test_generated_bundle.php | 75 + scratch/test_generic_resolve.php | 51 + scratch/test_health_doc_fhir.php | 46 + scratch/test_health_doc_preview.php | 18 + scratch/test_health_doc_preview_mysql.php | 26 + scratch/test_insert_file_upload.php | 11 + scratch/test_ipd9_bundle.php | 26 + scratch/test_ipd_api_response.php | 20 + scratch/test_marg_sample.csv | 6 + scratch/test_med_table.php | 14 + scratch/test_mr_cat_method.php | 10 + scratch/test_no_pdf.php | 784 ++++ scratch/test_opd_sql.php | 21 + scratch/test_org_parse.php | 45 + scratch/test_org_validation.php | 51 + scratch/test_pdf.php | 126 + scratch/test_prototype.php | 6 + scratch/test_real_pdf_generator.php | 135 + scratch/test_split_payment_and_audit.php | 168 + scratch/test_step_by_step.php | 1000 ++++ scratch/test_unit_dispense.php | 196 + scratch/test_upload_dir.php | 16 + scratch/test_upload_status.php | 12 + scratch/test_wellness_bundle.php | 68 + scratch/update_schema_v2.php | 86 + scratch/updated_wellness_bundle.json | 782 ++++ scratch/upgrade_abdm_schema.php | 53 + scratch/upgrade_sales_items_schema.php | 27 + scratch/user_updated_bundle.json | 824 ++++ scratch/validate_against_profiles.php | 90 + scratch/validate_bundle.php | 8 + scratch/validated_enriched_bundle.json | 1493 ++++++ scratch/validated_step_by_step_bundle.json | 1002 ++++ scratch/verify_abdm_compatibility.php | 254 + scratch/verify_all.php | 144 + scratch/verify_user_bundle.php | 830 ++++ 255 files changed, 36101 insertions(+), 8 deletions(-) create mode 100644 HMS_MEDICAL_STORE_SESSION.md create mode 100644 android_opd_queue_tv/gradle/gradle-daemon-jvm.properties create mode 100644 android_opd_queue_tv/gradle/wrapper/gradle-wrapper.jar create mode 100644 android_opd_queue_tv/gradle/wrapper/gradle-wrapper.properties create mode 100644 android_opd_queue_tv/gradlew create mode 100644 android_opd_queue_tv/gradlew.bat create mode 100644 app/Controllers/Api/v1/MedicalStoreApi.php create mode 100644 app/Controllers/Setting/MedicalStoreAdmin.php create mode 100644 app/Views/Setting/MedicalStore/medical_store_index.php create mode 100644 public/App/MedicalStore/index.html create mode 100644 public/App/MedicalStore/manifest.json create mode 100644 public/App/MedicalStore/sw.js create mode 100644 scratch/add_discount_columns.php create mode 100644 scratch/add_split_payment_columns.php create mode 100644 scratch/analyze_diffs.php create mode 100644 scratch/babel.min.js create mode 100644 scratch/bundle.js create mode 100644 scratch/bundle_with_pdf.json create mode 100644 scratch/bundle_without_pdf.json create mode 100644 scratch/check_all_bundles.php create mode 100644 scratch/check_all_dbs.php create mode 100644 scratch/check_all_orgs.php create mode 100644 scratch/check_all_tables_ipd9.php create mode 100644 scratch/check_api_doctors.php create mode 100644 scratch/check_careplan_spec.php create mode 100644 scratch/check_ci4_db.php create mode 100644 scratch/check_comp_cat.php create mode 100644 scratch/check_comp_category_sd.php create mode 100644 scratch/check_comp_enc.php create mode 100644 scratch/check_comp_slices.php create mode 100644 scratch/check_cond_cat_binding.php create mode 100644 scratch/check_cond_dates.php create mode 100644 scratch/check_cond_req.php create mode 100644 scratch/check_cp_req.php create mode 100644 scratch/check_db_health_records.php create mode 100644 scratch/check_db_hospital.php create mode 100644 scratch/check_dc_entries.php create mode 100644 scratch/check_diag_use.php create mode 100644 scratch/check_discharge_pdf.php create mode 100644 scratch/check_discount_schema.php create mode 100644 scratch/check_docref_desc.php create mode 100644 scratch/check_docref_req.php create mode 100644 scratch/check_doctor_master.php create mode 100644 scratch/check_enc_bindings.php create mode 100644 scratch/check_enc_elements.php create mode 100644 scratch/check_enc_sd.php create mode 100644 scratch/check_encounter_req.php create mode 100644 scratch/check_example_encounters.php create mode 100644 scratch/check_file_upload_table.php create mode 100644 scratch/check_full_563.php create mode 100644 scratch/check_h_settings.php create mode 100644 scratch/check_health_doc_db.php create mode 100644 scratch/check_health_records.php create mode 100644 scratch/check_hms_data_ci4.php create mode 100644 scratch/check_hospital_keys.php create mode 100644 scratch/check_imm_loc.php create mode 100644 scratch/check_imm_ms.php create mode 100644 scratch/check_init_bundle.php create mode 100644 scratch/check_init_imm.php create mode 100644 scratch/check_invoice_attachment.php create mode 100644 scratch/check_invoice_elements.php create mode 100644 scratch/check_invoice_files.php create mode 100644 scratch/check_invoice_record_diff.php create mode 100644 scratch/check_invoice_record_sd.php create mode 100644 scratch/check_invoice_slicing.php create mode 100644 scratch/check_ipd9.php create mode 100644 scratch/check_ipd_009.php create mode 100644 scratch/check_ipd_6_meds.php create mode 100644 scratch/check_ipd_9_content.php create mode 100644 scratch/check_ipd_9_meds.php create mode 100644 scratch/check_ipd_9_summary.php create mode 100644 scratch/check_ipd_data.php create mode 100644 scratch/check_ipd_db.php create mode 100644 scratch/check_ipd_nursing_entries.php create mode 100644 scratch/check_ipd_tables.php create mode 100644 scratch/check_items_units.php create mode 100644 scratch/check_lab_enc.php create mode 100644 scratch/check_lab_entries.php create mode 100644 scratch/check_lab_real.php create mode 100644 scratch/check_master_dosage_when.php create mode 100644 scratch/check_med_masters.php create mode 100644 scratch/check_med_tables.php create mode 100644 scratch/check_media_0.php create mode 100644 scratch/check_mr_binding.php create mode 100644 scratch/check_mr_req.php create mode 100644 scratch/check_mst_stores_columns.php create mode 100644 scratch/check_mysql_ipd.php create mode 100644 scratch/check_nursing_table.php create mode 100644 scratch/check_opd_dates.php create mode 100644 scratch/check_opd_dose_when.php create mode 100644 scratch/check_opd_prescription_cols.php create mode 100644 scratch/check_opd_table.php create mode 100644 scratch/check_org_elements.php create mode 100644 scratch/check_org_must_support.php create mode 100644 scratch/check_org_type_binding.php create mode 100644 scratch/check_p11.php create mode 100644 scratch/check_p6_mr.php create mode 100644 scratch/check_patient_age.php create mode 100644 scratch/check_patient_age2.php create mode 100644 scratch/check_proc_req.php create mode 100644 scratch/check_radio_real.php create mode 100644 scratch/check_rec10.php create mode 100644 scratch/check_recent_ipds.php create mode 100644 scratch/check_recent_steps.php create mode 100644 scratch/check_records_boot.php create mode 100644 scratch/check_request3_org.php create mode 100644 scratch/check_rx_entries.php create mode 100644 scratch/check_sample_items.php create mode 100644 scratch/check_schema.php create mode 100644 scratch/check_sd_elements.php create mode 100644 scratch/check_sd_imm.php create mode 100644 scratch/check_section_entries.php create mode 100644 scratch/check_seed_meds.php create mode 100644 scratch/check_step0_bundle.php create mode 100644 scratch/check_step563_org.php create mode 100644 scratch/check_store1_stock.php create mode 100644 scratch/check_syntax.cjs create mode 100644 scratch/check_transcript.php create mode 100644 scratch/check_unit_schema.php create mode 100644 scratch/clean_db_remarks.php create mode 100644 scratch/clean_med_history_bundle.json create mode 100644 scratch/compare_bundles.php create mode 100644 scratch/compare_clinical.php create mode 100644 scratch/compare_exact.php create mode 100644 scratch/compare_examples.php create mode 100644 scratch/compare_immunization_07.php create mode 100644 scratch/compare_sample07.php create mode 100644 scratch/compare_user_with_ex04.php create mode 100644 scratch/debug_ipd_sql.php create mode 100644 scratch/deep_compare_07.php create mode 100644 scratch/deep_validate_bundle.php create mode 100644 scratch/deep_verify.php create mode 100644 scratch/desc_patient_master.php create mode 100644 scratch/diff_all_fields.php create mode 100644 scratch/discharge_output.html create mode 100644 scratch/dump_2632.php create mode 100644 scratch/dump_bundle.php create mode 100644 scratch/dump_comp_07.php create mode 100644 scratch/dump_example_07_details.php create mode 100644 scratch/dump_sample_07_complete.php create mode 100644 scratch/enqueue_func.txt create mode 100644 scratch/extract_sample07_strings.php create mode 100644 scratch/extracted_app.jsx create mode 100644 scratch/fhir_1.json create mode 100644 scratch/find_aciloc.php create mode 100644 scratch/find_build_methods.php create mode 100644 scratch/find_hosp.php create mode 100644 scratch/find_imm_files.php create mode 100644 scratch/find_imm_tb.php create mode 100644 scratch/find_media.php create mode 100644 scratch/find_org.php create mode 100644 scratch/find_treatment_tables.php create mode 100644 scratch/generate_narrow_screenshot.php create mode 100644 scratch/generate_pwa_icons.php create mode 100644 scratch/generate_user_updated_bundle.php create mode 100644 scratch/generated_clean_bundle.json create mode 100644 scratch/inspect_compositions.php create mode 100644 scratch/inspect_cond_mr_ex04.php create mode 100644 scratch/inspect_ddcc.php create mode 100644 scratch/inspect_details_ex04.php create mode 100644 scratch/inspect_dump.php create mode 100644 scratch/inspect_ex04.php create mode 100644 scratch/inspect_ex04_enc.php create mode 100644 scratch/inspect_ex04_patient.php create mode 100644 scratch/inspect_example_07.php create mode 100644 scratch/inspect_generate_res.php create mode 100644 scratch/inspect_invoice_bundle.php create mode 100644 scratch/inspect_opconsult.php create mode 100644 scratch/inspect_opconsult_05.php create mode 100644 scratch/inspect_our_mr.php create mode 100644 scratch/inspect_seed_mr.php create mode 100644 scratch/inspect_wellness_sd.php create mode 100644 scratch/last_user_message.json create mode 100644 scratch/list_discharge_slices.php create mode 100644 scratch/list_mr_elements.php create mode 100644 scratch/list_slices.php create mode 100644 scratch/make_sample_07.php create mode 100644 scratch/migrate_medical_store.php create mode 100644 scratch/print_comp_ex04.php create mode 100644 scratch/read_2580.php create mode 100644 scratch/read_line0.php create mode 100644 scratch/read_sample_fhir.php create mode 100644 scratch/read_thinking_2587.php create mode 100644 scratch/read_transcript.php create mode 100644 scratch/resource_diffs.txt create mode 100644 scratch/sample07_map.php create mode 100644 scratch/sample_07_full.json create mode 100644 scratch/save_f1.php create mode 100644 scratch/search_all_mr_examples.php create mode 100644 scratch/search_dept.php create mode 100644 scratch/search_meal.php create mode 100644 scratch/sync_invoice_seq.php create mode 100644 scratch/sync_seed_meds.php create mode 100644 scratch/test_add_fields.php create mode 100644 scratch/test_age_helper.php create mode 100644 scratch/test_api_endpoints.php create mode 100644 scratch/test_babel.cjs create mode 100644 scratch/test_build_payload.php create mode 100644 scratch/test_build_source_5.php create mode 100644 scratch/test_bundle.json create mode 100644 scratch/test_bundle_no_na.php create mode 100644 scratch/test_bw_meds.php create mode 100644 scratch/test_canonical_imm.php create mode 100644 scratch/test_clean_generator.php create mode 100644 scratch/test_clean_med_history.php create mode 100644 scratch/test_clean_output.php create mode 100644 scratch/test_cleanup_summary.php create mode 100644 scratch/test_device_and_marg.php create mode 100644 scratch/test_discharge_9.php create mode 100644 scratch/test_discount_feature.php create mode 100644 scratch/test_enriched.php create mode 100644 scratch/test_final_html.php create mode 100644 scratch/test_full_org_builder.php create mode 100644 scratch/test_gen_doc5.php create mode 100644 scratch/test_generated_bundle.php create mode 100644 scratch/test_generic_resolve.php create mode 100644 scratch/test_health_doc_fhir.php create mode 100644 scratch/test_health_doc_preview.php create mode 100644 scratch/test_health_doc_preview_mysql.php create mode 100644 scratch/test_insert_file_upload.php create mode 100644 scratch/test_ipd9_bundle.php create mode 100644 scratch/test_ipd_api_response.php create mode 100644 scratch/test_marg_sample.csv create mode 100644 scratch/test_med_table.php create mode 100644 scratch/test_mr_cat_method.php create mode 100644 scratch/test_no_pdf.php create mode 100644 scratch/test_opd_sql.php create mode 100644 scratch/test_org_parse.php create mode 100644 scratch/test_org_validation.php create mode 100644 scratch/test_pdf.php create mode 100644 scratch/test_prototype.php create mode 100644 scratch/test_real_pdf_generator.php create mode 100644 scratch/test_split_payment_and_audit.php create mode 100644 scratch/test_step_by_step.php create mode 100644 scratch/test_unit_dispense.php create mode 100644 scratch/test_upload_dir.php create mode 100644 scratch/test_upload_status.php create mode 100644 scratch/test_wellness_bundle.php create mode 100644 scratch/update_schema_v2.php create mode 100644 scratch/updated_wellness_bundle.json create mode 100644 scratch/upgrade_abdm_schema.php create mode 100644 scratch/upgrade_sales_items_schema.php create mode 100644 scratch/user_updated_bundle.json create mode 100644 scratch/validate_against_profiles.php create mode 100644 scratch/validate_bundle.php create mode 100644 scratch/validated_enriched_bundle.json create mode 100644 scratch/validated_step_by_step_bundle.json create mode 100644 scratch/verify_abdm_compatibility.php create mode 100644 scratch/verify_all.php create mode 100644 scratch/verify_user_bundle.php diff --git a/.gitignore b/.gitignore index 339fd58..e662b17 100644 --- a/.gitignore +++ b/.gitignore @@ -144,3 +144,17 @@ public/uploads/* !public/assets/ !public/assets/img/ !public/assets/img/** + +# Android build & local properties +android_opd_queue_tv/.gradle/ +android_opd_queue_tv/*/build/ +android_opd_queue_tv/build/ +android_opd_queue_tv/local.properties + +# Temporary and extraction directories +docx_extracted/ +writable/debug/* +writable/github_update_cache.json +E-AtriaHMS.docx +E-AtriaHMS.zip + diff --git a/HMS_MEDICAL_STORE_SESSION.md b/HMS_MEDICAL_STORE_SESSION.md new file mode 100644 index 0000000..9582e06 --- /dev/null +++ b/HMS_MEDICAL_STORE_SESSION.md @@ -0,0 +1,77 @@ +# HMS Multi-Building Medical Store & ABDM Pharmacy System +**Session Name:** `HMS Multi-Store Pharmacy & ABDM Integration` +**Antigravity Conversation ID:** `3731d0c5-f4df-435e-b54f-f690562e18e3` +**Last Updated:** September 8, 2026 + +--- + +## Quick Resume Instructions After Computer Restart + +### 1. In Antigravity IDE +1. Open Antigravity IDE and reopen the workspace `HMS_CI4_OLD`. +2. In the Chat panel, click the **Chat History / Clock icon** (or open the left conversation drawer). +3. Select this session: **`HMS Multi-Store Pharmacy & ABDM Integration`** (ID: `3731d0c5-f4df-435e-b54f-f690562e18e3`). +4. Type your message and continue seamlessly! + +*Tip: If you ever open a new chat, you can type `@HMS_MEDICAL_STORE_SESSION.md` or `@conversation` to instantly restore all context.* + +--- + +## System Access & Credentials Summary + +### Development Server +- Command: `php spark serve` (in `d:\Workplace\HMS_CI4_OLD`) +- Server URL: `http://localhost:8080` + +### HMS Admin Management +- **URL:** [http://localhost:8080/setting/admin/medical-store](http://localhost:8080/setting/admin/medical-store) +- **Features:** Store configuration, DL 20B/21B licenses, GSTIN, Pharmacist details, ABDM HFR/HIP/HPR registries, 60-min OTP generator, terminal device authorization, and Marg ERP CSV import. + +### Direct Counter Desks (React PWA) +- **Counter A (Main Hospital Block A):** + - Direct Link: [http://localhost:8080/MedicalStore/storeA](http://localhost:8080/MedicalStore/storeA) + - Store Code: `ST-MAIN` + - Permanent Security Key: `STORE-SEC-A91B4C72` + - ABDM HFR ID: `IN0710001234` + - Pharmacist HPR ID: `91-8822-4411-9901` +- **Counter B (OPD Block B):** + - Direct Link: [http://localhost:8080/MedicalStore/storeB](http://localhost:8080/MedicalStore/storeB) + - Store Code: `ST-OPD-B2` + - Permanent Security Key: `STORE-SEC-B84F29D1` + - ABDM HFR ID: `IN0710001234-OPD` + - Pharmacist HPR ID: `91-8822-4411-9902` + +--- + +## Core Technical Reference + +1. **Zero Legacy Disturbance:** + - Legacy pharmacy tables (`invoice_med_master`, `inv_med_item`, `med_*`) and controllers remain 100% untouched. + - All new tables use the **`mst_*`** prefix (15 tables). +2. **ABDM Compatibility (M1 & M2):** + - Patient search by 14-digit ABHA Number or ABHA Address. + - Care Context generation: `PHARM-{store_code}-{invoice_no}`. + - NRCES FHIR R4 Bundle profile: `https://nrces.in/ndhm/fhir/r4/StructureDefinition/MedicationDispenseDocument`. + - Coded with SNOMED-CT clinical terminology. + - Gateway Bridge queue integration: `abdm_sync_record`. + - Bundle preview endpoint: `GET /api/v1/medical-store/abdm/bundle/{sale_id}`. +3. **Multi-Format Invoices:** + - 80mm Thermal Slip (Fast 1–5 item OTC/OPD). + - A5 Invoice (Normal OPD/Walk-in with GST summary). + - A4 Hospital Tax Invoice (IPD admissions & large bills). +4. **Marg ERP Migration:** + - Supported CSV import with auto-detected columns. Sample test file: `scratch/test_marg_sample.csv`. +5. **Double-Entry Accounting & Statutory Drug Register:** + - Automated ledger postings, Daily Cash Book, GSTR-1 outward reports, and mandatory Schedule H1 drug register. +6. **Retail Loose Tablet & Unit Dispensing:** + - Exact per-tablet pricing (`Strip MRP / units_per_pack`), exact stock deduction in individual tablets, and support for Loose Tab, Strip, and Combo sales. +7. **Split / Mixed Payment Mode & Audit:** + - Supports partial payments (e.g. ₹35 Cash + ₹100 UPI) with 12-digit UTR and bank name capturing for bank reconciliation and audit. +8. **Keyboard-First Zero-Mouse POS Workflow (Marg ERP Standard):** + - High-contrast single-line Quick Keys ribbon. + - Hotkeys: `F2` (Medicine Search), `F4` (Patient Search), `F7` (Whole Discount), `F8` (Payment Mode), `F9 / Ctrl+Enter` (Complete Sale & Print), `Alt+T` (Loose Tab), `Alt+S` (Strip), `Shift+Delete` (Remove Item). + - Auto-focus on Medicine Search on page load; `Enter` on quantity immediately commits and jumps focus back to Medicine Lookup for the next scan. +9. **Compact "Qty & Unit" Cell:** + - Single-line input group with type selector dropdown (`Tab`, `Strip`, `Str+Tab`) positioned before the quantity box. + - Automatically defaults to `Tab` (loose units). + diff --git a/android_opd_queue_tv/gradle/gradle-daemon-jvm.properties b/android_opd_queue_tv/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000..2a29db8 --- /dev/null +++ b/android_opd_queue_tv/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,13 @@ +#This file is generated by updateDaemonJvm +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/b96cc4b9c59b5bff244af296e50d5ea3/redirect +toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fdfa2f9fadcf75fb9616fde209d60b55/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/b96cc4b9c59b5bff244af296e50d5ea3/redirect +toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fdfa2f9fadcf75fb9616fde209d60b55/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97b61e8788c7490a5f53d8951b11ea7a/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/feb8af2956f2e263086e0a8f9a1df390/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/b96cc4b9c59b5bff244af296e50d5ea3/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fdfa2f9fadcf75fb9616fde209d60b55/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/eff42deed1d8947129a4e66cd07a89f4/redirect +toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8fe418192094ee8db0da620bcb6b1629/redirect +toolchainVendor=JETBRAINS +toolchainVersion=25 diff --git a/android_opd_queue_tv/gradle/wrapper/gradle-wrapper.jar b/android_opd_queue_tv/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..61285a659d17295f1de7c53e24fdf13ad755c379 GIT binary patch literal 46175 zcma&NWmKG9wk?cn;qLD4?(Xgo+}#P9AcecTOK=k0-KB7X7w!%r36RU%ea89j>2v%2 zy2jY`r|L&NwdbC5&AHZASAvGYhCo0-fPjFYcwhhD3mpOxLPbVff<-}9mQ7hfN=8*n zMn@YK0`jk~Y#ADPZt&s;&o%Vh+1OqX$SQPQUbO~kT2|`trE{h9WQ$5t)0<0SGK(9o zy!{fv+oYdReexE`UMYzV3-kOr>x=rJ7+6+0b5EnF$IG$Dt(hUAKx2>*-_*>j|Id49Q3}YN>5=$q?@D;}*%{N1&Ngq- zT;Qj#_R=+0ba4EqMNa487mOM?^?N!cyt;9!ID^&OIS$OX?qC^kSGrHw@&-mB@~L!$ zQMIB|qD849?j6c_o6Y9s2-@J%jl@tu1+mdGN~J$RK!v{juhQkNSMup%E!|Iwjp}G} z6l3PDwQp#b$A`v-92bY=W{dghjg1@gO53Q}P!4oN?n)(dY4}3I1erK<3&=O2;)*)+_&gzJwCFLYl&;nZCm zs21P5net@>H0V>H2FQ%TUoZBiSRH2w*u~K%d6Y|Fc_eO}lhQ1A!Z|)oX3+mS``s4O zQE>^#ibNrUi4P;{KRbbTOVweOhejS2x&Oab?s zB}^!pSukn*hb<|^*8b+28w~Kqr z5YDH20(#-gOLJR&1Q4qEEb{G)%nsAqPsEfj9FgZ% z5k%IHRQk6Xh}==R`LYmK?%(0w9zI}hkkj|3qvo$_FzU9$%Zf>(S>m|JTn!rYU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Tg_Wb@uJRrO;}Dx1|NiU&@Kn;TRk$|Y!rQcdH=8}F4%Uin(t z7W2uCLUq1ke+IBGzen))VEU<<)I-U z0r4L<3L+0=Bqfwp7!@S{(bc_0k~d^v5F7A^<(4Z9bO;D*TT>>}zxdIZo>-bQ-Oxf5 zu{C{R1?I8_3!WI;{AA&Kx8;|*Sxc|L%Yq3oukW?i;txy2_!Z7iCCTnOhujvVxsL8s zfLHR@l372@_uj9Z|0RHCOCe$cR#W&Fklmg2`(30gFlmnpxCv3<{R00jBpGmt)jxOF z-$7!m3g&ipU^Se7bt!nHfCVe;jepb31OcpxVKAgDnDqH}GqWiE0P=4v zM*~~qfA#gBV5Y@bA7+3DzB?F~`&QR(f^X2@Ud?}D{yE%DCHvdM^n&(};grErGS5tZ z)0sC#(phgcEQtOOkp8?$H#Mq-ZUMzJ{sGV*DzM)jo;M|3Z%-!PEWbznP2b&=Q@riG zlk>lv|J75!(1^Wz<~L>kt`!-7SU%tHo&RgV{pS2{s#)D0Wse1JLHtLi=ug!I?>6S9 zLejN_$q!o>{RPthtd(^a_okAL;4NH8iCeh;A2p`Cpf{CVu0?u&n3B{j(0^wQ{z$Ut zF3L@@iQ8Q&Df3g5{|HR{ZyGUoac@%YUrSm1Fhqr4PyPM@@$21lzgbIt%?SF#R&{=X@po9`C;Xsy0dCeKT$g13uui+5 z0{puM;jR|cUB@?HjlbPHOP;@U{EOm-yBIgK!q+d^|FClJUt#>_!rsi?U8j_P7-95J z-TpMeeD`E;CZujp^Iu|r>h)Jyz`M?GhLx{#T0cxN{^!pBAj5SRyKy50$qLSTURK|Fca-~JC(R-+UE literal 0 HcmV?d00001 diff --git a/android_opd_queue_tv/gradle/wrapper/gradle-wrapper.properties b/android_opd_queue_tv/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..19a6bde --- /dev/null +++ b/android_opd_queue_tv/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/android_opd_queue_tv/gradlew b/android_opd_queue_tv/gradlew new file mode 100644 index 0000000..adff685 --- /dev/null +++ b/android_opd_queue_tv/gradlew @@ -0,0 +1,248 @@ +#!/bin/sh + +# +# Copyright © 2015 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/android_opd_queue_tv/gradlew.bat b/android_opd_queue_tv/gradlew.bat new file mode 100644 index 0000000..c4bdd3a --- /dev/null +++ b/android_opd_queue_tv/gradlew.bat @@ -0,0 +1,93 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/app/Config/Routes.php b/app/Config/Routes.php index f091e78..74d2c6a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -1413,6 +1413,14 @@ $routes->group('setting', static function($routes) { $routes->post('admin/opd-queue-tv/save', 'Setting\\OpdQueueSetting::save'); $routes->post('admin/opd-queue-tv/upload-banner', 'Setting\\OpdQueueSetting::uploadBanner'); $routes->post('admin/opd-queue-tv/delete-banner', 'Setting\\OpdQueueSetting::deleteBanner'); + $routes->get('admin/medical-store', 'Setting\\MedicalStoreAdmin::index'); + $routes->post('admin/medical-store/save', 'Setting\\MedicalStoreAdmin::save'); + $routes->post('admin/medical-store/delete', 'Setting\\MedicalStoreAdmin::delete'); + $routes->post('admin/medical-store/generate-otp', 'Setting\\MedicalStoreAdmin::generateOtp'); + $routes->post('admin/medical-store/regenerate-key', 'Setting\\MedicalStoreAdmin::regenerateSecurityKey'); + $routes->post('admin/medical-store/revoke-device', 'Setting\\MedicalStoreAdmin::revokeDevice'); + $routes->post('admin/medical-store/import-marg', 'Setting\\MedicalStoreAdmin::importMarg'); + $routes->get('admin/bed-management', 'Setting\\BedManagement::index', ['filter' => $settingsBedFilter]); $routes->get('admin/departments', 'Setting\\BedManagement::departments', ['filter' => $settingsBedFilter]); $routes->post('admin/departments/save', 'Setting\\BedManagement::saveDepartment', ['filter' => $settingsBedFilter]); @@ -1641,5 +1649,45 @@ $routes->group('api/v1', ['namespace' => 'App\Controllers\Api\v1'], static funct $routes->get('doctor/ipd/list/(:num)', 'DoctorApi::ipdList/$1'); $routes->get('doctor/ipd/workspace/(:num)', 'DoctorApi::patientWorkspace/$1'); $routes->post('doctor/ipd/treatment/save/(:num)', 'DoctorApi::saveTreatmentNote/$1'); + + // Medical Store PWA APIs + $routes->get('medical-store/stores', 'MedicalStoreApi::stores'); + $routes->post('medical-store/stores/save', 'MedicalStoreApi::saveStore'); + $routes->get('medical-store/patient/search', 'MedicalStoreApi::searchPatient'); + $routes->get('medical-store/patient/prescription/(:segment)/(:num)', 'MedicalStoreApi::getPrescription/$1/$2'); + $routes->get('medical-store/items/search', 'MedicalStoreApi::searchItems'); + $routes->post('medical-store/stock/opening', 'MedicalStoreApi::saveOpeningStock'); + $routes->get('medical-store/stock/list', 'MedicalStoreApi::stockList'); + $routes->get('medical-store/stock/alerts', 'MedicalStoreApi::stockAlerts'); + $routes->post('medical-store/sales/save', 'MedicalStoreApi::saveSale'); + $routes->get('medical-store/sales/invoice/(:num)', 'MedicalStoreApi::getInvoice/$1'); + $routes->get('medical-store/sales/recent', 'MedicalStoreApi::recentSales'); + $routes->get('medical-store/suppliers', 'MedicalStoreApi::suppliers'); + $routes->post('medical-store/suppliers/save', 'MedicalStoreApi::saveSupplier'); + $routes->post('medical-store/purchase/save', 'MedicalStoreApi::savePurchase'); + $routes->post('medical-store/purchase/payment', 'MedicalStoreApi::saveSupplierPayment'); + $routes->post('medical-store/transfer/request', 'MedicalStoreApi::requestTransfer'); + $routes->post('medical-store/transfer/dispatch', 'MedicalStoreApi::dispatchTransfer'); + $routes->post('medical-store/transfer/receive', 'MedicalStoreApi::receiveTransfer'); + $routes->get('medical-store/accounting/supplier-ledger/(:num)', 'MedicalStoreApi::getSupplierLedger/$1'); + $routes->get('medical-store/accounting/patient-ledger/(:segment)', 'MedicalStoreApi::getPatientLedger/$1'); + $routes->get('medical-store/accounting/daybook', 'MedicalStoreApi::getDaybook'); + $routes->get('medical-store/accounting/gst-report', 'MedicalStoreApi::getGstReport'); + $routes->get('medical-store/accounting/bank-reconciliation', 'MedicalStoreApi::getBankReconciliation'); + $routes->post('medical-store/accounting/reconcile-bank', 'MedicalStoreApi::reconcileBank'); + $routes->get('medical-store/compliance/schedule-h1-register', 'MedicalStoreApi::getScheduleH1Register'); + $routes->post('medical-store/device/verify', 'MedicalStoreApi::verifyDevice'); + $routes->post('medical-store/device/check', 'MedicalStoreApi::checkDeviceStatus'); + $routes->post('medical-store/stock/import-marg', 'MedicalStoreApi::importMarg'); + $routes->get('medical-store/abdm/bundle/(:num)', 'MedicalStoreApi::getAbdmBundle/$1'); + $routes->post('medical-store/abdm/link-abha', 'MedicalStoreApi::linkAbha'); }); +// Dedicated Direct Store Links (e.g. /MedicalStore/storeA, /MedicalStore/storeB) +$routes->get('MedicalStore', 'Api\v1\MedicalStoreApi::pwaIndex'); +$routes->get('MedicalStore/(:any)', 'Api\v1\MedicalStoreApi::pwaIndex/$1'); +$routes->get('app/medical-store', 'Api\v1\MedicalStoreApi::pwaIndex'); +$routes->get('app/medical-store/(:any)', 'Api\v1\MedicalStoreApi::pwaIndex/$1'); + + + diff --git a/app/Controllers/Api/v1/MedicalStoreApi.php b/app/Controllers/Api/v1/MedicalStoreApi.php new file mode 100644 index 0000000..771dcd0 --- /dev/null +++ b/app/Controllers/Api/v1/MedicalStoreApi.php @@ -0,0 +1,2167 @@ +db = \Config\Database::connect(); + } + + /** + * Serves the React PWA App entry point at /MedicalStore/{slug} or /app/medical-store + */ + public function pwaIndex($slug = null) + { + $pwaPath = FCPATH . 'App/MedicalStore/index.html'; + if (file_exists($pwaPath)) { + $html = file_get_contents($pwaPath); + if ($slug !== null) { + $cleanSlug = htmlspecialchars($slug, ENT_QUOTES, 'UTF-8'); + $html = str_replace( + '', + "\n ", + $html + ); + } + return $this->response->setBody($html); + } + + return $this->response->setJSON([ + 'app_name' => 'Medical Store & Multi-Building Pharmacy System', + 'status' => 'ready', + 'api_base_url' => base_url('api/v1/medical-store/'), + 'message' => 'Medical Store PWA directory active. REST API ready.' + ]); + } + + // ========================================================================= + // 1. STORE & COUNTER MANAGEMENT + // ========================================================================= + + public function stores() + { + $slug = trim($this->request->getGet('slug') ?? ''); + $builder = $this->db->table('mst_stores'); + $builder->where('is_active', 1); + + if (!empty($slug)) { + $builder->groupStart() + ->where('store_slug', $slug) + ->orWhere('store_code', $slug) + ->groupEnd(); + } + + $stores = $builder->orderBy('is_main_store', 'DESC')->get()->getResultArray(); + return $this->response->setJSON(['status' => 1, 'stores' => $stores]); + } + + + public function saveStore() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + if (empty($json['store_name']) || empty($json['store_code'])) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Store Name and Store Code are required.']); + } + + $storeId = !empty($json['store_id']) ? (int)$json['store_id'] : 0; + $data = [ + 'store_code' => trim($json['store_code']), + 'store_name' => trim($json['store_name']), + 'building_name' => trim($json['building_name'] ?? ''), + 'floor_no' => trim($json['floor_no'] ?? ''), + 'room_no' => trim($json['room_no'] ?? ''), + 'is_main_store' => !empty($json['is_main_store']) ? 1 : 0, + 'drug_license_no_20b' => trim($json['drug_license_no_20b'] ?? ''), + 'drug_license_no_21b' => trim($json['drug_license_no_21b'] ?? ''), + 'drug_license_no_20f_x' => trim($json['drug_license_no_20f_x'] ?? ''), + 'gstin' => strtoupper(trim($json['gstin'] ?? '')), + 'pan_no' => strtoupper(trim($json['pan_no'] ?? '')), + 'fssai_no' => trim($json['fssai_no'] ?? ''), + 'state_code' => trim($json['state_code'] ?? '07'), + 'state_name' => trim($json['state_name'] ?? 'Delhi'), + 'registered_pharmacist_name' => trim($json['registered_pharmacist_name'] ?? ''), + 'pharmacist_reg_no' => trim($json['pharmacist_reg_no'] ?? ''), + 'contact_phone' => trim($json['contact_phone'] ?? ''), + 'contact_email' => trim($json['contact_email'] ?? ''), + 'address' => trim($json['address'] ?? ''), + 'invoice_prefix' => trim($json['invoice_prefix'] ?? 'INV/'), + 'next_invoice_no' => !empty($json['next_invoice_no']) ? (int)$json['next_invoice_no'] : 1001, + 'bank_name' => trim($json['bank_name'] ?? ''), + 'bank_account_no' => trim($json['bank_account_no'] ?? ''), + 'bank_ifsc' => trim($json['bank_ifsc'] ?? ''), + 'upi_id' => trim($json['upi_id'] ?? ''), + 'abdm_hfr_id' => trim($json['abdm_hfr_id'] ?? ''), + 'abdm_hip_id' => trim($json['abdm_hip_id'] ?? ''), + 'pharmacist_hpr_id' => trim($json['pharmacist_hpr_id'] ?? ''), + 'terms_conditions' => trim($json['terms_conditions'] ?? ''), + 'is_active' => isset($json['is_active']) ? (int)$json['is_active'] : 1, + ]; + + $table = $this->db->table('mst_stores'); + if ($storeId > 0) { + $table->where('store_id', $storeId)->update($data); + $msg = 'Store details updated successfully.'; + } else { + $table->insert($data); + $storeId = $this->db->insertID(); + $msg = 'New pharmacy store created successfully.'; + } + + return $this->response->setJSON(['status' => 1, 'message' => $msg, 'store_id' => $storeId]); + } + + // ========================================================================= + // 2. CORE HMS PATIENT INTEGRATION (UHID, IPD, OPD, DOCTOR PRESCRIPTIONS) + // ========================================================================= + + public function searchPatient() + { + $q = trim($this->request->getGet('q') ?? ''); + if (strlen($q) < 2) { + return $this->response->setJSON(['status' => 1, 'patients' => []]); + } + + // Search patient_master by UHID, Mobile, Name, ABHA ID, ABHA Address + $builder = $this->db->table('patient_master p'); + $builder->select('p.id as patient_id, p.p_code as uhid, p.p_fname, p.p_lname, p.title, p.mphone1, p.gender, p.age, p.dob, p.add1, p.city, p.abha_id, p.abha_address, p.abha_verified_status, p.abha_kyc_verified'); + $builder->groupStart() + ->like('p.p_code', $q) + ->orLike('p.mphone1', $q) + ->orLike('p.p_fname', $q) + ->orLike('p.p_lname', $q) + ->orLike("CONCAT(p.p_fname, ' ', p.p_lname)", $q) + ->orLike('p.abha_id', $q) + ->orLike('p.abha_address', $q) + ->groupEnd(); + $patients = $builder->limit(15)->get()->getResultArray(); + + $enriched = []; + foreach ($patients as $pt) { + $pId = (int)$pt['patient_id']; + $genderStr = ((int)$pt['gender'] === 1) ? 'Male' : (((int)$pt['gender'] === 2) ? 'Female' : 'Other'); + $fullName = trim(($pt['title'] ? $pt['title'] . ' ' : '') . $pt['p_fname'] . ' ' . ($pt['p_lname'] ?? '')); + + // Check Active OPD for today + $opdRow = $this->db->table('opd_master') + ->where('p_id', $pId) + ->orderBy('opd_id', 'DESC') + ->limit(1) + ->get() + ->getRowArray(); + + // Check Active IPD Admission + $ipdRow = $this->db->table('ipd_master') + ->where('p_id', $pId) + ->groupStart() + ->where('discharge_date IS NULL') + ->orWhere('discharge_date', '0000-00-00') + ->groupEnd() + ->orderBy('id', 'DESC') + ->limit(1) + ->get() + ->getRowArray(); + + $bedInfo = null; + if ($ipdRow) { + if (!empty($ipdRow['bed_no'])) { + $bedInfo = [ + 'bed_id' => $ipdRow['bed_no'], + 'bed_no' => $ipdRow['bed_no'], + 'ward_name' => 'Hospital Ward' + ]; + } + } + + $enriched[] = [ + 'patient_id' => $pId, + 'uhid' => $pt['uhid'] ?? '', + 'full_name' => $fullName, + 'mobile' => $pt['mphone1'] ?? '', + 'gender' => $genderStr, + 'age' => $pt['age'] ? $pt['age'] . ' Y' : 'N/A', + 'abha_id' => $pt['abha_id'] ?? '', + 'abha_address' => $pt['abha_address'] ?? '', + 'is_abha_linked' => (!empty($pt['abha_id']) || !empty($pt['abha_address'])), + 'abha_verified_status' => $pt['abha_verified_status'] ?? '', + 'abha_kyc_verified' => (int)($pt['abha_kyc_verified'] ?? 0), + 'has_active_opd'=> !empty($opdRow), + 'active_opd' => $opdRow ? [ + 'opd_id' => (int)$opdRow['opd_id'], + 'opd_code' => $opdRow['opd_code'] ?? '', + 'doctor_id' => (int)($opdRow['doc_id'] ?? 0), + 'doctor_name' => $opdRow['doc_name'] ?? '', + 'visit_date' => $opdRow['opd_book_date'] ?? '' + ] : null, + 'has_active_ipd'=> !empty($ipdRow), + 'active_ipd' => $ipdRow ? [ + 'ipd_id' => (int)$ipdRow['id'], + 'ipd_code' => $ipdRow['ipd_code'] ?? '', + 'doctor_id' => (int)($ipdRow['r_doc_id'] ?? 0), + 'doctor_name' => $ipdRow['r_doc_name'] ?? '', + 'admit_date' => $ipdRow['register_date'] ?? '', + 'bed_info' => $bedInfo + ] : null, + ]; + } + + return $this->response->setJSON(['status' => 1, 'patients' => $enriched]); + } + + public function getPrescription(string $encounterType, int $encounterId) + { + $medicines = []; + $encounterType = strtolower($encounterType); + + if ($encounterType === 'opd') { + // Fetch medicines from opd_prescription or related tables + $prescRows = $this->db->table('opd_prescription') + ->where('opd_id', $encounterId) + ->orderBy('id', 'DESC') + ->get() + ->getResultArray(); + + foreach ($prescRows as $pr) { + $medName = $pr['medicine_name'] ?? ($pr['item_name'] ?? ''); + if (!empty($medName)) { + $medicines[] = [ + 'medicine_name' => $medName, + 'dosage' => $pr['dosage'] ?? ($pr['dose'] ?? '1 Tab'), + 'frequency' => $pr['dosage_freq_str'] ?? ($pr['frequency'] ?? '1-0-1'), + 'duration' => $pr['no_of_days'] ?? ($pr['duration'] ?? '5 Days'), + 'instructions' => $pr['remark'] ?? ($pr['instructions'] ?? 'After meals'), + 'prescribed_qty'=> (int)($pr['qty'] ?? 10) + ]; + } + } + } elseif ($encounterType === 'ipd') { + // Check IPD treatment chart / nursing entries + $nursingMeds = $this->db->table('ipd_nursing_entries') + ->where('ipd_id', $encounterId) + ->where('entry_type', 'medication') + ->orderBy('id', 'DESC') + ->limit(20) + ->get() + ->getResultArray(); + + foreach ($nursingMeds as $nm) { + $data = json_decode($nm['entry_data'] ?? '{}', true); + if (!empty($data['medicine_name'])) { + $medicines[] = [ + 'medicine_name' => $data['medicine_name'], + 'dosage' => $data['dosage'] ?? '1 Tab', + 'frequency' => $data['frequency'] ?? 'Stat', + 'duration' => 'As directed', + 'instructions' => $data['notes'] ?? '', + 'prescribed_qty'=> (int)($data['qty'] ?? 5) + ]; + } + } + } + + return $this->response->setJSON([ + 'status' => 1, + 'encounter_type' => $encounterType, + 'encounter_id' => $encounterId, + 'medicines' => $medicines + ]); + } + + // ========================================================================= + // 3. ITEM MASTER, BATCHES & STOCK MANAGEMENT + // ========================================================================= + + public function searchItems() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $q = trim($this->request->getGet('q') ?? ''); + + $builder = $this->db->table('mst_items i'); + $builder->select('i.item_id, i.item_name, i.generic_name, i.category, i.hsn_code, i.gst_rate, i.unit_pack, i.units_per_pack, i.drug_schedule, i.manufacturer_name, i.barcode'); + $builder->where('i.is_active', 1); + + if (!empty($q)) { + $builder->groupStart() + ->like('i.item_name', $q) + ->orLike('i.generic_name', $q) + ->orLike('i.barcode', $q) + ->groupEnd(); + } + + $items = $builder->limit(30)->get()->getResultArray(); + $today = date('Y-m-d'); + $nearExpiryThreshold = date('Y-m-d', strtotime('+90 days')); + + $enriched = []; + foreach ($items as $it) { + $itemId = (int)$it['item_id']; + + // Fetch batches in stock for this store, ordered by FEFO (expiry_date ASC) + $batches = $this->db->table('mst_batches b') + ->select('b.batch_id, b.batch_no, b.expiry_date, b.mrp, b.ptr, b.purchase_rate_net, b.gst_rate, s.current_qty') + ->join('mst_stock s', 's.batch_id = b.batch_id AND s.store_id = ' . $storeId, 'inner') + ->where('b.item_id', $itemId) + ->where('b.store_id', $storeId) + ->where('s.current_qty >', 0) + ->orderBy('b.expiry_date', 'ASC') + ->get() + ->getResultArray(); + + $batchList = []; + $totalStock = 0; + foreach ($batches as $b) { + $isExpired = ($b['expiry_date'] <= $today); + $isNearExpiry = (!$isExpired && $b['expiry_date'] <= $nearExpiryThreshold); + $totalStock += (int)$b['current_qty']; + + $batchList[] = [ + 'batch_id' => (int)$b['batch_id'], + 'batch_no' => $b['batch_no'], + 'expiry_date' => $b['expiry_date'], + 'expiry_display' => date('m/Y', strtotime($b['expiry_date'])), + 'mrp' => (float)$b['mrp'], + 'ptr' => (float)$b['ptr'], + 'gst_rate' => (float)$b['gst_rate'], + 'current_qty' => (int)$b['current_qty'], + 'is_expired' => $isExpired, + 'is_near_expiry' => $isNearExpiry + ]; + } + + $it['batches'] = $batchList; + $it['total_stock'] = $totalStock; + // Best FEFO batch: first non-expired batch with stock + $fefoBatch = null; + foreach ($batchList as $b) { + if (!$b['is_expired']) { + $fefoBatch = $b; + break; + } + } + $it['fefo_batch'] = $fefoBatch; + $enriched[] = $it; + } + + return $this->response->setJSON(['status' => 1, 'items' => $enriched]); + } + + public function saveOpeningStock() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $storeId = (int)($json['store_id'] ?? 1); + $items = $json['items'] ?? []; + + if (empty($items)) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'No items provided for opening stock.']); + } + + $this->db->transStart(); + $totalOpeningValue = 0; + + foreach ($items as $row) { + $itemId = (int)($row['item_id'] ?? 0); + $batchNo = trim($row['batch_no'] ?? 'OP-01'); + $expiryDate = trim($row['expiry_date'] ?? date('Y-12-31', strtotime('+1 year'))); + $qty = (int)($row['qty'] ?? 0); + $mrp = (float)($row['mrp'] ?? 0); + $ptr = (float)($row['ptr'] ?? ($mrp * 0.75)); + $gstRate = (float)($row['gst_rate'] ?? 12.00); + + if ($itemId <= 0 || $qty <= 0) continue; + + // Check or insert batch + $batchRow = $this->db->table('mst_batches') + ->where('store_id', $storeId) + ->where('item_id', $itemId) + ->where('batch_no', $batchNo) + ->get() + ->getRowArray(); + + if ($batchRow) { + $batchId = (int)$batchRow['batch_id']; + } else { + $this->db->table('mst_batches')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_no' => $batchNo, + 'mfg_date' => date('Y-01-01'), + 'expiry_date' => $expiryDate, + 'mrp' => $mrp, + 'ptr' => $ptr, + 'purchase_rate_net' => $ptr * (1 + $gstRate / 100), + 'gst_rate' => $gstRate, + ]); + $batchId = $this->db->insertID(); + } + + // Update or insert stock + $stockRow = $this->db->table('mst_stock') + ->where('store_id', $storeId) + ->where('item_id', $itemId) + ->where('batch_id', $batchId) + ->get() + ->getRowArray(); + + if ($stockRow) { + $this->db->table('mst_stock') + ->where('stock_id', $stockRow['stock_id']) + ->update(['current_qty' => $stockRow['current_qty'] + $qty]); + } else { + $this->db->table('mst_stock')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_id' => $batchId, + 'current_qty' => $qty + ]); + } + + $lineVal = $qty * $ptr; + $totalOpeningValue += $lineVal; + + // Log in stock audit + $this->db->table('mst_stock_audit')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_id' => $batchId, + 'audit_type' => 'OPENING_STOCK', + 'system_qty' => 0, + 'physical_qty' => $qty, + 'variation_qty' => $qty, + 'rate' => $ptr, + 'total_value' => $lineVal, + 'remarks' => 'Opening Stock Onboarding' + ]); + } + + // Post Journal Ledger Entry: Dr Stock in Hand, Cr Opening Stock Capital + if ($totalOpeningValue > 0) { + $voucherNo = 'OPN-' . $storeId . '-' . date('YmdHis'); + $stockHead = $this->db->table('mst_account_heads')->where('head_code', '1003')->get()->getRowArray(); + $equityHead = $this->db->table('mst_account_heads')->where('head_code', '3004')->get()->getRowArray(); + + if ($stockHead && $equityHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, + 'voucher_no' => $voucherNo, + 'voucher_type' => 'OPENING_STOCK', + 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $stockHead['head_id'], + 'debit_amount' => $totalOpeningValue, + 'credit_amount' => 0, + 'narration' => 'Opening Stock Inward Valuation' + ]); + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, + 'voucher_no' => $voucherNo, + 'voucher_type' => 'OPENING_STOCK', + 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $equityHead['head_id'], + 'debit_amount' => 0, + 'credit_amount' => $totalOpeningValue, + 'narration' => 'Opening Stock Capital Credit' + ]); + } + } + + $this->db->transComplete(); + + if ($this->db->transStatus() === false) { + return $this->response->setStatusCode(500)->setJSON(['status' => 0, 'message' => 'Failed to save opening stock.']); + } + + return $this->response->setJSON([ + 'status' => 1, + 'message' => 'Opening stock saved successfully.', + 'total_valuation' => $totalOpeningValue + ]); + } + + public function stockList() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $filter = trim($this->request->getGet('filter') ?? 'all'); // all, low, near_expiry, expired + + $builder = $this->db->table('mst_stock s'); + $builder->select('s.stock_id, s.current_qty, s.last_updated_at, i.item_id, i.item_name, i.generic_name, i.category, i.hsn_code, i.drug_schedule, i.min_reorder_level, b.batch_id, b.batch_no, b.expiry_date, b.mrp, b.ptr, b.gst_rate'); + $builder->join('mst_items i', 'i.item_id = s.item_id', 'inner'); + $builder->join('mst_batches b', 'b.batch_id = s.batch_id', 'inner'); + $builder->where('s.store_id', $storeId); + + $today = date('Y-m-d'); + $nearThreshold = date('Y-m-d', strtotime('+90 days')); + + if ($filter === 'expired') { + $builder->where('b.expiry_date <=', $today); + } elseif ($filter === 'near_expiry') { + $builder->where('b.expiry_date >', $today)->where('b.expiry_date <=', $nearThreshold); + } elseif ($filter === 'low') { + $builder->where('s.current_qty <= i.min_reorder_level'); + } + + $stockRows = $builder->orderBy('i.item_name', 'ASC')->orderBy('b.expiry_date', 'ASC')->get()->getResultArray(); + + $totalCostValuation = 0; + $totalMrpValuation = 0; + $totalItems = count($stockRows); + + foreach ($stockRows as &$row) { + $qty = (int)$row['current_qty']; + $ptr = (float)$row['ptr']; + $mrp = (float)$row['mrp']; + $costVal = $qty * $ptr; + $mrpVal = $qty * $mrp; + + $totalCostValuation += $costVal; + $totalMrpValuation += $mrpVal; + + $row['cost_valuation'] = round($costVal, 2); + $row['mrp_valuation'] = round($mrpVal, 2); + $row['is_expired'] = ($row['expiry_date'] <= $today); + $row['is_near_expiry'] = (!$row['is_expired'] && $row['expiry_date'] <= $nearThreshold); + $row['expiry_display'] = date('m/Y', strtotime($row['expiry_date'])); + } + + return $this->response->setJSON([ + 'status' => 1, + 'store_id' => $storeId, + 'filter' => $filter, + 'summary' => [ + 'total_rows' => $totalItems, + 'total_cost_valuation' => round($totalCostValuation, 2), + 'total_mrp_valuation' => round($totalMrpValuation, 2) + ], + 'stock' => $stockRows + ]); + } + + public function stockAlerts() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $today = date('Y-m-d'); + $near30 = date('Y-m-d', strtotime('+30 days')); + $near60 = date('Y-m-d', strtotime('+60 days')); + $near90 = date('Y-m-d', strtotime('+90 days')); + + $expired = $this->db->table('mst_stock s') + ->select('s.current_qty, i.item_name, b.batch_no, b.expiry_date, b.mrp') + ->join('mst_items i', 'i.item_id = s.item_id') + ->join('mst_batches b', 'b.batch_id = s.batch_id') + ->where('s.store_id', $storeId) + ->where('s.current_qty >', 0) + ->where('b.expiry_date <=', $today) + ->get()->getResultArray(); + + $nearExpiry = $this->db->table('mst_stock s') + ->select('s.current_qty, i.item_name, b.batch_no, b.expiry_date, b.mrp') + ->join('mst_items i', 'i.item_id = s.item_id') + ->join('mst_batches b', 'b.batch_id = s.batch_id') + ->where('s.store_id', $storeId) + ->where('s.current_qty >', 0) + ->where('b.expiry_date >', $today) + ->where('b.expiry_date <=', $near90) + ->orderBy('b.expiry_date', 'ASC') + ->get()->getResultArray(); + + $lowStock = $this->db->table('mst_stock s') + ->select('s.current_qty, i.item_name, i.min_reorder_level') + ->join('mst_items i', 'i.item_id = s.item_id') + ->where('s.store_id', $storeId) + ->where('s.current_qty <= i.min_reorder_level') + ->get()->getResultArray(); + + return $this->response->setJSON([ + 'status' => 1, + 'alerts' => [ + 'expired_count' => count($expired), + 'expired_items' => $expired, + 'near_expiry_count' => count($nearExpiry), + 'near_expiry_items' => $nearExpiry, + 'low_stock_count' => count($lowStock), + 'low_stock_items' => $lowStock + ] + ]); + } + + // ========================================================================= + // 4. POS BILLING & DISPENSING + // ========================================================================= + + public function saveSale() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $storeId = (int)($json['store_id'] ?? 1); + $items = $json['items'] ?? []; + + if (empty($items)) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Cart is empty.']); + } + + // Fetch Store Config + $store = $this->db->table('mst_stores')->where('store_id', $storeId)->get()->getRowArray(); + if (!$store) { + return $this->response->setStatusCode(404)->setJSON(['status' => 0, 'message' => 'Pharmacy store not found.']); + } + + $this->db->transStart(); + + // Generate sequential invoice number + $prefix = $store['invoice_prefix'] ?: 'INV/'; + $seq = (int)$store['next_invoice_no']; + $invoiceNo = $prefix . str_pad((string)$seq, 5, '0', STR_PAD_LEFT); + + // Increment sequence in store + $this->db->table('mst_stores')->where('store_id', $storeId)->update(['next_invoice_no' => $seq + 1]); + + $wholeDiscType = trim((string)($json['whole_discount_type'] ?? 'pct')); // 'pct' or 'val' + $wholeDiscVal = (float)($json['whole_discount_val'] ?? 0); + + $grossAmount = 0; + $itemDiscountTotal = 0; + $hasScheduleH1 = 0; + $today = date('Y-m-d'); + $preItems = []; + + foreach ($items as $item) { + $itemId = (int)$item['item_id']; + $batchId = (int)$item['batch_id']; + $rawQty = (int)($item['qty'] ?? 1); + + // Fetch batch & check expiry and stock + $batch = $this->db->table('mst_batches b') + ->select('b.*, i.item_name, i.drug_schedule, i.hsn_code, i.unit_pack, i.units_per_pack, i.snomed_ct_code, i.snomed_display, s.current_qty') + ->join('mst_items i', 'i.item_id = b.item_id') + ->join('mst_stock s', 's.batch_id = b.batch_id AND s.store_id = ' . $storeId) + ->where('b.batch_id', $batchId) + ->where('b.store_id', $storeId) + ->get() + ->getRowArray(); + + if (!$batch) { + $this->db->transRollback(); + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => "Batch not found for item #$itemId."]); + } + + // Strictly prevent dispensing expired drugs (Indian Drugs & Cosmetics Act) + if ($batch['expiry_date'] <= $today) { + $this->db->transRollback(); + return $this->response->setStatusCode(400)->setJSON([ + 'status' => 0, + 'message' => "STATUTORY BLOCK: Medicine '{$batch['item_name']}' (Batch {$batch['batch_no']}) expired on " . date('d-m-Y', strtotime($batch['expiry_date'])) . ". Cannot be sold!" + ]); + } + + $unitsPerPack = (int)($batch['units_per_pack'] ?? 1); + if ($unitsPerPack <= 0) $unitsPerPack = 1; + + $sellUnit = trim((string)($item['sell_unit'] ?? 'Strip')); + $mrp = (float)$batch['mrp']; // Strip MRP + $perUnitMrp = $unitsPerPack > 0 ? ($mrp / $unitsPerPack) : $mrp; + + if ($unitsPerPack <= 1) { + $totalUnits = max(1, (int)($item['qty'] ?? 1)); + $dispQty = $totalUnits; + $lineGross = round($totalUnits * $mrp, 2); + $effectiveUnitPrice = $mrp; + $packQty = (float)$totalUnits; + $looseQty = 0; + $sellUnit = $batch['unit_pack'] ?: 'Unit'; + } elseif ($sellUnit === 'Unit' || $sellUnit === 'Tablet' || $sellUnit === 'Loose') { + $totalUnits = max(1, (int)($item['loose_qty'] ?? $item['qty'] ?? 1)); + $dispQty = $totalUnits; + $lineGross = round($totalUnits * $perUnitMrp, 2); + $effectiveUnitPrice = round($perUnitMrp, 2); + $packQty = round($totalUnits / $unitsPerPack, 2); + $looseQty = $totalUnits; + $sellUnit = 'Tablet'; + } elseif ($sellUnit === 'Combo') { + $sq = max(0, (int)($item['strip_qty'] ?? 0)); + $lq = max(0, (int)($item['loose_qty'] ?? 0)); + $totalUnits = ($sq * $unitsPerPack) + $lq; + if ($totalUnits <= 0) $totalUnits = 1; + $dispQty = $sq; + $lineGross = round(($sq * $mrp) + ($lq * $perUnitMrp), 2); + $effectiveUnitPrice = $mrp; + $packQty = round($totalUnits / $unitsPerPack, 2); + $looseQty = $lq; + } else { // 'Strip' + $sq = max(1, (int)($item['strip_qty'] ?? $item['qty'] ?? 1)); + $totalUnits = $sq * $unitsPerPack; + $dispQty = $sq; + $lineGross = round($sq * $mrp, 2); + $effectiveUnitPrice = $mrp; + $packQty = (float)$sq; + $looseQty = 0; + $sellUnit = 'Strip'; + } + + // Check stock availability (current_qty is in total units/tablets) + if ((int)$batch['current_qty'] < $totalUnits) { + $this->db->transRollback(); + $availStrips = floor((int)$batch['current_qty'] / $unitsPerPack); + $availLoose = (int)$batch['current_qty'] % $unitsPerPack; + $stockDetail = $unitsPerPack > 1 ? " ({$availStrips} strips, {$availLoose} tabs)" : ""; + return $this->response->setStatusCode(400)->setJSON([ + 'status' => 0, + 'message' => "Insufficient stock for '{$batch['item_name']}'. In stock: {$batch['current_qty']} units{$stockDetail}, Requested: $totalUnits units." + ]); + } + + if ($batch['drug_schedule'] === 'Schedule H1') { + $hasScheduleH1 = 1; + } + + $itemDiscType = trim((string)($item['discount_type'] ?? 'pct')); // 'pct' or 'val' + $itemDiscVal = (float)($item['discount_val'] ?? ($item['discount_pct'] ?? 0)); + + if ($itemDiscType === 'val') { + $lineItemDisc = min($lineGross, max(0, $itemDiscVal)); + $discPct = $lineGross > 0 ? round(($lineItemDisc / $lineGross) * 100, 2) : 0; + } else { + $discPct = min(100, max(0, $itemDiscVal)); + $lineItemDisc = round(($lineGross * $discPct) / 100, 2); + } + + $grossAmount += $lineGross; + $itemDiscountTotal += $lineItemDisc; + + $preItems[] = [ + 'itemId' => $itemId, + 'batchId' => $batchId, + 'batch' => $batch, + 'qty' => $dispQty, + 'sellUnit' => $sellUnit, + 'unitsPerPack' => $unitsPerPack, + 'totalUnits' => $totalUnits, + 'effectiveUnitPrice' => $effectiveUnitPrice, + 'packQty' => $packQty, + 'looseQty' => $looseQty, + 'mrp' => $mrp, + 'lineGross' => $lineGross, + 'itemDiscType' => $itemDiscType, + 'itemDiscVal' => $itemDiscVal, + 'itemDiscPct' => $discPct, + 'lineItemDisc' => $lineItemDisc, + 'netAfterItem' => $lineGross - $lineItemDisc + ]; + } + + // Calculate whole bill discount (by percentage or by value) + $balanceAfterItemDisc = max(0, $grossAmount - $itemDiscountTotal); + $wholeDiscountAmount = 0; + if ($wholeDiscVal > 0) { + if ($wholeDiscType === 'val') { + $wholeDiscountAmount = min($balanceAfterItemDisc, $wholeDiscVal); + } else { + $wholeDiscountAmount = round(($balanceAfterItemDisc * min(100, $wholeDiscVal)) / 100, 2); + } + } + + $totalDiscount = $itemDiscountTotal + $wholeDiscountAmount; + + // Second pass: distribute whole-bill discount proportionally across lines and compute GST + $isInterState = (!empty($json['patient_state_code']) && $json['patient_state_code'] !== $store['state_code']); + $validatedItems = []; + $taxableTotal = 0; + $cgstTotal = 0; + $sgstTotal = 0; + $igstTotal = 0; + + foreach ($preItems as $pi) { + $batch = $pi['batch']; + $lineGross = $pi['lineGross']; + $itemDisc = $pi['lineItemDisc']; + + // Proportional share of whole bill discount + $allocatedWholeDisc = 0; + if ($wholeDiscountAmount > 0 && $balanceAfterItemDisc > 0) { + $lineWeight = $pi['netAfterItem'] / $balanceAfterItemDisc; + $allocatedWholeDisc = round($wholeDiscountAmount * $lineWeight, 2); + } + + $totalLineDisc = min($lineGross, $itemDisc + $allocatedWholeDisc); + $lineNet = round($lineGross - $totalLineDisc, 2); + $effectiveDiscPct = $lineGross > 0 ? round(($totalLineDisc / $lineGross) * 100, 2) : 0; + + // Compute Back-Calculated GST from line net + $gstRate = (float)$batch['gst_rate']; + if ($gstRate > 0) { + $taxableVal = round($lineNet / (1 + ($gstRate / 100)), 2); + $gstAmt = round($lineNet - $taxableVal, 2); + } else { + $taxableVal = $lineNet; + $gstAmt = 0; + } + + if ($isInterState) { + $cgst = 0; + $sgst = 0; + $igst = $gstAmt; + } else { + $cgst = round($gstAmt / 2, 2); + $sgst = round($gstAmt - $cgst, 2); + $igst = 0; + } + + $taxableTotal += $taxableVal; + $cgstTotal += $cgst; + $sgstTotal += $sgst; + $igstTotal += $igst; + + $validatedItems[] = [ + 'item_id' => $pi['itemId'], + 'item_name' => $batch['item_name'], + 'unit_pack' => $batch['unit_pack'] ?? 'Units', + 'snomed_ct_code' => $batch['snomed_ct_code'] ?? '', + 'snomed_display' => $batch['snomed_display'] ?? '', + 'batch_id' => $pi['batchId'], + 'batch_no' => $batch['batch_no'], + 'expiry_date' => $batch['expiry_date'], + 'qty' => $pi['qty'], + 'sell_unit' => $pi['sellUnit'], + 'units_per_pack' => $pi['unitsPerPack'], + 'total_units' => $pi['totalUnits'], + 'unit_price' => $pi['effectiveUnitPrice'], + 'loose_qty' => $pi['looseQty'], + 'pack_qty' => $pi['packQty'], + 'unit_mrp' => $pi['mrp'], + 'discount_type' => $pi['itemDiscType'], + 'discount_val' => $pi['itemDiscVal'], + 'discount_pct' => $effectiveDiscPct, + 'discount_amount' => $totalLineDisc, + 'hsn_code' => $batch['hsn_code'] ?: '3004', + 'gst_rate' => $gstRate, + 'taxable_value' => $taxableVal, + 'cgst_amount' => $cgst, + 'sgst_amount' => $sgst, + 'igst_amount' => $igst, + 'total_amount' => $lineNet + ]; + + // Decrement Stock by exact totalUnits (tablets/units) + $this->db->table('mst_stock') + ->where('store_id', $storeId) + ->where('batch_id', $pi['batchId']) + ->set('current_qty', 'current_qty - ' . $pi['totalUnits'], false) + ->update(); + } + + $netBeforeRound = $grossAmount - $totalDiscount; + $netRounded = round($netBeforeRound); + $roundOff = round($netRounded - $netBeforeRound, 2); + + $paymentMode = trim($json['payment_mode'] ?? 'Cash'); // Cash, UPI, Card, Mixed, IPD_Credit + $cashPaid = (float)($json['cash_paid'] ?? ($paymentMode === 'Cash' ? $netRounded : 0)); + $upiPaid = (float)($json['upi_paid'] ?? ($paymentMode === 'UPI' ? $netRounded : 0)); + $cardPaid = (float)($json['card_paid'] ?? ($paymentMode === 'Card' ? $netRounded : 0)); + $creditAmount = (float)($json['credit_amount'] ?? ($paymentMode === 'IPD_Credit' ? $netRounded : 0)); + $bankName = trim($json['bank_name'] ?? ''); + $upiRefNo = trim($json['upi_ref_no'] ?? ''); + $cardRefNo = trim($json['card_ref_no'] ?? ''); + + // ABDM Integration: Extract ABHA ID and ABHA Address + $patientId = !empty($json['patient_id']) ? (int)$json['patient_id'] : null; + $abhaId = trim((string)($json['abha_id'] ?? '')); + $abhaAddress = trim((string)($json['abha_address'] ?? '')); + + // If not in payload but patient_id exists, look up patient_master + if (($abhaId === '' || $abhaAddress === '') && $patientId > 0) { + $pRow = $this->db->table('patient_master') + ->select('abha_id, abha_address') + ->where('id', $patientId) + ->get() + ->getRowArray(); + if ($pRow) { + if ($abhaId === '' && !empty($pRow['abha_id'])) $abhaId = $pRow['abha_id']; + if ($abhaAddress === '' && !empty($pRow['abha_address'])) $abhaAddress = $pRow['abha_address']; + } + } + + // Generate unique ABDM Care Context Reference (e.g. PHARM-STMAIN-INV262700001) + $cleanPrefix = preg_replace('/[^A-Za-z0-9]/', '', $store['store_code'] ?: 'STORE'); + $cleanInv = preg_replace('/[^A-Za-z0-9]/', '', $invoiceNo); + $careContextRef = "PHARM-{$cleanPrefix}-{$cleanInv}"; + $careContextDisplay = "Pharmacy Dispensation - {$invoiceNo}"; + + // Build official ABDM FHIR R4 MedicationDispense Document Bundle + $fhirBuilder = new \App\Libraries\FhirR4Builder(); + $patientData = [ + 'id' => $patientId ?: 0, + 'uhid' => $json['uhid'] ?? '', + 'p_code' => $json['uhid'] ?? '', + 'name' => trim($json['patient_name'] ?? 'Patient'), + 'p_fname' => trim($json['patient_name'] ?? 'Patient'), + 'phone' => trim($json['patient_mobile'] ?? ''), + 'mphone1' => trim($json['patient_mobile'] ?? ''), + 'gender' => trim($json['gender'] ?? 'Male'), + 'age' => trim($json['age'] ?? '30'), + 'abha_id' => $abhaId, + 'abha_address' => $abhaAddress + ]; + + $fhirBundle = $fhirBuilder->buildPharmacyDispenseBundle($patientData, $store, [ + 'doctor_name' => trim($json['doctor_name'] ?? ''), + 'doctor_reg_no' => trim($json['doctor_reg_no'] ?? ''), + 'patient_name' => trim($json['patient_name'] ?? 'Patient'), + 'abha_id' => $abhaId, + 'abha_address' => $abhaAddress, + 'abdm_care_context_ref' => $careContextRef, + 'invoice_no' => $invoiceNo + ], $validatedItems); + + $fhirBundleJson = json_encode($fhirBundle, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); + + // Create Sale Record + $saleData = [ + 'store_id' => $storeId, + 'invoice_no' => $invoiceNo, + 'sale_date' => date('Y-m-d H:i:s'), + 'patient_type' => $json['patient_type'] ?? 'Walk-in', + 'uhid' => $json['uhid'] ?? null, + 'patient_id' => $patientId, + 'opd_id' => !empty($json['opd_id']) ? (int)$json['opd_id'] : null, + 'ipd_id' => !empty($json['ipd_id']) ? (int)$json['ipd_id'] : null, + 'patient_name' => trim($json['patient_name'] ?? 'Walk-in Customer'), + 'patient_mobile' => trim($json['patient_mobile'] ?? ''), + 'patient_address' => trim($json['patient_address'] ?? ''), + 'age' => trim($json['age'] ?? ''), + 'gender' => trim($json['gender'] ?? ''), + 'doctor_id' => !empty($json['doctor_id']) ? (int)$json['doctor_id'] : null, + 'doctor_name' => trim($json['doctor_name'] ?? ''), + 'doctor_reg_no' => trim($json['doctor_reg_no'] ?? ''), + 'ward_name' => trim($json['ward_name'] ?? ''), + 'bed_no' => trim($json['bed_no'] ?? ''), + 'gross_amount' => $grossAmount, + 'discount_amount' => $totalDiscount, + 'bill_discount_type' => $wholeDiscType, + 'bill_discount_val' => $wholeDiscVal, + 'taxable_amount' => $taxableTotal, + 'cgst_amount' => $cgstTotal, + 'sgst_amount' => $sgstTotal, + 'igst_amount' => $igstTotal, + 'round_off' => $roundOff, + 'net_amount' => $netRounded, + 'payment_mode' => $paymentMode, + 'cash_paid' => $cashPaid, + 'upi_paid' => $upiPaid, + 'card_paid' => $cardPaid, + 'credit_amount' => $creditAmount, + 'payment_reference' => trim($json['payment_reference'] ?? ''), + 'bank_name' => $bankName, + 'upi_ref_no' => $upiRefNo, + 'card_ref_no' => $cardRefNo, + 'is_bank_reconciled' => 0, + 'schedule_h1_flag' => $hasScheduleH1, + 'abha_id' => $abhaId ?: null, + 'abha_address' => $abhaAddress ?: null, + 'abdm_care_context_ref' => $careContextRef, + 'abdm_care_context_display' => $careContextDisplay, + 'abdm_fhir_bundle_json' => $fhirBundleJson, + 'abdm_sync_status' => (!empty($abhaAddress) || !empty($abhaId)) ? 'PENDING' : 'NOT_APPLICABLE', + 'status' => 'completed', + 'created_by' => (int)($json['user_id'] ?? 1) + ]; + + // If IPD Credit, optionally link into ipd_invoice_item so hospital discharge handles it + if ($paymentMode === 'IPD_Credit' && !empty($json['ipd_id'])) { + $ipdId = (int)$json['ipd_id']; + if ($this->db->tableExists('ipd_invoice_item')) { + $this->db->table('ipd_invoice_item')->insert([ + 'ipd_id' => $ipdId, + 'item_name' => "Pharmacy Medicines ({$invoiceNo})", + 'item_desc' => "Medicines dispensed from {$store['store_name']}", + 'item_qty' => 1, + 'item_price' => $netRounded, + 'item_amount' => $netRounded, + 'insert_date' => date('Y-m-d H:i:s'), + ]); + $saleData['ipd_charge_id'] = $this->db->insertID(); + } + } + + $this->db->table('mst_sales')->insert($saleData); + $saleId = $this->db->insertID(); + + // Queue in hospital central ABDM Gateway Sync Outbox if table exists + if ((!empty($abhaAddress) || !empty($patientId)) && $this->db->tableExists('abdm_sync_record')) { + $this->db->table('abdm_sync_record')->insert([ + 'local_record_id' => 'mst_sale_' . $saleId, + 'local_patient_id' => $patientId ?: 0, + 'hi_type' => 'MedicationDispense', + 'care_context_reference' => $careContextRef, + 'care_context_display' => $careContextDisplay, + 'visit_date' => date('Y-m-d'), + 'department' => 'Pharmacy (' . ($store['store_name'] ?? 'Medical Store') . ')', + 'doctor_name' => trim($json['doctor_name'] ?? ($store['registered_pharmacist_name'] ?? 'Pharmacist')), + 'fhir_bundle_json' => $fhirBundleJson, + 'hfr_id' => $store['abdm_hfr_id'] ?: 'IN0710001234', + 'sync_status' => 'PENDING', + 'source_updated_at' => date('Y-m-d H:i:s'), + 'created_at' => date('Y-m-d H:i:s') + ]); + } + + // Insert Sale Items + foreach ($validatedItems as $vItem) { + $this->db->table('mst_sales_items')->insert([ + 'sale_id' => $saleId, + 'item_id' => $vItem['item_id'], + 'batch_id' => $vItem['batch_id'], + 'batch_no' => $vItem['batch_no'], + 'expiry_date' => $vItem['expiry_date'], + 'qty' => $vItem['qty'], + 'sell_unit' => $vItem['sell_unit'] ?? 'Strip', + 'units_per_pack' => $vItem['units_per_pack'] ?? 1, + 'total_units' => $vItem['total_units'] ?? $vItem['qty'], + 'unit_price' => $vItem['unit_price'] ?? 0.00, + 'loose_qty' => $vItem['loose_qty'] ?? 0, + 'pack_qty' => $vItem['pack_qty'] ?? 1.00, + 'unit_mrp' => $vItem['unit_mrp'], + 'discount_type' => $vItem['discount_type'] ?? 'pct', + 'discount_val' => $vItem['discount_val'] ?? 0, + 'discount_pct' => $vItem['discount_pct'], + 'discount_amount' => $vItem['discount_amount'], + 'hsn_code' => $vItem['hsn_code'], + 'gst_rate' => $vItem['gst_rate'], + 'taxable_value' => $vItem['taxable_value'], + 'cgst_amount' => $vItem['cgst_amount'], + 'sgst_amount' => $vItem['sgst_amount'], + 'igst_amount' => $vItem['igst_amount'], + 'total_amount' => $vItem['total_amount'] + ]); + } + + // Post Double-Entry Journal / Ledgers + $salesHead = $this->db->table('mst_account_heads')->where('head_code', '3001')->get()->getRowArray(); + $cgstHead = $this->db->table('mst_account_heads')->where('head_code', '2002')->get()->getRowArray(); + $sgstHead = $this->db->table('mst_account_heads')->where('head_code', '2003')->get()->getRowArray(); + $igstHead = $this->db->table('mst_account_heads')->where('head_code', '2004')->get()->getRowArray(); + $discHead = $this->db->table('mst_account_heads')->where('head_code', '4002')->get()->getRowArray(); + + // 1. Debit Cash/Bank/Patient + if ($cashPaid > 0) { + $cashHead = $this->db->table('mst_account_heads')->where('head_code', '1001')->get()->getRowArray(); + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $cashHead['head_id'], 'debit_amount' => $cashPaid, 'credit_amount' => 0, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Cash received for bill $invoiceNo" + ]); + } + if ($upiPaid > 0 || $cardPaid > 0) { + $bankHead = $this->db->table('mst_account_heads')->where('head_code', '1002')->get()->getRowArray(); + $refDetails = []; + if (!empty($upiRefNo)) $refDetails[] = "UTR: {$upiRefNo}"; + if (!empty($cardRefNo)) $refDetails[] = "Card Auth: {$cardRefNo}"; + if (!empty($bankName)) $refDetails[] = "Bank: {$bankName}"; + $narrationExtra = !empty($refDetails) ? " (" . implode(', ', $refDetails) . ")" : ""; + $auditRef = !empty($upiRefNo) ? $upiRefNo : $cardRefNo; + + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $bankHead['head_id'], 'debit_amount' => ($upiPaid + $cardPaid), 'credit_amount' => 0, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "UPI/Bank received for bill $invoiceNo" . $narrationExtra, + 'reconciled_flag' => 0, + 'reconciled_ref' => $auditRef + ]); + } + if ($creditAmount > 0) { + $debtorHeadCode = ($paymentMode === 'IPD_Credit') ? '1005' : '1004'; + $debtorHead = $this->db->table('mst_account_heads')->where('head_code', $debtorHeadCode)->get()->getRowArray(); + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $debtorHead['head_id'], 'debit_amount' => $creditAmount, 'credit_amount' => 0, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Credit/IPD charge for bill $invoiceNo" + ]); + } + if ($totalDiscount > 0 && $discHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $discHead['head_id'], 'debit_amount' => $totalDiscount, 'credit_amount' => 0, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Discount allowed on bill $invoiceNo" + ]); + } + + // 2. Credit Sales & Output Tax + if ($salesHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $salesHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $taxableTotal, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Taxable Pharmacy Sales $invoiceNo" + ]); + } + if ($cgstTotal > 0 && $cgstHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $cgstHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $cgstTotal, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Output CGST on $invoiceNo" + ]); + } + if ($sgstTotal > 0 && $sgstHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $sgstHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $sgstTotal, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Output SGST on $invoiceNo" + ]); + } + if ($igstTotal > 0 && $igstHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $invoiceNo, 'voucher_type' => 'SALE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $igstHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $igstTotal, + 'reference_type' => 'sales_invoice', 'reference_id' => $saleId, 'narration' => "Output IGST on $invoiceNo" + ]); + } + + $this->db->transComplete(); + + if ($this->db->transStatus() === false) { + return $this->response->setStatusCode(500)->setJSON(['status' => 0, 'message' => 'Failed to process sales invoice.']); + } + + return $this->response->setJSON([ + 'status' => 1, + 'message' => 'Invoice generated successfully.', + 'sale_id' => $saleId, + 'invoice_no' => $invoiceNo, + 'net_amount' => $netRounded, + 'abdm' => [ + 'abha_id' => $abhaId, + 'abha_address' => $abhaAddress, + 'care_context_ref' => $careContextRef, + 'is_abdm_linked' => (!empty($abhaAddress) || !empty($abhaId)) + ] + ]); + } + + public function getInvoice(int $saleId) + { + $sale = $this->db->table('mst_sales s') + ->select('s.*, st.store_name, st.building_name, st.floor_no, st.room_no, st.drug_license_no_20b, st.drug_license_no_21b, st.drug_license_no_20f_x, st.gstin, st.pan_no, st.fssai_no, st.state_code, st.state_name, st.registered_pharmacist_name, st.pharmacist_reg_no, st.contact_phone, st.contact_email, st.address as store_address, st.upi_id, st.terms_conditions, st.abdm_hfr_id, st.abdm_hip_id, st.pharmacist_hpr_id') + ->join('mst_stores st', 'st.store_id = s.store_id') + ->where('s.sale_id', $saleId) + ->get() + ->getRowArray(); + + if (!$sale) { + return $this->response->setStatusCode(404)->setJSON(['status' => 0, 'message' => 'Invoice not found.']); + } + + $items = $this->db->table('mst_sales_items si') + ->select('si.*, i.item_name, i.generic_name, i.category, i.unit_pack, i.drug_schedule, i.snomed_ct_code, i.snomed_display') + ->join('mst_items i', 'i.item_id = si.item_id') + ->where('si.sale_id', $saleId) + ->get() + ->getResultArray(); + + // Build HSN summary table for Indian GST invoice standard + $hsnSummary = []; + foreach ($items as $it) { + $hsn = $it['hsn_code'] ?: '3004'; + $rate = (string)$it['gst_rate']; + $key = $hsn . '_' . $rate; + if (!isset($hsnSummary[$key])) { + $hsnSummary[$key] = [ + 'hsn_code' => $hsn, + 'gst_rate' => (float)$rate, + 'taxable_value' => 0, + 'cgst_amount' => 0, + 'sgst_amount' => 0, + 'igst_amount' => 0, + 'total_tax' => 0 + ]; + } + $hsnSummary[$key]['taxable_value'] += (float)$it['taxable_value']; + $hsnSummary[$key]['cgst_amount'] += (float)$it['cgst_amount']; + $hsnSummary[$key]['sgst_amount'] += (float)$it['sgst_amount']; + $hsnSummary[$key]['igst_amount'] += (float)$it['igst_amount']; + $hsnSummary[$key]['total_tax'] += ((float)$it['cgst_amount'] + (float)$it['sgst_amount'] + (float)$it['igst_amount']); + } + + // Dynamic UPI QR string + $upiQrString = ''; + if (!empty($sale['upi_id'])) { + $upiQrString = "upi://pay?pa={$sale['upi_id']}&pn=" . urlencode($sale['store_name']) . "&am={$sale['net_amount']}&cu=INR&tn=" . urlencode("Bill " . $sale['invoice_no']); + } + + return $this->response->setJSON([ + 'status' => 1, + 'sale' => $sale, + 'items' => $items, + 'hsn_summary' => array_values($hsnSummary), + 'upi_qr_string' => $upiQrString + ]); + } + + public function recentSales() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $sales = $this->db->table('mst_sales') + ->where('store_id', $storeId) + ->orderBy('sale_id', 'DESC') + ->limit(25) + ->get() + ->getResultArray(); + + return $this->response->setJSON(['status' => 1, 'sales' => $sales]); + } + + // ========================================================================= + // 5. SUPPLIERS & PURCHASES + // ========================================================================= + + public function suppliers() + { + $suppliers = $this->db->table('mst_suppliers')->where('is_active', 1)->orderBy('supplier_name', 'ASC')->get()->getResultArray(); + return $this->response->setJSON(['status' => 1, 'suppliers' => $suppliers]); + } + + public function saveSupplier() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + if (empty($json['supplier_name'])) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Supplier name is required.']); + } + + $id = !empty($json['supplier_id']) ? (int)$json['supplier_id'] : 0; + $data = [ + 'supplier_name' => trim($json['supplier_name']), + 'dl_no_20b' => trim($json['dl_no_20b'] ?? ''), + 'dl_no_21b' => trim($json['dl_no_21b'] ?? ''), + 'gstin' => strtoupper(trim($json['gstin'] ?? '')), + 'pan_no' => strtoupper(trim($json['pan_no'] ?? '')), + 'contact_person' => trim($json['contact_person'] ?? ''), + 'phone' => trim($json['phone'] ?? ''), + 'email' => trim($json['email'] ?? ''), + 'address' => trim($json['address'] ?? ''), + 'state_code' => trim($json['state_code'] ?? '07'), + 'credit_days' => !empty($json['credit_days']) ? (int)$json['credit_days'] : 30, + 'bank_details' => trim($json['bank_details'] ?? ''), + ]; + + if ($id > 0) { + $this->db->table('mst_suppliers')->where('supplier_id', $id)->update($data); + } else { + $this->db->table('mst_suppliers')->insert($data); + $id = $this->db->insertID(); + } + + return $this->response->setJSON(['status' => 1, 'message' => 'Supplier saved successfully.', 'supplier_id' => $id]); + } + + public function savePurchase() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $storeId = (int)($json['store_id'] ?? 1); + $supplierId = (int)($json['supplier_id'] ?? 0); + $items = $json['items'] ?? []; + + if ($supplierId <= 0 || empty($items)) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Supplier and items are required.']); + } + + $this->db->transStart(); + + $taxableTotal = 0; + $cgstTotal = 0; + $sgstTotal = 0; + $igstTotal = 0; + $discountTotal = (float)($json['discount_amount'] ?? 0); + + $purchaseItems = []; + + foreach ($items as $it) { + $itemId = (int)$it['item_id']; + $batchNo = trim($it['batch_no']); + $expiryDate = trim($it['expiry_date']); + $qtyPacks = (int)$it['qty_packs']; + $freePacks = (int)($it['free_qty_packs'] ?? 0); + $unitsPerPack = (int)($it['units_per_pack'] ?? 10); + $totalUnits = ($qtyPacks + $freePacks) * $unitsPerPack; + + $mrp = (float)$it['mrp']; + $ptr = (float)$it['ptr']; + $discPct = (float)($it['discount_pct'] ?? 0); + $gstRate = (float)($it['gst_rate'] ?? 12.00); + + $lineNetPtr = ($qtyPacks * $ptr) * (1 - ($discPct / 100)); + $taxAmount = round($lineNetPtr * ($gstRate / 100), 2); + + $cgst = round($taxAmount / 2, 2); + $sgst = round($taxAmount - $cgst, 2); + $igst = 0; + $lineTotal = round($lineNetPtr + $taxAmount, 2); + $netUnitLanding = round($lineTotal / $totalUnits, 2); + + $taxableTotal += $lineNetPtr; + $cgstTotal += $cgst; + $sgstTotal += $sgst; + + $purchaseItems[] = [ + 'item_id' => $itemId, + 'batch_no' => $batchNo, + 'expiry_date' => $expiryDate, + 'qty_packs' => $qtyPacks, + 'free_qty_packs' => $freePacks, + 'units_per_pack' => $unitsPerPack, + 'total_units' => $totalUnits, + 'mrp' => $mrp, + 'ptr' => $ptr, + 'discount_pct' => $discPct, + 'hsn_code' => $it['hsn_code'] ?? '3004', + 'gst_rate' => $gstRate, + 'taxable_value' => $lineNetPtr, + 'cgst_amount' => $cgst, + 'sgst_amount' => $sgst, + 'igst_amount' => $igst, + 'total_amount' => $lineTotal, + 'net_unit_landing_cost' => $netUnitLanding + ]; + + // Update/create batch in mst_batches + $batchRow = $this->db->table('mst_batches') + ->where('store_id', $storeId) + ->where('item_id', $itemId) + ->where('batch_no', $batchNo) + ->get() + ->getRowArray(); + + if ($batchRow) { + $batchId = (int)$batchRow['batch_id']; + $this->db->table('mst_batches')->where('batch_id', $batchId)->update([ + 'expiry_date' => $expiryDate, + 'mrp' => $mrp, + 'ptr' => $ptr, + 'purchase_rate_net' => $netUnitLanding, + 'gst_rate' => $gstRate + ]); + } else { + $this->db->table('mst_batches')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_no' => $batchNo, + 'expiry_date' => $expiryDate, + 'mrp' => $mrp, + 'ptr' => $ptr, + 'purchase_rate_net' => $netUnitLanding, + 'gst_rate' => $gstRate + ]); + $batchId = $this->db->insertID(); + } + + // Increase stock in mst_stock + $stockRow = $this->db->table('mst_stock') + ->where('store_id', $storeId) + ->where('item_id', $itemId) + ->where('batch_id', $batchId) + ->get() + ->getRowArray(); + + if ($stockRow) { + $this->db->table('mst_stock') + ->where('stock_id', $stockRow['stock_id']) + ->update(['current_qty' => $stockRow['current_qty'] + $totalUnits]); + } else { + $this->db->table('mst_stock')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_id' => $batchId, + 'current_qty' => $totalUnits + ]); + } + } + + $grandTotal = round($taxableTotal + $cgstTotal + $sgstTotal + $igstTotal - $discountTotal); + + // Insert Purchase Record + $purchaseData = [ + 'store_id' => $storeId, + 'supplier_id' => $supplierId, + 'supplier_invoice_no' => trim($json['supplier_invoice_no'] ?? ('PUR-' . time())), + 'invoice_date' => $json['invoice_date'] ?? date('Y-m-d'), + 'received_date' => date('Y-m-d'), + 'due_date' => date('Y-m-d', strtotime('+30 days')), + 'taxable_amount' => $taxableTotal, + 'cgst_amount' => $cgstTotal, + 'sgst_amount' => $sgstTotal, + 'igst_amount' => $igstTotal, + 'discount_amount' => $discountTotal, + 'net_amount' => $grandTotal, + 'payment_status' => 'unpaid', + 'remarks' => trim($json['remarks'] ?? '') + ]; + $this->db->table('mst_purchases')->insert($purchaseData); + $purchaseId = $this->db->insertID(); + + foreach ($purchaseItems as $pi) { + $pi['purchase_id'] = $purchaseId; + $this->db->table('mst_purchase_items')->insert($pi); + } + + // Double-entry ledger: Dr Purchases, Dr Input GST, Cr Sundry Creditors (Supplier) + $purchaseHead = $this->db->table('mst_account_heads')->where('head_code', '4001')->get()->getRowArray(); + $inputCgstHead = $this->db->table('mst_account_heads')->where('head_code', '1006')->get()->getRowArray(); + $inputSgstHead = $this->db->table('mst_account_heads')->where('head_code', '1007')->get()->getRowArray(); + $creditorHead = $this->db->table('mst_account_heads')->where('head_code', '2001')->get()->getRowArray(); + + $vNo = $purchaseData['supplier_invoice_no']; + if ($purchaseHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $vNo, 'voucher_type' => 'PURCHASE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $purchaseHead['head_id'], 'debit_amount' => $taxableTotal, 'credit_amount' => 0, + 'reference_type' => 'purchase_invoice', 'reference_id' => $purchaseId, 'narration' => "Purchase from Supplier #$supplierId Bill $vNo" + ]); + } + if ($cgstTotal > 0 && $inputCgstHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $vNo, 'voucher_type' => 'PURCHASE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $inputCgstHead['head_id'], 'debit_amount' => $cgstTotal, 'credit_amount' => 0, + 'reference_type' => 'purchase_invoice', 'reference_id' => $purchaseId, 'narration' => "Input CGST credit on $vNo" + ]); + } + if ($sgstTotal > 0 && $inputSgstHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $vNo, 'voucher_type' => 'PURCHASE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $inputSgstHead['head_id'], 'debit_amount' => $sgstTotal, 'credit_amount' => 0, + 'reference_type' => 'purchase_invoice', 'reference_id' => $purchaseId, 'narration' => "Input SGST credit on $vNo" + ]); + } + if ($creditorHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $vNo, 'voucher_type' => 'PURCHASE', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $creditorHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $grandTotal, + 'reference_type' => 'purchase_invoice', 'reference_id' => $purchaseId, 'narration' => "Credit payable to Supplier #$supplierId" + ]); + } + + $this->db->transComplete(); + + if ($this->db->transStatus() === false) { + return $this->response->setStatusCode(500)->setJSON(['status' => 0, 'message' => 'Failed to save purchase bill.']); + } + + return $this->response->setJSON([ + 'status' => 1, + 'message' => 'Purchase inward bill recorded and stock updated.', + 'purchase_id' => $purchaseId, + 'net_amount' => $grandTotal + ]); + } + + public function saveSupplierPayment() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $supplierId = (int)($json['supplier_id'] ?? 0); + $amount = (float)($json['amount'] ?? 0); + $paymentMode = trim($json['payment_mode'] ?? 'Bank'); // Cash, Bank, Cheque, NEFT + $refNo = trim($json['reference_no'] ?? ''); + $storeId = (int)($json['store_id'] ?? 1); + + if ($supplierId <= 0 || $amount <= 0) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Supplier and valid amount required.']); + } + + $vNo = 'PMT-' . time(); + $creditorHead = $this->db->table('mst_account_heads')->where('head_code', '2001')->get()->getRowArray(); + $sourceHeadCode = ($paymentMode === 'Cash') ? '1001' : '1002'; + $sourceHead = $this->db->table('mst_account_heads')->where('head_code', $sourceHeadCode)->get()->getRowArray(); + + $this->db->transStart(); + + // Dr Creditor (reducing liability) + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $vNo, 'voucher_type' => 'PAYMENT', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $creditorHead['head_id'], 'debit_amount' => $amount, 'credit_amount' => 0, + 'reference_type' => 'supplier_payment', 'reference_id' => $supplierId, + 'narration' => "Payment made to Supplier #$supplierId via $paymentMode Ref: $refNo" + ]); + + // Cr Cash / Bank + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $vNo, 'voucher_type' => 'PAYMENT', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $sourceHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $amount, + 'reference_type' => 'supplier_payment', 'reference_id' => $supplierId, + 'narration' => "Payment outflow via $paymentMode to Supplier #$supplierId" + ]); + + $this->db->transComplete(); + + return $this->response->setJSON(['status' => 1, 'message' => 'Supplier payment recorded successfully.', 'voucher_no' => $vNo]); + } + + // ========================================================================= + // 6. MULTI-STORE TRANSFERS & INDENTS + // ========================================================================= + + public function requestTransfer() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $fromStoreId = (int)($json['from_store_id'] ?? 1); // Source (e.g. Main Store) + $toStoreId = (int)($json['to_store_id'] ?? 0); // Destination (e.g. Building Counter) + $items = $json['items'] ?? []; + + if ($toStoreId <= 0 || empty($items)) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Destination store and items are required.']); + } + + $transferNo = 'IND-' . date('Ymd') . '-' . rand(100, 999); + + $this->db->transStart(); + $this->db->table('mst_transfers')->insert([ + 'transfer_no' => $transferNo, + 'from_store_id' => $fromStoreId, + 'to_store_id' => $toStoreId, + 'status' => 'requested', + 'request_date' => date('Y-m-d H:i:s'), + 'remarks' => trim($json['remarks'] ?? '') + ]); + $transferId = $this->db->insertID(); + + foreach ($items as $it) { + $this->db->table('mst_transfer_items')->insert([ + 'transfer_id' => $transferId, + 'item_id' => (int)$it['item_id'], + 'requested_qty' => (int)$it['qty'] + ]); + } + + $this->db->transComplete(); + + return $this->response->setJSON([ + 'status' => 1, + 'message' => 'Store Indent Requisition submitted successfully.', + 'transfer_no' => $transferNo, + 'transfer_id' => $transferId + ]); + } + + public function dispatchTransfer() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $transferId = (int)($json['transfer_id'] ?? 0); + $items = $json['items'] ?? []; // [{item_id, batch_id, dispatched_qty}] + + $transfer = $this->db->table('mst_transfers')->where('transfer_id', $transferId)->get()->getRowArray(); + if (!$transfer || $transfer['status'] !== 'requested') { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Invalid transfer request.']); + } + + $this->db->transStart(); + + foreach ($items as $it) { + $itemId = (int)$it['item_id']; + $batchId = (int)$it['batch_id']; + $qty = (int)$it['dispatched_qty']; + + // Deduct stock from source store + $this->db->table('mst_stock') + ->where('store_id', $transfer['from_store_id']) + ->where('batch_id', $batchId) + ->set('current_qty', 'current_qty - ' . $qty, false) + ->update(); + + $this->db->table('mst_transfer_items') + ->where('transfer_id', $transferId) + ->where('item_id', $itemId) + ->update(['batch_id' => $batchId, 'dispatched_qty' => $qty]); + } + + $this->db->table('mst_transfers')->where('transfer_id', $transferId)->update([ + 'status' => 'dispatched', + 'dispatch_date' => date('Y-m-d H:i:s') + ]); + + $this->db->transComplete(); + + return $this->response->setJSON(['status' => 1, 'message' => 'Stock dispatched from source store.']); + } + + public function receiveTransfer() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $transferId = (int)($json['transfer_id'] ?? 0); + + $transfer = $this->db->table('mst_transfers')->where('transfer_id', $transferId)->get()->getRowArray(); + if (!$transfer || $transfer['status'] !== 'dispatched') { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Transfer is not in dispatched state.']); + } + + $items = $this->db->table('mst_transfer_items')->where('transfer_id', $transferId)->get()->getResultArray(); + + $this->db->transStart(); + + foreach ($items as $it) { + $itemId = (int)$it['item_id']; + $sourceBatchId = (int)$it['batch_id']; + $qty = (int)$it['dispatched_qty']; + + // Fetch source batch info + $srcBatch = $this->db->table('mst_batches')->where('batch_id', $sourceBatchId)->get()->getRowArray(); + if (!$srcBatch) continue; + + // Check or create batch in destination store + $destBatch = $this->db->table('mst_batches') + ->where('store_id', $transfer['to_store_id']) + ->where('item_id', $itemId) + ->where('batch_no', $srcBatch['batch_no']) + ->get() + ->getRowArray(); + + if ($destBatch) { + $destBatchId = (int)$destBatch['batch_id']; + } else { + $this->db->table('mst_batches')->insert([ + 'store_id' => $transfer['to_store_id'], + 'item_id' => $itemId, + 'batch_no' => $srcBatch['batch_no'], + 'mfg_date' => $srcBatch['mfg_date'], + 'expiry_date' => $srcBatch['expiry_date'], + 'mrp' => $srcBatch['mrp'], + 'ptr' => $srcBatch['ptr'], + 'purchase_rate_net' => $srcBatch['purchase_rate_net'], + 'gst_rate' => $srcBatch['gst_rate'], + ]); + $destBatchId = $this->db->insertID(); + } + + // Increase stock in destination store + $destStock = $this->db->table('mst_stock') + ->where('store_id', $transfer['to_store_id']) + ->where('item_id', $itemId) + ->where('batch_id', $destBatchId) + ->get() + ->getRowArray(); + + if ($destStock) { + $this->db->table('mst_stock') + ->where('stock_id', $destStock['stock_id']) + ->update(['current_qty' => $destStock['current_qty'] + $qty]); + } else { + $this->db->table('mst_stock')->insert([ + 'store_id' => $transfer['to_store_id'], + 'item_id' => $itemId, + 'batch_id' => $destBatchId, + 'current_qty' => $qty + ]); + } + + $this->db->table('mst_transfer_items') + ->where('transfer_item_id', $it['transfer_item_id']) + ->update(['received_qty' => $qty]); + } + + $this->db->table('mst_transfers')->where('transfer_id', $transferId)->update([ + 'status' => 'received', + 'receive_date' => date('Y-m-d H:i:s') + ]); + + $this->db->transComplete(); + + return $this->response->setJSON(['status' => 1, 'message' => 'Stock received and credited to store inventory.']); + } + + // ========================================================================= + // 7. INDIAN ACCOUNTING, LEDGERS & GST REPORTS + // ========================================================================= + + public function getSupplierLedger(int $supplierId) + { + $supplier = $this->db->table('mst_suppliers')->where('supplier_id', $supplierId)->get()->getRowArray(); + if (!$supplier) { + return $this->response->setStatusCode(404)->setJSON(['status' => 0, 'message' => 'Supplier not found.']); + } + + // Ledger entries for this supplier + $entries = $this->db->table('mst_ledger_entries le') + ->select('le.*, ah.head_name') + ->join('mst_account_heads ah', 'ah.head_id = le.account_head_id') + ->groupStart() + ->where('le.reference_type', 'purchase_invoice') + ->orWhere('le.reference_type', 'supplier_payment') + ->groupEnd() + ->orderBy('le.voucher_date', 'ASC') + ->orderBy('le.entry_id', 'ASC') + ->get() + ->getResultArray(); + + $runningBalance = 0; // Credit positive (Payable) + $statement = []; + foreach ($entries as $e) { + $debit = (float)$e['debit_amount']; + $credit = (float)$e['credit_amount']; + $runningBalance += ($credit - $debit); + + $e['balance'] = round($runningBalance, 2); + $statement[] = $e; + } + + return $this->response->setJSON([ + 'status' => 1, + 'supplier' => $supplier, + 'current_balance' => round($runningBalance, 2), + 'statement' => $statement + ]); + } + + public function getPatientLedger(string $uhid) + { + $sales = $this->db->table('mst_sales') + ->where('uhid', $uhid) + ->orderBy('sale_date', 'DESC') + ->get() + ->getResultArray(); + + $totalBilled = 0; + $totalPaid = 0; + $totalCredit = 0; + + foreach ($sales as $s) { + $totalBilled += (float)$s['net_amount']; + $totalPaid += ((float)$s['cash_paid'] + (float)$s['upi_paid'] + (float)$s['card_paid']); + $totalCredit += (float)$s['credit_amount']; + } + + return $this->response->setJSON([ + 'status' => 1, + 'uhid' => $uhid, + 'summary' => [ + 'total_billed' => round($totalBilled, 2), + 'total_paid' => round($totalPaid, 2), + 'outstanding_credit' => round($totalCredit, 2), + ], + 'invoices' => $sales + ]); + } + + public function getDaybook() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $date = trim($this->request->getGet('date') ?? date('Y-m-d')); + + $sales = $this->db->table('mst_sales') + ->where('store_id', $storeId) + ->where("DATE(sale_date)", $date) + ->orderBy('sale_id', 'ASC') + ->get() + ->getResultArray(); + + $totalSales = 0; + $cashTotal = 0; + $upiTotal = 0; + $cardTotal = 0; + $creditTotal = 0; + $cgstTotal = 0; + $sgstTotal = 0; + + foreach ($sales as $s) { + $totalSales += (float)$s['net_amount']; + $cashTotal += (float)$s['cash_paid']; + $upiTotal += (float)$s['upi_paid']; + $cardTotal += (float)$s['card_paid']; + $creditTotal += (float)$s['credit_amount']; + $cgstTotal += (float)$s['cgst_amount']; + $sgstTotal += (float)$s['sgst_amount']; + } + + return $this->response->setJSON([ + 'status' => 1, + 'store_id' => $storeId, + 'date' => $date, + 'summary' => [ + 'total_invoices' => count($sales), + 'total_sales' => round($totalSales, 2), + 'cash_in_drawer' => round($cashTotal, 2), + 'upi_collection' => round($upiTotal, 2), + 'card_swipes' => round($cardTotal, 2), + 'ipd_credit' => round($creditTotal, 2), + 'cgst_collected' => round($cgstTotal, 2), + 'sgst_collected' => round($sgstTotal, 2), + ], + 'transactions' => $sales + ]); + } + + public function getGstReport() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $from = trim($this->request->getGet('from') ?? date('Y-m-01')); + $to = trim($this->request->getGet('to') ?? date('Y-m-t')); + + // GSTR-1 Sales Breakdown + $salesItems = $this->db->table('mst_sales_items si') + ->select('si.hsn_code, si.gst_rate, SUM(si.taxable_value) as taxable_val, SUM(si.cgst_amount) as cgst_val, SUM(si.sgst_amount) as sgst_val, SUM(si.igst_amount) as igst_val, SUM(si.total_amount) as total_val') + ->join('mst_sales s', 's.sale_id = si.sale_id') + ->where('s.store_id', $storeId) + ->where("DATE(s.sale_date) >=", $from) + ->where("DATE(s.sale_date) <=", $to) + ->groupBy('si.hsn_code, si.gst_rate') + ->get() + ->getResultArray(); + + // GSTR-2 Purchase Breakdown (Input Tax Credit) + $purchaseItems = $this->db->table('mst_purchase_items pi') + ->select('pi.hsn_code, pi.gst_rate, SUM(pi.taxable_value) as taxable_val, SUM(pi.cgst_amount) as cgst_val, SUM(pi.sgst_amount) as sgst_val, SUM(pi.igst_amount) as igst_val, SUM(pi.total_amount) as total_val') + ->join('mst_purchases p', 'p.purchase_id = pi.purchase_id') + ->where('p.store_id', $storeId) + ->where("p.invoice_date >=", $from) + ->where("p.invoice_date <=", $to) + ->groupBy('pi.hsn_code, pi.gst_rate') + ->get() + ->getResultArray(); + + return $this->response->setJSON([ + 'status' => 1, + 'period' => ['from' => $from, 'to' => $to], + 'gstr1_sales' => $salesItems, + 'gstr2_purchases' => $purchaseItems + ]); + } + + public function getBankReconciliation() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $status = trim($this->request->getGet('status') ?? 'all'); // 'all', 'pending', 'reconciled' + $from = trim($this->request->getGet('from') ?? ''); + $to = trim($this->request->getGet('to') ?? ''); + $search = trim($this->request->getGet('search') ?? ''); + + $builder = $this->db->table('mst_sales') + ->where('store_id', $storeId) + ->groupStart() + ->where('upi_paid >', 0) + ->orWhere('card_paid >', 0) + ->orWhereIn('payment_mode', ['UPI', 'Card', 'Mixed']) + ->groupEnd(); + + if (!empty($from)) { + $builder->where('DATE(sale_date) >=', $from); + } + if (!empty($to)) { + $builder->where('DATE(sale_date) <=', $to); + } + + if ($status === 'pending') { + $builder->where('is_bank_reconciled', 0); + } elseif ($status === 'reconciled') { + $builder->where('is_bank_reconciled', 1); + } + + if (!empty($search)) { + $builder->groupStart() + ->like('invoice_no', $search) + ->orLike('patient_name', $search) + ->orLike('uhid', $search) + ->orLike('upi_ref_no', $search) + ->orLike('card_ref_no', $search) + ->orLike('bank_name', $search) + ->groupEnd(); + } + + $records = $builder->orderBy('sale_id', 'DESC')->get()->getResultArray(); + + // Compute summary metrics for Bank/UPI transactions + $summaryBuilder = $this->db->table('mst_sales') + ->where('store_id', $storeId) + ->groupStart() + ->where('upi_paid >', 0) + ->orWhere('card_paid >', 0) + ->orWhereIn('payment_mode', ['UPI', 'Card', 'Mixed']) + ->groupEnd(); + + if (!empty($from)) { + $summaryBuilder->where('DATE(sale_date) >=', $from); + } + if (!empty($to)) { + $summaryBuilder->where('DATE(sale_date) <=', $to); + } + + $allBankSales = $summaryBuilder->get()->getResultArray(); + + $totalCount = count($allBankSales); + $totalBankUpiAmount = 0; + $reconciledCount = 0; + $reconciledAmount = 0; + $pendingCount = 0; + $pendingAmount = 0; + + foreach ($allBankSales as $s) { + $bankPart = (float)$s['upi_paid'] + (float)$s['card_paid']; + $totalBankUpiAmount += $bankPart; + if (!empty($s['is_bank_reconciled'])) { + $reconciledCount++; + $reconciledAmount += $bankPart; + } else { + $pendingCount++; + $pendingAmount += $bankPart; + } + } + + return $this->response->setJSON([ + 'status' => 1, + 'summary' => [ + 'total_count' => $totalCount, + 'total_amount' => round($totalBankUpiAmount, 2), + 'reconciled_count' => $reconciledCount, + 'reconciled_amount' => round($reconciledAmount, 2), + 'pending_count' => $pendingCount, + 'pending_amount' => round($pendingAmount, 2), + ], + 'records' => $records + ]); + } + + public function reconcileBank() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $saleId = (int)($json['sale_id'] ?? 0); + $isReconciled = !empty($json['is_reconciled']) ? 1 : 0; + $notes = trim($json['reconciled_notes'] ?? ''); + $reconciledBy = trim($json['reconciled_by'] ?? 'Accountant'); + + if ($saleId <= 0) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Sale ID is required.']); + } + + $sale = $this->db->table('mst_sales')->where('sale_id', $saleId)->get()->getRowArray(); + if (!$sale) { + return $this->response->setStatusCode(404)->setJSON(['status' => 0, 'message' => 'Sales invoice not found.']); + } + + $now = date('Y-m-d H:i:s'); + $this->db->table('mst_sales')->where('sale_id', $saleId)->update([ + 'is_bank_reconciled' => $isReconciled, + 'reconciled_at' => $isReconciled ? $now : null, + 'reconciled_by' => $isReconciled ? $reconciledBy : '', + 'reconciled_notes' => $isReconciled ? $notes : null + ]); + + // Update ledger entry for head 1002 (Bank) + $bankHead = $this->db->table('mst_account_heads')->where('head_code', '1002')->get()->getRowArray(); + if ($bankHead) { + $this->db->table('mst_ledger_entries') + ->where('reference_type', 'sales_invoice') + ->where('reference_id', $saleId) + ->where('account_head_id', $bankHead['head_id']) + ->update([ + 'reconciled_flag' => $isReconciled, + 'reconciled_at' => $isReconciled ? $now : null + ]); + } + + return $this->response->setJSON([ + 'status' => 1, + 'message' => $isReconciled ? 'Invoice marked as Bank Statement Reconciled.' : 'Reconciliation status cleared.' + ]); + } + + public function getScheduleH1Register() + { + $storeId = (int)($this->request->getGet('store_id') ?? 1); + $from = trim($this->request->getGet('from') ?? date('Y-m-01')); + $to = trim($this->request->getGet('to') ?? date('Y-m-d')); + + // Indian CDSCO Schedule H1 Register + $h1Rows = $this->db->table('mst_sales_items si') + ->select('s.sale_date, s.invoice_no, s.patient_name, s.patient_address, s.doctor_name, s.doctor_reg_no, i.item_name, si.batch_no, si.qty, i.manufacturer_name') + ->join('mst_sales s', 's.sale_id = si.sale_id') + ->join('mst_items i', 'i.item_id = si.item_id') + ->where('s.store_id', $storeId) + ->where('i.drug_schedule', 'Schedule H1') + ->where("DATE(s.sale_date) >=", $from) + ->where("DATE(s.sale_date) <=", $to) + ->orderBy('s.sale_date', 'DESC') + ->get() + ->getResultArray(); + + return $this->response->setJSON([ + 'status' => 1, + 'compliance_note' => 'Statutory Schedule H1 Register maintained as per Drugs and Cosmetics Rules (4th Amendment 2013). Preserve record for minimum 3 years.', + 'records' => $h1Rows + ]); + } + + // ========================================================================= + // 8. COMPUTER TERMINAL / MACHINE VERIFICATION (SECURITY KEY & OTP) + // ========================================================================= + + public function verifyDevice() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $storeId = (int)($json['store_id'] ?? 0); + $storeSlug = trim($json['store_slug'] ?? ''); + $secKey = trim($json['security_key'] ?? ''); + $otp = trim($json['otp'] ?? ''); + $machineName = trim($json['machine_name'] ?? 'Pharmacy Counter PC'); + $deviceFingerprint = trim($json['device_fingerprint'] ?? ''); + + // Resolve store + $store = null; + if ($storeId > 0) { + $store = $this->db->table('mst_stores')->where('store_id', $storeId)->get()->getRowArray(); + } elseif (!empty($storeSlug)) { + $store = $this->db->table('mst_stores') + ->groupStart() + ->where('store_slug', $storeSlug) + ->orWhere('store_code', $storeSlug) + ->groupEnd() + ->get() + ->getRowArray(); + } + + if (!$store) { + return $this->response->setStatusCode(404)->setJSON(['status' => 0, 'message' => 'Medical Store counter not found.']); + } + + $isVerified = false; + $method = 'SECURITY_KEY'; + + // Check permanent Security Key + if (!empty($secKey) && !empty($store['security_key']) && hash_equals($store['security_key'], $secKey)) { + $isVerified = true; + $method = 'SECURITY_KEY'; + } + + // Check 60-minute OTP + if (!$isVerified && !empty($otp) && !empty($store['current_otp'])) { + $now = date('Y-m-d H:i:s'); + if ($store['current_otp'] === $otp && $store['otp_expiry'] >= $now) { + $isVerified = true; + $method = 'OTP'; + } + } + + if (!$isVerified) { + return $this->response->setStatusCode(401)->setJSON([ + 'status' => 0, + 'message' => 'Invalid Security Key or Expired OTP. Please ask HMS Admin for verification key.' + ]); + } + + // Generate high-entropy 64-character device token + $deviceToken = bin2hex(random_bytes(32)); + $ip = $this->request->getIPAddress(); + $ua = $this->request->getUserAgent()->getAgentString(); + + $this->db->table('mst_store_devices')->insert([ + 'store_id' => $store['store_id'], + 'machine_name' => $machineName, + 'device_token' => $deviceToken, + 'device_fingerprint' => $deviceFingerprint, + 'ip_address' => $ip, + 'user_agent' => $ua, + 'verified_by_method' => $method, + 'status' => 'authorized' + ]); + + return $this->response->setJSON([ + 'status' => 1, + 'message' => "Machine '{$machineName}' successfully verified and authorized for {$store['store_name']}.", + 'device_token' => $deviceToken, + 'store' => [ + 'store_id' => (int)$store['store_id'], + 'store_name' => $store['store_name'], + 'store_slug' => $store['store_slug'] + ] + ]); + } + + public function checkDeviceStatus() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $storeId = (int)($json['store_id'] ?? 0); + $deviceToken = trim($json['device_token'] ?? ''); + + if (empty($deviceToken)) { + return $this->response->setJSON(['status' => 0, 'authorized' => false, 'message' => 'No device token.']); + } + + $builder = $this->db->table('mst_store_devices') + ->where('device_token', $deviceToken) + ->where('status', 'authorized'); + + if ($storeId > 0) { + $builder->where('store_id', $storeId); + } + + $row = $builder->get()->getRowArray(); + if ($row) { + // Update last active timestamp + $this->db->table('mst_store_devices')->where('device_id', $row['device_id'])->update([ + 'last_active_at' => date('Y-m-d H:i:s') + ]); + + return $this->response->setJSON([ + 'status' => 1, + 'authorized' => true, + 'machine_name' => $row['machine_name'], + 'store_id' => (int)$row['store_id'] + ]); + } + + return $this->response->setJSON(['status' => 0, 'authorized' => false, 'message' => 'Device authorization revoked or not found.']); + } + + public function importMarg() + { + $admin = new \App\Controllers\Setting\MedicalStoreAdmin(); + return $admin->importMarg(); + } + + // ========================================================================= + // 9. ABDM (AYUSHMAN BHARAT DIGITAL MISSION) COMPLIANCE ENDPOINTS + // ========================================================================= + + public function getAbdmBundle(int $saleId) + { + $sale = $this->db->table('mst_sales') + ->select('sale_id, invoice_no, abha_id, abha_address, abdm_care_context_ref, abdm_care_context_display, abdm_sync_status, abdm_fhir_bundle_json') + ->where('sale_id', $saleId) + ->get() + ->getRowArray(); + + if (!$sale) { + return $this->response->setStatusCode(404)->setJSON(['status' => 0, 'message' => 'Sale record not found.']); + } + + $bundle = json_decode($sale['abdm_fhir_bundle_json'] ?? '{}', true); + + return $this->response->setJSON([ + 'status' => 1, + 'sale_id' => $saleId, + 'invoice_no' => $sale['invoice_no'], + 'abha_id' => $sale['abha_id'], + 'abha_address' => $sale['abha_address'], + 'care_context_ref' => $sale['abdm_care_context_ref'], + 'care_context_display' => $sale['abdm_care_context_display'], + 'sync_status' => $sale['abdm_sync_status'], + 'bundle' => $bundle, + 'fhir_bundle' => $bundle + ]); + } + + public function linkAbha() + { + $json = $this->request->getJSON(true) ?: $this->request->getPost(); + $saleId = (int)($json['sale_id'] ?? 0); + $abhaId = trim($json['abha_id'] ?? ''); + $abhaAddress = trim($json['abha_address'] ?? ''); + + if ($saleId <= 0 || (empty($abhaId) && empty($abhaAddress))) { + return $this->response->setStatusCode(400)->setJSON(['status' => 0, 'message' => 'Sale ID and valid ABHA ID or Address are required.']); + } + + $this->db->table('mst_sales')->where('sale_id', $saleId)->update([ + 'abha_id' => $abhaId ?: null, + 'abha_address' => $abhaAddress ?: null, + 'abdm_sync_status' => 'PENDING' + ]); + + return $this->response->setJSON([ + 'status' => 1, + 'message' => 'ABHA details linked to invoice successfully. ABDM synchronization scheduled.' + ]); + } +} + diff --git a/app/Controllers/Setting/MedicalStoreAdmin.php b/app/Controllers/Setting/MedicalStoreAdmin.php new file mode 100644 index 0000000..bd42d15 --- /dev/null +++ b/app/Controllers/Setting/MedicalStoreAdmin.php @@ -0,0 +1,452 @@ +db = \Config\Database::connect(); + } + + public function index() + { + $q = trim((string)($this->request->getGet('q') ?? '')); + + $builder = $this->db->table('mst_stores'); + if (!empty($q)) { + $builder->groupStart() + ->like('store_name', $q) + ->orLike('store_code', $q) + ->orLike('store_slug', $q) + ->orLike('building_name', $q) + ->orLike('drug_license_no_20b', $q) + ->orLike('gstin', $q) + ->groupEnd(); + } + + $stores = $builder->orderBy('is_main_store', 'DESC')->orderBy('store_id', 'ASC')->get()->getResultArray(); + + // Enforce security keys and slugs + foreach ($stores as &$st) { + $needsUpdate = false; + $updates = []; + + if (empty($st['store_slug'])) { + $st['store_slug'] = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $st['store_code'] ?: ('store' . $st['store_id']))); + $updates['store_slug'] = $st['store_slug']; + $needsUpdate = true; + } + + if (empty($st['security_key'])) { + $st['security_key'] = 'HMS-' . strtoupper(bin2hex(random_bytes(3))) . '-' . rand(100, 999); + $updates['security_key'] = $st['security_key']; + $needsUpdate = true; + } + + if ($needsUpdate) { + $this->db->table('mst_stores')->where('store_id', $st['store_id'])->update($updates); + } + + // Fetch authorized devices count + $deviceCount = $this->db->table('mst_store_devices') + ->where('store_id', $st['store_id']) + ->where('status', 'authorized') + ->countAllResults(); + $st['authorized_devices_count'] = $deviceCount; + } + + // Fetch recent authorized devices across all stores + $devices = $this->db->table('mst_store_devices d') + ->select('d.*, s.store_name, s.store_code') + ->join('mst_stores s', 's.store_id = d.store_id') + ->orderBy('d.device_id', 'DESC') + ->limit(30) + ->get() + ->getResultArray(); + + return view('Setting/MedicalStore/medical_store_index', [ + 'stores' => $stores, + 'devices' => $devices, + 'searchQuery' => $q + ]); + } + + public function save() + { + if (!$this->request->isAJAX()) { + return $this->response->setStatusCode(400)->setJSON(['ok' => false, 'error' => 'Invalid request']); + } + + $id = (int)($this->request->getPost('store_id') ?? 0); + $storeCode = trim((string)($this->request->getPost('store_code') ?? '')); + $storeSlug = strtolower(trim((string)($this->request->getPost('store_slug') ?? ''))); + $storeName = trim((string)($this->request->getPost('store_name') ?? '')); + + if (empty($storeName) || empty($storeCode)) { + return $this->response->setJSON(['ok' => false, 'error' => 'Store Name and Store Code are required.']); + } + + if (empty($storeSlug)) { + $storeSlug = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $storeCode)); + } + + // Check unique slug + $checkSlug = $this->db->table('mst_stores') + ->where('store_slug', $storeSlug) + ->where('store_id !=', $id) + ->get() + ->getRowArray(); + + if ($checkSlug) { + return $this->response->setJSON(['ok' => false, 'error' => "URL Link Slug '{$storeSlug}' is already assigned to another store. Please choose a unique slug."]); + } + + $secKey = trim((string)($this->request->getPost('security_key') ?? '')); + if (empty($secKey)) { + $secKey = 'HMS-' . strtoupper(bin2hex(random_bytes(3))) . '-' . rand(100, 999); + } + + $data = [ + 'store_code' => $storeCode, + 'store_slug' => $storeSlug, + 'store_name' => $storeName, + 'building_name' => trim((string)($this->request->getPost('building_name') ?? '')), + 'floor_no' => trim((string)($this->request->getPost('floor_no') ?? '')), + 'room_no' => trim((string)($this->request->getPost('room_no') ?? '')), + 'is_main_store' => !empty($this->request->getPost('is_main_store')) ? 1 : 0, + 'drug_license_no_20b' => trim((string)($this->request->getPost('drug_license_no_20b') ?? '')), + 'drug_license_no_21b' => trim((string)($this->request->getPost('drug_license_no_21b') ?? '')), + 'drug_license_no_20f_x' => trim((string)($this->request->getPost('drug_license_no_20f_x') ?? '')), + 'gstin' => strtoupper(trim((string)($this->request->getPost('gstin') ?? ''))), + 'pan_no' => strtoupper(trim((string)($this->request->getPost('pan_no') ?? ''))), + 'fssai_no' => trim((string)($this->request->getPost('fssai_no') ?? '')), + 'state_code' => trim((string)($this->request->getPost('state_code') ?? '07')), + 'state_name' => trim((string)($this->request->getPost('state_name') ?? 'Delhi')), + 'registered_pharmacist_name' => trim((string)($this->request->getPost('registered_pharmacist_name') ?? '')), + 'pharmacist_reg_no' => trim((string)($this->request->getPost('pharmacist_reg_no') ?? '')), + 'contact_phone' => trim((string)($this->request->getPost('contact_phone') ?? '')), + 'contact_email' => trim((string)($this->request->getPost('contact_email') ?? '')), + 'address' => trim((string)($this->request->getPost('address') ?? '')), + 'invoice_prefix' => trim((string)($this->request->getPost('invoice_prefix') ?? 'INV/')), + 'next_invoice_no' => !empty($this->request->getPost('next_invoice_no')) ? (int)$this->request->getPost('next_invoice_no') : 1001, + 'bank_name' => trim((string)($this->request->getPost('bank_name') ?? '')), + 'bank_account_no' => trim((string)($this->request->getPost('bank_account_no') ?? '')), + 'bank_ifsc' => trim((string)($this->request->getPost('bank_ifsc') ?? '')), + 'upi_id' => trim((string)($this->request->getPost('upi_id') ?? '')), + 'abdm_hfr_id' => trim((string)($this->request->getPost('abdm_hfr_id') ?? '')), + 'abdm_hip_id' => trim((string)($this->request->getPost('abdm_hip_id') ?? '')), + 'pharmacist_hpr_id' => trim((string)($this->request->getPost('pharmacist_hpr_id') ?? '')), + 'terms_conditions' => trim((string)($this->request->getPost('terms_conditions') ?? '')), + 'security_key' => $secKey, + 'is_active' => isset($_POST['is_active']) ? (int)$this->request->getPost('is_active') : 1, + ]; + + if ($id > 0) { + $this->db->table('mst_stores')->where('store_id', $id)->update($data); + $msg = 'Medical Store details updated successfully.'; + } else { + $this->db->table('mst_stores')->insert($data); + $id = $this->db->insertID(); + $msg = 'New Medical Store Counter created successfully.'; + } + + return $this->response->setJSON(['ok' => true, 'message' => $msg, 'store_id' => $id, 'store_slug' => $storeSlug]); + } + + public function generateOtp() + { + if (!$this->request->isAJAX()) { + return $this->response->setStatusCode(400)->setJSON(['ok' => false, 'error' => 'Invalid request']); + } + + $storeId = (int)($this->request->getPost('store_id') ?? 0); + $store = $this->db->table('mst_stores')->where('store_id', $storeId)->get()->getRowArray(); + if (!$store) { + return $this->response->setJSON(['ok' => false, 'error' => 'Store not found']); + } + + $otp = (string)rand(100000, 999999); + $expiry = date('Y-m-d H:i:s', strtotime('+60 minutes')); + + $this->db->table('mst_stores')->where('store_id', $storeId)->update([ + 'current_otp' => $otp, + 'otp_expiry' => $expiry + ]); + + return $this->response->setJSON([ + 'ok' => true, + 'message' => 'Terminal Verification OTP generated successfully.', + 'otp' => $otp, + 'expiry' => date('h:i A (d-m-Y)', strtotime($expiry)), + 'store_name' => $store['store_name'] + ]); + } + + public function regenerateSecurityKey() + { + if (!$this->request->isAJAX()) { + return $this->response->setStatusCode(400)->setJSON(['ok' => false, 'error' => 'Invalid request']); + } + + $storeId = (int)($this->request->getPost('store_id') ?? 0); + $newKey = 'HMS-' . strtoupper(bin2hex(random_bytes(3))) . '-' . rand(100, 999); + + $this->db->table('mst_stores')->where('store_id', $storeId)->update([ + 'security_key' => $newKey + ]); + + return $this->response->setJSON([ + 'ok' => true, + 'message' => 'New Security Key generated successfully.', + 'security_key' => $newKey + ]); + } + + public function revokeDevice() + { + if (!$this->request->isAJAX()) { + return $this->response->setStatusCode(400)->setJSON(['ok' => false, 'error' => 'Invalid request']); + } + + $deviceId = (int)($this->request->getPost('device_id') ?? 0); + $this->db->table('mst_store_devices')->where('device_id', $deviceId)->update([ + 'status' => 'revoked' + ]); + + return $this->response->setJSON(['ok' => true, 'message' => 'Terminal computer access revoked successfully.']); + } + + public function delete() + { + if (!$this->request->isAJAX()) { + return $this->response->setStatusCode(400)->setJSON(['ok' => false, 'error' => 'Invalid request']); + } + + $storeId = (int)($this->request->getPost('store_id') ?? 0); + // Soft deactivate store + $this->db->table('mst_stores')->where('store_id', $storeId)->update(['is_active' => 0]); + + return $this->response->setJSON(['ok' => true, 'message' => 'Store deactivated successfully.']); + } + + /** + * Marg Pharmacy Software / Excel CSV Inventory Import + */ + public function importMarg() + { + $storeId = (int)($this->request->getPost('store_id') ?? 0); + if ($storeId <= 0) { + return $this->response->setJSON(['ok' => false, 'error' => 'Please select a destination Medical Store.']); + } + + $file = $this->request->getFile('import_file'); + if (!$file || !$file->isValid()) { + return $this->response->setJSON(['ok' => false, 'error' => 'Please upload a valid CSV or Excel file.']); + } + + $ext = strtolower($file->getClientExtension()); + if (!in_array($ext, ['csv', 'txt'])) { + return $this->response->setJSON(['ok' => false, 'error' => 'Please upload CSV formatted export from Marg ERP or Excel.']); + } + + $handle = fopen($file->getTempName(), 'r'); + if (!$handle) { + return $this->response->setJSON(['ok' => false, 'error' => 'Unable to read uploaded file.']); + } + + $header = fgetcsv($handle, 4096, ','); + if (!$header) { + fclose($handle); + return $this->response->setJSON(['ok' => false, 'error' => 'CSV file is empty.']); + } + + // Normalize header names + $headerMap = []; + foreach ($header as $idx => $h) { + $cleaned = strtolower(trim(preg_replace('/[^a-zA-Z0-9]/', '', $h))); + $headerMap[$cleaned] = $idx; + } + + // Helper function to find column index + $findCol = function(array $aliases) use ($headerMap) { + foreach ($aliases as $a) { + $cleaned = strtolower(trim(preg_replace('/[^a-zA-Z0-9]/', '', $a))); + if (isset($headerMap[$cleaned])) return $headerMap[$cleaned]; + } + return null; + }; + + $colName = $findCol(['itemname', 'product', 'particulars', 'medicinename', 'name', 'item']); + $colGeneric = $findCol(['generic', 'genericname', 'molecule', 'composition']); + $colCat = $findCol(['category', 'type', 'itemtype']); + $colPack = $findCol(['packing', 'pack', 'packsize']); + $colBatch = $findCol(['batch', 'batchno', 'batchnumber']); + $colExpiry = $findCol(['exp', 'expiry', 'expdate', 'expirydate']); + $colMrp = $findCol(['mrp', 'maxretailprice']); + $colPtr = $findCol(['ptr', 'purchaserate', 'costrate', 'rate', 'cost', 'purrate']); + $colHsn = $findCol(['hsn', 'hsncode', 'hsnno']); + $colGst = $findCol(['gst', 'gstpct', 'gstper', 'tax', 'taxpct']); + $colQty = $findCol(['qty', 'quantity', 'stock', 'openingstock', 'opqty']); + $colBarcode = $findCol(['barcode', 'itemcode', 'code']); + + if ($colName === null) { + fclose($handle); + return $this->response->setJSON(['ok' => false, 'error' => "Could not locate 'Item Name' / 'Product' column in CSV header."]); + } + + $importedRows = 0; + $newItems = 0; + $newBatches = 0; + $totalValuation = 0; + + $this->db->transStart(); + + while (($row = fgetcsv($handle, 4096, ',')) !== false) { + $name = trim($row[$colName] ?? ''); + if (empty($name)) continue; + + $generic = ($colGeneric !== null) ? trim($row[$colGeneric] ?? '') : ''; + $cat = ($colCat !== null) ? trim($row[$colCat] ?? 'Tablet') : 'Tablet'; + $pack = ($colPack !== null) ? trim($row[$colPack] ?? '10 Tablets') : '10 Tablets'; + $batchNo = ($colBatch !== null) ? trim($row[$colBatch] ?? 'OPN-01') : 'OPN-01'; + $expRaw = ($colExpiry !== null) ? trim($row[$colExpiry] ?? '') : ''; + $mrp = ($colMrp !== null) ? (float)preg_replace('/[^0-9.]/', '', $row[$colMrp] ?? '0') : 0; + $ptr = ($colPtr !== null) ? (float)preg_replace('/[^0-9.]/', '', $row[$colPtr] ?? '0') : ($mrp * 0.75); + $hsn = ($colHsn !== null) ? trim($row[$colHsn] ?? '3004') : '3004'; + $gst = ($colGst !== null) ? (float)preg_replace('/[^0-9.]/', '', $row[$colGst] ?? '12') : 12; + $qty = ($colQty !== null) ? (int)preg_replace('/[^0-9]/', '', $row[$colQty] ?? '10') : 10; + $barcode = ($colBarcode !== null) ? trim($row[$colBarcode] ?? '') : ''; + + // Parse Marg Expiry formats (MM/YY, MM/YYYY, DD-MM-YYYY, YYYY-MM-DD) + $expiryDate = date('Y-12-31', strtotime('+1 year')); + if (!empty($expRaw)) { + if (preg_match('/^(\d{1,2})[\/\-](\d{2})$/', $expRaw, $m)) { + $expiryDate = '20' . $m[2] . '-' . str_pad($m[1], 2, '0', STR_PAD_LEFT) . '-28'; + } elseif (preg_match('/^(\d{1,2})[\/\-](\d{4})$/', $expRaw, $m)) { + $expiryDate = $m[2] . '-' . str_pad($m[1], 2, '0', STR_PAD_LEFT) . '-28'; + } elseif (strtotime($expRaw)) { + $expiryDate = date('Y-m-d', strtotime($expRaw)); + } + } + + // 1. Find or insert into mst_items (shared drug catalog) + $itemRow = $this->db->table('mst_items')->where('item_name', $name)->get()->getRowArray(); + if ($itemRow) { + $itemId = (int)$itemRow['item_id']; + } else { + $this->db->table('mst_items')->insert([ + 'item_name' => $name, + 'generic_name' => $generic, + 'category' => $cat ?: 'Tablet', + 'hsn_code' => $hsn ?: '3004', + 'gst_rate' => $gst ?: 12, + 'unit_pack' => $pack ?: '10 Tablets', + 'barcode' => $barcode, + 'drug_schedule' => 'Schedule H', + 'manufacturer_name' => 'Imported Catalog' + ]); + $itemId = $this->db->insertID(); + $newItems++; + } + + // 2. Find or insert into mst_batches for this store + $batchRow = $this->db->table('mst_batches') + ->where('store_id', $storeId) + ->where('item_id', $itemId) + ->where('batch_no', $batchNo) + ->get() + ->getRowArray(); + + if ($batchRow) { + $batchId = (int)$batchRow['batch_id']; + $this->db->table('mst_batches')->where('batch_id', $batchId)->update([ + 'expiry_date' => $expiryDate, + 'mrp' => $mrp, + 'ptr' => $ptr, + 'purchase_rate_net' => $ptr * (1 + $gst / 100), + 'gst_rate' => $gst + ]); + } else { + $this->db->table('mst_batches')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_no' => $batchNo, + 'mfg_date' => date('Y-01-01'), + 'expiry_date' => $expiryDate, + 'mrp' => $mrp, + 'ptr' => $ptr, + 'purchase_rate_net' => $ptr * (1 + $gst / 100), + 'gst_rate' => $gst, + 'barcode' => $barcode + ]); + $batchId = $this->db->insertID(); + $newBatches++; + } + + // 3. Update stock in mst_stock + $stockRow = $this->db->table('mst_stock') + ->where('store_id', $storeId) + ->where('item_id', $itemId) + ->where('batch_id', $batchId) + ->get() + ->getRowArray(); + + if ($stockRow) { + $this->db->table('mst_stock')->where('stock_id', $stockRow['stock_id'])->update([ + 'current_qty' => $stockRow['current_qty'] + $qty + ]); + } else { + $this->db->table('mst_stock')->insert([ + 'store_id' => $storeId, + 'item_id' => $itemId, + 'batch_id' => $batchId, + 'current_qty' => $qty + ]); + } + + $lineVal = $qty * $ptr; + $totalValuation += $lineVal; + $importedRows++; + } + + fclose($handle); + + // Record opening stock valuation journal voucher in double-entry ledgers + if ($totalValuation > 0) { + $voucherNo = 'MARG-IMP-' . $storeId . '-' . date('YmdHis'); + $stockHead = $this->db->table('mst_account_heads')->where('head_code', '1003')->get()->getRowArray(); + $equityHead = $this->db->table('mst_account_heads')->where('head_code', '3004')->get()->getRowArray(); + + if ($stockHead && $equityHead) { + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $voucherNo, 'voucher_type' => 'OPENING_STOCK', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $stockHead['head_id'], 'debit_amount' => $totalValuation, 'credit_amount' => 0, + 'narration' => "Marg ERP Opening Stock Inward ($importedRows lines)" + ]); + $this->db->table('mst_ledger_entries')->insert([ + 'store_id' => $storeId, 'voucher_no' => $voucherNo, 'voucher_type' => 'OPENING_STOCK', 'voucher_date' => date('Y-m-d'), + 'account_head_id' => $equityHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $totalValuation, + 'narration' => "Marg ERP Opening Capital Credit" + ]); + } + } + + $this->db->transComplete(); + + return $this->response->setJSON([ + 'ok' => true, + 'message' => "Successfully imported {$importedRows} inventory lines from Marg Pharmacy file.", + 'details' => [ + 'imported_rows' => $importedRows, + 'new_catalog_items'=> $newItems, + 'new_batches' => $newBatches, + 'total_valuation' => round($totalValuation, 2) + ] + ]); + } +} diff --git a/app/Libraries/FhirR4Builder.php b/app/Libraries/FhirR4Builder.php index 648f438..c122d75 100644 --- a/app/Libraries/FhirR4Builder.php +++ b/app/Libraries/FhirR4Builder.php @@ -3797,4 +3797,233 @@ class FhirR4Builder 'asNeeded' => false, ]; } + + /** + * Build ABDM FHIR R4 MedicationDispense Document Bundle + * + * @param array $patient + * @param array $store + * @param array $sale + * @param array> $items + * @return array + */ + public function buildPharmacyDispenseBundle(array $patient, array $store, array $sale, array $items): array + { + $issuedAt = $this->isoTimestamp(); + $bundleUuid = $this->generateUuid(); + $compositionUuid = $this->generateUuid(); + $patientUuid = $this->generateUuid(); + $practitionerUuid = $this->generateUuid(); + $organizationUuid = $this->generateUuid(); + + $patientRef = 'urn:uuid:' . $patientUuid; + $practitionerRef = 'urn:uuid:' . $practitionerUuid; + $organizationRef = 'urn:uuid:' . $organizationUuid; + + $resourceEntries = []; + + // 1. Practitioner (Pharmacist or Prescribing Doctor) + $practName = trim((string)(($sale['doctor_name'] ?? '') ?: (($store['registered_pharmacist_name'] ?? '') ?: 'Pharmacist'))); + $practRegNo = trim((string)(($sale['doctor_reg_no'] ?? '') ?: (($store['pharmacist_reg_no'] ?? '') ?: ''))); + $practHprId = trim((string)($store['pharmacist_hpr_id'] ?? '')); + + $practIdentifiers = []; + if ($practHprId !== '') { + $practIdentifiers[] = [ + 'type' => ['coding' => [['system' => 'http://terminology.hl7.org/CodeSystem/v2-0203', 'code' => 'PRN', 'display' => 'Provider number']]], + 'system' => 'https://hpr.abdm.gov.in', + 'value' => $practHprId + ]; + } + if ($practRegNo !== '') { + $practIdentifiers[] = [ + 'type' => ['coding' => [['system' => 'http://terminology.hl7.org/CodeSystem/v2-0203', 'code' => 'MD', 'display' => 'Medical License number']]], + 'system' => 'https://doctor.ndhm.gov.in', + 'value' => $practRegNo + ]; + } + + $resourceEntries[] = [ + 'fullUrl' => $practitionerRef, + 'resource' => [ + 'resourceType' => 'Practitioner', + 'id' => $practitionerUuid, + 'meta' => ['profile' => ['https://nrces.in/ndhm/fhir/r4/StructureDefinition/Practitioner']], + 'identifier' => $practIdentifiers, + 'name' => [['text' => $practName]] + ] + ]; + + // 2. Organization (Hospital Pharmacy / Store) + $hfrId = trim((string)(($store['abdm_hfr_id'] ?? '') ?: (($store['store_code'] ?? '') ?: 'IN0710001234'))); + $resourceEntries[] = [ + 'fullUrl' => $organizationRef, + 'resource' => [ + 'resourceType' => 'Organization', + 'id' => $organizationUuid, + 'meta' => ['profile' => ['https://nrces.in/ndhm/fhir/r4/StructureDefinition/Organization']], + 'identifier' => [[ + 'type' => ['coding' => [['system' => 'http://terminology.hl7.org/CodeSystem/v2-0203', 'code' => 'PRN', 'display' => 'Provider number']]], + 'system' => 'https://facility.ndhm.gov.in', + 'value' => $hfrId + ]], + 'name' => (string)(($store['store_name'] ?? '') ?: 'Hospital Medical Store'), + 'telecom' => [ + ['system' => 'phone', 'value' => (string)(($store['contact_phone'] ?? '') ?: '+91 9999999999')], + ['system' => 'email', 'value' => (string)(($store['contact_email'] ?? '') ?: 'pharmacy@hospital.in')] + ], + 'address' => [[ + 'line' => [(string)(($store['address'] ?? '') ?: 'Hospital Building')], + 'city' => (string)(($store['state_name'] ?? '') ?: 'Delhi'), + 'state' => (string)(($store['state_name'] ?? '') ?: 'Delhi'), + 'postalCode' => '110001', + 'country' => 'IN' + ]] + ] + ]; + + // 3. Patient + $patientResource = $this->buildPatientResource($patient); + $patientResource['id'] = $patientUuid; + // Inject ABHA identifiers if provided in sale or patient + $abhaNumber = trim((string)(($sale['abha_id'] ?? '') ?: ($patient['abha_id'] ?? ''))); + $abhaAddress = trim((string)(($sale['abha_address'] ?? '') ?: ($patient['abha_address'] ?? ''))); + + if (!isset($patientResource['identifier'])) { + $patientResource['identifier'] = []; + } + if ($abhaNumber !== '') { + $patientResource['identifier'][] = [ + 'type' => ['coding' => [['system' => 'https://nrces.in/ndhm/fhir/r4/CodeSystem/ndhm-identifier-type-code', 'code' => 'ABHA', 'display' => 'Ayushman Bharat Health Account']]], + 'system' => 'https://healthid.ndhm.gov.in', + 'value' => $abhaNumber + ]; + } + if ($abhaAddress !== '') { + $patientResource['identifier'][] = [ + 'type' => ['coding' => [['system' => 'https://nrces.in/ndhm/fhir/r4/CodeSystem/ndhm-identifier-type-code', 'code' => 'ABHA-ADDRESS', 'display' => 'ABHA Address']]], + 'system' => 'https://abdm.gov.in', + 'value' => $abhaAddress + ]; + } + $resourceEntries[] = ['fullUrl' => $patientRef, 'resource' => $patientResource]; + + // 4. MedicationDispense Resources + $medicationRefs = []; + foreach ($items as $idx => $it) { + $medUuid = $this->generateUuid(); + $medRef = 'urn:uuid:' . $medUuid; + $medicationRefs[] = ['reference' => $medRef]; + + $snomedCode = trim((string)($it['snomed_ct_code'] ?? '')); + $snomedDisplay = trim((string)($it['snomed_display'] ?? ($it['item_name'] ?? 'Medicine'))); + + $coding = []; + if ($snomedCode !== '') { + $coding[] = [ + 'system' => 'http://snomed.info/sct', + 'code' => $snomedCode, + 'display' => $snomedDisplay + ]; + } + + $medResource = [ + 'resourceType' => 'MedicationDispense', + 'id' => $medUuid, + 'meta' => ['profile' => ['https://nrces.in/ndhm/fhir/r4/StructureDefinition/MedicationDispense']], + 'status' => 'completed', + 'medicationCodeableConcept' => [ + 'coding' => $coding, + 'text' => (string)($it['item_name'] ?? 'Medicine') + ], + 'subject' => ['reference' => $patientRef, 'display' => (string)(($sale['patient_name'] ?? '') ?: 'Patient')], + 'performer' => [[ + 'actor' => ['reference' => $practitionerRef, 'display' => $practName] + ]], + 'location' => ['reference' => $organizationRef, 'display' => (string)(($store['store_name'] ?? '') ?: 'Pharmacy')], + 'quantity' => [ + 'value' => (int)($it['qty'] ?? 1), + 'unit' => (string)($it['unit_pack'] ?? 'Units'), + 'system' => 'http://unitsofmeasure.org', + 'code' => '1' + ], + 'daysSupply' => [ + 'value' => 5, + 'unit' => 'days', + 'system' => 'http://unitsofmeasure.org', + 'code' => 'd' + ], + 'whenPrepared' => $issuedAt, + 'whenHandedOver' => $issuedAt, + 'dosageInstruction' => [[ + 'text' => 'As directed by physician' + ]] + ]; + + $resourceEntries[] = ['fullUrl' => $medRef, 'resource' => $medResource]; + } + + // 5. Composition (Record Head) + $compositionResource = [ + 'resourceType' => 'Composition', + 'id' => $compositionUuid, + 'meta' => [ + 'profile' => ['https://nrces.in/ndhm/fhir/r4/StructureDefinition/MedicationDispenseDocument'], + 'versionId' => '1', + 'lastUpdated' => $issuedAt + ], + 'language' => 'en-IN', + 'identifier' => [ + 'system' => 'https://ndhm.in/phr', + 'value' => (string)(($sale['abdm_care_context_ref'] ?? '') ?: ('PHARM-' . (($sale['invoice_no'] ?? '') ?: $compositionUuid))) + ], + 'status' => 'final', + 'type' => [ + 'coding' => [[ + 'system' => 'http://loinc.org', + 'code' => '60590-7', + 'display' => 'Medication dispensed.extended Document' + ]], + 'text' => 'Pharmacy Medication Dispense Record' + ], + 'subject' => ['reference' => $patientRef, 'display' => (string)(($sale['patient_name'] ?? '') ?: 'Patient')], + 'date' => $issuedAt, + 'author' => [['reference' => $practitionerRef, 'display' => $practName]], + 'title' => 'Pharmacy Medication Dispensation Receipt', + 'custodian' => ['reference' => $organizationRef, 'display' => (string)(($store['store_name'] ?? '') ?: 'Hospital Pharmacy')], + 'section' => [[ + 'title' => 'Medications Dispensed', + 'code' => [ + 'coding' => [[ + 'system' => 'http://loinc.org', + 'code' => '10160-0', + 'display' => 'History of Medication use' + ]] + ], + 'entry' => $medicationRefs + ]] + ]; + + array_unshift($resourceEntries, [ + 'fullUrl' => 'urn:uuid:' . $compositionUuid, + 'resource' => $compositionResource + ]); + + return [ + 'resourceType' => 'Bundle', + 'id' => $bundleUuid, + 'meta' => [ + 'versionId' => '1', + 'lastUpdated' => $issuedAt, + 'profile' => ['https://nrces.in/ndhm/fhir/r4/StructureDefinition/DocumentBundle'] + ], + 'identifier' => [ + 'system' => 'https://ndhm.in/phr', + 'value' => $bundleUuid + ], + 'type' => 'document', + 'timestamp' => $issuedAt, + 'entry' => $resourceEntries + ]; + } } diff --git a/app/Views/Setting/Admin/index.php b/app/Views/Setting/Admin/index.php index bad9a3f..d71796b 100644 --- a/app/Views/Setting/Admin/index.php +++ b/app/Views/Setting/Admin/index.php @@ -70,6 +70,13 @@ Nursing Station Master +

+
diff --git a/app/Views/Setting/MedicalStore/medical_store_index.php b/app/Views/Setting/MedicalStore/medical_store_index.php new file mode 100644 index 0000000..0bcde6e --- /dev/null +++ b/app/Views/Setting/MedicalStore/medical_store_index.php @@ -0,0 +1,686 @@ +
+
+
+
Medical Stores & Pharmacy Counters Master
+ Manage hospital building stores, Indian Drug Licenses (20B/21B), GSTIN, direct URLs, and machine terminal security +
+
+ + +
+
+ + +
+
+
+
+
+ + + +
+
+
+ +
+
+
+
+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + $st): ?> + + + + + + + + + + + + + + +
#Store Name & BuildingDirect Counter Link (URL)Drug Licenses (20B / 21B)GSTIN & StatePharmacistTerminal SecurityActions
+ + No medical stores found. Click "Add Medical Store" to create a new pharmacy counter. +
+
+ + • + + CENTRAL STORE + + +
+
+ MedicalStore/ + + + + +
+
+
20B:
+
21B:
+
+
+ State: () + + + HFR: + + +
+
+ +
+ + + + +
+
+
+
+ + +
+
+
Authorized Computer Terminals & Machines
+ Protected counter computers verified via HMS Admin Security Key or OTP +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Machine / Computer NameMedical StoreIP AddressVerified MethodAuthorized DateStatusAction
+ No machine terminals registered yet. Open a store link on a counter PC and verify using the Security Key or OTP. +
+ + + + Active Authorized + + Access Revoked + + + + + + Revoked + +
+
+
+
+
+ + + + + + + + +
+ + diff --git a/public/App/MedicalStore/index.html b/public/App/MedicalStore/index.html new file mode 100644 index 0000000..d4394ff --- /dev/null +++ b/public/App/MedicalStore/index.html @@ -0,0 +1,4111 @@ + + + + + + HMS Medical Store - Multi-Building Pharmacy System + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + diff --git a/public/App/MedicalStore/manifest.json b/public/App/MedicalStore/manifest.json new file mode 100644 index 0000000..5635710 --- /dev/null +++ b/public/App/MedicalStore/manifest.json @@ -0,0 +1,17 @@ +{ + "short_name": "Medical Store", + "name": "HMS Medical Store & Multi-Building Pharmacy POS", + "icons": [ + { + "src": "/assets/img/logo.png", + "type": "image/png", + "sizes": "512x512", + "purpose": "any maskable" + } + ], + "start_url": "/app/medical-store", + "background_color": "#0f172a", + "theme_color": "#0891b2", + "display": "standalone", + "orientation": "any" +} diff --git a/public/App/MedicalStore/sw.js b/public/App/MedicalStore/sw.js new file mode 100644 index 0000000..2595ac0 --- /dev/null +++ b/public/App/MedicalStore/sw.js @@ -0,0 +1,21 @@ +const CACHE_NAME = 'medstore-pwa-v1'; +const ASSETS_TO_CACHE = [ + '/app/medical-store', + 'https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css', + 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css' +]; + +self.addEventListener('install', (event) => { + event.waitUntil( + caches.open(CACHE_NAME).then((cache) => { + return cache.addAll(ASSETS_TO_CACHE); + }) + ); +}); + +self.addEventListener('fetch', (event) => { + if (event.request.method !== 'GET') return; + event.respondWith( + fetch(event.request).catch(() => caches.match(event.request)) + ); +}); diff --git a/public/App/index.html b/public/App/index.html index a1c1332..ade153f 100644 --- a/public/App/index.html +++ b/public/App/index.html @@ -176,24 +176,24 @@
- - diff --git a/scratch/add_discount_columns.php b/scratch/add_discount_columns.php new file mode 100644 index 0000000..1cfa685 --- /dev/null +++ b/scratch/add_discount_columns.php @@ -0,0 +1,23 @@ +connect_error) { + die("Connection failed: " . $db->connect_error . "\n"); +} + +$res = $db->query("SHOW COLUMNS FROM mst_sales LIKE 'bill_discount_type'"); +if ($res->num_rows == 0) { + $db->query("ALTER TABLE mst_sales ADD COLUMN bill_discount_type varchar(10) DEFAULT 'pct' AFTER discount_amount"); + $db->query("ALTER TABLE mst_sales ADD COLUMN bill_discount_val decimal(10,2) DEFAULT 0.00 AFTER bill_discount_type"); + echo "Columns bill_discount_type and bill_discount_val added to mst_sales.\n"; +} else { + echo "Columns already exist in mst_sales.\n"; +} + +$resItem = $db->query("SHOW COLUMNS FROM mst_sales_items LIKE 'discount_type'"); +if ($resItem->num_rows == 0) { + $db->query("ALTER TABLE mst_sales_items ADD COLUMN discount_type varchar(10) DEFAULT 'pct' AFTER unit_mrp"); + $db->query("ALTER TABLE mst_sales_items ADD COLUMN discount_val decimal(10,2) DEFAULT 0.00 AFTER discount_type"); + echo "Columns discount_type and discount_val added to mst_sales_items.\n"; +} else { + echo "Columns already exist in mst_sales_items.\n"; +} diff --git a/scratch/add_split_payment_columns.php b/scratch/add_split_payment_columns.php new file mode 100644 index 0000000..1344f3e --- /dev/null +++ b/scratch/add_split_payment_columns.php @@ -0,0 +1,43 @@ +connect_error) { + die("Connection failed: " . $db->connect_error . "\n"); +} + +// Check and add columns to mst_sales +$salesCols = [ + 'bank_name' => "ALTER TABLE mst_sales ADD COLUMN bank_name varchar(100) DEFAULT '' AFTER payment_reference", + 'upi_ref_no' => "ALTER TABLE mst_sales ADD COLUMN upi_ref_no varchar(100) DEFAULT '' AFTER bank_name", + 'card_ref_no' => "ALTER TABLE mst_sales ADD COLUMN card_ref_no varchar(100) DEFAULT '' AFTER upi_ref_no", + 'is_bank_reconciled' => "ALTER TABLE mst_sales ADD COLUMN is_bank_reconciled tinyint(1) DEFAULT 0 AFTER card_ref_no", + 'reconciled_at' => "ALTER TABLE mst_sales ADD COLUMN reconciled_at datetime NULL AFTER is_bank_reconciled", + 'reconciled_by' => "ALTER TABLE mst_sales ADD COLUMN reconciled_by varchar(100) DEFAULT '' AFTER reconciled_at", + 'reconciled_notes' => "ALTER TABLE mst_sales ADD COLUMN reconciled_notes text NULL AFTER reconciled_by", +]; + +foreach ($salesCols as $col => $sql) { + $res = $db->query("SHOW COLUMNS FROM mst_sales LIKE '$col'"); + if ($res->num_rows == 0) { + $db->query($sql); + echo "Added column $col to mst_sales.\n"; + } else { + echo "Column $col already exists in mst_sales.\n"; + } +} + +// Check and add columns to mst_ledger_entries +$ledgerCols = [ + 'reconciled_flag' => "ALTER TABLE mst_ledger_entries ADD COLUMN reconciled_flag tinyint(1) DEFAULT 0 AFTER narration", + 'reconciled_at' => "ALTER TABLE mst_ledger_entries ADD COLUMN reconciled_at datetime NULL AFTER reconciled_flag", + 'reconciled_ref' => "ALTER TABLE mst_ledger_entries ADD COLUMN reconciled_ref varchar(100) DEFAULT '' AFTER reconciled_at", +]; + +foreach ($ledgerCols as $col => $sql) { + $res = $db->query("SHOW COLUMNS FROM mst_ledger_entries LIKE '$col'"); + if ($res->num_rows == 0) { + $db->query($sql); + echo "Added column $col to mst_ledger_entries.\n"; + } else { + echo "Column $col already exists in mst_ledger_entries.\n"; + } +} diff --git a/scratch/analyze_diffs.php b/scratch/analyze_diffs.php new file mode 100644 index 0000000..23ea549 --- /dev/null +++ b/scratch/analyze_diffs.php @@ -0,0 +1,51 @@ +e.length)&&(a=e.length);for(var n=0,t=Array(a);n=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function g(e,a,n){return(a=w(a))in e?Object.defineProperty(e,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[a]=n,e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function h(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),a&&x(e,a)}function m(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(m=function(){return!!e})()}function R(e,a){if(null==e)return{};var n={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(-1!==a.indexOf(t))continue;n[t]=e[t]}return n}function y(){ +/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ +var e,a,n="function"==typeof Symbol?Symbol:{},t=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function i(n,t,r,i){var d=t&&t.prototype instanceof s?t:s,u=Object.create(d.prototype);return v(u,"_invoke",function(n,t,r){var i,s,d,u=0,c=r||[],l=!1,p={p:0,n:0,v:e,a:g,f:g.bind(e,4),d:function(a,n){return i=a,s=0,d=e,p.n=n,o}};function g(n,t){for(s=n,d=t,a=0;!l&&u&&!r&&a3?(r=f===t)&&(d=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=e):i[0]<=g&&((r=n<2&&gt||t>f)&&(i[4]=n,i[5]=t,p.n=f,s=0))}if(r||n>1)return o;throw l=!0,t}return function(r,c,f){if(u>1)throw TypeError("Generator is already running");for(l&&1===c&&g(c,f),s=c,d=f;(a=s<2?e:d)||!l;){i||(s?s<3?(s>1&&(p.n=-1),g(s,d)):p.n=d:p.v=d);try{if(u=2,i){if(s||(r="next"),a=i[r]){if(!(a=a.call(i,d)))throw TypeError("iterator result is not an object");if(!a.done)return a;d=a.value,s<2&&(s=0)}else 1===s&&(a=i.return)&&a.call(i),s<2&&(d=TypeError("The iterator does not provide a '"+r+"' method"),s=1);i=e}else if((a=(l=p.n<0)?d:n.call(t,p))!==o)break}catch(a){i=e,s=1,d=a}finally{u=1}}return{value:a,done:l}}}(n,r,i),!0),u}var o={};function s(){}function d(){}function u(){}a=Object.getPrototypeOf;var c=[][t]?a(a([][t]())):(v(a={},t,function(){return this}),a),l=u.prototype=s.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,v(e,r,"GeneratorFunction")),e.prototype=Object.create(l),e}return d.prototype=u,v(l,"constructor",u),v(u,"constructor",d),d.displayName="GeneratorFunction",v(u,r,"GeneratorFunction"),v(l),v(l,r,"Generator"),v(l,t,function(){return this}),v(l,"toString",function(){return"[object Generator]"}),(y=function(){return{w:i,m:p}})()}function v(e,a,n,t){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}v=function(e,a,n,t){function i(a,n){v(e,a,function(e){return this._invoke(a,n,e)})}a?r?r(e,a,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[a]=n:(i("next",0),i("throw",1),i("return",2))},v(e,a,n,t)}function b(e){if(null!=e){var a=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(a)return a.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}function x(e,a){return x=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,a){return e.__proto__=a,e},x(e,a)}function E(e,a){return function(e){if(Array.isArray(e))return e}(e)||function(e,a){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var t,r,i,o,s=[],d=!0,u=!1;try{if(i=(n=n.call(e)).next,0===a){if(Object(n)!==n)return;d=!1}else for(;!(d=(t=i.call(n)).done)&&(s.push(t.value),s.length!==a);d=!0);}catch(e){u=!0,r=e}finally{try{if(!d&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw r}}return s}}(e,a)||C(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,a){return a||(a=e.slice(0)),e.raw=a,e}function T(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||C(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e){var a=function(e,a){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,a);if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===a?String:Number)(e)}(e,"string");return"symbol"==typeof a?a:a+""}function C(e,a){if(e){if("string"==typeof e)return n(e,a);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,a):void 0}}function P(e){var a="function"==typeof Map?new Map:void 0;return P=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(a){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==a){if(a.has(e))return a.get(e);a.set(e,n)}function n(){return function(e,a,n){if(m())return Reflect.construct.apply(null,arguments);var t=[null];t.push.apply(t,a);var r=new(e.bind.apply(e,t));return n&&x(r,n.prototype),r}(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),x(n,e)},P(e)}function A(e,a){for(var n=0,t=Object.keys(a);nr.length)return!1;for(var s=0,d=i.length-1;se)return!1;if((n+=a[t+1])>=e)return!0}return!1}function yn(e){return e<65?36===e:e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&gn.test(String.fromCharCode(e)):Rn(e,hn)))}function vn(e){return e<48?36===e:e<58||!(e<65)&&(e<=90||(e<97?95===e:e<=122||(e<=65535?e>=170&&fn.test(String.fromCharCode(e)):Rn(e,hn)||Rn(e,mn))))}function bn(e){for(var a=!0,n=0;n=48&&e<=57},Nn={decBinOct:new Set([46,66,69,79,95,98,101,111]),hex:new Set([46,88,95,120])},Bn={bin:function(e){return 48===e||49===e},oct:function(e){return e>=48&&e<=55},dec:function(e){return e>=48&&e<=57},hex:function(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}};function On(e,a,n,t,r,i){for(var o=n,s=t,d=r,u="",c=null,l=n,p=a.length;;){if(n>=p){i.unterminated(o,s,d),u+=a.slice(l,n);break}var g=a.charCodeAt(n);if(jn(e,g,a,n)){u+=a.slice(l,n);break}if(92===g){u+=a.slice(l,n);var f=Fn(a,n,t,r,"template"===e,i);null!==f.ch||c?u+=f.ch:c={pos:n,lineStart:t,curLine:r},n=f.pos,t=f.lineStart,r=f.curLine,l=n}else 8232===g||8233===g?(++r,t=++n):10===g||13===g?"template"===e?(u+=a.slice(l,n)+"\n",++n,13===g&&10===a.charCodeAt(n)&&++n,++r,l=t=n):i.unterminated(o,s,d):++n}return{pos:n,str:u,firstInvalidLoc:c,lineStart:t,curLine:r}}function jn(e,a,n,t){return"template"===e?96===a||36===a&&123===n.charCodeAt(t+1):a===("double"===e?34:39)}function Fn(e,a,n,t,r,i){var o=!r;a++;var s=function(e){return{pos:a,ch:e,lineStart:n,curLine:t}},d=e.charCodeAt(a++);switch(d){case 110:return s("\n");case 114:return s("\r");case 120:var u,c=Mn(e,a,n,t,2,!1,o,i);return u=c.code,a=c.pos,s(null===u?null:String.fromCharCode(u));case 117:var l,p=Un(e,a,n,t,o,i);return l=p.code,a=p.pos,s(null===l?null:String.fromCodePoint(l));case 116:return s("\t");case 98:return s("\b");case 118:return s("\v");case 102:return s("\f");case 13:10===e.charCodeAt(a)&&++a;case 10:n=a,++t;case 8232:case 8233:return s("");case 56:case 57:if(r)return s(null);i.strictNumericEscape(a-1,n,t);default:if(d>=48&&d<=55){var g=a-1,f=/^[0-7]+/.exec(e.slice(g,a+2))[0],h=parseInt(f,8);h>255&&(f=f.slice(0,-1),h=parseInt(f,8)),a+=f.length-1;var m=e.charCodeAt(a);if("0"!==f||56===m||57===m){if(r)return s(null);i.strictNumericEscape(g,n,t)}return s(String.fromCharCode(h))}return s(String.fromCharCode(d))}}function Mn(e,a,n,t,r,i,o,s){var d,u=a,c=Ln(e,a,n,t,16,r,i,!1,s,!o);return d=c.n,a=c.pos,null===d&&(o?s.invalidEscapeSequence(u,n,t):a=u-1),{code:d,pos:a}}function Ln(e,a,n,t,r,i,o,s,d,u){for(var c=a,l=16===r?Nn.hex:Nn.decBinOct,p=16===r?Bn.hex:10===r?Bn.dec:8===r?Bn.oct:Bn.bin,g=!1,f=0,h=0,m=null==i?1/0:i;h=97?R-97+10:R>=65?R-65+10:In(R)?R-48:1/0)>=r){if(y<=9&&u)return{n:null,pos:a};if(y<=9&&d.invalidDigit(a,n,t,r))y=0;else{if(!o)break;y=0,g=!0}}++a,f=f*r+y}else{var v=e.charCodeAt(a-1),b=e.charCodeAt(a+1);if(s){if(Number.isNaN(b)||!p(b)||l.has(v)||l.has(b)){if(u)return{n:null,pos:a};d.unexpectedNumericSeparator(a,n,t)}}else{if(u)return{n:null,pos:a};d.numericSeparatorInEscapeSequence(a,n,t)}++a}}return a===c||null!=i&&a-c!==i||g?{n:null,pos:a}:{n:f,pos:a}}function Un(e,a,n,t,r,i){var o;if(123===e.charCodeAt(a)){var s=Mn(e,++a,n,t,e.indexOf("}",a)-a,!0,r,i);if(o=s.code,a=s.pos,++a,null!==o&&o>1114111){if(!r)return{code:null,pos:a};i.invalidCodePoint(a,n,t)}}else{var d=Mn(e,a,n,t,4,!1,r,i);o=d.code,a=d.pos}return{code:o,pos:a}}var qn=["consequent","body","alternate"],Wn=["leadingComments","trailingComments","innerComments"],Vn=["||","&&","??"],Gn=["++","--"],Hn=[">","<",">=","<="],Kn=["==","===","!=","!=="],zn=[].concat(Kn,["in","instanceof"]),Jn=[].concat(T(zn),Hn),Xn=["-","/","%","*","**","&","|",">>",">>>","<<","^"],Yn=["+"].concat(Xn,T(Jn),["|>"]),$n=["=","+="].concat(T(Xn.map(function(e){return e+"="})),T(Vn.map(function(e){return e+"="}))),Qn=["delete","!"],Zn=["+","-","~"],et=["typeof"],at=["void","throw"].concat(Qn,Zn,et),nt={optional:["typeAnnotation","typeParameters","returnType"],force:["start","loc","end"]},tt={},rt={},it={},ot={},st={},dt={},ut={},ct={};function lt(e){return Array.isArray(e)?"array":null===e?"null":typeof e}function pt(e){for(var a=arguments.length,n=new Array(a>1?a-1:0),t=1;t=2&&"type"in a[0]&&"array"===a[0].type&&!("each"in a[1]))throw new Error('An assertValueType("array") validator can only be followed by an assertEach(...) validator.');return t}var _t,Dt,kt,It=new Set(["aliases","builder","deprecatedAlias","fields","inherits","visitor","validate","unionShape"]),Nt=new Set(["default","optional","deprecated","validate"]),Bt={};function Ot(){for(var e=arguments.length,a=new Array(e),n=0;n0:l&&"object"==typeof l)throw new Error("field defaults can only be primitives or empty arrays currently");o[u]={default:Array.isArray(l)?[]:l,optional:c.optional,deprecated:c.deprecated,validate:c.validate}}for(var g=0,f=Object.keys(a);g+i+1)throw new TypeError("RestElement must be last element of "+r)}}),Lt("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:Tt("Expression"),optional:!0}}}),Lt("SequenceExpression",{visitor:["expressions"],fields:{expressions:bt("Expression")},aliases:["Expression"]}),Lt("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression","ExpressionWrapper"],fields:{expression:{validate:Tt("Expression")}}}),Lt("SwitchCase",{visitor:["test","consequent"],fields:{test:{validate:Tt("Expression"),optional:!0},consequent:bt("Statement")}}),Lt("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"],fields:{discriminant:{validate:Tt("Expression")},cases:bt("SwitchCase")}}),Lt("ThisExpression",{aliases:["Expression","TSEntityName"]}),Lt("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"],fields:{argument:{validate:Tt("Expression")}}}),Lt("TryStatement",{visitor:["block","handler","finalizer"],aliases:["Statement"],fields:{block:{validate:At(Tt("BlockStatement"),pt(function(e){if(!e.handler&&!e.finalizer)throw new TypeError("TryStatement expects either a handler or finalizer, or both")},{oneOfNodeTypes:["BlockStatement"]}))},handler:{optional:!0,validate:Tt("CatchClause")},finalizer:{optional:!0,validate:Tt("BlockStatement")}}}),Lt("UnaryExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!0},argument:{validate:Tt("Expression")},operator:{validate:Et.apply(void 0,T(at))}},visitor:["argument"],aliases:["UnaryLike","Expression"]}),Lt("UpdateExpression",{builder:["operator","argument","prefix"],fields:{prefix:{default:!1},argument:{validate:Tt("Identifier","MemberExpression")},operator:{validate:Et.apply(void 0,T(Gn))}},visitor:["argument"],aliases:["Expression"]}),Lt("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"],fields:{declare:{validate:Ct("boolean"),optional:!0},kind:{validate:Et("var","let","const","using","await using")},declarations:bt("VariableDeclarator")},validate:(Kt=Tt("Identifier","Placeholder"),zt=Tt("Identifier","ArrayPattern","ObjectPattern","Placeholder"),Jt=Tt("Identifier","VoidPattern","Placeholder"),function(e,a,n){var t=n.kind,r=n.declarations,i=ln("ForXStatement",e,{left:n});if(i&&1!==r.length)throw new TypeError("Exactly one VariableDeclarator is required in the VariableDeclaration of a "+e.type);for(var o,s=p(r);!(o=s()).done;){var d=o.value;"const"===t||"let"===t||"var"===t?i||d.init?zt(d,"id",d.id):Kt(d,"id",d.id):Jt(d,"id",d.id)}})}),Lt("VariableDeclarator",{visitor:["id","init"],fields:{id:{validate:Tt("Identifier","ArrayPattern","ObjectPattern","VoidPattern")},definite:{optional:!0,validate:Ct("boolean")},init:{optional:!0,validate:Tt("Expression")}}}),Lt("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"],fields:{test:{validate:Tt("Expression")},body:{validate:Tt("Statement")}}}),Lt("WithStatement",{visitor:["object","body"],aliases:["Statement"],fields:{object:{validate:Tt("Expression")},body:{validate:Tt("Statement")}}}),Lt("AssignmentPattern",{visitor:["left","right","decorators"],builder:["left","right"],aliases:["FunctionParameter","Pattern","PatternLike"],fields:Object.assign({},Xt(),{left:{validate:Tt("Identifier","ObjectPattern","ArrayPattern","MemberExpression","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression")},right:{validate:Tt("Expression")},decorators:{validate:vt("Decorator"),optional:!0}})}),Lt("ArrayPattern",{visitor:["elements","typeAnnotation"],builder:["elements"],aliases:["FunctionParameter","Pattern","PatternLike","LVal"],fields:Object.assign({},Xt(),{elements:{validate:At(Ct("array"),xt(wt("null","PatternLike")))}})}),Lt("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["typeParameters","params","predicate","returnType","body"],aliases:["Scopable","Function","BlockParent","FunctionParent","Expression","Pureish"],fields:Object.assign({},Ut(),{generator:{default:null,optional:!0,validate:pt(function(e,a,n){if(n)throw new TypeError("ArrowFunctionExpression cannot be a generator")},{type:"boolean"})}},qt(),{expression:{optional:!0,validate:Ct("boolean")},body:{validate:Tt("BlockStatement","Expression")},predicate:{validate:Tt("FlowPredicate"),optional:!0}})}),Lt("ClassBody",{visitor:["body"],fields:{body:bt("ClassMethod","ClassPrivateMethod","ClassProperty","ClassPrivateProperty","ClassAccessorProperty","TSDeclareMethod","TSIndexSignature","StaticBlock")}}),Lt("ClassExpression",{builder:["id","superClass","body","decorators"],visitor:["decorators","id","typeParameters","superClass","superTypeArguments","mixins","implements","body"],aliases:["Scopable","Class","Expression"],fields:(_t={id:{validate:Tt("Identifier"),optional:!0},typeParameters:{validate:Tt("TypeParameterDeclaration","TSTypeParameterDeclaration"),optional:!0},body:{validate:Tt("ClassBody")},superClass:{optional:!0,validate:Tt("Expression")}},_t.superTypeArguments={validate:Tt("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},_t.implements={validate:vt("TSClassImplements","ClassImplements"),optional:!0},_t.decorators={validate:vt("Decorator"),optional:!0},_t.mixins={validate:Tt("InterfaceExtends"),optional:!0},_t)}),Lt("ClassDeclaration",{inherits:"ClassExpression",aliases:["Scopable","Class","Statement","Declaration"],fields:(Dt={id:{validate:Tt("Identifier"),optional:!0},typeParameters:{validate:Tt("TypeParameterDeclaration","TSTypeParameterDeclaration"),optional:!0},body:{validate:Tt("ClassBody")},superClass:{optional:!0,validate:Tt("Expression")}},Dt.superTypeArguments={validate:Tt("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},Dt.implements={validate:vt("TSClassImplements","ClassImplements"),optional:!0},Dt.decorators={validate:vt("Decorator"),optional:!0},Dt.mixins={validate:Tt("InterfaceExtends"),optional:!0},Dt.declare={validate:Ct("boolean"),optional:!0},Dt.abstract={validate:Ct("boolean"),optional:!0},Dt),validate:function(){var e=Tt("Identifier");return function(a,n,t){ln("ExportDefaultDeclaration",a)||e(t,"id",t.id)}}()});var Yt,$t,Qt,Zt,er={attributes:{optional:!0,validate:vt("ImportAttribute")}};Lt("ExportAllDeclaration",{visitor:["source","attributes"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:Object.assign({source:{validate:Tt("StringLiteral")},exportKind:ht(Et("type","value"))},er)}),Lt("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:{declaration:ft("FunctionDeclaration","ClassDeclaration","Expression","TSDeclareFunction","TSInterfaceDeclaration","EnumDeclaration"),exportKind:ht(Et("value"))}}),Lt("ExportNamedDeclaration",{builder:["declaration","specifiers","source","attributes"],visitor:["declaration","specifiers","source","attributes"],aliases:["Statement","Declaration","ImportOrExportDeclaration","ExportDeclaration"],fields:Object.assign({declaration:{optional:!0,validate:At(Tt("Declaration"),pt(function(e,a,n){if(n&&e.specifiers.length)throw new TypeError("Only declaration or specifiers is allowed on ExportNamedDeclaration");if(n&&e.source)throw new TypeError("Cannot export a declaration from a source")},{oneOfNodeTypes:["VariableDeclaration","FunctionDeclaration","ClassDeclaration","TSDeclareFunction","TSEnumDeclaration","TSImportEqualsDeclaration","TSInterfaceDeclaration","TSModuleDeclaration","TSTypeAliasDeclaration","EnumDeclaration","InterfaceDeclaration","OpaqueType","TypeAlias"]}))}},er,{specifiers:{default:[],validate:yt((Yt=Tt("ExportSpecifier","ExportDefaultSpecifier","ExportNamespaceSpecifier"),$t=Tt("ExportSpecifier"),pt(function(e,a,n){(e.source?Yt:$t)(e,a,n)},{oneOfNodeTypes:["ExportSpecifier","ExportDefaultSpecifier","ExportNamespaceSpecifier"]})))},source:{validate:Tt("StringLiteral"),optional:!0},exportKind:ht(Et("type","value"))})}),Lt("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"],fields:{local:{validate:Tt("Identifier")},exported:{validate:Tt("Identifier","StringLiteral")},exportKind:{validate:Et("type","value"),optional:!0}}}),Lt("ForOfStatement",{visitor:["left","right","body"],builder:["left","right","body","await"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"],fields:{left:{validate:(Qt=Tt("VariableDeclaration"),Zt=Tt("Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"),pt(function(e,a,n){ln("VariableDeclaration",n)?Qt(e,a,n):Zt(e,a,n)},{oneOfNodeTypes:["VariableDeclaration","Identifier","MemberExpression","ArrayPattern","ObjectPattern","TSAsExpression","TSSatisfiesExpression","TSTypeAssertion","TSNonNullExpression"]}))},right:{validate:Tt("Expression")},body:{validate:Tt("Statement")},await:{default:!1}}}),Lt("ImportDeclaration",{builder:["specifiers","source","attributes"],visitor:["specifiers","source","attributes"],aliases:["Statement","Declaration","ImportOrExportDeclaration"],fields:Object.assign({},er,{module:{optional:!0,validate:Ct("boolean")},phase:{default:null,validate:Et("source","defer")},specifiers:bt("ImportSpecifier","ImportDefaultSpecifier","ImportNamespaceSpecifier"),source:{validate:Tt("StringLiteral")},importKind:{validate:Et("type","typeof","value"),optional:!0}})}),Lt("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:Tt("Identifier")}}}),Lt("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"],fields:{local:{validate:Tt("Identifier")}}}),Lt("ImportSpecifier",{visitor:["imported","local"],builder:["local","imported"],aliases:["ModuleSpecifier"],fields:{local:{validate:Tt("Identifier")},imported:{validate:Tt("Identifier","StringLiteral")},importKind:{validate:Et("type","typeof","value"),optional:!0}}}),Lt("MetaProperty",{visitor:["meta","property"],aliases:["Expression"],fields:{meta:{validate:At(Tt("Identifier"),pt(function(e,a,n){var t;switch(n.name){case"function":t="sent";break;case"new":t="target";break;case"import":t="meta"}if(!ln("Identifier",e.property,{name:t}))throw new TypeError("Unrecognised MetaProperty")},{oneOfNodeTypes:["Identifier"]}))},property:{validate:Tt("Identifier")}}});var ar=function(){return{abstract:{validate:Ct("boolean"),default:!1,optional:!0},accessibility:{validate:Et("public","private","protected"),optional:!0},static:{default:!1},override:{optional:!0,validate:Ct("boolean"),default:!1},computed:{default:!1},optional:{validate:Ct("boolean"),optional:!0},key:{validate:At(function(){var e=Tt("Identifier","StringLiteral","NumericLiteral","BigIntLiteral"),a=Tt("Expression");return function(n,t,r){(n.computed?a:e)(n,t,r)}}(),Tt("Identifier","StringLiteral","NumericLiteral","BigIntLiteral","Expression"))}}},nr=function(e){return void 0===e&&(e=!0),Object.assign({},Ut(),ar(),{params:bt("FunctionParameter","TSParameterProperty"),kind:{validate:Et("get","set","method","constructor"),default:"method"},access:{validate:At(Ct("string"),Et("public","private","protected")),optional:!0}},e?{decorators:{validate:vt("Decorator"),optional:!0}}:{})};Lt("ClassMethod",Object.assign({aliases:["Function","Scopable","BlockParent","FunctionParent","Method"],builder:["kind","key","params","body","computed","static","generator","async"],visitor:["decorators","key","typeParameters","params","returnType","body"]},Ft(),{fields:Object.assign({},nr(),qt(),{body:{validate:Tt("BlockStatement")}})})),Lt("ObjectPattern",{visitor:["decorators","properties","typeAnnotation"],builder:["properties"],aliases:["FunctionParameter","Pattern","PatternLike","LVal"],fields:Object.assign({},Xt(),{properties:bt("RestElement","ObjectProperty")})}),Lt("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"],deprecatedAlias:"SpreadProperty",fields:{argument:{validate:Tt("Expression")}}}),Lt("Super"),Lt("TaggedTemplateExpression",{visitor:["tag","typeArguments","quasi"],builder:["tag","quasi"],aliases:["Expression"],fields:(kt={tag:{validate:Tt("Expression")},quasi:{validate:Tt("TemplateLiteral")}},kt.typeArguments={validate:Tt("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0},kt)}),Lt("TemplateElement",{builder:["value","tail"],fields:{value:{validate:At(function(e){var a=Object.keys(e);function n(n,t,r){for(var i,o=[],s=p(a);!(i=s()).done;){var d=i.value;try{qr(n,d,r[d],e[d])}catch(e){if(e instanceof TypeError){o.push(e.message);continue}throw e}}if(o.length)throw new TypeError("Property "+t+" of "+n.type+" expected to have the following:\n"+o.join("\n"))}return n.shapeOf=e,n}({raw:{validate:Ct("string")},cooked:{validate:Ct("string"),optional:!0}}),function(e){var a=e.value.raw,n=!1,t=function(){throw new Error("Internal @babel/types error.")},r=On("template",a,0,0,0,{unterminated:function(){n=!0},strictNumericEscape:t,invalidEscapeSequence:t,numericSeparatorInEscapeSequence:t,unexpectedNumericSeparator:t,invalidDigit:t,invalidCodePoint:t}),i=r.str,o=r.firstInvalidLoc;if(!n)throw new Error("Invalid raw");e.value.cooked=o?null:i})},tail:{default:!1}}}),Lt("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression","Literal"],fields:{quasis:bt("TemplateElement"),expressions:{validate:At(Ct("array"),xt(Tt("Expression","TSType")),function(e,a,n){if(e.quasis.length!==n.length+1)throw new TypeError("Number of "+e.type+" quasis should be exactly one more than the number of expressions.\nExpected "+(n.length+1)+" quasis but got "+e.quasis.length)})}}}),Lt("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{delegate:{validate:At(Ct("boolean"),pt(function(e,a,n){if(n&&!e.argument)throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument")},{type:"boolean"})),default:!1},argument:{optional:!0,validate:Tt("Expression")}}}),Lt("AwaitExpression",{builder:["argument"],visitor:["argument"],aliases:["Expression","Terminatorless"],fields:{argument:{validate:Tt("Expression")}}}),Lt("ImportExpression",{visitor:["source","options"],aliases:["Expression"],fields:{phase:{default:null,validate:Et("source","defer")},source:{validate:Tt("Expression")},options:{validate:Tt("Expression"),optional:!0}}}),Lt("Import"),Lt("BigIntLiteral",{builder:["value"],fields:{value:{validate:Ct("bigint")}},aliases:["Expression","Pureish","Literal","Immutable"]}),Lt("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"],fields:{exported:{validate:Tt("Identifier","StringLiteral")}}}),Lt("OptionalMemberExpression",Object.assign({builder:["object","property","computed","optional"],visitor:["object","property"],aliases:["Expression"]},Mt,{fields:{object:{validate:Tt("Expression")},property:{validate:function(){var e=Tt("Identifier","PrivateName"),a=Tt("Expression");return pt(function(n,t,r){(n.computed?a:e)(n,t,r)},{oneOfNodeTypes:["Expression","PrivateName"]})}()},computed:{default:!1},optional:{validate:At(Ct("boolean"),Pt())}}})),Lt("OptionalCallExpression",{visitor:["callee","typeArguments","arguments"],builder:["callee","arguments","optional"],aliases:["Expression"],fields:{callee:{validate:Tt("Expression")},arguments:bt("Expression","SpreadElement","ArgumentPlaceholder"),optional:{validate:At(Ct("boolean"),Pt())},typeArguments:{validate:Tt("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}}),Lt("ClassProperty",Object.assign({visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","typeAnnotation","decorators","computed","static"],aliases:["Property"]},Ft(),{fields:Object.assign({},ar(),{value:{validate:Tt("Expression"),optional:!0},definite:{validate:Ct("boolean"),optional:!0},typeAnnotation:{validate:Tt("TypeAnnotation","TSTypeAnnotation"),optional:!0},decorators:{validate:vt("Decorator"),optional:!0},readonly:{validate:Ct("boolean"),optional:!0},declare:{validate:Ct("boolean"),optional:!0},variance:{validate:Tt("Variance"),optional:!0}})})),Lt("ClassPrivateProperty",{visitor:["decorators","variance","key","typeAnnotation","value"],builder:["key","value","decorators","static"],aliases:["Property","Private"],fields:{key:{validate:Tt("PrivateName")},value:{validate:Tt("Expression"),optional:!0},typeAnnotation:{validate:Tt("TypeAnnotation","TSTypeAnnotation"),optional:!0},decorators:{validate:vt("Decorator"),optional:!0},static:{validate:Ct("boolean"),default:!1},readonly:{validate:Ct("boolean"),optional:!0},optional:{validate:Ct("boolean"),optional:!0},definite:{validate:Ct("boolean"),optional:!0},variance:{validate:Tt("Variance"),optional:!0}}}),Lt("ClassPrivateMethod",{builder:["kind","key","params","body","static"],visitor:["decorators","key","typeParameters","params","returnType","body"],aliases:["Function","Scopable","BlockParent","FunctionParent","Method","Private"],fields:Object.assign({},nr(),qt(),{kind:{validate:Et("get","set","method"),default:"method"},key:{validate:Tt("PrivateName")},body:{validate:Tt("BlockStatement")}})}),Lt("PrivateName",{visitor:["id"],aliases:["Private"],fields:{id:{validate:Tt("Identifier")}}}),Lt("StaticBlock",{visitor:["body"],fields:{body:bt("Statement")},aliases:["Scopable","BlockParent","FunctionParent"]}),Lt("ImportAttribute",{visitor:["key","value"],fields:{key:{validate:Tt("Identifier","StringLiteral")},value:{validate:Tt("StringLiteral")}}});var tr=Ot("Flow"),rr=function(e){var a="DeclareClass"===e;tr(e,{builder:["id","typeParameters","extends","body"],visitor:["id","typeParameters","extends"].concat(T(a?["mixins","implements"]:[]),["body"]),aliases:["FlowDeclaration","Statement","Declaration"],fields:Object.assign({id:ft("Identifier"),typeParameters:Rt("TypeParameterDeclaration"),extends:ht(vt("InterfaceExtends"))},a?{mixins:ht(vt("InterfaceExtends")),implements:ht(vt("ClassImplements"))}:{},{body:ft("ObjectTypeAnnotation")})})};tr("AnyTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["FlowType"],fields:{elementType:ft("FlowType")}}),tr("BooleanTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("BooleanLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:gt(Ct("boolean"))}}),tr("NullLiteralTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("ClassImplements",{visitor:["id","typeParameters"],fields:{id:ft("Identifier"),typeParameters:Rt("TypeParameterInstantiation")}}),rr("DeclareClass"),tr("DeclareFunction",{builder:["id"],visitor:["id","predicate"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier"),predicate:Rt("FlowPredicate")}}),rr("DeclareInterface"),tr("DeclareModule",{builder:["id","body","kind"],visitor:["id","body"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier","StringLiteral"),body:ft("BlockStatement"),kind:ht(Et("CommonJS","ES"))}}),tr("DeclareModuleExports",{visitor:["typeAnnotation"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{typeAnnotation:ft("TypeAnnotation")}}),tr("DeclareTypeAlias",{visitor:["id","typeParameters","right"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier"),typeParameters:Rt("TypeParameterDeclaration"),right:ft("FlowType")}}),tr("DeclareOpaqueType",{visitor:["id","typeParameters","supertype"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier"),typeParameters:Rt("TypeParameterDeclaration"),supertype:Rt("FlowType"),impltype:Rt("FlowType")}}),tr("DeclareVariable",{visitor:["id"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier")}}),tr("DeclareExportDeclaration",{visitor:["declaration","specifiers","source","attributes"],aliases:["FlowDeclaration","Statement","Declaration"],fields:Object.assign({declaration:Rt("Flow"),specifiers:ht(vt("ExportSpecifier","ExportNamespaceSpecifier")),source:Rt("StringLiteral"),default:ht(Ct("boolean"))},er)}),tr("DeclareExportAllDeclaration",{visitor:["source","attributes"],aliases:["FlowDeclaration","Statement","Declaration"],fields:Object.assign({source:ft("StringLiteral"),exportKind:ht(Et("type","value"))},er)}),tr("DeclaredPredicate",{visitor:["value"],aliases:["FlowPredicate"],fields:{value:ft("Expression")}}),tr("ExistsTypeAnnotation",{aliases:["FlowType"]}),tr("FunctionTypeAnnotation",{builder:["typeParameters","params","rest","returnType"],visitor:["typeParameters","this","params","rest","returnType"],aliases:["FlowType"],fields:{typeParameters:Rt("TypeParameterDeclaration"),params:bt("FunctionTypeParam"),rest:Rt("FunctionTypeParam"),this:Rt("FunctionTypeParam"),returnType:ft("FlowType")}}),tr("FunctionTypeParam",{visitor:["name","typeAnnotation"],fields:{name:Rt("Identifier"),typeAnnotation:ft("FlowType"),optional:ht(Ct("boolean"))}}),tr("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["FlowType"],fields:{id:ft("Identifier","QualifiedTypeIdentifier"),typeParameters:Rt("TypeParameterInstantiation")}}),tr("InferredPredicate",{aliases:["FlowPredicate"]}),tr("InterfaceExtends",{visitor:["id","typeParameters"],fields:{id:ft("Identifier","QualifiedTypeIdentifier"),typeParameters:Rt("TypeParameterInstantiation")}}),rr("InterfaceDeclaration"),tr("InterfaceTypeAnnotation",{visitor:["extends","body"],aliases:["FlowType"],fields:{extends:ht(vt("InterfaceExtends")),body:ft("ObjectTypeAnnotation")}}),tr("IntersectionTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:gt(vt("FlowType"))}}),tr("MixedTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("EmptyTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["FlowType"],fields:{typeAnnotation:ft("FlowType")}}),tr("NumberLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:gt(Ct("number"))}}),tr("BigIntLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:gt(Ct("bigint"))}}),tr("NumberTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties","internalSlots"],aliases:["FlowType"],builder:["properties","indexers","callProperties","internalSlots","exact"],fields:{properties:gt(vt("ObjectTypeProperty","ObjectTypeSpreadProperty")),indexers:{validate:vt("ObjectTypeIndexer"),optional:!1,default:[]},callProperties:{validate:vt("ObjectTypeCallProperty"),optional:!1,default:[]},internalSlots:{validate:vt("ObjectTypeInternalSlot"),optional:!1,default:[]},exact:{validate:Ct("boolean"),default:!1},inexact:ht(Ct("boolean"))}}),tr("ObjectTypeInternalSlot",{visitor:["id","value"],builder:["id","value","optional","static","method"],aliases:["UserWhitespacable"],fields:{id:ft("Identifier"),value:ft("FlowType"),optional:gt(Ct("boolean")),static:gt(Ct("boolean")),method:gt(Ct("boolean"))}}),tr("ObjectTypeCallProperty",{visitor:["value"],aliases:["UserWhitespacable"],fields:{value:ft("FlowType"),static:mt(Ct("boolean"),!1)}}),tr("ObjectTypeIndexer",{visitor:["variance","id","key","value"],builder:["id","key","value","variance"],aliases:["UserWhitespacable"],fields:{id:Rt("Identifier"),key:ft("FlowType"),value:ft("FlowType"),static:mt(Ct("boolean"),!1),variance:Rt("Variance")}}),tr("ObjectTypeProperty",{visitor:["key","value","variance"],aliases:["UserWhitespacable"],fields:{key:ft("Identifier","StringLiteral","NumericLiteral"),value:ft("FlowType"),kind:{validate:Et("init","get","set"),default:"init",optional:!1},static:mt(Ct("boolean"),!1),proto:mt(Ct("boolean"),!1),optional:mt(Ct("boolean"),!1),variance:Rt("Variance"),method:mt(Ct("boolean"),!1)}}),tr("ObjectTypeSpreadProperty",{visitor:["argument"],aliases:["UserWhitespacable"],fields:{argument:ft("FlowType")}}),tr("OpaqueType",{visitor:["id","typeParameters","supertype","impltype"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier"),typeParameters:Rt("TypeParameterDeclaration"),supertype:Rt("FlowType"),impltype:ft("FlowType")}}),tr("QualifiedTypeIdentifier",{visitor:["qualification","id"],builder:["id","qualification"],fields:{id:ft("Identifier"),qualification:ft("Identifier","QualifiedTypeIdentifier")}}),tr("StringLiteralTypeAnnotation",{builder:["value"],aliases:["FlowType"],fields:{value:gt(Ct("string"))}}),tr("StringTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("SymbolTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("ThisTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("TupleTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:gt(vt("FlowType"))}}),tr("TypeofTypeAnnotation",{visitor:["argument"],aliases:["FlowType"],fields:{argument:ft("FlowType")}}),tr("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["FlowDeclaration","Statement","Declaration"],fields:{id:ft("Identifier"),typeParameters:Rt("TypeParameterDeclaration"),right:ft("FlowType")}}),tr("TypeAnnotation",{visitor:["typeAnnotation"],fields:{typeAnnotation:ft("FlowType")}}),tr("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["ExpressionWrapper","Expression"],fields:{expression:ft("Expression"),typeAnnotation:ft("TypeAnnotation")}}),tr("TypeParameter",{builder:["name","bound","default","variance"],visitor:["bound","default","variance"],fields:{name:gt(Ct("string")),bound:Rt("TypeAnnotation"),default:Rt("FlowType"),variance:Rt("Variance")}}),tr("TypeParameterDeclaration",{visitor:["params"],fields:{params:gt(vt("TypeParameter"))}}),tr("TypeParameterInstantiation",{visitor:["params"],fields:{params:gt(vt("FlowType"))}}),tr("UnionTypeAnnotation",{visitor:["types"],aliases:["FlowType"],fields:{types:gt(vt("FlowType"))}}),tr("Variance",{builder:["kind"],fields:{kind:gt(Et("minus","plus"))}}),tr("VoidTypeAnnotation",{aliases:["FlowType","FlowBaseAnnotation"]}),tr("EnumDeclaration",{aliases:["Statement","Declaration"],visitor:["id","body"],fields:{id:ft("Identifier"),body:ft("EnumBooleanBody","EnumNumberBody","EnumStringBody","EnumSymbolBody")}});var ir={explicitType:mt(Ct("boolean"),!1),hasUnknownMembers:mt(Ct("boolean"),!1)};tr("EnumBooleanBody",{aliases:["EnumBody"],visitor:["members"],fields:Object.assign({},ir,{members:bt("EnumBooleanMember")})}),tr("EnumNumberBody",{aliases:["EnumBody"],visitor:["members"],fields:Object.assign({},ir,{members:bt("EnumNumberMember")})}),tr("EnumStringBody",{aliases:["EnumBody"],visitor:["members"],fields:Object.assign({},ir,{members:bt("EnumStringMember","EnumDefaultedMember")})}),tr("EnumSymbolBody",{aliases:["EnumBody"],visitor:["members"],fields:{members:bt("EnumDefaultedMember"),hasUnknownMembers:mt(Ct("boolean"),!1)}}),tr("EnumBooleanMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:ft("Identifier"),init:ft("BooleanLiteral")}}),tr("EnumNumberMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:ft("Identifier"),init:ft("NumericLiteral")}}),tr("EnumStringMember",{aliases:["EnumMember"],visitor:["id","init"],fields:{id:ft("Identifier"),init:ft("StringLiteral")}}),tr("EnumDefaultedMember",{aliases:["EnumMember"],visitor:["id"],fields:{id:ft("Identifier")}}),tr("IndexedAccessType",{visitor:["objectType","indexType"],aliases:["FlowType"],fields:{objectType:ft("FlowType"),indexType:ft("FlowType")}}),tr("OptionalIndexedAccessType",{visitor:["objectType","indexType"],aliases:["FlowType"],fields:{objectType:ft("FlowType"),indexType:ft("FlowType"),optional:mt(Ct("boolean"),!1)}});var or=Ot("JSX");or("JSXAttribute",{visitor:["name","value"],aliases:["Immutable"],fields:{name:{validate:Tt("JSXIdentifier","JSXNamespacedName")},value:{optional:!0,validate:Tt("JSXElement","JSXFragment","StringLiteral","JSXExpressionContainer")}}}),or("JSXClosingElement",{visitor:["name"],aliases:["Immutable"],fields:{name:{validate:Tt("JSXIdentifier","JSXMemberExpression","JSXNamespacedName")}}}),or("JSXElement",{builder:["openingElement","closingElement","children"],visitor:["openingElement","children","closingElement"],aliases:["Immutable","Expression"],fields:{openingElement:{validate:Tt("JSXOpeningElement")},closingElement:{optional:!0,validate:Tt("JSXClosingElement")},children:bt("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement","JSXFragment")}}),or("JSXEmptyExpression",{}),or("JSXExpressionContainer",{visitor:["expression"],aliases:["Immutable"],fields:{expression:{validate:Tt("Expression","JSXEmptyExpression")}}}),or("JSXSpreadChild",{visitor:["expression"],aliases:["Immutable"],fields:{expression:{validate:Tt("Expression")}}}),or("JSXIdentifier",{builder:["name"],fields:{name:{validate:Ct("string")}}}),or("JSXMemberExpression",{visitor:["object","property"],fields:{object:{validate:Tt("JSXMemberExpression","JSXIdentifier")},property:{validate:Tt("JSXIdentifier")}}}),or("JSXNamespacedName",{visitor:["namespace","name"],fields:{namespace:{validate:Tt("JSXIdentifier")},name:{validate:Tt("JSXIdentifier")}}}),or("JSXOpeningElement",{builder:["name","attributes","selfClosing"],visitor:["name","typeArguments","attributes"],aliases:["Immutable"],fields:{name:{validate:Tt("JSXIdentifier","JSXMemberExpression","JSXNamespacedName")},selfClosing:{default:!1},attributes:bt("JSXAttribute","JSXSpreadAttribute"),typeArguments:{validate:Tt("TypeParameterInstantiation","TSTypeParameterInstantiation"),optional:!0}}}),or("JSXSpreadAttribute",{visitor:["argument"],fields:{argument:{validate:Tt("Expression")}}}),or("JSXText",{aliases:["Immutable"],builder:["value"],fields:{value:{validate:Ct("string")}}}),or("JSXFragment",{builder:["openingFragment","closingFragment","children"],visitor:["openingFragment","children","closingFragment"],aliases:["Immutable","Expression"],fields:{openingFragment:{validate:Tt("JSXOpeningFragment")},closingFragment:{validate:Tt("JSXClosingFragment")},children:bt("JSXText","JSXExpressionContainer","JSXSpreadChild","JSXElement","JSXFragment")}}),or("JSXOpeningFragment",{aliases:["Immutable"]}),or("JSXClosingFragment",{aliases:["Immutable"]});for(var sr=["Identifier","StringLiteral","Expression","Statement","Declaration","BlockStatement","ClassBody","Pattern"],dr={Declaration:["Statement"],Pattern:["PatternLike","LVal"]},ur=0,cr=sr;ur=Number.MAX_SAFE_INTEGER?$h.uid=0:$h.uid++};var Zh=Function.call.bind(Object.prototype.toString);function em(e){if(void 0===e)return pi("undefined");if(!0===e||!1===e)return yi(e);if(null===e)return{type:"NullLiteral"};if("string"==typeof e)return hi(e);if("number"==typeof e){var a;if(Number.isFinite(e))a=mi(Math.abs(e));else a=zr("/",Number.isNaN(e)?mi(0):mi(1),mi(0));return(e<0||Object.is(e,-0))&&(a=ji("-",a)),a}if("bigint"==typeof e)return e<0?ji("-",mo(-e)):mo(e);if(function(e){return"[object RegExp]"===Zh(e)}(e))return vi(e.source,/\/([a-z]*)$/.exec(e.toString())[1]);if(Array.isArray(e))return Hr(e.map(em));if(function(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;var a=Object.getPrototypeOf(e);return null===a||null===Object.getPrototypeOf(a)}(e)){for(var n=[],t=0,r=Object.keys(e);t1?e:e[0]}),Em=bm(function(e){return e}),Sm=bm(function(e){if(0===e.length)throw new Error("Found nothing to return.");if(e.length>1)throw new Error("Found multiple statements but wanted one");return e[0]}),Tm={code:function(e){return"(\n"+e+"\n)"},validate:function(e){if(e.program.body.length>1)throw new Error("Found multiple statements but wanted one");if(0===Tm.unwrap(e).start)throw new Error("Parse result included parens.")},unwrap:function(e){var a=E(e.program.body,1)[0];return vm(a),a.expression}},wm=["placeholderAllowlist","placeholderPattern","preserveComments","syntacticPlaceholders"];function Cm(e,a){var n=a.placeholderAllowlist,t=void 0===n?e.placeholderAllowlist:n,r=a.placeholderPattern,i=void 0===r?e.placeholderPattern:r,o=a.preserveComments,s=void 0===o?e.preserveComments:o,d=a.syntacticPlaceholders,u=void 0===d?e.syntacticPlaceholders:d;return{parser:Object.assign({},e.parser,a.parser),placeholderAllowlist:t,placeholderPattern:i,preserveComments:s,syntacticPlaceholders:u}}function Pm(e){if(null!=e&&"object"!=typeof e)throw new Error("Unknown template options.");if(null!=e&&Object.hasOwn(e,"placeholderWhitelist")&&!Object.hasOwn(e,"placeholderAllowlist"))throw new Error("The 'placeholderWhitelist' option has been renamed to 'placeholderAllowlist'. Please update your configuration.");var a=e||{},n=a.placeholderAllowlist,t=a.placeholderPattern,r=a.preserveComments,i=a.syntacticPlaceholders,o=R(a,wm);if(null!=n&&!(n instanceof Set))throw new Error("'.placeholderAllowlist' must be a Set, null, or undefined");if(null!=t&&!(t instanceof RegExp)&&!1!==t)throw new Error("'.placeholderPattern' must be a RegExp, false, null, or undefined");if(null!=r&&"boolean"!=typeof r)throw new Error("'.preserveComments' must be a boolean, null, or undefined");if(null!=i&&"boolean"!=typeof i)throw new Error("'.syntacticPlaceholders' must be a boolean, null, or undefined");if(!0===i&&(null!=n||null!=t))throw new Error("'.placeholderAllowlist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");return{parser:o,placeholderAllowlist:n||void 0,placeholderPattern:null==t?void 0:t,preserveComments:null==r?void 0:r,syntacticPlaceholders:null==i?void 0:i}}function Am(e){if(Array.isArray(e))return e.reduce(function(e,a,n){return e["$"+n]=a,e},{});if("object"==typeof e||null==e)return e||void 0;throw new Error("Template replacements must be an array, object, null, or undefined")}var _m=l(function(e,a,n){this.line=void 0,this.column=void 0,void 0!==n&&(this.index=void 0),this.line=e,this.column=a,void 0!==n&&(this.index=n)}),Dm=l(function(e,a){this.start=void 0,this.end=void 0,this.filename=void 0,this.identifierName=void 0,this.start=e,this.end=a});function km(e,a){var n=e.line,t=e.column,r=e.index;return new _m(n,t+a,r+a)}var Im,Nm,Bm="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",Om={ImportMetaOutsideModule:{message:"import.meta may appear only with 'sourceType: \"module\"'",code:Bm},ImportOutsideModule:{message:"'import' and 'export' may appear only with 'sourceType: \"module\"'",code:Bm}},jm={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},Fm=function(e){return"UpdateExpression"===e.type?jm.UpdateExpression[""+e.prefix]:jm[e.type]},Mm={AccessorIsGenerator:function(e){return"A "+e.kind+"ter cannot be a generator."},ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:function(e){return"Missing initializer in "+e.kind+" declaration."},DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:function(e){return"`"+e.exportName+"` has already been exported. Exported identifiers must be unique."},DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:function(e){return"A string literal cannot be used as an exported binding without `from`.\n- Did you mean `export { '"+e.localName+"' as '"+e.exportName+"' } from 'some-module'`?"},ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:function(e){return"'"+("ForInStatement"===e.type?"for-in":"for-of")+"' loop variable declaration may not have an initializer."},ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:function(e){return"Unsyntactic "+("BreakStatement"===e.type?"break":"continue")+"."},IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportBindingIsString:function(e){return'A string literal cannot be used as an imported binding.\n- Did you mean `import { "'+e.importName+'" as foo }`?'},ImportCallArity:function(e){var a=e.phase;return"`import"+(a?"."+a:"")+"()` requires exactly one or two arguments."},ImportCallNotNewExpression:function(e){var a=e.phase;return"Cannot use new with import"+(a?"."+a:"")+"()."},ImportCallSpreadArgument:function(e){var a=e.phase;return"`...` is not allowed in `import"+(a?"."+a:"")+"()`."},IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDigit:function(e){return"Expected number in radix "+e.radix+"."},InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:function(e){return"Escape sequence in keyword "+e.reservedWord+"."},InvalidIdentifier:function(e){return"Invalid identifier "+e.identifierName+"."},InvalidLhs:function(e){var a=e.ancestor;return"Invalid left-hand side in "+Fm(a)+"."},InvalidLhsBinding:function(e){var a=e.ancestor;return"Binding invalid left-hand side in "+Fm(a)+"."},InvalidLhsOptionalChaining:function(e){var a=e.ancestor;return"Invalid optional chaining in the left-hand side of "+Fm(a)+"."},InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:function(e){return"Unexpected character '"+e.unexpected+"'."},InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:function(e){return"Private name #"+e.identifierName+" is not defined."},InvalidPropertyBindingPattern:"Binding member expression.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:function(e){return"Label '"+e.labelName+"' is already declared."},LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:function(e){return"This experimental syntax requires enabling the parser plugin: "+e.missingPlugin.map(function(e){return JSON.stringify(e)}).join(", ")+"."},MissingOneOfPlugins:function(e){return"This experimental syntax requires enabling one of the following parser plugin(s): "+e.missingPlugin.map(function(e){return JSON.stringify(e)}).join(", ")+"."},MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:function(e){return'Duplicate key "'+e.key+'" is not allowed in module attributes.'},ModuleExportNameHasLoneSurrogate:function(e){return"An export name cannot include a lone surrogate, found '\\u"+e.surrogateCharCode.toString(16)+"'."},ModuleExportUndefined:function(e){return"Export '"+e.localName+"' is not defined."},MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:function(e){var a=e.identifierName;return"Private names are only allowed in property accesses (`obj.#"+a+"`) or in `in` expressions (`#"+a+" in obj`)."},PrivateNameRedeclaration:function(e){return"Duplicate private name #"+e.identifierName+"."},RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperCallNotNewExpression:"Cannot use new with super(...).",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:function(e){return"Unexpected keyword '"+e.keyword+"'."},UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:function(e){return"Unexpected reserved word '"+e.reservedWord+"'."},UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:function(e){var a=e.expected,n=e.unexpected;return"Unexpected token"+(n?" '"+n+"'.":"")+(a?', expected "'+a+'"':"")},UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:function(e){var a=e.target;return"The only valid meta property for "+a+" is "+a+"."+e.onlyValidPropertyName+"."},UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:function(e){return"Identifier '"+e.identifierName+"' has already been declared."},VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},Lm={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:function(e){var a=e.unexpected;return"Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character `"+String.fromCodePoint(a)+"`."}},Um=new Set(["ArrowFunctionExpression","AssignmentExpression","ConditionalExpression","YieldExpression"]),qm={PipeTopicRequiresHackPipes:'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:function(e){var a=e.token;return"Invalid topic token "+a+". In order to use "+a+' as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "'+a+'" }.'},PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:function(e){var a=e.type;return"Hack-style pipe body cannot be an unparenthesized "+Fm({type:a})+"; please wrap it in parentheses."},PipelineUnparenthesized:"Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."},Wm=["message"];function Vm(e,a,n){Object.defineProperty(e,a,{enumerable:!1,configurable:!0,value:n})}function Gm(e,a){if(Array.isArray(e))return function(a){return Gm(a,e[0])};for(var n={},t=function(){var t=i[r],o=e[t],s="string"==typeof o?{message:function(){return o}}:"function"==typeof o?{message:o}:o,d=s.message,u=R(s,Wm),c="string"==typeof d?function(){return d}:d;n[t]=function(e){var a=e.toMessage,n=e.code,t=e.reasonCode,r=e.syntaxPlugin,i="MissingPlugin"===t||"MissingOneOfPlugins"===t;return function e(o,s,d){var u=new SyntaxError;return u.code=n,u.reasonCode=t,u.loc=o,u.pos=s,u.syntaxPlugin=r,i&&(u.missingPlugin=d.missingPlugin),Vm(u,"clone",function(a){var n;void 0===a&&(a={});var t=null!=(n=a.loc)?n:o,r=t.line,i=t.column,u=t.index,c=void 0===u?s:u;return e(new _m(r,i),c,Object.assign({},d,a.details))}),Vm(u,"details",d),Object.defineProperty(u,"message",{configurable:!0,get:function(){var e=a(d)+" ("+o.line+":"+o.column+")";return this.message=e,e},set:function(e){Object.defineProperty(this,"message",{value:e,writable:!0})}}),u}}(Object.assign({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:t,toMessage:c},a?{syntaxPlugin:a}:{},u))},r=0,i=Object.keys(e);r",{beforeExpr:dR}),template:TR("template"),ellipsis:TR("...",{beforeExpr:dR}),backQuote:TR("`",{startsExpr:uR}),dollarBraceL:TR("${",{beforeExpr:dR,startsExpr:uR}),templateTail:TR("...`",{startsExpr:uR}),templateNonTail:TR("...${",{beforeExpr:dR,startsExpr:uR}),at:TR("@"),hash:TR("#",{startsExpr:uR}),interpreterDirective:TR("#!..."),eq:TR("=",{beforeExpr:dR,isAssign:lR}),assign:TR("_=",{beforeExpr:dR,isAssign:lR}),slashAssign:TR("_=",{beforeExpr:dR,isAssign:lR}),xorAssign:TR("_=",{beforeExpr:dR,isAssign:lR}),moduloAssign:TR("_=",{beforeExpr:dR,isAssign:lR}),incDec:TR("++/--",{prefix:pR,postfix:!0,startsExpr:uR}),bang:TR("!",{beforeExpr:dR,prefix:pR,startsExpr:uR}),tilde:TR("~",{beforeExpr:dR,prefix:pR,startsExpr:uR}),doubleCaret:TR("^^",{startsExpr:uR}),doubleAt:TR("@@",{startsExpr:uR}),pipeline:mR("|>",0),nullishCoalescing:mR("??",1),logicalOR:mR("||",1),logicalAND:mR("&&",2),bitwiseOR:mR("|",3),bitwiseXOR:mR("^",4),bitwiseAND:mR("&",5),equality:mR("==/!=/===/!==",6),lt:mR("/<=/>=",7),gt:mR("/<=/>=",7),relational:mR("/<=/>=",7),bitShift:mR("<>/>>>",8),bitShiftL:mR("<>/>>>",8),bitShiftR:mR("<>/>>>",8),plusMin:TR("+/-",{beforeExpr:dR,binop:9,prefix:pR,startsExpr:uR}),modulo:TR("%",{binop:10,startsExpr:uR}),star:TR("*",{binop:10}),slash:mR("/",10),exponent:TR("**",{beforeExpr:dR,binop:11,rightAssociative:!0}),_in:hR("in",{beforeExpr:dR,binop:7}),_instanceof:hR("instanceof",{beforeExpr:dR,binop:7}),_break:hR("break"),_case:hR("case",{beforeExpr:dR}),_catch:hR("catch"),_continue:hR("continue"),_debugger:hR("debugger"),_default:hR("default",{beforeExpr:dR}),_else:hR("else",{beforeExpr:dR}),_finally:hR("finally"),_function:hR("function",{startsExpr:uR}),_if:hR("if"),_return:hR("return",{beforeExpr:dR}),_switch:hR("switch"),_throw:hR("throw",{beforeExpr:dR,prefix:pR,startsExpr:uR}),_try:hR("try"),_var:hR("var"),_const:hR("const"),_with:hR("with"),_new:hR("new",{beforeExpr:dR,startsExpr:uR}),_this:hR("this",{startsExpr:uR}),_super:hR("super",{startsExpr:uR}),_class:hR("class",{startsExpr:uR}),_extends:hR("extends",{beforeExpr:dR}),_export:hR("export"),_import:hR("import",{startsExpr:uR}),_null:hR("null",{startsExpr:uR}),_true:hR("true",{startsExpr:uR}),_false:hR("false",{startsExpr:uR}),_typeof:hR("typeof",{beforeExpr:dR,prefix:pR,startsExpr:uR}),_void:hR("void",{beforeExpr:dR,prefix:pR,startsExpr:uR}),_delete:hR("delete",{beforeExpr:dR,prefix:pR,startsExpr:uR}),_do:hR("do",{isLoop:cR,beforeExpr:dR}),_for:hR("for",{isLoop:cR}),_while:hR("while",{isLoop:cR}),_as:wR("as",{startsExpr:uR}),_assert:wR("assert",{startsExpr:uR}),_async:wR("async",{startsExpr:uR}),_await:wR("await",{startsExpr:uR}),_defer:wR("defer",{startsExpr:uR}),_from:wR("from",{startsExpr:uR}),_get:wR("get",{startsExpr:uR}),_let:wR("let",{startsExpr:uR}),_meta:wR("meta",{startsExpr:uR}),_of:wR("of",{startsExpr:uR}),_sent:wR("sent",{startsExpr:uR}),_set:wR("set",{startsExpr:uR}),_source:wR("source",{startsExpr:uR}),_static:wR("static",{startsExpr:uR}),_using:wR("using",{startsExpr:uR}),_yield:wR("yield",{startsExpr:uR}),_asserts:wR("asserts",{startsExpr:uR}),_checks:wR("checks",{startsExpr:uR}),_exports:wR("exports",{startsExpr:uR}),_global:wR("global",{startsExpr:uR}),_implements:wR("implements",{startsExpr:uR}),_intrinsic:wR("intrinsic",{startsExpr:uR}),_infer:wR("infer",{startsExpr:uR}),_is:wR("is",{startsExpr:uR}),_mixins:wR("mixins",{startsExpr:uR}),_proto:wR("proto",{startsExpr:uR}),_require:wR("require",{startsExpr:uR}),_satisfies:wR("satisfies",{startsExpr:uR}),_keyof:wR("keyof",{startsExpr:uR}),_readonly:wR("readonly",{startsExpr:uR}),_unique:wR("unique",{startsExpr:uR}),_abstract:wR("abstract",{startsExpr:uR}),_declare:wR("declare",{startsExpr:uR}),_enum:wR("enum",{startsExpr:uR}),_module:wR("module",{startsExpr:uR}),_namespace:wR("namespace",{startsExpr:uR}),_interface:wR("interface",{startsExpr:uR}),_type:wR("type",{startsExpr:uR}),_opaque:wR("opaque",{startsExpr:uR}),name:TR("name",{startsExpr:uR}),placeholder:TR("%%",{startsExpr:uR}),string:TR("string",{startsExpr:uR}),num:TR("num",{startsExpr:uR}),bigint:TR("bigint",{startsExpr:uR}),regexp:TR("regexp",{startsExpr:uR}),privateName:TR("#name",{startsExpr:uR}),eof:TR("eof"),jsxName:TR("jsxName"),jsxText:TR("jsxText",{beforeExpr:dR}),jsxTagStart:TR("jsxTagStart",{startsExpr:uR}),jsxTagEnd:TR("jsxTagEnd")};function PR(e){return e>=89&&e<=129}function AR(e){return e>=54&&e<=129}function _R(e){return e>=54&&e<=132}function DR(e){return ER[e]}function kR(e){return e>=125&&e<=127}function IR(e){return e>=54&&e<=88}function NR(e){return e>=35&&e<=55}function BR(e){return 30===e}function OR(e){return vR[e]}function jR(e){return bR[e]}function FR(e){return e>=20&&e<=21}function MR(e){return yR[e]}var LR=l(function(e,a){this.token=void 0,this.preserveSpace=void 0,this.token=e,this.preserveSpace=!!a}),UR={brace:new LR("{"),j_oTag:new LR("...",!0)};var qR=new Set(["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete","implements","interface","let","package","private","protected","public","static","yield","eval","arguments","enum","await"]);var WR,VR=0,GR=1,HR=2,KR=4,zR=8,JR=16,XR=32,YR=64,$R=128,QR=256,ZR=512,ey=1024,ay=2048,ny=514,ty=576,ry=3715,iy=1,oy=2,sy=4,dy=8,uy=16,cy=128,ly=256,py=512,gy=1024,fy=2048,hy=4096,my=8192,Ry=8331,yy=8201,vy=9,by=5,xy=17,Ey=130,Sy=2,Ty=8459,wy=1024,Cy=64,Py=65,Ay=8971,_y=1024,Dy=4098,ky=4096,Iy=2048,Ny=0,By=4,Oy=3,jy=6,Fy=5,My=2,Ly=1,Uy=1,qy=2,Wy=4,Vy=l(function(e){this.flags=0,this.names=new Map,this.firstLexicalName="",this.flags=e}),Gy=function(){function e(e,a){this.parser=void 0,this.scopeStack=[],this.inModule=void 0,this.undefinedExports=new Map,this.parser=e,this.inModule=a}var a=e.prototype;return a.createScope=function(e){return new Vy(e)},a.enter=function(e){this.scopeStack.push(this.createScope(e))},a.exit=function(){return this.scopeStack.pop().flags},a.treatFunctionsAsVarInScope=function(e){return!!(e.flags&(HR|$R)||!this.parser.inModule&&e.flags&GR)},a.declareName=function(e,a,n){var t=this.currentScope();if(a&dy||a&uy){this.checkRedeclarationInScope(t,e,a,n);var r=t.names.get(e)||0;a&uy?r|=Wy:(t.firstLexicalName||(t.firstLexicalName=e),r|=qy),t.names.set(e,r),a&dy&&this.maybeExportDefined(t,e)}else if(a&sy)for(var i=this.scopeStack.length-1;i>=0&&(t=this.scopeStack[i],this.checkRedeclarationInScope(t,e,a,n),t.names.set(e,(t.names.get(e)||0)|Uy),this.maybeExportDefined(t,e),!(t.flags&ry));--i);this.parser.inModule&&t.flags&GR&&this.undefinedExports.delete(e)},a.maybeExportDefined=function(e,a){this.parser.inModule&&e.flags&GR&&this.undefinedExports.delete(a)},a.checkRedeclarationInScope=function(e,a,n,t){this.isRedeclaredInScope(e,a,n)&&this.parser.raise(Hm.VarRedeclaration,t,{identifierName:a})},a.isRedeclaredInScope=function(e,a,n){if(!(n&iy))return!1;if(n&dy)return e.names.has(a);var t=e.names.get(a)||0;return n&uy?(t&qy)>0||!this.treatFunctionsAsVarInScope(e)&&(t&Uy)>0:(t&qy)>0&&!(e.flags&zR&&e.firstLexicalName===a)||!this.treatFunctionsAsVarInScope(e)&&(t&Wy)>0},a.checkLocalExport=function(e){var a=e.name;this.scopeStack[0].names.has(a)||this.undefinedExports.set(a,e.start)},a.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},a.currentVarScopeFlags=function(){for(var e=this.scopeStack.length-1;;e--){var a=this.scopeStack[e].flags;if(a&ry)return a}},a.currentThisScopeFlags=function(){for(var e=this.scopeStack.length-1;;e--){var a=this.scopeStack[e].flags;if(a&(ry|YR)&&!(a&KR))return a}},l(e,[{key:"inTopLevel",get:function(){return(this.currentScope().flags&GR)>0}},{key:"inFunction",get:function(){return(this.currentVarScopeFlags()&HR)>0}},{key:"allowSuper",get:function(){return(this.currentThisScopeFlags()&JR)>0}},{key:"allowDirectSuper",get:function(){return(this.currentThisScopeFlags()&XR)>0}},{key:"allowNewTarget",get:function(){return(this.currentThisScopeFlags()&ZR)>0}},{key:"inClass",get:function(){return(this.currentThisScopeFlags()&YR)>0}},{key:"inClassAndNotInNonArrowFunction",get:function(){var e=this.currentThisScopeFlags();return(e&YR)>0&&0===(e&HR)}},{key:"inStaticBlock",get:function(){for(var e=this.scopeStack.length-1;;e--){var a=this.scopeStack[e].flags;if(a&$R)return!0;if(a&(ry|YR))return!1}}},{key:"inNonArrowFunction",get:function(){return(this.currentThisScopeFlags()&HR)>0}},{key:"inBareCaseStatement",get:function(){return(this.currentScope().flags&QR)>0}},{key:"treatFunctionsAsVar",get:function(){return this.treatFunctionsAsVarInScope(this.currentScope())}}])}(),Hy=function(e){function a(){for(var a,n=arguments.length,t=new Array(n),r=0;r0||(r&qy)>0}return!1},n.checkLocalExport=function(a){this.scopeStack[0].declareFunctions.has(a.name)||e.prototype.checkLocalExport.call(this,a)},l(a)}(Gy),zy=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),Jy=Gm(WR||(WR=S(["flow"])))({AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:function(e){return"Cannot overwrite reserved type "+e.reservedType+"."},DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:function(e){var a=e.memberName;return"Boolean enum members need to be initialized. Use either `"+a+" = true,` or `"+a+" = false,` in enum `"+e.enumName+"`."},EnumDuplicateMemberName:function(e){return"Enum member names need to be unique, but the name `"+e.memberName+"` has already been used before in enum `"+e.enumName+"`."},EnumInconsistentMemberValues:function(e){return"Enum `"+e.enumName+"` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers."},EnumInvalidExplicitType:function(e){return"Enum type `"+e.invalidEnumType+"` is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `"+e.enumName+"`."},EnumInvalidExplicitTypeUnknownSupplied:function(e){return"Supplied enum type is not valid. Use one of `boolean`, `number`, `string`, or `symbol` in enum `"+e.enumName+"`."},EnumInvalidMemberInitializerPrimaryType:function(e){var a=e.enumName,n=e.memberName,t=e.explicitType;return"Enum `"+a+"` has type `"+t+"`, so the initializer of `"+n+"` needs to be a "+t+" literal."},EnumInvalidMemberInitializerSymbolType:function(e){var a=e.enumName;return"Symbol enum members cannot be initialized. Use `"+e.memberName+",` in enum `"+a+"`."},EnumInvalidMemberInitializerUnknownType:function(e){var a=e.enumName;return"The enum member initializer for `"+e.memberName+"` needs to be a literal (either a boolean, number, or string) in enum `"+a+"`."},EnumInvalidMemberName:function(e){var a=e.enumName;return"Enum member names cannot start with lowercase 'a' through 'z'. Instead of using `"+e.memberName+"`, consider using `"+e.suggestion+"`, in enum `"+a+"`."},EnumNumberMemberNotInitialized:function(e){var a=e.enumName;return"Number enum members need to be initialized, e.g. `"+e.memberName+" = 1` in enum `"+a+"`."},EnumStringMemberInconsistentlyInitialized:function(e){return"String enum members need to consistently either all use initializers, or use no initializers, in enum `"+e.enumName+"`."},GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:{message:"A binding pattern parameter cannot be optional in an implementation signature."},SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:function(e){return"Unexpected reserved type "+e.reservedType+"."},UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of ` async () => {}`, use `async () => {}`.",UnsupportedDeclareExportKind:function(e){return"`declare export "+e.unsupportedExportKind+"` is not supported. Use `"+e.suggestion+"` instead."},UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."});function Xy(e){return"type"===e.importKind||"typeof"===e.importKind}var Yy={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};var $y=/\*?\s*@((?:no)?flow)\b/,Qy={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xa0",iexcl:"\xa1",cent:"\xa2",pound:"\xa3",curren:"\xa4",yen:"\xa5",brvbar:"\xa6",sect:"\xa7",uml:"\xa8",copy:"\xa9",ordf:"\xaa",laquo:"\xab",not:"\xac",shy:"\xad",reg:"\xae",macr:"\xaf",deg:"\xb0",plusmn:"\xb1",sup2:"\xb2",sup3:"\xb3",acute:"\xb4",micro:"\xb5",para:"\xb6",middot:"\xb7",cedil:"\xb8",sup1:"\xb9",ordm:"\xba",raquo:"\xbb",frac14:"\xbc",frac12:"\xbd",frac34:"\xbe",iquest:"\xbf",Agrave:"\xc0",Aacute:"\xc1",Acirc:"\xc2",Atilde:"\xc3",Auml:"\xc4",Aring:"\xc5",AElig:"\xc6",Ccedil:"\xc7",Egrave:"\xc8",Eacute:"\xc9",Ecirc:"\xca",Euml:"\xcb",Igrave:"\xcc",Iacute:"\xcd",Icirc:"\xce",Iuml:"\xcf",ETH:"\xd0",Ntilde:"\xd1",Ograve:"\xd2",Oacute:"\xd3",Ocirc:"\xd4",Otilde:"\xd5",Ouml:"\xd6",times:"\xd7",Oslash:"\xd8",Ugrave:"\xd9",Uacute:"\xda",Ucirc:"\xdb",Uuml:"\xdc",Yacute:"\xdd",THORN:"\xde",szlig:"\xdf",agrave:"\xe0",aacute:"\xe1",acirc:"\xe2",atilde:"\xe3",auml:"\xe4",aring:"\xe5",aelig:"\xe6",ccedil:"\xe7",egrave:"\xe8",eacute:"\xe9",ecirc:"\xea",euml:"\xeb",igrave:"\xec",iacute:"\xed",icirc:"\xee",iuml:"\xef",eth:"\xf0",ntilde:"\xf1",ograve:"\xf2",oacute:"\xf3",ocirc:"\xf4",otilde:"\xf5",ouml:"\xf6",divide:"\xf7",oslash:"\xf8",ugrave:"\xf9",uacute:"\xfa",ucirc:"\xfb",uuml:"\xfc",yacute:"\xfd",thorn:"\xfe",yuml:"\xff",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02c6",tilde:"\u02dc",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039a",Lambda:"\u039b",Mu:"\u039c",Nu:"\u039d",Xi:"\u039e",Omicron:"\u039f",Pi:"\u03a0",Rho:"\u03a1",Sigma:"\u03a3",Tau:"\u03a4",Upsilon:"\u03a5",Phi:"\u03a6",Chi:"\u03a7",Psi:"\u03a8",Omega:"\u03a9",alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03b5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigmaf:"\u03c2",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03c6",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",thetasym:"\u03d1",upsih:"\u03d2",piv:"\u03d6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200c",zwj:"\u200d",lrm:"\u200e",rlm:"\u200f",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201a",ldquo:"\u201c",rdquo:"\u201d",bdquo:"\u201e",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203a",oline:"\u203e",frasl:"\u2044",euro:"\u20ac",image:"\u2111",weierp:"\u2118",real:"\u211c",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21b5",lArr:"\u21d0",uArr:"\u21d1",rArr:"\u21d2",dArr:"\u21d3",hArr:"\u21d4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220b",prod:"\u220f",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221a",prop:"\u221d",infin:"\u221e",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222a",int:"\u222b",there4:"\u2234",sim:"\u223c",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22a5",sdot:"\u22c5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230a",rfloor:"\u230b",lang:"\u2329",rang:"\u232a",loz:"\u25ca",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},Zy=new RegExp(/\r\n|[\r\n\u2028\u2029]/.source,"g");function ev(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function av(e,a,n){for(var t=a;t."},MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:function(e){var a=e.unexpected;return"Unexpected token `"+a+"`. Did you mean `"+e.HTMLEntity+"` or `{'"+a+"'}`?"},UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...?"});function sv(e){return!!e&&("JSXOpeningFragment"===e.type||"JSXClosingFragment"===e.type)}function dv(e){if("JSXIdentifier"===e.type)return e.name;if("JSXNamespacedName"===e.type)return e.namespace.name+":"+e.name.name;if("JSXMemberExpression"===e.type)return dv(e.object)+"."+dv(e.property);throw new Error("Node had unexpected type: "+e.type)}var uv=function(e){function a(){for(var a,n=arguments.length,t=new Array(n),r=0;r1)for(var t=0;t0?!(t&ly)||(t&py)>0!==(4&r)>0:t&cy&&(8&r)>0?!!(a.names.get(n)&qy)&&!!(t&iy):!!(t&oy&&(1&r)>0)||e.prototype.isRedeclaredInScope.call(this,a,n,t)},n.checkLocalExport=function(a){var n=a.name;if(!this.hasImport(n)){for(var t=this.scopeStack.length-1;t>=0;t--){var r=this.scopeStack[t].tsNames.get(n);if((1&r)>0||(16&r)>0)return}e.prototype.checkLocalExport.call(this,a)}},l(a,[{key:"inTSNamespace",get:function(){var e=this.scopeStack;return e.length>=2&&e[e.length-1].flags===VR&&(e[e.length-2].flags&ay)>0}}])}(Gy),lv=function(){function e(){this.sawUnambiguousESM=!1,this.ambiguousScriptDifferentAst=!1}var a=e.prototype;return a.sourceToOffsetPos=function(e){return e+this.startIndex},a.offsetToSourcePos=function(e){return e-this.startIndex},a.hasPlugin=function(e){if("string"==typeof e)return this.plugins.has(e);var a=e[0],n=e[1];if(!this.hasPlugin(a))return!1;for(var t=this.plugins.get(a),r=0,i=Object.keys(n);r0;)t=a[--r];null===t||t.start>n.start?gv(e,n.comments):pv(t,n.comments)}var hv=function(e){function a(){return e.apply(this,arguments)||this}h(a,e);var n=a.prototype;return n.addComment=function(e){this.filename&&(e.loc.filename=this.filename);var a=this.state.commentsLen;this.comments.length!==a&&(this.comments.length=a),this.comments.push(e),this.state.commentsLen++},n.processComment=function(e){var a=this.state.commentStack,n=a.length;if(0!==n){var t=n-1,r=a[t];r.start===e.end&&(r.leadingNode=e,t--);for(var i=e.start;t>=0;t--){var o=a[t],s=o.end;if(!(s>i)){s===i&&(o.trailingNode=e);break}o.containingNode=e,this.finalizeComment(o),a.splice(t,1)}}},n.finalizeComment=function(e){var a,n=e.comments;if(null!==e.leadingNode||null!==e.trailingNode)null!==e.leadingNode&&pv(e.leadingNode,n),null!==e.trailingNode&&function(e,a){var n;void 0===e.leadingComments?e.leadingComments=a:(n=e.leadingComments).unshift.apply(n,a)}(e.trailingNode,n);else{var t=e.containingNode,r=e.start;if(44===this.input.charCodeAt(this.offsetToSourcePos(r)-1))switch(t.type){case"ObjectExpression":case"ObjectPattern":fv(t,t.properties,e);break;case"CallExpression":case"NewExpression":case"OptionalCallExpression":fv(t,t.arguments,e);break;case"ImportExpression":fv(t,[t.source,null!=(a=t.options)?a:null],e);break;case"FunctionDeclaration":case"FunctionExpression":case"ArrowFunctionExpression":case"ObjectMethod":case"ClassMethod":case"ClassPrivateMethod":case"TSTypeParameterDeclaration":fv(t,t.params,e);break;case"ArrayExpression":case"ArrayPattern":fv(t,t.elements,e);break;case"ExportNamedDeclaration":case"ImportDeclaration":fv(t,t.specifiers,e);break;case"TSEnumBody":fv(t,t.members,e);break;case"TSInterfaceBody":fv(t,t.body,e);break;default:gv(t,n)}else gv(t,n)}},n.finalizeRemainingComments=function(){for(var e=this.state.commentStack,a=e.length-1;a>=0;a--)this.finalizeComment(e[a]);this.state.commentStack=[]},n.resetPreviousNodeTrailingComments=function(e){var a=this.state.commentStack,n=a.length;if(0!==n){var t=a[n-1];t.leadingNode===e&&(t.leadingNode=null)}},n.takeSurroundingComments=function(e,a,n){var t=this.state.commentStack,r=t.length;if(0!==r)for(var i=r-1;i>=0;i--){var o=t[i],s=o.end;if(o.start===n)o.leadingNode=e;else if(s===a)o.trailingNode=e;else if(s0},set:function(e){e?this.flags|=1:this.flags&=-2}},{key:"canStartArrow",get:function(){return(2&this.flags)>0},set:function(e){e?this.flags|=2:this.flags&=-3}},{key:"inType",get:function(){return(4&this.flags)>0},set:function(e){e?this.flags|=4:this.flags&=-5}},{key:"noAnonFunctionType",get:function(){return(8&this.flags)>0},set:function(e){e?this.flags|=8:this.flags&=-9}},{key:"hasFlowComment",get:function(){return(16&this.flags)>0},set:function(e){e?this.flags|=16:this.flags&=-17}},{key:"isAmbientContext",get:function(){return(32&this.flags)>0},set:function(e){e?this.flags|=32:this.flags&=-33}},{key:"inAbstractClass",get:function(){return(64&this.flags)>0},set:function(e){e?this.flags|=64:this.flags&=-65}},{key:"inDisallowConditionalTypesContext",get:function(){return(128&this.flags)>0},set:function(e){e?this.flags|=128:this.flags&=-129}},{key:"inConditionalConsequent",get:function(){return(256&this.flags)>0},set:function(e){e?this.flags|=256:this.flags&=-257}},{key:"inHackPipelineBody",get:function(){return(512&this.flags)>0},set:function(e){e?this.flags|=512:this.flags&=-513}},{key:"seenTopicReference",get:function(){return(1024&this.flags)>0},set:function(e){e?this.flags|=1024:this.flags&=-1025}},{key:"canStartJSXElement",get:function(){return(2048&this.flags)>0},set:function(e){e?this.flags|=2048:this.flags&=-2049}},{key:"containsEsc",get:function(){return(4096&this.flags)>0},set:function(e){e?this.flags|=4096:this.flags&=-4097}},{key:"hasTopLevelAwait",get:function(){return(8192&this.flags)>0},set:function(e){e?this.flags|=8192:this.flags&=-8193}}])}();function vv(e,a,n){return new _m(n,e-a,e)}var bv,xv=new Set([103,109,115,105,121,117,100,118]),Ev=l(function(e){var a=e.startIndex||0;this.type=e.type,this.value=e.value,this.start=a+e.start,this.end=a+e.end,this.loc=new Dm(e.startLoc,e.endLoc)}),Sv=function(e){function a(a,n){var t;return(t=e.call(this)||this).isLookahead=void 0,t.tokens=[],t.errorHandlers_readInt={invalidDigit:function(e,a,n,r){return!!(t.optionFlags&rR)&&(t.raise(Hm.InvalidDigit,vv(e,a,n),{radix:r}),!0)},numericSeparatorInEscapeSequence:t.errorBuilder(Hm.NumericSeparatorInEscapeSequence),unexpectedNumericSeparator:t.errorBuilder(Hm.UnexpectedNumericSeparator)},t.errorHandlers_readCodePoint=Object.assign({},t.errorHandlers_readInt,{invalidEscapeSequence:t.errorBuilder(Hm.InvalidEscapeSequence),invalidCodePoint:t.errorBuilder(Hm.InvalidCodePoint)}),t.errorHandlers_readStringContents_string=Object.assign({},t.errorHandlers_readCodePoint,{strictNumericEscape:function(e,a,n){t.recordStrictModeErrors(Hm.StrictNumericEscape,vv(e,a,n))},unterminated:function(e,a,n){throw t.raise(Hm.UnterminatedString,vv(e-1,a,n))}}),t.errorHandlers_readStringContents_template=Object.assign({},t.errorHandlers_readCodePoint,{strictNumericEscape:t.errorBuilder(Hm.StrictNumericEscape),unterminated:function(e,a,n){throw t.raise(Hm.UnterminatedTemplate,vv(e,a,n))}}),t.state=new yv,t.state.init(a),t.input=n,t.length=n.length,t.comments=[],t.isLookahead=!1,(!bv||bv.length<2*(t.length+1))&&(bv=new Uint32Array(2*(t.length+1))),t.locData=bv,t}h(a,e);var n=a.prototype;return n.setLoc=function(e){var a=this.offsetToSourcePos(e.index);this.locData[2*a]=e.line,this.locData[2*a+1]=e.column},n.getLoc=function(e){var a=this.offsetToSourcePos(e);return new _m(this.locData[2*a],this.locData[2*a+1],e)},n.pushToken=function(e){this.tokens.length=this.state.tokensLength,this.tokens.push(e),++this.state.tokensLength},n.next=function(){this.checkKeywordEscapes(),this.optionFlags&aR&&this.pushToken(new Ev(this.state)),this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},n.eat=function(e){return!!this.match(e)&&(this.next(),!0)},n.match=function(e){return this.state.type===e},n.createLookaheadState=function(e){return{pos:e.pos,value:null,type:e.type,start:e.start,end:e.end,context:[this.curContext()],inType:e.inType,startLoc:e.startLoc,lastTokEndLoc:e.lastTokEndLoc,curLine:e.curLine,lineStart:e.lineStart,curPosition:e.curPosition}},n.lookahead=function(){var e=this.state;this.state=this.createLookaheadState(e),this.isLookahead=!0,this.nextToken(),this.isLookahead=!1;var a=this.state;return this.state=e,a},n.nextTokenStart=function(){return this.nextTokenStartSince(this.state.pos)},n.nextTokenStartSince=function(e){return tv.lastIndex=e,tv.test(this.input)?tv.lastIndex:e},n.lookaheadCharCode=function(){return this.lookaheadCharCodeSince(this.state.pos)},n.lookaheadCharCodeSince=function(e){return this.input.charCodeAt(this.nextTokenStartSince(e))},n.nextTokenInLineStart=function(){return this.nextTokenInLineStartSince(this.state.pos)},n.nextTokenInLineStartSince=function(e){return rv.lastIndex=e,rv.test(this.input)?rv.lastIndex:e},n.lookaheadInLineCharCode=function(){return this.input.charCodeAt(this.nextTokenInLineStart())},n.codePointAtPos=function(e){var a=this.input.charCodeAt(e);if(55296==(64512&a)&&++e=this.length?this.finishToken(135):this.getTokenFromCode(this.codePointAtPos(this.state.pos))},n.skipBlockComment=function(e){var a;this.isLookahead||(a=this.state.curPosition());var n=this.state.pos,t=this.input.indexOf(e,n+2);if(-1===t)throw this.raise(Hm.UnterminatedComment,this.state.curPosition());for(this.state.pos=t+e.length,Zy.lastIndex=n+2;Zy.test(this.input)&&Zy.lastIndex<=t;)++this.state.curLine,this.state.lineStart=Zy.lastIndex;if(!this.isLookahead){var r={type:"CommentBlock",value:this.input.slice(n+2,t),start:this.sourceToOffsetPos(n),end:this.sourceToOffsetPos(t+e.length),loc:new Dm(a,this.state.curPosition())};return this.optionFlags&aR&&this.pushToken(r),r}},n.skipLineComment=function(e){var a,n=this.state.pos;this.isLookahead||(a=this.state.curPosition());var t=this.input.charCodeAt(this.state.pos+=e);if(this.state.pose))break e;var o=this.skipLineComment(3);void 0!==o&&(this.addComment(o),null==a||a.push(o))}else{if(60!==n||this.inModule||!(this.optionFlags&oR))break e;var s=this.state.pos;if(33!==this.input.charCodeAt(s+1)||45!==this.input.charCodeAt(s+2)||45!==this.input.charCodeAt(s+3))break e;var d=this.skipLineComment(4);void 0!==d&&(this.addComment(d),null==a||a.push(d))}}}if((null==a?void 0:a.length)>0){var u=this.state.pos,c={start:this.sourceToOffsetPos(e),end:this.sourceToOffsetPos(u),comments:a,leadingNode:null,trailingNode:null,containingNode:null};this.state.commentStack.push(c)}},n.finishToken=function(e,a){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var n=this.state.type;this.state.type=e,this.state.value=a,this.isLookahead||this.updateContext(n)},n.replaceToken=function(e){this.state.type=e,this.updateContext()},n.readToken_numberSign=function(){if(0!==this.state.pos||!this.readToken_interpreter()){var e=this.state.pos+1,a=this.codePointAtPos(e);if(a>=48&&a<=57)throw this.raise(Hm.UnexpectedDigitAfterHash,this.state.curPosition());yn(a)?(++this.state.pos,this.finishToken(134,this.readWord1(a))):92===a?(++this.state.pos,this.finishToken(134,this.readWord1())):this.finishOp(23,1)}},n.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);e>=48&&e<=57?this.readNumber(!0):46===e&&46===this.input.charCodeAt(this.state.pos+2)?(this.state.pos+=3,this.finishToken(17)):(++this.state.pos,this.finishToken(12))},n.readToken_slash=function(){61===this.input.charCodeAt(this.state.pos+1)?this.finishOp(27,2):this.finishOp(52,1)},n.readToken_interpreter=function(){if(0!==this.state.pos||this.length<2)return!1;var e=this.input.charCodeAt(this.state.pos+1);if(33!==e)return!1;var a=this.state.pos;for(this.state.pos+=1;!ev(e)&&++this.state.pos=48&&a<=57?(++this.state.pos,this.finishToken(13)):(this.state.pos+=2,this.finishToken(14))},n.getTokenFromCode=function(e){switch(e){case 46:return void this.readToken_dot();case 40:return++this.state.pos,void this.finishToken(6);case 41:return++this.state.pos,void this.finishToken(7);case 59:return++this.state.pos,void this.finishToken(9);case 44:return++this.state.pos,void this.finishToken(8);case 91:return++this.state.pos,void this.finishToken(0);case 93:return++this.state.pos,void this.finishToken(1);case 123:return++this.state.pos,void this.finishToken(2);case 125:return++this.state.pos,void this.finishToken(4);case 58:return void(this.hasPlugin("functionBind")&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(11,2):(++this.state.pos,this.finishToken(10)));case 63:return void this.readToken_question();case 96:return void this.readTemplateToken();case 48:var a=this.input.charCodeAt(this.state.pos+1);if(120===a||88===a)return void this.readRadixNumber(16);if(111===a||79===a)return void this.readRadixNumber(8);if(98===a||66===a)return void this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return void this.readNumber(!1);case 34:case 39:return void this.readString(e);case 47:return void this.readToken_slash();case 37:case 42:return void this.readToken_mult_modulo(e);case 124:case 38:return void this.readToken_pipe_amp(e);case 94:return void this.readToken_caret();case 43:case 45:return void this.readToken_plus_min(e);case 60:return void this.readToken_lt();case 62:return void this.readToken_gt();case 61:case 33:return void this.readToken_eq_excl(e);case 126:return void this.finishOp(32,1);case 64:return void this.readToken_atSign();case 35:return void this.readToken_numberSign();case 92:return void this.readWord();default:if(yn(e))return void this.readWord(e)}throw this.raise(Hm.InvalidOrUnexpectedToken,this.state.curPosition(),{unexpected:String.fromCodePoint(e)})},n.finishOp=function(e,a){var n=this.input.slice(this.state.pos,this.state.pos+a);this.state.pos+=a,this.finishToken(e,n)},n.readRegexp=function(){for(var e,a,n=this.state.startLoc,t=this.state.start+1,r=this.state.pos;;++r){if(r>=this.length)throw this.raise(Hm.UnterminatedRegExp,km(n,1));var i=this.input.charCodeAt(r);if(ev(i))throw this.raise(Hm.UnterminatedRegExp,km(n,1));if(e)e=!1;else{if(91===i)a=!0;else if(93===i&&a)a=!1;else if(47===i&&!a)break;e=92===i}}var o=this.input.slice(t,r);++r;for(var s="",d=function(){return km(n,r+2-t)};r=2&&48===this.input.charCodeAt(a);if(o){var s=this.input.slice(a,this.state.pos);if(this.recordStrictModeErrors(Hm.StrictOctalLiteral,n),!this.state.strict){var d=s.indexOf("_");d>0&&this.raise(Hm.ZeroDigitNumericSeparator,km(n,d))}i=o&&!/[89]/.test(s)}var u=this.input.charCodeAt(this.state.pos);46!==u||i||(++this.state.pos,this.readInt(10),t=!0,u=this.input.charCodeAt(this.state.pos)),69!==u&&101!==u||i||(43!==(u=this.input.charCodeAt(++this.state.pos))&&45!==u||++this.state.pos,null===this.readInt(10)&&this.raise(Hm.InvalidOrMissingExponent,n),t=!0,u=this.input.charCodeAt(this.state.pos));var c=this.input.slice(a,this.state.pos).replaceAll("_","");if(110===u&&((t||o)&&this.raise(Hm.InvalidBigIntLiteral,n),++this.state.pos,r=!0),yn(this.codePointAtPos(this.state.pos)))throw this.raise(Hm.NumberIdentifier,this.state.curPosition());if(r)this.finishToken(132,c);else{var l=i?parseInt(c,8):parseFloat(c);this.finishToken(131,l)}},n.readCodePoint=function(e){var a=Un(this.input,this.state.pos,this.state.lineStart,this.state.curLine,e,this.errorHandlers_readCodePoint),n=a.code,t=a.pos;return this.state.pos=t,n},n.readString=function(e){var a=On(34===e?"double":"single",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_string),n=a.str,t=a.pos,r=a.curLine,i=a.lineStart;this.state.pos=t+1,this.state.lineStart=i,this.state.curLine=r,this.finishToken(130,n)},n.readTemplateContinuation=function(){this.match(4)||this.unexpected(null,4),this.state.pos--,this.readTemplateToken()},n.readTemplateToken=function(){var e=this.input[this.state.pos],a=On("template",this.input,this.state.pos+1,this.state.lineStart,this.state.curLine,this.errorHandlers_readStringContents_template),n=a.str,t=a.firstInvalidLoc,r=a.pos,i=a.curLine,o=a.lineStart;this.state.pos=r+1,this.state.lineStart=o,this.state.curLine=i,t&&(this.state.firstInvalidTemplateEscapePos=new _m(t.curLine,t.pos-t.lineStart,this.sourceToOffsetPos(t.pos))),96===this.input.codePointAt(r)?this.finishToken(20,t?null:e+n+"`"):(this.state.pos++,this.finishToken(21,t?null:e+n+"${"))},n.recordStrictModeErrors=function(e,a){var n=a.index;this.state.strict&&!this.state.strictErrors.has(n)?this.raise(e,a):this.state.strictErrors.set(n,[e,a])},n.readWord1=function(e){this.state.containsEsc=!1;var a="",n=this.state.pos,t=this.state.pos;for(void 0!==e&&(this.state.pos+=e<=65535?1:2);this.state.pos=0;o--){var s=i[o];if(s.pos===r)return i[o]=e(t,r,n);if(s.pos0}},{key:"hasYield",get:function(){return(this.currentFlags()&kv)>0}},{key:"hasReturn",get:function(){return(this.currentFlags()&Nv)>0}},{key:"hasIn",get:function(){return(this.currentFlags()&Bv)>0}},{key:"inFSharpPipelineDirectBody",get:function(){return 0===(this.currentFlags()&Ov)}}])}();function Fv(e,a){return(e?Iv:0)|(a?kv:0)}var Mv=function(e){function a(){return e.apply(this,arguments)||this}h(a,e);var n=a.prototype;return n.addExtra=function(e,a,n,t){if(void 0===t&&(t=!0),e){var r=e.extra;null==r&&(r={},e.extra=r),t?r[a]=n:Object.defineProperty(r,a,{enumerable:t,value:n})}},n.isContextual=function(e){return this.state.type===e&&!this.state.containsEsc},n.isUnparsedContextual=function(e,a){if(this.input.startsWith(a,e)){var n=this.input.charCodeAt(e+a.length);return!(vn(n)||55296==(64512&n))}return!1},n.isLookaheadContextual=function(e){var a=this.nextTokenStart();return this.isUnparsedContextual(a,e)},n.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},n.expectContextual=function(e,a){if(!this.eatContextual(e)){if(null!=a)throw this.raise(a,this.state.startLoc);this.unexpected(null,e)}},n.canInsertSemicolon=function(){return this.match(135)||this.match(4)||this.hasPrecedingLineBreak()},n.hasPrecedingLineBreak=function(){return av(this.input,this.offsetToSourcePos(this.state.lastTokEndLoc.index),this.state.start)},n.hasFollowingLineBreak=function(){return av(this.input,this.state.end,this.nextTokenStart())},n.isLineTerminator=function(){return this.eat(9)||this.canInsertSemicolon()},n.semicolon=function(e){void 0===e&&(e=!0),(e?this.isLineTerminator():this.eat(9))||this.raise(Hm.MissingSemicolon,this.state.lastTokEndLoc)},n.expect=function(e,a){this.eat(e)||this.unexpected(a,e)},n.tryParse=function(e,a){void 0===a&&(a=this.state.clone());var n={node:null};try{var t=e(function(e){throw void 0===e&&(e=null),n.node=e,n});if(this.state.errors.length>a.errors.length){var r=this.state;return this.state=a,this.state.tokensLength=r.tokensLength,{node:t,error:r.errors[a.errors.length],thrown:!1,aborted:!1,failState:r}}return{node:t,error:null,thrown:!1,aborted:!1,failState:null}}catch(e){var i=this.state;if(this.state=a,e instanceof SyntaxError)return{node:null,error:e,thrown:!0,aborted:!1,failState:i};if(e===n)return{node:n.node,error:null,thrown:!1,aborted:!0,failState:i};throw e}},n.checkExpressionErrors=function(e,a){if(!e)return!1;var n=e.shorthandAssignLoc,t=e.doubleProtoLoc,r=e.privateKeyLoc,i=e.optionalParametersLoc,o=e.voidPatternLoc;if(!a)return!!(n||t||i||r||o);null!=n&&this.raise(Hm.InvalidCoverInitializedName,n),null!=t&&this.raise(Hm.DuplicateProto,t),null!=r&&this.raise(Hm.UnexpectedPrivateField,r),null!=i&&this.unexpected(i),null!=o&&this.raise(Hm.InvalidCoverDiscardElement,o)},n.isLiteralPropertyName=function(){return _R(this.state.type)},n.isPrivateName=function(e){return"PrivateName"===e.type},n.getPrivateNameSV=function(e){return e.id.name},n.hasPropertyAsPrivateName=function(e){return("MemberExpression"===e.type||"OptionalMemberExpression"===e.type)&&this.isPrivateName(e.property)},n.isObjectProperty=function(e){return"ObjectProperty"===e.type},n.isObjectMethod=function(e){return"ObjectMethod"===e.type},n.initializeScopes=function(e){var a=this;void 0===e&&(e="module"===this.options.sourceType);var n=this.state.labels;this.state.labels=[];var t=this.exportedIdentifiers;this.exportedIdentifiers=new Set;var r=this.inModule;this.inModule=e;var i=this.scope,o=this.getScopeHandler();this.scope=new o(this,e);var s=this.prodParam;this.prodParam=new jv;var d=this.classScope;this.classScope=new wv(this);var u=this.expressionScope;return this.expressionScope=new Av(this),function(){a.state.labels=n,a.exportedIdentifiers=t,a.inModule=r,a.scope=i,a.prodParam=s,a.classScope=d,a.expressionScope=u}},n.enterInitialScopes=function(){var e=Dv;(this.inModule||this.optionFlags&Km)&&(e|=Iv),this.optionFlags&$m&&(e|=kv);var a=!this.inModule&&"commonjs"===this.options.sourceType;(a||this.optionFlags&zm)&&(e|=Nv),this.prodParam.enter(e);var n=a?ny:GR;this.optionFlags&Jm&&(n|=ZR),this.optionFlags&Ym&&(n|=JR|XR),this.scope.enter(n)},n.checkDestructuringPrivate=function(e){var a=e.privateKeyLoc;null!==a&&this.expectPlugin("destructuringPrivate",a)},l(a)}(Sv),Lv=l(function(){this.shorthandAssignLoc=null,this.doubleProtoLoc=null,this.privateKeyLoc=null,this.optionalParametersLoc=null,this.voidPatternLoc=null}),Uv=l(function(e,a,n,t){this.type="",this.start=n,this.end=0,void 0!==t&&(this.loc=new Dm(t)),e&Zm&&(this.range=[n,0]),void 0!==t&&a&&(this.loc.filename=a)}),qv=Uv.prototype,Wv=function(e){function a(){return e.apply(this,arguments)||this}h(a,e);var n=a.prototype;return n.createPosition=function(e){return e},n.startNode=function(){var e=this.state.startLoc;return this.setLoc(e),this.startNodeAt(e)},n.startNodeAt=function(e){var a=this.optionFlags,n=this.filename;return a&eR?new Uv(a,n,e.index,this.createPosition(e)):new Uv(a,n,e.index)},n.startNodeAtNode=function(e){var a=this.optionFlags,n=this.filename;return a&eR?new Uv(a,n,e.start,e.loc.start):new Uv(a,n,e.start)},n.finishNode=function(e,a){return this.finishNodeAt(e,a,this.state.lastTokEndLoc)},n.finishNodeAt=function(e,a,n){e.type=a,e.end=n.index;var t=this.optionFlags;return t&eR&&(e.loc.end=this.createPosition(n)),t&Zm&&(e.range[1]=n.index),t&iR&&this.processComment(e),e},n.finishNodeAtNode=function(e,a,n){e.type=a,e.end=n.end;var t=this.optionFlags;return t&eR&&(e.loc.end=n.loc.end),t&Zm&&(e.range[1]=e.end),t&iR&&this.processComment(e),e},n.resetStartLocation=function(e,a){e.start=a.index;var n=this.optionFlags;n&eR&&(e.loc.start=this.createPosition(a)),n&Zm&&(e.range[0]=a.index)},n.resetEndLocation=function(e,a){void 0===a&&(a=this.state.lastTokEndLoc),e.end=a.index;var n=this.optionFlags;n&eR&&(e.loc.end=this.createPosition(a)),n&Zm&&(e.range[1]=a.index)},n.resetStartLocationFromNode=function(e,a){e.start=a.start;var n=this.optionFlags;n&eR&&(e.loc.start=a.loc.start),n&Zm&&(e.range[0]=a.start)},n.resetEndLocationFromNode=function(e,a){e.end=a.end;var n=this.optionFlags;n&eR&&(e.loc.end=a.loc.end),n&Zm&&(e.range[1]=a.end)},n.castNodeTo=function(e,a){return e.type=a,e},n.cloneIdentifier=function(e){var a=e.type,n=e.start,t=e.end,r=e.loc,i=e.range,o=e.name,s=Object.create(qv);return s.type=a,s.start=n,s.end=t,s.loc=r,s.range=i,s.name=o,e.extra&&(s.extra=e.extra),s},n.cloneStringLiteral=function(e){var a=e.type,n=e.start,t=e.end,r=e.loc,i=e.range,o=e.extra,s=Object.create(qv);return s.type=a,s.start=n,s.end=t,s.loc=r,s.range=i,s.extra=o,s.value=e.value,s},l(a)}(Mv),Vv=function(e){return"ParenthesizedExpression"===e.type?Vv(e.expression):e},Gv=1,Hv=2,Kv=4,zv=function(e){function a(){return e.apply(this,arguments)||this}h(a,e);var n=a.prototype;return n.toAssignable=function(e,a){var n,t;void 0===a&&(a=!1);var r=void 0;switch(("ParenthesizedExpression"===e.type||null!=(n=e.extra)&&n.parenthesized)&&(r=Vv(e),a?"Identifier"===r.type?this.expressionScope.recordArrowParameterBindingError(Hm.InvalidParenthesizedAssignment,e):"CallExpression"===r.type||"MemberExpression"===r.type||this.isOptionalMemberExpression(r)||this.raise(Hm.InvalidParenthesizedAssignment,e):this.raise(Hm.InvalidParenthesizedAssignment,e)),e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":case"VoidPattern":break;case"ObjectExpression":this.castNodeTo(e,"ObjectPattern");for(var i=0,o=e.properties.length,s=o-1;i=25&&o<=29){var d=this.startNodeAt(t),u=this.state.value;if(d.operator=u,this.match(25)){this.toAssignable(s,!0),d.left=s;var c=t.index;null!=e.doubleProtoLoc&&e.doubleProtoLoc.index>=c&&(e.doubleProtoLoc=null),null!=e.shorthandAssignLoc&&e.shorthandAssignLoc.index>=c&&(e.shorthandAssignLoc=null),null!=e.privateKeyLoc&&e.privateKeyLoc.index>=c&&(this.checkDestructuringPrivate(e),e.privateKeyLoc=null),null!=e.voidPatternLoc&&e.voidPatternLoc.index>=c&&(e.voidPatternLoc=null)}else d.left=s;return this.next(),d.right=this.parseMaybeAssign(),this.checkLVal(s,this.finishNode(d,"AssignmentExpression"),void 0,void 0,void 0,void 0,"||="===u||"&&="===u||"??="===u),d}if(n&&this.checkExpressionErrors(e,!0),r){var l=this.state.type;if((this.hasPlugin("v8intrinsic")?DR(l):DR(l)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(Hm.YieldNotInGeneratorFunction,t),this.parseYield(t)}return s},n.parseMaybeConditional=function(e){var a=this.state.startLoc,n=this.parseExprOps(e);return this.shouldExitDescending(n)?n:this.parseConditional(n,a,e)},n.parseConditional=function(e,a,n){if(this.eat(13)){var t=this.startNodeAt(a);return t.test=e,t.consequent=this.parseMaybeAssignAllowIn(),this.expect(10),t.alternate=this.parseMaybeAssign(),this.finishNode(t,"ConditionalExpression")}return e},n.parseMaybeUnaryOrPrivate=function(e){return this.match(134)?this.parsePrivateName():this.parseMaybeUnary(e)},n.parseExprOps=function(e){var a=this.state.startLoc,n=this.parseMaybeUnaryOrPrivate(e);return this.shouldExitDescending(n)?n:(this.state.canStartArrow=!1,this.parseExprOp(n,a,-1))},n.parseExprOp=function(e,a,n){if(this.isPrivateName(e)){var t=this.getPrivateNameSV(e);(n>=jR(54)||!this.prodParam.hasIn||!this.match(54))&&this.raise(Hm.PrivateInExpectedIn,a,{identifierName:t}),this.classScope.usePrivateName(t,a)}var r=this.state.type;if(NR(r)&&(this.prodParam.hasIn||!this.match(54))){var i=jR(r);if(i>n){if(35===r&&(this.expectPlugin("pipelineOperator"),this.prodParam.inFSharpPipelineDirectBody))return e;var o=this.startNodeAt(a);o.left=e,o.operator=this.state.value;var s=37===r||38===r,d=36===r;d&&(i=jR(38)),this.next(),o.right=this.parseExprOpRightExpr(r,i);var u=this.finishNode(o,s||d?"LogicalExpression":"BinaryExpression"),c=this.state.type;if(d&&(37===c||38===c)||s&&36===c)throw this.raise(Hm.MixingCoalesceWithLogical,this.state.startLoc);return this.parseExprOp(u,a,n)}}return e},n.parseExprOpRightExpr=function(e,a){var n=this;if(35===e)switch(this.getPluginOption("pipelineOperator","proposal")){case"hack":return this.withTopicBindingContext(function(){return n.parseHackPipeBody()});case"fsharp":return this.parseFSharpPipelineBody(a)}return this.parseExprOpBaseRightExpr(e,a)},n.parseExprOpBaseRightExpr=function(e,a){var n=this.state.startLoc;return this.parseExprOp(this.parseMaybeUnaryOrPrivate(),n,53===e?a-1:a)},n.parseHackPipeBody=function(){var e,a=this.state.startLoc,n=this.parseMaybeAssign();return!Um.has(n.type)||null!=(e=n.extra)&&e.parenthesized||this.raise(Hm.PipeUnparenthesizedBody,a,{type:n.type}),this.topicReferenceWasUsedInCurrentContext()||this.raise(Hm.PipeTopicUnused,a),n},n.checkExponentialAfterUnary=function(e){this.match(53)&&this.raise(Hm.UnexpectedTokenUnaryExponentiation,e.argument)},n.parseMaybeUnary=function(e,a){var n=this.state.startLoc,t=this.isContextual(92);if(t&&this.recordAwaitIfAllowed()){this.next();var r=this.parseAwait(n);return a||this.checkExponentialAfterUnary(r),r}var i,o=this.match(30),s=this.startNode();if(i=this.state.type,SR[i]){s.operator=this.state.value,s.prefix=!0,this.state.canStartArrow=!1,this.match(68)&&this.expectPlugin("throwExpressions");var d=this.match(85);if(this.next(),s.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(e,!0),this.state.strict&&d){var u=s.argument;"Identifier"===u.type?this.raise(Hm.StrictDelete,s):this.hasPropertyAsPrivateName(u)&&this.raise(Hm.DeletePrivateField,s)}if(!o)return a||this.checkExponentialAfterUnary(s),this.finishNode(s,"UnaryExpression")}var c=this.parseUpdate(s,o,e);if(t){var l=this.state.type;if((this.hasPlugin("v8intrinsic")?DR(l):DR(l)&&!this.match(50))&&!this.isAmbiguousPrefixOrIdentifier())return this.raiseOverwrite(Hm.AwaitNotInAsyncContext,n),this.parseAwait(n)}return c},n.parseUpdate=function(e,a,n){if(a){var t=this.finishNode(e,"UpdateExpression");return this.checkLVal(t.argument,t),t}var r=this.state.startLoc,i=this.parseExprSubscripts(n);if(this.checkExpressionErrors(n,!1))return i;for(;BR(this.state.type)&&!this.canInsertSemicolon();){var o=this.startNodeAt(r);o.operator=this.state.value,o.prefix=!1,o.argument=i,this.next(),this.checkLVal(i,i=this.finishNode(o,"UpdateExpression"))}return i},n.parseExprSubscripts=function(e){var a=this.state.startLoc;this.setLoc(a);var n=this.parseExprAtom(e);return this.shouldExitDescending(n)?n:this.parseSubscripts(n,a)},n.parseSubscripts=function(e,a,n){var t={optionalChainMember:!1,maybeAsyncArrow:this.atPossibleAsyncArrow(e),stop:!1};do{e=this.parseSubscript(e,a,n,t),t.maybeAsyncArrow=!1}while(!t.stop);return e},n.parseSubscript=function(e,a,n,t){var r=this.state.type;if(!n&&11===r)return this.parseBind(e,a,t);if(FR(r))return this.parseTaggedTemplateExpression(e,a,t);var i=!1;if(14===r){if(n&&(this.raise(Hm.OptionalChainingNoNew,this.state.startLoc),40===this.lookaheadCharCode()))return this.stopParseSubscript(e,t);t.optionalChainMember=i=!0,this.next()}if(!n&&this.match(6))return this.parseCoverCallAndAsyncArrowHead(e,a,t,i);var o=this.eat(0);return o||i||this.eat(12)?this.parseMember(e,a,t,o,i):this.stopParseSubscript(e,t)},n.stopParseSubscript=function(e,a){return a.stop=!0,e},n.parseMember=function(e,a,n,t,r){var i=this.startNodeAt(a);return i.object=e,i.computed=t,t?(i.property=this.parseExpression(),this.expect(1)):this.match(134)?("Super"===e.type&&this.raise(Hm.SuperPrivateField,a),this.classScope.usePrivateName(this.state.value,this.state.startLoc),i.property=this.parsePrivateName()):i.property=this.parseIdentifier(!0),n.optionalChainMember?(i.optional=r,this.finishNode(i,"OptionalMemberExpression")):this.finishNode(i,"MemberExpression")},n.parseBind=function(e,a,n){var t=this.startNodeAt(a);t.object=e,this.next();var r=this.match(79),i=this.parseNoCallExpr();if("Super"===i.type||r&&"ImportExpression"===i.type||"Import"===i.type)throw this.raise(Hm.UnsupportedBindRHS,i);return t.callee=i,n.stop=!0,this.parseSubscripts(this.finishNode(t,"BindExpression"),a,!1)},n.parseCoverCallAndAsyncArrowHead=function(e,a,n,t){var r=null;this.next();var i=this.startNodeAt(a);i.callee=e;var o=n.maybeAsyncArrow,s=n.optionalChainMember;o&&(this.expressionScope.enter(new Pv(2)),r=new Lv),s&&(i.optional=t),i.arguments=t?this.parseCallExpressionArguments():this.parseCallExpressionArguments("Super"!==e.type,i,r);var d=this.finishCallExpression(i,s);return o&&this.shouldParseAsyncArrow()&&!t?(n.stop=!0,this.checkDestructuringPrivate(r),this.expressionScope.validateAsPattern(),this.expressionScope.exit(),d=this.parseAsyncArrowFromCallExpression(this.startNodeAt(a),d)):(o&&(this.checkExpressionErrors(r,!0),this.expressionScope.exit()),this.toReferencedList(i.arguments)),d},n.parseTaggedTemplateExpression=function(e,a,n){var t=this.startNodeAt(a);return t.tag=e,t.quasi=this.parseTemplate(!0),n.optionalChainMember&&this.raise(Hm.OptionalChainingNoTemplate,a),this.finishNode(t,"TaggedTemplateExpression")},n.atPossibleAsyncArrow=function(e){return"Identifier"===e.type&&"async"===e.name&&this.state.lastTokEndLoc.index===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.state.canStartArrow},n.finishCallExpression=function(e,a){if("Import"===e.callee.type)if(0===e.arguments.length||e.arguments.length>2)this.raise(Hm.ImportCallArity,e);else for(var n=0,t=e.arguments;n1?((a=this.startNodeAt(i)).expressions=o,this.finishNode(a,"SequenceExpression"),this.resetEndLocation(a,c)):a=o[0],this.wrapParenthesis(n,a))},n.wrapParenthesis=function(e,a){if(!(this.optionFlags&tR))return this.addExtra(a,"parenthesized",!0),this.addExtra(a,"parenStart",e.index),this.takeSurroundingComments(a,e.index,this.state.lastTokEndLoc.index),a;var n=this.startNodeAt(e);return n.expression=a,this.finishNode(n,"ParenthesizedExpression")},n.shouldParseArrow=function(e){return!this.canInsertSemicolon()},n.parseArrow=function(e){if(this.eat(15))return e},n.parseParenItem=function(e,a){return e},n.parseNewOrNewTarget=function(){var e=this.startNode();if(this.next(),this.match(12)){var a=this.createIdentifier(this.startNodeAtNode(e),"new");this.next();var n=this.parseMetaProperty(e,a,"target");return this.scope.allowNewTarget||this.raise(Hm.UnexpectedNewTarget,n),n}return this.parseNew(e)},n.parseNew=function(e){if(this.parseNewCallee(e),this.eat(6)){var a=this.parseExprList(7);this.toReferencedList(a),e.arguments=a}else e.arguments=[];return this.finishNode(e,"NewExpression")},n.parseNewCallee=function(e){var a=this.match(79),n=this.parseNoCallExpr();e.callee=n,a&&"ImportExpression"===n.type&&this.raise(Hm.ImportCallNotNewExpression,n,n),"Import"===n.type&&this.raise(Hm.ImportCallNotNewExpression,n),"Super"===n.type&&this.raise(Hm.SuperCallNotNewExpression,n)},n.parseTemplateElement=function(e){var a=this.state,n=a.start,t=a.startLoc,r=a.end,i=a.value,o=n+1,s=this.startNodeAt(km(t,1));null===i&&(e||this.raise(Hm.InvalidEscapeSequenceTemplate,km(this.state.firstInvalidTemplateEscapePos,1)));var d=this.match(20),u=d?-1:-2,c=r+u;s.value={raw:this.input.slice(o,c).replace(/\r\n?/g,"\n"),cooked:null===i?null:i.slice(1,u)},s.tail=d,this.next();var l=this.finishNode(s,"TemplateElement");return this.resetEndLocation(l,km(this.state.lastTokEndLoc,u)),l},n.parseTemplate=function(e){for(var a=this.startNode(),n=this.parseTemplateElement(e),t=[n],r=[];!n.tail;)r.push(this.parseTemplateSubstitution()),this.readTemplateContinuation(),t.push(n=this.parseTemplateElement(e));return a.expressions=r,a.quasis=t,this.finishNode(a,"TemplateLiteral")},n.parseTemplateSubstitution=function(){return this.parseExpression()},n.parseObjectLike=function(e,a,n){var t=!1,r=!0,i=this.startNode();for(i.properties=[],this.next();!this.match(e);){if(r)r=!1;else if(this.expect(8),this.match(e)){this.addTrailingCommaExtraToNode(i);break}var o=void 0;a?o=this.parseBindingProperty():(o=this.parsePropertyDefinition(n),t=this.checkProto(o,t,n)),i.properties.push(o)}this.next();var s=a?"ObjectPattern":"ObjectExpression";return this.finishNode(i,s)},n.addTrailingCommaExtraToNode=function(e){this.addExtra(e,"trailingComma",this.state.lastTokStartLoc.index),this.addExtra(e,"trailingCommaLoc",this.state.lastTokStartLoc,!1)},n.maybeAsyncOrAccessorProp=function(e){return!e.computed&&"Identifier"===e.key.type&&(this.isLiteralPropertyName()||this.match(0)||this.match(51))},n.parsePropertyDefinition=function(e){var a=[];if(this.match(22))for(this.hasPlugin("decorators")&&this.raise(Hm.UnsupportedPropertyDecorator,this.state.startLoc);this.match(22);)a.push(this.parseDecorator());var n,t=this.startNode(),r=!1,i=!1;if(this.match(17))return a.length&&this.unexpected(),this.parseSpread();a.length&&(t.decorators=a),t.method=!1,e&&(n=this.state.startLoc);var o=this.eat(51);this.parsePropertyNamePrefixOperator(t);var s=this.state.containsEsc;if(this.parsePropertyName(t,e),!o&&!s&&this.maybeAsyncOrAccessorProp(t)){var d=t.key,u=d.name;"async"!==u||this.hasPrecedingLineBreak()||(r=!0,this.resetPreviousNodeTrailingComments(d),o=this.eat(51),this.parsePropertyName(t)),"get"!==u&&"set"!==u||(i=!0,this.resetPreviousNodeTrailingComments(d),t.kind=u,this.match(51)&&(o=!0,this.raise(Hm.AccessorIsGenerator,this.state.curPosition(),{kind:u}),this.next()),this.parsePropertyName(t))}return this.parseObjPropValue(t,n,o,r,!1,i,e)},n.getGetterSetterExpectedParamCount=function(e){return"get"===e.kind?0:1},n.getObjectOrClassMethodParams=function(e){return e.params},n.checkGetterSetterParams=function(e){var a,n=this.getGetterSetterExpectedParamCount(e),t=this.getObjectOrClassMethodParams(e);t.length!==n&&this.raise("get"===e.kind?Hm.BadGetterArity:Hm.BadSetterArity,e),"set"===e.kind&&"RestElement"===(null==(a=t[t.length-1])?void 0:a.type)&&this.raise(Hm.BadSetterRestParameter,e)},n.parseObjectMethod=function(e,a,n,t,r){if(r){var i=this.parseMethod(e,a,!1,!1,!1,"ObjectMethod");return this.checkGetterSetterParams(i),i}if(n||a||this.match(6))return t&&this.unexpected(),e.kind="method",e.method=!0,this.parseMethod(e,a,n,!1,!1,"ObjectMethod")},n.parseObjectProperty=function(e,a,n,t){if(e.shorthand=!1,this.eat(10))return e.value=n?this.parseMaybeDefault(this.state.startLoc):this.parseMaybeAssignAllowInOrVoidPattern(4,t),this.finishObjectProperty(e);if(!e.computed&&"Identifier"===e.key.type){if(this.checkReservedWord(e.key.name,e.key.start,!0,!1),n)e.value=this.parseMaybeDefault(a,this.cloneIdentifier(e.key));else if(this.match(25)){var r=this.state.startLoc;null!=t?null===t.shorthandAssignLoc&&(t.shorthandAssignLoc=r):this.raise(Hm.InvalidCoverInitializedName,r),e.value=this.parseMaybeDefault(a,this.cloneIdentifier(e.key))}else e.value=this.cloneIdentifier(e.key);return e.shorthand=!0,this.finishObjectProperty(e)}},n.finishObjectProperty=function(e){return this.finishNode(e,"ObjectProperty")},n.parseObjPropValue=function(e,a,n,t,r,i,o){var s=this.parseObjectMethod(e,n,t,r,i)||this.parseObjectProperty(e,a,r,o);return s||this.unexpected(),s},n.parsePropertyName=function(e,a){if(this.eat(0))e.computed=!0,e.key=this.parseMaybeAssignAllowIn(),this.expect(1);else{var n,t=this.state,r=t.type,i=t.value;if(AR(r))n=this.parseIdentifier(!0);else switch(r){case 131:n=this.parseNumericLiteral(i);break;case 130:n=this.parseStringLiteral(i);break;case 132:n=this.parseBigIntLiteral(i);break;case 134:var o=this.state.startLoc;null!=a?null===a.privateKeyLoc&&(a.privateKeyLoc=o):this.raise(Hm.UnexpectedPrivateField,o),n=this.parsePrivateName();break;default:this.unexpected()}e.key=n,134!==r&&(e.computed=!1)}},n.initFunction=function(e,a){e.id=null,e.generator=!1,e.async=a},n.parseMethod=function(e,a,n,t,r,i,o){void 0===o&&(o=!1),this.initFunction(e,n),e.generator=a,this.scope.enter(ny|JR|(o?ty:0)|(r?XR:0)),this.prodParam.enter(Fv(n,e.generator)),this.parseFunctionParams(e,t);var s=this.parseFunctionBodyAndFinish(e,i,!0);return this.prodParam.exit(),this.scope.exit(),s},n.parseArrayLike=function(e,a){var n=this.startNode();return this.next(),n.elements=this.parseExprList(e,!0,a,n),this.finishNode(n,"ArrayExpression")},n.parseArrowExpression=function(e,a,n,t){this.scope.enter(ny|KR);var r=Fv(n,!1);return this.match(2)||(r|=this.prodParam.currentFlags()&(Bv|Ov)),this.prodParam.enter(r),this.initFunction(e,n),a&&this.setArrowFunctionParameters(e,a,t),this.parseFunctionBody(e,!0),this.prodParam.exit(),this.scope.exit(),this.finishNode(e,"ArrowFunctionExpression")},n.setArrowFunctionParameters=function(e,a,n){this.toAssignableList(a,n,!1),e.params=a},n.parseFunctionBodyAndFinish=function(e,a,n){return void 0===n&&(n=!1),this.parseFunctionBody(e,!1,n),this.finishNode(e,a)},n.parseFunctionBody=function(e,a,n){var t=this;void 0===n&&(n=!1);var r=a&&!this.match(2);if(this.expressionScope.enter(_v()),r)e.body=this.parseMaybeAssign(),this.checkParams(e,!1,a,!1);else{var i=this.state.strict,o=this.state.labels;this.state.labels=[],this.prodParam.enter(this.prodParam.currentFlags()|Nv),e.body=this.parseBlock(!0,!1,function(r){var o=!t.isSimpleParamList(e.params);r&&o&&t.raise(Hm.IllegalLanguageModeDirective,"method"!==e.kind&&"constructor"!==e.kind||!e.key?e:t.optionFlags&eR?e.key.loc.end:e.key);var s=!i&&t.state.strict;t.checkParams(e,!(t.state.strict||a||n||o),a,s),t.state.strict&&e.id&&t.checkIdentifier(e.id,Py,s)}),this.prodParam.exit(),this.state.labels=o}this.expressionScope.exit()},n.isSimpleParameter=function(e){return"Identifier"===e.type},n.isSimpleParamList=function(e){for(var a=0,n=e.length;a10)&&function(e){return qR.has(e)}(e))if(n&&Dn(e))this.raise(Hm.UnexpectedKeyword,a,{keyword:e});else if((this.state.strict?t?_n:Pn:Cn)(e,this.inModule))this.raise(Hm.UnexpectedReservedWord,a,{reservedWord:e});else if("yield"===e){if(this.prodParam.hasYield)return void this.raise(Hm.YieldBindingIdentifier,a)}else if("await"===e){if(this.prodParam.hasAwait)return void this.raise(Hm.AwaitBindingIdentifier,a);if(this.scope.inStaticBlock)return void this.raise(Hm.AwaitBindingIdentifierInStaticBlock,a);this.expressionScope.recordAsyncArrowParametersError(a)}else if("arguments"===e&&this.scope.inClassAndNotInNonArrowFunction)return void this.raise(Hm.ArgumentsInClass,a)},n.recordAwaitIfAllowed=function(){var e=this.prodParam.hasAwait;return e&&!this.scope.inFunction&&(this.state.hasTopLevelAwait=!0),e},n.parseAwait=function(e,a){var n=e.index;this.setLoc(e);var t=this.startNodeAt(e);return this.expressionScope.recordParameterInitializerError(Hm.AwaitExpressionFormalParameter,n),this.eat(51)&&this.raise(Hm.ObsoleteAwaitStar,e),this.scope.inFunction||this.optionFlags&Km||(this.isAmbiguousPrefixOrIdentifier()?this.ambiguousScriptDifferentAst=!0:this.sawUnambiguousESM=!0),a||(t.argument=this.parseMaybeUnary(null,!0)),this.finishNode(t,"AwaitExpression")},n.isAmbiguousPrefixOrIdentifier=function(){if(this.hasPrecedingLineBreak())return!0;var e=this.state.type;return 49===e||6===e||0===e||FR(e)||98===e&&!this.state.containsEsc||133===e||52===e||this.hasPlugin("v8intrinsic")&&50===e},n.parseYield=function(e){this.setLoc(e);var a=this.startNodeAt(e);this.expressionScope.recordParameterInitializerError(Hm.YieldInParameter,e.index);var n=!1,t=null;if(!this.hasPrecedingLineBreak())switch(n=this.eat(51),this.state.type){case 9:case 135:case 4:case 7:case 1:case 5:case 10:case 8:if(!n)break;default:t=this.parseMaybeAssign()}return a.delegate=n,a.argument=t,this.finishNode(a,"YieldExpression")},n.parseImportCall=function(e){var a;this.next();var n=this.parseCallExpressionArguments();if(0===n.length||n.length>2)this.raise(Hm.ImportCallArity,e,e);else for(var t=0;t0)for(var t=0,r=Array.from(this.scope.undefinedExports);t=86&&o<=88?mv:this.match(67)?Rv:null,d=this.state.labels.length-1;d>=0;d--){var u=this.state.labels[d];if(u.statementStart!==e.start)break;u.statementStart=this.sourceToOffsetPos(this.state.start),u.kind=s}return this.state.labels.push({name:a,kind:s,statementStart:this.sourceToOffsetPos(this.state.start)}),e.body=t&ob?this.parseStatementOrSloppyAnnexBFunctionDeclaration(!0):this.parseStatement(),this.state.labels.pop(),e.label=n,this.finishNode(e,"LabeledStatement")},n.parseExpressionStatement=function(e,a,n){return e.expression=a,this.semicolon(),this.finishNode(e,"ExpressionStatement")},n.parseBlock=function(e,a,n){void 0===e&&(e=!1),void 0===a&&(a=!0);var t=this.startNode();return e&&this.state.strictErrors.clear(),this.expect(2),a&&this.scope.enter(VR),this.parseBlockBody(t,e,!1,4,n),a&&this.scope.exit(),this.finishNode(t,"BlockStatement")},n.isValidDirective=function(e){return"ExpressionStatement"===e.type&&"StringLiteral"===e.expression.type&&!e.expression.extra.parenthesized},n.parseBlockBody=function(e,a,n,t,r){var i=e.body=[],o=e.directives=[];this.parseBlockOrModuleBlockBody(i,a?o:void 0,n,t,r)},n.parseBlockOrModuleBlockBody=function(e,a,n,t,r){for(var i=this.state.strict,o=!1,s=!1;!this.match(t);){var d=n?this.parseModuleItem():this.parseStatementListItem();if(a&&!s){if(this.isValidDirective(d)){var u=this.stmtToDirective(d);a.push(u),o||"use strict"!==u.value.value||(o=!0,this.setStrict(!0));continue}s=!0,this.state.strictErrors.clear()}e.push(d)}null==r||r.call(this,o),i||this.setStrict(!1),this.next()},n.parseFor=function(e,a){return e.init=a,this.semicolon(!1),e.test=this.match(9)?null:this.parseExpression(),this.semicolon(!1),e.update=this.match(7)?null:this.parseExpression(),this.expect(7),e.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,"ForStatement")},n.parseForIn=function(e,a,n){var t=this.match(54);return this.next(),t?null!==n&&this.unexpected(n):e.await=null!==n,"VariableDeclaration"!==a.type||null==a.declarations[0].init||t&&this.options.annexB&&!this.state.strict&&"var"===a.kind&&"Identifier"===a.declarations[0].id.type||this.raise(Hm.ForInOfLoopInitializer,a,{type:t?"ForInStatement":"ForOfStatement"}),"AssignmentPattern"===a.type&&this.raise(Hm.InvalidLhs,a,{ancestor:{type:"ForStatement"}}),e.left=a,e.right=t?this.parseExpression():this.parseMaybeAssignAllowIn(),this.expect(7),e.body=this.parseStatement(),this.scope.exit(),this.state.labels.pop(),this.finishNode(e,t?"ForInStatement":"ForOfStatement")},n.parseVar=function(e,a,n,t){void 0===t&&(t=!1);var r=e.declarations=[];for(e.kind=n;;){var i=this.startNode();if(this.parseVarId(i,n),i.init=this.eat(25)?a?this.parseMaybeAssignDisallowIn():this.parseMaybeAssignAllowIn():null,null!==i.init||t||("Identifier"===i.id.type||a&&(this.match(54)||this.isContextual(98))?"const"!==n&&"using"!==n&&"await using"!==n||this.match(54)||this.isContextual(98)||this.raise(Hm.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:n}):this.raise(Hm.DeclarationMissingInitializer,this.state.lastTokEndLoc,{kind:"destructuring"})),r.push(this.finishNode(i,"VariableDeclarator")),!this.eat(8))break}return e},n.parseVarId=function(e,a){var n=this.parseBindingAtom();"using"===a||"await using"===a?"ArrayPattern"!==n.type&&"ObjectPattern"!==n.type||this.raise(Hm.UsingDeclarationHasBindingPattern,n):"VoidPattern"===n.type&&this.raise(Hm.UnexpectedVoidPattern,n),this.checkLVal(n,{type:"VariableDeclarator"},"var"===a?by:yy),e.id=n},n.parseAsyncFunctionExpression=function(e){return this.parseFunction(e,ab)},n.parseFunction=function(e,a){void 0===a&&(a=$v);var n=a&Zv,t=!!(a&Qv),r=t&&!(a&eb),i=!!(a&ab);return this.initFunction(e,i),this.match(51)&&(n&&this.raise(Hm.GeneratorInSingleStatementContext,this.state.startLoc),this.next(),e.generator=!0),t&&(e.id=this.parseFunctionId(r)),this.scope.enter(ny),this.prodParam.enter(Fv(i,e.generator)),t||(e.id=this.parseFunctionId()),this.parseFunctionParams(e,!1),this.parseFunctionBodyAndFinish(e,t?"FunctionDeclaration":"FunctionExpression"),this.prodParam.exit(),this.scope.exit(),t&&!n&&this.registerFunctionStatementId(e),e},n.parseFunctionId=function(e){return e||PR(this.state.type)?this.parseIdentifier():null},n.parseFunctionParams=function(e,a){this.expect(6),this.expressionScope.enter(new Cv(3)),e.params=this.parseBindingList(7,41,Hv|(a?Kv:0)),this.expressionScope.exit()},n.registerFunctionStatementId=function(e){e.id&&this.scope.declareName(e.id.name,!this.options.annexB||this.state.strict||e.generator||e.async?this.scope.treatFunctionsAsVar?by:yy:xy,e.id.start)},n.parseClass=function(e,a,n){this.next();var t=this.state.strict;return this.state.strict=!0,this.parseClassId(e,a,n),this.parseClassSuper(e),e.body=this.parseClassBody(!!e.superClass,t),this.finishNode(e,a?"ClassDeclaration":"ClassExpression")},n.isClassProperty=function(){return this.match(25)||this.match(9)||this.match(4)},n.isClassMethod=function(){return this.match(6)},n.nameIsConstructor=function(e){return"Identifier"===e.type&&"constructor"===e.name||"StringLiteral"===e.type&&"constructor"===e.value},n.isNonstaticConstructor=function(e){return!e.computed&&!e.static&&this.nameIsConstructor(e.key)},n.parseClassBody=function(e,a){this.classScope.enter();var n={hadConstructor:!1,hadSuperClass:e},t=[],r=this.startNode();for(r.body=[],this.expect(2);!this.match(4);)if(this.eat(9)){if(t.length>0)throw this.raise(Hm.DecoratorSemicolon,this.state.lastTokEndLoc)}else if(this.match(22))t.push(this.parseDecorator());else{var i=this.startNode();t.length&&(i.decorators=t,this.resetStartLocationFromNode(i,t[0]),t=[]),this.parseClassMember(r,i,n)}if(this.state.strict=a,this.next(),t.length)throw this.raise(Hm.TrailingDecorator,this.state.startLoc);return this.classScope.exit(),this.finishNode(r,"ClassBody")},n.parseClassMemberFromModifier=function(e,a){var n=this.parseIdentifier(!0);if(this.isClassMethod()){var t=a;return t.kind="method",t.computed=!1,t.key=n,t.static=!1,this.pushClassMethod(e,t,!1,!1,!1,!1),!0}if(this.isClassProperty()){var r=a;return r.computed=!1,r.key=n,r.static=!1,e.body.push(this.parseClassProperty(r)),!0}return this.resetPreviousNodeTrailingComments(n),!1},n.parseClassMember=function(e,a,n){var t=this.isContextual(102);if(t){if(this.parseClassMemberFromModifier(e,a))return;if(this.eat(2))return void this.parseClassStaticBlock(e,a)}this.parseClassMemberWithIsStatic(e,a,n,t)},n.parseClassMemberWithIsStatic=function(e,a,n,t){var r=a,i=a,o=a,s=a,d=a,u=r,c=r;if(a.static=t,this.parsePropertyNamePrefixOperator(a),this.eat(51)){u.kind="method";var l=this.match(134);return this.parseClassElementName(u),this.parsePostMemberNameModifiers(u),l?void this.pushClassPrivateMethod(e,i,!0,!1):(this.isNonstaticConstructor(r)&&this.raise(Hm.ConstructorIsGenerator,r.key),void this.pushClassMethod(e,r,!0,!1,!1,!1))}var p=!this.state.containsEsc&&PR(this.state.type),g=this.parseClassElementName(a),f=p?g.name:null,h=this.isPrivateName(g),m=this.state.startLoc;if(this.parsePostMemberNameModifiers(c),this.isClassMethod()){if(u.kind="method",h)return void this.pushClassPrivateMethod(e,i,!1,!1);var R=this.isNonstaticConstructor(r),y=!1;R&&(r.kind="constructor",r.decorators&&r.decorators.length>0&&this.raise(Hm.DecoratorConstructor,a),n.hadConstructor&&!this.hasPlugin("typescript")&&this.raise(Hm.DuplicateConstructor,g),R&&this.hasPlugin("typescript")&&a.override&&this.raise(Hm.OverrideOnConstructor,g),n.hadConstructor=!0,y=n.hadSuperClass),this.pushClassMethod(e,r,!1,!1,R,y)}else if(this.isClassProperty())h?this.pushClassPrivateProperty(e,s):this.pushClassProperty(e,o);else if("async"!==f||this.isLineTerminator())if("get"!==f&&"set"!==f||this.match(51)&&this.isLineTerminator())if("accessor"!==f||this.isLineTerminator())this.isLineTerminator()?h?this.pushClassPrivateProperty(e,s):this.pushClassProperty(e,o):this.unexpected();else{this.expectPlugin("decoratorAutoAccessors"),this.resetPreviousNodeTrailingComments(g);var v=this.match(134);this.parseClassElementName(o),this.pushClassAccessorProperty(e,d,v)}else{this.resetPreviousNodeTrailingComments(g),u.kind=f;var b=this.match(134);this.parseClassElementName(r),b?this.pushClassPrivateMethod(e,i,!1,!1):(this.isNonstaticConstructor(r)&&this.raise(Hm.ConstructorIsAccessor,r.key),this.pushClassMethod(e,r,!1,!1,!1,!1)),this.checkGetterSetterParams(r)}else{this.resetPreviousNodeTrailingComments(g);var x=this.eat(51);c.optional&&this.unexpected(m),u.kind="method";var E=this.match(134);this.parseClassElementName(u),this.parsePostMemberNameModifiers(c),E?this.pushClassPrivateMethod(e,i,x,!0):(this.isNonstaticConstructor(r)&&this.raise(Hm.ConstructorIsAsync,r.key),this.pushClassMethod(e,r,x,!0,!1,!1))}},n.parseClassElementName=function(e){var a=this.state,n=a.type,t=a.value;if(128!==n&&130!==n||!e.static||"prototype"!==t||this.raise(Hm.StaticPrototype,this.state.startLoc),134===n){"constructor"===t&&this.raise(Hm.ConstructorClassPrivateField,this.state.startLoc);var r=this.parsePrivateName();return e.key=r,r}return this.parsePropertyName(e),e.key},n.parseClassStaticBlock=function(e,a){var n;this.scope.enter(ty|$R|JR);var t=this.state.labels;this.state.labels=[],this.prodParam.enter(Dv);var r=a.body=[];this.parseBlockOrModuleBlockBody(r,void 0,!1,4),this.prodParam.exit(),this.scope.exit(),this.state.labels=t,e.body.push(this.finishNode(a,"StaticBlock")),null!=(n=a.decorators)&&n.length&&this.raise(Hm.DecoratorStaticBlock,a)},n.pushClassProperty=function(e,a){!a.computed&&this.nameIsConstructor(a.key)&&this.raise(Hm.ConstructorClassField,a.key),e.body.push(this.parseClassProperty(a))},n.pushClassPrivateProperty=function(e,a){var n=this.parseClassPrivateProperty(a);e.body.push(n),this.classScope.declarePrivateName(this.getPrivateNameSV(n.key),Ny,n.key.start)},n.pushClassAccessorProperty=function(e,a,n){n||a.computed||!this.nameIsConstructor(a.key)||this.raise(Hm.ConstructorClassField,a.key);var t=this.parseClassAccessorProperty(a);e.body.push(t),n&&this.classScope.declarePrivateName(this.getPrivateNameSV(t.key),Ny,t.key.start)},n.pushClassMethod=function(e,a,n,t,r,i){e.body.push(this.parseMethod(a,n,t,r,i,"ClassMethod",!0))},n.pushClassPrivateMethod=function(e,a,n,t){var r=this.parseMethod(a,n,t,!1,!1,"ClassPrivateMethod",!0);e.body.push(r);var i="get"===r.kind?r.static?jy:My:"set"===r.kind?r.static?Fy:Ly:Ny;this.declareClassPrivateMethodInScope(r,i)},n.declareClassPrivateMethodInScope=function(e,a){this.classScope.declarePrivateName(this.getPrivateNameSV(e.key),a,e.key.start)},n.parsePostMemberNameModifiers=function(e){},n.parseClassPrivateProperty=function(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassPrivateProperty")},n.parseClassProperty=function(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassProperty")},n.parseClassAccessorProperty=function(e){return this.parseInitializer(e),this.semicolon(),this.finishNode(e,"ClassAccessorProperty")},n.parseInitializer=function(e){this.scope.enter(ty|JR),this.expressionScope.enter(_v()),this.prodParam.enter(Dv),e.value=this.eat(25)?this.parseMaybeAssignAllowIn():null,this.expressionScope.exit(),this.prodParam.exit(),this.scope.exit()},n.parseClassId=function(e,a,n,t){if(void 0===t&&(t=Ry),PR(this.state.type))e.id=this.parseIdentifier(),a&&this.declareNameFromIdentifier(e.id,t);else{if(!n&&a)throw this.raise(Hm.MissingClassName,this.state.startLoc);e.id=null}},n.parseClassSuper=function(e){this.eat(77)?(this.state.canStartArrow=!1,e.superClass=this.parseExprSubscripts()):e.superClass=null},n.parseExport=function(e,a){var n=this.parseMaybeImportPhase(e,!0),t=this.maybeParseExportDefaultSpecifier(e,n),r=!t||this.eat(8),i=r&&this.eatExportStar(e),o=i&&this.maybeParseExportNamespaceSpecifier(e),s=r&&(!o||this.eat(8)),d=t||i;if(i&&!o){if(t&&this.unexpected(),a)throw this.raise(Hm.UnsupportedDecoratorExport,e);return this.parseExportFrom(e,!0),this.sawUnambiguousESM=!0,this.finishNode(e,"ExportAllDeclaration")}var u,c=this.maybeParseExportNamedSpecifiers(e);if(t&&r&&!i&&!c&&this.unexpected(null,2),o&&s&&this.unexpected(null,94),d||c){if(u=!1,a)throw this.raise(Hm.UnsupportedDecoratorExport,e);this.parseExportFrom(e,d)}else u=this.maybeParseExportDeclaration(e);if(d||c||u){var l,p=e;if(this.checkExport(p,!0,!1,!!p.source),"ClassDeclaration"===(null==(l=p.declaration)?void 0:l.type))this.maybeTakeDecorators(a,p.declaration,p);else if(a)throw this.raise(Hm.UnsupportedDecoratorExport,e);return this.sawUnambiguousESM=!0,this.finishNode(p,"ExportNamedDeclaration")}if(this.eat(61)){var g=e,f=this.parseExportDefaultExpression();if(g.declaration=f,"ClassDeclaration"===f.type)this.maybeTakeDecorators(a,f,g);else if(a)throw this.raise(Hm.UnsupportedDecoratorExport,e);return this.checkExport(g,!0,!0),this.sawUnambiguousESM=!0,this.finishNode(g,"ExportDefaultDeclaration")}throw this.unexpected(null,2)},n.eatExportStar=function(e){return this.eat(51)},n.maybeParseExportDefaultSpecifier=function(e,a){if(a||this.isExportDefaultSpecifier()){this.expectPlugin("exportDefaultFrom",null==a?void 0:a.start);var n=a||this.parseIdentifier(!0),t=this.startNodeAtNode(n);return t.exported=n,e.specifiers=[this.finishNode(t,"ExportDefaultSpecifier")],!0}return!1},n.maybeParseExportNamespaceSpecifier=function(e){if(this.isContextual(89)){var a;null!=(a=e).specifiers||(a.specifiers=[]);var n=this.startNodeAt(this.state.lastTokStartLoc);return this.next(),n.exported=this.parseModuleExportName(),e.specifiers.push(this.finishNode(n,"ExportNamespaceSpecifier")),!0}return!1},n.maybeParseExportNamedSpecifiers=function(e){if(this.match(2)){var a,n=e;n.specifiers||(n.specifiers=[]);var t="type"===n.exportKind;return(a=n.specifiers).push.apply(a,this.parseExportSpecifiers(t)),n.source=null,n.attributes=[],n.declaration=null,!0}return!1},n.maybeParseExportDeclaration=function(e){return!!this.shouldParseExportDeclaration()&&(e.specifiers=[],e.source=null,e.attributes=[],e.declaration=this.parseExportDeclaration(e),!0)},n.isAsyncFunction=function(){if(!this.isContextual(91))return!1;var e=this.nextTokenInLineStart();return this.isUnparsedContextual(e,"function")},n.parseExportDefaultExpression=function(){var e=this.startNode();if(this.match(64))return this.next(),this.parseFunction(e,Qv|eb);if(this.isAsyncFunction())return this.next(),this.next(),this.parseFunction(e,Qv|eb|ab);if(this.match(76))return this.parseClass(e,!0,!0);if(this.match(22))return this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1),this.startNode()),!0,!0);if(this.match(71)||this.match(70)||this.isLet()||this.isUsing()||this.isAwaitUsing())throw this.raise(Hm.UnsupportedDefaultExport,this.state.startLoc);var a=this.parseMaybeAssignAllowIn();return this.semicolon(),a},n.parseExportDeclaration=function(e){return this.match(76)?this.parseClass(this.startNode(),!0,!1):this.parseStatementListItem()},n.isExportDefaultSpecifier=function(){var e=this.state.type;if(PR(e)){if(91===e&&!this.state.containsEsc||96===e)return!1;if((126===e||125===e)&&!this.state.containsEsc){var a=this.nextTokenStart(),n=this.input.charCodeAt(a);if(123===n||this.chStartsBindingIdentifier(n,a)&&!this.input.startsWith("from",a))return this.expectOnePlugin(["flow","typescript"]),!1}}else if(!this.match(61))return!1;var t=this.nextTokenStart(),r=this.isUnparsedContextual(t,"from");if(44===this.input.charCodeAt(t)||PR(this.state.type)&&r)return!0;if(this.match(61)&&r){var i=this.input.charCodeAt(this.nextTokenStartSince(t+4));return 34===i||39===i}return!1},n.parseExportFrom=function(e,a){this.eatContextual(94)?(e.source=this.parseImportSource(),this.checkExport(e),this.maybeParseImportAttributes(e)):a&&this.unexpected(),this.semicolon()},n.shouldParseExportDeclaration=function(){var e=this.state.type;return!(22!==e||(this.expectOnePlugin(["decorators","decorators-legacy"]),!this.hasPlugin("decorators")))||(this.isUsing()||this.isAwaitUsing()?(this.raise(Hm.UsingDeclarationExport,this.state.startLoc),!0):70===e||71===e||64===e||76===e||this.isLet()||this.isAsyncFunction())},n.checkExport=function(e,a,n,t){var r;if(a)if(n){if(this.checkDuplicateExports(e,"default"),this.hasPlugin("exportDefaultFrom")){var i,o=e.declaration;"Identifier"!==o.type||"from"!==o.name||o.end-o.start!==4||null!=(i=o.extra)&&i.parenthesized||this.raise(Hm.ExportDefaultFromAsIdentifier,o)}}else if(null!=(r=e.specifiers)&&r.length)for(var s=0,d=e.specifiers;s() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:function(e){var a=e.typeParameterName;return"Single type parameter "+a+" should have a trailing comma. Example usage: <"+a+",>."},StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterInitializer:"A parameter initializer is only allowed in a function or constructor implementation.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnexpectedTypeDeclaration:function(e){return"'"+e+"' declarations can only be declared inside a block."},UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:function(e){return"Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got "+e.type+"."},UsingDeclarationInAmbientContext:function(e){return"'"+e+"' declarations are not allowed in ambient contexts."}});function hb(e){return"private"===e||"public"===e||"protected"===e}function mb(e){return"in"===e||"out"===e}function Rb(e){var a;if(null!=(a=e.extra)&&a.parenthesized)return!1;switch(e.type){case"Identifier":return!0;case"MemberExpression":return!e.computed&&Rb(e.object);case"TSInstantiationExpression":return Rb(e.expression);default:return!1}}var yb,vb=0,bb=1,xb=2;function Eb(e){if("MemberExpression"!==e.type)return!1;var a=e.computed,n=e.property;return(!a||"StringLiteral"===n.type||!("TemplateLiteral"!==n.type||n.expressions.length>0))&&wb(e.object)}function Sb(e,a){var n,t=e.type;if(null!=(n=e.extra)&&n.parenthesized)return!1;if(a){if("Literal"===t){var r=e.value;if("string"==typeof r||"boolean"==typeof r)return!0}}else if("StringLiteral"===t||"BooleanLiteral"===t)return!0;return!(!Tb(e,a)&&!function(e,a){if("UnaryExpression"===e.type){var n=e.operator,t=e.argument;if("-"===n&&Tb(t,a))return!0}return!1}(e,a))||("TemplateLiteral"===t&&0===e.expressions.length||!!Eb(e))}function Tb(e,a){return a?"Literal"===e.type&&("number"==typeof e.value||"bigint"in e):"NumericLiteral"===e.type||"BigIntLiteral"===e.type}function wb(e){return"Identifier"===e.type||"MemberExpression"===e.type&&!e.computed&&wb(e.object)}var Cb=Gm(yb||(yb=S(["placeholders"])))({ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."}),Pb=["fsharp","hack"],Ab=["^^","@@","^","%","#"];var _b={estree:function(e){return function(e){function a(){return e.apply(this,arguments)||this}h(a,e);var n=a.prototype;return n.createPosition=function(e){return new _m(e.line,e.column)},n.parse=function(){var a=e.prototype.parse.call(this);return this.optionFlags&aR&&(a.tokens=a.tokens.map(sR)),sR(a)},n.parseRegExpLiteral=function(e){var a=e.pattern,n=e.flags,t=null;try{t=new RegExp(a,n)}catch(e){}var r=this.estreeParseLiteral(t);return r.regex={pattern:a,flags:n},r},n.parseBigIntLiteral=function(e){var a;try{a=BigInt(e)}catch(e){a=null}var n=this.estreeParseLiteral(a);return n.bigint=String(n.value||e),n},n.estreeParseLiteral=function(e){return this.parseLiteral(e,"Literal")},n.parseStringLiteral=function(e){return this.estreeParseLiteral(e)},n.parseNumericLiteral=function(e){return this.estreeParseLiteral(e)},n.parseNullLiteral=function(){return this.estreeParseLiteral(null)},n.parseBooleanLiteral=function(e){return this.estreeParseLiteral(e)},n.estreeParseChainExpression=function(e,a){var n=this.startNodeAtNode(e);return n.expression=e,this.finishNodeAtNode(n,"ChainExpression",a)},n.directiveToStmt=function(e){var a=e.value;delete e.value,this.castNodeTo(a,"Literal"),a.raw=a.extra.raw,a.value=a.extra.expressionValue;var n=this.castNodeTo(e,"ExpressionStatement");return n.expression=a,n.directive=a.extra.rawValue,delete a.extra,n},n.fillOptionalPropertiesForTSESLint=function(e){},n.cloneEstreeStringLiteral=function(e){var a=e.start,n=e.end,t=e.loc,r=e.range,i=e.raw,o=e.value,s=Object.create(e.constructor.prototype);return s.type="Literal",s.start=a,s.end=n,s.loc=t,s.range=r,s.raw=i,s.value=o,s},n.initFunction=function(a,n){e.prototype.initFunction.call(this,a,n),a.expression=!1},n.checkDeclaration=function(a){null!=a&&this.isObjectProperty(a)?this.checkDeclaration(a.value):e.prototype.checkDeclaration.call(this,a)},n.getObjectOrClassMethodParams=function(e){return e.value.params},n.isValidDirective=function(e){var a;return"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&!(null!=(a=e.expression.extra)&&a.parenthesized)},n.parseBlockBody=function(a,n,t,r,i){var o=this;e.prototype.parseBlockBody.call(this,a,n,t,r,i);var s=a.directives.map(function(e){return o.directiveToStmt(e)});a.body=s.concat(a.body),delete a.directives},n.parsePrivateName=function(){var a=e.prototype.parsePrivateName.call(this);return this.convertPrivateNameToPrivateIdentifier(a)},n.convertPrivateNameToPrivateIdentifier=function(a){var n=e.prototype.getPrivateNameSV.call(this,a);return delete a.id,a.name=n,this.castNodeTo(a,"PrivateIdentifier")},n.isPrivateName=function(e){return"PrivateIdentifier"===e.type},n.getPrivateNameSV=function(e){return e.name},n.parseLiteral=function(a,n){var t=e.prototype.parseLiteral.call(this,a,n);return t.raw=t.extra.raw,delete t.extra,t},n.parseFunctionBody=function(a,n,t){void 0===t&&(t=!1),e.prototype.parseFunctionBody.call(this,a,n,t),a.expression="BlockStatement"!==a.body.type},n.parseMethod=function(a,n,t,r,i,o,s){void 0===s&&(s=!1);var d=this.startNode();d.kind=a.kind,delete(d=e.prototype.parseMethod.call(this,d,n,t,r,i,o,s)).kind;var u=a.typeParameters;u&&(delete a.typeParameters,d.typeParameters=u,this.resetStartLocationFromNode(d,u));var c=this.castNodeTo(d,this.hasPlugin("typescript")&&!d.body?"TSEmptyBodyFunctionExpression":"FunctionExpression");return a.value=c,"ClassPrivateMethod"===o&&(a.computed=!1),this.hasPlugin("typescript")&&a.abstract?(delete a.abstract,this.finishNode(a,"TSAbstractMethodDefinition")):"ObjectMethod"===o?("method"===a.kind&&(a.kind="init"),a.shorthand=!1,this.finishNode(a,"Property")):this.finishNode(a,"MethodDefinition")},n.nameIsConstructor=function(a){return"Literal"===a.type?"constructor"===a.value:e.prototype.nameIsConstructor.call(this,a)},n.parseClassProperty=function(){for(var a,n=arguments.length,t=new Array(n),r=0;r0&&o.start===r.start&&this.resetStartLocation(r,t)}return r},n.stopParseSubscript=function(a,n){var t=e.prototype.stopParseSubscript.call(this,a,n);return n.optionalChainMember?this.estreeParseChainExpression(t,a):t},n.parseMember=function(a,n,t,r,i){var o=e.prototype.parseMember.call(this,a,n,t,r,i);return"OptionalMemberExpression"===o.type?this.castNodeTo(o,"MemberExpression"):o.optional=!1,o},n.isOptionalMemberExpression=function(a){return"ChainExpression"===a.type?"MemberExpression"===a.expression.type:e.prototype.isOptionalMemberExpression.call(this,a)},n.hasPropertyAsPrivateName=function(a){return"ChainExpression"===a.type&&(a=a.expression),e.prototype.hasPropertyAsPrivateName.call(this,a)},n.isObjectProperty=function(e){return"Property"===e.type&&"init"===e.kind&&!e.method},n.isObjectMethod=function(e){return"Property"===e.type&&(e.method||"get"===e.kind||"set"===e.kind)},n.castNodeTo=function(a,n){var t=e.prototype.castNodeTo.call(this,a,n);return this.fillOptionalPropertiesForTSESLint(t),t},n.cloneIdentifier=function(a){var n=e.prototype.cloneIdentifier.call(this,a);return this.fillOptionalPropertiesForTSESLint(n),n},n.cloneStringLiteral=function(a){return"Literal"===a.type?this.cloneEstreeStringLiteral(a):e.prototype.cloneStringLiteral.call(this,a)},n.finishNodeAt=function(a,n,t){return sR(e.prototype.finishNodeAt.call(this,a,n,t))},n.finishNodeAtNode=function(a,n,t){return sR(e.prototype.finishNodeAtNode.call(this,a,n,t))},n.finishNode=function(a,n){var t=e.prototype.finishNode.call(this,a,n);return this.fillOptionalPropertiesForTSESLint(t),t},n.resetStartLocation=function(a,n){e.prototype.resetStartLocation.call(this,a,n),sR(a)},n.resetEndLocation=function(a,n){void 0===n&&(n=this.state.lastTokEndLoc),e.prototype.resetEndLocation.call(this,a,n),sR(a)},l(a)}(e)},jsx:function(e){return function(e){function a(){return e.apply(this,arguments)||this}h(a,e);var n=a.prototype;return n.jsxReadToken=function(){for(var a="",n=this.state.pos;;){if(this.state.pos>=this.length)throw this.raise(ov.UnterminatedJsxContent,this.state.startLoc);var t=this.input.charCodeAt(this.state.pos);switch(t){case 60:case 123:return this.state.pos===this.state.start?void(60===t&&this.state.canStartJSXElement?(++this.state.pos,this.finishToken(138)):e.prototype.getTokenFromCode.call(this,t)):(a+=this.input.slice(n,this.state.pos),void this.finishToken(137,a));case 38:a+=this.input.slice(n,this.state.pos),a+=this.jsxReadEntity(),n=this.state.pos;break;case 62:case 125:this.raise(ov.UnexpectedToken,this.state.curPosition(),{unexpected:this.input[this.state.pos],HTMLEntity:125===t?"}":">"});default:ev(t)?(a+=this.input.slice(n,this.state.pos),a+=this.jsxReadNewLine(!0),n=this.state.pos):++this.state.pos}}},n.jsxReadNewLine=function(e){var a,n=this.input.charCodeAt(this.state.pos);return++this.state.pos,13===n&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,a=e?"\n":"\r\n"):a=String.fromCharCode(n),++this.state.curLine,this.state.lineStart=this.state.pos,a},n.jsxReadString=function(e){for(var a="",n=++this.state.pos;;){if(this.state.pos>=this.length)throw this.raise(Hm.UnterminatedString,this.state.startLoc);var t=this.input.charCodeAt(this.state.pos);if(t===e)break;38===t?(a+=this.input.slice(n,this.state.pos),a+=this.jsxReadEntity(),n=this.state.pos):ev(t)?(a+=this.input.slice(n,this.state.pos),a+=this.jsxReadNewLine(!1),n=this.state.pos):++this.state.pos}a+=this.input.slice(n,this.state.pos++),this.finishToken(130,a)},n.jsxReadEntity=function(){var e=++this.state.pos;if(35===this.codePointAtPos(this.state.pos)){++this.state.pos;var a=10;120===this.codePointAtPos(this.state.pos)&&(a=16,++this.state.pos);var n=this.readInt(a,void 0,!1,"bail");if(null!==n&&59===this.codePointAtPos(this.state.pos))return++this.state.pos,String.fromCodePoint(n)}else{for(var t=0,r=!1;t++<10&&this.state.posn.index+1&&this.raise(Jy.UnexpectedSpaceBetweenModuloChecks,n),this.eat(6)?(a.value=e.prototype.parseExpression.call(this),this.expect(7),this.finishNode(a,"DeclaredPredicate")):this.finishNode(a,"InferredPredicate")},n.flowParseTypeAndPredicateInitialiser=function(e){var a=this.state.inType;this.state.inType=!0,this.expect(10);var n=null,t=null;return e&&this.match(50)?(this.state.inType=a,t=this.flowParsePredicate()):(n=this.flowParseType(),this.state.inType=a,this.match(50)&&(t=this.flowParsePredicate())),[n,t]},n.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},n.flowParseDeclareFunction=function(e){this.next();var a=e.id=this.parseIdentifier(),n=this.startNode(),t=this.startNode();this.match(43)?n.typeParameters=this.flowParseTypeParameterDeclaration():n.typeParameters=null,this.expect(6);var r=this.flowParseFunctionTypeParams();n.params=r.params,n.rest=r.rest,n.this=r._this,this.expect(7);var i=this.flowParseTypeAndPredicateInitialiser(!1);return n.returnType=i[0],e.predicate=i[1],t.typeAnnotation=this.finishNode(n,"FunctionTypeAnnotation"),a.typeAnnotation=this.finishNode(t,"TypeAnnotation"),this.resetEndLocation(a),this.semicolon(),this.scope.declareName(e.id.name,Iy,e.id.start),this.finishNode(e,"DeclareFunction")},n.flowParseDeclare=function(e,a){if(this.match(76))return this.flowParseDeclareClass(e);if(this.match(64))return this.flowParseDeclareFunction(e);if(this.match(70))return this.flowParseDeclareVariable(e);if(this.eatContextual(123))return this.match(12)?this.flowParseDeclareModuleExports(e):(a&&this.raise(Jy.NestedDeclareModule,this.state.lastTokStartLoc),this.flowParseDeclareModule(e));if(this.isContextual(126))return this.flowParseDeclareTypeAlias(e);if(this.isContextual(127))return this.flowParseDeclareOpaqueType(e);if(this.isContextual(125))return this.flowParseDeclareInterface(e);if(this.match(78))return this.flowParseDeclareExportDeclaration(e,a);throw this.unexpected()},n.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(e.id.name,by,e.id.start),this.semicolon(),this.finishNode(e,"DeclareVariable")},n.flowParseDeclareModule=function(a){var n=this;this.scope.enter(VR),this.match(130)?a.id=e.prototype.parseExprAtom.call(this):a.id=this.parseIdentifier();var t=this.startNode(),r=t.body=[];for(this.expect(2);!this.match(4);){var i=this.startNode();this.match(79)?(this.next(),this.isContextual(126)||this.match(83)||this.raise(Jy.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc),r.push(e.prototype.parseImport.call(this,i))):(this.expectContextual(121,Jy.UnsupportedStatementInDeclareModule),r.push(this.flowParseDeclare(i,!0)))}this.scope.exit(),this.expect(4),a.body=this.finishNode(t,"BlockStatement");var o=null,s=!1;return r.forEach(function(e){!function(e){return"DeclareExportAllDeclaration"===e.type||"DeclareExportDeclaration"===e.type&&(!e.declaration||"TypeAlias"!==e.declaration.type&&"InterfaceDeclaration"!==e.declaration.type)}(e)?"DeclareModuleExports"===e.type&&(s&&n.raise(Jy.DuplicateDeclareModuleExports,e),"ES"===o&&n.raise(Jy.AmbiguousDeclareModuleKind,e),o="CommonJS",s=!0):("CommonJS"===o&&n.raise(Jy.AmbiguousDeclareModuleKind,e),o="ES")}),a.kind=o||"CommonJS",this.finishNode(a,"DeclareModule")},n.flowParseDeclareExportDeclaration=function(e,a){if(this.expect(78),this.eat(61))return this.match(64)||this.match(76)?e.declaration=this.flowParseDeclare(this.startNode()):(e.declaration=this.flowParseType(),this.semicolon()),e.default=!0,this.finishNode(e,"DeclareExportDeclaration");if(this.match(71)||this.isLet()||(this.isContextual(126)||this.isContextual(125))&&!a){var n=this.state.value;throw this.raise(Jy.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:n,suggestion:Yy[n]})}if(this.match(70)||this.match(64)||this.match(76)||this.isContextual(127))return e.declaration=this.flowParseDeclare(this.startNode()),e.default=!1,this.finishNode(e,"DeclareExportDeclaration");if(this.match(51)||this.match(2)||this.isContextual(125)||this.isContextual(126)||this.isContextual(127)){var t=this.parseExport(e,null);return"ExportNamedDeclaration"===t.type?(t.default=!1,delete t.exportKind,this.castNodeTo(t,"DeclareExportDeclaration")):this.castNodeTo(t,"DeclareExportAllDeclaration")}throw this.unexpected()},n.flowParseDeclareModuleExports=function(e){return this.next(),this.expectContextual(107),e.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(e,"DeclareModuleExports")},n.flowParseDeclareTypeAlias=function(e){this.next();var a=this.flowParseTypeAlias(e);return this.castNodeTo(a,"DeclareTypeAlias"),a},n.flowParseDeclareOpaqueType=function(e){return this.next(),this.flowParseOpaqueType(e,!0)},n.flowParseDeclareInterface=function(e){return this.next(),this.flowParseInterfaceish(e,!1),this.finishNode(e,"DeclareInterface")},n.flowParseInterfaceish=function(e,a){if(e.id=this.flowParseRestrictedIdentifier(!a,!0),this.scope.declareName(e.id.name,a?xy:yy,e.id.start),this.match(43)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.extends=[],this.eat(77))do{e.extends.push(this.flowParseInterfaceExtends())}while(!a&&this.eat(8));if(a){var n=[],t=[];if(this.eatContextual(113))do{t.push(this.flowParseInterfaceExtends())}while(this.eat(8));if(this.eatContextual(109))do{n.push(this.flowParseClassImplements())}while(this.eat(8));e.implements=n,e.mixins=t}e.body=this.flowParseObjectType({allowStatic:a,allowExact:!1,allowSpread:!1,allowProto:a,allowInexact:!1})},n.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.flowParseQualifiedTypeIdentifier(),this.match(43)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"InterfaceExtends")},n.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},n.checkNotUnderscore=function(e){"_"===e&&this.raise(Jy.UnexpectedReservedUnderscore,this.state.startLoc)},n.checkReservedType=function(e,a,n){zy.has(e)&&this.raise(n?Jy.AssignReservedType:Jy.UnexpectedReservedType,a,{reservedType:e})},n.flowParseRestrictedIdentifierName=function(e,a){return this.checkReservedType(this.state.value,this.state.startLoc,a),this.parseIdentifierName(e)},n.flowParseRestrictedIdentifier=function(e,a){var n=this.startNode(),t=this.flowParseRestrictedIdentifierName(e,a);return this.createIdentifier(n,t)},n.flowParseTypeAlias=function(e){return e.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(e.id.name,yy,e.id.start),this.match(43)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(25),this.semicolon(),this.finishNode(e,"TypeAlias")},n.flowParseOpaqueType=function(e,a){return this.expectContextual(126),e.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(e.id.name,yy,e.id.start),this.match(43)?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.supertype=null,this.match(10)&&(e.supertype=this.flowParseTypeInitialiser(10)),e.impltype=null,a||(e.impltype=this.flowParseTypeInitialiser(25)),this.semicolon(),this.finishNode(e,a?"DeclareOpaqueType":"OpaqueType")},n.flowParseTypeParameterBound=function(){if(this.match(10)||this.isContextual(77)){var e=this.startNode();return this.next(),e.typeAnnotation=this.flowParseType(),this.finishNode(e,"TypeAnnotation")}},n.flowParseTypeParameter=function(e){void 0===e&&(e=!1);var a=this.state.startLoc,n=this.startNode(),t=this.flowParseVariance();return n.name=this.flowParseRestrictedIdentifierName(),n.variance=t,n.bound=this.flowParseTypeParameterBound(),this.match(25)?(this.eat(25),n.default=this.flowParseType()):e&&this.raise(Jy.MissingTypeParamDefault,a),this.finishNode(n,"TypeParameter")},n.flowParseTypeParameterDeclaration=function(){var e=this.state.inType,a=this.startNode();a.params=[],this.state.inType=!0,this.match(43)||this.match(138)?this.next():this.unexpected();var n=!1;do{var t=this.flowParseTypeParameter(n);a.params.push(t),t.default&&(n=!0),this.match(44)||this.expect(8)}while(!this.match(44));return this.expect(44),this.state.inType=e,this.finishNode(a,"TypeParameterDeclaration")},n.flowInTopLevelContext=function(e){if(this.curContext()===UR.brace)return e();var a=this.state.context;this.state.context=[a[0]];try{return e()}finally{this.state.context=a}},n.flowParseTypeParameterInstantiationInExpression=function(){if(43===this.reScan_lt())return this.flowParseTypeParameterInstantiation()},n.flowParseTypeParameterInstantiation=function(){var e=this,a=this.startNode(),n=this.state.inType;return this.state.inType=!0,a.params=[],this.flowInTopLevelContext(function(){e.expect(43);var n=e.state.noAnonFunctionType;for(e.state.noAnonFunctionType=!1;!e.match(44);)a.params.push(e.flowParseType()),e.match(44)||e.expect(8);e.state.noAnonFunctionType=n}),this.state.inType=n,this.state.inType||this.curContext()!==UR.brace||this.reScan_lt_gt(),this.expect(44),this.finishNode(a,"TypeParameterInstantiation")},n.flowParseTypeParameterInstantiationCallOrNew=function(){if(43!==this.reScan_lt())return null;var e=this.startNode(),a=this.state.inType;for(e.params=[],this.state.inType=!0,this.expect(43);!this.match(44);)e.params.push(this.flowParseTypeOrImplicitInstantiation()),this.match(44)||this.expect(8);return this.expect(44),this.state.inType=a,this.finishNode(e,"TypeParameterInstantiation")},n.flowParseInterfaceType=function(){var e=this.startNode();if(this.expectContextual(125),e.extends=[],this.eat(77))do{e.extends.push(this.flowParseInterfaceExtends())}while(this.eat(8));return e.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(e,"InterfaceTypeAnnotation")},n.flowParseObjectPropertyKey=function(){return this.match(131)||this.match(130)?e.prototype.parseExprAtom.call(this):this.parseIdentifier(!0)},n.flowParseObjectTypeIndexer=function(e,a,n){return e.static=a,10===this.lookahead().type?(e.id=this.parseIdentifier(!0),e.key=this.flowParseTypeInitialiser()):(e.id=null,e.key=this.flowParseType()),this.expect(1),e.value=this.flowParseTypeInitialiser(),e.variance=n,this.finishNode(e,"ObjectTypeIndexer")},n.flowParseObjectTypeInternalSlot=function(e,a){return e.static=a,e.id=this.parseIdentifier(!0),this.expect(1),this.expect(1),this.match(43)||this.match(6)?(e.method=!0,e.optional=!1,e.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(e))):(e.method=!1,this.eat(13)&&(e.optional=!0),e.value=this.flowParseTypeInitialiser()),this.finishNode(e,"ObjectTypeInternalSlot")},n.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,e.this=null,this.match(43)&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(6),this.match(74)&&(e.this=this.flowParseFunctionTypeParam(!0),e.this.name=null,this.match(7)||this.expect(8));!this.match(7)&&!this.match(17);)e.params.push(this.flowParseFunctionTypeParam(!1)),this.match(7)||this.expect(8);return this.eat(17)&&(e.rest=this.flowParseFunctionTypeParam(!1)),this.expect(7),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},n.flowParseObjectTypeCallProperty=function(e,a){var n=this.startNode();return e.static=a,e.value=this.flowParseObjectTypeMethodish(n),this.finishNode(e,"ObjectTypeCallProperty")},n.flowParseObjectType=function(e){var a=e.allowStatic,n=e.allowExact,t=e.allowSpread,r=e.allowProto,i=e.allowInexact,o=this.state.inType;this.state.inType=!0;var s,d,u=this.startNode();u.callProperties=[],u.properties=[],u.indexers=[],u.internalSlots=[];var c=!1;for(n&&this.match(3)?(this.expect(3),s=5,d=!0):(this.expect(2),s=4,d=!1),u.exact=d;!this.match(s);){var l=!1,p=null,g=null,f=this.startNode();if(r&&this.isContextual(114)){var h=this.lookahead();10!==h.type&&13!==h.type&&(this.next(),p=this.state.startLoc,a=!1)}if(a&&this.isContextual(102)){var m=this.lookahead();10!==m.type&&13!==m.type&&(this.next(),l=!0)}var R=this.flowParseVariance();if(this.eat(0))null!=p&&this.unexpected(p),this.eat(0)?(R&&this.unexpected(R.start),u.internalSlots.push(this.flowParseObjectTypeInternalSlot(f,l))):u.indexers.push(this.flowParseObjectTypeIndexer(f,l,R));else if(this.match(6)||this.match(43))null!=p&&this.unexpected(p),R&&this.unexpected(R.start),u.callProperties.push(this.flowParseObjectTypeCallProperty(f,l));else{var y="init";if(this.isContextual(95)||this.isContextual(100))_R(this.lookahead().type)&&(y=this.state.value,this.next());var v=this.flowParseObjectTypeProperty(f,l,p,R,y,t,null!=i?i:!d);null===v?(c=!0,g=this.state.lastTokStartLoc):u.properties.push(v)}this.flowObjectTypeSemicolon(),!g||this.match(4)||this.match(5)||this.raise(Jy.UnexpectedExplicitInexactInObject,g)}this.expect(s),t&&(u.inexact=c);var b=this.finishNode(u,"ObjectTypeAnnotation");return this.state.inType=o,b},n.flowParseObjectTypeProperty=function(e,a,n,t,r,i,o){if(this.eat(17))return this.match(8)||this.match(9)||this.match(4)||this.match(5)?(i?o||this.raise(Jy.InexactInsideExact,this.state.lastTokStartLoc):this.raise(Jy.InexactInsideNonObject,this.state.lastTokStartLoc),t&&this.raise(Jy.InexactVariance,t),null):(i||this.raise(Jy.UnexpectedSpreadType,this.state.lastTokStartLoc),null!=n&&this.unexpected(n),t&&this.raise(Jy.SpreadVariance,t),e.argument=this.flowParseType(),this.finishNode(e,"ObjectTypeSpreadProperty"));e.key=this.flowParseObjectPropertyKey(),e.static=a,e.proto=null!=n,e.kind=r;var s=!1;return this.match(43)||this.match(6)?(e.method=!0,null!=n&&this.unexpected(n),t&&this.unexpected(t.start),e.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(e)),"get"===r||"set"===r?this.flowCheckGetterSetterParams(e):a||i||"constructor"!==e.key.name||!e.value.this||this.raise(Jy.ThisParamBannedInConstructor,e.value.this)):("init"!==r&&this.unexpected(),e.method=!1,this.eat(13)&&(s=!0),e.value=this.flowParseTypeInitialiser(),e.variance=t),e.optional=s,this.finishNode(e,"ObjectTypeProperty")},n.flowCheckGetterSetterParams=function(e){var a="get"===e.kind?0:1,n=e.value,t=n.params.length+(n.rest?1:0);n.this&&this.raise("get"===e.kind?Jy.GetterMayNotHaveThisParam:Jy.SetterMayNotHaveThisParam,n.this),t!==a&&this.raise("get"===e.kind?Hm.BadGetterArity:Hm.BadSetterArity,e),"set"===e.kind&&n.rest&&this.raise(Hm.BadSetterRestParameter,e)},n.flowObjectTypeSemicolon=function(){this.eat(9)||this.eat(8)||this.match(4)||this.match(5)||this.unexpected()},n.flowParseQualifiedTypeIdentifier=function(e,a){null!=e||(e=this.state.startLoc);for(var n=a||this.flowParseRestrictedIdentifier(!0);this.eat(12);){var t=this.startNodeAt(e);t.qualification=n,t.id=this.flowParseRestrictedIdentifier(!0),n=this.finishNode(t,"QualifiedTypeIdentifier")}return n},n.flowParseGenericType=function(e,a){var n=this.startNodeAt(e);return n.typeParameters=null,n.id=this.flowParseQualifiedTypeIdentifier(e,a),this.match(43)&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},n.flowParseTypeofType=function(){var e=this.startNode();return this.expect(83),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},n.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(0);this.state.pos0){var f=[].concat(o);if(g.length>0){this.state=i,this.state.noArrowAt=f;for(var h=0;h1&&this.raise(Jy.AmbiguousConditionalArrow,i.startLoc),c&&1===p.length)this.state=i,f.push(p[0].start),this.state.noArrowAt=f,u=this.tryParseConditionalConsequent().consequent}return this.getArrowLikeExpressions(u,!0),this.state.noArrowAt=o,this.expect(10),s.test=e,s.consequent=u,s.alternate=this.forwardNoArrowParamsConversionAt(s,function(){return t.parseMaybeAssign(void 0,void 0)}),this.finishNode(s,"ConditionalExpression")},n.tryParseConditionalConsequent=function(){this.state.noArrowParamsConversionAt.push(this.state.start);var e=this.parseMaybeAssignAllowIn(),a=!this.match(10);return this.state.noArrowParamsConversionAt.pop(),{consequent:e,failed:a}},n.getArrowLikeExpressions=function(e,a){for(var n=this,t=[e],r=[];0!==t.length;){var i=t.pop();"ArrowFunctionExpression"===i.type&&"BlockStatement"!==i.body.type?(i.typeParameters||!i.returnType?this.finishArrowValidation(i):r.push(i),t.push(i.body)):"ConditionalExpression"===i.type&&(t.push(i.consequent),t.push(i.alternate))}return a?(r.forEach(function(e){return n.finishArrowValidation(e)}),[r,[]]):function(e,a){for(var n=[],t=[],r=0;r1)&&a||this.raise(Jy.TypeCastInPattern,r.typeAnnotation)}return e},n.parseArrayLike=function(a,n){var t=e.prototype.parseArrayLike.call(this,a,n);return"ArrayExpression"===t.type&&this.toReferencedList(t.elements),t},n.isValidLVal=function(a,n,t,r){return"TypeCastExpression"===a||e.prototype.isValidLVal.call(this,a,n,t,r)},n.parseClassProperty=function(a){return this.match(10)&&(a.typeAnnotation=this.flowParseTypeAnnotation()),e.prototype.parseClassProperty.call(this,a)},n.parseClassPrivateProperty=function(a){return this.match(10)&&(a.typeAnnotation=this.flowParseTypeAnnotation()),e.prototype.parseClassPrivateProperty.call(this,a)},n.isClassMethod=function(){return this.match(43)||e.prototype.isClassMethod.call(this)},n.isClassProperty=function(){return this.match(10)||e.prototype.isClassProperty.call(this)},n.isNonstaticConstructor=function(a){return!this.match(10)&&e.prototype.isNonstaticConstructor.call(this,a)},n.pushClassMethod=function(a,n,t,r,i,o){if(n.variance&&this.unexpected(n.variance.start),delete n.variance,this.match(43)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),e.prototype.pushClassMethod.call(this,a,n,t,r,i,o),n.params&&i){var s=n.params;s.length>0&&this.isThisParam(s[0])&&this.raise(Jy.ThisParamBannedInConstructor,n)}else if("MethodDefinition"===n.type&&i&&n.value.params){var d=n.value.params;d.length>0&&this.isThisParam(d[0])&&this.raise(Jy.ThisParamBannedInConstructor,n)}},n.pushClassPrivateMethod=function(a,n,t,r){n.variance&&this.unexpected(n.variance.start),delete n.variance,this.match(43)&&(n.typeParameters=this.flowParseTypeParameterDeclaration()),e.prototype.pushClassPrivateMethod.call(this,a,n,t,r)},n.flowParseClassImplements=function(){var e=this.startNode();return e.id=this.flowParseRestrictedIdentifier(!0),this.match(43)?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,this.finishNode(e,"ClassImplements")},n.parseClassSuper=function(a){if(e.prototype.parseClassSuper.call(this,a),a.superClass&&(this.match(43)||this.match(47))&&(a.superTypeArguments=this.flowParseTypeParameterInstantiationInExpression()),this.eatContextual(109)){var n=a.implements=[];do{n.push(this.flowParseClassImplements())}while(this.eat(8))}},n.checkGetterSetterParams=function(a){e.prototype.checkGetterSetterParams.call(this,a);var n=this.getObjectOrClassMethodParams(a);if(n.length>0){var t=n[0];this.isThisParam(t)&&"get"===a.kind?this.raise(Jy.GetterMayNotHaveThisParam,t):this.isThisParam(t)&&this.raise(Jy.SetterMayNotHaveThisParam,t)}},n.parsePropertyNamePrefixOperator=function(e){e.variance=this.flowParseVariance()},n.parseObjPropValue=function(a,n,t,r,i,o,s){var d;a.variance&&this.unexpected(a.variance.start),delete a.variance,this.match(43)&&!o&&(d=this.flowParseTypeParameterDeclaration(),this.match(6)||this.unexpected());var u=e.prototype.parseObjPropValue.call(this,a,n,t,r,i,o,s);return d&&((u.value||u).typeParameters=d),u},n.parseFunctionParamType=function(e){return this.eat(13)&&("Identifier"!==e.type&&this.raise(Jy.PatternIsOptional,e),this.isThisParam(e)&&this.raise(Jy.ThisParamMayNotBeOptional,e),e.optional=!0),this.match(10)?e.typeAnnotation=this.flowParseTypeAnnotation():this.isThisParam(e)&&this.raise(Jy.ThisParamAnnotationRequired,e),this.match(25)&&this.isThisParam(e)&&this.raise(Jy.ThisParamNoDefault,e),this.resetEndLocation(e),e},n.parseMaybeDefault=function(a,n){var t=e.prototype.parseMaybeDefault.call(this,a,n);return"AssignmentPattern"===t.type&&t.typeAnnotation&&t.right.start0&&this.raise(Jy.ThisParamMustBeFirst,a.params[i]);e.prototype.checkParams.call(this,a,n,t,r)}},n.parseParenAndDistinguishExpression=function(a){return e.prototype.parseParenAndDistinguishExpression.call(this,a&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))},n.parseSubscripts=function(a,n,t){var r=this;if("Identifier"===a.type&&"async"===a.name&&this.state.noArrowAt.includes(n.index)){this.next();var i=this.startNodeAt(n);i.callee=a,i.arguments=e.prototype.parseCallExpressionArguments.call(this),a=this.finishNode(i,"CallExpression")}else if("Identifier"===a.type&&"async"===a.name&&this.match(43)){var o=this.state.clone(),s=this.tryParse(function(e){return r.parseAsyncArrowWithTypeParameters(n)||e()},o);if(!s.error&&!s.aborted)return s.node;var d=this.tryParse(function(){return e.prototype.parseSubscripts.call(r,a,n,t)},o);if(d.node&&!d.error)return d.node;if(s.node)return this.state=s.failState,s.node;if(d.node)return this.state=d.failState,d.node;throw s.error||d.error}return e.prototype.parseSubscripts.call(this,a,n,t)},n.parseSubscript=function(a,n,t,r){var i=this;if(this.match(14)&&this.isLookaheadToken_lt()){if(r.optionalChainMember=!0,t)return r.stop=!0,a;this.next();var o=this.startNodeAt(n);return o.callee=a,o.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(6),o.arguments=this.parseCallExpressionArguments(),o.optional=!0,this.finishCallExpression(o,!0)}if(!t&&this.shouldParseTypes()&&(this.match(43)||this.match(47))){var s=this.startNodeAt(n);s.callee=a;var d=this.tryParse(function(){return s.typeArguments=i.flowParseTypeParameterInstantiationCallOrNew(),i.expect(6),s.arguments=e.prototype.parseCallExpressionArguments.call(i),r.optionalChainMember&&(s.optional=!1),i.finishCallExpression(s,r.optionalChainMember)});if(d.node)return d.error&&(this.state=d.failState),d.node}return e.prototype.parseSubscript.call(this,a,n,t,r)},n.parseNewCallee=function(a){var n=this;e.prototype.parseNewCallee.call(this,a);var t=null;this.shouldParseTypes()&&this.match(43)&&(t=this.tryParse(function(){return n.flowParseTypeParameterInstantiationCallOrNew()}).node),a.typeArguments=t},n.parseAsyncArrowWithTypeParameters=function(a){var n=this.startNodeAt(a);if(this.parseFunctionParams(n,!1),this.parseArrow(n))return e.prototype.parseArrowExpression.call(this,n,void 0,!0)},n.readToken_mult_modulo=function(a){var n=this.input.charCodeAt(this.state.pos+1);if(42===a&&47===n&&this.state.hasFlowComment)return this.state.hasFlowComment=!1,this.state.pos+=2,void this.nextToken();e.prototype.readToken_mult_modulo.call(this,a)},n.readToken_pipe_amp=function(a){var n=this.input.charCodeAt(this.state.pos+1);124!==a||125!==n?e.prototype.readToken_pipe_amp.call(this,a):this.finishOp(5,2)},n.parseTopLevel=function(a,n){var t=e.prototype.parseTopLevel.call(this,a,n);return this.state.hasFlowComment&&this.raise(Jy.UnterminatedFlowComment,this.state.curPosition()),t},n.skipBlockComment=function(){if(!this.hasPlugin("flowComments")||!this.skipFlowComment())return e.prototype.skipBlockComment.call(this,this.state.hasFlowComment?"*-/":"*/");if(this.state.hasFlowComment)throw this.raise(Jy.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();var a=this.skipFlowComment();a&&(this.state.pos+=a,this.state.hasFlowComment=!0)},n.skipFlowComment=function(){for(var e=this.state.pos,a=2;[32,9].includes(this.input.charCodeAt(e+a));)a++;var n=this.input.charCodeAt(a+e),t=this.input.charCodeAt(a+e+1);return 58===n&&58===t?a+2:"flow-include"===this.input.slice(a+e,a+e+12)?a+12:58===n&&58!==t&&a},n.hasFlowCommentCompletion=function(){if(-1===this.input.indexOf("*/",this.state.pos))throw this.raise(Hm.UnterminatedComment,this.state.curPosition())},n.flowEnumErrorBooleanMemberNotInitialized=function(e,a){this.raise(Jy.EnumBooleanMemberNotInitialized,e,a)},n.flowEnumErrorInvalidMemberInitializer=function(e,a){return this.raise(a.explicitType?"symbol"===a.explicitType?Jy.EnumInvalidMemberInitializerSymbolType:Jy.EnumInvalidMemberInitializerPrimaryType:Jy.EnumInvalidMemberInitializerUnknownType,e,a)},n.flowEnumErrorNumberMemberNotInitialized=function(e,a){this.raise(Jy.EnumNumberMemberNotInitialized,e,a)},n.flowEnumErrorStringMemberInconsistentlyInitialized=function(e,a){this.raise(Jy.EnumStringMemberInconsistentlyInitialized,e,a)},n.flowEnumMemberInit=function(){var e=this,a=this.state.startLoc,n=function(){return e.match(8)||e.match(4)};switch(this.state.type){case 131:var t=this.parseNumericLiteral(this.state.value);if(n())return{type:"number",loc:t.start,value:t};break;case 130:var r=this.parseStringLiteral(this.state.value);if(n())return{type:"string",loc:r.start,value:r};break;case 81:case 82:var i=this.parseBooleanLiteral(this.match(81));if(n())return{type:"boolean",loc:i.start,value:i}}return{type:"invalid",loc:a}},n.flowEnumMemberRaw=function(){var e=this.state.startLoc;return{id:this.parseIdentifier(!0),init:this.eat(25)?this.flowEnumMemberInit():{type:"none",loc:e}}},n.flowEnumCheckExplicitTypeMismatch=function(e,a,n){var t=a.explicitType;null!==t&&t!==n&&this.flowEnumErrorInvalidMemberInitializer(e,a)},n.flowEnumMembers=function(e){for(var a=e.enumName,n=e.explicitType,t=new Set,r={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},i=!1;!this.match(4);){if(this.eat(17)){i=!0;break}var o=this.startNode(),s=this.flowEnumMemberRaw(),d=s.id,u=s.init,c=d.name;if(""!==c){/^[a-z]/.test(c)&&this.raise(Jy.EnumInvalidMemberName,d,{memberName:c,suggestion:c[0].toUpperCase()+c.slice(1),enumName:a}),t.has(c)&&this.raise(Jy.EnumDuplicateMemberName,d,{memberName:c,enumName:a}),t.add(c);var l={enumName:a,explicitType:n,memberName:c};switch(o.id=d,u.type){case"boolean":this.flowEnumCheckExplicitTypeMismatch(u.loc,l,"boolean"),o.init=u.value,r.booleanMembers.push(this.finishNode(o,"EnumBooleanMember"));break;case"number":this.flowEnumCheckExplicitTypeMismatch(u.loc,l,"number"),o.init=u.value,r.numberMembers.push(this.finishNode(o,"EnumNumberMember"));break;case"string":this.flowEnumCheckExplicitTypeMismatch(u.loc,l,"string"),o.init=u.value,r.stringMembers.push(this.finishNode(o,"EnumStringMember"));break;case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(u.loc,l);case"none":switch(n){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(u.loc,l);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(u.loc,l);break;default:r.defaultedMembers.push(this.finishNode(o,"EnumDefaultedMember"))}}this.match(4)||this.expect(8)}}return{members:r,hasUnknownMembers:i}},n.flowEnumStringMembers=function(e,a,n){var t=n.enumName;if(0===e.length)return a;if(0===a.length)return e;if(a.length>e.length){for(var r=0;r=g){for(var f=0,h=s.defaultedMembers;f=g){for(var R=0,y=s.defaultedMembers;R0&&(this.raise(Hm.BadGetterArity,this.state.curPosition()),this.isThisParam(n.params[0])&&this.raise(fb.AccessorCannotDeclareThisParameter,this.state.curPosition()));else if("set"===n.kind){if(1!==n.params.length)this.raise(Hm.BadSetterArity,this.state.curPosition());else{var t=n.params[0];this.isThisParam(t)&&this.raise(fb.AccessorCannotDeclareThisParameter,this.state.curPosition()),"Identifier"===t.type&&t.optional&&this.raise(fb.SetAccessorCannotHaveOptionalParameter,this.state.curPosition()),"RestElement"===t.type&&this.raise(fb.SetAccessorCannotHaveRestParameter,this.state.curPosition())}n.returnType&&this.raise(fb.SetAccessorCannotHaveReturnType,n.returnType)}else n.kind="method";return this.finishNode(n,"TSMethodSignature")}var r=e;a&&(r.readonly=!0);var i=this.tsTryParseTypeAnnotation();return i&&(r.typeAnnotation=i),this.tsParseTypeMemberSemicolon(),this.finishNode(r,"TSPropertySignature")},n.tsParseTypeMember=function(){var a=this.startNode();if(this.match(6)||this.match(43))return this.tsParseSignatureMember("TSCallSignatureDeclaration",a);if(this.match(73)){var n=this.startNode();return this.next(),this.match(6)||this.match(43)?this.tsParseSignatureMember("TSConstructSignatureDeclaration",a):(a.key=this.createIdentifier(n,"new"),this.tsParsePropertyOrMethodSignature(a,!1))}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},a);var t=this.tsTryParseIndexSignature(a);return t||(e.prototype.parsePropertyName.call(this,a),a.computed||"Identifier"!==a.key.type||"get"!==a.key.name&&"set"!==a.key.name||!this.tsTokenCanFollowModifier()||(a.kind=a.key.name,e.prototype.parsePropertyName.call(this,a),this.match(6)||this.match(43)||this.unexpected(null,6)),this.tsParsePropertyOrMethodSignature(a,!!a.readonly))},n.tsParseTypeLiteral=function(){var e=this.startNode();return e.members=this.tsParseObjectTypeMembers(),this.finishNode(e,"TSTypeLiteral")},n.tsParseObjectTypeMembers=function(){this.expect(2);var e=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(4),e},n.tsIsStartOfMappedType=function(){return this.next(),this.eat(49)?this.isContextual(118):(this.isContextual(118)&&this.next(),!!this.match(0)&&(this.next(),!!this.tsIsIdentifier()&&(this.next(),this.match(54))))},n.tsParseMappedType=function(){var e=this.startNode();return this.expect(2),this.match(49)?(e.readonly=this.state.value,this.next(),this.expectContextual(118)):this.eatContextual(118)&&(e.readonly=!0),this.expect(0),e.key=this.tsParseTypeParameterName(),e.constraint=this.tsExpectThenParseType(54),e.nameType=this.eatContextual(89)?this.tsParseType():null,this.expect(1),this.match(49)?(e.optional=this.state.value,this.next(),this.expect(13)):this.eat(13)&&(e.optional=!0),e.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(4),this.finishNode(e,"TSMappedType")},n.tsParseTupleType=function(){var e=this,a=this.startNode();a.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);var n=!1;return a.elementTypes.forEach(function(a){var t=a.type;!n||"TSRestType"===t||"TSOptionalType"===t||"TSNamedTupleMember"===t&&a.optional||e.raise(fb.OptionalTypeBeforeRequired,a),n||(n="TSNamedTupleMember"===t&&a.optional||"TSOptionalType"===t)}),this.finishNode(a,"TSTupleType")},n.tsParseTupleElementType=function(){var e,a,n,t,r,i=this.state.startLoc,o=this.eat(17),s=this.state.startLoc,d=AR(this.state.type)?this.lookaheadCharCode():null;if(58===d)e=!0,n=!1,a=this.parseIdentifier(!0),this.expect(10),t=this.tsParseType();else if(63===d){n=!0;var u=this.state.value,c=this.tsParseNonArrayType();58===this.lookaheadCharCode()?(e=!0,a=this.createIdentifier(this.startNodeAt(s),u),this.expect(13),this.expect(10),t=this.tsParseType()):(e=!1,t=c,this.expect(13))}else t=this.tsParseType(),n=this.eat(13),e=this.eat(10);if(e)a?((r=this.startNodeAt(s)).optional=n,r.label=a,r.elementType=t,this.eat(13)&&(r.optional=!0,this.raise(fb.TupleOptionalAfterType,this.state.lastTokStartLoc))):((r=this.startNodeAt(s)).optional=n,this.raise(fb.InvalidTupleMemberLabel,t),r.label=t,r.elementType=this.tsParseType()),t=this.finishNode(r,"TSNamedTupleMember");else if(n){var l=this.startNodeAt(s);l.typeAnnotation=t,t=this.finishNode(l,"TSOptionalType")}if(o){var p=this.startNodeAt(i);p.typeAnnotation=t,t=this.finishNode(p,"TSRestType")}return t},n.tsParseParenthesizedType=function(){var e=this.startNode();return this.expect(6),e.typeAnnotation=this.tsParseType(),this.expect(7),this.finishNode(e,"TSParenthesizedType")},n.tsParseFunctionOrConstructorType=function(e,a){var n=this,t=this.startNode();return"TSConstructorType"===e&&(t.abstract=!!a,a&&this.next(),this.next()),this.tsInAllowConditionalTypesContext(function(){return n.tsFillSignature(15,t)}),this.finishNode(t,e)},n.tsParseLiteralTypeNode=function(){var a=this.startNode();switch(this.state.type){case 131:case 132:case 130:case 81:case 82:a.literal=e.prototype.parseExprAtom.call(this);break;default:this.unexpected()}return this.finishNode(a,"TSLiteralType")},n.tsParseTemplateLiteralType=function(){var e=this.state.startLoc,a=this.parseTemplateElement(!1),n=[a];if(a.tail){var t=this.startNodeAt(e),r=this.startNodeAt(e);return r.expressions=[],r.quasis=n,t.literal=this.finishNode(r,"TemplateLiteral"),this.finishNode(t,"TSLiteralType")}for(var i=[];!a.tail;)i.push(this.tsParseType()),this.readTemplateContinuation(),n.push(a=this.parseTemplateElement(!1));var o=this.startNodeAt(e);return o.types=i,o.quasis=n,this.finishNode(o,"TSTemplateLiteralType")},n.parseTemplateSubstitution=function(){return this.state.inType?this.tsParseType():e.prototype.parseTemplateSubstitution.call(this)},n.tsParseThisTypeOrThisTypePredicate=function(){var e=this.tsParseThisTypeNode();return this.isContextual(112)&&!this.hasPrecedingLineBreak()?this.tsParseThisTypePredicate(e):e},n.tsParseNonArrayType=function(){switch(this.state.type){case 130:case 131:case 132:case 81:case 82:return this.tsParseLiteralTypeNode();case 49:if("-"===this.state.value){var e=this.startNode(),a=this.lookahead();return 131!==a.type&&132!==a.type&&this.unexpected(),e.literal=this.parseMaybeUnary(),this.finishNode(e,"TSLiteralType")}break;case 74:return this.tsParseThisTypeOrThisTypePredicate();case 83:return this.tsParseTypeQuery();case 79:return this.tsParseImportType();case 2:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 6:if(!(this.optionFlags&tR)){var n=this.state.startLoc;this.next();var t=this.tsParseType();return this.expect(7),this.addExtra(t,"parenthesized",!0),this.addExtra(t,"parenStart",n.index),t}return this.tsParseParenthesizedType();case 21:case 20:return this.tsParseTemplateLiteralType();default:var r=this.state.type;if(PR(r)||84===r||80===r){var i=84===r?"TSVoidKeyword":80===r?"TSNullKeyword":function(e){switch(e){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}(this.state.value);if(void 0!==i&&46!==this.lookaheadCharCode()){var o=this.startNode();return this.next(),this.finishNode(o,i)}return this.tsParseTypeReference()}}throw this.unexpected()},n.tsParseArrayTypeOrHigher=function(){for(var e=this.state.startLoc,a=this.tsParseNonArrayType();!this.hasPrecedingLineBreak()&&this.eat(0);)if(this.match(1)){var n=this.startNodeAt(e);n.elementType=a,this.expect(1),a=this.finishNode(n,"TSArrayType")}else{var t=this.startNodeAt(e);t.objectType=a,t.indexType=this.tsParseType(),this.expect(1),a=this.finishNode(t,"TSIndexedAccessType")}return a},n.tsParseTypeOperator=function(){var e=this.startNode(),a=this.state.value;return this.next(),e.operator=a,e.typeAnnotation=this.tsParseTypeOperatorOrHigher(),"readonly"===a&&this.tsCheckTypeAnnotationForReadOnly(e),this.finishNode(e,"TSTypeOperator")},n.tsCheckTypeAnnotationForReadOnly=function(e){switch(e.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(fb.UnexpectedReadonly,e)}},n.tsParseInferType=function(){var e=this,a=this.startNode();this.expectContextual(111);var n=this.startNode();return n.name=this.tsParseTypeParameterName(),n.constraint=this.tsTryParse(function(){return e.tsParseConstraintForInferType()}),a.typeParameter=this.finishNode(n,"TSTypeParameter"),this.finishNode(a,"TSInferType")},n.tsParseConstraintForInferType=function(){var e=this;if(this.eat(77)){var a=this.tsInDisallowConditionalTypesContext(function(){return e.tsParseType()});if(this.state.inDisallowConditionalTypesContext||!this.match(13))return a}},n.tsParseTypeOperatorOrHigher=function(){var e,a=this;return(e=this.state.type)>=117&&e<=119&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(111)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(function(){return a.tsParseArrayTypeOrHigher()})},n.tsParseUnionOrIntersectionType=function(e,a,n){var t=this.startNode(),r=this.eat(n),i=[];do{i.push(a())}while(this.eat(n));return 1!==i.length||r?(t.types=i,this.finishNode(t,e)):i[0]},n.tsParseIntersectionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),41)},n.tsParseUnionTypeOrHigher=function(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),39)},n.tsIsStartOfFunctionType=function(){return!!this.match(43)||this.match(6)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))},n.tsSkipParameterStart=function(){if(PR(this.state.type)||this.match(74))return this.next(),!0;if(this.match(2)){var a=this.state.errors,n=a.length;try{return this.parseObjectLike(4,!0),a.length===n}catch(e){return!1}}if(this.match(0)){this.next();var t=this.state.errors,r=t.length;try{return e.prototype.parseBindingList.call(this,1,93,Gv),t.length===r}catch(e){return!1}}return!1},n.tsIsUnambiguouslyStartOfFunctionType=function(){if(this.next(),this.match(7)||this.match(17))return!0;if(this.tsSkipParameterStart()){if(this.match(10)||this.match(8)||this.match(13)||this.match(25))return!0;if(this.match(7)&&(this.next(),this.match(15)))return!0}return!1},n.tsParseTypeOrTypePredicateAnnotation=function(e){var a=this;return this.tsInType(function(){var n=a.startNode();a.expect(e);var t=a.startNode(),r=!!a.tsTryParse(a.tsParseTypePredicateAsserts.bind(a));if(r&&a.match(74)){var i=a.tsParseThisTypeOrThisTypePredicate();return"TSThisType"===i.type?(t.parameterName=i,t.asserts=!0,t.typeAnnotation=null,i=a.finishNode(t,"TSTypePredicate")):(a.resetStartLocationFromNode(i,t),i.asserts=!0),n.typeAnnotation=i,a.finishNode(n,"TSTypeAnnotation")}var o=a.tsIsIdentifier()&&a.tsTryParse(a.tsParseTypePredicatePrefix.bind(a));if(!o)return r?(t.parameterName=a.parseIdentifier(),t.asserts=r,t.typeAnnotation=null,n.typeAnnotation=a.finishNode(t,"TSTypePredicate"),a.finishNode(n,"TSTypeAnnotation")):a.tsParseTypeAnnotation(!1,n);var s=a.tsParseTypeAnnotation(!1);return t.parameterName=o,t.typeAnnotation=s,t.asserts=r,n.typeAnnotation=a.finishNode(t,"TSTypePredicate"),a.finishNode(n,"TSTypeAnnotation")})},n.tsTryParseTypeOrTypePredicateAnnotation=function(){if(this.match(10))return this.tsParseTypeOrTypePredicateAnnotation(10)},n.tsTryParseTypeAnnotation=function(){if(this.match(10))return this.tsParseTypeAnnotation()},n.tsTryParseType=function(){return this.tsEatThenParseType(10)},n.tsParseTypePredicatePrefix=function(){var e=this.parseIdentifier();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.next(),e},n.tsParseTypePredicateAsserts=function(){if(105!==this.state.type)return!1;var e=this.state.containsEsc;return this.next(),!(!PR(this.state.type)&&!this.match(74))&&(e&&this.raise(Hm.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"}),!0)},n.tsParseTypeAnnotation=function(e,a){var n=this;return void 0===e&&(e=!0),void 0===a&&(a=this.startNode()),this.tsInType(function(){e&&n.expect(10),a.typeAnnotation=n.tsParseType()}),this.finishNode(a,"TSTypeAnnotation")},n.tsParseType=function(){var e=this;gb(this.state.inType);var a=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(77))return a;var n=this.startNodeAtNode(a);return n.checkType=a,n.extendsType=this.tsInDisallowConditionalTypesContext(function(){return e.tsParseNonConditionalType()}),this.expect(13),n.trueType=this.tsInAllowConditionalTypesContext(function(){return e.tsParseType()}),this.expect(10),n.falseType=this.tsInAllowConditionalTypesContext(function(){return e.tsParseType()}),this.finishNode(n,"TSConditionalType")},n.isAbstractConstructorSignature=function(){return this.isContextual(120)&&this.isLookaheadContextual("new")},n.tsParseNonConditionalType=function(){return this.tsIsStartOfFunctionType()?this.tsParseFunctionOrConstructorType("TSFunctionType"):this.match(73)?this.tsParseFunctionOrConstructorType("TSConstructorType"):this.isAbstractConstructorSignature()?this.tsParseFunctionOrConstructorType("TSConstructorType",!0):this.tsParseUnionTypeOrHigher()},n.tsParseTypeAssertion=function(){var e=this;this.getPluginOption("typescript","disallowAmbiguousJSXLike")&&this.raise(fb.ReservedTypeAssertion,this.state.startLoc);var a=this.startNode();return a.typeAnnotation=this.tsInType(function(){return e.next(),e.match(71)?e.tsParseTypeReference():e.tsParseType()}),this.expect(44),a.expression=this.parseMaybeUnary(),this.finishNode(a,"TSTypeAssertion")},n.tsParseHeritageClause=function(a){var n=this,t=this.state.startLoc,r=this.tsParseDelimitedList("HeritageClauseElement",function(){var t=(n.state.canStartArrow=!1,e.prototype.parseExprSubscripts.call(n));Rb(t)||n.raise(fb.InvalidHeritageClauseType,t.start,{token:a});var r="extends"===a?"TSInterfaceHeritage":"TSClassImplements";if("TSInstantiationExpression"===t.type)return t.type=r,t;var i=n.startNodeAtNode(t);return i.expression=t,(n.match(43)||n.match(47))&&(i.typeArguments=n.tsParseTypeArgumentsInExpression()),n.finishNode(i,r)});return r.length||this.raise(fb.EmptyHeritageClauseType,t,{token:a}),r},n.tsParseInterfaceDeclaration=function(e,a){if(void 0===a&&(a={}),this.hasFollowingLineBreak())return null;this.expectContextual(125),a.declare&&(e.declare=!0),PR(this.state.type)?(e.id=this.parseIdentifier(),this.checkIdentifier(e.id,Ey)):(e.id=null,this.raise(fb.MissingInterfaceName,this.state.startLoc)),e.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(77)&&(e.extends=this.tsParseHeritageClause("extends"));var n=this.startNode();return n.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),e.body=this.finishNode(n,"TSInterfaceBody"),this.finishNode(e,"TSInterfaceDeclaration")},n.tsParseTypeAliasDeclaration=function(e){var a=this;return e.id=this.parseIdentifier(),this.checkIdentifier(e.id,Sy),e.typeAnnotation=this.tsInType(function(){if(e.typeParameters=a.tsTryParseTypeParameters(a.tsParseInOutModifiers),a.expect(25),a.isContextual(110)&&46!==a.lookaheadCharCode()){var n=a.startNode();return a.next(),a.finishNode(n,"TSIntrinsicKeyword")}return a.tsParseType()}),this.semicolon(),this.finishNode(e,"TSTypeAliasDeclaration")},n.tsInTopLevelContext=function(e){if(this.curContext()===UR.brace)return e();var a=this.state.context;this.state.context=[a[0]];try{return e()}finally{this.state.context=a}},n.tsInType=function(e){var a=this.state.inType;this.state.inType=!0;try{return e()}finally{this.state.inType=a}},n.tsInDisallowConditionalTypesContext=function(e){var a=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return e()}finally{this.state.inDisallowConditionalTypesContext=a}},n.tsInAllowConditionalTypesContext=function(e){var a=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return e()}finally{this.state.inDisallowConditionalTypesContext=a}},n.tsEatThenParseType=function(e){if(this.match(e))return this.tsNextThenParseType()},n.tsExpectThenParseType=function(e){var a=this;return this.tsInType(function(){return a.expect(e),a.tsParseType()})},n.tsNextThenParseType=function(){var e=this;return this.tsInType(function(){return e.next(),e.tsParseType()})},n.tsParseEnumMember=function(){var a=this.startNode();return a.id=this.match(130)?e.prototype.parseStringLiteral.call(this,this.state.value):this.parseIdentifier(!0),this.eat(25)&&(a.initializer=e.prototype.parseMaybeAssignAllowIn.call(this)),this.finishNode(a,"TSEnumMember")},n.tsParseEnumDeclaration=function(e,a){return void 0===a&&(a={}),a.const&&(e.const=!0),a.declare&&(e.declare=!0),this.expectContextual(122),e.id=this.parseIdentifier(),this.checkIdentifier(e.id,e.const?Ay:Ty),e.body=this.tsParseEnumBody(),this.finishNode(e,"TSEnumDeclaration")},n.tsParseEnumBody=function(){var e=this.startNode();return this.expect(2),e.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(4),this.finishNode(e,"TSEnumBody")},n.tsParseModuleBlock=function(a){var n=this.startNode();return a||this.scope.enter(VR),this.expect(2),e.prototype.parseBlockOrModuleBlockBody.call(this,n.body=[],void 0,!0,4),a||this.scope.exit(),this.finishNode(n,"TSModuleBlock")},n.tsParseNamespaceDeclaration=function(e){return e.id=this.tsParseEntityName(vb),"Identifier"===e.id.type&&this.checkIdentifier(e.id,_y),this.scope.enter(ay),this.prodParam.enter(Dv),e.body=this.tsParseModuleBlock(!1),this.prodParam.exit(),this.scope.exit(),this.finishNode(e,"TSModuleDeclaration")},n.tsParseAmbientExternalModuleDeclaration=function(a){var n=this.isContextual(108);if(n)a.kind="global",a.id=this.parseIdentifier();else{a.kind="module";var t=this.state,r=t.type,i=t.value;130===r?a.id=e.prototype.parseStringLiteral.call(this,i):PR(r)?(this.raise(fb.InlineModuleDeclarationMustUseString,this.state.startLoc),a.id=this.tsParseEntityName(vb)):2===r?this.raise(fb.EmptyNamespaceName,this.state.startLoc):(this.raise(fb.InvalidNamespaceName,this.state.startLoc,i),a.id=e.prototype.parseExprAtom.call(this))}return this.match(2)?(n||this.scope.enter(ey),this.prodParam.enter(Dv),a.body=this.tsParseModuleBlock(n),this.prodParam.exit(),n||this.scope.exit()):this.semicolon(),this.finishNode(a,"TSModuleDeclaration")},n.tsParseImportEqualsDeclaration=function(e,a){e.id=a||this.parseIdentifier(),this.checkIdentifier(e.id,ky),this.expect(25);var n=this.tsParseModuleReference();return"type"===e.importKind&&"TSExternalModuleReference"!==n.type&&this.raise(fb.ImportAliasHasImportType,n),e.moduleReference=n,this.semicolon(),this.finishNode(e,"TSImportEqualsDeclaration")},n.tsIsExternalModuleReference=function(){return this.isContextual(115)&&40===this.lookaheadCharCode()},n.tsParseModuleReference=function(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(vb)},n.tsParseExternalModuleReference=function(){var a=this.startNode();return this.expectContextual(115),this.expect(6),this.match(130)||this.unexpected(),a.expression=e.prototype.parseExprAtom.call(this),this.expect(7),this.sawUnambiguousESM=!0,this.finishNode(a,"TSExternalModuleReference")},n.tsLookAhead=function(e){var a=this.state.clone(),n=e();return this.state=a,n},n.tsTryParseAndCatch=function(e){var a=this.tryParse(function(a){return e()||a()});if(!a.aborted&&a.node)return a.error&&(this.state=a.failState),a.node},n.tsTryParse=function(e){var a=this.state.clone(),n=e();if(void 0!==n&&!1!==n)return n;this.state=a},n.tsTryParseDeclare=function(a){var n=this;if(!this.isLineTerminator()){var t=this.state.type;return this.tsInAmbientContext(function(){switch(t){case 64:return a.declare=!0,e.prototype.parseFunctionStatement.call(n,a,!1,!1);case 76:return a.declare=!0,n.parseClass(a,!0,!1);case 122:return n.tsParseEnumDeclaration(a,{declare:!0});case 108:return n.tsParseAmbientExternalModuleDeclaration(a);case 96:if(n.state.containsEsc)return;case 71:case 70:return n.match(71)&&n.isLookaheadContextual("enum")?(n.expect(71),n.tsParseEnumDeclaration(a,{const:!0,declare:!0})):(a.declare=!0,n.parseVarStatement(a,n.state.value,!0));case 103:if(n.isUsing())return n.raise(fb.InvalidModifierOnUsingDeclaration,n.state.startLoc,"declare"),a.declare=!0,n.parseVarStatement(a,"using",!0);break;case 92:if(n.isAwaitUsing())return n.raise(fb.InvalidModifierOnAwaitUsingDeclaration,n.state.startLoc,"declare"),a.declare=!0,n.next(),n.parseVarStatement(a,"await using",!0);break;case 125:var r=n.tsParseInterfaceDeclaration(a,{declare:!0});if(r)return r;default:if(PR(t))return n.tsParseDeclaration(a,n.state.type,!0,null)}})}},n.tsTryParseExportDeclaration=function(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)},n.tsParseDeclaration=function(e,a,n,t){switch(a){case 120:if(this.tsCheckLineTerminator(n)&&(this.match(76)||PR(this.state.type)))return this.tsParseAbstractDeclaration(e,t);break;case 123:if(this.tsCheckLineTerminator(n))return this.tsParseAmbientExternalModuleDeclaration(e);break;case 124:if(this.tsCheckLineTerminator(n)&&PR(this.state.type))return e.kind="namespace",this.tsParseNamespaceDeclaration(e);break;case 126:if(this.tsCheckLineTerminator(n)&&PR(this.state.type))return this.tsParseTypeAliasDeclaration(e)}},n.tsCheckLineTerminator=function(e){return e?!this.hasFollowingLineBreak()&&(this.next(),!0):!this.isLineTerminator()},n.tsTryParseGenericAsyncArrowFunction=function(a){var n=this;if(this.match(43)){var t=this.tsTryParseAndCatch(function(){var t=n.startNodeAt(a);return t.typeParameters=n.tsParseTypeParameters(n.tsParseConstModifier),e.prototype.parseFunctionParams.call(n,t),t.returnType=n.tsTryParseTypeOrTypePredicateAnnotation(),n.expect(15),t});if(t)return e.prototype.parseArrowExpression.call(this,t,null,!0)}},n.tsParseTypeArgumentsInExpression=function(){if(43===this.reScan_lt())return this.tsParseTypeArguments()},n.tsParseTypeArguments=function(){var e=this,a=this.startNode();return a.params=this.tsInType(function(){return e.tsInTopLevelContext(function(){return e.expect(43),e.tsParseDelimitedList("TypeParametersOrArguments",e.tsParseType.bind(e))})}),0===a.params.length?this.raise(fb.EmptyTypeArguments,a):this.state.inType||this.curContext()!==UR.brace||this.reScan_lt_gt(),this.expect(44),this.finishNode(a,"TSTypeParameterInstantiation")},n.tsIsDeclarationStart=function(){return(e=this.state.type)>=120&&e<=126;var e},n.isExportDefaultSpecifier=function(){return!this.tsIsDeclarationStart()&&e.prototype.isExportDefaultSpecifier.call(this)},n.parseBindingElement=function(e,a){var n=a.length?null:this.state.startLoc,t={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},t);var r=t.accessibility,i=t.override,o=t.readonly;e&Kv||!(r||o||i)||this.raise(fb.UnexpectedParameterModifier,n||a[0]);var s=this.state.startLoc,d=this.parseMaybeDefault(s);e&Hv&&this.parseFunctionParamType(d);var u=this.parseMaybeDefault(s,d);if(r||o||i){var c=n?this.startNodeAt(n):this.startNodeAtNode(a[0]);return a.length?c.decorators=a:this.setLoc(n),r&&(c.accessibility=r),o&&(c.readonly=o),i&&(c.override=i),"Identifier"!==u.type&&"AssignmentPattern"!==u.type&&this.raise(fb.UnsupportedParameterPropertyKind,n||a[0]),c.parameter=u,this.finishNode(c,"TSParameterProperty")}return a.length&&(d.decorators=a),u},n.isSimpleParameter=function(a){return"TSParameterProperty"===a.type&&e.prototype.isSimpleParameter.call(this,a.parameter)||e.prototype.isSimpleParameter.call(this,a)},n.tsDisallowOptionalPattern=function(e){for(var a=0,n=e.params;at&&!this.hasPrecedingLineBreak()&&(this.isContextual(89)||(r=this.isContextual(116)))){var o=this.startNodeAt(n);o.expression=a,o.typeAnnotation=this.tsInType(function(){return i.next(),i.match(71)?(r&&i.raise(Hm.UnexpectedKeyword,i.state.startLoc,{keyword:"const"}),i.tsParseTypeReference()):i.tsParseType()});var s=this.finishNode(o,r?"TSSatisfiesExpression":"TSAsExpression");return this.reScan_lt_gt(),this.parseExprOp(s,n,t)}return e.prototype.parseExprOp.call(this,a,n,t)},n.checkReservedWord=function(a,n,t,r){this.state.isAmbientContext||e.prototype.checkReservedWord.call(this,a,n,t,r)},n.checkDuplicateExports=function(){},n.isPotentialImportPhase=function(a){if(e.prototype.isPotentialImportPhase.call(this,a))return!0;if(this.isContextual(126)){var n=this.lookaheadCharCode();return a?123===n||42===n:61!==n}return!a&&this.isContextual(83)},n.applyImportPhase=function(a,n,t,r){e.prototype.applyImportPhase.call(this,a,n,t,r),n?a.exportKind="type"===t?"type":"value":a.importKind="type"===t||"typeof"===t?t:"value"},n.parseImport=function(a){if(this.match(130))return a.importKind="value",this.scope.inTSNamespace&&this.raise(fb.ImportInTSNamespace,a),e.prototype.parseImport.call(this,a);var n;if(PR(this.state.type)&&61===this.lookaheadCharCode()){a.importKind="value";var t=this.tsParseImportEqualsDeclaration(a);return this.scope.inTSNamespace&&"TSExternalModuleReference"===t.moduleReference.type&&this.raise(fb.ImportInTSNamespace,a),t}if(this.isContextual(126)){var r=this.parseMaybeImportPhase(a,!1);if(61===this.lookaheadCharCode())return this.scope.inTSNamespace&&this.raise(fb.ImportInTSNamespace,a),this.tsParseImportEqualsDeclaration(a,r);n=e.prototype.parseImportSpecifiersAndAfter.call(this,a,r)}else n=e.prototype.parseImport.call(this,a);return"type"===n.importKind&&n.specifiers.length>1&&"ImportDefaultSpecifier"===n.specifiers[0].type?this.raise(fb.TypeImportCannotSpecifyDefaultAndNamed,n):this.scope.inTSNamespace&&this.raise(fb.ImportInTSNamespace,n),n},n.parseExport=function(a,n){if(this.match(79)){var t=this.startNode();this.next();var r=null;this.isContextual(126)&&this.isPotentialImportPhase(!1)?r=this.parseMaybeImportPhase(t,!1):t.importKind="value";var i=this.tsParseImportEqualsDeclaration(t,r);return a.attributes=[],a.declaration=i,a.exportKind="value",a.source=null,a.specifiers=[],this.finishNode(a,"ExportNamedDeclaration")}if(this.eat(25)){var o=a;return o.expression=e.prototype.parseExpression.call(this),this.semicolon(),this.sawUnambiguousESM=!0,this.scope.inTSNamespace&&this.raise(fb.ExportAssignmentInTSNamespace,o),this.finishNode(o,"TSExportAssignment")}if(this.eatContextual(89)){var s=a;return this.expectContextual(124),s.id=this.parseIdentifier(),this.checkIdentifier(s.id,yy),this.semicolon(),this.scope.inTSNamespace&&this.raise(fb.NamespaceExportInTSNamespace,s),this.finishNode(s,"TSNamespaceExportDeclaration")}var d=e.prototype.parseExport.call(this,a,n);return this.scope.inTSNamespace&&("ExportNamedDeclaration"!==d.type||d.source||!d.declaration&&!this.state.isAmbientContext)&&this.raise(fb.ExportInTSNamespace,d),d},n.isAbstractClass=function(){return this.isContextual(120)&&this.isLookaheadContextual("class")},n.parseExportDefaultExpression=function(){if(this.isAbstractClass()){var a=this.startNode();return this.next(),a.abstract=!0,this.parseClass(a,!0,!0)}if(this.match(125)){var n=this.tsParseInterfaceDeclaration(this.startNode());if(n)return n}return e.prototype.parseExportDefaultExpression.call(this)},n.parseVarStatement=function(a,n,t){void 0===t&&(t=!1);var r=this.state.isAmbientContext,i=e.prototype.parseVarStatement.call(this,a,n,t||r);if(r&&!a.declare&&("using"===n||"await using"===n))return this.raiseOverwrite(fb.UsingDeclarationInAmbientContext,a,n),i;for(var o=0,s=i.declarations;o0&&!this.hasPlugin("decorators-legacy")&&("TSAbstractMethodDefinition"===n.type||"TSDeclareMethod"===n.type?this.raise(fb.DecoratorAbstractMethod,n,{kind:"abstract method"}):("ClassProperty"===n.type&&n.abstract||"ClassProperty"===n.type&&n.declare||"TSAbstractPropertyDefinition"===n.type||"PropertyDefinition"===n.type&&n.declare)&&this.raise(fb.DecoratorAbstractMethod,n,{kind:n.declare?"declare field":"abstract field"}))},n.parseClassMemberWithIsStatic=function(a,n,t,r){var i=this.tsTryParseIndexSignature(n);if(i)return a.body.push(i),n.abstract&&this.raise(fb.IndexSignatureHasAbstract,n),n.accessibility&&this.raise(fb.IndexSignatureHasAccessibility,n,{modifier:n.accessibility}),n.declare&&this.raise(fb.IndexSignatureHasDeclare,n),void(n.override&&this.raise(fb.IndexSignatureHasOverride,n));!this.state.inAbstractClass&&n.abstract&&this.raise(fb.NonAbstractClassHasAbstractMethod,n),n.override&&(t.hadSuperClass||this.raise(fb.OverrideNotInSubClass,n)),e.prototype.parseClassMemberWithIsStatic.call(this,a,n,t,r)},n.parsePostMemberNameModifiers=function(e){this.eat(13)&&(e.optional=!0),e.readonly&&this.match(6)&&this.raise(fb.ClassMethodHasReadonly,e),e.declare&&this.match(6)&&this.raise(fb.ClassMethodHasDeclare,e)},n.shouldParseExportDeclaration=function(){return!!this.tsIsDeclarationStart()||e.prototype.shouldParseExportDeclaration.call(this)},n.parseConditional=function(e,a,n){if(!this.match(13))return e;if(null!=n){var t=this.lookaheadCharCode();if(44===t||61===t||58===t||41===t)return this.setOptionalParametersError(n),e}this.next();var r=this.startNodeAt(a);r.test=e;var i=this.state.inConditionalConsequent;return this.state.inConditionalConsequent=!0,r.consequent=this.parseMaybeAssignAllowIn(),this.state.inConditionalConsequent=i,this.expect(10),r.alternate=this.parseMaybeAssign(),this.finishNode(r,"ConditionalExpression")},n.parseParenItem=function(a,n){var t=e.prototype.parseParenItem.call(this,a,n);if(this.eat(13)&&(t.optional=!0,this.resetEndLocation(a)),this.match(10)){var r=this.startNodeAt(n);return r.expression=a,r.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(r,"TSTypeCastExpression")}return a},n.parseExportDeclaration=function(a){var n=this;if(!this.state.isAmbientContext&&this.isContextual(121))return this.tsInAmbientContext(function(){return n.parseExportDeclaration(a)});var t=this.state.startLoc,r=this.eatContextual(121);if(r&&(this.isContextual(121)||!this.shouldParseExportDeclaration()))throw this.raise(fb.ExpectedAmbientAfterExportDeclare,this.state.startLoc);var i=PR(this.state.type)&&this.tsTryParseExportDeclaration()||e.prototype.parseExportDeclaration.call(this,a);return i?(("TSInterfaceDeclaration"===i.type||"TSTypeAliasDeclaration"===i.type||r)&&(a.exportKind="type"),r&&"TSImportEqualsDeclaration"!==i.type&&(this.resetStartLocation(i,t),i.declare=!0),i):null},n.parseClassId=function(a,n,t,r){if(n&&!t||!this.isContextual(109)){e.prototype.parseClassId.call(this,a,n,t,a.declare?wy:Ry);var i=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);i&&(a.typeParameters=i)}else a.id=null},n.parseClassPropertyAnnotation=function(e){e.optional||(this.eat(31)?e.definite=!0:this.eat(13)&&(e.optional=!0));var a=this.tsTryParseTypeAnnotation();a&&(e.typeAnnotation=a),e.definite&&(this.match(25)?this.raise(fb.DeclaratorDefiniteAssertionWithInitializer,e):a||this.raise(fb.DeclaratorDefiniteAssertionRequiresTypeAnnotation,e))},n.parseClassProperty=function(a){if(this.parseClassPropertyAnnotation(a),this.state.isAmbientContext&&(!a.readonly||a.typeAnnotation)&&this.match(25)&&this.raise(fb.DeclareClassFieldHasInitializer,this.state.startLoc),a.abstract&&this.match(25)){var n=a.key;this.raise(fb.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:"Identifier"!==n.type||a.computed?"["+this.input.slice(this.offsetToSourcePos(n.start),this.offsetToSourcePos(n.end))+"]":n.name})}return e.prototype.parseClassProperty.call(this,a)},n.parseClassPrivateProperty=function(a){return a.abstract&&this.raise(fb.PrivateElementHasAbstract,a),a.accessibility&&this.raise(fb.PrivateElementHasAccessibility,a,{modifier:a.accessibility}),this.parseClassPropertyAnnotation(a),e.prototype.parseClassPrivateProperty.call(this,a)},n.parseClassAccessorProperty=function(a){return this.parseClassPropertyAnnotation(a),a.optional&&this.raise(fb.AccessorCannotBeOptional,a),e.prototype.parseClassAccessorProperty.call(this,a)},n.pushClassMethod=function(a,n,t,r,i,o){var s=this.tsTryParseTypeParameters(this.tsParseConstModifier);s&&i&&this.raise(fb.ConstructorHasTypeParameters,s);var d=n.declare,u=void 0!==d&&d,c=n.kind;!u||"get"!==c&&"set"!==c||this.raise(fb.DeclareAccessor,n,{kind:c}),s&&(n.typeParameters=s),e.prototype.pushClassMethod.call(this,a,n,t,r,i,o)},n.pushClassPrivateMethod=function(a,n,t,r){var i=this.tsTryParseTypeParameters(this.tsParseConstModifier);i&&(n.typeParameters=i),e.prototype.pushClassPrivateMethod.call(this,a,n,t,r)},n.declareClassPrivateMethodInScope=function(a,n){"TSDeclareMethod"!==a.type&&("MethodDefinition"===a.type&&null==a.value.body||e.prototype.declareClassPrivateMethodInScope.call(this,a,n))},n.parseClassSuper=function(a){if(e.prototype.parseClassSuper.call(this,a),a.superClass)if("TSInstantiationExpression"===a.superClass.type){var n=a.superClass,t=n.expression;this.takeSurroundingComments(t,t.start,t.end);var r=n.typeArguments;this.takeSurroundingComments(r,r.start,r.end),a.superClass=t,a.superTypeArguments=r}else(this.match(43)||this.match(47))&&(a.superTypeArguments=this.tsParseTypeArgumentsInExpression());this.eatContextual(109)&&(a.implements=this.tsParseHeritageClause("implements"))},n.parseObjPropValue=function(a,n,t,r,i,o,s){var d=this.tsTryParseTypeParameters(this.tsParseConstModifier);return d&&(a.typeParameters=d),e.prototype.parseObjPropValue.call(this,a,n,t,r,i,o,s)},n.parseFunctionParams=function(a,n){var t=this.tsTryParseTypeParameters(this.tsParseConstModifier);t&&(a.typeParameters=t),e.prototype.parseFunctionParams.call(this,a,n)},n.parseVarId=function(a,n){e.prototype.parseVarId.call(this,a,n),"Identifier"===a.id.type&&!this.hasPrecedingLineBreak()&&this.eat(31)&&(a.definite=!0);var t=this.tsTryParseTypeAnnotation();t&&(a.id.typeAnnotation=t,this.resetEndLocation(a.id))},n.parseAsyncArrowFromCallExpression=function(a,n){return this.match(10)&&(a.returnType=this.tsParseTypeAnnotation()),e.prototype.parseAsyncArrowFromCallExpression.call(this,a,n)},n.parseMaybeAssign=function(a,n){var t,r,i,o,s,d,u,c,l,p=this;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(d=this.state.clone(),!(u=this.tryParse(function(){return e.prototype.parseMaybeAssign.call(p,a,n)},d)).error)return u.node;var g=this.state.context,f=g[g.length-1];f!==UR.j_oTag&&f!==UR.j_expr||g.pop()}if(!(null!=(t=u)&&t.error||this.match(43)))return e.prototype.parseMaybeAssign.call(this,a,n);d&&d!==this.state||(d=this.state.clone());var h=this.tryParse(function(t){var r,i,o;l=p.tsParseTypeParameters(p.tsParseConstModifier);var s=e.prototype.parseMaybeAssign.call(p,a,n);if(("ArrowFunctionExpression"!==s.type||null!=(r=s.extra)&&r.parenthesized)&&t(),0!==(null==(i=l)?void 0:i.params.length)&&p.resetStartLocationFromNode(s,l),s.typeParameters=l,p.hasPlugin("jsx")&&1===s.typeParameters.params.length&&(null==(o=s.typeParameters.extra)||!o.trailingComma)){var d=s.typeParameters.params[0];d.constraint||p.raise(fb.SingleTypeParameterWithoutTrailingComma,p.optionFlags&eR?km(d.loc.end,1):d,{typeParameterName:d.name.name})}return s},d);if(!h.error&&!h.aborted)return l&&this.reportReservedArrowTypeParam(l),h.node;if(!u&&(gb(!this.hasPlugin("jsx")),!(c=this.tryParse(function(){return e.prototype.parseMaybeAssign.call(p,a,n)},d)).error))return c.node;if(null!=(r=u)&&r.node)return this.state=u.failState,u.node;if(h.node)return this.state=h.failState,l&&this.reportReservedArrowTypeParam(l),h.node;if(null!=(i=c)&&i.node)return this.state=c.failState,c.node;throw(null==(o=u)?void 0:o.error)||h.error||(null==(s=c)?void 0:s.error)},n.reportReservedArrowTypeParam=function(e){var a;1!==e.params.length||e.params[0].constraint||null!=(a=e.extra)&&a.trailingComma||!this.getPluginOption("typescript","disallowAmbiguousJSXLike")||this.raise(fb.ReservedArrowTypeParam,e)},n.parseMaybeUnary=function(a,n){return!this.hasPlugin("jsx")&&this.match(43)?this.tsParseTypeAssertion():e.prototype.parseMaybeUnary.call(this,a,n)},n.parseArrow=function(a){var n=this;if(this.match(10)){var t=this.tryParse(function(e){var a=n.tsParseTypeOrTypePredicateAnnotation(10);return!n.canInsertSemicolon()&&n.match(15)||e(),a});if(t.aborted)return;t.thrown||(t.error&&(this.state=t.failState),a.returnType=t.node)}return e.prototype.parseArrow.call(this,a)},n.parseFunctionParamType=function(e){this.eat(13)&&(e.optional=!0);var a=this.tsTryParseTypeAnnotation();return a&&(e.typeAnnotation=a),this.resetEndLocation(e),e},n.isAssignable=function(a,n){switch(a.type){case"TSTypeCastExpression":return this.isAssignable(a.expression,n);case"TSParameterProperty":return!0;default:return e.prototype.isAssignable.call(this,a,n)}},n.toAssignable=function(a,n){switch(void 0===n&&(n=!1),a.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(a,n);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":n?this.expressionScope.recordArrowParameterBindingError(fb.UnexpectedTypeCastInParameter,a):this.raise(fb.UnexpectedTypeCastInParameter,a),this.toAssignable(a.expression,n);break;case"AssignmentExpression":n||"TSTypeCastExpression"!==a.left.type||(a.left=this.typeCastToParameter(a.left));default:e.prototype.toAssignable.call(this,a,n)}},n.toAssignableParenthesizedExpression=function(a,n){switch(a.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(a.expression,n);break;default:e.prototype.toAssignable.call(this,a,n)}},n.checkToRestConversion=function(a,n){switch(a.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(a.expression,!1);break;default:e.prototype.checkToRestConversion.call(this,a,n)}},n.isValidLVal=function(a,n,t,r){switch(a){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(r!==Cy||!t)&&["expression",!0];default:return e.prototype.isValidLVal.call(this,a,n,t,r)}},n.parseBindingAtom=function(){return 74===this.state.type?this.parseIdentifier(!0):e.prototype.parseBindingAtom.call(this)},n.parseMaybeDecoratorArguments=function(a,n){if(this.match(43)||this.match(47)){var t=this.tsParseTypeArgumentsInExpression();if(this.match(6)){var r=e.prototype.parseMaybeDecoratorArguments.call(this,a,n);return r.typeArguments=t,r}this.unexpected(null,6)}return e.prototype.parseMaybeDecoratorArguments.call(this,a,n)},n.checkCommaAfterRest=function(a){return this.state.isAmbientContext&&this.match(8)&&this.lookaheadCharCode()===a?(this.next(),!1):e.prototype.checkCommaAfterRest.call(this,a)},n.isClassMethod=function(){return this.match(43)||e.prototype.isClassMethod.call(this)},n.isClassProperty=function(){return this.match(31)||this.match(10)||e.prototype.isClassProperty.call(this)},n.parseMaybeDefault=function(a,n){var t=e.prototype.parseMaybeDefault.call(this,a,n);return"AssignmentPattern"===t.type&&t.typeAnnotation&&t.right.startthis.offsetToSourcePos(this.state.lastTokEndLoc.index)&&this.raise(Cb.UnexpectedSpace,this.state.lastTokEndLoc)},l(a)}(e)}},Db=Object.keys(_b),kb=function(e){function a(a,n,t){var r,i=function(e){var a={sourceType:"script",sourceFilename:void 0,startIndex:0,startColumn:0,startLine:1,allowAwaitOutsideFunction:!1,allowReturnOutsideFunction:!1,allowNewTargetOutsideFunction:!1,allowImportExportEverywhere:!1,allowSuperOutsideMethod:!1,allowUndeclaredExports:!1,allowYieldOutsideFunction:!1,plugins:[],strictMode:void 0,ranges:!1,locations:!0,tokens:!1,createImportExpressions:!0,createParenthesizedExpressions:!1,errorRecovery:!1,attachComment:!0,annexB:!0};if(null==e)return a;if(null!=e.annexB&&!1!==e.annexB)throw new Error("The `annexB` option can only be set to `false`.");for(var n=0,t=Object.keys(a);n0?a.startIndex=a.startColumn:null==e.startColumn&&a.startIndex>0&&(a.startColumn=a.startIndex);else if(null==e.startColumn||null==e.startIndex)throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");if("commonjs"===a.sourceType){if(null!=e.allowAwaitOutsideFunction)throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");if(null!=e.allowReturnOutsideFunction)throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");if(null!=e.allowNewTargetOutsideFunction)throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.")}return a}(a);(r=e.call(this,i,n)||this).options=i,r.initializeScopes(),r.plugins=t,r.filename=i.sourceFilename,r.startIndex=i.startIndex;var o=0;return i.allowAwaitOutsideFunction&&(o|=Km),i.allowReturnOutsideFunction&&(o|=zm),i.allowImportExportEverywhere&&(o|=Xm),i.allowSuperOutsideMethod&&(o|=Ym),i.allowUndeclaredExports&&(o|=Qm),i.allowNewTargetOutsideFunction&&(o|=Jm),i.allowYieldOutsideFunction&&(o|=$m),i.ranges&&(o|=Zm),!0===i.locations&&(o|=eR),i.tokens&&(o|=aR),i.createImportExpressions&&(o|=nR),i.createParenthesizedExpressions&&(o|=tR),i.errorRecovery&&(o|=rR),i.attachComment&&(o|=iR),i.annexB&&(o|=oR),r.optionFlags=o,r}h(a,e);var n=a.prototype;return n.getScopeHandler=function(){return Gy},n.parse=function(){this.enterInitialScopes();var e=this.startNode(),a=this.startNode();this.nextToken(),e.errors=[];var n=this.parseTopLevel(e,a);return n.errors=this.state.errors,n.comments.length=this.state.commentsLen,n},l(a)}(lb);function Ib(e,a){var n;if("unambiguous"!==(null==(n=a)?void 0:n.sourceType))return Bb(a,e).parse();a=Object.assign({},a);try{a.sourceType="module";var t=Bb(a,e),r=t.parse();if(t.sawUnambiguousESM)return r;if(t.ambiguousScriptDifferentAst)try{return a.sourceType="script",Bb(a,e).parse()}catch(e){}else r.program.sourceType="script";return r}catch(n){try{return a.sourceType="script",Bb(a,e).parse()}catch(e){}throw n}}var Nb=function(e){for(var a={},n=0,t=Object.keys(e);n=e.length)throw new Error("Position "+a+" is out of bounds for location data.");return e[2*a+1]},getLine:function(e,a){if(a<0||2*a>=e.length)throw new Error("Position "+a+" is out of bounds for location data.");return e[2*a]},parse:Ib,parseExpression:function(e,a){var n=Bb(a,e);return n.options.strictMode&&(n.state.strict=!0),n.getExpression()},tokTypes:Nb}),Fb=/\r\n|[\n\r\u2028\u2029]/;function Mb(e,a,n,t){void 0===n&&(n={});var r={defs:{gutter:String,marker:String,message:String,reset:String},highlight:String},i=r.defs,o=r.highlight,s=(n.startLine||1)-1,d=function(e,a,n,t){var r=Object.assign({column:null,line:-1},e.start),i=Object.assign({},r,e.end),o=n||{},s=o.linesAbove,d=void 0===s?2:s,u=o.linesBelow,c=void 0===u?3:u,l=r.line-t,p=r.column,g=i.line-t,f=i.column,h=Math.max(l-(d+1),0),m=Math.min(a.length,g+c);-1===l&&(h=0),-1===g&&(m=a.length);var R=g-l,y={};if(R)for(var v=0;v<=R;v++){var b=v+l;if(null==p)y[b]=!0;else if(0===v){var x=a[b-1].length;y[b]=[p,x-p]}else if(v===R)y[b]=[0,f];else{var E=a[b-1].length;y[b]=[0,E]}}else if(p===f)y[l]=null==p||[p,0];else{var S=null!=p?p:0,T=null!=f?f:S;y[l]=[S,T-S]}return{start:h,end:m,markerLines:y}}(a,e.split(Fb),n,s),u=d.start,c=d.end,l=d.markerLines,p=a.start&&"number"==typeof a.start.column,g=String(c+s).length,f=o(e).split(Fb,c).slice(u,c).map(function(e,a){var t=u+1+a,r=" "+(" "+(t+s)).slice(-g)+" |",o=l[t],d=!l[t+1];if(o){var c="";if(Array.isArray(o)){var p=e.slice(0,o[0]).replace(/[^\t]/g," "),f=o[1]||1;c=["\n ",i.gutter(r.replace(/\d/g," "))," ",p,i.marker("^").repeat(f)].join(""),d&&n.message&&(c+=" "+i.message(n.message))}return[i.marker(">"),i.gutter(r),e.length>0?" "+e:"",c].join("")}return" "+i.gutter(r)+(e.length>0?" "+e:"")}).join("\n");return n.message&&!p&&(f=""+" ".repeat(g+1)+n.message+"\n"+f),i.reset(f)}function Lb(e,a,n){return void 0===n&&(n={}),Mb(e,a,n)}var Ub=B,qb=F,Wb=La,Vb=W,Gb=da,Hb=$,Kb=fa,zb=Oa,Jb=H,Xb=Yh,Yb=sm,$b=/^[_$A-Z0-9]+$/;function Qb(e,a,n){var t=n.placeholderAllowlist,r=n.placeholderPattern,i=n.preserveComments,o=void 0!==i&&i,s=n.syntacticPlaceholders,d=function(e,a,n){var t=(a.plugins||[]).slice();!1!==n&&t.push("placeholders");a=Object.assign({allowAwaitOutsideFunction:!0,allowReturnOutsideFunction:!0,allowNewTargetOutsideFunction:!0,allowSuperOutsideMethod:!0,allowYieldOutsideFunction:!0,sourceType:"module"},a,{plugins:t});try{return Ib(e,a)}catch(a){var r=a.loc;throw r&&(a.message+="\n"+Lb(e,{start:r}),a.code="BABEL_TEMPLATE_PARSE_ERROR"),a}}(a,n.parser,s);Xb(d,{preserveComments:o}),e.validate(d);var u={syntactic:{placeholders:[],placeholderNames:new Set},legacy:{placeholders:[],placeholderNames:new Set},placeholderAllowlist:t,placeholderPattern:r,syntacticPlaceholders:s};return Yb(d,Zb,u),Object.assign({ast:d},u.syntactic.placeholders.length?u.syntactic:u.legacy)}function Zb(e,a,n){var t,r,i=n.syntactic.placeholders.length>0;if(Kb(e)){if(!1===n.syntacticPlaceholders)throw new Error("%%foo%%-style placeholders can't be used when '.syntacticPlaceholders' is false.");r=e.name.name,i=!0}else{if(i||n.syntacticPlaceholders)return;if(Vb(e)||Gb(e))r=e.name;else{if(!Jb(e))return;r=e.value}}if(i&&(null!=n.placeholderPattern||null!=n.placeholderAllowlist))throw new Error("'.placeholderAllowlist' and '.placeholderPattern' aren't compatible with '.syntacticPlaceholders: true'");if(i||!1!==n.placeholderPattern&&(n.placeholderPattern||$b).test(r)||null!=(t=n.placeholderAllowlist)&&t.has(r)){var o,s=(a=a.slice())[a.length-1],d=s.node,u=s.key;Jb(e)||Kb(e,{expectedNode:"StringLiteral"})?o="string":Hb(d)&&"arguments"===u||Ub(d)&&"arguments"===u||Wb(d)&&"params"===u?o="param":qb(d)&&!Kb(e)?(o="statement",a=a.slice(0,-1)):o=zb(e)&&Kb(e)?"statement":"other";var c=i?n.syntactic:n.legacy,l=c.placeholders,p=c.placeholderNames;l.push({name:r,type:o,resolve:function(e){return function(e,a){for(var n=e,t=0;t1?t-1:0),o=1;o1)throw new Error("Unexpected extra params.");return fx(cx(e,a,Cm(r,Pm(i[0]))))}if(Array.isArray(a)){var s=n.get(a);return s||(s=lx(e,a,r),n.set(a,s)),fx(s(i))}if("object"==typeof a&&a){if(i.length>0)throw new Error("Unexpected extra params.");return gx(e,Cm(r,Pm(a)))}throw new Error("Unexpected template param "+typeof a)},{ast:function(a){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o1)throw new Error("Unexpected extra params.");return cx(e,a,Cm(Cm(r,Pm(i[0])),px))()}if(Array.isArray(a)){var s=t.get(a);return s||(s=lx(e,a,Cm(r,px)),t.set(a,s)),s(i)()}throw new Error("Unexpected template param "+typeof a)}})}function fx(e){var a=new Error;return function(n){try{return e(n)}catch(e){throw e.stack+="\n =============\n"+a.stack.split("\n").slice(3).join("\n"),e}}}var hx=gx(xm),mx=gx(Sm),Rx=gx(Em),yx=gx(Tm),vx=gx({code:function(e){return e},validate:function(){},unwrap:function(e){return e.program}}),bx=Object.assign(hx.bind(void 0),{smart:hx,statement:mx,statements:Rx,expression:yx,program:vx,ast:hx.ast}),xx=Object.freeze({__proto__:null,default:bx,expression:yx,program:vx,smart:hx,statement:mx,statements:Rx});function Ex(e,a,n){return Object.freeze({minVersion:e,ast:function(){return bx.program.ast(a,{preserveComments:!0})},metadata:n})}var Sx={__proto__:null,OverloadYield:Ex("7.18.14","function _OverloadYield(e,d){this.v=e,this.k=d}",{globals:[],locals:{_OverloadYield:["body.0.id"]},exportBindingAssignments:[],exportName:"_OverloadYield",dependencies:{},internal:!1}),applyDecoratedDescriptor:Ex("7.0.0-beta.0",'function _applyDecoratedDescriptor(i,e,r,n,l){var a={};return Object.keys(n).forEach(function(i){a[i]=n[i]}),a.enumerable=!!a.enumerable,a.configurable=!!a.configurable,("value"in a||a.initializer)&&(a.writable=!0),a=r.slice().reverse().reduce(function(r,n){return n(i,e,r)||r},a),l&&void 0!==a.initializer&&(a.value=a.initializer?a.initializer.call(l):void 0,a.initializer=void 0),void 0===a.initializer?(Object.defineProperty(i,e,a),null):a}',{globals:["Object"],locals:{_applyDecoratedDescriptor:["body.0.id"]},exportBindingAssignments:[],exportName:"_applyDecoratedDescriptor",dependencies:{},internal:!1}),applyDecs2311:Ex("7.24.0",'function applyDecs2311(e,t,n,r,o,i){var a,c,u,s,f,l,p,d=Symbol.metadata||Symbol.for("Symbol.metadata"),m=Object.defineProperty,h=Object.create,y=[h(null),h(null)],v=t.length;function g(t,n,r){return function(o,i){n&&(i=o,o=e);for(var a=0;a=0;O-=n?2:1){var T=b(h[O],"A decorator","be",!0),z=n?h[O-1]:void 0,A={},H={kind:["field","accessor","method","getter","setter","class"][o],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw new TypeError("attempted to call addInitializer after decoration was finished");b(t,"An initializer","be",!0),i.push(t)}.bind(null,A)};if(w)c=T.call(z,N,H),A.v=1,b(c,"class decorators","return")&&(N=c);else if(H.static=s,H.private=f,c=H.access={has:f?p.bind():function(e){return r in e}},j||(c.get=f?E?function(e){return d(e),P.value}:I("get",0,d):function(e){return e[r]}),E||S||(c.set=f?I("set",0,d):function(e,t){e[r]=t}),N=T.call(z,D?{get:P.get,set:P.set}:P[F],H),A.v=1,D){if("object"==typeof N&&N)(c=b(N.get,"accessor.get"))&&(P.get=c),(c=b(N.set,"accessor.set"))&&(P.set=c),(c=b(N.init,"accessor.init"))&&k.unshift(c);else if(void 0!==N)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else b(N,(l?"field":"method")+" decorators","return")&&(l?k.unshift(N):P[F]=N)}return o<2&&u.push(g(k,s,1),g(i,s,0)),l||w||(f?D?u.splice(-1,0,I("get",s),I("set",s)):u.push(E?P[F]:b.call.bind(P[F])):m(e,r,P)),N}function w(e){return m(e,d,{configurable:!0,enumerable:!0,value:a})}return void 0!==i&&(a=i[d]),a=h(null==a?null:a),f=[],l=function(e){e&&f.push(g(e))},p=function(t,r){for(var i=0;ir.length)&&(a=r.length);for(var e=0,n=Array(a);e=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(r){throw r},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return a=r.done,r},e:function(r){u=!0,o=r},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}',{globals:["Symbol","Array","TypeError"],locals:{_createForOfIteratorHelper:["body.0.id"]},exportBindingAssignments:[],exportName:"_createForOfIteratorHelper",dependencies:{unsupportedIterableToArray:["body.0.body.body.1.consequent.body.0.test.left.right.right.callee"]},internal:!1}),createForOfIteratorHelperLoose:Ex("7.9.0",'function _createForOfIteratorHelperLoose(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=unsupportedIterableToArray(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}',{globals:["Symbol","Array","TypeError"],locals:{_createForOfIteratorHelperLoose:["body.0.id"]},exportBindingAssignments:[],exportName:"_createForOfIteratorHelperLoose",dependencies:{unsupportedIterableToArray:["body.0.body.body.2.test.left.right.right.callee"]},internal:!1}),createSuper:Ex("7.9.0","function _createSuper(t){var r=isNativeReflectConstruct();return function(){var e,o=getPrototypeOf(t);if(r){var s=getPrototypeOf(this).constructor;e=Reflect.construct(o,arguments,s)}else e=o.apply(this,arguments);return possibleConstructorReturn(this,e)}}",{globals:["Reflect"],locals:{_createSuper:["body.0.id"]},exportBindingAssignments:[],exportName:"_createSuper",dependencies:{getPrototypeOf:["body.0.body.body.1.argument.body.body.0.declarations.1.init.callee","body.0.body.body.1.argument.body.body.1.consequent.body.0.declarations.0.init.object.callee"],isNativeReflectConstruct:["body.0.body.body.0.declarations.0.init.callee"],possibleConstructorReturn:["body.0.body.body.1.argument.body.body.2.argument.callee"]},internal:!1}),defaults:Ex("7.0.0-beta.0","function _defaults(e,r){for(var t=Object.getOwnPropertyNames(r),o=0;o1){for(var t=Array(n),f=0;f3?(o=l===n)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&dn||n>l)&&(i[4]=r,i[5]=n,G.n=l,c=0))}if(o||r>1)return a;throw y=!0,n}return function(o,p,l){if(f>1)throw TypeError("Generator is already running");for(y&&1===p&&d(p,l),c=p,u=l;(t=c<2?e:u)||!y;){i||(c?c<3?(c>1&&(G.n=-1),d(c,u)):G.n=u:G.v=u);try{if(f=2,i){if(c||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=i.return)&&t.call(i),c<2&&(u=TypeError("The iterator does not provide a \'"+o+"\' method"),c=1);i=e}else if((t=(y=G.n<0)?u:r.call(n,G))!==a)break}catch(t){i=e,c=1,u=t}finally{f=1}}return{value:t,done:y}}}(r,o,i),!0),u}var a={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}t=Object.getPrototypeOf;var c=[][n]?t(t([][n]())):(define(t={},n,function(){return this}),t),u=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,GeneratorFunctionPrototype):(e.__proto__=GeneratorFunctionPrototype,define(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(u,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName="GeneratorFunction",define(GeneratorFunctionPrototype,o,"GeneratorFunction"),define(u),define(u,o,"Generator"),define(u,n,function(){return this}),define(u,"toString",function(){return"[object Generator]"}),(_regenerator=function(){return{w:i,m:f}})()}',{globals:["Symbol","Object","TypeError"],locals:{_regenerator:["body.0.id","body.0.body.body.9.argument.expressions.9.callee.left"]},exportBindingAssignments:["body.0.body.body.9.argument.expressions.9.callee"],exportName:"_regenerator",dependencies:{regeneratorDefine:["body.0.body.body.1.body.body.1.argument.expressions.0.callee","body.0.body.body.7.declarations.0.init.alternate.expressions.0.callee","body.0.body.body.8.body.body.0.argument.expressions.0.alternate.expressions.1.callee","body.0.body.body.9.argument.expressions.1.callee","body.0.body.body.9.argument.expressions.2.callee","body.0.body.body.9.argument.expressions.4.callee","body.0.body.body.9.argument.expressions.5.callee","body.0.body.body.9.argument.expressions.6.callee","body.0.body.body.9.argument.expressions.7.callee","body.0.body.body.9.argument.expressions.8.callee"]},internal:!1}),regeneratorAsync:Ex("7.27.0","function _regeneratorAsync(n,e,r,t,o){var a=asyncGen(n,e,r,t,o);return a.next().then(function(n){return n.done?n.value:a.next()})}",{globals:[],locals:{_regeneratorAsync:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorAsync",dependencies:{regeneratorAsyncGen:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),regeneratorAsyncGen:Ex("7.27.0","function _regeneratorAsyncGen(r,e,t,o,n){return new regeneratorAsyncIterator(regenerator().w(r,e,t,o),n||Promise)}",{globals:["Promise"],locals:{_regeneratorAsyncGen:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorAsyncGen",dependencies:{regenerator:["body.0.body.body.0.argument.arguments.0.callee.object.callee"],regeneratorAsyncIterator:["body.0.body.body.0.argument.callee"]},internal:!1}),regeneratorAsyncIterator:Ex("7.27.0",'function AsyncIterator(t,e){function n(r,o,i,f){try{var c=t[r](o),u=c.value;return u instanceof OverloadYield?e.resolve(u.v).then(function(t){n("next",t,i,f)},function(t){n("throw",t,i,f)}):e.resolve(u).then(function(t){c.value=t,i(c)},function(t){return n("throw",t,i,f)})}catch(t){f(t)}}var r;this.next||(define(AsyncIterator.prototype),define(AsyncIterator.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),define(this,"_invoke",function(t,o,i){function f(){return new e(function(e,r){n(t,i,e,r)})}return r=r?r.then(f,f):f()},!0)}',{globals:["Symbol"],locals:{AsyncIterator:["body.0.id","body.0.body.body.2.expression.expressions.0.right.expressions.0.arguments.0.object","body.0.body.body.2.expression.expressions.0.right.expressions.1.arguments.0.object"]},exportBindingAssignments:[],exportName:"AsyncIterator",dependencies:{OverloadYield:["body.0.body.body.0.body.body.0.block.body.1.argument.test.right"],regeneratorDefine:["body.0.body.body.2.expression.expressions.0.right.expressions.0.callee","body.0.body.body.2.expression.expressions.0.right.expressions.1.callee","body.0.body.body.2.expression.expressions.1.callee"]},internal:!0}),regeneratorDefine:Ex("7.27.0",'function regeneratorDefine(e,r,n,t){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}regeneratorDefine=function(e,r,n,t){function o(r,n){regeneratorDefine(e,r,function(e){return this._invoke(r,n,e)})}r?i?i(e,r,{value:n,enumerable:!t,configurable:!t,writable:!t}):e[r]=n:(o("next",0),o("throw",1),o("return",2))},regeneratorDefine(e,r,n,t)}',{globals:["Object"],locals:{regeneratorDefine:["body.0.id","body.0.body.body.2.expression.expressions.0.right.body.body.0.body.body.0.expression.callee","body.0.body.body.2.expression.expressions.1.callee","body.0.body.body.2.expression.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.2.expression.expressions.0"],exportName:"regeneratorDefine",dependencies:{},internal:!0}),regeneratorKeys:Ex("7.27.0","function _regeneratorKeys(e){var n=Object(e),r=[];for(var t in n)r.unshift(t);return function e(){for(;r.length;)if((t=r.pop())in n)return e.value=t,e.done=!1,e;return e.done=!0,e}}",{globals:["Object"],locals:{_regeneratorKeys:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorKeys",dependencies:{},internal:!1}),regeneratorValues:Ex("7.18.0",'function _regeneratorValues(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}throw new TypeError(typeof e+" is not iterable")}',{globals:["Symbol","isNaN","TypeError"],locals:{_regeneratorValues:["body.0.id"]},exportBindingAssignments:[],exportName:"_regeneratorValues",dependencies:{},internal:!1}),set:Ex("7.0.0-beta.0",'function set(e,r,t,o){return set="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(e,r,t,o){var f,i=superPropBase(e,r);if(i){if((f=Object.getOwnPropertyDescriptor(i,r)).set)return f.set.call(o,t),!0;if(!f.writable)return!1}if(f=Object.getOwnPropertyDescriptor(o,r)){if(!f.writable)return!1;f.value=t,Object.defineProperty(o,r,f)}else defineProperty(o,r,t);return!0},set(e,r,t,o)}function _set(e,r,t,o,f){if(!set(e,r,t,o||e)&&f)throw new TypeError("failed to set property");return t}',{globals:["Reflect","Object","TypeError"],locals:{set:["body.0.id","body.0.body.body.0.argument.expressions.1.callee","body.1.body.body.0.test.left.argument.callee","body.0.body.body.0.argument.expressions.0.left"],_set:["body.1.id"]},exportBindingAssignments:[],exportName:"_set",dependencies:{superPropBase:["body.0.body.body.0.argument.expressions.0.right.alternate.body.body.0.declarations.1.init.callee"],defineProperty:["body.0.body.body.0.argument.expressions.0.right.alternate.body.body.2.alternate.expression.callee"]},internal:!1}),setFunctionName:Ex("7.23.6",'function setFunctionName(e,t,n){"symbol"==typeof t&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:n?n+" "+t:t})}catch(e){}return e}',{globals:["Object"],locals:{setFunctionName:["body.0.id"]},exportBindingAssignments:[],exportName:"setFunctionName",dependencies:{},internal:!1}),setPrototypeOf:Ex("7.0.0-beta.0","function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},_setPrototypeOf(t,e)}",{globals:["Object"],locals:{_setPrototypeOf:["body.0.id","body.0.body.body.0.argument.expressions.1.callee","body.0.body.body.0.argument.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.0.argument.expressions.0"],exportName:"_setPrototypeOf",dependencies:{},internal:!1}),skipFirstGeneratorNext:Ex("7.0.0-beta.0","function _skipFirstGeneratorNext(t){return function(){var r=t.apply(this,arguments);return r.next(),r}}",{globals:[],locals:{_skipFirstGeneratorNext:["body.0.id"]},exportBindingAssignments:[],exportName:"_skipFirstGeneratorNext",dependencies:{},internal:!1}),slicedToArray:Ex("7.0.0-beta.0","function _slicedToArray(r,e){return arrayWithHoles(r)||iterableToArrayLimit(r,e)||unsupportedIterableToArray(r,e)||nonIterableRest()}",{globals:[],locals:{_slicedToArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_slicedToArray",dependencies:{arrayWithHoles:["body.0.body.body.0.argument.left.left.left.callee"],iterableToArrayLimit:["body.0.body.body.0.argument.left.left.right.callee"],unsupportedIterableToArray:["body.0.body.body.0.argument.left.right.callee"],nonIterableRest:["body.0.body.body.0.argument.right.callee"]},internal:!1}),superPropBase:Ex("7.0.0-beta.0","function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=getPrototypeOf(t)););return t}",{globals:[],locals:{_superPropBase:["body.0.id"]},exportBindingAssignments:[],exportName:"_superPropBase",dependencies:{getPrototypeOf:["body.0.body.body.0.test.right.right.right.callee"]},internal:!1}),superPropGet:Ex("7.25.0",'function _superPropGet(t,o,e,r){var p=get(getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t)}:p}',{globals:[],locals:{_superPropGet:["body.0.id"]},exportBindingAssignments:[],exportName:"_superPropGet",dependencies:{get:["body.0.body.body.0.declarations.0.init.callee"],getPrototypeOf:["body.0.body.body.0.declarations.0.init.arguments.0.callee"]},internal:!1}),superPropSet:Ex("7.25.0","function _superPropSet(t,e,o,r,p,f){return set(getPrototypeOf(f?t.prototype:t),e,o,r,p)}",{globals:[],locals:{_superPropSet:["body.0.id"]},exportBindingAssignments:[],exportName:"_superPropSet",dependencies:{set:["body.0.body.body.0.argument.callee"],getPrototypeOf:["body.0.body.body.0.argument.arguments.0.callee"]},internal:!1}),taggedTemplateLiteral:Ex("7.0.0-beta.0","function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}",{globals:["Object"],locals:{_taggedTemplateLiteral:["body.0.id"]},exportBindingAssignments:[],exportName:"_taggedTemplateLiteral",dependencies:{},internal:!1}),taggedTemplateLiteralLoose:Ex("7.0.0-beta.0","function _taggedTemplateLiteralLoose(e,t){return t||(t=e.slice(0)),e.raw=t,e}",{globals:[],locals:{_taggedTemplateLiteralLoose:["body.0.id"]},exportBindingAssignments:[],exportName:"_taggedTemplateLiteralLoose",dependencies:{},internal:!1}),tdz:Ex("7.5.5",'function _tdzError(e){throw new ReferenceError(e+" is not defined - temporal dead zone")}',{globals:["ReferenceError"],locals:{_tdzError:["body.0.id"]},exportBindingAssignments:[],exportName:"_tdzError",dependencies:{},internal:!1}),temporalRef:Ex("7.0.0-beta.0","function _temporalRef(r,e){return r===undef?err(e):r}",{globals:[],locals:{_temporalRef:["body.0.id"]},exportBindingAssignments:[],exportName:"_temporalRef",dependencies:{temporalUndefined:["body.0.body.body.0.argument.test.right"],tdz:["body.0.body.body.0.argument.consequent.callee"]},internal:!1}),temporalUndefined:Ex("7.0.0-beta.0","function _temporalUndefined(){}",{globals:[],locals:{_temporalUndefined:["body.0.id"]},exportBindingAssignments:[],exportName:"_temporalUndefined",dependencies:{},internal:!1}),toArray:Ex("7.0.0-beta.0","function _toArray(r){return arrayWithHoles(r)||iterableToArray(r)||unsupportedIterableToArray(r)||nonIterableRest()}",{globals:[],locals:{_toArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_toArray",dependencies:{arrayWithHoles:["body.0.body.body.0.argument.left.left.left.callee"],iterableToArray:["body.0.body.body.0.argument.left.left.right.callee"],unsupportedIterableToArray:["body.0.body.body.0.argument.left.right.callee"],nonIterableRest:["body.0.body.body.0.argument.right.callee"]},internal:!1}),toConsumableArray:Ex("7.0.0-beta.0","function _toConsumableArray(r){return arrayWithoutHoles(r)||iterableToArray(r)||unsupportedIterableToArray(r)||nonIterableSpread()}",{globals:[],locals:{_toConsumableArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_toConsumableArray",dependencies:{arrayWithoutHoles:["body.0.body.body.0.argument.left.left.left.callee"],iterableToArray:["body.0.body.body.0.argument.left.left.right.callee"],unsupportedIterableToArray:["body.0.body.body.0.argument.left.right.callee"],nonIterableSpread:["body.0.body.body.0.argument.right.callee"]},internal:!1}),toPrimitive:Ex("7.1.5",'function toPrimitive(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}',{globals:["Symbol","TypeError","String","Number"],locals:{toPrimitive:["body.0.id"]},exportBindingAssignments:[],exportName:"toPrimitive",dependencies:{},internal:!1}),toPropertyKey:Ex("7.1.5",'function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==typeof i?i:i+""}',{globals:[],locals:{toPropertyKey:["body.0.id"]},exportBindingAssignments:[],exportName:"toPropertyKey",dependencies:{toPrimitive:["body.0.body.body.0.declarations.0.init.callee"]},internal:!1}),toSetter:Ex("7.24.0",'function _toSetter(t,e,n){e||(e=[]);var r=e.length++;return Object.defineProperty({},"_",{set:function(o){e[r]=o,t.apply(n,e)}})}',{globals:["Object"],locals:{_toSetter:["body.0.id"]},exportBindingAssignments:[],exportName:"_toSetter",dependencies:{},internal:!1}),tsRewriteRelativeImportExtensions:Ex("7.27.0",'function tsRewriteRelativeImportExtensions(t,e){return"string"==typeof t&&/^\\.\\.?\\//.test(t)?t.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+)?)\\.([cm]?)ts$/i,function(t,s,r,n,o){return s?e?".jsx":".js":!r||n&&o?r+n+"."+o.toLowerCase()+"js":t}):t}',{globals:[],locals:{tsRewriteRelativeImportExtensions:["body.0.id"]},exportBindingAssignments:[],exportName:"tsRewriteRelativeImportExtensions",dependencies:{},internal:!1}),typeof:Ex("7.0.0-beta.0",'function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}',{globals:["Symbol"],locals:{_typeof:["body.0.id","body.0.body.body.0.argument.expressions.1.callee","body.0.body.body.0.argument.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.0.argument.expressions.0"],exportName:"_typeof",dependencies:{},internal:!1}),unsupportedIterableToArray:Ex("7.9.0",'function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?arrayLikeToArray(r,a):void 0}}',{globals:["Array"],locals:{_unsupportedIterableToArray:["body.0.id"]},exportBindingAssignments:[],exportName:"_unsupportedIterableToArray",dependencies:{arrayLikeToArray:["body.0.body.body.0.consequent.body.0.consequent.argument.callee","body.0.body.body.0.consequent.body.2.argument.expressions.1.alternate.consequent.callee"]},internal:!1}),usingCtx:Ex("7.23.9",'function _usingCtx(){var r="function"==typeof SuppressedError?SuppressedError:function(r,e){var n=Error();return n.name="SuppressedError",n.error=r,n.suppressed=e,n},e={},n=[];function using(r,e){if(null!=e){if(Object(e)!==e)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(r)var o=e[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(void 0===o&&(o=e[Symbol.dispose||Symbol.for("Symbol.dispose")],r))var t=o;if("function"!=typeof o)throw new TypeError("Object is not disposable.");t&&(o=function(){try{t.call(e)}catch(r){return Promise.reject(r)}}),n.push({v:e,d:o,a:r})}else r&&n.push({d:e,a:r});return e}return{e:e,u:using.bind(null,!1),a:using.bind(null,!0),d:function(){var o,t=this.e,s=0;function next(){for(;o=n.pop();)try{if(!o.a&&1===s)return s=0,n.push(o),Promise.resolve().then(next);if(o.d){var r=o.d.call(o.v);if(o.a)return s|=2,Promise.resolve(r).then(next,err)}else s|=1}catch(r){return err(r)}if(1===s)return t!==e?Promise.reject(t):Promise.resolve();if(t!==e)throw t}function err(n){return t=t!==e?new r(n,t):n,next()}return next()}}}',{globals:["SuppressedError","Error","Object","TypeError","Symbol","Promise"],locals:{_usingCtx:["body.0.id"]},exportBindingAssignments:[],exportName:"_usingCtx",dependencies:{},internal:!1}),wrapAsyncGenerator:Ex("7.0.0-beta.0",'function _wrapAsyncGenerator(e){return function(){return new AsyncGenerator(e.apply(this,arguments))}}function AsyncGenerator(e){var t,n;function resume(t,n){try{var r=e[t](n),o=r.value,u=o instanceof OverloadYield;Promise.resolve(u?o.v:o).then(function(n){if(u){var i="return"===t&&o.k?t:"next";if(!o.k||n.done)return resume(i,n);n=e[i](n).value}settle(!!r.done,n)},function(e){resume("throw",e)})}catch(e){settle(2,e)}}function settle(e,r){2===e?t.reject(r):t.resolve({value:r,done:e}),(t=t.next)?resume(t.key,t.arg):n=null}this._invoke=function(e,r){return new Promise(function(o,u){var i={key:e,arg:r,resolve:o,reject:u,next:null};n?n=n.next=i:(t=n=i,resume(e,r))})},"function"!=typeof e.return&&(this.return=void 0)}AsyncGenerator.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},AsyncGenerator.prototype.next=function(e){return this._invoke("next",e)},AsyncGenerator.prototype.throw=function(e){return this._invoke("throw",e)},AsyncGenerator.prototype.return=function(e){return this._invoke("return",e)};',{globals:["Promise","Symbol"],locals:{_wrapAsyncGenerator:["body.0.id"],AsyncGenerator:["body.1.id","body.0.body.body.0.argument.body.body.0.argument.callee","body.2.expression.expressions.0.left.object.object","body.2.expression.expressions.1.left.object.object","body.2.expression.expressions.2.left.object.object","body.2.expression.expressions.3.left.object.object"]},exportBindingAssignments:[],exportName:"_wrapAsyncGenerator",dependencies:{OverloadYield:["body.1.body.body.1.body.body.0.block.body.0.declarations.2.init.right"]},internal:!1}),wrapNativeSuper:Ex("7.0.0-beta.0",'function _wrapNativeSuper(t){var r="function"==typeof Map?new Map:void 0;return _wrapNativeSuper=function(t){if(null===t||!isNativeFunction(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,Wrapper)}function Wrapper(){return construct(t,arguments,getPrototypeOf(this).constructor)}return Wrapper.prototype=Object.create(t.prototype,{constructor:{value:Wrapper,enumerable:!1,writable:!0,configurable:!0}}),setPrototypeOf(Wrapper,t)},_wrapNativeSuper(t)}',{globals:["Map","TypeError","Object"],locals:{_wrapNativeSuper:["body.0.id","body.0.body.body.1.argument.expressions.1.callee","body.0.body.body.1.argument.expressions.0.left"]},exportBindingAssignments:["body.0.body.body.1.argument.expressions.0"],exportName:"_wrapNativeSuper",dependencies:{getPrototypeOf:["body.0.body.body.1.argument.expressions.0.right.body.body.3.body.body.0.argument.arguments.2.object.callee"],setPrototypeOf:["body.0.body.body.1.argument.expressions.0.right.body.body.4.argument.expressions.1.callee"],isNativeFunction:["body.0.body.body.1.argument.expressions.0.right.body.body.0.test.right.argument.callee"],construct:["body.0.body.body.1.argument.expressions.0.right.body.body.3.body.body.0.argument.callee"]},internal:!1}),wrapRegExp:Ex("7.19.0",'function _wrapRegExp(){_wrapRegExp=function(e,r){return new BabelRegExp(e,void 0,r)};var e=RegExp.prototype,r=new WeakMap;function BabelRegExp(e,t,p){var o=RegExp(e,t);return r.set(o,p||r.get(e)),setPrototypeOf(o,BabelRegExp.prototype)}function buildGroups(e,t){var p=r.get(t);return Object.keys(p).reduce(function(r,t){var o=p[t];if("number"==typeof o)r[t]=e[o];else{for(var i=0;void 0===e[o[i]]&&i+1]+)(>|$)/g,function(e,r,t){if(""===t)return e;var p=o[r];return Array.isArray(p)?"$"+p.join("$"):"number"==typeof p?"$"+p:""}))}if("function"==typeof p){var i=this;return e[Symbol.replace].call(this,t,function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(buildGroups(e,i)),p.apply(this,e)})}return e[Symbol.replace].call(this,t,p)},_wrapRegExp.apply(this,arguments)}',{globals:["RegExp","WeakMap","Object","Symbol","Array"],locals:{_wrapRegExp:["body.0.id","body.0.body.body.4.argument.expressions.3.callee.object","body.0.body.body.0.expression.left"]},exportBindingAssignments:["body.0.body.body.0.expression"],exportName:"_wrapRegExp",dependencies:{setPrototypeOf:["body.0.body.body.2.body.body.1.argument.expressions.1.callee"],inherits:["body.0.body.body.4.argument.expressions.0.callee"]},internal:!1}),writeOnlyError:Ex("7.12.13","function _writeOnlyError(r){throw new TypeError('\"'+r+'\" is write-only')}",{globals:["TypeError"],locals:{_writeOnlyError:["body.0.id"]},exportBindingAssignments:[],exportName:"_writeOnlyError",dependencies:{},internal:!1})},Tx=kf,wx=pi;function Cx(e,a,n){try{for(var t=a.split("."),r=t.shift();t.length>0;)e=e[r],r=t.shift();if(!(arguments.length>2))return e[r];e[r]=n}catch(e){throw e.message+=" (when accessing "+a+")",e}}var Px=Object.create(null);function Ax(e){if(!Px[e]){var a=Sx[e];if(!a)throw Object.assign(new ReferenceError("Unknown helper "+e),{code:"BABEL_HELPER_UNKNOWN",helper:e});Px[e]={minVersion:a.minVersion,build:function(e,n,t,r){var i=a.ast();return function(e,a,n,t,r,i){var o=a.locals,s=a.dependencies,d=a.exportBindingAssignments,u=a.exportName,c=new Set(t||[]);n&&c.add(n);for(var l=0,g=Object.entries(o);l1)for(var n=1;n=1e3?(e/1e3).toFixed(1)+"s":e+"ms"},log:lE};function fE(e,a){var n,t=null!==(n=a)&&void 0!==n?n:function(e,a){for(var n=0,t=0;t=11?a+=n-1:n>=9?a+=n-9:n>=1&&(a+=n+1),n++}while(this.hasLabel(a)||this.hasBinding(a)||this.hasGlobal(a)||this.hasReference(a));var t=this.getProgramParent();return t.referencesSet.add(a),t.uidsSet.add(a),a},a.generateUidBasedOnNode=function(e,a){var n=[];dT(e,n);var t=n.join("$");return t=t.replace(/^_/,"")||a||"ref",this.generateUid(t.slice(0,20))},a.generateUidIdentifierBasedOnNode=function(e,a){return SS(this.generateUidBasedOnNode(e,a))},a.isStatic=function(e){if(JS(e)||HS(e)||tT(e))return!0;if(BS(e)){var a=this.getBinding(e.name);return a?a.constant:this.hasBinding(e.name)}return!1},a.maybeGenerateMemoised=function(e,a){if(this.isStatic(e))return null;var n=this.generateUidIdentifierBasedOnNode(e);return a?n:(this.push({id:n}),xS(n))},a.checkBlockScopedCollisions=function(e,a,n,t){if("param"!==a&&("local"!==e.kind&&("let"===a||"let"===e.kind||"const"===e.kind||"module"===e.kind||"param"===e.kind&&"const"===a)))throw this.path.hub.buildError(t,'Duplicate declaration "'+n+'"',TypeError)},a.rename=function(e,a){var n=this.getBinding(e);n&&(a||(a=this.generateUidIdentifier(e).name),new uS(n,e,a).rename())},a.dump=function(){var e="-".repeat(60);console.log(e);var a=this;do{console.log("#",a.block.type);for(var n=0,t=Object.keys(a.bindings);n0)&&this.isPure(e.body,a));if(AS(e)){for(var o,s=p(e.body);!(o=s()).done;){var d=o.value;if(!this.isPure(d,a))return!1}return!0}if(wS(e))return this.isPure(e.left,a)&&this.isPure(e.right,a);if(TS(e)){for(var u,c=p(e.elements);!(u=c()).done;){var l=u.value;if(null!==l&&!this.isPure(l,a))return!1}return!0}if(qS(e)){for(var g,f=p(e.properties);!(g=f()).done;){var h=g.value;if(!this.isPure(h,a))return!1}return!0}if(MS(e))return!(e.computed&&!this.isPure(e.key,a))&&!((null==(r=e.decorators)?void 0:r.length)>0);if(WS(e))return!(e.computed&&!this.isPure(e.key,a))&&(!((null==(i=e.decorators)?void 0:i.length)>0)&&!((nT(e)||e.static)&&null!==e.value&&!this.isPure(e.value,a)));if(XS(e))return this.isPure(e.argument,a);if(zS(e)){for(var m,R=p(e.expressions);!(m=R()).done;){var y=m.value;if(!this.isPure(y,a))return!1}return!0}return KS(e)?QS(e.tag,"String.raw")&&!this.hasBinding("String",{noGlobals:!0})&&this.isPure(e.quasi,a):FS(e)?!e.computed&&BS(e.object)&&"Symbol"===e.object.name&&BS(e.property)&&"for"!==e.property.name&&!this.hasBinding("Symbol",{noGlobals:!0}):CS(e)?QS(e.callee,"Symbol.for")&&!this.hasBinding("Symbol",{noGlobals:!0})&&1===e.arguments.length&&H(e.arguments[0]):VS(e)},a.setData=function(e,a){return this.data[e]=a},a.getData=function(e){var a=this;do{var n=a.data[e];if(null!=n)return n}while(a=a.parent)},a.removeData=function(e){var a=this;do{null!=a.data[e]&&(a.data[e]=null)}while(a=a.parent)},a.init=function(){this.inited||(this.inited=!0,this.crawl())},a.crawl=function(){var e=this.path;uT(this),this.data=Object.create(null);var a=this;do{if(a.crawling)return;if(a.path.isProgram())break}while(a=a.parent);var n=a,t={references:[],constantViolations:[],assignments:[]};if(this.crawling=!0,cT||(cT=aN.visitors.merge([{Scope:function(e){uT(e.scope)}},lT])),"Program"!==e.type){var r=cT[e.type];if(r)for(var i,o=p(r.enter);!(i=o()).done;){i.value.call(t,e,t)}}!function(e,a,n){var t=XE(a);if(t.enter||t.exit)throw new Error("Should not be used with enter/exit visitors.");!function e(a,r,i,o,s,d,u,c){if(i){var l=c||kI.get({hub:u,parentPath:a,parent:r,container:o,listKey:d,key:s});UI.call(l);var g=t[i.type];if(null!=g&&g.enter)for(var f,h=p(g.enter);!(f=h()).done;)f.value.call(n,l,n);if(!l.shouldSkip){var m=cS[i.type];if(null!=m&&m.length){for(var R,y=p(m);!(R=y()).done;){var v=R.value,b=i[v];if(b)if(Array.isArray(b))for(var x=0;x>18&63]+fT[e>>12&63]+fT[e>>6&63]+fT[63&e]}function bT(e,a,n){for(var t,r=[],i=a;id?d:s+o));return 1===t?(a=e[n-1],r+=fT[a>>2],r+=fT[a<<4&63],r+="=="):2===t&&(a=(e[n-2]<<8)+e[n-1],r+=fT[a>>10],r+=fT[a>>4&63],r+=fT[a<<2&63],r+="="),i.push(r),i.join("")}function ET(e,a,n,t,r){var i,o,s=8*r-t-1,d=(1<>1,c=-7,l=n?r-1:0,p=n?-1:1,g=e[a+l];for(l+=p,i=g&(1<<-c)-1,g>>=-c,c+=s;c>0;i=256*i+e[a+l],l+=p,c-=8);for(o=i&(1<<-c)-1,i>>=-c,c+=t;c>0;o=256*o+e[a+l],l+=p,c-=8);if(0===i)i=1-u;else{if(i===d)return o?NaN:1/0*(g?-1:1);o+=Math.pow(2,t),i-=u}return(g?-1:1)*o*Math.pow(2,i-t)}function ST(e,a,n,t,r,i){var o,s,d,u=8*i-r-1,c=(1<>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,g=t?0:i-1,f=t?1:-1,h=a<0||0===a&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(s=isNaN(a)?1:0,o=c):(o=Math.floor(Math.log(a)/Math.LN2),a*(d=Math.pow(2,-o))<1&&(o--,d*=2),(a+=o+l>=1?p/d:p*Math.pow(2,1-l))*d>=2&&(o++,d/=2),o+l>=c?(s=0,o=c):o+l>=1?(s=(a*d-1)*Math.pow(2,r),o+=l):(s=a*Math.pow(2,l-1)*Math.pow(2,r),o=0));r>=8;e[n+g]=255&s,g+=f,s/=256,r-=8);for(o=o<0;e[n+g]=255&o,g+=f,o/=256,u-=8);e[n+g-f]|=128*h}var TT={}.toString,wT=Array.isArray||function(e){return"[object Array]"==TT.call(e)};function CT(){return AT.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function PT(e,a){if(CT()=CT())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+CT().toString(16)+" bytes");return 0|e}function BT(e){return!(null==e||!e._isBuffer)}function OT(e,a){if(BT(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var t=!1;;)switch(a){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return dw(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return uw(e).length;default:if(t)return dw(e).length;a=(""+a).toLowerCase(),t=!0}}function jT(e,a,n){var t=!1;if((void 0===a||a<0)&&(a=0),a>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(a>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return $T(this,a,n);case"utf8":case"utf-8":return zT(this,a,n);case"ascii":return XT(this,a,n);case"latin1":case"binary":return YT(this,a,n);case"base64":return KT(this,a,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return QT(this,a,n);default:if(t)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),t=!0}}function FT(e,a,n){var t=e[a];e[a]=e[n],e[n]=t}function MT(e,a,n,t,r){if(0===e.length)return-1;if("string"==typeof n?(t=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof a&&(a=AT.from(a,t)),BT(a))return 0===a.length?-1:LT(e,a,n,t,r);if("number"==typeof a)return a&=255,AT.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,a,n):Uint8Array.prototype.lastIndexOf.call(e,a,n):LT(e,[a],n,t,r);throw new TypeError("val must be string, number or Buffer")}function LT(e,a,n,t,r){var i,o=1,s=e.length,d=a.length;if(void 0!==t&&("ucs2"===(t=String(t).toLowerCase())||"ucs-2"===t||"utf16le"===t||"utf-16le"===t)){if(e.length<2||a.length<2)return-1;o=2,s/=2,d/=2,n/=2}function u(e,a){return 1===o?e[a]:e.readUInt16BE(a*o)}if(r){var c=-1;for(i=n;is&&(n=s-d),i=n;i>=0;i--){for(var l=!0,p=0;pr&&(t=r):t=r;var i=a.length;if(i%2!=0)throw new TypeError("Invalid hex string");t>i/2&&(t=i/2);for(var o=0;o>8,r=n%256,i.push(r),i.push(t);return i}(a,e.length-n),e,n,t)}function KT(e,a,n){return 0===a&&n===e.length?xT(e):xT(e.slice(a,n))}function zT(e,a,n){n=Math.min(e.length,n);for(var t=[],r=a;r239?4:u>223?3:u>191?2:1;if(r+l<=n)switch(l){case 1:u<128&&(c=u);break;case 2:128==(192&(i=e[r+1]))&&(d=(31&u)<<6|63&i)>127&&(c=d);break;case 3:i=e[r+1],o=e[r+2],128==(192&i)&&128==(192&o)&&(d=(15&u)<<12|(63&i)<<6|63&o)>2047&&(d<55296||d>57343)&&(c=d);break;case 4:i=e[r+1],o=e[r+2],s=e[r+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(d=(15&u)<<18|(63&i)<<12|(63&o)<<6|63&s)>65535&&d<1114112&&(c=d)}null===c?(c=65533,l=1):c>65535&&(c-=65536,t.push(c>>>10&1023|55296),c=56320|1023&c),t.push(c),r+=l}return function(e){var a=e.length;if(a<=JT)return String.fromCharCode.apply(String,e);var n="",t=0;for(;t0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},AT.prototype.compare=function(e,a,n,t,r){if(!BT(e))throw new TypeError("Argument must be a Buffer");if(void 0===a&&(a=0),void 0===n&&(n=e?e.length:0),void 0===t&&(t=0),void 0===r&&(r=this.length),a<0||n>e.length||t<0||r>this.length)throw new RangeError("out of range index");if(t>=r&&a>=n)return 0;if(t>=r)return-1;if(a>=n)return 1;if(this===e)return 0;for(var i=(r>>>=0)-(t>>>=0),o=(n>>>=0)-(a>>>=0),s=Math.min(i,o),d=this.slice(t,r),u=e.slice(a,n),c=0;cr)&&(n=r),e.length>0&&(n<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var i=!1;;)switch(t){case"hex":return UT(this,e,a,n);case"utf8":case"utf-8":return qT(this,e,a,n);case"ascii":return WT(this,e,a,n);case"latin1":case"binary":return VT(this,e,a,n);case"base64":return GT(this,e,a,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return HT(this,e,a,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),i=!0}},AT.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var JT=4096;function XT(e,a,n){var t="";n=Math.min(e.length,n);for(var r=a;rt)&&(n=t);for(var r="",i=a;in)throw new RangeError("Trying to access beyond buffer length")}function ew(e,a,n,t,r,i){if(!BT(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(a>r||ae.length)throw new RangeError("Index out of range")}function aw(e,a,n,t){a<0&&(a=65535+a+1);for(var r=0,i=Math.min(e.length-n,2);r>>8*(t?r:1-r)}function nw(e,a,n,t){a<0&&(a=4294967295+a+1);for(var r=0,i=Math.min(e.length-n,4);r>>8*(t?r:3-r)&255}function tw(e,a,n,t,r,i){if(n+t>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function rw(e,a,n,t,r){return r||tw(e,0,n,4),ST(e,a,n,t,23,4),n+4}function iw(e,a,n,t,r){return r||tw(e,0,n,8),ST(e,a,n,t,52,8),n+8}AT.prototype.slice=function(e,a){var n,t=this.length;if((e=~~e)<0?(e+=t)<0&&(e=0):e>t&&(e=t),(a=void 0===a?t:~~a)<0?(a+=t)<0&&(a=0):a>t&&(a=t),a0&&(r*=256);)t+=this[e+--a]*r;return t},AT.prototype.readUInt8=function(e,a){return a||ZT(e,1,this.length),this[e]},AT.prototype.readUInt16LE=function(e,a){return a||ZT(e,2,this.length),this[e]|this[e+1]<<8},AT.prototype.readUInt16BE=function(e,a){return a||ZT(e,2,this.length),this[e]<<8|this[e+1]},AT.prototype.readUInt32LE=function(e,a){return a||ZT(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},AT.prototype.readUInt32BE=function(e,a){return a||ZT(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},AT.prototype.readIntLE=function(e,a,n){e|=0,a|=0,n||ZT(e,a,this.length);for(var t=this[e],r=1,i=0;++i=(r*=128)&&(t-=Math.pow(2,8*a)),t},AT.prototype.readIntBE=function(e,a,n){e|=0,a|=0,n||ZT(e,a,this.length);for(var t=a,r=1,i=this[e+--t];t>0&&(r*=256);)i+=this[e+--t]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*a)),i},AT.prototype.readInt8=function(e,a){return a||ZT(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},AT.prototype.readInt16LE=function(e,a){a||ZT(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},AT.prototype.readInt16BE=function(e,a){a||ZT(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},AT.prototype.readInt32LE=function(e,a){return a||ZT(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},AT.prototype.readInt32BE=function(e,a){return a||ZT(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},AT.prototype.readFloatLE=function(e,a){return a||ZT(e,4,this.length),ET(this,e,!0,23,4)},AT.prototype.readFloatBE=function(e,a){return a||ZT(e,4,this.length),ET(this,e,!1,23,4)},AT.prototype.readDoubleLE=function(e,a){return a||ZT(e,8,this.length),ET(this,e,!0,52,8)},AT.prototype.readDoubleBE=function(e,a){return a||ZT(e,8,this.length),ET(this,e,!1,52,8)},AT.prototype.writeUIntLE=function(e,a,n,t){(e=+e,a|=0,n|=0,t)||ew(this,e,a,n,Math.pow(2,8*n)-1,0);var r=1,i=0;for(this[a]=255&e;++i=0&&(i*=256);)this[a+r]=e/i&255;return a+n},AT.prototype.writeUInt8=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,1,255,0),AT.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[a]=255&e,a+1},AT.prototype.writeUInt16LE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,2,65535,0),AT.TYPED_ARRAY_SUPPORT?(this[a]=255&e,this[a+1]=e>>>8):aw(this,e,a,!0),a+2},AT.prototype.writeUInt16BE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,2,65535,0),AT.TYPED_ARRAY_SUPPORT?(this[a]=e>>>8,this[a+1]=255&e):aw(this,e,a,!1),a+2},AT.prototype.writeUInt32LE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,4,4294967295,0),AT.TYPED_ARRAY_SUPPORT?(this[a+3]=e>>>24,this[a+2]=e>>>16,this[a+1]=e>>>8,this[a]=255&e):nw(this,e,a,!0),a+4},AT.prototype.writeUInt32BE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,4,4294967295,0),AT.TYPED_ARRAY_SUPPORT?(this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e):nw(this,e,a,!1),a+4},AT.prototype.writeIntLE=function(e,a,n,t){if(e=+e,a|=0,!t){var r=Math.pow(2,8*n-1);ew(this,e,a,n,r-1,-r)}var i=0,o=1,s=0;for(this[a]=255&e;++i=0&&(o*=256);)e<0&&0===s&&0!==this[a+i+1]&&(s=1),this[a+i]=(e/o|0)-s&255;return a+n},AT.prototype.writeInt8=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,1,127,-128),AT.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[a]=255&e,a+1},AT.prototype.writeInt16LE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,2,32767,-32768),AT.TYPED_ARRAY_SUPPORT?(this[a]=255&e,this[a+1]=e>>>8):aw(this,e,a,!0),a+2},AT.prototype.writeInt16BE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,2,32767,-32768),AT.TYPED_ARRAY_SUPPORT?(this[a]=e>>>8,this[a+1]=255&e):aw(this,e,a,!1),a+2},AT.prototype.writeInt32LE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,4,2147483647,-2147483648),AT.TYPED_ARRAY_SUPPORT?(this[a]=255&e,this[a+1]=e>>>8,this[a+2]=e>>>16,this[a+3]=e>>>24):nw(this,e,a,!0),a+4},AT.prototype.writeInt32BE=function(e,a,n){return e=+e,a|=0,n||ew(this,e,a,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),AT.TYPED_ARRAY_SUPPORT?(this[a]=e>>>24,this[a+1]=e>>>16,this[a+2]=e>>>8,this[a+3]=255&e):nw(this,e,a,!1),a+4},AT.prototype.writeFloatLE=function(e,a,n){return rw(this,e,a,!0,n)},AT.prototype.writeFloatBE=function(e,a,n){return rw(this,e,a,!1,n)},AT.prototype.writeDoubleLE=function(e,a,n){return iw(this,e,a,!0,n)},AT.prototype.writeDoubleBE=function(e,a,n){return iw(this,e,a,!1,n)},AT.prototype.copy=function(e,a,n,t){if(n||(n=0),t||0===t||(t=this.length),a>=e.length&&(a=e.length),a||(a=0),t>0&&t=this.length)throw new RangeError("sourceStart out of bounds");if(t<0)throw new RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),e.length-a=0;--r)e[r+a]=this[r+n];else if(i<1e3||!AT.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=a;i55295&&n<57344){if(!r){if(n>56319){(a-=3)>-1&&i.push(239,191,189);continue}if(o+1===t){(a-=3)>-1&&i.push(239,191,189);continue}r=n;continue}if(n<56320){(a-=3)>-1&&i.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(a-=3)>-1&&i.push(239,191,189);if(r=null,n<128){if((a-=1)<0)break;i.push(n)}else if(n<2048){if((a-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((a-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((a-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function uw(e){return function(e){var a,n,t,r,i,o;RT||yT();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===e[s-2]?2:"="===e[s-1]?1:0,o=new mT(3*s/4-i),t=i>0?s-4:s;var d=0;for(a=0,n=0;a>16&255,o[d++]=r>>8&255,o[d++]=255&r;return 2===i?(r=hT[e.charCodeAt(a)]<<2|hT[e.charCodeAt(a+1)]>>4,o[d++]=255&r):1===i&&(r=hT[e.charCodeAt(a)]<<10|hT[e.charCodeAt(a+1)]<<4|hT[e.charCodeAt(a+2)]>>2,o[d++]=r>>8&255,o[d++]=255&r),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(ow,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function cw(e,a,n,t){for(var r=0;r=a.length||r>=e.length);++r)a[r+n]=e[r];return r}function lw(e){return null!=e&&(!!e._isBuffer||pw(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&pw(e.slice(0,0))}(e))}function pw(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}for(var gw=",".charCodeAt(0),fw=";".charCodeAt(0),hw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mw=new Uint8Array(64),Rw=new Uint8Array(128),yw=0;yw<64;yw++){var vw=hw.charCodeAt(yw);mw[yw]=vw,Rw[vw]=yw}function bw(e,a){var n=0,t=0,r=0;do{var i=e.next();n|=(31&(r=Rw[i]))<>>=1,o&&(n=-2147483648|-n),a+n}function xw(e,a,n){var t=a-n;t=t<0?-t<<1|1:t<<1;do{var r=31&t;(t>>>=5)>0&&(r|=32),e.write(mw[r])}while(t>0);return a}function Ew(e,a){return!(e.pos>=a)&&e.peek()!==gw}var Sw="undefined"!=typeof TextDecoder?new TextDecoder:void 0!==AT?{decode:function(e){return AT.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode:function(e){for(var a="",n=0;n0?a+Sw.decode(e.subarray(0,n)):a},l(e)}(),ww=function(){function e(e){this.pos=0,this.buffer=e}var a=e.prototype;return a.next=function(){return this.buffer.charCodeAt(this.pos++)},a.peek=function(){return this.buffer.charCodeAt(this.pos)},a.indexOf=function(e){var a=this.buffer,n=this.pos,t=a.indexOf(e,n);return-1===t?a.length:t},l(e)}();function Cw(e){e.sort(Pw)}function Pw(e,a){return e[0]-a[0]}function Aw(e){for(var a=new Tw,n=0,t=0,r=0,i=0,o=0;o0&&a.write(fw),0!==s.length)for(var d=0,u=0;u0&&a.write(gw),d=xw(a,c[0],d),1!==c.length&&(n=xw(a,c[1],n),t=xw(a,c[2],t),r=xw(a,c[3],r),4!==c.length&&(i=xw(a,c[4],i)))}}return a.flush()}var _w=/^[\w+.-]+:\/\//,Dw=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,kw=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function Iw(e){return e.startsWith("/")}function Nw(e){return/^[.?#]/.test(e)}function Bw(e){var a=Dw.exec(e);return Ow(a[1],a[2]||"",a[3],a[4]||"",a[5]||"/",a[6]||"",a[7]||"")}function Ow(e,a,n,t,r,i,o){return{scheme:e,user:a,host:n,port:t,path:r,query:i,hash:o,type:7}}function jw(e){if(function(e){return e.startsWith("//")}(e)){var a=Bw("http:"+e);return a.scheme="",a.type=6,a}if(Iw(e)){var n=Bw("http://foo.com"+e);return n.scheme="",n.host="",n.type=5,n}if(function(e){return e.startsWith("file:")}(e))return function(e){var a=kw.exec(e),n=a[2];return Ow("file:","",a[1]||"","",Iw(n)?n:"/"+n,a[3]||"",a[4]||"")}(e);if(function(e){return _w.test(e)}(e))return Bw(e);var t=Bw("http://foo.com/"+e);return t.scheme="",t.host="",t.type=e?e.startsWith("?")?3:e.startsWith("#")?2:4:1,t}function Fw(e,a){for(var n=a<=4,t=e.path.split("/"),r=1,i=0,o=!1,s=1;st&&(t=i)}Fw(n,t);var o=n.query+n.hash;switch(t){case 2:case 3:return o;case 4:var s=n.path.slice(1);return s?Nw(a||e)&&!Nw(s)?"./"+s+o:s+o:o||".";case 5:return n.path+o;default:return n.scheme+"//"+n.user+n.host+n.port+n.path+o}}function Lw(e,a){for(var n=a;n=0&&e[t][0]===a;n=t--);return n}function Kw(e,a,n,t){var r=n.lastKey,i=n.lastNeedle,o=n.lastIndex,s=0,d=e.length-1;if(t===r){if(a===i)return Vw=-1!==o&&e[o][0]===a,o;a>=i?s=-1===o?0:o:d=o}return n.lastKey=t,n.lastNeedle=a,n.lastIndex=function(e,a,n,t){for(;n<=t;){var r=n+(t-n>>1),i=e[r][0]-a;if(0===i)return Vw=!0,r;i<0?n=r+1:t=r-1}return Vw=!1,n-1}(e,a,s,d)}var zw=l(function(e,a){var n="string"==typeof e;if(!n&&e._decodedMemo)return e;var t=function(e){return"string"==typeof e?JSON.parse(e):e}(e),r=t.version,i=t.file,o=t.names,s=t.sourceRoot,d=t.sources,u=t.sourcesContent;this.version=r,this.file=i,this.names=o||[],this.sourceRoot=s,this.sources=d,this.sourcesContent=u,this.ignoreList=t.ignoreList||t.x_google_ignoreList||void 0;var c=function(e,a){var n=function(e){if(!e)return"";var a=e.lastIndexOf("/");return e.slice(0,a+1)}(e),t=a?a+"/":"";return function(e){return Mw(t+(e||""),n)}}(a,s);this.resolvedSources=d.map(c);var l=t.mappings;if("string"==typeof l)this._encoded=l,this._decoded=void 0;else{if(!Array.isArray(l))throw t.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error("invalid source map: "+JSON.stringify(t));this._encoded=void 0,this._decoded=function(e,a){var n=Lw(e,0);if(n===e.length)return e;a||(e=e.slice());for(var t=n;t=i.length)return Yw(null,null,null,null);var o=i[n],s=function(e,a,n,t,r){var i=Kw(e,t,a,n);Vw?i=(-1===r?Gw:Hw)(e,t,i):-1===r&&i++;return-1===i||i===e.length?-1:i}(o,e._decodedMemo,n,t,r||1);if(-1===s)return Yw(null,null,null,null);var d=o[s];if(1===d.length)return Yw(null,null,null,null);var u=e.names;return Yw(e.resolvedSources[d[1]],d[2]+1,d[3],5===d.length?u[d[4]]:null)}function Yw(e,a,n,t){return{source:e,line:a,column:n,name:t}}var $w=l(function(){this._indexes={__proto__:null},this.array=[]});function Qw(e,a){var n=function(e,a){return e._indexes[a]}(e,a);if(void 0!==n)return n;var t=e,r=t.array,i=t._indexes,o=r.push(a);return i[a]=o-1}var Zw=l(function(e){var a=void 0===e?{}:e,n=a.file,t=a.sourceRoot;this._names=new $w,this._sources=new $w,this._sourcesContent=[],this._mappings=[],this.file=n,this.sourceRoot=t,this._ignoreList=new $w});var eC=function(e,a){return function(e,a,n){var t=n.generated,r=n.source,i=n.original,o=n.name,s=n.content;if(!r)return tC(e,a,t.line-1,t.column,null,null,null,null,null);return tC(e,a,t.line-1,t.column,r,i.line-1,i.column,o,s)}(!0,e,a)};function aC(e,a,n){var t=e,r=t._sources;t._sourcesContent[Qw(r,a)]=n}function nC(e){var a=e,n=a._mappings,t=a._sources,r=a._sourcesContent,i=a._names,o=a._ignoreList;return function(e){for(var a=e.length,n=a,t=n-1;t>=0&&!(e[t].length>0);n=t,t--);n=0;n=t--){if(a>=e[t][0])break}return n}(f,t);if(!r){if(function(e,a){if(0===a)return!0;var n=e[a-1];return 1===n.length}(f,h))return;return rC(f,h,[t])}var m=Qw(l,r),R=s?Qw(g,s):-1;if(m===p.length&&(p[m]=null!=d?d:null),!function(e,a,n,t,r,i){if(0===a)return!1;var o=e[a-1];return 1!==o.length&&(n===o[1]&&t===o[2]&&r===o[3]&&i===(5===o.length?o[4]:-1))}(f,h,m,i,o,R))return rC(f,h,s?[t,m,i,o,R]:[t,m,i,o])}function rC(e,a,n){for(var t=e.length;t>a;t--)e[t]=e[t-1];e[a]=n}for(var iC=function(){function e(e,a){var n;this._map=void 0,this._rawMappings=void 0,this._sourceFileName=void 0,this._lastGenLine=0,this._lastSourceLine=0,this._lastSourceColumn=0,this._inputMap=null;var t=this._map=new Zw({sourceRoot:e.sourceRoot});if(this._sourceFileName=null==(n=e.sourceFileName)?void 0:n.replace(/\\/g,"/"),this._rawMappings=void 0,e.inputSourceMap){this._inputMap=new zw(e.inputSourceMap);var r=this._inputMap.resolvedSources;if(r.length)for(var i=0;i=64?this._indentChar.repeat(a):oC[a/2];this._str+=t}else this._str+=a>1?String.fromCharCode(e).repeat(a):String.fromCharCode(e);var r=32===e,i=this._position;if(10!==e){if(this._map){var o=this._sourcePosition;n&&o?(this._map.mark(i,null,o.line,o.column,r?void 0:o.identifierName,r?void 0:o.identifierNamePos,o.filename),!r&&this._canMarkIdName&&(o.identifierName=void 0,o.identifierNamePos=void 0)):this._map.mark(i,null)}i.column+=a}else i.line++,i.column=0},a._append=function(e,a,n){var t=e.length,r=this._position,i=this._sourcePosition;this._last=-1,++this._appendCount>4096?(this._str,this._buf+=this._str,this._str=e,this._appendCount=0):this._str+=e;var o=!n&&null!==this._map;if(a||o){var s=i.column,d=i.identifierName,u=i.identifierNamePos,c=i.filename,l=i.line;null==d&&null==u||!this._canMarkIdName||(i.identifierName=void 0,i.identifierNamePos=void 0);var p=e.indexOf("\n"),g=0;for(o&&0!==p&&this._map.mark(r,e,l,s,d,u,c);-1!==p;)r.line++,r.column=0,(g=p+1)",7],["<=",7],[">=",7],["in",7],["instanceof",7],[">>",8],["<<",8],[">>>",8],["+",9],["-",9],["*",10],["/",10],["%",10],["**",11]]);function fC(e){return 154===e||199===e||207===e}var hC=function(e,a,n){return(22===n||23===n)&&a.superClass===e},mC=function(e,a,n){switch(n){case 109:case 133:return a.object===e;case 18:case 131:case 113:return a.callee===e;case 220:return a.tag===e;case 189:return!0}return!1};function RC(e){return(e&(gA.expressionStatement|gA.arrowBody))>0}function yC(e,a,n,t){if(hC(e,a,n))return!0;if(mC(e,a,n)||236===n||143===n||8===n)return!0;var r;switch(n){case 11:case 108:r=gC.get(a.operator);break;case 154:case 199:r=7}if(void 0!==r){var i=2===t?7:gC.get(e.operator);if(r>i)return!0;if(r===i&&11===n&&(11===i?a.left===e:a.right===e))return!0;if(1===t&&108===n&&(1===i&&1!==r||1===r&&1!==i))return!0}return!1}function vC(e,a,n){switch(n){case 4:case 116:case 91:case 237:return!0}return!1}function bC(e,a,n){return(6===n||7===n)&&a.left===e||(11===n&&("|"===a.operator||"&"===a.operator)&&e===a.left||yC(e,a,n,2))}function xC(e,a,n){switch(n){case 179:case 209:case 153:case 193:return!0;case 173:return a.objectType===e}return!1}function EC(e,a,n){switch(n){case 153:case 193:return!0;case 173:if(a.objectType===e)return!0}return!1}function SC(e,a,n){return!!xC(e,a,n)||(217===n||159===n&&(a.checkType===e||a.extendsType===e))}function TC(e,a,n){return 11===n||108===n||236===n||143===n||mC(e,a,n)||8===n&&lC(e)||29===n&&e===a.test||hC(e,a,n)||fC(n)}function wC(e,a,n){return mC(e,a,n)||11===n&&"**"===a.operator&&a.left===e||hC(e,a,n)}function CC(e,a,n){switch(n){case 236:case 143:case 11:case 108:case 8:return!0;case 29:if(a.test===e)return!0}return!!fC(n)||wC(e,a,n)}function PC(e,a,n){switch(n){case 18:return a.callee===e;case 109:return a.object===e}return!1}var AC=Object.freeze({__proto__:null,ArrowFunctionExpression:CC,AssignmentExpression:function(e,a,n,t){return!(!RC(t)||"ObjectPattern"!==e.left.type)||CC(e,a,n)},AwaitExpression:TC,BinaryExpression:function(e,a,n,t){return!!yC(e,a,n,0)||(t&gA.forInOrInitHeadAccumulate)>0&&"in"===e.operator},ClassExpression:function(e,a,n,t){return(t&(gA.expressionStatement|gA.exportDefault))>0},ConditionalExpression:CC,DoExpression:function(e,a,n,t){return(t&gA.expressionStatement)>0&&!e.async},FunctionExpression:function(e,a,n,t){return(t&(gA.expressionStatement|gA.exportDefault))>0},FunctionTypeAnnotation:function(e,a,n,t){return 237===n||91===n||4===n||(t&gA.arrowFlowReturnType)>0},Identifier:function(e,a,n,t,r){var i;if(r&&r(e)!==e.name)return!1;if(6===n&&null!=(i=e.extra)&&i.parenthesized&&a.left===e){var o=a.right.type;if(("FunctionExpression"===o||"ClassExpression"===o)&&null==a.right.id)return!0}return(t&gA.forOfHead||(109===n||133===n)&&t&(gA.expressionStatement|gA.forInitHead|gA.forInHead))&&"let"===e.name?!!((uC(a,{object:e,computed:!0})||cC(a,{object:e,computed:!0,optional:!1}))&&t&(gA.expressionStatement|gA.forInitHead|gA.forInHead))||(t&gA.forOfHead)>0:69===n&&a.left===e&&"async"===e.name&&!a.await},IntersectionTypeAnnotation:vC,LogicalExpression:function(e,a,n){return yC(e,a,n,1)},NullableTypeAnnotation:function(e,a,n){return 4===n},ObjectExpression:function(e,a,n,t){return RC(t)},OptionalCallExpression:PC,OptionalIndexedAccessType:function(e,a,n){return 85===n&&a.objectType===e},OptionalMemberExpression:PC,SequenceExpression:function(e,a,n){return!(142===n||134===n||109===n&&a.property===e||133===n&&a.property===e||222===n)&&(22===n||(69===n?a.right===e:61===n||!pC(a)))},SpreadElement:wC,TSAsExpression:bC,TSConditionalType:function(e,a,n){switch(n){case 153:case 193:case 209:case 210:case 179:case 217:return!0;case 173:return a.objectType===e;case 159:return a.checkType===e||a.extendsType===e}return!1},TSConstructorType:SC,TSFunctionType:SC,TSInferType:function(e,a,n){return!!EC(e,a,n)||(179===n||217===n)&&null!=e.typeParameter.constraint},TSInstantiationExpression:function(e,a,n){switch(n){case 18:case 131:case 113:case 175:return null!=a.typeArguments}return!1},TSIntersectionType:function(e,a,n){return 209===n||EC(e,a,n)},TSSatisfiesExpression:bC,TSTypeAssertion:wC,TSTypeOperator:EC,TSUnionType:xC,UnaryExpression:wC,UnionTypeAnnotation:vC,UpdateExpression:function(e,a,n){return mC(e,a,n)||hC(e,a,n)},YieldExpression:TC});function _C(e,a){for(var n=e.quasis,t="`",r=0;r");return null==(null==r?void 0:r.loc)||r.loc.start.line!==e.loc.start.line}return!!this.format.retainLines}function eP(e){var a;return!(null==(a=e.loc)||!a.identifierName)&&e.loc.identifierName!==e.name}function aP(e,a){var n,t=e;if(!t&&a){var r=a.type;"VariableDeclarator"===r?t=a.id:"AssignmentExpression"===r||"AssignmentPattern"===r?t=a.left:"ObjectProperty"===r||"ClassProperty"===r?a.computed&&"StringLiteral"!==a.key.type||(t=a.key):"ClassPrivateProperty"!==r&&"ClassAccessorProperty"!==r||(t=a.key)}if(null!=(n=t)&&n.loc){var i;if("Identifier"===t.type){if(!eP(t))return;i={pos:t.loc.start,name:t.loc.identifierName}}else if("PrivateName"===t.type){if(!eP(t.id))return;i={pos:t.loc.start,name:"#"+t.id.loc.identifierName}}else"StringLiteral"===t.type&&(i={pos:t.loc.start,name:t.value});return i}}function nP(e,a){var n=this;this.tokenChar(60);var t="ArrowFunctionExpression"===a.type&&1===e.params.length;this.tokenMap&&null!=e.start&&null!=e.end&&(t&&(t=!!this.tokenMap.find(e,function(e){return n.tokenMap.matchesOriginal(e,",")})),t||(t=this.shouldPrintTrailingComma(">"))),this.printList(e.params,t),this.tokenChar(62)}function tP(e,a){e.tokenMap&&a.start&&a.end?e.tokenMap.endMatches(a,",")?e.token(","):e.tokenMap.endMatches(a,";")&&e.semicolon():e.semicolon()}function rP(e){e.computed&&this.tokenChar(91),this.print(e.key),e.computed&&this.tokenChar(93),e.optional&&this.tokenChar(63)}function iP(e){var a=e.typeParameters,n=e.params;this.print(a),this.tokenChar(40),zC.call(this,n,41),this.space();var t=e.returnType;this.print(t)}function oP(e,a,n){var t,r=0;null!=(t=e.tokenMap)&&t.startMatches(a,n)&&(r=1,e.token(n)),e.printJoin(a.types,void 0,void 0,function(e){this.space(),this.token(n,void 0,e+r),this.space()})}function sP(e,a){!0!==a&&e.token(a)}function dP(e){this.print(e.expression),this.print(e.typeArguments)}function uP(e){var a=e.typeParameters,n=e.params;this.print(a),this.tokenChar(40),zC.call(this,n,41),this.print(e.returnType)}function cP(e){var a="ClassPrivateProperty"===e.type,n="ClassAccessorProperty"===e.type||"ClassProperty"===e.type;pP(this,e,[n&&e.declare&&"declare",!a&&e.accessibility]),e.static&&(this.word("static"),this.space()),pP(this,e,[!a&&e.abstract&&"abstract",!a&&e.override&&"override",(n||a)&&e.readonly&&"readonly"])}function lP(e,a,n){e.token("{");var t=e.enterDelimited();n(),e._noLineTerminatorAfterNode=t,e.rightBrace(a)}function pP(e,a,n){for(var t,r,i=new Set,o=p(n);!(r=o()).done;){var s=r.value;s&&i.add(s)}null==(t=e.tokenMap)||t.find(a,function(a){return!!i.has(a.value)&&(e.token(a.value),e.space(),i.delete(a.value),0===i.size)});for(var d,u=p(i);!(d=u()).done;){var c=d.value;e.word(c),e.space()}}var gP=me,fP=ma,hP=Fe,mP=Se,RP=Te,yP=Oa;function vP(e,a){var n=e.attributes;this.word("with"),this.space();var t=a?1:0;this.token("{",void 0,t),this.space(),this.printList(n,this.shouldPrintTrailingComma("}")),this.space(),this.token("}",void 0,t)}function bP(e){var a;this.word("export"),this.space(),"type"===e.exportKind&&(this.word("type"),this.space()),this.tokenChar(42),this.space(),this.word("from"),this.space(),null!=(a=e.attributes)&&a.length?(this.print(e.source,!0),this.space(),vP.call(this,e,!1)):this.print(e.source),this.semicolon()}function xP(e,a){gP(a.declaration)&&jC.call(e,a)&&e.printJoin(a.declaration.decorators)}var EP,SP,TP="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function wP(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var a=e.default;if("function"==typeof a){var n=function e(){var n=!1;try{n=this instanceof e}catch(e){}return n?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};n.prototype=a.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var t=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,t.get?t:{enumerable:!0,get:function(){return e[a]}})}),n}var CP=function(){if(SP)return EP;SP=1;var e={},a=e.hasOwnProperty,n=function(e,n){for(var t in e)a.call(e,t)&&n(t,e[t])},t=function(e){return"\\u"+("0000"+e).slice(-4)},r=function(e,a){var n=e.toString(16);return a?n:n.toUpperCase()},i=e.toString,o=Array.isArray,s=function(e){return"bigint"==typeof e},d={"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},u=/[\\\b\f\n\r\t]/,c=/[0-9]/,l=/[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,p=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g,g=/([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g,f=function(e,a){var h,m,R=function(){w=T,++a.indentLevel,T=a.indent.repeat(a.indentLevel)},y={escapeEverything:!1,minimal:!1,isScriptContext:!1,quotes:"single",wrap:!1,es6:!1,json:!1,compact:!0,lowercaseHex:!1,numbers:"decimal",indent:"\t",indentLevel:0,__inline1__:!1,__inline2__:!1},v=a&&a.json;v&&(y.quotes="double",y.wrap=!0),h=y,a=(m=a)?(n(m,function(e,a){h[e]=a}),h):h,"single"!=a.quotes&&"double"!=a.quotes&&"backtick"!=a.quotes&&(a.quotes="single");var b,x="double"==a.quotes?'"':"backtick"==a.quotes?"`":"'",E=a.compact,S=a.lowercaseHex,T=a.indent.repeat(a.indentLevel),w="",C=a.__inline1__,P=a.__inline2__,A=E?"":"\n",_=!0,D="binary"==a.numbers,k="octal"==a.numbers,I="decimal"==a.numbers,N="hexadecimal"==a.numbers;if(v&&e&&function(e){return"function"==typeof e}(e.toJSON)&&(e=e.toJSON()),!function(e){return"string"==typeof e||"[object String]"==i.call(e)}(e)){if(function(e){return"[object Map]"==i.call(e)}(e))return 0==e.size?"new Map()":(E||(a.__inline1__=!0,a.__inline2__=!1),"new Map("+f(Array.from(e),a)+")");if(function(e){return"[object Set]"==i.call(e)}(e))return 0==e.size?"new Set()":"new Set("+f(Array.from(e),a)+")";if(function(e){return AT.isBuffer(e)}(e))return 0==e.length?"Buffer.from([])":"Buffer.from("+f(Array.from(e),a)+")";if(o(e))return b=[],a.wrap=!0,C&&(a.__inline1__=!1,a.__inline2__=!0),P||R(),function(e,a){for(var n=e.length,t=-1;++t2?t(h):"\\x"+("00"+h).slice(-2)}),"`"==x&&(b=b.replace(/\$\{/g,"\\${")),a.isScriptContext&&(b=b.replace(/<\/(script|style)/gi,"<\\/$1").replace(/