PageSourceSearch

https://cortico.health/_nuxt/sign-up-2F7R4AwX.js

js cortico.health collected 2026-10-10 01:58:30 UTC 51,552 bytes, 1 lines download raw bytes

1import{e as bt,X as ht,Y as xt,W as wt,Z as kt,a as Ce,u as ze,z as Ke,A as St,$ as Ct,a0 as Ge,y as _t,a1 as qe,a2 as Pe,a3 as Et,x as le,a4 as $t,a5 as Nt,a6 as qt,a7 as re,b as Ze,H as Ie,j as Pt,a8 as De,a9 as It,d as Rt,aa as Lt,o as Tt,i as de,ab as Bt}from"./D1EJK7Tj.js";import{az as Vt,F as l,a5 as r,a8 as a,a9 as x,aa as _,as as Ot,ab as D,aA as At,aB as Mt,a0 as M,a7 as U,am as Ut,ac as Je,d as w,r as N,a as _e,w as me,a4 as j,a3 as Ft,a2 as t,a6 as fe,aq as pe,n as Qe,T as Ve,H as we,b as Xe,ad as jt,Q as Dt,N as xe}from"./vendor-vue-7DQK8ixm.js";import{_ as He}from"./FormField-i0SSqkkT.js";import{_ as ke}from"./FormAutocomplete-CA3w_jwO.js";import{L as et}from"./LogoSpinner-BZGyHcKx.js";import{u as Le}from"./user-C37SFZ8r.js";import{p as Ht,a as Yt,u as Wt}from"./useCerebroAuth-_PyCfSq1.js";import{i as zt}from"./validationUtils-2ca0G7P4.js";import{r as Kt,i as Gt}from"./registrationCases-bPIYZCEY.js";import{u as tt}from"./useTrackAuthEvents-SAPXbUiG.js";import{u as Ee}from"./useApi-C81Sg7Iw.js";import{u as Zt}from"./useErrorReporter-DtHF5UCX.js";import{u as Jt}from"./useFormErrors-DAViwoBq.js";import{d as Qt}from"./nativeUtils-DRfoQiUb.js";import{L as Xt}from"./LoadingSpinner-CeA39AtQ.js";import{_ as ei}from"./SignupStepper-BuYLLfY9.js";import{n as ti}from"./ssoRouting-DJP8mRRj.js";import{r as ii,b as ai}from"./signupIntent-B4EMRPL5.js";import{u as si}from"./useGtag-Dl27AV51.js";import{u as it}from"./cookie-DtWUlz_r.js";try{(function(){var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},u=new e.Error().stack;u&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[u]="460d143a-5dbc-45bd-9b80-61b225d6baec",e._sentryDebugIdIdentifier="sentry-dbid-460d143a-5dbc-45bd-9b80-61b225d6baec")})()}catch{}(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=(function(u){for(var i=1;i<arguments.length;i++){var h=arguments[i];if(h!=null)for(var T in h)h.hasOwnProperty(T)&&(u[T]=h[T])}return u})({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:cortico-website":!0})}catch{}})();const ri={class:"flex flex-col items-center gap-1.5 text-center"},oi={class:"text-lg sm:text-xl font-semibold tracking-tight text-gray-900"},ni={key:0,class:"text-sm leading-relaxed text-gray-500 max-w-sm"},Oe={__name:"StepCardHeader",props:{title:{type:String,required:!0},subtitle:{type:String,default:""}},setup(e){const u=e,i=Vt();function h(S){return!S||!S.length?!0:S.every(v=>v.type===At?!0:v.type===Mt?!String(v.children).trim():v.type===M?h(v.children):!1)}const T=()=>u.subtitle.trim()?!0:!h(i.default?.());return(S,v)=>(r(),l("div",ri,[a("h2",oi,_(e.title),1),T()?(r(),l("p",ni,[Ot(S.$slots,"default",{},()=>[D(_(e.subtitle),1)])])):x("",!0)]))}},li={class:"flex flex-col gap-6","data-testid":"signup-step-summary"},ci={class:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-5"},ui={class:"text-xs font-medium text-gray-500"},di={class:"text-sm text-gray-900 mt-0.5"},mi={class:"flex items-center justify-between gap-3 pt-2"},pi={class:"text-xs text-gray-500"},fi={__name:"StepSummary",props:{title:{type:String,required:!0},subtitle:{type:String,default:"Your practice is already registered, so these details can no longer be edited here."},backLabel:{type:String,default:"Back to verification"},footnote:{type:String,default:"Need to change something? Update it in your dashboard."},items:{type:Array,default:()=>[]}},emits:["back"],setup(e){return(u,i)=>(r(),l("div",li,[U(Oe,{title:e.title,subtitle:e.subtitle},null,8,["title","subtitle"]),a("dl",ci,[(r(!0),l(M,null,Ut(e.items,h=>(r(),l("div",{key:h.label,class:Je(h.wide?"sm:col-span-2":"")},[a("dt",ui,_(h.label),1),a("dd",di,_(h.value||"—"),1)],2))),128))]),a("div",mi,[a("p",pi,_(e.footnote),1),a("button",{type:"button","data-testid":"signup-summary-back",class:"shrink-0 px-4 py-2.5 text-sm font-medium text-gray-700 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors whitespace-nowrap",onClick:i[0]||(i[0]=h=>u.$emit("back"))},_(e.backLabel),1)])]))}},at=()=>{const{public:{WEAK_SALTKEY:e}}=bt(),{post:u}=Ee(),i={workEmail:"e",password:"p",firstName:"f",lastName:"l",occupation:"o",specialty:"s",subspecialty:"ss",practiceName:"pn",practicePhoneNumber:"ph",allowNumberPublic:"ap",practiceAddress:"pa",practiceCity:"pc",practiceProvince:"pp",slug:"sl",practiceCountry:"py",practiceEmail:"pe",practiceFaxNumber:"pf",pendingClinicUuid:"cu",clinicChosenUpfront:"cw"},h=Object.entries(i).reduce((E,[q,P])=>(E[P]=q,E),{}),T=E=>Object.entries(E).reduce((q,[P,d])=>(d!==""&&d!==null&&d!==void 0&&(q[i[P]||P]=d),q),{}),S=E=>Object.entries(E).reduce((q,[P,d])=>(q[h[P]||P]=d,q),{}),v=(E,q)=>{const d={d:T(E),s:q};return xt(d,e)};return{generateResumeLink:(E,q,P,d={})=>{const g=v(E,q),R=new URLSearchParams,B=[d.source,P].find(F=>F&&!wt(F));return B&&R.set("utm_source",B),R.set("entry_mechanism",d.source||"followup"),R.set("d",encodeURIComponent(g)),`${kt()}/auth/sign-up/?${R.toString()}`},generateResumeToken:v,parseResumeLink:E=>{const P=new URLSearchParams(E.split("?")[1]).get("d")||"",d=ht(P,e);if(!d||typeof d!="object")return{data:{},activeStep:null};const{d:g,s:R}=d;return{data:S(g),activeStep:R}}
1,sendResumeLinkEmail:async(E,q,P)=>{const d=v(E,q);try{await u("/api/send-resume-link-email/",{email:P,resumeToken:d,activeStep:q})}catch{}}}},Ye={},vi=()=>{const{post:e}=Ee(),{generateResumeLink:u}=at();return async(h,T,S)=>{if(Ye[h])return;let v;try{v=u(S,h+1,void 0,{source:"resume_email",medium:"email",campaign:"signup_resume"})}catch{v=void 0}try{await e("/api/self-registration/tracking",{stepNumber:h,resumeLink:v,...T}),Ye[h]=!0}catch{}}},gi={key:0,href:"/features/",target:"_blank",class:"text-cortico-blue font-medium underline underline-offset-2"},yi={key:0,role:"alert",class:"rounded-2xl border border-blue-100 bg-blue-50 p-4 flex flex-col gap-3"},bi={class:"flex items-start gap-3"},hi={class:"flex-1 min-w-0"},xi={class:"text-sm text-gray-600 mt-0.5"},wi={class:"font-medium text-gray-800"},ki={class:"flex flex-col gap-2 pl-11"},Si=["href"],Ci={class:"grid grid-cols-2 gap-x-6 gap-y-3 sm:gap-y-4"},_i={key:0,class:"col-span-2 p-4 bg-blue-50 border border-blue-200 rounded-lg"},Ei={key:1,class:"text-sm text-blue-800"},$i={key:0,class:"col-span-2 text-xs text-gray-500"},Ni={class:"flex items-center justify-end pt-2"},qi=["disabled"],Pi={key:1},Ii={__name:"UserInfoStep",props:{modelValue:{type:Object,required:!0},utmSource:{type:String,default:""},flow:{type:String,default:""},locked:{type:Boolean,default:!1},signedIn:{type:Boolean,default:!1}},emits:["updateSteps","update:modelValue","bypassWarning","backToSummary"],setup(e,{emit:u}){const i=Le(),{trackStepEntry:h,trackStepSubmission:T}=tt(),{$activeBus:S}=Ce(),v=ze(),{post:f}=Ee(),C=vi(),A=Zt(),{utm:E}=Ke(),{acquisition:q}=St(),P=w(()=>E.value.utm_source),d=w(()=>v.query.clinic||E.value.clinic||""),g=w(()=>!!v.query.email&&!!c.modelValue.workEmail),R=N(!1),B=N(!1),F=N(!1),V=N(null),c=e,ce=w(()=>{const y=[{label:"First Name",value:c.modelValue.firstName},{label:"Last Name",value:c.modelValue.lastName},{label:"Profession or Role",value:c.modelValue.occupation,wide:!0},{label:"Specialty",value:c.modelValue.specialty},{label:"Subspecialty",value:c.modelValue.subspecialty},{label:"Work Email",value:c.modelValue.workEmail,wide:!0}];return c.signedIn?y.filter(m=>m.value):y}),n=w(()=>c.signedIn&&!c.locked?{subtitle:"You're signed in, so we already have your details.",footnote:"Wrong account? Sign out and sign in with the right one.",backLabel:"Continue"}:{}),oe=u,Z=w(()=>[...Ct,"Non-Healthcare (Patients)"]),Y=["patient","patients","non-healthcare (patients)"],ee=w(()=>Y.includes((c.modelValue.occupation||"").toLowerCase().trim())),p=w(()=>c.flow==="plugin"||Ge(P.value)),H=w(()=>(c.modelValue.occupation||"").toLowerCase().includes("naturopath")),{fieldErrors:O,validateForm:W,isValid:J}=Jt(c.modelValue,[{key:"firstName",rules:[{validator:y=>!!y,message:"First name is required"}]},{key:"lastName",rules:[{validator:y=>!!y,message:"Last name is required"}]},{key:"workEmail",rules:[{validator:y=>g.value||!!y,message:"Work email is required"},{validator:y=>g.value||zt(y),message:"Invalid email address"}]},{key:"occupation",rules:[{validator:y=>Z.value.includes(y),message:"Please choose a profession from the list"}]}]),{root:te,markSubmitted:ie}=_t("SignupUserInfoStep",{errors:O}),z=w(()=>{const y=c.modelValue.occupation;return y&&qe[y]?qe[y]:y?[]:Object.values(qe).flat()}),ue=w(()=>{const y=c.modelValue.specialty;return y&&Pe[y]?Pe[y]:y?[]:Object.values(Pe).flat()}),K=()=>{const{utmSource:y,basis:m,channel:I}=q();return{email:c.modelValue.workEmail,fullName:`${c.modelValue.firstName} ${c.modelValue.lastName}`,occupation:c.modelValue.occupation,specialty:c.modelValue.specialty,subspecialty:c.modelValue.subspecialty,utmSource:y,acquisitionChannel:I,attributionBasis:m,flow:c.flow||v.query.flow||"",entryMechanism:v.query.entry_mechanism||"",gclid:E.value.gclid||void 0,referrer:document.referrer,...c.flow==="claim"&&d.value?{claimedClinic:d.value}:{}}},k=async()=>{if(!R.value&&(W(),!!J.value)){B.value&&!F.value&&(F.value=!0,B.value=!1),R.value=!0;try{const y=Le();if(!F.value){const I=await f(Ht(Et("validate-email/")),{email:c.modelValue.workEmail});if(I.error)throw I}const m=K();if(await T("USER_DETAILS",m.utmSource,{...m,case:Kt({providerId:v.query.provider_id,isEmailLocked:g.value,hasMatchingProviders:!1,hasClaimedProvider:!1})}),P.value!=="followup"&&await C(1,m,c.modelValue),y.accessToken)try{const I=le("").replace(/\/api\/?$/,"");await $fetch(Yt(`${I}/auth/update-provider-profile/`),{method:"POST",headers:{"Content-Type":"application/json"}
1,body:{first_name:c.modelValue.firstName,last_name:c.modelValue.lastName,occupation:c.modelValue.occupation,specialty:c.modelValue.specialty||void 0,subspecialty:c.modelValue.subspecialty||void 0}})}catch{S.$emit("showSnackbar",{title:"Error",description:"Failed to save your profile. Please try again.",error:!0});return}ie(),oe("updateSteps",{stepIndex:0,completed:!0})}catch(y){const m=y.error,I=y.data,ve=m?.message??"",G=y.status??m?.status??null,Q=(typeof I?.error=="string"?I.error:"")||(G===400?"Invalid email":"We couldn't verify your email right now. Please try again.");if(G===400||Q.toLowerCase().includes("email")&&Q.toLowerCase().includes("exists"))try{await $fetch("/api/error-report",{method:"POST",body:{context:"Self Registration User Info Submission",url:typeof window<"u"&&window.location?.href||"N/A",...c.modelValue,error:ve||Q}})}catch{}else await A("Self Registration User Info Submission",{...c.modelValue,error:ve||Q},{email:!0});if(Q.toLowerCase().includes("email")&&Q.toLowerCase().includes("exists")){B.value=!0,F.value=!1,V.value=I;return}S?.$emit("showSnackbar",{title:"Error",description:Q,error:!0})}finally{R.value=!1}}};_e(async()=>{await h("USER_DETAILS",q().utmSource,{email:c.modelValue.workEmail})});const $=()=>{F.value=!0,B.value=!1,k()},L=async y=>{oe("bypassWarning"),await Qe(),window.location.href=y};return me(()=>c.modelValue.occupation,()=>{c.modelValue.specialty="",c.modelValue.subspecialty=""}),me(()=>c.modelValue.specialty,()=>{c.modelValue.subspecialty=""}),me(()=>c.modelValue.workEmail,()=>{B.value=!1,F.value=!1,V.value=null}),(y,m)=>e.locked||e.signedIn?(r(),j(fi,Ft({key:0,title:"Your information",items:t(ce)},t(n),{onBack:m[0]||(m[0]=I=>y.$emit("backToSummary"))}),null,16,["items"])):(r(),l("form",{key:1,ref_key:"funnelRoot",ref:te,class:"flex flex-col gap-4 sm:gap-6",novalidate:"",onSubmit:pe(k,["prevent"])},[U(Oe,{title:"Your information"},{default:fe(()=>[!e.modelValue.occupation||t(ee)?(r(),l(M,{key:0}
1,[c.flow==="claim"?(r(),l(M,{key:0},[D(" Tell us about yourself so we can verify you work at this practice. ")],64)):(r(),l(M,{key:1},[D(_(t(p)?"Confirm your professional profile and practice info, then we'll guide you through setting up patient messaging.":"Confirm your professional profile and practice info, then we'll guide you through setting up "),1),t(p)?x("",!0):(r(),l("a",gi,"free tools")),t(p)?x("",!0):(r(),l(M,{key:1},[D(".")],64))],64))],64)):x("",!0)]),_:1}),t(B)?(r(),l("div",yi,[a("div",bi,[m[11]||(m[11]=a("div",{class:"w-8 h-8 rounded-xl bg-white border border-blue-100 flex items-center justify-center shrink-0"},[a("svg",{class:"w-4 h-4 text-cortico-blue",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})])],-1)),a("div",hi,[m[10]||(m[10]=a("p",{class:"text-sm font-semibold text-gray-900"},"Account already exists",-1)),a("p",xi,[t(V)?.clinic_host?(r(),l(M,{key:0},[t(V).clinic_name?(r(),l(M,{key:0},[m[8]||(m[8]=D("You already have an account at ",-1)),a("strong",wi,_(t(V).clinic_name),1),m[9]||(m[9]=D(".",-1))],64)):(r(),l(M,{key:1},[D("You already have an account on Cortico.")],64))],64)):(r(),l(M,{key:1},[D("This email is already registered on Cortico.")],64))])])]),a("div",ki,[t(V)?.clinic_host?(r(),l("a",{key:0,href:"https://"+t(V).clinic_host+"/sign_in/",target:"_blank",class:"w-full py-2 px-4 text-center text-sm font-semibold rounded-lg bg-corticoBlue-700 hover:bg-cortico-blue text-white transition-colors"}," Sign in to your account ",8,Si)):(r(),l("a",{key:1,class:"w-full py-2 px-4 text-center text-sm font-semibold rounded-lg bg-corticoBlue-700 hover:bg-cortico-blue text-white transition-colors cursor-pointer",onClick:m[1]||(m[1]=pe(I=>L("/auth/sign-in/?userType=provider"),["prevent"]))}," Sign in to your account ")),a("button",{type:"button",class:"w-full py-2 px-4 text-sm font-semibold rounded-lg border border-blue-200 bg-white hover:bg-blue-50 text-cortico-blue transition-colors",onClick:$}," I'm adding a second clinic ")])])):x("",!0),a("div",Ci,[U(ke,{modelValue:e.modelValue.occupation,"onUpdate:modelValue":m[2]||(m[2]=I=>e.modelValue.occupation=I),label:"Profession or Role",variant:"compact",class:"col-span-2","input-props":{id:"occupation",placeholder:"Choose from the list"},options:t(Z),required:"","is-error":!!t(O).occupation,"helper-text":t(O).occupation},null,8,["modelValue","options","is-error","helper-text"]),t(ee)?(r(),l("div",_i,[t(i).loggedIn?(r(),l(M,{key:0},[m[12]||(m[12]=a("p",{class:"text-sm text-blue-800 mb-3"},"This form is for healthcare provider registration. Head to your patient dashboard to see your clinics.",-1)),m[13]||(m[13]=a("div",{class:"flex justify-end"},[a("a",{href:"/guide/",class:"px-4 py-2 text-sm font-semibold text-white rounded-lg bg-corticoBlue-700 hover:bg-cortico-blue transition-colors"},"Go to patient dashboard")],-1))],64)):(r(),l("p",Ei,[m[14]||(m[14]=D(" If you're a patient, you can ",-1)),a("a",{class:"text-cortico-blue underline font-medium",onClick:m[3]||(m[3]=pe(I=>L("/auth/sign-in/?userType=patient"),["prevent"]))},"sign in here"),m[15]||(m[15]=D(" instead. ",-1))]))])):x("",!0),e.modelValue.occupation&&!t(ee)?(r(),l(M,{key:1},[e.modelValue.workEmail?(r(),l("p",$i," Signed in as "+_(e.modelValue.workEmail),1)):x("",!0),U(He,{modelValue:e.modelValue.firstName,"onUpdate:modelValue":m[4]||(m[4]=I=>e.modelValue.firstName=I),label:"First Name",variant:"compact","input-props":{id:"firstName",placeholder:"Jane"},class:"col-span-2 sm:col-span-1",required:"","is-error":!!t(O).firstName,"helper-text":t(O).firstName},null,8,["modelValue","is-error","helper-text"]),U(He,{modelValue:e.modelValue.lastName,"onUpdate:modelValue":m[5]||(m[5]=I=>e.modelValue.lastName=I),label:"Last Name",variant:"compact","input-props":{id:"lastName",placeholder:"Doe"},class:"col-span-2 sm:col-span-1",required:"","is-error":!!t(O).lastName,"helper-text":t(O).lastName},null,8,["modelValue","is-error","helper-text"]),t(z).length&&c.modelValue.occupation!=="Registered Nurse"&&!t(H)?(r(),j(ke,{key:1,modelValue:e.modelValue.specialty,"onUpdate:modelValue":m[6]||(m[6]=I=>e.modelValue.specialty=I),label:"Specialty (Optional)",variant:"compact","input-props":{id:"specialty",placeholder:"Choose or type your own"},options:t(z),"free-solo":"",class:"col-span-2 sm:col-span-1"},null,8,["modelValue","options"])):x("",!0),t(z).length&&c.modelValue.occupation!=="Pharmacist"&&c.modelValue.occupation!=="Nurse Practitioner"&&c.modelValue.occupation!=="Registered Nurse"&&!t(H)?(r(),j(ke,{key:2,modelValue:e.modelValue.subspecialty,"onUpdate:modelValue":m[7]||(m[7]=I=>e.modelValue.subspecialty=I),label:"Subspecialty (Optional)",variant:"compact","input-props":{id:"subspecialty",placeholder:"Choose or type your own"},options:t(ue),"free-solo":"",class:"col-span-2 sm:col-span-1"},null,8,["modelValue","options"])):x("",!0)],64)):x("",!0)]),e.modelValue.occupation&&!t(ee)?(r(),l(M,{key:1},[m[16]||(m[16]=a("a",{target:"_blank",href:"mailto:[email protected]?subject=Help+Me+Sign+Up+for+Cortico",class:"text-xs text-cortico-blue underline text-center"}," Need assistance? We're here to help ",-1)),a("div",Ni,[a("button",{disabled:t(R),class:"px-5 py-2.5 text-sm font-bold text-white rounded-lg bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 transition-colors whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-2"},[t(R)?(r(),j(et,{key:0,class:"text-white"})):(r(),l("span",Pi,"Continue to clinic details"))],8,qi)])],64)):x("",!0)],544))}},Se=2,Ri=50,Li=300,ne=Object.freeze({title:"Where do you work?",subtitle:"Tell us your clinic so we can verify your access. You don't need to own or manage it.",registerNewLink:"My clinic isn't on Cortico yet — register it",registerNewFooter:"I don't see my clinic — register a new one",registerNewButton:"Continue with this Clinic",searchUnavailable:"Search is temporarily unavailable. Please try again."}),Ti=e=>(e||"").replace(/\b(Dr|Mr|Mrs|Ms|St|Mt|Prof)(?!\.)(\s|$)/gi,"$1.$2"),Te=({clinic_address:e,clinic_city:u,clinic_province:i}={})=>
1[e,u,i].filter(Boolean).join(", "),Bi=(e,u)=>{!e||!u||(e.cerebro_clinic_id=u.id,e.cerebro_clinic_slug=u.clinic_slug,e.practiceName=u.clinic_name,e.practicePhoneNumber=u.phone_number,e.practiceFaxNumber=u.fax_number,e.practiceAddress=u.clinic_address,e.practiceCity=u.clinic_city,e.practiceCountry=u.clinic_country,e.practiceProvince=Nt[u.clinic_province])},rs=(e={})=>{if(!e?.cerebro_clinic_id)return null;const u=e.practiceName;return{id:e.cerebro_clinic_id,clinic_slug:e.cerebro_clinic_slug||"",clinic_name:typeof u=="string"?u:u?.clinic_name||"",clinic_address:e.practiceAddress||"",clinic_city:e.practiceCity||"",clinic_province:e.practiceProvince||"",phone_number:e.practicePhoneNumber||"",fax_number:e.practiceFaxNumber||""}},Vi=({get:e,posthog:u,flow:i=()=>"",onSearch:h=null,onNoResults:T=null}={})=>{const S=N([]),v=N(!1),f=N(!1),C=N(!1),A=async(d="",{isUserInitiated:g=!1}={})=>{if(!d||d.length<Se){S.value=[],f.value=!1;return}try{v.value=!0,f.value=!1;const R=await e(le("collected-clinics-public/clinic-names/"),{params:{search:d||void 0,limit:Ri}});S.value=R?.data||[],h?.({searchTerm:d,isUserInitiated:g,resultCount:S.value.length}),S.value.length===0&&(T?.({searchTerm:d,isUserInitiated:g}),$t(u,{searchTerm:d,flow:i(),isUserInitiated:g}))}catch{S.value=[],f.value=!0}finally{v.value=!1}},E=Qt(d=>{const g=Ti((typeof d=="string"?d:"")?.trim());g&&g.length>=Se?A(g,{isUserInitiated:!0}):S.value=[]},Li),q=async(d,{email:g=""}={})=>{if(!d||typeof d=="string")return null;const R=d.clinic_slug;if(!R)return null;try{C.value=!0;const B=g?`?email=${encodeURIComponent(g)}`:"",V=(await e(le(`collected-clinics-public/${R}/`)+B)).data;return V?{clinic:V,isClaimed:Gt(V)}:null}catch{return null}finally{C.value=!1}};return{clinicOptions:S,isClinicsLoading:v,clinicSearchError:f,isClinicDetailsFetching:C,fetchClinicOptions:A,debouncedFetchClinicOptions:E,resolveClinic:q,resolveClinicByEmrHost:async(d,{email:g=""}={})=>{if(!d)return null;try{C.value=!0;const B=((await e(le("plugin-clinic-lookup/"),{params:{emr_host:d}}))?.data||[]).map(c=>c?.host).find(Boolean);if(!B)return null;const V=((await e(le("collected-clinics-public-lite/"),{params:{host:B,limit:1}}))?.data?.results||[])[0];return V?.clinic_slug?await q(V,{email:g}):null}catch{return null}finally{C.value=!1}}}},Oi={key:0,class:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2"},Ai={class:"bg-gray-50 rounded-xl p-4 flex items-start gap-3"},Mi={class:"text-sm min-w-0"},Ui={class:"font-semibold text-gray-900"},Fi={key:0,class:"text-gray-500 mt-1 text-xs"},ji={class:"flex flex-wrap gap-x-4 mt-1.5"},Di={key:0,class:"text-gray-500 text-xs"},Hi={key:1,class:"text-gray-500 text-xs"},Yi={key:1,class:"text-xs text-gray-500 mt-2.5"},Be={__name:"ClinicSummaryTile",props:{clinic:{type:Object,required:!0},label:{type:String,default:""},footnote:{type:String,default:""}},setup(e){return(u,i)=>(r(),l("div",null,[e.label?(r(),l("p",Oi,_(e.label),1)):x("",!0),a("div",Ai,[i[0]||(i[0]=a("div",{class:"w-9 h-9 rounded-xl bg-white border border-gray-200 flex items-center justify-center shrink-0"},[a("svg",{class:"w-[18px] h-[18px] text-gray-500",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"})])],-1)),a("div",Mi,[a("p",Ui,_(e.clinic.clinic_name),1),e.clinic.clinic_address?(r(),l("p",Fi,_(t(Te)(e.clinic)),1)):x("",!0),a("div",ji,[e.clinic.phone_number?(r(),l("p",Di," Phone: "+_(e.clinic.phone_number),1)):x("",!0),e.clinic.fax_number?(r(),l("p",Hi," Fax: "+_(e.clinic.fax_number),1)):x("",!0)])])]),e.footnote?(r(),l("p",Yi,_(e.footnote),1)):x("",!0)]))}},Wi={"data-testid":"claimed-clinic-card",class:"border border-gray-200 rounded-2xl p-5 flex flex-col gap-4"},zi={key:0,"data-testid":"claimed-clinic-access-request-success",class:"p-3.5 bg-green-50 border border-green-100 rounded-lg flex items-start gap-2.5"},Ki={key:1,role:"alert",class:"p-3.5 bg-red-50 border border-red-100 rounded-lg"},Gi={class:"text-sm text-red-600"},Zi={key:2,class:"flex gap-3 items-end"},Ji={key:0,class:"flex flex-col gap-1.5 shrink-0"},Qi=["disabled"],Xi={class:"flex flex-col gap-1.5 flex-1"},ea=["href"],ta=["disabled"],ia={class:"flex flex-col gap-2.5"},aa=["disabled"],We={__name:"ClaimedClinicCard",props:{clinic:{type:Object,required:!0},accessRequestSent:{type:Boolean,default:!1},accessRequestLoading:{type:Boolean,default:!1},errorMessage:{type:String,default:""},conflictField:{type:String,default:""},busy:{type:Boolean,default:!1},resetLabel:{type:String,default:"Search for a different clinic"}}
1,emits:["request-access","sign-in-opened","register-different","reset"],setup(e){return(u,i)=>(r(),l("div",Wi,[U(Be,{clinic:e.clinic,label:"Already on Cortico"},null,8,["clinic"]),e.accessRequestSent?(r(),l("div",zi,[...i[5]||(i[5]=[a("svg",{class:"w-[18px] h-[18px] text-green-600 shrink-0 mt-px",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"})],-1),a("p",{class:"text-sm text-green-800"},"Access request sent! The clinic team and Cortico support have been notified.",-1)])])):x("",!0),e.errorMessage&&!e.accessRequestSent?(r(),l("div",Ki,[a("p",Gi,_(e.errorMessage),1)])):x("",!0),e.clinic.host?(r(),l("div",Zi,[!e.accessRequestSent&&!e.clinic.has_matching_provider?(r(),l("div",Ji,[i[6]||(i[6]=a("span",{class:"text-xs text-gray-500 text-center"},"No access yet?",-1)),a("button",{"data-testid":"claimed-clinic-request-access",type:"button",disabled:e.accessRequestLoading,class:"py-2 sm:py-2.5 px-3 sm:px-5 text-sm font-semibold rounded-lg transition-colors text-corticoBlue-700 border border-corticoBlue-700 hover:bg-corticoBlue-50 whitespace-nowrap disabled:opacity-60",onClick:i[0]||(i[0]=h=>u.$emit("request-access"))},_(e.accessRequestLoading?"Sending…":"Request access"),9,Qi)])):x("",!0),a("div",Xi,[i[8]||(i[8]=a("span",{class:"text-xs text-gray-500 text-center"},"Already have access?",-1)),a("a",{"data-testid":"claimed-clinic-sign-in",href:"https://"+e.clinic.host+"/sign_in/",target:"_blank",class:"py-2 sm:py-2.5 px-3 sm:px-4 text-sm font-semibold rounded-lg transition-colors text-white bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 flex justify-center items-center gap-2",onClick:i[1]||(i[1]=h=>u.$emit("sign-in-opened"))},[...i[7]||(i[7]=[a("span",null,"Go to Sign In",-1),a("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14 5l7 7m0 0l-7 7m7-7H3"})],-1)])],8,ea)])])):!e.accessRequestSent&&!e.clinic.has_matching_provider?(r(),l("button",{key:3,"data-testid":"claimed-clinic-request-access",type:"button",disabled:e.accessRequestLoading,class:Je(["w-full py-2.5 px-4 text-center text-sm font-semibold rounded-lg transition-colors flex justify-center items-center",e.accessRequestLoading?"bg-gray-400 text-white":"bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 text-white"]),onClick:i[2]||(i[2]=h=>u.$emit("request-access"))},_(e.accessRequestLoading?"Sending…":"I work here — request access"),11,ta)):x("",!0),a("div",ia,[e.conflictField?(r(),l("button",{key:0,"data-testid":"claimed-clinic-register-different",type:"button",disabled:e.busy,class:"text-xs text-gray-500 hover:text-gray-700 hover:underline text-left disabled:opacity-60",onClick:i[3]||(i[3]=h=>u.$emit("register-different"))}," Different clinic that happens to share this "+_(e.conflictField)+"? Register it anyway — Cortico staff will review. ",9,aa)):x("",!0),a("button",{type:"button","data-testid":"claimed-clinic-reset-search",class:"text-sm font-medium text-cortico-blue hover:underline text-left",onClick:i[4]||(i[4]=h=>u.$emit("reset"))},_(e.resetLabel),1)])]))}},sa={class:"fixed inset-0 flex justify-center gap-4 font-medium rounded-md sm:absolute bg-slate-400 bg-opacity-15 overlay z-100"},ra={class:"fixed flex p-4 transform -translate-y-1/2 bg-white rounded-md shadow-sm sm:absolute top-1/2"},oa={__name:"PrefillingOverlay",setup(e){return(u,i)=>(r(),l("div",sa,[a("div",ra,[U(Xt,{"loading-context":"Fetching clinic details..."})])]))}},na={class:"flex flex-col gap-6"},la={key:1,"data-testid":"prestep-detected-unclaimed-card",class:"border border-gray-200 rounded-2xl p-5 flex flex-col gap-4"},ca={class:"flex gap-3"},ua={key:0,class:"px-4 py-2 text-sm text-red-600 border-t border-gray-100"},da={key:0,role:"alert","data-testid":"prestep-clinic-search-unavailable",class:"-mt-2 text-sm text-red-600"},ma={key:2,"data-testid":"prestep-unclaimed-card",class:"border border-gray-200 rounded-2xl p-5 flex flex-col gap-4"},pa={class:"flex gap-3"},fa={key:3,class:"flex flex-col gap-4"},va={class:"text-sm text-gray-500","data-testid":"prestep-no-results"},ga={class:"flex items-center justify-end"},ya={__name:"FindYourClinicStep",props:{registrant:{type:Object,default:()=>({})},flow:{type:String,default:""},emrHost:{type:String,default:""},addingClinic:{type:Boolean,default:!1}},emits:["continue"],setup(e,{emit:u}){const i=e,h=u,{$posthog:T}=Ce(),{get:S,post:v}=Ee(),f=N(i.emrHost?"detecting":"searching"),C=N(null),A=N(!1),E=N(""),q=N(!1),P=N(!1),d=N(""),g=w(()=>typeof E.value=="string"?E.value.trim():E.value?.clinic_name||""),R=N(!1),B=()=>i.flow||"signup",{clinicOptions:F,isClinicsLoading:V,clinicSearchError:c,isClinicDetail
1sFetching:ce,debouncedFetchClinicOptions:n,resolveClinic:oe,resolveClinicByEmrHost:Z}=Vi({get:S,posthog:T,flow:B,onSearch:({resultCount:k})=>{R.value=k===0}}),Y=w(()=>g.value.length>=Se),ee=w(()=>R.value&&!V.value&&!c.value&&g.value.length>=Se),p=w(()=>A.value?i.addingClinic?"That clinic is already on Cortico":"You already have an account":f.value==="detected"?"We found your clinic":ne.title),H=w(()=>A.value?i.addingClinic?"Someone has already set it up. Ask them for access, or sign in if you have it.":"Your clinic is already set up on Cortico — sign in to get to it.":f.value==="detected"?"Confirm this is where you work and we'll carry the details over.":ne.subtitle),O=k=>qt(T,{outcome:k,clinicSlug:C.value?.clinic_slug||null,flow:B(),emrHostProvided:!!i.emrHost}),W=k=>{k&&O(k),f.value="searching",C.value=null,A.value=!1,q.value=!1,d.value=""},J=(k,{claimedOutcome:$,unclaimedOutcome:L,detected:y=!1})=>{C.value=k.clinic,A.value=k.isClaimed,f.value=y?"detected":k.isClaimed?"claimed":"confirming",O(k.isClaimed?$:L)};_e(async()=>{if(!i.emrHost)return;const k=await Z(i.emrHost,{email:i.registrant.workEmail});if(!k){f.value="searching",O(re.EMR_AUTODETECT_MISS);return}J(k,{claimedOutcome:re.EMR_AUTODETECT_CLAIMED,unclaimedOutcome:re.EMR_AUTODETECT_UNCLAIMED,detected:!0})}),me(E,k=>{typeof k=="string"&&(R.value=!1,f.value!=="searching"&&W(null),n(k))});const te=async k=>{if(!k||typeof k!="object"||!k.clinic_name)return;const $=await oe(k,{email:i.registrant.workEmail});if(!$){d.value="We couldn't check that clinic. Please try selecting it again.";return}d.value="",J($,{claimedOutcome:re.SEARCH_CLAIMED,unclaimedOutcome:re.SEARCH_UNCLAIMED})},ie=(k,$)=>{O($),h("continue",{mode:"claim",clinic:k})},z=()=>{Y.value&&(document.activeElement?.blur(),O(re.NO_MATCH_REGISTER_NEW),h("continue",{mode:"new",practiceName:g.value}))},ue=async()=>{if(!(!C.value||P.value)){P.value=!0,d.value="";try{await v(le(`collected-clinics-public/${C.value.clinic_slug}/request-access/`),{email:i.registrant.workEmail,name:`${i.registrant.firstName||""} ${i.registrant.lastName||""}`.trim()}),q.value=!0,O(re.ACCESS_REQUESTED)}catch{d.value="Failed to send access request. Please try again or contact [email protected]."}finally{P.value=!1}}},K=()=>O(re.SIGN_IN_OPENED);return(k,$)=>(r(),l(M,null,[U(Ve,null,{default:fe(()=>[t(ce)?(r(),j(oa,{key:0})):x("",!0)]),_:1}),a("div",na,[U(Oe,{title:t(p),subtitle:t(H)},null,8,["title","subtitle"]),t(f)==="detected"&&t(C)?(r(),l(M,{key:0},[t(A)?(r(),j(We,{key:0,clinic:t(C),"access-request-sent":t(q),"access-request-loading":t(P),"error-message":t(d),"reset-label":"This isn't my clinic — search instead",onRequestAccess:ue,onSignInOpened:K,onReset:$[0]||($[0]=L=>W("emr_autodetect_rejected"))},null,8,["clinic","access-request-sent","access-request-loading","error-message"])):(r(),l("div",la,[U(Be,{clinic:t(C),label:"Is this your practice?",footnote:"You can update these details after verifying your practice."},null,8,["clinic"]),a("div",ca,[a("button",{type:"button","data-testid":"prestep-detected-reject",class:"py-2 sm:py-2.5 px-3 sm:px-5 text-sm font-semibold rounded-lg transition-colors text-corticoBlue-700 shrink-0 border border-corticoBlue-700 hover:bg-corticoBlue-50 whitespace-nowrap",onClick:$[1]||($[1]=L=>W("emr_autodetect_rejected"))}," Not mine "),a("button",{type:"button","data-testid":"prestep-detected-claim",class:"flex-1 py-2 sm:py-2.5 px-3 sm:px-4 text-sm font-semibold rounded-lg transition-colors text-white bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 flex justify-center items-center",onClick:$[2]||($[2]=L=>ie(t(C),"emr_autodetect_unclaimed"))}," Yes, continue ")])]))],64)):x("",!0),t(f)==="searching"||t(f)==="claimed"||t(f)==="confirming"?(r(),l(M,{key:1},[U(ke,{modelValue:t(E),"onUpdate:modelValue":$[3]||($[3]=L=>we(E)?E.value=L:null),label:"Clinic name",variant:"compact","input-props":{id:"prestepClinicName",placeholder:"Start typing your clinic name...","data-testid":"prestep-clinic-search-input"},options:t(F)||[],"get-option-label":L=>L.clinic_name||L,"get-option-sub-label":L=>t(Te)(L),"get-option-search-keys":L=>[L.clinic_name||"",L.clinic_address||"",L.clinic_city||"",L.clinic_province||"",t(Te)(L)||""].filter(
1Boolean),"on-option-select":te,"is-loading":t(V),"free-solo":"","include-loading":"","bind-search-query":"","chars-before-show-options":2},{"dropdown-footer":fe(()=>[t(c)?(r(),l("div",ua,_(t(ne).searchUnavailable),1)):x("",!0),t(Y)?(r(),l("div",{key:1,class:"px-4 py-2 text-sm text-cortico-blue cursor-pointer hover:bg-gray-100 border-t border-gray-100",onMousedown:pe(z,["prevent"])},_(t(ne).registerNewFooter),33)):x("",!0)]),_:1},8,["modelValue","options","get-option-label","get-option-sub-label","get-option-search-keys","is-loading"]),t(c)?(r(),l("p",da,_(t(ne).searchUnavailable),1)):x("",!0),t(f)==="claimed"&&t(C)?(r(),j(We,{key:1,clinic:t(C),"access-request-sent":t(q),"access-request-loading":t(P),"error-message":t(d),onRequestAccess:ue,onSignInOpened:K,onReset:$[4]||($[4]=L=>W("search_reset"))},null,8,["clinic","access-request-sent","access-request-loading","error-message"])):x("",!0),t(f)==="confirming"&&t(C)?(r(),l("div",ma,[U(Be,{clinic:t(C),label:"Is this your practice?",footnote:"You can update these details after verifying your practice."},null,8,["clinic"]),a("div",pa,[a("button",{type:"button","data-testid":"prestep-unclaimed-reset",class:"py-2 sm:py-2.5 px-3 sm:px-5 text-sm font-semibold rounded-lg transition-colors text-corticoBlue-700 shrink-0 border border-corticoBlue-700 hover:bg-corticoBlue-50 whitespace-nowrap",onClick:$[5]||($[5]=L=>W("search_reset"))}," Not mine "),a("button",{type:"button","data-testid":"prestep-unclaimed-claim",class:"flex-1 py-2 sm:py-2.5 px-3 sm:px-4 text-sm font-semibold rounded-lg transition-colors text-white bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 flex justify-center items-center",onClick:$[6]||($[6]=L=>ie(t(C),"search_unclaimed"))}," Yes, continue ")])])):x("",!0),t(f)==="searching"&&t(ee)?(r(),l("div",fa,[a("p",va," No clinic on Cortico matches “"+_(t(g))+"”. Continue to register it. ",1),a("div",ga,[a("button",{type:"button","data-testid":"prestep-register-new",class:"px-5 py-2.5 text-sm font-bold text-white rounded-lg bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 transition-colors whitespace-nowrap flex items-center justify-center gap-2",onClick:z},_(t(ne).registerNewButton),1)])])):t(f)==="searching"&&t(Y)?(r(),l("button",{key:4,type:"button","data-testid":"prestep-register-new-link",class:"text-sm font-medium text-cortico-blue hover:underline text-left self-start",onClick:z},_(t(ne).registerNewLink),1)):x("",!0)],64)):x("",!0)])],64))}},ba={class:"flex flex-col gap-2"},ha=["disabled"],xa={key:0,class:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none"},wa={__name:"LeaveFormModal",props:{show:Boolean,emailing:Boolean},emits:["emailLink","leave","cancel"],setup(e,{emit:u}){const i=e,h=u,T=N(null);me(()=>i.show,async v=>{v&&(await Qe(),T.value?.focus?.())});const S=v=>{v.key==="Escape"&&i.show&&h("cancel")};return _e(()=>window.addEventListener("keydown",S)),Xe(()=>window.removeEventListener("keydown",S)),(v,f)=>(r(),j(jt,{to:"body"},[U(Ve,{name:"leave-modal"},{default:fe(()=>[e.show?(r(),l("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-[2px]",role:"dialog","aria-modal":"true","aria-labelledby":"leave-modal-title","aria-describedby":"leave-modal-desc",onClick:f[4]||(f[4]=pe(C=>v.$emit("cancel"),["self"]))},[a("div",{ref_key:"panel",ref:T,tabindex:"-1",class:"leave-modal__panel relative w-full max-w-sm p-6 bg-white shadow-xl rounded-2xl flex flex-col gap-5 focus:outline-none"},[a("button",{type:"button",class:"absolute flex items-center justify-center w-8 h-8 text-gray-500 transition-colors rounded-full top-3 right-3 hover:bg-gray-100 hover:text-gray-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-corticoBlue-500","aria-label":"Continue registration",onClick:f[0]||(f[0]=C=>v.$emit("cancel"))},[...f[5]||(f[5]=[a("svg",{class:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[a("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),a("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])]),f[7]||(f[7]=a("div",{class:"flex flex-col gap-3"},[a("span",{class:"flex items-center justify-center w-12 h-12 rounded-full bg-corticoBlue-50 text-corticoBlue-700"},[a("svg",{class:"w-6 h-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[a("path",{d:"M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z"})])]),a("h3",{id:"leave-modal-title",class:"pr-6 text-xl font-semibold text-gray-900"}," You haven't finished registering "),a("p",{id:"leave-modal-desc",class:"text-base text-gray-600"}," We can email you a link to pick up right where you left off. ")],-1)),a("div",ba,[a("button",{type:"button",disabled:e.emailing,class:"inline-flex items-center justify-center w-full gap-2 py-2.5 text-base font-bold text-center text-white transition-colors rounded-lg bg-corticoBlue-700 hover:bg-cortico-blue active:bg-corticoBlue-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-corticoBlue-500 disabled:opacity-60 disabled:cursor-not-allowed",onClick:f[1]||(f[1]=C=>v.$emit("emailLink"))},[e.emailing?(r(),l("svg",xa,[...f[6]||(f[6]=[a("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),a("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 0 1 8-8V0C5.4 0 0 5.4 0 12h4z"},null,-1)])])):x("",!0),D(" "+_(e.emailing?"Sending…":"Email me a link"),1)],8,ha),a("button",{type:"button",class:"w-full py-2.5 text-base font-bold text-center transition-colors border rounded-lg text-corticoBlue-700 border-corticoBlue-700 hover:bg-corticoBlue-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-corticoBlue-500",onClick:f[2]||(f[2]=C=>v.$emit("leave"))}," Leave without saving "),a("button",{type:"button",class:"w-full py-2 text-sm font-semibold text-center text-gray-500 transition-colors rounded-lg hover:text-gray-700 hover:bg-gray-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-corticoBlue-500",onClick:f[3]||(f[3]=C=>v.$emit("cancel"))}," Continue registration ")])],512)])):x("",!0)]),_:1})]))}},ka=Ze(wa,[["__scopeId","data-v-7c7267c7"]]),Sa=()=>{const{$posthog:e}=Ce(),{authFetch:u}=Wt();return async(i,{skipped:h=!1,source:T="step"}={})=>{const S=le("").replace(/\/api\/?$/,"");await u(`${S}/api/clinic-signup-intent/`,{method:"POST",body:i}),e?.capture("signup_intent_submitted",{signup_intents:i.intents,skipped:h,source:T})}},Re="signup_draft_v1",Ca=["password","confirmPassword","currentPassword"],_a=()=>{const e=it("signup_draft",{sameSite:"lax",path:"/"}),u=w(()=>!!e.value);return{save:(S,v)=>{const f={};for(const[C,A]of Object.entries(S||{}))Ca.includes(C)||A===""||A===null||A===void 0||(f[C]=A);Object.keys(f).length!==0&&(Ie.setItem(Re,JSON.stringify({data:f,activeStep:v,savedAt:Date.now()})),e.value||(e.value="1"))},load:()=>{const S=Ie.getItem(Re);
1if(!S)return null;try{const v=JSON.parse(S);return!v||typeof v!="object"||!v.data?null:v}catch{return null}},clear:()=>{Ie.removeItem(Re),e.value=null},hasDraftFlag:u}},Ea={class:"flex flex-col items-center justify-start min-h-full px-4 py-6 gap-4 sm:py-10 sm:gap-6"},$a={class:"flex flex-col items-center gap-2 text-center"},Na={key:0,class:"text-xs font-semibold tracking-widest text-gray-500 uppercase"},qa={class:"text-xl sm:text-3xl font-semibold text-cortico-blue tracking-tight"},Pa={key:1,class:"text-xs sm:text-sm text-center text-gray-500"},Ia={class:"font-medium text-gray-700"},Ra={key:2,class:"text-base text-gray-500"},La={key:0,role:"status","aria-live":"polite",class:"-mt-4 inline-flex items-center gap-2 rounded-full border border-amber-200 bg-amber-50 px-3.5 py-1.5 text-sm font-medium text-amber-900"},Ta={class:"w-full md:w-[550px]"},Ba={class:"relative w-full bg-white border border-gray-200 rounded-2xl p-4 sm:p-5 md:p-8 shadow-sm"},Va={key:0,class:"flex justify-center py-12"},Oa={__name:"sign-up",setup(e){const{gtag:u}=si(),i=ze(),h=Pt(),{$activeBus:T}=Ce(),{trackSignupVisited:S}=tt(),{sendResumeLinkEmail:v,parseResumeLink:f}=at(),{save:C,load:A,clear:E,hasDraftFlag:q}=_a(),P=Le(),d=N(!q.value),g=N(!1),R=xe(()=>de(()=>import("./MedicalPracticeStep-DLkU3f6Z.js"),[],import.meta.url)),B=xe(()=>de(()=>import("./SignupIntentStep-BKTPEvpQ.js"),[],import.meta.url)),F=xe(()=>de(()=>import("./CompletionStep-DClwjHBY.js"),[],import.meta.url)),V=()=>{de(()=>import("./MedicalPracticeStep-DLkU3f6Z.js"),[],import.meta.url),de(()=>import("./CompletionStep-DClwjHBY.js"),[],import.meta.url)},c=w(()=>!1);let ce=null;c.value&&(ce=xe(()=>de(()=>import("./SelfRegistrationUtils-DKG1R6jX.js"),[],import.meta.url).then(s=>s.default||s)));const n=N([{title:"Medical Professional",completed:!1,active:!0},{title:"Medical Practice",completed:!1,active:!1},{title:"Clinic created",completed:!1,active:!1}]),oe=w(()=>{if(g.value)return n.value.length;const s=n.value.findIndex(o=>o.active);return s===-1?1:s+1}),Z=N([]),Y=w(()=>Z.value.length>0),ee=w(()=>[{label:"Your info",active:n.value[0].active,completed:n.value[0].completed||g.value},{label:"Practice info",active:n.value[1].active,completed:n.value[1].completed||g.value},{label:"Clinic created",active:n.value[2].active||g.value,completed:n.value[2].completed||g.value||Y.value&&H.value}]),p=N({workEmail:"",firstName:"",lastName:"",occupation:"",specialty:"",subspecialty:"",practiceName:"",practicePhoneNumber:"",allowNumberPublic:!0,practiceAddress:"",practiceCity:"",practiceProvince:"",slug:"",host:"",registrantContactPhone:"",registrantContactState:"",signupIntents:[],signupIntentOther:"",signupIntentState:""}),H=w(()=>!!p.value.host),O=N(!1),W=N(!1),J=N(!1),te=N(null),ie=N(!1),z=N(!1),ue=w(()=>i.query.clinic),{utm:K}=Ke(),k=w(()=>K.value.utm_source),$=w(()=>{const s=i.query.flow,o=i.query.utm_source||k.value;return s==="claim"||o==="contentnetwork-claim"?"claim":s==="plugin"||Ge(o)?"plugin":s==="provider-message"?"provider-message":s==="invite"?"invite":""}),L=w(()=>$.value==="claim");w(()=>$.value==="plugin");const y=w(()=>i.query.msg),m=N(null);w(()=>$.value==="claim"?"Setup listing":"Setup solutions");const I=w(()=>i.query.clinic||K.value.clinic||""),ve=w(()=>g.value?L.value?"Your listing is claimed":"Registered successfully!":i.query.title?i.query.title:X.value?"Add a Clinic":L.value?I.value?`Claim ${I.value}`:"Claim directory listing":"Register Healthcare Professional"),G=N("");let ge=null;const Q=s=>{const o=Y.value||p.value.signupIntentState==="submitted";if(s===2&&H.value&&o){be();return}if(g.value){g.value=!1,n.value[s].active=!0;return}const b=n.value.findIndex(se=>se.active);if(s===b)return;if(s<b){n.value[b].active=!1,n.value[s].active=!0,G.value="";return}if(!(H.value||n.value.slice(0,s).every(se=>se.completed))){const se=n.value.findIndex(Ne=>!Ne.completed);se!==b&&(n.value[b].active=!1,n.value[se].active=!0),G.value="Finish registration first, please",clearTimeout(ge),ge=setTimeout(()=>{G.value=""},4e3);return}n.value[b].active=!1,n.value[s].active=!0,G.value=""},ye=({stepIndex:s,completed:o,action:b="next"})=>
1{if(n.value[s].completed=o,n.value[s].active=!1,b==="next"&&s===0&&o&&!X.value&&Bt(),b==="next"&&s===1&&Y.value){n.value[2].completed=!0,g.value=!0,Ae();return}b==="back"&&s>0?n.value[s-1].active=!0:b==="next"&&s<n.value.length-1?n.value[s+1].active=!0:b==="next"&&s===2&&(g.value=!0)},be=()=>{if(n.value.forEach(s=>{s.active=!1}),G.value="",!H.value){n.value[1].active=!0;return}g.value=!0},st=Sa(),Ae=async()=>{if(p.value.signupIntentState==="submitted"||!p.value.host)return;const s=[...Z.value];Object.assign(p.value,{signupIntents:s,signupIntentOther:"",signupIntentState:"submitted"});try{await st(ai({intents:s,host:p.value.host}),{source:"link"})}catch{}},rt=()=>{ue.value&&T?.$emit("showSnackbar",{title:"Clinic Information can be edited in the Last Step",description:"Clinic details will be available for editing in the final step. Please complete your account information first",duration:7e3})},ot=()=>{if(!i.query.d)return;const{activeStep:s,data:o}=f(i.fullPath);if(Object.keys(o).length>0){p.value=o,o.workEmail&&o.firstName&&o.lastName&&o.occupation&&(n.value[0].completed=!0),o.practiceName&&o.practiceAddress&&o.practiceCity&&o.practiceProvince&&(n.value[1].completed=!0),n.value[0].active=!1;const b=s?s-1:0;n.value[b].active=!0,m.value={title:"Welcome back!",description:"We’ve restored your previous progress. You can continue from where you left off."}}else m.value={title:"Oops!",description:"We couldn’t find your saved progress. Please start from the beginning.",error:!0}},X=w(()=>i.query.addClinic==="true"),nt=w(()=>{if(i.query.emr_host)return String(i.query.emr_host);const s=k.value||i.query.utm_source,o=window.location.host;return De(document.referrer,s,o)||K.value.emr_host||De(K.value.origin_referrer,s,o)}),Me=N(!1),lt=w(()=>!!i.query.clinic_id||!!i.query.clinic),$e=w(()=>!Me.value&&!p.value.clinicChosenUpfront&&!H.value&&!lt.value&&(n.value[0].active||X.value)&&!p.value.practiceName),ct=w(()=>X.value?"add-clinic":$.value),ut=({mode:s,clinic:o,practiceName:b}={})=>{s==="claim"&&o?(Bi(p.value,o),p.value.practiceFlowPhase="confirming"):(p.value.cerebro_clinic_id=void 0,p.value.cerebro_clinic_slug=void 0,p.value.practiceName=b||"",p.value.practiceFlowPhase="filling"),p.value.clinicChosenUpfront=!0,Me.value=!0},dt=()=>{if(!X.value)return;const o=it("username").value||"";if(o&&!o.includes("@")){const[b,...ae]=o.split(" ");p.value.firstName||=b||"",p.value.lastName||=ae.join(" ")||""}n.value[0].completed=!0,n.value[0].active=!1,n.value[1].active=!0},mt=()=>{if(!(!!i.query.d||!!i.query.addClinic)&&!Lt().status.value.authenticated){const o=new URLSearchParams;i.query.email&&o.set("email",i.query.email),i.query.userType&&o.set("userType",i.query.userType),i.query.flow&&o.set("flow",i.query.flow),i.query.utm_source&&o.set("utm_source",i.query.utm_source),i.query.signup_intent&&o.set("signup_intent",i.query.signup_intent),(i.query.next||i.query.redirect)&&o.set("next",ti(i.query)),i.query.native_return&&o.set("native_return",i.query.native_return),i.query.clinic&&o.set("clinic",i.query.clinic),i.query.clinic_id&&o.set("clinic_id",i.query.clinic_id),i.query.share_email&&o.set("share_email",i.query.share_email);const b=o.toString();Tt(`/auth/sign-in/${b?"?"+b:""}`,{replace:!0});return}i.query.email&&(p.value.workEmail=i.query.email),i.query.firstName&&(p.value.firstName=i.query.firstName),i.query.lastName&&(p.value.lastName=i.query.lastName)};ot(),mt(),dt();const pt=()=>{if(i.query.d){d.value=!0;return}const s=A();if(!s?.data){q.value&&E(),d.value=!0;return}if(i.query.addClinic){const b=!!s.data.host,ae=!i.query.email||s.data.workEmail===i.query.email;if(!b&&!ae){d.value=!0;return}}Object.assign(p.value,s.data),s.data.workEmail&&s.data.firstName&&s.data.lastName&&s.data.occupation&&(n.value[0].completed=!0),X.value&&(n.value[0].completed=!0),s.data.practiceName&&s.data.practiceAddress&&s.data.practiceCity&&s.data.practiceProvince&&(n.value[1].completed=!0),n.value.forEach(b=>{b.active=!1});const o=!!s.data.host;if(o&&(s.data.signupIntentState==="submitted"||Y.value))n.value.forEach(b=>{b.completed=!0}),g.value=!0,Ae();else if(o)n.value[0].completed=!0,n.value[1].completed=!0,n.value[2].active=!0;else{const b=s.activeStep?Math.min(s.activeStep-1,n.value.length-1):0,ae=n.value.findIndex(Ne=>!Ne.completed),se=ae!==-1&&ae<b?ae:b;n.value[se].active=!0}d.value=!0},Ue=w(()=>n.value.findIndex(s=>s.active));let he=null;me([p,Ue,g],()=>{d.value&&(clearTimeout(he),he=setTimeout(()=>{const s=Ue.value;s<0&&!g.value||C(p.value,g.value?n.value.length:s+1)},400))},{deep:!0}),_e(()=>{Z.value=ii({signupIntent:i.query.signup_intent||K.value.signup_intent,flow:$.value}),Y.value&&!p.value.signupIntents?.length&&(p.value.signupIntents=[...Z.value]),pt(),window.addEventListener("beforeunload",je),!p.value.workEmail&&P.email&&(p.value.workEmail=P.email),m.value?.title&&m.value?.description&&T?.$emit("showSnackbar",m.value),rt(),S(k.value),u("event","provider_register_start"),"requestIdleCallback"in window?It(V,{timeout:3e3}):setTimeout(V,1500)}),Xe(()=>{window.removeEventListener("beforeunload",je),clearTimeout(ge),
1clearTimeout(he)}),Dt(s=>ie.value||g.value?!0:n.value[2].active?(clearTimeout(he),C(p.value,3),!0):(te.value=s.fullPath,J.value=!0,!1));const Fe=()=>{const s=te.value;te.value=null,J.value=!1,s&&(ie.value=!0,Promise.resolve(h.push(s)).catch(()=>{}).finally(()=>{ie.value=!1}))},je=s=>{!g.value&&!n.value[2].active&&!W.value&&(s.preventDefault(),s.returnValue="")},ft=()=>{W.value=!0,setTimeout(()=>{W.value=!1},100)},vt=async()=>{z.value=!0;try{await v(p.value,oe.value,p.value.workEmail)}catch{}finally{z.value=!1}E(),Fe()},gt=()=>{E(),Fe()},yt=()=>{te.value=null,J.value=!1};return Rt({title:"Sign Up | Cortico",meta:[{hid:"description",name:"description",content:"Sign up as a freemium provider on Cortico"}]}),(s,o)=>(r(),l("div",Ea,[t(c)?(r(),j(t(ce),{key:0,"form-values":t(p),steps:t(n),"onUpdate:steps":o[0]||(o[0]=b=>n.value=b),"onUpdate:formValues":o[1]||(o[1]=b=>Object.assign(t(p),b))},null,8,["form-values","steps"])):x("",!0),a("div",$a,[t($e)?x("",!0):(r(),l("p",Na," Step "+_(t(oe))+" of "+_(t(n).length),1)),a("h1",qa,_(t(ve)),1),o[6]||(o[6]=a("p",{class:"text-xs sm:text-sm text-gray-500"}," For patient privacy and safety, we verify credentials for access to Cortico solutions. ",-1)),t(p).workEmail&&!t(X)?(r(),l("p",Pa,[o[5]||(o[5]=D(" Signing up as ",-1)),a("span",Ia,_(t(p).workEmail),1)])):x("",!0),t(y)?(r(),l("p",Ra,_(t(y)),1)):x("",!0)]),t($e)?x("",!0):(r(),j(t(ei),{key:1,steps:t(ee),onSelect:Q},null,8,["steps"])),U(Ve,{"enter-active-class":"transition duration-200 ease-out","enter-from-class":"opacity-0 -translate-y-1","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 -translate-y-1"},{default:fe(()=>[t(G)?(r(),l("p",La,[o[7]||(o[7]=a("svg",{class:"w-4 h-4 shrink-0 text-amber-600",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[a("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-11.25a.75.75 0 0 0-1.5 0v3.5a.75.75 0 0 0 1.5 0v-3.5ZM10 14a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z","clip-rule":"evenodd"})],-1)),D(" "+_(t(G)),1)])):x("",!0)]),_:1}),a("div",Ta,[a("div",Ba,[t(d)?t($e)?(r(),j(ya,{key:1,registrant:t(p),flow:t(ct),"emr-host":t(nt),"adding-clinic":t(X),onContinue:ut},null,8,["registrant","flow","emr-host","adding-clinic"])):t(n)[0].active?(r(),j(t(Ii),{key:2,modelValue:t(p),"onUpdate:modelValue":o[2]||(o[2]=b=>we(p)?p.value=b:null),"utm-source":t(k),flow:t($),locked:t(H),"signed-in":t(X),onUpdateSteps:ye,onBypassWarning:ft,onBackToSummary:be},null,8,["modelValue","utm-source","flow","locked","signed-in"])):t(n)[1].active?(r(),j(t(R),{key:3,modelValue:t(p),"onUpdate:modelValue":o[3]||(o[3]=b=>we(p)?p.value=b:null),isPrefilled:t(O),"onUpdate:isPrefilled":o[4]||(o[4]=b=>we(O)?O.value=b:null),"utm-source":t(k),flow:t($),locked:t(H),onUpdateSteps:ye,onBackToSummary:be},null,8,["modelValue","isPrefilled","utm-source","flow","locked"])):t(n)[2].active?(r(),j(t(B),{key:4,"form-values":t(p),onUpdateSteps:ye},null,8,["form-values"])):t(g)?(r(),j(t(F),{key:5,"form-values":t(p),flow:t($)},null,8,["form-values","flow"])):x("",!0):(r(),l("div",Va,[U(et,{class:"text-corticoBlue-700 w-8 h-8"})]))])]),U(ka,{show:t(J),emailing:t(z),onEmailLink:vt,onLeave:gt,onCancel:yt},null,8,["show","emailing"])]))}},Aa=Ze(Oa,[["__scopeId","data-v-a921b569"]]),os=Object.freeze(Object.defineProperty({__proto__:null,default:Aa},Symbol.toStringTag,{value:"Module"}));export{ne as C,oa as _,vi as a,Vi as b,rs as c,fi as d,Oe as e,We as f,Te as g,Be as h,Se as i,Sa as j,Bi as p,os as s,at as u};

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.