import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{$ as t}from"./vendor-charts-iXlq6Rne.js";import{u as n}from"./vendor-react-Dzc9WstK.js";import{t as r}from"./info-CKXMLsCK.js";import{_ as i}from"./vendor-flow-IzlrcDx6.js";import{Sn as a,rn as o}from"./index-HkVQGc9M.js";var s=e(t(),1),c=i(),l=[{to:`/admin/payments`,label:`Received`,end:!0},{to:`/admin/payments/cheques`,label:`Cheques`},{to:`/admin/payments/online`,label:`Online`}];function u({actions:e,toolbar:t,children:r}){return(0,c.jsxs)(`div`,{className:`-m-4 flex h-[calc(100vh-3.5rem)] flex-col bg-[var(--color-surface)] lg:-m-7`,children:[(0,c.jsxs)(`header`,{className:`flex h-12 flex-shrink-0 items-center gap-4 border-b border-[var(--color-border)] px-4 lg:px-6`,children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,c.jsx)(`h1`,{className:`text-[15px] font-bold tracking-[-0.01em] text-[var(--color-text-primary)]`,children:`Payments`}),(0,c.jsx)(d,{})]}),(0,c.jsx)(`nav`,{className:`flex min-w-0 items-center gap-0.5 overflow-x-auto`,children:l.map(e=>(0,c.jsx)(n,{to:e.to,end:e.end,className:({isActive:e})=>o(`whitespace-nowrap rounded-md px-2.5 py-1.5 text-[12.5px] font-medium transition-colors`,e?`bg-[var(--color-accent-soft)] text-[var(--color-accent-ink)]`:`text-[var(--color-text-muted)] hover:bg-[var(--color-background)] hover:text-[var(--color-text-primary)]`),children:e.label},e.to))}),e&&(0,c.jsx)(`div`,{className:`ml-auto flex flex-shrink-0 items-center gap-2`,children:e})]}),t&&(0,c.jsx)(`div`,{className:`flex flex-shrink-0 flex-wrap items-center gap-2 border-b border-[var(--color-border)] bg-[var(--color-background)] px-4 py-2 lg:px-6`,children:t}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:r})]})}function d(){let[e,t]=(0,s.useState)(!1),n=(0,s.useRef)(null);return(0,s.useEffect)(()=>{if(!e)return;let r=e=>{n.current&&!n.current.contains(e.target)&&t(!1)},i=e=>e.key===`Escape`&&t(!1);return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i)}},[e]),(0,c.jsxs)(`div`,{ref:n,className:`relative`,children:[(0,c.jsx)(`button`,{type:`button`,onClick:()=>t(e=>!e),"aria-label":`How payments work`,"aria-expanded":e,className:o(`flex h-5 w-5 items-center justify-center rounded-full transition-colors`,e?`bg-[var(--color-accent-soft)] text-[var(--color-accent-ink)]`:`text-[var(--color-text-muted)] hover:bg-[var(--color-background)] hover:text-[var(--color-text-primary)]`),children:(0,c.jsx)(r,{className:`h-3.5 w-3.5`})}),e&&(0,c.jsxs)(`div`,{className:`absolute left-0 top-7 z-50 w-[420px] rounded-[var(--radius-card)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4 shadow-lg`,children:[(0,c.jsxs)(`div`,{className:`mb-2 flex items-start justify-between gap-2`,children:[(0,c.jsx)(`p`,{className:`text-[13px] font-semibold text-[var(--color-text-primary)]`,children:`What credits a customer`}),(0,c.jsx)(`button`,{type:`button`,onClick:()=>t(!1),className:`text-[var(--color-text-muted)] hover:text-[var(--color-text-primary)]`,"aria-label":`Close`,children:(0,c.jsx)(a,{className:`h-3.5 w-3.5`})})]}),(0,c.jsx)(`ul`,{className:`space-y-1.5`,children:[[`Cash, UPI, a bank transfer`,`Credits the ledger the moment you record it. It is money.`],[`A cheque`,`Taken today, cleared later — or bounced. What it does to the balance on the day you take it is a setting.`],[`An online payment`,`Written by the gateway, never keyed in. Nobody can type one into a form.`],[`A payment recorded wrongly`,`Is cancelled, not deleted. A contra debit posts and the receipt still stands.`]].map(([e,t])=>(0,c.jsxs)(`li`,{className:`text-[12px] leading-snug`,children:[(0,c.jsx)(`span`,{className:`font-medium text-[var(--color-text-primary)]`,children:e}),(0,c.jsxs)(`span`,{className:`text-[var(--color-text-muted)]`,children:[` — `,t]})]},e))}),(0,c.jsx)(`div`,{className:`mt-3 border-t border-[var(--color-border-light)] pt-2.5`,children:(0,c.jsxs)(`p`,{className:`text-[12px] leading-relaxed text-[var(--color-text-muted)]`,children:[(0,c.jsx)(`strong`,{className:`text-[var(--color-text-primary)]`,children:`A receipt is not a credit.`}),` `,`Every row here has a status, and only some of them have moved a balance. That is the whole point of the distinction: a cheque in a drawer frees up no credit line, and a distributor who orders against one is ordering against paper.`]})})]})]})}export{u as t};