1import{c as xe,n as Ze,r as m,o as ue,j as e,B as D,e as pe,h as R,i as Q,b as Qe,d as et,L as ee,t as U,R as tt,l as st,s as nt,p as rt,S as ge,X as ot}from"./main-BGPPHxHM.js";import{B as at}from"./badge-zEFINaEp.js";import{L as S}from"./label-Cs-fnIPW.js";import{I as k}from"./input-D0ZnlPy7.js";import{T as it}from"./truck-C9R0Zl7k.js";import{T as lt}from"./textarea-C1GjMsvY.js";import{P as E,u as be,a as C,b as ve,e as ye,c as je}from"./index-D3F3hwE6.js";import{P as ct}from"./index-CDLVY2j6.js";import{C as dt}from"./check-Cx29d-FE.js";import{i as we,S as X,a as q,b as W,c as J,d as Z}from"./select-9BnniKoU.js";import{c as ut,a as mt}from"./index-Q-HDVsyn.js";import{C as ht}from"./circle-check-D9BCjgai.js";import{E as me}from"./external-link-CK93yfK1.js";import{B as ft}from"./badge-pound-sterling-BVwuh2wG.js";import{S as xt,g as oe,F as pt,a as gt,O as bt,b as Ne}from"./car-card-C9ZRISs7.js";import{A as vt}from"./arrow-left-CFvWDBUx.js";import{G as yt}from"./gauge-BjZ0J16D.js";import{P as jt}from"./palette-D7Dp8342.js";import{C as wt}from"./car-C2IJ_QB7.js";import{C as Se}from"./chevron-right-ChkK1bCk.js";const Nt=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],St=xe("zoom-in",Nt);const _t=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],kt=xe("zoom-out",_t);function Ct(t){const n=Ze();return m.useCallback(async(...s)=>{try{const r=await t(...s);if(ue(r))throw r;return r}catch(r){if(ue(r))return r.options._fromLocation=n.stores.location.state,n.navigate(n.resolveRedirect(r).options);throw r}},[n,t])}const Pt="B19 1ES",_e=30,ke=2,Rt=.2;function Et(t){const n=_e+t*ke,s=n*Rt,r=n+s;return{net:+n.toFixed(2),vat:+s.toFixed(2),total:+r.toFixed(2)}}const Mt="447450918041",I=t=>new Intl.NumberFormat("en-GB",{style:"currency",currency:"GBP",maximumFractionDigits:2}).format(t);async function he(t){const n=await fetch(`https://api.postcodes.io/postcodes/${encodeURIComponent(t.trim())}`);if(!n.ok)return null;const s=await n.json();return s?.result?{lat:s.result.latitude,lon:s.result.longitude}:null}function At(t,n){const s=o=>o*Math.PI/180,r=3958.7613,d=s(n.lat-t.lat),l=s(n.lon-t.lon),a=Math.sin(d/2)**2+Math.cos(s(t.lat))*Math.cos(s(n.lat))*Math.sin(l/2)**2;return 2*r*Math.asin(Math.sqrt(a))}function Ft({car:t}){const[n,s]=m.useState(""),[r,d]=m.useState(!1),[l,a]=m.useState(null),[o,i]=m.useState(null),p=async u=>{u.preventDefault(),a(null),i(null);const f=n.trim();if(!/^[A-Za-z0-9 ]{5,8}$/.test(f)){a("Please enter a valid UK postcode.");return}d(!0);try{const[x,g]=await Promise.all([he(Pt),he(f)]);if(!x||!g){a("We couldn't find that postcode. Please double-check it.");return}const w=Math.max(1,Math.round(At(x,g))),{net:v,vat:y,total:h}=Et(w);i({miles:w,net:v,vat:y,total:h,postcode:f.toUpperCase()})}catch{a("Something went wrong fetching the quote. Please try again.")}finally{d(!1)}},b=o?`https://wa.me/${Mt}?text=${encodeURIComponent(`Hi Pulse Cars, I'd like to book delivery for the ${t.year} ${t.make} ${t.model} to ${o.postcode}. Quoted ${I(o.total)} inc. VAT (${I(o.net)} + ${I(o.vat)} VAT) for ${o.miles} miles. Please confirm.`)}`:"";return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(it,{className:"h-5 w-5 text-primary"}),e.jsx("h2",{className:"font-display text-xl font-semibold",children:"Get this car delivered"})]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"UK nationwide delivery from our showroom in Birmingham (B19 1ES). £30 base fee plus £2/mile from B19 1ES to your postcode. All prices exclude VAT (20%)."}),e.jsxs("form",{onSubmit:p,className:"mt-6 grid gap-4",children:[e.jsxs("div",{children:[e.jsx(S,{htmlFor:"delivery-postcode",children:"Your postcode"}),e.jsx(k,{id:"delivery-postcode",placeholder:"e.g. SW1A 1AA",value:n,onChange:u=>s(u.target.value),className:"mt-1.5 uppercase",maxLength:8,autoComplete:"postal-code"})]}),e.jsx(D,{type:"submit",size:"lg",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"mr-2 h-4 w-4 animate-spin"})," Calculatingâ¦"]}):"Get delivery quote"}),l&&e.jsx("p",{className:"text-sm text-destructive",children:l}),o&&e.jsxs("div",{className:"rounded-xl bg-gradient-hero p-5 text-primary-foreground",children:[e.jsxs("p",{className:"text-xs uppercase tracking-wide opacity-90",children:["Delivery to ",o.postcode," · ",o.miles," miles"]}),e.jsx("p",{className:"font-display text-4xl font-bold",children:I(o.total)}),e.jsxs("p",{className:"mt-1 text-xs opacity-90",children:[I(o.net)," + ",I(o.vat)," VAT (20%)"]}),e.jsxs("p",{className:"mt-1 text-[11px] opacity-80",children:["£",_e.toFixed(2)," base + ",o.miles," miles à £",ke.toFixed(2),"/mile"]})]}),o&&e.jsx(D,{asChild:!0,size:"lg",className:"bg-gradient-hero shadow-elegant",children:e.jsx("a",{href:b,target:"_blank",rel:"noopener noreferrer",children:"Book delivery on WhatsApp"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Quote is based on straight-line distance and is indicative. Final price confirmed by our team."})]})]})}
1var K="Checkbox",[It]=je(K),[Dt,ae]=It(K);function Tt(t){const{__scopeCheckbox:n,checked:s,children:r,defaultChecked:d,disabled:l,form:a,name:o,onCheckedChange:i,required:p,value:b="on",internal_do_not_use_render:u}=t,[f,x]=be({prop:s,defaultProp:d??!1,onChange:i,caller:K}),[g,w]=m.useState(null),[v,y]=m.useState(null),h=m.useRef(!1),c=g?!!a||!!g.closest("form"):!0,j={checked:f,disabled:l,setChecked:x,control:g,setControl:w,name:o,form:a,value:b,hasConsumerStoppedPropagationRef:h,required:p,defaultChecked:P(d)?!1:d,isFormControl:c,bubbleInput:v,setBubbleInput:y};return e.jsx(Dt,{scope:n,...j,children:Lt(u)?u(j):r})}var Ce="CheckboxTrigger",Pe=m.forwardRef(({__scopeCheckbox:t,onKeyDown:n,onClick:s,...r},d)=>{const{control:l,value:a,disabled:o,checked:i,required:p,setControl:b,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:x,bubbleInput:g}=ae(Ce,t),w=R(d,b),v=m.useRef(i);return m.useEffect(()=>{const y=l?.form;if(y){const h=()=>u(v.current);return y.addEventListener("reset",h),()=>y.removeEventListener("reset",h)}},[l,u]),e.jsx(E.button,{type:"button",role:"checkbox","aria-checked":P(i)?"mixed":i,"aria-required":p,"data-state":Fe(i),"data-disabled":o?"":void 0,disabled:o,value:a,...r,ref:w,onKeyDown:C(n,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:C(s,y=>{u(h=>P(h)?!0:!h),g&&x&&(f.current=y.isPropagationStopped(),f.current||y.stopPropagation())})})});Pe.displayName=Ce;var ie=m.forwardRef((t,n)=>{const{__scopeCheckbox:s,name:r,checked:d,defaultChecked:l,required:a,disabled:o,value:i,onCheckedChange:p,form:b,...u}=t;return e.jsx(Tt,{__scopeCheckbox:s,checked:d,defaultChecked:l,disabled:o,required:a,onCheckedChange:p,name:r,form:b,value:i,internal_do_not_use_render:({isFormControl:f})=>e.jsxs(e.Fragment,{children:[e.jsx(Pe,{...u,ref:n,__scopeCheckbox:s}),f&&e.jsx(Ae,{__scopeCheckbox:s})]})})});ie.displayName=K;var Re="CheckboxIndicator",Ee=m.forwardRef((t,n)=>{const{__scopeCheckbox:s,forceMount:r,...d}=t,l=ae(Re,s);return e.jsx(ct,{present:r||P(l.checked)||l.checked===!0,children:e.jsx(E.span,{"data-state":Fe(l.checked),"data-disabled":l.disabled?"":void 0,...d,ref:n,style:{pointerEvents:"none",...t.style}})})});Ee.displayName=Re;var Me="CheckboxBubbleInput",Ae=m.forwardRef(({__scopeCheckbox:t,...n},s)=>{const{control:r,hasConsumerStoppedPropagationRef:d,checked:l,defaultChecked:a,required:o,disabled:i,name:p,value:b,form:u,bubbleInput:f,setBubbleInput:x}=ae(Me,t),g=R(s,x),w=ve(l),v=ye(r);m.useEffect(()=>{const h=f;if(!h)return;const c=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(c,"checked").set,B=!d.current;if(w!==l&&_){const $=new Event("click",{bubbles:B});h.indeterminate=P(l),_.call(h,P(l)?!1:l),h.dispatchEvent($)}},[f,w,l,d]);const y=m.useRef(P(l)?!1:l);return e.jsx(E.input,{type:"checkbox","aria-hidden":!0,defaultChecked:a??y.current,required:o,disabled:i,name:p,value:b,form:u,...n,tabIndex:-1,ref:g,style:{...n.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ae.displayName=Me;function Lt(t){return typeof t=="function"}function P(t){return t==="indeterminate"}function Fe(t){return P(t)?"indeterminate":t?"checked":"unchecked"}const Ie=m.forwardRef(({className:t,...n},s)=>e.jsx(ie,{ref:s,className:Q("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...n,children:e.jsx(Ee,{className:Q("grid place-content-center text-current"),children:e.jsx(dt,{className:"h-4 w-4"})})}));Ie.displayName=ie.displayName;var De=["PageUp","PageDown"],Te=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Le={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},L="Slider",[te,Bt,$t]=ut(L),[Be]=je(L,[$t]),[zt,G]=Be(L),$e=m.forwardRef((t,n)=>{const{name:s,min:r=0,max:d=100,step:l=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:i=0,defaultValue:p=[r],value:b,onValueChange:u=()=>{},onValueCommit:f=()=>{},inverted:x=!1,form:g,...w}=t,v=m.useRef(new Set),y=m.useRef(0),c=a==="horizontal"?Vt:Ot,[j=[],_]=be({prop:b,defaultProp:p,onChange:N=>{[...v.current][y.current]?.focus(),u(N)}}),B=m.useRef(j);function $(N){const M=Ut(j,N);z(N,M)}function We(N){z(N,y.current)}function Je(){const N=B.current[y.current];j[y.current]!==N&&f(j)}function z(N,M,{commit:H}={commit:!1}){const ce=Jt(l),Y=Zt(Math.round((N-r)/l)*l+r,ce),V=we(Y,[r,d]);_((F=[])=>{const A=Ht(F,V,M);if(Wt(A,i*l)){y.current=A.indexOf(V);const de=String(A)!==String(F);return de&&H&&f(A),de?A:F}else return F})}return e.jsx(zt,{scope:t.__scopeSlider,name:s,disabled:o,min:r,max:d,valueIndexToChangeRef:y,thumbs:v.current,values:j,orientation:a,form:g,children:e.jsx(te.Provider,{scope:t.__scopeSlider,children:e.jsx(te.Slot,{scope:t.__scopeSlider,children:e.jsx(c,{"aria-disabled":o,"data-disabled":o?"":void 0,...w,ref:n,onPointerDown:C(w.onPointerDown,()=>{o||(B.current=j)}),min:r,max:d,inverted:x,onSlideStart:o?void 0:$,onSlideMove:o?void 0:We,onSlideEnd:o?void 0:Je,onHomeKeyDown:()=>!o&&z(r,0,{commit:!0}),onEndKeyDown:()=>!o&&z(d,j.length-1,{commit:!0}),onStepKeyDown:({event:N,direction:M})=>{if(!o){const Y=De.includes(N.key)||N.shiftKey&&Te.includes(N.key)?10:1,V=y.current,F=j[V],A=l*Y*M;z(F+A,V,{commit:!0})}}})})})})});$e.displayName=L;var[ze,Ve]=Be(L,{startEdge:"left",endEdge:"right",size:"width",direction:1}
1),Vt=m.forwardRef((t,n)=>{const{min:s,max:r,dir:d,inverted:l,onSlideStart:a,onSlideMove:o,onSlideEnd:i,onStepKeyDown:p,...b}=t,[u,f]=m.useState(null),x=R(n,c=>f(c)),g=m.useRef(void 0),w=mt(d),v=w==="ltr",y=v&&!l||!v&&l;function h(c){const j=g.current||u.getBoundingClientRect(),_=[0,j.width],$=le(_,y?[s,r]:[r,s]);return g.current=j,$(c-j.left)}return e.jsx(ze,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:e.jsx(Oe,{dir:w,"data-orientation":"horizontal",...b,ref:x,style:{...b.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:c=>{const j=h(c.clientX);a?.(j)},onSlideMove:c=>{const j=h(c.clientX);o?.(j)},onSlideEnd:()=>{g.current=void 0,i?.()},onStepKeyDown:c=>{const _=Le[y?"from-left":"from-right"].includes(c.key);p?.({event:c,direction:_?-1:1})}})})}),Ot=m.forwardRef((t,n)=>{const{min:s,max:r,inverted:d,onSlideStart:l,onSlideMove:a,onSlideEnd:o,onStepKeyDown:i,...p}=t,b=m.useRef(null),u=R(n,b),f=m.useRef(void 0),x=!d;function g(w){const v=f.current||b.current.getBoundingClientRect(),y=[0,v.height],c=le(y,x?[r,s]:[s,r]);return f.current=v,c(w-v.top)}return e.jsx(ze,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:e.jsx(Oe,{"data-orientation":"vertical",...p,ref:u,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const v=g(w.clientY);l?.(v)},onSlideMove:w=>{const v=g(w.clientY);a?.(v)},onSlideEnd:()=>{f.current=void 0,o?.()},onStepKeyDown:w=>{const y=Le[x?"from-bottom":"from-top"].includes(w.key);i?.({event:w,direction:y?-1:1})}})})}),Oe=m.forwardRef((t,n)=>{const{__scopeSlider:s,onSlideStart:r,onSlideMove:d,onSlideEnd:l,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:i,...p}=t,b=G(L,s);return e.jsx(E.span,{...p,ref:n,onKeyDown:C(t.onKeyDown,u=>{u.key==="Home"?(a(u),u.preventDefault()):u.key==="End"?(o(u),u.preventDefault()):De.concat(Te).includes(u.key)&&(i(u),u.preventDefault())}),onPointerDown:C(t.onPointerDown,u=>{const f=u.target;f.setPointerCapture(u.pointerId),u.preventDefault(),b.thumbs.has(f)?f.focus():r(u)}),onPointerMove:C(t.onPointerMove,u=>{u.target.hasPointerCapture(u.pointerId)&&d(u)}),onPointerUp:C(t.onPointerUp,u=>{const f=u.target;f.hasPointerCapture(u.pointerId)&&(f.releasePointerCapture(u.pointerId),l(u))})})}),Ke="SliderTrack",Ge=m.forwardRef((t,n)=>{const{__scopeSlider:s,...r}=t,d=G(Ke,s);return e.jsx(E.span,{"data-disabled":d.disabled?"":void 0,"data-orientation":d.orientation,...r,ref:n})});Ge.displayName=Ke;var se="SliderRange",He=m.forwardRef((t,n)=>{const{__scopeSlider:s,...r}=t,d=G(se,s),l=Ve(se,s),a=m.useRef(null),o=R(n,a),i=d.values.length,p=d.values.map(f=>Xe(f,d.min,d.max)),b=i>1?Math.min(...p):0,u=100-Math.max(...p);return e.jsx(E.span,{"data-orientation":d.orientation,"data-disabled":d.disabled?"":void 0,...r,ref:o,style:{...t.style,[l.startEdge]:b+"%",[l.endEdge]:u+"%"}})});He.displayName=se;var ne="SliderThumb",Ye=m.forwardRef((t,n)=>{const s=Bt(t.__scopeSlider),[r,d]=m.useState(null),l=R(n,o=>d(o)),a=m.useMemo(()=>r?s().findIndex(o=>o.ref.current===r):-1,[s,r]);return e.jsx(Kt,{...t,ref:l,index:a})}),Kt=m.forwardRef((t,n)=>{const{__scopeSlider:s,index:r,name:d,...l}=t,a=G(ne,s),o=Ve(ne,s),[i,p]=m.useState(null),b=R(n,h=>p(h)),u=i?a.form||!!i.closest("form"):!0,f=ye(i),x=a.values[r],g=x===void 0?0:Xe(x,a.min,a.max),w=Yt(r,a.values.length),v=f?.[o.size],y=v?Xt(v,g,o.direction):0;return m.useEffect(()=>{if(i)return a.thumbs.add(i),()=>{a.thumbs.delete(i)}},[i,a.thumbs]),e.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${g}% + ${y}px)`},children:[e.jsx(te.ItemSlot,{scope:t.__scopeSlider,children:e.jsx(E.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...l,ref:b,style:x===void 0?{display:"none"}:t.style,onFocus:C(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),u&&e.jsx(Ue,{name:d??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});Ye.displayName=ne;var Gt="RadioBubbleInput",Ue=m.forwardRef(({__scopeSlider:t,value:n,...s},r)=>{const d=m.useRef(null),l=R(d,r),a=ve(n);return m.useEffect(()=>{const o=d.current;if(!o)return;const i=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(i,"value").set;if(a!==n&&b){const u=new Event("input",{bubbles:!0});b.call(o,n),o.dispatchEvent(u)}},[a,n]),e.jsx(E.input,{style:{display:"none"},...s,ref:l,defaultValue:n})});Ue.displayName=Gt;function Ht(t=[],n,s){const r=[...t];return r[s]=n,r.sort((d,l)=>d-l)}function Xe(t,n,s){const l=100/(s-n)*(t-n);return we(l,[0,100])}function Yt(t,n){return n>2?`Value ${t+1} of ${n}`:n===2?["Minimum","Maximum"][t]:void 0}function Ut(t,n){if(t.length===1)return 0;const s=t.map(d=>Math.abs(d-n)),r=Math.min(...s);return s.indexOf(r)}function Xt(t,n,s){const r=t/2,l=le([0,50],[0,r]);return(r-l(n)*s)*s}function qt(t){return t.slice(0,-1).map((n,s)=>t[s+1]-n)}function Wt(t,n){if(n>0){const s=qt(t);return Math.min(...s)>=n}return!0}function le(t,n){return s=>{if(t[0]===t[1]||n[0]===n[1])return n[0];const r=(n[1]-n[0])/(t[1]-t[0]);return n[0]+r*(s-t[0])}}function Jt(t){return(String(t).split(".")[1]||"").length}function Zt(t,n){const s=Math.pow(10,n);return Math.round(t*s)/s}var qe=$e,Qt=Ge,es=He,ts=Ye;const re=m.forwardRef(({className:t,...n},s)=>e.jsxs(qe,{ref:s,className:Q("relative flex w-full touch-none select-none items-center",t),...n,children:[e.jsx(Qt,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(es,{className:"absolute h-full bg-primary"})}
1),e.jsx(ts,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));re.displayName=qe.displayName;const ss=Qe({method:"POST"}).handler(et("8d6679e8030455f29f02cd2b0b323e4234e04f1691b03850aedc93f62875e282")),fe="https://applications.jigsawfinance.com/pulse-cars-limited-1787921597855/",ns=["Employed (full time)","Employed (part time)","Self-employed","Retired","Student","Other"],rs=["Homeowner","Private tenant","Council tenant","Living with family","Other"],os=["Single","Married","Civil partnership","Divorced","Widowed","Other"];function as({carId:t,carLabel:n,price:s}){const r=Ct(ss),[d,l]=m.useState(!1),[a,o]=m.useState(!1),[i,p]=m.useState({full_name:"",email:"",phone:"",postcode:"",date_of_birth:"",employment_status:"",marital_status:"",residential_status:"",time_at_address:"",annual_income:"",notes:""}),[b,u]=m.useState(s?Math.round(s*.1/50)*50:500),[f,x]=m.useState(48),[g,w]=m.useState(!1),v=c=>j=>p(_=>({..._,[c]:j})),y=Math.max(2e3,s?Math.round(s*.6):1e4),h=async c=>{if(c.preventDefault(),!g){U.error("Please tick the consent box so we can pass your details to Jigsaw Finance.");return}l(!0);try{if(!(await r({data:{car_id:t,car_label:n,full_name:i.full_name.trim(),email:i.email.trim(),phone:i.phone.trim(),postcode:i.postcode.trim()||void 0,date_of_birth:i.date_of_birth||void 0,employment_status:i.employment_status||void 0,marital_status:i.marital_status||void 0,residential_status:i.residential_status||void 0,time_at_address:i.time_at_address.trim()||void 0,annual_income:i.annual_income?Number(i.annual_income):void 0,deposit:b,term_months:f,notes:i.notes.trim()||void 0,consent:!0}})).ok)throw new Error("failed");o(!0),U.success("Finance enquiry sent â we'll be in touch shortly.")}catch{U.error("Sorry, we couldn't send that. Please call us or use the direct application link.")}finally{l(!1)}};return a?e.jsxs("div",{className:"rounded-2xl border border-primary/30 bg-primary/5 p-6 text-center",children:[e.jsx(ht,{className:"mx-auto h-10 w-10 text-primary"}),e.jsx("h3",{className:"mt-3 font-display text-lg font-semibold",children:"Enquiry received"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Thanks ",i.full_name.split(" ")[0],". With your consent we'll introduce you to Jigsaw Finance Limited, an FCA-authorised credit broker, who will look at options on your behalf. You can also start the full application now."]}),e.jsx(D,{asChild:!0,className:"mt-4 bg-gradient-hero shadow-elegant",children:e.jsxs("a",{href:fe,target:"_blank",rel:"noopener noreferrer",children:["Continue to full application ",e.jsx(me,{className:"ml-2 h-4 w-4"})]})})]}):e.jsxs("form",{onSubmit:h,className:"space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:e.jsx(ft,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-display text-xl font-semibold",children:"Apply for finance on this car"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[n?`${n} â `:"","send your details and we'll introduce you to Jigsaw Finance Limited."]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-name",children:"Full name *"}),e.jsx(k,{id:"fa-name",required:!0,value:i.full_name,onChange:c=>v("full_name")(c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-phone",children:"Mobile number *"}),e.jsx(k,{id:"fa-phone",required:!0,type:"tel",value:i.phone,onChange:c=>v("phone")(c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-email",children:"Email *"}),e.jsx(k,{id:"fa-email",required:!0,type:"email",value:i.email,onChange:c=>v("email")(c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-postcode",children:"Postcode"}),e.jsx(k,{id:"fa-postcode",value:i.postcode,onChange:c=>v("postcode")(c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-dob",children:"Date of birth"}),e.jsx(k,{id:"fa-dob",type:"date",value:i.date_of_birth,onChange:c=>v("date_of_birth")(c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-income",children:"Annual income (£)"}),e.jsx(k,{id:"fa-income",type:"number",min:0,inputMode:"numeric",value:i.annual_income,onChange:c=>v("annual_income")(c.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{children:"Employment status"}),e.jsxs(X,{value:i.employment_status,onValueChange:v("employment_status"),children:[e.jsx(q,{children:e.jsx(W,{placeholder:"Select"})}),e.jsx(J,{children:ns.map(c=>e.jsx(Z,{value:c,children:c},c))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{children:"Residential status"}),e.jsxs(X,{value:i.residential_status,onValueChange:v("residential_status"),children:[e.jsx(q,{children:e.jsx(W,{placeholder:"Select"})}),e.jsx(J,{children:rs.map(c=>e.jsx(Z,{value:c,children:c},c))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{children:"Marital status"}),e.jsxs(X,{value:i.marital_status,onValueChange:v("marital_status"),children:[e.jsx(q,{children:e.jsx(W,{placeholder:"Select"})}),e.jsx(J,{children:os.map(c=>e.jsx(Z,{value:c,children:c},c))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-time",children:"Time at current address"}),e.jsx(k,{id:"fa-time",placeholder:"e.g. 3 years 2 months",value:i.time_at_address,onChange:c=>v("time_at_address")(c.target.value)})]})]}),e.jsxs("div",{className:"grid gap-5 rounded-xl border border-border bg-muted/40 p-4 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-sm font-medium",children:[e.jsx("span",{children:"Deposit"}),e.jsxs("span",{className:"text-primary",children:["£",b.toLocaleStr
1ing()]})]}),e.jsx(re,{className:"mt-3",min:0,max:y,step:50,value:[b],onValueChange:c=>u(c[0])})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-sm font-medium",children:[e.jsx("span",{children:"Preferred term"}),e.jsxs("span",{className:"text-primary",children:[f," months"]})]}),e.jsx(re,{className:"mt-3",min:12,max:60,step:6,value:[f],onValueChange:c=>x(c[0])})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"fa-notes",children:"Anything else we should know?"}),e.jsx(lt,{id:"fa-notes",rows:3,value:i.notes,onChange:c=>v("notes")(c.target.value)})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-border p-4",children:[e.jsx(Ie,{id:"fa-consent",checked:g,onCheckedChange:c=>w(c===!0)}),e.jsxs(S,{htmlFor:"fa-consent",className:"text-xs font-normal leading-relaxed text-muted-foreground",children:["I consent to Pulse Cars Limited passing my details to Jigsaw Finance Limited (FRN 679612), an FCA-authorised credit broker, so they can look at finance options on my behalf. Finance is subject to status and credit checks. See our ",e.jsx(ee,{to:"/finance",className:"text-primary hover:underline",children:"finance information"})," and"," ",e.jsx(ee,{to:"/trust",className:"text-primary hover:underline",children:"privacy policy"}),"."]})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx(D,{type:"submit",size:"lg",disabled:d,className:"bg-gradient-hero shadow-elegant sm:flex-1",children:d?e.jsxs(e.Fragment,{children:[e.jsx(pe,{className:"mr-2 h-4 w-4 animate-spin"})," Sendingâ¦"]}):"Apply for finance"}),e.jsx(D,{asChild:!0,size:"lg",variant:"outline",children:e.jsxs("a",{href:fe,target:"_blank",rel:"noopener noreferrer",children:["Apply direct with Jigsaw ",e.jsx(me,{className:"ml-2 h-4 w-4"})]})})]}),e.jsx("p",{className:"text-[11px] leading-relaxed text-muted-foreground",children:"Pulse Cars Limited (FRN 1062917) is an Introducer Appointed Representative of Jigsaw Finance Limited (FRN 679612), which is authorised and regulated by the Financial Conduct Authority. Jigsaw Finance Limited is a credit broker, not a lender. We do not give financial advice or recommend products. We may receive a commission for introducing you; this does not affect the price of your vehicle. Finance subject to status, affordability and credit checks; UK residents 18+."})]})}const T=t=>new Intl.NumberFormat("en-GB",{style:"currency",currency:"GBP",maximumFractionDigits:0}).format(t);function Ms(){const{id:t}=tt.useParams(),n=st(),[s,r]=m.useState(null),[d,l]=m.useState(!0);return m.useEffect(()=>{nt.from("cars").select("id,make,model,year,price,mileage,fuel_type,transmission,body_type,color,description,image_url,status,featured,created_at,updated_at,gallery_urls,variant,registration,registration_date,stock_number,location,engine,engine_size,horsepower,drivetrain,doors,seats,mpg_combined,mpg_city,mpg_highway,fuel_tank_size,co2_emissions,ulez_compliant,mot_expiry,previous_owners,length_mm,width_mm,height_mm,wheelbase_mm,features,offer_active,offer_label,market_price,offer_expires_at,listed_at").eq("id",t).maybeSingle().then(({data:a})=>{r(a??null),l(!1)}),rt(t,`/car/${t}`)},[t]),d?e.jsx("div",{className:"py-20 text-center text-muted-foreground",children:"Loadingâ¦"}):s?e.jsxs("div",{className:"mx-auto max-w-7xl px-4 py-10 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs(ee,{to:"/inventory",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(vt,{className:"h-4 w-4"})," Back to inventory"]}),e.jsx(xt,{variant:"button",path:`/car/${s.id}`,title:`${s.year} ${s.make} ${s.model}`,text:`Check out this ${s.year} ${s.make} ${s.model} at Pulse Cars`,label:"Share"})]}),e.jsxs("div",{className:"mt-6 grid gap-8 lg:grid-cols-[1.4fr_1fr]",children:[e.jsxs("div",{children:[e.jsx(is,{car:s}),e.jsxs("div",{className:"mt-6",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"font-display text-3xl font-bold sm:text-4xl",children:[s.year," ",s.make," ",s.model]}),e.jsxs("p",{className:"mt-1 text-muted-foreground",children:[s.body_type,s.stock_number&&e.jsxs(e.Fragment,{children:[" · Inventory ",e.jsxs("span",{className:"font-semibold text-foreground",children:["#",s.stock_number]})]})]}),s.stock_number&&e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Quote ",e.jsxs("span",{className:"font-semibold text-foreground",children:["#",s.stock_number]})," when booking an appointment."]})]}),e.jsx("div",{className:"text-right",children:(()=>{const a=oe(s);return e.jsxs(e.Fragment,{children:[a&&a.savings>0&&e.jsx("div",{className:"text-sm text-muted-foreground line-through",children:T(a.marketPrice)}),e.jsx("div",{className:"font-display text-3xl font-bold text-primary",children:T(Number(s.price))}),a&&a.savings>0&&e.jsxs("div",{className:"mt-1 inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-xs font-semibold text-destructive",children:[e.jsx(ge,{className:"h-3 w-3"})," Save ",T(a.savings)," (",a.percent,"%)"]}),s.status!=="available"&&e.jsx(at,{variant:"secondary",className:"mt-2 capitalize",children:s.status})]})})()})]}),e.jsx(ds,{car:s}),e.jsxs("div",{className:"mt-6 grid grid-cols-2 gap-4 sm:grid-cols-4",children:[e.jsx(O,{icon:e.jsx(yt,{className:"h-4 w-4"}
1),label:"Mileage",value:`${s.mileage.toLocaleString()} mi`}),e.jsx(O,{icon:e.jsx(pt,{className:"h-4 w-4"}),label:"Fuel",value:s.fuel_type}),e.jsx(O,{icon:e.jsx(gt,{className:"h-4 w-4"}),label:"Gearbox",value:s.transmission}),e.jsx(O,{icon:e.jsx(jt,{className:"h-4 w-4"}),label:"Colour",value:s.color||"â"})]}),e.jsx(cs,{car:s}),s.description&&e.jsxs("div",{className:"mt-8",children:[e.jsx("h2",{className:"font-display text-xl font-semibold",children:"About this car"}),e.jsx("p",{className:"mt-3 whitespace-pre-line leading-relaxed text-muted-foreground",children:s.description})]})]}),e.jsx("div",{id:"finance",className:"mt-8 rounded-2xl border border-border bg-card p-6 shadow-card sm:p-8",children:e.jsx(as,{carId:s.id,carLabel:`${s.year} ${s.make} ${s.model}`,price:Number(s.price)})})]}),e.jsx("aside",{className:"lg:sticky lg:top-6 lg:self-start",children:e.jsx("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-card",children:e.jsx(Ft,{car:{id:s.id,year:s.year,make:s.make,model:s.model}})})})]})]}):e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-20 text-center",children:[e.jsx("h1",{className:"font-display text-3xl font-bold",children:"Car not found"}),e.jsx(D,{className:"mt-6",onClick:()=>n({to:"/inventory"}),children:"Back to inventory"})]})}function is({car:t}){const n=Array.from(new Set([...t.image_url?[t.image_url]:[],...t.gallery_urls??[]])),[s,r]=m.useState(0),[d,l]=m.useState(!1),a=m.useRef(null),o=m.useRef(null);if(n.length===0)return e.jsx("div",{className:"overflow-hidden rounded-2xl border border-border bg-muted shadow-card",children:e.jsx("div",{className:"flex aspect-[16/10] w-full items-center justify-center text-muted-foreground",children:e.jsx(wt,{className:"h-12 w-12"})})});const i=oe(t),p=n.length,b=x=>r((x%p+p)%p),u=x=>{a.current=x.touches[0].clientX,o.current=x.touches[0].clientY},f=x=>{if(a.current===null||o.current===null)return;const g=x.changedTouches[0].clientX-a.current,w=x.changedTouches[0].clientY-o.current;Math.abs(g)>40&&Math.abs(g)>Math.abs(w)&&b(g<0?s+1:s-1),a.current=null,o.current=null};return e.jsxs("div",{children:[e.jsxs("div",{className:"relative overflow-hidden rounded-2xl border border-border bg-muted shadow-card select-none",onTouchStart:u,onTouchEnd:f,children:[i&&e.jsx(bt,{offer:i}),e.jsx("div",{className:"flex aspect-[16/10] w-full transition-transform duration-300 ease-out",style:{transform:`translateX(-${s*100}%)`},children:n.map((x,g)=>e.jsx("img",{src:x,alt:`${t.year} ${t.make} ${t.model} â photo ${g+1}`,draggable:!1,onClick:()=>l(!0),loading:g===0?"eager":"lazy",className:"h-full w-full flex-shrink-0 cursor-zoom-in object-cover"},x+g))}),p>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Previous photo",onClick:()=>b(s-1),className:"absolute left-2 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded-full bg-background/80 p-2 text-foreground shadow backdrop-blur transition hover:bg-background sm:flex",children:e.jsx(Ne,{className:"h-5 w-5"})}),e.jsx("button",{type:"button","aria-label":"Next photo",onClick:()=>b(s+1),className:"absolute right-2 top-1/2 hidden -translate-y-1/2 items-center justify-center rounded-full bg-background/80 p-2 text-foreground shadow backdrop-blur transition hover:bg-background sm:flex",children:e.jsx(Se,{className:"h-5 w-5"})}),e.jsxs("div",{className:"pointer-events-none absolute right-3 bottom-3 rounded-full bg-background/80 px-2 py-0.5 text-[11px] font-medium text-foreground shadow backdrop-blur",children:[s+1,"/",p]})]})]}),p>1&&e.jsx("div",{className:"mt-3 grid grid-cols-5 gap-2 sm:grid-cols-6",children:n.map((x,g)=>e.jsx("button",{type:"button",onClick:()=>r(g),className:`overflow-hidden rounded-md border ${s===g?"border-primary ring-2 ring-primary/40":"border-border"}`,children:e.jsx("img",{src:x,alt:"",className:"aspect-square w-full object-cover",loading:"lazy"})},x+g))}),d&&e.jsx(ls,{photos:n,index:s,onIndex:r,onClose:()=>l(!1)})]})}function ls({photos:t,index:n,onIndex:s,onClose:r}){const d=t.length,[l,a]=m.useState(1),[o,i]=m.useState({x:0,y:0}),p=m.useRef(null),b=m.useRef(null),u=m.useRef(null),f=m.useRef(null),x=h=>{s((h%d+d)%d),a(1),i({x:0,y:0})};m.useEffect(()=>{const h=j=>
1{j.key==="Escape"&&r(),j.key==="ArrowLeft"&&x(n-1),j.key==="ArrowRight"&&x(n+1)};window.addEventListener("keydown",h);const c=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",h),document.body.style.overflow=c}},[n,d]);const g=h=>{const c=h[0].clientX-h[1].clientX,j=h[0].clientY-h[1].clientY;return Math.hypot(c,j)},w=h=>{h.touches.length===2?(u.current={dist:g(h.touches),zoom:l},p.current=null):h.touches.length===1&&(l>1?f.current={x:h.touches[0].clientX,y:h.touches[0].clientY,px:o.x,py:o.y}:(p.current=h.touches[0].clientX,b.current=h.touches[0].clientY))},v=h=>{if(h.touches.length===2&&u.current){const c=g(h.touches),j=Math.max(1,Math.min(5,c/u.current.dist*u.current.zoom));a(j),j===1&&i({x:0,y:0})}else h.touches.length===1&&f.current&&l>1&&i({x:f.current.px+(h.touches[0].clientX-f.current.x),y:f.current.py+(h.touches[0].clientY-f.current.y)})},y=h=>{if(u.current=null,f.current=null,l<=1&&p.current!==null&&b.current!==null){const c=h.changedTouches[0].clientX-p.current,j=h.changedTouches[0].clientY-b.current;Math.abs(c)>40&&Math.abs(c)>Math.abs(j)&&x(c<0?n+1:n-1)}p.current=null,b.current=null};return e.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/95",onClick:r,children:[e.jsx("button",{type:"button","aria-label":"Close",onClick:r,className:"absolute right-4 top-4 z-10 rounded-full bg-white/10 p-2 text-white backdrop-blur hover:bg-white/20",children:e.jsx(ot,{className:"h-5 w-5"})}),e.jsxs("div",{className:"absolute right-16 top-4 z-10 flex gap-2",children:[e.jsx("button",{type:"button","aria-label":"Zoom out",onClick:h=>{h.stopPropagation();const c=Math.max(1,l-.5);a(c),c===1&&i({x:0,y:0})},className:"rounded-full bg-white/10 p-2 text-white backdrop-blur hover:bg-white/20",children:e.jsx(kt,{className:"h-5 w-5"})}),e.jsx("button",{type:"button","aria-label":"Zoom in",onClick:h=>{h.stopPropagation(),a(Math.min(5,l+.5))},className:"rounded-full bg-white/10 p-2 text-white backdrop-blur hover:bg-white/20",children:e.jsx(St,{className:"h-5 w-5"})})]}),d>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Previous",onClick:h=>{h.stopPropagation(),x(n-1)},className:"absolute left-2 top-1/2 z-10 hidden -translate-y-1/2 rounded-full bg-white/10 p-3 text-white backdrop-blur hover:bg-white/20 sm:block",children:e.jsx(Ne,{className:"h-6 w-6"})}),e.jsx("button",{type:"button","aria-label":"Next",onClick:h=>{h.stopPropagation(),x(n+1)},className:"absolute right-2 top-1/2 z-10 hidden -translate-y-1/2 rounded-full bg-white/10 p-3 text-white backdrop-blur hover:bg-white/20 sm:block",children:e.jsx(Se,{className:"h-6 w-6"})})]}),e.jsx("div",{className:"flex h-full w-full items-center justify-center overflow-hidden",onClick:h=>h.stopPropagation(),onTouchStart:w,onTouchMove:v,onTouchEnd:y,children:e.jsx("img",{src:t[n],alt:"",draggable:!1,onDoubleClick:()=>{l>1?(a(1),i({x:0,y:0})):a(2)},style:{transform:`translate(${o.x}px, ${o.y}px) scale(${l})`,transition:u.current||f.current?"none":"transform 0.2s ease-out"},className:"max-h-full max-w-full select-none object-contain"})}),d>1&&e.jsxs("div",{className:"absolute bottom-4 left-1/2 z-10 -translate-x-1/2 rounded-full bg-white/10 px-3 py-1 text-sm text-white backdrop-blur",children:[n+1," / ",d]})]})}function O({icon:t,label:n,value:s}){return e.jsxs("div",{className:"rounded-xl border border-border bg-card p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t," ",n]}),e.jsx("div",{className:"mt-1 font-medium",children:s})]})}function cs({car:t}){const n=[["Variant",t.variant],["Registration",t.registration],["Registration date",t.registration_date],["Stock number",t.stock_number],["Location",t.location],["Previous owners",t.previous_owners],["MOT expiry",t.mot_expiry]],s=[["Engine",t.engine],["Engine size",t.engine_size?`${t.engine_size} L`:null],["Horsepower",t.horsepower?`${t.horsepower} hp`:null],["Drivetrain",t.drivetrain],["Doors",t.doors],["Seats",t.seats]],r=[["Combined MPG",t.mpg_combined],["City MPG",t.mpg_city],["Highway MPG",t.mpg_highway],["Fuel tank",t.fuel_tank_size?`${t.fuel_tank_size} L`:null],["COâ",t.co2_emissions?`${t.co2_emissions} g/km`:null],["ULEZ compliant",t.ulez_compliant===!0?"Yes":t.ulez_compliant===!1?"No":null]],d=[["Length",t.length_mm?`${t.length_mm} mm`:null],["Width",t.width_mm?`${t.width_mm} mm`:null],["Height",t.height_mm?`${t.height_mm} mm`:null],["Wheelbase",t.wheelbase_mm?`${t.wheelbase_mm} mm`:null]],l=[{title:"Overview",rows:n},{title:"Performance",rows:s},{title:"Fuel economy",rows:r},{title:"Measurements",rows:d}].map(o=>({...o,rows:o.rows.filter(([,i])=>i!=null&&i!=="")})).filter(o=>o.rows.length>
10),a=(t.features??[]).filter(Boolean);return l.length===0&&a.length===0?null:e.jsxs("div",{className:"mt-8 space-y-6",children:[l.map(o=>e.jsxs("div",{children:[e.jsx("h2",{className:"font-display text-xl font-semibold",children:o.title}),e.jsx("dl",{className:"mt-3 grid grid-cols-1 gap-x-6 gap-y-2 sm:grid-cols-2",children:o.rows.map(([i,p])=>e.jsxs("div",{className:"flex justify-between gap-4 border-b border-border/60 py-1.5 text-sm",children:[e.jsx("dt",{className:"text-muted-foreground",children:i}),e.jsx("dd",{className:"text-right font-medium",children:String(p)})]},i))})]},o.title)),a.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"font-display text-xl font-semibold",children:"Features & options"}),e.jsx("ul",{className:"mt-3 grid grid-cols-1 gap-2 sm:grid-cols-2",children:a.map(o=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary"})," ",o]},o))})]})]})}function ds({car:t}){const n=oe(t);if(!n||n.savings<=0)return null;const s=Number(t.price),r=Math.max(8,Math.round(s/n.marketPrice*100));return e.jsxs("div",{className:"mt-6 rounded-2xl border border-destructive/30 bg-gradient-to-br from-destructive/5 to-orange-500/5 p-5 shadow-card",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r from-destructive to-orange-500 px-3 py-1 text-xs font-bold uppercase tracking-wide text-white shadow",children:[e.jsx(ge,{className:"h-3.5 w-3.5"})," ",n.label]})}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"You save"}),e.jsx("div",{className:"font-display text-2xl font-bold text-destructive",children:T(n.savings)}),e.jsxs("div",{className:"text-xs font-semibold text-destructive",children:[n.percent,"% below market"]})]})]}),e.jsxs("div",{className:"mt-5 space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Typical market price"}),e.jsx("span",{className:"font-semibold line-through",children:T(n.marketPrice)})]}),e.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full w-full rounded-full bg-muted-foreground/30"})})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Our price"}),e.jsx("span",{className:"font-bold text-primary",children:T(s)})]}),e.jsx("div",{className:"h-3 w-full overflow-hidden rounded-full bg-muted",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-primary to-primary/70 transition-all",style:{width:`${r}%`}})})]})]}),n.expiresAt&&e.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:["Offer ends ",n.expiresAt.toLocaleString("en-GB",{dateStyle:"medium",timeStyle:"short"})]})]})}export{Ms as component};
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.