1import{_ as ct}from"./CdK0junX.js";import{_ as pt}from"./BODP698o.js";import{e as ut,k as mt,l as bt,H as w,E as j,B as G,c as o,a as n,b as H,t as a,q as e,F as k,n as F,s as x,d as z,w as ft,r as m,o as i,y as T,v as vt,a2 as _t,z as yt,A as v}from"./Bxhr9KyS.js";import{f as U,s as gt,a as q,i as ht,r as kt,b as xt}from"./BmEbFmiV.js";import{u as St,a as wt,v as $t}from"./LhciUrBa.js";import{u as At}from"./qi15kqLs.js";import{s as Ct}from"./2UBjoXOg.js";import{u as Dt}from"./B0FJYG5A.js";import"./Cu51b7Xs.js";import"./B_iN96ON.js";import"./ByBzfwiT.js";import"./CzfGcy3p.js";(function(){try{var d=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};d.SENTRY_RELEASE={id:"ad4c597fcedc8f3d0448a45152bbb50f62a9243a"};var l=new d.Error().stack;l&&(d._sentryDebugIds=d._sentryDebugIds||{},d._sentryDebugIds[l]="f9dd9a66-c74a-43d7-b9c7-57784aa020e8",d._sentryDebugIdIdentifier="sentry-dbid-f9dd9a66-c74a-43d7-b9c7-57784aa020e8")}catch{}})();const It=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function Lt(d,l){const c=String(d.name??"").trim(),_=String(l.name??"").trim(),S=It.compare(c,_);return S!==0?S:c!==_?c<_?-1:1:d.id<l.id?-1:d.id>l.id?1:0}function Ft(d){return[...d??[]].sort(Lt)}const Tt={class:"at-container at-step-page"},Et={class:"at-section-pad"},Nt={class:"at-step-title"},Bt={class:"at-title-border"},Pt={class:"at-display-bold"},Kt={class:"at-step-lede"},Rt={key:0,class:"text-sm text-gray-400","data-testid":"appointment-loading"},Vt={key:1,"data-testid":"appointment-gate-error",class:"text-sm text-yellow-700 bg-yellow-50 border border-yellow-200 rounded-md p-3"},Ot={key:2,"data-testid":"appointment-none-available",class:"text-sm text-yellow-700 bg-yellow-50 border border-yellow-200 rounded-md p-3 mb-4"},jt={key:0,class:"mb-6","data-testid":"appointment-site-picker"},Gt={class:"block text-sm font-semibold text-brand-navy mb-2"},Ht={class:"space-y-2"},zt=["data-testid"],Ut=["value"],qt={class:"text-sm"},Mt={class:"font-medium text-gray-800"},Wt={class:"text-gray-500"},Yt={key:0,"data-testid":"appointment-site-error",role:"alert",class:"mt-2 text-sm text-red-700"},Jt={key:1,class:"mb-6 text-sm text-gray-600","data-testid":"appointment-site-auto"},Qt={class:"font-medium"},Xt={key:2,class:"text-sm text-gray-400 italic mb-4","data-testid":"appointment-no-site"},Zt={key:3,"data-testid":"appointment-no-availability",class:"text-sm text-yellow-700 bg-yellow-50 border border-yellow-200 rounded-md p-3 mb-4"},te={class:"mb-4"},ee={class:"block text-sm font-semibold text-brand-navy mb-2"},ae={class:"flex flex-wrap gap-2","data-testid":"appointment-date-options"},se=["data-testid","aria-pressed","onClick"],ne={key:0,class:"mb-4"},oe={class:"block text-sm font-semibold text-brand-navy mb-2"},ie={key:0,class:"text-sm text-gray-400","data-testid":"appointment-slots-loading"},le={key:1,"data-testid":"appointment-slots-error",role:"alert",class:"text-sm text-red-700"},re={key:2,class:"text-sm text-gray-400 italic","data-testid":"appointment-no-slots"},de={key:3,class:"grid grid-cols-2 sm:grid-cols-3 gap-2","data-testid":"appointment-slot-grid"},ce=["disabled","aria-disabled","onClick"],pe={class:"text-xs opacity-75"},ue={key:1,"data-testid":"appointment-selected-summary",class:"mb-4 rounded-md border border-emerald-200 bg-emerald-50 p-3 text-sm text-emerald-900 flex items-center justify-between gap-3"},me={class:"flex flex-col gap-0.5"},be={"data-testid":"appointment-selected-sentence"},fe={"data-testid":"appointment-selected-when",class:"text-xs opacity-90"},ve={class:"flex justify-between gap-4"},Ie=ut({__name:"appointment",async setup(d){let l,c;const{applicationData:_,hydrateApplication:S,currentStep:M,getAppointmentSlots:W,setAppointmentSelection:$}=Dt(),{fetchConfig:Y}=St(_.value.campaignId??null),{routeBefore:J,routeAfter:E,loadAppointmentGate:Q}=wt(_.value.campaignId??null),{t:y}=mt(),A=bt();M.value=5,[l,c]=w(()=>S()),await l,c(),[l,c]=w(()=>Y()),await l,c();const X=v(()=>A(J("appointment"))),N=m(!0),C=m(!1),B=m(!1),g=m([]),p=m(""),b=m(""),h=m([]),D=m(!1),f=m(null),P=v(()=>g.value.length>1),K=m(!1),Z=v(()=>g.value.find(t=>
1t.id===p.value)??null),r=m({}),tt=v(()=>{const t=new Set;return P.value&&t.add("site"),t}),{surface:R}=At({errors:r,visibleKeys:tt,toast:!0}),V=v(()=>xt(Z.value?.schedule??null)),et=v(()=>!!p.value&&V.value.length===0);function O(){f.value&&(f.value=null,$({distributionSiteId:null,startTime:null}))}async function at(){if(r.value.site="",r.value.slots="",!p.value||!b.value){h.value=[];return}D.value=!0;try{h.value=await W(p.value,b.value)}catch(t){h.value=[],R(t,{formKey:"slots",resolveKey:()=>Ct(t)===403?"site":null})||(r.value.slots=y("appointment.errors.loadFailed"))}finally{D.value=!1}}j(p,()=>{O(),b.value="",h.value=[],r.value.site="",r.value.slots=""}),j(b,()=>{O(),at()});try{const t=([l,c]=w(()=>Q()),l=await l,c(),l),u=$t(t);t?(B.value=t.enabled,g.value=Ft(t.distributionSites),K.value=u==="unavailable",u==="skip"?([l,c]=w(()=>G(A(E("appointment")))),await l,c()):u==="select"&&t.distributionSites.length===1&&(p.value=t.distributionSites[0].id)):(C.value=!0,r.value.gate=y("appointment.errors.loadFailed"))}catch(t){C.value=!0,R(t,{formKey:"gate"})||(r.value.gate=y("appointment.errors.loadFailed"))}finally{N.value=!1}function I(t){return ht(t)}function st(t){I(t)||(f.value=t,$({distributionSiteId:p.value,startTime:t.startsAt}))}const nt=v(()=>b.value?U(b.value):"");function ot(){f.value=null,$({distributionSiteId:null,startTime:null})}function it(t){const u=kt(t);return u===null?y("appointment.unlimited"):u<=0?y("appointment.full"):y("appointment.remaining",{n:u})}async function lt(){await G(A(E("appointment")))}return(t,u)=>{const rt=ct,dt=pt;return i(),o("div",Tt,[n("div",Et,[H(rt,{"current-step":"appointment"}),n("div",Nt,[n("div",Bt,[n("h1",Pt,a(t.$t("appointment.title")),1)])]),n("p",Kt,a(t.$t("appointment.subtitle")),1),e(N)?(i(),o("div",Rt,a(t.$t("common.loading")),1)):e(C)?(i(),o("p",Vt,a(e(r).gate||t.$t("appointment.errors.loadFailed")),1)):e(K)?(i(),o("p",Ot,a(t.$t("appointment.noneAvailable")),1)):e(B)?(i(),o(k,{key:3},[e(P)?(i(),o("div",jt,[n("label",Gt,a(t.$t("appointment.siteLabel")),1),n("div",Ht,[(i(!0),o(k,null,F(e(g),s=>(i(),o("label",{key:s.id,class:T(["flex items-start gap-3 p-3 border rounded-md cursor-pointer hover:bg-gray-50",e(p)===s.id?"border-brand-red bg-red-50":"border-gray-200"]),"data-testid":`appointment-site-option-${s.id}`},[vt(n("input",{"onUpdate:modelValue":u[0]||(u[0]=L=>yt(p)?p.value=L:null),type:"radio",value:s.id,class:"mt-0.5"},null,8,Ut),[[_t,e(p)]]),n("div",qt,[n("div",Mt,a(s.name),1),n("div",Wt,a([s.address,s.city,s.state].filter(Boolean).join(", ")),1)])],10,zt))),128))]),e(r).site?(i(),o("p",Yt,a(e(r).site),1)):x("",!0)])):e(g).length===1?(i(),o("div",Jt,[n("span",Qt,a(t.$t("appointment.siteLabel"))+":",1),z(" "+a(e(g)[0]?.name),1)])):x("",!0),e(p)?e(et)?(i(),o("p",Zt,a(t.$t("appointment.noAvailabilityForSite")),1)):(i(),o(k,{key:4},[n("fieldset",te,[n("legend",ee,a(t.$t("appointment.dateLabel")),1),n("div",ae,[(i(!0),o(k,null,F(e(V),s=>(i(),o("button",{key:s,type:"button","data-testid":`appointment-date-option-${s}`,class:T(["at-nav-button",e(b)===s?"ring-2 ring-brand-red ring-offset-2":""]),"aria-pressed":e(b)===s,onClick:L=>b.value=s},a(e(U)(s)),11,se))),128))])]),e(b)?(i(),o("div",ne,[n("label",oe,a(t.$t("appointment.timeLabel")),1),e(D)?(i(),o("div",ie,a(t.$t("appointment.loadingSlots")),1)):e(r).slots?(i(),o("p",le,a(e(r).slots),1)):e(h).length===0&&!e(r).site?(i(),o("p",re,a(t.$t("appointment.noSlotsForDate")),1)):(i(),o("div",de,[(i(!0),o(k,null,F(e(h),s=>(i(),o("button",{key:s.startsAt,type:"button","data-testid":"appointment-slot",disabled:I(s),"aria-disabled":I(s),class:T(["px-2 py-2 rounded-md border text-xs font-semibold transition-colors disabled:cursor-not-allowed disabled:opacity-60",[e(gt)(s),e(f)?.startsAt===s.startsAt?"ring-2 ring-brand-red":""]]),onClick:L=>st(s)},[n("div",null,a(e(q)(s.startsAt)),1),n("div",pe,a(it(s)),1)],10,ce))),128))]))])):x("",!0),e(f)?(i(),o("div",ue,[n("span",me,[n("span",be,a(t.$t("appointment.selectedSummary")),1),n("span",fe,a(t.$t("appointment.selectedWhen",{date:e(nt),time:e(q)(e(f).startsAt)})),1)]),n("button",{type:"button","data-testid":"appointment-clear-selection",class:"text-xs text-brand-redDark hover:underline whitespace-nowrap",onClick:ot},a(t.$t("appointment.clearSelection")),1)])):x("",!0)],64)):(i(),o("p",Xt,a(t.$t("appointment.noSiteSelected")),1))],64)):x("",!0),n("div",ve,[H(dt,{to:e(X),class:"at-nav-button"},{default:ft(()=>[z(a(t.$t("common.back")),1)]),_:1},8,["to"]),n("button",{type:"button","data-testid":"appointment-next",class:"at-nav-button",onClick:lt},a(t.$t("common.next")),1)])])])}}});
1export{Ie 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.