1import{q as v,i as U,d as C,e as x,c as t,x as i,t as $,a as c,a1 as I,y,E as R,o as s,j as N,bo as j,g as p,k as S,G as V,A as q,Y as A,m as M,l as G}from"./entry-BwZZnLSu.js";function K(h){const l=U(),n=v(null),_=v(!1),m=v(!1),f=v(!1);let w=null;const e=()=>n.value?Promise.resolve():w||(_.value=!0,m.value=!1,f.value=!1,w=(async()=>{var r;try{const a=await $fetch(`${l.public.baseURL}/widget/rainforest_pay/receipt-session/${h}`);if(!(a!=null&&a.sessionKey)||!(a!=null&&a.payinId)){m.value=!0;return}n.value=a}catch(a){const u=(a==null?void 0:a.statusCode)??((r=a==null?void 0:a.response)==null?void 0:r.status);typeof u=="number"&&u>=400&&u<500?f.value=!0:(m.value=!0,console.error("[Rainforest] Failed to fetch receipt session:",a))}finally{_.value=!1,w=null}})(),w);return{session:n,loading:_,error:m,unavailable:f,fetchSession:e,retry:()=>(n.value=null,m.value=!1,f.value=!1,e())}}const O={key:0,"data-testid":"receipt-summary",class:"tw-mb-6 tw-pb-6 tw-border-b tw-border-gray-200"},W={key:0,"data-testid":"summary-vehicles",class:"tw-mb-4"},Y={class:"tw-space-y-1"},z={key:0,class:"tw-text-gray-500"},H={key:1,"data-testid":"summary-items",class:"tw-mb-4"},J={class:"tw-space-y-1"},Q={key:0,class:"tw-text-gray-500"},X={key:2,"data-testid":"summary-tradeins",class:"tw-mb-4"},Z={class:"tw-space-y-1"},ee={key:0,class:"tw-text-gray-500"},te={key:1,"data-testid":"summary-description",class:"tw-text-sm tw-text-gray-800 tw-mb-4"},se={key:2,"data-testid":"summary-dealer"},ae={class:"tw-text-sm tw-font-medium tw-text-gray-900"},re={key:0,class:"tw-text-sm tw-text-gray-500"},ne={key:0},oe={key:1},ie={key:2},le=C({__name:"ReceiptSummary",props:{dealer:{},summary:{},currency:{}},setup(h){const l=h,n=x(()=>{var e;return l.summary&&l.summary.kind==="description"&&((e=l.summary.description)==null?void 0:e.trim())||""}),_=x(()=>{const e=l.summary;return!!e&&e.kind==="unit_sale"&&(e.vehicles.length>0||e.lineItems.length>0||e.tradeIns.length>0)}),m=x(()=>{var e;return!!((e=l.dealer)!=null&&e.name)||n.value.length>0||_.value});function f(e){return[e.year,e.make,e.model].filter(Boolean).join(" ")}function w(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:l.currency??"USD",maximumFractionDigits:0}).format(e)}return(e,o)=>m.value?(s(),t("div",O,[e.summary&&e.summary.kind==="unit_sale"?(s(),t($,{key:0},[e.summary.vehicles.length?(s(),t("div",W,[o[0]||(o[0]=c("p",{class:"tw-text-xs tw-uppercase tw-tracking-wide tw-text-gray-500 tw-mb-1"}," Purchased ",-1)),c("ul",Y,[(s(!0),t($,null,I(e.summary.vehicles,(r,a)=>(s(),t("li",{key:`veh-${a}`,class:"tw-text-sm tw-text-gray-800"},[R(y(f(r))+" ",1),r.stock?(s(),t("span",z,"· Stock "+y(r.stock),1)):i("",!0)]))),128))])])):i("",!0),e.summary.lineItems.length?(s(),t("div",H,[o[1]||(o[1]=c("p",{class:"tw-text-xs tw-uppercase tw-tracking-wide tw-text-gray-500 tw-mb-1"}," Items ",-1)),c("ul",J,[(s(!0),t($,null,I(e.summary.lineItems,(r,a)=>(s(),t("li",{key:`item-${a}`,class:"tw-text-sm tw-text-gray-800"},[R(y(r.title)+" ",1),(r.quantity??1)>1?(s(),t("span",Q," à "+y(r.quantity),1)):i("",!0)]))),128))])])):i("",!0),e.summary.tradeIns.length?(s(),t("div",X,[o[2]||(o[2]=c("p",{class:"tw-text-xs tw-uppercase tw-tracking-wide tw-text-gray-500 tw-mb-1"}," Trade-in ",-1)),c("ul",Z,[(s(!0),t($,null,I(e.summary.tradeIns,(r,a)=>(s(),t("li",{key:`trade-${a}`,class:"tw-text-sm tw-text-gray-800"},[R(y(f(r))+" ",1),r.value!=null?(s(),t("span",ee," · "+y(w(r.value))+" credit ",1)):i("",!0)]))),128))])])):i("",!0)],64)):n.value?(s(),t("p",te,y(n.value),1)):i("",!0),e.dealer&&e.dealer.name?(s(),t("div",se,[o[3]||(o[3]=c("p",{class:"tw-text-xs tw-uppercase tw-tracking-wide tw-text-gray-500 tw-mb-1"}," Paid to ",-1)),c("p",ae,y(e.dealer.name),1),e.dealer.phone||e.dealer.email?(s(),t("p",re,[e.dealer.phone?(s(),t("span",ne,y(e.dealer.phone),1)):i("",!0),e.dealer.phone&&e.dealer.email?(s(),t("span",oe," · ")):i("",!0),e.dealer.email?(s(),t("span",ie,y(e.dealer.email),1)):i("",!0)])):i("",!0)])):i("",!0)])):i("",!0)}}),ue={class:"tw-w-full"},ce={key:0,class:"tw-py-12 tw-text-center"},me={key:1,class:"tw-py-12 tw-text-center"},de={key:2,class:"tw-py-12 tw-flex tw-justify-center"},ye={key:3,class:"tw-w-full"},pe=["session-key","payin-id"],E="rainforest-payin-receipt",fe="https://static.rainforestpay.com/payment.js",we=15e3,_e=C({__name:"RainforestPayinReceipt",props:{systemRef:{}},setup(h){const l=h,{session:n,loading:_,error:m,unavailable:f,fetchSession:w,retry:e}=K(l.systemRef),o=v(!1),r=v(!1),a=x(()=>m.value||r.value);let u=null;function P(g=!1){if(customElements.get(E)){o.value=!0;return}B(g),u=setTimeout(()=>{o.value||(r.value=!0),u=null},we),customElements.whenDefined(E).then(()=>{o.value=!0,u&&(clearTimeout(u),u=null)})}N(()=>{w(),P()});const L=()=>{r.value=!1,o.value||P(!0),e()};j(()=>{u&&(clearTimeout(u),u=null)});function B(g=!1){const d=document.querySelector("script[data-rainforest-payment]");if(d&&!g)return;d&&d.remove();const k=U().public.rainforestPay,T=(k==null?void 0:k.paymentScriptUrl)||fe,F=g?`${T}${T.includes("?")?"&":"?"}retry=${Date.now()}`:T,b=document.createElement("script");b.type="module",b.src=F,b.dataset.rainforestPayment="1",b.addEventListener("error",D=>{console.error("[Rainforest] Failed to load payment script:",F,D),r.value=!0}),document.body.appendChild(b)}return(g,d)=>{const k=V;return s(),t("div",ue,[p(f)?(s(),t("div",ce,d[0]||(d[0]=[c("p",{class:"tw-text-gray-700 tw-text-sm"}," This receipt isn't available. If you just completed your payment, please check back shortly, or contact the dealership for a copy. ",-1)]))):p(a)?(s(),t("div",me,[d[2]||(d[2]=c("p",{class:"tw-text-red-600 tw-text-sm tw-mb-4"}
1," Couldn't load the receipt right now. Please try again or contact support if the problem continues. ",-1)),S(k,{color:"primary",variant:"outlined",onClick:L},{default:q(()=>d[1]||(d[1]=[R(" Try again ")])),_:1})])):p(_)||!p(o)?(s(),t("div",de,[S(A,{indeterminate:"",color:"primary"})])):p(n)?(s(),t("div",ye,[S(le,{dealer:p(n).dealer,summary:p(n).summary},null,8,["dealer","summary"]),c("rainforest-payin-receipt",{"session-key":p(n).sessionKey,"payin-id":p(n).payinId,class:"tw-w-full"},null,8,pe)])):i("",!0)])}}}),he={class:"payment-receipt-page"},ve={class:"payment-receipt-card"},ge=C({__name:"[id]",setup(h){const l=M(),n=x(()=>l.params.id.toString());return(_,m)=>(s(),t("div",he,[c("div",ve,[S(_e,{"system-ref":p(n)},null,8,["system-ref"])])]))}}),be=G(ge,[["__scopeId","data-v-3e5393bb"]]);export{be 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.