import{t as e}from"./createLucideIcon-CPi6oOk3.js";import{_ as t}from"./vendor-flow-IzlrcDx6.js";import{rn as n}from"./index-HkVQGc9M.js";import{t as r}from"./format-DOnLYpxL.js";var i=e(`gift`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M20 11v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8`,key:`1sqzm4`}],[`path`,{d:`M7.5 7a1 1 0 0 1 0-5A4.8 8 0 0 1 12 7a4.8 8 0 0 1 4.5-5 1 1 0 0 1 0 5`,key:`kc0143`}],[`rect`,{x:`3`,y:`7`,width:`18`,height:`4`,rx:`1`,key:`1hberx`}]]),a=t();function o({credit_limit:e,outstanding:t,available:i,after_order:o,exceeds:s,className:c}){let l=Number(e)||0,u=Number(t)||0,d=l>0?Math.min(100,u/l*100):0;return l<=0?null:(0,a.jsxs)(`div`,{className:n(`rounded-[var(--radius-card)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3.5`,c),children:[(0,a.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2 mb-2`,children:[(0,a.jsx)(`span`,{className:`text-[11px] font-bold uppercase tracking-[0.06em] text-[var(--color-text-muted)]`,children:`Credit`}),(0,a.jsxs)(`span`,{className:`text-[11.5px] text-[var(--color-text-muted)] tabular-nums`,children:[r(u),` of `,r(l),` used`]})]}),(0,a.jsx)(`div`,{className:`h-2 rounded-full bg-[var(--color-border-light)] overflow-hidden`,children:(0,a.jsx)(`div`,{className:n(`h-full rounded-full transition-[width]`,d>=100?`bg-[var(--color-error)]`:d>=80?`bg-[var(--color-warning)]`:`bg-[var(--color-success)]`),style:{width:`${d}%`}})}),(0,a.jsxs)(`div`,{className:`mt-2 flex items-baseline justify-between gap-2`,children:[(0,a.jsx)(`span`,{className:`text-[12px] text-[var(--color-text-secondary)]`,children:`Available`}),(0,a.jsx)(`span`,{className:`text-[13px] font-bold tabular-nums text-[var(--color-text-primary)]`,children:r(i)})]}),o!==void 0&&(0,a.jsxs)(`div`,{className:`mt-1 flex items-baseline justify-between gap-2`,children:[(0,a.jsx)(`span`,{className:`text-[12px] text-[var(--color-text-secondary)]`,children:`After this order`}),(0,a.jsx)(`span`,{className:n(`text-[13px] font-bold tabular-nums`,s?`text-[var(--color-error)]`:`text-[var(--color-text-primary)]`),children:r(o)})]}),s&&(0,a.jsx)(`p`,{className:`mt-2 text-[11.5px] text-[var(--color-warning)] leading-snug`,children:`Over the credit limit. The order can still be placed — it will go to a manager for approval.`})]})}export{i as n,o as t};