hplx-feature-library 1.0.192 → 1.0.193

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.
@@ -0,0 +1,36 @@
1
+ "use strict";const e=require("./index-DQlbIHh3.cjs"),v=require("react"),et=require("./common-utils-CJv4_aVl.cjs"),le=require("./PrintModal-8N1cT8wF.cjs"),Ie=require("./dayjs.min-DXp74Ozx.cjs"),$r=require("./APIAction-5-3i1gGx.cjs"),qt=require("./CommonConstant-COHqiSWL.cjs"),Xr=require("./index.esm-BdlMQ1M7.cjs");;/* empty css */const Rl=require("./useMediaQuery-D4SIgdMW.cjs"),tn=require("./ReusableModal-CIgDYOWZ.cjs"),Gl={color:"white"},br=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:Gl}),e.jsxRuntimeExports.jsx("div",{className:"hfl-text-1",children:e.jsxRuntimeExports.jsx(e.bs,{variant:i.isSelected?"Bold":"Regular",type:"Text sm",style:Gl,className:"hover:hfl-underline",children:i.label})})]})})}),It=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:et.E_ENVIRONMENT.DEVELOPMENT}}),xl="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",zl={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:""},rn={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"}},pl=[{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:""}],Ir=[{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}],sn=10,ln=10,ft=["bill_summary","service_level_bill","consult_details","lab_detail","other_detail","payment_summary","delete_item","deposit","deposit_summary","payment_mode"],Pt=["Doctor consultation","Other Services","Internal lab tests"],qr=["CASH","CARD","M-WALLET","UPI/UPI QR SCAN","CHEQUE","BANK TRANSFER","INSURANCE","PATIENT APP","HBOOK","DEPOSIT","CREDIT","CGHS","RGHS","PMJAY","AYUSHMAN BHARAT"],Ds=["CASH","CARD","UPI/UPI QR SCAN","M-WALLET","CHEQUE","BANK TRANSFER"],Jr={0:"M",1:"F",2:"O"};var Ur=(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))(Ur||{}),ur=(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))(ur||{}),jr=(i=>(i.deposit_refund="deposit_refund",i.consultation_lab_other_services="consultation_lab_other_services",i))(jr||{});const fr={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 Xt=(i=>(i.lis_report="lis_report",i.healthplix_report="healthplix_report",i))(Xt||{});const Yr={lis_report:{key:"lis_report",label:"LIS Reports"},healthplix_report:{key:"healthplix_report",label:"HealthPlix Reports"}},Rt=["abha","appointment","add_bills","bills","payments","visits","lab","doc","profile"],nn={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"},gl=[{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"}],an=async({callback:i},d,c)=>{try{const a={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"&&(a.partner_service_enabled=!0);const y=await et.ReArchAPI(c.token,c.envName).post($r.GET_PATIENT_DETAILS,{...a}),{data:R}=y||{},{error:l}=R||{};if(l)throw new Error(l);i(R)}catch(a){console.log(a),i(void 0)}},on=async i=>{try{const d=await et.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)}},un=async i=>{try{const d=await et.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)}},vl=async(i="all",d,c=1,a=20,y)=>{try{const R=await et.ReArchAPI(y.token,y.envName).get(`${le.GET_BILLS}?date=${i}&patient_role_id=${d}&page_no=${c}&page_size=${a}&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)}},yl=async(i,d=1,c=10,a)=>{try{const y=await et.ReArchAPI(a.token,a.envName).get(`${le.GET_PAYMENT}?patient_role_id=${i}&branch_id=${a.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)}},wl=async(i,d,c)=>{try{const a=await et.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}=a||{};return Promise.resolve(y)}catch(a){return console.log(a),Promise.reject(a)}},_l=async(i,d,c=!0,a)=>{try{const y=await et.ReArchAPI(a.token,a.envName).get(`${le.GET_PAST_DUE}?bill_date=${i}&org_branch_id=${a.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)}},cn=async(i,d,c)=>{try{const a=await et.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}=a||{};return Promise.resolve(y)}catch(a){return console.log(a),Promise.reject(a)}},dn=async(i,d,c,a)=>{try{const y={billing_person_role_id:+a.window_var.doctor_role_id_for_seg,org_branch_id:+a.window_var.org_branch_id_for_seg,patient_role_id:+d,doctor_id:+a.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:Pt.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 et.ReArchAPI(a.token,a.envName).post(le.GET_BILLS,{...y}),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}},fn=async(i,d,c)=>{try{const a={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 et.ReArchAPI(c.token,c.envName).put(le.PUT_BILL_ITEM,{...a}),{data:R}=y||{};return Promise.resolve(R)}catch(a){return console.log(a),Promise.reject(a)}},ml=async(i,d,c,a,y,R={},l)=>{try{const A={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:a,org_branch_id:+l.window_var.org_branch_id_for_seg,refund_details:R},S=await et.ReArchAPI(l.token,l.envName).put(le.PUT_BILLS,{...A}),{data:h}=S||{};return Promise.resolve(h)}catch(A){return console.log(A),Promise.reject(A)}},Yl=async(i,d,c,a,y,R)=>{try{const l=await et.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=${a}`),{data:A}=l||{};return Promise.resolve(A)}catch(l){return console.log(l),Promise.reject(l)}},Gs=async(i="all",d,c=1,a=10,y=!1,R)=>{try{const l=await et.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=${a}&skip_appnt_with_bill=${y}`),{data:A}=l||{};return Promise.resolve(A)}catch(l){return console.log(l),Promise.reject(l)}},hn=async(i,d="all",c="0",a)=>{try{const y=await et.ReArchAPI(a.token,a.envName).get(`${le.GET_APPOINTMENTS}/services/${i}?appnt_date=${d}&doctor_id=${a.window_var.person_id_for_seg}&org_branch_id=${a.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)}},pn=async(i,d,c,a,y,R,l)=>{try{const A={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:a,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:Ie.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 et.ReArchAPI(l.token,l.envName).post(le.PUT_APPOINTMENTS,{...A}),{data:h}=S||{};return Promise.resolve(h)}catch(A){return console.log(A),Promise.reject(A)}},mn=async(i,d,c,a,y)=>{try{const R={doctor_id:y.window_var.person_id_for_seg,patient_role_id:a,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:Ie.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:Ie.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 et.ReArchAPI(y.token,y.envName).put(le.PUT_APPOINTMENTS,{...R}),{data:A}=l||{};return Promise.resolve(A)}catch(R){return console.log(R),Promise.reject(R)}},xn=async(i="",d)=>{try{const c=await et.ReArchAPI(d.token,d.envName).get(`${le.GET_BRANCH_PREFERENCE}/${d.window_var.org_branch_id_for_seg}?fields_required=${i}`),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},gn=async(i,d,c="",a)=>{try{const y={branch_id:a.window_var.org_branch_id_for_seg,doctor_id:a.window_var.person_id_for_seg,doctor_role_id:a.window_var.doctor_role_id_for_seg,patient_role_id:d,extra:{visit_date:Ie.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 et.ReArchAPI(a.token,a.envName).post(le.GET_VISIT_ALL,{...y}),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}},vn=async(i,d,c,a)=>{try{const y=await et.ReArchAPI(a.enc_token,a.envName).get(`${le.GET_PATIENT_POPUP_HPLXLAB}/${c}/reports?page=${d}&limit=${i}`),{data:R}=y||{},{status:l,message:A}=R||{};if(!l)throw new Error(A);return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},yn=async(i,d,c,a)=>{try{const y=await et.ReArchAPI(a.token,a.envName).get(`${le.GET_PATIENT_POPUP_VISIT}/${c}?doctor_role_id=${a.window_var.doctor_role_id_for_seg}&doctor_id=${a.window_var.person_id_for_seg}&branch_id=${a.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)}},_n=async(i,d,c)=>{const{patientRoleID:a,patientID:y}=c||{};try{const R=await et.ReArchAPI(d.token,d.envName).put(le.UPDATE_PATIENT_DETAIL+"/"+a,{...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:a,patient_id:y}),{data:l}=R||{};return l?.status&&typeof d.window_var.getUpdatedPatientDetails=="function"&&y===d.window_var.patient_person_id&&a===d.window_var.patient_role_id&&d.window_var.getUpdatedPatientDetails(),Promise.resolve(l)}catch(R){return console.log(R),Promise.reject(R)}},bn=async i=>{try{const d=await et.hplxAPI(i.token,i.envName).post(le.GET_REFERREDBY_DOCTOR),{data:c}=d||{},{apiError:a}=c||{};if(a)throw new Error(a);return Promise.resolve(c)}catch(d){return console.log(d),Promise.reject(d)}},jn=async(i,d)=>{try{const c=await et.hplxAPI(i.token,i.envName).post(`${le.GET_IPD_CASE}?pid=${d}`),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},Rn=i=>{const d=[];if(i.length)for(const c of i)d.push({title:c,value:c});return d},wn=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},Cn=async(i,d)=>{try{const c=await et.hplxAPI(d.token,d.envName).post(le.ADD_PATIENT_IMAGE,i),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},En=async(i,d,c,a,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:a,org_branch_id:y.window_var.org_branch_id_for_seg,total_amount:i,data:d,payment_split:c},l=await et.ReArchAPI(y.token,y.envName).post(le.POST_PAYMENT,{...R}),{data:A}=l||{};return Promise.resolve(A)}catch(R){return console.log(R),Promise.reject(R)}},Pn=async(i="",d)=>{try{const c=await et.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:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},Sn=async(i,d,c)=>{try{const a={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 et.ReArchAPI(c.token,c.envName).post(le.GET_REFERRAL,{...a}),{data:R}=y||{};return Promise.resolve(R)}catch(a){return console.log(a),Promise.reject(a)}},Nn=async(i,d,c,a,y)=>{try{const R=await et.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=${a}&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)}},Cl=async(i,d,c,a)=>{try{let y="";c.forEach((A,S)=>{y="fields="+A+(S<c.length-1?"&":"")});const R=await et.ReArchAPI(a.token,a.envName).get(`${le.GET_BILLS_PAYMENTS_BILL_ID}/${i}?branch_id=${a.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)}},ql=async(i,d,c)=>{const a={patient_role_id:i,patient_id:d,branch_id:c.window_var.org_branch_id_for_seg};try{const y=await et.ReArchAPI(c.token,c.envName).post(le.GET_ABHA_INFO,a),{data:R}=y||{};return Promise.resolve(R)}catch(y){return console.log(y),Promise.reject(y)}},An=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 a=await et.ReArchAPI(d.token,d.envName).post(le.GENERATE_OTP_BY_ABHA_ADDRESS,c),{data:y}=a||{};return Promise.resolve(y)}catch(a){return console.log(a),Promise.reject(a)}},Dn=async(i,d,c,a,y)=>{const R={abha_address:i,otp:d,patient_role_id:c,patient_id:a,branch_id:y.window_var.org_branch_id_for_seg};try{const l=await et.ReArchAPI(y.token,y.envName).post(le.VERIFY_ABHA_OTP,R),{data:A}=l||{};return Promise.resolve(A)}catch(l){return console.log(l),Promise.reject(l)}},In=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 a=await et.ReArchAPI(d.token,d.envName).post(le.GET_ABHA_CONSENT,c),{data:y}=a||{};return Promise.resolve(y)}catch(a){return console.log(a),Promise.reject(a)}},Tn=async(i,d)=>{try{const c=await et.ReArchAPI(d.token,d.envName).get(`${le.GET_INSURANCE_LIST}/${i}`),{data:a}=c||{};return Promise.resolve(a)}catch(c){return console.log(c),Promise.reject(c)}},Bn=async i=>{try{const d={doctor_id:i.window_var.person_id_for_seg},c=await et.ReArchAPI(i.token,i.envName).post(le.GET_CUSTOM_TRANSLATIONS,{...d}),{data:a,status:y}=c||{};if(y!==200)throw new Error("error");return Promise.resolve(a)}catch(d){return console.log(d),Promise.reject(d)}},Gn=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},a=await et.ReArchAPI(d.token,d.envName).post(le.VERIFY_INSURANCE,{...c});return Promise.resolve(a)}catch(c){return Promise.resolve(c)}},Fn=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 et.ReArchAPI(i.token,i.envName).post(le.GET_ONLINE_TEST_RANGES,{...d}),{data:a,status:y}=c||{};if(y!==200)throw new Error("error");return Promise.resolve(a)}catch(d){return console.log(d),Promise.reject(d)}},Fl=async(i,d,c)=>{try{const a=await et.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}=a||{};if(y?.status)return Promise.resolve(y)}catch(a){return console.log(a),Promise.reject(a)}},El=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 a=await et.ReArchAPI(d.enc_token,d.envName).get(`${le.UPDATE_WALLET}/balance?emr_entity_id=${i}&entity_type=PATIENT_BRANCH&branch_id=${c}`),{data:y}=a;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)}},bl=async(i,d=1,c=10,a)=>{try{const y=await et.ReArchAPI(a.enc_token,a.envName).get(`${le.UPDATE_WALLET}/transaction?emr_entity_id=${i}&branch_id=${a.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)}},Mn=async(i,d,c,a)=>{try{const y={mode:Number(d),transaction_type:c},R=await et.ReArchAPI(a.token,a.envName).patch(`${le.GET_PAYMENT}/${i}`,y),{data:l}=R||{};return Promise.resolve(l)}catch(y){return console.log(y),Promise.reject(y)}};var Ts={exports:{}},Hn=Ts.exports,Ml;function Ln(){return Ml||(Ml=1,function(i,d){(function(c,a){i.exports=a()})(Hn,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"},a=/(\[[^[]*\])|([-_:/.,()\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?/,A=/\d*[^-_:/,()\s\d]+/,S={},h=function(N){return(N=+N)+(N>68?1900:2e3)},z=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 I=P.match(/([+-]|\d\d)/g),j=60*I[1]+(+I[2]||0);return j===0?0:I[0]==="+"?-j:j}(N)}],k=function(N){var P=S[N];return P&&(P.indexOf?P:P.s.concat(P.f))},L=function(N,P){var I,j=S.meridiem;if(j){for(var ee=1;ee<=24;ee+=1)if(N.indexOf(j(ee,0,P))>-1){I=ee>12;break}}else I=N===(P?"pm":"PM");return I},V={A:[A,function(N){this.afternoon=L(N,!1)}],a:[A,function(N){this.afternoon=L(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,z("seconds")],ss:[l,z("seconds")],m:[l,z("minutes")],mm:[l,z("minutes")],H:[l,z("hours")],h:[l,z("hours")],HH:[l,z("hours")],hh:[l,z("hours")],D:[l,z("day")],DD:[R,z("day")],Do:[A,function(N){var P=S.ordinal,I=N.match(/\d+/);if(this.day=I[0],P)for(var j=1;j<=31;j+=1)P(j).replace(/\[|\]/g,"")===N&&(this.day=j)}],w:[l,z("week")],ww:[R,z("week")],M:[l,z("month")],MM:[R,z("month")],MMM:[A,function(N){var P=k("months"),I=(k("monthsShort")||P.map(function(j){return j.slice(0,3)})).indexOf(N)+1;if(I<1)throw new Error;this.month=I%12||I}],MMMM:[A,function(N){var P=k("months").indexOf(N)+1;if(P<1)throw new Error;this.month=P%12||P}],Y:[/[+-]?\d+/,z("year")],YY:[R,function(N){this.year=h(N)}],YYYY:[/\d{4}/,z("year")],Z:g,ZZ:g};function D(N){var P,I;P=N,I=S&&S.formats;for(var j=(N=P.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(q,O,de){var je=de&&de.toUpperCase();return O||I[de]||c[de]||I[je].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(ce,Fe,ae){return Fe||ae.slice(1)})})).match(a),ee=j.length,H=0;H<ee;H+=1){var G=j[H],W=V[G],J=W&&W[0],ue=W&&W[1];j[H]=ue?{regex:J,parser:ue}:G.replace(/^\[|\]$/g,"")}return function(q){for(var O={},de=0,je=0;de<ee;de+=1){var ce=j[de];if(typeof ce=="string")je+=ce.length;else{var Fe=ce.regex,ae=ce.parser,Y=q.slice(je),fe=Fe.exec(Y)[0];ae.call(O,fe),q=q.replace(fe,"")}}return function(M){var Ce=M.afternoon;if(Ce!==void 0){var Me=M.hours;Ce?Me<12&&(M.hours+=12):Me===12&&(M.hours=0),delete M.afternoon}}(O),O}}return function(N,P,I){I.p.customParseFormat=!0,N&&N.parseTwoDigitYear&&(h=N.parseTwoDigitYear);var j=P.prototype,ee=j.parse;j.parse=function(H){var G=H.date,W=H.utc,J=H.args;this.$u=W;var ue=J[1];if(typeof ue=="string"){var q=J[2]===!0,O=J[3]===!0,de=q||O,je=J[2];O&&(je=J[2]),S=this.$locale(),!q&&je&&(S=I.Ls[je]),this.$d=function(Y,fe,M,Ce){try{if(["x","X"].indexOf(fe)>-1)return new Date((fe==="X"?1e3:1)*Y);var Me=D(fe)(Y),Le=Me.year,ht=Me.month,dt=Me.day,nt=Me.hours,ke=Me.minutes,pt=Me.seconds,Ct=Me.milliseconds,xt=Me.zone,Nt=Me.week,Bt=new Date,T=dt||(Le||ht?1:Bt.getDate()),De=Le||Bt.getFullYear(),Ue=0;Le&&!ht||(Ue=ht>0?ht-1:Bt.getMonth());var re,X=nt||0,Z=ke||0,ie=pt||0,Te=Ct||0;return xt?new Date(Date.UTC(De,Ue,T,X,Z,ie,Te+60*xt.offset*1e3)):M?new Date(Date.UTC(De,Ue,T,X,Z,ie,Te)):(re=new Date(De,Ue,T,X,Z,ie,Te),Nt&&(re=Ce(re).week(Nt).toDate()),re)}catch{return new Date("")}}(G,ue,W,I),this.init(),je&&je!==!0&&(this.$L=this.locale(je).$L),de&&G!=this.format(ue)&&(this.$d=new Date("")),S={}}else if(ue instanceof Array)for(var ce=ue.length,Fe=1;Fe<=ce;Fe+=1){J[1]=ue[Fe-1];var ae=I.apply(this,J);if(ae.isValid()){this.$d=ae.$d,this.$L=ae.$L,this.init();break}Fe===ce&&(this.$d=new Date(""))}else ee.call(this,H)}}})}(Ts)),Ts.exports}var kn=Ln();const Vn=e.getDefaultExportFromCjs(kn);Ie.dayjs.extend(Vn);const Ul=(...i)=>{let d=!1;try{const c=/^[a-zA-Z]+$/;for(const a of i){const y=a.toString();if(y.includes(".")||y.includes("-")||c.test(y)){d=!0;break}}}catch{return!1}return d},Kl=async(i,d=!0,c,a,y,R,l,A=!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 z=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(z)){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:k,order_unit_item_price:L,order_item_discount:V,order_item_service_tax:D,order_item_service_tax_percentage:N=0,order_item_price:P}=i;if(!d&&Ul(k,L,V,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(L*k*.01*N),appnt_time:Ie.dayjs(z,"hh:mm A").format("HH:mm:ss")},i.appnt_id.length)try{const I=await mn(i,d,a?.name,y.patientRoleID,S),j=I.appnt_update_status?"Success":"Error";if(I.appnt_update_message&&(h=I),c(j,I.appnt_update_message,j,3e3),A){const ee=I.bill_update_status?"Success":"Error";c(ee,I.bill_update_message,ee,3e3)}}catch(I){console.error("Error while create/update appointnment",I),c("Error",I.data.message,"Error",3e3)}else{const I=await pn(i,d,a.name,a.phone_number,y.patientRoleID,l,S),j=I.appnt_create_status?"Success":"Error";if(I.appnt_create_status&&(h=I),c(j,I.appnt_create_message,j,3e3),A){const ee=I.bill_create_status?"Success":"Error";c(ee,I.bill_create_message,ee,3e3)}}return h}catch{c("Error","Something went wrong while creating/updating appointment","Error",3e3)}},Pl=async(i,d,c,a,y,R=Pt[0],l)=>{let A={};try{if(R===Pt[0]&&!i.appnt_doctor_role_id){d("Error","Doctor name is missing","Error",3e3);return}if(R===Pt[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:z=0,order_item_discount:g,order_item_service_tax:k,order_item_price:L}=i;if(Ul(S,h,g,k,L)){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*z)};try{if(i?.order_item_id?.length){const D=await fn(i,c,l);d(D.status?"Success":"Error",D.message,D.status?"Success":"Error",3e3),D.status&&(A=D)}else{const D=await dn(i,c,a,l);d(D.status?"Success":"Error",D.message,D.status?"Success":"Error",3e3)}}catch(D){console.error("Error while create/update bill",D)}return A}catch{console.log("error in handleCreateUpdateBill API Call"),d("Error","Something went wrong while create update bill","Error",3e3)}},Zl=async(i,d,c)=>{try{const a=await Cl(i,d,["payments"],c),y=Array.isArray(a?.payments)?a.payments:[],R=[...new Set(y.map(l=>ur[l.mode]).filter(l=>typeof l=="string"))];return{lab_owner_name:a?.lab_owner_name??"",paymentModes:R}}catch(a){return console.error("Error in fetching payment modes from bill id:",a),null}},On=async(i,d,c)=>{const a={lab_owner_name:"",paymentsData:new Map([])},y=i.map(l=>Cl(l,d,["payments"],c));return(await Promise.all(y)).forEach(l=>{l.service_category_id==3&&(a.lab_owner_name=l.lab_owner_name),Array.isArray(l.payments)&&l.payments.length>0?a.paymentsData.set(l.service_category_id,l.payments.map(A=>A?.mode)):a.paymentsData.set(l.service_category_id,[])}),a},$l=(i="")=>{switch(i){case"0":return"male";case"1":return"female";case"2":return"others";default:return""}},Wn={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"},Hl=(i,d)=>{let c={};try{c=JSON.parse(d)}catch(R){return console.error("Failed to parse visit_pad_json:",R),[]}const a=Array.isArray(i)?i:i.split(","),y=[];return a.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 A=c?.[l];A&&(R==="presc"||A?.include==="1")&&(R==="obstetricHistory"&&c?.obhGpla?.include==="0"&&c?.obhPregnancyHistory?.include==="0"||y.push(R))}),y.map(R=>Wn[R]||R)},zn="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",Yn="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",hr=(i="")=>{const d=new Date(i),a=Math.abs(new Date().getTime()-d.getTime()),y=Math.ceil(a/(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`},nr=i=>i?i.toLowerCase().replace(/\b\w/g,d=>d.toUpperCase()):"",Xl=i=>{switch(i){case"DEPOSIT":return zn;case"REFUND":return Yn;default:return""}},qn=i=>{const{handleCurrentWindow:d,setShowPatientPopModal:c,patientIDs:a,redirectionPage:y,closePrintModal:R}=i,l=v.useContext(It);if(!l)throw new Error("PatientPopupHeader must be used within an AppContext.Provider");const{currentWindow:A,patientDetails:S,docPreference:h,billPreferences:z,setLastBillPaymentData:g,variable:k}=l,{name:L,age:V,gender:D,image_link:N,org_person_bid_str:P,org_person_dob:I,honorific:j}=S||{};window.patientPopupClosehandler=()=>{if(c(!1),R(),g({created_on:"",category_name:""}),window.location.pathname.indexOf("/frontdesk/")!==-1){const H=document.getElementById("appointmentRefreshBtn");H&&H.click()}};const ee=()=>{y==="appointments"?typeof window.redirectVPFromAppnt=="function"&&window.redirectVPFromAppnt(a?.patientRoleID||"",a?.patientID||""):y==="consultations"?typeof window.redirectVPFromConsult=="function"&&window.redirectVPFromConsult(a?.patientRoleID||"",a?.patientID||""):y==="addpatient"||y==="frontDeskDashboard"?window.location.href=`${window.origin}${qt.EAPP_ROUTES.visitpad}?pid=${a?.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}. `:"",L]}),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:[$l(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"}),V?typeof V=="number"?`${V} Years`:hr(`${V}`):I&&hr(I)||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"})]})]})]}),k.window_var.role_id==="11"&&e.jsxRuntimeExports.jsx(e.Ku,{onClick:ee,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(br,{disabled:!1,src:xl,onClickHandler:()=>d(Rt[8]),label:"Abha",isRequired:h?.abha?.link_patient_rx??!1,isSelected:A===Rt[8],data_qa:"abha-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[1]?"hx_patient-calendar-filled":"hx_patient-calendar",onClickHandler:()=>d(Rt[1]),label:"Appnt",isRequired:!0,isSelected:A===Rt[1],data_qa:"appoint-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[2]?"hx_patient-add-bil-filled":"hx_patient-add-bil",onClickHandler:()=>{d(Rt[2])},label:"Add Bills",isRequired:!0,isSelected:A===Rt[2],data_qa:"add-bills-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[3]?"hx_patient-all-bills-filled":"hx_patient-all-bills",onClickHandler:()=>{d(Rt[3])},label:"Bills",isRequired:!0,isSelected:A===Rt[3],data_qa:"bill-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[4]?"hx_patient-payments-filled":"hx_patient-payments",onClickHandler:()=>{d(Rt[4])},label:"Payments",isRequired:!0,isSelected:A===Rt[4],data_qa:"payments-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[5]?"hx_patient-visits-filled":"hx_patient-visits",onClickHandler:()=>{d(Rt[5])},label:"Visits",isRequired:!0,isSelected:A===Rt[5],data_qa:"visits-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[6]?"hx_patient-lab-filled":"hx_patient-lab",onClickHandler:()=>d(Rt[6]),label:"Lab",isRequired:k.window_var.permit_lab_tech==="1"||z?.features?.enable_lis_v1===!0,isSelected:A===Rt[6],data_qa:"lab-tab"}),e.jsxRuntimeExports.jsx(br,{disabled:!1,icon:A===Rt[8]?"hx_patient-user-filled":"hx_patient-user",onClickHandler:()=>d(Rt[8]),label:"Profile",isRequired:!0,isSelected:A===Rt[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"})]})]})},Un=()=>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"})})]}),Kn=i=>{const{patientAbhaDetails:d,savePatientDetailsHandler:c,setPatientAbhaDetails:a,patientData:y}=i,{showToast:R,patientIDs:l,variable:A}=v.useContext(It)||{},[S,h]=v.useState(""),[z,g]=v.useState(""),[k,L]=v.useState(),V=async(D=!1)=>{try{if(k?.status&&!D){const N=await Dn(k.abha_address,z,l?.patientRoleID||"",l?.patientID||"",A);if(N.status){const P=await ql(l?.patientRoleID||"",l?.patientID||"",A);a(P),In(k.abha_address,A);const I=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,I||"")}else R("Error",N.error,"Error",3e3)}else{const N=await An(S,A);L(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:xl,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:xl,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"}),k?.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 V(!0)},children:[e.jsxRuntimeExports.jsx("div",{className:"hx_rewind hfl-font-bold hfl-text-3"}),"Resend OTP"]})]})]}),k?.status&&e.jsxRuntimeExports.jsx(e.Ps,{inputProps:{value:z,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:k?.status?"Submit OTP":"Verify ABHA",onClick:async()=>{await V()}})]})},Zn=v.forwardRef(i=>{const{patientData:d={},setPatientData:c,preferences:a,referredByDocList:y,throughChannelList:R,showImageFromLink:l,validators:A,setValidators:S,billPreferences:h,isAbhaVerified:z,isPartnerServiceEnabled:g,insuranceData:k,partnerConfig:L,verifyInsuranceHandler:V,policyNumberErrorMessage:D,selectedInsuranceDetails:N,setSelectedInsuranceDetails:P,insuranceDivRef:I,patientCustomFieldData:j}=i,[ee,H]=v.useState(!1),[G,W]=v.useState([]),[J,ue]=v.useState([]),[q,O]=v.useState(!1),[de,je]=v.useState(!1),[ce,Fe]=v.useState([]),ae=h?.permissions?.edit_patient_name,{phone_number:Y,age:fe,org_person_dob:M,gender:Ce,honorific:Me,name:Le,patient_preferred_language:ht,blood_group:dt,spouse_name:nt,marital_status:ke,married_since:pt,spouse_blood_group:Ct,org_person_bid_str:xt,ref_doc_name:Nt,ref_doc_spec:Bt,email:T,phone_secondary:De,pincode:Ue,address:re,through_channel:X,care_of:Z,tag:ie,image_link:Te,aadhar_number:Pe}=d,[mt,Jt]=v.useState(Ce),[vt,Wt]=v.useState("Years"),[Gt,er]=v.useState(""),[tr,lr]=v.useState(!1),[pr,ar]=v.useState([]),cr=v.useRef(),yt=(B,ye)=>{c(jt=>({...jt,[B]:ye})),B=="gender"&&ye==""?S(jt=>({...jt,gender:"Select Gender"})):S(jt=>({...jt,gender:""}))};v.useEffect(()=>{Me&&er(Me)},[Me]),v.useEffect(()=>{Te&&l(Te)},[Te]);const rr=B=>{const{value:ye}=B.target,jt=_t(ye);W(jt)},dr=B=>{yt("occupation",B.trim()),O(!1)},mr=B=>{yt("city",B.trim()),je(!1)},ir=B=>{const{value:ye}=B.target,jt=ot(ye);ue(jt)},xr=B=>{const{value:ye}=B.target,jt=ut(ye);Fe(jt)},ot=B=>{if(qt.OccupationList?.length){let ye=qt.OccupationList;return B?.length&&(ye=qt.OccupationList.filter(jt=>jt.toLowerCase().includes(B.toLowerCase()))),ye}else return[]},_t=B=>{if(R?.length){let ye=R;return B?.length&&(ye=R.filter(jt=>jt.title.toLowerCase().includes(B.toLowerCase()))),ye}else return[]},ut=B=>{if(qt.CityList?.length){let ye=qt.CityList;return B?.length&&(ye=qt.CityList.filter(jt=>jt.toLowerCase().includes(B.toLowerCase()))),ye}else return[]},Et=(B="")=>{const ye=B?.toLowerCase();return M!==""?"":fe!==""&&Number(fe)<0&&M===""?"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(!M){const B=et.calculateDOB(d.age,vt);B&&c(ye=>({...ye,org_person_dob:B}))}},[vt,d.age]);const Ht=B=>{Jt(B),yt("gender",B),S(ye=>({...ye,gender:""}))},Ft=B=>{yt("through_channel",B.value.trim()),H(!1)},Lt=B=>{cr.current&&!cr.current.contains(B.target)&&lr(!1)},Vt=(B,ye,jt)=>{c(kt=>{const Kt=kt.custom_fields?.length?kt.custom_fields.map(sr=>sr.id===B?{...sr,value:jt}:sr):[];return Kt.some(sr=>sr.id===B)||Kt.push({id:B,value:jt,title:ye}),{...kt,custom_fields:Kt}})},Tt=v.useCallback(()=>j?.map(B=>{const{id:ye,type:jt,title:kt}=B||{};if(!ye||!jt||!kt)return null;const Kt=d.custom_fields?.find($t=>$t.id===ye)?.value||"";switch(jt){case"text":return e.jsxRuntimeExports.jsx(e.Ps,{label:kt,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",inputProps:{value:Kt||"",placeholder:`Enter ${kt}`,onChange:$t=>{Vt(ye,kt,$t.target.value)}},width:"21em"},ye);case"date":return e.jsxRuntimeExports.jsx(e.ZC,{label:kt,placeholder:`Select ${kt}`,selectDate:Kt?new Date(Kt):null,clearDate:$t=>{Vt(ye,kt,$t)},dateVar:$t=>{Vt(ye,kt,$t)},isborderRequired:!0,width:"22em",openUp:!0,backSpaceClearDate:!0},ye);default:return null}}),[j,d.custom_fields]);return v.useEffect(()=>{const B=Object.keys(L).map(ye=>{if(L[ye]?.verify_insurance?.enable)return{value:ye,label:ye}}).filter(ye=>ye);ar(B??[])},[L]),v.useEffect(()=>(document.addEventListener("mousedown",Lt),()=>{document.removeEventListener("mousedown",Lt)}),[]),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:ae?"":"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:cr,className:"-hfl-ml-2 hfl-flex hfl-w-16 hfl-items-center hfl-justify-between hfl-bg-Gray-50",onClick:()=>lr(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:Gt}),!Gt.length&&e.jsxRuntimeExports.jsx("div",{className:`${tr?"hx_up":"hx_down"} -hfl-mr-2`})]}),errorMsg:!!A.name&&A.name,inputProps:{type:"text",value:Le,disabled:z,placeholder:"Enter Name",onChange:B=>{yt("name",B.target.value)},onBlur:()=>{const B=!(Le.length>0);Le.length>0&&Le.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"}),tr&&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:qt.HonorificList.map(B=>e.jsxRuntimeExports.jsx(e.ks,{className:"hfl-text-Primary-700",label:B.label,onSelect:()=>{er(B.label),lr(!1),Jt(B.gender),yt("honorific",B.label),yt("gender",B.gender),c(ye=>({...ye,gender:B.gender,patHonorific:B.label}))}}))})]}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx(e.Ps,{label:`Phone ${a&&a.phone_number_length?"*":""}`,labelColor:"hfl-text-Gray-600",labelSize:"Text sm",errorMsg:!!A.phone_number&&A.phone_number,inputProps:{maxLength:10,value:Y,placeholder:"Enter Number",onChange:B=>{yt("phone_number",B.target.value.replace(/[^0-9]/g,""))},onBlur:()=>{const{isError:B=!1,msg:ye=""}=a&&a.phone_number_length||Y?et.validateMobileNo(Y):{};S(jt=>({...jt,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 ${A.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}),!!A.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:A.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:vt,end_icon:"hx_down",errorMsg:!!A.age&&A.age,inputProps:{disabled:z,type:"number",min:0,maxLength:3,placeholder:"Age",onChange:B=>{yt("age",B.target.value.replace(/[^0-9]/g,"")),c(ye=>({...ye,org_person_dob:""}))},onBlur:()=>{S(B=>({...B,age:Et(vt)}))}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{disabled:z,placeholder:"Select format"},suffixOptions:[{label:"Years",value:"years"},{label:"Weeks",value:"weeks"},{label:"Months",value:"months"},{label:"Days",value:"days"}],handleValChange:B=>{yt("age",B),S(ye=>({...ye,age:Et(vt)}))},handleSuffixValChange:B=>{Wt(B),S(ye=>({...ye,age:Et(B)}))},onSuffixDropdownClick:B=>{Wt(B.label),c(ye=>({...ye,age_selector:B.value,org_person_dob:""})),S(ye=>({...ye,age:Et(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:z,width:"8em",height:"!hfl-h-[40px]",label:"",labelSize:"Text sm",labelColor:"hfl-text-Gray-700",selectDate:M&&et.isValidDate(new Date(M))?new Date(Ie.dayjs(new Date(M)).format("DD-MMM-YYYY")):"",dateVar:B=>{c(ye=>({...ye,org_person_dob:Ie.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:ht?qt.DefinedLanguages[ht]:"English"},placeholder:"English",label:"Preferred Language",onChange:B=>{yt("patient_preferred_language",B.value)},options:Object.keys(qt.DefinedLanguages).map(B=>({label:qt.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:Ue,placeholder:"Enter Pin",onChange:B=>{yt("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=>{yt("city",B.target.value),je(!0),xr(B)},onBlur:B=>{B.stopPropagation(),je(!1)}},width:23.5+"em"}),de&&ce&&ce.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:ce.map(B=>e.jsxRuntimeExports.jsx(e.ks,{label:B,className:"hfl-text-Primary-700",onSelect:()=>mr(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:re,placeholder:"Enter Address",onChange:B=>{yt("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:ke&&qt.MARITAL_STATUS.find(B=>B===ke)||""},placeholder:"Marital Status",label:"Marital Status",onChange:B=>{yt("marital_status",B.label)},options:qt.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&&et.isValidDate(new Date(pt))?new Date(Ie.dayjs(new Date(pt)).format("DD-MMM-YYYY")):"",dateVar:B=>{c(ye=>({...ye,married_since:Ie.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:dt&&qt.bloodGroups.find(B=>B.value===dt)?.label||"Blood group"},onChange:B=>{yt("blood_group",B.value)},options:qt.bloodGroups,className:"!hfl-h-11 hfl-w-[370px]","data-qa":"blood-group"})]}),ke!==qt.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:nt,placeholder:"Enter Spouse Name",onChange:B=>{yt("spouse_name",B.target.value)}},width:"21em"}),e.jsxRuntimeExports.jsx(e.Ap,{label:"Spouse Blood Group",placeholder:"Enter blood group",value:{label:Ct?qt.bloodGroups.find(B=>B.value===Ct)?.label||"Spouse Blood group":"Blood group"},onChange:B=>{yt("spouse_blood_group",B.value)},options:qt.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:xt,placeholder:"Enter ID",onChange:B=>{yt("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:Nt,input2value:Bt,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:qt.SpecialityList,handleValChange:B=>{yt("ref_doc_name",B)},handleSuffixValChange:B=>{yt("ref_doc_spec",B.value)},onDropdownClick:B=>{yt("ref_doc_name",B.doctor_name),yt("ref_doc_id",B.doctor_id),yt("refDocId",B.doctor_id),yt("ref_doc_spec",B.specialist)},onSuffixDropdownClick:B=>{yt("ref_doc_spec",B.value)}}),e.jsxRuntimeExports.jsx(e.Ps,{label:"Email",className:"",classNameParentDiv:"hfl-relative",showEmailSuggestions:!0,labelColor:"hfl-text-Gray-600",errorMsg:!!A.email&&A.email,labelSize:"Text sm",start_icon:"hx_mail",inputProps:{value:T,placeholder:"Enter Email",onChange:B=>{yt("email",B.target.value.trim())},onBlur:B=>{B.target.value&&!Xr.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:X,placeholder:"Enter Channel",onChange:B=>{yt("through_channel",B.target.value),H(!0),rr(B)},onBlur:B=>{B.stopPropagation(),H(!1)}},width:23.5+"em"}),ee&&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,...jt}=B||{};return e.jsxRuntimeExports.jsx(e.ks,{label:B.title,className:"hfl-text-Primary-700",...jt,onSelect:()=>Ft({...jt})})})})]}),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:Z,placeholder:"Enter C/O",onChange:B=>{yt("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=>{yt("occupation",B.target.value),O(!0),ir(B)},onBlur:B=>{B.stopPropagation(),O(!1)}},width:23.5+"em"}),q&&J&&J.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:J.map(B=>e.jsxRuntimeExports.jsx(e.ks,{label:B,className:"hfl-text-Primary-700",onSelect:()=>dr(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:ie,placeholder:"Enter Tag",onChange:B=>{yt("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=>{yt("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=>{yt("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:pr,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:I,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:k,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:()=>V(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:Tt()})]})]})})}),$n=i=>{const{getPatientDetails:d,setPatientAbhaDetails:c,patientAbhaDetails:a,isPartnerServiceEnabled:y,partnerConfig:R}=i,[l,A]=v.useState(""),[S,h]=v.useState(!1),[z,g]=v.useState(!1),[k,L]=v.useState(!1),[V,D]=v.useState([]),[N,P]=v.useState([]),I=v.useRef(null),j=v.useRef(null),[ee,H]=v.useState("profile"),{docPreference:G,patientDetails:W,preferences:J,patientIDs:ue,billPreferences:q,showToast:O,patientCustomFieldData:de,variable:je}=v.useContext(It)||{},ce=W?.org_person_bid_str||"",[Fe,ae]=v.useState([]),[Y,fe]=v.useState(""),[M,Ce]=v.useState({partner_name:"",policy_company:"",policy_id:""}),Me=v.useRef(null),[Le,ht]=v.useState({name:"",phone_number:"",age:"",gender:"",email:""}),dt=(ie,Te,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 ${ee===ie?"hfl-bg-Primary-50 hfl-text-Primary-600":""} hfl-cursor-pointer`,onClick:()=>H(ie),children:[e.jsxRuntimeExports.jsx("div",{className:Te}),e.jsxRuntimeExports.jsx(e.bs,{variant:"Medium",type:"Text sm",children:Pe})]},ie),[nt,ke]=v.useState(W),pt=async()=>{try{h(!1);const ie=await navigator.mediaDevices.getUserMedia({video:!0});j.current&&(j.current.srcObject=ie,L(!0))}catch(ie){console.error("Error accessing camera:",ie)}},Ct=ie=>{h(!1),L(!1);const Te=ie.target.files?.[0];if(!Te)return;const Pe=new FileReader;Pe.onloadend=()=>{const mt=Pe.result;typeof mt=="string"?A(mt):console.error("Failed to read file as a data URL."),ie.target&&(ie.target.value="")},Pe.onerror=()=>{console.error("There was an issue reading the file.")},Pe.readAsDataURL(Te)},xt=()=>{document.getElementById("upload-local-file")?.click()},Nt=()=>{O?.("Success","Image deleted successfully","Success",3e3),h(!0),A(""),L(!1),T()},Bt=ie=>{A(ie),h(!1),L(!1)},T=()=>{if(j.current&&j.current.srcObject){const ie=j.current.srcObject;ie instanceof MediaStream&&ie.getTracks().forEach(Te=>Te.stop())}},De=()=>{const ie=I.current,Te=j.current;if(ie&&Te){ie.width=Te.videoWidth,ie.height=Te.videoHeight;const Pe=ie.getContext("2d");Pe&&Pe.drawImage(Te,0,0,ie.width,ie.height);const mt=ie.toDataURL();A(mt),h(!1),L(!1),T()}};v.useEffect(()=>{(async()=>{try{const ie=await bn(je),{total_ref_doc_details:Te,through_channel:Pe}=ie;Te.length&&D(wn(Te)),Pe.length&&P(Rn(Pe))}catch(ie){console.log("ERROR",ie)}})()},[je]),v.useEffect(()=>{Ce({partner_name:nt?.insurance_details?.partner||"",policy_company:nt?.insurance_details?.policy_company||"",policy_id:nt?.insurance_details?.policy_id||""})},[nt?.insurance_details]),v.useEffect(()=>{const ie=async Te=>{try{const mt=(await Tn(Te,je))?.insurance_companies||{},Jt=Object.entries(mt).map(([vt,Wt])=>({value:vt,label:Wt}));ae(Jt)}catch(Pe){console.error("Failed to fetch insurance list:",Pe),ae([])}};M?.partner_name&&y?ie(M?.partner_name):ae([])},[y,M?.partner_name,je]),v.useEffect(()=>{Me?.current?.scrollIntoView({behavior:"smooth"})},[M.partner_name]);const Ue=async ie=>{if(R&&R[ie?.partner_name]?.verify_insurance?.enable){const Te=await Gn({...ie,patient_role_id:nt?.patient_id||""},je),{data:Pe}=Te||{};if(Pe.status_code===200)fe(""),O?.("Insurance Verified Successfully","","Success",3e3);else if(Pe?.error||Te?.status===500)throw fe("Policy Number is Incorrect"),console.log(Pe?.error),new Error(Pe?.error)}},re=async(ie,Te)=>{const Pe=new FormData;Pe.append("pid",ie),Pe.append("bidstr",Te),Pe.append("imgData",l);const mt=await Cn(Pe,je);mt.apiError&&O?.("Error",mt.apiError,"Error",3e3)},X=async ie=>{const Te=new FormData;Te.append("pid",ie);const Pe=await $r.deletePatientImage(Te,je);Pe.apiError&&O("Error",Pe.apiError,"Error",3e3)},Z=async(ie=nt?.name??"",Te=nt?.org_person_dob??"")=>{if(!nt||!ue?.patientRoleID){O?.("Error","Patient data not available.","Error",3e3);return}const Pe={...nt,name:ie,org_person_dob:Te};try{nt.image_link&&!l?await X(ue.patientRoleID):l&&z&&(await re(ue.patientRoleID,ce),g(!1));const mt=await _n(Pe,je,ue);mt.status?(O?.("Success",mt.message,"Success",3e3),d(ue.patientRoleID)):O?.("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:dt("profile","hx_person-id-filled hfl-text-5","Profile")}),ee==="sms"?e.jsxRuntimeExports.jsx(Un,{}):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(Kn,{patientAbhaDetails:a,patientData:nt,savePatientDetailsHandler:Z,setPatientAbhaDetails:c}),e.jsxRuntimeExports.jsx(Zn,{setPatientData:ke,patientData:nt,preferences:J,referredByDocList:V,throughChannelList:N,showImageFromLink:Bt,setValidators:ht,validators:Le,billPreferences:q,isAbhaVerified:a?.patient_details_mongo?.length,isPartnerServiceEnabled:y,insuranceData:Fe,partnerConfig:R,verifyInsuranceHandler:Ue,policyNumberErrorMessage:Y,selectedInsuranceDetails:M,setSelectedInsuranceDetails:Ce,insuranceDivRef:Me,patientCustomFieldData:de})]}),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:Ct}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:"Upload",icon:"Left",iconFile:"hx_image-add",onClick:xt,"data-qa":"choos-img"})]})]}),e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-flex
6
+ ${k?"":"hfl-hidden"}`,children:[e.jsxRuntimeExports.jsx("canvas",{ref:I,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:Nt}),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||k?"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),Nt()},"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:()=>Z(),"data-qa":"save-details"})})]})]})]})};var Is={exports:{}},Kr={exports:{}},Xn=Kr.exports,Ll;function Jn(){return Ll||(Ll=1,function(i,d){(function(c,a){a(d,v)})(Xn,function(c,a){function y(t,o,f,p,w,_,C){try{var U=t[_](C),$=U.value}catch(Q){return void f(Q)}U.done?o($):Promise.resolve($).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($){y(_,p,w,C,U,"next",$)}function U($){y(_,p,w,C,U,"throw",$)}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 A(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)}a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;var h={init:"init"},z=function(t){var o=t.value;return o===void 0?"":o},g=function(){return a.createElement(a.Fragment,null," ")},k={Cell:z,width:150,minWidth:0,maxWidth:Number.MAX_SAFE_INTEGER};function L(){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,{},A(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 V=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,U,$){return typeof U=="function"?_({},U(C,$)):Array.isArray(U)?L.apply(void 0,[C].concat(U)):L(C,U)}(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 I(t,o){return typeof t=="function"?t(o):t}function j(t){var o=a.useRef();return o.current=t,a.useCallback(function(){return o.current},[])}var ee=typeof document<"u"?a.useLayoutEffect:a.useEffect;function H(t,o){var f=a.useRef(!1);ee(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 W(_,l({},t,{column:o},f,{},w))}}function W(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)?a.createElement(t,o):t;var f}function J(t,o,f){return f===void 0&&(f=0),t.map(function(p){return q(p=l({},p,{parent:o,depth:f})),p.columns&&(p.columns=J(p.columns,p,f+1)),p})}function ue(t){return ae(t,"columns")}function q(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,U,$){if(!U)return C;var Q,ge=typeof U=="function"?U:JSON.stringify(U),pe=je.get(ge)||function(){var me=function(se){return function he(Re,Se){if(Se===void 0&&(Se=[]),Array.isArray(Re))for(var Ve=0;Ve<Re.length;Ve+=1)he(Re[Ve],Se);else Se.push(Re);return Se}(se).map(function(he){return String(he).replace(".","_")}).join(".").replace(Le,".").replace(ht,"").split(".")}(U);return je.set(ge,me),me}();try{Q=pe.reduce(function(me,se){return me[se]},C)}catch{}return Q!==void 0?Q:$}(_,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 O(t,o){if(!o)throw new Error;return Object.assign(t,l({Header:g,Footer:g},k,{},o,{},t)),Object.assign(t,{originalWidth:t.width}),t}function de(t,o,f){f===void 0&&(f=function(){return{}});for(var p=[],w=t,_=0,C=function(){return _++},U=function(){var $={headers:[]},Q=[],ge=w.some(function(pe){return pe.parent});w.forEach(function(pe){var me,se=[].concat(Q).reverse()[0];ge&&(pe.parent?me=l({},pe.parent,{originalId:pe.parent.id,id:pe.parent.id+"_"+C(),headers:[pe]},f(pe)):me=O(l({originalId:pe.id+"_placeholder",id:pe.id+"_placeholder_"+C(),placeholderOf:pe,headers:[pe]},f(pe)),o),se&&se.originalId===me.originalId?se.headers.push(pe):Q.push(me)),$.headers.push(pe)}),p.push($),w=Q};w.length;)U();return p.reverse()}var je=new Map;function ce(){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 Fe(t){if(typeof t=="function")return t}function ae(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(U){return function $(Q,ge){ge===void 0&&(ge=!0),Q.isExpanded=Q.original&&Q.original[f]||p[Q.id],Q.canExpand=Q.subRows&&!!Q.subRows.length,ge&&C.push(Q),Q.subRows&&Q.subRows.length&&Q.isExpanded&&Q.subRows.forEach(function(pe){return $(pe,_)})}(U)}),C}function fe(t,o,f){return Fe(t)||o[t]||f[t]||f.text}function M(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 Me=null,Le=/\[/g,ht=/\]/g,dt=function(t){return l({role:"table"},t)},nt=function(t){return l({role:"rowgroup"},t)},ke=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)},Ct=function(t,o){return l({key:"headerGroup_"+o.index,role:"row"},t)},xt=function(t,o){return l({key:"footerGroup_"+o.index},t)},Nt=function(t,o){return l({key:"row_"+o.row.id,role:"row"},t)},Bt=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:[dt],getTableBodyProps:[nt],getHeaderGroupProps:[Ct],getFooterGroupProps:[xt],getHeaderProps:[ke],getFooterProps:[pt],getRowProps:[Nt],getCellProps:[Bt],useFinalInstance:[]}}h.resetHiddenColumns="resetHiddenColumns",h.toggleHideColumn="toggleHideColumn",h.setHiddenColumns="setHiddenColumns",h.toggleHideAllColumns="toggleHideAllColumns";var De=function(t){t.getToggleHiddenProps=[Ue],t.getToggleHideAllColumnsProps=[re],t.stateReducers.push(X),t.useInstanceBeforeDimensions.push(Z),t.headerGroupsDeps.push(function(o,f){var p=f.instance;return[].concat(o,[p.state.hiddenColumns])}),t.useInstance.push(ie)};De.pluginName="useColumnVisibility";var Ue=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"}]},re=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 X(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:I(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 Z(t){var o=t.headers,f=t.state.hiddenColumns;a.useRef(!1).current;var p=0;o.forEach(function(w){return p+=function _(C,U){C.isVisible=U&&!f.includes(C.id);var $=0;return C.headers&&C.headers.length?C.headers.forEach(function(Q){return $+=_(Q,C.isVisible)}):$=C.isVisible?1:0,C.totalVisibleHeaderCount=$,$}(w,!0)})}function ie(t){var o=t.columns,f=t.flatHeaders,p=t.dispatch,w=t.allColumns,_=t.getHooks,C=t.state.hiddenColumns,U=t.autoResetHiddenColumns,$=U===void 0||U,Q=j(t),ge=w.length===C.length,pe=a.useCallback(function(Se,Ve){return p({type:h.toggleHideColumn,columnId:Se,value:Ve})},[p]),me=a.useCallback(function(Se){return p({type:h.setHiddenColumns,value:Se})},[p]),se=a.useCallback(function(Se){return p({type:h.toggleHideAllColumns,value:Se})},[p]),he=V(_().getToggleHideAllColumnsProps,{instance:Q()});f.forEach(function(Se){Se.toggleHidden=function(Ve){p({type:h.toggleHideColumn,columnId:Se.id,value:Ve})},Se.getToggleHiddenProps=V(_().getToggleHiddenProps,{instance:Q(),column:Se})});var Re=j($);H(function(){Re()&&p({type:h.resetHiddenColumns})},[p,o]),Object.assign(t,{allColumnsHidden:ge,toggleHideColumn:pe,setHiddenColumns:me,toggleHideAllColumns:se,getToggleHideAllColumnsProps:he})}var Te={},Pe={},mt=function(t,o,f){return t},Jt=function(t,o){return t.subRows||[]},vt=function(t,o,f){return""+(f?[f.id,o].join("."):o)},Wt=function(t){return t};function Gt(t){var o=t.initialState,f=o===void 0?Te:o,p=t.defaultColumn,w=p===void 0?Pe:p,_=t.getSubRows,C=_===void 0?Jt:_,U=t.getRowId,$=U===void 0?vt:U,Q=t.stateReducer,ge=Q===void 0?mt:Q,pe=t.useControlledState,me=pe===void 0?Wt:pe;return l({},A(t,["initialState","defaultColumn","getSubRows","getRowId","stateReducer","useControlledState"]),{initialState:f,defaultColumn:w,getSubRows:C,getRowId:$,stateReducer:ge,useControlledState:me})}function er(t,o){o===void 0&&(o=0);var f=0,p=0,w=0,_=0;return t.forEach(function(C){var U=C.headers;if(C.totalLeft=o,U&&U.length){var $=er(U,o),Q=$[0],ge=$[1],pe=$[2],me=$[3];C.totalMinWidth=Q,C.totalWidth=ge,C.totalMaxWidth=pe,C.totalFlexWidth=me}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 tr(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.column,C=t.getRowId,U=t.getSubRows,$=t.accessValueHooks,Q=t.getInstance;o.forEach(function(ge,pe){return function me(se,he,Re,Se,Ve){Re===void 0&&(Re=0);var st=se,Oe=C(se,he,Se),ve=w[Oe];if(ve)ve.subRows&&ve.originalSubRows.forEach(function(Ge,Xe){return me(Ge,Xe,Re+1,ve)});else if((ve={id:Oe,original:st,index:he,depth:Re,cells:[{}]}).cells.map=Ce,ve.cells.filter=Ce,ve.cells.forEach=Ce,ve.cells[0].getCellProps=Ce,ve.values={},Ve.push(ve),p.push(ve),w[Oe]=ve,ve.originalSubRows=U(se,he),ve.originalSubRows){var tt=[];ve.originalSubRows.forEach(function(Ge,Xe){return me(Ge,Xe,Re+1,ve,tt)}),ve.subRows=tt}_.accessor&&(ve.values[_.id]=_.accessor(se,he,ve,Ve,o)),ve.values[_.id]=D($,ve.values[_.id],{row:ve,column:_,instance:Q()})}(ge,pe,0,void 0,f)})}h.resetExpanded="resetExpanded",h.toggleRowExpanded="toggleRowExpanded",h.toggleAllRowsExpanded="toggleAllRowsExpanded";var lr=function(t){t.getToggleAllRowsExpandedProps=[pr],t.getToggleRowExpandedProps=[ar],t.stateReducers.push(cr),t.useInstance.push(yt),t.prepareRow.push(rr)};lr.pluginName="useExpanded";var pr=function(t,o){var f=o.instance;return[t,{onClick:function(p){f.toggleAllRowsExpanded()},style:{cursor:"pointer"},title:"Toggle All Rows Expanded"}]},ar=function(t,o){var f=o.row;return[t,{onClick:function(){f.toggleRowExpanded()},style:{cursor:"pointer"},title:"Toggle Row Expanded"}]};function cr(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 U={};return Object.keys(_).forEach(function(he){U[he]=!0}),l({},t,{expanded:U})}return l({},t,{expanded:{}})}if(o.type===h.toggleRowExpanded){var $,Q=o.id,ge=o.value,pe=t.expanded[Q],me=ge!==void 0?ge:!pe;if(!pe&&me)return l({},t,{expanded:l({},t.expanded,($={},$[Q]=!0,$))});if(pe&&!me){var se=t.expanded;return se[Q],l({},t,{expanded:A(se,[Q].map(S))})}return t}}function yt(t){var o=t.data,f=t.rows,p=t.rowsById,w=t.manualExpandedKey,_=w===void 0?"expanded":w,C=t.paginateExpandedRows,U=C===void 0||C,$=t.expandSubRows,Q=$===void 0||$,ge=t.autoResetExpanded,pe=ge===void 0||ge,me=t.getHooks,se=t.plugins,he=t.state.expanded,Re=t.dispatch;P(se,["useSortBy","useGroupBy","usePivotColumns","useGlobalFilter"],"useExpanded");var Se=j(pe),Ve=!!(Object.keys(p).length&&Object.keys(he).length);Ve&&Object.keys(p).some(function(gt){return!he[gt]})&&(Ve=!1),H(function(){Se()&&Re({type:h.resetExpanded})},[Re,o]);var st=a.useCallback(function(gt,Ye){Re({type:h.toggleRowExpanded,id:gt,value:Ye})},[Re]),Oe=a.useCallback(function(gt){return Re({type:h.toggleAllRowsExpanded,value:gt})},[Re]),ve=a.useMemo(function(){return U?Y(f,{manualExpandedKey:_,expanded:he,expandSubRows:Q}):f},[U,f,_,he,Q]),tt=a.useMemo(function(){return function(gt){var Ye=0;return Object.keys(gt).forEach(function(Ze){var wt=Ze.split(".");Ye=Math.max(Ye,wt.length)}),Ye}(he)},[he]),Ge=j(t),Xe=V(me().getToggleAllRowsExpandedProps,{instance:Ge()});Object.assign(t,{preExpandedRows:f,expandedRows:ve,rows:ve,expandedDepth:tt,isAllRowsExpanded:Ve,toggleRowExpanded:st,toggleAllRowsExpanded:Oe,getToggleAllRowsExpandedProps:Xe})}function rr(t,o){var f=o.instance.getHooks,p=o.instance;t.toggleRowExpanded=function(w){return p.toggleRowExpanded(t.id,w)},t.getToggleRowExpandedProps=V(f().getToggleRowExpandedProps,{instance:p,row:t})}var dr=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())})})};dr.autoRemove=function(t){return!t};var mr=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()})})};mr.autoRemove=function(t){return!t};var ir=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return _===void 0||String(_)===String(f)})})};ir.autoRemove=function(t){return!t};var xr=function(t,o,f){return t.filter(function(p){return o.some(function(w){return p.values[w].includes(f)})})};xr.autoRemove=function(t){return!t||!t.length};var ot=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)})})})};ot.autoRemove=function(t){return!t||!t.length};var _t=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)})})})};_t.autoRemove=function(t){return!t||!t.length};var ut=function(t,o,f){return t.filter(function(p){return o.some(function(w){var _=p.values[w];return f.includes(_)})})};ut.autoRemove=function(t){return!t||!t.length};var Et=function(t,o,f){return t.filter(function(p){return o.some(function(w){return p.values[w]===f})})};Et.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 Ft=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(U){return o.some(function($){var Q=U.values[$];return Q>=w&&Q<=_})})};Ft.autoRemove=function(t){return!t||typeof t[0]!="number"&&typeof t[1]!="number"};var Lt=Object.freeze({__proto__:null,text:dr,exactText:mr,exactTextCase:ir,includes:xr,includesAll:ot,includesSome:_t,includesValue:ut,exact:Et,equals:Ht,between:Ft});h.resetFilters="resetFilters",h.setFilter="setFilter",h.setAllFilters="setAllFilters";var Vt=function(t){t.stateReducers.push(Tt),t.useInstance.push(B)};function Tt(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,U=p.filterTypes,$=C.find(function(Re){return Re.id===w});if(!$)throw new Error("React-Table: Could not find a column with id: "+w);var Q=fe($.filter,U||{},Lt),ge=t.filters.find(function(Re){return Re.id===w}),pe=I(_,ge&&ge.value);return M(Q.autoRemove,pe,$)?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:pe}:Re})}:{filters:[].concat(t.filters,[{id:w,value:pe}])})}if(o.type===h.setAllFilters){var me=o.filters,se=p.allColumns,he=p.filterTypes;return l({},t,{filters:I(me,t.filters).filter(function(Re){var Se=se.find(function(Ve){return Ve.id===Re.id});return!M(fe(Se.filter,he||{},Lt).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,U=t.manualFilters,$=t.defaultCanFilter,Q=$!==void 0&&$,ge=t.disableFilters,pe=t.state.filters,me=t.dispatch,se=t.autoResetFilters,he=se===void 0||se,Re=a.useCallback(function(Ge,Xe){me({type:h.setFilter,columnId:Ge,filterValue:Xe})},[me]),Se=a.useCallback(function(Ge){me({type:h.setAllFilters,filters:Ge})},[me]);_.forEach(function(Ge){var Xe=Ge.id,gt=Ge.accessor,Ye=Ge.defaultCanFilter,Ze=Ge.disableFilters;Ge.canFilter=gt?ce(Ze!==!0&&void 0,ge!==!0&&void 0,!0):ce(Ye,Q,!1),Ge.setFilter=function(Qe){return Re(Ge.id,Qe)};var wt=pe.find(function(Qe){return Qe.id===Xe});Ge.filterValue=wt&&wt.value});var Ve=a.useMemo(function(){if(U||!pe.length)return[f,p,w];var Ge=[],Xe={};return[function gt(Ye,Ze){Ze===void 0&&(Ze=0);var wt=Ye;return(wt=pe.reduce(function(Qe,bt){var r=bt.id,s=bt.value,u=_.find(function(x){return x.id===r});if(!u)return Qe;Ze===0&&(u.preFilteredRows=Qe);var n=fe(u.filter,C||{},Lt);return n?(u.filteredRows=n(Qe,[r],s),u.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+u.id+"."),Qe)},Ye)).forEach(function(Qe){Ge.push(Qe),Xe[Qe.id]=Qe,Qe.subRows&&(Qe.subRows=Qe.subRows&&Qe.subRows.length>0?gt(Qe.subRows,Ze+1):Qe.subRows)}),wt}(f),Ge,Xe]},[U,pe,f,p,w,_,C]),st=Ve[0],Oe=Ve[1],ve=Ve[2];a.useMemo(function(){_.filter(function(Ge){return!pe.find(function(Xe){return Xe.id===Ge.id})}).forEach(function(Ge){Ge.preFilteredRows=st,Ge.filteredRows=st})},[st,pe,_]);var tt=j(he);H(function(){tt()&&me({type:h.resetFilters})},[me,U?null:o]),Object.assign(t,{preFilteredRows:f,preFilteredFlatRows:p,preFilteredRowsById:w,filteredRows:st,filteredFlatRows:Oe,filteredRowsById:ve,rows:st,flatRows:Oe,rowsById:ve,setFilter:Re,setAllFilters:Se})}Vt.pluginName="useFilters",h.resetGlobalFilter="resetGlobalFilter",h.setGlobalFilter="setGlobalFilter";var ye=function(t){t.stateReducers.push(jt),t.useInstance.push(kt)};function jt(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,_||{},Lt),U=I(w,t.globalFilter);return M(C.autoRemove,U)?(t.globalFilter,A(t,["globalFilter"])):l({},t,{globalFilter:U})}}function kt(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.allColumns,C=t.filterTypes,U=t.globalFilter,$=t.manualGlobalFilter,Q=t.state.globalFilter,ge=t.dispatch,pe=t.autoResetGlobalFilter,me=pe===void 0||pe,se=t.disableGlobalFilter,he=a.useCallback(function(ve){ge({type:h.setGlobalFilter,filterValue:ve})},[ge]),Re=a.useMemo(function(){if($||Q===void 0)return[f,p,w];var ve=[],tt={},Ge=fe(U,C||{},Lt);if(!Ge)return console.warn("Could not find a valid 'globalFilter' option."),f;_.forEach(function(gt){var Ye=gt.disableGlobalFilter;gt.canFilter=ce(Ye!==!0&&void 0,se!==!0&&void 0,!0)});var Xe=_.filter(function(gt){return gt.canFilter===!0});return[function gt(Ye){return(Ye=Ge(Ye,Xe.map(function(Ze){return Ze.id}),Q)).forEach(function(Ze){ve.push(Ze),tt[Ze.id]=Ze,Ze.subRows=Ze.subRows&&Ze.subRows.length?gt(Ze.subRows):Ze.subRows}),Ye}(f),ve,tt]},[$,Q,U,C,_,f,p,w,se]),Se=Re[0],Ve=Re[1],st=Re[2],Oe=j(me);H(function(){Oe()&&ge({type:h.resetGlobalFilter})},[ge,$?null:o]),Object.assign(t,{preGlobalFilteredRows:f,preGlobalFilteredFlatRows:p,preGlobalFilteredRowsById:w,globalFilteredRows:Se,globalFilteredFlatRows:Ve,globalFilteredRowsById:st,rows:Se,flatRows:Ve,rowsById:st,setGlobalFilter:he,disableGlobalFilter:se})}function Kt(t,o){return o.reduce(function(f,p){return f+(typeof p=="number"?p:0)},0)}ye.pluginName="useGlobalFilter";var $t=Object.freeze({__proto__:null,sum:Kt,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 Kt(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}}),sr=[],Sr={};h.resetGroupBy="resetGroupBy",h.setGroupBy="setGroupBy",h.toggleGroupBy="toggleGroupBy";var Tr=function(t){t.getGroupByToggleProps=[ts],t.stateReducers.push(Rr),t.visibleColumnsDeps.push(function(o,f){var p=f.instance;return[].concat(o,[p.state.groupBy])}),t.visibleColumns.push(rs),t.useInstance.push(Hs),t.prepareRow.push(ss)};Tr.pluginName="useGroupBy";var ts=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 Rr(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(U){return U!==w})})}}function rs(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 Ms={};function Hs(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.rowsById,_=t.allColumns,C=t.flatHeaders,U=t.groupByFn,$=U===void 0?ls:U,Q=t.manualGroupBy,ge=t.aggregations,pe=ge===void 0?Ms:ge,me=t.plugins,se=t.state.groupBy,he=t.dispatch,Re=t.autoResetGroupBy,Se=Re===void 0||Re,Ve=t.disableGroupBy,st=t.defaultCanGroupBy,Oe=t.getHooks;P(me,["useColumnOrder","useFilters"],"useGroupBy");var ve=j(t);_.forEach(function(u){var n=u.accessor,x=u.defaultGroupBy,b=u.disableGroupBy;u.canGroupBy=n?ce(u.canGroupBy,b!==!0&&void 0,Ve!==!0&&void 0,!0):ce(u.canGroupBy,x,st,!1),u.canGroupBy&&(u.toggleGroupBy=function(){return t.toggleGroupBy(u.id)}),u.Aggregated=u.Aggregated||u.Cell});var tt=a.useCallback(function(u,n){he({type:h.toggleGroupBy,columnId:u,value:n})},[he]),Ge=a.useCallback(function(u){he({type:h.setGroupBy,value:u})},[he]);C.forEach(function(u){u.getGroupByToggleProps=V(Oe().getGroupByToggleProps,{instance:ve(),header:u})});var Xe=a.useMemo(function(){if(Q||!se.length)return[f,p,w,sr,Sr,p,w];var u=se.filter(function(te){return _.find(function(_e){return _e.id===te})}),n=[],x={},b=[],m={},E=[],F={},K=function te(_e,oe,xe){if(oe===void 0&&(oe=0),oe===u.length)return _e.map(function(Be){return l({},Be,{depth:oe})});var be=u[oe],ne=$(_e,be);return Object.entries(ne).map(function(Be,ze){var Ke=Be[0],Ee=Be[1],rt=be+":"+Ke,ct=te(Ee,oe+1,rt=xe?xe+">"+rt:rt),Ne=oe?ae(Ee,"leafRows"):Ee,we=function(We,lt,at){var St={};return _.forEach(function(He){if(u.includes(He.id))St[He.id]=lt[0]?lt[0].values[He.id]:null;else{var zt=typeof He.aggregate=="function"?He.aggregate:pe[He.aggregate]||$t[He.aggregate];if(zt){var it=lt.map(function(Je){return Je.values[He.id]}),$e=We.map(function(Je){var At=Je.values[He.id];if(!at&&He.aggregateValue){var Ut=typeof He.aggregateValue=="function"?He.aggregateValue:pe[He.aggregateValue]||$t[He.aggregateValue];if(!Ut)throw console.info({column:He}),new Error("React Table: Invalid column.aggregateValue option for column listed above");At=Ut(At,Je,He)}return At});St[He.id]=zt($e,it)}else{if(He.aggregate)throw console.info({column:He}),new Error("React Table: Invalid column.aggregate option for column listed above");St[He.id]=null}}}),St}(Ne,Ee,oe),Ae={id:rt,isGrouped:!0,groupByID:be,groupByVal:Ke,values:we,subRows:ct,leafRows:Ne,depth:oe,index:ze};return ct.forEach(function(We){n.push(We),x[We.id]=We,We.isGrouped?(b.push(We),m[We.id]=We):(E.push(We),F[We.id]=We)}),Ae})}(f);return K.forEach(function(te){n.push(te),x[te.id]=te,te.isGrouped?(b.push(te),m[te.id]=te):(E.push(te),F[te.id]=te)}),[K,n,x,b,m,E,F]},[Q,se,f,p,w,_,pe,$]),gt=Xe[0],Ye=Xe[1],Ze=Xe[2],wt=Xe[3],Qe=Xe[4],bt=Xe[5],r=Xe[6],s=j(Se);H(function(){s()&&he({type:h.resetGroupBy})},[he,Q?null:o]),Object.assign(t,{preGroupedRows:f,preGroupedFlatRow:p,preGroupedRowsById:w,groupedRows:gt,groupedFlatRows:Ye,groupedRowsById:Ze,onlyGroupedFlatRows:wt,onlyGroupedRowsById:Qe,nonGroupedFlatRows:bt,nonGroupedRowsById:r,rows:gt,flatRows:Ye,rowsById:Ze,toggleGroupBy:tt,setGroupBy:Ge})}function ss(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 ls(t,o){return t.reduce(function(f,p,w){var _=""+p.values[o];return f[_]=Array.isArray(f[_])?f[_]:[],f[_].push(p),f},{})}var ns=/([0-9]+)/gm;function Nr(t,o){return t===o?0:t>o?1:-1}function wr(t,o,f){return[t.values[f],o.values[f]]}function as(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}var Ls=Object.freeze({__proto__:null,alphanumeric:function(t,o,f){var p=wr(t,o,f),w=p[0],_=p[1];for(w=as(w),_=as(_),w=w.split(ns).filter(Boolean),_=_.split(ns).filter(Boolean);w.length&&_.length;){var C=w.shift(),U=_.shift(),$=parseInt(C,10),Q=parseInt(U,10),ge=[$,Q].sort();if(isNaN(ge[0])){if(C>U)return 1;if(U>C)return-1}else{if(isNaN(ge[1]))return isNaN($)?-1:1;if($>Q)return 1;if(Q>$)return-1}}return w.length-_.length},datetime:function(t,o,f){var p=wr(t,o,f),w=p[0],_=p[1];return Nr(w=w.getTime(),_=_.getTime())},basic:function(t,o,f){var p=wr(t,o,f);return Nr(p[0],p[1])},string:function(t,o,f){var p=wr(t,o,f),w=p[0],_=p[1];for(w=w.split("").filter(Boolean),_=_.split("").filter(Boolean);w.length&&_.length;){var C=w.shift(),U=_.shift(),$=C.toLowerCase(),Q=U.toLowerCase();if($>Q)return 1;if(Q>$)return-1;if(C>U)return 1;if(U>C)return-1}return w.length-_.length},number:function(t,o,f){var p=wr(t,o,f),w=p[0],_=p[1],C=/[^0-9.]/gi;return Nr(w=Number(String(w).replace(C,"")),_=Number(String(_).replace(C,"")))}});h.resetSortBy="resetSortBy",h.setSortBy="setSortBy",h.toggleSortBy="toggleSortBy",h.clearSortBy="clearSortBy",k.sortType="alphanumeric",k.sortDescFirst=!1;var is=function(t){t.getSortByToggleProps=[ks],t.stateReducers.push(Vs),t.useInstance.push(Os)};is.pluginName="useSortBy";var ks=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 Vs(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,U=o.multi,$=p.allColumns,Q=p.disableMultiSort,ge=p.disableSortRemove,pe=p.disableMultiRemove,me=p.maxMultiSortColCount,se=me===void 0?Number.MAX_SAFE_INTEGER:me,he=t.sortBy,Re=$.find(function(ve){return ve.id===_}).sortDescFirst,Se=he.find(function(ve){return ve.id===_}),Ve=he.findIndex(function(ve){return ve.id===_}),st=C!=null,Oe=[];return(w=!Q&&U?Se?"toggle":"add":Ve!==he.length-1||he.length!==1?"replace":Se?"toggle":"replace")!="toggle"||ge||st||U&&pe||!(Se&&Se.desc&&!Re||!Se.desc&&Re)||(w="remove"),w==="replace"?Oe=[{id:_,desc:st?C:Re}]:w==="add"?(Oe=[].concat(he,[{id:_,desc:st?C:Re}])).splice(0,Oe.length-se):w==="toggle"?Oe=he.map(function(ve){return ve.id===_?l({},ve,{desc:st?C:!Se.desc}):ve}):w==="remove"&&(Oe=he.filter(function(ve){return ve.id!==_})),l({},t,{sortBy:Oe})}}function Os(t){var o=t.data,f=t.rows,p=t.flatRows,w=t.allColumns,_=t.orderByFn,C=_===void 0?os:_,U=t.sortTypes,$=t.manualSortBy,Q=t.defaultCanSort,ge=t.disableSortBy,pe=t.flatHeaders,me=t.state.sortBy,se=t.dispatch,he=t.plugins,Re=t.getHooks,Se=t.autoResetSortBy,Ve=Se===void 0||Se;P(he,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var st=a.useCallback(function(Ye){se({type:h.setSortBy,sortBy:Ye})},[se]),Oe=a.useCallback(function(Ye,Ze,wt){se({type:h.toggleSortBy,columnId:Ye,desc:Ze,multi:wt})},[se]),ve=j(t);pe.forEach(function(Ye){var Ze=Ye.accessor,wt=Ye.canSort,Qe=Ye.disableSortBy,bt=Ye.id,r=Ze?ce(Qe!==!0&&void 0,ge!==!0&&void 0,!0):ce(Q,wt,!1);Ye.canSort=r,Ye.canSort&&(Ye.toggleSortBy=function(u,n){return Oe(Ye.id,u,n)},Ye.clearSortBy=function(){se({type:h.clearSortBy,columnId:Ye.id})}),Ye.getSortByToggleProps=V(Re().getSortByToggleProps,{instance:ve(),column:Ye});var s=me.find(function(u){return u.id===bt});Ye.isSorted=!!s,Ye.sortedIndex=me.findIndex(function(u){return u.id===bt}),Ye.isSortedDesc=Ye.isSorted?s.desc:void 0});var tt=a.useMemo(function(){if($||!me.length)return[f,p];var Ye=[],Ze=me.filter(function(wt){return w.find(function(Qe){return Qe.id===wt.id})});return[function wt(Qe){var bt=C(Qe,Ze.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,n=Fe(u)||(U||{})[u]||Ls[u];if(!n)throw new Error("React-Table: Could not find a valid sortType of '"+u+"' for column '"+r.id+"'.");return function(x,b){return n(x,b,r.id,r.desc)}}),Ze.map(function(r){var s=w.find(function(u){return u.id===r.id});return s&&s.sortInverted?r.desc:!r.desc}));return bt.forEach(function(r){Ye.push(r),r.subRows&&r.subRows.length!==0&&(r.subRows=wt(r.subRows))}),bt}(f),Ye]},[$,me,f,p,w,C,U]),Ge=tt[0],Xe=tt[1],gt=j(Ve);H(function(){gt()&&se({type:h.resetSortBy})},[$?null:o]),Object.assign(t,{preSortedRows:f,preSortedFlatRows:p,sortedRows:Ge,sortedFlatRows:Xe,rows:Ge,flatRows:Xe,setSortBy:st,toggleSortBy:Oe})}function os(t,o,f){return[].concat(t).sort(function(p,w){for(var _=0;_<o.length;_+=1){var C=o[_],U=f[_]===!1||f[_]==="desc",$=C(p,w);if($!==0)return U?-$:$}return f[0]?p.index-w.index:w.index-p.index})}h.resetPage="resetPage",h.gotoPage="gotoPage",h.setPageSize="setPageSize";var Br=function(t){t.stateReducers.push(Ws),t.useInstance.push(zs)};function Ws(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=I(o.pageIndex,t.pageIndex),U=!1;return C>t.pageIndex?U=w===-1?_.length>=t.pageSize:C<w:C<t.pageIndex&&(U=C>-1),U?l({},t,{pageIndex:C}):t}if(o.type===h.setPageSize){var $=o.pageSize,Q=t.pageSize*t.pageIndex;return l({},t,{pageIndex:Math.floor(Q/$),pageSize:$})}}function zs(t){var o=t.rows,f=t.autoResetPage,p=f===void 0||f,w=t.manualExpandedKey,_=w===void 0?"expanded":w,C=t.plugins,U=t.pageCount,$=t.paginateExpandedRows,Q=$===void 0||$,ge=t.expandSubRows,pe=ge===void 0||ge,me=t.state,se=me.pageSize,he=me.pageIndex,Re=me.expanded,Se=me.globalFilter,Ve=me.filters,st=me.groupBy,Oe=me.sortBy,ve=t.dispatch,tt=t.data,Ge=t.manualPagination;P(C,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var Xe=j(p);H(function(){Xe()&&ve({type:h.resetPage})},[ve,Ge?null:tt,Se,Ve,st,Oe]);var gt=Ge?U:Math.ceil(o.length/se),Ye=a.useMemo(function(){return gt>0?[].concat(new Array(gt)).fill(null).map(function(n,x){return x}):[]},[gt]),Ze=a.useMemo(function(){var n;if(Ge)n=o;else{var x=se*he,b=x+se;n=o.slice(x,b)}return Q?n:Y(n,{manualExpandedKey:_,expanded:Re,expandSubRows:pe})},[pe,Re,_,Ge,he,se,Q,o]),wt=he>0,Qe=gt===-1?Ze.length>=se:he<gt-1,bt=a.useCallback(function(n){ve({type:h.gotoPage,pageIndex:n})},[ve]),r=a.useCallback(function(){return bt(function(n){return n-1})},[bt]),s=a.useCallback(function(){return bt(function(n){return n+1})},[bt]),u=a.useCallback(function(n){ve({type:h.setPageSize,pageSize:n})},[ve]);Object.assign(t,{pageOptions:Ye,pageCount:gt,page:Ze,canPreviousPage:wt,canNextPage:Qe,gotoPage:bt,previousPage:r,nextPage:s,setPageSize:u})}Br.pluginName="usePagination",h.resetPivot="resetPivot",h.togglePivot="togglePivot";var Gr=function(t){t.getPivotToggleProps=[Ys],t.stateReducers.push(qs),t.useInstanceAfterData.push(Us),t.allColumns.push(Ks),t.accessValue.push(Zs),t.materializedColumns.push(cs),t.materializedColumnsDeps.push(ds),t.visibleColumns.push($s),t.visibleColumnsDeps.push(Xs),t.useInstance.push(Js),t.prepareRow.push(Qs)};Gr.pluginName="usePivotColumns";var us=[],Ys=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 qs(t,o,f,p){if(o.type===h.init)return l({pivotColumns:us},t);if(o.type===h.resetPivot)return l({},t,{pivotColumns:p.initialState.pivotColumns||us});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(U){return U!==w})})}}function Us(t){t.allColumns.forEach(function(o){o.isPivotSource=t.state.pivotColumns.includes(o.id)})}function Ks(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 Zs(t,o){var f=o.column;return f.uniqueValues&&t!==void 0&&f.uniqueValues.add(t),t}function cs(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($){return p.find(function(Q){return Q.id===$})}).filter(Boolean),C=p.filter(function($){return!$.isPivotSource&&!w.groupBy.includes($.id)&&!w.pivotColumns.includes($.id)}),U=ue(function $(Q,ge,pe){Q===void 0&&(Q=0),pe===void 0&&(pe=[]);var me=_[Q];return me?Array.from(me.uniqueValues).sort().map(function(se){var he=l({},me,{Header:me.PivotHeader||typeof me.header=="string"?me.Header+": "+se:se,isPivotGroup:!0,parent:ge,depth:Q,id:ge?ge.id+"."+me.id+"."+se:me.id+"."+se,pivotValue:se});return he.columns=$(Q+1,he,[].concat(pe,[function(Re){return Re.values[me.id]===se}])),he}):C.map(function(se){return l({},se,{canPivot:!1,isPivoted:!0,parent:ge,depth:Q,id:""+(ge?ge.id+"."+se.id:se.id),accessor:function(he,Re,Se){if(pe.every(function(Ve){return Ve(Se)}))return Se.values[se.id]}})})}());return[].concat(t,U)}function ds(t,o){var f=o.instance.state,p=f.pivotColumns,w=f.groupBy;return[].concat(t,[p,w])}function $s(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 Xs(t,o){var f=o.instance;return[].concat(t,[f.state.pivotColumns,f.state.groupBy])}function Js(t){var o=t.columns,f=t.allColumns,p=t.flatHeaders,w=t.getHooks,_=t.plugins,C=t.dispatch,U=t.autoResetPivot,$=U===void 0||U,Q=t.manaulPivot,ge=t.disablePivot,pe=t.defaultCanPivot;P(_,["useGroupBy"],"usePivotColumns");var me=j(t);f.forEach(function(he){var Re=he.accessor,Se=he.defaultPivot,Ve=he.disablePivot;he.canPivot=Re?ce(he.canPivot,Ve!==!0&&void 0,ge!==!0&&void 0,!0):ce(he.canPivot,Se,pe,!1),he.canPivot&&(he.togglePivot=function(){return t.togglePivot(he.id)}),he.Aggregated=he.Aggregated||he.Cell}),p.forEach(function(he){he.getPivotToggleProps=V(w().getPivotToggleProps,{instance:me(),header:he})});var se=j($);H(function(){se()&&C({type:h.resetPivot})},[C,Q?null:o]),Object.assign(t,{togglePivot:function(he,Re){C({type:h.togglePivot,columnId:he,value:Re})}})}function Qs(t){t.allCells.forEach(function(o){o.isPivoted=o.column.isPivoted})}h.resetSelectedRows="resetSelectedRows",h.toggleAllRowsSelected="toggleAllRowsSelected",h.toggleRowSelected="toggleRowSelected",h.toggleAllPageRowsSelected="toggleAllPageRowsSelected";var fs=function(t){t.getToggleRowSelectedProps=[Fr],t.getToggleAllRowsSelectedProps=[Cr],t.getToggleAllPageRowsSelectedProps=[hs],t.stateReducers.push(el),t.useInstance.push(ps),t.prepareRow.push(tl)};fs.pluginName="useRowSelect";var Fr=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}]},Cr=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)}]},hs=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 el(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,U=p.nonGroupedRowsById,$=U===void 0?C:U,Q=w!==void 0?w:!_,ge=Object.assign({},t.selectedRowIds);return Q?Object.keys($).forEach(function(bt){ge[bt]=!0}):Object.keys($).forEach(function(bt){delete ge[bt]}),l({},t,{selectedRowIds:ge})}if(o.type===h.toggleRowSelected){var pe=o.id,me=o.value,se=p.rowsById,he=p.selectSubRows,Re=he===void 0||he,Se=p.getSubRows,Ve=t.selectedRowIds[pe],st=me!==void 0?me:!Ve;if(Ve===st)return t;var Oe=l({},t.selectedRowIds);return function bt(r){var s=se[r];if(s&&(s.isGrouped||(st?Oe[r]=!0:delete Oe[r]),Re&&Se(s)))return Se(s).forEach(function(u){return bt(u.id)})}(pe),l({},t,{selectedRowIds:Oe})}if(o.type===h.toggleAllPageRowsSelected){var ve=o.value,tt=p.page,Ge=p.rowsById,Xe=p.selectSubRows,gt=Xe===void 0||Xe,Ye=p.isAllPageRowsSelected,Ze=p.getSubRows,wt=ve!==void 0?ve:!Ye,Qe=l({},t.selectedRowIds);return tt.forEach(function(bt){return function r(s){var u=Ge[s];if(u.isGrouped||(wt?Qe[s]=!0:delete Qe[s]),gt&&Ze(u))return Ze(u).forEach(function(n){return r(n.id)})}(bt.id)}),l({},t,{selectedRowIds:Qe})}return t}function ps(t){var o=t.data,f=t.rows,p=t.getHooks,w=t.plugins,_=t.rowsById,C=t.nonGroupedRowsById,U=C===void 0?_:C,$=t.autoResetSelectedRows,Q=$===void 0||$,ge=t.state.selectedRowIds,pe=t.selectSubRows,me=pe===void 0||pe,se=t.dispatch,he=t.page,Re=t.getSubRows;P(w,["useFilters","useGroupBy","useSortBy","useExpanded","usePagination"],"useRowSelect");var Se=a.useMemo(function(){var Ze=[];return f.forEach(function(wt){var Qe=me?function bt(r,s,u){if(s[r.id])return!0;var n=u(r);if(n&&n.length){var x=!0,b=!1;return n.forEach(function(m){b&&!x||(bt(m,s,u)?b=!0:x=!1)}),!!x||!!b&&null}return!1}(wt,ge,Re):!!ge[wt.id];wt.isSelected=!!Qe,wt.isSomeSelected=Qe===null,Qe&&Ze.push(wt)}),Ze},[f,me,ge,Re]),Ve=!!(Object.keys(U).length&&Object.keys(ge).length),st=Ve;Ve&&Object.keys(U).some(function(Ze){return!ge[Ze]})&&(Ve=!1),Ve||he&&he.length&&he.some(function(Ze){var wt=Ze.id;return!ge[wt]})&&(st=!1);var Oe=j(Q);H(function(){Oe()&&se({type:h.resetSelectedRows})},[se,o]);var ve=a.useCallback(function(Ze){return se({type:h.toggleAllRowsSelected,value:Ze})},[se]),tt=a.useCallback(function(Ze){return se({type:h.toggleAllPageRowsSelected,value:Ze})},[se]),Ge=a.useCallback(function(Ze,wt){return se({type:h.toggleRowSelected,id:Ze,value:wt})},[se]),Xe=j(t),gt=V(p().getToggleAllRowsSelectedProps,{instance:Xe()}),Ye=V(p().getToggleAllPageRowsSelectedProps,{instance:Xe()});Object.assign(t,{selectedFlatRows:Se,isAllRowsSelected:Ve,isAllPageRowsSelected:st,toggleRowSelected:Ge,toggleAllRowsSelected:ve,getToggleAllRowsSelectedProps:gt,getToggleAllPageRowsSelectedProps:Ye,toggleAllPageRowsSelected:tt})}function tl(t,o){var f=o.instance;t.toggleRowSelected=function(p){return f.toggleRowSelected(t.id,p)},t.getToggleRowSelectedProps=V(f.getHooks().getToggleRowSelectedProps,{instance:f,row:t})}var ms=function(t){return{}},xs=function(t){return{}};h.setRowState="setRowState",h.setCellState="setCellState",h.resetRowState="resetRowState";var Mr=function(t){t.stateReducers.push(rl),t.useInstance.push(gs),t.prepareRow.push(sl)};function rl(t,o,f,p){var w=p.initialRowStateAccessor,_=w===void 0?ms:w,C=p.initialCellStateAccessor,U=C===void 0?xs:C,$=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 Q,ge=o.rowId,pe=o.value,me=t.rowState[ge]!==void 0?t.rowState[ge]:_($[ge]);return l({},t,{rowState:l({},t.rowState,(Q={},Q[ge]=I(pe,me),Q))})}if(o.type===h.setCellState){var se,he,Re,Se,Ve,st=o.rowId,Oe=o.columnId,ve=o.value,tt=t.rowState[st]!==void 0?t.rowState[st]:_($[st]),Ge=(tt==null||(se=tt.cellState)==null?void 0:se[Oe])!==void 0?tt.cellState[Oe]:U((he=$[st])==null||(Re=he.cells)==null?void 0:Re.find(function(Xe){return Xe.column.id===Oe}));return l({},t,{rowState:l({},t.rowState,(Ve={},Ve[st]=l({},tt,{cellState:l({},tt.cellState||{},(Se={},Se[Oe]=I(ve,Ge),Se))}),Ve))})}}function gs(t){var o=t.autoResetRowState,f=o===void 0||o,p=t.data,w=t.dispatch,_=a.useCallback(function($,Q){return w({type:h.setRowState,rowId:$,value:Q})},[w]),C=a.useCallback(function($,Q,ge){return w({type:h.setCellState,rowId:$,columnId:Q,value:ge})},[w]),U=j(f);H(function(){U()&&w({type:h.resetRowState})},[p]),Object.assign(t,{setRowState:_,setCellState:C})}function sl(t,o){var f=o.instance,p=f.initialRowStateAccessor,w=p===void 0?ms:p,_=f.initialCellStateAccessor,C=_===void 0?xs:_,U=f.state.rowState;t&&(t.state=U[t.id]!==void 0?U[t.id]:w(t),t.setState=function($){return f.setRowState(t.id,$)},t.cells.forEach(function($){t.state.cellState||(t.state.cellState={}),$.state=t.state.cellState[$.column.id]!==void 0?t.state.cellState[$.column.id]:C($),$.setState=function(Q){return f.setCellState(t.id,$.column.id,Q)}}))}Mr.pluginName="useRowState",h.resetColumnOrder="resetColumnOrder",h.setColumnOrder="setColumnOrder";var vs=function(t){t.stateReducers.push(ys),t.visibleColumnsDeps.push(function(o,f){var p=f.instance;return[].concat(o,[p.state.columnOrder])}),t.visibleColumns.push(_s),t.useInstance.push(ll)};function ys(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:I(o.columnOrder,t.columnOrder)}):void 0}function _s(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 U=p.shift(),$=w.findIndex(function(Q){return Q.id===U});$>-1&&_.push(w.splice($,1)[0])};w.length&&p.length;)C();return[].concat(_,w)}function ll(t){var o=t.dispatch;t.setColumnOrder=a.useCallback(function(f){return o({type:h.setColumnOrder,columnOrder:f})},[o])}vs.pluginName="useColumnOrder",k.canResize=!0,h.columnStartResizing="columnStartResizing",h.columnResizing="columnResizing",h.columnDoneResizing="columnDoneResizing",h.resetResize="resetResize";var bs=function(t){t.getResizerProps=[nl],t.getHeaderProps.push({style:{position:"relative"}}),t.stateReducers.push(al),t.useInstance.push(ol),t.useInstanceBeforeDimensions.push(il)},nl=function(t,o){var f=o.instance,p=o.header,w=f.dispatch,_=function(C,U){var $=!1;if(C.type==="touchstart"){if(C.touches&&C.touches.length>1)return;$=!0}var Q,ge,pe=function(Oe){var ve=[];return function tt(Ge){Ge.columns&&Ge.columns.length&&Ge.columns.map(tt),ve.push(Ge)}(Oe),ve}(U).map(function(Oe){return[Oe.id,Oe.totalWidth]}),me=$?Math.round(C.touches[0].clientX):C.clientX,se=function(){window.cancelAnimationFrame(Q),Q=null,w({type:h.columnDoneResizing})},he=function(){window.cancelAnimationFrame(Q),Q=null,w({type:h.columnResizing,clientX:ge})},Re=function(Oe){ge=Oe,Q||(Q=window.requestAnimationFrame(he))},Se={mouse:{moveEvent:"mousemove",moveHandler:function(Oe){return Re(Oe.clientX)},upEvent:"mouseup",upHandler:function(Oe){document.removeEventListener("mousemove",Se.mouse.moveHandler),document.removeEventListener("mouseup",Se.mouse.upHandler),se()}},touch:{moveEvent:"touchmove",moveHandler:function(Oe){return Oe.cancelable&&(Oe.preventDefault(),Oe.stopPropagation()),Re(Oe.touches[0].clientX),!1},upEvent:"touchend",upHandler:function(Oe){document.removeEventListener(Se.touch.moveEvent,Se.touch.moveHandler),document.removeEventListener(Se.touch.upEvent,Se.touch.moveHandler),se()}}},Ve=$?Se.touch:Se.mouse,st=!!function(){if(typeof Me=="boolean")return Me;var Oe=!1;try{var ve={get passive(){return Oe=!0,!1}};window.addEventListener("test",null,ve),window.removeEventListener("test",null,ve)}catch{Oe=!1}return Me=Oe}()&&{passive:!1};document.addEventListener(Ve.moveEvent,Ve.moveHandler,st),document.addEventListener(Ve.upEvent,Ve.upHandler,st),w({type:h.columnStartResizing,columnId:U.id,columnWidth:U.totalWidth,headerIdWidths:pe,clientX:me})};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 al(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,U=t.columnResizing,$=U.startX,Q=U.columnWidth,ge=U.headerIdWidths,pe=(C-$)/Q,me={};return(ge===void 0?[]:ge).forEach(function(se){var he=se[0],Re=se[1];me[he]=Math.max(Re+Re*pe,0)}),l({},t,{columnResizing:l({},t.columnResizing,{columnWidths:l({},t.columnResizing.columnWidths,{},me)})})}return o.type===h.columnDoneResizing?l({},t,{columnResizing:l({},t.columnResizing,{startX:null,isResizingColumn:null})}):void 0}bs.pluginName="useResizeColumns";var il=function(t){var o=t.flatHeaders,f=t.disableResizing,p=t.getHooks,w=t.state.columnResizing,_=j(t);o.forEach(function(C){var U=ce(C.disableResizing!==!0&&void 0,f!==!0&&void 0,!0);C.canResize=U,C.width=w.columnWidths[C.id]||C.originalWidth||C.width,C.isResizing=w.isResizingColumn===C.id,U&&(C.getResizerProps=V(p().getResizerProps,{instance:_(),header:C}))})};function ol(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);H(function(){C()&&f({type:h.resetResize})},[_]);var U=a.useCallback(function(){return f({type:h.resetResize})},[f]);Object.assign(t,{resetResizing:U})}var Hr={position:"absolute",top:0},js=function(t){t.getTableBodyProps.push(Ar),t.getRowProps.push(Ar),t.getHeaderGroupProps.push(Ar),t.getFooterGroupProps.push(Ar),t.getHeaderProps.push(function(o,f){var p=f.column;return[o,{style:l({},Hr,{left:p.totalLeft+"px",width:p.totalWidth+"px"})}]}),t.getCellProps.push(function(o,f){var p=f.cell;return[o,{style:l({},Hr,{left:p.column.totalLeft+"px",width:p.column.totalWidth+"px"})}]}),t.getFooterProps.push(function(o,f){var p=f.column;return[o,{style:l({},Hr,{left:p.totalLeft+"px",width:p.totalWidth+"px"})}]})};js.pluginName="useAbsoluteLayout";var Ar=function(t,o){return[t,{style:{position:"relative",width:o.instance.totalColumnsWidth+"px"}}]},Lr={display:"inline-block",boxSizing:"border-box"},kr=function(t,o){return[t,{style:{display:"flex",width:o.instance.totalColumnsWidth+"px"}}]},Rs=function(t){t.getRowProps.push(kr),t.getHeaderGroupProps.push(kr),t.getFooterGroupProps.push(kr),t.getHeaderProps.push(function(o,f){var p=f.column;return[o,{style:l({},Lr,{width:p.totalWidth+"px"})}]}),t.getCellProps.push(function(o,f){var p=f.cell;return[o,{style:l({},Lr,{width:p.column.totalWidth+"px"})}]}),t.getFooterProps.push(function(o,f){var p=f.column;return[o,{style:l({},Lr,{width:p.totalWidth+"px"})}]})};function Vr(t){t.getTableProps.push(ul),t.getRowProps.push(Or),t.getHeaderGroupProps.push(Or),t.getFooterGroupProps.push(Or),t.getHeaderProps.push(cl),t.getCellProps.push(dl),t.getFooterProps.push(fl)}Rs.pluginName="useBlockLayout",Vr.pluginName="useFlexLayout";var ul=function(t,o){return[t,{style:{minWidth:o.instance.totalColumnsMinWidth+"px"}}]},Or=function(t,o){return[t,{style:{display:"flex",flex:"1 0 auto",minWidth:o.instance.totalColumnsMinWidth+"px"}}]},cl=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"}}]},dl=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"}}]},fl=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 ws(t){t.stateReducers.push(Ss),t.getTableProps.push(Cs),t.getHeaderProps.push(Es),t.getRowProps.push(Ps)}h.columnStartResizing="columnStartResizing",h.columnResizing="columnResizing",h.columnDoneResizing="columnDoneResizing",h.resetResize="resetResize",ws.pluginName="useGridLayout";var Cs=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(" ")}}]},Es=function(t,o){var f=o.column;return[t,{id:"header-cell-"+f.id,style:{position:"sticky",gridColumn:"span "+f.totalVisibleHeaderCount}}]},Ps=function(t,o){var f=o.row;return f.isExpanded?[t,{style:{gridColumn:"1 / "+(f.cells.length+1)}}]:[t,{}]};function Ss(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=Wr(w);if(C!==void 0){var U=p.visibleColumns.reduce(function(ve,tt){var Ge;return l({},ve,((Ge={})[tt.id]=Wr(tt.id),Ge))},{}),$=p.visibleColumns.reduce(function(ve,tt){var Ge;return l({},ve,((Ge={})[tt.id]=tt.minWidth,Ge))},{}),Q=p.visibleColumns.reduce(function(ve,tt){var Ge;return l({},ve,((Ge={})[tt.id]=tt.maxWidth,Ge))},{}),ge=_.map(function(ve){var tt=ve[0];return[tt,Wr(tt)]});return l({},t,{gridLayout:l({},t.gridLayout,{startWidths:U,minWidths:$,maxWidths:Q,headerIdGridWidths:ge,columnWidth:C})})}return t}if(o.type===h.columnResizing){var pe=o.clientX,me=t.columnResizing.startX,se=t.gridLayout,he=se.columnWidth,Re=se.minWidths,Se=se.maxWidths,Ve=se.headerIdGridWidths,st=(pe-me)/he,Oe={};return(Ve===void 0?[]:Ve).forEach(function(ve){var tt=ve[0],Ge=ve[1];Oe[tt]=Math.min(Math.max(Re[tt],Ge+Ge*st),Se[tt])}),l({},t,{gridLayout:l({},t.gridLayout,{columnWidths:l({},t.gridLayout.columnWidths,{},Oe)})})}return o.type===h.columnDoneResizing?l({},t,{gridLayout:l({},t.gridLayout,{startWidths:{},minWidths:{},maxWidths:{}})}):void 0}function Wr(t){var o,f=(o=document.getElementById("header-cell-"+t))==null?void 0:o.offsetWidth;if(f!==void 0)return f}c._UNSTABLE_usePivotColumns=Gr,c.actions=h,c.defaultColumn=k,c.defaultGroupByFn=ls,c.defaultOrderByFn=os,c.defaultRenderer=z,c.emptyRenderer=g,c.ensurePluginOrder=P,c.flexRender=W,c.functionalUpdate=I,c.loopHooks=N,c.makePropGetter=V,c.makeRenderer=G,c.reduceHooks=D,c.safeUseLayoutEffect=ee,c.useAbsoluteLayout=js,c.useAsyncDebounce=function(t,o){o===void 0&&(o=0);var f=a.useRef({}),p=j(t),w=j(o);return a.useCallback(function(){var _=R(regeneratorRuntime.mark(function C(){var U,$,Q,ge=arguments;return regeneratorRuntime.wrap(function(pe){for(;;)switch(pe.prev=pe.next){case 0:for(U=ge.length,$=new Array(U),Q=0;Q<U;Q++)$[Q]=ge[Q];return f.current.promise||(f.current.promise=new Promise(function(me,se){f.current.resolve=me,f.current.reject=se})),f.current.timeout&&clearTimeout(f.current.timeout),f.current.timeout=setTimeout(R(regeneratorRuntime.mark(function me(){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,$);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()}},me,null,[[1,9,12,15]])})),w()),pe.abrupt("return",f.current.promise);case 5:case"end":return pe.stop()}},C)}));return function(){return _.apply(this,arguments)}}(),[p,w])},c.useBlockLayout=Rs,c.useColumnOrder=vs,c.useExpanded=lr,c.useFilters=Vt,c.useFlexLayout=Vr,c.useGetLatest=j,c.useGlobalFilter=ye,c.useGridLayout=ws,c.useGroupBy=Tr,c.useMountedLayoutEffect=H,c.usePagination=Br,c.useResizeColumns=bs,c.useRowSelect=fs,c.useRowState=Mr,c.useSortBy=is,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=Gt(t),f=[De].concat(f);var w=a.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,Gt(t)));var U=_(),$=U.data,Q=U.columns,ge=U.initialState,pe=U.defaultColumn,me=U.getSubRows,se=U.getRowId,he=U.stateReducer,Re=U.useControlledState,Se=j(he),Ve=a.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,K){return K(F,E,m,_())||F},m)},[C,Se,_]),st=a.useReducer(Ve,void 0,function(){return Ve(ge,{type:h.init})}),Oe=st[0],ve=st[1],tt=D([].concat(C().useControlledState,[Re]),Oe,{instance:_()});Object.assign(_(),{state:tt,dispatch:ve});var Ge=a.useMemo(function(){return J(D(C().columns,Q,{instance:_()}))},[C,_,Q].concat(D(C().columnsDeps,[],{instance:_()})));_().columns=Ge;var Xe=a.useMemo(function(){return D(C().allColumns,ue(Ge),{instance:_()}).map(q)},[Ge,C,_].concat(D(C().allColumnsDeps,[],{instance:_()})));_().allColumns=Xe;var gt=a.useMemo(function(){for(var m=[],E=[],F={},K=[].concat(Xe);K.length;){var te=K.shift();tr({data:$,rows:m,flatRows:E,rowsById:F,column:te,getRowId:se,getSubRows:me,accessValueHooks:C().accessValue,getInstance:_})}return[m,E,F]},[Xe,$,se,me,C,_]),Ye=gt[0],Ze=gt[1],wt=gt[2];Object.assign(_(),{rows:Ye,initialRows:[].concat(Ye),flatRows:Ze,rowsById:wt}),N(C().useInstanceAfterData,_());var Qe=a.useMemo(function(){return D(C().visibleColumns,Xe,{instance:_()}).map(function(m){return O(m,pe)})},[C,Xe,_,pe].concat(D(C().visibleColumnsDeps,[],{instance:_()})));Xe=a.useMemo(function(){var m=[].concat(Qe);return Xe.forEach(function(E){m.find(function(F){return F.id===E.id})||m.push(E)}),m},[Xe,Qe]),_().allColumns=Xe;var bt=a.useMemo(function(){return D(C().headerGroups,de(Qe,pe),_())},[C,Qe,pe,_].concat(D(C().headerGroupsDeps,[],{instance:_()})));_().headerGroups=bt;var r=a.useMemo(function(){return bt.length?bt[0].headers:[]},[bt]);_().headers=r,_().flatHeaders=bt.reduce(function(m,E){return[].concat(m,E.headers)},[]),N(C().useInstanceBeforeDimensions,_());var s=Qe.filter(function(m){return m.isVisible}).map(function(m){return m.id}).sort().join("_");Qe=a.useMemo(function(){return Qe.filter(function(m){return m.isVisible})},[Qe,s]),_().visibleColumns=Qe;var u=er(r),n=u[0],x=u[1],b=u[2];return _().totalColumnsMinWidth=n,_().totalColumnsWidth=x,_().totalColumnsMaxWidth=b,N(C().useInstance,_()),[].concat(_().flatHeaders,_().allColumns).forEach(function(m){m.render=G(_(),m),m.getHeaderProps=V(C().getHeaderProps,{instance:_(),column:m}),m.getFooterProps=V(C().getFooterProps,{instance:_(),column:m})}),_().headerGroups=a.useMemo(function(){return bt.filter(function(m,E){return m.headers=m.headers.filter(function(F){return F.headers?function K(te){return te.filter(function(_e){return _e.headers?K(_e.headers):_e.isVisible}).length}(F.headers):F.isVisible}),!!m.headers.length&&(m.getHeaderGroupProps=V(C().getHeaderGroupProps,{instance:_(),headerGroup:m,index:E}),m.getFooterGroupProps=V(C().getFooterGroupProps,{instance:_(),headerGroup:m,index:E}),!0)})},[bt,_,C]),_().footerGroups=[].concat(_().headerGroups).reverse(),_().prepareRow=a.useCallback(function(m){m.getRowProps=V(C().getRowProps,{instance:_(),row:m}),m.allCells=Xe.map(function(E){var F=m.values[E.id],K={column:E,row:m,value:F};return K.getCellProps=V(C().getCellProps,{instance:_(),cell:K}),K.render=G(_(),E,{row:m,cell:K,value:F}),K}),m.cells=Qe.map(function(E){return m.allCells.find(function(F){return F.column.id===E.id})}),N(C().prepareRow,m,{instance:_()})},[C,_,Xe,Qe]),_().getTableProps=V(C().getTableProps,{instance:_()}),_().getTableBodyProps=V(C().getTableBodyProps,{instance:_()}),N(C().useFinalInstance,_()),_()},Object.defineProperty(c,"__esModule",{value:!0})})}(Kr,Kr.exports)),Kr.exports}var Zr={exports:{}},Qn=Zr.exports,kl;function ea(){return kl||(kl=1,function(i,d){(function(c,a){a(d,v)})(Qn,function(c,a){a=a&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a;function y(r,s,u,n,x,b,m){try{var E=r[b](m),F=E.value}catch(K){u(K);return}E.done?s(F):Promise.resolve(F).then(n,x)}function R(r){return function(){var s=this,u=arguments;return new Promise(function(n,x){var b=r.apply(s,u);function m(F){y(b,n,x,m,E,"next",F)}function E(F){y(b,n,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 n in u)Object.prototype.hasOwnProperty.call(u,n)&&(r[n]=u[n])}return r},l.apply(this,arguments)}function A(r,s){if(r==null)return{};var u={},n=Object.keys(r),x,b;for(b=0;b<n.length;b++)x=n[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 n=u.call(r,s);if(typeof n!="object")return n;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 z="Renderer Error ☝️",g={init:"init"},k=function(s){var u=s.value,n=u===void 0?"":u;return n},L=function(){return a.createElement(a.Fragment,null," ")},V={Cell:k,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(n,x){var b=x.style,m=x.className,E=A(x,["style","className"]);return n=l({},n,{},E),b&&(n.style=n.style?l({},n.style||{},{},b||{}):b),m&&(n.className=n.className?n.className+" "+m:m),n.className===""&&delete n.className,n},{})}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(n){return n===void 0&&(n={}),[].concat(s,[n]).reduce(function(x,b){return N(x,b,l({},u,{userProps:n}))},{})}},I=function(s,u,n,x){return n===void 0&&(n={}),s.reduce(function(b,m){var E=m(b,n);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,n){return n===void 0&&(n={}),s.forEach(function(x){var b=x(u,n);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 ee(r,s,u,n){if(n)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 H(r,s){return typeof r=="function"?r(s):r}function G(r){var s=a.useRef();return s.current=r,a.useCallback(function(){return s.current},[])}var W=typeof document<"u"?a.useLayoutEffect:a.useEffect;function J(r,s){var u=a.useRef(!1);W(function(){u.current&&r(),u.current=!0},s)}function ue(r,s){s===void 0&&(s=0);var u=a.useRef({}),n=G(r),x=G(s);return a.useCallback(function(){var b=R(regeneratorRuntime.mark(function m(){var E,F,K,te=arguments;return regeneratorRuntime.wrap(function(oe){for(;;)switch(oe.prev=oe.next){case 0:for(E=te.length,F=new Array(E),K=0;K<E;K++)F[K]=te[K];return u.current.promise||(u.current.promise=new Promise(function(xe,be){u.current.resolve=xe,u.current.reject=be})),u.current.timeout&&clearTimeout(u.current.timeout),u.current.timeout=setTimeout(R(regeneratorRuntime.mark(function xe(){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,n().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()}},xe,null,[[1,9,12,15]])})),x()),oe.abrupt("return",u.current.promise);case 5:case"end":return oe.stop()}},m)}));return function(){return b.apply(this,arguments)}}(),[n,x])}function q(r,s,u){return u===void 0&&(u={}),function(n,x){x===void 0&&(x={});var b=typeof n=="string"?s[n]:n;if(typeof b>"u")throw console.info(s),new Error(z);return O(b,l({},r,{column:s},u,{},x))}}function O(r,s){return de(r)?a.createElement(r,s):r}function de(r){return je(r)||typeof r=="function"||ce(r)}function je(r){return typeof r=="function"&&function(){var s=Object.getPrototypeOf(r);return s.prototype&&s.prototype.isReactComponent}()}function ce(r){return typeof r=="object"&&typeof r.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(r.$$typeof.description)}function Fe(r,s,u){return u===void 0&&(u=0),r.map(function(n){return n=l({},n,{parent:s,depth:u}),Y(n),n.columns&&(n.columns=Fe(n.columns,n,u+1)),n})}function ae(r){return dt(r,"columns")}function Y(r){var s=r.id,u=r.accessor,n=r.Header;if(typeof u=="string"){s=s||u;var x=u.split(".");u=function(m){return Me(m,x)}}if(!s&&typeof n=="string"&&n&&(s=n),!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:L,Footer:L},V,{},s,{},r)),Object.assign(r,{originalWidth:r.width}),r}function M(r,s,u){u===void 0&&(u=function(){return{}});for(var n=[],x=r,b=0,m=function(){return b++},E=function(){var K={headers:[]},te=[],_e=x.some(function(oe){return oe.parent});x.forEach(function(oe){var xe=[].concat(te).reverse()[0],be;if(_e){if(oe.parent)be=l({},oe.parent,{originalId:oe.parent.id,id:oe.parent.id+"_"+m(),headers:[oe]},u(oe));else{var ne=oe.id+"_placeholder";be=fe(l({originalId:ne,id:oe.id+"_placeholder_"+m(),placeholderOf:oe,headers:[oe]},u(oe)),s)}xe&&xe.originalId===be.originalId?xe.headers.push(oe):te.push(be)}K.headers.push(oe)}),n.push(K),x=te};x.length;)E();return n.reverse()}var Ce=new Map;function Me(r,s,u){if(!s)return r;var n=typeof s=="function"?s:JSON.stringify(s),x=Ce.get(n)||function(){var m=De(s);return Ce.set(n,m),m}(),b;try{b=x.reduce(function(m,E){return m[E]},r)}catch{}return typeof b<"u"?b:u}function Le(){for(var r=arguments.length,s=new Array(r),u=0;u<r;u++)s[u]=arguments[u];for(var n=0;n<s.length;n+=1)if(typeof s[n]<"u")return s[n]}function ht(r){if(typeof r=="function")return r}function dt(r,s){var u=[],n=function x(b){b.forEach(function(m){m[s]?x(m[s]):u.push(m)})};return n(r),u}function nt(r,s){var u=s.manualExpandedKey,n=s.expanded,x=s.expandSubRows,b=x===void 0?!0:x,m=[],E=function F(K,te){te===void 0&&(te=!0),K.isExpanded=K.original&&K.original[u]||n[K.id],K.canExpand=K.subRows&&!!K.subRows.length,te&&m.push(K),K.subRows&&K.subRows.length&&K.isExpanded&&K.subRows.forEach(function(_e){return F(_e,b)})};return r.forEach(function(F){return E(F)}),m}function ke(r,s,u){return ht(r)||s[r]||u[r]||u.text}function pt(r,s,u){return r?r(s,u):typeof s>"u"}function Ct(){throw new Error("React-Table: You have not called prepareRow(row) one or more rows you are attempting to render.")}var xt=null;function Nt(){if(typeof xt=="boolean")return xt;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 xt=r,xt}var Bt=/\[/g,T=/\]/g;function De(r){return Ue(r).map(function(s){return String(s).replace(".","_")}).join(".").replace(Bt,".").replace(T,"").split(".")}function Ue(r,s){if(s===void 0&&(s=[]),!Array.isArray(r))s.push(r);else for(var u=0;u<r.length;u+=1)Ue(r[u],s);return s}var re=function(s){return l({role:"table"},s)},X=function(s){return l({role:"rowgroup"},s)},Z=function(s,u){var n=u.column;return l({key:"header_"+n.id,colSpan:n.totalVisibleHeaderCount,role:"columnheader"},s)},ie=function(s,u){var n=u.column;return l({key:"footer_"+n.id,colSpan:n.totalVisibleHeaderCount},s)},Te=function(s,u){var n=u.index;return l({key:"headerGroup_"+n,role:"row"},s)},Pe=function(s,u){var n=u.index;return l({key:"footerGroup_"+n},s)},mt=function(s,u){var n=u.row;return l({key:"row_"+n.id,role:"row"},s)},Jt=function(s,u){var n=u.cell;return l({key:"cell_"+n.row.id+"_"+n.column.id,role:"cell"},s)};function vt(){return{useOptions:[],stateReducers:[],useControlledState:[],columns:[],columnsDeps:[],allColumns:[],allColumnsDeps:[],accessValue:[],materializedColumns:[],materializedColumnsDeps:[],useInstanceAfterData:[],visibleColumns:[],visibleColumnsDeps:[],headerGroups:[],headerGroupsDeps:[],useInstanceBeforeDimensions:[],useInstance:[],prepareRow:[],getTableProps:[re],getTableBodyProps:[X],getHeaderGroupProps:[Te],getFooterGroupProps:[Pe],getHeaderProps:[Z],getFooterProps:[ie],getRowProps:[mt],getCellProps:[Jt],useFinalInstance:[]}}g.resetHiddenColumns="resetHiddenColumns",g.toggleHideColumn="toggleHideColumn",g.setHiddenColumns="setHiddenColumns",g.toggleHideAllColumns="toggleHideAllColumns";var Wt=function(s){s.getToggleHiddenProps=[Gt],s.getToggleHideAllColumnsProps=[er],s.stateReducers.push(tr),s.useInstanceBeforeDimensions.push(lr),s.headerGroupsDeps.push(function(u,n){var x=n.instance;return[].concat(u,[x.state.hiddenColumns])}),s.useInstance.push(pr)};Wt.pluginName="useColumnVisibility";var Gt=function(s,u){var n=u.column;return[s,{onChange:function(b){n.toggleHidden(!b.target.checked)},style:{cursor:"pointer"},checked:n.isVisible,title:"Toggle Column Visible"}]},er=function(s,u){var n=u.instance;return[s,{onChange:function(b){n.toggleHideAllColumns(!b.target.checked)},style:{cursor:"pointer"},checked:!n.allColumnsHidden&&!n.state.hiddenColumns.length,title:"Toggle All Columns Hidden",indeterminate:!n.allColumnsHidden&&n.state.hiddenColumns.length}]};function tr(r,s,u,n){if(s.type===g.init)return l({hiddenColumns:[]},r);if(s.type===g.resetHiddenColumns)return l({},r,{hiddenColumns:n.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:H(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?n.allColumns.map(function(E){return E.id}):[]})}}function lr(r){var s=r.headers,u=r.state.hiddenColumns,n=a.useRef(!1);n.current;var x=function m(E,F){E.isVisible=F&&!u.includes(E.id);var K=0;return E.headers&&E.headers.length?E.headers.forEach(function(te){return K+=m(te,E.isVisible)}):K=E.isVisible?1:0,E.totalVisibleHeaderCount=K,K},b=0;s.forEach(function(m){return b+=x(m,!0)})}function pr(r){var s=r.columns,u=r.flatHeaders,n=r.dispatch,x=r.allColumns,b=r.getHooks,m=r.state.hiddenColumns,E=r.autoResetHiddenColumns,F=E===void 0?!0:E,K=G(r),te=x.length===m.length,_e=a.useCallback(function(Be,ze){return n({type:g.toggleHideColumn,columnId:Be,value:ze})},[n]),oe=a.useCallback(function(Be){return n({type:g.setHiddenColumns,value:Be})},[n]),xe=a.useCallback(function(Be){return n({type:g.toggleHideAllColumns,value:Be})},[n]),be=P(b().getToggleHideAllColumnsProps,{instance:K()});u.forEach(function(Be){Be.toggleHidden=function(ze){n({type:g.toggleHideColumn,columnId:Be.id,value:ze})},Be.getToggleHiddenProps=P(b().getToggleHiddenProps,{instance:K(),column:Be})});var ne=G(F);J(function(){ne()&&n({type:g.resetHiddenColumns})},[n,s]),Object.assign(r,{allColumnsHidden:te,toggleHideColumn:_e,setHiddenColumns:oe,toggleHideAllColumns:xe,getToggleHideAllColumnsProps:be})}var ar={},cr={},yt=function(s,u,n){return s},rr=function(s,u){return s.subRows||[]},dr=function(s,u,n){return""+(n?[n.id,u].join("."):u)},mr=function(s){return s};function ir(r){var s=r.initialState,u=s===void 0?ar:s,n=r.defaultColumn,x=n===void 0?cr:n,b=r.getSubRows,m=b===void 0?rr:b,E=r.getRowId,F=E===void 0?dr:E,K=r.stateReducer,te=K===void 0?yt:K,_e=r.useControlledState,oe=_e===void 0?mr:_e,xe=A(r,["initialState","defaultColumn","getSubRows","getRowId","stateReducer","useControlledState"]);return l({},xe,{initialState:u,defaultColumn:x,getSubRows:m,getRowId:F,stateReducer:te,useControlledState:oe})}var xr=function(s){for(var u=arguments.length,n=new Array(u>1?u-1:0),x=1;x<u;x++)n[x-1]=arguments[x];s=ir(s),n=[Wt].concat(n);var b=a.useRef({}),m=G(b.current);Object.assign(m(),l({},s,{plugins:n,hooks:vt()})),n.filter(Boolean).forEach(function(qe){qe(m().hooks)});var E=G(m().hooks);m().getHooks=E,delete m().hooks,Object.assign(m(),I(E().useOptions,ir(s)));var F=m(),K=F.data,te=F.columns,_e=F.initialState,oe=F.defaultColumn,xe=F.getSubRows,be=F.getRowId,ne=F.stateReducer,Be=F.useControlledState,ze=G(ne),Ke=a.useCallback(function(qe,Dt){if(!Dt.type)throw console.info({action:Dt}),new Error("Unknown Action 👆");return[].concat(E().stateReducers,Array.isArray(ze())?ze():[ze()]).reduce(function(Ot,Qt){return Qt(Ot,Dt,qe,m())||Ot},qe)},[E,ze,m]),Ee=a.useReducer(Ke,void 0,function(){return Ke(_e,{type:g.init})}),rt=Ee[0],ct=Ee[1],Ne=I([].concat(E().useControlledState,[Be]),rt,{instance:m()});Object.assign(m(),{state:Ne,dispatch:ct});var we=a.useMemo(function(){return Fe(I(E().columns,te,{instance:m()}))},[E,m,te].concat(I(E().columnsDeps,[],{instance:m()})));m().columns=we;var Ae=a.useMemo(function(){return I(E().allColumns,ae(we),{instance:m()}).map(Y)},[we,E,m].concat(I(E().allColumnsDeps,[],{instance:m()})));m().allColumns=Ae;var We=a.useMemo(function(){for(var qe=[],Dt=[],Ot={},Qt=[].concat(Ae);Qt.length;){var Yt=Qt.shift();_t({data:K,rows:qe,flatRows:Dt,rowsById:Ot,column:Yt,getRowId:be,getSubRows:xe,accessValueHooks:E().accessValue,getInstance:m})}return[qe,Dt,Ot]},[Ae,K,be,xe,E,m]),lt=We[0],at=We[1],St=We[2];Object.assign(m(),{rows:lt,initialRows:[].concat(lt),flatRows:at,rowsById:St}),j(E().useInstanceAfterData,m());var He=a.useMemo(function(){return I(E().visibleColumns,Ae,{instance:m()}).map(function(qe){return fe(qe,oe)})},[E,Ae,m,oe].concat(I(E().visibleColumnsDeps,[],{instance:m()})));Ae=a.useMemo(function(){var qe=[].concat(He);return Ae.forEach(function(Dt){qe.find(function(Ot){return Ot.id===Dt.id})||qe.push(Dt)}),qe},[Ae,He]),m().allColumns=Ae;{var zt=Ae.filter(function(qe,Dt){return Ae.findIndex(function(Ot){return Ot.id===qe.id})!==Dt});if(zt.length)throw console.info(Ae),new Error('Duplicate columns were found with ids: "'+zt.map(function(qe){return qe.id}).join(", ")+'" in the columns array above')}var it=a.useMemo(function(){return I(E().headerGroups,M(He,oe),m())},[E,He,oe,m].concat(I(E().headerGroupsDeps,[],{instance:m()})));m().headerGroups=it;var $e=a.useMemo(function(){return it.length?it[0].headers:[]},[it]);m().headers=$e,m().flatHeaders=it.reduce(function(qe,Dt){return[].concat(qe,Dt.headers)},[]),j(E().useInstanceBeforeDimensions,m());var Je=He.filter(function(qe){return qe.isVisible}).map(function(qe){return qe.id}).sort().join("_");He=a.useMemo(function(){return He.filter(function(qe){return qe.isVisible})},[He,Je]),m().visibleColumns=He;var At=ot($e),Ut=At[0],Er=At[1],zr=At[2];return m().totalColumnsMinWidth=Ut,m().totalColumnsWidth=Er,m().totalColumnsMaxWidth=zr,j(E().useInstance,m()),[].concat(m().flatHeaders,m().allColumns).forEach(function(qe){qe.render=q(m(),qe),qe.getHeaderProps=P(E().getHeaderProps,{instance:m(),column:qe}),qe.getFooterProps=P(E().getFooterProps,{instance:m(),column:qe})}),m().headerGroups=a.useMemo(function(){return it.filter(function(qe,Dt){return qe.headers=qe.headers.filter(function(Ot){var Qt=function Yt(gr){return gr.filter(function(Zt){return Zt.headers?Yt(Zt.headers):Zt.isVisible}).length};return Ot.headers?Qt(Ot.headers):Ot.isVisible}),qe.headers.length?(qe.getHeaderGroupProps=P(E().getHeaderGroupProps,{instance:m(),headerGroup:qe,index:Dt}),qe.getFooterGroupProps=P(E().getFooterGroupProps,{instance:m(),headerGroup:qe,index:Dt}),!0):!1})},[it,m,E]),m().footerGroups=[].concat(m().headerGroups).reverse(),m().prepareRow=a.useCallback(function(qe){qe.getRowProps=P(E().getRowProps,{instance:m(),row:qe}),qe.allCells=Ae.map(function(Dt){var Ot=qe.values[Dt.id],Qt={column:Dt,row:qe,value:Ot};return Qt.getCellProps=P(E().getCellProps,{instance:m(),cell:Qt}),Qt.render=q(m(),Dt,{row:qe,cell:Qt,value:Ot}),Qt}),qe.cells=He.map(function(Dt){return qe.allCells.find(function(Ot){return Ot.column.id===Dt.id})}),j(E().prepareRow,qe,{instance:m()})},[E,m,Ae,He]),m().getTableProps=P(E().getTableProps,{instance:m()}),m().getTableBodyProps=P(E().getTableBodyProps,{instance:m()}),j(E().useFinalInstance,m()),m()};function ot(r,s){s===void 0&&(s=0);var u=0,n=0,x=0,b=0;return r.forEach(function(m){var E=m.headers;if(m.totalLeft=s,E&&E.length){var F=ot(E,s),K=F[0],te=F[1],_e=F[2],oe=F[3];m.totalMinWidth=K,m.totalWidth=te,m.totalMaxWidth=_e,m.totalFlexWidth=oe}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,n+=m.totalWidth,x+=m.totalMaxWidth,b+=m.totalFlexWidth)}),[u,n,x,b]}function _t(r){var s=r.data,u=r.rows,n=r.flatRows,x=r.rowsById,b=r.column,m=r.getRowId,E=r.getSubRows,F=r.accessValueHooks,K=r.getInstance,te=function _e(oe,xe,be,ne,Be){be===void 0&&(be=0);var ze=oe,Ke=m(oe,xe,ne),Ee=x[Ke];if(Ee)Ee.subRows&&Ee.originalSubRows.forEach(function(ct,Ne){return _e(ct,Ne,be+1,Ee)});else if(Ee={id:Ke,original:ze,index:xe,depth:be,cells:[{}]},Ee.cells.map=Ct,Ee.cells.filter=Ct,Ee.cells.forEach=Ct,Ee.cells[0].getCellProps=Ct,Ee.values={},Be.push(Ee),n.push(Ee),x[Ke]=Ee,Ee.originalSubRows=E(oe,xe),Ee.originalSubRows){var rt=[];Ee.originalSubRows.forEach(function(ct,Ne){return _e(ct,Ne,be+1,Ee,rt)}),Ee.subRows=rt}b.accessor&&(Ee.values[b.id]=b.accessor(oe,xe,Ee,Be,s)),Ee.values[b.id]=I(F,Ee.values[b.id],{row:Ee,column:b,instance:K()},!0)};s.forEach(function(_e,oe){return te(_e,oe,0,void 0,u)})}g.resetExpanded="resetExpanded",g.toggleRowExpanded="toggleRowExpanded",g.toggleAllRowsExpanded="toggleAllRowsExpanded";var ut=function(s){s.getToggleAllRowsExpandedProps=[Et],s.getToggleRowExpandedProps=[Ht],s.stateReducers.push(Ft),s.useInstance.push(Lt),s.prepareRow.push(Vt)};ut.pluginName="useExpanded";var Et=function(s,u){var n=u.instance;return[s,{onClick:function(b){n.toggleAllRowsExpanded()},style:{cursor:"pointer"},title:"Toggle All Rows Expanded"}]},Ht=function(s,u){var n=u.row;return[s,{onClick:function(){n.toggleRowExpanded()},style:{cursor:"pointer"},title:"Toggle Row Expanded"}]};function Ft(r,s,u,n){if(s.type===g.init)return l({expanded:{}},r);if(s.type===g.resetExpanded)return l({},r,{expanded:n.initialState.expanded||{}});if(s.type===g.toggleAllRowsExpanded){var x=s.value,b=n.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(Be){F[Be]=!0}),l({},r,{expanded:F})}return l({},r,{expanded:{}})}if(s.type===g.toggleRowExpanded){var K=s.id,te=s.value,_e=r.expanded[K],oe=typeof te<"u"?te:!_e;if(!_e&&oe){var xe;return l({},r,{expanded:l({},r.expanded,(xe={},xe[K]=!0,xe))})}else if(_e&&!oe){var be=r.expanded;be[K];var ne=A(be,[K].map(h));return l({},r,{expanded:ne})}else return r}}function Lt(r){var s=r.data,u=r.rows,n=r.rowsById,x=r.manualExpandedKey,b=x===void 0?"expanded":x,m=r.paginateExpandedRows,E=m===void 0?!0:m,F=r.expandSubRows,K=F===void 0?!0:F,te=r.autoResetExpanded,_e=te===void 0?!0:te,oe=r.getHooks,xe=r.plugins,be=r.state.expanded,ne=r.dispatch;ee(xe,["useSortBy","useGroupBy","usePivotColumns","useGlobalFilter"],"useExpanded");var Be=G(_e),ze=!!(Object.keys(n).length&&Object.keys(be).length);ze&&Object.keys(n).some(function(Ae){return!be[Ae]})&&(ze=!1),J(function(){Be()&&ne({type:g.resetExpanded})},[ne,s]);var Ke=a.useCallback(function(Ae,We){ne({type:g.toggleRowExpanded,id:Ae,value:We})},[ne]),Ee=a.useCallback(function(Ae){return ne({type:g.toggleAllRowsExpanded,value:Ae})},[ne]),rt=a.useMemo(function(){return E?nt(u,{manualExpandedKey:b,expanded:be,expandSubRows:K}):u},[E,u,b,be,K]),ct=a.useMemo(function(){return Tt(be)},[be]),Ne=G(r),we=P(oe().getToggleAllRowsExpandedProps,{instance:Ne()});Object.assign(r,{preExpandedRows:u,expandedRows:rt,rows:rt,expandedDepth:ct,isAllRowsExpanded:ze,toggleRowExpanded:Ke,toggleAllRowsExpanded:Ee,getToggleAllRowsExpandedProps:we})}function Vt(r,s){var u=s.instance.getHooks,n=s.instance;r.toggleRowExpanded=function(x){return n.toggleRowExpanded(r.id,x)},r.getToggleRowExpandedProps=P(u().getToggleRowExpandedProps,{instance:n,row:r})}function Tt(r){var s=0;return Object.keys(r).forEach(function(u){var n=u.split(".");s=Math.max(s,n.length)}),s}var B=function(s,u,n){return s=s.filter(function(x){return u.some(function(b){var m=x.values[b];return String(m).toLowerCase().includes(String(n).toLowerCase())})}),s};B.autoRemove=function(r){return!r};var ye=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m!==void 0?String(m).toLowerCase()===String(n).toLowerCase():!0})})};ye.autoRemove=function(r){return!r};var jt=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m!==void 0?String(m)===String(n):!0})})};jt.autoRemove=function(r){return!r};var kt=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m.includes(n)})})};kt.autoRemove=function(r){return!r||!r.length};var Kt=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m&&m.length&&n.every(function(E){return m.includes(E)})})})};Kt.autoRemove=function(r){return!r||!r.length};var $t=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m&&m.length&&n.some(function(E){return m.includes(E)})})})};$t.autoRemove=function(r){return!r||!r.length};var sr=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return n.includes(m)})})};sr.autoRemove=function(r){return!r||!r.length};var Sr=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m===n})})};Sr.autoRemove=function(r){return typeof r>"u"};var Tr=function(s,u,n){return s.filter(function(x){return u.some(function(b){var m=x.values[b];return m==n})})};Tr.autoRemove=function(r){return r==null};var ts=function(s,u,n){var x=n||[],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(K){var te=F.values[K];return te>=b&&te<=m})})};ts.autoRemove=function(r){return!r||typeof r[0]!="number"&&typeof r[1]!="number"};var Rr=Object.freeze({__proto__:null,text:B,exactText:ye,exactTextCase:jt,includes:kt,includesAll:Kt,includesSome:$t,includesValue:sr,exact:Sr,equals:Tr,between:ts});g.resetFilters="resetFilters",g.setFilter="setFilter",g.setAllFilters="setAllFilters";var rs=function(s){s.stateReducers.push(Ms),s.useInstance.push(Hs)};rs.pluginName="useFilters";function Ms(r,s,u,n){if(s.type===g.init)return l({filters:[]},r);if(s.type===g.resetFilters)return l({},r,{filters:n.initialState.filters||[]});if(s.type===g.setFilter){var x=s.columnId,b=s.filterValue,m=n.allColumns,E=n.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 K=ke(F.filter,E||{},Rr),te=r.filters.find(function(ne){return ne.id===x}),_e=H(b,te&&te.value);return pt(K.autoRemove,_e,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:_e}:ne})}):l({},r,{filters:[].concat(r.filters,[{id:x,value:_e}])})}if(s.type===g.setAllFilters){var oe=s.filters,xe=n.allColumns,be=n.filterTypes;return l({},r,{filters:H(oe,r.filters).filter(function(ne){var Be=xe.find(function(Ke){return Ke.id===ne.id}),ze=ke(Be.filter,be||{},Rr);return!pt(ze.autoRemove,ne.value,Be)})})}}function Hs(r){var s=r.data,u=r.rows,n=r.flatRows,x=r.rowsById,b=r.allColumns,m=r.filterTypes,E=r.manualFilters,F=r.defaultCanFilter,K=F===void 0?!1:F,te=r.disableFilters,_e=r.state.filters,oe=r.dispatch,xe=r.autoResetFilters,be=xe===void 0?!0:xe,ne=a.useCallback(function(Ne,we){oe({type:g.setFilter,columnId:Ne,filterValue:we})},[oe]),Be=a.useCallback(function(Ne){oe({type:g.setAllFilters,filters:Ne})},[oe]);b.forEach(function(Ne){var we=Ne.id,Ae=Ne.accessor,We=Ne.defaultCanFilter,lt=Ne.disableFilters;Ne.canFilter=Ae?Le(lt===!0?!1:void 0,te===!0?!1:void 0,!0):Le(We,K,!1),Ne.setFilter=function(St){return ne(Ne.id,St)};var at=_e.find(function(St){return St.id===we});Ne.filterValue=at&&at.value});var ze=a.useMemo(function(){if(E||!_e.length)return[u,n,x];var Ne=[],we={},Ae=function We(lt,at){at===void 0&&(at=0);var St=lt;return St=_e.reduce(function(He,zt){var it=zt.id,$e=zt.value,Je=b.find(function(Ut){return Ut.id===it});if(!Je)return He;at===0&&(Je.preFilteredRows=He);var At=ke(Je.filter,m||{},Rr);return At?(Je.filteredRows=At(He,[it],$e),Je.filteredRows):(console.warn("Could not find a valid 'column.filter' for column with the ID: "+Je.id+"."),He)},lt),St.forEach(function(He){Ne.push(He),we[He.id]=He,He.subRows&&(He.subRows=He.subRows&&He.subRows.length>0?We(He.subRows,at+1):He.subRows)}),St};return[Ae(u),Ne,we]},[E,_e,u,n,x,b,m]),Ke=ze[0],Ee=ze[1],rt=ze[2];a.useMemo(function(){var Ne=b.filter(function(we){return!_e.find(function(Ae){return Ae.id===we.id})});Ne.forEach(function(we){we.preFilteredRows=Ke,we.filteredRows=Ke})},[Ke,_e,b]);var ct=G(be);J(function(){ct()&&oe({type:g.resetFilters})},[oe,E?null:s]),Object.assign(r,{preFilteredRows:u,preFilteredFlatRows:n,preFilteredRowsById:x,filteredRows:Ke,filteredFlatRows:Ee,filteredRowsById:rt,rows:Ke,flatRows:Ee,rowsById:rt,setFilter:ne,setAllFilters:Be})}g.resetGlobalFilter="resetGlobalFilter",g.setGlobalFilter="setGlobalFilter";var ss=function(s){s.stateReducers.push(ls),s.useInstance.push(ns)};ss.pluginName="useGlobalFilter";function ls(r,s,u,n){if(s.type===g.resetGlobalFilter)return l({},r,{globalFilter:n.initialState.globalFilter||void 0});if(s.type===g.setGlobalFilter){var x=s.filterValue,b=n.userFilterTypes,m=ke(n.globalFilter,b||{},Rr),E=H(x,r.globalFilter);if(pt(m.autoRemove,E)){r.globalFilter;var F=A(r,["globalFilter"]);return F}return l({},r,{globalFilter:E})}}function ns(r){var s=r.data,u=r.rows,n=r.flatRows,x=r.rowsById,b=r.allColumns,m=r.filterTypes,E=r.globalFilter,F=r.manualGlobalFilter,K=r.state.globalFilter,te=r.dispatch,_e=r.autoResetGlobalFilter,oe=_e===void 0?!0:_e,xe=r.disableGlobalFilter,be=a.useCallback(function(rt){te({type:g.setGlobalFilter,filterValue:rt})},[te]),ne=a.useMemo(function(){if(F||typeof K>"u")return[u,n,x];var rt=[],ct={},Ne=ke(E,m||{},Rr);if(!Ne)return console.warn("Could not find a valid 'globalFilter' option."),u;b.forEach(function(We){var lt=We.disableGlobalFilter;We.canFilter=Le(lt===!0?!1:void 0,xe===!0?!1:void 0,!0)});var we=b.filter(function(We){return We.canFilter===!0}),Ae=function We(lt){return lt=Ne(lt,we.map(function(at){return at.id}),K),lt.forEach(function(at){rt.push(at),ct[at.id]=at,at.subRows=at.subRows&&at.subRows.length?We(at.subRows):at.subRows}),lt};return[Ae(u),rt,ct]},[F,K,E,m,b,u,n,x,xe]),Be=ne[0],ze=ne[1],Ke=ne[2],Ee=G(oe);J(function(){Ee()&&te({type:g.resetGlobalFilter})},[te,F?null:s]),Object.assign(r,{preGlobalFilteredRows:u,preGlobalFilteredFlatRows:n,preGlobalFilteredRowsById:x,globalFilteredRows:Be,globalFilteredFlatRows:ze,globalFilteredRowsById:Ke,rows:Be,flatRows:ze,rowsById:Ke,setGlobalFilter:be,disableGlobalFilter:xe})}function Nr(r,s){return s.reduce(function(u,n){return u+(typeof n=="number"?n:0)},0)}function wr(r){var s=r[0]||0;return r.forEach(function(u){typeof u=="number"&&(s=Math.min(s,u))}),s}function as(r){var s=r[0]||0;return r.forEach(function(u){typeof u=="number"&&(s=Math.max(s,u))}),s}function Ls(r){var s=r[0]||0,u=r[0]||0;return r.forEach(function(n){typeof n=="number"&&(s=Math.min(s,n),u=Math.max(u,n))}),s+".."+u}function is(r){return Nr(null,r)/r.length}function ks(r){if(!r.length)return null;var s=Math.floor(r.length/2),u=[].concat(r).sort(function(n,x){return n-x});return r.length%2!==0?u[s]:(u[s-1]+u[s])/2}function Vs(r){return Array.from(new Set(r).values())}function Os(r){return new Set(r).size}function os(r){return r.length}var Br=Object.freeze({__proto__:null,sum:Nr,min:wr,max:as,minMax:Ls,average:is,median:ks,unique:Vs,uniqueCount:Os,count:os}),Ws=[],zs={};g.resetGroupBy="resetGroupBy",g.setGroupBy="setGroupBy",g.toggleGroupBy="toggleGroupBy";var Gr=function(s){s.getGroupByToggleProps=[us],s.stateReducers.push(Ys),s.visibleColumnsDeps.push(function(u,n){var x=n.instance;return[].concat(u,[x.state.groupBy])}),s.visibleColumns.push(qs),s.useInstance.push(Ks),s.prepareRow.push(Zs)};Gr.pluginName="useGroupBy";var us=function(s,u){var n=u.header;return[s,{onClick:n.canGroupBy?function(x){x.persist(),n.toggleGroupBy()}:void 0,style:{cursor:n.canGroupBy?"pointer":void 0},title:"Toggle GroupBy"}]};function Ys(r,s,u,n){if(s.type===g.init)return l({groupBy:[]},r);if(s.type===g.resetGroupBy)return l({},r,{groupBy:n.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 qs(r,s){var u=s.instance.state.groupBy,n=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(n,x),r.forEach(function(b){b.isGrouped=u.includes(b.id),b.groupedIndex=u.indexOf(b.id)}),r}var Us={};function Ks(r){var s=r.data,u=r.rows,n=r.flatRows,x=r.rowsById,b=r.allColumns,m=r.flatHeaders,E=r.groupByFn,F=E===void 0?cs:E,K=r.manualGroupBy,te=r.aggregations,_e=te===void 0?Us:te,oe=r.plugins,xe=r.state.groupBy,be=r.dispatch,ne=r.autoResetGroupBy,Be=ne===void 0?!0:ne,ze=r.disableGroupBy,Ke=r.defaultCanGroupBy,Ee=r.getHooks;ee(oe,["useColumnOrder","useFilters"],"useGroupBy");var rt=G(r);b.forEach(function($e){var Je=$e.accessor,At=$e.defaultGroupBy,Ut=$e.disableGroupBy;$e.canGroupBy=Je?Le($e.canGroupBy,Ut===!0?!1:void 0,ze===!0?!1:void 0,!0):Le($e.canGroupBy,At,Ke,!1),$e.canGroupBy&&($e.toggleGroupBy=function(){return r.toggleGroupBy($e.id)}),$e.Aggregated=$e.Aggregated||$e.Cell});var ct=a.useCallback(function($e,Je){be({type:g.toggleGroupBy,columnId:$e,value:Je})},[be]),Ne=a.useCallback(function($e){be({type:g.setGroupBy,value:$e})},[be]);m.forEach(function($e){$e.getGroupByToggleProps=P(Ee().getGroupByToggleProps,{instance:rt(),header:$e})});var we=a.useMemo(function(){if(K||!xe.length)return[u,n,x,Ws,zs,n,x];var $e=xe.filter(function(Yt){return b.find(function(gr){return gr.id===Yt})}),Je=function(gr,Zt,Ns){var vr={};return b.forEach(function(Mt){if($e.includes(Mt.id)){vr[Mt.id]=Zt[0]?Zt[0].values[Mt.id]:null;return}var As=typeof Mt.aggregate=="function"?Mt.aggregate:_e[Mt.aggregate]||Br[Mt.aggregate];if(As){var Dr=Zt.map(function(Pr){return Pr.values[Mt.id]}),hl=gr.map(function(Pr){var yr=Pr.values[Mt.id];if(!Ns&&Mt.aggregateValue){var _r=typeof Mt.aggregateValue=="function"?Mt.aggregateValue:_e[Mt.aggregateValue]||Br[Mt.aggregateValue];if(!_r)throw console.info({column:Mt}),new Error("React Table: Invalid column.aggregateValue option for column listed above");yr=_r(yr,Pr,Mt)}return yr});vr[Mt.id]=As(hl,Dr)}else{if(Mt.aggregate)throw console.info({column:Mt}),new Error("React Table: Invalid column.aggregate option for column listed above");vr[Mt.id]=null}}),vr},At=[],Ut={},Er=[],zr={},qe=[],Dt={},Ot=function Yt(gr,Zt,Ns){if(Zt===void 0&&(Zt=0),Zt===$e.length)return gr.map(function(Dr){return l({},Dr,{depth:Zt})});var vr=$e[Zt],Mt=F(gr,vr),As=Object.entries(Mt).map(function(Dr,hl){var Pr=Dr[0],yr=Dr[1],_r=vr+":"+Pr;_r=Ns?Ns+">"+_r:_r;var Tl=Yt(yr,Zt+1,_r),Bl=Zt?dt(yr,"leafRows"):yr,Ql=Je(Bl,yr,Zt),en={id:_r,isGrouped:!0,groupByID:vr,groupByVal:Pr,values:Ql,subRows:Tl,leafRows:Bl,depth:Zt,index:hl};return Tl.forEach(function(or){At.push(or),Ut[or.id]=or,or.isGrouped?(Er.push(or),zr[or.id]=or):(qe.push(or),Dt[or.id]=or)}),en});return As},Qt=Ot(u);return Qt.forEach(function(Yt){At.push(Yt),Ut[Yt.id]=Yt,Yt.isGrouped?(Er.push(Yt),zr[Yt.id]=Yt):(qe.push(Yt),Dt[Yt.id]=Yt)}),[Qt,At,Ut,Er,zr,qe,Dt]},[K,xe,u,n,x,b,_e,F]),Ae=we[0],We=we[1],lt=we[2],at=we[3],St=we[4],He=we[5],zt=we[6],it=G(Be);J(function(){it()&&be({type:g.resetGroupBy})},[be,K?null:s]),Object.assign(r,{preGroupedRows:u,preGroupedFlatRow:n,preGroupedRowsById:x,groupedRows:Ae,groupedFlatRows:We,groupedRowsById:lt,onlyGroupedFlatRows:at,onlyGroupedRowsById:St,nonGroupedFlatRows:He,nonGroupedRowsById:zt,rows:Ae,flatRows:We,rowsById:lt,toggleGroupBy:ct,setGroupBy:Ne})}function Zs(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 cs(r,s){return r.reduce(function(u,n,x){var b=""+n.values[s];return u[b]=Array.isArray(u[b])?u[b]:[],u[b].push(n),u},{})}var ds=/([0-9]+)/gm,$s=function(s,u,n){var x=Cr(s,u,n),b=x[0],m=x[1];for(b=hs(b),m=hs(m),b=b.split(ds).filter(Boolean),m=m.split(ds).filter(Boolean);b.length&&m.length;){var E=b.shift(),F=m.shift(),K=parseInt(E,10),te=parseInt(F,10),_e=[K,te].sort();if(isNaN(_e[0])){if(E>F)return 1;if(F>E)return-1;continue}if(isNaN(_e[1]))return isNaN(K)?-1:1;if(K>te)return 1;if(te>K)return-1}return b.length-m.length};function Xs(r,s,u){var n=Cr(r,s,u),x=n[0],b=n[1];return x=x.getTime(),b=b.getTime(),Fr(x,b)}function Js(r,s,u){var n=Cr(r,s,u),x=n[0],b=n[1];return Fr(x,b)}function Qs(r,s,u){var n=Cr(r,s,u),x=n[0],b=n[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(),K=E.toLowerCase();if(F>K)return 1;if(K>F)return-1;if(m>E)return 1;if(E>m)return-1}return x.length-b.length}function fs(r,s,u){var n=Cr(r,s,u),x=n[0],b=n[1],m=/[^0-9.]/gi;return x=Number(String(x).replace(m,"")),b=Number(String(b).replace(m,"")),Fr(x,b)}function Fr(r,s){return r===s?0:r>s?1:-1}function Cr(r,s,u){return[r.values[u],s.values[u]]}function hs(r){return typeof r=="number"?isNaN(r)||r===1/0||r===-1/0?"":String(r):typeof r=="string"?r:""}var el=Object.freeze({__proto__:null,alphanumeric:$s,datetime:Xs,basic:Js,string:Qs,number:fs});g.resetSortBy="resetSortBy",g.setSortBy="setSortBy",g.toggleSortBy="toggleSortBy",g.clearSortBy="clearSortBy",V.sortType="alphanumeric",V.sortDescFirst=!1;var ps=function(s){s.getSortByToggleProps=[tl],s.stateReducers.push(ms),s.useInstance.push(xs)};ps.pluginName="useSortBy";var tl=function(s,u){var n=u.instance,x=u.column,b=n.isMultiSortEvent,m=b===void 0?function(E){return E.shiftKey}:b;return[s,{onClick:x.canSort?function(E){E.persist(),x.toggleSortBy(void 0,!n.disableMultiSort&&m(E))}:void 0,style:{cursor:x.canSort?"pointer":void 0},title:x.canSort?"Toggle SortBy":void 0}]};function ms(r,s,u,n){if(s.type===g.init)return l({sortBy:[]},r);if(s.type===g.resetSortBy)return l({},r,{sortBy:n.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,K=s.multi,te=n.allColumns,_e=n.disableMultiSort,oe=n.disableSortRemove,xe=n.disableMultiRemove,be=n.maxMultiSortColCount,ne=be===void 0?Number.MAX_SAFE_INTEGER:be,Be=r.sortBy,ze=te.find(function(Ae){return Ae.id===E}),Ke=ze.sortDescFirst,Ee=Be.find(function(Ae){return Ae.id===E}),rt=Be.findIndex(function(Ae){return Ae.id===E}),ct=typeof F<"u"&&F!==null,Ne=[],we;return!_e&&K?Ee?we="toggle":we="add":rt!==Be.length-1||Be.length!==1?we="replace":Ee?we="toggle":we="replace",we==="toggle"&&!oe&&!ct&&(!K||!xe)&&(Ee&&Ee.desc&&!Ke||!Ee.desc&&Ke)&&(we="remove"),we==="replace"?Ne=[{id:E,desc:ct?F:Ke}]:we==="add"?(Ne=[].concat(Be,[{id:E,desc:ct?F:Ke}]),Ne.splice(0,Ne.length-ne)):we==="toggle"?Ne=Be.map(function(Ae){return Ae.id===E?l({},Ae,{desc:ct?F:!Ee.desc}):Ae}):we==="remove"&&(Ne=Be.filter(function(Ae){return Ae.id!==E})),l({},r,{sortBy:Ne})}}function xs(r){var s=r.data,u=r.rows,n=r.flatRows,x=r.allColumns,b=r.orderByFn,m=b===void 0?Mr:b,E=r.sortTypes,F=r.manualSortBy,K=r.defaultCanSort,te=r.disableSortBy,_e=r.flatHeaders,oe=r.state.sortBy,xe=r.dispatch,be=r.plugins,ne=r.getHooks,Be=r.autoResetSortBy,ze=Be===void 0?!0:Be;ee(be,["useFilters","useGlobalFilter","useGroupBy","usePivotColumns"],"useSortBy");var Ke=a.useCallback(function(We){xe({type:g.setSortBy,sortBy:We})},[xe]),Ee=a.useCallback(function(We,lt,at){xe({type:g.toggleSortBy,columnId:We,desc:lt,multi:at})},[xe]),rt=G(r);_e.forEach(function(We){var lt=We.accessor,at=We.canSort,St=We.disableSortBy,He=We.id,zt=lt?Le(St===!0?!1:void 0,te===!0?!1:void 0,!0):Le(K,at,!1);We.canSort=zt,We.canSort&&(We.toggleSortBy=function($e,Je){return Ee(We.id,$e,Je)},We.clearSortBy=function(){xe({type:g.clearSortBy,columnId:We.id})}),We.getSortByToggleProps=P(ne().getSortByToggleProps,{instance:rt(),column:We});var it=oe.find(function($e){return $e.id===He});We.isSorted=!!it,We.sortedIndex=oe.findIndex(function($e){return $e.id===He}),We.isSortedDesc=We.isSorted?it.desc:void 0});var ct=a.useMemo(function(){if(F||!oe.length)return[u,n];var We=[],lt=oe.filter(function(St){return x.find(function(He){return He.id===St.id})}),at=function St(He){var zt=m(He,lt.map(function(it){var $e=x.find(function(Ut){return Ut.id===it.id});if(!$e)throw new Error("React-Table: Could not find a column with id: "+it.id+" while sorting");var Je=$e.sortType,At=ht(Je)||(E||{})[Je]||el[Je];if(!At)throw new Error("React-Table: Could not find a valid sortType of '"+Je+"' for column '"+it.id+"'.");return function(Ut,Er){return At(Ut,Er,it.id,it.desc)}}),lt.map(function(it){var $e=x.find(function(Je){return Je.id===it.id});return $e&&$e.sortInverted?it.desc:!it.desc}));return zt.forEach(function(it){We.push(it),!(!it.subRows||it.subRows.length===0)&&(it.subRows=St(it.subRows))}),zt};return[at(u),We]},[F,oe,u,n,x,m,E]),Ne=ct[0],we=ct[1],Ae=G(ze);J(function(){Ae()&&xe({type:g.resetSortBy})},[F?null:s]),Object.assign(r,{preSortedRows:u,preSortedFlatRows:n,sortedRows:Ne,sortedFlatRows:we,rows:Ne,flatRows:we,setSortBy:Ke,toggleSortBy:Ee})}function Mr(r,s,u){return[].concat(r).sort(function(n,x){for(var b=0;b<s.length;b+=1){var m=s[b],E=u[b]===!1||u[b]==="desc",F=m(n,x);if(F!==0)return E?-F:F}return u[0]?n.index-x.index:x.index-n.index})}var rl="usePagination";g.resetPage="resetPage",g.gotoPage="gotoPage",g.setPageSize="setPageSize";var gs=function(s){s.stateReducers.push(sl),s.useInstance.push(vs)};gs.pluginName=rl;function sl(r,s,u,n){if(s.type===g.init)return l({pageSize:10,pageIndex:0},r);if(s.type===g.resetPage)return l({},r,{pageIndex:n.initialState.pageIndex||0});if(s.type===g.gotoPage){var x=n.pageCount,b=n.page,m=H(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,K=r.pageSize*r.pageIndex,te=Math.floor(K/F);return l({},r,{pageIndex:te,pageSize:F})}}function vs(r){var s=r.rows,u=r.autoResetPage,n=u===void 0?!0:u,x=r.manualExpandedKey,b=x===void 0?"expanded":x,m=r.plugins,E=r.pageCount,F=r.paginateExpandedRows,K=F===void 0?!0:F,te=r.expandSubRows,_e=te===void 0?!0:te,oe=r.state,xe=oe.pageSize,be=oe.pageIndex,ne=oe.expanded,Be=oe.globalFilter,ze=oe.filters,Ke=oe.groupBy,Ee=oe.sortBy,rt=r.dispatch,ct=r.data,Ne=r.manualPagination;ee(m,["useGlobalFilter","useFilters","useGroupBy","useSortBy","useExpanded"],"usePagination");var we=G(n);J(function(){we()&&rt({type:g.resetPage})},[rt,Ne?null:ct,Be,ze,Ke,Ee]);var Ae=Ne?E:Math.ceil(s.length/xe),We=a.useMemo(function(){return Ae>0?[].concat(new Array(Ae)).fill(null).map(function(Je,At){return At}):[]},[Ae]),lt=a.useMemo(function(){var Je;if(Ne)Je=s;else{var At=xe*be,Ut=At+xe;Je=s.slice(At,Ut)}return K?Je:nt(Je,{manualExpandedKey:b,expanded:ne,expandSubRows:_e})},[_e,ne,b,Ne,be,xe,K,s]),at=be>0,St=Ae===-1?lt.length>=xe:be<Ae-1,He=a.useCallback(function(Je){rt({type:g.gotoPage,pageIndex:Je})},[rt]),zt=a.useCallback(function(){return He(function(Je){return Je-1})},[He]),it=a.useCallback(function(){return He(function(Je){return Je+1})},[He]),$e=a.useCallback(function(Je){rt({type:g.setPageSize,pageSize:Je})},[rt]);Object.assign(r,{pageOptions:We,pageCount:Ae,page:lt,canPreviousPage:at,canNextPage:St,gotoPage:He,previousPage:zt,nextPage:it,setPageSize:$e})}g.resetPivot="resetPivot",g.togglePivot="togglePivot";var ys=function(s){s.getPivotToggleProps=[ll],s.stateReducers.push(bs),s.useInstanceAfterData.push(nl),s.allColumns.push(al),s.accessValue.push(il),s.materializedColumns.push(ol),s.materializedColumnsDeps.push(Hr),s.visibleColumns.push(js),s.visibleColumnsDeps.push(Ar),s.useInstance.push(Lr),s.prepareRow.push(kr)};ys.pluginName="usePivotColumns";var _s=[],ll=function(s,u){var n=u.header;return[s,{onClick:n.canPivot?function(x){x.persist(),n.togglePivot()}:void 0,style:{cursor:n.canPivot?"pointer":void 0},title:"Toggle Pivot"}]};function bs(r,s,u,n){if(s.type===g.init)return l({pivotColumns:_s},r);if(s.type===g.resetPivot)return l({},r,{pivotColumns:n.initialState.pivotColumns||_s});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 nl(r){r.allColumns.forEach(function(s){s.isPivotSource=r.state.pivotColumns.includes(s.id)})}function al(r,s){var u=s.instance;return r.forEach(function(n){n.isPivotSource=u.state.pivotColumns.includes(n.id),n.uniqueValues=new Set}),r}function il(r,s){var u=s.column;return u.uniqueValues&&typeof r<"u"&&u.uniqueValues.add(r),r}function ol(r,s){var u=s.instance,n=u.allColumns,x=u.state;if(!x.pivotColumns.length||!x.groupBy||!x.groupBy.length)return r;var b=x.pivotColumns.map(function(K){return n.find(function(te){return te.id===K})}).filter(Boolean),m=n.filter(function(K){return!K.isPivotSource&&!x.groupBy.includes(K.id)&&!x.pivotColumns.includes(K.id)}),E=function K(te,_e,oe){te===void 0&&(te=0),oe===void 0&&(oe=[]);var xe=b[te];if(!xe)return m.map(function(ne){return l({},ne,{canPivot:!1,isPivoted:!0,parent:_e,depth:te,id:""+(_e?_e.id+"."+ne.id:ne.id),accessor:function(ze,Ke,Ee){if(oe.every(function(rt){return rt(Ee)}))return Ee.values[ne.id]}})});var be=Array.from(xe.uniqueValues).sort();return be.map(function(ne){var Be=l({},xe,{Header:xe.PivotHeader||typeof xe.header=="string"?xe.Header+": "+ne:ne,isPivotGroup:!0,parent:_e,depth:te,id:_e?_e.id+"."+xe.id+"."+ne:xe.id+"."+ne,pivotValue:ne});return Be.columns=K(te+1,Be,[].concat(oe,[function(ze){return ze.values[xe.id]===ne}])),Be})},F=ae(E());return[].concat(r,F)}function Hr(r,s){var u=s.instance.state,n=u.pivotColumns,x=u.groupBy;return[].concat(r,[n,x])}function js(r,s){var u=s.instance.state;return r=r.filter(function(n){return!n.isPivotSource}),u.pivotColumns.length&&u.groupBy&&u.groupBy.length&&(r=r.filter(function(n){return n.isGrouped||n.isPivoted})),r}function Ar(r,s){var u=s.instance;return[].concat(r,[u.state.pivotColumns,u.state.groupBy])}function Lr(r){var s=r.columns,u=r.allColumns,n=r.flatHeaders,x=r.getHooks,b=r.plugins,m=r.dispatch,E=r.autoResetPivot,F=E===void 0?!0:E,K=r.manaulPivot,te=r.disablePivot,_e=r.defaultCanPivot;ee(b,["useGroupBy"],"usePivotColumns");var oe=G(r);u.forEach(function(ne){var Be=ne.accessor,ze=ne.defaultPivot,Ke=ne.disablePivot;ne.canPivot=Be?Le(ne.canPivot,Ke===!0?!1:void 0,te===!0?!1:void 0,!0):Le(ne.canPivot,ze,_e,!1),ne.canPivot&&(ne.togglePivot=function(){return r.togglePivot(ne.id)}),ne.Aggregated=ne.Aggregated||ne.Cell});var xe=function(Be,ze){m({type:g.togglePivot,columnId:Be,value:ze})};n.forEach(function(ne){ne.getPivotToggleProps=P(x().getPivotToggleProps,{instance:oe(),header:ne})});var be=G(F);J(function(){be()&&m({type:g.resetPivot})},[m,K?null:s]),Object.assign(r,{togglePivot:xe})}function kr(r){r.allCells.forEach(function(s){s.isPivoted=s.column.isPivoted})}var Rs="useRowSelect";g.resetSelectedRows="resetSelectedRows",g.toggleAllRowsSelected="toggleAllRowsSelected",g.toggleRowSelected="toggleRowSelected",g.toggleAllPageRowsSelected="toggleAllPageRowsSelected";var Vr=function(s){s.getToggleRowSelectedProps=[ul],s.getToggleAllRowsSelectedProps=[Or],s.getToggleAllPageRowsSelectedProps=[cl],s.stateReducers.push(dl),s.useInstance.push(fl),s.prepareRow.push(ws)};Vr.pluginName=Rs;var ul=function(s,u){var n=u.instance,x=u.row,b=n.manualRowSelectedKey,m=b===void 0?"isSelected":b,E=!1;return x.original&&x.original[m]?E=!0:E=x.isSelected,[s,{onChange:function(K){x.toggleRowSelected(K.target.checked)},style:{cursor:"pointer"},checked:E,title:"Toggle Row Selected",indeterminate:x.isSomeSelected}]},Or=function(s,u){var n=u.instance;return[s,{onChange:function(b){n.toggleAllRowsSelected(b.target.checked)},style:{cursor:"pointer"},checked:n.isAllRowsSelected,title:"Toggle All Rows Selected",indeterminate:!!(!n.isAllRowsSelected&&Object.keys(n.state.selectedRowIds).length)}]},cl=function(s,u){var n=u.instance;return[s,{onChange:function(b){n.toggleAllPageRowsSelected(b.target.checked)},style:{cursor:"pointer"},checked:n.isAllPageRowsSelected,title:"Toggle All Current Page Rows Selected",indeterminate:!!(!n.isAllPageRowsSelected&&n.page.some(function(x){var b=x.id;return n.state.selectedRowIds[b]}))}]};function dl(r,s,u,n){if(s.type===g.init)return l({selectedRowIds:{}},r);if(s.type===g.resetSelectedRows)return l({},r,{selectedRowIds:n.initialState.selectedRowIds||{}});if(s.type===g.toggleAllRowsSelected){var x=s.value,b=n.isAllRowsSelected,m=n.rowsById,E=n.nonGroupedRowsById,F=E===void 0?m:E,K=typeof x<"u"?x:!b,te=Object.assign({},r.selectedRowIds);return K?Object.keys(F).forEach(function(it){te[it]=!0}):Object.keys(F).forEach(function(it){delete te[it]}),l({},r,{selectedRowIds:te})}if(s.type===g.toggleRowSelected){var _e=s.id,oe=s.value,xe=n.rowsById,be=n.selectSubRows,ne=be===void 0?!0:be,Be=n.getSubRows,ze=r.selectedRowIds[_e],Ke=typeof oe<"u"?oe:!ze;if(ze===Ke)return r;var Ee=l({},r.selectedRowIds),rt=function it($e){var Je=xe[$e];if(Je&&(Je.isGrouped||(Ke?Ee[$e]=!0:delete Ee[$e]),ne&&Be(Je)))return Be(Je).forEach(function(At){return it(At.id)})};return rt(_e),l({},r,{selectedRowIds:Ee})}if(s.type===g.toggleAllPageRowsSelected){var ct=s.value,Ne=n.page,we=n.rowsById,Ae=n.selectSubRows,We=Ae===void 0?!0:Ae,lt=n.isAllPageRowsSelected,at=n.getSubRows,St=typeof ct<"u"?ct:!lt,He=l({},r.selectedRowIds),zt=function it($e){var Je=we[$e];if(Je.isGrouped||(St?He[$e]=!0:delete He[$e]),We&&at(Je))return at(Je).forEach(function(At){return it(At.id)})};return Ne.forEach(function(it){return zt(it.id)}),l({},r,{selectedRowIds:He})}return r}function fl(r){var s=r.data,u=r.rows,n=r.getHooks,x=r.plugins,b=r.rowsById,m=r.nonGroupedRowsById,E=m===void 0?b:m,F=r.autoResetSelectedRows,K=F===void 0?!0:F,te=r.state.selectedRowIds,_e=r.selectSubRows,oe=_e===void 0?!0:_e,xe=r.dispatch,be=r.page,ne=r.getSubRows;ee(x,["useFilters","useGroupBy","useSortBy","useExpanded","usePagination"],"useRowSelect");var Be=a.useMemo(function(){var lt=[];return u.forEach(function(at){var St=oe?Cs(at,te,ne):!!te[at.id];at.isSelected=!!St,at.isSomeSelected=St===null,St&&lt.push(at)}),lt},[u,oe,te,ne]),ze=!!(Object.keys(E).length&&Object.keys(te).length),Ke=ze;ze&&Object.keys(E).some(function(lt){return!te[lt]})&&(ze=!1),ze||be&&be.length&&be.some(function(lt){var at=lt.id;return!te[at]})&&(Ke=!1);var Ee=G(K);J(function(){Ee()&&xe({type:g.resetSelectedRows})},[xe,s]);var rt=a.useCallback(function(lt){return xe({type:g.toggleAllRowsSelected,value:lt})},[xe]),ct=a.useCallback(function(lt){return xe({type:g.toggleAllPageRowsSelected,value:lt})},[xe]),Ne=a.useCallback(function(lt,at){return xe({type:g.toggleRowSelected,id:lt,value:at})},[xe]),we=G(r),Ae=P(n().getToggleAllRowsSelectedProps,{instance:we()}),We=P(n().getToggleAllPageRowsSelectedProps,{instance:we()});Object.assign(r,{selectedFlatRows:Be,isAllRowsSelected:ze,isAllPageRowsSelected:Ke,toggleRowSelected:Ne,toggleAllRowsSelected:rt,getToggleAllRowsSelectedProps:Ae,getToggleAllPageRowsSelectedProps:We,toggleAllPageRowsSelected:ct})}function ws(r,s){var u=s.instance;r.toggleRowSelected=function(n){return u.toggleRowSelected(r.id,n)},r.getToggleRowSelectedProps=P(u.getHooks().getToggleRowSelectedProps,{instance:u,row:r})}function Cs(r,s,u){if(s[r.id])return!0;var n=u(r);if(n&&n.length){var x=!0,b=!1;return n.forEach(function(m){b&&!x||(Cs(m,s,u)?b=!0:x=!1)}),x?!0:b?null:!1}return!1}var Es=function(s){return{}},Ps=function(s){return{}};g.setRowState="setRowState",g.setCellState="setCellState",g.resetRowState="resetRowState";var Ss=function(s){s.stateReducers.push(Wr),s.useInstance.push(t),s.prepareRow.push(o)};Ss.pluginName="useRowState";function Wr(r,s,u,n){var x=n.initialRowStateAccessor,b=x===void 0?Es:x,m=n.initialCellStateAccessor,E=m===void 0?Ps:m,F=n.rowsById;if(s.type===g.init)return l({rowState:{}},r);if(s.type===g.resetRowState)return l({},r,{rowState:n.initialState.rowState||{}});if(s.type===g.setRowState){var K,te=s.rowId,_e=s.value,oe=typeof r.rowState[te]<"u"?r.rowState[te]:b(F[te]);return l({},r,{rowState:l({},r.rowState,(K={},K[te]=H(_e,oe),K))})}if(s.type===g.setCellState){var xe,be,ne,Be,ze,Ke=s.rowId,Ee=s.columnId,rt=s.value,ct=typeof r.rowState[Ke]<"u"?r.rowState[Ke]:b(F[Ke]),Ne=typeof(ct==null||(xe=ct.cellState)==null?void 0:xe[Ee])<"u"?ct.cellState[Ee]:E((be=F[Ke])==null||(ne=be.cells)==null?void 0:ne.find(function(we){return we.column.id===Ee}));return l({},r,{rowState:l({},r.rowState,(ze={},ze[Ke]=l({},ct,{cellState:l({},ct.cellState||{},(Be={},Be[Ee]=H(rt,Ne),Be))}),ze))})}}function t(r){var s=r.autoResetRowState,u=s===void 0?!0:s,n=r.data,x=r.dispatch,b=a.useCallback(function(F,K){return x({type:g.setRowState,rowId:F,value:K})},[x]),m=a.useCallback(function(F,K,te){return x({type:g.setCellState,rowId:F,columnId:K,value:te})},[x]),E=G(u);J(function(){E()&&x({type:g.resetRowState})},[n]),Object.assign(r,{setRowState:b,setCellState:m})}function o(r,s){var u=s.instance,n=u.initialRowStateAccessor,x=n===void 0?Es:n,b=u.initialCellStateAccessor,m=b===void 0?Ps: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(K){return u.setCellState(r.id,F.column.id,K)}}))}g.resetColumnOrder="resetColumnOrder",g.setColumnOrder="setColumnOrder";var f=function(s){s.stateReducers.push(p),s.visibleColumnsDeps.push(function(u,n){var x=n.instance;return[].concat(u,[x.state.columnOrder])}),s.visibleColumns.push(w),s.useInstance.push(_)};f.pluginName="useColumnOrder";function p(r,s,u,n){if(s.type===g.init)return l({columnOrder:[]},r);if(s.type===g.resetColumnOrder)return l({},r,{columnOrder:n.initialState.columnOrder||[]});if(s.type===g.setColumnOrder)return l({},r,{columnOrder:H(s.columnOrder,r.columnOrder)})}function w(r,s){var u=s.instance.state.columnOrder;if(!u||!u.length)return r;for(var n=[].concat(u),x=[].concat(r),b=[],m=function(){var F=n.shift(),K=x.findIndex(function(te){return te.id===F});K>-1&&b.push(x.splice(K,1)[0])};x.length&&n.length;)m();return[].concat(b,x)}function _(r){var s=r.dispatch;r.setColumnOrder=a.useCallback(function(u){return s({type:g.setColumnOrder,columnOrder:u})},[s])}V.canResize=!0,g.columnStartResizing="columnStartResizing",g.columnResizing="columnResizing",g.columnDoneResizing="columnDoneResizing",g.resetResize="resetResize";var C=function(s){s.getResizerProps=[U],s.getHeaderProps.push({style:{position:"relative"}}),s.stateReducers.push($),s.useInstance.push(ge),s.useInstanceBeforeDimensions.push(Q)},U=function(s,u){var n=u.instance,x=u.header,b=n.dispatch,m=function(F,K){var te=!1;if(F.type==="touchstart"){if(F.touches&&F.touches.length>1)return;te=!0}var _e=pe(K),oe=_e.map(function(Ne){return[Ne.id,Ne.totalWidth]}),xe=te?Math.round(F.touches[0].clientX):F.clientX,be,ne,Be=function(){window.cancelAnimationFrame(be),be=null,b({type:g.columnDoneResizing})},ze=function(){window.cancelAnimationFrame(be),be=null,b({type:g.columnResizing,clientX:ne})},Ke=function(we){ne=we,be||(be=window.requestAnimationFrame(ze))},Ee={mouse:{moveEvent:"mousemove",moveHandler:function(we){return Ke(we.clientX)},upEvent:"mouseup",upHandler:function(we){document.removeEventListener("mousemove",Ee.mouse.moveHandler),document.removeEventListener("mouseup",Ee.mouse.upHandler),Be()}},touch:{moveEvent:"touchmove",moveHandler:function(we){return we.cancelable&&(we.preventDefault(),we.stopPropagation()),Ke(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),Be()}}},rt=te?Ee.touch:Ee.mouse,ct=Nt()?{passive:!1}:!1;document.addEventListener(rt.moveEvent,rt.moveHandler,ct),document.addEventListener(rt.upEvent,rt.upHandler,ct),b({type:g.columnStartResizing,columnId:K.id,columnWidth:K.totalWidth,headerIdWidths:oe,clientX:xe})};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 $(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,n=s.columnId,x=s.columnWidth,b=s.headerIdWidths;return l({},r,{columnResizing:l({},r.columnResizing,{startX:u,headerIdWidths:b,columnWidth:x,isResizingColumn:n})})}if(s.type===g.columnResizing){var m=s.clientX,E=r.columnResizing,F=E.startX,K=E.columnWidth,te=E.headerIdWidths,_e=te===void 0?[]:te,oe=m-F,xe=oe/K,be={};return _e.forEach(function(ne){var Be=ne[0],ze=ne[1];be[Be]=Math.max(ze+ze*xe,0)}),l({},r,{columnResizing:l({},r.columnResizing,{columnWidths:l({},r.columnResizing.columnWidths,{},be)})})}if(s.type===g.columnDoneResizing)return l({},r,{columnResizing:l({},r.columnResizing,{startX:null,isResizingColumn:null})})}var Q=function(s){var u=s.flatHeaders,n=s.disableResizing,x=s.getHooks,b=s.state.columnResizing,m=G(s);u.forEach(function(E){var F=Le(E.disableResizing===!0?!1:void 0,n===!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,n=r.autoResetResize,x=n===void 0?!0:n,b=r.columns;ee(s,["useAbsoluteLayout"],"useResizeColumns");var m=G(x);J(function(){m()&&u({type:g.resetResize})},[b]);var E=a.useCallback(function(){return u({type:g.resetResize})},[u]);Object.assign(r,{resetResizing:E})}function pe(r){var s=[],u=function n(x){x.columns&&x.columns.length&&x.columns.map(n),s.push(x)};return u(r),s}var me={position:"absolute",top:0},se=function(s){s.getTableBodyProps.push(he),s.getRowProps.push(he),s.getHeaderGroupProps.push(he),s.getFooterGroupProps.push(he),s.getHeaderProps.push(function(u,n){var x=n.column;return[u,{style:l({},me,{left:x.totalLeft+"px",width:x.totalWidth+"px"})}]}),s.getCellProps.push(function(u,n){var x=n.cell;return[u,{style:l({},me,{left:x.column.totalLeft+"px",width:x.column.totalWidth+"px"})}]}),s.getFooterProps.push(function(u,n){var x=n.column;return[u,{style:l({},me,{left:x.totalLeft+"px",width:x.totalWidth+"px"})}]})};se.pluginName="useAbsoluteLayout";var he=function(s,u){var n=u.instance;return[s,{style:{position:"relative",width:n.totalColumnsWidth+"px"}}]},Re={display:"inline-block",boxSizing:"border-box"},Se=function(s,u){var n=u.instance;return[s,{style:{display:"flex",width:n.totalColumnsWidth+"px"}}]},Ve=function(s){s.getRowProps.push(Se),s.getHeaderGroupProps.push(Se),s.getFooterGroupProps.push(Se),s.getHeaderProps.push(function(u,n){var x=n.column;return[u,{style:l({},Re,{width:x.totalWidth+"px"})}]}),s.getCellProps.push(function(u,n){var x=n.cell;return[u,{style:l({},Re,{width:x.column.totalWidth+"px"})}]}),s.getFooterProps.push(function(u,n){var x=n.column;return[u,{style:l({},Re,{width:x.totalWidth+"px"})}]})};Ve.pluginName="useBlockLayout";function st(r){r.getTableProps.push(Oe),r.getRowProps.push(ve),r.getHeaderGroupProps.push(ve),r.getFooterGroupProps.push(ve),r.getHeaderProps.push(tt),r.getCellProps.push(Ge),r.getFooterProps.push(Xe)}st.pluginName="useFlexLayout";var Oe=function(s,u){var n=u.instance;return[s,{style:{minWidth:n.totalColumnsMinWidth+"px"}}]},ve=function(s,u){var n=u.instance;return[s,{style:{display:"flex",flex:"1 0 auto",minWidth:n.totalColumnsMinWidth+"px"}}]},tt=function(s,u){var n=u.column;return[s,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]},Ge=function(s,u){var n=u.cell;return[s,{style:{boxSizing:"border-box",flex:n.column.totalFlexWidth+" 0 auto",minWidth:n.column.totalMinWidth+"px",width:n.column.totalWidth+"px"}}]},Xe=function(s,u){var n=u.column;return[s,{style:{boxSizing:"border-box",flex:n.totalFlexWidth?n.totalFlexWidth+" 0 auto":void 0,minWidth:n.totalMinWidth+"px",width:n.totalWidth+"px"}}]};g.columnStartResizing="columnStartResizing",g.columnResizing="columnResizing",g.columnDoneResizing="columnDoneResizing",g.resetResize="resetResize";function gt(r){r.stateReducers.push(Qe),r.getTableProps.push(Ye),r.getHeaderProps.push(Ze),r.getRowProps.push(wt)}gt.pluginName="useGridLayout";var Ye=function(s,u){var n=u.instance,x=n.visibleColumns.map(function(b){var m;return n.state.gridLayout.columnWidths[b.id]?n.state.gridLayout.columnWidths[b.id]+"px":(m=n.state.columnResizing)!=null&&m.isResizingColumn?n.state.gridLayout.startWidths[b.id]+"px":typeof b.width=="number"?b.width+"px":b.width});return[s,{style:{display:"grid",gridTemplateColumns:x.join(" ")}}]},Ze=function(s,u){var n=u.column;return[s,{id:"header-cell-"+n.id,style:{position:"sticky",gridColumn:"span "+n.totalVisibleHeaderCount}}]},wt=function(s,u){var n=u.row;return n.isExpanded?[s,{style:{gridColumn:"1 / "+(n.cells.length+1)}}]:[s,{}]};function Qe(r,s,u,n){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=bt(x);if(m!==void 0){var E=n.visibleColumns.reduce(function(Ne,we){var Ae;return l({},Ne,(Ae={},Ae[we.id]=bt(we.id),Ae))},{}),F=n.visibleColumns.reduce(function(Ne,we){var Ae;return l({},Ne,(Ae={},Ae[we.id]=we.minWidth,Ae))},{}),K=n.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,bt(we)]});return l({},r,{gridLayout:l({},r.gridLayout,{startWidths:E,minWidths:F,maxWidths:K,headerIdGridWidths:te,columnWidth:m})})}else return r}if(s.type===g.columnResizing){var _e=s.clientX,oe=r.columnResizing.startX,xe=r.gridLayout,be=xe.columnWidth,ne=xe.minWidths,Be=xe.maxWidths,ze=xe.headerIdGridWidths,Ke=ze===void 0?[]:ze,Ee=_e-oe,rt=Ee/be,ct={};return Ke.forEach(function(Ne){var we=Ne[0],Ae=Ne[1];ct[we]=Math.min(Math.max(ne[we],Ae+Ae*rt),Be[we])}),l({},r,{gridLayout:l({},r.gridLayout,{columnWidths:l({},r.gridLayout.columnWidths,{},ct)})})}if(s.type===g.columnDoneResizing)return l({},r,{gridLayout:l({},r.gridLayout,{startWidths:{},minWidths:{},maxWidths:{}})})}function bt(r){var s,u=(s=document.getElementById("header-cell-"+r))==null?void 0:s.offsetWidth;if(u!==void 0)return u}c._UNSTABLE_usePivotColumns=ys,c.actions=g,c.defaultColumn=V,c.defaultGroupByFn=cs,c.defaultOrderByFn=Mr,c.defaultRenderer=k,c.emptyRenderer=L,c.ensurePluginOrder=ee,c.flexRender=O,c.functionalUpdate=H,c.loopHooks=j,c.makePropGetter=P,c.makeRenderer=q,c.reduceHooks=I,c.safeUseLayoutEffect=W,c.useAbsoluteLayout=se,c.useAsyncDebounce=ue,c.useBlockLayout=Ve,c.useColumnOrder=f,c.useExpanded=ut,c.useFilters=rs,c.useFlexLayout=st,c.useGetLatest=G,c.useGlobalFilter=ss,c.useGridLayout=gt,c.useGroupBy=Gr,c.useMountedLayoutEffect=J,c.usePagination=gs,c.useResizeColumns=C,c.useRowSelect=Vr,c.useRowState=Ss,c.useSortBy=ps,c.useTable=xr,Object.defineProperty(c,"__esModule",{value:!0})})}(Zr,Zr.exports)),Zr.exports}var Vl;function ta(){return Vl||(Vl=1,process.env.NODE_ENV==="production"?Is.exports=Jn():Is.exports=ea()),Is.exports}var Qr=ta();const ra=({inputvalue:i="",options:d=[],isDisabled:c=!1,currRowData:a={},onlyDropdownItemsAllowed:y,handleValueChange:R,rowId:l="",setTableData:A,handleRightSegment:S})=>{const h=v.useRef(null),[z,g]=v.useState(a?.original?.service_name||""),[k,L]=v.useState(!1),[V,D]=v.useState([]),[N,P]=v.useState(!1),I=v.useCallback(G=>{h.current&&!h.current.contains(G.target)&&(N&&y&&g(""),L(!1))},[y,N]);v.useEffect(()=>{g(i)},[i]);const j=G=>{if(P(!0),L(!0),d?.length>0){const J=d.filter(ue=>ue.service_name.toLowerCase().includes(G.target.value.toLowerCase())).sort((ue,q)=>{const O=G.target.value.toLowerCase(),de=ue.service_name.toLowerCase().startsWith(O),je=q.service_name.toLowerCase().startsWith(O);return de&&!je?-1:!de&&je?1:ue.service_name.localeCompare(q.service_name)});D(J)}g(G.target.value)},ee=G=>{P(!1),g(G.service_name),A(W=>W.map((J,ue)=>l===ue.toString()?{...J,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}:J)),L(!1)},H=G=>{switch(G){case Pt[0]:return"hx_service-appointment-filled hfl-text-Primary-500";case Pt[1]:return"hx_service-other-filled hfl-text-Pink-500";case Pt[2]:return"hx_service-lab-filled hfl-text-Purple-600";default:return"hx_service-other-filled hfl-text-Pink-500"}};return v.useEffect(()=>{a?.original?.service_name&&g(a.original.service_name)},[a?.original?.service_name]),v.useEffect(()=>(document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)),[I]),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:`${a?.original?.service_category?H(a.original.service_category):""} -hfl-ml-1 hfl-text-2`}),e.jsxRuntimeExports.jsx("input",{type:"text",className:`hfl-flex-1 focus-visible:hfl-outline-0 ${a?.original?.order_item_id?"hfl-bg-Gray-50 hfl-caret-Gray-50":""}`,value:z,onChange:G=>{a?.original?.order_item_id||(j(G),R(G,"service_name",l))},onFocus:()=>{a?.original?.order_item_id||(L(!0),D(d))},placeholder:c?"":"Add Service",onBlur:()=>L(!1),"data-qa":"add-service"}),e.jsxRuntimeExports.jsx("i",{className:`hfl-duration-300 hfl-ease-linear ${!c&&(k?"hx_down hfl-rotate-180 hfl-text-3":"hx_down hfl-text-3")} ${a?.original?.order_item_id?"hfl-hidden":""}`,onClick:()=>{a?.original?.order_item_id||(L(!0),D(d))}})]})})}),k&&!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:V.map((G,W)=>e.jsxRuntimeExports.jsx(e.ks,{label:G.service_name,value:G.service_name,onSelect:()=>{ee(G);const J=G.service_category.toLowerCase();J===Pt[0].toLowerCase()?S(ft[2]):J===Pt[1].toLowerCase()?S(ft[4]):J===Pt[2].toLowerCase()?S(ft[3]):S(ft[0])},className:"hfl-p-2"},W))})]})},Ol=i=>{if(!v.useContext(It))throw new Error("AddBillsTable must be used within an PatientPopupContext.Provider");const{patientIDs:c,serviceListArr:a,showToast:y,billPreferences:R,formattedService:l,docPreference:A,getAndSetServiceListArr:S,variable:h}=v.useContext(It),{isDisabled:z=!1,addBillButton:g,tableBodyData:k,handleEditRow:L,handleRightSegment:V,tableData:D,setTableData:N,setEditRowId:P,getBillSummarydata:I,refreshBillsList:j}=i,ee=v.useMemo(()=>D.length>=0&&!z?D.map(M=>({...M,order_item_service_tax:Math.floor(M?.order_item_service_tax),deleted:!1})):[],[D]),H=()=>{N(M=>[...M,{index:"",order_id:"",order_date:"",order_created_on:Ie.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(()=>{k?.length>0&&!z&&N(k)},[k]);const G=(M,Ce,Me)=>{const{value:Le}=M.target;N(ht=>ht.map((dt,nt)=>Me==nt?{...dt,[Ce]:Le}:dt))},W=M=>{P(M.id),L(M)},J=(M,Ce,Me,Le,ht)=>{let dt,nt;if(M>0&&Ce>0&&Le>=0){const ke=M*Ce;return dt=ke+ke*.01*Le,nt=dt-Me,Math.floor(nt)}else return nt=0},ue=async(M,Ce)=>{if(parseInt(M?.original?.balance_amount)>=parseInt(M?.original?.net_amount))try{const Me=await Yl(M.original.order_id,M.original.order_item_id,c.patientRoleID,"","0",h);Me&&(await I(),N(Le=>{const ht=[...Le];return ht.splice(Ce,1),ht?.length===0&&H(),ht}),await j()),y?.(Me.status?"Success":"Error",Me.message,Me.status?"Success":"Error",3e3)}catch(Me){console.log("Error while deleting row",Me)}},q=v.useMemo(()=>[{Header:"#",accessor:"index",Cell:({row:M})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[20px] hfl-items-center hfl-justify-center focus:hfl-outline-none",children:M?.index+1})},{Header:"Service Name",accessor:"service_name",Cell:({row:M})=>e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-w-[310px] hfl-items-start",onClick:async()=>{a?.service_list?.length||await S(),W(M)},children:e.jsxRuntimeExports.jsx(ra,{inputvalue:M?.original?.service_name,onlyDropdownItemsAllowed:!0,currRowData:M,rowId:M.id,options:a?.service_list,isDisabled:z,handleValueChange:G,setTableData:N,handleRightSegment:V})})},{Header:"Qty",accessor:"item_quantity",Cell:({row:M})=>e.jsxRuntimeExports.jsx("input",{type:"number",min:1,className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:M?.original?.item_quantity,onFocus:()=>{W(M)},onChange:Ce=>G(Ce,"item_quantity",M.id)})},{Header:"Unit Price",accessor:"order_unit_item_price",Cell:({row:M})=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center hfl-justify-center",children:[e.jsxRuntimeExports.jsx("i",{className:" hx_f-rupee"}),A?.permissions?.edit_service_unit_price?e.jsxRuntimeExports.jsx("input",{type:"number",min:0,onFocus:()=>{W(M)},className:" hfl-flex hfl-w-[64px] hfl-items-center focus:hfl-outline-none",value:M?.original?.order_unit_item_price,onChange:Ce=>G(Ce,"order_unit_item_price",M.id)}):e.jsxRuntimeExports.jsx("input",{onFocus:()=>{W(M)},className:" hfl-flex hfl-w-[64px] hfl-items-center focus:hfl-outline-none",value:M?.original?.order_unit_item_price,readOnly:!0})]})},{Header:"GST %",accessor:"order_item_service_tax_percentage",Cell:({row:M})=>e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:l?.[+M?.original?.service_id]?.service_tax||0,readOnly:!0})},{Header:"Discount",accessor:"order_item_discount",Cell:({row:M})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:R?.billing?.enable_order_discount==1?e.jsxRuntimeExports.jsx("input",{type:"number",min:0,onFocus:()=>{W(M)},className:"hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:M?.original?.order_item_discount,onChange:Ce=>G(Ce,"order_item_discount",M.id)}):e.jsxRuntimeExports.jsx("input",{className:"hfl-pointer-events-none hfl-flex hfl-w-[74px] hfl-items-center focus:hfl-outline-none",value:M?.original?.order_item_discount,readOnly:!0,type:"text"})})},{Header:"Total Price",accessor:"order_item_price",Cell:({row:M})=>e.jsxRuntimeExports.jsxs("div",{className:`${M.original.order_paid_amount===void 0||M.original.refund_amount===void 0||M.original.balance_amount===void 0||parseInt(M.original.order_paid_amount)-parseInt(M.original.refund_amount)===0?"hfl-text-Error-500":parseInt(M.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:J(Number(M?.original?.order_unit_item_price),Number(M?.original?.item_quantity),Number(M?.original?.order_item_discount),Number(l?.[+M?.original?.service_id]?.service_tax||0)),readOnly:!0})]})},{Header:"",accessor:"deleted",Cell:({row:M})=>e.jsxRuntimeExports.jsx(e.Nu,{variant:"Left",text:parseInt(M?.original?.balance_amount)>=parseInt(M?.original?.net_amount)?"Delete row":"Please Delete from Bill tab",theme:"light",children:e.jsxRuntimeExports.jsx("i",{className:` ${z?"hx_delete hfl-text-White":"hx_delete"} ${parseInt(M?.original?.balance_amount)>=parseInt(M?.original?.net_amount)?"":" hfl-cursor-not-allowed hfl-opacity-20"} `,onClick:Ce=>{Ce.stopPropagation(),V(),ue(M,M.id)}})})}],[R,A,a?.service_list]),O=v.useMemo(()=>z?k:ee,[ee,k]),{getTableProps:de,getTableBodyProps:je,headerGroups:ce,rows:Fe,prepareRow:ae}=Qr.useTable({columns:q,data:O}),Y=M=>{const Ce=[];return M?.headers?.length&&M.headers.map(Me=>{Ce.push(e.jsxRuntimeExports.jsx("th",{...Me.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:Me.render("Header")})}))}),Ce},fe=()=>{const M=[];return Fe.map((Ce,Me)=>{ae(Ce),M.push(e.jsxRuntimeExports.jsx("tr",{id:Me+1+"",...Ce.getRowProps(),className:" hfl-group hfl-h-9 hfl-w-full hfl-border-t-1 hfl-border-Gray-200",onClick:()=>{W(Ce)},children:Ce.cells.map((Le,ht)=>e.jsxRuntimeExports.jsx("td",{"data-qa":Me+1+"-"+Le.column.id,...Le.getCellProps(),className:`hfl-relative hfl-border-1 hfl-border-Gray-200 hfl-px-2 hfl-text-left ${ht==1&&Ce?.original?.order_item_id?"hfl-bg-Gray-50":""} `,onClick:dt=>{ht===6?(dt.stopPropagation(),V()):W(Ce)},children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"",children:Le.render("Cell")})}))}))}),M};return v.useEffect(()=>{g&&D[D.length-1]?.order_item_id&&H()},[D,k]),e.jsxRuntimeExports.jsx("div",{className:`${z?" hfl-pointer-events-none":"hfl-cursor-pointer"}`,children:e.jsxRuntimeExports.jsxs("table",{...de(),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:ce.map(M=>e.jsxRuntimeExports.jsx("tr",{...M.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50",children:Y(M)}))}),e.jsxRuntimeExports.jsx("tbody",{...je(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:fe()})]})})},sa=()=>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"})]}),la=i=>{const{className:d,children:c,tab:a}=i,y=Rl.useMediaQuery("(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]":a==="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 "})]})},Sl=i=>{const{children:d,className:c,tab:a}=i,y=Rl.useMediaQuery("(max-width: 1080px)");return e.jsxRuntimeExports.jsx("div",{className:` ${y?"":a==="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})},Nl=i=>{const{rightSegment:d,summaryData:c,pastDueData:a,showDeposit:y=!1,showPayment:R=!0,showDiscount:l=!0,showRefund:A=!0,showDepositRefund:S=!1,isPayDue:h,getBillSummarydata:z,getPastDueAmount:g,handleRightSegment:k,serviceItem:L,date:V,refreshBillsList:D,deleteLastPaymemntMode:N=!1,setDeleteLastPaymentMode:P=()=>{},walletBalance:I=0,setRefreshWallet:j}=i,ee=()=>{if(y)return"deposit";if(R)return"payment";if(l)return"discount";if(A)return"refund";if(S)return"deposit_refund"},{patientIDs:H,showToast:G,billPreferences:W,getLastBillsPaymentData:J,variable:ue}=v.useContext(It)||{},[q,O]=v.useState(ee()),[de,je]=v.useState([]),[ce,Fe]=v.useState([{id:1,item_level:"0",bill_level:"0"}]),[ae,Y]=v.useState([{id:1,label:"CASH",value:"0",detail:""}]),[fe,M]=v.useState(!1),Ce={color:"#98A2B3",fontFamily:"Inter",fontSize:"14px",fontWeight:400,lineHeight:"18px"},[Me,Le]=v.useState(""),[ht,dt]=v.useState(""),nt=v.useCallback((re,X)=>{if(P(!1),re==="payment"||re==="deposit"){const Z=[...de];Z.splice(X,1),je(Z)}else if(re==="discount"){const Z=[...ce];Z.splice(X,1),Fe(Z)}else if(re==="refund"){const Z=[...ae];Z.splice(X,1),Y(Z)}},[ce,de,ae,P]);v.useEffect(()=>{N&&nt("payment",1)},[N,nt]),v.useEffect(()=>{if(W){const re=ur[W.billing?.default_payment_mode||0]||"CASH";je(X=>[{...X[0],label:re},...X.slice(1)]),Y(X=>[{...X[0],label:re},...X.slice(1)])}},[W]);const[ke,pt]=v.useState(!0),Ct=()=>{pt(re=>!re)},xt=[{key:"deposit",label:"Add Deposit"},{key:"payment",label:"Pay Bill"},{key:"discount",label:"Discount"},{key:"refund",label:"Refund"},{key:"deposit_refund",label:"Refund"}].filter(re=>re.key==="payment"?R:re.key==="discount"?l:re.key==="refund"?A:re.key==="deposit"?y:re.key==="deposit_refund"?S:!0),Nt=re=>{O(re)},Bt=re=>{const X=(re==="payment"?de.length:re==="discount"?ce.length:ae.length)+1;re==="payment"&&R&&de.length<2?je([...de,{id:X,label:ur[W?.billing?.default_payment_mode||0]||"CASH",value:"0",detail:""}]):re==="discount"&&l?Fe([...ce,{id:X,item_level:"0",bill_level:"0"}]):re==="refund"&&A&&ae.length<2?Y([...ae,{id:X,label:"CASH",value:"0",detail:""}]):re==="deposit"&&y&&de.length<2?je([...de,{id:X,label:ur[W?.billing?.default_payment_mode||0]||"CASH",value:"0",detail:""}]):re==="deposit_refund"&&S&&ae.length<2&&Y([...ae,{id:X,label:"CASH",value:"0",detail:""}])},T=v.useMemo(()=>{let re=[];c?.bill_summary?re=Object.entries(c?.bill_summary).map(([Te,Pe])=>({order_id:Pe?.order_id,amount:Number(Pe?.balance_amount),order_date:Ie.dayjs(V).format("YYYY-MM-DD"),service_category_id:Number(Te)})).filter(Te=>Te.amount!==0):c?.balance_amount&&re.push({amount:parseInt(c?.balance_amount)});const X=h?(a?.bill_amount_details??[]).map(Te=>({...Te,amount:Number(Te.balance_amount)||0})):[];return[...re,...X].reduce((Te,Pe)=>Te+Pe.amount,0)},[c,h,a?.bill_amount_details,V]),De=v.useCallback(()=>I<=T?I:T,[T,I]);v.useEffect(()=>{const re=De();q!=="deposit"&&q!=="deposit_refund"&&je(X=>{if(!X[0])return X;const Z=(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(a?.total_amount||"0")||0)||parseInt(c?.balance_amount||"0")||0,ie=X[0].label==="DEPOSIT"?Math.min(Z,re):Z;return[{...X[0],value:`${ie}`},...X.slice(1)]}),L&&Fe(X=>[{...X[0],item_level:c?.order_item_sum_discount||"0",bill_level:c?.order_discount||"0"},...X.slice(1)])},[c,de.length,h,De,q,L,a?.total_amount]);const Ue=(re=!0,X,Z,ie="")=>{const Te=de.findIndex((vt,Wt)=>Wt!==Z),Pe=typeof X=="string"&&X?.trim()===""?0:parseInt(X)||0,mt=De(),Jt=de.some((vt,Wt)=>vt.label==="DEPOSIT"&&Wt!==Z);if(Pe>=0){const vt=T-Pe;return de.map((Gt,er)=>{if(er===Z){const tr=ie||Gt.label;return tr==="DEPOSIT"?Jt?Gt:(Pe>mt?Le("The amount entered is greater than deposit amount "):Le(""),{...Gt,label:tr,value:Pe.toString()}):{...Gt,label:tr,value:Pe.toString()}}else return er===Te?Gt.label==="DEPOSIT"&&vt>mt?{...Gt,value:mt.toString()}:{...Gt,value:re?vt.toString():Gt.value}:Gt})}return de};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:xt.map((re,X)=>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 ${q===re.key?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>Nt(re.key),children:re.label},X))}),(q==="payment"||q==="deposit")&&(R||y)&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[de.map((re,X)=>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:(q!=="deposit"?qr:Ds).find(Z=>Z===re.label)||""},onChange:Z=>{const ie=Ue(d===ft[0],Z.label=="DEPOSIT"?De().toString():de[X].value,X,Z.label);je(ie)},options:q!=="deposit"?qr.map(Z=>({label:Z,value:Z})):Ds.map(Z=>({label:Z,value:Z}))}),e.jsxRuntimeExports.jsx(e.Ps,{className:`hfl-w-[85px] ${Me&&de[X].label==="DEPOSIT"?"hfl-border-Error-600":""}`,inputProps:{type:"number",min:0,value:re.value,onChange:Z=>{if(d===ft[0]){const ie=Ue(!0,Z.target.value,X);je(ie)}else{const ie=de[X].label==="DEPOSIT",Te=[...de.slice(0,X),{...de[X],value:Math.abs(+Z.target.value).toString()},...de.slice(X+1)];ie&&parseInt(Z.target.value)>I?Le("The amount entered is greater than deposit amount"):Le(""),je(Te)}}}}),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 ${de.length===1?"hfl-cursor-not-allowed":""}`,onClick:()=>nt("payment",X),disabled:de.length===1,textField:""})]},X),Me&&de[X].label==="DEPOSIT"&&e.jsxRuntimeExports.jsx(e.bs,{className:"hfl-mt-1 hfl-text-Error-600",variant:"Regular",type:"Text xs",children:Me}),e.jsxRuntimeExports.jsx(e.Ps,{className:" hfl-mt-2",placeholderStyle:Ce,inputProps:{type:"text",value:re.detail,placeholder:"Add Details",onChange:Z=>{const ie=[...de.slice(0,X),{...de[X],detail:Z.target.value},...de.slice(X+1)];je(ie)}}})]})),de?.length&&de?.length<2&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-cursor-pointer hfl-items-center hfl-text-Primary-600",onClick:()=>Bt(q),"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 ₹ ${de.reduce((re,X)=>re+parseFloat(X.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===ft[0]){const re=Object.entries(c?.bill_summary).map(([Pe,mt])=>({order_id:mt?.order_id,amount:Number(mt?.balance_amount),order_date:Ie.dayjs(V).format("YYYY-MM-DD"),service_category_id:+Pe})).filter(Pe=>Pe.amount!==0),X=h?a?.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})):[],Z=[...re,...X],ie=Z.reduce((Pe,mt)=>Pe+parseFloat(mt.amount||"0"),0),Te=de.reduce((Pe,mt)=>Pe+parseFloat(mt.value||"0"),0);if(Te===ie)if(Te===0)G("Error","Please enter some amount","Error",3e3);else{M(!0);const Pe=await En(Te,Z,de.map(mt=>({amount:parseInt(mt.value),mode:ur[mt.label],details:mt.detail})),H?.patientRoleID||"",ue);Pe?(nt("payment",1),G("Success",Pe?.message,"Success",3e3),j?.(mt=>!mt),z?.(),D?.(V),g?.(),await J(H?.patientRoleID||""),k(),M(!1)):(M(!1),G("Error","Something went wrong please try again","Error",3e3))}else G("Error",Te>ie?"Payment cannot be more than the balance amount":"Please do a full payment","Error",3e3)}else{let re;const X=de?.reduce((Z,ie)=>{const Te=parseInt(ie.value)||0;return Z+Te},0);try{X&&X<=0?G("Error","Please enter valid amount","Error",3e3):q=="deposit"?(re=await Fl(H?.patientRoleID||"",{payment_type:"CREDIT",transaction_type:"DEPOSIT",split_payment:de.map(Z=>({amount:parseInt(Z.value),mode:Ur[Z.label],details:Z.detail}))},ue),re.status&&j?.(Z=>!Z)):(M(!0),re=await ml("DEPOSIT",X.toString(),c?.order_id,de.map(Z=>({amount:parseInt(Z.value),mode:Ur[Z.label],details:Z.detail})),H?.patientRoleID||"",{},ue),re&&j?.(Z=>!Z))}catch(Z){M(!1),G("Error",Z.data.message,"Error",3e3)}re&&(nt("payment",1),G("Success",re?.message,"Success",3e3),z?.(),D?.(V),g?.(),await J(H?.patientRoleID||""),k(),M(!1))}}})]}),q==="discount"&&l&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[ce.map((re,X)=>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:re.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:re.bill_level,onChange:Z=>{const ie=[...ce.slice(0,X),{...ce[X],bill_level:Z.target.value},...ce.slice(X+1)];Fe(ie)}}})]})]},X)),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()=>{M(!0);let re,X=0;try{X=parseInt(ce[0].bill_level)+parseInt(ce[0].item_level),X>0?re=await ml("DISCOUNT",ce[0].bill_level+parseInt(ce[0].item_level),c?.order_id,[],H?.patientRoleID||"",{},ue):(M(!1),G("Error","Invalid input","Error",3e3))}catch(Z){M(!1),console.error("Error in updateBill",Z)}re&&(G("Success",re?.message,"Success",3e3),z?.(),D?.(V),g?.(),k(),M(!1))}})]}),q==="refund"&&A&&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:ke,text:"Refund amount as Discount",onClick:Ct}),ae.map((re,X)=>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:qr.find(Z=>Z==re.label)},onChange:Z=>{const ie=[...ae.slice(0,X),{...ae[X],label:Z.label},...ae.slice(X+1)];Y(ie)},options:qr.map(Z=>({label:Z,value:Z}))}),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-w-[85px]",inputProps:{type:"number",min:0,value:re.value,onChange:Z=>{const ie=[...ae.slice(0,X),{...ae[X],value:Z.target.value},...ae.slice(X+1)];Y(ie)}}}),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 ${ae.length===1?"hfl-cursor-not-allowed":""}`,onClick:()=>nt("refund",X),disabled:ae.length===1,textField:""})]},X),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-mt-2",placeholderStyle:Ce,inputProps:{type:"text",value:re.detail,placeholder:"Add Details",onChange:Z=>{const ie=[...ae.slice(0,X),{...ae[X],detail:Z.target.value},...ae.slice(X+1)];Y(ie)}}})]})),ae.length<2&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-cursor-pointer hfl-items-center hfl-text-Primary-600 ",onClick:()=>Bt("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 re,X=0;try{X=ae.reduce((Z,ie)=>{const Te=parseInt(ie.value)||0;return Z+Te},0),X<=0?G("Error","Please enter valid amount","Error",3e3):(M(!0),re=await ml("REFUND",X.toString(),c?.order_id,ae.map(Z=>({amount:parseInt(Z.value),mode:Ur[Z.label],details:Z.detail})),H?.patientRoleID||"",{give_discount:ke,existing_discount:parseInt(c.order_discount)+parseInt(c.order_item_sum_discount)},ue),re&&(j?.(Z=>!Z),M(!1),await J?.(H?.patientRoleID||"")))}catch(Z){console.error("Error in update refund",Z),M(!1)}re&&(G("Success",re?.message,"Success",3e3),z?.(),D?.(V),g?.(),k(),M(!1))}})]}),q==="deposit_refund"&&S&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-gap-2 hfl-p-2",children:[ae.map((re,X)=>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:Ds.find(Z=>Z==re.label)},onChange:Z=>{const ie=[...ae.slice(0,X),{...ae[X],label:Z.label},...ae.slice(X+1)];Y(ie)},options:Ds.map(Z=>({label:Z,value:Z}))}),e.jsxRuntimeExports.jsx(e.Ps,{className:`hfl-w-[85px] ${ht?"hfl-border-Error-600":""}`,inputProps:{type:"number",min:0,value:re.value,onChange:Z=>{const ie=[...ae.slice(0,X),{...ae[X],value:Math.abs(+Z.target.value).toString()},...ae.slice(X+1)];parseInt(Z.target.value)>I?dt("The amount entered is greater than deposit amount"):dt(""),Y(ie)}}}),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 ${ae.length===1?"hfl-cursor-not-allowed":""}`,onClick:()=>nt("refund",X),disabled:ae.length===1,textField:""})]},X),e.jsxRuntimeExports.jsx(e.Ps,{className:"hfl-mt-2",placeholderStyle:Ce,inputProps:{type:"text",value:re.detail,placeholder:"Add Details",onChange:Z=>{const ie=[...ae.slice(0,X),{...ae[X],detail:Z.target.value},...ae.slice(X+1)];Y(ie)}}}),ht&&e.jsxRuntimeExports.jsx(e.bs,{className:"hfl-mt-1 hfl-text-Error-600",variant:"Regular",type:"Text xs",children:ht})]})),ae.length<2&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-inline-flex hfl-cursor-pointer hfl-items-center hfl-text-Primary-600 ",onClick:()=>Bt("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 ${ht?"hfl-cursor-not-allowed hfl-opacity-50":""}`,disabled:!!ht.length,onClick:async()=>{let re=0;try{re=ae.reduce((X,Z)=>{const ie=parseInt(Z.value)||0;return X+ie},0),re<=0?G("Error","Please enter valid amount","Error",3e3):(await Fl(H?.patientRoleID||"",{payment_type:"DEBIT",transaction_type:"REFUND",split_payment:ae.map(Z=>({amount:parseInt(Z.value),mode:Ur[Z.label],details:Z.detail}))},ue))?.status&&j?.(Z=>!Z)}catch(X){console.error(X)}}})]})]})},na=i=>{const{date:d,rightSegment:c,handleRightSegment:a,billSummaryClicked:y,showDiscount:R=!1,showRefund:l=!1,handleServiceItem:A,pastDueData:S,summaryData:h,getBillSummarydata:z,getPastDueAmount:g,refreshBillsList:k,walletBalance:L=0,setRefreshWallet:V}=i,[D,N]=v.useState(!1),[P,I]=v.useState(!1),j=()=>{I(!0),N(!0)},ee=()=>{I(!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:()=>{A(Pt[0]),a(ft[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:()=>{A(Pt[1]),a(ft[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:()=>{A(Pt[2]),a(ft[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((H,G)=>H+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(H=>e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-justify-between",children:[e.jsxRuntimeExports.jsxs("div",{children:[H==="1"&&"Consultations",H==="2"&&"Lab Services",H==="3"&&"Other Services"]}),"₹ ",h.bill_summary[H]?.order_discount||"0"]},H))})]}),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:()=>ee()})]}),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(Nl,{isPayDue:D,rightSegment:c,pastDueData:S,showDiscount:R,showRefund:l,summaryData:h,date:d,getBillSummarydata:z,handleRightSegment:a,getPastDueAmount:g,refreshBillsList:k,deleteLastPaymemntMode:P,setDeleteLastPaymentMode:I,walletBalance:L,setRefreshWallet:V})]}),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"})]})]})},aa=i=>{const{editedTableData:d,handleRightSegment:c,getBillSummarydata:a,order_date:y,editRowId:R,setTableData:l,refreshBillsList:A,handleRevertEdit:S}=i,{patientIDs:h,showToast:z,doctorListArr:g,billPreferences:k,formattedService:L,ppEventProps:V,variable:D}=v.useContext(It),[N,P]=v.useState(),I={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,ee]=v.useState(()=>({...d,...I})),H=(J,ue)=>{let q={};J==="labowner"?q={lab_owner_name:ue.labOwnerName,lab_owner_id:ue.LabOwnerDocRoleID||""}:q={doctor_name:ue.docName,referrer_doctor_role_id:ue.docRoleID},ee(O=>({...O,bill_item_details:{...O.bill_item_details,...q}}))},G=async(J="")=>{try{const ue=await Pn(J,D);P(ue)}catch(ue){console.error("Error in getReferalDoctorList API Call:",ue)}};v.useEffect(()=>{G()},[]);const W=async()=>{if(d?.order_item_id)try{const J=await wl(d?.order_item_id,h.patientRoleID,D);ee(ue=>{const q=J.data;return{...ue,...rn,...q,service_category:Pt[2],service_category_id:"3",order_item_service_tax_percentage:L?.[+q.service_id]?.service_tax||0,bill_item_details:{...ue.bill_item_details,...q.bill_item_details,appnt_doctor_role_id:"",referrer_doctor_role_id:""}}})}catch(J){console.error("Error fetching bill item data:",J)}};return v.useEffect(()=>{d&&ee({...j,...d})},[d]),v.useEffect(()=>{W()},[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:[k?.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(J=>({label:J.doctor_name,value:J.doctor_name,appnt_doctor_role_id:J.doctor_identifier})),handleSuffixValChange:J=>{H("",{docName:J,docRoleID:""})},onSuffixDropdownClick:J=>{H("",{docName:J.label,docRoleID:J.appnt_doctor_role_id})}})}),k?.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(J=>({label:J.referralName,value:J.referralName,referralId:J.referralId})),onlySuffixDropdownItemsAllowed:!1,handleSuffixValChange:J=>{G(J),H("labowner",{labOwnerName:J,LabOwnerDocRoleID:""})},onSuffixDropdownClick:J=>{H("labowner",{labOwnerName:J.label,LabOwnerDocRoleID:J.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 J=await Pl(j,z,h.patientRoleID,Ie.dayjs(y).format("YYYY-MM-DD"),V,Pt[2],D);j.bill_item_details.lab_owner_name&&Sn(j.bill_item_details.lab_owner_name,h?.patientRoleID||"",D),J&&(l(ue=>ue.map((q,O)=>R==O.toString()?{...q,order_item_id:J.order_item_id||j.order_item_id}:q)),(J.order_item_id||j.order_item_id)&&(a(),c(),A(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()}})})]})},ia="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",oa=i=>{const{showToast:d,patientIDs:c,doctorListArr:a,patientDetails:y,billPreferences:R,formattedService:l,ppEventProps:A,variable:S}=v.useContext(It),{bill_date:h,handleRightSegment:z,getBillSummarydata:g,editedTableData:k,setTableData:L,editRowId:V,refreshBillsList:D,handleRevertEdit:N,checkAppointmentForBilling:P}=i,[I,j]=v.useState([]),ee=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),H=a?.doctor_list?.length===1?a?.doctor_list[0]:{doctor_name:"",doctor_identifier:""},G={...zl,appnt_doctor_name:window.role_id=="11"?window.doc_name_for_seg:H?.doctor_name,appnt_doctor_role_id:window.role_id=="11"?window.doctor_role_id_for_seg:H?.doctor_identifier,appnt_duration:+R?.print?.bill?.appnt_minute_slab,appnt_time_time:ee?.split(" ")[0]||"",appnt_time_format:ee?.split(" ")[1]||"",total_price:"",appnt_date:Ie.dayjs().format("YYYY-MM-DD"),appnt_service_id:k?.service_id||"",appnt_service_name:k?.service_name||"",...k},[W,J]=v.useState(G),[ue,q]=v.useState(!1),O=async()=>{if(k?.order_item_id)try{const Y=await wl(k.order_item_id,c.patientRoleID,S),{created_on:fe,order_item_service_tax:M,service_id:Ce,bill_item_details:Me,order_item_id:Le,item_quantity:ht,order_unit_item_price:dt,order_item_price:nt,order_item_discount:ke,service_name:pt}=Y.data,{appointment_details:Ct,doctor_name:xt}=Me,{appnt_id:Nt,appnt_date:Bt=Ie.dayjs().format("YYYY-MM-DD"),appnt_time:T,appnt_status:De,appnt_duration:Ue,doctor_role_id:re}=Ct,X=new Date("1970-01-01T"+T+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"}),Z={appnt_time_time:"",appnt_time_format:""};X&&X!=="Invalid Date"&&(Z.appnt_time_time=X?.split(" ")[0],Z.appnt_time_format=X?.split(" ")[1]),J(ie=>({...ie,appnt_id:Nt,patient_role_id:c.patientRoleID,appnt_doctor_role_id:re,appnt_service_id:Ce,appnt_date:Bt,appnt_time:T,appnt_status:De,appnt_duration:Ue,appnt_doctor_name:xt,appnt_service_name:pt,appnt_mode:"inperson",order_item_id:Le,item_quantity:ht,order_unit_item_price:dt,order_item_price:nt,order_item_discount:ke,order_item_service_tax:""+Math.floor(+M),order_item_service_tax_percentage:l[+Ce]?.service_tax||0,total_price:"",appnt_created_on:fe,order_item_created_on:fe,...Z}))}catch(Y){J(G),console.error("Error fetching bill item data:",Y)}};v.useEffect(()=>{k&&J({...W,...k})},[k]),v.useEffect(()=>{O()},[W.order_item_id]);const[de,je]=v.useState(!1),ce=(Y,fe)=>{J(M=>({...M,[Y]:fe}))},Fe=async()=>{try{const Y=await hn(k.service_id,Ie.dayjs(h).format("YYYY-MM-DD"),c.patientRoleID,S);if(Y?.appointments?.length)for(const fe of Y.appointments){const M=new Date("1970-01-01T"+fe.appnt_time+"Z").toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});M&&M!=="Invalid Date"&&(fe.appnt_time_time=M?.split(" ")[0],fe.appnt_time_format=M?.split(" ")[1])}j(Y?.appointments)}catch{console.log("error in getAppointmentsList API Call")}};v.useEffect(()=>{Fe()},[k?.service_id]);const ae=W.appnt_date&&Ie.dayjs(W.appnt_date).format("YYYY-MM-DD")<Ie.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:k?.service_name||"",children:k?.service_name||""}),e.jsxRuntimeExports.jsx("div",{className:"hx_close hfl-flex-shrink-0 hfl-cursor-pointer hfl-text-4",onClick:()=>{z(),N()}})]}),I.length>0&&!de&&e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-flex-col hfl-items-center hfl-gap-2.5 hfl-px-[13px] hfl-py-3",children:[I.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:()=>{je(!0),J(M=>({...M,...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:Ie.dayjs(h).format("YYYY-MM-DD")!==Ie.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:()=>{je(!0),J(G)}})]}),(Ie.dayjs(h).format("YYYY-MM-DD")===Ie.dayjs().format("YYYY-MM-DD")&&I.length==0||de)&&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:W.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 ${ae?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-12",widthSufixDrpdwn:"hfl-w-[250px]",suffixOptions:a?.doctor_list?.map(Y=>({label:Y.doctor_name,value:Y.doctor_name,appnt_doctor_role_id:Y.doctor_identifier})),handleSuffixValChange:Y=>{ce("appnt_doctor_name",Y),ce("appnt_doctor_role_id","")},onSuffixDropdownClick:Y=>{ce("appnt_doctor_name",Y.label),ce("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:[ae?e.jsxRuntimeExports.jsx(e.Ps,{className:"!hfl-h-[40px]",width:"120px",start_icon:"hx_calendar",inputProps:{value:W.appnt_date,disabled:!0}}):e.jsxRuntimeExports.jsx(e.ZC,{placeholder:"Today",width:"120px",height:"!hfl-h-[40px]",selectDate:new Date(Ie.dayjs(W.appnt_date).format("DD-MMM-YYYY")),dateVar:Y=>{ce("appnt_date",Ie.dayjs(Y).format("YYYY-MM-DD"))},isborderRequired:!0,minDate:new Date}),e.jsxRuntimeExports.jsx(e.ej,{className:` hfl-w-20 ${ae?" hfl-pointer-events-none":""}`,suffixClassName:` hfl-w-10 ${ae?" hfl-pointer-events-none":""}`,suffixDropdownClassName:"hfl-ml-[80px]",input1value:W?.appnt_time_time||"",input2value:W?.appnt_time_format||"",end_icon:"hx_down",inputProps:{placeholder:"10:00",onBlur:Y=>{ce("appnt_time_time",Y.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:Y=>{ce("appnt_time_format",Y.value)}})]})]}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ir.find(Y=>Y.value==W.appnt_duration)?.label,value:W.appnt_duration},label:"Duration",className:`hfl-text-Gray-800 ${ae?" hfl-pointer-events-none":""}`,onChange:Y=>{ce("appnt_duration",Y.value)},options:Ir}),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:ue,text:"Partner Enabled",onClick:()=>q(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:()=>{z(),je(!1)}}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Primary",size:"md",textField:W?.appnt_id?.length?"Update":"Create",icon:"No",onClick:async()=>{if(Ie.dayjs(h).format("YYYY-MM-DD")<Ie.dayjs().format("YYYY-MM-DD"))await Pl(W,d,c.patientRoleID,Ie.dayjs(h).format("YYYY-MM-DD"),A,Pt[0],S)&&z();else{const Y=await Kl(W,!1,d,y,c,A,ue,!0,S);Y&&(L(fe=>fe.map((M,Ce)=>V==Ce.toString()?{...M,order_item_id:Y.order_item_id||W.order_item_id}:M)),J(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&&z())}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"})]})]}),Ie.dayjs(h).format("YYYY-MM-DD")!==Ie.dayjs().format("YYYY-MM-DD")&&I.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:ia,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:()=>{de?je(!1):z(),N()}})})]})},ua=i=>{const{handleRightSegment:d,editedTableData:c,getBillSummarydata:a,order_date:y,setTableData:R,editRowId:l,refreshBillsList:A,handleRevertEdit:S}=i,{patientIDs:h,showToast:z,doctorListArr:g,billPreferences:k,formattedService:L,ppEventProps:V,variable:D}=v.useContext(It)||{},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,I]=v.useState({...c,...N}),j=v.useCallback(async()=>{if(c?.order_item_id)try{const H=await wl(c.order_item_id,h?.patientRoleID||"",D);I({...c,...H.data,service_category:Pt[1],service_category_id:"2",order_item_service_tax_percentage:L?.[+H.data.service_id]?.service_tax||0,bill_item_details:{...N.bill_item_details,...H.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(H){console.error("Error fetching bill item data:",H)}},[N.bill_item_details,c,L,h?.patientRoleID,D]);v.useEffect(()=>{c&&I(H=>({...H,...c}))},[c]),v.useEffect(()=>{j()},[j,P.order_item_id]);const ee=H=>{const G={...P,service_category:Pt[1],bill_item_details:{doctor_name:H.docName,appointment_details:null,lab_owner_name:"",lab_owner_id:"",referrer_doctor_role_id:H.docRoleID}};I(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:[k?.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(H=>({label:H.doctor_name,value:H.doctor_name,appnt_doctor_role_id:H.doctor_identifier})),handleSuffixValChange:H=>{ee({docName:H,docRoleID:""})},onSuffixDropdownClick:H=>{ee({docName:H.label,docRoleID:H.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 H=await Pl(P,z,h?.patientRoleID||"",Ie.dayjs(y).format("YYYY-MM-DD"),V,Pt[1],D);H&&(R(G=>G.map((W,J)=>l==J.toString()?{...W,order_item_id:H?.order_item_id||P.order_item_id}:W)),(H?.order_item_id||P.order_item_id)&&(a(),d(),A(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 Bs={exports:{}},ca=Bs.exports,Wl;function da(){return Wl||(Wl=1,function(i,d){(function(c,a){i.exports=a()})(ca,function(){var c="minute",a=/[+-]\d\d(?::?\d\d)?/g,y=/([+-]|\d\d)/g;return function(R,l,A){var S=l.prototype;A.utc=function(D){var N={date:D,utc:!0,args:arguments};return new l(N)},S.utc=function(D){var N=A(this.toDate(),{locale:this.$L,utc:!0});return D?N.add(this.utcOffset(),c):N},S.local=function(){return A(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 z=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 z.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(H){H===void 0&&(H="");var G=H.match(a);if(!G)return null;var W=(""+G[0]).match(y)||["-",0,0],J=W[0],ue=60*+W[1]+ +W[2];return ue===0?0:J==="+"?ue:-ue}(D),D===null))return this;var I=Math.abs(D)<=16?60*D:D;if(I===0)return this.utc(N);var j=this.clone();if(N)return j.$offset=I,j.$u=!1,j;var ee=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(j=this.local().add(I+ee,c)).$offset=I,j.$x.$localOffset=ee,j};var k=S.format;S.format=function(D){var N=D||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return k.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 L=S.toDate;S.toDate=function(D){return D==="s"&&this.$offset?A(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():L.call(this)};var V=S.diff;S.diff=function(D,N,P){if(D&&this.$u===D.$u)return V.call(this,D,N,P);var I=this.local(),j=A(D).local();return V.call(I,j,N,P)}}})}(Bs)),Bs.exports}var fa=da();const Al=e.getDefaultExportFromCjs(fa),Dl=i=>{Ie.dayjs.extend(Al);const{categorySummaryData:d,serviceDetails:c,walletBalance:a,rightSegment:y,serviceItem:R,bill_date:l,handleRightSegment:A,getBillSummarydata:S,getPastDueAmount:h,refreshBillsList:z,closePrintModal:g,setRefreshWallet:k}=i,L=v.useContext(It);if(!L)throw new Error("ServiceLevelBillSummary must be used within an AppContext.Provider");const{patientDetails:V,patientIDs:D,billPreferences:N,setShowPrintModal:P,currentWindow:I,showPrintModal:j,variable:ee}=L,H=()=>{switch(R){case Pt[0]:return"Consultation Bill";case Pt[1]:return"Other Service Bill";case Pt[2]:return"Lab Service Bill";default:return`${R} Bill`}},G=async(W,J,ue)=>{if(j?.visible&&g(),!d)return;const q=await Zl(d.order_id,D?.patientRoleID||"",ee),O=c.map(Le=>({serviceName:Le.service_name,price:+Le.order_unit_item_price,gst:+Le.order_item_service_tax,discount:+Le.order_item_discount,netPrice:+Le.net_amount,itemQty:+Le.item_quantity})),de=+d.order_paid_amount,je=+d.refund_amount,ce=+d.balance_amount,Fe=+d.order_discount,ae=+d.order_item_sum_discount,Y=+d.order_service_tax,fe={paymentStatus:de-je===0?"red":ce===0?"green":"yellow",paymentMode:q?.paymentModes?.length?q.paymentModes.join(", "):"",billedAmount:+d.order_total,discountAmount:Fe+ae,gstAmount:Y,cgstAmount:(Y/2).toFixed(2),sgstAmount:(Y/2).toFixed(2),finalAmount:+d.net_bill_amount,receivedAmount:de,balanceAmount:ce,refundAmount:je},Ce=[V?.age&&typeof V.age=="number"?`${V.age}y`:V?.org_person_dob?hr(V.org_person_dob):"",V?.gender?Jr[V.gender]:"",V?.blood_group].filter(Boolean).join(", "),Me={name:`${nr(V?.name??"")}${Ce?` (${Ce})`:""}`,billDate:Ie.dayjs(d.order_date).format("DD-MMM-YYYY"),mobileNumber:V?.phone_number??"",email:V?.email??"",billNumber:d.order_id_str,patientId:V?.org_person_bid_str??"",patientIdForEmail:D?.patientRoleID??"",billStatus:ce===0?"PAID":"UNPAID",address:[V?.address,V?.city,V?.pincode].filter(Boolean).join(", "),referredBy:q?.lab_owner_name?nr(q.lab_owner_name):V?.ref_doc_name?nr(V.ref_doc_name):"--"};P({printDataFrom:"patient_popup",visible:!0,whichPreview:W,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:J,preferences:{...N?.print?.bill,...N?.org_details},billSummaryDetails:fe,billServiceDetails:O,billPatientDetails:Me,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:d?.order_id}},trackEventHandler:()=>{console.log(ue)}})};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:()=>A(ft[0])}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-flex hfl-items-center",children:[H()," : ",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(Nl,{showDiscount:I!==Rt[4],showRefund:I!==Rt[4],rightSegment:y,summaryData:d,getBillSummarydata:S,handleRightSegment:A,serviceItem:R,getPastDueAmount:h,date:l,refreshBillsList:z,setRefreshWallet:k,walletBalance:a})]}),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"})]})]})},Il=({depositAmount:i,handleRightSegment:d,rightSegment:c,setRefreshWallet:a})=>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(Nl,{rightSegment:c,showDeposit:!0,showPayment:!1,showDiscount:!1,showDepositRefund:!0,showRefund:!1,handleRightSegment:d,walletBalance:i,setRefreshWallet:a})})]}),ha=({closePrintModal:i})=>{if(!v.useContext(It))throw new Error("AddBills component must be used within an PatientPopupContext.Provider");const{patientDetails:d,patientIDs:c,billPreferences:a,setShowPrintModal:y,showPrintModal:R,setLoading:l,showToast:A,variable:S}=v.useContext(It),[h,z]=v.useState(new Date),[g,k]=v.useState(),[L,V]=v.useState(ft[0]),[D,N]=v.useState([]),[P,I]=v.useState([]),[j,ee]=v.useState(""),[H,G]=v.useState(),[W,J]=v.useState(!1),[ue,q]=v.useState(pl),[O,de]=v.useState("-1"),[je,ce]=v.useState({bill_summary:{},status:!1,message:""}),[Fe,ae]=v.useState(!1),[Y,fe]=v.useState(0),M=T=>{ee(T)},Ce=async T=>{l(!0);try{await dt(T),z(T)}catch(De){console.error(De)}l(!1)},Me=async()=>{try{const T=await cn(c.patientRoleID,Ie.dayjs(h).format("YYYY-MM-DD"),S);ce(T)}catch(T){console.error("Error in getBillSummary API Call:",T)}},Le=()=>{q(T=>P.length>+O&&+O>=0?[...T.slice(0,+O),{order_id:P[O].order_id,order_date:P[O].order_date,order_created_on:P[O].order_created_on,service_category:P[O].service_category,service_category_id:P[O].service_category_id,order_id_str:P[O].order_id_str,order_total:P[O].order_total,order_paid_amount:P[O].order_paid_amount,order_item_sum_discount:P[O].order_item_sum_discount,order_discount:P[O].order_discount,refund_amount:P[O].refund_amount,order_service_tax:P[O].order_service_tax,balance_amount:P[O].balance_amount,net_bill_amount:P[O].net_bill_amount,order_item_id:P[O].order_item_id,service_id:P[O]?.service_id,service_name:P[O].service_name,item_quantity:P[O].item_quantity,order_unit_item_price:P[O].order_unit_item_price,order_item_price:P[O].order_item_price,order_item_discount:P[O].order_item_discount,order_item_service_tax:""+Math.floor(P[O].order_item_service_tax),order_item_service_tax_percent:P[O].order_item_service_tax_percent,net_amount:P[O].net_amount,created_on:P[O].created_on},...T.slice(+O+1)]:T)},ht=async()=>{try{const T=await Gs(Ie.dayjs(h).format("YYYY-MM-DD"),c.patientRoleID,1,10,!0,S);J(T?.total_records>0)}catch{console.log("error in checkAppointmentForBilling API Call")}};v.useEffect(()=>{Me(),pt(),window?.partner_service_enabled!=="1"&&ht()},[h]);const dt=async(T=Ie.dayjs().format("YYYY-MM-DD"))=>{l(!0);try{const De=await vl(Ie.dayjs(T).format("YYYY-MM-DD"),c.patientRoleID,1,100,S);k(De),q(pl);const Ue=De?.bill_list.flatMap(re=>{const{order_items:X,...Z}=re;return X.map(ie=>({...Z,...ie})).filter(ie=>Ie.dayjs(ie?.created_on).format("YYYY-MM-DD")===Ie.dayjs(new Date).format("YYYY-MM-DD"))});if(I(Ue),De?.bill_list?.length){const re=De?.bill_list.reduce((X,Z)=>{const ie=Z.order_items.filter(Te=>Ie.dayjs(Te?.created_on).isBefore(Ie.dayjs(new Date).format("YYYY-MM-DD"))).map(Te=>({...Te,service_category:Z.service_category,service_category_id:Z.service_category_id}));return[...X,...ie]},[]);N(re)}else q(pl),N([])}catch{console.log("error in getBillsList API Call")}l(!1)};v.useEffect(()=>{dt()},[]);const nt=async()=>{try{const T=await El(c.patientRoleID,S);fe(T?.wallet_balance||0)}catch(T){console.error("Failed to fetch wallet balance:",T)}};v.useEffect(()=>{nt()},[Fe]);const ke=v.useCallback(async()=>{try{const T=await _l(Ie.dayjs(h).format("YYYY-MM-DD"),c.patientRoleID,!1,S);G(T)}catch(T){console.error("Error in getPastDueAmount API Call:",T)}},[h,_l,c.patientRoleID]);v.useEffect(()=>{ke()},[ke]);const pt=(T=ft[0])=>{V(T)},Ct=T=>{switch(T?.original?.service_category.toLowerCase()){case Pt[0].toLowerCase():pt(ft[2]);break;case Pt[1].toLowerCase():pt(ft[4]);break;case Pt[2].toLowerCase():pt(ft[3]);break;default:pt(ft[0]);break}},xt=(T,De)=>De.reduce((Ue,re)=>Ue+(parseInt(je.bill_summary[re]?.[T]||"0")||0),0),Nt=(T,De)=>De.map(Ue=>je.bill_summary[Ue]?.[T]).filter(Ue=>Ue),Bt=async(T,De,Ue)=>{if(R?.visible&&i(),je?.bill_summary&&Object.keys(je?.bill_summary).length>0){const re=await On(Nt("order_id",T),c?.patientRoleID,S),X=[...new Set(T.map(vt=>re.paymentsData.get(vt)).flat())].map(vt=>ur[vt]??void 0)?.filter(vt=>vt),Z=xt("order_service_tax",T??[1,2,3]),ie={billedAmount:xt("order_total",T??[1,2,3]),gstAmount:Z,cgstAmount:(Z/2).toFixed(2),sgstAmount:(Z/2).toFixed(2),discountAmount:xt("order_item_sum_discount",T??[1,2,3])+xt("order_discount",T??[1,2,3]),finalAmount:xt("net_bill_amount",T??[1,2,3]),receivedAmount:xt("order_paid_amount",T??[1,2,3]),balanceAmount:xt("balance_amount",T??[1,2,3]),refundAmount:xt("refund_amount",T??[1,2,3])},Pe=[...ue,...D].filter(vt=>T.includes(parseInt(vt?.service_category_id))).map(vt=>({serviceName:vt.service_name,price:vt.order_unit_item_price,gst:Math.floor(vt.order_item_service_tax),discount:vt.order_item_discount,netPrice:vt.net_amount,itemQty:vt.item_quantity})),Jt=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?hr(d?.org_person_dob):"",Jr[d?.gender]??"",d?.blood_group].filter(vt=>vt).join(", ");y({printDataFrom:"patient_popup",visible:!0,whichPreview:De,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill",details:{showPrintPreviewForBill:Ue,preferences:{...a?.print?.bill,...a?.org_details,...a?.branch_details},billSummaryDetails:{...ie,paymentStatus:parseInt(ie?.receivedAmount||"0")-parseInt(ie?.refundAmount||"0")===0?"red":parseInt(ie?.balanceAmount||"0")===0?"green":"yellow",paymentMode:X?.join(", ")},billServiceDetails:Pe,billPatientDetails:{name:nr(d?.name)+(Jt?` (${Jt}) `:""),billDate:Ie.dayjs(h).format("DD-MMM-YYYY"),mobileNumber:d?.phone_number,email:d?.email,billNumber:Nt("order_id_str",T)?.toString(),patientId:d?.org_person_bid_str,patientIdForEmail:c.patientRoleID,billStatus:parseInt(ie?.balanceAmount||"0")===0?"PAID":"UNPAID",address:[d?.address??"",d?.city??"",d?.pincode??""].filter(vt=>vt).join(", "),referredBy:re?.lab_owner_name?nr(re?.lab_owner_name):d?.ref_doc_name?nr(d?.ref_doc_name):"--"},isWholeBill:T.length===3,payloadDataforEmail:{orderDate:T.length===3?Ie.dayjs(h).format("YYYY-MM-DD"):"",orderNumber:T.length===3?"":Nt("order_id",T)?.toString()}},trackEventHandler:vt=>{console.log("Bill Print Event",vt)}})}else A("Error","Please add a service to create bill","Error",3e3)};return e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex",children:[e.jsxRuntimeExports.jsx(la,{tab:"add_bills",children:e.jsxRuntimeExports.jsxs("div",{className:`hfl-relative hfl-h-full hfl-overflow-auto ${L===ft[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(Ie.dayjs(h).format("DD-MMM-YYYY")),dateVar:T=>{z(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(ft[7])})]})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"-hfl-gap-[1px] hfl-flex hfl-h-[590px] hfl-flex-col hfl-items-start",children:[e.jsxRuntimeExports.jsx(Ol,{tableBodyData:P,tableData:ue,isDisabled:!1,addBillButton:!0,handleEditRow:Ct,handleRightSegment:pt,setTableData:q,setEditRowId:de,getBillSummarydata:Me,refreshBillsList:dt}),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(Ol,{tableBodyData:D,tableData:D,isDisabled:!0,addBillButton:!1,handleEditRow:Ct,handleRightSegment:pt,setTableData:q,setEditRowId:de,getBillSummarydata:()=>{},refreshBillsList:()=>{}})]})]})]}),e.jsxRuntimeExports.jsx("div",{className:" mt-2 hfl-sticky hfl-bottom-0 hfl-w-full",children:W&&e.jsxRuntimeExports.jsx(sa,{})})]})}),e.jsxRuntimeExports.jsxs(Sl,{tab:"add_bills",children:[L===ft[0]&&e.jsxRuntimeExports.jsx(na,{summaryData:je,date:h,rightSegment:L,handleRightSegment:pt,billSummaryClicked:(T,De,Ue)=>Bt(T,De,Ue),showDiscount:!1,showRefund:!1,handleServiceItem:M,pastDueData:H,getBillSummarydata:Me,refreshBillsList:dt,getPastDueAmount:ke,walletBalance:Y,setRefreshWallet:ae}),L===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{bill_date:h,rightSegment:L,serviceDetails:g?.bill_list.find(T=>T.service_category.toLowerCase()===j.toLowerCase())?.order_items??[],categorySummaryData:je?.bill_summary[`${Pt.indexOf(j)+1}`],serviceItem:j,handleRightSegment:pt,getBillSummarydata:Me,refreshBillsList:dt,getPastDueAmount:ke,walletBalance:Y,setRefreshWallet:ae,closePrintModal:i}),L===ft[2]&&e.jsxRuntimeExports.jsx(oa,{bill_date:h,handleRightSegment:pt,getBillSummarydata:Me,editedTableData:ue?.[O],setTableData:q,editRowId:O,handleRevertEdit:Le,refreshBillsList:dt,checkAppointmentForBilling:ht}),L===ft[4]&&e.jsxRuntimeExports.jsx(ua,{order_date:h,handleRightSegment:pt,getBillSummarydata:Me,editedTableData:ue?.[O],setTableData:q,editRowId:O,refreshBillsList:dt,handleRevertEdit:Le}),L===ft[3]&&e.jsxRuntimeExports.jsx(aa,{order_date:h,handleRightSegment:pt,editedTableData:ue?.[O],getBillSummarydata:Me,setTableData:q,editRowId:O,refreshBillsList:dt,handleRevertEdit:Le}),L===ft[7]&&e.jsxRuntimeExports.jsx(Il,{depositAmount:Y,handleRightSegment:pt,rightSegment:L,setRefreshWallet:ae})]})]})},jl=i=>{const{appointments:d,isDisabled:c,handleAppointData:a,leftNav:y,today:R}=i,l=v.useCallback(N=>{a(N)},[a]),A=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:Ie.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:gl.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:z,headerGroups:g,rows:k,prepareRow:L}=Qr.useTable({columns:A,data:S}),V=N=>{const P=[];return N?.headers?.length&&N.headers.map(I=>{P.push(e.jsxRuntimeExports.jsx("th",{...I.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:I.render("Header")})}))}),P},D=()=>{const N=[];return k.map((P,I)=>{L(P),N.push(e.jsxRuntimeExports.jsx("tr",{"data-qa":I+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":I+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:V(N)}))}),e.jsxRuntimeExports.jsx("tbody",{...z(),className:"hfl-rounded-lg hfl-border-1 hfl-border-Gray-200",children:D()})]})})},es=i=>{const{currentPage:d,totalRecord:c,handleLoadMore:a,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:()=>a(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})})]})},pa=i=>{const{handleAddNewAppnt:d,handleAppointData:c,sortAppointments:a}=i,[y,R]=v.useState(),[l,A]=v.useState(1),[S,h]=v.useState([]),[z,g]=v.useState([]),[k,L]=v.useState(""),{patientIDs:V,setLoading:D,variable:N}=v.useContext(It),P=async I=>{let j=I;if(D(!0),j<=Math.ceil((y?.total_records||0)/10)){if(j=I+1,j!==I){const ee=await Gs("all",V?.patientRoleID||"",j,10,!1,N);h(H=>[...H,...ee.appointments.filter(G=>G.appnt_date>=Ie.dayjs(new Date).format("YYYY-MM-DD"))]),g(H=>[...H,...ee.appointments.filter(G=>G.appnt_date<Ie.dayjs(new Date).format("YYYY-MM-DD"))])}A(j)}D(!1)};return v.useEffect(()=>{D(!0);const I=async()=>{try{const j=await Gs("all",V?.patientRoleID||"",1,10,!1,N);j&&(R(j),h(j?.appointments?.filter(ee=>ee.appnt_date>=Ie.dayjs(new Date).format("YYYY-MM-DD"))),g(j?.appointments?.filter(ee=>ee.appnt_date<Ie.dayjs(new Date).format("YYYY-MM-DD")))),L(j?.appointments?.length?"":"No Appointment")}catch{console.log("error in getAppointmentsList API Call")}};D(!1),I()},[V?.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(jl,{appointments:a(S),handleAppointData:c})})]}),z.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(jl,{isDisabled:!0,appointments:z,handleAppointData:c})})]})]}),z.length>0||S.length>0?e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(es,{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:k})})]})},ma=()=>{const{showToast:i,patientDetails:d,doctorListArr:c,serviceListArr:a,patientIDs:y,setLoading:R,billPreferences:l,docPreference:A,formattedService:S,ppEventProps:h,getAndSetServiceListArr:z,variable:g}=v.useContext(It),[k,L]=v.useState(g.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?.length?!0:l?.billing?.prepaid_consultation!=="1"),[V,D]=v.useState("today"),[N,P]=v.useState(!1),[I,j]=v.useState([]),ee=new Date().toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),H=v.useMemo(()=>c?.doctor_list?.length===1?c.doctor_list[0]:{doctor_name:"",doctor_identifier:""},[c]),G=v.useMemo(()=>({...zl,deleted:!1,appnt_date:Ie.dayjs().format("YYYY-MM-DD"),appnt_doctor_name:g.window_var.role_id=="11"?g.window_var.doc_name_for_seg:H?.doctor_name,appnt_doctor_role_id:g.window_var.role_id=="11"?g.window_var.doctor_role_id_for_seg:H?.doctor_identifier,appnt_duration:l?.print?.bill?.appnt_minute_slab||"",appnt_time_time:ee?.split(" ")[0]||"",appnt_time_format:ee?.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,ee,H?.doctor_identifier,H?.doctor_name,g.window_var.doc_name_for_seg,g.window_var.doctor_role_id_for_seg,g.window_var.role_id]),[W,J]=v.useState(G),[ue,q]=v.useState(!1);v.useEffect(()=>{L(g.window_var?.partner_service_enabled==="1"&&d?.insurance_details?.policy_id?!0:l?.billing?.prepaid_consultation!=="1")},[N,l,V,d,g.window_var?.partner_service_enabled]),v.useEffect(()=>{q(T=>k&&T)},[k]),v.useEffect(()=>{if(!+W?.order_item_id&&!W?.order_unit_item_price){const T=S?.[W.appnt_service_id];T&&J(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}))}},[k,N,W.order_item_id,W.order_unit_item_price,W.appnt_service_id,S]);const O=v.useCallback(T=>{const{order_unit_item_price:De=0,item_quantity:Ue=0,order_item_discount:re=0,appnt_service_id:X}=T;if(!X)return;let Z=0;const ie=S?.[X]?.service_tax||0;let Te=0;if(Number(De)>0&&Number(Ue)>0){const Pe=Number(De)*Number(Ue);Z=Math.floor(Pe*.01*ie),Te=Pe+Z-Number(re)}J(Pe=>({...Pe,order_item_service_tax:Z.toString(),order_item_price:Te.toString()}))},[S]),de=v.useMemo(()=>[{...W,order_item_service_tax:Math.floor(+W.order_item_service_tax).toString()}],[W]),je=T=>{xt();const De=new Date(`1970-01-01T${T.appnt_time}Z`).toLocaleTimeString("en-US",{timeZone:"UTC",hour12:!0,hour:"numeric",minute:"numeric"});J(Ue=>({...Ue,...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}))},ce=(T,De)=>{if(T==="appnt_service_name"){const{appnt_service_name:Ue,appnt_service_id:re,order_item_discount:X,order_unit_item_price:Z,item_quantity:ie,order_item_service_tax_percentage:Te}=De,Pe={...W,appnt_service_name:Ue,appnt_service_id:re,order_unit_item_price:Z,item_quantity:ie,order_item_discount:X,order_item_service_tax_percentage:Te};J(Pe),O(Pe)}else T==="appnt_date"&&De>Ie.dayjs().format("YYYY-MM-DD")&&(L(!0),k||i("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),J(Ue=>({...Ue,[T]:De}))},Fe=()=>{L(T=>!T)},ae=()=>{q(T=>!T)},Y=(T,De)=>{J(Ue=>({...Ue,[De]:T}))};v.useEffect(()=>{O(W)},[W.order_unit_item_price,W.item_quantity,W.order_item_discount,O,W]);const fe=T=>[...T].sort((De,Ue)=>new Date(De.appnt_date).getTime()-new Date(Ue.appnt_date).getTime()),M=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"}),A?.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})]})}],[A?.permissions?.edit_service_unit_price,S]),Ce=v.useMemo(()=>de,[de]),{getTableProps:Me,getTableBodyProps:Le,headerGroups:ht,rows:dt,prepareRow:nt}=Qr.useTable({columns:M,data:Ce}),ke=T=>{const De=[];return T?.headers?.length&&T.headers.map(Ue=>{De.push(e.jsxRuntimeExports.jsx("th",{...Ue.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:Ue.render("Header")})}))}),De},pt=()=>{const T=[];return dt.map((De,Ue)=>{nt(De),T.push(e.jsxRuntimeExports.jsx("tr",{id:Ue.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(re=>e.jsxRuntimeExports.jsx("td",{"data-qa":Ue+1+"-"+re.column.id,...re.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:re.render("Cell")})}))}))}),T},Ct=(T,De,Ue)=>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 ${V===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:Ue})]},T),xt=v.useCallback(()=>{D("today"),J(G),P(!0)},[G]),Nt=v.useCallback(async()=>{R(!0);try{const T=await Gs(V=="today"?Ie.dayjs().format("YYYY-MM-DD"):"all",y?.patientRoleID||"",1,V=="today"?100:10,!1,g);j(T?.appointments?.filter(De=>De.appnt_date===Ie.dayjs().format("YYYY-MM-DD"))),T.appointments.length===0&&xt(),R(!1)}catch{R(!1),console.log("error in getAppointmentsList API Call")}},[xt,V,y?.patientRoleID,R,g]);v.useEffect(()=>{N||Nt()},[N,Nt]),v.useEffect(()=>{V==="today"&&Nt()},[Nt,V]);const Bt=async()=>{W.appnt_date>Ie.dayjs().format("YYYY-MM-DD")&&(L(!0),k||i("Error","Cannot add bill for future appointments. Continue without billing?","Error",5e3)),await Kl(W,k||W.appnt_date>Ie.dayjs().format("YYYY-MM-DD"),i,d,y,h,ue,!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:[Ct("today","hx_calendar-add hfl-text-5","Today's Appts"),Ct("all","hx_calendar hfl-text-5","All Appts")]}),V==="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:I.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:W.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:W.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=>{ce("appnt_doctor_name",T),ce("appnt_doctor_role_id","")},onSuffixDropdownClick:T=>{ce("appnt_doctor_name",T.label),ce("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(Ie.dayjs(W.appnt_date).format("DD-MMM-YYYY")),dateVar:T=>{ce("appnt_date",Ie.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:W?.appnt_time_time||"",input2value:W?.appnt_time_format||"",end_icon:"hx_down",classNamedoubleInput:"hfl-relative",inputProps:{placeholder:"10:00",onBlur:T=>{ce("appnt_time_time",T.target.value)}},onlySuffixDropdownItemsAllowed:!0,suffixInputProps:{placeholder:"AM"},suffixOptions:[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],onSuffixDropdownClick:T=>{ce("appnt_time_format",T.value)}})]})]}),W.appnt_id.length>1&&W.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:W.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:W.appnt_service_name,inputProps:{disabled:!1},widthSufixDrpdwn:"hfl-w-[350px]",suffixInputProps:{placeholder:"Service Name",onClick:async()=>{a?.service_list?.length||z()}},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:a?.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=>{ce("appnt_service_name",{appnt_service_name:T})},onSuffixDropdownClick:T=>{ce("appnt_service_name",T)}}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:Ir.find(T=>T.value==Number(W.appnt_duration))?.label||"",value:W.appnt_duration},label:"Duration",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:T=>{ce("appnt_duration",T.value)},options:Ir,"data-qa":"time picker"}),e.jsxRuntimeExports.jsx(e.Ap,{value:{label:gl.find(T=>T.value==W?.appnt_status)?.text||""},label:"Booking Status",className:"hfl-w-[350px] hfl-text-Gray-800",onChange:T=>{ce("appnt_status",T.value)},options:gl.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:ue,text:"Partner Enabled",onClick:ae,"data-qa":"skip-billing"}),!+W?.order_item_id&&e.jsxRuntimeExports.jsx(e.Os,{size:"md",disabled:!1,isMarked:k,text:"Skip Billing",onClick:Fe,"data-qa":"skip-billing"})]}),!k||+W?.order_item_id?e.jsxRuntimeExports.jsx("div",{className:`${+W?.appnt_id&&+W?.order_item_id?"hfl-pointer-events-none":""}`,children:e.jsxRuntimeExports.jsxs("table",{...Me(),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:ht.map(T=>e.jsxRuntimeExports.jsx("tr",{...T.getHeaderGroupProps(),className:"hfl-h-10 hfl-rounded-lg hfl-bg-Blue_gray-50",children:ke(T)}))}),e.jsxRuntimeExports.jsx("tbody",{...Le(),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:W.appnt_id.length?"Update Appointment":"Book Appointment",icon:"No",onClick:Bt,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:xt})]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-px-4 ","data-qa":"appointment-table",children:e.jsxRuntimeExports.jsx(jl,{today:!0,leftNav:V,appointments:fe(I),handleAppointData:je})})]})}),V==="all"&&e.jsxRuntimeExports.jsx(pa,{sortAppointments:fe,handleAddNewAppnt:xt,handleAppointData:je})]})},xa=({columns:i,data:d})=>{const{getTableProps:c,getTableBodyProps:a,headerGroups:y,rows:R,prepareRow:l}=Qr.useTable({columns:i,data:d}),A=h=>{const z=[];return h?.headers?.length&&h.headers.map(g=>{z.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")})}))}),z},S=()=>{const h=[];return R.map((z,g)=>{l(z),h.push(e.jsxRuntimeExports.jsx("tr",{id:g.toString(),...z.getRowProps(),className:`${z.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:z.cells.map((k,L)=>e.jsxRuntimeExports.jsx("td",{"data-qa":g+1+"-"+(L+1),...k.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] ${z.original.appnt_status===1?"hfl-text-Gray-300 group-hover:hfl-text-Gray-500":"hfl-text-Gray-500"}`,children:k.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:A(h)}))}),e.jsxRuntimeExports.jsx("tbody",{...a(),className:"hfl-rounded-",children:S()})]})})},ga="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",va=({closePrintModal:i,setLatestMetaData:d,setInvestigationDropdown:c,setCustomTranslations:a,getVisitpadPreferenceHandler:y,updateVPPrefUsingDocPref:R})=>{const{patientIDs:l,setShowPrintModal:A,setEndConsultationClicked:S,preferences:h,variable:z}=v.useContext(It),g=v.useReducer((q,O)=>({...q,...O}),{currentPage:1,totalRecord:0,pastVisits:[],isVisitLoading:!1}),[k,L]=g,{pastVisits:V,currentPage:D,isVisitLoading:N,totalRecord:P}=k,I=async q=>{try{L({isVisitLoading:!0});const O=await yn(sn,q,l.patientRoleID,z),de=O?.visits??[];L({currentPage:q,pastVisits:[...V,...de],isVisitLoading:!1,totalRecord:+O.total_visit_count})}catch(O){console.error("Failed to fetch visits:",O),L({isVisitLoading:!1})}},j=async(q,O,de=!0,je)=>{i(),L({isVisitLoading:!0});const ce=await gn(q.original.visit_date,l.patientRoleID,q.original.visit_id,z);L({isVisitLoading:!1});let Fe=null;const{doctor_id:ae="",doctor_role_id:Y=""}=ce?.visits[0]||{};window.doctor_role_id_for_seg!=Y?Fe=await y({doc_id:ae,doc_rid:Y}):await R(h,h.printDefaultPrefIndex,Y,!1),ce&&(d(ce?.latest_visit_metadata),ce?.visits[0]&&(A({printDataFrom:"patient_popup",visible:!0,whichPreview:"offlinePrint",printData:"",visitId:ce?.visits[0]?.visit_id,visit_date:ce?.visits[0]?.visit_date,visit_number:je,currentPrintTime:0,printType:"visit",details:ce?.visits[0],visitpadPref:Fe,appointmentInfo:{appnt_id:V?.[q?.index]?.appnt_id||"",appnt_type:V?.[q?.index]?.appnt_type||""}}),S(de)))},ee=async()=>{try{const q=await Bn(z),O={};q.transalation_records.forEach(de=>{const je=de.language;O[je]=de}),a(O)}catch(q){console.error("Failed to get custom translations:",q)}},H=async()=>{try{const q=await Fn(z);if(q?.test_ranges){const O=q.test_ranges.map(de=>({test_id:de.test_id,test_names:de.test_names,test_range_rule:de.test_range_rule,test_range_text:de.test_range_text,test_units:de.test_units,value:de.test_names}));c(O)}}catch(q){console.error("Failed to get investigation test names:",q)}};v.useEffect(()=>{I(D),ee(),H()},[]);const G={visit_date:"100px",doctor_name:"350px",appnt_type:"100px",service_name:"150px",view:"250px"},W=v.useMemo(()=>[{Header:"Date",accessor:"visit_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-[${G.visit_date}]`,children:q?.original?.visit_date&&Ie.dayjs(q.original.visit_date).format("DD-MMM-YYYY")})})},{Header:"Doctor",accessor:"doctor_name",Cell:({row:q})=>e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${G.doctor_name}]`,children:["Dr. ",q?.original?.doctor_name&&q.original.doctor_name]})},{Header:"Type",accessor:"appnt_type",Cell:({row:q})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${G.appnt_type}]`,children:q?.original?.appnt_type&&q.original.appnt_type})},{Header:"Service",accessor:"service_name",Cell:({row:q})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${G.service_name}]`,children:q?.original?.service_name&&q.original.service_name})},{Header:"Prescription",accessor:"view",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",onClick:()=>{j(q,"VISIT_PRINT",!1,P-q.index)},className:"hfl-w-[74px] "+q.index,"data-qa":"to-print"}),e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary-Grey",size:"sm",textField:"Share",iconFile:"hx_share",icon:"Left",onClick:()=>j(q,"VISIT_SHARE",!0,P-q.index),className:"hfl-w-[74px]","data-qa":"to-share"})]})}],[V]),J=v.useMemo(()=>V,[V]),ue=async()=>{if(!l?.patientRoleID)return;let q="../ipdv2/viewPatientsCase";if(z.window_var?.enable_ipd_v2!=="1"){q="../ipd/viewPatientsCase.php";try{const O=await jn(z,l.patientRoleID),{status:de=0,case_id:je=0}=O,ce=new Date().toISOString().slice(0,10);q=de&&je?`../ipd/viewPatientRecords.php?pid=${l.patientRoleID}&case_id=${je}`:`../ipd/viewAddPatientsCase.php?pid=${l.patientRoleID}&date=${ce}`}catch(O){console.error("Failed to get IPD Case by PID:",O)}}window.open(q,"_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"}),z.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:()=>{ue()}})]}),J?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(xa,{columns:W,data:J,columnWidth:G}),e.jsxRuntimeExports.jsx(es,{currentPage:D,totalRecord:P,handleLoadMore:()=>I(D+1),isLoading:N,currentTotal:J.length})]}),J.length===0&&!N&&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:ga,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"})]})]})},ya=({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"})]})})})),_a=i=>{const{billsData:d,handleRowClick:c,handleRightSegment:a,getRowIndices:y,getRefundAmt:R,closePrintModal:l}=i,{patientIDs:A,patientDetails:S,billPreferences:h,setShowPrintModal:z,showPrintModal:g,variable:k}=v.useContext(It)||{},L=({label:j,className:ee})=>e.jsxRuntimeExports.jsx("th",{className:ee,children:e.jsxRuntimeExports.jsxs(e.bs,{variant:"Semibold",type:"Text sm",className:"hfl-text-Gray-600",children:[" ",j]})}),V=j=>{switch(j){case Pt[0]:return"hx_service-appointment-filled hfl-text-Primary-500";case Pt[1]:return"hx_service-other-filled hfl-text-Pink-500";case Pt[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 Pt[0]:return"Consultation";case Pt[1]:return"Other";case Pt[2]:return"Lab";default:return"Other"}},N=async(j,ee,H)=>{if(g?.visible&&l(),j?.order_id){const G=await Zl(j?.order_id,A?.patientRoleID||"",k),W={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"},ue=[S?.age&&typeof S?.age=="number"?`${S?.age}y`:S?.org_person_dob?hr(S?.org_person_dob):"",Jr[S?.gender]??"",S?.blood_group].filter(q=>q).join(", ");z({printDataFrom:"patient_popup",visible:!0,whichPreview:ee,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:W,billServiceDetails:j?.order_items?.map(q=>({serviceName:q.service_name,price:q.order_unit_item_price,gst:Math.floor(+q.order_item_service_tax),discount:q.order_item_discount,netPrice:q.net_amount,itemQty:q.item_quantity})),billPatientDetails:{name:nr(S?.name)+(ue?` (${ue}) `:""),billDate:Ie.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:A?.patientRoleID,billStatus:parseInt(j?.balance_amount||"0")===0?"PAID":"UNPAID",address:[S?.address??"",S?.city??"",S?.pincode??""].filter(q=>q).join(", "),referredBy:G?.lab_owner_name?nr(G?.lab_owner_name):S?.ref_doc_name?nr(S?.ref_doc_name):"--"},showPrintPreviewForBill:H,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"},I=[{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:I.map((j,ee)=>e.jsxRuntimeExports.jsx(L,{label:j.label,className:j.className},ee))})}),e.jsxRuntimeExports.jsx("tbody",{children:d.length>0&&d.map((j,ee)=>e.jsxRuntimeExports.jsx(v.Fragment,{children:j.order_items.map((H,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:`${Ie.dayjs(j.order_date).format("DD-MMM-YY")===Ie.dayjs(new Date).format("DD-MMM-YY")?"hfl-w-[80px] hfl-bg-Success-25 hfl-px-1 hfl-text-Success-500":""}`,children:Ie.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 ${V(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":ee+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":ee+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":ee+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:H.service_name,children:e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text sm",className:"hfl-truncate",children:H.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:["₹ ",H.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:["₹ ",H.order_item_service_tax]})})}),e.jsxRuntimeExports.jsx("td",{"data-qa":ee+1+"-"+(G+1)+"-delete-bill",className:`${P.td_without_truncate} hfl-max-w-[36px] hfl-cursor-pointer`,onClick:()=>{y(ee,G),a(ft[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"})})]},`${ee}-${G}`))},ee))})]})})},ba=i=>{const{refundAmt:d,handleRightSegment:c,bills:a,billsListIndex:y,orderItemsIndex:R,getBillsList:l}=i,{patientIDs:A,showToast:S,variable:h}=v.useContext(It)||{},[z,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:a?.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: ",a?.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:z,placeholder:"Enter Reason",onChange:k=>{g(k.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(a?.bill_list?.[y].order_id){const k=await Yl(a?.bill_list?.[y].order_id,a?.bill_list?.[y].order_items[R].order_item_id,A?.patientRoleID||"",z,"0",h);k?(await l(),S?.("Success",k?.message,"Success",3e3),c("")):S?.("Error","Something went wrong please try again","Error",3e3)}}catch(k){console.error("Error in deleting bill item",k)}},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("")})})]})},ja="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",Ra=i=>{const{closePrintModal:d,handleCurrentWindow:c,billIdToOpen:a,onBillHandled:y}=i,[R,l]=v.useState(),[A,S]=v.useState(""),[h,z]=v.useState(""),[g,k]=v.useState(),[L,V]=v.useState(),[D,N]=v.useState(1),[P,I]=v.useState([]),[j,ee]=v.useState(-1),[H,G]=v.useState(-1),[W,J]=v.useState(0),[ue,q]=v.useState(0),[O,de]=v.useState(!1),je=v.useContext(It);if(!je)throw new Error("Bills component must be used within an AppContext.Provider");const{patientIDs:ce,setLoading:Fe,variable:ae}=je,Y=ke=>J(ke),fe=(ke=ft[0])=>S(ke),M=ke=>z(ke),Ce=ke=>{k(ke),M(ke?.service_category??""),S(ft[1])},Me=(ke,pt)=>{ee(ke),G(pt)},Le=v.useCallback(async()=>{if(ce?.patientRoleID)try{const ke=await _l(Ie.dayjs().format("YYYY-MM-DD"),ce.patientRoleID,!1,ae);V(ke)}catch(ke){console.error("Error in getPastDueAmount API Call:",ke)}},[ce.patientRoleID,ae]),ht=v.useCallback(async()=>{if(ce?.patientRoleID)try{const ke=await El(ce.patientRoleID,ae);q(ke?.wallet_balance||0)}catch(ke){console.error("Error fetching wallet balance:",ke),q(0)}},[ce.patientRoleID,ae]),dt=v.useCallback(async()=>{if(ce?.patientRoleID){Fe(!0);try{const ke=await vl("all",ce.patientRoleID,1,10,ae);ke&&(l(ke),I(ke.bill_list??[]))}catch(ke){console.error("Error in getBillsList API Call:",ke)}finally{Fe(!1)}}},[ce.patientRoleID,Fe,ae]),nt=async ke=>{if(!ce?.patientRoleID||!R)return;const pt=R.total_pages;if(!(ke>pt)){Fe(!0);try{const Ct=await vl("all",ce.patientRoleID,ke,10,ae);Ct?.bill_list&&I(xt=>[...xt,...Ct.bill_list]),N(ke)}catch(Ct){console.error("Failed to load more bills:",Ct)}finally{Fe(!1)}}};return v.useEffect(()=>{Le(),dt()},[Le,dt]),v.useEffect(()=>{ht()},[ht,O]),v.useEffect(()=>{if(a&&P.length){const ke=P.find(pt=>pt.order_id_str===a);ke&&(Ce(ke),y?.())}},[a,P]),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] ${A===ft[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:["₹ ",L?.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:ue}),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:()=>fe(ft[7])})]})]})]})]}),R?.bill_list?.length?e.jsxRuntimeExports.jsx(_a,{billsData:P,handleRowClick:Ce,handleRightSegment:fe,getRowIndices:Me,getRefundAmt:Y,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:ja,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?.(Rt[2]),children:"Add Bills"})]})]})]})}),R?.bill_list?.length&&e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(es,{currentPage:D,totalRecord:R.total_records,currentTotal:P.length,handleLoadMore:()=>nt(D+1)})})]}),e.jsxRuntimeExports.jsxs(Sl,{children:[A===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{rightSegment:A,serviceDetails:g?.order_items??[],categorySummaryData:g,serviceItem:h,handleRightSegment:fe,getPastDueAmount:Le,getBillSummarydata:dt,closePrintModal:d,setRefreshWallet:de,walletBalance:ue,bill_date:"",refreshBillsList:dt}),A===ft[6]&&e.jsxRuntimeExports.jsx(ba,{refundAmt:W,bills:R,billsListIndex:j,orderItemsIndex:H,handleRightSegment:fe,getBillsList:dt}),A===ft[7]&&e.jsxRuntimeExports.jsx(Il,{depositAmount:ue,handleRightSegment:fe,rightSegment:A,setRefreshWallet:de})]})]})},wa=({reference:i,closeModalHandler:d,payment_id:c,currentMode:a,transactionType:y,refreshPaymentData:R})=>{const{showToast:l,variable:A}=v.useContext(It)||{},[S,h]=v.useState({paymentMethod:a}),z=async()=>{const g=await Mn(c,S.paymentMethod,y,A);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:ur[S.paymentMethod]},options:qr.map(g=>({label:g,value:g,className:"hfl-text-1 hfl-text-Gray-800"})),onChange:g=>{h(k=>({...k,paymentMethod:ur[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:z})]})]})},Ca=({styles:i,data:d,handleDeleteRow:c,handleRightSegment:a,handleRowClick:y,getType:R,getTypeColor:l,refreshPaymentData:A})=>{const[S,h]=v.useState({show:!1,payment_id:"",mode:"",payment_type:""}),z=v.useRef(null),g=L=>{switch(L){case"1":return"Consultation";case"2":return"Other";case"3":return"Lab";default:return"Other"}},k=L=>{switch(L){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((L,V)=>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:Ie.dayjs.utc(new Date(L.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:L.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(L)},"data-qa":V+1+"-bill-amount",children:"₹"+L.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(L.payment_refund)}`,children:R(L.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:ur[L.paid_mode]}),e.jsxRuntimeExports.jsx("span",{className:"hx_edit hfl-cursor-pointer hfl-text-Blue-600",onClick:()=>{h({show:!0,payment_id:L.order_payment_id,mode:L.paid_mode,payment_type:R(L.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 ${k(L.service_category_id)}`}),e.jsxRuntimeExports.jsxs(e.bs,{variant:"Regular",type:"Text sm",className:"-hfl-ml-0 ",children:[" ",g(L?.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:L.order_total})]})}),e.jsxRuntimeExports.jsx("td",{className:`${i.td} hfl-max-w-[70px]`,title:L.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:L.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(),a(),c(L,V)},"data-qa":V+1+"-delete-transaction"})})]},`${V}`)},V)),S.show&&e.jsxRuntimeExports.jsx(tn.ReusableModal,{childModalRef:z,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(wa,{reference:z,closeModalHandler:h,payment_id:S.payment_id,currentMode:S.mode,transactionType:S.payment_type,refreshPaymentData:A})})]})},Ea=({styles:i,data:d,handleRowClick:c,closePrintModal:a,patient_entity_id:y})=>{const{patientDetails:R,patientIDs:l,billPreferences:A,setShowPrintModal:S,showPrintModal:h}=v.useContext(It),z=async(g,k,L,V)=>{h?.visible&&a();const N=[R?.age&&typeof R?.age=="number"?`${R?.age}y`:R?.org_person_dob?hr(R?.org_person_dob):"",Jr[R?.gender]??"",R?.blood_group].filter(I=>I).join(", "),P={name:nr(R?.name)+(N?` (${N}) `:""),billDate:Ie.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(I=>I).join(", ")};S({printDataFrom:"patient_popup",visible:!0,whichPreview:k,printData:"",visitId:"",visit_date:"",visit_number:1,currentPrintTime:new Date().getTime(),printType:"bill_deposit_refund",details:{showPrintPreviewForBill:L,preferences:{...A?.print?.bill,...A?.org_details},depositRefundBillDetails:g,billPatientDetails:P,isWholeBill:!1,payloadDataforEmail:{orderDate:"",orderNumber:g?.bill_number,patient_user_id:y}},trackEventHandler:()=>{console.log(V)}})};return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d.length>0&&d.map((g,k)=>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:Ie.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":k+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:()=>z(g,"billPrintPreview",!1,g?.type==="DEPOSIT"?"DEPOSIT_BILL_PRINT":"REFUND_BILL_PRINT"),"data-qa":k+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:Xl(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})})})]},`${k}`)},k))})},Pa=i=>{const{data:d,setTableData:c,handleRightSegment:a,handleRowClick:y,activeTab:R,closePrintModal:l,patient_entity_id:A,refreshPaymentData:S}=i,{patientIDs:h,showToast:z,variable:g}=v.useContext(It)||{};Ie.dayjs.extend(Al);const k=async(I,j)=>{let ee="";I.payment_refund==="P"?ee="payment":I.payment_refund==="R"&&(ee="refund");try{const H=await Nn(I.order_payment_id,ee,I.order_id,h?.patientRoleID||"",g);H.status&&(z("Success",H?.message,"Success",3e3),c(G=>{try{const W=[...G];return W.splice(j,1),W}catch(W){return console.error(`Error: ${W}`),G}}),S())}catch(H){console.error("Error deleting payment:",H)}},L=I=>{switch(I){case"P":return"Payment";case"R":return"Refund";case"D":return"Deposit";default:return""}},V=I=>{switch(I){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===fr[jr.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:I,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:[" ",I]})}),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((I,j)=>e.jsxRuntimeExports.jsx(N,{label:I.label,className:I.className},j))})}),e.jsxRuntimeExports.jsx("tbody",{children:R===fr[jr.consultation_lab_other_services].key?e.jsxRuntimeExports.jsx(Ca,{styles:P,data:d,handleDeleteRow:k,handleRightSegment:a,handleRowClick:y,getTypeColor:V,getType:L,refreshPaymentData:S}):e.jsxRuntimeExports.jsx(Ea,{styles:P,data:d,handleRowClick:y,closePrintModal:l,patient_entity_id:A})})]})})},Sa="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",Na=({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(ft[7])})]})]})]}),Aa=i=>{Ie.dayjs.extend(Al);const{patientDetails:d,patientIDs:c,billPreferences:a,setShowPrintModal:y,showPrintModal:R}=v.useContext(It)||{},{handleRightSegment:l,closePrintModal:A,summaryData:S,patient_entity_id:h}=i,z=async(g,k)=>{R?.visible&&A();const V=[d?.age&&typeof d?.age=="number"?`${d?.age}y`:d?.org_person_dob?hr(d?.org_person_dob):"",Jr[d?.gender]??"",d?.blood_group].filter(N=>N).join(", "),D={name:nr(d?.name)+(V?` (${V}) `:""),billDate:Ie.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:k,preferences:{...a?.print?.bill,...a?.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(ft[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:Xl(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:()=>z("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:()=>z("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"})]})]})},Da=({closePrintModal:i})=>{const[d,c]=v.useState(fr[jr.consultation_lab_other_services].key),[a,y]=v.useState(null),[R,l]=v.useState(ft[5]),[A,S]=v.useState(""),[h,z]=v.useState(),[g,k]=v.useState([]),[L,V]=v.useState(1),[D,N]=v.useState(),{setLoading:P,patientIDs:I,variable:j}=v.useContext(It),[ee,H]=v.useState(0),[G,W]=v.useState(!1),J=v.useCallback(async()=>{try{if(P(!0),I?.patientRoleID){const Y=await yl(I.patientRoleID,1,10,j);Y&&(y(Y),k(Y.data))}P(!1)}catch{y(null),k([]),P(!1),console.log("error in getPaymentsList API Call")}},[I.patientRoleID,P,j]),ue=v.useCallback(async()=>{try{P(!0);const Y=await bl(I?.patientRoleID||"",1,10,j);Y&&(y(Y),k(Y?.wallet_transactions||[])),P(!1)}catch{y(null),k([]),P(!1),console.log("error in getDepositRefundList API Call")}},[I?.patientRoleID,P,j]),q=(Y=ft[5])=>{l(Y)},O=Y=>{S(Y)},de=async Y=>{if(z(Y),d===fr[jr.consultation_lab_other_services].key){if(O(Pt[parseInt(Y?.service_category_id)-1]),l(ft[1]),Y?.order_id){const fe=await ce(Y.order_id);N(fe)}}else l(ft[8])},je=async Y=>{let fe=Y;if(P(!0),fe<=Math.ceil(a?.total_records||0)){if(fe=Y+1,fe!==Y){let M,Ce;d==fr[jr.deposit_refund].key?(M=await bl(I?.patientRoleID||"",fe,10,j),Ce=[...g,...M.wallet_transactions]):(M=await yl(I?.patientRoleID||"",fe,10,j),Ce=[...g,...M.data]),k(Ce)}V(fe)}P(!1)},ce=async Y=>{try{return await Cl(Y,I?.patientRoleID||"",["order_items"],j)}catch{console.log("Error in Loading Bill Details from Bill Id")}},Fe=v.useCallback(async()=>{const Y=await El(I?.patientRoleID||"",j);H(Y?.wallet_balance||0)},[I?.patientRoleID,j]),ae=Y=>{c(Y),q(),i()};return v.useEffect(()=>{d==fr[jr.deposit_refund].key?ue():J()},[d,ue,J]),v.useEffect(()=>{Fe(),d==fr[jr.deposit_refund].key&&ue()},[d,Fe,ue,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===ft[7]?"hfl-opacity-30":""}`,children:[e.jsxRuntimeExports.jsx("div",{className:"hfl-flex hfl-items-center",children:Object.values(fr).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:()=>ae(Y.key),children:Y.label},fe))}),e.jsxRuntimeExports.jsx(Na,{walletBalance:ee,handleRightSegment:q,headerText:fr[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(Pa,{data:g,setTableData:k,handleRowClick:de,handleRightSegment:q,activeTab:d,closePrintModal:i,patient_entity_id:a?.entity_id||"",refreshPaymentData:J})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-px-6 hfl-py-2",children:e.jsxRuntimeExports.jsx(es,{currentPage:L,totalRecord:a?.total_records||0,currentTotal:L===Math.ceil((a?.total_records||0)/10)?a?.total_records||0:L*10,handleLoadMore:je})})]}):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:Sa,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(Sl,{children:[R===ft[1]&&e.jsxRuntimeExports.jsx(Dl,{rightSegment:R,categorySummaryData:{...h,order_date:D?.order_date??""},serviceItem:A,handleRightSegment:q,serviceDetails:D?.order_items??[],getBillSummarydata:J,closePrintModal:i,setRefreshWallet:W,walletBalance:ee,getPastDueAmount:()=>{},refreshBillsList:()=>{},bill_date:""}),R===ft[7]&&e.jsxRuntimeExports.jsx(Il,{depositAmount:ee,handleRightSegment:q,rightSegment:R,setRefreshWallet:W}),R===ft[8]&&e.jsxRuntimeExports.jsx(Aa,{summaryData:{...h,order_date:D?.order_date??""},handleRightSegment:q,closePrintModal:i,patient_entity_id:a?.entity_id||""})]})]})},Fs=()=>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})}),Jl=({columns:i,data:d})=>{const{getTableProps:c,getTableBodyProps:a,headerGroups:y,rows:R,prepareRow:l}=Qr.useTable({columns:i,data:d}),A=h=>{const z=[];return h?.headers?.length&&h.headers.map(g=>{z.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")})}))}),z},S=()=>{const h=[];return R.map((z,g)=>{l(z),h.push(e.jsxRuntimeExports.jsx("tr",{id:g.toString(),...z.getRowProps(),className:"hfl-bg-White hfl-group hfl-border-t-1 hfl-border-Gray-200",children:z.cells.map((k,L)=>e.jsxRuntimeExports.jsx("td",{"data-qa":g+1+"-"+(L+1),...k.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:k.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:A(h)}))}),e.jsxRuntimeExports.jsx("tbody",{...a(),className:"hfl-rounded-",children:S()})]})})},Ia=i=>{const{visits:d=[],setPdfUrl:c,pdfUrl:a}=i,[y,R]=v.useState([]);return v.useEffect(()=>{R(Ta(d))},[]),e.jsxRuntimeExports.jsx("div",{children:y&&y.length&&y.map((l,A)=>l.reports.length>0&&l.reports.map((S,h)=>{const z=l.date||"No date available";S.label=`${new Date(z).toLocaleDateString()}${l.reports.length>1?` - ${h+1}`:""}`;const{lab_number:g,label:k,message:L=""}=S;return e.jsxRuntimeExports.jsx("div",{className:"hfl-relative hfl-mb-2 hfl-flex hfl-items-center hfl-justify-center",title:`${k} ${L?`(${L})`:""}
18
+ ${g}`,children:e.jsxRuntimeExports.jsx(e.Ku,{hierarchy:"Secondary",size:"lg",textField:`${k} ${L?`(${L})`:""}
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
+ ${a.lab_number===g?"hfl-bg-Gray-200":"hfl-bg-White"}
25
+ hfl-whitespace-pre-line
26
+ hfl-py-6
27
+ hfl-text-left
28
+ `})},`${A}-${h}`)}))})},Ta=i=>{const d={};return i.forEach(c=>{const a=c.date,y=c.reports;d[a]||(d[a]=[]),d[a]=d[a].concat(y)}),Object.keys(d).map(c=>({date:c,reports:d[c]}))},Ba=i=>{const{setLisModalOpen:d,patientDetails:c,lisPDFUrl:a={report_link:"",lab_number:""},showListing:y=!0,showToast:R,openLISReportHandler:l=()=>{},variable:A}=i,{org_person_bid_str:S="",email:h="",phone_number:z="",patient_id:g,name:k=""}=c,[L,V]=v.useState(),[D,N]=v.useState(a),[P,I]=v.useState(!0),[j,ee]=v.useState(!1),[H,G]=v.useState(""),[W,J]=v.useState(h),[ue,q]=v.useState(z),[O,de]=v.useState(!1),je=fe=>{const{value:M}=fe.target;ee(!!M&&!Xr.create$6().email().isValidSync(M)),J(M)},ce=fe=>{const{value:M}=fe.target;de(!!M&&!Xr.create$6().min(10).max(10).isValidSync(M)),q(M)};v.useEffect(()=>{S&&y&&(async()=>{try{I(!0);const M=await le.getLisDataByOrgBidStr(S,A),{visits:Ce=[]}=M;V(M),Ce.length&&Ce[0]?.reports?.length?N(Ce[0].reports[0]):I(!1)}catch(M){console.error("Error:",M),I(!1)}})()},[S]),v.useEffect(()=>{D.report_link?I(!0):I(!1)},[D]);const Fe=()=>{I(!1)},ae=async(fe,M)=>{const Ce={patient_id:g,report_name:`${fe.lab_number}.pdf`,report_url:fe.report_link,channel:M,receiver_emails:W?[W]:[],receiver_phone_numbers:ue?[ue]:[],label:fe?.label||"",patient_name:k},Me=await le.sendAttachLISReport(Ce,A),Le=M==="SMS/WA"?"WhatsApp":M;Me||R("",Le+" failed to sent","Error",3e3),R("",Le+" 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(Fs,{}),e.jsxRuntimeExports.jsx("iframe",{height:"100%",width:"100%",src:Y(D.report_link),title:"PDF Report",onLoad:Fe,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:L?.visits&&L.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(Ia,{visits:L?.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."})})}),L?.visits&&L.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:()=>ae(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&&H!=="email"?"Email format is wrong":void 0,inputProps:{onFocus:()=>G("email"),onBlur:()=>G(""),autoFocus:!0,type:"text",placeholder:"Enter Email",onChange:fe=>{je(fe)},value:W}})}),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:O&&H!=="phone"?"Invalid Phone Number":void 0,inputProps:{placeholder:"Enter Phone Number",onFocus:()=>G("phone"),onBlur:()=>G(""),onChange:fe=>{ce(fe)},value:ue,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:!W||j||P,icon:"Left",onClick:()=>ae(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:!ue||O||P,icon:"Left",onClick:()=>ae(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"})]})})})]})})]})]})})})},Ga=i=>{const{patientDetails:d,showToast:c,variable:a}=i,[y,R]=v.useState(!1),[l,A]=v.useState(""),{org_person_bid_str:S=""}=d,h=v.useReducer((ee,H)=>({...ee,...H}),{currentPage:1,totalRecord:0,LabRecords:[],isLabTableLoading:!1}),[z,g]=h,{LabRecords:k,currentPage:L,isLabTableLoading:V}=z,D=(ee,H)=>{ee==="print_pdf"?window.open(H.report_link,"_blank"):ee==="print_preview"&&(R(!0),A(H))},N=v.useCallback(async ee=>{try{g({isLabTableLoading:!0});const H=await le.getLisDataByOrgBidStr(S,a);let G=[];H?.visits?.length&&(G=Fa(H.visits)),g({currentPage:ee,LabRecords:G?.length?G:[],isLabTableLoading:!1,totalRecord:G.length})}catch(H){g({isLabTableLoading:!1}),console.log(H)}},[g,S,a]),P={lab_date:"100px",lab_number:"350px"};v.useEffect(()=>{N(L)},[L,N]);const I=v.useMemo(()=>[{Header:"Date",accessor:"lab_date",Cell:({row:ee})=>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:ee?.original?.lab_date&&Ie.dayjs(ee.original.lab_date).format("DD-MMM-YYYY")})})},{Header:"Lab Number / Service Name.",accessor:"lab_number",Cell:({row:ee})=>e.jsxRuntimeExports.jsx(e.bs,{variant:"Regular",type:"Text [13px]",className:`hfl-text-Gray-600 hfl-w-[${P.lab_number}]`,children:ee?.original?.lab_number&&ee.original.lab_number})},{Header:"View Report",accessor:"report_link",Cell:({row:ee})=>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",ee.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",ee.original)})]})}],[P.lab_date,P.lab_number]),j=v.useMemo(()=>k,[k]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",j?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Jl,{columns:I,data:j||[]}),y&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-left-[50%] hfl-top-[50%]",children:e.jsxRuntimeExports.jsx(Ba,{setLisModalOpen:R,patientDetails:d,lisPDFUrl:l,showListing:!1,openLISReportHandler:D,showToast:c,variable:a})})]}),j.length===0&&!V&&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"})}),V&&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(Fs,{})})]})},Fa=i=>{const d=[];return i.forEach(c=>{c.reports.forEach(a=>{d.push({lab_number:a.lab_number,report_link:a.report_link,lab_date:c.date})})}),d},Ma=i=>{const{setHplxLabModalOpen:d,patientDetails:c,showHPLXPrintPreview:a,reportsData:y,showToast:R,envName:l}=i,{patient_role_id:A="",email:S="",phone_number:h="",name:z=""}=c,{order_date:g,report_id:k}=y,[L,V]=v.useState(!1),[D,N]=v.useState(""),[P,I]=v.useState(S),[j,ee]=v.useState(h),[H,G]=v.useState(!1),[W,J]=v.useState(null),[ue,q]=v.useState("");v.useEffect(()=>{A&&g&&(async()=>{const ae={pid:A,todays_date:g,rids:k};try{const Y=await le.getHplxLabPdfUrl(ae,l);if(Y&&Y?.pdf){q(Y.pdf);const M=await(await fetch(Y.pdf)).blob(),Ce=URL.createObjectURL(M);J(Ce),a||ce(Ce)}}catch(Y){console.error("Error:",Y)}})()},[A,g]);const O=async Fe=>{try{const ae={created_by:window.doctor_role_id_for_seg,dynamicFieldValue:{patient_name:z,url:ue,email_attachment_urls:ue,email_attachment_file_names:"Lab-Report.pdf"},receiverEmails:Fe==="Email"?[P]:[],receiverPersonRoleIds:[],receiverPhoneNumbers:Fe==="WA"?[j]:[],receiverPhoneNumbersUrl:"",senderId:window.doctor_role_id_for_seg,sourceDetails:{entity_type:"hplx_lab_report",entity_id:k,user_type:"0",user_id:A,branch_id:window.org_branch_id_for_seg},triggerCode:Fe==="WA"?"EHR-LAB-REPORT-WHATSAPP":"EHR-LAB-REPORT-EMAIL"};if(await le.sendV2PrintEmailOrSMS(ae,l))R("",`${Fe==="Email"?"Email":"WhatsApp"} Sent Successfully`,"Success",1e3,"topRight");else throw new Error("Error while uploading the file")}catch(ae){console.log("error",ae)}},de=Fe=>{const{value:ae}=Fe.target;V(!!ae&&!Xr.create$6().email().isValidSync(ae)),I(ae)},je=Fe=>{const{value:ae}=Fe.target;G(!!ae&&!Xr.create$6().min(10).max(10).isValidSync(ae)),ee(ae)},ce=Fe=>{if(Fe){const ae=document.getElementById("hiddenIframe").querySelector("iframe");ae.src=Fe,ae.onload=()=>{ae.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:W?W+"#toolbar=0&navpanes=0":"about:blank",title:"PDF Report"}),e.jsxRuntimeExports.jsx("div",{id:"hiddenIframe",className:"hfl-hidden",children:e.jsxRuntimeExports.jsx("iframe",{src:W,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:L&&D!=="email"&&"Email format is wrong",inputProps:{onFocus:()=>N("email"),onBlur:()=>N(""),autoFocus:!0,type:"text",placeholder:"Enter Email",onChange:Fe=>{de(Fe)},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:H&&D!=="phone"&&"Invalid Phone Number",inputProps:{placeholder:"Enter Phone Number",onFocus:()=>N("phone"),onBlur:()=>N(""),onChange:Fe=>{je(Fe)},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||L,icon:"Left",onClick:()=>O("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||H,icon:"Left",onClick:()=>O("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:()=>ce(W),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"})]})})})]})})]})]})})})},Ha=i=>{const{patientDetails:d,showToast:c,variable:a}=i,[y,R]=v.useState(!1),[l,A]=v.useState(!0),[S,h]=v.useState({}),z=v.useReducer((G,W)=>({...G,...W}),{currentPage:1,totalRecord:0,LabRecords:[],isLabTableLoading:!1}),[g,k]=z,{LabRecords:L,currentPage:V,isLabTableLoading:D,totalRecord:N}=g,P={order_date:"100px",test:"350px"},I=(G,W)=>{R(!0),A(G),h(W)},j=v.useCallback(async G=>{k({isLabTableLoading:!0});try{const W=await vn(ln,G,d?.patient_role_id,a),J=W?.data??[];k({currentPage:G,LabRecords:[...L,...J],isLabTableLoading:!1,totalRecord:W?.total_lab_count??0})}catch(W){console.error("Failed to fetch HPLX Lab reports:",W)}finally{k({isLabTableLoading:!1})}},[k,d?.patient_role_id,a]);v.useEffect(()=>{j(V)},[V,j]);const ee=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&&Ie.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:()=>I(!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:()=>I(!0,G.original)})]})}],[P.order_date,P.test]),H=v.useMemo(()=>L,[L]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[" ",H?.length>0&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(Jl,{columns:ee,data:H||[]}),e.jsxRuntimeExports.jsx("div",{className:"hfl-mt-2",children:e.jsxRuntimeExports.jsx(es,{currentPage:V,totalRecord:N,handleLoadMore:()=>j(V+1),isLoading:D,currentTotal:H.length})}),y&&e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-left-[50%] hfl-top-[50%]",children:e.jsxRuntimeExports.jsx(Ma,{setHplxLabModalOpen:R,patientDetails:d,showHPLXPrintPreview:l,reportsData:S,showToast:c,envName:a})})]}),H.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(Fs,{})})]})},La=i=>{const{showToast:d}=i,{patientDetails:c,billPreferences:a,variable:y}=v.useContext(It)||{},[R,l]=v.useState(""),A=a?.features?.enable_lis_v1??!1,S=y.window_var.permit_lab_tech=="1";v.useEffect(()=>{A&&S||A?l(Yr[Xt.lis_report].key):S&&l(Yr[Xt.healthplix_report].key)},[A,S]);const h=z=>{l(z)};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:A||S?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",{className:"hfl-flex hfl-items-center",children:[A&&e.jsxRuntimeExports.jsx(e.bs,{variant:`${R===Xt.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===Xt.lis_report?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>h(Xt.lis_report),children:Yr[Xt.lis_report].label}),S&&e.jsxRuntimeExports.jsx(e.bs,{variant:`${R===Xt.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===Xt.healthplix_report?"hfl-border-b-2 hfl-border-Primary-600 hfl-text-Primary-600":""}`,onClick:()=>h(Xt.healthplix_report),children:Yr[Xt.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===Xt.lis_report?"Lab reports of LIS":R===Xt.healthplix_report?"Lab reports of Healthplix":""})}),R===Xt.lis_report&&e.jsxRuntimeExports.jsx(Ga,{patientDetails:c,showToast:d,variable:y}),R===Xt.healthplix_report&&e.jsxRuntimeExports.jsx(Ha,{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 ka({variable:i}){const{window_var:d,token:c,envName:a,IMGREP_DIRECTORY:y}=i,R=Rl.useMediaQuery("(max-width: 1080px)"),l=v.useRef(null),[A,S]=v.useState(!1),[h,z]=v.useState(!1),[g,k]=v.useState([]),[L,V]=v.useState(Rt[2]),[D,N]=v.useState(),[P,I]=v.useState(),[j,ee]=v.useState(),[H,G]=v.useState(),[W,J]=v.useState(),[ue,q]=v.useState(),[O,de]=v.useState({printDataFrom:"",visible:!1,whichPreview:"offlinePrint",printData:"",visitId:"",visit_date:"",details:{},visit_number:1,currentPrintTime:0,printType:"bill",trackEventHandler:()=>{}}),[je,ce]=v.useState(""),[Fe,ae]=v.useState("en"),[Y,fe]=v.useState(),[M,Ce]=v.useState(),[Me,Le]=v.useState(),[ht,dt]=v.useState({patient_id:"",patient_registered_date:"",patient_age:"",patient_gender:""}),nt=window?.partner_config?JSON.parse(window?.partner_config):{},[ke,pt]=v.useState([]),{patient_preferred_language:Ct}=W||{},{visit_pad_json:xt,visitpad_order:Nt,org_person_sign_text:Bt,org_person_signature_url:T}=j||{},{add_lang_change:De,defaultLanguage:Ue}=typeof xt=="string"&&xt&&JSON.parse(xt)||{},{rows:re}=Ue||{},[X,Z]=v.useState(!1),[ie,Te]=v.useState({}),[Pe,mt]=v.useState([]),[Jt,vt]=v.useState({}),[Wt,Gt]=v.useState({created_on:"",category_name:""});v.useEffect(()=>{const ot=ue?.print?.bill?.appnt_minute_slab;if(!ot)return;const _t=+ot;_t&&(Ir.find(Et=>Et.value==_t)||Ir.unshift({label:`${_t} min`,value:_t}))},[ue]);const er=v.useCallback(ot=>{an({callback:ut=>{J(ut),dt({patient_id:ot,patient_registered_date:"",patient_age:ut?.age?typeof ut?.age=="number"?`${ut.age} y`:`${hr(`${ut.age}`)}`:hr(ut?.org_person_dob),patient_gender:$l(ut?.gender)})}},ot,i)},[J]),tr=ot=>{rr(),V(ot)},lr=(ot,_t,ut,Et)=>{const Ht=Date.now();k(Ft=>[...Ft,{id:Ht,title:ot,description:_t,type:ut,duration:Et}]),setTimeout(()=>{k(Ft=>[...Ft].filter(({id:Lt})=>Lt!==Ht))},Et)};v.useEffect(()=>{Nt&&xt&&pt(Hl(Nt,xt))},[j,xt,Nt]);const pr=v.useCallback(()=>{ae(typeof Ct=="string"&&Ct.length>=2?Ct:typeof re=="string"&&re.length>=2?re:"en")},[re,Ct]);v.useEffect(()=>{pr()},[Ct,re,pr]);const ar=async(ot,_t,ut,Et=!0)=>{const{unmodifiedVisitPadJson:Ht,printPrefMasterArr:Ft}=ot,Lt=Ht&&et.isJson(Ht)?JSON.parse(Ht):{},Vt=Ft?.[_t]||{config:{}},Tt=Vt?.config||{},ye={...Lt,...Vt,...((Kt,$t)=>Object.fromEntries(Object.entries(Kt).map(([sr,Sr])=>[$t[sr]||sr,Sr])))(Tt,nn)},jt={org_person_logo_footer_url:`${y}${Tt.footer_img_url}`,org_person_logo_header_url:`${y}${Tt.header_img_url}`,org_person_sign_text:Tt.signature,org_person_signature_url:`${y}${Tt.signature_img_url}`,person_seal_url:`${Tt.seal_img_url}`},kt={...ot,visit_pad_json:JSON.stringify(ye),...jt};if(ut===""||window.doctor_role_id_for_seg==ut)ee(kt);else if(Et)de(Kt=>({...Kt,visible:!0,visitpadPref:kt}));else return kt},cr=async(ot={doc_id:"",doc_rid:""})=>{const _t=await $r.getVisitpadPreference(ot,{token:c,envName:a},d.org_branch_id_for_seg||"",d.person_id_for_seg||"",d.doctor_role_id_for_seg||""),ut=await $r.getDoctorPreference("print_configs",ot,d.doctor_role_id_for_seg||"",d.org_branch_id_for_seg||"",{token:c,envName:a||et.E_ENVIRONMENT.STAGING}),Et=_t?.visit_pad_json,Ht={};let Ft=0;ut?.print_templates?.forEach((Vt,Tt)=>{Vt?.name&&(Ht[Tt]=Vt.name,Ft=Vt.is_default?Tt:Ft)}),_t.printPreferenceList=Ht,_t.printPrefMasterArr=ut?.print_templates||[],_t.unmodifiedVisitPadJson=Et,_t.printDefaultPrefIndex=Ft;const Lt=await ar(_t,Ft,ot.doc_rid,!1);if(!(ot.doc_rid===""||window.doctor_role_id_for_seg==ot.doc_rid))return Lt},yt=async()=>{const ot=await on(i);N(ot);const _t={};if(ot?.service_list){for(const ut of ot.service_list)_t[ut.service_identifier]={...ut};Ce(_t)}};window.patientPopupHandler=async(ot,_t,ut,Et,Ht,Ft,Lt)=>{S(!0),ce(ot),G({patientRoleID:_t,patientID:ut}),l.current=Lt??null,await ar(Et,Et.printDefaultPrefIndex,"",!1);try{V(Rt.includes(Ft?.toLowerCase()??"")?Ft.toLowerCase():Rt[2]),er(_t),un(i).then(I),xn("patient_config",i).then(q),$r.getDoctorPreference("print_configs",{doc_rid:""},d.doctor_role_id_for_seg||"",d.org_branch_id_for_seg||"",{token:c,envName:a||et.E_ENVIRONMENT.STAGING}).then(fe),ql(_t,ut,i).then(Le),ir(_t),await yt()}catch{console.log("Failed to open patient pop up")}};const rr=()=>{de({printDataFrom:"",visible:!1,whichPreview:"",printData:"",visitId:"",visit_date:"",details:{},visit_number:1,currentPrintTime:0,printType:"",trackEventHandler:()=>{}})};v.useEffect(()=>{document.body.style.overflow=A?"hidden":"auto"},[A]);const dr=v.useMemo(()=>[...ue?.patient_config?.custom_fields||[]].sort((ut,Et)=>ut.sort-Et.sort).map(ut=>{const Et=W?.custom_fields?.find(Ht=>Ht.id===ut.id);return{...ut,value:Et?.value||"",title:Et?.value?Et?.title:ut.title}}),[ue?.patient_config?.custom_fields,W?.custom_fields]),mr=ot=>{switch(ot){case"1":return"Consultation";case"2":return"Other";case"3":return"Lab";default:return"Other"}},ir=async ot=>{function _t(ut){return ut?ut.replace("Z","").replace(" +0000 UTC","").trim():null}try{const[ut,Et]=await Promise.all([yl(ot,1,1,i),bl(ot,1,10,i)]),Ht=Et?.wallet_transactions?.filter(Tt=>Tt.type?.toUpperCase()==="DEPOSIT").map(Tt=>({...Tt,created_on:Tt.transaction_time}))??[],Ft=ut?.data?.filter(Tt=>Tt.payment_refund?.toUpperCase()==="P")??[],Lt=[...Ht,...Ft].sort((Tt,B)=>{const ye=new Date(_t(Tt.created_on)||0).getTime();return new Date(_t(B.created_on)||0).getTime()-ye});if(Lt.length===0){Gt({created_on:"",category_name:""});return}const Vt=Lt[0];Gt({created_on:Vt.created_on??"",category_name:"service_category_id"in Vt?mr(Vt.service_category_id):Vt.type??""})}catch(ut){console.error("Error in last payment details API Call",ut),Gt({created_on:"",category_name:""})}};function xr(ot){const _t=Ie.dayjs(ot).startOf("day"),Et=Ie.dayjs().startOf("day").diff(_t,"day");return Et===0?"Today":Et===1?"Yesterday":Et>=2?`${Et} days ago`:_t.format("DD MMM YYYY")}return e.jsxRuntimeExports.jsx("div",{id:"react_patientpopup_mfe",children:e.jsxRuntimeExports.jsxs(It.Provider,{value:{billPreferences:ue,preferences:j,currentWindow:L,patientDetails:W,setShowPrintModal:de,showPrintModal:O,setEndConsultationClicked:Z,doctorListArr:P,docPreference:Y,serviceListArr:D,patientIDs:H,showToast:lr,isLoading:h,setLoading:z,formattedService:M,ppEventProps:ht,getAndSetServiceListArr:yt,patientCustomFieldData:dr,getLastBillsPaymentData:ir,setLastBillPaymentData:Gt,variable:i},children:[e.jsxRuntimeExports.jsx("div",{children:A&&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(qn,{redirectionPage:je,patientIDs:H,setShowPatientPopModal:S,handleCurrentWindow:tr,closePrintModal:rr})}),h&&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(Fs,{})}),L===Rt[1]&&e.jsxRuntimeExports.jsx(ma,{}),L===Rt[2]&&e.jsxRuntimeExports.jsx(ha,{closePrintModal:rr}),L===Rt[3]&&e.jsxRuntimeExports.jsx(Ra,{closePrintModal:rr,handleCurrentWindow:tr,billIdToOpen:l.current,onBillHandled:()=>l.current=null}),L===Rt[4]&&e.jsxRuntimeExports.jsx(Da,{closePrintModal:rr}),L===Rt[5]&&e.jsxRuntimeExports.jsx(va,{closePrintModal:rr,setLatestMetaData:vt,setInvestigationDropdown:mt,setCustomTranslations:Te,getVisitpadPreferenceHandler:cr,updateVPPrefUsingDocPref:ar}),L===Rt[6]&&e.jsxRuntimeExports.jsx(La,{showToast:lr}),L===Rt[8]&&e.jsxRuntimeExports.jsx($n,{patientAbhaDetails:Me,setPatientAbhaDetails:Le,getPatientDetails:er,isPartnerServiceEnabled:window?.partner_service_enabled==="1",partnerConfig:nt}),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:Wt.created_on&&e.jsxRuntimeExports.jsxs(e.bs,{variant:"Medium",type:"Text sm",children:["Last Payment: ",xr(Wt.created_on),Wt.category_name&&` (${Wt.category_name})`]})}),e.jsxRuntimeExports.jsx("div",{className:"hfl-absolute hfl-z-[100]",children:e.jsxRuntimeExports.jsx(e.qh,{toastList:g})})]})}),O?.visible&&e.jsxRuntimeExports.jsx(le.PrintModal,{modalProps:{mfePrefix:"hfl",printType:O.printType,onCloseModal:rr,showToast:lr,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:{...ue?.print?.bill,...ue?.org_details,...ue?.branch_details,doc_sign_img:T,doc_sign_text:Bt},showPrintPreviewForBill:O.details.showPrintPreviewForBill,isWholeBill:O.details.isWholeBill,payloadDataforEmail:O.details.payloadDataforEmail,printDataFrom:O.printDataFrom,depositRefundBillDetails:O.details.depositRefundBillDetails}:void 0,optionFormProps:{selectedLanguage:Fe,showLanguageDropDown:O.printType==="visit"&&De?.print==="1"||O.printType==="visit"&&window.role_id!="11",showPrintPrefDropDown:!0,setSelectedLanguage:ot=>ae(ot),googleReview:!1,showEmailInput:!0,showPhoneInput:O.printType==="visit"},ampEventProps:{vpEventProps:"",setvpEventProps:()=>{},trackEventHandler:ot=>{O.trackEventHandler?.(ot)}},visitpadProps:O.printType==="visit"?{printDataFrom:O.printDataFrom,patientDetails:W,visitDetails:O.details,offlineMode:!1,visitId:O.visitId,preferences:O?.visitpadPref||j,endConsultationClicked:X,visitDate:O.visit_date,visitPadOrder:O?.visitpadPref?.visitpad_order?Hl(O?.visitpadPref?.visitpad_order,O?.visitpadPref?.visit_pad_json):ke,visitNumber:O.visit_number,customTranslations:ie,latestMetaData:Jt,investigationDropdown:Pe,printDateTime:()=>"",getInvestigationTestNameOffline:()=>{},updateVPPrefUsingDocPref:ar,patientCustomFields:dr}:void 0,appointmentInfoProps:O.printType==="visit"&&O.printDataFrom==="patient_popup"?O.appointmentInfo:void 0})]})}),A&&e.jsxRuntimeExports.jsx(ya,{fontBaseUrl:i.fontBaseUrl})]})})}exports.PatientPopupContainer=ka;