PageSourceSearch

https://vizops360.ai/assets/finance.bank-statements.import-nF-hmSlV.js

js vizops360.ai collected 2026-10-05 13:52:55 UTC 56,768 bytes, 1 lines download raw bytes

1import{d4 as et,ax as tt,E as at,r as d,ey as rt,e0 as st,e1 as nt,e9 as ot,dI as it,j as t,b6 as R,k as dt,S as $,b7 as re,v as lt,Y as Ne,ap as E,J as Ee,as as se,b4 as ct,L as ye,K as pt,cI as Te,dG as mt,b as ut,df as gt,z as xt,bT as ht,bv as Ce,bw as Pe,a as bt,by as Se,bz as ke,at as ft,au as Nt,av as Ae,cB as Et,bB as je,n as yt,aI as m,b9 as Tt}from"./index-CpeGhXo5.js";import{e as Ct,d as Oe,f as Re}from"./financeMappers-CUv1G2pV.js";import{a as Pt}from"./seedData-BKFJmuM9.js";import{e as St}from"./expenseDraft-DqR0Jp71.js";import{F as we}from"./file-check-DgOG7DHv.js";import{L as kt}from"./lock-open-Cmtyk41m.js";const _=[{id:"RULE-AWS",name:"Amazon Web Services (Cloud Hosting)",pattern:"AWS|AMAZON WEB SERVICES|AMZN EMEA",targetType:"EXPENSE",clientOrVendor:"Amazon Web Services (AWS EMEA)",category:"IT & Software Infrastructure",department:"Technology",team:"DevOps & Cloud",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:18,expenseType:"Operational",paymentMethod:"Corporate Credit Card",matchCount:14,confidence:99,learnedFromCFO:!0,createdAt:"2026-01-10"},{id:"RULE-GCP",name:"Google Cloud Platform",pattern:"GOOGLE CLOUD|GCP CLOUD|GOOGLE*SVCS",targetType:"EXPENSE",clientOrVendor:"Google Cloud Platform (GCP)",category:"IT & Softw
1are Infrastructure",department:"Technology",team:"DevOps & Cloud",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:18,expenseType:"Operational",paymentMethod:"Corporate Credit Card",matchCount:9,confidence:99,learnedFromCFO:!0,createdAt:"2026-01-15"},{id:"RULE-PSPCL",name:"Punjab State Power Corporation (Electricity)",pattern:"PSPCL|PUNJAB STATE ELECTRI|POWER CORP",targetType:"EXPENSE",clientOrVendor:"Punjab State Power Corporation (PSPCL)",category:"Electricity & Power Charges",department:"Administration",team:"Facilities & Infrastructure",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:0,expenseType:"Fixed",paymentMethod:"Bank Transfer",matchCount:6,confidence:99,learnedFromCFO:!0,createdAt:"2026-02-01"},{id:"RULE-SALARY-JANVI",name:"Staff Payroll - Janvi Arora",pattern:"JANVI ARORA|JAN PENDING SALARY|FEB PENDING SALARY",targetType:"EXPENSE",clientOrVendor:"Janvi Arora (Staff Payroll)",category:"Payroll & Pending Salaries",department:"Human Resources",team:"Core Team",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:0,expenseType:"Fixed",paymentMethod:"Bank Transfer (NEFT)",matchCount:8,confidence:99,learnedFromCFO:!0,createdAt:"2026-02-15"},{id:"RULE-AMRITPAL",name:"Professional Fees - Amritpal Singh",pattern:"AMRITPAL SINGH",targetType:"EXPENSE",clientOrVendor:"Amritpal Singh",category:"Professional & Consulting Fees",department:"Technology",team:"Senior Architecture",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:10,expenseType:"Variable",paymentMethod:"Bank Transfer (NEFT)",matchCount:5,confidence:97,learnedFromCFO:!0,createdAt:"2026-03-01"},{id:"RULE-TRAVEL-MMT",name:"Corporate Air Travel - MakeMyTrip",pattern:"MAKEMYTRIP|MMT CORP|INDIGO AIR|VISTARA",targetType:"EXPENSE",clientOrVendor:"MakeMyTrip Corporate Air Travel",category:"Travel & Conveyance",department:"Operations",team:"Client Management",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:5,expenseType:"Variable",paymentMethod:"Corporate Credit Card",matchCount:11,confidence:98,learnedFromCFO:!0,createdAt:"2026-02-20"},{id:"RULE-OFFICE-STAPLES",name:"Office Supplies - Staples / Nayyar",pattern:"STAPLES|NAYYAR LABELS|OFFICE SUPPLIES|ID CARDS",targetType:"EXPENSE",clientOrVendor:"Nayyar Labels & Supplies",category:"Office Supplies & Printing",department:"Administration",team:"Procurement",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:18,expenseType:"Variable",paymentMethod:"Bank Transfer",matchCount:7,confidence:96,learnedFromCFO:!0,createdAt:"2026-03-05"},{id:"RULE-HDFC-CHARGES",name:"HDFC Statutory & Wire Charges",pattern:"INWARD WIRE|WIRE CHRG|STATUTORY CHRG|SGST|CGST",targetType:"EXPENSE",clientOrVendor:"HDFC Bank (Statutory Charges)",category:"Bank & Statutory Charges",department:"Finance",team:"Treasury",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:18,expenseType:"Fixed",paymentMethod:"Auto Debit",matchCount:15,confidence:99,learnedFromCFO:!0,createdAt:"2026-01-05"},{id:"RULE-DIRECTOR-DRAWINGS",name:"Pawandeep Kaur Grewal (Director Remuneration)",pattern:"PAWANDEEP KAUR",targetType:"EXPENSE",clientOrVendor:"Pawandeep Kaur Grewal (CFO & Director)",category:"Director Remuneration & Drawings",department:"Management",team:"Executive Leadership",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:0,expenseType:"Fixed",paymentMethod:"Bank Transfer",matchCount:4,confidence:99,learnedFromCFO:!0,createdAt:"2026-01-01"},{id:"RULE-DIRECTOR-CAPITAL",name:"Sarbjit Singh Grewal (Capital Infusion)",pattern:"SARBJIT SINGH GREWAL|SARBJIT GREWAL",targetType:"REVENUE",clientOrVendor:"Sarbjit Singh Grewal (Managing Director)",category:"Director Capital Infusion",department:"Management",team:"Executive Leadership",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:0,expenseType:"Operational",paymentMethod:"Bank Transfer",matchCount:3,confidence:99,learnedFromCFO:!0,createdAt:"2026-01-01"},{id:"RULE-INTERNAL-TRANSFER",name:"Inter-Account Transfer (HDFC to Kotak)",pattern:"TWS KOTAK|KKBK0003916|HDFC TO KOTAK|TRANSFER TO",targetType:"TRANSFER",clientOrVendor:"Tekki Web Solutions (Kotak ••531)",category:"Internal Account Transfer",department:"Finance",team:"Treasury",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:0,expenseType:"Operational",paymentMethod:"RTGS / Internal Transfer",matchCount:18,confidence:99,learnedFromCFO:!0,createdAt:"2026-01-01"},{id:"RULE-POS-SETTLEMENT",name:"Merchant POS Settlement Revenue",pattern:"REV-ATPO|POS SETTLEMENT|RAZORPAY|STRIPE PAYOUT",targetType:"REVENUE",clientOrVendor:"Merchant POS Settlement Desk",category:"Direct Payment Collections",department:"Revenue",team:"Collections",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:18,expenseType:"Operational",paymentMethod:"Bank Transfer",matchCount:22,confidence:95,learnedFromCFO:!0,createdAt:"2026-01-01"}],De="bank_ingestion_ai_rules_v1";function S(){try{const s=localStorage.getItem(De);if(s){const l=JSON.parse(s);if(Array.isArray(l)&&l.length>0)return l}}catch(s){console.error("Error reading AI ingestion rules:",s)}return F(_),_}function F(s){try{localStorage.setItem(De,JSON.stringify(s)),typeof window<"u"&&window.dispatchEvent(new CustomEvent("bank-ingestion-rules-updated",{detail:s}))}catch(l){console.error("Error saving AI ingestion rules:",l)}}function W(s,l,x){const o=S(),f=(s||"").toUpperCase();for(const p of o)if(p.pattern.split("|").map(T=>
1T.trim().toUpperCase()).filter(Boolean).some(T=>f.includes(T)))return p.matchCount=(p.matchCount||0)+1,p.lastMatchedAt=new Date().toISOString().slice(0,10),F(o),{matchedRule:p,targetType:p.targetType,clientOrVendor:p.clientOrVendor,categoryOrProject:p.category,department:p.department||"Operations",team:p.team||"General",taxRate:p.taxRate??(p.targetType==="EXPENSE"?18:0),confidence:p.confidence||98,isLearned:p.learnedFromCFO};const c=x>0,w=c?"REVENUE":"EXPENSE";let N="Direct Party Transaction",L=c?"Client Service Inflow":"General Operational Expense",k=c?"Revenue":"Operations",Y="General";if(f.includes("NEFT")||f.includes("RTGS")||f.includes("IMPS")){const p=s.replace(/^(NEFT|RTGS|IMPS)\s*(DR|CR)?[-/\s]*/i,"").split(/[-/]/)[0]?.trim();p&&p.length>3&&(N=p)}return{matchedRule:null,targetType:w,clientOrVendor:N,categoryOrProject:L,department:k,team:Y,taxRate:0,confidence:85,isLearned:!1}}function V(s){const l=S(),f=(s.narration||"").replace(/[0-9]{5,}/g,"").replace(/\b(NEFT|RTGS|IMPS|DR|CR|NETBANK|MUM|TRANSFER|TPT|UPI|BANK)\b/gi,"").replace(/[^a-zA-Z\s]/g," ").split(/\s+/).map(N=>N.trim().toUpperCase()).filter(N=>N.length>=3).slice(0,3).join(" ")||s.clientOrVendor.toUpperCase().slice(0,15);let c=l.find(N=>N.clientOrVendor.toLowerCase()===s.clientOrVendor.toLowerCase()||f.includes(N.pattern.split("|")[0]));if(c)return c.matchCount=(c.matchCount||0)+1,c.confidence=99,c.learnedFromCFO=!0,c.targetType=s.targetType,c.category=s.categoryOrProject,c.department=s.department||c.department||"Operations",c.team=s.team||c.team||"General",s.taxRate!==void 0&&(c.taxRate=s.taxRate),c.lastMatchedAt=new Date().toISOString().slice(0,10),F(l),c;const w={id:`RULE-LEARNED-${Date.now()}`,name:`${s.clientOrVendor} (${s.categoryOrProject})`,pattern:f,targetType:s.targetType,clientOrVendor:s.clientOrVendor,category:s.categoryOrProject,department:s.department||"Operations",team:s.team||"General",company:"Tekki Web Solutions Pvt. Ltd.",taxRate:s.taxRate??(s.targetType==="EXPENSE"?18:0),expenseType:"Variable",paymentMethod:"Bank Transfer",matchCount:1,confidence:99,learnedFromCFO:!0,createdAt:new Date().toISOString().slice(0,10),lastMatchedAt:new Date().toISOString().slice(0,10)};return l.unshift(w),F(l),w}function At(s){const l=S().filter(x=>x.id!==s);F(l)}function jt(){return F(_),_}const ve=s=>{if(!s)return"—";try{const l=s.split("-");if(l.length===3&&l[0].length===4){const o=parseInt(l[0],10),f=parseInt(l[1],10)-1,c=parseInt(l[2],10);return new Date(o,f,c).toLocaleDateString("en-IN",{day:"2-digit",month:"short",year:"numeric"})}const x=new Date(s);return isNaN(x.getTime())?s:x.toLocaleDateString("en-IN",{day:"2-digit",month:"short",year:"numeric"})}catch{return s}},I=s=>
1s==null||isNaN(Number(s))?"₹0.00":Number(s).toLocaleString("en-IN",{minimumFractionDigits:2,maximumFractionDigits:2});function Ot(s,l){const x=s.toUpperCase();for(const o of l)if(x.includes(o.last4)||x.includes(`POS ${o.last4}`)||x.includes(`CARD ${o.last4}`)||x.includes(`*${o.last4}`))return{last4:o.last4,cardNickname:o.cardNickname,cardType:o.cardType}}const ne=[{id:"HDFC-TXN-01",date:"2026-04-01",narration:"ACH D- KMBLDRAOPERATIONS-RC613-18825357-",refNo:"0000003287380780",debit:34788,credit:0,balance:79212.21,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Kotak Mahindra Bank Operations",categoryOrProject:"Loan EMI & Vehicle Finance",status:"PENDING",aiConfidence:96,isAiVerified:!0},{id:"HDFC-TXN-02",date:"2026-04-02",narration:"INW 020426I049911847 [email protected]",refNo:"0000020426280017",debit:0,credit:241628173e-2,balance:249549394e-2,suggestedType:"REVENUE",targetType:"REVENUE",clientOrVendor:"Foreign Inward Remittance (USD 25,995.50 @ 92.95)",categoryOrProject:"Software Export Revenue",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-03",date:"2026-04-02",narration:"020426I049911847 DPO2709207472815 CGST",refNo:"0000020426280018",debit:622.47,credit:0,balance:249487147e-2,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"HDFC Bank (Inward Wire CGST)",categoryOrProject:"Bank & Statutory Charges",status:"PENDING",aiConfidence:98,isAiVerified:!0},{id:"HDFC-TXN-04",date:"2026-04-02",narration:"020426I049911847 DPO2709207472815 SGST",refNo:"0000020426280020",debit:622.47,credit:0,balance:2494249,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"HDFC Bank (Inward Wire SGST)",categoryOrProject:"Bank & Statutory Charges",status:"PENDING",aiConfidence:98,isAiVerified:!0},{id:"HDFC-TXN-05",date:"2026-04-02",narration:"RTGS DR-KKBK0003916-TWS KOTAK 531-NETBANK, MUM-HDFCR52026040291055019-BANK TRANSFER",refNo:"HDFCR52026040291055019",debit:2294e3,credit:0,balance:200249,suggestedType:"TRANSFER",targetType:"TRANSFER",clientOrVendor:"Tekki Web Solutions (Kotak ••531)",categoryOrProject:"Internal Account Transfer (HDFC to Kotak)",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-06",date:"2026-04-03",narration:"18311000003976-TPT-NBYFUSLAVALSZ12V-SARBJIT SINGH GREWAL",refNo:"0000000568398046",debit:0,credit:25e4,balance:450249,suggestedType:"REVENUE",targetType:"REVENUE",clientOrVendor:"Sarbjit Singh Grewal (Managing Director)",categoryOrProject:"Director Capital Infusion",status:"PENDING",aiConfidence:97,isAiVerified:!0},{id:"HDFC-TXN-07",date:"2026-04-07",narration:"50100095798040-TPT-NB3C0S9WRUPQJ0E9-PAWANDEEP KAUR",refNo:"0000000312566283",debit:1e5,credit:0,balance:350249,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Pawandeep Kaur Grewal (CFO & Director)",categoryOrProject:"Director Remuneration & Drawings",status:"PENDING",aiConfidence:97,isAiVerified:!0},{id:"HDFC-TXN-08",date:"2026-04-07",narration:"NEFT DR-UBIN0552054-AMRITPAL SINGH-NETBANK",refNo:"HDFCH00917612764",debit:42263,credit:0,balance:307986,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Amritpal Singh",categoryOrProject:"Professional & Consulting Fees",status:"PENDING",aiConfidence:94,isAiVerified:!0},{id:"HDFC-TXN-09",date:"2026-04-09",narration:"NEFT DR-BDBL0001386-JANVI ARORA-NETBANK, MUM-HDFCH00924237868-JAN PENDING SALARY",refNo:"HDFCH00924237868",debit:5920,credit:0,balance:137584.8,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Janvi Arora",categoryOrProject:"Payroll & Pending Salaries",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-10",date:"2026-04-09",narration:"NEFT DR-BDBL0001386-JANVI ARORA-NETBANK, MUM-HDFCH00924239404-FEB PENDING SALARY",refNo:"HDFCH00924239404",debit:5920,credit:0,balance:131664.8,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Janvi Arora",categoryOrProject:"Payroll & Pending Salaries",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-11",date:"2026-04-09",narration:"REV-ATPO-HGAKP0C61E1111051080-08/04/2026",refNo:"00000000000000",debit:0,credit:2238.46,balance:133903.26,suggestedType:"REVENUE",targetType:"REVENUE",clientOrVendor:"Merchant POS Settlement Desk",categoryOrProject:"Direct Payment Collections",status:"PENDING",aiConfidence:92,isAiVerified:!0},{id:"HDFC-TXN-12",date:"2026-04-10",narration:"CHDFGVP1H1RG8Y/PUNJAB STATE ELECTRI",refNo:"0002642100000089",debit:20710,credit:0,balance:113193.26,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Punjab State Power Corporation (PSPCL)",categoryOrProject:"Electricity & Power Charges",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-13",date:"2026-04-10",narration:"50200026442996-TPT-HALF PYMNT ID CARDS-NAYYAR LABELS",refNo:"0000000627109407",debit:560,credit:0,balance:112633.26,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Nayyar Labels",categoryOrProject:"Office Stationery & Printing",status:"PENDING",aiConfidence:96,isAiVerified:!0},{id:"HDFC-TXN-14",date:"2026-04-10",narration:"114429028011/CCAIRTELIN",refNo:"0002642100000093",debit:1060.82,credit:0,balance:111572.44,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Bharti Airtel Ltd",categoryOrProject:"Office Internet & Utilities",status:"PENDING",detectedCard:{last4:"8830",cardNickname:"Treasury Platinum Debit",cardType:"Business Debit Card"},aiConfidence:95,isAiVerified:!0},{id:"HDFC-TXN-15",date:"2026-04-10",narration:"50200031332984-TPT-04 TO 06 2026-NETPLUS BROADBAND SERVICES PVT LTD",refNo:"0000000627467705",debit:49300,credit:0,balance:62272.44,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Netplus Broadband Services Pvt Ltd",categoryOrProject:"Office Internet & Utilities",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-16",date:"2026-04-10",narration:"IMPS-610013060118-TEKKI WEB SOLUTIONS PRIVATE LIMITED-KKBK-XXXXXX5763-IB: KOTAK 5763 TO HDFC 01",refNo:"0000610013060118",debit:0,credit:15e4,balance:212272.44,suggestedType:"TRANSFER",targetType:"TRANSFER",clientOrVendor:"Tekki Web Solutions (Kotak ••5763)",categoryOrProject:"Internal Account Transfer (Kotak to HDFC)",status:"PENDING",aiConfidence:99,isAiVerified:!0},{id:"HDFC-TXN-17",date:"2026-04-21",narration:"59208559000047-TPT-LETTER HEAD-GAGAN COLOR IMAGES",refNo:"0000000956555536",debit:2124,credit:0,balance:84732.48,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Gagan Color Images",categoryOrProject:"Printing & Corporate Stationery",status:"PENDING",aiConfidence:96,isAiVerified:!0},{id:"HDFC-TXN-18",date:"2026-04-21",narration:"K4UX64MPAF72LNGXCE/PAYUBHARTIAIRTELLIMI",refNo:"0002642111000205",debit:2356.46,credit:0,balance:82375.98,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Bharti Airtel Ltd (PayU Leased Line)",categoryOrProject:"Office Internet & Utilities",status:"PENDING",detectedCard:{last4:"4521",cardNickname:"Executive Regalia Corporate",cardType:"Corporate Credit Card"},aiConfidence:97,isAiVerified:!0},{id:"HDFC-TXN-19",date:"2026-04-22",narration:"50200026442996-TPT-SECND HALF PYMNT-NAYYAR LABELS",refNo:"0000000512414720",debit:781,credit:0,balance:81594.98,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Nayyar Labels",categoryOrProject:"Office Stationery & Printing",status:"PENDING",aiConfidence:96,isAiVerified:!0},{id:"HDFC-TXN-20",date:"2026-04-24",narration:"ACH D- PSB06091200001061-00224554",ref
1No:"0000003457643132",debit:50360,credit:0,balance:31234.98,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Punjab & Sind Bank",categoryOrProject:"Loan EMI & Commercial Finance",status:"PENDING",aiConfidence:95,isAiVerified:!0},{id:"HDFC-TXN-21",date:"2026-04-27",narration:"50200119626720-TPT-SESSION PAYMENT-BHARPUUR GROWTH",refNo:"0000000854834186",debit:5e3,credit:0,balance:26234.98,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Bharpuur Growth",categoryOrProject:"Corporate Training & Coaching",status:"PENDING",aiConfidence:95,isAiVerified:!0},{id:"HDFC-TXN-22",date:"2026-04-29",narration:"NEFT CR-KKBK0000958-TEKKI WEB SOLUTIONS PRIVATE LIMITED-TWS HDFC BANK-KKBKH26119805323",refNo:"KKBKH26119805323",debit:0,credit:15e4,balance:176234.98,suggestedType:"TRANSFER",targetType:"TRANSFER",clientOrVendor:"Tekki Web Solutions (Kotak ••531)",categoryOrProject:"Internal Account Transfer (Kotak to HDFC)",status:"PENDING",aiConfidence:99,isAiVerified:!0}],Rt=[{id:"KKBK-TXN-01",date:"2026-08-05",narration:"UPI CR-CLIENT DIRECT REMITTANCE-INV-41",refNo:"UPI2608051",debit:0,credit:45e3,balance:545e3,suggestedType:"REVENUE",targetType:"REVENUE",clientOrVendor:"Local Client Direct",categoryOrProject:"UI/UX Consultation",status:"PENDING"},{id:"KKBK-TXN-02",date:"2026-08-12",narration:"IMPS DR-OFFICE HARDWARE & LAPTOP SERVICE LUDHIANA",refNo:"IMPS882103",debit:18500,credit:0,balance:526500,suggestedType:"EXPENSE",targetType:"EXPENSE",clientOrVendor:"Tech Care Ludhiana",categoryOrProject:"IT Hardware Maintenance",status:"PENDING"}],wt=[{value:"REVENUE",label:"Revenue (Income)"},{value:"EXPENSE",label:"Expense (Expenditure)"},{value:"TRANSFER",label:"Internal Transfer"},{value:"EXCLUDE",label:"Exclude from Ledger"}],vt=[{value:"ALL",label:"All Flows"},{value:"CREDIT",label:"Credits (Revenue)"},{value:"DEBIT",label:"Debits (Expense)"},{value:"PENDING",label:"Pending Audit"},{value:"POSTED",label:"Posted to Ledger"}];function Bt({isReconcileView:s}={}){const l=et();tt();const x=at(),o=!!(s||x.pathname.includes("bank-reconcile")),f=d.useRef(null),{data:c}=rt({limit:100}),{data:w}=st({limit:500}),[N]=nt(),[L]=ot(),k=d.useMemo(()=>{const e=(c?.items??[]).map(Ct);return e.length>0?e:Pt},[c]),{isFinanceHead:Y,isExecutiveBoard:p,user:oe}=it(),A=Y||p,[T,ie]=d.useState("BA1"),[z,v]=d.useState(()=>
1S()),[Ie,J]=d.useState(!1),[u,j]=d.useState({name:"",pattern:"",targetType:"EXPENSE",clientOrVendor:"",category:"IT & Software Infrastructure",department:"Technology",team:"Core Team",taxRate:18}),[g,y]=d.useState(()=>ne.map(e=>{const a=W(e.narration,e.debit,e.credit);return{...e,targetType:e.targetType||a.targetType,clientOrVendor:e.clientOrVendor||a.clientOrVendor,categoryOrProject:e.categoryOrProject||a.categoryOrProject,department:e.department||a.department,team:e.team||a.team,taxRate:e.taxRate!==void 0?e.taxRate:a.taxRate,aiConfidence:e.aiConfidence||a.confidence,isAiVerified:e.isAiVerified!==void 0?e.isAiVerified:a.isLearned,matchedRuleName:a.matchedRule?.name}})),[O,q]=d.useState([]),[M,Fe]=d.useState(""),[D,Ve]=d.useState("ALL"),[Z,de]=d.useState(!1),[Le,le]=d.useState(!1),[Me,B]=d.useState(!1),[G,ce]=d.useState(null),[Q,pe]=d.useState(""),[me,Be]=d.useState(!1),[ue,Ge]=d.useState(!0),[X,ge]=d.useState(!1),[Xe,ee]=d.useState(""),[xe,U]=d.useState(null),[H,Ue]=d.useState({isDecrypted:!0,passwordMasked:"••••••••",rawPassword:"",bankAccount:"Primary Operations Account",accountNo:"••••0193",fileName:"Statement_Upload_Review.pdf",date:"Current Financial Period"}),h=d.useMemo(()=>k.find(e=>e.id===T)||k[0]||{bank:"Corporate Bank",account:"Primary Operations Account",accountNo:"••••0193"},[k,T]);g.length;const He=d.useMemo(()=>g.reduce((e,a)=>e+(a.credit||0),0),[g]),Ke=d.useMemo(()=>g.reduce((e,a)=>e+(a.debit||0),0),[g]),he=d.useMemo(()=>g.filter(e=>e.status==="PENDING").length,[g]),$e=d.useMemo(()=>g.filter(e=>e.status==="POSTED").length,[g]),te=d.useMemo(()=>g.filter(e=>{if(D==="CREDIT"&&e.credit<=0||D==="DEBIT"&&e.debit<=0||D==="PENDING"&&e.status!=="PENDING"||D==="POSTED"&&e.status!=="POSTED")return!1;if(M.trim()){const a=M.toLowerCase();return e.narration.toLowerCase().includes(a)||e.refNo.toLowerCase().includes(a)||!!e.chqNo&&e.chqNo.toLowerCase().includes(a)||e.clientOrVendor.toLowerCase().includes(a)||e.categoryOrProject.toLowerCase().includes(a)}return!0}),[g,D,M]),We=e=>{const a=e.target.files?.[0];if(!a)return;e.target.value="";const i=a.name.toLowerCase().endsWith(".pdf")||a.type.includes("pdf"),r=a.name.toLowerCase(),n=localStorage.getItem(`bank_statement_pwd_${T}`)||"";if(ce(a),pe(n||""),U(null),i||r.includes("statement")||r.includes("hdfc")||r.includes("tekki")||r.includes("protected")){B(!0),n?m.info(`Protected statement "${a.name}" detected. Password auto-filled from ${h.bank} profile.`):m.info(`Protected statement "${a.name}" detected. Please enter statement password to decrypt.`);return}de(!0),m.info(`Parsing "${a.name}" with Financial OCR parser & AI Knowledge Engine...`),setTimeout(()=>{const b=St(),K=`IMPORTED INWARD WIRE FROM ${a.name.toUpperCase()} - STRIVESTEAM SOLUTIONS TECH`,ae="POS 4521 DR-AWS EMEA AMAZON WEB SERVICES US-CLOUD COMPUTE",Ze=Ot(ae,b),C=W(K,0,118e3),P=W(ae,19800,0),fe=[{id:`UPLOAD-${Date.now()}-1`,date:new Date().toISOString().slice(0,10),narration:K,refNo:`OCR-${Math.floor(1e5+Math.random()*9e5)}`,debit:0,credit:118e3,balance:145e4,suggestedType:C.targetType,targetType:C.targetType,clientOrVendor:C.clientOrVendor,categoryOrProject:C.categoryOrProject,department:C.department,team:C.team,taxRate:C.taxRate,status:"PENDING",aiConfidence:C.confidence,isAiVerified:!0,matchedRuleName:C.matchedRule?.name},{id:`UPLOAD-${Date.now()}-2`,date:new Date().toISOString().slice(0,10),narration:ae,refNo:`OCR-${Math.floor(1e5+Math.random()*9e5)}`,debit:19800,credit:0,balance:1430200,suggestedType:P.targetType,targetType:P.targetType,clientOrVendor:P.clientOrVendor,categoryOrProject:P.categoryOrProject,department:P.department,team:P.team,taxRate:P.taxRate,status:"PENDING",detectedCard:Ze||{last4:"4521",cardNickname:"Executive Regalia Corporate",cardType:"Corporate Credit Card"},aiConfidence:P.confidence,isAiVerified:!0,matchedRuleName:P.matchedRule?.name}];y(Qe=>[...fe,...Qe]),de(!1),m.success(`Extracted ${fe.length} transactions from ${a.name} with AI classification auto-applied!`)},1200)},be=()=>{const e=Q.trim();if(!e){U("Please enter the statement password to decrypt this PDF.");return}ge(!0),U(null),ee("Verifying 256-bit AES cipher key against statement header..."),setTimeout(()=>{ee("Decrypting binary streams & reading statement tables..."),setTimeout(()=>{ee("Extracting 22 transactions & cross-referencing AI rules..."),setTimeout(()=>{if(ue)try{localStorage.setItem(`bank_statement_pwd_${T}`,e)}catch{}const a=ne.map(n=>{const b=W(n.narration,n.debit,n.credit);return{...n,targetType:n.targetType||b.targetType,clientOrVendor:n.clientOrVendor||b.clientOrVendor,categoryOrProject:n.categoryOrProject||b.categoryOrProject,department:n.department||b.department,team:n.team||b.team,taxR
1ate:n.taxRate!==void 0?n.taxRate:b.taxRate,aiConfidence:n.aiConfidence||b.confidence,isAiVerified:n.isAiVerified!==void 0?n.isAiVerified:b.isLearned,matchedRuleName:b.matchedRule?.name}});y(a);const i=k.find(n=>n.bank?.toLowerCase().includes("hdfc"));i&&ie(i.id);const r=e.length>3?`${e.slice(0,2)}${"•".repeat(Math.max(2,e.length-4))}${e.slice(-2)}`:"••••••";Ue({isDecrypted:!0,passwordMasked:r,rawPassword:e,bankAccount:`${h.bank} (A/C: ${h.accountNo})`,accountNo:h.accountNo,fileName:G?G.name:"Tekki_HDFC_Corporate_Statement_April_2026.pdf",date:"01/04/2026 To 30/04/2026"}),ge(!1),B(!1),ce(null),m.success(`🔓 Statement Decrypted: Extracted 22 transactions with AI Auto-Classification using password (${r})!`)},350)},350)},350)},_e=(e,a)=>{y(i=>i.map(r=>r.id===e?{...r,targetType:a}:r))},Ye=async e=>{if(e.status!=="POSTED"){if(e.targetType==="TRANSFER"||e.targetType==="EXCLUDE"){y(a=>a.map(i=>i.id===e.id?{...i,status:"POSTED",postedLedger:void 0}:i)),m.info(`Transaction ${e.refNo} marked as Internal Transfer / Excluded`);return}if(!A){y(a=>a.map(i=>i.id===e.id?{...i,status:"APPROVED"}:i)),m.success(`Entry ${e.refNo} submitted by Assistant (${oe?.name||"Tisha Verma"}). Routed to CFO Pawandeep Kaur Grewal for approval & AI learning!`);return}try{if(e.targetType==="REVENUE"){const a=Oe({client:e.clientOrVendor,project:e.categoryOrProject,entryDate:e.date,gross:e.credit,tax:0,net:e.credit,invoiceNo:e.refNo||`REV-${e.id}`,company:h.company||"Tekki Web Solutions Pvt. Ltd.",status:"Received",paymentMethod:e.detectedCard?e.detectedCard.cardType:"Bank Transfer"});await N(a).unwrap();const i=V({narration:e.narration,targetType:"REVENUE",clientOrVendor:e.clientOrVendor,categoryOrProject:e.categoryOrProject,department:e.department||"Revenue",team:e.team||"Collections",taxRate:0,credit:e.credit});v(S()),m.success(`CFO Approved: ₹${e.credit.toLocaleString("en-IN")} booked to Revenue Ledger! AI rule for "${i.pattern}" memorized.`)}else if(e.targetType==="EXPENSE"){const a=e.taxRate??18,i=Math.round(e.debit*a/100),r=Re({vendor:e.clientOrVendor,category:e.categoryOrProject,departmentName:e.department||"Operations",teamName:e.team||"Core Team",companyName:h.company||"Tekki Web Solutions Pvt. Ltd.",entryDate:e.date,gross:e.debit,taxRate:a,tax:i,net:e.debit+i,voucherNo:e.refNo||`BNK-${e.id}`,paymentMethod:e.detectedCard?e.detectedCard.cardType:"Bank Transfer",status:"Approved",description:`Bank Statement Import (${h.bank}): ${e.narration}${e.detectedCard?` [Card: ${e.detectedCard.cardNickname} ••${e.detectedCard.last4}]`:""}`});await L(r).unwrap();const n=V({narration:e.narration,targetType:"EXPENSE",clientOrVendor:e.clientOrVendor,categoryOrProject:e.categoryOrProject,department:e.department||"Operations",team:e.team||"Core Team",taxRate:a,debit:e.debit});v(S()),m.success(`CFO Approved: ₹${e.debit.toLocaleString("en-IN")} booked to Expense Ledger [${e.categoryOrProject} • ${e.department||"Operations"}]! AI pattern "${n.pattern}" memorized.`)}y(a=>a.map(i=>i.id===e.id?{...i,status:"POSTED",postedLedger:e.targetType}:i))}catch{m.error("Failed to post entry to ledger. Please verify required fields.")}}},ze=()=>{const e=g.filter(a=>a.status==="PENDING").map(a=>a.id);q(a=>a.length===e.length?[]:e)},Je=async()=>{if(O.length===0){m.info("No transactions selected.");return}const e=g.filter(r=>O.includes(r.id)&&r.status==="PENDING");if(!A){y(r=>r.map(n=>O.includes(n.id)&&n.status==="PENDING"?{...n,status:"APPROVED"}:n)),q([]),m.success(`${e.length} transaction(s) submitted by Assistant. CFO Pawandeep Kaur notified for approval.`);return}le(!0);let a=0,i=0;for(const r of e)try{if(r.targetType==="REVENUE"){const n=Oe({client:r.clientOrVendor,project:r.categoryOrProject,entryDate:r.date,gross:r.credit,tax:0,net:r.credit,invoiceNo:r.refNo||`REV-${r.id}`,company:h.company||"Tekki Web Solutions Pvt. Ltd.",status:"Received",paymentMethod:r.detectedCard?r.detectedCard.cardType:"Bank Transfer"});await N(n).unwrap(),V({narration:r.narration,targetType:"REVENUE",clientOrVendor:r.clientOrVendor,categoryOrProject:r.categoryOrProject,department:r.department,team:r.team,credit:r.credit}),a++}else if(r.targetType==="EXPENSE"){const n=r.taxRate??18,b=Math.round(r.debit*n/100),K=Re({vendor:r.clientOrVendor,category:r.categoryOrProject,departmentName:r.department||"Operations",teamName:r.team||"Core Team",companyName:h.company||"Tekki Web Solutions Pvt. Ltd.",entryDate:r.date,gross:r.debit,taxRate:n,tax:b,net:r.debit+b,voucherNo:r.refNo||`BNK-${r.id}`,paymentMethod:r.detectedCard?r.detectedCard.cardType:"Bank Transfer",status:"Approved",description:`Bank Statement Import (${h.bank}): ${r.narration}${r.detectedCard?` [Card: ${r.detectedCard.cardNickname} ••${r.detectedCard.last4}]`:""}`});await L(K).unwrap(),V({narration:r.narration,targetType:"EXPENSE",clientOrVendor:r.clientOrVendor,categoryOrProject:r.categoryOrProject,department:r.department,team:r.team,taxR
1ate:n,debit:r.debit}),i++}}catch{}v(S()),y(r=>r.map(n=>O.includes(n.id)?{...n,status:"POSTED",postedLedger:n.targetType}:n)),q([]),le(!1),m.success(`CFO Ledger Sync: Posted ${a} to Revenue & ${i} to Expense Ledger. AI rules memorized!`)},qe=d.useMemo(()=>[{key:"date",id:"date",header:"Txn Date",label:"Txn Date",width:"110px",sortable:!0,sortValue:e=>e.date,render:e=>t.jsx("span",{className:"font-semibold text-xs text-slate-800 dark:text-slate-200 whitespace-nowrap",children:ve(e.date)})},{key:"narration",id:"narration",header:"Narration / Description",label:"Narration / Description",minWidth:260,render:e=>t.jsxs("div",{className:"space-y-1 py-0.5",children:[t.jsx("span",{className:"font-medium text-xs text-slate-900 dark:text-slate-100 line-clamp-2 leading-relaxed",children:e.narration}),t.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.detectedCard&&t.jsxs(R,{variant:"outline",className:"text-[10px] bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300 border-indigo-200 dark:border-indigo-800 gap-1 py-0 px-1.5 font-medium",children:[t.jsx(dt,{className:"w-2.5 h-2.5 text-indigo-600 dark:text-indigo-400"}),t.jsxs("span",{children:[e.detectedCard.cardNickname," (••",e.detectedCard.last4,")"]})]}),e.isAiVerified&&t.jsxs(R,{variant:"outline",title:e.matchedRuleName?`Learned Rule: ${e.matchedRuleName} (${e.department||"Operations"})`:"AI Inferred from Corporate Knowledge Base",className:"text-[10px] bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300 border-emerald-200 dark:border-emerald-800 gap-1 py-0 px-1.5 font-medium",children:[t.jsx($,{className:"w-2.5 h-2.5 text-emerald-600 dark:text-emerald-400"}),t.jsxs("span",{children:["AI Auto-Filled (",e.aiConfidence||98,"%)"]})]})]})]})},{key:"refNo",id:"refNo",header:"Chq / Ref No",label:"Chq / Ref No",width:"135px",render:e=>{const a=!!(e.chqNo||e.refNo?.toLowerCase().startsWith("chq")||e.refNo&&e.refNo.length<=8&&/^\d+$/.test(e.refNo)&&!e.refNo.startsWith("0000"));return t.jsx("div",{className:"flex flex-col text-xs",children:a?t.jsx("span",{className:"font-semibold text-blue-700 dark:text-blue-300",children:e.chqNo?`Chq #${e.chqNo}`:`Chq #${e.refNo}`}):t.jsx("span",{className:"text-slate-700 dark:text-slate-300 font-medium truncate max-w-[130px]",title:e.refNo,children:e.refNo||"—"})})}},{key:"valueDate",id:"valueDate",header:"Value Date",label:"Value Date",width:"110px",sortable:!0,sortValue:e=>e.valueDate||e.date,render:e=>t.jsx("span",{className:"font-medium text-xs text-slate-600 dark:text-slate-400 whitespace-nowrap",children:ve(e.valueDate||e.date)})},{key:"debit",id:"debit",header:"Withdrawal (Debit ₹)",label:"Withdrawal (Debit ₹)",width:"140px",align:"right",sortable:!0,sortValue:e=>e.debit,render:e=>e.debit>
10?t.jsxs("span",{className:"font-bold text-xs text-rose-600 dark:text-rose-400 whitespace-nowrap",children:["₹",I(e.debit)]}):t.jsx("span",{className:"text-muted-foreground/30 text-xs",children:"—"})},{key:"credit",id:"credit",header:"Deposit (Credit ₹)",label:"Deposit (Credit ₹)",width:"140px",align:"right",sortable:!0,sortValue:e=>e.credit,render:e=>e.credit>0?t.jsxs("span",{className:"font-bold text-xs text-emerald-600 dark:text-emerald-400 whitespace-nowrap",children:["₹",I(e.credit)]}):t.jsx("span",{className:"text-muted-foreground/30 text-xs",children:"—"})},{key:"balance",id:"balance",header:"Closing Balance (₹)",label:"Closing Balance (₹)",width:"145px",align:"right",sortable:!0,sortValue:e=>e.balance,render:e=>t.jsxs("span",{className:"font-bold text-xs text-slate-800 dark:text-slate-200 whitespace-nowrap",children:["₹",I(e.balance)]})},{key:"targetType",id:"targetType",header:"Classification",label:"Classification",width:"175px",render:e=>t.jsx(re,{value:e.targetType,onChange:a=>_e(e.id,a),disabled:e.status==="POSTED",options:wt,placeholder:"Select Flow...",searchPlaceholder:"Search flow...",triggerClassName:"h-7 text-xs font-medium",enableEditDeleteAdd:!1})},{key:"clientOrVendor",id:"clientOrVendor",header:"Target Entity / Category",label:"Target Entity / Category",minWidth:180,render:e=>t.jsxs("div",{className:"space-y-0.5",children:[t.jsx("span",{className:"font-semibold text-xs text-foreground block truncate max-w-[200px]",title:e.clientOrVendor,children:e.clientOrVendor}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[t.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[130px]",title:e.categoryOrProject,children:e.categoryOrProject}),e.department&&t.jsxs("span",{className:"text-[10px] text-purple-600 dark:text-purple-400 font-medium",children:["• ",e.department]})]})]})},{key:"status",id:"status",header:o?"Audit Match":"Status",label:o?"Audit Match":"Status",width:"125px",align:"center",render:e=>e.status==="POSTED"?t.jsxs(R,{variant:"outline",className:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300 border-emerald-200 dark:border-emerald-800 gap-1 py-0.5 text-[10px] font-bold",children:[t.jsx(lt,{className:"w-3 h-3 text-emerald-600"})," ",o?"Reconciled":"Posted"]}):e.status==="APPROVED"?t.jsxs(R,{variant:"outline",className:"bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300 border-indigo-200 dark:border-indigo-800 gap-1 py-0.5 text-[10px] font-bold",children:[t.jsx(Ne,{className:"w-3 h-3 text-indigo-600"})," ",o?"Verified":"Awaiting CFO"]}):t.jsxs(R,{variant:"outline",className:"bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-300 border-amber-200 dark:border-amber-800 gap-1 py-0.5 text-[10px] font-bold",children:[t.jsx(Ne,{className:"w-3 h-3 text-amber-600"})," ",o?"Pending Match":"Pending Audit"]})},{key:"actions",id:"actions",header:"Action",label:"Action",width:"125px",align:"right",fixed:"right",render:e=>{if(e.status==="POSTED")return t.jsx("span",{className:"text-[11px] text-muted-foreground font-medium italic",children:o?"Matched with Ledger":`In ${e.postedLedger||"Ledger"}`});if(e.status==="APPROVED"&&!A)return t.jsx("span",{className:"text-[11px] text-indigo-600 dark:text-indigo-400 font-semibold italic",children:"Submitted"});const a=e.credit>0;return t.jsxs(E,{size:"sm",onClick:()=>Ye(e),className:se("h-7 px-2.5 rounded-md font-semibold text-xs gap-1 transition-colors shadow-2xs cursor-pointer",A?a?"bg-emerald-600 hover:bg-emerald-700 text-white":"bg-rose-600 hover:bg-rose-700 text-white":"bg-indigo-600 hover:bg-indigo-700 text-white"),children:[t.jsx(Ee,{className:"w-3.5 h-3.5"}),t.jsx("span",{children:o?"Reconcile":A?"Approve & Post":"Approve"})]})}}],[A,o]);return t.jsxs("div",{className:"flex flex-col flex-1 h-full min-h-0 overflow-y-auto overflow-x-hidden custom-scrollbar bg-slate-50/50 dark:bg-slate-950/50",children:[t.jsx(ct,{title:o?"Bank Reconciliation & Statement Audit Desk":"Bank Statement Import & Ingestion Desk",subtitle:o?"Reconcile corporate bank statement transactions against ERP General Ledgers with automated balance verification and CFO sign-off.":"Ingest corporate bank statements (PDF, Excel, CSV), verify parsed particulars, and approve postings directly to ledgers.",accentVar:"--mod-finance",showMonthYearFilter:!1,actions:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(ye,{to:`${l}/bank-accounts`,className:"h-8 px-3 rounded-md border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 hover:bg-slate-50 dark:hover:bg-slate-800 text-xs font-semibold text-slate-700 dark:text-slate-200 inline-flex items-center gap-1.5 transition-colors shadow-2xs cursor-pointer",children:[t.jsx(pt,{className:"w-3.5 h-3.5"})," Back to Bank Accounts"]}),t.jsx(ye,{to:o?`${l}/bank-accounts/import`:`${l}/bank-reconcile`,className:se("h-8 px-3.5 rounded-md text-xs font-semibold inline-flex items-center gap-1.5 transition-colors shadow-2xs cursor-pointer",o?"border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 hover:bg-slate-50 dark:hover:bg-slate-800 text-slate-700 dark:text-slate-200":"bg-blue-600 hover:bg-blue-700 text-white"),children:o?t.jsxs(t.Fragment,{children:[t.jsx(Te,{className:"w-3.5 h-3.5 text-emerald-600"}),t.jsx("span",{children:"Statement Import"})]}):t.jsxs(t.Fragment,{children:[t.jsx(we,{className:"w-3.5 h-3.5"}),t.jsx("span",{children:"Bank Reconciliation"})]})})]})}),t.jsxs("div",{className:"p-3.5 pb-20 space-y-3",children:[t.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl px-3.5 py-2.5 shadow-2xs flex flex-col md:flex-row md:items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-blue-50 dark:bg-blue-950/60 border border-blue-200 dark:border-blue-800 text-blue-600 flex items-center justify-center shrink-0",children:t.jsx(mt,{className:"w-4 h-4"})}),t.jsxs("div",{className:"min-w-0 flex-1 flex flex-col sm:flex-row sm:items-center gap-1 sm:gap-3",children:[t.jsx("span",{className:"text-xs font-bold text-slate-800 dark:text-slate-200 shrink-0",children:"Corporate Account:"}),t.jsx("div",{className:"w-full sm:w-80",children:t.jsx(re,{options:k.map(e=>({label:`${e.bank} - ${e.account} (${e.accountNo})`,value:e.id})),value:T,onChange:e=>{ie(e),k.find(i=>i.id===e)?.bank?.toLowerCase().includes("kotak")?y(Rt):y(ne)},placeholder:"Select Target Bank Account",searchPlaceholder:"Type bank or account number...",triggerClassName:"h-8 text-xs font-semibold",enableEditDeleteAdd:!1})}),t.jsxs("span",{className:"text-[11px] text-muted-foreground hidden lg:inline truncate",children:["A/C: ",t.jsx("span",{className:"font-semibold text-foreground",children:h.accountNo})," • ",h.bank]})]})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[t.jsx("input",{ref:f,type:"file",accept:".pdf,.xlsx,.xls,.csv",onChange:We,className:"hidden"}),t.jsxs(E,{type:"button",onClick:()=>f.current?.click(),disabled:Z,className:"h-8 px-3.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold text-xs shadow-2xs inline-flex items-center gap-1.5 cursor-pointer transition-colors",children:[t.jsx(Te,{className:"w-3.5 h-3.5"}),t.jsx("span",{children:Z?"Parsing OCR Data...":"Upload Bank Statement (PDF/Excel/CSV)"})]})]})]}),H&&t.jsx("div",{className:"px-3.5 py-2 bg-emerald-50/70 dark:bg-emerald-950/30 border border-emerald-200/60 dark:border-emerald-800/40 rounded-lg flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 text-xs",children:t.jsxs("div",{className:"flex items-center gap-2 text-emerald-800 dark:text-emerald-300",children:[t.jsx(ut,{className:"w-4 h-4 text-emerald-600 shrink-0"}),t.jsxs("div",{children:[t.jsx("span",{className:"font-bold",children:"Decrypted PDF Statement Active:"})," ",t.jsxs("span",{className:"text-[11px] text-emerald-700 dark:text-emerald-400",children:["File: ",t.jsx("span",{className:"font-semibold text-foreground",children:H.fileName})," • Account: ",t.jsx("span",{className:"font-semibold",children:H.accountNo})," • Period: ",t.jsx("span",{className:"font-semibold",children:H.date})]})]})]})}),t.jsxs("div",{className:"bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-xl shadow-xs overflow-hidden",children:[t.jsxs("div",{className:"px-4 py-2.5 border-b border-border flex flex-col md:flex-row md:items-center justify-between gap-3 bg-slate-50/50 dark:bg-slate-900/50",children:[t.jsxs("div",{className:"flex items-center gap-2.5 shrink-0",children:[t.jsx("div",{className:"w-7 h-7 rounded-lg bg-indigo-50 dark:bg-indigo-950/60 border border-indigo-200 dark:border-indigo-800 text-indigo-600 flex items-center justify-center shrink-0",children:o?t.jsx(we,{className:"w-3.5 h-3.5"}):t.jsx(gt,{className:"w-3.5 h-3.5"})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-slate-800 dark:text-slate-200",children:o?"Bank Reconciliation Ledger":"Statement Transactions & Ingestion Ledger"}),t.jsxs("span",{className:"text-[11px] text-muted-foreground font-semibold",children:["(",te.length," entries)"]}
1)]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsxs("div",{className:"relative w-full sm:w-60",children:[t.jsx(xt,{className:"w-3.5 h-3.5 text-muted-foreground absolute left-2.5 top-1/2 -translate-y-1/2"}),t.jsx("input",{type:"text",value:M,onChange:e=>Fe(e.target.value),placeholder:"Search narration, chq, ref...",className:"w-full h-8 pl-8 pr-2.5 rounded-md border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-800/80 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-blue-500"})]}),t.jsx(re,{value:D,onChange:Ve,options:vt,placeholder:"Filter Flow",searchPlaceholder:"Search flow...",triggerClassName:"h-8 w-36 text-xs font-medium",enableEditDeleteAdd:!1}),t.jsxs(E,{variant:"outline",size:"sm",onClick:()=>J(!0),className:"h-8 px-2.5 text-xs font-semibold border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer shadow-2xs gap-1.5 shrink-0",title:"View and manage learned AI classification rules",children:[t.jsx($,{className:"w-3.5 h-3.5 text-purple-600 dark:text-purple-400"}),t.jsxs("span",{children:["AI Rules (",z.length,")"]})]}),O.length>0&&t.jsxs(E,{size:"sm",onClick:Je,disabled:Le,className:"h-8 px-2.5 text-xs font-bold bg-blue-600 hover:bg-blue-700 text-white gap-1.5 shadow-2xs cursor-pointer shrink-0",children:[t.jsx(Ee,{className:"w-3.5 h-3.5"}),A?`Approve (${O.length})`:`Approve (${O.length})`]}),t.jsxs(E,{variant:"outline",size:"sm",onClick:ze,className:"h-8 px-2.5 text-xs font-semibold border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer shadow-2xs shrink-0",children:["Select Pending (",he,")"]})]})]}),t.jsx("div",{className:"w-full",children:t.jsx(ht,{rows:te,columns:qe,rowKey:e=>e.id,loading:Z,initialPageSize:15,storageKey:"bank-statement-import-table"})}),t.jsxs("div",{className:"border-t border-border bg-slate-50/90 dark:bg-slate-900/90 px-4 py-2.5 flex flex-wrap items-center justify-between gap-3 text-xs",children:[t.jsxs("div",{className:"flex items-center gap-4 text-muted-foreground",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-bold text-slate-700 dark:text-slate-300",children:"Total Entries:"}),t.jsxs("span",{className:"font-semibold text-foreground",children:[te.length," txns"]})]}),t.jsx("span",{className:"text-slate-300 dark:text-slate-700",children:"|"}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-bold text-slate-700 dark:text-slate-300",children:"Sync Status:"}),t.jsxs("span",{className:"font-semibold text-amber-600 dark:text-amber-400",children:[he," Pending"]}),t.jsx("span",{className:"text-muted-foreground",children:"/"}),t.jsxs("span",{className:"font-semibold text-emerald-600 dark:text-emerald-400",children:[$e," Synced"]})]})]}),t.jsxs("div",{className:"flex flex-wrap items-center gap-4 sm:gap-6",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-medium text-muted-foreground",children:"Total Withdrawals (Dr):"}
1),t.jsxs("span",{className:"font-bold text-xs text-rose-600 dark:text-rose-400",children:["₹",I(Ke)]})]}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{className:"font-medium text-muted-foreground",children:"Total Deposits (Cr):"}),t.jsxs("span",{className:"font-bold text-xs text-emerald-600 dark:text-emerald-400",children:["₹",I(He)]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 pl-2 sm:pl-3 border-l border-border",children:[t.jsx("span",{className:"font-medium text-muted-foreground",children:"Closing Balance:"}),t.jsxs("span",{className:"font-bold text-xs text-slate-900 dark:text-slate-100",children:["₹",I(g[g.length-1]?.balance||0)]})]})]})]})]})]}),t.jsx(Ce,{open:Me,onOpenChange:B,children:t.jsxs(Pe,{className:"max-w-md p-0 gap-0 overflow-hidden rounded-2xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-xl",children:[t.jsxs("div",{className:"p-4 border-b border-slate-100 dark:border-slate-800 flex items-center gap-3",children:[t.jsx("div",{className:"w-9 h-9 rounded-xl bg-blue-50 dark:bg-blue-950/60 border border-blue-200 dark:border-blue-800 text-blue-600 flex items-center justify-center shrink-0",children:t.jsx(bt,{className:"w-4 h-4"})}),t.jsxs("div",{children:[t.jsx(Se,{className:"text-sm font-bold text-foreground",children:"Unlock Statement PDF"}),t.jsx(ke,{className:"text-[11px] text-muted-foreground",children:"Enter statement password or Customer ID to decrypt and extract OCR particulars."})]})]}),t.jsxs("div",{className:"p-4 space-y-3.5",children:[t.jsxs("div",{className:"p-3 rounded-lg border border-slate-200 dark:border-slate-800 bg-slate-50/70 dark:bg-slate-800/40 text-xs space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-muted-foreground font-medium",children:"Target Account"}),t.jsxs("span",{className:"font-semibold text-foreground",children:[h.bank," (••",h.accountNo?.slice(-4)||"0193",")"]})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-muted-foreground font-medium",children:"Statement File"}),t.jsx("span",{className:"text-slate-700 dark:text-slate-300 font-medium truncate max-w-[200px]",children:G?G.name:"Bank_Statement_Document.pdf"})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-semibold text-slate-700 dark:text-slate-300",children:"Statement Password"}),t.jsxs("div",{className:"relative",children:[t.jsx("input",{type:me?"text":"password",value:Q,onChange:e=>{pe(e.target.value),U(null)},onKeyDown:e=>{e.key==="Enter"&&be()},placeholder:"Enter 8-digit Customer ID or statement password...",className:"w-full h-9 pl-3 pr-9 rounded-lg border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-800/80 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-blue-500",autoFocus:!0}),t.jsx("button",{type:"button",onClick:()=>Be(e=>!e),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-slate-400 hover:text-slate-600 dark:hover:text-slate-200 cursor-pointer",children:me?t.jsx(ft,{className:"w-4 h-4"}):t.jsx(Nt,{className:"w-4 h-4"})})]})]}),t.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none text-xs text-muted-foreground",children:[t.jsx("input",{type:"checkbox",checked:ue,onChange:e=>Ge(e.target.checked),className:"w-3.5 h-3.5 rounded border-slate-300 text-blue-600 focus:ring-blue-500"}),t.jsx("span",{children:"Remember password for auto-unlocking subsequent statements"})]}),X&&t.jsxs("div",{className:"p-2.5 rounded-lg border border-blue-200 dark:border-blue-900 bg-blue-50/50 dark:bg-blue-950/20 text-xs flex items-center gap-2 text-blue-700 dark:text-blue-300",children:[t.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"}),t.jsx("span",{children:Xe})]}),xe&&t.jsxs("div",{className:"p-2.5 rounded-lg border border-rose-200 dark:border-rose-900 bg-rose-50/50 dark:bg-rose-950/20 text-xs flex items-center gap-2 text-rose-700 dark:text-rose-400 font-medium",children:[t.jsx(Et,{className:"w-3.5 h-3.5 shrink-0"}),t.jsx("span",{children:xe})]})]}
1),t.jsxs(je,{className:"px-4 py-3 border-t border-slate-100 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/50 flex items-center justify-end gap-2",children:[t.jsx(E,{type:"button",variant:"outline",onClick:()=>B(!1),disabled:X,className:"h-8 px-3 text-xs font-semibold cursor-pointer",children:"Cancel"}),t.jsx(E,{type:"button",onClick:be,disabled:X||!Q.trim(),className:"h-8 px-3.5 bg-blue-600 hover:bg-blue-700 text-white font-semibold text-xs shadow-2xs inline-flex items-center gap-1.5 cursor-pointer disabled:opacity-50",children:X?t.jsxs(t.Fragment,{children:[t.jsx(Ae,{className:"w-3.5 h-3.5 animate-spin"})," Decrypting..."]}):t.jsxs(t.Fragment,{children:[t.jsx(kt,{className:"w-3.5 h-3.5"})," Unlock & Extract Data"]})})]})]})}),t.jsx(Ce,{open:Ie,onOpenChange:J,children:t.jsxs(Pe,{className:"max-w-3xl p-0 gap-0 overflow-hidden rounded-2xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 shadow-2xl",children:[t.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-slate-50/70 dark:bg-slate-800/40",children:[t.jsxs("div",{className:"flex items-center gap-2.5",children:[t.jsx("div",{className:"w-8 h-8 rounded-lg bg-purple-50 dark:bg-purple-950/60 border border-purple-200 dark:border-purple-800 text-purple-600 flex items-center justify-center shrink-0",children:t.jsx($,{className:"w-4 h-4"})}),t.jsxs("div",{children:[t.jsxs(Se,{className:"text-sm font-bold text-foreground",children:["Bank Ingestion AI Rules & Knowledge Engine (",z.length," Rules)"]}),t.jsx(ke,{className:"text-[11px] text-muted-foreground",children:"AI memorizes classifications from CFO approvals. Future statement uploads auto-fill Category, Department, Team, and GST tax settings."})]})]}),t.jsxs(E,{size:"sm",variant:"outline",onClick:()=>{const e=jt();v(e),m.success("AI rules reset to corporate benchmarks.")},className:"h-7 px-2.5 text-xs font-semibold border-slate-200 dark:border-slate-700 hover:bg-slate-100 dark:hover:bg-slate-800 gap-1 cursor-pointer",children:[t.jsx(yt,{className:"w-3 h-3 text-muted-foreground"})," Reset Benchmarks"]})]}),t.jsxs("div",{className:"p-4 max-h-[60vh] overflow-y-auto space-y-3 custom-scrollbar",children:[t.jsxs("div",{className:"p-3 rounded-xl border border-dashed border-purple-200 dark:border-purple-900/60 bg-purple-50/30 dark:bg-purple-950/20 space-y-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs font-bold text-purple-900 dark:text-purple-200 flex items-center gap-1.5",children:[t.jsx($,{className:"w-3.5 h-3.5 text-purple-600"})," Add Custom Auto-Categorization Rule"]}),t.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Match words in Narration"})]}),t.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-2",children:[t.jsxs("div",{children:[t.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground block mb-0.5",children:"Narration Keyword(s)"}),t.jsx("input",{type:"text",placeholder:"e.g. AWS, GOOGLE, PSPCL",value:u.pattern,onChange:e=>j(a=>({...a,pattern:e.target.value})),className:"w-full h-7 px-2 text-xs rounded border border-border bg-white dark:bg-slate-800"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground block mb-0.5",children:"Party / Vendor Name"}),t.jsx("input",{type:"text",placeholder:"e.g. Amazon Web Services",value:u.clientOrVendor,onChange:e=>j(a=>({...a,clientOrVendor:e.target.value})),className:"w-full h-7 px-2 text-xs rounded border border-border bg-white dark:bg-slate-800"})]}),t.jsxs("div",{children:[t.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground block mb-0.5",children:"Category"}),t.jsx("input",{type:"text",placeholder:"e.g. IT & Software Infrastructure",value:u.category,onChange:e=>j(a=>({...a,category:e.target.value})),className:"w-full h-7 px-2 text-xs rounded border border-border bg-white dark:bg-slate-800"})]})]}),t.jsxs("div",{className:"flex items-center justify-between pt-1",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs("select",{value:u.targetType,onCh
1ange:e=>j(a=>({...a,targetType:e.target.value})),className:"h-7 px-2 text-xs rounded border border-border bg-white dark:bg-slate-800 font-semibold",children:[t.jsx("option",{value:"EXPENSE",children:"Debit (Expense)"}),t.jsx("option",{value:"REVENUE",children:"Credit (Revenue)"}),t.jsx("option",{value:"TRANSFER",children:"Internal Transfer"})]}),t.jsxs("select",{value:u.department,onChange:e=>j(a=>({...a,department:e.target.value})),className:"h-7 px-2 text-xs rounded border border-border bg-white dark:bg-slate-800 font-medium",children:[t.jsx("option",{value:"Technology",children:"Technology"}),t.jsx("option",{value:"Operations",children:"Operations"}),t.jsx("option",{value:"Administration",children:"Administration"}),t.jsx("option",{value:"Human Resources",children:"Human Resources"}),t.jsx("option",{value:"Finance",children:"Finance"}),t.jsx("option",{value:"Revenue",children:"Revenue"})]}),t.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[t.jsx("span",{className:"text-muted-foreground text-[10px]",children:"GST:"}),t.jsxs("select",{value:u.taxRate,onChange:e=>j(a=>({...a,taxRate:Number(e.target.value)})),className:"h-7 px-1.5 text-xs rounded border border-border bg-white dark:bg-slate-800",children:[t.jsx("option",{value:0,children:"0%"}),t.jsx("option",{value:5,children:"5%"}),t.jsx("option",{value:12,children:"12%"}),t.jsx("option",{value:18,children:"18%"}),t.jsx("option",{value:28,children:"28%"})]})]})]}),t.jsx(E,{size:"sm",onClick:()=>{if(!u.pattern||!u.clientOrVendor){m.error("Please provide keyword pattern and vendor/client name");return}const e=V({narration:u.pattern,targetType:u.targetType,clientOrVendor:u.clientOrVendor,categoryOrProject:u.category,department:u.department,team:u.team,taxRate:u.taxRate});v(S()),j({name:"",pattern:"",targetType:"EXPENSE",clientOrVendor:"",category:"IT & Softw
1are Infrastructure",department:"Technology",team:"Core Team",taxRate:18}),m.success(`Rule for "${e.pattern}" created successfully!`)},className:"h-7 px-3 bg-purple-600 hover:bg-purple-700 text-white font-semibold text-xs cursor-pointer",children:"Save Rule"})]})]}),t.jsx("div",{className:"space-y-2",children:z.map(e=>t.jsxs("div",{className:"p-3 rounded-xl border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-800/50 flex flex-col sm:flex-row sm:items-center justify-between gap-2 shadow-2xs hover:border-purple-500/40 transition-colors",children:[t.jsxs("div",{className:"min-w-0 space-y-0.5",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("span",{className:"font-mono text-xs font-bold text-foreground bg-slate-100 dark:bg-slate-800 px-1.5 py-0.5 rounded border border-border",children:e.pattern}),t.jsx(R,{variant:"outline",className:se("text-[9px] py-0 px-1 font-bold",e.targetType==="REVENUE"?"bg-emerald-50 text-emerald-700 border-emerald-200 dark:bg-emerald-950 dark:text-emerald-300":e.targetType==="EXPENSE"?"bg-rose-50 text-rose-700 border-rose-200 dark:bg-rose-950 dark:text-rose-300":"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-950 dark:text-blue-300"),children:e.targetType}),t.jsx(R,{variant:"outline",className:"text-[9px] py-0 px-1 font-semibold text-purple-700 dark:text-purple-300 border-purple-200 dark:border-purple-800 bg-purple-50 dark:bg-purple-950/50",children:e.learnedFromCFO?"CFO Trained":"Benchmark"}),t.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.matchCount," entries auto-filled"]})]}),t.jsxs("div",{className:"text-xs",children:[t.jsx("span",{className:"font-bold text-foreground",children:e.clientOrVendor})," •"," ",t.jsx("span",{className:"text-muted-foreground",children:e.category})," •"," ",t.jsxs("span",{className:"font-semibold text-slate-700 dark:text-slate-300",children:[e.department||"Operations"," (",e.team||"General",")"]})," •"," ",t.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400 font-medium",children:["GST ",e.taxRate,"%"]})]})]}),t.jsx(E,{size:"sm",variant:"outline",onClick:()=>{At(e.id),v(S()),m.info(`Deleted rule "${e.name}"`)},className:"h-7 px-2 text-rose-600 border-rose-200 dark:border-rose-900 hover:bg-rose-50 dark:hover:bg-rose-950/50 cursor-pointer shrink-0 self-end sm:self-center",title:"Delete rule",children:t.jsx(Tt,{className:"w-3 h-3"})})]},e.id))})]}),t.jsx(je,{className:"p-3 border-t border-border bg-slate-50/50 dark:bg-slate-900/50 flex justify-end",children:t.jsx(E,{variant:"outline",size:"sm",onClick:()=>J(!1),className:"h-8 px-3 text-xs font-semibold cursor-pointer",children:"Close"})})]})})]})}export{Bt as BankStatementsImportPage,Bt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.