hplx-feature-library 1.0.175 → 1.0.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/APIAction-GKwgCFa7.cjs +1 -0
- package/dist/{index-nNWK2dDb.js → APIAction-owCQeK4h.js} +1 -1
- package/dist/AllInvestigations/index.js +1 -1
- package/dist/{AllInvestigationsTable-txmu7PTJ.js → AllInvestigationsTable-230u6fB3.js} +40 -38
- package/dist/{AllInvestigationsTable-C7uQ56B0.cjs → AllInvestigationsTable-BDLPOHjr.cjs} +4 -4
- package/dist/NineDots/index.js +4 -0
- package/dist/NineDots-Cy5GdMqh.cjs +3 -0
- package/dist/NineDots-Q7DH5xQq.js +1787 -0
- package/dist/{components → PatientAddEdit/components}/PatientAddEdit.d.ts +1 -1
- package/dist/PatientAddEdit/index.d.ts +1 -0
- package/dist/PatientAddEdit/index.js +2 -1661
- package/dist/PatientAddEdit-D-PuyA4h.cjs +7 -0
- package/dist/PatientAddEdit-MgBWiJqX.js +1665 -0
- package/dist/PatientPopup/components/bills/Bills.d.ts +3 -1
- package/dist/PatientPopup/index.js +1 -1
- package/dist/PatientPopupContainer-BREW2AZX.cjs +36 -0
- package/dist/{PatientPopupContainer-BSWU5CPk.js → PatientPopupContainer-CyTTjYhk.js} +3976 -3967
- package/dist/{PrintModal-BeR4-UcB.js → PrintModal-BR_tTgyn.js} +2 -1
- package/dist/{PrintModal-PPpn_LGy.cjs → PrintModal-CaqANEG3.cjs} +8 -8
- package/dist/{components → SearchPatients/components}/SearchPatients.d.ts +1 -1
- package/dist/SearchPatients/index.d.ts +1 -0
- package/dist/SearchPatients/index.js +4 -0
- package/dist/SearchPatients-BEQ0kjtj.js +233 -0
- package/dist/SearchPatients-eiOJOnND.cjs +1 -0
- package/dist/UserProfile/index.js +4 -0
- package/dist/UserProfile-Bs3EzSqu.js +1761 -0
- package/dist/UserProfile-C4cNhkeg.cjs +14 -0
- package/dist/common-utils-CDvwCtzy.js +2328 -0
- package/dist/common-utils-lI6oOpoS.cjs +6 -0
- package/dist/hplx-feature-library.css +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.esm-BdlMQ1M7.cjs +4 -0
- package/dist/index.esm-Bn1Rklqj.js +1275 -0
- package/dist/index.js +16 -2023
- package/dist/nineDots/{nineDots.d.ts → NineDots.d.ts} +1 -1
- package/dist/nineDots/NineDotsUtils.d.ts +1 -1
- package/dist/nineDots/index.d.ts +1 -0
- package/dist/print-pdf/index.js +1 -1
- package/dist/types/AllInvestigationTypes.d.ts +2 -0
- package/dist/useMediaQuery-CZAbdJzN.js +13 -0
- package/dist/useMediaQuery-D4SIgdMW.cjs +1 -0
- package/dist/userProfile/index.d.ts +1 -0
- package/package.json +22 -11
- package/dist/PatientPopupContainer-nZZA67ZY.cjs +0 -36
- package/dist/index-Cy8OvNyb.cjs +0 -1
- package/dist/index.esm-BJMiy-rl.js +0 -3597
- package/dist/index.esm-DvJKLbVG.cjs +0 -9
- /package/dist/{nineDots → types}/NineDotsTypes.d.ts +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./index-DQlbIHh3.cjs"),v=require("react"),Ie=require("./index.esm-DvJKLbVG.cjs"),le=require("./PrintModal-PPpn_LGy.cjs"),Te=require("./dayjs.min-DXp74Ozx.cjs"),Kr=require("./index-Cy8OvNyb.cjs"),Ql=require("./ReusableModal-CIgDYOWZ.cjs"),Tl={color:"white"},yr=i=>e.jsxRuntimeExports.jsx("div",{children:i.isRequired&&e.jsxRuntimeExports.jsx("a",{href:i.goToPage,children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-flex-col hfl-items-center hfl-rounded hfl-px-2 hfl-py-1 ${i.color}
|
|
2
|
-
${i.disabled?"hfl-cursor-not-allowed ":"hfl-cursor-pointer"} ${i.isSelected?"hfl-bg-White_20 hfl-bg-opacity-10 ":""} `,onClick:i.disabled?()=>{}:i.onClickHandler,title:i.disabled?"Low internet speed. Feature available only in online mode":i.label,"data-qa":i.data_qa,children:[i.src&&e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[22px]",src:i.src,alt:"no-img"}),i.icon&&e.jsxRuntimeExports.jsx("i",{className:i.icon+" hfl-text-5 ",style:Tl}),e.jsxRuntimeExports.jsx("div",{className:"hfl-text-1",children:e.jsxRuntimeExports.jsx(e.bs,{variant:i.isSelected?"Bold":"Regular",type:"Text sm",style:Tl,className:"hover:hfl-underline",children:i.label})})]})})}),Tt=v.createContext({currentWindow:"",isLoading:!1,formattedService:void 0,billPreferences:void 0,doctorListArr:void 0,serviceListArr:void 0,patientDetails:void 0,preferences:void 0,patientIDs:void 0,docPreference:void 0,showPrintModal:{visible:!1,whichPreview:"",printData:"",visitId:"",visit_date:"",details:null,visit_number:0,printDataFrom:"",currentPrintTime:0,printType:"",trackEventHandler:()=>{},appointmentInfo:void 0},ppEventProps:{patient_id:"",patient_registered_date:"",patient_age:"",patient_gender:""},patientCustomFieldData:[],setShowPrintModal:()=>{},setEndConsultationClicked:()=>{},setLoading:()=>{},setLastBillPaymentData:()=>{},getAndSetServiceListArr:async()=>{},getLastBillsPaymentData:async()=>{},showToast:()=>{},variable:{token:"",enc_token:"",envName:Ie.E_ENVIRONMENT.DEVELOPMENT}}),ml="data:image/svg+xml,%3csvg%20width='22'%20height='22'%20viewBox='0%200%2022%2022'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3crect%20width='22'%20height='22'%20fill='url(%23pattern0)'/%3e%3cdefs%3e%3cpattern%20id='pattern0'%20patternContentUnits='objectBoundingBox'%20width='1'%20height='1'%3e%3cuse%20xlink:href='%23image0_3069_356'%20transform='scale(0.00666667)'/%3e%3c/pattern%3e%3cimage%20id='image0_3069_356'%20width='150'%20height='150'%20xlink:href='data:image/png;base64,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'/%3e%3c/defs%3e%3c/svg%3e",Ol={appnt_id:"",patient_role_id:"",appnt_doctor_role_id:"",appnt_service_id:"",appnt_date:"",appnt_time:"",appnt_status:0,appnt_duration:"15",appnt_doctor_name:"",appnt_service_name:"",order_item_id:"",item_quantity:"0",order_unit_item_price:"0",order_item_price:"0",order_item_discount:"0",order_item_service_tax:"0",total_price:"0",appnt_created_on:"",order_item_created_on:""},en={order_item_id:"",service_id:"",service_name:"",service_category:"",service_category_id:"",item_quantity:"",order_unit_item_price:"",order_item_price:"",order_item_discount:"",order_item_service_tax:"",created_on:"",bill_item_details:{appointment_details:null,doctor_name:"",lab_owner_name:"",lab_owner_id:"0"}},hl=[{order_id:"",order_date:"",order_created_on:"",service_category:"",service_category_id:"",order_id_str:"",order_total:"",order_paid_amount:"",order_item_sum_discount:"",order_discount:"",refund_amount:"",order_service_tax:"",balance_amount:"",net_bill_amount:"",order_item_id:"",service_id:"",service_name:"",item_quantity:"",order_unit_item_price:"",order_item_price:"",order_item_discount:"",order_item_service_tax:"",order_item_service_tax_percent:"",created_on:"",net_amount:""}],Ar=[{label:"5 min",value:5},{label:"10 min",value:10},{label:"15 min",value:15},{label:"20 min",value:20},{label:"30 min",value:30},{label:"45 min",value:45},{label:"1 hour",value:60},{label:"1:30 hours",value:90},{label:"2 hours",value:120},{label:"2:30 hours",value:150},{label:"3 hours",value:180}],tn=10,rn=10,ht=["bill_summary","service_level_bill","consult_details","lab_detail","other_detail","payment_summary","delete_item","deposit","deposit_summary","payment_mode"],Ct=["Doctor consultation","Other Services","Internal lab tests"],zr=["CASH","CARD","M-WALLET","UPI/UPI QR SCAN","CHEQUE","BANK TRANSFER","INSURANCE","PATIENT APP","HBOOK","DEPOSIT","CREDIT","CGHS","RGHS","PMJAY","AYUSHMAN BHARAT"],Ns=["CASH","CARD","UPI/UPI QR SCAN","M-WALLET","CHEQUE","BANK TRANSFER"],Zr={0:"M",1:"F",2:"O"};var Yr=(i=>(i.CASH="CASH",i.CARD="CARD",i["M-WALLET"]="M-WALLET",i.CHEQUE="CHEQUE",i["BANK TRANSFER"]="BANK_TRANSFER",i.INSURANCE="INSURANCE",i["PATIENT APP"]="PATIENT_APP",i.HBOOK="HBOOK",i.DEPOSIT="DEPOSIT",i["UPI/UPI QR SCAN"]="UPI",i.CREDIT="CREDIT_MODE",i.CGHS="CGHS",i.RGHS="RGHS",i.PMJAY="PMJAY",i["AYUSHMAN BHARAT"]="AYUSHMAN BHARAT",i))(Yr||{}),ir=(i=>(i[i.CASH=0]="CASH",i[i.CARD=1]="CARD",i[i["M-WALLET"]=2]="M-WALLET",i[i.CHEQUE=3]="CHEQUE",i[i["BANK TRANSFER"]=4]="BANK TRANSFER",i[i.INSURANCE=5]="INSURANCE",i[i["PATIENT APP"]=6]="PATIENT APP",i[i.HBOOK=7]="HBOOK",i[i.DEPOSIT=8]="DEPOSIT",i[i["UPI/UPI QR SCAN"]=9]="UPI/UPI QR SCAN",i[i.CREDIT=10]="CREDIT",i[i.CGHS=11]="CGHS",i[i.RGHS=12]="RGHS",i[i.PMJAY=13]="PMJAY",i[i["AYUSHMAN BHARAT"]=14]="AYUSHMAN BHARAT",i))(ir||{}),_r=(i=>(i.deposit_refund="deposit_refund",i.consultation_lab_other_services="consultation_lab_other_services",i))(_r||{});const cr={consultation_lab_other_services:{key:"consultation_lab_other_services",label:"Consultation, Lab and Other Services"},deposit_refund:{key:"deposit_refund",label:"Deposits and Refunds"}};var Kt=(i=>(i.lis_report="lis_report",i.healthplix_report="healthplix_report",i))(Kt||{});const Wr={lis_report:{key:"lis_report",label:"LIS Reports"},healthplix_report:{key:"healthplix_report",label:"HealthPlix Reports"}},jt=["abha","appointment","add_bills","bills","payments","visits","lab","doc","profile"],sn={margin_left:"leftMargin",margin_right:"rightMargin",header_height:"headerHeight",footer_height:"footerHeight",page_height:"pageHeight",pdf_margin_left:"leftMarginPdf",pdf_margin_right:"rightMarginPdf",pdf_header_height:"headerHeightPdf",pdf_footer_height:"footerHeightPdf",patient_img_height:"patientImageHeight",patient_img_width:"patientImageWidth",font_family:"fontFamily",font_size:"fontSize",font_size_compensation:"fontSizeCompen",field_phone_number:"print_phoneNum",field_address:"print_address",field_refer_by:"refer_by",field_channel_through:"channel_through",field_department_name:"department_name",field_doctor_name:"doctor_name",field_visit_number:"visit_number",not_include_sub_header:"notIncludeSubHeader",show_print_preview:"showPrintPreview",default_language:"defaultLanguage",print_sign_img:"print_signImg"},xl=[{value:0,text:"BOOKED",text_color:"hfl-text-Primary-700"},{value:1,text:"REVIEWED",text_color:"hfl-text-Gray-400 group-hover:hfl-text-Gray-500"},{value:2,text:"CANCELLED",text_color:"hfl-text-Error-600"},{value:3,text:"ARRIVED",text_color:"hfl-text-Primary-700"},{value:5,text:"ON-GOING",text_color:"hfl-text-Success-700"}],ln=async({callback:i},d,c)=>{try{const n={branch_id:c.window_var.org_branch_id_for_seg,person_id:c.window_var.person_id_for_seg,person_role_id:c.window_var.doctor_role_id_for_seg,patient_role_id:d};window?.partner_service_enabled==="1"&&(n.partner_service_enabled=!0);const y=await Ie.ReArchAPI(c.token,c.envName).post(Kr.GET_PATIENT_DETAILS,{...n}),{data:R}=y||{},{error:l}=R||{};if(l)throw new Error(l);i(R)}catch(n){console.log(n),i(void 0)}},nn=async i=>{try{const d=await Ie.ReArchAPI(i.token,i.envName).get(le.GET_SERVICE_LIST+"/"+i.window_var.org_branch_id_for_seg+"?doctor_role_id="+i.window_var.doctor_role_id_for_seg+"&doctor_id="+i.window_var.person_id_for_seg),{data:c}=d||{};return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},an=async i=>{try{const d=await Ie.ReArchAPI(i.token,i.envName).get(le.GET_DOCTORS_LIST+"/"+i.window_var.org_branch_id_for_seg+"?doctor_role_id="+i.window_var.doctor_role_id_for_seg+"&doctor_id="+i.window_var.person_id_for_seg),{data:c}=d||{};return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},gl=async(i="all",d,c=1,n=20,y)=>{try{const R=await Ie.ReArchAPI(y.token,y.envName).get(`${le.GET_BILLS}?date=${i}&patient_role_id=${d}&page_no=${c}&page_size=${n}&org_branch_id=${y.window_var.org_branch_id_for_seg}`),{data:l}=R||{};return Promise.resolve(l)}catch(R){return console.log(R),Promise.reject(R)}},vl=async(i,d=1,c=10,n)=>{try{const y=await Ie.ReArchAPI(n.token,n.envName).get(`${le.GET_PAYMENT}?patient_role_id=${i}&branch_id=${n.window_var.org_branch_id_for_seg}&page_number=${d}&page_size=${c}`),{data:R}=y||{};return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},jl=async(i,d,c)=>{try{const n=await Ie.ReArchAPI(c.token,c.envName).get(`${le.GET_BILL_ITEM}?order_item_id=${i}&patient_role_id=${d}&org_branch_id=${c.window_var.org_branch_id_for_seg}`),{data:y}=n||{};return Promise.resolve(y)}catch(n){return console.log(n),Promise.reject(n)}},yl=async(i,d,c=!0,n)=>{try{const y=await Ie.ReArchAPI(n.token,n.envName).get(`${le.GET_PAST_DUE}?bill_date=${i}&org_branch_id=${n.window_var.org_branch_id_for_seg}&patient_role_id=${d}&past_due=${c}`),{data:R}=y||{};return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},on=async(i,d,c)=>{try{const n=await Ie.ReArchAPI(c.token,c.envName).get(`${le.GET_BILL_SUMMARY}/${i}/${d}?doctor_role_id=${c.window_var.doctor_role_id_for_seg}&doctor_id=${c.window_var.person_id_for_seg}&org_branch_id=${c.window_var.org_branch_id_for_seg}`),{data:y}=n||{};return Promise.resolve(y)}catch(n){return console.log(n),Promise.reject(n)}},un=async(i,d,c,n)=>{try{const y={billing_person_role_id:+n.window_var.doctor_role_id_for_seg,org_branch_id:+n.window_var.org_branch_id_for_seg,patient_role_id:+d,doctor_id:+n.window_var.person_id_for_seg,billing_person_role:11,bill_details:{appnt_id:+i?.appnt_id||0,discount:+i?.order_item_discount,order_date:c,quantity:+i?.item_quantity,referrer_doctor_role_id:+i?.bill_item_details?.referrer_doctor_role_id||i?.appnt_doctor_role_id||0,service_category:Ct.indexOf(i?.service_category)+1,service_id:+i?.service_id,service_name:i?.service_name,service_tax:Math.floor(i?.order_item_service_tax)||0,unit_price:+i?.order_unit_item_price||0,appnt_doctor_role_id:+i?.appnt_doctor_role_id||0,doctor_name:i?.bill_item_details?.doctor_name||"",lab_owner_name:i?.bill_item_details?.lab_owner_name||"",lab_owner_id:+i?.bill_item_details?.lab_owner_id||0}},R=await Ie.ReArchAPI(n.token,n.envName).post(le.GET_BILLS,{...y}),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}},cn=async(i,d,c)=>{try{const n={org_branch_id:+c.window_var.org_branch_id_for_seg,doctor_id:+c.window_var.person_id_for_seg,patient_role_id:+d,order_item_price:+i.order_item_price,order_item_id:+i.order_item_id,service_id:+i.service_id,service_name:i.service_name,item_quantity:+i.item_quantity,order_unit_item_price:+i.order_unit_item_price,order_item_discount:+i.order_item_discount,order_item_service_tax:Math.floor(i.order_item_service_tax)},y=await Ie.ReArchAPI(c.token,c.envName).put(le.PUT_BILL_ITEM,{...n}),{data:R}=y||{};return Promise.resolve(R)}catch(n){return console.log(n),Promise.reject(n)}},pl=async(i,d,c,n,y,R={},l)=>{try{const I={action:i,amount:d,order_id:+c,billing_person_role_id:+l.window_var.doctor_role_id_for_seg,patient_role_id:+y,payment_split:n,org_branch_id:+l.window_var.org_branch_id_for_seg,refund_details:R},S=await Ie.ReArchAPI(l.token,l.envName).put(le.PUT_BILLS,{...I}),{data:h}=S||{};return Promise.resolve(h)}catch(I){return console.log(I),Promise.reject(I)}},Wl=async(i,d,c,n,y,R)=>{try{const l=await Ie.ReArchAPI(R.token,R.envName).delete(`${le.DELETE_BILL_ITEM}?deleting_person_role_id=${R.window_var.doctor_role_id_for_seg}&mode=${y}&order_id=${i}&order_item_id=${d}&org_branch_id=${R.window_var.org_branch_id_for_seg}&patient_role_id=${c}&reason=${n}`),{data:I}=l||{};return Promise.resolve(I)}catch(l){return console.log(l),Promise.reject(l)}},Ts=async(i="all",d,c=1,n=10,y=!1,R)=>{try{const l=await Ie.ReArchAPI(R.token,R.envName).get(`${le.GET_APPOINTMENTS}?appnt_date=${i}&patient_role_id=${d}&doctor_id=${R.window_var.person_id_for_seg}&org_branch_id=${R.window_var.org_branch_id_for_seg}&page_no=${c}&page_size=${n}&skip_appnt_with_bill=${y}`),{data:I}=l||{};return Promise.resolve(I)}catch(l){return console.log(l),Promise.reject(l)}},dn=async(i,d="all",c="0",n)=>{try{const y=await Ie.ReArchAPI(n.token,n.envName).get(`${le.GET_APPOINTMENTS}/services/${i}?appnt_date=${d}&doctor_id=${n.window_var.person_id_for_seg}&org_branch_id=${n.window_var.org_branch_id_for_seg}&patient_role_id=${c}`),{data:R}=y||{};return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},fn=async(i,d,c,n,y,R,l)=>{try{const I={doctor_id:+l.window_var.person_id_for_seg,patient_role_id:+y,org_branch_id:+l.window_var.org_branch_id_for_seg,billing_person_role_id:+l.window_var.doctor_role_id_for_seg,appnt_date:i.appnt_date,patient_name:c,patient_phone_number:n,appnt_doctor_name:i.appnt_doctor_name,appnt_doctor_role_id:+i.appnt_doctor_role_id,appnt_duration:+i.appnt_duration,appnt_service_id:+i?.service_id||+i.appnt_service_id,appnt_service_name:i?.service_name||i.appnt_service_name,appnt_status:+i.appnt_status,appnt_time:i.appnt_time,skip_appnt_bill:d,order_date:Te.dayjs().format("YYYY-MM-DD"),item_quantity:+i.item_quantity,order_item_discount:+i.order_item_discount,order_item_price:+i.order_item_price,order_item_service_tax:Math.floor(i.order_item_service_tax),order_unit_item_price:+i.order_unit_item_price,is_partner_appointment:R},S=await Ie.ReArchAPI(l.token,l.envName).post(le.PUT_APPOINTMENTS,{...I}),{data:h}=S||{};return Promise.resolve(h)}catch(I){return console.log(I),Promise.reject(I)}},hn=async(i,d,c,n,y)=>{try{const R={doctor_id:y.window_var.person_id_for_seg,patient_role_id:n,org_branch_id:+y.window_var.org_branch_id_for_seg,billing_person_role_id:y.window_var.doctor_role_id_for_seg,appnt_id:+i.appnt_id,appnt_date:Te.dayjs(i.appnt_date).format("YYYY-MM-DD"),patient_name:c,appnt_doctor_name:i.appnt_doctor_name,appnt_doctor_role_id:+i.appnt_doctor_role_id,appnt_duration:+i.appnt_duration,appnt_service_id:+i.appnt_service_id,appnt_service_name:i.appnt_service_name,appnt_status:+i.appnt_status,appnt_time:i.appnt_time,skip_appnt_bill:d,order_date:Te.dayjs().format("YYYY-MM-DD"),item_quantity:+i.item_quantity,order_item_discount:+i.order_item_discount,order_item_price:+i.order_item_price,order_item_service_tax:Math.floor(i.order_item_service_tax),order_unit_item_price:+i.order_unit_item_price},l=await Ie.ReArchAPI(y.token,y.envName).put(le.PUT_APPOINTMENTS,{...R}),{data:I}=l||{};return Promise.resolve(I)}catch(R){return console.log(R),Promise.reject(R)}},pn=async(i="",d)=>{try{const c=await Ie.ReArchAPI(d.token,d.envName).get(`${le.GET_BRANCH_PREFERENCE}/${d.window_var.org_branch_id_for_seg}?fields_required=${i}`),{data:n}=c||{};return Promise.resolve(n)}catch(c){return console.log(c),Promise.reject(c)}},mn=async(i,d,c="",n)=>{try{const y={branch_id:n.window_var.org_branch_id_for_seg,doctor_id:n.window_var.person_id_for_seg,doctor_role_id:n.window_var.doctor_role_id_for_seg,patient_role_id:d,extra:{visit_date:Te.dayjs(i).format("DD-MMM-YYYY")},page_config:{page_number:1,page_size:1},metadata_preference:{patient_history:!0,obstetric_history:!0,menstrual_info:!0,physical_examination:!0,lab_tests_n_imaging:!0,drawing_board:!0},visit_id:c},R=await Ie.ReArchAPI(n.token,n.envName).post(le.GET_VISIT_ALL,{...y}),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}},xn=async(i,d,c,n)=>{try{const y=await Ie.ReArchAPI(n.enc_token,n.envName).get(`${le.GET_PATIENT_POPUP_HPLXLAB}/${c}/reports?page=${d}&limit=${i}`),{data:R}=y||{},{status:l,message:I}=R||{};if(!l)throw new Error(I);return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},gn=async(i,d,c,n)=>{try{const y=await Ie.ReArchAPI(n.token,n.envName).get(`${le.GET_PATIENT_POPUP_VISIT}/${c}?doctor_role_id=${n.window_var.doctor_role_id_for_seg}&doctor_id=${n.window_var.person_id_for_seg}&branch_id=${n.window_var.org_branch_id_for_seg}&page_size=${i}&page_number=${d}`),{data:R}=y||{},{error:l}=R||{};if(l)throw new Error(l);return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},vn=async(i,d,c)=>{const{patientRoleID:n,patientID:y}=c||{};try{const R=await Ie.ReArchAPI(d.token,d.envName).put(le.UPDATE_PATIENT_DETAIL+"/"+n,{...i,person_role_id:d.window_var.doctor_role_id_for_seg,person_id:d.window_var.person_id_for_seg,branch_id:d.window_var.org_branch_id_for_seg,patient_role_id:n,patient_id:y}),{data:l}=R||{};return l?.status&&typeof d.window_var.getUpdatedPatientDetails=="function"&&y===d.window_var.patient_person_id&&n===d.window_var.patient_role_id&&d.window_var.getUpdatedPatientDetails(),Promise.resolve(l)}catch(R){return console.log(R),Promise.reject(R)}},yn=async i=>{try{const d=await Ie.hplxAPI(i.token,i.envName).post(le.GET_REFERREDBY_DOCTOR),{data:c}=d||{},{apiError:n}=c||{};if(n)throw new Error(n);return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},_n=async(i,d)=>{try{const c=await Ie.hplxAPI(i.token,i.envName).post(`${le.GET_IPD_CASE}?pid=${d}`),{data:n}=c||{};return Promise.resolve(n)}catch(c){return console.log(c),Promise.reject(c)}},bn=i=>{const d=[];if(i.length)for(const c of i)d.push({title:c,value:c});return d},jn=i=>{const d=[];if(i.length)for(const c of i)d.push({doctor_id:c.doctor_id?c.doctor_id:"",doctor_name:c.doctor_name?c.doctor_name:"",label:c.doctor_name?c.doctor_name:"",specialist:c.specialist||""});return d},Rn=async(i,d)=>{try{const c=await Ie.hplxAPI(d.token,d.envName).post(le.ADD_PATIENT_IMAGE,i),{data:n}=c||{};return Promise.resolve(n)}catch(c){return console.log(c),Promise.reject(c)}},wn=async(i,d,c,n,y)=>{try{const R={billing_person_id:y.window_var.person_id_for_seg,billing_person_role_id:y.window_var.doctor_role_id_for_seg,patient_role_id:n,org_branch_id:y.window_var.org_branch_id_for_seg,total_amount:i,data:d,payment_split:c},l=await Ie.ReArchAPI(y.token,y.envName).post(le.POST_PAYMENT,{...R}),{data:I}=l||{};return Promise.resolve(I)}catch(R){return console.log(R),Promise.reject(R)}},Cn=async(i="",d)=>{try{const c=await Ie.ReArchAPI(d.token,d.envName).get(le.GET_REFERRAL+"/"+d.window_var.org_branch_id_for_seg+`?type=null&query=${i}&doctor_role_id=`+d.window_var.doctor_role_id_for_seg+"&doctor_id="+d.window_var.person_id_for_seg),{data:n}=c||{};return Promise.resolve(n)}catch(c){return console.log(c),Promise.reject(c)}},En=async(i,d,c)=>{try{const n={org_branch_id:+c.window_var.org_branch_id_for_seg,patient_role_id:+d,doctor_role_id:+c.window_var.doctor_role_id_for_seg,doctor_id:+c.window_var.person_id_for_seg,referral_name:i,is_lab_referral:!0},y=await Ie.ReArchAPI(c.token,c.envName).post(le.GET_REFERRAL,{...n}),{data:R}=y||{};return Promise.resolve(R)}catch(n){return console.log(n),Promise.reject(n)}},Pn=async(i,d,c,n,y)=>{try{const R=await Ie.ReArchAPI(y.token,y.envName).delete(`${le.DELETE_TRANSACTION}/${i}/${d}?org_branch_id=${y.window_var.org_branch_id_for_seg}&patient_role_id=${n}&order_id=${c}&deleting_person_role_id=${y.window_var.doctor_role_id_for_seg}&doctor_role_id=${y.window_var.doctor_role_id_for_seg}&doctor_id=${y.window_var.person_id_for_seg}`),{data:l}=R||{};return Promise.resolve(l)}catch(R){return console.log(R),Promise.reject(R)}},Rl=async(i,d,c,n)=>{try{let y="";c.forEach((I,S)=>{y="fields="+I+(S<c.length-1?"&":"")});const R=await Ie.ReArchAPI(n.token,n.envName).get(`${le.GET_BILLS_PAYMENTS_BILL_ID}/${i}?branch_id=${n.window_var.org_branch_id_for_seg}&patient_role_id=${d}&${y}`),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}},zl=async(i,d,c)=>{const n={patient_role_id:i,patient_id:d,branch_id:c.window_var.org_branch_id_for_seg};try{const y=await Ie.ReArchAPI(c.token,c.envName).post(le.GET_ABHA_INFO,n),{data:R}=y||{};return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},Sn=async(i,d)=>{const c={scope:i?.includes("@")?"abha_address":"abha_number",AbhaAddress:i,branch_id:d.window_var.org_branch_id_for_seg};try{const n=await Ie.ReArchAPI(d.token,d.envName).post(le.GENERATE_OTP_BY_ABHA_ADDRESS,c),{data:y}=n||{};return Promise.resolve(y)}catch(n){return console.log(n),Promise.reject(n)}},Nn=async(i,d,c,n,y)=>{const R={abha_address:i,otp:d,patient_role_id:c,patient_id:n,branch_id:y.window_var.org_branch_id_for_seg};try{const l=await Ie.ReArchAPI(y.token,y.envName).post(le.VERIFY_ABHA_OTP,R),{data:I}=l||{};return Promise.resolve(I)}catch(l){return console.log(l),Promise.reject(l)}},An=async(i,d)=>{const c={abha_address:i,doctor_name:d.window_var.doc_name_for_seg,branch_name:d.window_var.current_branch_name||"",doctor_role_id:d.window_var.doctor_role_id_for_seg,description:"Auto initiated",branch_id:d.window_var.org_branch_id_for_seg};try{const n=await Ie.ReArchAPI(d.token,d.envName).post(le.GET_ABHA_CONSENT,c),{data:y}=n||{};return Promise.resolve(y)}catch(n){return console.log(n),Promise.reject(n)}},Dn=async(i,d)=>{try{const c=await Ie.ReArchAPI(d.token,d.envName).get(`${le.GET_INSURANCE_LIST}/${i}`),{data:n}=c||{};return Promise.resolve(n)}catch(c){return console.log(c),Promise.reject(c)}},In=async i=>{try{const d={doctor_id:i.window_var.person_id_for_seg},c=await Ie.ReArchAPI(i.token,i.envName).post(le.GET_CUSTOM_TRANSLATIONS,{...d}),{data:n,status:y}=c||{};if(y!==200)throw new Error("error");return Promise.resolve(n)}catch(d){return console.log(d),Promise.reject(d)}},Tn=async(i,d)=>{try{const c={branch_id:d.window_var.org_branch_id_for_seg,doctor_id:d.window_var.person_id_for_seg,...i},n=await Ie.ReArchAPI(d.token,d.envName).post(le.VERIFY_INSURANCE,{...c});return Promise.resolve(n)}catch(c){return Promise.resolve(c)}},Bn=async i=>{try{const d={org_branch_id:i.window_var.org_branch_id_for_seg,doctor_id:i.window_var.person_id_for_seg,doctor_role_id:i.window_var.doctor_role_id_for_seg,master_tests_needed:!1},c=await Ie.ReArchAPI(i.token,i.envName).post(le.GET_ONLINE_TEST_RANGES,{...d}),{data:n,status:y}=c||{};if(y!==200)throw new Error("error");return Promise.resolve(n)}catch(d){return console.log(d),Promise.reject(d)}},Bl=async(i,d,c)=>{try{const n=await Ie.ReArchAPI(c.enc_token,c.envName).post(le.UPDATE_WALLET,{...d,emr_entity_id:i,branch_id:c.window_var.org_branch_id_for_seg,entity_type:"PATIENT_BRANCH"}),{data:y}=n||{};if(y?.status)return Promise.resolve(y)}catch(n){return console.log(n),Promise.reject(n)}},wl=async(i,d)=>{try{const c=d.window_var.org_branch_id_for_seg;if(!i||!c)throw new Error("Patient ID or Branch ID is missing.");const n=await Ie.ReArchAPI(d.enc_token,d.envName).get(`${le.UPDATE_WALLET}/balance?emr_entity_id=${i}&entity_type=PATIENT_BRANCH&branch_id=${c}`),{data:y}=n;if(y?.status)return Promise.resolve(y);throw new Error(y?.message||"API returned a non-successful status for wallet balance.")}catch(c){console.error("Failed to get wallet balance:",c)}},_l=async(i,d=1,c=10,n)=>{try{const y=await Ie.ReArchAPI(n.enc_token,n.envName).get(`${le.UPDATE_WALLET}/transaction?emr_entity_id=${i}&branch_id=${n.window_var.org_branch_id_for_seg}&page_no=${d}&page_size=${c}&entity_type=PATIENT_BRANCH`),{data:R}=y||{};return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},Gn=async(i,d,c,n)=>{try{const y={mode:Number(d),transaction_type:c},R=await Ie.ReArchAPI(n.token,n.envName).patch(`${le.GET_PAYMENT}/${i}`,y),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}};var Ds={exports:{}},Fn=Ds.exports,Gl;function Mn(){return Gl||(Gl=1,function(i,d){(function(c,n){i.exports=n()})(Fn,function(){var c={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},n=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,y=/\d/,R=/\d\d/,l=/\d\d?/,I=/\d*[^-_:/,()\s\d]+/,S={},h=function(N){return(N=+N)+(N>68?1900:2e3)},V=function(N){return function(P){this[N]=+P}},g=[/[+-]\d\d:?(\d\d)?|Z/,function(N){(this.zone||(this.zone={})).offset=function(P){if(!P||P==="Z")return 0;var A=P.match(/([+-]|\d\d)/g),j=60*A[1]+(+A[2]||0);return j===0?0:A[0]==="+"?-j:j}(N)}],L=function(N){var P=S[N];return P&&(P.indexOf?P:P.s.concat(P.f))},W=function(N,P){var A,j=S.meridiem;if(j){for(var Q=1;Q<=24;Q+=1)if(N.indexOf(j(Q,0,P))>-1){A=Q>12;break}}else A=N===(P?"pm":"PM");return A},z={A:[I,function(N){this.afternoon=W(N,!1)}],a:[I,function(N){this.afternoon=W(N,!0)}],Q:[y,function(N){this.month=3*(N-1)+1}],S:[y,function(N){this.milliseconds=100*+N}],SS:[R,function(N){this.milliseconds=10*+N}],SSS:[/\d{3}/,function(N){this.milliseconds=+N}],s:[l,V("seconds")],ss:[l,V("seconds")],m:[l,V("minutes")],mm:[l,V("minutes")],H:[l,V("hours")],h:[l,V("hours")],HH:[l,V("hours")],hh:[l,V("hours")],D:[l,V("day")],DD:[R,V("day")],Do:[I,function(N){var P=S.ordinal,A=N.match(/\d+/);if(this.day=A[0],P)for(var j=1;j<=31;j+=1)P(j).replace(/\[|\]/g,"")===N&&(this.day=j)}],w:[l,V("week")],ww:[R,V("week")],M:[l,V("month")],MM:[R,V("month")],MMM:[I,function(N){var P=L("months"),A=(L("monthsShort")||P.map(function(j){return j.slice(0,3)})).indexOf(N)+1;if(A<1)throw new Error;this.month=A%12||A}],MMMM:[I,function(N){var P=L("months").indexOf(N)+1;if(P<1)throw new Error;this.month=P%12||P}],Y:[/[+-]?\d+/,V("year")],YY:[R,function(N){this.year=h(N)}],YYYY:[/\d{4}/,V("year")],Z:g,ZZ:g};function D(N){var P,A;P=N,A=S&&S.formats;for(var j=(N=P.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(O,re,ce){var _e=ce&&ce.toUpperCase();return re||A[ce]||c[ce]||A[_e].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(xe,Ve,ie){return Ve||ie.slice(1)})})).match(n),Q=j.length,M=0;M<Q;M+=1){var G=j[M],k=z[G],$=k&&k[0],X=k&&k[1];j[M]=X?{regex:$,parser:X}:G.replace(/^\[|\]$/g,"")}return function(O){for(var re={},ce=0,_e=0;ce<Q;ce+=1){var xe=j[ce];if(typeof xe=="string")_e+=xe.length;else{var Ve=xe.regex,ie=xe.parser,Y=O.slice(_e),fe=Ve.exec(Y)[0];ie.call(re,fe),O=O.replace(fe,"")}}return function(H){var Ce=H.afternoon;if(Ce!==void 0){var Fe=H.hours;Ce?Fe<12&&(H.hours+=12):Fe===12&&(H.hours=0),delete H.afternoon}}(re),re}}return function(N,P,A){A.p.customParseFormat=!0,N&&N.parseTwoDigitYear&&(h=N.parseTwoDigitYear);var j=P.prototype,Q=j.parse;j.parse=function(M){var G=M.date,k=M.utc,$=M.args;this.$u=k;var X=$[1];if(typeof X=="string"){var O=$[2]===!0,re=$[3]===!0,ce=O||re,_e=$[2];re&&(_e=$[2]),S=this.$locale(),!O&&_e&&(S=A.Ls[_e]),this.$d=function(Y,fe,H,Ce){try{if(["x","X"].indexOf(fe)>-1)return new Date((fe==="X"?1e3:1)*Y);var Fe=D(fe)(Y),ke=Fe.year,xt=Fe.month,He=Fe.day,st=Fe.hours,_t=Fe.minutes,pt=Fe.seconds,Pt=Fe.milliseconds,Rt=Fe.zone,Dt=Fe.week,Gt=new Date,T=He||(ke||xt?1:Gt.getDate()),De=ke||Gt.getFullYear(),qe=0;ke&&!xt||(qe=xt>0?xt-1:Gt.getMonth());var ae,J=st||0,K=_t||0,oe=pt||0,Be=Pt||0;return Rt?new Date(Date.UTC(De,qe,T,J,K,oe,Be+60*Rt.offset*1e3)):H?new Date(Date.UTC(De,qe,T,J,K,oe,Be)):(ae=new Date(De,qe,T,J,K,oe,Be),Dt&&(ae=Ce(ae).week(Dt).toDate()),ae)}catch{return new Date("")}}(G,X,k,A),this.init(),_e&&_e!==!0&&(this.$L=this.locale(_e).$L),ce&&G!=this.format(X)&&(this.$d=new Date("")),S={}}else if(X instanceof Array)for(var xe=X.length,Ve=1;Ve<=xe;Ve+=1){$[1]=X[Ve-1];var ie=A.apply(this,$);if(ie.isValid()){this.$d=ie.$d,this.$L=ie.$L,this.init();break}Ve===xe&&(this.$d=new Date(""))}else Q.call(this,M)}}})}(Ds)),Ds.exports}var Hn=Mn();const Ln=e.getDefaultExportFromCjs(Hn);Te.dayjs.extend(Ln);const Yl=(...i)=>{let d=!1;try{const c=/^[a-zA-Z]+$/;for(const n of i){const y=n.toString();if(y.includes(".")||y.includes("-")||c.test(y)){d=!0;break}}}catch{return!1}return d},ql=async(i,d=!0,c,n,y,R,l,I=!1,S)=>{let h={appnt_id:0,error:"",order_id:"",order_item_id:"",appnt_create_status:!1,appnt_create_message:"",bill_create_status:!1,bill_create_message:""};const V=i.appnt_time_time+" "+i.appnt_time_format;try{if(!i.appnt_doctor_role_id){c("Error","Doctor name is missing","Error",3e3);return}if(!new RegExp(/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/).test(V)){c("Error","Error in time format","Error",3e3);return}if(!i.appnt_service_id){c("Error","Service name is missing","Error",3e3);return}const{item_quantity:L,order_unit_item_price:W,order_item_discount:z,order_item_service_tax:D,order_item_service_tax_percentage:N=0,order_item_price:P}=i;if(!d&&Yl(L,W,z,D,P)){c("Error","Value cannot be in decimal or in negative form","Error",3e3);return}if(i={...i,order_item_service_tax:Math.floor(W*L*.01*N),appnt_time:Te.dayjs(V,"hh:mm A").format("HH:mm:ss")},i.appnt_id.length)try{const A=await hn(i,d,n?.name,y.patientRoleID,S),j=A.appnt_update_status?"Success":"Error";if(A.appnt_update_message&&(h=A),c(j,A.appnt_update_message,j,3e3),I){const Q=A.bill_update_status?"Success":"Error";c(Q,A.bill_update_message,Q,3e3)}}catch(A){console.error("Error while create/update appointnment",A),c("Error",A.data.message,"Error",3e3)}else{const A=await fn(i,d,n.name,n.phone_number,y.patientRoleID,l,S),j=A.appnt_create_status?"Success":"Error";if(A.appnt_create_status&&(h=A),c(j,A.appnt_create_message,j,3e3),I){const Q=A.bill_create_status?"Success":"Error";c(Q,A.bill_create_message,Q,3e3)}}return h}catch{c("Error","Something went wrong while creating/updating appointment","Error",3e3)}},Cl=async(i,d,c,n,y,R=Ct[0],l)=>{let I={};try{if(R===Ct[0]&&!i.appnt_doctor_role_id){d("Error","Doctor name is missing","Error",3e3);return}if(R===Ct[0]){const D=i.appnt_time_time+" "+i.appnt_time_format;if(!new RegExp(/^(0?[1-9]|1[012])(:[0-5]\d) [APap][mM]$/).test(D)){d("Error","Error in time format","Error",3e3);return}}const{item_quantity:S,order_unit_item_price:h,order_item_service_tax_percentage:V=0,order_item_discount:g,order_item_service_tax:L,order_item_price:W}=i;if(Yl(S,h,g,L,W)){d("Error","Value cannot be in decimal or in negative form","Error",3e3);return}i={...i,order_item_service_tax:Math.floor(h*S*.01*V)};try{if(i?.order_item_id?.length){const D=await cn(i,c,l);d(D.status?"Success":"Error",D.message,D.status?"Success":"Error",3e3),D.status&&(I=D)}else{const D=await un(i,c,n,l);d(D.status?"Success":"Error",D.message,D.status?"Success":"Error",3e3)}}catch(D){console.error("Error while create/update bill",D)}return I}catch{console.log("error in handleCreateUpdateBill API Call"),d("Error","Something went wrong while create update bill","Error",3e3)}},Ul=async(i,d,c)=>{try{const n=await Rl(i,d,["payments"],c),y=Array.isArray(n?.payments)?n.payments:[],R=[...new Set(y.map(l=>ir[l.mode]).filter(l=>typeof l=="string"))];return{lab_owner_name:n?.lab_owner_name??"",paymentModes:R}}catch(n){return console.error("Error in fetching payment modes from bill id:",n),null}},kn=async(i,d,c)=>{const n={lab_owner_name:"",paymentsData:new Map([])},y=i.map(l=>Rl(l,d,["payments"],c));return(await Promise.all(y)).forEach(l=>{l.service_category_id==3&&(n.lab_owner_name=l.lab_owner_name),Array.isArray(l.payments)&&l.payments.length>0?n.paymentsData.set(l.service_category_id,l.payments.map(I=>I?.mode)):n.paymentsData.set(l.service_category_id,[])}),n},Kl=(i="")=>{switch(i){case"0":return"male";case"1":return"female";case"2":return"others";default:return""}},Vn={vitals:"vitals",investigationtable:"Investigations",complaints:"Complaints",diagnosis:"Diagnosis",presc:"RxComponent",nextvisit:"FollowUpVisit",referred:"referTo",dietEX:"Diet",tests:"TestsRequested",quicknotes:"QuickNotes",advice:"Advice",systemic:"SystemicExaminations",pickle:"GeneralExaminations",assessment:"Assessment",glassPrescription:"",pediatrics:"",jointExamination:"",customField:"",customField2:"",customField3:"",patienthistory:"PatientHistory",pastMedication:"pastMedication",menstrualInfo:"menstrualInfo",physicalExamination:"physicalExamination",obstetricHistory:"obstetricHistory",labTestImaging:"labTestImaging",drawingBoard:"drawing_board"},Fl=(i,d)=>{let c={};try{c=JSON.parse(d)}catch(R){return console.error("Failed to parse visit_pad_json:",R),[]}const n=Array.isArray(i)?i:i.split(","),y=[];return n.forEach(R=>{let l="";switch(R){case"nextvisit":l="use_next_visit";break;case"referred":l="use_doc_referral";break;case"dietEX":l="use_dietEx";break;case"tests":l="use_test_prescribed";break;case"assesment":l="use_assessment";break;case"quicknotes":l="use_quick_notes";break;case"presc":l="use_print_prescription_method";break;case"systemic":l="use_systemic_exam";break;case"customField":l="use_custom_field";break;case"customField2":l="use_custom_field2";break;case"customField3":l="use_custom_field3";break;case"customField4":l="use_custom_field4";break;case"customField5":l="use_custom_field5";break;case"customField6":l="use_custom_field6";break;case"investigationtable":l="use_investigation_table";break;case"patienthistory":l="patient_history_include";break;case"menstrualInfo":l="use_menstrual_info";break;case"physicalExamination":l="use_physical_examination";break;case"obstetricHistory":l="obstetric_history_include";break;case"labTestImaging":l="use_lab_test_imaging";break;case"vitals":l="use_vitals";break;case"pastMedication":l="use_past_medication";break;case"drawing_board":l="drawing_board";break;default:l="use_"+R}const I=c?.[l];I&&(R==="presc"||I?.include==="1")&&(R==="obstetricHistory"&&c?.obhGpla?.include==="0"&&c?.obhPregnancyHistory?.include==="0"||y.push(R))}),y.map(R=>Vn[R]||R)},On="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cpath%20d='M7.6665%206.00004C8.95517%206.00004%209.99984%204.95537%209.99984%203.66671C9.99984%202.37804%208.95517%201.33337%207.6665%201.33337C6.37784%201.33337%205.33317%202.37804%205.33317%203.66671C5.33317%204.95537%206.37784%206.00004%207.6665%206.00004Z'%20fill='%23039855'/%3e%3cpath%20d='M4.65017%205.75205C4.49106%205.52233%204.4115%205.40747%204.32581%205.36953C4.24888%205.33547%204.1679%205.3313%204.08788%205.35729C3.99875%205.38624%203.92865%205.46803%203.78845%205.6316C3.22585%206.28801%202.84213%207.10277%202.71374%208.00016H2.6665C2.29831%208.00016%201.99984%207.70168%201.99984%207.33349C1.99984%207.08757%202.13265%206.87188%202.33365%206.75561C2.65236%206.57125%202.76127%206.16343%202.57691%205.84472C2.39255%205.52601%201.98473%205.4171%201.66602%205.60147C1.06996%205.94627%200.666504%206.59237%200.666504%207.33349C0.666504%208.43806%201.56193%209.33349%202.6665%209.33349H2.71377C2.85774%2010.339%203.32239%2011.2416%203.9998%2011.9329L3.99979%2013.4823C3.99976%2013.5617%203.99973%2013.6565%204.00655%2013.7401C4.01446%2013.8369%204.03476%2013.9756%204.10879%2014.1209C4.20466%2014.309%204.35764%2014.462%204.54581%2014.5579C4.6911%2014.6319%204.82976%2014.6522%204.92658%2014.6601C5.0101%2014.6669%205.10492%2014.6669%205.18432%2014.6669H6.4819C6.56129%2014.6669%206.65616%2014.6669%206.73968%2014.6601C6.8365%2014.6522%206.97516%2014.6319%207.12045%2014.5579C7.30862%2014.462%207.4616%2014.309%207.55747%2014.1209C7.6315%2013.9756%207.6518%2013.8369%207.65971%2013.7401C7.66653%2013.6565%207.6665%2013.5617%207.66647%2013.4823L7.66646%2013.3335H8.33314L8.33313%2013.482C8.3331%2013.5615%208.33307%2013.6563%208.33989%2013.7398C8.3478%2013.8366%208.3681%2013.9753%208.44213%2014.1206C8.538%2014.3088%208.69099%2014.4618%208.87915%2014.5576C9.02444%2014.6317%209.16311%2014.652%209.25992%2014.6599C9.34344%2014.6667%209.43824%2014.6667%209.51764%2014.6666H10.8153C10.8947%2014.6667%2010.9896%2014.6667%2011.0731%2014.6599C11.1699%2014.652%2011.3085%2014.6317%2011.4538%2014.5576C11.642%2014.4618%2011.795%2014.3088%2011.8909%2014.1206C11.9649%2013.9753%2011.9852%2013.8366%2011.9931%2013.7398C11.9999%2013.6563%2011.9999%2013.5615%2011.9999%2013.482L11.9999%2012.884C12.7373%2012.5338%2013.3676%2011.9963%2013.83%2011.3333L14.1486%2011.3333C14.228%2011.3333%2014.3229%2011.3334%2014.4064%2011.3265C14.5032%2011.3186%2014.6419%2011.2983%2014.7872%2011.2243C14.9753%2011.1284%2015.1283%2010.9754%2015.2242%2010.7873C15.2982%2010.642%2015.3185%2010.5033%2015.3264%2010.4065C15.3333%2010.323%2015.3332%2010.2282%2015.3332%2010.1488V7.84245C15.3332%207.76683%2015.3333%207.67651%2015.327%207.59685C15.3199%207.50472%2015.3015%207.37257%2015.2341%207.23269C15.1358%207.02862%2014.9712%206.86396%2014.7671%206.76567C14.6272%206.6983%2014.4951%206.67993%2014.403%206.67276C14.3435%206.66813%2014.2781%206.66697%2014.2173%206.66669C13.9935%206.19554%2013.6934%205.76825%2013.3332%205.40063L13.3332%204.68824C13.3332%204.58502%2013.3333%204.46819%2013.3243%204.36769C13.3144%204.25673%2013.2886%204.08518%2013.1832%203.91515C13.0519%203.70315%2012.846%203.54789%2012.6061%203.47982C12.4137%203.42523%2012.2416%203.44753%2012.1322%203.4685C12.0331%203.48749%2011.9208%203.51963%2011.8216%203.54801L11.7177%203.57769C11.581%203.61674%2011.5127%203.63626%2011.4646%203.67145C11.4182%203.70542%2011.3899%203.73891%2011.364%203.79026C11.3371%203.84344%2011.3279%203.92456%2011.3094%204.08678C11.101%205.91399%209.54949%207.33337%207.6665%207.33337C6.41617%207.33337%205.31201%206.70755%204.65017%205.75205Z'%20fill='%23039855'/%3e%3c/svg%3e",Wn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%3e%3cg%20clip-path='url(%23clip0_3744_11287)'%3e%3cpath%20d='M7.99984%200.666626C3.94975%200.666626%200.666504%203.94987%200.666504%207.99996C0.666504%2012.05%203.94975%2015.3333%207.99984%2015.3333C8.47083%2015.3333%208.93145%2015.2889%209.37774%2015.204C8.53209%2014.4484%207.99976%2013.3495%207.99976%2012.1262C7.99976%2012.0103%208.00454%2011.8954%208.01391%2011.7819L5.24834%209.5192C5.2413%209.51353%205.23438%209.50771%205.22758%209.50175C5.15845%209.44136%205.10469%209.36959%205.06681%209.29153C5.02391%209.20345%204.99984%209.10452%204.99984%208.99996L4.99984%208.99919C4.99985%208.97688%205.00098%208.95454%205.00323%208.93228C5.01844%208.7814%205.08397%208.64537%205.18277%208.54122C5.23645%208.48449%205.29814%208.43911%205.36462%208.4054C5.45526%208.35929%205.55791%208.33329%205.66657%208.33329H6.6665C7.21472%208.33329%207.58295%208.12528%207.82444%207.84003C7.94632%207.69607%208.04285%207.52355%208.11027%207.33329H5.6665C5.29831%207.33329%204.99984%207.03482%204.99984%206.66663C4.99984%206.29844%205.29831%205.99996%205.6665%205.99996H8.11027C8.04285%205.8097%207.94632%205.63718%207.82444%205.49322C7.58295%205.20797%207.21472%204.99996%206.6665%204.99996H5.6665C5.29831%204.99996%204.99984%204.70148%204.99984%204.33329C4.99984%203.9651%205.29831%203.66663%205.6665%203.66663H10.3332C10.7014%203.66663%2010.9998%203.9651%2010.9998%204.33329C10.9998%204.70148%2010.7014%204.99996%2010.3332%204.99996H9.10602C9.29303%205.31016%209.41955%205.65102%209.48954%205.99996H10.3332C10.7014%205.99996%2010.9998%206.29844%2010.9998%206.66663C10.9998%207.03482%2010.7014%207.33329%2010.3332%207.33329H9.48954C9.39054%207.82684%209.17845%208.30422%208.84207%208.70155C8.48663%209.12139%208.00773%209.43255%207.42456%209.577L8.39182%2010.3684C9.05188%208.96864%2010.4758%207.99996%2012.126%207.99996C13.3493%207.99996%2014.4483%208.53232%2015.2039%209.37801C15.2888%208.93167%2015.3332%208.471%2015.3332%207.99996C15.3332%203.94987%2012.0499%200.666626%207.99984%200.666626Z'%20fill='%23DC6803'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.126%208.91891C10.3547%208.91891%208.91878%2010.3548%208.91878%2012.1261C8.91878%2013.8974%2010.3547%2015.3333%2012.126%2015.3333C13.8973%2015.3333%2015.3332%2013.8974%2015.3332%2012.1261C15.3332%2010.3548%2013.8973%208.91891%2012.126%208.91891ZM12.126%209.57157C12.4082%209.57157%2012.6369%209.80032%2012.6369%2010.0825V11.6152H14.1697C14.4518%2011.6152%2014.6806%2011.844%2014.6806%2012.1262C14.6806%2012.4083%2014.4518%2012.6371%2014.1697%2012.6371H12.6369V14.1698C12.6369%2014.452%2012.4082%2014.6807%2012.126%2014.6807C11.8438%2014.6807%2011.6151%2014.452%2011.6151%2014.1698V12.6371H10.0823C9.80016%2012.6371%209.57141%2012.4083%209.57141%2012.1262C9.57141%2011.844%209.80016%2011.6152%2010.0823%2011.6152H11.6151V10.0825C11.6151%209.80032%2011.8438%209.57157%2012.126%209.57157Z'%20fill='%23DC6803'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_3744_11287'%3e%3crect%20width='16'%20height='16'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",dr=(i="")=>{const d=new Date(i),n=Math.abs(new Date().getTime()-d.getTime()),y=Math.ceil(n/(1e3*60*60*24));return y<=7?`${y-1}d`:y<=30?`${Math.floor(y/7)}w`:y<=365?`${Math.floor(y/30)}m`:`${Math.floor(y/365)}y`},sr=i=>i?i.toLowerCase().replace(/\b\w/g,d=>d.toUpperCase()):"",Zl=i=>{switch(i){case"DEPOSIT":return On;case"REFUND":return Wn;default:return""}},zn=i=>{const{handleCurrentWindow:d,setShowPatientPopModal:c,patientIDs:n,redirectionPage:y,closePrintModal:R}=i,l=v.useContext(Tt);if(!l)throw new Error("PatientPopupHeader must be used within an AppContext.Provider");const{currentWindow:I,patientDetails:S,docPreference:h,billPreferences:V,setLastBillPaymentData:g,variable:L}=l,{name:W,age:z,gender:D,image_link:N,org_person_bid_str:P,org_person_dob:A,honorific:j}=S||{};window.patientPopupClosehandler=()=>{if(c(!1),R(),g({created_on:"",category_name:""}),window.location.pathname.indexOf("/frontdesk/")!==-1){const M=document.getElementById("appointmentRefreshBtn");M&&M.click()}};const Q=()=>{y==="appointments"?typeof window.redirectVPFromAppnt=="function"&&window.redirectVPFromAppnt(n?.patientRoleID||"",n?.patientID||""):y==="consultations"?typeof window.redirectVPFromConsult=="function"&&window.redirectVPFromConsult(n?.patientRoleID||"",n?.patientID||""):y==="addpatient"||y==="frontDeskDashboard"?window.location.href=`${window.origin}${Ie.EAPP_ROUTES$1.visitpad}?pid=${n?.patientRoleID}`:window.location.reload(),c(!1),R()};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[56px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-rounded-t-xl hfl-bg-Blue_gray-600 hfl-py-1 hfl-pl-[11px] hfl-pr-1.5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-[13px]",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 hfl-px-2 hfl-py-0.5",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-8 hfl-w-8 hfl-flex-col hfl-items-center hfl-justify-center hfl-rounded hfl-bg-White_20",children:e.jsxRuntimeExports.jsx(e.tp,{url:N,name:"",placeholder:!1,text:!1,size:"Text sm",shape:"hplxt-rounded"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-text-White_20",children:[e.jsxRuntimeExports.jsxs(e.bs,{variant:"Bold",type:"Text sm",className:"hfl-text-2 hfl-font-inter-2 hfl-capitalize hfl-leading-10","data-qa":"patient-name",children:[j?`${j}. `:"",W]}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text lg",className:"hfl-flex hfl-items-center hfl-gap-2 hfl-text-1 hfl-capitalize",children:[Kl(D)||e.jsxRuntimeExports.jsx("div",{className:"hfl-top-1 hfl-h-3 hfl-w-10 hfl-rounded-3xl hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),z?typeof z=="number"?`${z} Years`:dr(`${z}`):A&&dr(A)||e.jsxRuntimeExports.jsx("div",{className:"hfl-h-3 hfl-w-12 hfl-rounded-3xl hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),P||e.jsxRuntimeExports.jsx("div",{className:"hfl-top-1 hfl-h-3 hfl-w-10 hfl-rounded-3xl hfl-bg-Gray-100"})]})]})]}),L.window_var.role_id==="11"&&e.jsxRuntimeExports.jsx(e.Ku,{onClick:Q,hierarchy:"Primary",size:"md",textField:"Visit Pad",className:"hfl-rounded-md hfl-bg-Warning-50 hfl-p-2.5 hfl-text-Warning-500 hfl-shadow-md hover:hfl-bg-Warning-100","data-qa":"visit-pad"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(yr,{disabled:!1,src:ml,onClickHandler:()=>d(jt[8]),label:"Abha",isRequired:h?.abha?.link_patient_rx??!1,isSelected:I===jt[8],data_qa:"abha-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[1]?"hx_patient-calendar-filled":"hx_patient-calendar",onClickHandler:()=>d(jt[1]),label:"Appnt",isRequired:!0,isSelected:I===jt[1],data_qa:"appoint-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[2]?"hx_patient-add-bil-filled":"hx_patient-add-bil",onClickHandler:()=>{d(jt[2])},label:"Add Bills",isRequired:!0,isSelected:I===jt[2],data_qa:"add-bills-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[3]?"hx_patient-all-bills-filled":"hx_patient-all-bills",onClickHandler:()=>{d(jt[3])},label:"Bills",isRequired:!0,isSelected:I===jt[3],data_qa:"bill-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[4]?"hx_patient-payments-filled":"hx_patient-payments",onClickHandler:()=>{d(jt[4])},label:"Payments",isRequired:!0,isSelected:I===jt[4],data_qa:"payments-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[5]?"hx_patient-visits-filled":"hx_patient-visits",onClickHandler:()=>{d(jt[5])},label:"Visits",isRequired:!0,isSelected:I===jt[5],data_qa:"visits-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[6]?"hx_patient-lab-filled":"hx_patient-lab",onClickHandler:()=>d(jt[6]),label:"Lab",isRequired:L.window_var.permit_lab_tech==="1"||V?.features?.enable_lis_v1===!0,isSelected:I===jt[6],data_qa:"lab-tab"}),e.jsxRuntimeExports.jsx(yr,{disabled:!1,icon:I===jt[8]?"hx_patient-user-filled":"hx_patient-user",onClickHandler:()=>d(jt[8]),label:"Profile",isRequired:!0,isSelected:I===jt[8],data_qa:"profile-tab"}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-cursor-pointer hfl-text-5 hfl-text-White_20",onClick:()=>window.patientPopupClosehandler?.(),"data-qa":"patient-popup-close"})]})]})},Yn=()=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[900px] hfl-flex-col hfl-p-3 ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx("div",{className:" hfl-flex",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",children:"Select Message Template"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-pr-2",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"lg",icon:"Left",iconFile:"hx_chat-filled hfl-text-Primary-500",textField:"Select SMS Template",className:"hfl-justify-center"})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"lg",icon:"Left",iconFile:"hx_whatsapp-filled hfl-text-Success-500",textField:"Select Whatsapp Template",className:"hfl-justify-center"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"flex hfl-top-0 hfl-pt-3 ",children:e.jsxRuntimeExports.jsx(e.Oh,{className:"hfl-bg-Gray-200",rows:10,suffixPlaceholder:"Load Message Template from right"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-justify-end hfl-pt-[160px] ",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Send Message"})})]}),qn=i=>{const{patientAbhaDetails:d,savePatientDetailsHandler:c,setPatientAbhaDetails:n,patientData:y}=i,{showToast:R,patientIDs:l,variable:I}=v.useContext(Tt)||{},[S,h]=v.useState(""),[V,g]=v.useState(""),[L,W]=v.useState(),z=async(D=!1)=>{try{if(L?.status&&!D){const N=await Nn(L.abha_address,V,l?.patientRoleID||"",l?.patientID||"",I);if(N.status){const P=await zl(l?.patientRoleID||"",l?.patientID||"",I);n(P),An(L.abha_address,I);const A=N.PatientDetails[0].yearOfBirth?y?.org_person_dob.replace(y.org_person_dob.split("-")[0],N.PatientDetails[0].yearOfBirth):y?.org_person_dob;c(N.PatientDetails[0].name,A||"")}else R("Error",N.error,"Error",3e3)}else{const N=await Sn(S,I);W(N),N.status||R("Error",N.error,"Error",3e3)}}catch(N){console.error("Error while generating OTP",N)}};return d?.patient_details_mongo?.length?e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[40px] hfl-flex hfl-items-center hfl-justify-between hfl-rounded-lg hfl-bg-Purple-25 hfl-px-3 hfl-py-2 hfl-shadow-lg",children:[e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-items-center hfl-gap-3 hfl-text-1 hfl-text-Rose-600",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-h-8 hfl-w-8",src:ml,alt:"profile-tab"}),d.patient_details_mongo[0].abha_address,e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[31px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Blue_gray-700",children:d.patient_details_mongo[0].abha_number})]})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-flex hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Success-600",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_verified-filled hfl-text-4"}),"Verified by ABHA"]})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[40px] hfl-flex hfl-h-[72px] hfl-flex-shrink-0 hfl-items-start hfl-gap-[9px] hfl-rounded-lg hfl-bg-Blue_gray-50 hfl-px-[13px] hfl-py-2 hfl-shadow-xs",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-h-8 hfl-w-8",src:ml,alt:"profile-tab"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-gap-1",children:[e.jsxRuntimeExports.jsx(e.Ps,{inputProps:{value:S,onChange:D=>{h(D.target.value)},placeholder:"Enter ABHA Address/ ABHA Number"},className:"",width:"400px",height:"32px"}),L?.status&&e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Gray-400",children:["OTP sent",e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[18px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-gap-1 hfl-text-1 hfl-text-Primary-600",onClick:async()=>{await z(!0)},children:[e.jsxRuntimeExports.jsx("div",{className:"hx_rewind hfl-font-bold hfl-text-3"}),"Resend OTP"]})]})]}),L?.status&&e.jsxRuntimeExports.jsx(e.Ps,{inputProps:{value:V,onChange:D=>{g(D.target.value)},placeholder:"Enter OTP"},className:"",width:"128px",height:"32px"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",className:"hfl-h-[32px]",size:"sm",textField:L?.status?"Submit OTP":"Verify ABHA",onClick:async()=>{await z()}})]})},Un=v.forwardRef(i=>{const{patientData:d={},setPatientData:c,preferences:n,referredByDocList:y,throughChannelList:R,showImageFromLink:l,validators:I,setValidators:S,billPreferences:h,isAbhaVerified:V,isPartnerServiceEnabled:g,insuranceData:L,partnerConfig:W,verifyInsuranceHandler:z,policyNumberErrorMessage:D,selectedInsuranceDetails:N,setSelectedInsuranceDetails:P,insuranceDivRef:A,patientCustomFieldData:j}=i,[Q,M]=v.useState(!1),[G,k]=v.useState([]),[$,X]=v.useState([]),[O,re]=v.useState(!1),[ce,_e]=v.useState(!1),[xe,Ve]=v.useState([]),ie=h?.permissions?.edit_patient_name,{phone_number:Y,age:fe,org_person_dob:H,gender:Ce,honorific:Fe,name:ke,patient_preferred_language:xt,blood_group:He,spouse_name:st,marital_status:_t,married_since:pt,spouse_blood_group:Pt,org_person_bid_str:Rt,ref_doc_name:Dt,ref_doc_spec:Gt,email:T,phone_secondary:De,pincode:qe,address:ae,through_channel:J,care_of:K,tag:oe,image_link:Be,aadhar_number:Pe}=d,[mt,Zt]=v.useState(Ce),[ct,Ot]=v.useState("Years"),[kt,er]=v.useState(""),[Qt,rr]=v.useState(!1),[lr,br]=v.useState([]),nr=v.useRef(),at=(B,ye)=>{c(bt=>({...bt,[B]:ye})),B=="gender"&&ye==""?S(bt=>({...bt,gender:"Select Gender"})):S(bt=>({...bt,gender:""}))};v.useEffect(()=>{Fe&&er(Fe)},[Fe]),v.useEffect(()=>{Be&&l(Be)},[Be]);const fr=B=>{const{value:ye}=B.target,bt=ft(ye);k(bt)},hr=B=>{at("occupation",B.trim()),re(!1)},or=B=>{at("city",B.trim()),_e(!1)},ur=B=>{const{value:ye}=B.target,bt=vt(ye);X(bt)},dt=B=>{const{value:ye}=B.target,bt=Et(ye);Ve(bt)},vt=B=>{if(Ie.OccupationList?.length){let ye=Ie.OccupationList;return B?.length&&(ye=Ie.OccupationList.filter(bt=>bt.toLowerCase().includes(B.toLowerCase()))),ye}else return[]},ft=B=>{if(R?.length){let ye=R;return B?.length&&(ye=R.filter(bt=>bt.title.toLowerCase().includes(B.toLowerCase()))),ye}else return[]},Et=B=>{if(Ie.CityList?.length){let ye=Ie.CityList;return B?.length&&(ye=Ie.CityList.filter(bt=>bt.toLowerCase().includes(B.toLowerCase()))),ye}else return[]},Bt=(B="")=>{const ye=B?.toLowerCase();return H!==""?"":fe!==""&&Number(fe)<0&&H===""?"Invalid Age":ye==="weeks"&&fe!==""&&Number(fe)<5907||ye==="days"&&fe!==""&&Number(fe)<9999||ye==="months"&&fe!==""&&Number(fe)<1358||ye==="years"&&fe!==""&&Number(fe)<114?"":"Invalid Age"};v.useEffect(()=>{if(!H){const B=Ie.calculateDOB(d.age,ct);B&&c(ye=>({...ye,org_person_dob:B}))}},[ct,d.age]);const Ht=B=>{Zt(B),at("gender",B),S(ye=>({...ye,gender:""}))},$t=B=>{at("through_channel",B.value.trim()),M(!1)},Ft=B=>{nr.current&&!nr.current.contains(B.target)&&rr(!1)},At=(B,ye,bt)=>{c(Lt=>{const Xt=Lt.custom_fields?.length?Lt.custom_fields.map(tr=>tr.id===B?{...tr,value:bt}:tr):[];return Xt.some(tr=>tr.id===B)||Xt.push({id:B,value:bt,title:ye}),{...Lt,custom_fields:Xt}})},pr=v.useCallback(()=>j?.map(B=>{const{id:ye,type:bt,title:Lt}=B||{};if(!ye||!bt||!Lt)return null;const Xt=d.custom_fields?.find(qt=>qt.id===ye)?.value||"";switch(bt){case"text":return e.jsxRuntimeExports.jsx(e.Ps,{label:Lt,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Xt||"",placeholder:`Enter ${Lt}`,onChange:qt=>{At(ye,Lt,qt.target.value)}},width:"21em"},ye);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:Lt,placeholder:`Select ${Lt}`,selectDate:Xt?new Date(Xt):null,clearDate:qt=>{At(ye,Lt,qt)},dateVar:qt=>{At(ye,Lt,qt)},isborderRequired:!0,width:"22em",openUp:!0,backSpaceClearDate:!0},ye);default:return null}}),[j,d.custom_fields]);return v.useEffect(()=>{const B=Object.keys(W).map(ye=>{if(W[ye]?.verify_insurance?.enable)return{value:ye,label:ye}}).filter(ye=>ye);br(B??[])},[W]),v.useEffect(()=>(document.addEventListener("mousedown",Ft),()=>{document.removeEventListener("mousedown",Ft)}),[]),e.jsxRuntimeExports.jsx("div",{id:"add-patient-modal hfl-overflow-scroll",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-min-h-[400px] hfl-px-10 hfl-py-5 ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1",children:[e.jsxRuntimeExports.jsxs("div",{className:ie?"":"hfl-pointer-events-none",children:[e.jsxRuntimeExports.jsx(e.Ps,{label:"Patient Name*",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",prefix:e.jsxRuntimeExports.jsxs("div",{ref:nr,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>rr(B=>!B),children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text md",className:"hfl-px-1 hfl-py-1 hfl-text-Gray-700",children:kt}),!kt.length&&e.jsxRuntimeExports.jsx("div",{className:`${Qt?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:!!I.name&&I.name,inputProps:{type:"text",value:ke,disabled:V,placeholder:"Enter Name",onChange:B=>{at("name",B.target.value)},onBlur:()=>{const B=!(ke.length>0);ke.length>0&&ke.length<2?S(ye=>({...ye,name:"Enter at least 2 letters "})):S(ye=>({...ye,name:B?"Enter the Name of the Patient":""}))}},start_icon:"hx_person",width:"16em"}),Qt&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[1000] hfl-mt-[2px] hfl-flex hfl-h-[270px] hfl-w-20 hfl-flex-col hfl-overflow-y-auto hfl-rounded-lg hfl-border-1 hfl-border-Gray-300 hfl-bg-White",style:{boxShadow:"0px 24px 48px -12px rgba(16, 24, 40, 0.18)"},children:Ie.HonorificList.map(B=>e.jsxRuntimeExports.jsx(e.ks,{className:"hfl-text-Primary-700",label:B.label,onSelect:()=>{er(B.label),rr(!1),Zt(B.gender),at("honorific",B.label),at("gender",B.gender),c(ye=>({...ye,gender:B.gender,patHonorific:B.label}))}}))})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ps,{label:`Phone ${n&&n.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:!!I.phone_number&&I.phone_number,inputProps:{maxLength:10,value:Y,placeholder:"Enter Number",onChange:B=>{at("phone_number",B.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:B=!1,msg:ye=""}=n&&n.phone_number_length||Y?Ie.validateMobileNo(Y):{};S(bt=>({...bt,phone_number:B?ye:""}))}},width:"21em",start_icon:"hx_phone"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-space-x-2 hfl-pt-8",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-h-[40px] hfl-space-y-1",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-pb-[1px] hfl-text-Gray-600",children:"Gender*"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx(e.ju,{className:`!hfl-h-[37px] hfl-w-44 ${I.gender?"hfl-border-Error-300":""}`,options:[{label:"M",value:"0"},{label:"F",value:"1"},{label:"Other",value:"2"}],value:mt,onChange:B=>Ht(B),disabled:!1}),!!I.gender&&e.jsxRuntimeExports.jsx("div",{className:"hfl-font-inter hfl-text-1 hfl-font-inter-0 hfl-leading-10 hfl-tracking-1 hfl-text-Error-500",children:I.gender})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.ej,{label:"Age or DOB*",className:"hfl-w-20",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-w-16 hfl-border-0",suffixDropdownClassName:"hfl-ml-[80px]",input1value:fe==0?"":fe,input2value:ct,end_icon:"hx_down",errorMsg:!!I.age&&I.age,inputProps:{disabled:V,type:"number",min:0,maxLength:3,placeholder:"Age",onChange:B=>{at("age",B.target.value.replace(/[^0-9]/g,"")),c(ye=>({...ye,org_person_dob:""}))},onBlur:()=>{S(B=>({...B,age:Bt(ct)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{disabled:V,placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:B=>{at("age",B),S(ye=>({...ye,age:Bt(ct)}))},handleSuffixValChange:B=>{Ot(B),S(ye=>({...ye,age:Bt(B)}))},onSuffixDropdownClick:B=>{Ot(B.label),c(ye=>({...ye,age_selector:B.value,org_person_dob:""})),S(ye=>({...ye,age:Bt(B.value)}))}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"DOB",disable:V,width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:H&&Ie.isValidDate(new Date(H))?new Date(Te.dayjs(new Date(H)).format("DD-MMM-YYYY")):"",dateVar:B=>{c(ye=>({...ye,org_person_dob:Te.dayjs(B).format("YYYY-MM-DD"),age:""})),S(ye=>({...ye,age:""}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-1",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:xt?Ie.DefinedLanguages[xt]:"English"},placeholder:"English",label:"Preferred Language",onChange:B=>{at("patient_preferred_language",B.value)},options:Object.keys(Ie.DefinedLanguages).map(B=>({label:Ie.DefinedLanguages[B],value:B})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"dropdown-language"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pb-6 hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[375px] hfl-flex-col",children:[e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-mb-3",label:"Pin",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:qe,placeholder:"Enter Pin",onChange:B=>{at("pincode",B.target.value)}},width:22.5+"em"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-2",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Ps,{label:"City",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:d?.city,placeholder:"Enter City",onChange:B=>{at("city",B.target.value),_e(!0),dt(B)},onBlur:B=>{B.stopPropagation(),_e(!1)}},width:23.5+"em"}),ce&&xe&&xe.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:xe.map(B=>e.jsxRuntimeExports.jsx(e.ks,{label:B,className:"hfl-text-Primary-700",onSelect:()=>or(B)}))})]})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-col",style:{height:"100%",flexGrow:1},children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-h-[120px] hfl-w-[368px]",label:"Address",rows:4,inputProps:{value:ae,placeholder:"Enter Address",onChange:B=>{at("address",B.target.value)}},isDynamicHeight:!0,"data-qa":"enter-address"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-stroke-Gray-200 hfl-stroke-1 hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Marital Status"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pt-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-space-x-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.Ap,{value:{label:_t&&Ie.MARITAL_STATUS.find(B=>B===_t)||""},placeholder:"Marital Status",label:"Marital Status",onChange:B=>{at("marital_status",B.label)},options:Ie.MARITAL_STATUS.map(B=>({label:B,value:B})),className:"!hfl-h-[40px] hfl-w-[200px]","data-qa":"marital-status"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-[24px] hfl-flex hfl-space-y-2",children:e.jsxRuntimeExports.jsx(e.ZC,{className:"hfl-relative",placeholder:"Since",width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:pt&&Ie.isValidDate(new Date(pt))?new Date(Te.dayjs(new Date(pt)).format("DD-MMM-YYYY")):"",dateVar:B=>{c(ye=>({...ye,married_since:Te.dayjs(B).format("YYYY-MM-DD")}))},isborderRequired:!0,maxDate:new Date})})]}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Blood Group",placeholder:"Enter blood group",value:{label:He&&Ie.bloodGroups.find(B=>B.value===He)?.label||"Blood group"},onChange:B=>{at("blood_group",B.value)},options:Ie.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),_t!==Ie.MARITAL_STATUS[0]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pt-6",children:[e.jsxRuntimeExports.jsx(e.Ps,{label:"Spouse Name",start_icon:"hx_person",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:st,placeholder:"Enter Spouse Name",onChange:B=>{at("spouse_name",B.target.value)}},width:"21em"}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:Pt?Ie.bloodGroups.find(B=>B.value===Pt)?.label||"Spouse Blood group":"Blood group"},onChange:B=>{at("spouse_blood_group",B.value)},options:Ie.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-pt-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx("span",{className:"hfl-absolute hfl-left-0 hfl-right-0 hfl-top-1/2 hfl-h-px hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsx("span",{className:"hfl-relative hfl-bg-White hfl-px-4",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-ml-2 hfl-inline hfl-bg-White hfl-text-Gray-400",children:"Other Details"})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-pt-6",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Existing ID (if any)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Rt,placeholder:"Enter ID",onChange:B=>{at("org_person_bid_str",B.target.value)}},width:"23em"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pt-6",children:[e.jsxRuntimeExports.jsx(e.ej,{classNameDatePicker:"hfl-relative",classNamedoubleInput:"hfl-relative",label:"Referred By",input1value:Dt,input2value:Gt,end_icon:"hx_down",inputProps:{placeholder:"Doctor Name"},suffixInputProps:{placeholder:"Speciality"},className:"hfl-w-48",suffixClassName:"hfl-w-[100px]",suffixDropdownClassName:"hfl-ml-[160px]",options:y,suffixOptions:Ie.SpecialityList,handleValChange:B=>{at("ref_doc_name",B)},handleSuffixValChange:B=>{at("ref_doc_spec",B.value)},onDropdownClick:B=>{at("ref_doc_name",B.doctor_name),at("ref_doc_id",B.doctor_id),at("refDocId",B.doctor_id),at("ref_doc_spec",B.specialist)},onSuffixDropdownClick:B=>{at("ref_doc_spec",B.value)}}),e.jsxRuntimeExports.jsx(e.Ps,{label:"Email",className:"",classNameParentDiv:"hfl-relative",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:!!I.email&&I.email,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:T,placeholder:"Enter Email",onChange:B=>{at("email",B.target.value.trim())},onBlur:B=>{B.target.value&&!Ie.create$6().email().isValidSync(B.target.value)?S(ye=>({...ye,email:"Email format is wrong"})):S(ye=>({...ye,email:""}))}},width:20.5+"em"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-flex-row hfl-flex-wrap hfl-justify-between hfl-gap-y-6 hfl-py-6",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Ps,{label:"Channel (How did the patient hear about you?)",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:J,placeholder:"Enter Channel",onChange:B=>{at("through_channel",B.target.value),M(!0),fr(B)},onBlur:B=>{B.stopPropagation(),M(!1)}},width:23.5+"em"}),Q&&G&&G.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:G.map(B=>{const{title:ye,...bt}=B||{};return e.jsxRuntimeExports.jsx(e.ks,{label:B.title,className:"hfl-text-Primary-700",...bt,onSelect:()=>$t({...bt})})})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-[368px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"C/O",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:K,placeholder:"Enter C/O",onChange:B=>{at("care_of",B.target.value)}},width:"22em"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Ps,{label:"Occupation",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:d?.occupation,placeholder:"Enter Occupation",onChange:B=>{at("occupation",B.target.value),re(!0),ur(B)},onBlur:B=>{B.stopPropagation(),re(!1)}},width:23.5+"em"}),O&&$&&$.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-10 hfl-mt-1 hfl-max-h-80 hfl-w-full hfl-overflow-y-auto hfl-rounded-lg hfl-border hfl-border-Blue_gray-200 hfl-bg-Indigo-25 hfl-shadow-md ",children:$.map(B=>e.jsxRuntimeExports.jsx(e.ks,{label:B,className:"hfl-text-Primary-700",onSelect:()=>hr(B)}))})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-[368px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Tag",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:oe,placeholder:"Enter Tag",onChange:B=>{at("tag",B.target.value)}},width:"22em"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pb-2",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Mobile 2",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:De,maxLength:10,placeholder:"Enter Secondary Number",onChange:B=>{at("phone_secondary",B.target.value.replace(/[^0-9]/g,""))}},width:23.5+"em"})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-[368px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Aadhar Number",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Pe,maxLength:12,placeholder:"Aadhar Card Number",onChange:B=>{at("aadhar_number",B.target.value)},onBlur:()=>{S(B=>({...B,aadhar_number:d.aadhar_number&&d.aadhar_number.length!=12?"Please enter 12 digit aadhar number":""}))}},width:"22em"})})]}),g&&e.jsxRuntimeExports.jsx("div",{className:"hfl-align-center hfl-flex hfl-flex-1 hfl-flex-row hfl-justify-between hfl-gap-1 hfl-pb-8",children:e.jsxRuntimeExports.jsx(e.Ap,{label:"Partner Company",placeholder:"Select Partner",value:{label:N?.partner_name??""},onChange:B=>{P(ye=>({...ye,partner_name:B.value}))},options:lr,disabled:!!d?.insurance_details?.policy_id,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"opd-insurance"})}),g&&N?.partner_name&&e.jsxRuntimeExports.jsxs("div",{ref:A,className:"hfl-flex hfl-flex-1 hfl-flex-row hfl-items-center hfl-justify-between hfl-pb-8 hfl-pt-2",children:[e.jsxRuntimeExports.jsx(e.Ap,{label:"Insurance Company",placeholder:"Select Provider",value:{label:N?.policy_company??"Select Provider"},onChange:B=>{P(ye=>({...ye,policy_company:B.value}))},options:L,disabled:!!d?.insurance_details?.policy_id,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"opd-insurance"}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-justify-between ${D?"hfl-items-center":"hfl-items-end"}`,children:[e.jsxRuntimeExports.jsx(e.Ps,{label:"Policy Number",labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:N?.policy_id??"",placeholder:"Enter Policy Number",onChange:B=>{P(ye=>({...ye,policy_id:B.target.value}))},disabled:!!d?.insurance_details?.policy_id},errorMsg:D,width:d?.insurance_details?.policy_id?16.5+"em":17.5+"em"}),e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-ml-4 hfl-px-4 hfl-py-[1.2rem]",hierarchy:"Primary",size:"md",onClick:()=>z(N),textField:d?.insurance_details?.policy_id?"Verified":"Verify",style:{pointerEvents:d?.insurance_details?.policy_id?"none":"unset"}})]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-grid hfl-grid-cols-2 hfl-gap-x-36 hfl-gap-y-6",children:pr()})]})]})})}),Kn=i=>{const{getPatientDetails:d,setPatientAbhaDetails:c,patientAbhaDetails:n,isPartnerServiceEnabled:y,partnerConfig:R}=i,[l,I]=v.useState(""),[S,h]=v.useState(!1),[V,g]=v.useState(!1),[L,W]=v.useState(!1),[z,D]=v.useState([]),[N,P]=v.useState([]),A=v.useRef(null),j=v.useRef(null),[Q,M]=v.useState("profile"),{docPreference:G,patientDetails:k,preferences:$,patientIDs:X,billPreferences:O,showToast:re,patientCustomFieldData:ce,variable:_e}=v.useContext(Tt)||{},xe=k?.org_person_bid_str||"",[Ve,ie]=v.useState([]),[Y,fe]=v.useState(""),[H,Ce]=v.useState({partner_name:"",policy_company:"",policy_id:""}),Fe=v.useRef(null),[ke,xt]=v.useState({name:"",phone_number:"",age:"",gender:"",email:""}),He=(oe,Be,Pe)=>e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[60px] hfl-flex-col hfl-items-center hfl-rounded hfl-px-1 hfl-py-2 hfl-text-center ${Q===oe?"hfl-bg-Primary-50 hfl-text-Primary-600":""} hfl-cursor-pointer`,onClick:()=>M(oe),children:[e.jsxRuntimeExports.jsx("div",{className:Be}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:Pe})]},oe),[st,_t]=v.useState(k),pt=async()=>{try{h(!1);const oe=await navigator.mediaDevices.getUserMedia({video:!0});j.current&&(j.current.srcObject=oe,W(!0))}catch(oe){console.error("Error accessing camera:",oe)}},Pt=oe=>{h(!1),W(!1);const Be=oe.target.files?.[0];if(!Be)return;const Pe=new FileReader;Pe.onloadend=()=>{const mt=Pe.result;typeof mt=="string"?I(mt):console.error("Failed to read file as a data URL."),oe.target&&(oe.target.value="")},Pe.onerror=()=>{console.error("There was an issue reading the file.")},Pe.readAsDataURL(Be)},Rt=()=>{document.getElementById("upload-local-file")?.click()},Dt=()=>{re?.("Success","Image deleted successfully","Success",3e3),h(!0),I(""),W(!1),T()},Gt=oe=>{I(oe),h(!1),W(!1)},T=()=>{if(j.current&&j.current.srcObject){const oe=j.current.srcObject;oe instanceof MediaStream&&oe.getTracks().forEach(Be=>Be.stop())}},De=()=>{const oe=A.current,Be=j.current;if(oe&&Be){oe.width=Be.videoWidth,oe.height=Be.videoHeight;const Pe=oe.getContext("2d");Pe&&Pe.drawImage(Be,0,0,oe.width,oe.height);const mt=oe.toDataURL();I(mt),h(!1),W(!1),T()}};v.useEffect(()=>{(async()=>{try{const oe=await yn(_e),{total_ref_doc_details:Be,through_channel:Pe}=oe;Be.length&&D(jn(Be)),Pe.length&&P(bn(Pe))}catch(oe){console.log("ERROR",oe)}})()},[_e]),v.useEffect(()=>{Ce({partner_name:st?.insurance_details?.partner||"",policy_company:st?.insurance_details?.policy_company||"",policy_id:st?.insurance_details?.policy_id||""})},[st?.insurance_details]),v.useEffect(()=>{const oe=async Be=>{try{const mt=(await Dn(Be,_e))?.insurance_companies||{},Zt=Object.entries(mt).map(([ct,Ot])=>({value:ct,label:Ot}));ie(Zt)}catch(Pe){console.error("Failed to fetch insurance list:",Pe),ie([])}};H?.partner_name&&y?oe(H?.partner_name):ie([])},[y,H?.partner_name,_e]),v.useEffect(()=>{Fe?.current?.scrollIntoView({behavior:"smooth"})},[H.partner_name]);const qe=async oe=>{if(R&&R[oe?.partner_name]?.verify_insurance?.enable){const Be=await Tn({...oe,patient_role_id:st?.patient_id||""},_e),{data:Pe}=Be||{};if(Pe.status_code===200)fe(""),re?.("Insurance Verified Successfully","","Success",3e3);else if(Pe?.error||Be?.status===500)throw fe("Policy Number is Incorrect"),console.log(Pe?.error),new Error(Pe?.error)}},ae=async(oe,Be)=>{const Pe=new FormData;Pe.append("pid",oe),Pe.append("bidstr",Be),Pe.append("imgData",l);const mt=await Rn(Pe,_e);mt.apiError&&re?.("Error",mt.apiError,"Error",3e3)},J=async oe=>{const Be=new FormData;Be.append("pid",oe);const Pe=await Kr.deletePatientImage(Be,_e);Pe.apiError&&re("Error",Pe.apiError,"Error",3e3)},K=async(oe=st?.name??"",Be=st?.org_person_dob??"")=>{if(!st||!X?.patientRoleID){re?.("Error","Patient data not available.","Error",3e3);return}const Pe={...st,name:oe,org_person_dob:Be};try{st.image_link&&!l?await J(X.patientRoleID):l&&V&&(await ae(X.patientRoleID,xe),g(!1));const mt=await vn(Pe,_e,X);mt.status?(re?.("Success",mt.message,"Success",3e3),d(X.patientRoleID)):re?.("Error",mt.message,"Error",3e3)}catch(mt){console.error("Error updating patient details:",mt)}};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-flex-row hfl-bg-White ",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-gap-4 hfl-border-r-1 hfl-border-Gray-200 hfl-bg-Gray-50 hfl-px-1 hfl-py-2",children:He("profile","hx_person-id-filled hfl-text-5","Profile")}),Q==="sms"?e.jsxRuntimeExports.jsx(Yn,{}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full xxs:max-md:hfl-w-[915px]",children:[e.jsxRuntimeExports.jsxs("div",{className:" hfl-mt-4 hfl-justify-center hfl-overflow-y-auto",children:[G?.abha?.link_patient_rx&&e.jsxRuntimeExports.jsx(qn,{patientAbhaDetails:n,patientData:st,savePatientDetailsHandler:K,setPatientAbhaDetails:c}),e.jsxRuntimeExports.jsx(Un,{setPatientData:_t,patientData:st,preferences:$,referredByDocList:z,throughChannelList:N,showImageFromLink:Gt,setValidators:xt,validators:ke,billPreferences:O,isAbhaVerified:n?.patient_details_mongo?.length,isPartnerServiceEnabled:y,insuranceData:Ve,partnerConfig:R,verifyInsuranceHandler:qe,policyNumberErrorMessage:Y,selectedInsuranceDetails:H,setSelectedInsuranceDetails:Ce,insuranceDivRef:Fe,patientCustomFieldData:ce})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-px-4 hfl-py-9",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-justify-start hfl-pt-3",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-h-[150px] hfl-w-[200px] hfl-items-center hfl-justify-center
|
|
3
|
-
hfl-rounded-3xl hfl-border-4
|
|
4
|
-
hfl-border-White hfl-bg-Primary-50 hfl-shadow-lg`,children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-flex-col hfl-items-center hfl-justify-between
|
|
5
|
-
${S?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Camera",className:"hfl-mb-2",onClick:pt,icon:"Left",iconFile:"hx_camera","data-qa":"cam-btn"}),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("input",{id:"upload-local-file",type:"file",style:{display:"none"},accept:"image/*",onChange:Pt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:Rt,"data-qa":"choos-img"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
|
|
6
|
-
${L?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("canvas",{ref:A,style:{display:"none"}}),e.jsxRuntimeExports.jsx("video",{ref:j,className:"hfl-object-fit hfl-h-full hfl-w-full hfl-rounded-3xl",autoPlay:!0}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-bottom-0 hfl-left-0 hfl-right-0 hfl-flex hfl-justify-around",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Cancel",className:"hfl-mb-2 hfl-bg-Error-600 hover:hfl-bg-Error-700",onClick:Dt}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Capture",className:"hfl-mb-2 hfl-bg-Primary-600",onClick:De})]})]}),e.jsxRuntimeExports.jsx("div",{className:S||l||L?"hfl-hidden":"hfl-cursor-pointer hfl-px-[60px] hfl-py-[40px]",onClick:()=>{g(!0),h(!0)},"data-qa":"profile-img",children:e.jsxRuntimeExports.jsxs("svg",{width:"76",height:"72",viewBox:"0 0 76 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsxRuntimeExports.jsx("path",{opacity:"0.4",d:"M75.375 26.0477V57.1667C75.6016 59.1092 75.3857 61.0778 74.7434 62.925C74.1011 64.7722 73.0491 66.4501 71.6663 67.8329C70.2834 69.2158 68.6055 70.2678 66.7583 70.9101C64.9111 71.5524 62.9425 71.7683 61 71.5417H15C13.0575 71.7683 11.0889 71.5524 9.2417 70.9101C7.3945 70.2678 5.71661 69.2158 4.33373 67.8329C2.95086 66.4501 1.89887 64.7722 1.25659 62.925C0.614305 61.0778 0.398381 59.1092 0.624996 57.1667V18.8333C0.398381 16.8908 0.614305 14.9222 1.25659 13.075C1.89887 11.2278 2.95086 9.54994 4.33373 8.16707C5.71661 6.7842 7.3945 5.73221 9.2417 5.08992C11.0889 4.44764 13.0575 4.23172 15 4.45833H48.7333C48.9029 4.46277 49.0695 4.50469 49.221 4.58109C49.3725 4.65748 49.5052 4.76645 49.6096 4.90019C49.7141 5.03393 49.7876 5.18911 49.825 5.35462C49.8624 5.52013 49.8626 5.69187 49.8258 5.8575C48.9214 10.3365 49.831 14.9913 52.355 18.8004C54.879 22.6094 58.8112 25.2613 63.2885 26.1742C66.8321 26.8826 70.5088 26.4602 73.7995 24.9667C73.975 24.8968 74.1649 24.8712 74.3526 24.8921C74.5403 24.9131 74.72 24.9799 74.8757 25.0868C75.0314 25.1936 75.1584 25.3372 75.2455 25.5048C75.3326 25.6724 75.3771 25.8588 75.375 26.0477Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M69.2877 46.2877L52.2217 29.2217C51.4989 28.5016 50.5202 28.0973 49.5 28.0973C48.4798 28.0973 47.5011 28.5016 46.7783 29.2217L27.8417 48.1583C27.4834 48.5095 27.0017 48.7062 26.5 48.7062C25.9983 48.7062 25.5166 48.5095 25.1583 48.1583L21.555 44.555C20.8322 43.835 19.8536 43.4307 18.8333 43.4307C17.8131 43.4307 16.8344 43.835 16.1117 44.555L6.71233 53.9543C6.49661 54.1698 6.37527 54.4621 6.375 54.767V57.1667C6.375 63.2233 8.94333 65.7917 15 65.7917H61C67.0567 65.7917 69.625 63.2233 69.625 57.1667V47.1003C69.6247 46.7954 69.5034 46.5031 69.2877 46.2877Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M22.6667 31.2917C22.0374 31.2939 21.4139 31.1722 20.8317 30.9335C20.2494 30.6948 19.7199 30.3438 19.2734 29.9004C18.3715 29.005 17.8623 27.7881 17.8577 26.5172C17.8532 25.2464 18.3536 24.0258 19.249 23.124C20.1444 22.2221 21.3613 21.7129 22.6322 21.7083H22.6667C23.9375 21.7083 25.1563 22.2132 26.0549 23.1118C26.9535 24.0104 27.4583 25.2292 27.4583 26.5C27.4583 27.7708 26.9535 28.9896 26.0549 29.8882C25.1563 30.7868 23.9375 31.2917 22.6667 31.2917Z",fill:"#396CE8"}),e.jsxRuntimeExports.jsx("path",{d:"M74.5317 7.21833L68.7817 1.46833C68.2421 0.930873 67.5116 0.629108 66.75 0.629108C65.9884 0.629108 65.2579 0.930873 64.7183 1.46833L58.9683 7.21833C58.4605 7.76333 58.184 8.48418 58.1972 9.229C58.2103 9.97382 58.512 10.6845 59.0388 11.2112C59.5655 11.738 60.2762 12.0397 61.021 12.0528C61.7658 12.066 62.4867 11.7895 63.0317 11.2817L63.875 10.4422V18.8333C63.875 19.5958 64.1779 20.3271 64.7171 20.8663C65.2562 21.4054 65.9875 21.7083 66.75 21.7083C67.5125 21.7083 68.2438 21.4054 68.7829 20.8663C69.3221 20.3271 69.625 19.5958 69.625 18.8333V10.4422L70.4683 11.2817C71.0133 11.7895 71.7342 12.066 72.479 12.0528C73.2238 12.0397 73.9345 11.738 74.4612 11.2112C74.988 10.6845 75.2897 9.97382 75.3028 9.229C75.316 8.48418 75.0395 7.76333 74.5317 7.21833Z",fill:"#396CE8"})]})}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-w-full
|
|
7
|
-
${l?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("img",{alt:"",src:l,className:"hfl-h-full hfl-w-full hfl-rounded-3xl hfl-object-cover"}),e.jsxRuntimeExports.jsx("div",{className:`hfl-absolute hfl-right-2 hfl-top-2 hfl-flex hfl-h-[40px]
|
|
8
|
-
hfl-w-[40px] hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-rounded-full hfl-bg-White`,onClick:()=>{g(!0),Dt()},"data-qa":"close-icon",children:e.jsxRuntimeExports.jsx("i",{className:"hx_delete hfl-text-[22px]"})})]})]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-pt-8",children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Save Patient Details",className:"hfl-w-[200px] hfl-justify-center",onClick:()=>K(),"data-qa":"save-details"})})]})]})]})};var As={exports:{}},qr={exports:{}},Zn=qr.exports,Ml;function $n(){return Ml||(Ml=1,function(i,d){(function(c,n){n(d,v)})(Zn,function(c,n){function y(t,o,f,p,w,_,C){try{var q=t[_](C),Z=q.value}catch(ee){return void f(ee)}q.done?o(Z):Promise.resolve(Z).then(p,w)}function R(t){return function(){var o=this,f=arguments;return new Promise(function(p,w){var _=t.apply(o,f);function C(Z){y(_,p,w,C,q,"next",Z)}function q(Z){y(_,p,w,C,q,"throw",Z)}C(void 0)})}}function l(){return(l=Object.assign||function(t){for(var o=1;o<arguments.length;o++){var f=arguments[o];for(var p in f)Object.prototype.hasOwnProperty.call(f,p)&&(t[p]=f[p])}return t}).apply(this,arguments)}function I(t,o){if(t==null)return{};var f,p,w={},_=Object.keys(t);for(p=0;p<_.length;p++)f=_[p],o.indexOf(f)>=0||(w[f]=t[f]);return w}function S(t){var o=function(f,p){if(typeof f!="object"||f===null)return f;var w=f[Symbol.toPrimitive];if(w!==void 0){var _=w.call(f,p);if(typeof _!="object")return _;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(f)}(t,"string");return typeof o=="symbol"?o:String(o)}n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;var h={init:"init"},V=function(t){var o=t.value;return o===void 0?"":o},g=function(){return n.createElement(n.Fragment,null," ")},L={Cell:V,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function W(){for(var t=arguments.length,o=new Array(t),f=0;f<t;f++)o[f]=arguments[f];return o.reduce(function(p,w){var _=w.style,C=w.className;return p=l({},p,{},I(w,["style","className"])),_&&(p.style=p.style?l({},p.style||{},{},_||{}):_),C&&(p.className=p.className?p.className+" "+C:C),p.className===""&&delete p.className,p},{})}var z=function(t,o){return o===void 0&&(o={}),function(f){return f===void 0&&(f={}),[].concat(t,[f]).reduce(function(p,w){return function _(C,q,Z){return typeof q=="function"?_({},q(C,Z)):Array.isArray(q)?W.apply(void 0,[C].concat(q)):W(C,q)}(p,w,l({},o,{userProps:f}))},{})}},D=function(t,o,f,p){return f===void 0&&(f={}),t.reduce(function(w,_){return _(w,f)},o)},N=function(t,o,f){return f===void 0&&(f={}),t.forEach(function(p){p(o,f)})};function P(t,o,f,p){t.findIndex(function(w){return w.pluginName===f}),o.forEach(function(w){t.findIndex(function(_){return _.pluginName===w})})}function A(t,o){return typeof t=="function"?t(o):t}function j(t){var o=n.useRef();return o.current=t,n.useCallback(function(){return o.current},[])}var Q=typeof document<"u"?n.useLayoutEffect:n.useEffect;function M(t,o){var f=n.useRef(!1);Q(function(){f.current&&t(),f.current=!0},o)}function G(t,o,f){return f===void 0&&(f={}),function(p,w){w===void 0&&(w={});var _=typeof p=="string"?o[p]:p;if(_===void 0)throw console.info(o),new Error("Renderer Error ☝️");return k(_,l({},t,{column:o},f,{},w))}}function k(t,o){return function(p){return typeof p=="function"&&(w=Object.getPrototypeOf(p)).prototype&&w.prototype.isReactComponent;var w}(f=t)||typeof f=="function"||function(p){return typeof p=="object"&&typeof p.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(p.$$typeof.description)}(f)?n.createElement(t,o):t;var f}function $(t,o,f){return f===void 0&&(f=0),t.map(function(p){return O(p=l({},p,{parent:o,depth:f})),p.columns&&(p.columns=$(p.columns,p,f+1)),p})}function X(t){return ie(t,"columns")}function O(t){var o=t.id,f=t.accessor,p=t.Header;if(typeof f=="string"){o=o||f;var w=f.split(".");f=function(_){return function(C,q,Z){if(!q)return C;var ee,ge=typeof q=="function"?q:JSON.stringify(q),he=_e.get(ge)||function(){var pe=function(se){return function de(Re,Se){if(Se===void 0&&(Se=[]),Array.isArray(Re))for(var Oe=0;Oe<Re.length;Oe+=1)de(Re[Oe],Se);else Se.push(Re);return Se}(se).map(function(de){return String(de).replace(".","_")}).join(".").replace(ke,".").replace(xt,"").split(".")}(q);return _e.set(ge,pe),pe}();try{ee=he.reduce(function(pe,se){return pe[se]},C)}catch{}return ee!==void 0?ee:Z}(_,w)}}if(!o&&typeof p=="string"&&p&&(o=p),!o&&t.columns)throw console.error(t),new Error('A column ID (or unique "Header" value) is required!');if(!o)throw console.error(t),new Error("A column ID (or string accessor) is required!");return Object.assign(t,{id:o,accessor:f}),t}function re(t,o){if(!o)throw new Error;return Object.assign(t,l({Header:g,Footer:g},L,{},o,{},t)),Object.assign(t,{originalWidth:t.width}),t}function ce(t,o,f){f===void 0&&(f=function(){return{}});for(var p=[],w=t,_=0,C=function(){return _++},q=function(){var Z={headers:[]},ee=[],ge=w.some(function(he){return he.parent});w.forEach(function(he){var pe,se=[].concat(ee).reverse()[0];ge&&(he.parent?pe=l({},he.parent,{originalId:he.parent.id,id:he.parent.id+"_"+C(),headers:[he]},f(he)):pe=re(l({originalId:he.id+"_placeholder",id:he.id+"_placeholder_"+C(),placeholderOf:he,headers:[he]},f(he)),o),se&&se.originalId===pe.originalId?se.headers.push(he):ee.push(pe)),Z.headers.push(he)}),p.push(Z),w=ee};w.length;)q();return p.reverse()}var _e=new Map;function xe(){for(var t=arguments.length,o=new Array(t),f=0;f<t;f++)o[f]=arguments[f];for(var p=0;p<o.length;p+=1)if(o[p]!==void 0)return o[p]}function Ve(t){if(typeof t=="function")return t}function ie(t,o){var f=[];return function p(w){w.forEach(function(_){_[o]?p(_[o]):f.push(_)})}(t),f}function Y(t,o){var f=o.manualExpandedKey,p=o.expanded,w=o.expandSubRows,_=w===void 0||w,C=[];return t.forEach(function(q){return function Z(ee,ge){ge===void 0&&(ge=!0),ee.isExpanded=ee.original&&ee.original[f]||p[ee.id],ee.canExpand=ee.subRows&&!!ee.subRows.length,ge&&C.push(ee),ee.subRows&&ee.subRows.length&&ee.isExpanded&&ee.subRows.forEach(function(he){return Z(he,_)})}(q)}),C}function fe(t,o,f){return Ve(t)||o[t]||f[t]||f.text}function H(t,o,f){return t?t(o,f):o===void 0}function Ce(){throw new Error("React-Table: You have not called prepareRow(row) one or more rows you are attempting to render.")}var Fe=null,ke=/\[/g,xt=/\]/g,He=function(t){return l({role:"table"},t)},st=function(t){return l({role:"rowgroup"},t)},_t=function(t,o){var f=o.column;return l({key:"header_"+f.id,colSpan:f.totalVisibleHeaderCount,role:"columnheader"},t)},pt=function(t,o){var f=o.column;return l({key:"footer_"+f.id,colSpan:f.totalVisibleHeaderCount},t)},Pt=function(t,o){return l({key:"headerGroup_"+o.index,role:"row"},t)},Rt=function(t,o){return l({key:"footerGroup_"+o.index},t)},Dt=function(t,o){return l({key:"row_"+o.row.id,role:"row"},t)},Gt=function(t,o){var f=o.cell;return l({key:"cell_"+f.row.id+"_"+f.column.id,role:"cell"},t)};function T(){return{useOptions:[],stateReducers:[],useControlledState:[],columns:[],columnsDeps:[],allColumns:[],allColumnsDeps:[],accessValue:[],materializedColumns:[],materializedColumnsDeps:[],useInstanceAfterData:[],visibleColumns:[],visibleColumnsDeps:[],headerGroups:[],headerGroupsDeps:[],useInstanceBeforeDimensions:[],useInstance:[],prepareRow:[],getTableProps:[He],getTableBodyProps:[st],getHeaderGroupProps:[Pt],getFooterGroupProps:[Rt],getHeaderProps:[_t],getFooterProps:[pt],getRowProps:[Dt],getCellProps:[Gt],useFinalInstance:[]}}h.resetHiddenColumns="resetHiddenColumns",h.toggleHideColumn="toggleHideColumn",h.setHiddenColumns="setHiddenColumns",h.toggleHideAllColumns="toggleHideAllColumns";var De=function(t){t.getToggleHiddenProps=[qe],t.getToggleHideAllColumnsProps=[ae],t.stateReducers.push(J),t.useInstanceBeforeDimensions.push(K),t.headerGroupsDeps.push(function(o,f){var p=f.instance;return[].concat(o,[p.state.hiddenColumns])}),t.useInstance.push(oe)};De.pluginName="useColumnVisibility";var qe=function(t,o){var f=o.column;return[t,{onChange:function(p){f.toggleHidden(!p.target.checked)},style:{cursor:"pointer"},checked:f.isVisible,title:"Toggle Column Visible"}]},ae=function(t,o){var f=o.instance;return[t,{onChange:function(p){f.toggleHideAllColumns(!p.target.checked)},style:{cursor:"pointer"},checked:!f.allColumnsHidden&&!f.state.hiddenColumns.length,title:"Toggle All Columns Hidden",indeterminate:!f.allColumnsHidden&&f.state.hiddenColumns.length}]};function J(t,o,f,p){if(o.type===h.init)return l({hiddenColumns:[]},t);if(o.type===h.resetHiddenColumns)return l({},t,{hiddenColumns:p.initialState.hiddenColumns||[]});if(o.type===h.toggleHideColumn){var w=(o.value!==void 0?o.value:!t.hiddenColumns.includes(o.columnId))?[].concat(t.hiddenColumns,[o.columnId]):t.hiddenColumns.filter(function(_){return _!==o.columnId});return l({},t,{hiddenColumns:w})}return o.type===h.setHiddenColumns?l({},t,{hiddenColumns:A(o.value,t.hiddenColumns)}):o.type===h.toggleHideAllColumns?l({},t,{hiddenColumns:(o.value!==void 0?o.value:!t.hiddenColumns.length)?p.allColumns.map(function(_){return _.id}):[]}):void 0}function K(t){var o=t.headers,f=t.state.hiddenColumns;n.useRef(!1).current;var p=0;o.forEach(function(w){return p+=function _(C,q){C.isVisible=q&&!f.includes(C.id);var Z=0;return C.headers&&C.headers.length?C.headers.forEach(function(ee){return Z+=_(ee,C.isVisible)}):Z=C.isVisible?1:0,C.totalVisibleHeaderCount=Z,Z}(w,!0)})}function oe(t){var o=t.columns,f=t.flatHeaders,p=t.dispatch,w=t.allColumns,_=t.getHooks,C=t.state.hiddenColumns,q=t.autoResetHiddenColumns,Z=q===void 0||q,ee=j(t),ge=w.length===C.length,he=n.useCallback(function(Se,Oe){return p({type:h.toggleHideColumn,columnId:Se,value:Oe})},[p]),pe=n.useCallback(function(Se){return p({type:h.setHiddenColumns,value:Se})},[p]),se=n.useCallback(function(Se){return p({type:h.toggleHideAllColumns,value:Se})},[p]),de=z(_().getToggleHideAllColumnsProps,{instance:ee()});f.forEach(function(Se){Se.toggleHidden=function(Oe){p({type:h.toggleHideColumn,columnId:Se.id,value:Oe})},Se.getToggleHiddenProps=z(_().getToggleHiddenProps,{instance:ee(),column:Se})});var Re=j(Z);M(function(){Re()&&p({type:h.resetHiddenColumns})},[p,o]),Object.assign(t,{allColumnsHidden:ge,toggleHideColumn:he,setHiddenColumns:pe,toggleHideAllColumns:se,getToggleHideAllColumnsProps:de})}var Be={},Pe={},mt=function(t,o,f){return t},Zt=function(t,o){return t.subRows||[]},ct=function(t,o,f){return""+(f?[f.id,o].join("."):o)},Ot=function(t){return t};function kt(t){var o=t.initialState,f=o===void 0?Be:o,p=t.defaultColumn,w=p===void 0?Pe:p,_=t.getSubRows,C=_===void 0?Zt:_,q=t.getRowId,Z=q===void 0?ct:q,ee=t.stateReducer,ge=ee===void 0?mt:ee,he=t.useControlledState,pe=he===void 0?Ot:he;return l({},I(t,["initialState","defaultColumn","getSubRows","getRowId","stateReducer","useControlledState"]),{initialState:f,defaultColumn:w,getSubRows:C,getRowId:Z,stateReducer:ge,useControlledState:pe})}function er(t,o){o===void 0&&(o=0);var f=0,p=0,w=0,_=0;return t.forEach(function(C){var q=C.headers;if(C.totalLeft=o,q&&q.length){var Z=er(q,o),ee=Z[0],ge=Z[1],he=Z[2],pe=Z[3];C.totalMinWidth=ee,C.totalWidth=ge,C.totalMaxWidth=he,C.totalFlexWidth=pe}else C.totalMinWidth=C.minWidth,C.totalWidth=Math.min(Math.max(C.minWidth,C.width),C.maxWidth),C.totalMaxWidth=C.maxWidth,C.totalFlexWidth=C.canResize?C.totalWidth:0;C.isVisible&&(o+=C.totalWidth,f+=C.totalMinWidth,p+=C.totalWidth,w+=C.totalMaxWidth,_+=C.totalFlexWidth)}),[f,p,w,_]}function Qt(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.column,C=t.getRowId,q=t.getSubRows,Z=t.accessValueHooks,ee=t.getInstance;o.forEach(function(ge,he){return function pe(se,de,Re,Se,Oe){Re===void 0&&(Re=0);var lt=se,We=C(se,de,Se),ve=w[We];if(ve)ve.subRows&&ve.originalSubRows.forEach(function(Me,Je){return pe(Me,Je,Re+1,ve)});else if((ve={id:We,original:lt,index:de,depth:Re,cells:[{}]}).cells.map=Ce,ve.cells.filter=Ce,ve.cells.forEach=Ce,ve.cells[0].getCellProps=Ce,ve.values={},Oe.push(ve),p.push(ve),w[We]=ve,ve.originalSubRows=q(se,de),ve.originalSubRows){var tt=[];ve.originalSubRows.forEach(function(Me,Je){return pe(Me,Je,Re+1,ve,tt)}),ve.subRows=tt}_.accessor&&(ve.values[_.id]=_.accessor(se,de,ve,Oe,o)),ve.values[_.id]=D(Z,ve.values[_.id],{row:ve,column:_,instance:ee()})}(ge,he,0,void 0,f)})}h.resetExpanded="resetExpanded",h.toggleRowExpanded="toggleRowExpanded",h.toggleAllRowsExpanded="toggleAllRowsExpanded";var rr=function(t){t.getToggleAllRowsExpandedProps=[lr],t.getToggleRowExpandedProps=[br],t.stateReducers.push(nr),t.useInstance.push(at),t.prepareRow.push(fr)};rr.pluginName="useExpanded";var lr=function(t,o){var f=o.instance;return[t,{onClick:function(p){f.toggleAllRowsExpanded()},style:{cursor:"pointer"},title:"Toggle All Rows Expanded"}]},br=function(t,o){var f=o.row;return[t,{onClick:function(){f.toggleRowExpanded()},style:{cursor:"pointer"},title:"Toggle Row Expanded"}]};function nr(t,o,f,p){if(o.type===h.init)return l({expanded:{}},t);if(o.type===h.resetExpanded)return l({},t,{expanded:p.initialState.expanded||{}});if(o.type===h.toggleAllRowsExpanded){var w=o.value,_=p.rowsById,C=Object.keys(_).length===Object.keys(t.expanded).length;if(w!==void 0?w:!C){var q={};return Object.keys(_).forEach(function(de){q[de]=!0}),l({},t,{expanded:q})}return l({},t,{expanded:{}})}if(o.type===h.toggleRowExpanded){var Z,ee=o.id,ge=o.value,he=t.expanded[ee],pe=ge!==void 0?ge:!he;if(!he&&pe)return l({},t,{expanded:l({},t.expanded,(Z={},Z[ee]=!0,Z))});if(he&&!pe){var se=t.expanded;return se[ee],l({},t,{expanded:I(se,[ee].map(S))})}return t}}function at(t){var o=t.data,f=t.rows,p=t.rowsById,w=t.manualExpandedKey,_=w===void 0?"expanded":w,C=t.paginateExpandedRows,q=C===void 0||C,Z=t.expandSubRows,ee=Z===void 0||Z,ge=t.autoResetExpanded,he=ge===void 0||ge,pe=t.getHooks,se=t.plugins,de=t.state.expanded,Re=t.dispatch;P(se,["useSortBy","useGroupBy","usePivotColumns","useGlobalFilter"],"useExpanded");var Se=j(he),Oe=!!(Object.keys(p).length&&Object.keys(de).length);Oe&&Object.keys(p).some(function(gt){return!de[gt]})&&(Oe=!1),M(function(){Se()&&Re({type:h.resetExpanded})},[Re,o]);var lt=n.useCallback(function(gt,Ue){Re({type:h.toggleRowExpanded,id:gt,value:Ue})},[Re]),We=n.useCallback(function(gt){return Re({type:h.toggleAllRowsExpanded,value:gt})},[Re]),ve=n.useMemo(function(){return q?Y(f,{manualExpandedKey:_,expanded:de,expandSubRows:ee}):f},[q,f,_,de,ee]),tt=n.useMemo(function(){return function(gt){var Ue=0;return Object.keys(gt).forEach(function($e){var wt=$e.split(".");Ue=Math.max(Ue,wt.length)}),Ue}(de)},[de]),Me=j(t),Je=z(pe().getToggleAllRowsExpandedProps,{instance:Me()});Object.assign(t,{preExpandedRows:f,expandedRows:ve,rows:ve,expandedDepth:tt,isAllRowsExpanded:Oe,toggleRowExpanded:lt,toggleAllRowsExpanded:We,getToggleAllRowsExpandedProps:Je})}function fr(t,o){var f=o.instance.getHooks,p=o.instance;t.toggleRowExpanded=function(w){return p.toggleRowExpanded(t.id,w)},t.getToggleRowExpandedProps=z(f().getToggleRowExpandedProps,{instance:p,row:t})}var hr=function(t,o,f){return t=t.filter(function(p){return o.some(function(w){var _=p.values[w];return String(_).toLowerCase().includes(String(f).toLowerCase())})})};hr.autoRemove=function(t){return!t};var or=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return _===void 0||String(_).toLowerCase()===String(f).toLowerCase()})})};or.autoRemove=function(t){return!t};var ur=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return _===void 0||String(_)===String(f)})})};ur.autoRemove=function(t){return!t};var dt=function(t,o,f){return t.filter(function(p){return o.some(function(w){return p.values[w].includes(f)})})};dt.autoRemove=function(t){return!t||!t.length};var vt=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return _&&_.length&&f.every(function(C){return _.includes(C)})})})};vt.autoRemove=function(t){return!t||!t.length};var ft=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return _&&_.length&&f.some(function(C){return _.includes(C)})})})};ft.autoRemove=function(t){return!t||!t.length};var Et=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return f.includes(_)})})};Et.autoRemove=function(t){return!t||!t.length};var Bt=function(t,o,f){return t.filter(function(p){return o.some(function(w){return p.values[w]===f})})};Bt.autoRemove=function(t){return t===void 0};var Ht=function(t,o,f){return t.filter(function(p){return o.some(function(w){return p.values[w]==f})})};Ht.autoRemove=function(t){return t==null};var $t=function(t,o,f){var p=f||[],w=p[0],_=p[1];if((w=typeof w=="number"?w:-1/0)>(_=typeof _=="number"?_:1/0)){var C=w;w=_,_=C}return t.filter(function(q){return o.some(function(Z){var ee=q.values[Z];return ee>=w&&ee<=_})})};$t.autoRemove=function(t){return!t||typeof t[0]!="number"&&typeof t[1]!="number"};var Ft=Object.freeze({__proto__:null,text:hr,exactText:or,exactTextCase:ur,includes:dt,includesAll:vt,includesSome:ft,includesValue:Et,exact:Bt,equals:Ht,between:$t});h.resetFilters="resetFilters",h.setFilter="setFilter",h.setAllFilters="setAllFilters";var At=function(t){t.stateReducers.push(pr),t.useInstance.push(B)};function pr(t,o,f,p){if(o.type===h.init)return l({filters:[]},t);if(o.type===h.resetFilters)return l({},t,{filters:p.initialState.filters||[]});if(o.type===h.setFilter){var w=o.columnId,_=o.filterValue,C=p.allColumns,q=p.filterTypes,Z=C.find(function(Re){return Re.id===w});if(!Z)throw new Error("React-Table: Could not find a column with id: "+w);var ee=fe(Z.filter,q||{},Ft),ge=t.filters.find(function(Re){return Re.id===w}),he=A(_,ge&&ge.value);return H(ee.autoRemove,he,Z)?l({},t,{filters:t.filters.filter(function(Re){return Re.id!==w})}):l({},t,ge?{filters:t.filters.map(function(Re){return Re.id===w?{id:w,value:he}:Re})}:{filters:[].concat(t.filters,[{id:w,value:he}])})}if(o.type===h.setAllFilters){var pe=o.filters,se=p.allColumns,de=p.filterTypes;return l({},t,{filters:A(pe,t.filters).filter(function(Re){var Se=se.find(function(Oe){return Oe.id===Re.id});return!H(fe(Se.filter,de||{},Ft).autoRemove,Re.value,Se)})})}}function B(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.allColumns,C=t.filterTypes,q=t.manualFilters,Z=t.defaultCanFilter,ee=Z!==void 0&&Z,ge=t.disableFilters,he=t.state.filters,pe=t.dispatch,se=t.autoResetFilters,de=se===void 0||se,Re=n.useCallback(function(Me,Je){pe({type:h.setFilter,columnId:Me,filterValue:Je})},[pe]),Se=n.useCallback(function(Me){pe({type:h.setAllFilters,filters:Me})},[pe]);_.forEach(function(Me){var Je=Me.id,gt=Me.accessor,Ue=Me.defaultCanFilter,$e=Me.disableFilters;Me.canFilter=gt?xe($e!==!0&&void 0,ge!==!0&&void 0,!0):xe(Ue,ee,!1),Me.setFilter=function(et){return Re(Me.id,et)};var wt=he.find(function(et){return et.id===Je});Me.filterValue=wt&&wt.value});var Oe=n.useMemo(function(){if(q||!he.length)return[f,p,w];var Me=[],Je={};return[function gt(Ue,$e){$e===void 0&&($e=0);var wt=Ue;return(wt=he.reduce(function(et,yt){var r=yt.id,s=yt.value,u=_.find(function(x){return x.id===r});if(!u)return et;$e===0&&(u.preFilteredRows=et);var a=fe(u.filter,C||{},Ft);return a?(u.filteredRows=a(et,[r],s),u.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+u.id+"."),et)},Ue)).forEach(function(et){Me.push(et),Je[et.id]=et,et.subRows&&(et.subRows=et.subRows&&et.subRows.length>0?gt(et.subRows,$e+1):et.subRows)}),wt}(f),Me,Je]},[q,he,f,p,w,_,C]),lt=Oe[0],We=Oe[1],ve=Oe[2];n.useMemo(function(){_.filter(function(Me){return!he.find(function(Je){return Je.id===Me.id})}).forEach(function(Me){Me.preFilteredRows=lt,Me.filteredRows=lt})},[lt,he,_]);var tt=j(de);M(function(){tt()&&pe({type:h.resetFilters})},[pe,q?null:o]),Object.assign(t,{preFilteredRows:f,preFilteredFlatRows:p,preFilteredRowsById:w,filteredRows:lt,filteredFlatRows:We,filteredRowsById:ve,rows:lt,flatRows:We,rowsById:ve,setFilter:Re,setAllFilters:Se})}At.pluginName="useFilters",h.resetGlobalFilter="resetGlobalFilter",h.setGlobalFilter="setGlobalFilter";var ye=function(t){t.stateReducers.push(bt),t.useInstance.push(Lt)};function bt(t,o,f,p){if(o.type===h.resetGlobalFilter)return l({},t,{globalFilter:p.initialState.globalFilter||void 0});if(o.type===h.setGlobalFilter){var w=o.filterValue,_=p.userFilterTypes,C=fe(p.globalFilter,_||{},Ft),q=A(w,t.globalFilter);return H(C.autoRemove,q)?(t.globalFilter,I(t,["globalFilter"])):l({},t,{globalFilter:q})}}function Lt(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.allColumns,C=t.filterTypes,q=t.globalFilter,Z=t.manualGlobalFilter,ee=t.state.globalFilter,ge=t.dispatch,he=t.autoResetGlobalFilter,pe=he===void 0||he,se=t.disableGlobalFilter,de=n.useCallback(function(ve){ge({type:h.setGlobalFilter,filterValue:ve})},[ge]),Re=n.useMemo(function(){if(Z||ee===void 0)return[f,p,w];var ve=[],tt={},Me=fe(q,C||{},Ft);if(!Me)return console.warn("Could not find a valid 'globalFilter' option."),f;_.forEach(function(gt){var Ue=gt.disableGlobalFilter;gt.canFilter=xe(Ue!==!0&&void 0,se!==!0&&void 0,!0)});var Je=_.filter(function(gt){return gt.canFilter===!0});return[function gt(Ue){return(Ue=Me(Ue,Je.map(function($e){return $e.id}),ee)).forEach(function($e){ve.push($e),tt[$e.id]=$e,$e.subRows=$e.subRows&&$e.subRows.length?gt($e.subRows):$e.subRows}),Ue}(f),ve,tt]},[Z,ee,q,C,_,f,p,w,se]),Se=Re[0],Oe=Re[1],lt=Re[2],We=j(pe);M(function(){We()&&ge({type:h.resetGlobalFilter})},[ge,Z?null:o]),Object.assign(t,{preGlobalFilteredRows:f,preGlobalFilteredFlatRows:p,preGlobalFilteredRowsById:w,globalFilteredRows:Se,globalFilteredFlatRows:Oe,globalFilteredRowsById:lt,rows:Se,flatRows:Oe,rowsById:lt,setGlobalFilter:de,disableGlobalFilter:se})}function Xt(t,o){return o.reduce(function(f,p){return f+(typeof p=="number"?p:0)},0)}ye.pluginName="useGlobalFilter";var qt=Object.freeze({__proto__:null,sum:Xt,min:function(t){var o=t[0]||0;return t.forEach(function(f){typeof f=="number"&&(o=Math.min(o,f))}),o},max:function(t){var o=t[0]||0;return t.forEach(function(f){typeof f=="number"&&(o=Math.max(o,f))}),o},minMax:function(t){var o=t[0]||0,f=t[0]||0;return t.forEach(function(p){typeof p=="number"&&(o=Math.min(o,p),f=Math.max(f,p))}),o+".."+f},average:function(t){return Xt(0,t)/t.length},median:function(t){if(!t.length)return null;var o=Math.floor(t.length/2),f=[].concat(t).sort(function(p,w){return p-w});return t.length%2!=0?f[o]:(f[o-1]+f[o])/2},unique:function(t){return Array.from(new Set(t).values())},uniqueCount:function(t){return new Set(t).size},count:function(t){return t.length}}),tr=[],Jr={};h.resetGroupBy="resetGroupBy",h.setGroupBy="setGroupBy",h.toggleGroupBy="toggleGroupBy";var Dr=function(t){t.getGroupByToggleProps=[Qr],t.stateReducers.push(jr),t.visibleColumnsDeps.push(function(o,f){var p=f.instance;return[].concat(o,[p.state.groupBy])}),t.visibleColumns.push(es),t.useInstance.push(Ms),t.prepareRow.push(ts)};Dr.pluginName="useGroupBy";var Qr=function(t,o){var f=o.header;return[t,{onClick:f.canGroupBy?function(p){p.persist(),f.toggleGroupBy()}:void 0,style:{cursor:f.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function jr(t,o,f,p){if(o.type===h.init)return l({groupBy:[]},t);if(o.type===h.resetGroupBy)return l({},t,{groupBy:p.initialState.groupBy||[]});if(o.type===h.setGroupBy)return l({},t,{groupBy:o.value});if(o.type===h.toggleGroupBy){var w=o.columnId,_=o.value,C=_!==void 0?_:!t.groupBy.includes(w);return l({},t,C?{groupBy:[].concat(t.groupBy,[w])}:{groupBy:t.groupBy.filter(function(q){return q!==w})})}}function es(t,o){var f=o.instance.state.groupBy,p=f.map(function(_){return t.find(function(C){return C.id===_})}).filter(Boolean),w=t.filter(function(_){return!f.includes(_.id)});return(t=[].concat(p,w)).forEach(function(_){_.isGrouped=f.includes(_.id),_.groupedIndex=f.indexOf(_.id)}),t}var Fs={};function Ms(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.allColumns,C=t.flatHeaders,q=t.groupByFn,Z=q===void 0?rs:q,ee=t.manualGroupBy,ge=t.aggregations,he=ge===void 0?Fs:ge,pe=t.plugins,se=t.state.groupBy,de=t.dispatch,Re=t.autoResetGroupBy,Se=Re===void 0||Re,Oe=t.disableGroupBy,lt=t.defaultCanGroupBy,We=t.getHooks;P(pe,["useColumnOrder","useFilters"],"useGroupBy");var ve=j(t);_.forEach(function(u){var a=u.accessor,x=u.defaultGroupBy,b=u.disableGroupBy;u.canGroupBy=a?xe(u.canGroupBy,b!==!0&&void 0,Oe!==!0&&void 0,!0):xe(u.canGroupBy,x,lt,!1),u.canGroupBy&&(u.toggleGroupBy=function(){return t.toggleGroupBy(u.id)}),u.Aggregated=u.Aggregated||u.Cell});var tt=n.useCallback(function(u,a){de({type:h.toggleGroupBy,columnId:u,value:a})},[de]),Me=n.useCallback(function(u){de({type:h.setGroupBy,value:u})},[de]);C.forEach(function(u){u.getGroupByToggleProps=z(We().getGroupByToggleProps,{instance:ve(),header:u})});var Je=n.useMemo(function(){if(ee||!se.length)return[f,p,w,tr,Jr,p,w];var u=se.filter(function(te){return _.find(function(be){return be.id===te})}),a=[],x={},b=[],m={},E=[],F={},U=function te(be,ue,me){if(ue===void 0&&(ue=0),ue===u.length)return be.map(function(Ge){return l({},Ge,{depth:ue})});var je=u[ue],ne=Z(be,je);return Object.entries(ne).map(function(Ge,Ye){var Ze=Ge[0],Ee=Ge[1],rt=je+":"+Ze,ut=te(Ee,ue+1,rt=me?me+">"+rt:rt),Ne=ue?ie(Ee,"leafRows"):Ee,we=function(ze,nt,it){var St={};return _.forEach(function(Le){if(u.includes(Le.id))St[Le.id]=nt[0]?nt[0].values[Le.id]:null;else{var Wt=typeof Le.aggregate=="function"?Le.aggregate:he[Le.aggregate]||qt[Le.aggregate];if(Wt){var ot=nt.map(function(Qe){return Qe.values[Le.id]}),Xe=ze.map(function(Qe){var Nt=Qe.values[Le.id];if(!it&&Le.aggregateValue){var Yt=typeof Le.aggregateValue=="function"?Le.aggregateValue:he[Le.aggregateValue]||qt[Le.aggregateValue];if(!Yt)throw console.info({column:Le}),new Error("React Table: Invalid column.aggregateValue option for column listed above");Nt=Yt(Nt,Qe,Le)}return Nt});St[Le.id]=Wt(Xe,ot)}else{if(Le.aggregate)throw console.info({column:Le}),new Error("React Table: Invalid column.aggregate option for column listed above");St[Le.id]=null}}}),St}(Ne,Ee,ue),Ae={id:rt,isGrouped:!0,groupByID:je,groupByVal:Ze,values:we,subRows:ut,leafRows:Ne,depth:ue,index:Ye};return ut.forEach(function(ze){a.push(ze),x[ze.id]=ze,ze.isGrouped?(b.push(ze),m[ze.id]=ze):(E.push(ze),F[ze.id]=ze)}),Ae})}(f);return U.forEach(function(te){a.push(te),x[te.id]=te,te.isGrouped?(b.push(te),m[te.id]=te):(E.push(te),F[te.id]=te)}),[U,a,x,b,m,E,F]},[ee,se,f,p,w,_,he,Z]),gt=Je[0],Ue=Je[1],$e=Je[2],wt=Je[3],et=Je[4],yt=Je[5],r=Je[6],s=j(Se);M(function(){s()&&de({type:h.resetGroupBy})},[de,ee?null:o]),Object.assign(t,{preGroupedRows:f,preGroupedFlatRow:p,preGroupedRowsById:w,groupedRows:gt,groupedFlatRows:Ue,groupedRowsById:$e,onlyGroupedFlatRows:wt,onlyGroupedRowsById:et,nonGroupedFlatRows:yt,nonGroupedRowsById:r,rows:gt,flatRows:Ue,rowsById:$e,toggleGroupBy:tt,setGroupBy:Me})}function ts(t){t.allCells.forEach(function(o){var f;o.isGrouped=o.column.isGrouped&&o.column.id===t.groupByID,o.isPlaceholder=!o.isGrouped&&o.column.isGrouped,o.isAggregated=!o.isGrouped&&!o.isPlaceholder&&((f=t.subRows)==null?void 0:f.length)})}function rs(t,o){return t.reduce(function(f,p,w){var _=""+p.values[o];return f[_]=Array.isArray(f[_])?f[_]:[],f[_].push(p),f},{})}var ss=/([0-9]+)/gm;function Pr(t,o){return t===o?0:t>o?1:-1}function Rr(t,o,f){return[t.values[f],o.values[f]]}function ls(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}var Hs=Object.freeze({__proto__:null,alphanumeric:function(t,o,f){var p=Rr(t,o,f),w=p[0],_=p[1];for(w=ls(w),_=ls(_),w=w.split(ss).filter(Boolean),_=_.split(ss).filter(Boolean);w.length&&_.length;){var C=w.shift(),q=_.shift(),Z=parseInt(C,10),ee=parseInt(q,10),ge=[Z,ee].sort();if(isNaN(ge[0])){if(C>q)return 1;if(q>C)return-1}else{if(isNaN(ge[1]))return isNaN(Z)?-1:1;if(Z>ee)return 1;if(ee>Z)return-1}}return w.length-_.length},datetime:function(t,o,f){var p=Rr(t,o,f),w=p[0],_=p[1];return Pr(w=w.getTime(),_=_.getTime())},basic:function(t,o,f){var p=Rr(t,o,f);return Pr(p[0],p[1])},string:function(t,o,f){var p=Rr(t,o,f),w=p[0],_=p[1];for(w=w.split("").filter(Boolean),_=_.split("").filter(Boolean);w.length&&_.length;){var C=w.shift(),q=_.shift(),Z=C.toLowerCase(),ee=q.toLowerCase();if(Z>ee)return 1;if(ee>Z)return-1;if(C>q)return 1;if(q>C)return-1}return w.length-_.length},number:function(t,o,f){var p=Rr(t,o,f),w=p[0],_=p[1],C=/[^0-9.]/gi;return Pr(w=Number(String(w).replace(C,"")),_=Number(String(_).replace(C,"")))}});h.resetSortBy="resetSortBy",h.setSortBy="setSortBy",h.toggleSortBy="toggleSortBy",h.clearSortBy="clearSortBy",L.sortType="alphanumeric",L.sortDescFirst=!1;var ns=function(t){t.getSortByToggleProps=[Ls],t.stateReducers.push(ks),t.useInstance.push(Vs)};ns.pluginName="useSortBy";var Ls=function(t,o){var f=o.instance,p=o.column,w=f.isMultiSortEvent,_=w===void 0?function(C){return C.shiftKey}:w;return[t,{onClick:p.canSort?function(C){C.persist(),p.toggleSortBy(void 0,!f.disableMultiSort&&_(C))}:void 0,style:{cursor:p.canSort?"pointer":void 0},title:p.canSort?"Toggle SortBy":void 0}]};function ks(t,o,f,p){if(o.type===h.init)return l({sortBy:[]},t);if(o.type===h.resetSortBy)return l({},t,{sortBy:p.initialState.sortBy||[]});if(o.type===h.clearSortBy)return l({},t,{sortBy:t.sortBy.filter(function(ve){return ve.id!==o.columnId})});if(o.type===h.setSortBy)return l({},t,{sortBy:o.sortBy});if(o.type===h.toggleSortBy){var w,_=o.columnId,C=o.desc,q=o.multi,Z=p.allColumns,ee=p.disableMultiSort,ge=p.disableSortRemove,he=p.disableMultiRemove,pe=p.maxMultiSortColCount,se=pe===void 0?Number.MAX_SAFE_INTEGER:pe,de=t.sortBy,Re=Z.find(function(ve){return ve.id===_}).sortDescFirst,Se=de.find(function(ve){return ve.id===_}),Oe=de.findIndex(function(ve){return ve.id===_}),lt=C!=null,We=[];return(w=!ee&&q?Se?"toggle":"add":Oe!==de.length-1||de.length!==1?"replace":Se?"toggle":"replace")!="toggle"||ge||lt||q&&he||!(Se&&Se.desc&&!Re||!Se.desc&&Re)||(w="remove"),w==="replace"?We=[{id:_,desc:lt?C:Re}]:w==="add"?(We=[].concat(de,[{id:_,desc:lt?C:Re}])).splice(0,We.length-se):w==="toggle"?We=de.map(function(ve){return ve.id===_?l({},ve,{desc:lt?C:!Se.desc}):ve}):w==="remove"&&(We=de.filter(function(ve){return ve.id!==_})),l({},t,{sortBy:We})}}function Vs(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.allColumns,_=t.orderByFn,C=_===void 0?as:_,q=t.sortTypes,Z=t.manualSortBy,ee=t.defaultCanSort,ge=t.disableSortBy,he=t.flatHeaders,pe=t.state.sortBy,se=t.dispatch,de=t.plugins,Re=t.getHooks,Se=t.autoResetSortBy,Oe=Se===void 0||Se;P(de,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var lt=n.useCallback(function(Ue){se({type:h.setSortBy,sortBy:Ue})},[se]),We=n.useCallback(function(Ue,$e,wt){se({type:h.toggleSortBy,columnId:Ue,desc:$e,multi:wt})},[se]),ve=j(t);he.forEach(function(Ue){var $e=Ue.accessor,wt=Ue.canSort,et=Ue.disableSortBy,yt=Ue.id,r=$e?xe(et!==!0&&void 0,ge!==!0&&void 0,!0):xe(ee,wt,!1);Ue.canSort=r,Ue.canSort&&(Ue.toggleSortBy=function(u,a){return We(Ue.id,u,a)},Ue.clearSortBy=function(){se({type:h.clearSortBy,columnId:Ue.id})}),Ue.getSortByToggleProps=z(Re().getSortByToggleProps,{instance:ve(),column:Ue});var s=pe.find(function(u){return u.id===yt});Ue.isSorted=!!s,Ue.sortedIndex=pe.findIndex(function(u){return u.id===yt}),Ue.isSortedDesc=Ue.isSorted?s.desc:void 0});var tt=n.useMemo(function(){if(Z||!pe.length)return[f,p];var Ue=[],$e=pe.filter(function(wt){return w.find(function(et){return et.id===wt.id})});return[function wt(et){var yt=C(et,$e.map(function(r){var s=w.find(function(x){return x.id===r.id});if(!s)throw new Error("React-Table: Could not find a column with id: "+r.id+" while sorting");var u=s.sortType,a=Ve(u)||(q||{})[u]||Hs[u];if(!a)throw new Error("React-Table: Could not find a valid sortType of '"+u+"' for column '"+r.id+"'.");return function(x,b){return a(x,b,r.id,r.desc)}}),$e.map(function(r){var s=w.find(function(u){return u.id===r.id});return s&&s.sortInverted?r.desc:!r.desc}));return yt.forEach(function(r){Ue.push(r),r.subRows&&r.subRows.length!==0&&(r.subRows=wt(r.subRows))}),yt}(f),Ue]},[Z,pe,f,p,w,C,q]),Me=tt[0],Je=tt[1],gt=j(Oe);M(function(){gt()&&se({type:h.resetSortBy})},[Z?null:o]),Object.assign(t,{preSortedRows:f,preSortedFlatRows:p,sortedRows:Me,sortedFlatRows:Je,rows:Me,flatRows:Je,setSortBy:lt,toggleSortBy:We})}function as(t,o,f){return[].concat(t).sort(function(p,w){for(var _=0;_<o.length;_+=1){var C=o[_],q=f[_]===!1||f[_]==="desc",Z=C(p,w);if(Z!==0)return q?-Z:Z}return f[0]?p.index-w.index:w.index-p.index})}h.resetPage="resetPage",h.gotoPage="gotoPage",h.setPageSize="setPageSize";var Ir=function(t){t.stateReducers.push(Os),t.useInstance.push(Ws)};function Os(t,o,f,p){if(o.type===h.init)return l({pageSize:10,pageIndex:0},t);if(o.type===h.resetPage)return l({},t,{pageIndex:p.initialState.pageIndex||0});if(o.type===h.gotoPage){var w=p.pageCount,_=p.page,C=A(o.pageIndex,t.pageIndex),q=!1;return C>t.pageIndex?q=w===-1?_.length>=t.pageSize:C<w:C<t.pageIndex&&(q=C>-1),q?l({},t,{pageIndex:C}):t}if(o.type===h.setPageSize){var Z=o.pageSize,ee=t.pageSize*t.pageIndex;return l({},t,{pageIndex:Math.floor(ee/Z),pageSize:Z})}}function Ws(t){var o=t.rows,f=t.autoResetPage,p=f===void 0||f,w=t.manualExpandedKey,_=w===void 0?"expanded":w,C=t.plugins,q=t.pageCount,Z=t.paginateExpandedRows,ee=Z===void 0||Z,ge=t.expandSubRows,he=ge===void 0||ge,pe=t.state,se=pe.pageSize,de=pe.pageIndex,Re=pe.expanded,Se=pe.globalFilter,Oe=pe.filters,lt=pe.groupBy,We=pe.sortBy,ve=t.dispatch,tt=t.data,Me=t.manualPagination;P(C,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var Je=j(p);M(function(){Je()&&ve({type:h.resetPage})},[ve,Me?null:tt,Se,Oe,lt,We]);var gt=Me?q:Math.ceil(o.length/se),Ue=n.useMemo(function(){return gt>0?[].concat(new Array(gt)).fill(null).map(function(a,x){return x}):[]},[gt]),$e=n.useMemo(function(){var a;if(Me)a=o;else{var x=se*de,b=x+se;a=o.slice(x,b)}return ee?a:Y(a,{manualExpandedKey:_,expanded:Re,expandSubRows:he})},[he,Re,_,Me,de,se,ee,o]),wt=de>0,et=gt===-1?$e.length>=se:de<gt-1,yt=n.useCallback(function(a){ve({type:h.gotoPage,pageIndex:a})},[ve]),r=n.useCallback(function(){return yt(function(a){return a-1})},[yt]),s=n.useCallback(function(){return yt(function(a){return a+1})},[yt]),u=n.useCallback(function(a){ve({type:h.setPageSize,pageSize:a})},[ve]);Object.assign(t,{pageOptions:Ue,pageCount:gt,page:$e,canPreviousPage:wt,canNextPage:et,gotoPage:yt,previousPage:r,nextPage:s,setPageSize:u})}Ir.pluginName="usePagination",h.resetPivot="resetPivot",h.togglePivot="togglePivot";var Tr=function(t){t.getPivotToggleProps=[zs],t.stateReducers.push(Ys),t.useInstanceAfterData.push(qs),t.allColumns.push(Us),t.accessValue.push(Ks),t.materializedColumns.push(os),t.materializedColumnsDeps.push(us),t.visibleColumns.push(Zs),t.visibleColumnsDeps.push($s),t.useInstance.push(Xs),t.prepareRow.push(Js)};Tr.pluginName="usePivotColumns";var is=[],zs=function(t,o){var f=o.header;return[t,{onClick:f.canPivot?function(p){p.persist(),f.togglePivot()}:void 0,style:{cursor:f.canPivot?"pointer":void 0},title:"Toggle Pivot"}]};function Ys(t,o,f,p){if(o.type===h.init)return l({pivotColumns:is},t);if(o.type===h.resetPivot)return l({},t,{pivotColumns:p.initialState.pivotColumns||is});if(o.type===h.togglePivot){var w=o.columnId,_=o.value,C=_!==void 0?_:!t.pivotColumns.includes(w);return l({},t,C?{pivotColumns:[].concat(t.pivotColumns,[w])}:{pivotColumns:t.pivotColumns.filter(function(q){return q!==w})})}}function qs(t){t.allColumns.forEach(function(o){o.isPivotSource=t.state.pivotColumns.includes(o.id)})}function Us(t,o){var f=o.instance;return t.forEach(function(p){p.isPivotSource=f.state.pivotColumns.includes(p.id),p.uniqueValues=new Set}),t}function Ks(t,o){var f=o.column;return f.uniqueValues&&t!==void 0&&f.uniqueValues.add(t),t}function os(t,o){var f=o.instance,p=f.allColumns,w=f.state;if(!w.pivotColumns.length||!w.groupBy||!w.groupBy.length)return t;var _=w.pivotColumns.map(function(Z){return p.find(function(ee){return ee.id===Z})}).filter(Boolean),C=p.filter(function(Z){return!Z.isPivotSource&&!w.groupBy.includes(Z.id)&&!w.pivotColumns.includes(Z.id)}),q=X(function Z(ee,ge,he){ee===void 0&&(ee=0),he===void 0&&(he=[]);var pe=_[ee];return pe?Array.from(pe.uniqueValues).sort().map(function(se){var de=l({},pe,{Header:pe.PivotHeader||typeof pe.header=="string"?pe.Header+": "+se:se,isPivotGroup:!0,parent:ge,depth:ee,id:ge?ge.id+"."+pe.id+"."+se:pe.id+"."+se,pivotValue:se});return de.columns=Z(ee+1,de,[].concat(he,[function(Re){return Re.values[pe.id]===se}])),de}):C.map(function(se){return l({},se,{canPivot:!1,isPivoted:!0,parent:ge,depth:ee,id:""+(ge?ge.id+"."+se.id:se.id),accessor:function(de,Re,Se){if(he.every(function(Oe){return Oe(Se)}))return Se.values[se.id]}})})}());return[].concat(t,q)}function us(t,o){var f=o.instance.state,p=f.pivotColumns,w=f.groupBy;return[].concat(t,[p,w])}function Zs(t,o){var f=o.instance.state;return t=t.filter(function(p){return!p.isPivotSource}),f.pivotColumns.length&&f.groupBy&&f.groupBy.length&&(t=t.filter(function(p){return p.isGrouped||p.isPivoted})),t}function $s(t,o){var f=o.instance;return[].concat(t,[f.state.pivotColumns,f.state.groupBy])}function Xs(t){var o=t.columns,f=t.allColumns,p=t.flatHeaders,w=t.getHooks,_=t.plugins,C=t.dispatch,q=t.autoResetPivot,Z=q===void 0||q,ee=t.manaulPivot,ge=t.disablePivot,he=t.defaultCanPivot;P(_,["useGroupBy"],"usePivotColumns");var pe=j(t);f.forEach(function(de){var Re=de.accessor,Se=de.defaultPivot,Oe=de.disablePivot;de.canPivot=Re?xe(de.canPivot,Oe!==!0&&void 0,ge!==!0&&void 0,!0):xe(de.canPivot,Se,he,!1),de.canPivot&&(de.togglePivot=function(){return t.togglePivot(de.id)}),de.Aggregated=de.Aggregated||de.Cell}),p.forEach(function(de){de.getPivotToggleProps=z(w().getPivotToggleProps,{instance:pe(),header:de})});var se=j(Z);M(function(){se()&&C({type:h.resetPivot})},[C,ee?null:o]),Object.assign(t,{togglePivot:function(de,Re){C({type:h.togglePivot,columnId:de,value:Re})}})}function Js(t){t.allCells.forEach(function(o){o.isPivoted=o.column.isPivoted})}h.resetSelectedRows="resetSelectedRows",h.toggleAllRowsSelected="toggleAllRowsSelected",h.toggleRowSelected="toggleRowSelected",h.toggleAllPageRowsSelected="toggleAllPageRowsSelected";var cs=function(t){t.getToggleRowSelectedProps=[Br],t.getToggleAllRowsSelectedProps=[wr],t.getToggleAllPageRowsSelectedProps=[ds],t.stateReducers.push(Qs),t.useInstance.push(fs),t.prepareRow.push(el)};cs.pluginName="useRowSelect";var Br=function(t,o){var f=o.instance,p=o.row,w=f.manualRowSelectedKey,_=w===void 0?"isSelected":w;return[t,{onChange:function(C){p.toggleRowSelected(C.target.checked)},style:{cursor:"pointer"},checked:!(!p.original||!p.original[_])||p.isSelected,title:"Toggle Row Selected",indeterminate:p.isSomeSelected}]},wr=function(t,o){var f=o.instance;return[t,{onChange:function(p){f.toggleAllRowsSelected(p.target.checked)},style:{cursor:"pointer"},checked:f.isAllRowsSelected,title:"Toggle All Rows Selected",indeterminate:!!(!f.isAllRowsSelected&&Object.keys(f.state.selectedRowIds).length)}]},ds=function(t,o){var f=o.instance;return[t,{onChange:function(p){f.toggleAllPageRowsSelected(p.target.checked)},style:{cursor:"pointer"},checked:f.isAllPageRowsSelected,title:"Toggle All Current Page Rows Selected",indeterminate:!!(!f.isAllPageRowsSelected&&f.page.some(function(p){var w=p.id;return f.state.selectedRowIds[w]}))}]};function Qs(t,o,f,p){if(o.type===h.init)return l({selectedRowIds:{}},t);if(o.type===h.resetSelectedRows)return l({},t,{selectedRowIds:p.initialState.selectedRowIds||{}});if(o.type===h.toggleAllRowsSelected){var w=o.value,_=p.isAllRowsSelected,C=p.rowsById,q=p.nonGroupedRowsById,Z=q===void 0?C:q,ee=w!==void 0?w:!_,ge=Object.assign({},t.selectedRowIds);return ee?Object.keys(Z).forEach(function(yt){ge[yt]=!0}):Object.keys(Z).forEach(function(yt){delete ge[yt]}),l({},t,{selectedRowIds:ge})}if(o.type===h.toggleRowSelected){var he=o.id,pe=o.value,se=p.rowsById,de=p.selectSubRows,Re=de===void 0||de,Se=p.getSubRows,Oe=t.selectedRowIds[he],lt=pe!==void 0?pe:!Oe;if(Oe===lt)return t;var We=l({},t.selectedRowIds);return function yt(r){var s=se[r];if(s&&(s.isGrouped||(lt?We[r]=!0:delete We[r]),Re&&Se(s)))return Se(s).forEach(function(u){return yt(u.id)})}(he),l({},t,{selectedRowIds:We})}if(o.type===h.toggleAllPageRowsSelected){var ve=o.value,tt=p.page,Me=p.rowsById,Je=p.selectSubRows,gt=Je===void 0||Je,Ue=p.isAllPageRowsSelected,$e=p.getSubRows,wt=ve!==void 0?ve:!Ue,et=l({},t.selectedRowIds);return tt.forEach(function(yt){return function r(s){var u=Me[s];if(u.isGrouped||(wt?et[s]=!0:delete et[s]),gt&&$e(u))return $e(u).forEach(function(a){return r(a.id)})}(yt.id)}),l({},t,{selectedRowIds:et})}return t}function fs(t){var o=t.data,f=t.rows,p=t.getHooks,w=t.plugins,_=t.rowsById,C=t.nonGroupedRowsById,q=C===void 0?_:C,Z=t.autoResetSelectedRows,ee=Z===void 0||Z,ge=t.state.selectedRowIds,he=t.selectSubRows,pe=he===void 0||he,se=t.dispatch,de=t.page,Re=t.getSubRows;P(w,["useFilters","useGroupBy","useSortBy","useExpanded","usePagination"],"useRowSelect");var Se=n.useMemo(function(){var $e=[];return f.forEach(function(wt){var et=pe?function yt(r,s,u){if(s[r.id])return!0;var a=u(r);if(a&&a.length){var x=!0,b=!1;return a.forEach(function(m){b&&!x||(yt(m,s,u)?b=!0:x=!1)}),!!x||!!b&&null}return!1}(wt,ge,Re):!!ge[wt.id];wt.isSelected=!!et,wt.isSomeSelected=et===null,et&&$e.push(wt)}),$e},[f,pe,ge,Re]),Oe=!!(Object.keys(q).length&&Object.keys(ge).length),lt=Oe;Oe&&Object.keys(q).some(function($e){return!ge[$e]})&&(Oe=!1),Oe||de&&de.length&&de.some(function($e){var wt=$e.id;return!ge[wt]})&&(lt=!1);var We=j(ee);M(function(){We()&&se({type:h.resetSelectedRows})},[se,o]);var ve=n.useCallback(function($e){return se({type:h.toggleAllRowsSelected,value:$e})},[se]),tt=n.useCallback(function($e){return se({type:h.toggleAllPageRowsSelected,value:$e})},[se]),Me=n.useCallback(function($e,wt){return se({type:h.toggleRowSelected,id:$e,value:wt})},[se]),Je=j(t),gt=z(p().getToggleAllRowsSelectedProps,{instance:Je()}),Ue=z(p().getToggleAllPageRowsSelectedProps,{instance:Je()});Object.assign(t,{selectedFlatRows:Se,isAllRowsSelected:Oe,isAllPageRowsSelected:lt,toggleRowSelected:Me,toggleAllRowsSelected:ve,getToggleAllRowsSelectedProps:gt,getToggleAllPageRowsSelectedProps:Ue,toggleAllPageRowsSelected:tt})}function el(t,o){var f=o.instance;t.toggleRowSelected=function(p){return f.toggleRowSelected(t.id,p)},t.getToggleRowSelectedProps=z(f.getHooks().getToggleRowSelectedProps,{instance:f,row:t})}var hs=function(t){return{}},ps=function(t){return{}};h.setRowState="setRowState",h.setCellState="setCellState",h.resetRowState="resetRowState";var Gr=function(t){t.stateReducers.push(tl),t.useInstance.push(ms),t.prepareRow.push(rl)};function tl(t,o,f,p){var w=p.initialRowStateAccessor,_=w===void 0?hs:w,C=p.initialCellStateAccessor,q=C===void 0?ps:C,Z=p.rowsById;if(o.type===h.init)return l({rowState:{}},t);if(o.type===h.resetRowState)return l({},t,{rowState:p.initialState.rowState||{}});if(o.type===h.setRowState){var ee,ge=o.rowId,he=o.value,pe=t.rowState[ge]!==void 0?t.rowState[ge]:_(Z[ge]);return l({},t,{rowState:l({},t.rowState,(ee={},ee[ge]=A(he,pe),ee))})}if(o.type===h.setCellState){var se,de,Re,Se,Oe,lt=o.rowId,We=o.columnId,ve=o.value,tt=t.rowState[lt]!==void 0?t.rowState[lt]:_(Z[lt]),Me=(tt==null||(se=tt.cellState)==null?void 0:se[We])!==void 0?tt.cellState[We]:q((de=Z[lt])==null||(Re=de.cells)==null?void 0:Re.find(function(Je){return Je.column.id===We}));return l({},t,{rowState:l({},t.rowState,(Oe={},Oe[lt]=l({},tt,{cellState:l({},tt.cellState||{},(Se={},Se[We]=A(ve,Me),Se))}),Oe))})}}function ms(t){var o=t.autoResetRowState,f=o===void 0||o,p=t.data,w=t.dispatch,_=n.useCallback(function(Z,ee){return w({type:h.setRowState,rowId:Z,value:ee})},[w]),C=n.useCallback(function(Z,ee,ge){return w({type:h.setCellState,rowId:Z,columnId:ee,value:ge})},[w]),q=j(f);M(function(){q()&&w({type:h.resetRowState})},[p]),Object.assign(t,{setRowState:_,setCellState:C})}function rl(t,o){var f=o.instance,p=f.initialRowStateAccessor,w=p===void 0?hs:p,_=f.initialCellStateAccessor,C=_===void 0?ps:_,q=f.state.rowState;t&&(t.state=q[t.id]!==void 0?q[t.id]:w(t),t.setState=function(Z){return f.setRowState(t.id,Z)},t.cells.forEach(function(Z){t.state.cellState||(t.state.cellState={}),Z.state=t.state.cellState[Z.column.id]!==void 0?t.state.cellState[Z.column.id]:C(Z),Z.setState=function(ee){return f.setCellState(t.id,Z.column.id,ee)}}))}Gr.pluginName="useRowState",h.resetColumnOrder="resetColumnOrder",h.setColumnOrder="setColumnOrder";var xs=function(t){t.stateReducers.push(gs),t.visibleColumnsDeps.push(function(o,f){var p=f.instance;return[].concat(o,[p.state.columnOrder])}),t.visibleColumns.push(vs),t.useInstance.push(sl)};function gs(t,o,f,p){return o.type===h.init?l({columnOrder:[]},t):o.type===h.resetColumnOrder?l({},t,{columnOrder:p.initialState.columnOrder||[]}):o.type===h.setColumnOrder?l({},t,{columnOrder:A(o.columnOrder,t.columnOrder)}):void 0}function vs(t,o){var f=o.instance.state.columnOrder;if(!f||!f.length)return t;for(var p=[].concat(f),w=[].concat(t),_=[],C=function(){var q=p.shift(),Z=w.findIndex(function(ee){return ee.id===q});Z>-1&&_.push(w.splice(Z,1)[0])};w.length&&p.length;)C();return[].concat(_,w)}function sl(t){var o=t.dispatch;t.setColumnOrder=n.useCallback(function(f){return o({type:h.setColumnOrder,columnOrder:f})},[o])}xs.pluginName="useColumnOrder",L.canResize=!0,h.columnStartResizing="columnStartResizing",h.columnResizing="columnResizing",h.columnDoneResizing="columnDoneResizing",h.resetResize="resetResize";var ys=function(t){t.getResizerProps=[ll],t.getHeaderProps.push({style:{position:"relative"}}),t.stateReducers.push(nl),t.useInstance.push(il),t.useInstanceBeforeDimensions.push(al)},ll=function(t,o){var f=o.instance,p=o.header,w=f.dispatch,_=function(C,q){var Z=!1;if(C.type==="touchstart"){if(C.touches&&C.touches.length>1)return;Z=!0}var ee,ge,he=function(We){var ve=[];return function tt(Me){Me.columns&&Me.columns.length&&Me.columns.map(tt),ve.push(Me)}(We),ve}(q).map(function(We){return[We.id,We.totalWidth]}),pe=Z?Math.round(C.touches[0].clientX):C.clientX,se=function(){window.cancelAnimationFrame(ee),ee=null,w({type:h.columnDoneResizing})},de=function(){window.cancelAnimationFrame(ee),ee=null,w({type:h.columnResizing,clientX:ge})},Re=function(We){ge=We,ee||(ee=window.requestAnimationFrame(de))},Se={mouse:{moveEvent:"mousemove",moveHandler:function(We){return Re(We.clientX)},upEvent:"mouseup",upHandler:function(We){document.removeEventListener("mousemove",Se.mouse.moveHandler),document.removeEventListener("mouseup",Se.mouse.upHandler),se()}},touch:{moveEvent:"touchmove",moveHandler:function(We){return We.cancelable&&(We.preventDefault(),We.stopPropagation()),Re(We.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(We){document.removeEventListener(Se.touch.moveEvent,Se.touch.moveHandler),document.removeEventListener(Se.touch.upEvent,Se.touch.moveHandler),se()}}},Oe=Z?Se.touch:Se.mouse,lt=!!function(){if(typeof Fe=="boolean")return Fe;var We=!1;try{var ve={get passive(){return We=!0,!1}};window.addEventListener("test",null,ve),window.removeEventListener("test",null,ve)}catch{We=!1}return Fe=We}()&&{passive:!1};document.addEventListener(Oe.moveEvent,Oe.moveHandler,lt),document.addEventListener(Oe.upEvent,Oe.upHandler,lt),w({type:h.columnStartResizing,columnId:q.id,columnWidth:q.totalWidth,headerIdWidths:he,clientX:pe})};return[t,{onMouseDown:function(C){return C.persist()||_(C,p)},onTouchStart:function(C){return C.persist()||_(C,p)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};function nl(t,o){if(o.type===h.init)return l({columnResizing:{columnWidths:{}}},t);if(o.type===h.resetResize)return l({},t,{columnResizing:{columnWidths:{}}});if(o.type===h.columnStartResizing){var f=o.clientX,p=o.columnId,w=o.columnWidth,_=o.headerIdWidths;return l({},t,{columnResizing:l({},t.columnResizing,{startX:f,headerIdWidths:_,columnWidth:w,isResizingColumn:p})})}if(o.type===h.columnResizing){var C=o.clientX,q=t.columnResizing,Z=q.startX,ee=q.columnWidth,ge=q.headerIdWidths,he=(C-Z)/ee,pe={};return(ge===void 0?[]:ge).forEach(function(se){var de=se[0],Re=se[1];pe[de]=Math.max(Re+Re*he,0)}),l({},t,{columnResizing:l({},t.columnResizing,{columnWidths:l({},t.columnResizing.columnWidths,{},pe)})})}return o.type===h.columnDoneResizing?l({},t,{columnResizing:l({},t.columnResizing,{startX:null,isResizingColumn:null})}):void 0}ys.pluginName="useResizeColumns";var al=function(t){var o=t.flatHeaders,f=t.disableResizing,p=t.getHooks,w=t.state.columnResizing,_=j(t);o.forEach(function(C){var q=xe(C.disableResizing!==!0&&void 0,f!==!0&&void 0,!0);C.canResize=q,C.width=w.columnWidths[C.id]||C.originalWidth||C.width,C.isResizing=w.isResizingColumn===C.id,q&&(C.getResizerProps=z(p().getResizerProps,{instance:_(),header:C}))})};function il(t){var o=t.plugins,f=t.dispatch,p=t.autoResetResize,w=p===void 0||p,_=t.columns;P(o,["useAbsoluteLayout"],"useResizeColumns");var C=j(w);M(function(){C()&&f({type:h.resetResize})},[_]);var q=n.useCallback(function(){return f({type:h.resetResize})},[f]);Object.assign(t,{resetResizing:q})}var Fr={position:"absolute",top:0},_s=function(t){t.getTableBodyProps.push(Sr),t.getRowProps.push(Sr),t.getHeaderGroupProps.push(Sr),t.getFooterGroupProps.push(Sr),t.getHeaderProps.push(function(o,f){var p=f.column;return[o,{style:l({},Fr,{left:p.totalLeft+"px",width:p.totalWidth+"px"})}]}),t.getCellProps.push(function(o,f){var p=f.cell;return[o,{style:l({},Fr,{left:p.column.totalLeft+"px",width:p.column.totalWidth+"px"})}]}),t.getFooterProps.push(function(o,f){var p=f.column;return[o,{style:l({},Fr,{left:p.totalLeft+"px",width:p.totalWidth+"px"})}]})};_s.pluginName="useAbsoluteLayout";var Sr=function(t,o){return[t,{style:{position:"relative",width:o.instance.totalColumnsWidth+"px"}}]},Mr={display:"inline-block",boxSizing:"border-box"},Hr=function(t,o){return[t,{style:{display:"flex",width:o.instance.totalColumnsWidth+"px"}}]},bs=function(t){t.getRowProps.push(Hr),t.getHeaderGroupProps.push(Hr),t.getFooterGroupProps.push(Hr),t.getHeaderProps.push(function(o,f){var p=f.column;return[o,{style:l({},Mr,{width:p.totalWidth+"px"})}]}),t.getCellProps.push(function(o,f){var p=f.cell;return[o,{style:l({},Mr,{width:p.column.totalWidth+"px"})}]}),t.getFooterProps.push(function(o,f){var p=f.column;return[o,{style:l({},Mr,{width:p.totalWidth+"px"})}]})};function Lr(t){t.getTableProps.push(ol),t.getRowProps.push(kr),t.getHeaderGroupProps.push(kr),t.getFooterGroupProps.push(kr),t.getHeaderProps.push(ul),t.getCellProps.push(cl),t.getFooterProps.push(dl)}bs.pluginName="useBlockLayout",Lr.pluginName="useFlexLayout";var ol=function(t,o){return[t,{style:{minWidth:o.instance.totalColumnsMinWidth+"px"}}]},kr=function(t,o){return[t,{style:{display:"flex",flex:"1 0 auto",minWidth:o.instance.totalColumnsMinWidth+"px"}}]},ul=function(t,o){var f=o.column;return[t,{style:{boxSizing:"border-box",flex:f.totalFlexWidth?f.totalFlexWidth+" 0 auto":void 0,minWidth:f.totalMinWidth+"px",width:f.totalWidth+"px"}}]},cl=function(t,o){var f=o.cell;return[t,{style:{boxSizing:"border-box",flex:f.column.totalFlexWidth+" 0 auto",minWidth:f.column.totalMinWidth+"px",width:f.column.totalWidth+"px"}}]},dl=function(t,o){var f=o.column;return[t,{style:{boxSizing:"border-box",flex:f.totalFlexWidth?f.totalFlexWidth+" 0 auto":void 0,minWidth:f.totalMinWidth+"px",width:f.totalWidth+"px"}}]};function js(t){t.stateReducers.push(Es),t.getTableProps.push(Rs),t.getHeaderProps.push(ws),t.getRowProps.push(Cs)}h.columnStartResizing="columnStartResizing",h.columnResizing="columnResizing",h.columnDoneResizing="columnDoneResizing",h.resetResize="resetResize",js.pluginName="useGridLayout";var Rs=function(t,o){var f=o.instance;return[t,{style:{display:"grid",gridTemplateColumns:f.visibleColumns.map(function(p){var w;return f.state.gridLayout.columnWidths[p.id]?f.state.gridLayout.columnWidths[p.id]+"px":(w=f.state.columnResizing)!=null&&w.isResizingColumn?f.state.gridLayout.startWidths[p.id]+"px":typeof p.width=="number"?p.width+"px":p.width}).join(" ")}}]},ws=function(t,o){var f=o.column;return[t,{id:"header-cell-"+f.id,style:{position:"sticky",gridColumn:"span "+f.totalVisibleHeaderCount}}]},Cs=function(t,o){var f=o.row;return f.isExpanded?[t,{style:{gridColumn:"1 / "+(f.cells.length+1)}}]:[t,{}]};function Es(t,o,f,p){if(o.type===h.init)return l({gridLayout:{columnWidths:{}}},t);if(o.type===h.resetResize)return l({},t,{gridLayout:{columnWidths:{}}});if(o.type===h.columnStartResizing){var w=o.columnId,_=o.headerIdWidths,C=Vr(w);if(C!==void 0){var q=p.visibleColumns.reduce(function(ve,tt){var Me;return l({},ve,((Me={})[tt.id]=Vr(tt.id),Me))},{}),Z=p.visibleColumns.reduce(function(ve,tt){var Me;return l({},ve,((Me={})[tt.id]=tt.minWidth,Me))},{}),ee=p.visibleColumns.reduce(function(ve,tt){var Me;return l({},ve,((Me={})[tt.id]=tt.maxWidth,Me))},{}),ge=_.map(function(ve){var tt=ve[0];return[tt,Vr(tt)]});return l({},t,{gridLayout:l({},t.gridLayout,{startWidths:q,minWidths:Z,maxWidths:ee,headerIdGridWidths:ge,columnWidth:C})})}return t}if(o.type===h.columnResizing){var he=o.clientX,pe=t.columnResizing.startX,se=t.gridLayout,de=se.columnWidth,Re=se.minWidths,Se=se.maxWidths,Oe=se.headerIdGridWidths,lt=(he-pe)/de,We={};return(Oe===void 0?[]:Oe).forEach(function(ve){var tt=ve[0],Me=ve[1];We[tt]=Math.min(Math.max(Re[tt],Me+Me*lt),Se[tt])}),l({},t,{gridLayout:l({},t.gridLayout,{columnWidths:l({},t.gridLayout.columnWidths,{},We)})})}return o.type===h.columnDoneResizing?l({},t,{gridLayout:l({},t.gridLayout,{startWidths:{},minWidths:{},maxWidths:{}})}):void 0}function Vr(t){var o,f=(o=document.getElementById("header-cell-"+t))==null?void 0:o.offsetWidth;if(f!==void 0)return f}c._UNSTABLE_usePivotColumns=Tr,c.actions=h,c.defaultColumn=L,c.defaultGroupByFn=rs,c.defaultOrderByFn=as,c.defaultRenderer=V,c.emptyRenderer=g,c.ensurePluginOrder=P,c.flexRender=k,c.functionalUpdate=A,c.loopHooks=N,c.makePropGetter=z,c.makeRenderer=G,c.reduceHooks=D,c.safeUseLayoutEffect=Q,c.useAbsoluteLayout=_s,c.useAsyncDebounce=function(t,o){o===void 0&&(o=0);var f=n.useRef({}),p=j(t),w=j(o);return n.useCallback(function(){var _=R(regeneratorRuntime.mark(function C(){var q,Z,ee,ge=arguments;return regeneratorRuntime.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:for(q=ge.length,Z=new Array(q),ee=0;ee<q;ee++)Z[ee]=ge[ee];return f.current.promise||(f.current.promise=new Promise(function(pe,se){f.current.resolve=pe,f.current.reject=se})),f.current.timeout&&clearTimeout(f.current.timeout),f.current.timeout=setTimeout(R(regeneratorRuntime.mark(function pe(){return regeneratorRuntime.wrap(function(se){for(;;)switch(se.prev=se.next){case 0:return delete f.current.timeout,se.prev=1,se.t0=f.current,se.next=5,p().apply(void 0,Z);case 5:se.t1=se.sent,se.t0.resolve.call(se.t0,se.t1),se.next=12;break;case 9:se.prev=9,se.t2=se.catch(1),f.current.reject(se.t2);case 12:return se.prev=12,delete f.current.promise,se.finish(12);case 15:case"end":return se.stop()}},pe,null,[[1,9,12,15]])})),w()),he.abrupt("return",f.current.promise);case 5:case"end":return he.stop()}},C)}));return function(){return _.apply(this,arguments)}}(),[p,w])},c.useBlockLayout=bs,c.useColumnOrder=xs,c.useExpanded=rr,c.useFilters=At,c.useFlexLayout=Lr,c.useGetLatest=j,c.useGlobalFilter=ye,c.useGridLayout=js,c.useGroupBy=Dr,c.useMountedLayoutEffect=M,c.usePagination=Ir,c.useResizeColumns=ys,c.useRowSelect=cs,c.useRowState=Gr,c.useSortBy=ns,c.useTable=function(t){for(var o=arguments.length,f=new Array(o>1?o-1:0),p=1;p<o;p++)f[p-1]=arguments[p];t=kt(t),f=[De].concat(f);var w=n.useRef({}),_=j(w.current);Object.assign(_(),l({},t,{plugins:f,hooks:T()})),f.filter(Boolean).forEach(function(m){m(_().hooks)});var C=j(_().hooks);_().getHooks=C,delete _().hooks,Object.assign(_(),D(C().useOptions,kt(t)));var q=_(),Z=q.data,ee=q.columns,ge=q.initialState,he=q.defaultColumn,pe=q.getSubRows,se=q.getRowId,de=q.stateReducer,Re=q.useControlledState,Se=j(de),Oe=n.useCallback(function(m,E){if(!E.type)throw console.info({action:E}),new Error("Unknown Action 👆");return[].concat(C().stateReducers,Array.isArray(Se())?Se():[Se()]).reduce(function(F,U){return U(F,E,m,_())||F},m)},[C,Se,_]),lt=n.useReducer(Oe,void 0,function(){return Oe(ge,{type:h.init})}),We=lt[0],ve=lt[1],tt=D([].concat(C().useControlledState,[Re]),We,{instance:_()});Object.assign(_(),{state:tt,dispatch:ve});var Me=n.useMemo(function(){return $(D(C().columns,ee,{instance:_()}))},[C,_,ee].concat(D(C().columnsDeps,[],{instance:_()})));_().columns=Me;var Je=n.useMemo(function(){return D(C().allColumns,X(Me),{instance:_()}).map(O)},[Me,C,_].concat(D(C().allColumnsDeps,[],{instance:_()})));_().allColumns=Je;var gt=n.useMemo(function(){for(var m=[],E=[],F={},U=[].concat(Je);U.length;){var te=U.shift();Qt({data:Z,rows:m,flatRows:E,rowsById:F,column:te,getRowId:se,getSubRows:pe,accessValueHooks:C().accessValue,getInstance:_})}return[m,E,F]},[Je,Z,se,pe,C,_]),Ue=gt[0],$e=gt[1],wt=gt[2];Object.assign(_(),{rows:Ue,initialRows:[].concat(Ue),flatRows:$e,rowsById:wt}),N(C().useInstanceAfterData,_());var et=n.useMemo(function(){return D(C().visibleColumns,Je,{instance:_()}).map(function(m){return re(m,he)})},[C,Je,_,he].concat(D(C().visibleColumnsDeps,[],{instance:_()})));Je=n.useMemo(function(){var m=[].concat(et);return Je.forEach(function(E){m.find(function(F){return F.id===E.id})||m.push(E)}),m},[Je,et]),_().allColumns=Je;var yt=n.useMemo(function(){return D(C().headerGroups,ce(et,he),_())},[C,et,he,_].concat(D(C().headerGroupsDeps,[],{instance:_()})));_().headerGroups=yt;var r=n.useMemo(function(){return yt.length?yt[0].headers:[]},[yt]);_().headers=r,_().flatHeaders=yt.reduce(function(m,E){return[].concat(m,E.headers)},[]),N(C().useInstanceBeforeDimensions,_());var s=et.filter(function(m){return m.isVisible}).map(function(m){return m.id}).sort().join("_");et=n.useMemo(function(){return et.filter(function(m){return m.isVisible})},[et,s]),_().visibleColumns=et;var u=er(r),a=u[0],x=u[1],b=u[2];return _().totalColumnsMinWidth=a,_().totalColumnsWidth=x,_().totalColumnsMaxWidth=b,N(C().useInstance,_()),[].concat(_().flatHeaders,_().allColumns).forEach(function(m){m.render=G(_(),m),m.getHeaderProps=z(C().getHeaderProps,{instance:_(),column:m}),m.getFooterProps=z(C().getFooterProps,{instance:_(),column:m})}),_().headerGroups=n.useMemo(function(){return yt.filter(function(m,E){return m.headers=m.headers.filter(function(F){return F.headers?function U(te){return te.filter(function(be){return be.headers?U(be.headers):be.isVisible}).length}(F.headers):F.isVisible}),!!m.headers.length&&(m.getHeaderGroupProps=z(C().getHeaderGroupProps,{instance:_(),headerGroup:m,index:E}),m.getFooterGroupProps=z(C().getFooterGroupProps,{instance:_(),headerGroup:m,index:E}),!0)})},[yt,_,C]),_().footerGroups=[].concat(_().headerGroups).reverse(),_().prepareRow=n.useCallback(function(m){m.getRowProps=z(C().getRowProps,{instance:_(),row:m}),m.allCells=Je.map(function(E){var F=m.values[E.id],U={column:E,row:m,value:F};return U.getCellProps=z(C().getCellProps,{instance:_(),cell:U}),U.render=G(_(),E,{row:m,cell:U,value:F}),U}),m.cells=et.map(function(E){return m.allCells.find(function(F){return F.column.id===E.id})}),N(C().prepareRow,m,{instance:_()})},[C,_,Je,et]),_().getTableProps=z(C().getTableProps,{instance:_()}),_().getTableBodyProps=z(C().getTableBodyProps,{instance:_()}),N(C().useFinalInstance,_()),_()},Object.defineProperty(c,"__esModule",{value:!0})})}(qr,qr.exports)),qr.exports}var Ur={exports:{}},Xn=Ur.exports,Hl;function Jn(){return Hl||(Hl=1,function(i,d){(function(c,n){n(d,v)})(Xn,function(c,n){n=n&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n;function y(r,s,u,a,x,b,m){try{var E=r[b](m),F=E.value}catch(U){u(U);return}E.done?s(F):Promise.resolve(F).then(a,x)}function R(r){return function(){var s=this,u=arguments;return new Promise(function(a,x){var b=r.apply(s,u);function m(F){y(b,a,x,m,E,"next",F)}function E(F){y(b,a,x,m,E,"throw",F)}m(void 0)})}}function l(){return l=Object.assign||function(r){for(var s=1;s<arguments.length;s++){var u=arguments[s];for(var a in u)Object.prototype.hasOwnProperty.call(u,a)&&(r[a]=u[a])}return r},l.apply(this,arguments)}function I(r,s){if(r==null)return{};var u={},a=Object.keys(r),x,b;for(b=0;b<a.length;b++)x=a[b],!(s.indexOf(x)>=0)&&(u[x]=r[x]);return u}function S(r,s){if(typeof r!="object"||r===null)return r;var u=r[Symbol.toPrimitive];if(u!==void 0){var a=u.call(r,s);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function h(r){var s=S(r,"string");return typeof s=="symbol"?s:String(s)}var V="Renderer Error ☝️",g={init:"init"},L=function(s){var u=s.value,a=u===void 0?"":u;return a},W=function(){return n.createElement(n.Fragment,null," ")},z={Cell:L,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function D(){for(var r=arguments.length,s=new Array(r),u=0;u<r;u++)s[u]=arguments[u];return s.reduce(function(a,x){var b=x.style,m=x.className,E=I(x,["style","className"]);return a=l({},a,{},E),b&&(a.style=a.style?l({},a.style||{},{},b||{}):b),m&&(a.className=a.className?a.className+" "+m:m),a.className===""&&delete a.className,a},{})}function N(r,s,u){return typeof s=="function"?N({},s(r,u)):Array.isArray(s)?D.apply(void 0,[r].concat(s)):D(r,s)}var P=function(s,u){return u===void 0&&(u={}),function(a){return a===void 0&&(a={}),[].concat(s,[a]).reduce(function(x,b){return N(x,b,l({},u,{userProps:a}))},{})}},A=function(s,u,a,x){return a===void 0&&(a={}),s.reduce(function(b,m){var E=m(b,a);if(!x&&typeof E>"u")throw console.info(m),new Error("React Table: A reducer hook ☝️ just returned undefined! This is not allowed.");return E},u)},j=function(s,u,a){return a===void 0&&(a={}),s.forEach(function(x){var b=x(u,a);if(typeof b<"u")throw console.info(x,b),new Error("React Table: A loop-type hook ☝️ just returned a value! This is not allowed.")})};function Q(r,s,u,a){if(a)throw new Error('Defining plugins in the "after" section of ensurePluginOrder is no longer supported (see plugin '+u+")");var x=r.findIndex(function(b){return b.pluginName===u});if(x===-1)throw new Error('The plugin "'+u+`" was not found in the plugin list!
|
|
9
|
-
This usually means you need to need to name your plugin hook by setting the 'pluginName' property of the hook function, eg:
|
|
10
|
-
|
|
11
|
-
`+u+".pluginName = '"+u+`'
|
|
12
|
-
`);s.forEach(function(b){var m=r.findIndex(function(E){return E.pluginName===b});if(m>-1&&m>x)throw new Error("React Table: The "+u+" plugin hook must be placed after the "+b+" plugin hook!")})}function M(r,s){return typeof r=="function"?r(s):r}function G(r){var s=n.useRef();return s.current=r,n.useCallback(function(){return s.current},[])}var k=typeof document<"u"?n.useLayoutEffect:n.useEffect;function $(r,s){var u=n.useRef(!1);k(function(){u.current&&r(),u.current=!0},s)}function X(r,s){s===void 0&&(s=0);var u=n.useRef({}),a=G(r),x=G(s);return n.useCallback(function(){var b=R(regeneratorRuntime.mark(function m(){var E,F,U,te=arguments;return regeneratorRuntime.wrap(function(ue){for(;;)switch(ue.prev=ue.next){case 0:for(E=te.length,F=new Array(E),U=0;U<E;U++)F[U]=te[U];return u.current.promise||(u.current.promise=new Promise(function(me,je){u.current.resolve=me,u.current.reject=je})),u.current.timeout&&clearTimeout(u.current.timeout),u.current.timeout=setTimeout(R(regeneratorRuntime.mark(function me(){return regeneratorRuntime.wrap(function(ne){for(;;)switch(ne.prev=ne.next){case 0:return delete u.current.timeout,ne.prev=1,ne.t0=u.current,ne.next=5,a().apply(void 0,F);case 5:ne.t1=ne.sent,ne.t0.resolve.call(ne.t0,ne.t1),ne.next=12;break;case 9:ne.prev=9,ne.t2=ne.catch(1),u.current.reject(ne.t2);case 12:return ne.prev=12,delete u.current.promise,ne.finish(12);case 15:case"end":return ne.stop()}},me,null,[[1,9,12,15]])})),x()),ue.abrupt("return",u.current.promise);case 5:case"end":return ue.stop()}},m)}));return function(){return b.apply(this,arguments)}}(),[a,x])}function O(r,s,u){return u===void 0&&(u={}),function(a,x){x===void 0&&(x={});var b=typeof a=="string"?s[a]:a;if(typeof b>"u")throw console.info(s),new Error(V);return re(b,l({},r,{column:s},u,{},x))}}function re(r,s){return ce(r)?n.createElement(r,s):r}function ce(r){return _e(r)||typeof r=="function"||xe(r)}function _e(r){return typeof r=="function"&&function(){var s=Object.getPrototypeOf(r);return s.prototype&&s.prototype.isReactComponent}()}function xe(r){return typeof r=="object"&&typeof r.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(r.$$typeof.description)}function Ve(r,s,u){return u===void 0&&(u=0),r.map(function(a){return a=l({},a,{parent:s,depth:u}),Y(a),a.columns&&(a.columns=Ve(a.columns,a,u+1)),a})}function ie(r){return He(r,"columns")}function Y(r){var s=r.id,u=r.accessor,a=r.Header;if(typeof u=="string"){s=s||u;var x=u.split(".");u=function(m){return Fe(m,x)}}if(!s&&typeof a=="string"&&a&&(s=a),!s&&r.columns)throw console.error(r),new Error('A column ID (or unique "Header" value) is required!');if(!s)throw console.error(r),new Error("A column ID (or string accessor) is required!");return Object.assign(r,{id:s,accessor:u}),r}function fe(r,s){if(!s)throw new Error;return Object.assign(r,l({Header:W,Footer:W},z,{},s,{},r)),Object.assign(r,{originalWidth:r.width}),r}function H(r,s,u){u===void 0&&(u=function(){return{}});for(var a=[],x=r,b=0,m=function(){return b++},E=function(){var U={headers:[]},te=[],be=x.some(function(ue){return ue.parent});x.forEach(function(ue){var me=[].concat(te).reverse()[0],je;if(be){if(ue.parent)je=l({},ue.parent,{originalId:ue.parent.id,id:ue.parent.id+"_"+m(),headers:[ue]},u(ue));else{var ne=ue.id+"_placeholder";je=fe(l({originalId:ne,id:ue.id+"_placeholder_"+m(),placeholderOf:ue,headers:[ue]},u(ue)),s)}me&&me.originalId===je.originalId?me.headers.push(ue):te.push(je)}U.headers.push(ue)}),a.push(U),x=te};x.length;)E();return a.reverse()}var Ce=new Map;function Fe(r,s,u){if(!s)return r;var a=typeof s=="function"?s:JSON.stringify(s),x=Ce.get(a)||function(){var m=De(s);return Ce.set(a,m),m}(),b;try{b=x.reduce(function(m,E){return m[E]},r)}catch{}return typeof b<"u"?b:u}function ke(){for(var r=arguments.length,s=new Array(r),u=0;u<r;u++)s[u]=arguments[u];for(var a=0;a<s.length;a+=1)if(typeof s[a]<"u")return s[a]}function xt(r){if(typeof r=="function")return r}function He(r,s){var u=[],a=function x(b){b.forEach(function(m){m[s]?x(m[s]):u.push(m)})};return a(r),u}function st(r,s){var u=s.manualExpandedKey,a=s.expanded,x=s.expandSubRows,b=x===void 0?!0:x,m=[],E=function F(U,te){te===void 0&&(te=!0),U.isExpanded=U.original&&U.original[u]||a[U.id],U.canExpand=U.subRows&&!!U.subRows.length,te&&m.push(U),U.subRows&&U.subRows.length&&U.isExpanded&&U.subRows.forEach(function(be){return F(be,b)})};return r.forEach(function(F){return E(F)}),m}function _t(r,s,u){return xt(r)||s[r]||u[r]||u.text}function pt(r,s,u){return r?r(s,u):typeof s>"u"}function Pt(){throw new Error("React-Table: You have not called prepareRow(row) one or more rows you are attempting to render.")}var Rt=null;function Dt(){if(typeof Rt=="boolean")return Rt;var r=!1;try{var s={get passive(){return r=!0,!1}};window.addEventListener("test",null,s),window.removeEventListener("test",null,s)}catch{r=!1}return Rt=r,Rt}var Gt=/\[/g,T=/\]/g;function De(r){return qe(r).map(function(s){return String(s).replace(".","_")}).join(".").replace(Gt,".").replace(T,"").split(".")}function qe(r,s){if(s===void 0&&(s=[]),!Array.isArray(r))s.push(r);else for(var u=0;u<r.length;u+=1)qe(r[u],s);return s}var ae=function(s){return l({role:"table"},s)},J=function(s){return l({role:"rowgroup"},s)},K=function(s,u){var a=u.column;return l({key:"header_"+a.id,colSpan:a.totalVisibleHeaderCount,role:"columnheader"},s)},oe=function(s,u){var a=u.column;return l({key:"footer_"+a.id,colSpan:a.totalVisibleHeaderCount},s)},Be=function(s,u){var a=u.index;return l({key:"headerGroup_"+a,role:"row"},s)},Pe=function(s,u){var a=u.index;return l({key:"footerGroup_"+a},s)},mt=function(s,u){var a=u.row;return l({key:"row_"+a.id,role:"row"},s)},Zt=function(s,u){var a=u.cell;return l({key:"cell_"+a.row.id+"_"+a.column.id,role:"cell"},s)};function ct(){return{useOptions:[],stateReducers:[],useControlledState:[],columns:[],columnsDeps:[],allColumns:[],allColumnsDeps:[],accessValue:[],materializedColumns:[],materializedColumnsDeps:[],useInstanceAfterData:[],visibleColumns:[],visibleColumnsDeps:[],headerGroups:[],headerGroupsDeps:[],useInstanceBeforeDimensions:[],useInstance:[],prepareRow:[],getTableProps:[ae],getTableBodyProps:[J],getHeaderGroupProps:[Be],getFooterGroupProps:[Pe],getHeaderProps:[K],getFooterProps:[oe],getRowProps:[mt],getCellProps:[Zt],useFinalInstance:[]}}g.resetHiddenColumns="resetHiddenColumns",g.toggleHideColumn="toggleHideColumn",g.setHiddenColumns="setHiddenColumns",g.toggleHideAllColumns="toggleHideAllColumns";var Ot=function(s){s.getToggleHiddenProps=[kt],s.getToggleHideAllColumnsProps=[er],s.stateReducers.push(Qt),s.useInstanceBeforeDimensions.push(rr),s.headerGroupsDeps.push(function(u,a){var x=a.instance;return[].concat(u,[x.state.hiddenColumns])}),s.useInstance.push(lr)};Ot.pluginName="useColumnVisibility";var kt=function(s,u){var a=u.column;return[s,{onChange:function(b){a.toggleHidden(!b.target.checked)},style:{cursor:"pointer"},checked:a.isVisible,title:"Toggle Column Visible"}]},er=function(s,u){var a=u.instance;return[s,{onChange:function(b){a.toggleHideAllColumns(!b.target.checked)},style:{cursor:"pointer"},checked:!a.allColumnsHidden&&!a.state.hiddenColumns.length,title:"Toggle All Columns Hidden",indeterminate:!a.allColumnsHidden&&a.state.hiddenColumns.length}]};function Qt(r,s,u,a){if(s.type===g.init)return l({hiddenColumns:[]},r);if(s.type===g.resetHiddenColumns)return l({},r,{hiddenColumns:a.initialState.hiddenColumns||[]});if(s.type===g.toggleHideColumn){var x=typeof s.value<"u"?s.value:!r.hiddenColumns.includes(s.columnId),b=x?[].concat(r.hiddenColumns,[s.columnId]):r.hiddenColumns.filter(function(E){return E!==s.columnId});return l({},r,{hiddenColumns:b})}if(s.type===g.setHiddenColumns)return l({},r,{hiddenColumns:M(s.value,r.hiddenColumns)});if(s.type===g.toggleHideAllColumns){var m=typeof s.value<"u"?s.value:!r.hiddenColumns.length;return l({},r,{hiddenColumns:m?a.allColumns.map(function(E){return E.id}):[]})}}function rr(r){var s=r.headers,u=r.state.hiddenColumns,a=n.useRef(!1);a.current;var x=function m(E,F){E.isVisible=F&&!u.includes(E.id);var U=0;return E.headers&&E.headers.length?E.headers.forEach(function(te){return U+=m(te,E.isVisible)}):U=E.isVisible?1:0,E.totalVisibleHeaderCount=U,U},b=0;s.forEach(function(m){return b+=x(m,!0)})}function lr(r){var s=r.columns,u=r.flatHeaders,a=r.dispatch,x=r.allColumns,b=r.getHooks,m=r.state.hiddenColumns,E=r.autoResetHiddenColumns,F=E===void 0?!0:E,U=G(r),te=x.length===m.length,be=n.useCallback(function(Ge,Ye){return a({type:g.toggleHideColumn,columnId:Ge,value:Ye})},[a]),ue=n.useCallback(function(Ge){return a({type:g.setHiddenColumns,value:Ge})},[a]),me=n.useCallback(function(Ge){return a({type:g.toggleHideAllColumns,value:Ge})},[a]),je=P(b().getToggleHideAllColumnsProps,{instance:U()});u.forEach(function(Ge){Ge.toggleHidden=function(Ye){a({type:g.toggleHideColumn,columnId:Ge.id,value:Ye})},Ge.getToggleHiddenProps=P(b().getToggleHiddenProps,{instance:U(),column:Ge})});var ne=G(F);$(function(){ne()&&a({type:g.resetHiddenColumns})},[a,s]),Object.assign(r,{allColumnsHidden:te,toggleHideColumn:be,setHiddenColumns:ue,toggleHideAllColumns:me,getToggleHideAllColumnsProps:je})}var br={},nr={},at=function(s,u,a){return s},fr=function(s,u){return s.subRows||[]},hr=function(s,u,a){return""+(a?[a.id,u].join("."):u)},or=function(s){return s};function ur(r){var s=r.initialState,u=s===void 0?br:s,a=r.defaultColumn,x=a===void 0?nr:a,b=r.getSubRows,m=b===void 0?fr:b,E=r.getRowId,F=E===void 0?hr:E,U=r.stateReducer,te=U===void 0?at:U,be=r.useControlledState,ue=be===void 0?or:be,me=I(r,["initialState","defaultColumn","getSubRows","getRowId","stateReducer","useControlledState"]);return l({},me,{initialState:u,defaultColumn:x,getSubRows:m,getRowId:F,stateReducer:te,useControlledState:ue})}var dt=function(s){for(var u=arguments.length,a=new Array(u>1?u-1:0),x=1;x<u;x++)a[x-1]=arguments[x];s=ur(s),a=[Ot].concat(a);var b=n.useRef({}),m=G(b.current);Object.assign(m(),l({},s,{plugins:a,hooks:ct()})),a.filter(Boolean).forEach(function(Ke){Ke(m().hooks)});var E=G(m().hooks);m().getHooks=E,delete m().hooks,Object.assign(m(),A(E().useOptions,ur(s)));var F=m(),U=F.data,te=F.columns,be=F.initialState,ue=F.defaultColumn,me=F.getSubRows,je=F.getRowId,ne=F.stateReducer,Ge=F.useControlledState,Ye=G(ne),Ze=n.useCallback(function(Ke,It){if(!It.type)throw console.info({action:It}),new Error("Unknown Action 👆");return[].concat(E().stateReducers,Array.isArray(Ye())?Ye():[Ye()]).reduce(function(Vt,Jt){return Jt(Vt,It,Ke,m())||Vt},Ke)},[E,Ye,m]),Ee=n.useReducer(Ze,void 0,function(){return Ze(be,{type:g.init})}),rt=Ee[0],ut=Ee[1],Ne=A([].concat(E().useControlledState,[Ge]),rt,{instance:m()});Object.assign(m(),{state:Ne,dispatch:ut});var we=n.useMemo(function(){return Ve(A(E().columns,te,{instance:m()}))},[E,m,te].concat(A(E().columnsDeps,[],{instance:m()})));m().columns=we;var Ae=n.useMemo(function(){return A(E().allColumns,ie(we),{instance:m()}).map(Y)},[we,E,m].concat(A(E().allColumnsDeps,[],{instance:m()})));m().allColumns=Ae;var ze=n.useMemo(function(){for(var Ke=[],It=[],Vt={},Jt=[].concat(Ae);Jt.length;){var zt=Jt.shift();ft({data:U,rows:Ke,flatRows:It,rowsById:Vt,column:zt,getRowId:je,getSubRows:me,accessValueHooks:E().accessValue,getInstance:m})}return[Ke,It,Vt]},[Ae,U,je,me,E,m]),nt=ze[0],it=ze[1],St=ze[2];Object.assign(m(),{rows:nt,initialRows:[].concat(nt),flatRows:it,rowsById:St}),j(E().useInstanceAfterData,m());var Le=n.useMemo(function(){return A(E().visibleColumns,Ae,{instance:m()}).map(function(Ke){return fe(Ke,ue)})},[E,Ae,m,ue].concat(A(E().visibleColumnsDeps,[],{instance:m()})));Ae=n.useMemo(function(){var Ke=[].concat(Le);return Ae.forEach(function(It){Ke.find(function(Vt){return Vt.id===It.id})||Ke.push(It)}),Ke},[Ae,Le]),m().allColumns=Ae;{var Wt=Ae.filter(function(Ke,It){return Ae.findIndex(function(Vt){return Vt.id===Ke.id})!==It});if(Wt.length)throw console.info(Ae),new Error('Duplicate columns were found with ids: "'+Wt.map(function(Ke){return Ke.id}).join(", ")+'" in the columns array above')}var ot=n.useMemo(function(){return A(E().headerGroups,H(Le,ue),m())},[E,Le,ue,m].concat(A(E().headerGroupsDeps,[],{instance:m()})));m().headerGroups=ot;var Xe=n.useMemo(function(){return ot.length?ot[0].headers:[]},[ot]);m().headers=Xe,m().flatHeaders=ot.reduce(function(Ke,It){return[].concat(Ke,It.headers)},[]),j(E().useInstanceBeforeDimensions,m());var Qe=Le.filter(function(Ke){return Ke.isVisible}).map(function(Ke){return Ke.id}).sort().join("_");Le=n.useMemo(function(){return Le.filter(function(Ke){return Ke.isVisible})},[Le,Qe]),m().visibleColumns=Le;var Nt=vt(Xe),Yt=Nt[0],Cr=Nt[1],Or=Nt[2];return m().totalColumnsMinWidth=Yt,m().totalColumnsWidth=Cr,m().totalColumnsMaxWidth=Or,j(E().useInstance,m()),[].concat(m().flatHeaders,m().allColumns).forEach(function(Ke){Ke.render=O(m(),Ke),Ke.getHeaderProps=P(E().getHeaderProps,{instance:m(),column:Ke}),Ke.getFooterProps=P(E().getFooterProps,{instance:m(),column:Ke})}),m().headerGroups=n.useMemo(function(){return ot.filter(function(Ke,It){return Ke.headers=Ke.headers.filter(function(Vt){var Jt=function zt(mr){return mr.filter(function(Ut){return Ut.headers?zt(Ut.headers):Ut.isVisible}).length};return Vt.headers?Jt(Vt.headers):Vt.isVisible}),Ke.headers.length?(Ke.getHeaderGroupProps=P(E().getHeaderGroupProps,{instance:m(),headerGroup:Ke,index:It}),Ke.getFooterGroupProps=P(E().getFooterGroupProps,{instance:m(),headerGroup:Ke,index:It}),!0):!1})},[ot,m,E]),m().footerGroups=[].concat(m().headerGroups).reverse(),m().prepareRow=n.useCallback(function(Ke){Ke.getRowProps=P(E().getRowProps,{instance:m(),row:Ke}),Ke.allCells=Ae.map(function(It){var Vt=Ke.values[It.id],Jt={column:It,row:Ke,value:Vt};return Jt.getCellProps=P(E().getCellProps,{instance:m(),cell:Jt}),Jt.render=O(m(),It,{row:Ke,cell:Jt,value:Vt}),Jt}),Ke.cells=Le.map(function(It){return Ke.allCells.find(function(Vt){return Vt.column.id===It.id})}),j(E().prepareRow,Ke,{instance:m()})},[E,m,Ae,Le]),m().getTableProps=P(E().getTableProps,{instance:m()}),m().getTableBodyProps=P(E().getTableBodyProps,{instance:m()}),j(E().useFinalInstance,m()),m()};function vt(r,s){s===void 0&&(s=0);var u=0,a=0,x=0,b=0;return r.forEach(function(m){var E=m.headers;if(m.totalLeft=s,E&&E.length){var F=vt(E,s),U=F[0],te=F[1],be=F[2],ue=F[3];m.totalMinWidth=U,m.totalWidth=te,m.totalMaxWidth=be,m.totalFlexWidth=ue}else m.totalMinWidth=m.minWidth,m.totalWidth=Math.min(Math.max(m.minWidth,m.width),m.maxWidth),m.totalMaxWidth=m.maxWidth,m.totalFlexWidth=m.canResize?m.totalWidth:0;m.isVisible&&(s+=m.totalWidth,u+=m.totalMinWidth,a+=m.totalWidth,x+=m.totalMaxWidth,b+=m.totalFlexWidth)}),[u,a,x,b]}function ft(r){var s=r.data,u=r.rows,a=r.flatRows,x=r.rowsById,b=r.column,m=r.getRowId,E=r.getSubRows,F=r.accessValueHooks,U=r.getInstance,te=function be(ue,me,je,ne,Ge){je===void 0&&(je=0);var Ye=ue,Ze=m(ue,me,ne),Ee=x[Ze];if(Ee)Ee.subRows&&Ee.originalSubRows.forEach(function(ut,Ne){return be(ut,Ne,je+1,Ee)});else if(Ee={id:Ze,original:Ye,index:me,depth:je,cells:[{}]},Ee.cells.map=Pt,Ee.cells.filter=Pt,Ee.cells.forEach=Pt,Ee.cells[0].getCellProps=Pt,Ee.values={},Ge.push(Ee),a.push(Ee),x[Ze]=Ee,Ee.originalSubRows=E(ue,me),Ee.originalSubRows){var rt=[];Ee.originalSubRows.forEach(function(ut,Ne){return be(ut,Ne,je+1,Ee,rt)}),Ee.subRows=rt}b.accessor&&(Ee.values[b.id]=b.accessor(ue,me,Ee,Ge,s)),Ee.values[b.id]=A(F,Ee.values[b.id],{row:Ee,column:b,instance:U()},!0)};s.forEach(function(be,ue){return te(be,ue,0,void 0,u)})}g.resetExpanded="resetExpanded",g.toggleRowExpanded="toggleRowExpanded",g.toggleAllRowsExpanded="toggleAllRowsExpanded";var Et=function(s){s.getToggleAllRowsExpandedProps=[Bt],s.getToggleRowExpandedProps=[Ht],s.stateReducers.push($t),s.useInstance.push(Ft),s.prepareRow.push(At)};Et.pluginName="useExpanded";var Bt=function(s,u){var a=u.instance;return[s,{onClick:function(b){a.toggleAllRowsExpanded()},style:{cursor:"pointer"},title:"Toggle All Rows Expanded"}]},Ht=function(s,u){var a=u.row;return[s,{onClick:function(){a.toggleRowExpanded()},style:{cursor:"pointer"},title:"Toggle Row Expanded"}]};function $t(r,s,u,a){if(s.type===g.init)return l({expanded:{}},r);if(s.type===g.resetExpanded)return l({},r,{expanded:a.initialState.expanded||{}});if(s.type===g.toggleAllRowsExpanded){var x=s.value,b=a.rowsById,m=Object.keys(b).length===Object.keys(r.expanded).length,E=typeof x<"u"?x:!m;if(E){var F={};return Object.keys(b).forEach(function(Ge){F[Ge]=!0}),l({},r,{expanded:F})}return l({},r,{expanded:{}})}if(s.type===g.toggleRowExpanded){var U=s.id,te=s.value,be=r.expanded[U],ue=typeof te<"u"?te:!be;if(!be&&ue){var me;return l({},r,{expanded:l({},r.expanded,(me={},me[U]=!0,me))})}else if(be&&!ue){var je=r.expanded;je[U];var ne=I(je,[U].map(h));return l({},r,{expanded:ne})}else return r}}function Ft(r){var s=r.data,u=r.rows,a=r.rowsById,x=r.manualExpandedKey,b=x===void 0?"expanded":x,m=r.paginateExpandedRows,E=m===void 0?!0:m,F=r.expandSubRows,U=F===void 0?!0:F,te=r.autoResetExpanded,be=te===void 0?!0:te,ue=r.getHooks,me=r.plugins,je=r.state.expanded,ne=r.dispatch;Q(me,["useSortBy","useGroupBy","usePivotColumns","useGlobalFilter"],"useExpanded");var Ge=G(be),Ye=!!(Object.keys(a).length&&Object.keys(je).length);Ye&&Object.keys(a).some(function(Ae){return!je[Ae]})&&(Ye=!1),$(function(){Ge()&&ne({type:g.resetExpanded})},[ne,s]);var Ze=n.useCallback(function(Ae,ze){ne({type:g.toggleRowExpanded,id:Ae,value:ze})},[ne]),Ee=n.useCallback(function(Ae){return ne({type:g.toggleAllRowsExpanded,value:Ae})},[ne]),rt=n.useMemo(function(){return E?st(u,{manualExpandedKey:b,expanded:je,expandSubRows:U}):u},[E,u,b,je,U]),ut=n.useMemo(function(){return pr(je)},[je]),Ne=G(r),we=P(ue().getToggleAllRowsExpandedProps,{instance:Ne()});Object.assign(r,{preExpandedRows:u,expandedRows:rt,rows:rt,expandedDepth:ut,isAllRowsExpanded:Ye,toggleRowExpanded:Ze,toggleAllRowsExpanded:Ee,getToggleAllRowsExpandedProps:we})}function At(r,s){var u=s.instance.getHooks,a=s.instance;r.toggleRowExpanded=function(x){return a.toggleRowExpanded(r.id,x)},r.getToggleRowExpandedProps=P(u().getToggleRowExpandedProps,{instance:a,row:r})}function pr(r){var s=0;return Object.keys(r).forEach(function(u){var a=u.split(".");s=Math.max(s,a.length)}),s}var B=function(s,u,a){return s=s.filter(function(x){return u.some(function(b){var m=x.values[b];return String(m).toLowerCase().includes(String(a).toLowerCase())})}),s};B.autoRemove=function(r){return!r};var ye=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m!==void 0?String(m).toLowerCase()===String(a).toLowerCase():!0})})};ye.autoRemove=function(r){return!r};var bt=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m!==void 0?String(m)===String(a):!0})})};bt.autoRemove=function(r){return!r};var Lt=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m.includes(a)})})};Lt.autoRemove=function(r){return!r||!r.length};var Xt=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m&&m.length&&a.every(function(E){return m.includes(E)})})})};Xt.autoRemove=function(r){return!r||!r.length};var qt=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m&&m.length&&a.some(function(E){return m.includes(E)})})})};qt.autoRemove=function(r){return!r||!r.length};var tr=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return a.includes(m)})})};tr.autoRemove=function(r){return!r||!r.length};var Jr=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m===a})})};Jr.autoRemove=function(r){return typeof r>"u"};var Dr=function(s,u,a){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m==a})})};Dr.autoRemove=function(r){return r==null};var Qr=function(s,u,a){var x=a||[],b=x[0],m=x[1];if(b=typeof b=="number"?b:-1/0,m=typeof m=="number"?m:1/0,b>m){var E=b;b=m,m=E}return s.filter(function(F){return u.some(function(U){var te=F.values[U];return te>=b&&te<=m})})};Qr.autoRemove=function(r){return!r||typeof r[0]!="number"&&typeof r[1]!="number"};var jr=Object.freeze({__proto__:null,text:B,exactText:ye,exactTextCase:bt,includes:Lt,includesAll:Xt,includesSome:qt,includesValue:tr,exact:Jr,equals:Dr,between:Qr});g.resetFilters="resetFilters",g.setFilter="setFilter",g.setAllFilters="setAllFilters";var es=function(s){s.stateReducers.push(Fs),s.useInstance.push(Ms)};es.pluginName="useFilters";function Fs(r,s,u,a){if(s.type===g.init)return l({filters:[]},r);if(s.type===g.resetFilters)return l({},r,{filters:a.initialState.filters||[]});if(s.type===g.setFilter){var x=s.columnId,b=s.filterValue,m=a.allColumns,E=a.filterTypes,F=m.find(function(ne){return ne.id===x});if(!F)throw new Error("React-Table: Could not find a column with id: "+x);var U=_t(F.filter,E||{},jr),te=r.filters.find(function(ne){return ne.id===x}),be=M(b,te&&te.value);return pt(U.autoRemove,be,F)?l({},r,{filters:r.filters.filter(function(ne){return ne.id!==x})}):te?l({},r,{filters:r.filters.map(function(ne){return ne.id===x?{id:x,value:be}:ne})}):l({},r,{filters:[].concat(r.filters,[{id:x,value:be}])})}if(s.type===g.setAllFilters){var ue=s.filters,me=a.allColumns,je=a.filterTypes;return l({},r,{filters:M(ue,r.filters).filter(function(ne){var Ge=me.find(function(Ze){return Ze.id===ne.id}),Ye=_t(Ge.filter,je||{},jr);return!pt(Ye.autoRemove,ne.value,Ge)})})}}function Ms(r){var s=r.data,u=r.rows,a=r.flatRows,x=r.rowsById,b=r.allColumns,m=r.filterTypes,E=r.manualFilters,F=r.defaultCanFilter,U=F===void 0?!1:F,te=r.disableFilters,be=r.state.filters,ue=r.dispatch,me=r.autoResetFilters,je=me===void 0?!0:me,ne=n.useCallback(function(Ne,we){ue({type:g.setFilter,columnId:Ne,filterValue:we})},[ue]),Ge=n.useCallback(function(Ne){ue({type:g.setAllFilters,filters:Ne})},[ue]);b.forEach(function(Ne){var we=Ne.id,Ae=Ne.accessor,ze=Ne.defaultCanFilter,nt=Ne.disableFilters;Ne.canFilter=Ae?ke(nt===!0?!1:void 0,te===!0?!1:void 0,!0):ke(ze,U,!1),Ne.setFilter=function(St){return ne(Ne.id,St)};var it=be.find(function(St){return St.id===we});Ne.filterValue=it&&it.value});var Ye=n.useMemo(function(){if(E||!be.length)return[u,a,x];var Ne=[],we={},Ae=function ze(nt,it){it===void 0&&(it=0);var St=nt;return St=be.reduce(function(Le,Wt){var ot=Wt.id,Xe=Wt.value,Qe=b.find(function(Yt){return Yt.id===ot});if(!Qe)return Le;it===0&&(Qe.preFilteredRows=Le);var Nt=_t(Qe.filter,m||{},jr);return Nt?(Qe.filteredRows=Nt(Le,[ot],Xe),Qe.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+Qe.id+"."),Le)},nt),St.forEach(function(Le){Ne.push(Le),we[Le.id]=Le,Le.subRows&&(Le.subRows=Le.subRows&&Le.subRows.length>0?ze(Le.subRows,it+1):Le.subRows)}),St};return[Ae(u),Ne,we]},[E,be,u,a,x,b,m]),Ze=Ye[0],Ee=Ye[1],rt=Ye[2];n.useMemo(function(){var Ne=b.filter(function(we){return!be.find(function(Ae){return Ae.id===we.id})});Ne.forEach(function(we){we.preFilteredRows=Ze,we.filteredRows=Ze})},[Ze,be,b]);var ut=G(je);$(function(){ut()&&ue({type:g.resetFilters})},[ue,E?null:s]),Object.assign(r,{preFilteredRows:u,preFilteredFlatRows:a,preFilteredRowsById:x,filteredRows:Ze,filteredFlatRows:Ee,filteredRowsById:rt,rows:Ze,flatRows:Ee,rowsById:rt,setFilter:ne,setAllFilters:Ge})}g.resetGlobalFilter="resetGlobalFilter",g.setGlobalFilter="setGlobalFilter";var ts=function(s){s.stateReducers.push(rs),s.useInstance.push(ss)};ts.pluginName="useGlobalFilter";function rs(r,s,u,a){if(s.type===g.resetGlobalFilter)return l({},r,{globalFilter:a.initialState.globalFilter||void 0});if(s.type===g.setGlobalFilter){var x=s.filterValue,b=a.userFilterTypes,m=_t(a.globalFilter,b||{},jr),E=M(x,r.globalFilter);if(pt(m.autoRemove,E)){r.globalFilter;var F=I(r,["globalFilter"]);return F}return l({},r,{globalFilter:E})}}function ss(r){var s=r.data,u=r.rows,a=r.flatRows,x=r.rowsById,b=r.allColumns,m=r.filterTypes,E=r.globalFilter,F=r.manualGlobalFilter,U=r.state.globalFilter,te=r.dispatch,be=r.autoResetGlobalFilter,ue=be===void 0?!0:be,me=r.disableGlobalFilter,je=n.useCallback(function(rt){te({type:g.setGlobalFilter,filterValue:rt})},[te]),ne=n.useMemo(function(){if(F||typeof U>"u")return[u,a,x];var rt=[],ut={},Ne=_t(E,m||{},jr);if(!Ne)return console.warn("Could not find a valid 'globalFilter' option."),u;b.forEach(function(ze){var nt=ze.disableGlobalFilter;ze.canFilter=ke(nt===!0?!1:void 0,me===!0?!1:void 0,!0)});var we=b.filter(function(ze){return ze.canFilter===!0}),Ae=function ze(nt){return nt=Ne(nt,we.map(function(it){return it.id}),U),nt.forEach(function(it){rt.push(it),ut[it.id]=it,it.subRows=it.subRows&&it.subRows.length?ze(it.subRows):it.subRows}),nt};return[Ae(u),rt,ut]},[F,U,E,m,b,u,a,x,me]),Ge=ne[0],Ye=ne[1],Ze=ne[2],Ee=G(ue);$(function(){Ee()&&te({type:g.resetGlobalFilter})},[te,F?null:s]),Object.assign(r,{preGlobalFilteredRows:u,preGlobalFilteredFlatRows:a,preGlobalFilteredRowsById:x,globalFilteredRows:Ge,globalFilteredFlatRows:Ye,globalFilteredRowsById:Ze,rows:Ge,flatRows:Ye,rowsById:Ze,setGlobalFilter:je,disableGlobalFilter:me})}function Pr(r,s){return s.reduce(function(u,a){return u+(typeof a=="number"?a:0)},0)}function Rr(r){var s=r[0]||0;return r.forEach(function(u){typeof u=="number"&&(s=Math.min(s,u))}),s}function ls(r){var s=r[0]||0;return r.forEach(function(u){typeof u=="number"&&(s=Math.max(s,u))}),s}function Hs(r){var s=r[0]||0,u=r[0]||0;return r.forEach(function(a){typeof a=="number"&&(s=Math.min(s,a),u=Math.max(u,a))}),s+".."+u}function ns(r){return Pr(null,r)/r.length}function Ls(r){if(!r.length)return null;var s=Math.floor(r.length/2),u=[].concat(r).sort(function(a,x){return a-x});return r.length%2!==0?u[s]:(u[s-1]+u[s])/2}function ks(r){return Array.from(new Set(r).values())}function Vs(r){return new Set(r).size}function as(r){return r.length}var Ir=Object.freeze({__proto__:null,sum:Pr,min:Rr,max:ls,minMax:Hs,average:ns,median:Ls,unique:ks,uniqueCount:Vs,count:as}),Os=[],Ws={};g.resetGroupBy="resetGroupBy",g.setGroupBy="setGroupBy",g.toggleGroupBy="toggleGroupBy";var Tr=function(s){s.getGroupByToggleProps=[is],s.stateReducers.push(zs),s.visibleColumnsDeps.push(function(u,a){var x=a.instance;return[].concat(u,[x.state.groupBy])}),s.visibleColumns.push(Ys),s.useInstance.push(Us),s.prepareRow.push(Ks)};Tr.pluginName="useGroupBy";var is=function(s,u){var a=u.header;return[s,{onClick:a.canGroupBy?function(x){x.persist(),a.toggleGroupBy()}:void 0,style:{cursor:a.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function zs(r,s,u,a){if(s.type===g.init)return l({groupBy:[]},r);if(s.type===g.resetGroupBy)return l({},r,{groupBy:a.initialState.groupBy||[]});if(s.type===g.setGroupBy){var x=s.value;return l({},r,{groupBy:x})}if(s.type===g.toggleGroupBy){var b=s.columnId,m=s.value,E=typeof m<"u"?m:!r.groupBy.includes(b);return E?l({},r,{groupBy:[].concat(r.groupBy,[b])}):l({},r,{groupBy:r.groupBy.filter(function(F){return F!==b})})}}function Ys(r,s){var u=s.instance.state.groupBy,a=u.map(function(b){return r.find(function(m){return m.id===b})}).filter(Boolean),x=r.filter(function(b){return!u.includes(b.id)});return r=[].concat(a,x),r.forEach(function(b){b.isGrouped=u.includes(b.id),b.groupedIndex=u.indexOf(b.id)}),r}var qs={};function Us(r){var s=r.data,u=r.rows,a=r.flatRows,x=r.rowsById,b=r.allColumns,m=r.flatHeaders,E=r.groupByFn,F=E===void 0?os:E,U=r.manualGroupBy,te=r.aggregations,be=te===void 0?qs:te,ue=r.plugins,me=r.state.groupBy,je=r.dispatch,ne=r.autoResetGroupBy,Ge=ne===void 0?!0:ne,Ye=r.disableGroupBy,Ze=r.defaultCanGroupBy,Ee=r.getHooks;Q(ue,["useColumnOrder","useFilters"],"useGroupBy");var rt=G(r);b.forEach(function(Xe){var Qe=Xe.accessor,Nt=Xe.defaultGroupBy,Yt=Xe.disableGroupBy;Xe.canGroupBy=Qe?ke(Xe.canGroupBy,Yt===!0?!1:void 0,Ye===!0?!1:void 0,!0):ke(Xe.canGroupBy,Nt,Ze,!1),Xe.canGroupBy&&(Xe.toggleGroupBy=function(){return r.toggleGroupBy(Xe.id)}),Xe.Aggregated=Xe.Aggregated||Xe.Cell});var ut=n.useCallback(function(Xe,Qe){je({type:g.toggleGroupBy,columnId:Xe,value:Qe})},[je]),Ne=n.useCallback(function(Xe){je({type:g.setGroupBy,value:Xe})},[je]);m.forEach(function(Xe){Xe.getGroupByToggleProps=P(Ee().getGroupByToggleProps,{instance:rt(),header:Xe})});var we=n.useMemo(function(){if(U||!me.length)return[u,a,x,Os,Ws,a,x];var Xe=me.filter(function(zt){return b.find(function(mr){return mr.id===zt})}),Qe=function(mr,Ut,Ps){var xr={};return b.forEach(function(Mt){if(Xe.includes(Mt.id)){xr[Mt.id]=Ut[0]?Ut[0].values[Mt.id]:null;return}var Ss=typeof Mt.aggregate=="function"?Mt.aggregate:be[Mt.aggregate]||Ir[Mt.aggregate];if(Ss){var Nr=Ut.map(function(Er){return Er.values[Mt.id]}),fl=mr.map(function(Er){var gr=Er.values[Mt.id];if(!Ps&&Mt.aggregateValue){var vr=typeof Mt.aggregateValue=="function"?Mt.aggregateValue:be[Mt.aggregateValue]||Ir[Mt.aggregateValue];if(!vr)throw console.info({column:Mt}),new Error("React Table: Invalid column.aggregateValue option for column listed above");gr=vr(gr,Er,Mt)}return gr});xr[Mt.id]=Ss(fl,Nr)}else{if(Mt.aggregate)throw console.info({column:Mt}),new Error("React Table: Invalid column.aggregate option for column listed above");xr[Mt.id]=null}}),xr},Nt=[],Yt={},Cr=[],Or={},Ke=[],It={},Vt=function zt(mr,Ut,Ps){if(Ut===void 0&&(Ut=0),Ut===Xe.length)return mr.map(function(Nr){return l({},Nr,{depth:Ut})});var xr=Xe[Ut],Mt=F(mr,xr),Ss=Object.entries(Mt).map(function(Nr,fl){var Er=Nr[0],gr=Nr[1],vr=xr+":"+Er;vr=Ps?Ps+">"+vr:vr;var Dl=zt(gr,Ut+1,vr),Il=Ut?He(gr,"leafRows"):gr,Xl=Qe(Il,gr,Ut),Jl={id:vr,isGrouped:!0,groupByID:xr,groupByVal:Er,values:Xl,subRows:Dl,leafRows:Il,depth:Ut,index:fl};return Dl.forEach(function(ar){Nt.push(ar),Yt[ar.id]=ar,ar.isGrouped?(Cr.push(ar),Or[ar.id]=ar):(Ke.push(ar),It[ar.id]=ar)}),Jl});return Ss},Jt=Vt(u);return Jt.forEach(function(zt){Nt.push(zt),Yt[zt.id]=zt,zt.isGrouped?(Cr.push(zt),Or[zt.id]=zt):(Ke.push(zt),It[zt.id]=zt)}),[Jt,Nt,Yt,Cr,Or,Ke,It]},[U,me,u,a,x,b,be,F]),Ae=we[0],ze=we[1],nt=we[2],it=we[3],St=we[4],Le=we[5],Wt=we[6],ot=G(Ge);$(function(){ot()&&je({type:g.resetGroupBy})},[je,U?null:s]),Object.assign(r,{preGroupedRows:u,preGroupedFlatRow:a,preGroupedRowsById:x,groupedRows:Ae,groupedFlatRows:ze,groupedRowsById:nt,onlyGroupedFlatRows:it,onlyGroupedRowsById:St,nonGroupedFlatRows:Le,nonGroupedRowsById:Wt,rows:Ae,flatRows:ze,rowsById:nt,toggleGroupBy:ut,setGroupBy:Ne})}function Ks(r){r.allCells.forEach(function(s){var u;s.isGrouped=s.column.isGrouped&&s.column.id===r.groupByID,s.isPlaceholder=!s.isGrouped&&s.column.isGrouped,s.isAggregated=!s.isGrouped&&!s.isPlaceholder&&((u=r.subRows)==null?void 0:u.length)})}function os(r,s){return r.reduce(function(u,a,x){var b=""+a.values[s];return u[b]=Array.isArray(u[b])?u[b]:[],u[b].push(a),u},{})}var us=/([0-9]+)/gm,Zs=function(s,u,a){var x=wr(s,u,a),b=x[0],m=x[1];for(b=ds(b),m=ds(m),b=b.split(us).filter(Boolean),m=m.split(us).filter(Boolean);b.length&&m.length;){var E=b.shift(),F=m.shift(),U=parseInt(E,10),te=parseInt(F,10),be=[U,te].sort();if(isNaN(be[0])){if(E>F)return 1;if(F>E)return-1;continue}if(isNaN(be[1]))return isNaN(U)?-1:1;if(U>te)return 1;if(te>U)return-1}return b.length-m.length};function $s(r,s,u){var a=wr(r,s,u),x=a[0],b=a[1];return x=x.getTime(),b=b.getTime(),Br(x,b)}function Xs(r,s,u){var a=wr(r,s,u),x=a[0],b=a[1];return Br(x,b)}function Js(r,s,u){var a=wr(r,s,u),x=a[0],b=a[1];for(x=x.split("").filter(Boolean),b=b.split("").filter(Boolean);x.length&&b.length;){var m=x.shift(),E=b.shift(),F=m.toLowerCase(),U=E.toLowerCase();if(F>U)return 1;if(U>F)return-1;if(m>E)return 1;if(E>m)return-1}return x.length-b.length}function cs(r,s,u){var a=wr(r,s,u),x=a[0],b=a[1],m=/[^0-9.]/gi;return x=Number(String(x).replace(m,"")),b=Number(String(b).replace(m,"")),Br(x,b)}function Br(r,s){return r===s?0:r>s?1:-1}function wr(r,s,u){return[r.values[u],s.values[u]]}function ds(r){return typeof r=="number"?isNaN(r)||r===1/0||r===-1/0?"":String(r):typeof r=="string"?r:""}var Qs=Object.freeze({__proto__:null,alphanumeric:Zs,datetime:$s,basic:Xs,string:Js,number:cs});g.resetSortBy="resetSortBy",g.setSortBy="setSortBy",g.toggleSortBy="toggleSortBy",g.clearSortBy="clearSortBy",z.sortType="alphanumeric",z.sortDescFirst=!1;var fs=function(s){s.getSortByToggleProps=[el],s.stateReducers.push(hs),s.useInstance.push(ps)};fs.pluginName="useSortBy";var el=function(s,u){var a=u.instance,x=u.column,b=a.isMultiSortEvent,m=b===void 0?function(E){return E.shiftKey}:b;return[s,{onClick:x.canSort?function(E){E.persist(),x.toggleSortBy(void 0,!a.disableMultiSort&&m(E))}:void 0,style:{cursor:x.canSort?"pointer":void 0},title:x.canSort?"Toggle SortBy":void 0}]};function hs(r,s,u,a){if(s.type===g.init)return l({sortBy:[]},r);if(s.type===g.resetSortBy)return l({},r,{sortBy:a.initialState.sortBy||[]});if(s.type===g.clearSortBy){var x=r.sortBy,b=x.filter(function(Ae){return Ae.id!==s.columnId});return l({},r,{sortBy:b})}if(s.type===g.setSortBy){var m=s.sortBy;return l({},r,{sortBy:m})}if(s.type===g.toggleSortBy){var E=s.columnId,F=s.desc,U=s.multi,te=a.allColumns,be=a.disableMultiSort,ue=a.disableSortRemove,me=a.disableMultiRemove,je=a.maxMultiSortColCount,ne=je===void 0?Number.MAX_SAFE_INTEGER:je,Ge=r.sortBy,Ye=te.find(function(Ae){return Ae.id===E}),Ze=Ye.sortDescFirst,Ee=Ge.find(function(Ae){return Ae.id===E}),rt=Ge.findIndex(function(Ae){return Ae.id===E}),ut=typeof F<"u"&&F!==null,Ne=[],we;return!be&&U?Ee?we="toggle":we="add":rt!==Ge.length-1||Ge.length!==1?we="replace":Ee?we="toggle":we="replace",we==="toggle"&&!ue&&!ut&&(!U||!me)&&(Ee&&Ee.desc&&!Ze||!Ee.desc&&Ze)&&(we="remove"),we==="replace"?Ne=[{id:E,desc:ut?F:Ze}]:we==="add"?(Ne=[].concat(Ge,[{id:E,desc:ut?F:Ze}]),Ne.splice(0,Ne.length-ne)):we==="toggle"?Ne=Ge.map(function(Ae){return Ae.id===E?l({},Ae,{desc:ut?F:!Ee.desc}):Ae}):we==="remove"&&(Ne=Ge.filter(function(Ae){return Ae.id!==E})),l({},r,{sortBy:Ne})}}function ps(r){var s=r.data,u=r.rows,a=r.flatRows,x=r.allColumns,b=r.orderByFn,m=b===void 0?Gr:b,E=r.sortTypes,F=r.manualSortBy,U=r.defaultCanSort,te=r.disableSortBy,be=r.flatHeaders,ue=r.state.sortBy,me=r.dispatch,je=r.plugins,ne=r.getHooks,Ge=r.autoResetSortBy,Ye=Ge===void 0?!0:Ge;Q(je,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var Ze=n.useCallback(function(ze){me({type:g.setSortBy,sortBy:ze})},[me]),Ee=n.useCallback(function(ze,nt,it){me({type:g.toggleSortBy,columnId:ze,desc:nt,multi:it})},[me]),rt=G(r);be.forEach(function(ze){var nt=ze.accessor,it=ze.canSort,St=ze.disableSortBy,Le=ze.id,Wt=nt?ke(St===!0?!1:void 0,te===!0?!1:void 0,!0):ke(U,it,!1);ze.canSort=Wt,ze.canSort&&(ze.toggleSortBy=function(Xe,Qe){return Ee(ze.id,Xe,Qe)},ze.clearSortBy=function(){me({type:g.clearSortBy,columnId:ze.id})}),ze.getSortByToggleProps=P(ne().getSortByToggleProps,{instance:rt(),column:ze});var ot=ue.find(function(Xe){return Xe.id===Le});ze.isSorted=!!ot,ze.sortedIndex=ue.findIndex(function(Xe){return Xe.id===Le}),ze.isSortedDesc=ze.isSorted?ot.desc:void 0});var ut=n.useMemo(function(){if(F||!ue.length)return[u,a];var ze=[],nt=ue.filter(function(St){return x.find(function(Le){return Le.id===St.id})}),it=function St(Le){var Wt=m(Le,nt.map(function(ot){var Xe=x.find(function(Yt){return Yt.id===ot.id});if(!Xe)throw new Error("React-Table: Could not find a column with id: "+ot.id+" while sorting");var Qe=Xe.sortType,Nt=xt(Qe)||(E||{})[Qe]||Qs[Qe];if(!Nt)throw new Error("React-Table: Could not find a valid sortType of '"+Qe+"' for column '"+ot.id+"'.");return function(Yt,Cr){return Nt(Yt,Cr,ot.id,ot.desc)}}),nt.map(function(ot){var Xe=x.find(function(Qe){return Qe.id===ot.id});return Xe&&Xe.sortInverted?ot.desc:!ot.desc}));return Wt.forEach(function(ot){ze.push(ot),!(!ot.subRows||ot.subRows.length===0)&&(ot.subRows=St(ot.subRows))}),Wt};return[it(u),ze]},[F,ue,u,a,x,m,E]),Ne=ut[0],we=ut[1],Ae=G(Ye);$(function(){Ae()&&me({type:g.resetSortBy})},[F?null:s]),Object.assign(r,{preSortedRows:u,preSortedFlatRows:a,sortedRows:Ne,sortedFlatRows:we,rows:Ne,flatRows:we,setSortBy:Ze,toggleSortBy:Ee})}function Gr(r,s,u){return[].concat(r).sort(function(a,x){for(var b=0;b<s.length;b+=1){var m=s[b],E=u[b]===!1||u[b]==="desc",F=m(a,x);if(F!==0)return E?-F:F}return u[0]?a.index-x.index:x.index-a.index})}var tl="usePagination";g.resetPage="resetPage",g.gotoPage="gotoPage",g.setPageSize="setPageSize";var ms=function(s){s.stateReducers.push(rl),s.useInstance.push(xs)};ms.pluginName=tl;function rl(r,s,u,a){if(s.type===g.init)return l({pageSize:10,pageIndex:0},r);if(s.type===g.resetPage)return l({},r,{pageIndex:a.initialState.pageIndex||0});if(s.type===g.gotoPage){var x=a.pageCount,b=a.page,m=M(s.pageIndex,r.pageIndex),E=!1;return m>r.pageIndex?E=x===-1?b.length>=r.pageSize:m<x:m<r.pageIndex&&(E=m>-1),E?l({},r,{pageIndex:m}):r}if(s.type===g.setPageSize){var F=s.pageSize,U=r.pageSize*r.pageIndex,te=Math.floor(U/F);return l({},r,{pageIndex:te,pageSize:F})}}function xs(r){var s=r.rows,u=r.autoResetPage,a=u===void 0?!0:u,x=r.manualExpandedKey,b=x===void 0?"expanded":x,m=r.plugins,E=r.pageCount,F=r.paginateExpandedRows,U=F===void 0?!0:F,te=r.expandSubRows,be=te===void 0?!0:te,ue=r.state,me=ue.pageSize,je=ue.pageIndex,ne=ue.expanded,Ge=ue.globalFilter,Ye=ue.filters,Ze=ue.groupBy,Ee=ue.sortBy,rt=r.dispatch,ut=r.data,Ne=r.manualPagination;Q(m,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var we=G(a);$(function(){we()&&rt({type:g.resetPage})},[rt,Ne?null:ut,Ge,Ye,Ze,Ee]);var Ae=Ne?E:Math.ceil(s.length/me),ze=n.useMemo(function(){return Ae>0?[].concat(new Array(Ae)).fill(null).map(function(Qe,Nt){return Nt}):[]},[Ae]),nt=n.useMemo(function(){var Qe;if(Ne)Qe=s;else{var Nt=me*je,Yt=Nt+me;Qe=s.slice(Nt,Yt)}return U?Qe:st(Qe,{manualExpandedKey:b,expanded:ne,expandSubRows:be})},[be,ne,b,Ne,je,me,U,s]),it=je>0,St=Ae===-1?nt.length>=me:je<Ae-1,Le=n.useCallback(function(Qe){rt({type:g.gotoPage,pageIndex:Qe})},[rt]),Wt=n.useCallback(function(){return Le(function(Qe){return Qe-1})},[Le]),ot=n.useCallback(function(){return Le(function(Qe){return Qe+1})},[Le]),Xe=n.useCallback(function(Qe){rt({type:g.setPageSize,pageSize:Qe})},[rt]);Object.assign(r,{pageOptions:ze,pageCount:Ae,page:nt,canPreviousPage:it,canNextPage:St,gotoPage:Le,previousPage:Wt,nextPage:ot,setPageSize:Xe})}g.resetPivot="resetPivot",g.togglePivot="togglePivot";var gs=function(s){s.getPivotToggleProps=[sl],s.stateReducers.push(ys),s.useInstanceAfterData.push(ll),s.allColumns.push(nl),s.accessValue.push(al),s.materializedColumns.push(il),s.materializedColumnsDeps.push(Fr),s.visibleColumns.push(_s),s.visibleColumnsDeps.push(Sr),s.useInstance.push(Mr),s.prepareRow.push(Hr)};gs.pluginName="usePivotColumns";var vs=[],sl=function(s,u){var a=u.header;return[s,{onClick:a.canPivot?function(x){x.persist(),a.togglePivot()}:void 0,style:{cursor:a.canPivot?"pointer":void 0},title:"Toggle Pivot"}]};function ys(r,s,u,a){if(s.type===g.init)return l({pivotColumns:vs},r);if(s.type===g.resetPivot)return l({},r,{pivotColumns:a.initialState.pivotColumns||vs});if(s.type===g.togglePivot){var x=s.columnId,b=s.value,m=typeof b<"u"?b:!r.pivotColumns.includes(x);return m?l({},r,{pivotColumns:[].concat(r.pivotColumns,[x])}):l({},r,{pivotColumns:r.pivotColumns.filter(function(E){return E!==x})})}}function ll(r){r.allColumns.forEach(function(s){s.isPivotSource=r.state.pivotColumns.includes(s.id)})}function nl(r,s){var u=s.instance;return r.forEach(function(a){a.isPivotSource=u.state.pivotColumns.includes(a.id),a.uniqueValues=new Set}),r}function al(r,s){var u=s.column;return u.uniqueValues&&typeof r<"u"&&u.uniqueValues.add(r),r}function il(r,s){var u=s.instance,a=u.allColumns,x=u.state;if(!x.pivotColumns.length||!x.groupBy||!x.groupBy.length)return r;var b=x.pivotColumns.map(function(U){return a.find(function(te){return te.id===U})}).filter(Boolean),m=a.filter(function(U){return!U.isPivotSource&&!x.groupBy.includes(U.id)&&!x.pivotColumns.includes(U.id)}),E=function U(te,be,ue){te===void 0&&(te=0),ue===void 0&&(ue=[]);var me=b[te];if(!me)return m.map(function(ne){return l({},ne,{canPivot:!1,isPivoted:!0,parent:be,depth:te,id:""+(be?be.id+"."+ne.id:ne.id),accessor:function(Ye,Ze,Ee){if(ue.every(function(rt){return rt(Ee)}))return Ee.values[ne.id]}})});var je=Array.from(me.uniqueValues).sort();return je.map(function(ne){var Ge=l({},me,{Header:me.PivotHeader||typeof me.header=="string"?me.Header+": "+ne:ne,isPivotGroup:!0,parent:be,depth:te,id:be?be.id+"."+me.id+"."+ne:me.id+"."+ne,pivotValue:ne});return Ge.columns=U(te+1,Ge,[].concat(ue,[function(Ye){return Ye.values[me.id]===ne}])),Ge})},F=ie(E());return[].concat(r,F)}function Fr(r,s){var u=s.instance.state,a=u.pivotColumns,x=u.groupBy;return[].concat(r,[a,x])}function _s(r,s){var u=s.instance.state;return r=r.filter(function(a){return!a.isPivotSource}),u.pivotColumns.length&&u.groupBy&&u.groupBy.length&&(r=r.filter(function(a){return a.isGrouped||a.isPivoted})),r}function Sr(r,s){var u=s.instance;return[].concat(r,[u.state.pivotColumns,u.state.groupBy])}function Mr(r){var s=r.columns,u=r.allColumns,a=r.flatHeaders,x=r.getHooks,b=r.plugins,m=r.dispatch,E=r.autoResetPivot,F=E===void 0?!0:E,U=r.manaulPivot,te=r.disablePivot,be=r.defaultCanPivot;Q(b,["useGroupBy"],"usePivotColumns");var ue=G(r);u.forEach(function(ne){var Ge=ne.accessor,Ye=ne.defaultPivot,Ze=ne.disablePivot;ne.canPivot=Ge?ke(ne.canPivot,Ze===!0?!1:void 0,te===!0?!1:void 0,!0):ke(ne.canPivot,Ye,be,!1),ne.canPivot&&(ne.togglePivot=function(){return r.togglePivot(ne.id)}),ne.Aggregated=ne.Aggregated||ne.Cell});var me=function(Ge,Ye){m({type:g.togglePivot,columnId:Ge,value:Ye})};a.forEach(function(ne){ne.getPivotToggleProps=P(x().getPivotToggleProps,{instance:ue(),header:ne})});var je=G(F);$(function(){je()&&m({type:g.resetPivot})},[m,U?null:s]),Object.assign(r,{togglePivot:me})}function Hr(r){r.allCells.forEach(function(s){s.isPivoted=s.column.isPivoted})}var bs="useRowSelect";g.resetSelectedRows="resetSelectedRows",g.toggleAllRowsSelected="toggleAllRowsSelected",g.toggleRowSelected="toggleRowSelected",g.toggleAllPageRowsSelected="toggleAllPageRowsSelected";var Lr=function(s){s.getToggleRowSelectedProps=[ol],s.getToggleAllRowsSelectedProps=[kr],s.getToggleAllPageRowsSelectedProps=[ul],s.stateReducers.push(cl),s.useInstance.push(dl),s.prepareRow.push(js)};Lr.pluginName=bs;var ol=function(s,u){var a=u.instance,x=u.row,b=a.manualRowSelectedKey,m=b===void 0?"isSelected":b,E=!1;return x.original&&x.original[m]?E=!0:E=x.isSelected,[s,{onChange:function(U){x.toggleRowSelected(U.target.checked)},style:{cursor:"pointer"},checked:E,title:"Toggle Row Selected",indeterminate:x.isSomeSelected}]},kr=function(s,u){var a=u.instance;return[s,{onChange:function(b){a.toggleAllRowsSelected(b.target.checked)},style:{cursor:"pointer"},checked:a.isAllRowsSelected,title:"Toggle All Rows Selected",indeterminate:!!(!a.isAllRowsSelected&&Object.keys(a.state.selectedRowIds).length)}]},ul=function(s,u){var a=u.instance;return[s,{onChange:function(b){a.toggleAllPageRowsSelected(b.target.checked)},style:{cursor:"pointer"},checked:a.isAllPageRowsSelected,title:"Toggle All Current Page Rows Selected",indeterminate:!!(!a.isAllPageRowsSelected&&a.page.some(function(x){var b=x.id;return a.state.selectedRowIds[b]}))}]};function cl(r,s,u,a){if(s.type===g.init)return l({selectedRowIds:{}},r);if(s.type===g.resetSelectedRows)return l({},r,{selectedRowIds:a.initialState.selectedRowIds||{}});if(s.type===g.toggleAllRowsSelected){var x=s.value,b=a.isAllRowsSelected,m=a.rowsById,E=a.nonGroupedRowsById,F=E===void 0?m:E,U=typeof x<"u"?x:!b,te=Object.assign({},r.selectedRowIds);return U?Object.keys(F).forEach(function(ot){te[ot]=!0}):Object.keys(F).forEach(function(ot){delete te[ot]}),l({},r,{selectedRowIds:te})}if(s.type===g.toggleRowSelected){var be=s.id,ue=s.value,me=a.rowsById,je=a.selectSubRows,ne=je===void 0?!0:je,Ge=a.getSubRows,Ye=r.selectedRowIds[be],Ze=typeof ue<"u"?ue:!Ye;if(Ye===Ze)return r;var Ee=l({},r.selectedRowIds),rt=function ot(Xe){var Qe=me[Xe];if(Qe&&(Qe.isGrouped||(Ze?Ee[Xe]=!0:delete Ee[Xe]),ne&&Ge(Qe)))return Ge(Qe).forEach(function(Nt){return ot(Nt.id)})};return rt(be),l({},r,{selectedRowIds:Ee})}if(s.type===g.toggleAllPageRowsSelected){var ut=s.value,Ne=a.page,we=a.rowsById,Ae=a.selectSubRows,ze=Ae===void 0?!0:Ae,nt=a.isAllPageRowsSelected,it=a.getSubRows,St=typeof ut<"u"?ut:!nt,Le=l({},r.selectedRowIds),Wt=function ot(Xe){var Qe=we[Xe];if(Qe.isGrouped||(St?Le[Xe]=!0:delete Le[Xe]),ze&&it(Qe))return it(Qe).forEach(function(Nt){return ot(Nt.id)})};return Ne.forEach(function(ot){return Wt(ot.id)}),l({},r,{selectedRowIds:Le})}return r}function dl(r){var s=r.data,u=r.rows,a=r.getHooks,x=r.plugins,b=r.rowsById,m=r.nonGroupedRowsById,E=m===void 0?b:m,F=r.autoResetSelectedRows,U=F===void 0?!0:F,te=r.state.selectedRowIds,be=r.selectSubRows,ue=be===void 0?!0:be,me=r.dispatch,je=r.page,ne=r.getSubRows;Q(x,["useFilters","useGroupBy","useSortBy","useExpanded","usePagination"],"useRowSelect");var Ge=n.useMemo(function(){var nt=[];return u.forEach(function(it){var St=ue?Rs(it,te,ne):!!te[it.id];it.isSelected=!!St,it.isSomeSelected=St===null,St&&nt.push(it)}),nt},[u,ue,te,ne]),Ye=!!(Object.keys(E).length&&Object.keys(te).length),Ze=Ye;Ye&&Object.keys(E).some(function(nt){return!te[nt]})&&(Ye=!1),Ye||je&&je.length&&je.some(function(nt){var it=nt.id;return!te[it]})&&(Ze=!1);var Ee=G(U);$(function(){Ee()&&me({type:g.resetSelectedRows})},[me,s]);var rt=n.useCallback(function(nt){return me({type:g.toggleAllRowsSelected,value:nt})},[me]),ut=n.useCallback(function(nt){return me({type:g.toggleAllPageRowsSelected,value:nt})},[me]),Ne=n.useCallback(function(nt,it){return me({type:g.toggleRowSelected,id:nt,value:it})},[me]),we=G(r),Ae=P(a().getToggleAllRowsSelectedProps,{instance:we()}),ze=P(a().getToggleAllPageRowsSelectedProps,{instance:we()});Object.assign(r,{selectedFlatRows:Ge,isAllRowsSelected:Ye,isAllPageRowsSelected:Ze,toggleRowSelected:Ne,toggleAllRowsSelected:rt,getToggleAllRowsSelectedProps:Ae,getToggleAllPageRowsSelectedProps:ze,toggleAllPageRowsSelected:ut})}function js(r,s){var u=s.instance;r.toggleRowSelected=function(a){return u.toggleRowSelected(r.id,a)},r.getToggleRowSelectedProps=P(u.getHooks().getToggleRowSelectedProps,{instance:u,row:r})}function Rs(r,s,u){if(s[r.id])return!0;var a=u(r);if(a&&a.length){var x=!0,b=!1;return a.forEach(function(m){b&&!x||(Rs(m,s,u)?b=!0:x=!1)}),x?!0:b?null:!1}return!1}var ws=function(s){return{}},Cs=function(s){return{}};g.setRowState="setRowState",g.setCellState="setCellState",g.resetRowState="resetRowState";var Es=function(s){s.stateReducers.push(Vr),s.useInstance.push(t),s.prepareRow.push(o)};Es.pluginName="useRowState";function Vr(r,s,u,a){var x=a.initialRowStateAccessor,b=x===void 0?ws:x,m=a.initialCellStateAccessor,E=m===void 0?Cs:m,F=a.rowsById;if(s.type===g.init)return l({rowState:{}},r);if(s.type===g.resetRowState)return l({},r,{rowState:a.initialState.rowState||{}});if(s.type===g.setRowState){var U,te=s.rowId,be=s.value,ue=typeof r.rowState[te]<"u"?r.rowState[te]:b(F[te]);return l({},r,{rowState:l({},r.rowState,(U={},U[te]=M(be,ue),U))})}if(s.type===g.setCellState){var me,je,ne,Ge,Ye,Ze=s.rowId,Ee=s.columnId,rt=s.value,ut=typeof r.rowState[Ze]<"u"?r.rowState[Ze]:b(F[Ze]),Ne=typeof(ut==null||(me=ut.cellState)==null?void 0:me[Ee])<"u"?ut.cellState[Ee]:E((je=F[Ze])==null||(ne=je.cells)==null?void 0:ne.find(function(we){return we.column.id===Ee}));return l({},r,{rowState:l({},r.rowState,(Ye={},Ye[Ze]=l({},ut,{cellState:l({},ut.cellState||{},(Ge={},Ge[Ee]=M(rt,Ne),Ge))}),Ye))})}}function t(r){var s=r.autoResetRowState,u=s===void 0?!0:s,a=r.data,x=r.dispatch,b=n.useCallback(function(F,U){return x({type:g.setRowState,rowId:F,value:U})},[x]),m=n.useCallback(function(F,U,te){return x({type:g.setCellState,rowId:F,columnId:U,value:te})},[x]),E=G(u);$(function(){E()&&x({type:g.resetRowState})},[a]),Object.assign(r,{setRowState:b,setCellState:m})}function o(r,s){var u=s.instance,a=u.initialRowStateAccessor,x=a===void 0?ws:a,b=u.initialCellStateAccessor,m=b===void 0?Cs:b,E=u.state.rowState;r&&(r.state=typeof E[r.id]<"u"?E[r.id]:x(r),r.setState=function(F){return u.setRowState(r.id,F)},r.cells.forEach(function(F){r.state.cellState||(r.state.cellState={}),F.state=typeof r.state.cellState[F.column.id]<"u"?r.state.cellState[F.column.id]:m(F),F.setState=function(U){return u.setCellState(r.id,F.column.id,U)}}))}g.resetColumnOrder="resetColumnOrder",g.setColumnOrder="setColumnOrder";var f=function(s){s.stateReducers.push(p),s.visibleColumnsDeps.push(function(u,a){var x=a.instance;return[].concat(u,[x.state.columnOrder])}),s.visibleColumns.push(w),s.useInstance.push(_)};f.pluginName="useColumnOrder";function p(r,s,u,a){if(s.type===g.init)return l({columnOrder:[]},r);if(s.type===g.resetColumnOrder)return l({},r,{columnOrder:a.initialState.columnOrder||[]});if(s.type===g.setColumnOrder)return l({},r,{columnOrder:M(s.columnOrder,r.columnOrder)})}function w(r,s){var u=s.instance.state.columnOrder;if(!u||!u.length)return r;for(var a=[].concat(u),x=[].concat(r),b=[],m=function(){var F=a.shift(),U=x.findIndex(function(te){return te.id===F});U>-1&&b.push(x.splice(U,1)[0])};x.length&&a.length;)m();return[].concat(b,x)}function _(r){var s=r.dispatch;r.setColumnOrder=n.useCallback(function(u){return s({type:g.setColumnOrder,columnOrder:u})},[s])}z.canResize=!0,g.columnStartResizing="columnStartResizing",g.columnResizing="columnResizing",g.columnDoneResizing="columnDoneResizing",g.resetResize="resetResize";var C=function(s){s.getResizerProps=[q],s.getHeaderProps.push({style:{position:"relative"}}),s.stateReducers.push(Z),s.useInstance.push(ge),s.useInstanceBeforeDimensions.push(ee)},q=function(s,u){var a=u.instance,x=u.header,b=a.dispatch,m=function(F,U){var te=!1;if(F.type==="touchstart"){if(F.touches&&F.touches.length>1)return;te=!0}var be=he(U),ue=be.map(function(Ne){return[Ne.id,Ne.totalWidth]}),me=te?Math.round(F.touches[0].clientX):F.clientX,je,ne,Ge=function(){window.cancelAnimationFrame(je),je=null,b({type:g.columnDoneResizing})},Ye=function(){window.cancelAnimationFrame(je),je=null,b({type:g.columnResizing,clientX:ne})},Ze=function(we){ne=we,je||(je=window.requestAnimationFrame(Ye))},Ee={mouse:{moveEvent:"mousemove",moveHandler:function(we){return Ze(we.clientX)},upEvent:"mouseup",upHandler:function(we){document.removeEventListener("mousemove",Ee.mouse.moveHandler),document.removeEventListener("mouseup",Ee.mouse.upHandler),Ge()}},touch:{moveEvent:"touchmove",moveHandler:function(we){return we.cancelable&&(we.preventDefault(),we.stopPropagation()),Ze(we.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(we){document.removeEventListener(Ee.touch.moveEvent,Ee.touch.moveHandler),document.removeEventListener(Ee.touch.upEvent,Ee.touch.moveHandler),Ge()}}},rt=te?Ee.touch:Ee.mouse,ut=Dt()?{passive:!1}:!1;document.addEventListener(rt.moveEvent,rt.moveHandler,ut),document.addEventListener(rt.upEvent,rt.upHandler,ut),b({type:g.columnStartResizing,columnId:U.id,columnWidth:U.totalWidth,headerIdWidths:ue,clientX:me})};return[s,{onMouseDown:function(F){return F.persist()||m(F,x)},onTouchStart:function(F){return F.persist()||m(F,x)},style:{cursor:"col-resize"},draggable:!1,role:"separator"}]};C.pluginName="useResizeColumns";function Z(r,s){if(s.type===g.init)return l({columnResizing:{columnWidths:{}}},r);if(s.type===g.resetResize)return l({},r,{columnResizing:{columnWidths:{}}});if(s.type===g.columnStartResizing){var u=s.clientX,a=s.columnId,x=s.columnWidth,b=s.headerIdWidths;return l({},r,{columnResizing:l({},r.columnResizing,{startX:u,headerIdWidths:b,columnWidth:x,isResizingColumn:a})})}if(s.type===g.columnResizing){var m=s.clientX,E=r.columnResizing,F=E.startX,U=E.columnWidth,te=E.headerIdWidths,be=te===void 0?[]:te,ue=m-F,me=ue/U,je={};return be.forEach(function(ne){var Ge=ne[0],Ye=ne[1];je[Ge]=Math.max(Ye+Ye*me,0)}),l({},r,{columnResizing:l({},r.columnResizing,{columnWidths:l({},r.columnResizing.columnWidths,{},je)})})}if(s.type===g.columnDoneResizing)return l({},r,{columnResizing:l({},r.columnResizing,{startX:null,isResizingColumn:null})})}var ee=function(s){var u=s.flatHeaders,a=s.disableResizing,x=s.getHooks,b=s.state.columnResizing,m=G(s);u.forEach(function(E){var F=ke(E.disableResizing===!0?!1:void 0,a===!0?!1:void 0,!0);E.canResize=F,E.width=b.columnWidths[E.id]||E.originalWidth||E.width,E.isResizing=b.isResizingColumn===E.id,F&&(E.getResizerProps=P(x().getResizerProps,{instance:m(),header:E}))})};function ge(r){var s=r.plugins,u=r.dispatch,a=r.autoResetResize,x=a===void 0?!0:a,b=r.columns;Q(s,["useAbsoluteLayout"],"useResizeColumns");var m=G(x);$(function(){m()&&u({type:g.resetResize})},[b]);var E=n.useCallback(function(){return u({type:g.resetResize})},[u]);Object.assign(r,{resetResizing:E})}function he(r){var s=[],u=function a(x){x.columns&&x.columns.length&&x.columns.map(a),s.push(x)};return u(r),s}var pe={position:"absolute",top:0},se=function(s){s.getTableBodyProps.push(de),s.getRowProps.push(de),s.getHeaderGroupProps.push(de),s.getFooterGroupProps.push(de),s.getHeaderProps.push(function(u,a){var x=a.column;return[u,{style:l({},pe,{left:x.totalLeft+"px",width:x.totalWidth+"px"})}]}),s.getCellProps.push(function(u,a){var x=a.cell;return[u,{style:l({},pe,{left:x.column.totalLeft+"px",width:x.column.totalWidth+"px"})}]}),s.getFooterProps.push(function(u,a){var x=a.column;return[u,{style:l({},pe,{left:x.totalLeft+"px",width:x.totalWidth+"px"})}]})};se.pluginName="useAbsoluteLayout";var de=function(s,u){var a=u.instance;return[s,{style:{position:"relative",width:a.totalColumnsWidth+"px"}}]},Re={display:"inline-block",boxSizing:"border-box"},Se=function(s,u){var a=u.instance;return[s,{style:{display:"flex",width:a.totalColumnsWidth+"px"}}]},Oe=function(s){s.getRowProps.push(Se),s.getHeaderGroupProps.push(Se),s.getFooterGroupProps.push(Se),s.getHeaderProps.push(function(u,a){var x=a.column;return[u,{style:l({},Re,{width:x.totalWidth+"px"})}]}),s.getCellProps.push(function(u,a){var x=a.cell;return[u,{style:l({},Re,{width:x.column.totalWidth+"px"})}]}),s.getFooterProps.push(function(u,a){var x=a.column;return[u,{style:l({},Re,{width:x.totalWidth+"px"})}]})};Oe.pluginName="useBlockLayout";function lt(r){r.getTableProps.push(We),r.getRowProps.push(ve),r.getHeaderGroupProps.push(ve),r.getFooterGroupProps.push(ve),r.getHeaderProps.push(tt),r.getCellProps.push(Me),r.getFooterProps.push(Je)}lt.pluginName="useFlexLayout";var We=function(s,u){var a=u.instance;return[s,{style:{minWidth:a.totalColumnsMinWidth+"px"}}]},ve=function(s,u){var a=u.instance;return[s,{style:{display:"flex",flex:"1 0 auto",minWidth:a.totalColumnsMinWidth+"px"}}]},tt=function(s,u){var a=u.column;return[s,{style:{boxSizing:"border-box",flex:a.totalFlexWidth?a.totalFlexWidth+" 0 auto":void 0,minWidth:a.totalMinWidth+"px",width:a.totalWidth+"px"}}]},Me=function(s,u){var a=u.cell;return[s,{style:{boxSizing:"border-box",flex:a.column.totalFlexWidth+" 0 auto",minWidth:a.column.totalMinWidth+"px",width:a.column.totalWidth+"px"}}]},Je=function(s,u){var a=u.column;return[s,{style:{boxSizing:"border-box",flex:a.totalFlexWidth?a.totalFlexWidth+" 0 auto":void 0,minWidth:a.totalMinWidth+"px",width:a.totalWidth+"px"}}]};g.columnStartResizing="columnStartResizing",g.columnResizing="columnResizing",g.columnDoneResizing="columnDoneResizing",g.resetResize="resetResize";function gt(r){r.stateReducers.push(et),r.getTableProps.push(Ue),r.getHeaderProps.push($e),r.getRowProps.push(wt)}gt.pluginName="useGridLayout";var Ue=function(s,u){var a=u.instance,x=a.visibleColumns.map(function(b){var m;return a.state.gridLayout.columnWidths[b.id]?a.state.gridLayout.columnWidths[b.id]+"px":(m=a.state.columnResizing)!=null&&m.isResizingColumn?a.state.gridLayout.startWidths[b.id]+"px":typeof b.width=="number"?b.width+"px":b.width});return[s,{style:{display:"grid",gridTemplateColumns:x.join(" ")}}]},$e=function(s,u){var a=u.column;return[s,{id:"header-cell-"+a.id,style:{position:"sticky",gridColumn:"span "+a.totalVisibleHeaderCount}}]},wt=function(s,u){var a=u.row;return a.isExpanded?[s,{style:{gridColumn:"1 / "+(a.cells.length+1)}}]:[s,{}]};function et(r,s,u,a){if(s.type===g.init)return l({gridLayout:{columnWidths:{}}},r);if(s.type===g.resetResize)return l({},r,{gridLayout:{columnWidths:{}}});if(s.type===g.columnStartResizing){var x=s.columnId,b=s.headerIdWidths,m=yt(x);if(m!==void 0){var E=a.visibleColumns.reduce(function(Ne,we){var Ae;return l({},Ne,(Ae={},Ae[we.id]=yt(we.id),Ae))},{}),F=a.visibleColumns.reduce(function(Ne,we){var Ae;return l({},Ne,(Ae={},Ae[we.id]=we.minWidth,Ae))},{}),U=a.visibleColumns.reduce(function(Ne,we){var Ae;return l({},Ne,(Ae={},Ae[we.id]=we.maxWidth,Ae))},{}),te=b.map(function(Ne){var we=Ne[0];return[we,yt(we)]});return l({},r,{gridLayout:l({},r.gridLayout,{startWidths:E,minWidths:F,maxWidths:U,headerIdGridWidths:te,columnWidth:m})})}else return r}if(s.type===g.columnResizing){var be=s.clientX,ue=r.columnResizing.startX,me=r.gridLayout,je=me.columnWidth,ne=me.minWidths,Ge=me.maxWidths,Ye=me.headerIdGridWidths,Ze=Ye===void 0?[]:Ye,Ee=be-ue,rt=Ee/je,ut={};return Ze.forEach(function(Ne){var we=Ne[0],Ae=Ne[1];ut[we]=Math.min(Math.max(ne[we],Ae+Ae*rt),Ge[we])}),l({},r,{gridLayout:l({},r.gridLayout,{columnWidths:l({},r.gridLayout.columnWidths,{},ut)})})}if(s.type===g.columnDoneResizing)return l({},r,{gridLayout:l({},r.gridLayout,{startWidths:{},minWidths:{},maxWidths:{}})})}function yt(r){var s,u=(s=document.getElementById("header-cell-"+r))==null?void 0:s.offsetWidth;if(u!==void 0)return u}c._UNSTABLE_usePivotColumns=gs,c.actions=g,c.defaultColumn=z,c.defaultGroupByFn=os,c.defaultOrderByFn=Gr,c.defaultRenderer=L,c.emptyRenderer=W,c.ensurePluginOrder=Q,c.flexRender=re,c.functionalUpdate=M,c.loopHooks=j,c.makePropGetter=P,c.makeRenderer=O,c.reduceHooks=A,c.safeUseLayoutEffect=k,c.useAbsoluteLayout=se,c.useAsyncDebounce=X,c.useBlockLayout=Oe,c.useColumnOrder=f,c.useExpanded=Et,c.useFilters=es,c.useFlexLayout=lt,c.useGetLatest=G,c.useGlobalFilter=ts,c.useGridLayout=gt,c.useGroupBy=Tr,c.useMountedLayoutEffect=$,c.usePagination=ms,c.useResizeColumns=C,c.useRowSelect=Lr,c.useRowState=Es,c.useSortBy=fs,c.useTable=dt,Object.defineProperty(c,"__esModule",{value:!0})})}(Ur,Ur.exports)),Ur.exports}var Ll;function Qn(){return Ll||(Ll=1,process.env.NODE_ENV==="production"?As.exports=$n():As.exports=Jn()),As.exports}var $r=Qn();const ea=({inputvalue:i="",options:d=[],isDisabled:c=!1,currRowData:n={},onlyDropdownItemsAllowed:y,handleValueChange:R,rowId:l="",setTableData:I,handleRightSegment:S})=>{const h=v.useRef(null),[V,g]=v.useState(n?.original?.service_name||""),[L,W]=v.useState(!1),[z,D]=v.useState([]),[N,P]=v.useState(!1),A=v.useCallback(G=>{h.current&&!h.current.contains(G.target)&&(N&&y&&g(""),W(!1))},[y,N]);v.useEffect(()=>{g(i)},[i]);const j=G=>{if(P(!0),W(!0),d?.length>0){const $=d.filter(X=>X.service_name.toLowerCase().includes(G.target.value.toLowerCase())).sort((X,O)=>{const re=G.target.value.toLowerCase(),ce=X.service_name.toLowerCase().startsWith(re),_e=O.service_name.toLowerCase().startsWith(re);return ce&&!_e?-1:!ce&&_e?1:X.service_name.localeCompare(O.service_name)});D($)}g(G.target.value)},Q=G=>{P(!1),g(G.service_name),I(k=>k.map(($,X)=>l===X.toString()?{...$,service_name:G.service_name,item_quantity:"1",order_unit_item_price:G?.price,order_item_service_tax_percentage:G?.service_tax,order_item_discount:"0",service_category:G?.service_category,service_id:G?.service_identifier}:$)),W(!1)},M=G=>{switch(G){case Ct[0]:return"hx_service-appointment-filled hfl-text-Primary-500";case Ct[1]:return"hx_service-other-filled hfl-text-Pink-500";case Ct[2]:return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}};return v.useEffect(()=>{n?.original?.service_name&&g(n.original.service_name)},[n?.original?.service_name]),v.useEffect(()=>(document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)),[A]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-w-[100px]",children:[e.jsxRuntimeExports.jsx(e.Nu,{text:c?"Low internet speed. Feature available only in online mode":"",children:e.jsxRuntimeExports.jsx("div",{className:`hfl-flex hfl-w-[330px] hfl-items-center hfl-justify-between hfl-pr-4 ${c?"hfl-pointer-events-none":"hfl-cursor-pointer"}`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[360px] hfl-items-center",children:[e.jsxRuntimeExports.jsx("div",{className:`${n?.original?.service_category?M(n.original.service_category):""} -hfl-ml-1 hfl-text-2`}),e.jsxRuntimeExports.jsx("input",{type:"text",className:`hfl-flex-1 focus-visible:hfl-outline-0 ${n?.original?.order_item_id?"hfl-bg-Gray-50 hfl-caret-Gray-50":""}`,value:V,onChange:G=>{n?.original?.order_item_id||(j(G),R(G,"service_name",l))},onFocus:()=>{n?.original?.order_item_id||(W(!0),D(d))},placeholder:c?"":"Add Service",onBlur:()=>W(!1),"data-qa":"add-service"}),e.jsxRuntimeExports.jsx("i",{className:`hfl-duration-300 hfl-ease-linear ${!c&&(L?"hx_down hfl-rotate-180 hfl-text-3":"hx_down hfl-text-3")} ${n?.original?.order_item_id?"hfl-hidden":""}`,onClick:()=>{n?.original?.order_item_id||(W(!0),D(d))}})]})})}),L&&!c&&e.jsxRuntimeExports.jsx("div",{ref:h,className:"hfl-absolute hfl-right-0 hfl-z-10 hfl-max-h-[270px] hfl-w-[330px] hfl-overflow-scroll hfl-overflow-x-hidden hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-bg-White hfl-shadow-md",children:z.map((G,k)=>e.jsxRuntimeExports.jsx(e.ks,{label:G.service_name,value:G.service_name,onSelect:()=>{Q(G);const $=G.service_category.toLowerCase();$===Ct[0].toLowerCase()?S(ht[2]):$===Ct[1].toLowerCase()?S(ht[4]):$===Ct[2].toLowerCase()?S(ht[3]):S(ht[0])},className:"hfl-p-2"},k))})]})},kl=i=>{if(!v.useContext(Tt))throw new Error("AddBillsTable must be used within an PatientPopupContext.Provider");const{patientIDs:c,serviceListArr:n,showToast:y,billPreferences:R,formattedService:l,docPreference:I,getAndSetServiceListArr:S,variable:h}=v.useContext(Tt),{isDisabled:V=!1,addBillButton:g,tableBodyData:L,handleEditRow:W,handleRightSegment:z,tableData:D,setTableData:N,setEditRowId:P,getBillSummarydata:A,refreshBillsList:j}=i,Q=v.useMemo(()=>D.length>=0&&!V?D.map(H=>({...H,order_item_service_tax:Math.floor(H?.order_item_service_tax),deleted:!1})):[],[D]),M=()=>{N(H=>[...H,{index:"",order_id:"",order_date:"",order_created_on:Te.dayjs().format("YYYY-MM-DD"),service_category:"",service_category_id:"",order_id_str:"",order_total:"",order_paid_amount:"",order_item_sum_discount:"0",order_discount:"0",refund_amount:"0",order_service_tax:"0",balance_amount:"0",net_bill_amount:"0",order_item_id:"",service_id:"",service_name:"",item_quantity:"1",order_unit_item_price:"0",order_item_price:"0",order_item_discount:"0",order_item_service_tax:"0",order_item_service_tax_percent:"0",created_on:"",net_amount:"0"}])};v.useEffect(()=>{L?.length>0&&!V&&N(L)},[L]);const G=(H,Ce,Fe)=>{const{value:ke}=H.target;N(xt=>xt.map((He,st)=>Fe==st?{...He,[Ce]:ke}:He))},k=H=>{P(H.id),W(H)},$=(H,Ce,Fe,ke,xt)=>{let He,st;if(H>0&&Ce>0&&ke>=0){const _t=H*Ce;return He=_t+_t*.01*ke,st=He-Fe,Math.floor(st)}else return st=0},X=async(H,Ce)=>{if(parseInt(H?.original?.balance_amount)>=parseInt(H?.original?.net_amount))try{const Fe=await Wl(H.original.order_id,H.original.order_item_id,c.patientRoleID,"","0",h);Fe&&(await A(),N(ke=>{const xt=[...ke];return xt.splice(Ce,1),xt?.length===0&&M(),xt}),await j()),y?.(Fe.status?"Success":"Error",Fe.message,Fe.status?"Success":"Error",3e3)}catch(Fe){console.log("Error while deleting row",Fe)}},O=v.useMemo(()=>[{Header:"#",accessor:"index",Cell:({row:H})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[20px] hfl-items-center hfl-justify-center focus:hfl-outline-none",children:H?.index+1})},{Header:"Service Name",accessor:"service_name",Cell:({row:H})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[310px] hfl-items-start",onClick:async()=>{n?.service_list?.length||await S(),k(H)},children:e.jsxRuntimeExports.jsx(ea,{inputvalue:H?.original?.service_name,onlyDropdownItemsAllowed:!0,currRowData:H,rowId:H.id,options:n?.service_list,isDisabled:V,handleValueChange:G,setTableData:N,handleRightSegment:z})})},{Header:"Qty",accessor:"item_quantity",Cell:({row:H})=>e.jsxRuntimeExports.jsx("input",{type:"number",min:1,className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:H?.original?.item_quantity,onFocus:()=>{k(H)},onChange:Ce=>G(Ce,"item_quantity",H.id)})},{Header:"Unit Price",accessor:"order_unit_item_price",Cell:({row:H})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),I?.permissions?.edit_service_unit_price?e.jsxRuntimeExports.jsx("input",{type:"number",min:0,onFocus:()=>{k(H)},className:" hfl-flex hfl-w-[64px] hfl-items-center focus:hfl-outline-none",value:H?.original?.order_unit_item_price,onChange:Ce=>G(Ce,"order_unit_item_price",H.id)}):e.jsxRuntimeExports.jsx("input",{onFocus:()=>{k(H)},className:" hfl-flex hfl-w-[64px] hfl-items-center focus:hfl-outline-none",value:H?.original?.order_unit_item_price,readOnly:!0})]})},{Header:"GST %",accessor:"order_item_service_tax_percentage",Cell:({row:H})=>e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:l?.[+H?.original?.service_id]?.service_tax||0,readOnly:!0})},{Header:"Discount",accessor:"order_item_discount",Cell:({row:H})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:R?.billing?.enable_order_discount==1?e.jsxRuntimeExports.jsx("input",{type:"number",min:0,onFocus:()=>{k(H)},className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:H?.original?.order_item_discount,onChange:Ce=>G(Ce,"order_item_discount",H.id)}):e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:H?.original?.order_item_discount,readOnly:!0,type:"text"})})},{Header:"Total Price",accessor:"order_item_price",Cell:({row:H})=>e.jsxRuntimeExports.jsxs("div",{className:`${H.original.order_paid_amount===void 0||H.original.refund_amount===void 0||H.original.balance_amount===void 0||parseInt(H.original.order_paid_amount)-parseInt(H.original.refund_amount)===0?"hfl-text-Error-500":parseInt(H.original.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-flex hfl-items-center hfl-justify-center `,children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[64px] hfl-items-center focus:hfl-outline-none",value:$(Number(H?.original?.order_unit_item_price),Number(H?.original?.item_quantity),Number(H?.original?.order_item_discount),Number(l?.[+H?.original?.service_id]?.service_tax||0)),readOnly:!0})]})},{Header:"",accessor:"deleted",Cell:({row:H})=>e.jsxRuntimeExports.jsx(e.Nu,{variant:"Left",text:parseInt(H?.original?.balance_amount)>=parseInt(H?.original?.net_amount)?"Delete row":"Please Delete from Bill tab",theme:"light",children:e.jsxRuntimeExports.jsx("i",{className:` ${V?"hx_delete hfl-text-White":"hx_delete"} ${parseInt(H?.original?.balance_amount)>=parseInt(H?.original?.net_amount)?"":" hfl-cursor-not-allowed hfl-opacity-20"} `,onClick:Ce=>{Ce.stopPropagation(),z(),X(H,H.id)}})})}],[R,I,n?.service_list]),re=v.useMemo(()=>V?L:Q,[Q,L]),{getTableProps:ce,getTableBodyProps:_e,headerGroups:xe,rows:Ve,prepareRow:ie}=$r.useTable({columns:O,data:re}),Y=H=>{const Ce=[];return H?.headers?.length&&H.headers.map(Fe=>{Ce.push(e.jsxRuntimeExports.jsx("th",{...Fe.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:Fe.render("Header")})}))}),Ce},fe=()=>{const H=[];return Ve.map((Ce,Fe)=>{ie(Ce),H.push(e.jsxRuntimeExports.jsx("tr",{id:Fe+1+"",...Ce.getRowProps(),className:" hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200",onClick:()=>{k(Ce)},children:Ce.cells.map((ke,xt)=>e.jsxRuntimeExports.jsx("td",{"data-qa":Fe+1+"-"+ke.column.id,...ke.getCellProps(),className:`hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left ${xt==1&&Ce?.original?.order_item_id?"hfl-bg-Gray-50":""} `,onClick:He=>{xt===6?(He.stopPropagation(),z()):k(Ce)},children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"",children:ke.render("Cell")})}))}))}),H};return v.useEffect(()=>{g&&D[D.length-1]?.order_item_id&&M()},[D,L]),e.jsxRuntimeExports.jsx("div",{className:`${V?" hfl-pointer-events-none":"hfl-cursor-pointer"}`,children:e.jsxRuntimeExports.jsxs("table",{...ce(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:xe.map(H=>e.jsxRuntimeExports.jsx("tr",{...H.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50",children:Y(H)}))}),e.jsxRuntimeExports.jsx("tbody",{..._e(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:fe()})]})})},ta=()=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-9 hfl-items-center hfl-gap-2 hfl-border-t-Gray-200 hfl-bg-Gray-50 hfl-p-1.5",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_star hfl-text-Purple-500"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text xs",className:"hfl-text-1",children:"Patient has an Appointment on this day which doesn’t have a Bill"})]}),Bs=i=>{const[d,c]=v.useState(!1);return v.useEffect(()=>{const n=window.matchMedia(i);n.matches!==d&&c(n.matches);const y=()=>c(n.matches);return window.addEventListener("resize",y),()=>window.removeEventListener("resize",y)},[d,i]),d},ra=i=>{const{className:d,children:c,tab:n}=i,y=Bs("(max-width: 1080px)");return e.jsxRuntimeExports.jsxs("div",{className:`hfl-h-[73.55vh] xxs:max-md:hfl-w-[750px] hfl-bg-White ${y?"hfl-w-[640px]":n==="add_bills"?"hfl-w-[908px]":"hfl-w-[938px]"} hfl-items-center hfl-justify-end hfl-pb-[1px] hfl-pt-2 ${d}`,children:[c,e.jsxRuntimeExports.jsx("div",{className:"hfl-flex "})]})},El=i=>{const{children:d,className:c,tab:n}=i,y=Bs("(max-width: 1080px)");return e.jsxRuntimeExports.jsx("div",{className:` ${y?"":n==="add_bills"?"hfl-w-[358px]":"hfl-w-[330px]"} hfl-sticky hfl-right-0 hfl-h-[73.55vh] xxs:max-md:hfl-right-[50px] hfl-shrink-0 hfl-overflow-auto hfl-overflow-x-hidden hfl-border-l hfl-border-Gray-200 hfl-bg-Gray-50 ${c}`,children:d})},Pl=i=>{const{rightSegment:d,summaryData:c,pastDueData:n,showDeposit:y=!1,showPayment:R=!0,showDiscount:l=!0,showRefund:I=!0,showDepositRefund:S=!1,isPayDue:h,getBillSummarydata:V,getPastDueAmount:g,handleRightSegment:L,serviceItem:W,date:z,refreshBillsList:D,deleteLastPaymemntMode:N=!1,setDeleteLastPaymentMode:P=()=>{},walletBalance:A=0,setRefreshWallet:j}=i,Q=()=>{if(y)return"deposit";if(R)return"payment";if(l)return"discount";if(I)return"refund";if(S)return"deposit_refund"},{patientIDs:M,showToast:G,billPreferences:k,getLastBillsPaymentData:$,variable:X}=v.useContext(Tt)||{},[O,re]=v.useState(Q()),[ce,_e]=v.useState([]),[xe,Ve]=v.useState([{id:1,item_level:"0",bill_level:"0"}]),[ie,Y]=v.useState([{id:1,label:"CASH",value:"0",detail:""}]),[fe,H]=v.useState(!1),Ce={color:"#98A2B3",fontFamily:"Inter",fontSize:"14px",fontWeight:400,lineHeight:"18px"},[Fe,ke]=v.useState(""),[xt,He]=v.useState(""),st=v.useCallback((ae,J)=>{if(P(!1),ae==="payment"||ae==="deposit"){const K=[...ce];K.splice(J,1),_e(K)}else if(ae==="discount"){const K=[...xe];K.splice(J,1),Ve(K)}else if(ae==="refund"){const K=[...ie];K.splice(J,1),Y(K)}},[xe,ce,ie,P]);v.useEffect(()=>{N&&st("payment",1)},[N,st]),v.useEffect(()=>{if(k){const ae=ir[k.billing?.default_payment_mode||0]||"CASH";_e(J=>[{...J[0],label:ae},...J.slice(1)]),Y(J=>[{...J[0],label:ae},...J.slice(1)])}},[k]);const[_t,pt]=v.useState(!0),Pt=()=>{pt(ae=>!ae)},Rt=[{key:"deposit",label:"Add Deposit"},{key:"payment",label:"Pay Bill"},{key:"discount",label:"Discount"},{key:"refund",label:"Refund"},{key:"deposit_refund",label:"Refund"}].filter(ae=>ae.key==="payment"?R:ae.key==="discount"?l:ae.key==="refund"?I:ae.key==="deposit"?y:ae.key==="deposit_refund"?S:!0),Dt=ae=>{re(ae)},Gt=ae=>{const J=(ae==="payment"?ce.length:ae==="discount"?xe.length:ie.length)+1;ae==="payment"&&R&&ce.length<2?_e([...ce,{id:J,label:ir[k?.billing?.default_payment_mode||0]||"CASH",value:"0",detail:""}]):ae==="discount"&&l?Ve([...xe,{id:J,item_level:"0",bill_level:"0"}]):ae==="refund"&&I&&ie.length<2?Y([...ie,{id:J,label:"CASH",value:"0",detail:""}]):ae==="deposit"&&y&&ce.length<2?_e([...ce,{id:J,label:ir[k?.billing?.default_payment_mode||0]||"CASH",value:"0",detail:""}]):ae==="deposit_refund"&&S&&ie.length<2&&Y([...ie,{id:J,label:"CASH",value:"0",detail:""}])},T=v.useMemo(()=>{let ae=[];c?.bill_summary?ae=Object.entries(c?.bill_summary).map(([Be,Pe])=>({order_id:Pe?.order_id,amount:Number(Pe?.balance_amount),order_date:Te.dayjs(z).format("YYYY-MM-DD"),service_category_id:Number(Be)})).filter(Be=>Be.amount!==0):c?.balance_amount&&ae.push({amount:parseInt(c?.balance_amount)});const J=h?(n?.bill_amount_details??[]).map(Be=>({...Be,amount:Number(Be.balance_amount)||0})):[];return[...ae,...J].reduce((Be,Pe)=>Be+Pe.amount,0)},[c,h,n?.bill_amount_details,z]),De=v.useCallback(()=>A<=T?A:T,[T,A]);v.useEffect(()=>{const ae=De();O!=="deposit"&&O!=="deposit_refund"&&_e(J=>{if(!J[0])return J;const K=(c&&c.bill_summary&&c.bill_summary[1]&&parseInt(c.bill_summary[1].balance_amount)||0||0)+(c&&c.bill_summary&&c.bill_summary[2]&&parseInt(c.bill_summary[2].balance_amount)||0||0)+(c&&c.bill_summary&&c.bill_summary[3]&&parseInt(c.bill_summary[3].balance_amount)||0||0)+(h&&parseInt(n?.total_amount||"0")||0)||parseInt(c?.balance_amount||"0")||0,oe=J[0].label==="DEPOSIT"?Math.min(K,ae):K;return[{...J[0],value:`${oe}`},...J.slice(1)]}),W&&Ve(J=>[{...J[0],item_level:c?.order_item_sum_discount||"0",bill_level:c?.order_discount||"0"},...J.slice(1)])},[c,ce.length,h,De,O,W,n?.total_amount]);const qe=(ae=!0,J,K,oe="")=>{const Be=ce.findIndex((ct,Ot)=>Ot!==K),Pe=typeof J=="string"&&J?.trim()===""?0:parseInt(J)||0,mt=De(),Zt=ce.some((ct,Ot)=>ct.label==="DEPOSIT"&&Ot!==K);if(Pe>=0){const ct=T-Pe;return ce.map((kt,er)=>{if(er===K){const Qt=oe||kt.label;return Qt==="DEPOSIT"?Zt?kt:(Pe>mt?ke("The amount entered is greater than deposit amount "):ke(""),{...kt,label:Qt,value:Pe.toString()}):{...kt,label:Qt,value:Pe.toString()}}else return er===Be?kt.label==="DEPOSIT"&&ct>mt?{...kt,value:mt.toString()}:{...kt,value:ae?ct.toString():kt.value}:kt})}return ce};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-rounded-md hfl-border-Gray-300 hfl-bg-White_20 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-start hfl-rounded-t-md hfl-bg-Gray-100 hfl-shadow-md",style:{boxShadow:"inset 0 2px 4px 0 rgb(0 0 0 / 0.05)"},children:Rt.map((ae,J)=>e.jsxRuntimeExports.jsx("div",{className:`hfl-flex hfl-h-8 hfl-flex-1 hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-gap-0.5 hfl-px-[13px] hfl-py-2 ${O===ae.key?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>Dt(ae.key),children:ae.label},J))}),(O==="payment"||O==="deposit")&&(R||y)&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[ce.map((ae,J)=>e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-items-flex hfl-inline-flex hfl-items-center hfl-justify-center hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ap,{className:"hfl-w-[155px] hfl-text-Gray-800",value:{label:(O!=="deposit"?zr:Ns).find(K=>K===ae.label)||""},onChange:K=>{const oe=qe(d===ht[0],K.label=="DEPOSIT"?De().toString():ce[J].value,J,K.label);_e(oe)},options:O!=="deposit"?zr.map(K=>({label:K,value:K})):Ns.map(K=>({label:K,value:K}))}),e.jsxRuntimeExports.jsx(e.Ps,{className:`hfl-w-[85px] ${Fe&&ce[J].label==="DEPOSIT"?"hfl-border-Error-600":""}`,inputProps:{type:"number",min:0,value:ae.value,onChange:K=>{if(d===ht[0]){const oe=qe(!0,K.target.value,J);_e(oe)}else{const oe=ce[J].label==="DEPOSIT",Be=[...ce.slice(0,J),{...ce[J],value:Math.abs(+K.target.value).toString()},...ce.slice(J+1)];oe&&parseInt(K.target.value)>A?ke("The amount entered is greater than deposit amount"):ke(""),_e(Be)}}}}),e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-items-center hfl-justify-center ","data-qa":"payment-delete",hierarchy:"Secondary-Grey",size:"sm",icon:"Only",iconFile:`hx_delete hfl-text-4 hfl-text-Gray-400 ${ce.length===1?"hfl-cursor-not-allowed":""}`,onClick:()=>st("payment",J),disabled:ce.length===1,textField:""})]},J),Fe&&ce[J].label==="DEPOSIT"&&e.jsxRuntimeExports.jsx(e.bs,{className:"hfl-mt-1 hfl-text-Error-600",variant:"Regular",type:"Text xs",children:Fe}),e.jsxRuntimeExports.jsx(e.Ps,{className:" hfl-mt-2",placeholderStyle:Ce,inputProps:{type:"text",value:ae.detail,placeholder:"Add Details",onChange:K=>{const oe=[...ce.slice(0,J),{...ce[J],detail:K.target.value},...ce.slice(J+1)];_e(oe)}}})]})),ce?.length&&ce?.length<2&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-cursor-pointer hfl-items-center hfl-text-Primary-600",onClick:()=>Gt(O),"data-qa":"payment-mode",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_add-circle hfl-text-3"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",children:"Payment Mode"})]}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"pay-bill",hierarchy:"Primary",size:"lg",textField:`Pay ₹ ${ce.reduce((ae,J)=>ae+parseFloat(J.value||"0"),0)}`,disabled:fe,className:"hfl-flex hfl-h-9 hfl-w-full hfl-justify-center hfl-bg-Primary-600 hfl-shadow-md hover:hfl-bg-Primary-800",onClick:async()=>{if(d===ht[0]){const ae=Object.entries(c?.bill_summary).map(([Pe,mt])=>({order_id:mt?.order_id,amount:Number(mt?.balance_amount),order_date:Te.dayjs(z).format("YYYY-MM-DD"),service_category_id:+Pe})).filter(Pe=>Pe.amount!==0),J=h?n?.bill_amount_details.map(Pe=>({order_id:Pe.order_id,amount:Number(Pe.balance_amount),order_date:Pe.order_date,service_category_id:Pe.service_category_id})):[],K=[...ae,...J],oe=K.reduce((Pe,mt)=>Pe+parseFloat(mt.amount||"0"),0),Be=ce.reduce((Pe,mt)=>Pe+parseFloat(mt.value||"0"),0);if(Be===oe)if(Be===0)G("Error","Please enter some amount","Error",3e3);else{H(!0);const Pe=await wn(Be,K,ce.map(mt=>({amount:parseInt(mt.value),mode:ir[mt.label],details:mt.detail})),M?.patientRoleID||"",X);Pe?(st("payment",1),G("Success",Pe?.message,"Success",3e3),j?.(mt=>!mt),V?.(),D?.(z),g?.(),await $(M?.patientRoleID||""),L(),H(!1)):(H(!1),G("Error","Something went wrong please try again","Error",3e3))}else G("Error",Be>oe?"Payment cannot be more than the balance amount":"Please do a full payment","Error",3e3)}else{let ae;const J=ce?.reduce((K,oe)=>{const Be=parseInt(oe.value)||0;return K+Be},0);try{J&&J<=0?G("Error","Please enter valid amount","Error",3e3):O=="deposit"?(ae=await Bl(M?.patientRoleID||"",{payment_type:"CREDIT",transaction_type:"DEPOSIT",split_payment:ce.map(K=>({amount:parseInt(K.value),mode:Yr[K.label],details:K.detail}))},X),ae.status&&j?.(K=>!K)):(H(!0),ae=await pl("DEPOSIT",J.toString(),c?.order_id,ce.map(K=>({amount:parseInt(K.value),mode:Yr[K.label],details:K.detail})),M?.patientRoleID||"",{},X),ae&&j?.(K=>!K))}catch(K){H(!1),G("Error",K.data.message,"Error",3e3)}ae&&(st("payment",1),G("Success",ae?.message,"Success",3e3),V?.(),D?.(z),g?.(),await $(M?.patientRoleID||""),L(),H(!1))}}})]}),O==="discount"&&l&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[xe.map((ae,J)=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-contents hfl-gap-1.5",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-whitespace-nowrap",children:"Item level discount:"}),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-w-[111px]",inputProps:{type:"number",min:0,value:ae.item_level,disabled:!0}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-whitespace-nowrap",children:"Bill Level Discount:"}),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-w-[111px]",inputProps:{type:"number",min:0,value:ae.bill_level,onChange:K=>{const oe=[...xe.slice(0,J),{...xe[J],bill_level:K.target.value},...xe.slice(J+1)];Ve(oe)}}})]})]},J)),e.jsxRuntimeExports.jsx(e.Ku,{disabled:fe,hierarchy:"Primary",size:"lg",textField:"Add Discount to Bill",className:"hfl-flex hfl-h-9 hfl-w-full hfl-justify-center hfl-border hfl-border-Warning-300 hfl-bg-Warning-50 hfl-text-Warning-600 hover:hfl-bg-Warning-200",onClick:async()=>{H(!0);let ae,J=0;try{J=parseInt(xe[0].bill_level)+parseInt(xe[0].item_level),J>0?ae=await pl("DISCOUNT",xe[0].bill_level+parseInt(xe[0].item_level),c?.order_id,[],M?.patientRoleID||"",{},X):(H(!1),G("Error","Invalid input","Error",3e3))}catch(K){H(!1),console.error("Error in updateBill",K)}ae&&(G("Success",ae?.message,"Success",3e3),V?.(),D?.(z),g?.(),L(),H(!1))}})]}),O==="refund"&&I&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[e.jsxRuntimeExports.jsx(e.Os,{size:"md",disabled:!1,isMarked:_t,text:"Refund amount as Discount",onClick:Pt}),ie.map((ae,J)=>e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-items-flex hfl-inline-flex hfl-items-center hfl-justify-center hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ap,{className:"hfl-w-[155px] hfl-text-Gray-800",value:{label:zr.find(K=>K==ae.label)},onChange:K=>{const oe=[...ie.slice(0,J),{...ie[J],label:K.label},...ie.slice(J+1)];Y(oe)},options:zr.map(K=>({label:K,value:K}))}),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-w-[85px]",inputProps:{type:"number",min:0,value:ae.value,onChange:K=>{const oe=[...ie.slice(0,J),{...ie[J],value:K.target.value},...ie.slice(J+1)];Y(oe)}}}),e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-items-center hfl-justify-center ","data-qa":"refund-delete",hierarchy:"Secondary-Grey",size:"sm",icon:"Only",iconFile:`hx_delete hfl-text-4 hfl-text-Gray-400 ${ie.length===1?"hfl-cursor-not-allowed":""}`,onClick:()=>st("refund",J),disabled:ie.length===1,textField:""})]},J),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-mt-2",placeholderStyle:Ce,inputProps:{type:"text",value:ae.detail,placeholder:"Add Details",onChange:K=>{const oe=[...ie.slice(0,J),{...ie[J],detail:K.target.value},...ie.slice(J+1)];Y(oe)}}})]})),ie.length<2&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-cursor-pointer hfl-items-center hfl-text-Primary-600 ",onClick:()=>Gt("refund"),children:[e.jsxRuntimeExports.jsx("div",{className:"hx_add-circle hfl-text-3"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",children:"Refund Mode"})]}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",disabled:fe,textField:"Update Refund",className:"hfl-flex hfl-h-9 hfl-w-full hfl-justify-center hfl-border hfl-border-Warning-300 hfl-bg-Warning-50 hfl-text-Warning-600 hover:hfl-bg-Warning-200",onClick:async()=>{let ae,J=0;try{J=ie.reduce((K,oe)=>{const Be=parseInt(oe.value)||0;return K+Be},0),J<=0?G("Error","Please enter valid amount","Error",3e3):(H(!0),ae=await pl("REFUND",J.toString(),c?.order_id,ie.map(K=>({amount:parseInt(K.value),mode:Yr[K.label],details:K.detail})),M?.patientRoleID||"",{give_discount:_t,existing_discount:parseInt(c.order_discount)+parseInt(c.order_item_sum_discount)},X),ae&&(j?.(K=>!K),H(!1),await $?.(M?.patientRoleID||"")))}catch(K){console.error("Error in update refund",K),H(!1)}ae&&(G("Success",ae?.message,"Success",3e3),V?.(),D?.(z),g?.(),L(),H(!1))}})]}),O==="deposit_refund"&&S&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[ie.map((ae,J)=>e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-items-flex hfl-inline-flex hfl-items-center hfl-justify-center hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ap,{className:"hfl-w-[155px] hfl-text-Gray-800",value:{label:Ns.find(K=>K==ae.label)},onChange:K=>{const oe=[...ie.slice(0,J),{...ie[J],label:K.label},...ie.slice(J+1)];Y(oe)},options:Ns.map(K=>({label:K,value:K}))}),e.jsxRuntimeExports.jsx(e.Ps,{className:`hfl-w-[85px] ${xt?"hfl-border-Error-600":""}`,inputProps:{type:"number",min:0,value:ae.value,onChange:K=>{const oe=[...ie.slice(0,J),{...ie[J],value:Math.abs(+K.target.value).toString()},...ie.slice(J+1)];parseInt(K.target.value)>A?He("The amount entered is greater than deposit amount"):He(""),Y(oe)}}}),e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-items-center hfl-justify-center ","data-qa":"refund-delete",hierarchy:"Secondary-Grey",size:"sm",icon:"Only",iconFile:`hx_delete hfl-text-4 hfl-text-Gray-400 ${ie.length===1?"hfl-cursor-not-allowed":""}`,onClick:()=>st("refund",J),disabled:ie.length===1,textField:""})]},J),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-mt-2",placeholderStyle:Ce,inputProps:{type:"text",value:ae.detail,placeholder:"Add Details",onChange:K=>{const oe=[...ie.slice(0,J),{...ie[J],detail:K.target.value},...ie.slice(J+1)];Y(oe)}}}),xt&&e.jsxRuntimeExports.jsx(e.bs,{className:"hfl-mt-1 hfl-text-Error-600",variant:"Regular",type:"Text xs",children:xt})]})),ie.length<2&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-cursor-pointer hfl-items-center hfl-text-Primary-600 ",onClick:()=>Gt("deposit_refund"),children:[e.jsxRuntimeExports.jsx("div",{className:"hx_add-circle hfl-text-3"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text xs",children:"Refund Mode"})]}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update Refund",className:`hfl-flex hfl-h-9 hfl-w-full hfl-justify-center hfl-border hfl-border-Warning-300 hfl-bg-Warning-50 hfl-text-Warning-600 hover:hfl-bg-Warning-200 ${xt?"hfl-cursor-not-allowed hfl-opacity-50":""}`,disabled:!!xt.length,onClick:async()=>{let ae=0;try{ae=ie.reduce((J,K)=>{const oe=parseInt(K.value)||0;return J+oe},0),ae<=0?G("Error","Please enter valid amount","Error",3e3):(await Bl(M?.patientRoleID||"",{payment_type:"DEBIT",transaction_type:"REFUND",split_payment:ie.map(K=>({amount:parseInt(K.value),mode:Yr[K.label],details:K.detail}))},X))?.status&&j?.(K=>!K)}catch(J){console.error(J)}}})]})]})},sa=i=>{const{date:d,rightSegment:c,handleRightSegment:n,billSummaryClicked:y,showDiscount:R=!1,showRefund:l=!1,handleServiceItem:I,pastDueData:S,summaryData:h,getBillSummarydata:V,getPastDueAmount:g,refreshBillsList:L,walletBalance:W=0,setRefreshWallet:z}=i,[D,N]=v.useState(!1),[P,A]=v.useState(!1),j=()=>{A(!0),N(!0)},Q=()=>{A(!0),N(!1)};return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text md",children:"Bills Summary:"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-gap-0.5 hfl-px-3 hfl-py-2",children:[S?.total_amount!=="0"&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-full hfl-items-center hfl-gap-[5px] hfl-rounded hfl-border-1 hfl-border-Warning-300 hfl-bg-Warning-50 hfl-px-3",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:"Past Due Amount:"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Warning-600",children:["₹ ",S?.total_amount]})}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:`hfl-text-Primary-600 hfl-underline ${D?"hfl-cursor-not-allowed hfl-opacity-30":"hfl-cursor-pointer"}`,onClick:()=>!D&&j(),"data-qa":"add-to-bill",children:"Add to Bill"})]}),h?.bill_summary?.["1"]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-gap-1 hfl-self-stretch",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-gap-1",onClick:()=>{I(Ct[0]),n(ht[1])},children:[e.jsxRuntimeExports.jsx("i",{className:"hx_service-appointment-filled "}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Consultations Bill"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:`${h.bill_summary[1]?.order_paid_amount===void 0||h.bill_summary[1]?.refund_amount===void 0||h.bill_summary[1]?.balance_amount===void 0||parseInt(h.bill_summary[1]?.order_paid_amount)-parseInt(h.bill_summary[1]?.refund_amount)===0?"hfl-text-Error-500":parseInt(h.bill_summary[1]?.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-cursor-pointer`,children:["₹ ",h.bill_summary[1]?.net_bill_amount]})]}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"sm",textField:"",disabled:!1,onClick:()=>y([1],"billPrintPreview",!1),icon:"Only",iconFile:"hx_print hfl-text-4",className:" hfl-justify-center hfl-text-Primary-600 hfl-shadow-md"})]}),h?.bill_summary?.["2"]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-gap-1 hfl-self-stretch",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-gap-1",onClick:()=>{I(Ct[1]),n(ht[1])},children:[e.jsxRuntimeExports.jsx("i",{className:" hx_service-other-filled hfl-text-Pink-500"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800 ",children:"Other Services Bill"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:`${h.bill_summary[2]?.order_paid_amount===void 0||h.bill_summary[2]?.refund_amount===void 0||h.bill_summary[2]?.balance_amount===void 0||parseInt(h.bill_summary[2]?.order_paid_amount)-parseInt(h.bill_summary[2]?.refund_amount)===0?"hfl-text-Error-500":parseInt(h.bill_summary[2]?.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-cursor-pointer`,children:["₹ ",h.bill_summary[2].net_bill_amount]})]}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"sm",textField:"",disabled:!1,icon:"Only",onClick:()=>y([2],"billPrintPreview",!1),iconFile:"hx_print hfl-text-4",className:" hfl-justify-center hfl-text-Primary-600 hfl-shadow-md"})]}),h?.bill_summary?.["3"]&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-cursor-pointer hfl-items-center hfl-gap-1 hfl-self-stretch",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-gap-1",onClick:()=>{I(Ct[2]),n(ht[1])},children:[e.jsxRuntimeExports.jsx("i",{className:" hx_service-lab-filled hfl-text-Purple-600"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Lab Services Bill"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:`${h.bill_summary[3]?.order_paid_amount===void 0||h.bill_summary[3]?.refund_amount===void 0||h.bill_summary[3]?.balance_amount===void 0||parseInt(h.bill_summary[3]?.order_paid_amount)-parseInt(h.bill_summary[3]?.refund_amount)===0?"hfl-text-Error-500":parseInt(h.bill_summary[3]?.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-cursor-pointer`,children:["₹ ",h.bill_summary[3].net_bill_amount]})]}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"sm",textField:"",disabled:!1,icon:"Only",onClick:()=>y([3],"billPrintPreview",!1),iconFile:"hx_print hfl-text-4",className:" hfl-justify-center hfl-text-Primary-600 hfl-shadow-md"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Billed Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(h.bill_summary[1]?.order_total||"0")+parseInt(h.bill_summary[2]?.order_total||"0")+parseInt(h.bill_summary[3]?.order_total||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-inline-flex hfl-flex-1 hfl-items-center hfl-text-Gray-800 ",children:["Discount Amount",e.jsxRuntimeExports.jsxs("div",{className:"hfl-group hfl-relative hfl-inline-block",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_info hfl-text-4 hfl-text-Gray-400"}),e.jsxRuntimeExports.jsxs("div",{className:`
|
|
13
|
-
hfl-invisible hfl-absolute hfl-left-1/2 hfl-top-full
|
|
14
|
-
hfl-z-10 hfl-block hfl-w-max hfl-max-w-xs
|
|
15
|
-
hfl-translate-x-[-50%] hfl-text-left hfl-opacity-0 hfl-transition hfl-delay-1000
|
|
16
|
-
group-hover:hfl-visible group-hover:hfl-opacity-100
|
|
17
|
-
`,children:[h&&e.jsxRuntimeExports.jsxs("div",{className:"text:hfl-Gray-700 hfl-mb-3 hfl-w-[207px] hfl-rounded-lg hfl-bg-White hfl-p-3 hfl-shadow-lg",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Line Item Discount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Medium",type:"Text sm",children:["₹"," ",["1","2","3"].reduce((M,G)=>M+parseInt(h.bill_summary[G]?.order_item_sum_discount||"0"),0)]})]}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Additional Discount"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",children:["1","2","3"].map(M=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[M==="1"&&"Consultations",M==="2"&&"Lab Services",M==="3"&&"Other Services"]}),"₹ ",h.bill_summary[M]?.order_discount||"0"]},M))})]}),e.jsxRuntimeExports.jsx("div",{className:"text:hfl-Gray-700 hfl-absolute hfl-bottom-2 hfl-left-1/2 hfl-h-3 hfl-w-3 hfl-translate-x-[-50%] hfl-rotate-45 hfl-bg-White"})]})]})]}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",parseInt(h.bill_summary[1]?.order_item_sum_discount||"0")+parseInt(h.bill_summary[2]?.order_item_sum_discount||"0")+parseInt(h.bill_summary[3]?.order_item_sum_discount||"0")+parseInt(h.bill_summary[1]?.order_discount||"0")+parseInt(h.bill_summary[2]?.order_discount||"0")+parseInt(h.bill_summary[3]?.order_discount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-inline-flex hfl-flex-1 hfl-items-center hfl-text-Gray-800 ",children:"Tax Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(h.bill_summary[1]?.order_service_tax||"0")+parseInt(h.bill_summary[2]?.order_service_tax||"0")+parseInt(h.bill_summary[3]?.order_service_tax||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Final Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(h.bill_summary[1]?.net_bill_amount||"0")+parseInt(h.bill_summary[2]?.net_bill_amount||"0")+parseInt(h.bill_summary[3]?.net_bill_amount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Received Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",parseInt(h.bill_summary[1]?.order_paid_amount||"0")+parseInt(h.bill_summary[2]?.order_paid_amount||"0")+parseInt(h.bill_summary[3]?.order_paid_amount||"0")]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Refund Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",parseInt(h.bill_summary[1]?.refund_amount||"0")+parseInt(h.bill_summary[2]?.refund_amount||"0")+parseInt(h.bill_summary[3]?.refund_amount||"0")]})]}),D&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px]",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Past Due Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.total_amount]}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>Q()})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Balance"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Bold",type:"Text lg",className:"hfl-text-Gray-800",children:["₹"," ",(parseInt(h.bill_summary[1]?.balance_amount||"0")||0)+(parseInt(h.bill_summary[2]?.balance_amount||"0")||0)+(parseInt(h.bill_summary[3]?.balance_amount||"0")||0)+(D&&parseInt(S?.total_amount||"0")||0)]})]}),e.jsxRuntimeExports.jsx(Pl,{isPayDue:D,rightSegment:c,pastDueData:S,showDiscount:R,showRefund:l,summaryData:h,date:d,getBillSummarydata:V,handleRightSegment:n,getPastDueAmount:g,refreshBillsList:L,deleteLastPaymemntMode:P,setDeleteLastPaymentMode:A,walletBalance:W,setRefreshWallet:z})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-px-2 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"to-print",hierarchy:"Tertiary",size:"md",textField:"Print",disabled:!1,icon:"Left",onClick:()=>y([1,2,3],"billPrintPreview",!1),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"to-share",hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>y([1,2,3],"billSharePreview",!0),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},la=i=>{const{editedTableData:d,handleRightSegment:c,getBillSummarydata:n,order_date:y,editRowId:R,setTableData:l,refreshBillsList:I,handleRevertEdit:S}=i,{patientIDs:h,showToast:V,doctorListArr:g,billPreferences:L,formattedService:W,ppEventProps:z,variable:D}=v.useContext(Tt),[N,P]=v.useState(),A={bill_item_details:{doctor_name:D.window_var.doc_name_for_seg,referrer_doctor_role_id:D.window_var.doctor_role_id_for_seg,lab_owner_name:"",lab_owner_id:"",appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},appnt_doctor_role_id:""}},[j,Q]=v.useState(()=>({...d,...A})),M=($,X)=>{let O={};$==="labowner"?O={lab_owner_name:X.labOwnerName,lab_owner_id:X.LabOwnerDocRoleID||""}:O={doctor_name:X.docName,referrer_doctor_role_id:X.docRoleID},Q(re=>({...re,bill_item_details:{...re.bill_item_details,...O}}))},G=async($="")=>{try{const X=await Cn($,D);P(X)}catch(X){console.error("Error in getReferalDoctorList API Call:",X)}};v.useEffect(()=>{G()},[]);const k=async()=>{if(d?.order_item_id)try{const $=await jl(d?.order_item_id,h.patientRoleID,D);Q(X=>{const O=$.data;return{...X,...en,...O,service_category:Ct[2],service_category_id:"3",order_item_service_tax_percentage:W?.[+O.service_id]?.service_tax||0,bill_item_details:{...X.bill_item_details,...O.bill_item_details,appnt_doctor_role_id:"",referrer_doctor_role_id:""}}})}catch($){console.error("Error fetching bill item data:",$)}};return v.useEffect(()=>{d&&Q({...j,...d})},[d]),v.useEffect(()=>{k()},[j.order_item_id]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text md",className:"hfl-max-w-[300px] hfl-truncate",children:j?.service_name}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{c(),S()}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4",children:[L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.ej,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:j.bill_item_details.doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:g?.doctor_list?.map($=>({label:$.doctor_name,value:$.doctor_name,appnt_doctor_role_id:$.doctor_identifier})),handleSuffixValChange:$=>{M("",{docName:$,docRoleID:""})},onSuffixDropdownClick:$=>{M("",{docName:$.label,docRoleID:$.appnt_doctor_role_id})}})}),L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.ej,{label:"Lab Owner (Referred By)",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hx_down hfl-bg-White_20",input2value:j.bill_item_details.lab_owner_name,inputProps:{disabled:!0},suffixInputProps:{placeholder:"Lab Owner (Referred By)"},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-border-l-0 hfl-w-[270px] hfl-text-ellipsis hfl-bg-White_20",widthSufixDrpdwn:"hfl-w-[305px]",suffixOptions:N?.referrals?.map($=>({label:$.referralName,value:$.referralName,referralId:$.referralId})),onlySuffixDropdownItemsAllowed:!1,handleSuffixValChange:$=>{G($),M("labowner",{labOwnerName:$,LabOwnerDocRoleID:""})},onSuffixDropdownClick:$=>{M("labowner",{labOwnerName:$.label,LabOwnerDocRoleID:$.referralId})}})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update",className:"hfl-flex hfl-h-9 hfl-w-full hfl-shrink-0 hfl-items-center hfl-justify-center hfl-gap-1 hfl-self-stretch hfl-rounded-md hfl-p-3",onClick:async()=>{const $=await Cl(j,V,h.patientRoleID,Te.dayjs(y).format("YYYY-MM-DD"),z,Ct[2],D);j.bill_item_details.lab_owner_name&&En(j.bill_item_details.lab_owner_name,h?.patientRoleID||"",D),$&&(l(X=>X.map((O,re)=>R==re.toString()?{...O,order_item_id:$.order_item_id||j.order_item_id}:O)),($.order_item_id||j.order_item_id)&&(n(),c(),I(y)))}})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{c(),S()}})})]})},na="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='50'%20height='49'%20viewBox='0%200%2050%2049'%20fill='none'%3e%3cg%20opacity='0.3'%20clip-path='url(%23clip0_916_82588)'%3e%3cpath%20d='M48.2399%2011.218V38.5495C48.2399%2039.4022%2047.9011%2040.2201%2047.2981%2040.8231C46.6951%2041.4261%2045.8772%2041.7649%2045.0244%2041.7649H4.83118C3.97839%2041.7649%203.16052%2041.4261%202.55751%2040.8231C1.95449%2040.2201%201.61572%2039.4022%201.61572%2038.5495V11.218L2.41959%2010.4142H47.436L48.2399%2011.218Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M48.2399%208.00245V11.2179H1.61572V8.00245C1.61572%207.14965%201.95449%206.33179%202.55751%205.72877C3.16052%205.12576%203.97839%204.78699%204.83118%204.78699H45.0244C45.8772%204.78699%2046.6951%205.12576%2047.2981%205.72877C47.9011%206.33179%2048.2399%207.14965%2048.2399%208.00245Z'%20fill='%23D0D5DD'/%3e%3cpath%20d='M10.4572%203.17951C10.4572%202.29158%209.73735%201.57178%208.84943%201.57178C7.9615%201.57178%207.2417%202.29158%207.2417%203.17951V6.39497C7.2417%207.28289%207.9615%208.0027%208.84943%208.0027C9.73735%208.0027%2010.4572%207.28289%2010.4572%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M18.4967%203.17951C18.4967%202.29158%2017.7769%201.57178%2016.889%201.57178C16.0011%201.57178%2015.2812%202.29158%2015.2812%203.17951V6.39497C15.2812%207.28289%2016.0011%208.0027%2016.889%208.0027C17.7769%208.0027%2018.4967%207.28289%2018.4967%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M26.5348%203.17951C26.5348%202.29158%2025.815%201.57178%2024.9271%201.57178C24.0391%201.57178%2023.3193%202.29158%2023.3193%203.17951V6.39497C23.3193%207.28289%2024.0391%208.0027%2024.9271%208.0027C25.815%208.0027%2026.5348%207.28289%2026.5348%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M34.5734%203.17951C34.5734%202.29158%2033.8536%201.57178%2032.9656%201.57178C32.0777%201.57178%2031.3579%202.29158%2031.3579%203.17951V6.39497C31.3579%207.28289%2032.0777%208.0027%2032.9656%208.0027C33.8536%208.0027%2034.5734%207.28289%2034.5734%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M42.6124%203.17951C42.6124%202.29158%2041.8926%201.57178%2041.0047%201.57178C40.1168%201.57178%2039.397%202.29158%2039.397%203.17951V6.39497C39.397%207.28289%2040.1168%208.0027%2041.0047%208.0027C41.8926%208.0027%2042.6124%207.28289%2042.6124%206.39497V3.17951Z'%20fill='%23F9FAFB'/%3e%3cpath%20d='M24.928%2034.5299C29.8115%2034.5299%2033.7705%2030.571%2033.7705%2025.6874C33.7705%2020.8038%2029.8115%2016.8449%2024.928%2016.8449C20.0444%2016.8449%2016.0854%2020.8038%2016.0854%2025.6874C16.0854%2030.571%2020.0444%2034.5299%2024.928%2034.5299Z'%20fill='%23D0D5DD'/%3e%3cpath%20d='M29.7505%2024.0798H26.5351V20.8644C26.5351%2020.6512%2026.4504%2020.4467%2026.2996%2020.2959C26.1489%2020.1452%2025.9444%2020.0605%2025.7312%2020.0605H24.1235C23.9103%2020.0605%2023.7058%2020.1452%2023.5551%2020.2959C23.4043%2020.4467%2023.3196%2020.6512%2023.3196%2020.8644V24.0798H20.1042C19.891%2024.0798%2019.6865%2024.1645%2019.5357%2024.3153C19.385%2024.466%2019.3003%2024.6705%2019.3003%2024.8837V26.4914C19.3003%2026.7046%2019.385%2026.9091%2019.5357%2027.0598C19.6865%2027.2106%2019.891%2027.2953%2020.1042%2027.2953H23.3196V30.5107C23.3196%2030.7239%2023.4043%2030.9284%2023.5551%2031.0791C23.7058%2031.2299%2023.9103%2031.3146%2024.1235%2031.3146H25.7312C25.9444%2031.3146%2026.1489%2031.2299%2026.2996%2031.0791C26.4504%2030.9284%2026.5351%2030.7239%2026.5351%2030.5107V27.2953H29.7505C29.9637%2027.2953%2030.1682%2027.2106%2030.319%2027.0598C30.4697%2026.9091%2030.5544%2026.7046%2030.5544%2026.4914V24.8837C30.5544%2024.6705%2030.4697%2024.466%2030.319%2024.3153C30.1682%2024.1645%2029.9637%2024.0798%2029.7505%2024.0798Z'%20fill='white'/%3e%3cpath%20d='M13.6731%2048.1958C15.8929%2048.1958%2017.6925%2046.3963%2017.6925%2044.1765C17.6925%2041.9567%2015.8929%2040.1572%2013.6731%2040.1572C11.4533%2040.1572%209.65381%2041.9567%209.65381%2044.1765C9.65381%2046.3963%2011.4533%2048.1958%2013.6731%2048.1958Z'%20fill='%2398A2B3'/%3e%3cpath%20d='M45.0241%203.9834H43.4164V3.17954C43.4164%202.53994%2043.1623%201.92655%2042.71%201.47428C42.2578%201.02202%2041.6444%200.767944%2041.0048%200.767944C40.3652%200.767944%2039.7518%201.02202%2039.2995%201.47428C38.8472%201.92655%2038.5932%202.53994%2038.5932%203.17954V3.9834H35.3777V3.17954C35.3777%202.53994%2035.1236%201.92655%2034.6714%201.47428C34.2191%201.02202%2033.6057%200.767944%2032.9661%200.767944C32.3265%200.767944%2031.7131%201.02202%2031.2609%201.47428C30.8086%201.92655%2030.5545%202.53994%2030.5545%203.17954V3.9834H27.3391V3.17954C27.3391%202.53994%2027.085%201.92655%2026.6327%201.47428C26.1805%201.02202%2025.5671%200.767944%2024.9275%200.767944C24.2879%200.767944%2023.6745%201.02202%2023.2222%201.47428C22.7699%201.92655%2022.5159%202.53994%2022.5159%203.17954V3.9834H19.3004V3.17954C19.3004%202.53994%2019.0463%201.92655%2018.5941%201.47428C18.1418%201.02202%2017.5284%200.767944%2016.8888%200.767944C16.2492%200.767944%2015.6358%201.02202%2015.1836%201.47428C14.7313%201.92655%2014.4772%202.53994%2014.4772%203.17954V3.9834H11.2618V3.17954C11.2618%202.53994%2011.0077%201.92655%2010.5554%201.47428C10.1032%201.02202%209.48977%200.767944%208.85017%200.767944C8.21058%200.767944%207.59718%201.02202%207.14492%201.47428C6.69265%201.92655%206.43858%202.53994%206.43858%203.17954V3.9834H4.83085C3.76525%203.98468%202.74366%204.40855%201.99017%205.16205C1.23667%205.91554%200.8128%206.93713%200.811523%208.00273L0.811523%2038.5496C0.8128%2039.6152%201.23667%2040.6368%201.99017%2041.3903C2.74366%2042.1438%203.76525%2042.5676%204.83085%2042.5689H9.13152C8.80047%2043.5017%208.7644%2044.5137%209.02822%2045.4677C9.29203%2046.4217%209.84294%2047.2714%2010.6062%2047.9015C11.3695%2048.5317%2012.3081%2048.9117%2013.2948%2048.9902C14.2814%2049.0686%2015.2683%2048.8416%2016.1216%2048.3399C16.9748%2047.8382%2017.653%2047.0862%2018.0642%2046.1859C18.4754%2045.2856%2018.5996%2044.2805%2018.4201%2043.3072C18.2405%2042.3338%2017.7659%2041.4393%2017.0605%2040.7449C16.3552%2040.0506%2015.4533%2039.59%2014.4772%2039.4258V31.3148C14.4772%2030.6752%2014.2231%2030.0618%2013.7709%2029.6096C13.3186%2029.1573%2012.7052%2028.9032%2012.0656%2028.9032H10.8598C10.54%2028.9032%2010.2333%2028.7762%2010.0072%2028.55C9.78107%2028.3239%209.65404%2028.0172%209.65404%2027.6974C9.65404%2027.3776%209.78107%2027.0709%2010.0072%2026.8448C10.2333%2026.6187%2010.54%2026.4916%2010.8598%2026.4916H15.3221C15.5196%2028.9036%2016.6173%2031.153%2018.397%2032.793C20.1767%2034.4329%2022.5082%2035.3433%2024.9283%2035.3433C27.3483%2035.3433%2029.6799%2034.4329%2031.4596%2032.793C33.2393%2031.153%2034.3369%2028.9036%2034.5345%2026.4916H35.3777C35.5909%2026.4916%2035.7954%2026.5763%2035.9461%2026.7271C36.0969%2026.8778%2036.1816%2027.0823%2036.1816%2027.2955V32.5206C36.1816%2033.2668%2036.478%2033.9824%2037.0056%2034.5101C37.5333%2035.0377%2038.2489%2035.3341%2038.9951%2035.3341C39.7413%2035.3341%2040.4569%2035.0377%2040.9846%2034.5101C41.5122%2033.9824%2041.8086%2033.2668%2041.8086%2032.5206V24.8115C42.9313%2024.6208%2043.9503%2024.0394%2044.6858%2023.1701C45.4213%2022.3007%2045.8258%2021.1994%2045.8279%2020.0607V15.2375C45.8279%2014.8111%2045.6586%2014.4022%2045.3571%2014.1007C45.0555%2013.7992%2044.6466%2013.6298%2044.2202%2013.6298H43.4164C43.2032%2013.6298%2042.9987%2013.7145%2042.8479%2013.8652C42.6972%2014.016%2042.6125%2014.2204%2042.6125%2014.4336C42.6125%2014.6468%2042.6972%2014.8513%2042.8479%2015.0021C42.9987%2015.1528%2043.2032%2015.2375%2043.4164%2015.2375H44.2202V20.0607C44.2202%2020.9135%2043.8814%2021.7314%2043.2784%2022.3344C42.6754%2022.9374%2041.8576%2023.2762%2041.0048%2023.2762C40.152%2023.2762%2039.3341%2022.9374%2038.7311%2022.3344C38.1281%2021.7314%2037.7893%2020.9135%2037.7893%2020.0607V15.2375H38.5932C38.8064%2015.2375%2039.0108%2015.1528%2039.1616%2015.0021C39.3123%2014.8513%2039.397%2014.6468%2039.397%2014.4336C39.397%2014.2204%2039.3123%2014.016%2039.1616%2013.8652C39.0108%2013.7145%2038.8064%2013.6298%2038.5932%2013.6298H37.7893C37.3629%2013.6298%2036.954%2013.7992%2036.6525%2014.1007C36.351%2014.4022%2036.1816%2014.8111%2036.1816%2015.2375V20.0607C36.1837%2021.1994%2036.5882%2022.3007%2037.3237%2023.1701C38.0592%2024.0394%2039.0783%2024.6208%2040.2009%2024.8115V32.5206C40.2009%2032.8404%2040.0739%2033.1471%2039.8477%2033.3732C39.6216%2033.5994%2039.3149%2033.7264%2038.9951%2033.7264C38.6753%2033.7264%2038.3686%2033.5994%2038.1425%2033.3732C37.9163%2033.1471%2037.7893%2032.8404%2037.7893%2032.5206V27.2955C37.7893%2026.6559%2037.5352%2026.0425%2037.083%2025.5902C36.6307%2025.138%2036.0173%2024.8839%2035.3777%2024.8839H34.5328C34.3353%2022.4719%2033.2377%2020.2225%2031.458%2018.5825C29.6782%2016.9426%2027.3467%2016.0322%2024.9267%2016.0322C22.5066%2016.0322%2020.1751%2016.9426%2018.3954%2018.5825C16.6157%2020.2225%2015.518%2022.4719%2015.3205%2024.8839H10.8598C10.1136%2024.8839%209.39801%2025.1803%208.87037%2025.708C8.34273%2026.2356%208.04631%2026.9512%208.04631%2027.6974C8.04631%2028.4436%208.34273%2029.1592%208.87037%2029.6869C9.39801%2030.2145%2010.1136%2030.5109%2010.8598%2030.5109H12.0656C12.2788%2030.5109%2012.4833%2030.5956%2012.634%2030.7464C12.7848%2030.8971%2012.8695%2031.1016%2012.8695%2031.3148V39.4258C11.7956%2039.6088%2010.8152%2040.15%2010.0881%2040.9612H4.83085C4.19125%2040.9612%203.57785%2040.7071%203.12559%2040.2548C2.67333%2039.8026%202.41925%2039.1892%202.41925%2038.5496V12.0221H47.4357V38.5496C47.4357%2039.1892%2047.1816%2039.8026%2046.7293%2040.2548C46.2771%2040.7071%2045.6637%2040.9612%2045.0241%2040.9612H20.1043C19.8911%2040.9612%2019.6866%2041.0459%2019.5359%2041.1966C19.3851%2041.3474%2019.3004%2041.5519%2019.3004%2041.7651C19.3004%2041.9782%2019.3851%2042.1827%2019.5359%2042.3335C19.6866%2042.4842%2019.8911%2042.5689%2020.1043%2042.5689H45.0241C46.0897%2042.5676%2047.1113%2042.1438%2047.8648%2041.3903C48.6183%2040.6368%2049.0421%2039.6152%2049.0434%2038.5496V8.00273C49.0421%206.93713%2048.6183%205.91554%2047.8648%205.16205C47.1113%204.40855%2046.0897%203.98468%2045.0241%203.9834ZM24.9275%2017.6491C26.5174%2017.6491%2028.0715%2018.1206%2029.3935%2019.0039C30.7154%2019.8872%2031.7458%2021.1426%2032.3542%2022.6115C32.9626%2024.0804%2033.1218%2025.6967%2032.8117%2027.256C32.5015%2028.8154%2031.7359%2030.2477%2030.6116%2031.3719C29.4874%2032.4962%2028.0551%2033.2618%2026.4957%2033.5719C24.9364%2033.8821%2023.3201%2033.7229%2021.8512%2033.1145C20.3823%2032.5061%2019.1269%2031.4757%2018.2436%2030.1538C17.3603%2028.8318%2016.8888%2027.2776%2016.8888%2025.6878C16.8912%2023.5565%2017.7388%2021.5132%2019.2459%2020.0062C20.7529%2018.4991%2022.7962%2017.6514%2024.9275%2017.6491ZM13.6734%2040.9612C14.3093%2040.9612%2014.931%2041.1498%2015.4598%2041.5031C15.9886%2041.8564%2016.4007%2042.3586%2016.6441%2042.9461C16.8874%2043.5337%2016.9511%2044.1802%2016.827%2044.804C16.703%2045.4277%2016.3967%2046.0006%2015.947%2046.4503C15.4973%2046.9%2014.9244%2047.2063%2014.3007%2047.3303C13.6769%2047.4544%2013.0304%2047.3907%2012.4429%2047.1473C11.8553%2046.904%2011.3531%2046.4918%2010.9998%2045.9631C10.6465%2045.4343%2010.4579%2044.8126%2010.4579%2044.1766C10.4579%2043.3239%2010.7967%2042.506%2011.3997%2041.903C12.0027%2041.3%2012.8206%2040.9612%2013.6734%2040.9612ZM40.2009%203.17954C40.2009%202.96634%2040.2856%202.76187%2040.4363%202.61112C40.5871%202.46037%2040.7916%202.37567%2041.0048%202.37567C41.218%202.37567%2041.4224%202.46037%2041.5732%202.61112C41.7239%202.76187%2041.8086%202.96634%2041.8086%203.17954V6.395C41.8086%206.6082%2041.7239%206.81266%2041.5732%206.96342C41.4224%207.11417%2041.218%207.19886%2041.0048%207.19886C40.7916%207.19886%2040.5871%207.11417%2040.4363%206.96342C40.2856%206.81266%2040.2009%206.6082%2040.2009%206.395V3.17954ZM32.1622%203.17954C32.1622%202.96634%2032.2469%202.76187%2032.3977%202.61112C32.5484%202.46037%2032.7529%202.37567%2032.9661%202.37567C33.1793%202.37567%2033.3838%202.46037%2033.5345%202.61112C33.6853%202.76187%2033.77%202.96634%2033.77%203.17954V6.395C33.77%206.6082%2033.6853%206.81266%2033.5345%206.96342C33.3838%207.11417%2033.1793%207.19886%2032.9661%207.19886C32.7529%207.19886%2032.5484%207.11417%2032.3977%206.96342C32.2469%206.81266%2032.1622%206.6082%2032.1622%206.395V3.17954ZM24.1236%203.17954C24.1236%202.96634%2024.2083%202.76187%2024.359%202.61112C24.5098%202.46037%2024.7143%202.37567%2024.9275%202.37567C25.1407%202.37567%2025.3451%202.46037%2025.4959%202.61112C25.6466%202.76187%2025.7313%202.96634%2025.7313%203.17954V6.395C25.7313%206.6082%2025.6466%206.81266%2025.4959%206.96342C25.3451%207.11417%2025.1407%207.19886%2024.9275%207.19886C24.7143%207.19886%2024.5098%207.11417%2024.359%206.96342C24.2083%206.81266%2024.1236%206.6082%2024.1236%206.395V3.17954ZM16.085%203.17954C16.085%202.96634%2016.1696%202.76187%2016.3204%202.61112C16.4712%202.46037%2016.6756%202.37567%2016.8888%202.37567C17.102%202.37567%2017.3065%202.46037%2017.4572%202.61112C17.608%202.76187%2017.6927%202.96634%2017.6927%203.17954V6.395C17.6927%206.6082%2017.608%206.81266%2017.4572%206.96342C17.3065%207.11417%2017.102%207.19886%2016.8888%207.19886C16.6756%207.19886%2016.4712%207.11417%2016.3204%206.96342C16.1696%206.81266%2016.085%206.6082%2016.085%206.395V3.17954ZM8.04631%203.17954C8.04631%202.96634%208.131%202.76187%208.28175%202.61112C8.43251%202.46037%208.63697%202.37567%208.85017%202.37567C9.06337%202.37567%209.26783%202.46037%209.41859%202.61112C9.56934%202.76187%209.65404%202.96634%209.65404%203.17954V6.395C9.65404%206.6082%209.56934%206.81266%209.41859%206.96342C9.26783%207.11417%209.06337%207.19886%208.85017%207.19886C8.63697%207.19886%208.43251%207.11417%208.28175%206.96342C8.131%206.81266%208.04631%206.6082%208.04631%206.395V3.17954ZM2.41925%2010.4143V8.00273C2.41925%207.36313%202.67333%206.74973%203.12559%206.29747C3.57785%205.84521%204.19125%205.59113%204.83085%205.59113H6.43858V6.395C6.43858%207.03459%206.69265%207.64799%207.14492%208.10025C7.59718%208.55252%208.21058%208.80659%208.85017%208.80659C9.48977%208.80659%2010.1032%208.55252%2010.5554%208.10025C11.0077%207.64799%2011.2618%207.03459%2011.2618%206.395V5.59113H14.4772V6.395C14.4772%207.03459%2014.7313%207.64799%2015.1836%208.10025C15.6358%208.55252%2016.2492%208.80659%2016.8888%208.80659C17.5284%208.80659%2018.1418%208.55252%2018.5941%208.10025C19.0463%207.64799%2019.3004%207.03459%2019.3004%206.395V5.59113H22.5159V6.395C22.5159%207.03459%2022.7699%207.64799%2023.2222%208.10025C23.6745%208.55252%2024.2879%208.80659%2024.9275%208.80659C25.5671%208.80659%2026.1805%208.55252%2026.6327%208.10025C27.085%207.64799%2027.3391%207.03459%2027.3391%206.395V5.59113H30.5545V6.395C30.5545%207.03459%2030.8086%207.64799%2031.2609%208.10025C31.7131%208.55252%2032.3265%208.80659%2032.9661%208.80659C33.6057%208.80659%2034.2191%208.55252%2034.6714%208.10025C35.1236%207.64799%2035.3777%207.03459%2035.3777%206.395V5.59113H38.5932V6.395C38.5932%207.03459%2038.8472%207.64799%2039.2995%208.10025C39.7518%208.55252%2040.3652%208.80659%2041.0048%208.80659C41.6444%208.80659%2042.2578%208.55252%2042.71%208.10025C43.1623%207.64799%2043.4164%207.03459%2043.4164%206.395V5.59113H45.0241C45.6637%205.59113%2046.2771%205.84521%2046.7293%206.29747C47.1816%206.74973%2047.4357%207.36313%2047.4357%208.00273V10.4143H2.41925Z'%20fill='%2398A2B3'/%3e%3cpath%20d='M22.5154%2028.0995V30.5111C22.5154%2030.9375%2022.6848%2031.3465%2022.9863%2031.648C23.2878%2031.9495%2023.6968%2032.1189%2024.1231%2032.1189H25.7309C26.1573%2032.1189%2026.5662%2031.9495%2026.8677%2031.648C27.1692%2031.3465%2027.3386%2030.9375%2027.3386%2030.5111V28.0995H29.7502C30.1766%2028.0995%2030.5855%2027.9301%2030.887%2027.6286C31.1885%2027.3271%2031.3579%2026.9182%2031.3579%2026.4918V24.8841C31.3579%2024.4577%2031.1885%2024.0487%2030.887%2023.7472C30.5855%2023.4457%2030.1766%2023.2763%2029.7502%2023.2763H27.3386V20.8647C27.3386%2020.4384%2027.1692%2020.0294%2026.8677%2019.7279C26.5662%2019.4264%2026.1573%2019.257%2025.7309%2019.257H24.1231C23.6968%2019.257%2023.2878%2019.4264%2022.9863%2019.7279C22.6848%2020.0294%2022.5154%2020.4384%2022.5154%2020.8647V23.2763H20.1038C19.6774%2023.2763%2019.2685%2023.4457%2018.967%2023.7472C18.6655%2024.0487%2018.4961%2024.4577%2018.4961%2024.8841V26.4918C18.4961%2026.9182%2018.6655%2027.3271%2018.967%2027.6286C19.2685%2027.9301%2019.6774%2028.0995%2020.1038%2028.0995H22.5154ZM20.1038%2024.8841H23.3193C23.5325%2024.8841%2023.7369%2024.7994%2023.8877%2024.6486C24.0385%2024.4979%2024.1231%2024.2934%2024.1231%2024.0802V20.8647H25.7309V24.0802C25.7309%2024.2934%2025.8156%2024.4979%2025.9663%2024.6486C26.1171%2024.7994%2026.3215%2024.8841%2026.5347%2024.8841H29.7502V26.4918H26.5347C26.3215%2026.4918%2026.1171%2026.5765%2025.9663%2026.7272C25.8156%2026.878%2025.7309%2027.0825%2025.7309%2027.2957V30.5111H24.1231V27.2957C24.1231%2027.0825%2024.0385%2026.878%2023.8877%2026.7272C23.7369%2026.5765%2023.5325%2026.4918%2023.3193%2026.4918H20.1038V24.8841Z'%20fill='%2398A2B3'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_916_82588'%3e%3crect%20width='48.2319'%20height='48.2319'%20fill='white'%20transform='translate(0.811523%200.767883)'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",aa=i=>{const{showToast:d,patientIDs:c,doctorListArr:n,patientDetails:y,billPreferences:R,formattedService:l,ppEventProps:I,variable:S}=v.useContext(Tt),{bill_date:h,handleRightSegment:V,getBillSummarydata:g,editedTableData:L,setTableData:W,editRowId:z,refreshBillsList:D,handleRevertEdit:N,checkAppointmentForBilling:P}=i,[A,j]=v.useState([]),Q=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),M=n?.doctor_list?.length===1?n?.doctor_list[0]:{doctor_name:"",doctor_identifier:""},G={...Ol,appnt_doctor_name:window.role_id=="11"?window.doc_name_for_seg:M?.doctor_name,appnt_doctor_role_id:window.role_id=="11"?window.doctor_role_id_for_seg:M?.doctor_identifier,appnt_duration:+R?.print?.bill?.appnt_minute_slab,appnt_time_time:Q?.split(" ")[0]||"",appnt_time_format:Q?.split(" ")[1]||"",total_price:"",appnt_date:Te.dayjs().format("YYYY-MM-DD"),appnt_service_id:L?.service_id||"",appnt_service_name:L?.service_name||"",...L},[k,$]=v.useState(G),[X,O]=v.useState(!1),re=async()=>{if(L?.order_item_id)try{const Y=await jl(L.order_item_id,c.patientRoleID,S),{created_on:fe,order_item_service_tax:H,service_id:Ce,bill_item_details:Fe,order_item_id:ke,item_quantity:xt,order_unit_item_price:He,order_item_price:st,order_item_discount:_t,service_name:pt}=Y.data,{appointment_details:Pt,doctor_name:Rt}=Fe,{appnt_id:Dt,appnt_date:Gt=Te.dayjs().format("YYYY-MM-DD"),appnt_time:T,appnt_status:De,appnt_duration:qe,doctor_role_id:ae}=Pt,J=new Date("1970-01-01T"+T+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"}),K={appnt_time_time:"",appnt_time_format:""};J&&J!=="Invalid Date"&&(K.appnt_time_time=J?.split(" ")[0],K.appnt_time_format=J?.split(" ")[1]),$(oe=>({...oe,appnt_id:Dt,patient_role_id:c.patientRoleID,appnt_doctor_role_id:ae,appnt_service_id:Ce,appnt_date:Gt,appnt_time:T,appnt_status:De,appnt_duration:qe,appnt_doctor_name:Rt,appnt_service_name:pt,appnt_mode:"inperson",order_item_id:ke,item_quantity:xt,order_unit_item_price:He,order_item_price:st,order_item_discount:_t,order_item_service_tax:""+Math.floor(+H),order_item_service_tax_percentage:l[+Ce]?.service_tax||0,total_price:"",appnt_created_on:fe,order_item_created_on:fe,...K}))}catch(Y){$(G),console.error("Error fetching bill item data:",Y)}};v.useEffect(()=>{L&&$({...k,...L})},[L]),v.useEffect(()=>{re()},[k.order_item_id]);const[ce,_e]=v.useState(!1),xe=(Y,fe)=>{$(H=>({...H,[Y]:fe}))},Ve=async()=>{try{const Y=await dn(L.service_id,Te.dayjs(h).format("YYYY-MM-DD"),c.patientRoleID,S);if(Y?.appointments?.length)for(const fe of Y.appointments){const H=new Date("1970-01-01T"+fe.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});H&&H!=="Invalid Date"&&(fe.appnt_time_time=H?.split(" ")[0],fe.appnt_time_format=H?.split(" ")[1])}j(Y?.appointments)}catch{console.log("error in getAppointmentsList API Call")}};v.useEffect(()=>{Ve()},[L?.service_id]);const ie=k.appnt_date&&Te.dayjs(k.appnt_date).format("YYYY-MM-DD")<Te.dayjs().format("YYYY-MM-DD");return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[340px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text md",className:"hfl-truncate hfl-capitalize",title:L?.service_name||"",children:L?.service_name||""}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{V(),N()}})]}),A.length>0&&!ce&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[A.map((Y,fe)=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-shrink-0 hfl-flex-col hfl-items-start hfl-gap-[5px] hfl-rounded-md hfl-border-Gray-200 hfl-bg-White_20 hfl-px-3 hfl-py-2 hfl-shadow-md hover:hfl-bg-Gray-100",onClick:()=>{_e(!0),$(H=>({...H,...Y}))},children:[e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["Consultation with ",Y.appnt_doctor_name]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",children:`${Y.appnt_time_time} ${Y.appnt_time_format}`}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[11px] hfl-w-[1px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_inperson hfl-text-3"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",children:"In-Person"})]})]})]},fe)),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"Create New Appointment",disabled:Te.dayjs(h).format("YYYY-MM-DD")!==Te.dayjs().format("YYYY-MM-DD"),className:"hfl-h-10 hfl-w-full hfl-justify-center hfl-bg-White_20 hfl-text-[13px] hover:hfl-bg-Gray-100",onClick:()=>{_e(!0),$(G)}})]}),(Te.dayjs(h).format("YYYY-MM-DD")===Te.dayjs().format("YYYY-MM-DD")&&A.length==0||ce)&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col hfl-gap-4 hfl-px-3 hfl-py-4",children:[e.jsxRuntimeExports.jsx(e.ej,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:k.appnt_doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:`hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20 ${ie?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:n?.doctor_list?.map(Y=>({label:Y.doctor_name,value:Y.doctor_name,appnt_doctor_role_id:Y.doctor_identifier})),handleSuffixValChange:Y=>{xe("appnt_doctor_name",Y),xe("appnt_doctor_role_id","")},onSuffixDropdownClick:Y=>{xe("appnt_doctor_name",Y.label),xe("appnt_doctor_role_id",Y.appnt_doctor_role_id)}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Date & Time of Appointment"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-gap-2",children:[ie?e.jsxRuntimeExports.jsx(e.Ps,{className:"!hfl-h-[40px]",width:"120px",start_icon:"hx_calendar",inputProps:{value:k.appnt_date,disabled:!0}}):e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",width:"120px",height:"!hfl-h-[40px]",selectDate:new Date(Te.dayjs(k.appnt_date).format("DD-MMM-YYYY")),dateVar:Y=>{xe("appnt_date",Te.dayjs(Y).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.ej,{className:` hfl-w-20 ${ie?" hfl-pointer-events-none":""}`,suffixClassName:` hfl-w-10 ${ie?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-[80px]",input1value:k?.appnt_time_time||"",input2value:k?.appnt_time_format||"",end_icon:"hx_down",inputProps:{placeholder:"10:00",onBlur:Y=>{xe("appnt_time_time",Y.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:Y=>{xe("appnt_time_format",Y.value)}})]})]}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ar.find(Y=>Y.value==k.appnt_duration)?.label,value:k.appnt_duration},label:"Duration",className:`hfl-text-Gray-800 ${ie?" hfl-pointer-events-none":""}`,onChange:Y=>{xe("appnt_duration",Y.value)},options:Ar}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Type"}),e.jsxRuntimeExports.jsx(e.ju,{options:[{start_icon:"hx_inperson hfl-text-3",label:"In-Person",value:"inperson"}],disabled:!1,value:"inperson"})]}),window?.partner_service_enabled==="1"&&y?.insurance_details?.policy_id?.length&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-1.5",children:e.jsxRuntimeExports.jsx(e.Os,{size:"md",disabled:!1,isMarked:X,text:"Partner Enabled",onClick:()=>O(Y=>!Y),"data-qa":"skip-billing"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"No",className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{V(),_e(!1)}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:k?.appnt_id?.length?"Update":"Create",icon:"No",onClick:async()=>{if(Te.dayjs(h).format("YYYY-MM-DD")<Te.dayjs().format("YYYY-MM-DD"))await Cl(k,d,c.patientRoleID,Te.dayjs(h).format("YYYY-MM-DD"),I,Ct[0],S)&&V();else{const Y=await ql(k,!1,d,y,c,I,X,!0,S);Y&&(W(fe=>fe.map((H,Ce)=>z==Ce.toString()?{...H,order_item_id:Y.order_item_id||k.order_item_id}:H)),$(fe=>({...fe,order_item_id:Y.order_item_id,appnt_id:Y.appnt_id,order_id:Y.order_id})),Y.order_item_id&&Y.appnt_id&&V())}g(),D(h),P()},className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800"})]})]}),Te.dayjs(h).format("YYYY-MM-DD")!==Te.dayjs().format("YYYY-MM-DD")&&A.length==0&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-[11px]",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[58px] hfl-pb-4",src:na,alt:"no-bills"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-1.5 hfl-text-Error-600",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_error-filled hfl-h-5 hfl-w-5 "}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"There is no visit/prescription on this date."})]}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Bill cannot be created without a visit"})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-sticky hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{ce?_e(!1):V(),N()}})})]})},ia=i=>{const{handleRightSegment:d,editedTableData:c,getBillSummarydata:n,order_date:y,setTableData:R,editRowId:l,refreshBillsList:I,handleRevertEdit:S}=i,{patientIDs:h,showToast:V,doctorListArr:g,billPreferences:L,formattedService:W,ppEventProps:z,variable:D}=v.useContext(Tt)||{},N={bill_item_details:{appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},doctor_name:D.window_var.doc_name_for_seg,referrer_doctor_role_id:D.window_var.doctor_role_id_for_seg,lab_owner_name:"",lab_owner_id:"",appnt_doctor_role_id:""}},[P,A]=v.useState({...c,...N}),j=v.useCallback(async()=>{if(c?.order_item_id)try{const M=await jl(c.order_item_id,h?.patientRoleID||"",D);A({...c,...M.data,service_category:Ct[1],service_category_id:"2",order_item_service_tax_percentage:W?.[+M.data.service_id]?.service_tax||0,bill_item_details:{...N.bill_item_details,...M.data.bill_item_details,appointment_details:{appnt_id:"",doctor_role_id:"",appnt_date:"",appnt_time:"",appnt_duration:0,appnt_status:0},lab_owner_name:"",lab_owner_id:"0",appnt_doctor_role_id:"",referrer_doctor_role_id:""}})}catch(M){console.error("Error fetching bill item data:",M)}},[N.bill_item_details,c,W,h?.patientRoleID,D]);v.useEffect(()=>{c&&A(M=>({...M,...c}))},[c]),v.useEffect(()=>{j()},[j,P.order_item_id]);const Q=M=>{const G={...P,service_category:Ct[1],bill_item_details:{doctor_name:M.docName,appointment_details:null,lab_owner_name:"",lab_owner_id:"",referrer_doctor_role_id:M.docRoleID}};A(G)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text lg",children:P?.service_name}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{d(),S()}})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4",children:[L?.billing?.enable_add_service_owner!=0&&e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.ej,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:P.bill_item_details.doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[220px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",suffixOptions:g?.doctor_list?.map(M=>({label:M.doctor_name,value:M.doctor_name,appnt_doctor_role_id:M.doctor_identifier})),handleSuffixValChange:M=>{Q({docName:M,docRoleID:""})},onSuffixDropdownClick:M=>{Q({docName:M.label,docRoleID:M.appnt_doctor_role_id})}})}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Update",className:"hfl-flex hfl-h-9 hfl-w-full hfl-shrink-0 hfl-items-center hfl-justify-center hfl-gap-1 hfl-self-stretch hfl-rounded-md hfl-p-3",onClick:async()=>{const M=await Cl(P,V,h?.patientRoleID||"",Te.dayjs(y).format("YYYY-MM-DD"),z,Ct[1],D);M&&(R(G=>G.map((k,$)=>l==$.toString()?{...k,order_item_id:M?.order_item_id||P.order_item_id}:k)),(M?.order_item_id||P.order_item_id)&&(n(),d(),I(y)))}})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>{d(),S()}})})]})};var Is={exports:{}},oa=Is.exports,Vl;function ua(){return Vl||(Vl=1,function(i,d){(function(c,n){i.exports=n()})(oa,function(){var c="minute",n=/[+-]\d\d(?::?\d\d)?/g,y=/([+-]|\d\d)/g;return function(R,l,I){var S=l.prototype;I.utc=function(D){var N={date:D,utc:!0,args:arguments};return new l(N)},S.utc=function(D){var N=I(this.toDate(),{locale:this.$L,utc:!0});return D?N.add(this.utcOffset(),c):N},S.local=function(){return I(this.toDate(),{locale:this.$L,utc:!1})};var h=S.parse;S.parse=function(D){D.utc&&(this.$u=!0),this.$utils().u(D.$offset)||(this.$offset=D.$offset),h.call(this,D)};var V=S.init;S.init=function(){if(this.$u){var D=this.$d;this.$y=D.getUTCFullYear(),this.$M=D.getUTCMonth(),this.$D=D.getUTCDate(),this.$W=D.getUTCDay(),this.$H=D.getUTCHours(),this.$m=D.getUTCMinutes(),this.$s=D.getUTCSeconds(),this.$ms=D.getUTCMilliseconds()}else V.call(this)};var g=S.utcOffset;S.utcOffset=function(D,N){var P=this.$utils().u;if(P(D))return this.$u?0:P(this.$offset)?g.call(this):this.$offset;if(typeof D=="string"&&(D=function(M){M===void 0&&(M="");var G=M.match(n);if(!G)return null;var k=(""+G[0]).match(y)||["-",0,0],$=k[0],X=60*+k[1]+ +k[2];return X===0?0:$==="+"?X:-X}(D),D===null))return this;var A=Math.abs(D)<=16?60*D:D;if(A===0)return this.utc(N);var j=this.clone();if(N)return j.$offset=A,j.$u=!1,j;var Q=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(j=this.local().add(A+Q,c)).$offset=A,j.$x.$localOffset=Q,j};var L=S.format;S.format=function(D){var N=D||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return L.call(this,N)},S.valueOf=function(){var D=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*D},S.isUTC=function(){return!!this.$u},S.toISOString=function(){return this.toDate().toISOString()},S.toString=function(){return this.toDate().toUTCString()};var W=S.toDate;S.toDate=function(D){return D==="s"&&this.$offset?I(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():W.call(this)};var z=S.diff;S.diff=function(D,N,P){if(D&&this.$u===D.$u)return z.call(this,D,N,P);var A=this.local(),j=I(D).local();return z.call(A,j,N,P)}}})}(Is)),Is.exports}var ca=ua();const Sl=e.getDefaultExportFromCjs(ca),Nl=i=>{Te.dayjs.extend(Sl);const{categorySummaryData:d,serviceDetails:c,walletBalance:n,rightSegment:y,serviceItem:R,bill_date:l,handleRightSegment:I,getBillSummarydata:S,getPastDueAmount:h,refreshBillsList:V,closePrintModal:g,setRefreshWallet:L}=i,W=v.useContext(Tt);if(!W)throw new Error("ServiceLevelBillSummary must be used within an AppContext.Provider");const{patientDetails:z,patientIDs:D,billPreferences:N,setShowPrintModal:P,currentWindow:A,showPrintModal:j,variable:Q}=W,M=()=>{switch(R){case Ct[0]:return"Consultation Bill";case Ct[1]:return"Other Service Bill";case Ct[2]:return"Lab Service Bill";default:return`${R} Bill`}},G=async(k,$,X)=>{if(j?.visible&&g(),!d)return;const O=await Ul(d.order_id,D?.patientRoleID||"",Q),re=c.map(ke=>({serviceName:ke.service_name,price:+ke.order_unit_item_price,gst:+ke.order_item_service_tax,discount:+ke.order_item_discount,netPrice:+ke.net_amount,itemQty:+ke.item_quantity})),ce=+d.order_paid_amount,_e=+d.refund_amount,xe=+d.balance_amount,Ve=+d.order_discount,ie=+d.order_item_sum_discount,Y=+d.order_service_tax,fe={paymentStatus:ce-_e===0?"red":xe===0?"green":"yellow",paymentMode:O?.paymentModes?.length?O.paymentModes.join(", "):"",billedAmount:+d.order_total,discountAmount:Ve+ie,gstAmount:Y,cgstAmount:(Y/2).toFixed(2),sgstAmount:(Y/2).toFixed(2),finalAmount:+d.net_bill_amount,receivedAmount:ce,balanceAmount:xe,refundAmount:_e},Ce=[z?.age&&typeof z.age=="number"?`${z.age}y`:z?.org_person_dob?dr(z.org_person_dob):"",z?.gender?Zr[z.gender]:"",z?.blood_group].filter(Boolean).join(", "),Fe={name:`${sr(z?.name??"")}${Ce?` (${Ce})`:""}`,billDate:Te.dayjs(d.order_date).format("DD-MMM-YYYY"),mobileNumber:z?.phone_number??"",email:z?.email??"",billNumber:d.order_id_str,patientId:z?.org_person_bid_str??"",patientIdForEmail:D?.patientRoleID??"",billStatus:xe===0?"PAID":"UNPAID",address:[z?.address,z?.city,z?.pincode].filter(Boolean).join(", "),referredBy:O?.lab_owner_name?sr(O.lab_owner_name):z?.ref_doc_name?sr(z.ref_doc_name):"--"};P({printDataFrom:"patient_popup",visible:!0,whichPreview:k,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:$,preferences:{...N?.print?.bill,...N?.org_details},billSummaryDetails:fe,billServiceDetails:re,billPatientDetails:Fe,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:d?.order_id}},trackEventHandler:()=>{console.log(X)}})};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_arrow-left hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>I(ht[0])}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:[M()," : ",e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-text-Primary-600",children:d?.order_id_str})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Gross Bill Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_total??0]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Discount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",+(d?.order_discount||0)+ +(d?.order_item_sum_discount||0)]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Tax Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_service_tax]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Net Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.net_bill_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Collected Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",d?.order_paid_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Refund Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," - ",d?.refund_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Net Paid Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Success-500",children:["₹ ",+(d?.order_paid_amount||0)-+(d?.refund_amount||0)]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-self-stretch hfl-py-[7px] hfl-pr-9",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:"Total Balance Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Warning-500 ",children:["₹ ",d?.balance_amount]})]}),e.jsxRuntimeExports.jsx(Pl,{showDiscount:A!==jt[4],showRefund:A!==jt[4],rightSegment:y,summaryData:d,getBillSummarydata:S,handleRightSegment:I,serviceItem:R,getPastDueAmount:h,date:l,refreshBillsList:V,setRefreshWallet:L,walletBalance:n})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-gap-2 hfl-px-1 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Print",icon:"Left",onClick:()=>G("billPrintPreview",!1,"BILL_PRINT"),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>G("billSharePreview",!0,"BILL_SHARE"),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},Al=({depositAmount:i,handleRightSegment:d,rightSegment:c,setRefreshWallet:n})=>e.jsxRuntimeExports.jsxs("div",{className:" hfl-flex hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-border-b hfl-border-Gray-200 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-px-1",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-gap-1"}),e.jsxRuntimeExports.jsx("i",{className:"hx_arrow-left hfl-cursor-pointer hfl-text-4 hfl-font-inter-2",onClick:()=>{d()}}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text md",className:"hfl-flex hfl-items-center",children:"Deposit Amount"})]}),e.jsxRuntimeExports.jsx("i",{className:"hx_close hfl-cursor-pointer hfl-text-right hfl-text-4 hfl-font-inter-2",onClick:()=>{d()}})]}),e.jsxRuntimeExports.jsxs("div",{className:`${i>0?"hfl-bg-Success-50":"hfl-bg-Warning-50"} hfl-m-3 hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-rounded-lg hfl-border hfl-border-Gray-200 hfl-px-2 hfl-py-3`,children:[e.jsxRuntimeExports.jsx("span",{className:`hfl-text-5 hfl-font-inter-3 ${i>0?"hfl-text-Success-600":"hfl-text-Gray-800"} `,children:"₹"+i}),e.jsxRuntimeExports.jsx("span",{className:"hfl-mt-[-8px] hfl-text-1 hfl-text-Gray-500",children:"Balance"})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full hfl-px-3",children:e.jsxRuntimeExports.jsx(Pl,{rightSegment:c,showDeposit:!0,showPayment:!1,showDiscount:!1,showDepositRefund:!0,showRefund:!1,handleRightSegment:d,walletBalance:i,setRefreshWallet:n})})]}),da=({closePrintModal:i})=>{if(!v.useContext(Tt))throw new Error("AddBills component must be used within an PatientPopupContext.Provider");const{patientDetails:d,patientIDs:c,billPreferences:n,setShowPrintModal:y,showPrintModal:R,setLoading:l,showToast:I,variable:S}=v.useContext(Tt),[h,V]=v.useState(new Date),[g,L]=v.useState(),[W,z]=v.useState(ht[0]),[D,N]=v.useState([]),[P,A]=v.useState([]),[j,Q]=v.useState(""),[M,G]=v.useState(),[k,$]=v.useState(!1),[X,O]=v.useState(hl),[re,ce]=v.useState("-1"),[_e,xe]=v.useState({bill_summary:{},status:!1,message:""}),[Ve,ie]=v.useState(!1),[Y,fe]=v.useState(0),H=T=>{Q(T)},Ce=async T=>{l(!0);try{await He(T),V(T)}catch(De){console.error(De)}l(!1)},Fe=async()=>{try{const T=await on(c.patientRoleID,Te.dayjs(h).format("YYYY-MM-DD"),S);xe(T)}catch(T){console.error("Error in getBillSummary API Call:",T)}},ke=()=>{O(T=>P.length>+re&&+re>=0?[...T.slice(0,+re),{order_id:P[re].order_id,order_date:P[re].order_date,order_created_on:P[re].order_created_on,service_category:P[re].service_category,service_category_id:P[re].service_category_id,order_id_str:P[re].order_id_str,order_total:P[re].order_total,order_paid_amount:P[re].order_paid_amount,order_item_sum_discount:P[re].order_item_sum_discount,order_discount:P[re].order_discount,refund_amount:P[re].refund_amount,order_service_tax:P[re].order_service_tax,balance_amount:P[re].balance_amount,net_bill_amount:P[re].net_bill_amount,order_item_id:P[re].order_item_id,service_id:P[re]?.service_id,service_name:P[re].service_name,item_quantity:P[re].item_quantity,order_unit_item_price:P[re].order_unit_item_price,order_item_price:P[re].order_item_price,order_item_discount:P[re].order_item_discount,order_item_service_tax:""+Math.floor(P[re].order_item_service_tax),order_item_service_tax_percent:P[re].order_item_service_tax_percent,net_amount:P[re].net_amount,created_on:P[re].created_on},...T.slice(+re+1)]:T)},xt=async()=>{try{const T=await Ts(Te.dayjs(h).format("YYYY-MM-DD"),c.patientRoleID,1,10,!0,S);$(T?.total_records>0)}catch{console.log("error in checkAppointmentForBilling API Call")}};v.useEffect(()=>{Fe(),pt(),window?.partner_service_enabled!=="1"&&xt()},[h]);const He=async(T=Te.dayjs().format("YYYY-MM-DD"))=>{l(!0);try{const De=await gl(Te.dayjs(T).format("YYYY-MM-DD"),c.patientRoleID,1,100,S);L(De),O(hl);const qe=De?.bill_list.flatMap(ae=>{const{order_items:J,...K}=ae;return J.map(oe=>({...K,...oe})).filter(oe=>Te.dayjs(oe?.created_on).format("YYYY-MM-DD")===Te.dayjs(new Date).format("YYYY-MM-DD"))});if(A(qe),De?.bill_list?.length){const ae=De?.bill_list.reduce((J,K)=>{const oe=K.order_items.filter(Be=>Te.dayjs(Be?.created_on).isBefore(Te.dayjs(new Date).format("YYYY-MM-DD"))).map(Be=>({...Be,service_category:K.service_category,service_category_id:K.service_category_id}));return[...J,...oe]},[]);N(ae)}else O(hl),N([])}catch{console.log("error in getBillsList API Call")}l(!1)};v.useEffect(()=>{He()},[]);const st=async()=>{try{const T=await wl(c.patientRoleID,S);fe(T?.wallet_balance||0)}catch(T){console.error("Failed to fetch wallet balance:",T)}};v.useEffect(()=>{st()},[Ve]);const _t=v.useCallback(async()=>{try{const T=await yl(Te.dayjs(h).format("YYYY-MM-DD"),c.patientRoleID,!1,S);G(T)}catch(T){console.error("Error in getPastDueAmount API Call:",T)}},[h,yl,c.patientRoleID]);v.useEffect(()=>{_t()},[_t]);const pt=(T=ht[0])=>{z(T)},Pt=T=>{switch(T?.original?.service_category.toLowerCase()){case Ct[0].toLowerCase():pt(ht[2]);break;case Ct[1].toLowerCase():pt(ht[4]);break;case Ct[2].toLowerCase():pt(ht[3]);break;default:pt(ht[0]);break}},Rt=(T,De)=>De.reduce((qe,ae)=>qe+(parseInt(_e.bill_summary[ae]?.[T]||"0")||0),0),Dt=(T,De)=>De.map(qe=>_e.bill_summary[qe]?.[T]).filter(qe=>qe),Gt=async(T,De,qe)=>{if(R?.visible&&i(),_e?.bill_summary&&Object.keys(_e?.bill_summary).length>0){const ae=await kn(Dt("order_id",T),c?.patientRoleID,S),J=[...new Set(T.map(ct=>ae.paymentsData.get(ct)).flat())].map(ct=>ir[ct]??void 0)?.filter(ct=>ct),K=Rt("order_service_tax",T??[1,2,3]),oe={billedAmount:Rt("order_total",T??[1,2,3]),gstAmount:K,cgstAmount:(K/2).toFixed(2),sgstAmount:(K/2).toFixed(2),discountAmount:Rt("order_item_sum_discount",T??[1,2,3])+Rt("order_discount",T??[1,2,3]),finalAmount:Rt("net_bill_amount",T??[1,2,3]),receivedAmount:Rt("order_paid_amount",T??[1,2,3]),balanceAmount:Rt("balance_amount",T??[1,2,3]),refundAmount:Rt("refund_amount",T??[1,2,3])},Pe=[...X,...D].filter(ct=>T.includes(parseInt(ct?.service_category_id))).map(ct=>({serviceName:ct.service_name,price:ct.order_unit_item_price,gst:Math.floor(ct.order_item_service_tax),discount:ct.order_item_discount,netPrice:ct.net_amount,itemQty:ct.item_quantity})),Zt=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?dr(d?.org_person_dob):"",Zr[d?.gender]??"",d?.blood_group].filter(ct=>ct).join(", ");y({printDataFrom:"patient_popup",visible:!0,whichPreview:De,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:qe,preferences:{...n?.print?.bill,...n?.org_details,...n?.branch_details},billSummaryDetails:{...oe,paymentStatus:parseInt(oe?.receivedAmount||"0")-parseInt(oe?.refundAmount||"0")===0?"red":parseInt(oe?.balanceAmount||"0")===0?"green":"yellow",paymentMode:J?.join(", ")},billServiceDetails:Pe,billPatientDetails:{name:sr(d?.name)+(Zt?` (${Zt}) `:""),billDate:Te.dayjs(h).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:Dt("order_id_str",T)?.toString(),patientId:d?.org_person_bid_str,patientIdForEmail:c.patientRoleID,billStatus:parseInt(oe?.balanceAmount||"0")===0?"PAID":"UNPAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(ct=>ct).join(", "),referredBy:ae?.lab_owner_name?sr(ae?.lab_owner_name):d?.ref_doc_name?sr(d?.ref_doc_name):"--"},isWholeBill:T.length===3,payloadDataforEmail:{orderDate:T.length===3?Te.dayjs(h).format("YYYY-MM-DD"):"",orderNumber:T.length===3?"":Dt("order_id",T)?.toString()}},trackEventHandler:ct=>{console.log("Bill Print Event",ct)}})}else I("Error","Please add a service to create bill","Error",3e3)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx(ra,{tab:"add_bills",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-overflow-auto ${W===ht[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-ml-4 hfl-mr-1 hfl-flex hfl-flex-col hfl-gap-1 hfl-self-stretch",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-text-Gray-700",children:"Bill Date :"}),e.jsxRuntimeExports.jsx("div",{"data-qa":"calendar",children:e.jsxRuntimeExports.jsx(e.ZC,{selectDate:new Date(Te.dayjs(h).format("DD-MMM-YYYY")),dateVar:T=>{V(T),Ce(T)},maxDate:new Date})}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"Today",className:"hfl-h-10",onClick:()=>Ce(new Date),"data-qa":"today"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:" hfl-text-Success-500",children:Y}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>pt(ht[7])})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"-hfl-gap-[1px] hfl-flex hfl-h-[590px] hfl-flex-col hfl-items-start",children:[e.jsxRuntimeExports.jsx(kl,{tableBodyData:P,tableData:X,isDisabled:!1,addBillButton:!0,handleEditRow:Pt,handleRightSegment:pt,setTableData:O,setEditRowId:ce,getBillSummarydata:Fe,refreshBillsList:He}),D&&D?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-py-3 hfl-text-Gray-700",children:["Old Bill"," "]}),e.jsxRuntimeExports.jsx(kl,{tableBodyData:D,tableData:D,isDisabled:!0,addBillButton:!1,handleEditRow:Pt,handleRightSegment:pt,setTableData:O,setEditRowId:ce,getBillSummarydata:()=>{},refreshBillsList:()=>{}})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:" mt-2 hfl-sticky hfl-bottom-0 hfl-w-full",children:k&&e.jsxRuntimeExports.jsx(ta,{})})]})}),e.jsxRuntimeExports.jsxs(El,{tab:"add_bills",children:[W===ht[0]&&e.jsxRuntimeExports.jsx(sa,{summaryData:_e,date:h,rightSegment:W,handleRightSegment:pt,billSummaryClicked:(T,De,qe)=>Gt(T,De,qe),showDiscount:!1,showRefund:!1,handleServiceItem:H,pastDueData:M,getBillSummarydata:Fe,refreshBillsList:He,getPastDueAmount:_t,walletBalance:Y,setRefreshWallet:ie}),W===ht[1]&&e.jsxRuntimeExports.jsx(Nl,{bill_date:h,rightSegment:W,serviceDetails:g?.bill_list.find(T=>T.service_category.toLowerCase()===j.toLowerCase())?.order_items??[],categorySummaryData:_e?.bill_summary[`${Ct.indexOf(j)+1}`],serviceItem:j,handleRightSegment:pt,getBillSummarydata:Fe,refreshBillsList:He,getPastDueAmount:_t,walletBalance:Y,setRefreshWallet:ie,closePrintModal:i}),W===ht[2]&&e.jsxRuntimeExports.jsx(aa,{bill_date:h,handleRightSegment:pt,getBillSummarydata:Fe,editedTableData:X?.[re],setTableData:O,editRowId:re,handleRevertEdit:ke,refreshBillsList:He,checkAppointmentForBilling:xt}),W===ht[4]&&e.jsxRuntimeExports.jsx(ia,{order_date:h,handleRightSegment:pt,getBillSummarydata:Fe,editedTableData:X?.[re],setTableData:O,editRowId:re,refreshBillsList:He,handleRevertEdit:ke}),W===ht[3]&&e.jsxRuntimeExports.jsx(la,{order_date:h,handleRightSegment:pt,editedTableData:X?.[re],getBillSummarydata:Fe,setTableData:O,editRowId:re,refreshBillsList:He,handleRevertEdit:ke}),W===ht[7]&&e.jsxRuntimeExports.jsx(Al,{depositAmount:Y,handleRightSegment:pt,rightSegment:W,setRefreshWallet:ie})]})]})},bl=i=>{const{appointments:d,isDisabled:c,handleAppointData:n,leftNav:y,today:R}=i,l=v.useCallback(N=>{n(N)},[n]),I=v.useMemo(()=>[{Header:"Date",accessor:"appnt_date",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[130px] hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:` ${c?"":"hfl-rounded-sm hfl-bg-Success-50 hfl-px-2 hfl-text-Success-600"} `,children:Te.dayjs(N?.original?.appnt_date).format("DD-MMM-YYYY")})})},{Header:"Time",accessor:"appnt_time",Cell:({row:N})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:" ",children:N?.original?.appnt_time&&new Date("1970-01-01T"+N?.original?.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"})})},{Header:"Status",accessor:"appnt_status",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:" hfl-flex hfl-w-[100px] hfl-items-center hfl-justify-center focus:hfl-outline-none",children:e.jsxRuntimeExports.jsx(e.bs,{className:" hfl-flex hfl-w-[100px] hfl-items-center focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:xl.find(P=>P.value==N?.original?.appnt_status)?.text})})},{Header:"Doctor",accessor:"appnt_doctor_name",Cell:({row:N})=>e.jsxRuntimeExports.jsx(e.bs,{className:" hfl-flex hfl-w-[316px] hfl-items-center hfl-capitalize focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:"Dr. "+N.original.appnt_doctor_name})},{Header:"Type",accessor:"order_unit_item_price",Cell:()=>e.jsxRuntimeExports.jsx(e.bs,{className:" hfl-flex hfl-w-[100px] hfl-items-center focus:hfl-outline-none",variant:"Regular",type:"Text sm",children:"In-Person"})},{Header:"Service",accessor:"appnt_service_name",Cell:({row:N})=>e.jsxRuntimeExports.jsx("div",{className:" [100px] hfl-flex hfl-items-center hfl-justify-center ",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-w-[116px] hfl-items-center hfl-capitalize",children:N.original.appnt_service_name})})},{Header:"Bill",accessor:"total_price",Cell:({row:N})=>N.original.order_item_id!=0||c||y!="today"?e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-text-Error-500 ",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-w-[106px] hfl-items-center",children:N.original.total_price})]}):e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"sm",textField:"",icon:"Left",iconFile:"hx_rupee-bill-filled hfl-text-3",onClick:()=>{l(N.original)},children:"Add Bill"})},{Header:"",accessor:"edit",Cell:({row:N})=>e.jsxRuntimeExports.jsx("i",{className:` ${c?"hfl-text-White":""} ${y==="today"&&"hx_edit"} hfl-p-4 hfl-text-Primary-700 `,onClick:()=>{y==="today"&&l(N.original)},"data-qa":"edit-icon"})}],[l,c,y]),S=v.useMemo(()=>d||[],[d]),{getTableProps:h,getTableBodyProps:V,headerGroups:g,rows:L,prepareRow:W}=$r.useTable({columns:I,data:S}),z=N=>{const P=[];return N?.headers?.length&&N.headers.map(A=>{P.push(e.jsxRuntimeExports.jsx("th",{...A.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:A.render("Header")})}))}),P},D=()=>{const N=[];return L.map((P,A)=>{W(P),N.push(e.jsxRuntimeExports.jsx("tr",{"data-qa":A+1+"",...P.getRowProps(),className:`${P?.original?.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200 ${c?"hfl-bg-Gray-100":""}`,children:P.cells.map(j=>e.jsxRuntimeExports.jsx("td",{"data-qa":A+1+"-"+j.column.id,...j.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:`${P?.original?.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:j.render("Cell")})}))}))}),N};return e.jsxRuntimeExports.jsx("div",{className:`${c?" hfl-pointer-events-none":"hfl-cursor-pointer"} ${R?" hfl-h-[500px] hfl-overflow-y-scroll":""} `,children:d&&e.jsxRuntimeExports.jsxs("table",{...h(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:g.map(N=>e.jsxRuntimeExports.jsx("tr",{...N.getHeaderGroupProps(),className:"hfl-h-9 hfl-rounded-lg hfl-bg-Blue_gray-50 hfl-py-2",children:z(N)}))}),e.jsxRuntimeExports.jsx("tbody",{...V(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:D()})]})})},Xr=i=>{const{currentPage:d,totalRecord:c,handleLoadMore:n,isLoading:y=!1,currentTotal:R}=i;return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!y&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-text-Gray-500",children:`1 — ${R} of ${c} results`}),R!==c?e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-text-Blue-^00 hfl-flex hfl-justify-center",hierarchy:"Link-Colour",size:"lg",textField:"Load more... ",onClick:()=>n(d)}):e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",className:"hfl-text-Gray-500",children:"End of List"})]}),y&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.Eu,{size:"xxs",progress:10,spinnerMode:!0})})]})},fa=i=>{const{handleAddNewAppnt:d,handleAppointData:c,sortAppointments:n}=i,[y,R]=v.useState(),[l,I]=v.useState(1),[S,h]=v.useState([]),[V,g]=v.useState([]),[L,W]=v.useState(""),{patientIDs:z,setLoading:D,variable:N}=v.useContext(Tt),P=async A=>{let j=A;if(D(!0),j<=Math.ceil((y?.total_records||0)/10)){if(j=A+1,j!==A){const Q=await Ts("all",z?.patientRoleID||"",j,10,!1,N);h(M=>[...M,...Q.appointments.filter(G=>G.appnt_date>=Te.dayjs(new Date).format("YYYY-MM-DD"))]),g(M=>[...M,...Q.appointments.filter(G=>G.appnt_date<Te.dayjs(new Date).format("YYYY-MM-DD"))])}I(j)}D(!1)};return v.useEffect(()=>{D(!0);const A=async()=>{try{const j=await Ts("all",z?.patientRoleID||"",1,10,!1,N);j&&(R(j),h(j?.appointments?.filter(Q=>Q.appnt_date>=Te.dayjs(new Date).format("YYYY-MM-DD"))),g(j?.appointments?.filter(Q=>Q.appnt_date<Te.dayjs(new Date).format("YYYY-MM-DD")))),W(j?.appointments?.length?"":"No Appointment")}catch{console.log("error in getAppointmentsList API Call")}};D(!1),A()},[z?.patientRoleID,D,N]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-max-h-[550px] hfl-w-full hfl-flex-col hfl-overflow-y-scroll",children:[S.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-justify-between hfl-px-3 hfl-py-2 ",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"",children:"Upcoming Appointments"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"new-appointment",hierarchy:"Primary",size:"md",className:"text",icon:"Left",iconFile:"hx_add-circle",textField:"New Appointment",onClick:d})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ",children:e.jsxRuntimeExports.jsx(bl,{appointments:n(S),handleAppointData:c})})]}),V.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-w-full hfl-items-center hfl-px-3 hfl-py-2 hfl-pt-4 ",children:"Past Appointments"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 hfl-pb-4 xxs:max-md:hfl-w-[885px] xxs:max-md:hfl-overflow-y","data-qa":"all-appoint-table",children:e.jsxRuntimeExports.jsx(bl,{isDisabled:!0,appointments:V,handleAppointData:c})})]})]}),V.length>0||S.length>0?e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Xr,{currentPage:l,totalRecord:y?.total_records||0,currentTotal:l===Math.ceil((y?.total_records||0)/10)?y?.total_records||0:l*10,handleLoadMore:P})}):e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-w-full hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",children:L})})]})},ha=()=>{const{showToast:i,patientDetails:d,doctorListArr:c,serviceListArr:n,patientIDs:y,setLoading:R,billPreferences:l,docPreference:I,formattedService:S,ppEventProps:h,getAndSetServiceListArr:V,variable:g}=v.useContext(Tt),[L,W]=v.useState(g.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length?!0:l?.billing?.prepaid_consultation!=="1"),[z,D]=v.useState("today"),[N,P]=v.useState(!1),[A,j]=v.useState([]),Q=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),M=v.useMemo(()=>c?.doctor_list?.length===1?c.doctor_list[0]:{doctor_name:"",doctor_identifier:""},[c]),G=v.useMemo(()=>({...Ol,deleted:!1,appnt_date:Te.dayjs().format("YYYY-MM-DD"),appnt_doctor_name:g.window_var.role_id=="11"?g.window_var.doc_name_for_seg:M?.doctor_name,appnt_doctor_role_id:g.window_var.role_id=="11"?g.window_var.doctor_role_id_for_seg:M?.doctor_identifier,appnt_duration:l?.print?.bill?.appnt_minute_slab||"",appnt_time_time:Q?.split(" ")[0]||"",appnt_time_format:Q?.split(" ")[1]||"",total_price:"0",order_item_service_tax_percentage:0,order_item_service_tax:"0",item_quantity:"1",order_unit_item_price:"0",order_item_price:"0",order_id:"",order_date:"",order_created_on:"",service_category:"",service_category_id:"",order_id_str:"",order_total:"",order_paid_amount:"",order_item_sum_discount:"",order_discount:"",refund_amount:"",order_service_tax:"",balance_amount:"",net_bill_amount:"",service_id:"",service_name:"",order_item_service_tax_percent:"",created_on:"",net_amount:""}),[l?.print?.bill?.appnt_minute_slab,Q,M?.doctor_identifier,M?.doctor_name,g.window_var.doc_name_for_seg,g.window_var.doctor_role_id_for_seg,g.window_var.role_id]),[k,$]=v.useState(G),[X,O]=v.useState(!1);v.useEffect(()=>{W(g.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?!0:l?.billing?.prepaid_consultation!=="1")},[N,l,z,d,g.window_var?.partner_service_enabled]),v.useEffect(()=>{O(T=>L&&T)},[L]),v.useEffect(()=>{if(!+k?.order_item_id&&!k?.order_unit_item_price){const T=S?.[k.appnt_service_id];T&&$(De=>({...De,order_unit_item_price:T.price.toString(),item_quantity:"1",order_item_discount:"0",order_item_service_tax_percentage:T?.service_tax||0}))}},[L,N,k.order_item_id,k.order_unit_item_price,k.appnt_service_id,S]);const re=v.useCallback(T=>{const{order_unit_item_price:De=0,item_quantity:qe=0,order_item_discount:ae=0,appnt_service_id:J}=T;if(!J)return;let K=0;const oe=S?.[J]?.service_tax||0;let Be=0;if(Number(De)>0&&Number(qe)>0){const Pe=Number(De)*Number(qe);K=Math.floor(Pe*.01*oe),Be=Pe+K-Number(ae)}$(Pe=>({...Pe,order_item_service_tax:K.toString(),order_item_price:Be.toString()}))},[S]),ce=v.useMemo(()=>[{...k,order_item_service_tax:Math.floor(+k.order_item_service_tax).toString()}],[k]),_e=T=>{Rt();const De=new Date(`1970-01-01T${T.appnt_time}Z`).toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});$(qe=>({...qe,...T,appnt_time_time:De?.split(" ")[0]??"",appnt_time_format:De?.split(" ")[1]??"",order_item_service_tax_percentage:S?.[T.appnt_service_id]?.service_tax||0,order_item_price:T.total_price.toString(),deleted:!1}))},xe=(T,De)=>{if(T==="appnt_service_name"){const{appnt_service_name:qe,appnt_service_id:ae,order_item_discount:J,order_unit_item_price:K,item_quantity:oe,order_item_service_tax_percentage:Be}=De,Pe={...k,appnt_service_name:qe,appnt_service_id:ae,order_unit_item_price:K,item_quantity:oe,order_item_discount:J,order_item_service_tax_percentage:Be};$(Pe),re(Pe)}else T==="appnt_date"&&De>Te.dayjs().format("YYYY-MM-DD")&&(W(!0),L||i("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),$(qe=>({...qe,[T]:De}))},Ve=()=>{W(T=>!T)},ie=()=>{O(T=>!T)},Y=(T,De)=>{$(qe=>({...qe,[De]:T}))};v.useEffect(()=>{re(k)},[k.order_unit_item_price,k.item_quantity,k.order_item_discount,re,k]);const fe=T=>[...T].sort((De,qe)=>new Date(De.appnt_date).getTime()-new Date(qe.appnt_date).getTime()),H=v.useMemo(()=>[{Header:"Unit Price",accessor:"order_unit_item_price",Cell:({row:T})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),I?.permissions?.edit_service_unit_price?e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:T?.original?.order_unit_item_price,onChange:De=>Y(De.target.value,"order_unit_item_price")}):e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:T?.original?.order_unit_item_price})]})},{Header:"Qty",accessor:"item_quantity",Cell:({row:T})=>e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:T?.original?.item_quantity,onChange:De=>Y(De.target.value,"item_quantity")})},{Header:"Discount",accessor:"order_item_discount",Cell:({row:T})=>e.jsxRuntimeExports.jsx("input",{type:"text",className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:T?.original?.order_item_discount,onChange:De=>Y(De.target.value,"order_item_discount")})},{Header:"GST in %",accessor:"order_item_service_tax_percentage",Cell:({row:T})=>{const De=Number(T?.original?.appnt_service_id||"0");return e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center focus:hfl-outline-none",value:S?.[De]?.service_tax||0,readOnly:!0})}},{Header:"GST In Rs",accessor:"order_item_service_tax",Cell:({row:T})=>e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center",value:T?.original?.order_item_service_tax,readOnly:!0})},{Header:"Net Price",accessor:"order_item_price",Cell:({row:T})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-text-Error-500 ",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),e.jsxRuntimeExports.jsx("input",{type:"number",className:"hfl-pointer-events-none hfl-flex hfl-w-[120px] hfl-items-center",value:T?.original?.order_item_price,readOnly:!0})]})}],[I?.permissions?.edit_service_unit_price,S]),Ce=v.useMemo(()=>ce,[ce]),{getTableProps:Fe,getTableBodyProps:ke,headerGroups:xt,rows:He,prepareRow:st}=$r.useTable({columns:H,data:Ce}),_t=T=>{const De=[];return T?.headers?.length&&T.headers.map(qe=>{De.push(e.jsxRuntimeExports.jsx("th",{...qe.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Indigo-600",children:qe.render("Header")})}))}),De},pt=()=>{const T=[];return He.map((De,qe)=>{st(De),T.push(e.jsxRuntimeExports.jsx("tr",{id:qe.toString(),...De.getRowProps(),className:`${De?.original?.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200`,children:De.cells.map(ae=>e.jsxRuntimeExports.jsx("td",{"data-qa":qe+1+"-"+ae.column.id,...ae.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:`${De?.original?.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:ae.render("Cell")})}))}))}),T},Pt=(T,De,qe)=>e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[60px] hfl-flex-col hfl-items-center hfl-rounded hfl-px-1 hfl-py-2 hfl-text-center ${z===T?"hfl-bg-Primary-50 hfl-text-Primary-600":""} hfl-cursor-pointer`,onClick:()=>D(T),"data-qa":T,children:[e.jsxRuntimeExports.jsx("div",{className:De}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:qe})]},T),Rt=v.useCallback(()=>{D("today"),$(G),P(!0)},[G]),Dt=v.useCallback(async()=>{R(!0);try{const T=await Ts(z=="today"?Te.dayjs().format("YYYY-MM-DD"):"all",y?.patientRoleID||"",1,z=="today"?100:10,!1,g);j(T?.appointments?.filter(De=>De.appnt_date===Te.dayjs().format("YYYY-MM-DD"))),T.appointments.length===0&&Rt(),R(!1)}catch{R(!1),console.log("error in getAppointmentsList API Call")}},[Rt,z,y?.patientRoleID,R,g]);v.useEffect(()=>{N||Dt()},[N,Dt]),v.useEffect(()=>{z==="today"&&Dt()},[Dt,z]);const Gt=async()=>{k.appnt_date>Te.dayjs().format("YYYY-MM-DD")&&(W(!0),L||i("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),await ql(k,L||k.appnt_date>Te.dayjs().format("YYYY-MM-DD"),i,d,y,h,X,!1,g)&&P(!1)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-4 hfl-border-r-1 hfl-border-Gray-200 hfl-bg-Gray-50 hfl-px-1 hfl-py-2",children:[Pt("today","hx_calendar-add hfl-text-5","Today's Appts"),Pt("all","hx_calendar hfl-text-5","All Appts")]}),z==="today"&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto",children:A.length<=0||N?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 hfl-self-stretch hfl-bg-Gray-100 hfl-p-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-flex-1",children:k.appnt_id.length?"Update Appointment":"New Appointment"}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{P(!1)},"data-qa":"close-new-ppointment"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-item-center hfl-flex hfl-flex-col hfl-gap-4",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[739px] hfl-flex-wrap hfl-content-start hfl-items-start hfl-gap-6",children:[e.jsxRuntimeExports.jsx(e.ej,{label:"Doctor Name",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",input1value:"Dr.",input2value:k.appnt_doctor_name,end_icon:"hx_down hfl-bg-White_20",inputProps:{disabled:!0},suffixInputProps:{placeholder:"Doctor Name"},className:"hfl-relative hfl-w-12 hfl-flex-none hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500",suffixClassName:" hfl-w-[270px] hfl-text-ellipsis hfl-bg-White_20",suffixDropdownClassName:"hfl-ml-12",suffixOptions:c?.doctor_list?.map(T=>({label:T.doctor_name,value:T.doctor_name,appnt_doctor_role_id:T.doctor_identifier})),handleSuffixValChange:T=>{xe("appnt_doctor_name",T),xe("appnt_doctor_role_id","")},onSuffixDropdownClick:T=>{xe("appnt_doctor_name",T.label),xe("appnt_doctor_role_id",T.appnt_doctor_role_id)}}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[350px] hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Date & Time of Appointment"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-gap-2 ",children:[e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",height:"!hfl-h-[40px]",selectDate:new Date(Te.dayjs(k.appnt_date).format("DD-MMM-YYYY")),dateVar:T=>{xe("appnt_date",Te.dayjs(T).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.ej,{className:"hfl-w-24",suffixClassName:"hfl-w-10 ",suffixDropdownClassName:"hfl-ml-[96px]",input1value:k?.appnt_time_time||"",input2value:k?.appnt_time_format||"",end_icon:"hx_down",classNamedoubleInput:"hfl-relative",inputProps:{placeholder:"10:00",onBlur:T=>{xe("appnt_time_time",T.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:T=>{xe("appnt_time_format",T.value)}})]})]}),k.appnt_id.length>1&&k.order_item_id.length>1?e.jsxRuntimeExports.jsx(e.ej,{label:"Service",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hfl-bg-White_20",input2value:k.appnt_service_name,inputProps:{disabled:!0},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",disabled:!0},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500 ",classNamedoubleInput:"hfl-relative",suffixClassName:" hfl-border-l-0 hfl-w-[318px] hfl-text-ellipsis hfl-bg-White_20"}):e.jsxRuntimeExports.jsx(e.ej,{label:"Service",labelSize:"Text sm",labelColor:"hfl-text-Gray-800",end_icon:"hx_down hfl-bg-White_20",input2value:k.appnt_service_name,inputProps:{disabled:!1},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",onClick:async()=>{n?.service_list?.length||V()}},className:"hfl-hidden hfl-w-12 hfl-text-ellipsis hfl-bg-Gray-50 hfl-text-Gray-500 ",classNamedoubleInput:"hfl-relative",suffixClassName:"hfl-border-l-0 hfl-w-[318px] hfl-text-ellipsis hfl-bg-White_20",suffixOptions:n?.service_list?.filter(T=>T.service_category==="Doctor consultation")?.map(T=>({label:T.service_name,value:T.service_name,appnt_service_id:T.service_identifier,order_unit_item_price:T.price,item_quantity:1,order_item_discount:T.order_item_discount||0,order_item_service_tax_percentage:T.service_tax,appnt_service_name:T.service_name})),handleSuffixValChange:T=>{xe("appnt_service_name",{appnt_service_name:T})},onSuffixDropdownClick:T=>{xe("appnt_service_name",T)}}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ar.find(T=>T.value==Number(k.appnt_duration))?.label||"",value:k.appnt_duration},label:"Duration",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:T=>{xe("appnt_duration",T.value)},options:Ar,"data-qa":"time picker"}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:xl.find(T=>T.value==k?.appnt_status)?.text||""},label:"Booking Status",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:T=>{xe("appnt_status",T.value)},options:xl.map(T=>({label:T.text,value:T.value})),"data-qa":"click-status"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[350px] hfl-flex-col hfl-gap-1.5",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:"Type"}),e.jsxRuntimeExports.jsx(e.ju,{options:[{start_icon:"hx_inperson hfl-text-3",label:"In-Person",value:"inperson"}],disabled:!1,value:"inperson","data-qa":"data-type"})]}),g.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length&&e.jsxRuntimeExports.jsx(e.Os,{size:"md",disabled:!1,isMarked:X,text:"Partner Enabled",onClick:ie,"data-qa":"skip-billing"}),!+k?.order_item_id&&e.jsxRuntimeExports.jsx(e.Os,{size:"md",disabled:!1,isMarked:L,text:"Skip Billing",onClick:Ve,"data-qa":"skip-billing"})]}),!L||+k?.order_item_id?e.jsxRuntimeExports.jsx("div",{className:`${+k?.appnt_id&&+k?.order_item_id?"hfl-pointer-events-none":""}`,children:e.jsxRuntimeExports.jsxs("table",{...Fe(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:xt.map(T=>e.jsxRuntimeExports.jsx("tr",{...T.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50",children:_t(T)}))}),e.jsxRuntimeExports.jsx("tbody",{...ke(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:pt()})]})}):"",e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"No",className:"hfl-w-[150px] hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{P(!1)},"data-qa":"cancel"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:k.appnt_id.length?"Update Appointment":"Book Appointment",icon:"No",onClick:Gt,className:"hfl-w-[150px] hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800","data-qa":"book-appointment"})]})]})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-flex-col",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-center hfl-justify-between hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",children:"Today’s Appointments"}),e.jsxRuntimeExports.jsx(e.Ku,{"data-qa":"new-appointment",hierarchy:"Primary",size:"md",className:"text",icon:"Left",iconFile:"hx_add-circle",textField:"New Appointment",onClick:Rt})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ","data-qa":"appointment-table",children:e.jsxRuntimeExports.jsx(bl,{today:!0,leftNav:z,appointments:fe(A),handleAppointData:_e})})]})}),z==="all"&&e.jsxRuntimeExports.jsx(fa,{sortAppointments:fe,handleAddNewAppnt:Rt,handleAppointData:_e})]})},pa=({columns:i,data:d})=>{const{getTableProps:c,getTableBodyProps:n,headerGroups:y,rows:R,prepareRow:l}=$r.useTable({columns:i,data:d}),I=h=>{const V=[];return h?.headers?.length&&h.headers.map(g=>{V.push(e.jsxRuntimeExports.jsx("th",{...g.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:g.render("Header")})}))}),V},S=()=>{const h=[];return R.map((V,g)=>{l(V),h.push(e.jsxRuntimeExports.jsx("tr",{id:g.toString(),...V.getRowProps(),className:`${V.original.appnt_status===1?"hfl-bg-Gray-50 hfl-text-Gray-400 hover:hfl-bg-White hover:hfl-text-Gray-500":"hfl-bg-White"} hfl-group hfl-border-t-1 hfl-border-Gray-200`,children:V.cells.map((L,W)=>e.jsxRuntimeExports.jsx("td",{"data-qa":g+1+"-"+(W+1),...L.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:`hfl-text-[13px] ${V.original.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:L.render("Cell")})}))}))}),h};return e.jsxRuntimeExports.jsx("div",{className:"hfl-max-h-[55vh] hfl-overflow-y-auto xxs:max-md:hfl-overflow-x-auto hfl-overflow-x-hidden","data-qa":"past-visit-table",children:e.jsxRuntimeExports.jsxs("table",{...c(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:y.map(h=>e.jsxRuntimeExports.jsx("tr",{...h.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50 ",children:I(h)}))}),e.jsxRuntimeExports.jsx("tbody",{...n(),className:"hfl-rounded-",children:S()})]})})},ma="data:image/svg+xml,%3csvg%20width='87'%20height='86'%20viewBox='0%200%2087%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='43.5'%20cy='83.42'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M17.179%2014.1224C16.5958%2013.0118%2015.2122%2012.5787%2014.0887%2013.1552C12.9651%2013.7317%2012.5271%2015.0994%2013.1102%2016.21L15.2825%2020.347C15.8657%2021.4576%2017.2493%2021.8906%2018.3729%2021.3141C19.4964%2020.7377%2019.9345%2019.37%2019.3513%2018.2593L17.179%2014.1224ZM14.8903%2014.6818C15.1609%2014.543%2015.4942%2014.6473%2015.6346%2014.9148L17.8069%2019.0517C17.9474%2019.3193%2017.8419%2019.6487%2017.5712%2019.7875C17.3006%2019.9264%2016.9674%2019.8221%2016.8269%2019.5546L14.6546%2015.4176C14.5141%2015.1501%2014.6196%2014.8207%2014.8903%2014.6818ZM22.9352%2024.0112C20.0523%2024.0112%2017.7152%2026.3214%2017.7152%2029.1712V65.3801C17.7152%2068.2299%2020.0523%2070.5401%2022.9352%2070.5401H57.7352C60.6181%2070.5401%2062.9552%2068.2299%2062.9552%2065.3801V59.7953C59.3146%2057.7135%2056.8652%2053.8225%2056.8652%2049.366C56.8652%2044.9095%2059.3146%2041.0186%2062.9552%2038.9368V29.1712C62.9552%2026.3214%2060.6181%2024.0112%2057.7352%2024.0112H54.1652V25.3157C54.1652%2027.6905%2052.2177%2029.6157%2049.8152%2029.6157H32.5952C30.1928%2029.6157%2028.2452%2027.6905%2028.2452%2025.3157V24.0112H22.9352ZM64.6952%2038.1166V29.1712C64.6952%2025.3714%2061.5791%2022.2912%2057.7352%2022.2912H46.2996C45.7087%2020.0557%2043.6519%2018.406%2041.2052%2018.406C38.7586%2018.406%2036.7018%2020.0557%2036.1109%2022.2912H22.9352C19.0913%2022.2912%2015.9752%2025.3714%2015.9752%2029.1712V65.3801C15.9752%2069.1798%2019.0913%2072.2601%2022.9352%2072.2601H57.7352C61.5791%2072.2601%2064.6952%2069.1798%2064.6952%2065.3801V60.6155C66.0461%2061.1262%2067.5126%2061.406%2069.0452%2061.406C75.772%2061.406%2081.2252%2056.0155%2081.2252%2049.366C81.2252%2042.7165%2075.772%2037.326%2069.0452%2037.326C67.5126%2037.326%2066.0461%2037.6058%2064.6952%2038.1166ZM6.33244%2020.881C6.89862%2019.7618%208.27544%2019.3082%209.40766%2019.8679L13.625%2021.9526C14.7572%2022.5123%2015.2161%2023.8733%2014.6499%2024.9925C14.0837%2026.1117%2012.7069%2026.5652%2011.5747%2026.0056L7.35734%2023.9209C6.22512%2023.3612%205.76626%2022.0002%206.33244%2020.881ZM8.62943%2021.4063C8.35671%2021.2715%208.02508%2021.3807%207.8887%2021.6503C7.75233%2021.9199%207.86286%2022.2477%208.13557%2022.3825L12.3529%2024.4672C12.6256%2024.602%2012.9572%2024.4928%2013.0936%2024.2232C13.23%2023.9536%2013.1195%2023.6258%2012.8468%2023.491L8.62943%2021.4063ZM36.2851%2041.3145C36.2851%2040.127%2037.2589%2039.1645%2038.4601%2039.1645H53.2501C54.4513%2039.1645%2055.4251%2040.127%2055.4251%2041.3145C55.4251%2042.5019%2054.4513%2043.4645%2053.2501%2043.4645H38.4601C37.2589%2043.4645%2036.2851%2042.5019%2036.2851%2041.3145ZM38.4601%2049.2325C37.2589%2049.2325%2036.2851%2050.1951%2036.2851%2051.3825C36.2851%2052.5699%2037.2589%2053.5325%2038.4601%2053.5325H53.2501C54.4513%2053.5325%2055.4251%2052.5699%2055.4251%2051.3825C55.4251%2050.1951%2054.4513%2049.2325%2053.2501%2049.2325H38.4601ZM38.0251%2051.3825C38.0251%2051.145%2038.2199%2050.9525%2038.4601%2050.9525H53.2501C53.4903%2050.9525%2053.6851%2051.145%2053.6851%2051.3825C53.6851%2051.62%2053.4903%2051.8125%2053.2501%2051.8125H38.4601C38.2199%2051.8125%2038.0251%2051.62%2038.0251%2051.3825ZM36.2851%2061.9099C36.2851%2060.7225%2037.2589%2059.7599%2038.4601%2059.7599H53.2501C54.4513%2059.7599%2055.4251%2060.7225%2055.4251%2061.9099C55.4251%2063.0974%2054.4513%2064.0599%2053.2501%2064.0599H38.4601C37.2589%2064.0599%2036.2851%2063.0974%2036.2851%2061.9099ZM38.4601%2061.4799C38.2199%2061.4799%2038.0251%2061.6725%2038.0251%2061.9099C38.0251%2062.1474%2038.2199%2062.3399%2038.4601%2062.3399H53.2501C53.4903%2062.3399%2053.6851%2062.1474%2053.6851%2061.9099C53.6851%2061.6725%2053.4903%2061.4799%2053.2501%2061.4799H38.4601ZM26.5647%2040.5435C26.5647%2039.1186%2027.7333%2037.9635%2029.1747%2037.9635H30.5547C31.9962%2037.9635%2033.1647%2039.1186%2033.1647%2040.5435V41.9076C33.1647%2043.3325%2031.9962%2044.4876%2030.5547%2044.4876H29.1747C27.7333%2044.4876%2026.5647%2043.3325%2026.5647%2041.9076V40.5435ZM29.1747%2048.0315C27.7333%2048.0315%2026.5647%2049.1866%2026.5647%2050.6115V51.9757C26.5647%2053.4006%2027.7333%2054.5557%2029.1747%2054.5557H30.5547C31.9962%2054.5557%2033.1647%2053.4006%2033.1647%2051.9757V50.6115C33.1647%2049.1866%2031.9962%2048.0315%2030.5547%2048.0315H29.1747ZM28.3047%2050.6115C28.3047%2050.1366%2028.6942%2049.7515%2029.1747%2049.7515H30.5547C31.0352%2049.7515%2031.4247%2050.1366%2031.4247%2050.6115V51.9757C31.4247%2052.4506%2031.0352%2052.8357%2030.5547%2052.8357H29.1747C28.6942%2052.8357%2028.3047%2052.4506%2028.3047%2051.9757V50.6115ZM26.5647%2061.139C26.5647%2059.7141%2027.7333%2058.559%2029.1747%2058.559H30.5547C31.9962%2058.559%2033.1647%2059.7141%2033.1647%2061.139V62.5031C33.1647%2063.928%2031.9962%2065.0831%2030.5547%2065.0831H29.1747C27.7333%2065.0831%2026.5647%2063.928%2026.5647%2062.5031V61.139ZM29.1747%2060.279C28.6942%2060.279%2028.3047%2060.664%2028.3047%2061.139V62.5031C28.3047%2062.9781%2028.6942%2063.3631%2029.1747%2063.3631H30.5547C31.0352%2063.3631%2031.4247%2062.9781%2031.4247%2062.5031V61.139C31.4247%2060.664%2031.0352%2060.279%2030.5547%2060.279H29.1747ZM58.6052%2049.366C58.6052%2043.6665%2063.2793%2039.046%2069.0452%2039.046C74.811%2039.046%2079.4852%2043.6665%2079.4852%2049.366C79.4852%2055.0656%2074.811%2059.686%2069.0452%2059.686C63.2793%2059.686%2058.6052%2055.0656%2058.6052%2049.366ZM66.8702%2043.776C66.8702%2042.5886%2067.844%2041.626%2069.0452%2041.626C70.2464%2041.626%2071.2202%2042.5886%2071.2202%2043.776V48.936C71.2202%2050.1235%2070.2464%2051.086%2069.0452%2051.086C67.844%2051.086%2066.8702%2050.1235%2066.8702%2048.936V43.776ZM69.0452%2043.346C68.8049%2043.346%2068.6102%2043.5386%2068.6102%2043.776V48.936C68.6102%2049.1735%2068.8049%2049.366%2069.0452%2049.366C69.2854%2049.366%2069.4802%2049.1735%2069.4802%2048.936V43.776C69.4802%2043.5386%2069.2854%2043.346%2069.0452%2043.346ZM69.0452%2057.106C67.844%2057.106%2066.8702%2056.1435%2066.8702%2054.956C66.8702%2053.7686%2067.844%2052.806%2069.0452%2052.806C70.2464%2052.806%2071.2202%2053.7686%2071.2202%2054.956C71.2202%2056.1435%2070.2464%2057.106%2069.0452%2057.106ZM68.6102%2054.956C68.6102%2055.1935%2068.8049%2055.386%2069.0452%2055.386C69.2854%2055.386%2069.4802%2055.1935%2069.4802%2054.956C69.4802%2054.7186%2069.2854%2054.526%2069.0452%2054.526C68.8049%2054.526%2068.6102%2054.7186%2068.6102%2054.956Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",xa=({closePrintModal:i,setLatestMetaData:d,setInvestigationDropdown:c,setCustomTranslations:n,getVisitpadPreferenceHandler:y,updateVPPrefUsingDocPref:R})=>{const{patientIDs:l,setShowPrintModal:I,setEndConsultationClicked:S,preferences:h,variable:V}=v.useContext(Tt),[g,L]=v.useReducer((X,O)=>({...X,...O}),{currentPage:1,totalRecord:0,pastVisits:[],isVisitLoading:!1}),{pastVisits:W,currentPage:z,isVisitLoading:D,totalRecord:N}=g,P=v.useCallback(async X=>{if(l?.patientRoleID)try{L({isVisitLoading:!0});const O=await gn(tn,X,l.patientRoleID,V),re=O?.visits??[];L({currentPage:X,pastVisits:X===1?re:[...W,...re],isVisitLoading:!1,totalRecord:+O.total_visit_count})}catch(O){console.error("Failed to fetch visits:",O),L({isVisitLoading:!1})}},[l?.patientRoleID]),A=v.useCallback(async(X,O,re=!0)=>{if(l?.patientRoleID){i(),L({isVisitLoading:!0});try{const _e=(await mn(X.original.visit_date,l.patientRoleID,X.original.visit_id,V))?.visits?.[0];if(!_e)throw new Error("Visit details not found.");let xe=null;const{doctor_id:Ve="",doctor_role_id:ie=""}=_e;V.window_var.doctor_role_id_for_seg!==ie?xe=await y({doc_id:Ve,doc_rid:ie}):h&&await R(h,h.printDefaultPrefIndex,ie,!1),d(_e.latest_visit_metadata||{}),I({printDataFrom:"patient_popup",visible:!0,whichPreview:"offlinePrint",printData:"",visitId:_e.visit_id,visit_date:_e.visit_date,visit_number:N-X.index,currentPrintTime:0,printType:"visit",details:_e,visitpadPref:xe,appointmentInfo:{appnt_id:X.original.appnt_id||"",appnt_type:X.original.appnt_type||""},trackEventHandler:()=>{}}),S(re)}catch(ce){console.error("Failed to prepare print data:",ce)}finally{L({isVisitLoading:!1})}}},[i,y,V,l.patientRoleID,h,S,d,I,R,N]),j=v.useCallback(async()=>{try{const X=await In(V),O={};X.transalation_records.forEach(re=>{O[re.language]=re}),n(O)}catch(X){console.error("Failed to get custom translations:",X)}},[n,V]),Q=v.useCallback(async()=>{try{const X=await Bn(V);if(X?.test_ranges){const O=X.test_ranges.map(re=>({test_id:re.test_id,test_names:re.test_names,test_range_rule:re.test_range_rule,test_range_text:re.test_range_text,test_units:re.test_units,value:re.test_names}));c(O)}}catch(X){console.error("Failed to get investigation test names:",X)}},[c,V]);v.useEffect(()=>{P(1),j(),Q()},[j,Q]);const M=v.useMemo(()=>({visit_date:"100px",doctor_name:"350px",appnt_type:"100px",service_name:"150px",view:"250px"}),[]),G=v.useMemo(()=>[{Header:"Date",accessor:"visit_date",Cell:({row:X})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${M.visit_date}]`,children:X.original.visit_date?Te.dayjs(X.original.visit_date).format("DD-MMM-YYYY"):"N/A"})},{Header:"Doctor",accessor:"doctor_name",Cell:({row:X})=>e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${M.doctor_name}]`,children:["Dr. ",X.original.doctor_name||"N/A"]})},{Header:"Type",accessor:"appnt_type",Cell:({row:X})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${M.appnt_type}]`,children:X.original.appnt_type||"N/A"})},{Header:"Service",accessor:"service_name",Cell:({row:X})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${M.service_name}]`,children:X.original.service_name||"N/A"})},{Header:"Prescription",id:"view",Cell:({row:X})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-2 hfl-my-1 hfl-flex hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Print",iconFile:"hx_print",icon:"Left",onClick:()=>A(X,"VISIT_PRINT",!1),className:"hfl-w-[74px]","data-qa":"to-print"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Share",iconFile:"hx_share",icon:"Left",onClick:()=>A(X,"VISIT_SHARE",!0),className:"hfl-w-[74px]","data-qa":"to-share"})]})}],[M,A]),k=v.useMemo(()=>W,[W]),$=async()=>{if(!l?.patientRoleID)return;let X="../ipdv2/viewPatientsCase";if(V.window_var?.enable_ipd_v2!=="1"){X="../ipd/viewPatientsCase.php";try{const O=await _n(V,l.patientRoleID),{status:re=0,case_id:ce=0}=O,_e=new Date().toISOString().slice(0,10);X=re&&ce?`../ipd/viewPatientRecords.php?pid=${l.patientRoleID}&case_id=${ce}`:`../ipd/viewAddPatientsCase.php?pid=${l.patientRoleID}&date=${_e}`}catch(O){console.error("Failed to get IPD Case by PID:",O)}}window.open(X,"_blank")};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-[12%] hfl-h-[69vh] hfl-overflow-auto hfl-py-[20px]",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text md",className:"hfl-text-Gray-600",children:"Past Visits"}),V.window_var.ipd_module==="1"&&e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"sm",textField:"Go to IPD","data-qa":"go-to-ipd",className:"hfl-justify-center hfl-bg-Primary-600 hfl-text-White hover:hfl-bg-Primary-700",onClick:()=>{$()}})]}),k?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(pa,{columns:G,data:k,columnWidth:M}),e.jsxRuntimeExports.jsx(Xr,{currentPage:z,totalRecord:N,handleLoadMore:()=>P(z+1),isLoading:D,currentTotal:k.length})]}),k.length===0&&!D&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:ma,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"There are no visits for the patient"})]})]})},ga=({fontBaseUrl:i})=>(le.Font.register({family:"notoKannada",src:`${i}/fonts/NotoSansKannada.ttf`}),le.Font.register({family:"notoKannadaBold",src:`${i}/fonts/NotoSansKannada-Bold.ttf`}),le.Font.register({family:"notoHindi",src:`${i}/fonts/NotoSansHindi.ttf`}),le.Font.register({family:"notoHindiBold",src:`${i}/fonts/NotoSansHindi-Bold.ttf`}),le.Font.register({family:"notoUrdu",src:`${i}/fonts/Jameel-Nastaleeq.ttf`}),le.Font.register({family:"notoUrduBold",src:`${i}/fonts/Jameel-Nastaleeq.ttf`}),le.Font.register({family:"notoArabic",src:`${i}/fonts/NotoSansArabic.ttf`}),le.Font.register({family:"notoArabicBold",src:`${i}/fonts/NotoSansArabic-Bold.ttf`}),le.Font.register({family:"notoGujarati",src:`${i}/fonts/NotoSerifGujarati-Regular.ttf`}),le.Font.register({family:"notoGujaratiBold",src:`${i}/fonts/NotoSerifGujarati-Bold.ttf`}),le.Font.register({family:"notoMalayalam",src:`${i}/fonts/AnekMalayalam-Regular.ttf`}),le.Font.register({family:"notoMalayalamBold",src:`${i}/fonts/AnekMalayalam-Bold.ttf`}),le.Font.register({family:"notoOriya",src:`${i}/fonts/NotoSansOriya.ttf`}),le.Font.register({family:"notoOriyaBold",src:`${i}/fonts/NotoSansOriya-Bold.ttf`}),le.Font.register({family:"notoPunjabi",src:`${i}/fonts/MuktaMaheePunjabi-Regular.ttf`}),le.Font.register({family:"notoPunjabiBold",src:`${i}/fonts/MuktaMaheePunjabi-Bold.ttf`}),le.Font.register({family:"notoTamil",src:`${i}/fonts/NotoSansTamil.ttf`}),le.Font.register({family:"notoTamilBold",src:`${i}/fonts/NotoSansTamil-Bold.ttf`}),le.Font.register({family:"notoTelugu",src:`${i}/fonts/Noto-Sans-Telugu-Regular.ttf`}),le.Font.register({family:"notoTeluguBold",src:`${i}/fonts/Noto-Sans-Telugu-Bold.ttf`}),le.Font.register({family:"notoBengali",src:`${i}/fonts/NotoSerifBengali-Regular.ttf`}),le.Font.register({family:"notoBengaliBold",src:`${i}/fonts/NotoSerifBengali-Bold.ttf`}),le.Font.register({family:"Verdana",src:`${i}/fonts/Verdana.ttf`}),le.Font.register({family:"Verdana-Bold",src:`${i}/fonts/Verdana-Bold.ttf`}),le.Font.register({family:"Verdana-Italic",src:`${i}/fonts/Verdana-Italic.ttf`}),le.Font.register({family:"Verdana-BoldItalic",src:`${i}/fonts/Verdana-Bold-Italic.ttf`}),le.Font.register({family:"Arial",src:`${i}/fonts/Arial.ttf`}),le.Font.register({family:"Arial-Bold",src:`${i}/fonts/Arial-Bold.ttf`}),le.Font.register({family:"Arial-Italic",src:`${i}/fonts/Arial-Italic.ttf`}),le.Font.register({family:"Arial-BoldItalic",src:`${i}/fonts/Arial-Bold-Italic.ttf`}),le.Font.register({family:"Rupee",src:`${i}/fonts/IndianRupee.ttf`}),e.jsxRuntimeExports.jsx(le.PDFViewer,{style:{display:"none"},children:e.jsxRuntimeExports.jsx(le.Document,{children:e.jsxRuntimeExports.jsxs(le.Page,{children:[e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoKannada"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoHindi"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoUrdu"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoArabic"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoGujarati"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoMalayalam"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoOriya"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoPunjabi"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoTamil"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoTelugu"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoBengali"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoKannadaBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoHindiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoUrduBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoArabicBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoGujaratiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoMalayalamBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoOriyaBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoPunjabiBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoTamilBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoTeluguBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"notoBengaliBold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Verdana"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Verdana-Bold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Verdana-Italic"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Verdana-BoldItalic"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Arial"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Arial-Bold"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Arial-Italic"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Arial-BoldItalic"},children:"load font"}),e.jsxRuntimeExports.jsx(le.Text,{style:{fontFamily:"Rupee"},children:"load font"})]})})})),va=i=>{const{billsData:d,handleRowClick:c,handleRightSegment:n,getRowIndices:y,getRefundAmt:R,closePrintModal:l}=i,{patientIDs:I,patientDetails:S,billPreferences:h,setShowPrintModal:V,showPrintModal:g,variable:L}=v.useContext(Tt)||{},W=({label:j,className:Q})=>e.jsxRuntimeExports.jsx("th",{className:Q,children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",j]})}),z=j=>{switch(j){case Ct[0]:return"hx_service-appointment-filled hfl-text-Primary-500";case Ct[1]:return"hx_service-other-filled hfl-text-Pink-500";case Ct[2]:return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}},D=j=>{switch(j){case Ct[0]:return"Consultation";case Ct[1]:return"Other";case Ct[2]:return"Lab";default:return"Other"}},N=async(j,Q,M)=>{if(g?.visible&&l(),j?.order_id){const G=await Ul(j?.order_id,I?.patientRoleID||"",L),k={finalAmount:j.net_bill_amount,billedAmount:j.order_total,gstAmount:j.order_service_tax,cgstAmount:(+j.order_service_tax/2).toFixed(2),sgstAmount:(+j.order_service_tax/2).toFixed(2),discountAmount:j.order_item_sum_discount,receivedAmount:j.order_paid_amount,refundAmount:j.refund_amount,balanceAmount:j.balance_amount,paymentMode:G?.paymentModes.length?G?.paymentModes.join(", "):"",paymentStatus:parseInt(j?.order_paid_amount||"0")-parseInt(j?.refund_amount||"0")===0?"red":parseInt(j?.balance_amount||"0")===0?"green":"yellow"},X=[S?.age&&typeof S?.age=="number"?`${S?.age}y`:S?.org_person_dob?dr(S?.org_person_dob):"",Zr[S?.gender]??"",S?.blood_group].filter(O=>O).join(", ");V({printDataFrom:"patient_popup",visible:!0,whichPreview:Q,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{preferences:{...h?.print?.bill,...h?.org_details,...h?.branch_details},billSummaryDetails:k,billServiceDetails:j?.order_items?.map(O=>({serviceName:O.service_name,price:O.order_unit_item_price,gst:Math.floor(+O.order_item_service_tax),discount:O.order_item_discount,netPrice:O.net_amount,itemQty:O.item_quantity})),billPatientDetails:{name:sr(S?.name)+(X?` (${X}) `:""),billDate:Te.dayjs(j?.order_date).format("DD-MMM-YYYY"),mobileNumber:S?.phone_number,email:S?.email,billNumber:j.order_id_str,patientId:S?.org_person_bid_str,patientIdForEmail:I?.patientRoleID,billStatus:parseInt(j?.balance_amount||"0")===0?"PAID":"UNPAID",address:[S?.address??"",S?.city??"",S?.pincode??""].filter(O=>O).join(", "),referredBy:G?.lab_owner_name?sr(G?.lab_owner_name):S?.ref_doc_name?sr(S?.ref_doc_name):"--"},showPrintPreviewForBill:M,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:j?.order_id}},trackEventHandler:()=>{}})}},P={table:"hfl-table-fixed hfl-rounded-lg hfl-shadow-md hfl-border-Gray-200 hfl-border-1 hfl-pb-8 ",th:"hfl-bg-Blue_gray-50",td:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-truncate hfl-text-Gray-500",td_without_truncate:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-text-Gray-500"},A=[{label:"Date",className:"focus:hfl-outline-none hfl-items-start hfl-w-[120px] hfl-border-Gray-200 hfl-border-1"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Department",className:"focus:hfl-outline-none hfl-items-start hfl-w-[106px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Paid",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Due",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Billed",className:"focus:hfl-outline-none hfl-items-start hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Discount",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Refund",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Service",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Price",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"GST",className:"focus:hfl-outline-none hfl-items-center hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"",className:"focus:hfl-outline-none hfl-items-center hfl-w-[36px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"}];return e.jsxRuntimeExports.jsx("div",{"data-qa":"bills-table",children:d.length>0&&e.jsxRuntimeExports.jsxs("table",{className:`${P.table} `,children:[e.jsxRuntimeExports.jsx("thead",{className:`${P.th}`,children:e.jsxRuntimeExports.jsx("tr",{children:A.map((j,Q)=>e.jsxRuntimeExports.jsx(W,{label:j.label,className:j.className},Q))})}),e.jsxRuntimeExports.jsx("tbody",{children:d.length>0&&d.map((j,Q)=>e.jsxRuntimeExports.jsx(v.Fragment,{children:j.order_items.map((M,G)=>e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[G===0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td}`,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:`${Te.dayjs(j.order_date).format("DD-MMM-YY")===Te.dayjs(new Date).format("DD-MMM-YY")?"hfl-w-[80px] hfl-bg-Success-25 hfl-px-1 hfl-text-Success-500":""}`,children:Te.dayjs(j.order_date).format("DD-MMM-YY")})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",children:j.order_id_str})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:` hfl-flex ${z(j.service_category)}`}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:[" ",D(j.service_category)]})]})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["₹ ",parseInt(j.order_paid_amount)-parseInt(j.refund_amount)]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm","data-qa":Q+1+"-due-amount",children:["₹ ",j.balance_amount]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[84px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between",children:[e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:`${j.order_paid_amount===void 0||j.refund_amount===void 0||j.balance_amount===void 0||parseInt(j.order_paid_amount)-parseInt(j.refund_amount)===0?"hfl-text-Error-500":parseInt(j.balance_amount)===0?"hfl-text-Success-500":"hfl-text-Warning-500"} hfl-cursor-pointer`,onClick:()=>{c(j)},"data-qa":Q+1+"-total-bill",children:["₹ ",j.net_bill_amount]}),e.jsxRuntimeExports.jsx("i",{className:" hx_print-filled hfl-cursor-pointer hfl-text-2 hfl-text-Gray-500",onClick:()=>N(j,"billPrintPreview",!1),"data-qa":Q+1+"-print-bill"})]})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-w-[84px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["₹ ",parseInt(j.order_discount)+parseInt(j.order_item_sum_discount)]})})}),e.jsxRuntimeExports.jsx("td",{rowSpan:j.order_items.length,className:`${P.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["₹ ",j.refund_amount]})})})]}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-w-8 hfl-max-w-[96px]`,title:M.service_name,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:M.service_name})}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-max-w-[64px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["₹ ",M.order_item_price]})})}),e.jsxRuntimeExports.jsx("td",{className:`${P.td} hfl-max-w-[46px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["₹ ",M.order_item_service_tax]})})}),e.jsxRuntimeExports.jsx("td",{"data-qa":Q+1+"-"+(G+1)+"-delete-bill",className:`${P.td_without_truncate} hfl-max-w-[36px] hfl-cursor-pointer`,onClick:()=>{y(Q,G),n(ht[6]),parseInt(j.order_paid_amount)-parseInt(j.refund_amount)<=parseInt(j.net_bill_amount)-parseInt(j.order_items[G].net_amount)?R(0):R(parseInt(j.order_paid_amount)-parseInt(j.refund_amount))},children:e.jsxRuntimeExports.jsx("i",{className:"hx_delete hfl-text-Gray-500"})})]},`${Q}-${G}`))},Q))})]})})},ya=i=>{const{refundAmt:d,handleRightSegment:c,bills:n,billsListIndex:y,orderItemsIndex:R,getBillsList:l}=i,{patientIDs:I,showToast:S,variable:h}=v.useContext(Tt)||{},[V,g]=v.useState("");return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full hfl-bg-Error-25",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-shrink-0 hfl-items-center hfl-justify-between hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsxs(e.bs,{variant:"Medium",type:"Text lg",className:"hfl-flex",children:["Bill :",e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text lg",className:"hfl-flex hfl-text-Blue-600",children:n?.bill_list[y].order_id_str})]}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>c("")})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-shrink-0 hfl-flex-col hfl-items-start hfl-gap-[5px] hfl-rounded-md hfl-border-Gray-200 hfl-bg-White_20 hfl-px-3 hfl-py-2 hfl-shadow-md",children:[e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",children:["Service: ",n?.bill_list[y].order_items[R].service_name]}),d>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-gap-3",children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",children:["Refund of",e.jsxRuntimeExports.jsx("div",{className:"hfl-inline hfl-font-inter-2 hfl-text-Error-600",children:" ₹ "+d+" "}),"will be given to delete this item"]})})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-full",children:e.jsxRuntimeExports.jsx(e.bu,{className:"hfl-w-[100%]",rows:4,inputProps:{value:V,placeholder:"Enter Reason",onChange:L=>{g(L.target.value)}},isDynamicHeight:!0})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-full hfl-items-start hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Cancel",icon:"Left",iconFile:"hx_close",className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100",onClick:()=>{c("")}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:"Delete",icon:"Left",iconFile:"hx_delete",onClick:async()=>{try{if(n?.bill_list?.[y].order_id){const L=await Wl(n?.bill_list?.[y].order_id,n?.bill_list?.[y].order_items[R].order_item_id,I?.patientRoleID||"",V,"0",h);L?(await l(),S?.("Success",L?.message,"Success",3e3),c("")):S?.("Error","Something went wrong please try again","Error",3e3)}}catch(L){console.error("Error in deleting bill item",L)}},className:"hfl-flex-1 hfl-items-center hfl-justify-center hfl-bg-Primary-600 hfl-text-White_20 hover:hfl-bg-Primary-800"})]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-gap-[14px] hfl-px-3 hfl-py-4"}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-4 hfl-left-2 hfl-w-full",children:e.jsxRuntimeExports.jsx(e.Ku,{className:"hfl-h-8 hfl-shrink-0 hfl-border-l-Gray-200 hfl-bg-White_20 hfl-text-Gray-500 hfl-shadow-md hover:hfl-bg-Gray-100",hierarchy:"Tertiary",size:"md",textField:"Go Back",icon:"Left",iconFile:"hx_arrow-left hfl-text-Gray-500",onClick:()=>c("")})})]})},_a="data:image/svg+xml,%3csvg%20width='87'%20height='86'%20viewBox='0%200%2087%2086'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='43.5'%20cy='83.42'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.6751%2018.92C34.2431%2016.9347%2036.0897%2015.48%2038.2799%2015.48H55.9277C54.4566%2016.3563%2053.188%2017.5313%2052.2081%2018.92H33.6751ZM51.1971%2020.64H25.6649C22.782%2020.64%2020.445%2022.9502%2020.445%2025.8V57.62H47.4149H47.8499C48.3304%2057.62%2048.7199%2058.005%2048.7199%2058.48V62.995C48.7199%2066.676%2051.7387%2069.66%2055.4624%2069.66C59.1862%2069.66%2062.2049%2066.676%2062.2049%2062.995V37.84C55.4781%2037.84%2050.0249%2032.4495%2050.0249%2025.8C50.0249%2023.9534%2050.4455%2022.2039%2051.1971%2020.64ZM63.9449%2037.7181V61.8486C66.4138%2061.4392%2068.2949%2059.3168%2068.2949%2056.76V36.2293C66.9805%2036.9809%2065.5108%2037.4967%2063.9449%2037.7181ZM70.0349%2035.0228V56.76C70.0349%2060.2756%2067.3674%2063.1753%2063.924%2063.5893C63.6156%2067.9429%2059.9451%2071.38%2055.4624%2071.38C55.3865%2071.38%2055.3108%2071.379%2055.2354%2071.377L55.2449%2071.38H23.925C19.1201%2071.38%2015.225%2067.5296%2015.225%2062.78V61.06C15.225%2059.1601%2016.783%2057.62%2018.705%2057.62V25.8C18.705%2022.0003%2021.821%2018.92%2025.6649%2018.92H31.8855C32.49%2015.9759%2035.1232%2013.76%2038.2799%2013.76H61.3349V13.7902C61.6223%2013.7702%2061.9124%2013.76%2062.2049%2013.76C68.9318%2013.76%2074.3849%2019.1505%2074.3849%2025.8C74.3849%2029.5023%2072.6945%2032.8142%2070.0349%2035.0228ZM10.44%2066.005C10.44%2065.6488%2010.7321%2065.36%2011.0925%2065.36C11.4528%2065.36%2011.745%2065.6488%2011.745%2066.005V66.22C11.745%2070.9696%2015.6401%2074.82%2020.445%2074.82H22.4459C22.7823%2074.82%2023.055%2075.0895%2023.055%2075.422C23.055%2075.7545%2022.7823%2076.024%2022.4459%2076.024H20.445C14.6698%2076.024%2010.44%2071.9104%2010.44%2066.22V66.005ZM11.0925%2063.64C9.77111%2063.64%208.69995%2064.6988%208.69995%2066.005V66.22C8.69995%2072.8786%2013.7274%2077.744%2020.445%2077.744H22.4459C23.7433%2077.744%2024.795%2076.7044%2024.795%2075.422C24.795%2074.1396%2023.7433%2073.1%2022.4459%2073.1H20.445C16.601%2073.1%2013.485%2070.0197%2013.485%2066.22V66.005C13.485%2064.6988%2012.4138%2063.64%2011.0925%2063.64ZM24.795%2043.43C24.795%2042.2426%2025.7687%2041.28%2026.9699%2041.28H40.0199C41.2212%2041.28%2042.195%2042.2426%2042.195%2043.43C42.195%2044.6174%2041.2212%2045.58%2040.0199%2045.58H26.9699C25.7687%2045.58%2024.795%2044.6174%2024.795%2043.43ZM26.9699%2043C26.7297%2043%2026.535%2043.1925%2026.535%2043.43C26.535%2043.6675%2026.7297%2043.86%2026.9699%2043.86H40.0199C40.2602%2043.86%2040.4549%2043.6675%2040.4549%2043.43C40.4549%2043.1925%2040.2602%2043%2040.0199%2043H26.9699ZM32.15%2037.9752C32.2163%2038.0407%2032.3208%2038.0735%2032.4635%2038.0735C32.5859%2038.0735%2032.6751%2038.0407%2032.7312%2037.9752C32.7923%2037.9097%2032.8229%2037.8064%2032.8229%2037.6653V37.0531C33.297%2037.0027%2033.7277%2036.8691%2034.1152%2036.6525C34.5026%2036.4307%2034.8135%2036.1082%2035.048%2035.685C35.2876%2035.2566%2035.4074%2034.7275%2035.4074%2034.0977C35.4074%2033.5534%2035.2825%2033.105%2035.0327%2032.7522C34.783%2032.3944%2034.4924%2032.1198%2034.161%2031.9283C33.8297%2031.7368%2033.3837%2031.5202%2032.8229%2031.2783V29.2375C33.0778%2029.2476%2033.2919%2029.2753%2033.4652%2029.3206C33.6436%2029.366%2033.8246%2029.4239%2034.0081%2029.4945C34.1356%2029.5449%2034.2197%2029.5701%2034.2604%2029.5701C34.3624%2029.5701%2034.4695%2029.4995%2034.5816%2029.3584C34.6988%2029.2173%2034.7983%2029.0535%2034.8798%2028.8671C34.9614%2028.6756%2035.0022%2028.5194%2035.0022%2028.3985C35.0022%2028.2624%2034.9079%2028.1264%2034.7192%2027.9903C34.5357%2027.8543%2034.2757%2027.7384%2033.9393%2027.6426C33.6079%2027.5469%2033.2358%2027.4914%2032.8229%2027.4763V27.0606C32.8229%2026.9145%2032.7923%2026.8112%2032.7312%2026.7507C32.67%2026.6902%2032.5655%2026.66%2032.4176%2026.66C32.2953%2026.66%2032.2035%2026.6927%2032.1424%2026.7583C32.0812%2026.8187%2032.0506%2026.9195%2032.0506%2027.0606V27.4839C31.5561%2027.5393%2031.1024%2027.6728%2030.6895%2027.8845C30.2817%2028.0961%2029.9529%2028.3985%2029.7031%2028.7915C29.4585%2029.1795%2029.3361%2029.6557%2029.3361%2030.2201C29.3361%2030.8147%2029.4661%2031.2985%2029.7261%2031.6713C29.9912%2032.0392%2030.2996%2032.3189%2030.6513%2032.5103C31.0081%2032.6968%2031.4746%2032.8958%2032.0506%2033.1075V35.3221C31.7346%2035.3221%2031.444%2035.2793%2031.1789%2035.1936C30.9189%2035.108%2030.6513%2034.9971%2030.376%2034.8611C30.1823%2034.7603%2030.0549%2034.7099%2029.9937%2034.7099C29.902%2034.7099%2029.7873%2034.7804%2029.6496%2034.9215C29.512%2035.0576%2029.3922%2035.2214%2029.2902%2035.4128C29.1934%2035.6043%2029.1449%2035.7656%2029.1449%2035.8966C29.1449%2036.0528%2029.2596%2036.2191%2029.489%2036.3955C29.7235%2036.5718%2030.06%2036.7255%2030.4984%2036.8565C30.9419%2036.9825%2031.4593%2037.0556%2032.0506%2037.0757V37.6653C32.0506%2037.8064%2032.0837%2037.9097%2032.15%2037.9752ZM31.5001%2029.6154C31.602%2029.4793%2031.7855%2029.3786%2032.0506%2029.3131V30.9306C31.8212%2030.7996%2031.6453%2030.6635%2031.523%2030.5224C31.4058%2030.3813%2031.3471%2030.2151%2031.3471%2030.0236C31.3471%2029.8825%2031.3981%2029.7464%2031.5001%2029.6154ZM33.2511%2034.8611C33.1441%2034.9971%2033.0013%2035.1004%2032.8229%2035.171V33.4703C33.2154%2033.692%2033.4117%2033.9843%2033.4117%2034.3471C33.4117%2034.5537%2033.3582%2034.725%2033.2511%2034.8611ZM24.795%2050.31C24.795%2049.1226%2025.7687%2048.16%2026.9699%2048.16H53.07C54.2712%2048.16%2055.2449%2049.1226%2055.2449%2050.31C55.2449%2051.4974%2054.2712%2052.46%2053.07%2052.46H26.9699C25.7687%2052.46%2024.795%2051.4974%2024.795%2050.31ZM26.9699%2049.88C26.7297%2049.88%2026.535%2050.0725%2026.535%2050.31C26.535%2050.5475%2026.7297%2050.74%2026.9699%2050.74H53.07C53.3102%2050.74%2053.5049%2050.5475%2053.5049%2050.31C53.5049%2050.0725%2053.3102%2049.88%2053.07%2049.88H26.9699ZM51.7649%2025.8C51.7649%2020.1004%2056.4391%2015.48%2062.2049%2015.48C67.9708%2015.48%2072.6449%2020.1004%2072.6449%2025.8C72.6449%2031.4996%2067.9708%2036.12%2062.2049%2036.12C56.4391%2036.12%2051.7649%2031.4996%2051.7649%2025.8ZM60.0299%2020.21C60.0299%2019.0226%2061.0037%2018.06%2062.2049%2018.06C63.4062%2018.06%2064.3799%2019.0226%2064.3799%2020.21V25.37C64.3799%2026.5574%2063.4062%2027.52%2062.2049%2027.52C61.0037%2027.52%2060.0299%2026.5574%2060.0299%2025.37V20.21ZM62.2049%2019.78C61.9647%2019.78%2061.7699%2019.9725%2061.7699%2020.21V25.37C61.7699%2025.6075%2061.9647%2025.8%2062.2049%2025.8C62.4452%2025.8%2062.6399%2025.6075%2062.6399%2025.37V20.21C62.6399%2019.9725%2062.4452%2019.78%2062.2049%2019.78ZM62.2049%2033.54C61.0037%2033.54%2060.0299%2032.5774%2060.0299%2031.39C60.0299%2030.2026%2061.0037%2029.24%2062.2049%2029.24C63.4062%2029.24%2064.3799%2030.2026%2064.3799%2031.39C64.3799%2032.5774%2063.4062%2033.54%2062.2049%2033.54ZM61.7699%2031.39C61.7699%2031.6275%2061.9647%2031.82%2062.2049%2031.82C62.4452%2031.82%2062.6399%2031.6275%2062.6399%2031.39C62.6399%2031.1525%2062.4452%2030.96%2062.2049%2030.96C61.9647%2030.96%2061.7699%2031.1525%2061.7699%2031.39Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",ba=i=>{const{closePrintModal:d,handleCurrentWindow:c}=i,[n,y]=v.useState(),[R,l]=v.useState(""),[I,S]=v.useState(""),[h,V]=v.useState(),[g,L]=v.useState(),[W,z]=v.useState(1),[D,N]=v.useState([]),[P,A]=v.useState(-1),[j,Q]=v.useState(-1),[M,G]=v.useState(0),[k,$]=v.useState(0),[X,O]=v.useState(!1),re=v.useContext(Tt);if(!re)throw new Error("Bills component must be used within an AppContext.Provider");const{patientIDs:ce,setLoading:_e,variable:xe}=re,Ve=He=>G(He),ie=(He=ht[0])=>l(He),Y=He=>S(He),fe=He=>{V(He),Y(He?.service_category??""),l(ht[1])},H=(He,st)=>{A(He),Q(st)},Ce=v.useCallback(async()=>{if(ce?.patientRoleID)try{const He=await yl(Te.dayjs().format("YYYY-MM-DD"),ce.patientRoleID,!1,xe);L(He)}catch(He){console.error("Error in getPastDueAmount API Call:",He)}},[ce.patientRoleID,xe]),Fe=v.useCallback(async()=>{if(ce?.patientRoleID)try{const He=await wl(ce.patientRoleID,xe);$(He?.wallet_balance||0)}catch(He){console.error("Error fetching wallet balance:",He),$(0)}},[ce.patientRoleID,xe]),ke=v.useCallback(async()=>{if(ce?.patientRoleID){_e(!0);try{const He=await gl("all",ce.patientRoleID,1,10,xe);He&&(y(He),N(He.bill_list??[]))}catch(He){console.error("Error in getBillsList API Call:",He)}finally{_e(!1)}}},[ce.patientRoleID,_e,xe]),xt=async He=>{if(!ce?.patientRoleID||!n)return;const st=n.total_pages;if(!(He>st)){_e(!0);try{const _t=await gl("all",ce.patientRoleID,He,10,xe);_t?.bill_list&&N(pt=>[...pt,..._t.bill_list]),z(He)}catch(_t){console.error("Failed to load more bills:",_t)}finally{_e(!1)}}};return v.useEffect(()=>{Ce(),ke()},[Ce,ke]),v.useEffect(()=>{Fe()},[Fe,X]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-flex-row hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[938px] hfl-flex-col hfl-px-4 hfl-py-2 xxs:max-md:hfl-w-[750px] ${R===ht[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-max-h-[470px] hfl-w-full hfl-flex-col hfl-overflow-y-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-self-stretch",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-text-Gray-700",children:"Bills"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-gap-2 ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-text-Blue_gray-600",children:"Total Due Amount :"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text lg",className:"hfl-text-Error-500",children:["₹ ",g?.total_amount||0]})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-h-[30px] hfl-w-[2px] hfl-bg-Gray-200"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-items-center hfl-justify-center hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",className:" hfl-text-Success-500",children:k}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>ie(ht[7])})]})]})]})]}),n?.bill_list?.length?e.jsxRuntimeExports.jsx(va,{billsData:D,handleRowClick:fe,handleRightSegment:ie,getRowIndices:H,getRefundAmt:Ve,closePrintModal:d}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:_a,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"No Past Bills Available"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text md",className:"hfl-text-Gray-500",children:["To create a new bill go to"," ",e.jsxRuntimeExports.jsx("span",{className:"hfl-inline hfl-cursor-pointer hfl-text-Blue-600 hfl-underline",onClick:()=>c?.(jt[2]),children:"Add Bills"})]})]})]})}),n?.bill_list?.length&&e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Xr,{currentPage:W,totalRecord:n.total_records,currentTotal:D.length,handleLoadMore:()=>xt(W+1)})})]}),e.jsxRuntimeExports.jsxs(El,{children:[R===ht[1]&&e.jsxRuntimeExports.jsx(Nl,{rightSegment:R,serviceDetails:h?.order_items??[],categorySummaryData:h,serviceItem:I,handleRightSegment:ie,getPastDueAmount:Ce,getBillSummarydata:ke,closePrintModal:d,setRefreshWallet:O,walletBalance:k,bill_date:"",refreshBillsList:ke}),R===ht[6]&&e.jsxRuntimeExports.jsx(ya,{refundAmt:M,bills:n,billsListIndex:P,orderItemsIndex:j,handleRightSegment:ie,getBillsList:ke}),R===ht[7]&&e.jsxRuntimeExports.jsx(Al,{depositAmount:k,handleRightSegment:ie,rightSegment:R,setRefreshWallet:O})]})]})},ja=({reference:i,closeModalHandler:d,payment_id:c,currentMode:n,transactionType:y,refreshPaymentData:R})=>{const{showToast:l,variable:I}=v.useContext(Tt)||{},[S,h]=v.useState({paymentMethod:n}),V=async()=>{const g=await Gn(c,S.paymentMethod,y,I);g.status?(l("Update Success",g.message,"Success",3e3),R?.()):l("Update Failed",g.message,"Error",3e3),d({show:!1,payment_id:"",mode:"",payment_type:""})};return e.jsxRuntimeExports.jsxs("div",{ref:i,className:"hfl-flex hfl-w-[400px] hfl-flex-col hfl-rounded-lg hfl-border-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-rounded-t-lg hfl-bg-gradient_primary_600_500_90 hfl-px-6 hfl-py-5 hfl-text-White hfl-shadow-sm",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Bold",type:"Text md",className:"hfl-text-White",children:"Please make required changes"})," "]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-bg-White hfl-p-6",children:e.jsxRuntimeExports.jsx(e.Ap,{className:"hfl-w-[200px] hfl-text-0 hfl-text-Gray-800 ",value:{label:ir[S.paymentMethod]},options:zr.map(g=>({label:g,value:g,className:"hfl-text-1 hfl-text-Gray-800"})),onChange:g=>{h(L=>({...L,paymentMethod:ir[g.value]}))},label:"Payment Method",labelClassName:"after:hfl-content-['*'] after:hfl-text-Error-600 after:hfl-ml-1 hfl-font-inter-2 hfl-font-inter",dropdownInputTextClassName:"hfl-text-1 hfl-text-Gray-600"})}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-row hfl-justify-end hfl-gap-[10px] hfl-rounded-b-lg hfl-border-t-1 hfl-border-Gray-100 hfl-bg-Gray-50 hfl-px-7 hfl-py-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{textField:"Cancel",size:"sm",hierarchy:"Primary",onClick:()=>d({show:!1,payment_id:"",mode:"",payment_type:""}),className:"hfl-border-1 hfl-border-Blue-300 hfl-bg-Blue-50 hfl-text-Blue-600 hover:hfl-bg-Blue-600 hover:hfl-text-White"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"sm",textField:"Save",className:"hfl-bg-Blue-600",onClick:V})]})]})},Ra=({styles:i,data:d,handleDeleteRow:c,handleRightSegment:n,handleRowClick:y,getType:R,getTypeColor:l,refreshPaymentData:I})=>{const[S,h]=v.useState({show:!1,payment_id:"",mode:"",payment_type:""}),V=v.useRef(null),g=W=>{switch(W){case"1":return"Consultation";case"2":return"Other";case"3":return"Lab";default:return"Other"}},L=W=>{switch(W){case"1":return"hx_service-appointment-filled hfl-text-Primary-500";case"2":return"hx_service-other-filled hfl-text-Pink-500";case"3":return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}};return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d.length>0&&d.map((W,z)=>e.jsxRuntimeExports.jsx(v.Fragment,{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[e.jsxRuntimeExports.jsx("td",{className:`${i.td} `,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",children:Te.dayjs.utc(new Date(W.created_on)).format("YYYY-MM-DD / HH:mm")})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 ",children:W.order_id_str})})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hfl-text-Primary-600 hover:hfl-underline",onClick:()=>{y(W)},"data-qa":z+1+"-bill-amount",children:"₹"+W.paid_amount})})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f_rupee hfl-flex "}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:` -hfl-ml-1 hfl-px-1 ${l(W.payment_refund)}`,children:R(W.payment_refund)})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",onClick:()=>{},className:"-hfl-ml-1",children:ir[W.paid_mode]}),e.jsxRuntimeExports.jsx("span",{className:"hx_edit hfl-cursor-pointer hfl-text-Blue-600",onClick:()=>{h({show:!0,payment_id:W.order_payment_id,mode:W.paid_mode,payment_type:R(W.payment_refund).toLowerCase()})}})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center ",children:[e.jsxRuntimeExports.jsx("i",{className:`hfl-flex hfl-text-3 hfl-text-Error-500 ${L(W.service_category_id)}`}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",g(W?.service_category_id)]})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[50px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:W.order_total})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[70px]`,title:W.details,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-truncate",children:W.details})})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("i",{className:" hx_delete hfl-flex hfl-cursor-pointer hfl-text-2",onClick:D=>{D.stopPropagation(),n(),c(W,z)},"data-qa":z+1+"-delete-transaction"})})]},`${z}`)},z)),S.show&&e.jsxRuntimeExports.jsx(Ql.ReusableModal,{childModalRef:V,backdropClasses:"",clickOutsideHandler:()=>{},closeOnClickOutside:!1,hideBackDrop:!1,modalClasses:"hfl-rounded-xlg hfl-mx-2 xsm:hfl-mx-6 md:hfl-mx-12 ",children:e.jsxRuntimeExports.jsx(ja,{reference:V,closeModalHandler:h,payment_id:S.payment_id,currentMode:S.mode,transactionType:S.payment_type,refreshPaymentData:I})})]})},wa=({styles:i,data:d,handleRowClick:c,closePrintModal:n,patient_entity_id:y})=>{const{patientDetails:R,patientIDs:l,billPreferences:I,setShowPrintModal:S,showPrintModal:h}=v.useContext(Tt),V=async(g,L,W,z)=>{h?.visible&&n();const N=[R?.age&&typeof R?.age=="number"?`${R?.age}y`:R?.org_person_dob?dr(R?.org_person_dob):"",Zr[R?.gender]??"",R?.blood_group].filter(A=>A).join(", "),P={name:sr(R?.name)+(N?` (${N}) `:""),billDate:Te.dayjs(g?.transaction_time).format("DD-MMM-YYYY"),mobileNumber:R?.phone_number,email:R?.email,billNumber:g?.bill_number,patientId:R?.org_person_bid_str,patientIdForEmail:l?.patientRoleID,billStatus:"PAID",address:[R?.address??"",R?.city??"",R?.pincode??""].filter(A=>A).join(", ")};S({printDataFrom:"patient_popup",visible:!0,whichPreview:L,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:W,preferences:{...I?.print?.bill,...I?.org_details},depositRefundBillDetails:g,billPatientDetails:P,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:g?.bill_number,patient_user_id:y}},trackEventHandler:()=>{console.log(z)}})};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d.length>0&&d.map((g,L)=>e.jsxRuntimeExports.jsx(v.Fragment,{children:e.jsxRuntimeExports.jsxs("tr",{className:"hfl-border-1",children:[e.jsxRuntimeExports.jsx("td",{className:`${i.td} `,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",children:Te.dayjs.utc(new Date(g.transaction_time)).format("YYYY-MM-DD / HH:mm")})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[70px]`,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-text-Primary-600",children:g.bill_number})})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[105px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:g.bill_amount})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[115px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex hfl-cursor-pointer hover:hfl-underline",onClick:()=>{c(g)},"data-qa":L+1+"-bill-amount",children:"₹"+g.paid_amount}),e.jsxRuntimeExports.jsx("i",{className:" hx_print-filled hfl-cursor-pointer hfl-text-2 hfl-text-Gray-500",onClick:()=>V(g,"billPrintPreview",!1,g?.type==="DEPOSIT"?"DEPOSIT_BILL_PRINT":"REFUND_BILL_PRINT"),"data-qa":L+1+"-print-bill"})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hfl-flex hfl-text-0"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1",children:g.mode})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[90px]`,children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center ",children:[e.jsxRuntimeExports.jsx("img",{src:Zl(g.type)}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",g.type]})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[160px]`,title:g.details,children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-1 hfl-truncate",children:g.details})})})]},`${L}`)},L))})},Ca=i=>{const{data:d,setTableData:c,handleRightSegment:n,handleRowClick:y,activeTab:R,closePrintModal:l,patient_entity_id:I,refreshPaymentData:S}=i,{patientIDs:h,showToast:V,variable:g}=v.useContext(Tt)||{};Te.dayjs.extend(Sl);const L=async(A,j)=>{let Q="";A.payment_refund==="P"?Q="payment":A.payment_refund==="R"&&(Q="refund");try{const M=await Pn(A.order_payment_id,Q,A.order_id,h?.patientRoleID||"",g);M.status&&(V("Success",M?.message,"Success",3e3),c(G=>{try{const k=[...G];return k.splice(j,1),k}catch(k){return console.error(`Error: ${k}`),G}}),S())}catch(M){console.error("Error deleting payment:",M)}},W=A=>{switch(A){case"P":return"Payment";case"R":return"Refund";case"D":return"Deposit";default:return""}},z=A=>{switch(A){case"DEPOSIT":case"P":return"hfl-bg-Success-50 hfl-text-Success-500";case"REFUND":case"R":return"hfl-bg-Error-50 hfl-text-Error-500";case"D":return"hfl-bg-Primary-50 hfl-text-Primary-500";default:return""}},D=v.useMemo(()=>R===cr[_r.consultation_lab_other_services].key?[{label:"Date/Time",className:"focus:hfl-outline-none hfl-items-start hfl-w-[162px] hfl-border-Gray-200 hfl-border-1"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[100px] hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Type",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Mode",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Category",className:"focus:hfl-outline-none hfl-items-start hfl-w-[136px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Bill Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[110px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:"Details",className:"focus:hfl-outline-none hfl-items-start hfl-w-[120px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"},{label:" ",className:"focus:hfl-outline-none hfl-items-start hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1"}]:[{label:"Date/Time",className:"focus:hfl-outline-none hfl-items-start hfl-w-[162px] hfl-border-Gray-200 hfl-border-1 hfl-px-2 hfl-text-left"},{label:"#Bill",className:"focus:hfl-outline-none hfl-items-start hfl-w-[100px] hfl-truncate hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Bill Amount",className:"focus:hfl-outline-none hfl-items-start hfl-w-[105px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Total Paid",className:"focus:hfl-outline-none hfl-items-start hfl-w-[115px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Mode",className:"focus:hfl-outline-none hfl-items-start hfl-w-[90px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Category",className:"focus:hfl-outline-none hfl-items-start hfl-w-[136px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"},{label:"Details",className:"focus:hfl-outline-none hfl-items-start hfl-w-[160px] hfl-border-1 hfl-px-2 hfl-border-Gray-200 hfl-py-1 hfl-text-left"}],[R]),N=({label:A,className:j})=>e.jsxRuntimeExports.jsx("th",{className:j,children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",A]})}),P={table:"hfl-table-fixed hfl-rounded-lg hfl-shadow-md hfl-border-Gray-200 hfl-border-1 hfl-pb-8 ",th:"hfl-bg-Blue_gray-50",td:"hfl-px-2 hfl-h-[36px] hfl-align-top hfl-border-Gray-200 hfl-py-1.5 hfl-border-1 hfl-truncate hfl-text-Gray-500"};return e.jsxRuntimeExports.jsx("div",{className:"",children:e.jsxRuntimeExports.jsxs("table",{className:`${P.table}`,children:[e.jsxRuntimeExports.jsx("thead",{className:`${P.th}`,children:e.jsxRuntimeExports.jsx("tr",{children:D.map((A,j)=>e.jsxRuntimeExports.jsx(N,{label:A.label,className:A.className},j))})}),e.jsxRuntimeExports.jsx("tbody",{children:R===cr[_r.consultation_lab_other_services].key?e.jsxRuntimeExports.jsx(Ra,{styles:P,data:d,handleDeleteRow:L,handleRightSegment:n,handleRowClick:y,getTypeColor:z,getType:W,refreshPaymentData:S}):e.jsxRuntimeExports.jsx(wa,{styles:P,data:d,handleRowClick:y,closePrintModal:l,patient_entity_id:I})})]})})},Ea="data:image/svg+xml,%3csvg%20width='88'%20height='87'%20viewBox='0%200%2088%2087'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cellipse%20opacity='0.1'%20cx='44'%20cy='83.92'%20rx='43.5'%20ry='2.58'%20fill='%234E5BA6'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.6799%2017.3857C12.6799%2016.1344%2013.7061%2015.12%2014.972%2015.12C16.2379%2015.12%2017.2641%2016.1344%2017.2641%2017.3857V22.0468C17.2641%2023.2981%2016.2379%2024.3125%2014.972%2024.3125C13.7061%2024.3125%2012.6799%2023.2981%2012.6799%2022.0468V17.3857ZM14.972%2016.84C14.6671%2016.84%2014.4199%2017.0843%2014.4199%2017.3857V22.0468C14.4199%2022.3482%2014.6671%2022.5925%2014.972%2022.5925C15.2769%2022.5925%2015.5241%2022.3482%2015.5241%2022.0468V17.3857C15.5241%2017.0843%2015.2769%2016.84%2014.972%2016.84ZM23.1199%2026.3C23.1199%2023.9252%2025.0675%2022%2027.4699%2022H56.4199C55.1757%2023.464%2054.2776%2025.225%2053.8502%2027.16H23.1199V26.3ZM53.6005%2028.88H19.6399C17.2375%2028.88%2015.2899%2030.8052%2015.2899%2033.18V37.48L56.4199%2037.48C54.6412%2035.3872%2053.5699%2032.6872%2053.5699%2029.74C53.5699%2029.4508%2053.5802%2029.1641%2053.6005%2028.88ZM67.4899%2041.6581V58.98H69.2299C71.6324%2058.98%2073.5799%2057.0548%2073.5799%2054.68V38.9628C71.8823%2040.3727%2069.7897%2041.3329%2067.4899%2041.6581ZM75.3199%2037.1886V54.68C75.3199%2058.0047%2072.5933%2060.7%2069.2299%2060.7H67.4899V61.56C67.4899%2064.8848%2064.7633%2067.58%2061.3999%2067.58H19.6399C16.2765%2067.58%2013.5499%2064.8848%2013.5499%2061.56V33.18C13.5499%2029.8552%2016.2765%2027.16%2019.6399%2027.16H21.3799V26.3C21.3799%2022.9752%2024.1065%2020.28%2027.4699%2020.28H57.9199V20.5172C60.0371%2018.759%2062.7684%2017.7%2065.7499%2017.7C72.4768%2017.7%2077.9299%2023.0905%2077.9299%2029.74C77.9299%2032.5522%2076.9545%2035.1393%2075.3199%2037.1886ZM15.2899%2042.64L65.7499%2042.64V58.98V60.7V61.56C65.7499%2063.9348%2063.8024%2065.86%2061.3999%2065.86H19.6399C17.2375%2065.86%2015.2899%2063.9348%2015.2899%2061.56V42.64ZM73.262%2063.28C71.9961%2063.28%2070.9699%2064.2944%2070.9699%2065.5457V70.2068C70.9699%2071.4581%2071.9961%2072.4725%2073.262%2072.4725C74.5279%2072.4725%2075.5541%2071.4581%2075.5541%2070.2068V65.5457C75.5541%2064.2944%2074.5279%2063.28%2073.262%2063.28ZM72.7099%2065.5457C72.7099%2065.2443%2072.9571%2065%2073.262%2065C73.5669%2065%2073.8141%2065.2443%2073.8141%2065.5457V70.2068C73.8141%2070.5082%2073.5669%2070.7525%2073.262%2070.7525C72.9571%2070.7525%2072.7099%2070.5082%2072.7099%2070.2068V65.5457ZM55.3099%2029.74C55.3099%2024.0404%2059.9841%2019.42%2065.7499%2019.42C71.5158%2019.42%2076.1899%2024.0404%2076.1899%2029.74C76.1899%2035.4396%2071.5158%2040.06%2065.7499%2040.06C59.9841%2040.06%2055.3099%2035.4396%2055.3099%2029.74ZM63.5749%2024.15C63.5749%2022.9626%2064.5487%2022%2065.7499%2022C66.9511%2022%2067.9249%2022.9626%2067.9249%2024.15V29.31C67.9249%2030.4974%2066.9511%2031.46%2065.7499%2031.46C64.5487%2031.46%2063.5749%2030.4974%2063.5749%2029.31V24.15ZM65.7499%2023.72C65.5097%2023.72%2065.3149%2023.9125%2065.3149%2024.15V29.31C65.3149%2029.5475%2065.5097%2029.74%2065.7499%2029.74C65.9902%2029.74%2066.1849%2029.5475%2066.1849%2029.31V24.15C66.1849%2023.9125%2065.9902%2023.72%2065.7499%2023.72ZM65.7499%2037.48C64.5487%2037.48%2063.5749%2036.5174%2063.5749%2035.33C63.5749%2034.1426%2064.5487%2033.18%2065.7499%2033.18C66.9511%2033.18%2067.9249%2034.1426%2067.9249%2035.33C67.9249%2036.5174%2066.9511%2037.48%2065.7499%2037.48ZM65.3149%2035.33C65.3149%2035.5675%2065.5097%2035.76%2065.7499%2035.76C65.9902%2035.76%2066.1849%2035.5675%2066.1849%2035.33C66.1849%2035.0925%2065.9902%2034.9%2065.7499%2034.9C65.5097%2034.9%2065.3149%2035.0925%2065.3149%2035.33ZM35.7349%2050.38C34.5337%2050.38%2033.5599%2051.3426%2033.5599%2052.53C33.5599%2053.7174%2034.5337%2054.68%2035.7349%2054.68H59.2249C60.4262%2054.68%2061.3999%2053.7174%2061.3999%2052.53C61.3999%2051.3426%2060.4262%2050.38%2059.2249%2050.38H35.7349ZM35.2999%2052.53C35.2999%2052.2925%2035.4947%2052.1%2035.7349%2052.1H59.2249C59.4652%2052.1%2059.6599%2052.2925%2059.6599%2052.53C59.6599%2052.7675%2059.4652%2052.96%2059.2249%2052.96H35.7349C35.4947%2052.96%2035.2999%2052.7675%2035.2999%2052.53ZM24.4249%2056.4C26.5871%2056.4%2028.3399%2054.6673%2028.3399%2052.53C28.3399%2050.3927%2026.5871%2048.66%2024.4249%2048.66C22.2627%2048.66%2020.5099%2050.3927%2020.5099%2052.53C20.5099%2054.6673%2022.2627%2056.4%2024.4249%2056.4Z'%20fill='%23AFB5D9'/%3e%3c/svg%3e",Pa=({walletBalance:i,handleRightSegment:d,headerText:c})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mt-2 hfl-flex hfl-w-full hfl-flex-row hfl-items-center hfl-justify-between hfl-text-Gray-700",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text lg",children:c}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text lg",children:"Deposit Amount:"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-gap-1 hfl-rounded-lg hfl-bg-Gray-50 hfl-p-1",children:[e.jsxRuntimeExports.jsx("i",{className:"hx_rupee hfl-text-3 hfl-text-Success-500"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text lg",className:" hfl-text-Success-500",children:i}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"md",textField:"",icon:"Only",iconFile:"hx_add-circle hfl-text-4",className:"hfl-items-center hfl-justify-center",onClick:()=>d(ht[7])})]})]})]}),Sa=i=>{Te.dayjs.extend(Sl);const{patientDetails:d,patientIDs:c,billPreferences:n,setShowPrintModal:y,showPrintModal:R}=v.useContext(Tt)||{},{handleRightSegment:l,closePrintModal:I,summaryData:S,patient_entity_id:h}=i,V=async(g,L)=>{R?.visible&&I();const z=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?dr(d?.org_person_dob):"",Zr[d?.gender]??"",d?.blood_group].filter(N=>N).join(", "),D={name:sr(d?.name)+(z?` (${z}) `:""),billDate:Te.dayjs(S?.transaction_time).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:S?.bill_number,patientId:d?.org_person_bid_str,patientIdForEmail:c?.patientRoleID,billStatus:"PAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(N=>N).join(", ")};y?.({printDataFrom:"patient_popup",visible:!0,whichPreview:g,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:L,preferences:{...n?.print?.bill,...n?.org_details},depositRefundBillDetails:S,billPatientDetails:D,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:S?.bill_number,patient_user_id:h}},trackEventHandler:()=>{}})};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-h-full ",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-8 hfl-w-[330px] hfl-shrink-0 hfl-items-center hfl-gap-2 hfl-border-b-1 hfl-border-b-Gray-200 hfl-px-2",children:[e.jsxRuntimeExports.jsx("div",{className:"hx_arrow-left hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>l(ht[0])}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:"Bills Summary"})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-start hfl-px-3 hfl-py-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-justify-between hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-w-[60%] hfl-gap-2",children:[e.jsxRuntimeExports.jsx("img",{src:Zl(S.type),alt:""}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-flex-1 hfl-text-Gray-800",children:S.type==="DEPOSIT"?"Deposit":"Refund(Deposit)"})]}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.bill_amount]})]}),S.type==="DEPOSIT"&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Total Billed Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.bill_amount]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Paid Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.paid_amount]})]})]}),S.type==="REFUND"&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Deposit Amount"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-Gray-800",children:["₹ ",S?.opening_balance]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-start hfl-self-stretch hfl-py-[7px] hfl-pr-7",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-w-[60%] hfl-flex-1 hfl-text-Gray-800",children:"Total Balance"}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-800",children:["₹"," ",S.type==="DEPOSIT"?parseInt(S?.bill_amount)-parseInt(S?.paid_amount):S?.closing_balance]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-absolute hfl-bottom-1 hfl-flex hfl-w-full hfl-items-start hfl-gap-2 hfl-px-1 hfl-pb-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Print",icon:"Left",onClick:()=>V("billPrintPreview",!1),iconFile:"hx_print",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary",size:"md",textField:"Share",icon:"Left",onClick:()=>V("billSharePreview",!0),iconFile:"hx_share",className:" hfl-flex-1 hfl-items-center hfl-justify-center hfl-border hfl-border-Gray-300 hfl-bg-White hfl-text-Gray-700 hover:hfl-bg-Gray-100"})]})]})},Na=({closePrintModal:i})=>{const[d,c]=v.useState(cr[_r.consultation_lab_other_services].key),[n,y]=v.useState(null),[R,l]=v.useState(ht[5]),[I,S]=v.useState(""),[h,V]=v.useState(),[g,L]=v.useState([]),[W,z]=v.useState(1),[D,N]=v.useState(),{setLoading:P,patientIDs:A,variable:j}=v.useContext(Tt),[Q,M]=v.useState(0),[G,k]=v.useState(!1),$=v.useCallback(async()=>{try{if(P(!0),A?.patientRoleID){const Y=await vl(A.patientRoleID,1,10,j);Y&&(y(Y),L(Y.data))}P(!1)}catch{y(null),L([]),P(!1),console.log("error in getPaymentsList API Call")}},[A.patientRoleID,P,j]),X=v.useCallback(async()=>{try{P(!0);const Y=await _l(A?.patientRoleID||"",1,10,j);Y&&(y(Y),L(Y?.wallet_transactions||[])),P(!1)}catch{y(null),L([]),P(!1),console.log("error in getDepositRefundList API Call")}},[A?.patientRoleID,P,j]),O=(Y=ht[5])=>{l(Y)},re=Y=>{S(Y)},ce=async Y=>{if(V(Y),d===cr[_r.consultation_lab_other_services].key){if(re(Ct[parseInt(Y?.service_category_id)-1]),l(ht[1]),Y?.order_id){const fe=await xe(Y.order_id);N(fe)}}else l(ht[8])},_e=async Y=>{let fe=Y;if(P(!0),fe<=Math.ceil(n?.total_records||0)){if(fe=Y+1,fe!==Y){let H,Ce;d==cr[_r.deposit_refund].key?(H=await _l(A?.patientRoleID||"",fe,10,j),Ce=[...g,...H.wallet_transactions]):(H=await vl(A?.patientRoleID||"",fe,10,j),Ce=[...g,...H.data]),L(Ce)}z(fe)}P(!1)},xe=async Y=>{try{return await Rl(Y,A?.patientRoleID||"",["order_items"],j)}catch{console.log("Error in Loading Bill Details from Bill Id")}},Ve=v.useCallback(async()=>{const Y=await wl(A?.patientRoleID||"",j);M(Y?.wallet_balance||0)},[A?.patientRoleID,j]),ie=Y=>{c(Y),O(),i()};return v.useEffect(()=>{d==cr[_r.deposit_refund].key?X():$()},[d,X,$]),v.useEffect(()=>{Ve(),d==cr[_r.deposit_refund].key&&X()},[d,Ve,X,G]),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:[e.jsxRuntimeExports.jsxs("div",{className:`hfl-flex hfl-w-[938px] hfl-flex-col hfl-justify-start hfl-px-4 hfl-py-2 xxs:max-md:hfl-w-[750px] ${R===ht[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:Object.values(cr).map((Y,fe)=>e.jsxRuntimeExports.jsx(e.bs,{variant:`${d===Y.key?"Semibold":"Regular"}`,type:"Text md",className:`hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-gap-0.5 hfl-px-[13px] hfl-py-2 ${d===Y.key?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>ie(Y.key),children:Y.label},fe))}),e.jsxRuntimeExports.jsx(Pa,{walletBalance:Q,handleRightSegment:O,headerText:cr[d].label}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-max-h-[470px] hfl-w-full hfl-flex-col hfl-overflow-y-scroll"}),g?.length?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-1 hfl-flex-col hfl-items-center hfl-gap-6 hfl-overflow-y-auto ",children:e.jsxRuntimeExports.jsx(Ca,{data:g,setTableData:L,handleRowClick:ce,handleRightSegment:O,activeTab:d,closePrintModal:i,patient_entity_id:n?.entity_id||"",refreshPaymentData:$})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(Xr,{currentPage:W,totalRecord:n?.total_records||0,currentTotal:W===Math.ceil((n?.total_records||0)/10)?n?.total_records||0:W*10,handleLoadMore:_e})})]}):e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:[e.jsxRuntimeExports.jsx("img",{className:"hfl-w-[80px] hfl-text-Blue_gray-500",src:Ea,alt:"empty-bills"}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"No Active or Past Payments for the Patient"})]})]}),e.jsxRuntimeExports.jsxs(El,{children:[R===ht[1]&&e.jsxRuntimeExports.jsx(Nl,{rightSegment:R,categorySummaryData:{...h,order_date:D?.order_date??""},serviceItem:I,handleRightSegment:O,serviceDetails:D?.order_items??[],getBillSummarydata:$,closePrintModal:i,setRefreshWallet:k,walletBalance:Q,getPastDueAmount:()=>{},refreshBillsList:()=>{},bill_date:""}),R===ht[7]&&e.jsxRuntimeExports.jsx(Al,{depositAmount:Q,handleRightSegment:O,rightSegment:R,setRefreshWallet:k}),R===ht[8]&&e.jsxRuntimeExports.jsx(Sa,{summaryData:{...h,order_date:D?.order_date??""},handleRightSegment:O,closePrintModal:i,patient_entity_id:n?.entity_id||""})]})]})},Gs=()=>e.jsxRuntimeExports.jsx("div",{className:"hfl-inset-0 hfl-z-[100] hfl-flex hfl-h-full hfl-w-full hfl-items-center hfl-justify-center hfl-overflow-y-auto hfl-outline-none focus:hfl-outline-none",children:e.jsxRuntimeExports.jsx(e.Eu,{progress:10,spinnerMode:!0})}),$l=({columns:i,data:d})=>{const{getTableProps:c,getTableBodyProps:n,headerGroups:y,rows:R,prepareRow:l}=$r.useTable({columns:i,data:d}),I=h=>{const V=[];return h?.headers?.length&&h.headers.map(g=>{V.push(e.jsxRuntimeExports.jsx("th",{...g.getHeaderProps(),className:"hfl-rounded hfl-border-1 hfl-border-Gray-200 hfl-bg-Blue_gray-50 hfl-px-2 hfl-py-1 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:g.render("Header")})}))}),V},S=()=>{const h=[];return R.map((V,g)=>{l(V),h.push(e.jsxRuntimeExports.jsx("tr",{id:g.toString(),...V.getRowProps(),className:"hfl-bg-White hfl-group hfl-border-t-1 hfl-border-Gray-200",children:V.cells.map((L,W)=>e.jsxRuntimeExports.jsx("td",{"data-qa":g+1+"-"+(W+1),...L.getCellProps(),className:"hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-text-[13px] hfl-text-Gray-500",children:L.render("Cell")})}))}))}),h};return e.jsxRuntimeExports.jsx("div",{className:"hfl-max-h-[54vh] hfl-overflow-y-auto hfl-overflow-x-hidden","data-qa":"lab-report-table",children:e.jsxRuntimeExports.jsxs("table",{...c(),className:"hfl-table-fixed hfl-rounded-lg hfl-border-1 hfl-border-Gray-200 hfl-pb-8 hfl-shadow-md",children:[e.jsxRuntimeExports.jsx("thead",{children:y.map(h=>e.jsxRuntimeExports.jsx("tr",{...h.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50 ",children:I(h)}))}),e.jsxRuntimeExports.jsx("tbody",{...n(),className:"hfl-rounded-",children:S()})]})})},Aa=i=>{const{visits:d=[],setPdfUrl:c,pdfUrl:n}=i,[y,R]=v.useState([]);return v.useEffect(()=>{R(Da(d))},[]),e.jsxRuntimeExports.jsx("div",{children:y&&y.length&&y.map((l,I)=>l.reports.length>0&&l.reports.map((S,h)=>{const V=l.date||"No date available";S.label=`${new Date(V).toLocaleDateString()}${l.reports.length>1?` - ${h+1}`:""}`;const{lab_number:g,label:L,message:W=""}=S;return e.jsxRuntimeExports.jsx("div",{className:"hfl-relative hfl-mb-2 hfl-flex hfl-items-center hfl-justify-center",title:`${L} ${W?`(${W})`:""}
|
|
18
|
-
${g}`,children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:`${L} ${W?`(${W})`:""}
|
|
19
|
-
${g}`,textFieldClassName:"hfl-w-full hfl-line-clamp-2",onClick:()=>c(S),className:`
|
|
20
|
-
hfl-w-full
|
|
21
|
-
hfl-border hfl-border-Gray-300
|
|
22
|
-
hfl-text-Gray-700
|
|
23
|
-
hover:hfl-bg-Gray-100
|
|
24
|
-
${n.lab_number===g?"hfl-bg-Gray-200":"hfl-bg-White"}
|
|
25
|
-
hfl-whitespace-pre-line
|
|
26
|
-
hfl-py-6
|
|
27
|
-
hfl-text-left
|
|
28
|
-
`})},`${I}-${h}`)}))})},Da=i=>{const d={};return i.forEach(c=>{const n=c.date,y=c.reports;d[n]||(d[n]=[]),d[n]=d[n].concat(y)}),Object.keys(d).map(c=>({date:c,reports:d[c]}))},Ia=i=>{const{setLisModalOpen:d,patientDetails:c,lisPDFUrl:n={report_link:"",lab_number:""},showListing:y=!0,showToast:R,openLISReportHandler:l=()=>{},variable:I}=i,{org_person_bid_str:S="",email:h="",phone_number:V="",patient_id:g,name:L=""}=c,[W,z]=v.useState(),[D,N]=v.useState(n),[P,A]=v.useState(!0),[j,Q]=v.useState(!1),[M,G]=v.useState(""),[k,$]=v.useState(h),[X,O]=v.useState(V),[re,ce]=v.useState(!1),_e=fe=>{const{value:H}=fe.target;Q(!!H&&!Ie.create$6().email().isValidSync(H)),$(H)},xe=fe=>{const{value:H}=fe.target;ce(!!H&&!Ie.create$6().min(10).max(10).isValidSync(H)),O(H)};v.useEffect(()=>{S&&y&&(async()=>{try{A(!0);const H=await le.getLisDataByOrgBidStr(S,I),{visits:Ce=[]}=H;z(H),Ce.length&&Ce[0]?.reports?.length?N(Ce[0].reports[0]):A(!1)}catch(H){console.error("Error:",H),A(!1)}})()},[S]),v.useEffect(()=>{D.report_link?A(!0):A(!1)},[D]);const Ve=()=>{A(!1)},ie=async(fe,H)=>{const Ce={patient_id:g,report_name:`${fe.lab_number}.pdf`,report_url:fe.report_link,channel:H,receiver_emails:k?[k]:[],receiver_phone_numbers:X?[X]:[],label:fe?.label||"",patient_name:L},Fe=await le.sendAttachLISReport(Ce,I),ke=H==="SMS/WA"?"WhatsApp":H;Fe||R("",ke+" failed to sent","Error",3e3),R("",ke+" sent successfully","Success",3e3)},Y=fe=>fe?`${fe}#toolbar=0&navpanes=0`:`data:text/html;charset=utf-8,${encodeURIComponent(`
|
|
29
|
-
<html>
|
|
30
|
-
<body style="font-family: sans-serif; display: flex; align-items: center; justify-content: center; height: 100%; margin:0; background:#f9f9f9;">
|
|
31
|
-
<div style="text-align:center;">
|
|
32
|
-
<h2 style="color:#555;">No report available</h2>
|
|
33
|
-
</div>
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
36
|
-
`)}`;return e.jsxRuntimeExports.jsx("div",{style:{zIndex:1e4},className:"hfl-fixed hfl-inset-0 hfl-flex hfl-w-full hfl-items-center hfl-justify-center hfl-overflow-y-auto hfl-overflow-x-hidden hfl-opacity-100 hfl-outline-none",children:e.jsxRuntimeExports.jsx("div",{className:"xss:max-md:hfl-w-[80vw] hfl-relative hfl-m-1 hfl-mx-auto hfl-my-6 hfl-w-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-rounded-lg hfl-border-0 hfl-bg-White hfl-shadow-lg hfl-outline-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-rounded-t hfl-px-4 hfl-py-2 hfl-shadow-sm",style:{borderBottom:"1px solid var(--gray-300, #D0D5DD)"},children:[e.jsxRuntimeExports.jsx(e.bs,{type:"Text md",variant:"Regular",children:"Report"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary-Grey",icon:"Only",iconFile:"hx_close",onClick:()=>d(!1),size:"md",textField:""})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-overflow-y-auto",style:{maxHeight:"85vh"},children:[e.jsxRuntimeExports.jsx("div",{id:"pdf-print-render",className:"hfl-overflow-y-auto hfl-bg-Gray-300",children:e.jsxRuntimeExports.jsxs("div",{className:"relative hfl-h-[85vh] hfl-w-[210mm] xxs:max-md:hfl-h-[85vh] xxs:max-sm:hfl-w-[150mm] md:hfl-w-[180mm]",children:[P&&e.jsxRuntimeExports.jsx(Gs,{}),e.jsxRuntimeExports.jsx("iframe",{height:"100%",width:"100%",src:Y(D.report_link),title:"PDF Report",onLoad:Ve,style:{display:P?"none":"block"}})]})}),y?e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-bg-Gray-25 md:hfl-w-[400px]",style:{boxShadow:"-4px 0px 4px 0px rgba(222, 214, 214, 0.25)",maxHeight:"85vh",position:"relative"},children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex-grow hfl-overflow-y-auto",style:{paddingBottom:"60px"},children:W?.visits&&W.visits.length>0?e.jsxRuntimeExports.jsxs("div",{className:"hfl-p-6 hfl-pb-0",children:[e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-font-inter-2 !hfl-text-Black",children:"Please Choose Date:"}),e.jsxRuntimeExports.jsx(Aa,{visits:W?.visits,setPdfUrl:N,pdfUrl:D})]}):!P&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-flex-1 hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"!hfl-text-Gray hfl-font-inter-2",children:"No reports available."})})}),W?.visits&&W.visits.length>0&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-[0px] hfl-w-[400px] hfl-border-t-1 hfl-border-Gray-100 hfl-bg-White hfl-p-2",style:{boxShadow:"0px 2px 4px -2px rgba(16, 24, 40, 0.06), 0px 4px 8px -2px rgba(16, 24, 40, 0.10)"},children:e.jsxRuntimeExports.jsx(e.Ku,{onClick:()=>ie(D,"Attachment"),hierarchy:"Primary",size:"lg",textField:"Attach to EMR",className:"hfl-mx-2 hfl-flex hfl-w-full hfl-items-center hfl-justify-center hfl-text-center"})})]}):e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-bg-Gray-25 md:hfl-w-[400px]",style:{boxShadow:"-4px 0px 4px 0px rgba(222, 214, 214, 0.25)",maxHeight:"85vh",position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-justify-between hfl-bg-Gray-25 md:hfl-w-[400px]",style:{boxShadow:"rgba(222, 214, 214, 0.25) -4px 0px 4px 0px"},children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-px-6 hfl-pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-py-6 xxs:max-md:hfl-w-[190px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Email",height:"hfl-h-10 hfl-border-Purple-200 hfl-h-10 hfl-border-Purple-200",start_icon:"hx_mail",errorMsg:j&&M!=="email"?"Email format is wrong":void 0,inputProps:{onFocus:()=>G("email"),onBlur:()=>G(""),autoFocus:!0,type:"text",placeholder:"Enter Email",onChange:fe=>{_e(fe)},value:k}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-auto xxs:max-md:hfl-w-[190px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Phone Number",height:"hfl-h-10 hfl-border-Purple-200 hfl-h-10 hfl-border-Purple-200",start_icon:"hx_phone",errorMsg:re&&M!=="phone"?"Invalid Phone Number":void 0,inputProps:{placeholder:"Enter Phone Number",onFocus:()=>G("phone"),onBlur:()=>G(""),onChange:fe=>{xe(fe)},value:X,maxLength:10}})})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-[0px] hfl-w-[400px] hfl-border-t-1 hfl-border-Gray-100 hfl-bg-White hfl-p-2",style:{boxShadow:"0px 2px 4px -2px rgba(16, 24, 40, 0.06), 0px 4px 8px -2px rgba(16, 24, 40, 0.10)"},children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-space-x-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Email",disabled:!k||j||P,icon:"Left",onClick:()=>ie(D,"Email"),iconFile:"hx_mail hfl-text-4 hfl-text-4",className:"hfl-border-Blue-300 hfl-items-center hfl-justify-center hfl-border hfl-px-10"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"WhatsApp",disabled:!X||re||P,icon:"Left",onClick:()=>ie(D,"SMS/WA"),iconFile:"hfl-mr-2",className:"hfl-border-Blue-300 hfl-items-center hfl-justify-center hfl-border hfl-px-10"}),e.jsxRuntimeExports.jsx("img",{alt:"WhatsApp",src:le.WhatsApp,width:"24px",height:"24px",className:"hfl-absolute hfl-left-[16px] hfl-top-[50%] hfl-translate-y-[-50%] hfl-object-contain hover:hfl-cursor-pointer"})]}),e.jsxRuntimeExports.jsx(e.Ku,{id:"print-button",hierarchy:"Secondary",size:"lg",textField:"Print",disabled:P,icon:"Left",onClick:()=>l("print_pdf",D),iconFile:"hx_print hfl-text-4 hfl-text-4",className:"hfl-border-Blue-300 hfl-flex hfl-items-center hfl-justify-center hfl-border hfl-px-10"})]})})})]})})]})]})})})},Ta=i=>{const{patientDetails:d,showToast:c,variable:n}=i,[y,R]=v.useState(!1),[l,I]=v.useState(""),{org_person_bid_str:S=""}=d,h=v.useReducer((Q,M)=>({...Q,...M}),{currentPage:1,totalRecord:0,LabRecords:[],isLabTableLoading:!1}),[V,g]=h,{LabRecords:L,currentPage:W,isLabTableLoading:z}=V,D=(Q,M)=>{Q==="print_pdf"?window.open(M.report_link,"_blank"):Q==="print_preview"&&(R(!0),I(M))},N=v.useCallback(async Q=>{try{g({isLabTableLoading:!0});const M=await le.getLisDataByOrgBidStr(S,n);let G=[];M?.visits?.length&&(G=Ba(M.visits)),g({currentPage:Q,LabRecords:G?.length?G:[],isLabTableLoading:!1,totalRecord:G.length})}catch(M){g({isLabTableLoading:!1}),console.log(M)}},[g,S,n]),P={lab_date:"100px",lab_number:"350px"};v.useEffect(()=>{N(W)},[W,N]);const A=v.useMemo(()=>[{Header:"Date",accessor:"lab_date",Cell:({row:Q})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-max-[100px] hfl-w-[100px]",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${P.lab_date}]`,children:Q?.original?.lab_date&&Te.dayjs(Q.original.lab_date).format("DD-MMM-YYYY")})})},{Header:"Lab Number / Service Name.",accessor:"lab_number",Cell:({row:Q})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${P.lab_number}]`,children:Q?.original?.lab_number&&Q.original.lab_number})},{Header:"View Report",accessor:"report_link",Cell:({row:Q})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-2 hfl-my-1 hfl-flex hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Print",iconFile:"hx_print",icon:"Left",className:"hfl-w-[74px]","data-qa":"to-print",onClick:()=>D("print_preview",Q.original)}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Share",iconFile:"hx_share",icon:"Left",className:"hfl-w-[74px]","data-qa":"to-share",onClick:()=>D("print_preview",Q.original)})]})}],[P.lab_date,P.lab_number]),j=v.useMemo(()=>L,[L]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",j?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx($l,{columns:A,data:j||[]}),y&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-left-[50%] hfl-top-[50%]",children:e.jsxRuntimeExports.jsx(Ia,{setLisModalOpen:R,patientDetails:d,lisPDFUrl:l,showListing:!1,openLISReportHandler:D,showToast:c,variable:n})})]}),j.length===0&&!z&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"These are no Reports for the Patient"})}),z&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",style:{width:"inherit"},children:e.jsxRuntimeExports.jsx(Gs,{})})]})},Ba=i=>{const d=[];return i.forEach(c=>{c.reports.forEach(n=>{d.push({lab_number:n.lab_number,report_link:n.report_link,lab_date:c.date})})}),d},Ga=i=>{const{setHplxLabModalOpen:d,patientDetails:c,showHPLXPrintPreview:n,reportsData:y,showToast:R,envName:l}=i,{patient_role_id:I="",email:S="",phone_number:h="",name:V=""}=c,{order_date:g,report_id:L}=y,[W,z]=v.useState(!1),[D,N]=v.useState(""),[P,A]=v.useState(S),[j,Q]=v.useState(h),[M,G]=v.useState(!1),[k,$]=v.useState(null),[X,O]=v.useState("");v.useEffect(()=>{I&&g&&(async()=>{const ie={pid:I,todays_date:g,rids:L};try{const Y=await le.getHplxLabPdfUrl(ie,l);if(Y&&Y?.pdf){O(Y.pdf);const H=await(await fetch(Y.pdf)).blob(),Ce=URL.createObjectURL(H);$(Ce),n||xe(Ce)}}catch(Y){console.error("Error:",Y)}})()},[I,g]);const re=async Ve=>{try{const ie={created_by:window.doctor_role_id_for_seg,dynamicFieldValue:{patient_name:V,url:X,email_attachment_urls:X,email_attachment_file_names:"Lab-Report.pdf"},receiverEmails:Ve==="Email"?[P]:[],receiverPersonRoleIds:[],receiverPhoneNumbers:Ve==="WA"?[j]:[],receiverPhoneNumbersUrl:"",senderId:window.doctor_role_id_for_seg,sourceDetails:{entity_type:"hplx_lab_report",entity_id:L,user_type:"0",user_id:I,branch_id:window.org_branch_id_for_seg},triggerCode:Ve==="WA"?"EHR-LAB-REPORT-WHATSAPP":"EHR-LAB-REPORT-EMAIL"};if(await le.sendV2PrintEmailOrSMS(ie,l))R("",`${Ve==="Email"?"Email":"WhatsApp"} Sent Successfully`,"Success",1e3,"topRight");else throw new Error("Error while uploading the file")}catch(ie){console.log("error",ie)}},ce=Ve=>{const{value:ie}=Ve.target;z(!!ie&&!Ie.create$6().email().isValidSync(ie)),A(ie)},_e=Ve=>{const{value:ie}=Ve.target;G(!!ie&&!Ie.create$6().min(10).max(10).isValidSync(ie)),Q(ie)},xe=Ve=>{if(Ve){const ie=document.getElementById("hiddenIframe").querySelector("iframe");ie.src=Ve,ie.onload=()=>{ie.contentWindow.print()}}};return e.jsxRuntimeExports.jsx("div",{style:{zIndex:1e4},className:"hfl-fixed hfl-inset-0 hfl-flex hfl-w-full hfl-items-center hfl-justify-center hfl-overflow-y-auto hfl-overflow-x-hidden hfl-opacity-100 hfl-outline-none",children:e.jsxRuntimeExports.jsx("div",{className:"xss:max-md:hfl-w-[80vw] hfl-relative hfl-m-1 hfl-mx-auto hfl-my-6 hfl-w-auto",children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-rounded-lg hfl-border-0 hfl-bg-White hfl-shadow-lg hfl-outline-none",children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-rounded-t hfl-px-4 hfl-py-2 hfl-shadow-sm",style:{borderBottom:"1px solid var(--gray-300, #D0D5DD)"},children:[e.jsxRuntimeExports.jsx(e.bs,{type:"Text md",variant:"Regular",children:"Report"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Tertiary-Grey",icon:"Only",iconFile:"hx_close",onClick:()=>d(!1),size:"md",textField:""})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-overflow-y-auto",style:{maxHeight:"85vh"},children:[e.jsxRuntimeExports.jsx("div",{id:"pdf-print-render",className:"hfl-overflow-y-auto hfl-bg-Gray-300",children:e.jsxRuntimeExports.jsxs("div",{className:"relative hfl-h-[85vh] hfl-w-[210mm] xxs:max-md:hfl-h-[85vh] xxs:max-sm:hfl-w-[150mm] md:hfl-w-[180mm]",children:[e.jsxRuntimeExports.jsx("iframe",{height:"100%",width:"100%",src:k?k+"#toolbar=0&navpanes=0":"about:blank",title:"PDF Report"}),e.jsxRuntimeExports.jsx("div",{id:"hiddenIframe",className:"hfl-hidden",children:e.jsxRuntimeExports.jsx("iframe",{src:k,title:"PDF Report"})})]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-flex-col hfl-bg-Gray-25 md:hfl-w-[400px]",style:{boxShadow:"-4px 0px 4px 0px rgba(222, 214, 214, 0.25)",maxHeight:"85vh",position:"relative"},children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-justify-between hfl-bg-Gray-25 md:hfl-w-[400px]",style:{boxShadow:"rgba(222, 214, 214, 0.25) -4px 0px 4px 0px"},children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-px-6 hfl-pb-0",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-py-6 xxs:max-md:hfl-w-[190px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Email",height:"hfl-h-10 hfl-border-Purple-200 hfl-h-10 hfl-border-Purple-200",start_icon:"hx_mail",errorMsg:W&&D!=="email"&&"Email format is wrong",inputProps:{onFocus:()=>N("email"),onBlur:()=>N(""),autoFocus:!0,type:"text",placeholder:"Enter Email",onChange:Ve=>{ce(Ve)},value:P}})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-w-auto xxs:max-md:hfl-w-[190px]",children:e.jsxRuntimeExports.jsx(e.Ps,{label:"Phone Number",height:"hfl-h-10 hfl-border-Purple-200 hfl-h-10 hfl-border-Purple-200",start_icon:"hx_phone",errorMsg:M&&D!=="phone"&&"Invalid Phone Number",inputProps:{placeholder:"Enter Phone Number",onFocus:()=>N("phone"),onBlur:()=>N(""),onChange:Ve=>{_e(Ve)},value:j,maxLength:10}})})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-bottom-[0px] hfl-w-[400px] hfl-border-t-1 hfl-border-Gray-100 hfl-bg-White hfl-p-2",style:{boxShadow:"0px 2px 4px -2px rgba(16, 24, 40, 0.06), 0px 4px 8px -2px rgba(16, 24, 40, 0.10)"},children:e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center hfl-space-x-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"Email",disabled:!P||W,icon:"Left",onClick:()=>re("Email"),iconFile:"hx_mail hfl-text-4 hfl-text-4",className:"hfl-border-Blue-300 hfl-items-center hfl-justify-center hfl-border hfl-px-10"}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"lg",textField:"WhatsApp",disabled:!j||M,icon:"Left",onClick:()=>re("WA"),iconFile:"hfl-mr-2",className:"hfl-border-blue-300 hfl-items-center hfl-justify-center hfl-border hfl-px-10"}),e.jsxRuntimeExports.jsx("img",{alt:"WhatsApp",src:le.WhatsApp,width:"24px",height:"24px",className:"hfl-absolute hfl-left-[16px] hfl-top-[50%] hfl-translate-y-[-50%] hfl-object-contain hover:hfl-cursor-pointer"})]}),e.jsxRuntimeExports.jsx(e.Ku,{id:"print-button",hierarchy:"Secondary",size:"lg",textField:"Print",icon:"Left",onClick:()=>xe(k),iconFile:"hx_print hfl-text-4 hfl-text-4",className:"hfl-border-Blue-300 hfl-flex hfl-items-center hfl-justify-center hfl-border hfl-px-10"})]})})})]})})]})]})})})},Fa=i=>{const{patientDetails:d,showToast:c,variable:n}=i,[y,R]=v.useState(!1),[l,I]=v.useState(!0),[S,h]=v.useState({}),V=v.useReducer((G,k)=>({...G,...k}),{currentPage:1,totalRecord:0,LabRecords:[],isLabTableLoading:!1}),[g,L]=V,{LabRecords:W,currentPage:z,isLabTableLoading:D,totalRecord:N}=g,P={order_date:"100px",test:"350px"},A=(G,k)=>{R(!0),I(G),h(k)},j=v.useCallback(async G=>{L({isLabTableLoading:!0});try{const k=await xn(rn,G,d?.patient_role_id,n),$=k?.data??[];L({currentPage:G,LabRecords:[...W,...$],isLabTableLoading:!1,totalRecord:k?.total_lab_count??0})}catch(k){console.error("Failed to fetch HPLX Lab reports:",k)}finally{L({isLabTableLoading:!1})}},[L,d?.patient_role_id,n]);v.useEffect(()=>{j(z)},[z,j]);const Q=v.useMemo(()=>[{Header:"Date",accessor:"order_date",Cell:({row:G})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-max-[100px] hfl-w-[100px]",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${P.order_date}]`,children:G?.original?.order_date&&Te.dayjs(G.original.order_date).format("DD-MMM-YYYY")})})},{Header:"Test Name",accessor:"test",Cell:({row:G})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${P.test}]`,children:G?.original?.test&&G.original.test})},{Header:"View Report",accessor:"report_link",Cell:({row:G})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-mx-2 hfl-my-1 hfl-flex hfl-gap-2",children:[e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Print",iconFile:"hx_print",icon:"Left",className:"hfl-w-[74px]","data-qa":"to-print",onClick:()=>A(!0,G.original)}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Share",iconFile:"hx_share",icon:"Left",className:"hfl-w-[74px]","data-qa":"to-share",onClick:()=>A(!0,G.original)})]})}],[P.order_date,P.test]),M=v.useMemo(()=>W,[W]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",M?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx($l,{columns:Q,data:M||[]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-2",children:e.jsxRuntimeExports.jsx(Xr,{currentPage:z,totalRecord:N,handleLoadMore:()=>j(z+1),isLoading:D,currentTotal:M.length})}),y&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-left-[50%] hfl-top-[50%]",children:e.jsxRuntimeExports.jsx(Ga,{setHplxLabModalOpen:R,patientDetails:d,showHPLXPrintPreview:l,reportsData:S,showToast:c,envName:n})})]}),M.length===0&&!D&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text md",className:"hfl-items-center hfl-justify-center hfl-text-Gray-400",children:"These are no Reports for the Patient"})}),D&&e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-[calc(100%_-_80px)] hfl-flex-col hfl-items-center hfl-justify-center hfl-gap-4",style:{width:"inherit"},children:e.jsxRuntimeExports.jsx(Gs,{})})]})},Ma=i=>{const{showToast:d}=i,{patientDetails:c,billPreferences:n,variable:y}=v.useContext(Tt)||{},[R,l]=v.useState(""),I=n?.features?.enable_lis_v1??!1,S=y.window_var.permit_lab_tech=="1";v.useEffect(()=>{I&&S||I?l(Wr[Kt.lis_report].key):S&&l(Wr[Kt.healthplix_report].key)},[I,S]);const h=V=>{l(V)};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-[73.55vh] hfl-bg-White",children:e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[913px] hfl-flex-col hfl-justify-start hfl-px-4 hfl-py-2",children:I||S?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[I&&e.jsxRuntimeExports.jsx(e.bs,{variant:`${R===Kt.lis_report?"Semibold":"Regular"}`,type:"Text md",className:`hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-gap-0.5 hfl-px-[13px] hfl-py-2 ${R===Kt.lis_report?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>h(Kt.lis_report),children:Wr[Kt.lis_report].label}),S&&e.jsxRuntimeExports.jsx(e.bs,{variant:`${R===Kt.healthplix_report?"Semibold":"Regular"}`,type:"Text md",className:`hfl-flex hfl-cursor-pointer hfl-items-center hfl-justify-center hfl-gap-0.5 hfl-px-[13px] hfl-py-2 ${R===Kt.healthplix_report?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>h(Kt.healthplix_report),children:Wr[Kt.healthplix_report].label})]}),e.jsxRuntimeExports.jsxs("div",{className:"hfl-relative hfl-mx-[12%] hfl-h-full hfl-overflow-auto hfl-py-[20px]",children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center hfl-justify-between hfl-pb-2",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Semibold",type:"Text md",className:"hfl-text-Gray-600",children:R===Kt.lis_report?"Lab reports of LIS":R===Kt.healthplix_report?"Lab reports of Healthplix":""})}),R===Kt.lis_report&&e.jsxRuntimeExports.jsx(Ta,{patientDetails:c,showToast:d,variable:y}),R===Kt.healthplix_report&&e.jsxRuntimeExports.jsx(Fa,{patientDetails:c,showToast:d,variable:y})]})]}):e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-full hfl-items-center hfl-justify-center",children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text lg",className:"hfl-text-Gray-500",children:"Lab is not active."})})})})})};function Ha({variable:i}){const{window_var:d,token:c,envName:n,IMGREP_DIRECTORY:y}=i,R=Bs("(max-width: 1080px)"),[l,I]=v.useState(!1),[S,h]=v.useState(!1),[V,g]=v.useState([]),[L,W]=v.useState(jt[2]),[z,D]=v.useState(),[N,P]=v.useState(),[A,j]=v.useState(),[Q,M]=v.useState(),[G,k]=v.useState(),[$,X]=v.useState(),[O,re]=v.useState({printDataFrom:"",visible:!1,whichPreview:"offlinePrint",printData:"",visitId:"",visit_date:"",details:{},visit_number:1,currentPrintTime:0,printType:"bill",trackEventHandler:()=>{}}),[ce,_e]=v.useState(""),[xe,Ve]=v.useState("en"),[ie,Y]=v.useState(),[fe,H]=v.useState(),[Ce,Fe]=v.useState(),[ke,xt]=v.useState({patient_id:"",patient_registered_date:"",patient_age:"",patient_gender:""}),He=window?.partner_config?JSON.parse(window?.partner_config):{},[st,_t]=v.useState([]),{patient_preferred_language:pt}=G||{},{visit_pad_json:Pt,visitpad_order:Rt,org_person_sign_text:Dt,org_person_signature_url:Gt}=A||{},{add_lang_change:T,defaultLanguage:De}=typeof Pt=="string"&&Pt&&JSON.parse(Pt)||{},{rows:qe}=De||{},[ae,J]=v.useState(!1),[K,oe]=v.useState({}),[Be,Pe]=v.useState([]),[mt,Zt]=v.useState({}),[ct,Ot]=v.useState({created_on:"",category_name:""});v.useEffect(()=>{const dt=$?.print?.bill?.appnt_minute_slab;if(!dt)return;const vt=+dt;vt&&(Ar.find(Et=>Et.value==vt)||Ar.unshift({label:`${vt} min`,value:vt}))},[$]);const kt=v.useCallback(dt=>{ln({callback:ft=>{k(ft),xt({patient_id:dt,patient_registered_date:"",patient_age:ft?.age?typeof ft?.age=="number"?`${ft.age} y`:`${dr(`${ft.age}`)}`:dr(ft?.org_person_dob),patient_gender:Kl(ft?.gender)})}},dt,i)},[k]),er=dt=>{at(),W(dt)},Qt=(dt,vt,ft,Et)=>{const Bt=Date.now();g(Ht=>[...Ht,{id:Bt,title:dt,description:vt,type:ft,duration:Et}]),setTimeout(()=>{g(Ht=>[...Ht].filter(({id:$t})=>$t!==Bt))},Et)};v.useEffect(()=>{Rt&&Pt&&_t(Fl(Rt,Pt))},[A,Pt,Rt]);const rr=v.useCallback(()=>{Ve(typeof pt=="string"&&pt.length>=2?pt:typeof qe=="string"&&qe.length>=2?qe:"en")},[qe,pt]);v.useEffect(()=>{rr()},[pt,qe,rr]);const lr=async(dt,vt,ft,Et=!0)=>{const{unmodifiedVisitPadJson:Bt,printPrefMasterArr:Ht}=dt,$t=Bt&&Ie.isJson(Bt)?JSON.parse(Bt):{},Ft=Ht?.[vt]||{config:{}},At=Ft?.config||{},B={...$t,...Ft,...((Lt,Xt)=>Object.fromEntries(Object.entries(Lt).map(([qt,tr])=>[Xt[qt]||qt,tr])))(At,sn)},ye={org_person_logo_footer_url:`${y}${At.footer_img_url}`,org_person_logo_header_url:`${y}${At.header_img_url}`,org_person_sign_text:At.signature,org_person_signature_url:`${y}${At.signature_img_url}`,person_seal_url:`${At.seal_img_url}`},bt={...dt,visit_pad_json:JSON.stringify(B),...ye};if(ft===""||window.doctor_role_id_for_seg==ft)j(bt);else if(Et)re(Lt=>({...Lt,visible:!0,visitpadPref:bt}));else return bt},br=async(dt={doc_id:"",doc_rid:""})=>{const vt=await Kr.getVisitpadPreference(dt,{token:c,envName:n},d.org_branch_id_for_seg||"",d.person_id_for_seg||"",d.doctor_role_id_for_seg||""),ft=await Kr.getDoctorPreference("print_configs",dt,d.doctor_role_id_for_seg||"",d.org_branch_id_for_seg||"",{token:c,envName:n||Ie.E_ENVIRONMENT.STAGING}),Et=vt?.visit_pad_json,Bt={};let Ht=0;ft?.print_templates?.forEach((Ft,At)=>{Ft?.name&&(Bt[At]=Ft.name,Ht=Ft.is_default?At:Ht)}),vt.printPreferenceList=Bt,vt.printPrefMasterArr=ft?.print_templates||[],vt.unmodifiedVisitPadJson=Et,vt.printDefaultPrefIndex=Ht;const $t=await lr(vt,Ht,dt.doc_rid,!1);if(!(dt.doc_rid===""||window.doctor_role_id_for_seg==dt.doc_rid))return $t},nr=async()=>{const dt=await nn(i);D(dt);const vt={};if(dt?.service_list){for(const ft of dt.service_list)vt[ft.service_identifier]={...ft};H(vt)}};window.patientPopupHandler=async(dt,vt,ft,Et,Bt,Ht)=>{I(!0),_e(dt),M({patientRoleID:vt,patientID:ft}),await lr(Et,Et.printDefaultPrefIndex,"",!1);try{W(Ht?.toLowerCase()===jt[1]?jt[1]:jt[2]),kt(vt),an(i).then(P),pn("patient_config",i).then(X),Kr.getDoctorPreference("print_configs",{doc_rid:""},d.doctor_role_id_for_seg||"",d.org_branch_id_for_seg||"",{token:c,envName:n||Ie.E_ENVIRONMENT.STAGING}).then(Y),zl(vt,ft,i).then(Fe),or(vt),await nr()}catch{console.log("Failed to open patient pop up")}};const at=()=>{re({printDataFrom:"",visible:!1,whichPreview:"",printData:"",visitId:"",visit_date:"",details:{},visit_number:1,currentPrintTime:0,printType:"",trackEventHandler:()=>{}})};v.useEffect(()=>{document.body.style.overflow=l?"hidden":"auto"},[l]);const fr=v.useMemo(()=>[...$?.patient_config?.custom_fields||[]].sort((ft,Et)=>ft.sort-Et.sort).map(ft=>{const Et=G?.custom_fields?.find(Bt=>Bt.id===ft.id);return{...ft,value:Et?.value||"",title:Et?.value?Et?.title:ft.title}}),[$?.patient_config?.custom_fields,G?.custom_fields]),hr=dt=>{switch(dt){case"1":return"Consultation";case"2":return"Other";case"3":return"Lab";default:return"Other"}},or=async dt=>{function vt(ft){return ft?ft.replace("Z","").replace(" +0000 UTC","").trim():null}try{const[ft,Et]=await Promise.all([vl(dt,1,1,i),_l(dt,1,10,i)]),Bt=Et?.wallet_transactions?.filter(At=>At.type?.toUpperCase()==="DEPOSIT").map(At=>({...At,created_on:At.transaction_time}))??[],Ht=ft?.data?.filter(At=>At.payment_refund?.toUpperCase()==="P")??[],$t=[...Bt,...Ht].sort((At,pr)=>{const B=new Date(vt(At.created_on)||0).getTime();return new Date(vt(pr.created_on)||0).getTime()-B});if($t.length===0){Ot({created_on:"",category_name:""});return}const Ft=$t[0];Ot({created_on:Ft.created_on??"",category_name:"service_category_id"in Ft?hr(Ft.service_category_id):Ft.type??""})}catch(ft){console.error("Error in last payment details API Call",ft),Ot({created_on:"",category_name:""})}};function ur(dt){const vt=Te.dayjs(dt).startOf("day"),Et=Te.dayjs().startOf("day").diff(vt,"day");return Et===0?"Today":Et===1?"Yesterday":Et>=2?`${Et} days ago`:vt.format("DD MMM YYYY")}return e.jsxRuntimeExports.jsx("div",{id:"react_patientpopup_mfe",children:e.jsxRuntimeExports.jsxs(Tt.Provider,{value:{billPreferences:$,preferences:A,currentWindow:L,patientDetails:G,setShowPrintModal:re,showPrintModal:O,setEndConsultationClicked:J,doctorListArr:N,docPreference:ie,serviceListArr:z,patientIDs:Q,showToast:Qt,isLoading:S,setLoading:h,formattedService:fe,ppEventProps:ke,getAndSetServiceListArr:nr,patientCustomFieldData:fr,getLastBillsPaymentData:or,setLastBillPaymentData:Ot,variable:i},children:[e.jsxRuntimeExports.jsx("div",{children:l&&e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(52, 64, 84, 0.5)",position:"fixed",alignContent:"center",justifyContent:"center",zIndex:1060,height:"100vh",display:"flex",width:"100%",top:0,paddingTop:"50px",left:0},children:e.jsxRuntimeExports.jsxs("div",{style:{zIndex:1e3,borderRadius:"12px",border:"0px",backgroundColor:"var(--White, #FFFFFD)",boxShadow:"0px 8px 8px -4px rgba(16, 24, 40, 0.03), 0px 20px 24px -4px rgba(16, 24, 40, 0.08)",padding:"0px",width:R?"980px":"1267px",maxHeight:"80.45vh",minHeight:"70vh",inset:"6%"},children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-sticky hfl-top-0 hfl-z-50",children:e.jsxRuntimeExports.jsx(zn,{redirectionPage:ce,patientIDs:Q,setShowPatientPopModal:I,handleCurrentWindow:er,closePrintModal:at})}),S&&e.jsxRuntimeExports.jsx("div",{className:" hfl-absolute hfl-flex hfl-items-center hfl-justify-center hfl-rounded-b-2xl hfl-bg-White",style:{width:"inherit",height:"598px"},children:e.jsxRuntimeExports.jsx(Gs,{})}),L===jt[1]&&e.jsxRuntimeExports.jsx(ha,{}),L===jt[2]&&e.jsxRuntimeExports.jsx(da,{closePrintModal:at}),L===jt[3]&&e.jsxRuntimeExports.jsx(ba,{closePrintModal:at,handleCurrentWindow:er}),L===jt[4]&&e.jsxRuntimeExports.jsx(Na,{closePrintModal:at}),L===jt[5]&&e.jsxRuntimeExports.jsx(xa,{closePrintModal:at,setLatestMetaData:Zt,setInvestigationDropdown:Pe,setCustomTranslations:oe,getVisitpadPreferenceHandler:br,updateVPPrefUsingDocPref:lr}),L===jt[6]&&e.jsxRuntimeExports.jsx(Ma,{showToast:Qt}),L===jt[8]&&e.jsxRuntimeExports.jsx(Kn,{patientAbhaDetails:Ce,setPatientAbhaDetails:Fe,getPatientDetails:kt,isPartnerServiceEnabled:window?.partner_service_enabled==="1",partnerConfig:He}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-h-[40px] hfl-items-center hfl-rounded-b-md hfl-border-t-1 hfl-border-Gray-200 hfl-bg-White hfl-p-4 ",children:ct.created_on&&e.jsxRuntimeExports.jsxs(e.bs,{variant:"Medium",type:"Text sm",children:["Last Payment: ",ur(ct.created_on),ct.category_name&&` (${ct.category_name})`]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[100]",children:e.jsxRuntimeExports.jsx(e.qh,{toastList:V})})]})}),O?.visible&&e.jsxRuntimeExports.jsx(le.PrintModal$1,{modalProps:{mfePrefix:"hfl",printType:O.printType,onCloseModal:at,showToast:Qt,currentPrintTime:O.currentPrintTime,whichPreview:O.whichPreview,envName:i},billPrintProps:O.printType==="bill"||O.printType==="bill_deposit_refund"?{billPatientDetails:O.details.billPatientDetails,billServiceDetails:O.details.billServiceDetails,billSummaryDetails:O.details.billSummaryDetails,preferences:{...$?.print?.bill,...$?.org_details,...$?.branch_details,doc_sign_img:Gt,doc_sign_text:Dt},showPrintPreviewForBill:O.details.showPrintPreviewForBill,isWholeBill:O.details.isWholeBill,payloadDataforEmail:O.details.payloadDataforEmail,printDataFrom:O.printDataFrom,depositRefundBillDetails:O.details.depositRefundBillDetails}:void 0,optionFormProps:{selectedLanguage:xe,showLanguageDropDown:O.printType==="visit"&&T?.print==="1"||O.printType==="visit"&&window.role_id!="11",showPrintPrefDropDown:!0,setSelectedLanguage:dt=>Ve(dt),googleReview:!1,showEmailInput:!0,showPhoneInput:O.printType==="visit"},ampEventProps:{vpEventProps:"",setvpEventProps:()=>{},trackEventHandler:dt=>{O.trackEventHandler?.(dt)}},visitpadProps:O.printType==="visit"?{printDataFrom:O.printDataFrom,patientDetails:G,visitDetails:O.details,offlineMode:!1,visitId:O.visitId,preferences:O?.visitpadPref||A,endConsultationClicked:ae,visitDate:O.visit_date,visitPadOrder:O?.visitpadPref?.visitpad_order?Fl(O?.visitpadPref?.visitpad_order,O?.visitpadPref?.visit_pad_json):st,visitNumber:O.visit_number,customTranslations:K,latestMetaData:mt,investigationDropdown:Be,printDateTime:()=>"",getInvestigationTestNameOffline:()=>{},updateVPPrefUsingDocPref:lr,patientCustomFields:fr}:void 0,appointmentInfoProps:O.printType==="visit"&&O.printDataFrom==="patient_popup"?O.appointmentInfo:void 0})]})}),l&&e.jsxRuntimeExports.jsx(ga,{fontBaseUrl:i.fontBaseUrl})]})})}exports.PatientPopupContainer=Ha;exports.useMediaQuery=Bs;
|