1import{e as de,y as ce,x as fe,C as me,a7 as pe,Y as ve,u as be,E as _e,c as i,a as t,l as d,F as w,d as T,t as o,k as f,m as ge,i as k,j as A,A as he,b as xe,w as ye,q as a,p as $,s as we,K as ke,_ as $e,h as Le,o as l}from"./D8644rYh.js";import{u as Se}from"./MRLRowXz.js";const Te={class:"min-h-[70vh] bg-ink text-white"},Ae={class:"relative overflow-hidden"},Ce={class:"relative z-10 container mx-auto max-w-3xl px-4 py-16 md:py-24"},Ne={class:"flex items-center gap-3 text-xs font-semibold uppercase tracking-[0.25em] text-primary-200"},De={class:"font-display mt-5 text-3xl font-semibold leading-[1.08] tracking-tight md:text-5xl"},Fe={key:0,class:"mt-4 text-lg text-white/80"},Re={key:0},Ee={class:"mt-8 rounded-2xl bg-white/[0.06] p-6 ring-1 ring-white/15 md:p-8"},Ie={class:"text-xs font-semibold uppercase tracking-[0.2em] text-primary-200"},Me={class:"font-display mt-2 text-4xl font-semibold md:text-5xl"},Oe={class:"mt-2 text-sm text-white/60"},Pe={key:0,class:"mt-1 text-sm text-white/60"},Ue={key:1,class:"mt-6 border-t border-white/10 pt-5"},Ve={class:"text-sm font-semibold text-white/85"},je={class:"mt-2 whitespace-pre-line text-sm leading-relaxed text-white/70"},Be={class:"mt-7 flex flex-wrap gap-3"},qe=["href"],Ke=["href"],He={class:"mt-3 text-xs text-white/50"},Ye={key:1,class:"mt-6 rounded-2xl bg-white/[0.08] p-6 ring-1 ring-white/15 md:p-8","aria-live":"polite"},ze={class:"text-xs font-semibold uppercase tracking-[0.2em] text-primary-200"},Xe={class:"font-display mt-3 text-2xl font-semibold"},Ge={class:"mt-3 text-sm leading-6 text-white/70"},Je=["aria-labelledby"],Qe={key:0,class:"mb-5 rounded-xl bg-primary-50 px-4 py-3 text-sm font-medium text-primary-700"},We={key:1,class:"-mt-3 mb-5 px-1 text-xs text-ink/60"},Ze=["id"],et={class:"mt-2 text-sm leading-6 text-grey-text"},tt={class:"mt-6 grid gap-3 sm:grid-cols-2"},st={class:"text-xs font-semibold uppercase tracking-[0.16em] text-primary-700"},ot=["id"],nt={key:0,class:"block"},at={class:"text-sm font-semibold"},it={key:1,class:"block"},lt={class:"text-sm font-semibold"},rt={class:"block"},ut={class:"text-sm font-semibold"},dt={class:"flex items-start gap-3 rounded-xl bg-gray-50 p-4 text-sm leading-6"},ct={key:2,class:"rounded-xl bg-red-50 px-4 py-3 text-sm text-danger",role:"alert"},ft={class:"flex flex-wrap justify-end gap-3"},mt=["disabled"],pt=["disabled"],vt={key:3,class:"mt-6 rounded-2xl bg-white/[0.08] p-6 ring-1 ring-white/15 md:p-8","aria-live":"polite"},bt={class:"text-xs font-semibold uppercase tracking-[0.2em] text-primary-200"},_t={class:"font-display mt-3 text-2xl font-semibold"},gt={class:"mt-3 text-sm leading-6 text-white/70"},ht={class:"mt-4 inline-flex items-center rounded-full bg-black/15 px-4 py-1.5 text-sm font-semibold text-white"},xt={key:0,class:"mt-3 text-sm text-white/70"},yt={key:4,class:"mt-6 rounded-2xl bg-white/[0.08] p-6 ring-1 ring-white/15 md:p-8","aria-live":"polite"},wt={class:"text-xs font-semibold uppercase tracking-[0.2em] text-primary-200"},kt={class:"font-display mt-3 text-2xl font-semibold"},$t={class:"mt-3 text-sm leading-6 text-white/70"},Lt={key:0,class:"mt-5 grid gap-3 rounded-xl bg-black/15 p-4 text-sm sm:grid-cols-2"},St={class:"text-white/55"},Tt={class:"mt-1 font-medium"},At={class:"text-white/55"},Ct={class:"mt-1 font-mono font-medium"},Nt={key:1,class:"py-20 text-center",role:"status"},Dt={class:"mt-4 text-sm text-white/70"},Ft={class:"font-display text-3xl font-semibold tracking-tight md:text-4xl"},Rt={class:"mt-4 max-w-xl text-white/75"},Et={class:"font-display text-3xl font-semibold tracking-tight md:text-4xl"},It={class:"mt-4 max-w-xl text-white/75"},Mt=["disabled"],Vt=de({__name:"[token]",async setup(Ot){let h,C;const V=ce(),j=fe(),{t:r,locale:v}=me(),N=Se(),{apiBaseUrl:D}=pe().public,b=a(()=>String(V.params.token??"")),{data:s,pending:F,error:B,refresh:R}=([h,C]=ve(()=>Le(`offer-${b.value}`,()=>N(`/o/${b.value}/meta`))),h=await h,C(),h),m=$(null),E=$(null),_=$(!1),c=$(""),u=we({full_name:"",amount:null,message:"",consent:!1}),q=a(()=>`${D}/api/o/${b.value}`),K=a(()=>`${D}/api/o/${b.value}/proof`),H=a(()=>s.value?`${new Intl.NumberFormat(v.value).format(Math.round(s.value.amount))} â¬`:""),Y=a(()=>s.value?new Date(s.value.created_at).toLocaleDateString(v.value,{dateStyle:"long"}):""),I=a(()=>s.value?.valid_until?new Date(`${s.value.valid_until}T12:00:00`).toLocaleDateString(v.value,{dateStyle:"long"}):""),z=a(()=>s.value?.response_recorded_at?new Date(s.value.response_recorded_at).toLocaleStr
1ing(v.value,{dateStyle:"long",timeStyle:"short"}):""),M=e=>{const n=e;return n?.status??n?.statusCode??n?.response?.status??n?.data?.statusCode},X=e=>e?.data?.code,G=a(()=>M(B.value)===404),x=a(()=>!!s.value?.identity),J=a(()=>s.value?.identity?.role==="reader"),L=a(()=>s.value?.identity?.role==="signer"),O=a(()=>{const e=s.value?.identity;return e?`${String(e.first_name??"").trim()} ${String(e.last_name??"").trim()}`.trim():""}),Q=a(()=>!!s.value?.signatures?.mine?.signed_at),W=a(()=>L.value&&Q.value&&s.value?.status==="sent"),Z=a(()=>{const e=s.value?.signatures;return e?r("offer.signaturesProgress",{signed:e.signed_count,total:e.signer_count}):""}),S=a(()=>s.value?.signatures?.signers??[]),P=a(()=>S.value.map(e=>`${e.name} (${r(e.signed?"offer.signers.signed":"offer.signers.pending")})`).join(" · ")),y=a(()=>m.value??"accept"),ee=a(()=>r(`offer.responseActions.${y.value}.kicker`)),te=a(()=>r(`offer.responseActions.${y.value}.title`)),se=a(()=>r(`offer.responseActions.${y.value}.consent`)),oe=a(()=>r(`offer.responseActions.${y.value}.submit`)),ne=a(()=>r(`offer.statuses.${s.value?.status??"expired"}.kicker`)),ae=a(()=>s.value?.response_kind==="counter_proposal"&&s.value.staff_decision?r(`offer.statuses.counter_${s.value.staff_decision}.title`):r(`offer.statuses.${s.value?.status??"expired"}.title`,{amount:s.value?.response_amount?`${new Intl.NumberFormat(v.value).format(Math.round(s.value.response_amount))} â¬`:""})),ie=a(()=>s.value?.response_kind==="counter_proposal"&&s.value.staff_decision?r(`offer.statuses.counter_${s.value.staff_decision}.text`,{amount:s.value.response_amount?`${new Intl.NumberFormat(v.value).format(Math.round(s.value.response_amount))} â¬`:""}):r(`offer.statuses.${s.value?.status??"expired"}.text`,{amount:s.value?.response_amount?`${new Intl.NumberFormat(v.value).format(Math.round(s.value.response_amount))} â¬`:""}));async function U(e){m.value=e,c.value="",u.consent=!1,e==="counter"&&s.value&&(u.amount=Math.round(s.value.amount)),await ke(),E.value?.focus()}function le(){_.value||(m.value=null,c.value="",u.consent=!1)}async function re(){if(!(!m.value||_.value)){if(!x.value&&u.full_name.trim().length<3){c.value=r("offer.errors.fullName");return}if(m.value==="counter"&&(!Number.isSafeInteger(u.amount)||Number(u.amount)<=0)){c.value=r("offer.errors.amount");return}if(!u.consent){c.value=r("offer.errors.consent");return}_.value=!0,c.value="";try{const e=await N(`/o/${b.value}/respond`,{method:"POST",body:{action:m.value,...x.value?{}:{full_name:u.full_name.trim()},amount:m.value==="counter"?u.amount:void 0,message:u.message.trim()||void 0,locale:v.value,consent:!0}});m.value=null;const n=s.value?e.partial?{...s.value,can_respond:!1,signatures:{signer_count:e.signer_count??s.value.signatures?.signer_count??1,signed_count:e.signed_count??s.value.signatures?.signed_count??1,mine:{signed_at:new Date().toISOString(),signed_action:"accept"}}}:{...s.value,status:e.status,can_respond:!1,response_kind:e.response_kind??null,response_amount:e.response_amount??null,response_name:e.response_name??(x.value?O.value:u.full_name.trim()),response_recorded_at:e.response_recorded_at??new Date().toISOString(),response_code:e.response_code??null}:null;n&&(s.value=n),await R().catch(()=>{}),!s.value&&n&&(s.value=n)}catch(e){const n=X(e),g=M(e);n==="OFFER_EXPIRED"?c.value=r("offer.errors.expired"):n==="OFFER_ALREADY_RESPONDED"||g===409?c.value=r("offer.errors.alreadyResponded"):g===429?c.value=r("offer.errors.tooMany"):g===503||g!=null&&g>=500?c.value=r("offer.errors.unavailable"):c.value=r("offer.errors.generic")}finally{_.value=!1}}}async function ue(){await R().catch(()=>{})}return be({title:r("offer.headTitle")}),_e({robots:"noindex, nofollow"}),(e,n)=>{const g=$e;return l(),i("div",Te,[t("section",Ae,[n[8]||(n[8]=t("div",{class:"pointer-events-none absolute inset-0 bg-gradient-to-bl from-primary-600/40 via-transparent to-transparent"},null,-1)),t("div",Ce,[d(s)?(l(),i(w,{key:0},[t("p",Ne,[n[6]||(n[6]=t("span",{class:"h-px w-8 shrink-0 bg-primary-300/70","aria-hidden":"true"},null,-1)),T(" "+o(e.$t("offer.kicker")),1)]),t("h1",De,o(e.$t("offer.title")),1),d(s).dealTitle?(l(),i("p",Fe,[T(o(d(s).dealTitle),1),d(s).dealCity?(l(),i("span",Re," · "+o(d(s).dealCity),1)):f("",!0)])):f("",!0),t("div",Ee,[t("p",Ie,o(e.$t("offer.amountLabel")),1),t("p",Me,o(H.value),1),t("p",Oe,o(e.$t("offer.dated",{date:Y.value})),1),I.value?(l(),i("p",Pe,o(e.$t("offer.validUntil",{date:I.value})),1)):f("",!0),d(s).conditionsText?(l(),i("div",Ue,[t("p",Ve,o(e.$t("offer.conditionsTitle")),1),t("p",je,o(d(s).conditionsText),1)])):f("",!0),t("div",Be,[t("a",{href:q.value,target:"_blank",rel:"noopener",class:"inline-flex h-12 items-center justify-center rounded-full bg-white px-7 font-semibold text-primary-700 transition hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"},o(e.$t("offer.viewPdf")),9,qe),d(s).response_code?(l(),i("a",{key:0,href:K.value,class:"inline-flex h-12 items-center justify-center rounded-full border border-white/25 px-7 font-semibold text-white transition hover:bg-white/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"},o(e.$t("offer.downloadProof")),9,Ke)):f("",!0)]),t("p",He,o(e.$t("offer.note")),1)]),J.value?(l(),i("section",Ye,[t("p",ze,o(e.$t("offer.reader.kicker")),1),t("h2",Xe,o(e.$t("offer.reader.title")),1),t("p",Ge,o(e.$t("offer.reader.text")),1)])):d(s).can_respond?(l(),i("section",{key:2,class:"mt-6 rounded-2xl bg-white p-6 text-ink md:p-8","aria-labelledby":`${b.value}-response-title`},[L.value?(l(),i("p",Qe,o(e.$t("offer.signerBanner",{name:O.value})),1)):f("",!0),L.value&&S.value.length>1?(l(),i("p",We,o(e.$t("offer.signers.title"))+" : "+o(P.value),1)):f("",!0),m.value?(l(),i("form",{key:3,class:"space-y-5",novalidate:"",onSubmit:ge(re,["prevent"])},[t("div",null,[t("p",st,o(ee.value),1),t("h2",{id:`${b.value}-response-title`,class:"font-display mt-2 text-2xl font-semibold"},o(te.value),9,ot)]),x.value?f("",!0):(l(),i("label",nt,[t("span",at,o(e.$t("offer.fullNameLabel")),1),k(t("input",{ref_key:"fullNameInput",ref:E,"onUpdate:modelValue":n[2]||(n[2]=p=>u.full_name=p),required:"",minlength:"3",maxlength:"120",autocomplete:"name",class:"mt-2 h-12 w-full rounded-xl border border-gray-300 px-4 outline-none transition focus:border-primary-600 focus:ring-2 focus:ring-primary-600/20"},null,512),[[A,u.full_name,void 0,{trim:!0}]])])),m.value==="counter"?(l(),i("label",it,[t("span",lt,o(e.$t("offer.counterAmountLabel")),1),k(t("input",{"onUpdate:modelValue":n[3]||(n[3]=p=>u.amount=p),required:"",type:"number",min:"1",step:"1",inputmode:"numeric",class:"mt-2 h-12 w-full rounded-xl border border-gray-300 px-4 outline-none transition focus:border-primary-600 focus:ring-2 focus:ring-primary-600/20"},null,512),[[A,u.amount,void 0,{number:!0}]])])):f("",!0),t("label",rt,[t("span",ut,o(e.$t("offer.messageLabel")),1),k(t("textarea",{"onUpdate:modelValue":n[4]||(n[4]=p=>u.message=p),rows:"3",maxlength:"2000",class:"mt-2 w-full rounded-xl border border-gray-300 px-4 py-3 outline-none transition focus:border-primary-600 focus:ring-2 focus:ring-primary-600/20"},null,512),[[A,u.message,void 0,{trim:!0}]])]),t("label",dt,[k(t("input",{"onUpdate:modelValue":n[5]||(n[5]=p=>u.consent=p),type:"checkbox",required:"",class:"mt-1 h-4 w-4 shrink-0 accent-primary-600"},null,512),[[he,u.consent]]),t("span",null,o(se.value),1)]),c.value?(l(),i("p",ct,o(c.value),1)):f("",!0),t("div",ft,[t("button",{type:"button",class:"h-11 rounded-full px-5 font-semibold text-grey-text hover:bg-gray-100 disabled:opacity-60",disabled:_.value,onClick:le},o(e.$t("offer.cancelAction")),9,mt),t("button",{type:"submit",class:"h-11 rounded-full bg-primary-600 px-6 font-semibold text-white transition hover:bg-primary-500 disabled:cursor-wait disabled:opacity-60",disabled:_.value},o(_.value?e.$t("offer.sendingResponse"):oe.value),9,pt)])],32)):(l(),i(w,{key:2},[t("h2",{id:`${b.value}-response-title`,class:"font-display text-2xl font-semibold"},o(e.$t("offer.respondTitle")),9,Ze),t("p",et,o(e.$t("offer.respondIntro")),1
1),t("div",tt,[t("button",{type:"button",class:"h-12 rounded-full bg-primary-600 px-5 font-semibold text-white transition hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600",onClick:n[0]||(n[0]=p=>U("accept"))},o(e.$t("offer.acceptAction")),1),t("button",{type:"button",class:"h-12 rounded-full border border-gray-300 px-5 font-semibold transition hover:bg-gray-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600",onClick:n[1]||(n[1]=p=>U("counter"))},o(e.$t("offer.counterAction")),1)])],64))],8,Je)):W.value?(l(),i("section",vt,[t("p",bt,o(e.$t("offer.awaiting.kicker")),1),t("h2",_t,o(e.$t("offer.awaiting.title")),1),t("p",gt,o(e.$t("offer.awaiting.text")),1),t("p",ht,o(Z.value),1),S.value.length>1?(l(),i("p",xt,o(e.$t("offer.signers.title"))+" : "+o(P.value),1)):f("",!0)])):(l(),i("section",yt,[t("p",wt,o(ne.value),1),t("h2",kt,o(ae.value),1),t("p",$t,o(ie.value),1),d(s).response_code?(l(),i("dl",Lt,[t("div",null,[t("dt",St,o(e.$t("offer.responseDateLabel")),1),t("dd",Tt,o(z.value),1)]),t("div",null,[t("dt",At,o(e.$t("offer.proofCodeLabel")),1),t("dd",Ct,o(d(s).response_code),1)])])):f("",!0)]))],64)):d(F)?(l(),i("div",Nt,[n[7]||(n[7]=t("span",{class:"inline-block h-8 w-8 animate-spin rounded-full border-2 border-white/25 border-t-primary-300","aria-hidden":"true"},null,-1)),t("p",Dt,o(e.$t("offer.loading")),1)])):G.value?(l(),i(w,{key:2},[t("h1",Ft,o(e.$t("offer.notFoundTitle")),1),t("p",Rt,o(e.$t("offer.notFoundText")),1),xe(g,{to:d(j)("/"),class:"mt-7 inline-flex h-12 items-center justify-center rounded-full bg-white px-7 font-semibold text-primary-700 transition hover:bg-gray-100"},{default:ye(()=>[T(o(e.$t("offer.backHome")),1)]),_:1},8,["to"])],64)):(l(),i(w,{key:3},[t("h1",Et,o(e.$t("offer.loadErrorTitle")),1),t("p",It,o(e.$t("offer.loadErrorText")),1),t("button",{type:"button",class:"mt-7 inline-flex h-12 items-center justify-center rounded-full bg-white px-7 font-semibold text-primary-700 transition hover:bg-gray-100 disabled:cursor-wait disabled:opacity-60",disabled:d(F),onClick:ue},o(e.$t("offer.retryLoad")),9,Mt)],64))])])])}}});export{Vt 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.