PageSourceSearch

https://app.prospectsinmotion.com/_nuxt/CNxMWutG.js

js prospectsinmotion.com collected 2026-10-04 01:57:29 UTC 93,580 bytes, 1 lines download raw bytes

1import{_ as _t}from"./g9gpNee0.js";import{d as K,o as n,f as i,g as t,t as d,F as T,k as L,e as s,q as O,h as b,p as H,n as Q,j as W,r as j,c as m,at as ne,v as J,l as Y,C as pt,x as we,Z as Se,a$ as le,m as te,$ as mt,M as de,N as Ke,B as Je,w as ce,aw as Ce,ag as Xe,E as ft,T as yt,u as vt,S as bt,y as Re}from"./5iPJ5zAh.js";import{f as ye}from"./C1JsP145.js";import{b as Ee,a as ve,P as he,S as De,B as Ze}from"./c9h7fkTo.js";import{_ as gt}from"./CjaGG_Iq.js";import{g as ge}from"./DAoCM98P.js";import{b as xe}from"./CXnIM_Ti.js";import{u as kt}from"./DynQtOmh.js";import{u as $t}from"./0tx_stYV.js";import{u as Ct}from"./DO0GCZlW.js";const wt={class:"chsc__head"},St={class:"chsc__label"},Ot={class:"chsc__count"},At={class:"chsc__list"},Et=["onClick"],Tt={key:0,class:"chsc__empty"},It=K({__name:"ClientHubStatusColumn",props:{label:{},color:{},accounts:{},threshold:{default:10},compact:{type:Boolean,default:!1}},emits:["select"],setup(e){const o=e,a=j(!1),h=m(()=>a.value?o.accounts:o.accounts.slice(0,o.threshold));return(l,u)=>{const r=ne;return n(),i("div",{class:W(["chsc",{"chsc--sm":e.compact}]),style:Q({"--c":e.color})},[t("div",wt,[u[1]||(u[1]=t("span",{class:"chsc__dot"},null,-1)),t("span",St,d(e.label),1),t("span",Ot,d(e.accounts.length),1)]),t("ul",At,[(n(!0),i(T,null,L(s(h),y=>(n(),i("li",{key:y.account_id,class:"chsc__item"},[t("button",{type:"button",class:"chsc__name",onClick:_=>l.$emit("select",y)},d(("formatAccountName"in l?l.formatAccountName:s(ye))(y.account_name)),9,Et)]))),128)),e.accounts.length?O("",!0):(n(),i("li",Tt,"No accounts"))]),e.accounts.length>e.threshold?(n(),i("button",{key:0,type:"button",class:"chsc__more",onClick:u[0]||(u[0]=y=>a.value=!s(a))},[b(r,{name:s(a)?"heroicons:chevron-up":"heroicons:chevron-down",size:"13"},null,8,["name"]),H(" "+d(s(a)?"Show less":`View all ${e.accounts.length}`),1)])):O("",!0)],6)}}}),Nt=J(It,[["__scopeId","data-v-d5e688d2"]]),xt={class:"chpr"},Lt={key:0,class:"chpr-loading"},Mt={class:"chpr-kpis"},Pt={class:"chpr-kpi chpr-kpi--total"},Rt={class:"chpr-kpi__value"},Dt={class:"chpr-kpi__sub"},Ft={class:"chpr-kpi chpr-kpi--active"},Ht={class:"chpr-kpi__value"},Bt={class:"chpr-kpi chpr-kpi--happy"},zt={class:"chpr-kpi__value"},Ut={class:"chpr-kpi chpr-kpi--caution"},Vt={class:"chpr-kpi__value"},Gt={class:"chpr-kpi chpr-kpi--critical"},Yt={class:"chpr-kpi__value"},jt={class:"chpr-kpi chpr-kpi--secondary chpr-kpi--onboarding"},Wt={class:"chpr-kpi__value"},qt={class:"chpr-kpi chpr-kpi--secondary chpr-kpi--lost"},Kt={class:"chpr-kpi__value"},Jt={class:"chpr-kpi chpr-kpi--secondary chpr-kpi--ghl_only"},Xt={class:"chpr-kpi__value"},Zt={class:"chpr-charts"},Qt={class:"chpr-card__header"},en={key:0,class:"chpr-dist"},tn={class:"chpr-donut"},nn={viewBox:"0 0 42 42",class:"chpr-donut__svg"},sn=["stroke","stroke-dasharray","stroke-dashoffset"],on={class:"chpr-donut__center"},an={class:"chpr-donut__value"},ln={class:"chpr-legend"},cn={class:"chpr-legend__name"},rn={class:"chpr-legend__pct"},un={class:"chpr-legend__count"},dn={key:1,class:"chpr-empty"},hn={key:0,class:"chpr-card"},_n={class:"chpr-card__header"},pn={class:"chpr-cols chpr-cols--primary"},mn={class:"chpr-cols chpr-cols--secondary"},fn=K({__name:"ClientHubPerformanceReport",props:{summary:{},loading:{type:Boolean},accounts:{}},emits:["select-account"],setup(e){const o=e,a=m(()=>o.summary?.accounts_with_status??0),h=k=>o.summary?.[k]??0,l=(k,f)=>{const M=k.reduce((B,q)=>B+q.value,0);let R=25;const N=k.filter(B=>B.value>0).map(B=>{const q=B.value/M*100,X={pct:q,offset:R,color:B.color};return R-=q,X}),D=k.map(B=>({...B,pct:M?Math.round(B.value/M*100):0}));return{title:f,total:M,donut:N,legend:D}},u=k=>k.map(f=>({key:f,label:he[f],color:ve[f],value:h(f)})),r=m(()=>Ee.reduce((k,f)=>k+h(f),0)),y=m(()=>[l(u(Ee),"Performance status"),l([{key:"active",label:"Active",color:"#0891b2",value:r.value},...u(De)],"Lifecycle status")]),_=(k,f)=>k.account_name.localeCompare(f.account_name),$=k=>k.map(f=>({key:f,label:he[f],color:ve[f],accounts:o.accounts.filter(M=>M.performance_status===f).sort(_)})),g=m(()=>$(Ee)),C=m(()=>$(De));return(k,f)=>{const M=ne,R=Nt;return n(),i("div",xt,[e.loading&&!e.summary?(n(),i("div",Lt,[...f[2]||(f[2]=[t("span",{class:"spinner"},null,-1),H(" Loading report… ",-1)])])):e.summary?(n(),i(T,{key:1},[t("div",Mt,[t("div",Pt,[t("div",Rt,d(e.summary.accounts_with_status),1),f[3]||(f[3]=t("div",{class:"chpr-kpi__label"},"Accounts with status",-1)),t("div",Dt,d(e.summary.accounts_without_status)+" without status yet",1)]),t("div",Ft,[t("div",Ht,d(s(r)),1),f[4]||(f[4]=t("div",{class:"chpr-kpi__label"},"Active accounts",-1))]),t("div",Bt,[t("div",zt,d(e.summary.happy),1),f[5]||(f[5]=t("div",{class:"chpr-kpi__label"},"Happy",-1)),f[6]||(f[6]=t("div",{class:"chpr-kpi__sub"},"Performing well",-1))]),t("div",Ut,[t("div",Vt,d(e.summary.caution),1),f[7]||(f[7]=t("div",{class:"chpr-kpi__label"},"Caution",-1)),f[8]||(f[8]=t("div",{class:"chpr-kpi__sub"},"Needs attention",-1))]),t("div",Gt,[t("div",Yt,d(e.summary.critical),1),f[9]||(f[9]=t("div",{class:"chpr-kpi__label"},"Critical",-1)),f[10]||(f[10]=t("div",{class:"chpr-kpi__sub"},"Immediate action",-1))]),t("div",jt,[t("div",Wt,d(e.summary.onboarding),1),f[11]||(f[11]=t("div",{class:"chpr-kpi__label"},"Onboarding",-1))]),t("div",qt,[t("div",Kt,d(e.summary.lost),1),f[12]||(f[12]=t("div",{class:"chpr-kpi__label"},"Lost",-1))]),t("div",Jt,[t("div",Xt,d(e.summary.ghl_only),1),f[13]||(f[13]=t("div",{class:"chpr-kpi__label"},"GHL Only",-1))])]),t("div",Zt,[(n(!0),i(T,null,L(s(y),N=>(n(),i("div",{key:N.title,class:"chpr-card"},[t("div",Qt,[b(M,{name:"heroicons:chart-pie",size:"16"}),t("span",null,d(N.title),1)]),N.total>0?(n(),i("div",en,[t("div",tn,[(n(),i("svg",nn,[f[14]||(f[14]=t("circle",{class:"chpr-donut__track",cx:"21",cy:"21",r:"15.915",fill:"none"},null,-1)),(n(!0),i(T,null,L(N.donut,(D,B)=>(n(),i("circle",{key:B,class:"chpr-donut__seg",cx:"21",cy:"21",r:"15.915",fill:"none",stroke:D.color,"stroke-dasharray":`${D.pct} ${100-D.pct}`,"stroke-dashoffset":D.offset},null,8,sn))),128))])),t("div",on,[t("span",an,d(N.total),1),f[15]||(f[15]=t("span",{class:"chpr-donut__label"},"Accounts",-1))])]),t("div",ln,[(n(!0),i(T,null,L(N.legend,D=>(n(),i("div",{key:D.key,class:"chpr-legend__row"},[t("span",{class:"chpr-legend__dot",style:Q({background:D.color})},null,4),t("span",cn,d(D.label),1),t("span",rn,d(D.pct)+"%",1),t("span",un,"("+d(D.value)+")",1)]))),128))])])):(n(),i("div",dn,[b(M,{name:"heroicons:chart-pie",size:"28"}),f[16]||(f[16]=t("p",null,"No accounts in these statuses yet.",-1))]))]))),128))]),s(a)>0?(n(),i("div",hn,[t("div",_n,[b(M,{name:"heroicons:list-bullet",size:"16"}),f[17]||(f[17]=t("span",null,"Accounts by status",-1))]),t("div",pn,[(n(!0),i(T,null,L(s(g),N=>(n(),Y(R,{key:N.key,label:N.label,color:N.color,accounts:N.accounts,onSelect:f[0]||(f[0]=D=>k.$emit("select-account",D))},null,8,["label","color","accounts"]))),128))]),t("div",mn,[(n(!0),i(T,null,L(s(C),N=>(n(),Y(R,{key:N.key,label:N.label,color:N.color,accounts:N.accounts,compact:"",onSelect:f[1]||(f[1]=D=>k.$emit("select-account",D))},null,8,["label","color","accounts"]))),128))])])):O("",!0)],64)):O("",!0)])}}}
1),yn=J(fn,[["__scopeId","data-v-7acbeca3"]]),vn=K({__name:"PerformanceStatusBadge",props:{status:{}},setup(e){const o=e,a=m(()=>o.status?he[o.status]:"No status");return(h,l)=>(n(),i("span",{class:W(["perf-badge",`perf-badge--${e.status??"none"}`])},[l[0]||(l[0]=t("span",{class:"perf-badge__dot"},null,-1)),H(" "+d(s(a)),1)],2))}}),Me=J(vn,[["__scopeId","data-v-277cf208"]]),bn={class:"chma"},gn={class:"chma-filters"},kn={class:"chma-filter chma-filter--search"},$n={class:"chma-search"},Cn=["value"],wn={class:"chma-filter"},Sn=["value"],On=["value"],An={class:"chma-filter"},En=["value"],Tn={key:0,class:"chma-loading"},In={key:1,class:"chma-empty"},Nn={key:2,class:"chma-table-wrap"},xn={class:"chma-table"},Ln=["onClick"],Mn={class:"chma-td-name"},Pn={class:"chma-name-link"},Rn={class:"chma-td-coach"},Dn={key:0},Fn={key:1,class:"chma-muted"},Hn={class:"chma-td-action"},Bn=["onClick"],zn=K({__name:"ClientHubManageAccounts",props:{accounts:{},loading:{type:Boolean},salesCoachOptions:{},search:{},salesCoachFilter:{},statusFilter:{}},emits:["update:search","update:salesCoachFilter","update:statusFilter","reset","select","view"],setup(e,{emit:o}){const a=e,h=o,l=m(()=>!!a.search||a.salesCoachFilter!=null||a.statusFilter!=null),u=y=>{const _=y.target.value;h("update:salesCoachFilter",_===""?null:Number(_))},r=y=>{const _=y.target.value;h("update:statusFilter",_===""?null:_)};return(y,_)=>{const $=ne,g=Me;return n(),i("div",bn,[t("div",gn,[t("div",kn,[_[2]||(_[2]=t("label",{class:"chma-filter__label"},"Account",-1)),t("div",$n,[b($,{name:"heroicons:magnifying-glass",size:"14",class:"chma-search__icon"}),t("input",{value:e.search,type:"text",class:"chma-input",placeholder:"Search by name…",onInput:_[0]||(_[0]=C=>y.$emit("update:search",C.target.value))},null,40,Cn)])]),t("div",wn,[_[4]||(_[4]=t("label",{class:"chma-filter__label"},"Sales coach",-1)),t("select",{class:"chma-select",value:e.salesCoachFilter??"",onChange:u},[_[3]||(_[3]=t("option",{value:""},"All coaches",-1)),(n(!0),i(T,null,L(e.salesCoachOptions,C=>(n(),i("option",{key:C.value,value:C.value},d(C.label),9,On))),128))],40,Sn)]),t("div",An,[_[6]||(_[6]=t("label",{class:"chma-filter__label"},"Status",-1)),t("select",{class:"chma-select",value:e.statusFilter??"",onChange:r},[..._[5]||(_[5]=[pt('<option value="" data-v-9d284aee>All statuses</option><option value="happy" data-v-9d284aee>Happy</option><option value="caution" data-v-9d284aee>Caution</option><option value="critical" data-v-9d284aee>Critical</option><option value="onboarding" data-v-9d284aee>Onboarding</option><option value="lost" data-v-9d284aee>Lost</option><option value="ghl_only" data-v-9d284aee>GHL Only</option><option value="none" data-v-9d284aee>No status</option>',8)])],40,En)]),s(l)?(n(),i("button",{key:0,class:"chma-reset",onClick:_[1]||(_[1]=C=>y.$emit("reset"))},[b($,{name:"heroicons:x-mark",size:"13"}),_[7]||(_[7]=H(" Reset ",-1))])):O("",!0)]),e.loading&&!e.accounts.length?(n(),i("div",Tn,[..._[8]||(_[8]=[t("span",{class:"spinner"},null,-1),H(" Loading accounts… ",-1)])])):e.accounts.length?(n(),i("div",Nn,[t("table",xn,[_[10]||(_[10]=t("thead",null,[t("tr",null,[t("th",null,"Account"),t("th",null,"Sales coach"),t("th",null,"Status"),t("th",{class:"chma-th-action"})])],-1)),t("tbody",null,[(n(!0),i(T,null,L(e.accounts,C=>(n(),i("tr",{key:C.account_id,onClick:k=>y.$emit("view",C)},[t("td",Mn,[t("span",Pn,d(("formatAccountName"in y?y.formatAccountName:s(ye))(C.account_name)),1)]),t("td",Rn,[C.sales_coach?(n(),i("span",Dn,d(C.sales_coach.first_name)+" "+d(C.sales_coach.last_name),1)):(n(),i("span",Fn,"—"))]),t("td",null,[b(g,{status:C.performance_status},null,8,["status"])]),t("td",Hn,[t("button",{class:"chma-config-btn",onClick:we(k=>y.$emit("select",C),["stop"])},d(C.performance_status?"Change":"Set status"),9,Bn)])],8,Ln))),128))])])])):(n(),i("div",In,[b($,{name:"heroicons:building-office-2",size:"30"}),_[9]||(_[9]=t("p",null,"No accounts match the current filters.",-1))]))])}}}),Un=J(zn,[["__scopeId","data-v-9d284aee"]]),Vn={class:"chst__head"},Gn={key:0,class:"chst__icon","aria-hidden":"true"},Yn={class:"chst__label"},jn={class:"chst__body"},Wn={key:0,class:"chst__value"},qn={key:2,class:"chst__sub"},Kn={key:3,class:"chst__sub"},Jn=K({__name:"ClientHubStatTile",props:{label:{},value:{},sub:{default:null},icon:{default:void 0},tone:{default:"neutral"},accent:{default:null}},setup(e){const o=e,a=m(()=>typeof o.value=="number"?!0:/\d/.test(String(o.value??"")));
1return(h,l)=>{const u=ne;return n(),i("div",{class:W(["chst",`chst--${e.tone}`]),style:Q(e.accent?{"--c":e.accent}:void 0)},[t("span",Vn,[e.icon?(n(),i("span",Gn,[b(u,{name:e.icon,size:"12"},null,8,["name"])])):O("",!0),t("span",Yn,d(e.label),1)]),t("span",jn,[h.$slots.value?(n(),i("span",Wn,[Se(h.$slots,"value",{},void 0,!0)])):(n(),i("span",{key:1,class:W(["chst__value",{"chst__value--data":s(a)}])},d(e.value??"—"),3)),h.$slots.sub?(n(),i("span",qn,[Se(h.$slots,"sub",{},void 0,!0)])):e.sub?(n(),i("span",Kn,d(e.sub),1)):O("",!0)])],6)}}}),Xn=J(Jn,[["__scopeId","data-v-51abbc48"]]),Zn={class:"chif"},Qn={class:"chif__label"},es={key:1,class:"chif__empty"},ts=K({__name:"ClientHubInfoField",props:{label:{},value:{default:null},mono:{type:Boolean,default:!1}},setup(e){const o=e,a=m(()=>o.value===null||o.value===void 0||o.value===""?null:String(o.value));return(h,l)=>(n(),i("div",Zn,[t("span",Qn,d(e.label),1),Se(h.$slots,"default",{},()=>[s(a)?(n(),i("span",{key:0,class:W(["chif__value",{"chif__value--mono":e.mono}])},d(s(a)),3)):(n(),i("span",es,"—"))],!0)]))}}),Qe=J(ts,[["__scopeId","data-v-3ae313de"]]),ns={class:"chic__head"},ss={class:"chic__title"},os={key:0,class:"chic__count"},as=K({__name:"ClientHubInfoCard",props:{icon:{},title:{},count:{default:null},maxBodyHeight:{default:void 0}},setup(e){return(o,a)=>{const h=ne;return n(),i("section",{class:"chic",style:Q(e.maxBodyHeight?{"--max-body":e.maxBodyHeight}:void 0)},[t("header",ns,[b(h,{name:e.icon,size:"15"},null,8,["name"]),t("span",ss,d(e.title),1),e.count!=null?(n(),i("span",os,d(e.count),1)):O("",!0)]),t("div",{class:W(["chic__body",{"chic__body--scroll":!!e.maxBodyHeight}])},[Se(o.$slots,"default",{},void 0,!0)],2)],4)}}}),is=J(as,[["__scopeId","data-v-8a2e9ff9"]]),et=[{key:le.CANCELLED,label:ge(le.CANCELLED),short:"Cancelled",color:"var(--danger)"},{key:le.PENDING_ACCOUNT_CONFIRMATION,label:ge(le.PENDING_ACCOUNT_CONFIRMATION),short:"Pending",color:"var(--accent)"},{key:le.COMPLETED,label:ge(le.COMPLETED),short:"Completed",color:"var(--success)"},{key:le.COMPLETED_BY_AGENCY,label:ge(le.COMPLETED_BY_AGENCY),short:"By agency",color:"#94A3B8"}],ls=[{key:"proposal_sent",label:"Proposal sent",icon:"heroicons:document-text",color:"var(--warning)"},{key:"client_won",label:"Client won",icon:"heroicons:trophy",color:"var(--success)"}];function re(e){if(e==null||e==="")return null;const o=Number(e);return Number.isNaN(o)?String(e):o.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:Number.isInteger(o)?0:2})}function fe(e){return e?e.replace(/_/g," ").split(" ").filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):"—"}function cs(e){return e?`${e.first_name??""} ${e.last_name??""}`.trim()||e.email||`User #${e.id}`:""}function rs(e){if(!e)return"?";const o=e.first_name?.trim()?.[0],a=e.last_name?.trim()?.[0];return o||a?`${o??""}${a??""}`.toUpperCase():(e.email?.trim()?.[0]??"#").toUpperCase()}function Le(e){return e?e.charAt(0).toUpperCase()+e.slice(1):"—"}function Oe(e){const[o,a]=e.split("-").map(Number);return!o||!a?e:`${new Date(o,a-1,1).toLocaleDateString("en-US",{month:"short"})} ${o}`}const us={class:"chbp"},ds={class:"chbp__grid"},hs=["href"],_s={key:1,class:"chbp__tiers"},ps={class:"chbp__table"},ms={class:"chbp__num"},fs={class:"chbp__num"},ys={class:"chbp__num"},vs=K({__name:"ClientHubBillingPanel",props:{billing:{},details:{default:null}},setup(e){const o=e,a=m(()=>o.details?.setup_fee??null),h=m(()=>{const r=o.details?.contract_folder_link;return typeof r=="string"&&r.trim()!==""?r.trim():null}),l=m(()=>o.details?.payment_method??null),u=m(()=>Ze[o.billing.billing_model]??o.billing.billing_model);return(r,y)=>{const _=Qe,$=ne;return n(),i("div",us,[t("div",ds,[b(_,{label:"Billing model",value:s(u)},null,8,["value"]),b(_,{label:"Monthly Retainer/Flat Fee",value:s(re)(e.billing.monthly_flat_fee),mono:""},null,8,["value"]),b(_,{label:"Per appointment"},{default:te(()=>[t("span",{class:W(["chbp__flag",e.billing.per_appointment_enabled?"chbp__flag--on":"chbp__flag--off"])},d(e.billing.per_appointment_enabled?"Enabled":"Disabled"),3)]),_:1}),b(_,{label:"Rate per confirmed appt.",value:s(re)(e.billing.rate_per_confirmed_appointment),mono:""},null,8,["value"]),b(_,{label:"Setup fee",value:s(re)(s(a)),mono:""},null,8,["value"]),b(_,{label:"Payment method",value:s(l)},null,8,["value"])]),s(h)?(n(),i("a",{key:0,class:"chbp__link",href:s(h),target:"_blank",rel:"noopener"},[b($,{name:"heroicons:document-check",size:"14"}),y[0]||(y[0]=t("span",{class:"chbp__link-text"},"Contract folder",-1)),b($,{name:"heroicons:arrow-top-right-on-square",size:"12",class:"chbp__link-go"})],8,hs)):O("",!0),e.billing.rate_tiers.length?(n(),i("div",_s,[y[2]||(y[2]=t("span",{class:"chbp__subtitle"},"Rate tiers",-1)),t("table",ps,[y[1]||(y[1]=t("thead",null,[t("tr",null,[t("th",null,"From"),t("th",null,"To"),t("th",null,"Rate")])],-1)),t("tbody",null,[(n(!0),i(T,null,L(e.billing.rate_tiers,(g,C)=>(n(),i("tr",{key:C},[t("td",ms,d(g.min_threshold),1),t("td",fs,d(g.max_threshold??"∞"),1),t("td",ys,d(s(re)(g.rate_per_confirmed_appointment)),1)]))),128))])])])):O("",!0)])}}}),bs=J(vs,[["__scopeId","data-v-c415e36e"]]),gs={class:"chpe__avatar"},ks={class:"chpe__info"},$s={class:"chpe__role"},Cs={key:0,class:"chpe__name"},ws={key:0,class:"chpe__flag"},Ss={key:1,class:"chpe__unassigned"},Os=["href"],As=K({__name:"ClientHubPersonRow",props:{role:{},person:{}},setup(e){const o=e,a=m(()=>cs(o.person)),h=m(()=>rs(o.person));return(l,u)=>(n(),i("div",{class:W(["chpe",{"chpe--empty":!e.person}])},[t("span",gs,d(e.person?s(h):"—"),1),t("div",ks,[t("span",$s,d(e.role),1),e.person?(n(),i("span",Cs,[H(d(s(a))+" ",1),e.person.is_active===!1?(n(),i("span",ws,"Inactive")):O("",!0)])):(n(),i("span",Ss,"Not assigned")),e.person?.email?(n(),i("a",{key:2,href:`mailto:${e.person.email}`,class:"chpe__email",onClick:u[0]||(u[0]=we(()=>{},["stop"]))},d(e.person.email),9,Os)):O("",!0)])],2))}}),Es=J(As,[["__scopeId","data-v-f46e6d9f"]]),Ts={class:"chht"},Is={key:0,class:"chht__empty"},Ns={key:1,class:"chht__list"},xs={class:"chht__rail"},Ls={class:"chht__content"},Ms={class:"chht__head"},Ps={class:"chht__event"},Rs={class:"chht__ago"},Ds={key:0,class:"chht__comment"},Fs={class:"chht__meta"},Hs={class:"chht__author"},Bs={class:"chht__date"},zs=K({__name:"ClientHubHistoryTimeline",props:{entries:{},limit:{default:4}},setup(e){const o=e,a=j(!1),h=m(()=>a.value?o.entries:o.entries.slice(0,o.limit)),l=_=>_?he[_]:"No status",u=_=>_?ve[_]:"var(--text-faint)",r=_=>_.event_type==="note"?"Note added":_.event_type==="status_set"?`Status set to ${l(_.to_status)}`:`${l(_.from_status)} → ${l(_.to_status)}`,y=_=>{const $=new Date(_);
1return Number.isNaN($.getTime())?_:$.toLocaleString("en-US",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})};return(_,$)=>{const g=ne;return n(),i("div",Ts,[e.entries.length?(n(),i("ul",Ns,[(n(!0),i(T,null,L(s(h),C=>(n(),i("li",{key:C.id,class:"chht__item"},[t("span",xs,[t("span",{class:"chht__dot",style:Q({background:u(C.to_status)})},null,4)]),t("div",Ls,[t("div",Ms,[t("span",Ps,d(r(C)),1),t("span",Rs,d(s(Le)(s(xe)(C.created))),1)]),C.comment?(n(),i("p",Ds,d(C.comment),1)):O("",!0),t("div",Fs,[t("span",Hs,[b(g,{name:"heroicons:user-circle",size:"12"}),H(" "+d(C.changed_by_username||C.changed_by_email||"System"),1)]),t("span",Bs,d(y(C.created)),1)])])]))),128))])):(n(),i("div",Is,[b(g,{name:"heroicons:inbox",size:"22"}),$[1]||($[1]=t("span",null,"No status history yet.",-1))])),e.entries.length>e.limit?(n(),i("button",{key:2,type:"button",class:"chht__more",onClick:$[0]||($[0]=C=>a.value=!s(a))},[b(g,{name:s(a)?"heroicons:chevron-up":"heroicons:chevron-down",size:"13"},null,8,["name"]),H(" "+d(s(a)?"Show less":`View all ${e.entries.length}`),1)])):O("",!0)])}}}),Us=J(zs,[["__scopeId","data-v-98e2bab8"]]),Vs={class:"chcr__avatar"},Gs={class:"chcr__info"},Ys={class:"chcr__top"},js={class:"chcr__name"},Ws={key:0,class:"chcr__badge"},qs={key:0,class:"chcr__title"},Ks=["href"],Js=["href"],Xs=K({__name:"ClientHubContactRow",props:{contact:{}},setup(e){const o=e,a=m(()=>{const h=o.contact.full_name?.trim();if(h){const l=h.split(/\s+/),u=l[0]?.[0]??"",r=l.length>1?l[l.length-1][0]:"";return`${u}${r}`.toUpperCase()}return(o.contact.email?.trim()?.[0]??"#").toUpperCase()});return(h,l)=>(n(),i("div",{class:W(["chcr",{"chcr--primary":e.contact.is_primary}])},[t("span",Vs,d(s(a)),1),t("div",Gs,[t("span",Ys,[t("span",js,d(e.contact.full_name||"Unnamed contact"),1),e.contact.is_primary?(n(),i("span",Ws,"Primary")):O("",!0)]),e.contact.title?(n(),i("span",qs,d(e.contact.title),1)):O("",!0),e.contact.email?(n(),i("a",{key:1,class:"chcr__link",href:`mailto:${e.contact.email}`},d(e.contact.email),9,Ks)):O("",!0),e.contact.phone?(n(),i("a",{key:2,class:"chcr__link",href:`tel:${e.contact.phone}`},d(e.contact.phone),9,Js)):O("",!0)])],2))}}),Zs=J(Xs,[["__scopeId","data-v-75b7e7e5"]]),Qs={class:"chac"},eo={key:0,class:"chac-current"},to={class:"chac-current__head"},no={class:"chac-current__label"},so={class:"chac-current__total"},oo={class:"chac-keys"},ao={class:"chac-key__label"},io={class:"chac-key__n"},lo={key:1,class:"chac-empty"},co={key:2,class:"chac-rows"},ro={class:"chac-month"},uo={class:"chac-track"},ho={class:"chac-total"},_o={class:"chac-tooltip",role:"tooltip"},po={class:"chac-tooltip__title"},mo={class:"chac-tooltip__label"},fo={class:"chac-tooltip__n"},yo=K({__name:"ClientHubAppointmentsChart",props:{metrics:{}},setup(e){const o=e,a=et,h=(g,C)=>g.by_status?.[C]??0,l=m(()=>o.metrics.months??[]),u=m(()=>{const g=l.value,C=g.findIndex(k=>(k.total??0)>0);return C>0?g.slice(C):C===-1?g.slice(-1):g}),r=m(()=>o.metrics.current_month??u.value[u.value.length-1]),y=m(()=>Math.max(...u.value.map(g=>g.total??0),0)),_=m(()=>u.value.map(g=>({month:g.month,label:Oe(g.month),total:g.total??0,isCurrent:g.month===r.value?.month,segments:a.map(C=>({...C,value:h(g,C.key),width:y.value?h(g,C.key)/y.value*100:0}))}))),$=m(()=>r.value?Oe(r.value.month):"—");return(g,C)=>(n(),i("div",Qs,[s(r)?(n(),i("div",eo,[t("div",to,[t("span",no,"Current month · "+d(s($)),1),t("span",so,[H(d(s(r).total)+" ",1),C[0]||(C[0]=t("span",{class:"chac-current__unit"},"appointments",-1))])]),t("div",oo,[(n(!0),i(T,null,L(s(a),k=>(n(),i("span",{key:k.key,class:"chac-key"},[t("span",{class:"chac-dot",style:Q({background:k.color}),"aria-hidden":"true"},null,4),t("span",ao,d(k.label),1),t("span",io,d(h(s(r),k.key)),1)]))),128))])])):O("",!0),s(y)===0?(n(),i("div",lo," No appointments scheduled in the last "+d(s(l).length)+" months. ",1)):(n(),i("ol",co,[(n(!0),i(T,null,L(s(_),k=>(n(),i("li",{key:k.month,class:W(["chac-row",{"chac-row--current":k.isCurrent}])},[t("span",ro,d(k.label),1),t("span",uo,[(n(!0),i(T,null,L(k.segments,f=>(n(),i("span",{key:f.key,class:W(["chac-seg",{"chac-seg--zero":f.value===0}]),style:Q({width:`${f.width}%`,background:f.color})},null,6))),128))]),t("span",ho,d(k.total),1),t("span",_o,[t("span",po,d(k.label)+" · "+d(k.total)+" total",1),(n(!0),i(T,null,L(k.segments,f=>(n(),i("span",{key:f.key,class:"chac-tooltip__row"},[t("span",{class:"chac-dot",style:Q({background:f.color}),"aria-hidden":"true"},null,4),t("span",mo,d(f.label),1),t("span",fo,d(f.value),1)]))),128))])],2))),128))])),C[1]||(C[1]=t("p",{class:"chac-note"}," Counted by scheduled date and current status. The current month includes appointments still ahead in the month. ",-1))]))}}),vo=J(yo,[["__scopeId","data-v-18e27ee8"]]),bo={class:"chai"},go={key:0,class:"chai-placeholder"},ko={key:1,class:"chai-placeholder"},$o={key:2,class:"chai-placeholder chai-placeholder--error"},Co={class:"chai-hero__main"},wo={class:"chai-hero__title"},So={class:"chai-hero__name"},Oo={class:"chai-hero__badges"},Ao={class:"chai-tag"},Eo={class:"chai-tag chai-tag--type"},To={class:"chai-tag chai-tag--id"},Io={key:0,class:"chai-tag"},No={class:"chai-hero__side"},xo=["disabled"],Lo={key:0,class:"chai-inline-error"},Mo={class:"chai-stats"},Po={class:"chai-breakdown"},Ro=["title"],Do={class:"chai-breakdown__n"},Fo={key:0,class:"chai-breakdown__meta"},Ho={class:"chai-outcomes"},Bo={class:"chai-outcome__label"},zo={class:"chai-grid"},Uo={class:"chai-fields"},Vo={class:"chai-since"},Go={class:"chai-since__value"},Yo={key:0,class:"chai-since__sub"},jo={class:"chai-contact"},Wo=["href"],qo={class:"chai-contact__value"},Ko=["href"],Jo={class:"chai-contact__value"},Xo=["href"],Zo={class:"chai-contact__value"},Qo=["href"],ea={class:"chai-contact__value chai-contact__value--text"},ta=["href"],na=["href"],sa={key:6,class:"chai-empty"},oa={class:"chai-mid"},aa={class:"chai-mid__stack"},ia={key:0,class:"chai-chips"},la={key:1,class:"chai-empty"},ca={class:"chai-chips"},ra={class:"chai-people"},ua={key:0,class:"chai-people"},da={key:1,class:"chai-empty"},ha={class:"chai-people"},_a={class:"chai-footnote"},pa=K({__name:"ClientHubAccountInfo",props:{detail:{},loading:{type:Boolean},error:{},accountId:{}},emits:["refresh","manage-status"],setup(e){const o=e,a=m(()=>
1o.detail?.client_status?ve[o.detail.client_status]:"var(--text-faint)"),h=m(()=>o.detail?.client_status?he[o.detail.client_status]:"No status"),l=m(()=>{const v=o.detail?.status_history?.[0];return v?`Updated ${xe(v.created)}`:"Never updated"}),u=m(()=>o.detail?.appointment_metrics?.current_month??null),r=m(()=>u.value?.total??"—"),y=m(()=>{const v=u.value;return v?et.map(x=>({...x,value:v.by_status?.[x.key]??0})).filter(x=>x.value>0):[]}),_=m(()=>ls.map(v=>({...v,value:u.value?.by_client_status?.[v.key]??0}))),$=m(()=>{const v=u.value;return v?`Of ${v.total} appts in ${Oe(v.month)}`:null}),g=v=>{const x=o.detail?.details?.[v];return typeof x=="string"&&x.trim()!==""?x.trim():null},C=m(()=>g("master_doc_link")),k=m(()=>{const v=u.value;if(!v)return null;const x=o.detail?.goal,V=x?` · ${Math.round(v.total/x*100)}% of goal`:"";return`${Oe(v.month)}${V}`}),f=m(()=>{const v=o.detail?.billing.billing_model;return v?Ze[v]??v:null}),M=m(()=>re(o.detail?.billing.monthly_flat_fee??null)??"—"),R=m(()=>{const v=o.detail?.billing;return v?(v.billing_model==="flat_fee_only"||v.billing_model==="flat_fee_and_per_appointment")&&re(v.monthly_flat_fee)!==null:!1}),N=m(()=>{const v=o.detail?.billing;return v?v.per_appointment_enabled||v.rate_tiers.length>0:!1}),D=m(()=>{const v=o.detail?.billing;return v?v.rate_tiers.length?"Scale":re(v.rate_per_confirmed_appointment)??"—":"—"}),B=m(()=>{const v=o.detail?.billing;return v?v.rate_tiers.length?`${v.rate_tiers.length} rate tiers`:"Per confirmed appt.":null}),q=m(()=>{const v=o.detail?.active_services??[];return v.length?v.slice(0,2).map(fe).join(", ")+(v.length>2?"…":""):"None enabled"}),X=m(()=>{const v=o.detail?.staff;return v?[v.team_lead,v.sales_coach,v.cold_email_specialist].filter(Boolean).length+v.specialists.length:0}),S=m(()=>{if(!o.detail?.created)return"—";const v=new Date(o.detail.created);return Number.isNaN(v.getTime())?"—":v.toLocaleDateString("en-US",{month:"short",year:"numeric"})}),p=m(()=>o.detail?.created?Le(xe(o.detail.created)):null),A=m(()=>({path:"/config/accounts-management",query:{account_id:String(o.detail?.account_id??""),search:ye(o.detail?.account_name??"")}})),F=m(()=>o.detail?.contacts??[]),E=m(()=>o.detail?.enabled_reports??[]),c=m(()=>{const v=o.detail?.address;if(!v)return null;const x=[v.address1,v.address2].filter(Boolean).join(", "),V=[v.city,v.state,v.zip].filter(Boolean).join(" ");return[x,V,v.country].filter(Boolean).join(", ")||null}),w=m(()=>{const v=o.detail?.contact.website;if(v)return/^https?:\/\//i.test(v)?v:`https://${v}`}),I=m(()=>c.value?`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(c.value)}`:void 0),P=m(()=>{const v=o.detail?.contact;return!!(v?.website||v?.email||v?.phone||c.value||o.detail?.details?.client_sales_folder_link||C.value)}),z=v=>{if(!v)return"—";const x=new Date(v);return Number.isNaN(x.getTime())?v:x.toLocaleDateString("en-US",{day:"2-digit",month:"short",year:"numeric"})};return(v,x)=>{const V=ne,G=Me,ie=gt,oe=Xn,pe=Qe,ae=is,be=bs,me=Es,ut=Us,dt=Zs,ht=vo;return n(),i("div",bo,[e.accountId?e.loading&&!e.detail?(n(),i("div",ko,[...x[5]||(x[5]=[t("span",{class:"spinner"},null,-1),H(" Loading account info… ",-1)])])):e.error&&!e.detail?(n(),i("div",$o,[b(V,{name:"heroicons:exclamation-triangle",size:"24"}),t("span",null,d(e.error),1),t("button",{type:"button",class:"chai-btn",onClick:x[0]||(x[0]=U=>v.$emit("refresh"))},"Retry")])):e.detail?(n(),i(T,{key:3},[t("div",{class:"chai-hero",style:Q({"--status":s(a)})},[t("div",Co,[t("div",wo,[t("h2",So,d(("formatAccountName"in v?v.formatAccountName:s(ye))(e.detail.account_name??"")),1),b(G,{status:e.detail.client_status},null,8,["status"])]),t("div",Oo,[t("span",Ao,d(s(fe)(e.detail.account_status)),1),t("span",Eo,d(e.detail.account_type),1),t("span",To,"ID "+d(e.detail.account_id),1),e.detail.industry?(n(),i("span",Io,d(e.detail.industry),1)):O("",!0)])]),t("div",No,[t("button",{type:"button",class:"chai-btn",disabled:e.loading,onClick:x[1]||(x[1]=U=>
1v.$emit("refresh"))},[b(V,{name:"heroicons:arrow-path",size:"14"}),x[6]||(x[6]=H(" Refresh ",-1))],8,xo),b(ie,{class:"chai-btn",to:s(A)},{default:te(()=>[b(V,{name:"heroicons:cog-6-tooth",size:"14"}),x[7]||(x[7]=H(" Account Management ",-1))]),_:1},8,["to"]),t("button",{type:"button",class:"chai-btn chai-btn--primary",onClick:x[2]||(x[2]=U=>v.$emit("manage-status"))},[b(V,{name:"heroicons:flag",size:"14"}),x[8]||(x[8]=H(" Manage status ",-1))])])],4),e.error?(n(),i("div",Lo,d(e.error),1)):O("",!0),t("div",Mo,[b(oe,{label:"Client status",icon:"heroicons:heart",value:s(h),accent:s(a),sub:s(l)},null,8,["value","accent","sub"]),b(oe,{label:"Monthly appt. goal",icon:"heroicons:flag",tone:"purple",value:e.detail.goal??"—",sub:"Appointments / month"},null,8,["value"]),e.detail.appointment_metrics?(n(),Y(oe,{key:0,label:"Appts this month",icon:"heroicons:calendar-days",tone:"accent",value:s(r),sub:s(k)},mt({_:2},[s(y).length?{name:"sub",fn:te(()=>[t("span",Po,[(n(!0),i(T,null,L(s(y),U=>(n(),i("span",{key:U.key,class:"chai-breakdown__item",title:U.label},[t("span",{class:"chai-breakdown__dot",style:Q({background:U.color}),"aria-hidden":"true"},null,4),t("span",Do,d(U.value),1),H(" "+d(U.short),1)],8,Ro))),128))]),s(k)?(n(),i("span",Fo,d(s(k)),1)):O("",!0)]),key:"0"}:void 0]),1032,["value","sub"])):O("",!0),e.detail.appointment_metrics?(n(),Y(oe,{key:1,label:"Sales outcomes",icon:"heroicons:trophy",tone:"success",value:null,sub:s($)},{value:te(()=>[t("span",Ho,[(n(!0),i(T,null,L(s(_),U=>(n(),i("span",{key:U.key,class:"chai-outcome"},[t("span",{class:"chai-outcome__n",style:Q({color:U.color})},d(U.value),5),t("span",Bo,d(U.label),1)]))),128))])]),_:1},8,["sub"])):O("",!0),s(R)?(n(),Y(oe,{key:2,label:"Monthly Retainer/Flat Fee",icon:"heroicons:banknotes",tone:"teal",value:s(M),sub:s(f)},null,8,["value","sub"])):O("",!0),s(N)?(n(),Y(oe,{key:3,label:"Rate per appt.",icon:"heroicons:receipt-percent",tone:"indigo",value:s(D),sub:s(B)},null,8,["value","sub"])):O("",!0),b(oe,{label:"Active services",icon:"heroicons:squares-2x2",tone:"pink",value:e.detail.active_services.length,sub:s(q)},null,8,["value","sub"])]),t("div",zo,[b(ae,{icon:"heroicons:identification",title:"Company profile"},{default:te(()=>[t("div",Uo,[b(pe,{label:"Industry",value:s(Le)(e.detail.industry)},null,8,["value"]),b(pe,{label:"Client since"},{default:te(()=>[t("span",Vo,[t("span",Go,d(s(S)),1),s(p)?(n(),i("span",Yo,d(s(p)),1)):O("",!0)])]),_:1})]),t("div",jo,[e.detail.contact.website?(n(),i("a",{key:0,class:"chai-contact__row",href:s(w),target:"_blank",rel:"noopener"},[b(V,{name:"heroicons:globe-alt",size:"14"}),t("span",qo,d(e.detail.contact.website),1),b(V,{name:"heroicons:arrow-top-right-on-square",size:"12",class:"chai-contact__go"})],8,Wo)):O("",!0),e.detail.contact.email?(n(),i("a",{key:1,class:"chai-contact__row",href:`mailto:${e.detail.contact.email}`},[b(V,{name:"heroicons:envelope",size:"14"}),t("span",Jo,d(e.detail.contact.email),1)],8,Ko)):O("",!0),e.detail.contact.phone?(n(),i("a",{key:2,class:"chai-contact__row",href:`tel:${e.detail.contact.phone}`},[b(V,{name:"heroicons:phone",size:"14"}),t("span",Zo,d(e.detail.contact.phone),1)],8,Xo)):O("",!0),s(c)?(n(),i("a",{key:3,class:"chai-contact__row",href:s(I),target:"_blank",rel:"noopener"},[b(V,{name:"heroicons:map-pin",size:"14"}),t("span",ea,d(s(c)),1),b(V,{name:"heroicons:arrow-top-right-on-square",size:"12",class:"chai-contact__go"})],8,Qo)):O("",!0),e.detail.details?.client_sales_folder_link?(n(),i("a",{key:4,class:"chai-contact__row",href:String(e.detail.details.client_sales_folder_link),target:"_blank",rel:"noopener"},[b(V,{name:"heroicons:folder",size:"14"}),x[9]||(x[9]=t("span",{class:"chai-contact__value chai-contact__value--text"},"Client sales folder",-1)),b(V,{name:"heroicons:arrow-top-right-on-square",size:"12",class:"chai-contact__go"})],8,ta)):O("",!0),s(C)?(n(),i("a",{key:5,class:"chai-contact__row",href:s(C),target:"_blank",rel:"noopener"},[b(V,{name:"heroicons:document-text",size:"14"}),x[10]||(x[10]=t("span",{class:"chai-contact__value chai-contact__value--text"},"Master doc",-1)),b(V,{name:"heroicons:arrow-top-right-on-square",size:"12",class:"chai-contact__go"})],8,na)):O("",!0),s(P)?O("",!0):(n(),i("span",sa,"No contact details on file."))])]),_:1}),t("div",oa,[t("div",aa,[b(ae,{icon:"heroicons:squares-2x2",title:"Active services",count:e.detail.active_services.length,"max-body-height":"240px"},{default:te(()=>[e.detail.active_services.length?(n(),i("div",ia,[(n(!0),i(T,null,L(e.detail.active_services,U=>(n(),i("span",{key:U,class:"chai-chip"},[b(V,{name:"heroicons:check-circle-solid",size:"13"}),H(" "+d(s(fe)(U)),1)]))),128))])):(n(),i("span",la,"No active services."))]),_:1},8,["count"]),s(E).length?(n(),Y(ae,{key:0,icon:"heroicons:document-chart-bar",title:"Enabled reports",count:s(E).length},{default:te(()=>[t("div",ca,[(n(!0),i(T,null,L(s(E),U=>(n(),i("span",{key:U,class:"chai-chip chai-chip--muted"},[b(V,{name:"heroicons:document-text",size:"13"}),H(" "+d(s(fe)(U)),1)]))),128))])]),_:1},8,["count"])):O("",!0)]),b(ae,{icon:"heroicons:banknotes",title:"Billing"},{default:te(()=>[b(be,{billing:e.detail.billing,details:e.detail.details},null,8,["billing","details"])]),_:1})]),b(ae,{icon:"heroicons:user-group",title:"Team",count:s(X),"max-body-height":"316px"},{default:te(()=>[t("div",ra,[b(me,{role:"Team lead",person:e.detail.staff.team_lead},null,8,["person"]),b(me,{role:"Sales coach",person:e.detail.staff.sales_coach},null,8,["person"]),b(me,{role:"Cold email specialist",person:e.detail.staff.cold_email_specialist},null,8,["person"]),(n(!0),i(T,null,L(e.detail.staff.specialists,U=>(n(),Y(me,{key:`${U.role}-${U.person.id}`,role:s(fe)(U.role),person:U.person},null,8,["role","person"]))),128))])]),_:1},8,["count"]),t("div",{class:W(["chai-bottom",{"chai-bottom--pair":!s(F).length}])},[b(ae,{icon:"heroicons:phone-arrow-up-right",title:"Active callers",count:e.detail.active_callers_count,"max-body-height":"392px"},{default:te(()=>[e.detail.active_callers.length?(n(),i("div",ua,[(n(!0),i(T,null,L(e.detail.active_callers,U=>(n(),Y(me,{key:U.id,role:"Caller",person:U},null,8,["person"]))),128))])):(n(),i("span",da,"No active callers assigned."))]),_:1},8,["count"]),b(ae,{icon:"heroicons:clock",title:"Status history",count:e.detail.status_history_total,"max-body-height":"392px"},{default:te(()=>[b(ut,{entries:e.detail.status_history},null,8,["entries"])]),_:1},8,["count"]),s(F).length?(n(),Y(ae,{key:0,icon:"heroicons:identification",title:"Contacts",count:s(F).length,"max-body-height":"392px"},{default:te(()=>[t("div",ha,[(n(!0),i(T,null,L(s(F),U=>
1(n(),Y(dt,{key:U.id,contact:U},null,8,["contact"]))),128))])]),_:1},8,["count"])):O("",!0)],2),e.detail.appointment_metrics?(n(),Y(ae,{key:0,icon:"heroicons:chart-bar",title:"Appointments by month",class:"chai-grid__full"},{default:te(()=>[b(ht,{metrics:e.detail.appointment_metrics},null,8,["metrics"])]),_:1})):O("",!0)]),t("p",_a," Created "+d(z(e.detail.created))+" · Last updated "+d(z(e.detail.updated)),1)],64)):O("",!0):(n(),i("div",go,[b(V,{name:"heroicons:building-office-2",size:"32"}),x[3]||(x[3]=t("p",{class:"chai-placeholder__title"},"No account selected",-1)),x[4]||(x[4]=t("p",{class:"chai-placeholder__text"}," Pick an account in the selector at the top of the page — or click one in Performance Report or Manage Accounts — to see everything about it here. ",-1))]))])}}}),ma=J(pa,[["__scopeId","data-v-679d3bf3"]]),fa={class:"chon","aria-label":"Onboarding sections"},ya=["data-tone","onClick"],va={class:"chon__row"},ba={class:"chon__label"},ga={key:0,class:"chon__done"},ka={class:"chon__gauge"},$a=K({__name:"ClientHubOnboardingNav",props:{sections:{},activeKey:{}},emits:["select"],setup(e){return(o,a)=>{const h=ne;return n(),i("nav",fa,[a[1]||(a[1]=t("span",{class:"chon__title"},"Sections",-1)),(n(!0),i(T,null,L(e.sections,l=>(n(),i("button",{key:l.key,type:"button",class:W(["chon__item",{"chon__item--active":l.key===e.activeKey}]),"data-tone":l.tone,onClick:u=>o.$emit("select",l.key)},[t("span",va,[a[0]||(a[0]=t("span",{class:"chon__dot"},null,-1)),t("span",ba,d(l.label),1),l.missing?O("",!0):(n(),i("span",ga,[b(h,{name:"heroicons:check",size:"12"})]))]),t("span",ka,[t("span",{class:"chon__gauge-fill",style:Q({width:`${l.percent}%`})},null,4)])],10,ya))),128))])}}}),Ca=J($a,[["__scopeId","data-v-8a4f2437"]]),Fe=[{value:"Yes",label:"Yes"},{value:"No",label:"No"}],He=[{value:"yes",label:"Yes"},{value:"no",label:"No"}],wa=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"].map(e=>({value:e,label:e})),Sa=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(e=>({value:e,label:e})),Ae=Array.from({length:16},(e,o)=>{const a=o+6,l=`${a%12===0?12:a%12}:00 ${a<12?"AM":"PM"}`;return{value:l,label:l}}),Oa=[...["Eastern Time (ET)","Central Time (CT)","Mountain Time (MT)","Mountain Time — Arizona (no DST)","Pacific Time (PT)","Alaska Time (AKT)","Hawaii-Aleutian Time (HT)"].map(e=>({value:e,label:e,group:"United States"})),...["Newfoundland Time (NT)","Atlantic Time (AT)","Eastern Time (Canada)","Central Time (Canada)","Mountain Time (Canada)","Pacific Time (Canada)"].map(e=>({value:e,label:e,group:"Canada"})),...["UTC","UK / Ireland (GMT/BST)","Central Europe (CET/CEST)","Eastern Europe (EET/EEST)","India (IST)","China / Singapore (CST/SGT)","Japan / Korea (JST/KST)","Australia Eastern (AET)"].map(e=>({value:e,label:e,group:"Other / Worldwide"}))],Aa=[{value:"commercial",label:"Commercial Cleaning"},{value:"parking",label:"Parking Lot Maintenance"},{value:"other",label:"Other"}],Ea=[...["Sweeping","Dusting","Mopping","Vacuuming","Taking out the trash","Disinfecting high touch areas"].map(e=>({value:e,label:e,group:"Regular Janitorial Services"})),...["Day / Night Porter","Post-Construction Cleaning","Disinfecting Spray (e.g. Enviroshield for JAN-PROs)"].map(e=>({value:e,label:e,group:"Additional Commercial Services"})),...["Deep Cleaning","Carpet Shampooing / Cleaning","Strip & Wax of Floors","Buff & Shine of Floors","Tile and/or Grout Cleaning","Floor Burnishing","Turn-Key Cleaning / Move-in / Move-out Cleaning","Pressure Washing","Upholstery Cleaning","Window Cleaning","Exterior Cleaning","Kitchen (Back of House) Cleaning","Maintenance Services"].map(e=>({value:e,label:e,group:"Special Cleaning Services"}))],Ta=["Asphalt Crack Filling","Asphalt Pothole Repairs","Asphalt Seal Coating","Parking Lot Signs & Bollard Covers","Line Striping (Asphalt/Concrete)","Custom Stenciling","Parking Blocks & Speed Bumps (or Wheel Stops)","Warehouse Safety Barrier Guardrails and Bollards","Indoor Line Striping & Safety Markings","Indoor Concrete Polishing","Power Washing","Snow Plowing","Epoxy Flooring","Repaving / Resurfacing","Concrete Repairs","Concrete Sidewalks & Curb Repairs","Landscaping"].map(e=>({value:e,label:e,group:"Parking lot & pavement services"})),Ia=["ISSA CIMS Certified","ISSA CIMS-GB (Green Building)","OSHA 10/30-Hour Certified","GBAC STAR Accredited","EPA Safer Choice Partner","Green Seal Certified","IICRC Certified (carpet & upholstery)","Bonded & Insured"].map(e=>({value:e,label:e})),Na=["OSHA 10/30-Hour Certified","Bonded & Insured","Asphalt Contractor Certification","NAPA Member (National Asphalt Pavement Association)","DOT / Traffic Control Certification","EPA Stormwater Pollution Prevention Certification"].map(e=>({value:e,label:e})),Be=["Facebook","Instagram","TikTok","LinkedIn","YouTube","Pinterest","X (Twitter)","Yelp"].map(e=>({value:e,label:e})),xa=["Facebook","Instagram","LinkedIn","X (Twitter)","YouTube","Yelp"].map(e=>({value:e,label:e})),se=(...e)=>e.map(o=>({value:o,label:o})),ze=se("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"),Ue=Array.from({length:31},(e,o)=>({value:String(o+1),label:String(o+1)})),Ve=Array.from({length:100},(e,o)=>{const a=String(new Date().getFullYear()-o);return{value:a,label:a}}),Z=(e,...o)=>({path:e,anyOf:o}),ke={"business_info.name":{type:"text"},"business_info.phone":{type:"tel",placeholder:"(555) 010-0199"},"business_info.address":{type:"text"},"business_info.timezone":{type:"select",options:Oa,allowOther:!0},"business_info.timezone_other":{type:"text"},"business_info.contact_name":{type:"text"},"business_info.contact_email":{type:"email"},"business_info.days_open":{type:"derived",options:wa},"business_info.hours_summary":{type:"derived"},"business_info.hours_monday":{type:"hours"},"business_info.hours_tuesday":{type:"hours"},"business_info.hours_wednesday":{type:"hours"},"business_info.hours_thursday":{type:"hours"},"business_info.hours_friday":{type:"hours"},"business_info.hours_saturday":{type:"hours"},"business_info.hours_sunday":{type:"hours"},"company_and_services.company_type":{type:"select",options:Aa},"company_and_services.company_type_other":{type:"text",condition:Z("company_and_services.company_type","other")},"company_and_services.vendor_compliance":{type:"yesno",options:He},"company_and_services.vendor_compliance_detail":{type:"textarea",condition:Z("company_and_services.vendor_compliance","yes")},"company_and_services.services_selected":{type:"multi",condition:Z("company_and_services.company_type","commercial","parking")},"company_and_services.services_other_specify":{type:"text",condition:Z("company_and_services.company_type","commercial","parking")},"company_and_services.services_free_text":{type:"textarea",condition:Z("company_and_services.company_type","other")},"company_and_services.takes_specials":{type:"yesno"},"company_and_services.government_contracts":{type:"yesno"},"company_and_services.certifications_selected":{type:"multi",condition:Z("company_and_services.company_type","commercial","parking")},"company_and_services.certifications_other_specify":{type:"text",condition:Z("company_and_services.company_type","commercial","parking")},"company_and_services.certifications_free_text":{type:"textarea",condition:Z("company_and_services.company_type","other")},"marketing_services.selected":{type:"derived"},"marketing_services.keys":{type:"derived"},"marketing_services.*":{type:"yesno"},"appointment_setup.comparative_quotes":{type:"yesno",options:He},"appointment_setup.attendee_name":{type:"text"},"appointment_setup.attendee_email":{type:"email"},"appointment_setup.manager_name":{type:"text"},"appointment_setup.manager_email":{type:"email"},"appointment_setup.bookable_days":{type:"multi",options:Sa},"appointment_setup.earliest_time":{type:"select",options:Ae},"appointment_setup.latest_time":{type:"select",options:Ae},"appointment_setup.time_between":{type:"select",options:se("15 min","30 min","45 min","1 hour","1.5 hours","2 hours"),allowOther:!0},"appointment_setup.time_between_other":{type:"text"},"appointment_setup.booking_method":{type:"select",options:se("Google Calendar","Outlook","iCal","Calendly","Other")},"appointment_setup.booking_method_other":{type:"text",condition:Z("appointment_setup.booking_method","Other")},"social_media.no_accounts_yet":{type:"yesno"},"social_media.current_platforms":{type:"multi",options:Be},"social_media.manage_platforms":{type:"multi",options:Be},"social_media.visual_references":{type:"textarea",placeholder:"One link per line"},"social_media.acknowledgement":{type:"yesno"},"social_media.credentials.*.username":{type:"text"},"social_media.credentials.*.password":{type:"password"},"platform_access.*.granted":{type:"yesno"},"platform_access.*.username":{type:"text"},"platform_access.*.password":{type:"password"},"platform_access.no_facebook_account":{type:"yesno"},"platform_access.no_google_account":{type:"yesno"},"platform_access.ad_campaign_budget":{type:"text",placeholder:"e.g. $1,500/month"},"platform_access.ad_campaign_languages":{type:"multi",options:se("English","Spanish")},"domain_hosting.status":{type:"select",options:[{value:"have",label:"I have a domain and hosting"},{value:"need",label:"I need to purchase them"}]},"domain_hosting.company_website":{type:"url",placeholder:"e.g. cleaninginmotion.com"},"domain_hosting.registrar":{type:"select",options:se("GoDaddy","Namecheap","Google Domains","Network Solutions","Domain.com","Wix","Squarespace","Corporate / IT-managed"),allowOther:!0,condition:Z("domain_hosting.status","have")},"domain_hosting.registrar_other":{type:"text"},"domain_hosting.domain_username":{type:"text",condition:Z("domain_hosting.status","have")},"domain_hosting.domain_password":{type:"password",condition:Z("domain_hosting.status","have")},"domain_hosting.hosting_provider":{type:"select",options:se("Bluehost","SiteGround","WP Engine","WordPress.com","GoDaddy","HostGator","DreamHost","Wix","Squarespace","Corporate / IT-managed"),allowOther:!0,condition:Z("domain_hosting.status","have")},"domain_hosting.hosting_provider_other":{type:"text"},"domain_hosting.hosting_username":{type:"text",condition:Z("domain_hosting.status","have")},"domain_hosting.hosting_password":{type:"password",condition:Z("domain_hosting.status","have")},"domain_hosting.info_not_available":{type:"yesno"},"google_business_profile.no_profile_yet":{type:"yesno"},"google_business_profile.access_email":{type:"email",condition:Z("google_business_profile.no_profile_yet","No")},"google_business_profile.profile_url":{type:"url",condition:Z("google_business_profile.no_profile_yet","No")},"google_business_profile.primary_category":{type:"text",condition:Z("google_business_profile.no_profile_yet","No")},"google_business_profile.profile_details.planning":{type:"multi",options:se("Appointment required","Walk-ins welcome","Online booking available","On-site services (we come to you)")},"google_business_profile.profile_details.parking":{type:"multi",options:se("Free parking","Accessible parking","Wheelchair-accessible entrance","Wheelchair-accessible restrooms")},"google_business_profile.profile_details.payment_methods":{type:"multi",options:se("Cash","Check","Credit / debit cards","Financing available","Invoice")},"google_business_profile.profile_details.social_channels":{type:"multi",options:xa},"google_business_profile.profile_details.community_involvement":{type:"textarea"},"industries_locations.industries_selected":{type:"multi"},"industries_locations.industries_by_group":{type:"derived"},"industries_locations.industries_count":{type:"derived"},"industries_locations.group_count":{type:"derived"},"industries_locations.locations_target":{type:"textarea",placeholder:"ZIP codes separated by commas"},"seo_content.content_proof":{type:"multi",options:se("Before-and-after photos","Client logos","Video walkthroughs","Written testimonials","Specific client success stories")},"seo_content.content_notes":{type:"textarea"},"seo_content.priority_services":{type:"multi"},"seo_content.priority_other":{type:"text"},"seo_content.main_cta":{type:"multi",options:se("Book an on-site walkthrough","Use an online quote calculator","Request a PDF proposal","Other")},"seo_content.main_cta_other":{type:"text",condition:{path:"seo_content.main_cta",anyOf:["Other"],contains:!0}},"seo_content.objections":{type:"textarea"},"seo_content.competitors":{type:"textarea"},"seo_content.technical_access":{type:"multi",options:se("Google Analytics 4","Google Search Console","Website CMS")},"seo_content.access_email":{type:"email"},"about_company.q1":{type:"textarea"},"about_company.q2":{type:"textarea"},"about_company.q3":{type:"textarea"},"about_company.q4":{type:"textarea"},"about_company.q5":{type:"textarea"},"about_company.franchise_q1":{type:"textarea"},"about_company.franchise_q2":{type:"textarea"},"personal_info.full_name":{type:"text"},"personal_info.birthday_month":{type:"select",options:ze},"personal_info.birthday_day":{type:"select",options:Ue},"personal_info.birthday_year":{type:"select",options:Ve},"personal_info.anniversary_month":{type:"select",options:ze},"personal_info.anniversary_day":{type:"select",options:Ue},"personal_info.anniversary_year":{type:"select",options:Ve},"personal_info.nickname":{type:"text"},"personal_info.zodiac":{type:"select",options:se("Aries","Taurus","Gemini","Cancer","Leo","Virgo","Libra","Scorpio","Sagittarius","Capricorn","Aquarius","Pisces")}},La=e=>{if(ke[e])return ke[e];const o=e.split(".");for(const a of Object.keys(ke)){if(!a.includes("*"))continue;const h=a.split(".");if(h.length===o.length&&h.every((l,u)=>l==="*"||l===o[u]))return ke[a]}return null},Ge={commercial:Ea,parking:Ta},Ma={commercial:Ia,parking:Na};function Pa(e,o){const a=o.answer("company_and_services.company_type").toLowerCase();return e==="company_and_services.services_selected"?Ge[a]??[]:e==="company_and_services.certifications_selected"?Ma[a]??[]:e==="industries_locations.industries_selected"?o.answerOptions.industries:e==="marketing_services.selected"?Object.values(o.answerOptions.marketingLabels).map(h=>({value:h,label:h})):e==="seo_content.priority_services"?Pe(o.answer("company_and_services.services_selected"),Ge[a]??[]).map(l
1=>({value:l,label:l})):null}function tt(e,o,a,h){if(o==="password")return{type:"password",options:[],allowOther:!1,placeholder:"",condition:null};if(h.answerOptions.marketingPaths.has(e))return{type:"yesno",options:Fe,allowOther:!1,placeholder:"",condition:null};const l=La(e);if(!l)return{type:"textarea",options:[],allowOther:!1,placeholder:"",condition:null};const u=Pa(e,h)??l.options??(l.type==="yesno"?Fe:[]),r=l.type==="select"||l.type==="multi"||l.type==="yesno";return{type:a?r&&!u.length?"textarea":l.type:"derived",options:u,allowOther:l.allowOther??!1,placeholder:l.placeholder??"",condition:l.condition??null}}function Ra(e,o,a=""){const h=e.condition;if(!h||a.trim())return!0;const l=o.answer(h.path);if(!l)return!1;if(h.contains){const u=l.split(",").map(r=>r.trim().toLowerCase());return h.anyOf.some(r=>u.includes(r.toLowerCase()))}return h.anyOf.some(u=>u.toLowerCase()===l.trim().toLowerCase())}const nt=", ";function Pe(e,o){const a=(e||"").trim();if(!a)return[];const h=new Set(o.map(y=>y.value)),l=a.split(",").map(y=>y.trim()).filter(Boolean),u=[];let r=0;for(;r<l.length;){let y="";for(let _=Math.min(l.length,r+4);_>r;_--){const $=l.slice(r,_).join(nt);if(h.has($)){y=$,r=_;break}}y?u.push(y):(u.push(l[r]),r++)}return u}function Da(e){return e.join(nt)}const Fa="Closed";function Ha(e){const o=(e||"").trim();if(!o||/^closed$/i.test(o))return{closed:!0,from:"",to:""};const[a="",h=""]=o.split("-").map(l=>l.trim());return{closed:!1,from:a,to:h}}function Te(e,o,a){return e?Fa:!o&&!a?"":`${o} - ${a}`.trim()}const ee=e=>typeof e=="string"?e.trim():"",Ye=e=>Array.isArray(e)?e:[],ue=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:null,st={marketingPaths:new Set,marketingLabels:{},industries:[]};function Ba(e){const o=new Set,a={},h=[],l=(_,$)=>{if(!_)return;const g=_.includes(".")?_:`marketing_services.${_}`;o.add(g),$&&(a[g]=$)},u=e?.marketing_services;if(Array.isArray(u))for(const _ of u){const $=ue(_);$&&l(ee($.field)||ee($.key),ee($.label))}else{const _=ue(u);if(_)for(const[$,g]of Object.entries(_)){const C=ue(g);C?l(ee(C.field)||$,ee(C.label)):l($,ee(g))}}const r=(_,$)=>{if(typeof $=="string"){const k=$.trim();k&&h.push({value:k,label:k,group:_||void 0});return}const g=ue($);if(!g)return;const C=ee(g.value)||ee(g.label)||ee(g.name);C&&h.push({value:C,label:ee(g.label)||C,group:_||void 0})},y=e?.industry_groups;if(Array.isArray(y))for(const _ of y){const $=ue(_);if(!$){r("",_);continue}const g=ee($.group)||ee($.label)||ee($.name)||ee($.category),C=Ye($.items??$.industries??$.options??$.values);for(const k of C)r(g,k)}else{const _=ue(y);if(_)for(const[$,g]of Object.entries(_))for(const C of Ye(g))r($,C)}return{marketingPaths:o,marketingLabels:a,industries:h}}const ot={type:"derived",options:[],allowOther:!1,placeholder:"",condition:null},za={key:0,class:"choc__pills"},Ua=["onClick"],Va={key:1,class:"choc__stack"},Ga=["value"],Ya=["label"],ja=["value"],Wa=["value"],qa=["value"],Ka={key:2,class:"choc__stack"},Ja={key:0,class:"choc__empty"},Xa={class:"choc__multi-head"},Za={class:"choc__count"},Qa={class:"choc__list"},ei={key:0,class:"choc__group"},ti=["checked","onChange"],ni={key:0,class:"choc__empty"},si={key:0,class:"choc__unknown"},oi={key:3,class:"choc__stack"},ai={class:"choc__pills"},ii={key:0,class:"choc__row"},li=["value"],ci=["value"],ri=["value"],ui=["value"],di=["value","rows","placeholder"],hi=["value","type","placeholder"],Ie="__other__",_i=K({__name:"ClientHubOnboardingControl",props:{control:{},value:{},placeholder:{default:"Not answered"}},emits:["update"],setup(e,{emit:o}){const a=e,h=o,l=j(""),u=E=>h("update",E),r=m(()=>({email:"email",tel:"tel",url:"url"})[a.control.type]??"text"),y=m(()=>Math.min(8,Math.max(2,Math.ceil(a.value.length/60)+1))),_=E=>{const c=[];for(const w of E){const I=w.group??"",P=c[c.length-1];P&&P.name===I?P.options.push(w):c.push({name:I,options:[w]})}return c},$=m(()=>_(a.control.options)),g=m(()=>{const E=l.value.trim().toLowerCase();return E?$.value.map(c=>({name:c.name,options:c.name.toLowerCase().includes(E)?c.options:c.options.filter(w=>w.label.toLowerCase().includes(E))})).filter(c=>c.options.length>0):$.value}),C=m(()=>a.control.type==="multi"),k=m(()=>C.value?Pe(a.value,a.control.options):a.value?[a.value]:[]),f=m(()=>new Set(a.control.options.map(E=>E.value))),M=m(()=>C.value?k.value.filter(E=>!f.value.has(E)):[]),R=E=>k.value.includes(E),N=E=>{u(a.value===E?"":E)},D=E=>{const c=R(E)?k.value.filter(w=>w!==E):[...k.value,E];u(Da(c))},B=m(()=>!a.value||f.value.has(a.value)),q=m(()=>a.control.allowOther&&!B.value),X=m(()=>
1B.value?a.value:Ie),S=E=>{const c=E.target.value;u(c===Ie?"":c)},p=m(()=>Ha(a.value)),A=E=>{u(E?Te(!0,"",""):Te(!1,p.value.from,p.value.to))},F=(E,c)=>{const w=E.target.value,I=c==="from"?w:p.value.from,P=c==="to"?w:p.value.to;u(Te(!1,I,P))};return(E,c)=>e.control.type==="yesno"?(n(),i("div",za,[(n(!0),i(T,null,L(e.control.options,w=>(n(),i("button",{key:w.value,type:"button",class:W(["choc__pill",{"choc__pill--on":R(w.value)}]),onClick:I=>N(w.value)},d(w.label),11,Ua))),128))])):e.control.type==="select"?(n(),i("div",Va,[t("select",{class:"choc__input",value:s(X),onChange:c[0]||(c[0]=w=>S(w))},[c[10]||(c[10]=t("option",{value:""},"Not answered",-1)),(n(!0),i(T,null,L(s($),w=>(n(),i(T,{key:w.name||"plain"},[w.name?(n(),i("optgroup",{key:0,label:w.name},[(n(!0),i(T,null,L(w.options,I=>(n(),i("option",{key:I.value,value:I.value},d(I.label),9,ja))),128))],8,Ya)):O("",!0),(n(!0),i(T,null,L(w.name?[]:w.options,I=>(n(),i("option",{key:I.value,value:I.value},d(I.label),9,Wa))),128))],64))),128)),e.control.allowOther?(n(),i("option",{key:0,value:Ie},"Other…")):O("",!0)],40,Ga),s(q)?(n(),i("input",{key:0,value:e.value,type:"text",class:"choc__input",placeholder:"Type the other value",onInput:c[1]||(c[1]=w=>u(w.target.value))},null,40,qa)):O("",!0)])):e.control.type==="multi"?(n(),i("div",Ka,[e.control.options.length?(n(),i(T,{key:1},[t("div",Xa,[e.control.options.length>12?de((n(),i("input",{key:0,"onUpdate:modelValue":c[2]||(c[2]=w=>Je(l)?l.value=w:null),type:"search",class:"choc__input choc__input--search",placeholder:"Filter options…"},null,512)),[[Ke,s(l)]]):O("",!0),t("span",Za,d(s(k).length)+" selected",1),s(k).length?(n(),i("button",{key:1,type:"button",class:"choc__link",onClick:c[3]||(c[3]=w=>u(""))}," Clear ")):O("",!0)]),t("div",Qa,[(n(!0),i(T,null,L(s(g),w=>(n(),i(T,{key:w.name||"plain"},[w.name?(n(),i("p",ei,d(w.name),1)):O("",!0),(n(!0),i(T,null,L(w.options,I=>(n(),i("label",{key:I.value,class:"choc__check"},[t("input",{type:"checkbox",checked:R(I.value),onChange:P=>D(I.value)},null,40,ti),t("span",null,d(I.label),1)]))),128))],64))),128)),s(g).length?O("",!0):(n(),i("p",ni,"No option matches that filter."))]),s(M).length?(n(),i("p",si," Kept as answered: "+d(s(M).join(", ")),1)):O("",!0)],64)):(n(),i("div",Ja," No options available — pick the company type first. "))])):e.control.type==="hours"?(n(),i("div",oi,[t("div",ai,[t("button",{type:"button",class:W(["choc__pill",{"choc__pill--on":!s(p).closed}]),onClick:c[4]||(c[4]=w=>A(!1))}," Open ",2),t("button",{type:"button",class:W(["choc__pill",{"choc__pill--on":s(p).closed}]),onClick:c[5]||(c[5]=w=>A(!0))}," Closed ",2)]),s(p).closed?O("",!0):(n(),i("div",ii,[t("select",{class:"choc__input",value:s(p).from,onChange:c[6]||(c[6]=w=>F(w,"from"))},[c[11]||(c[11]=t("option",{value:""},"--",-1)),(n(!0),i(T,null,L(s(Ae),w=>(n(),i("option",{key:w.value,value:w.value},d(w.label),9,ci))),128))],40,li),c[13]||(c[13]=t("span",{class:"choc__to"},"to",-1)),t("select",{class:"choc__input",value:s(p).to,onChange:c[7]||(c[7]=w=>F(w,"to"))},[c[12]||(c[12]=t("option",{value:""},"--",-1)),(n(!0),i(T,null,L(s(Ae),w=>(n(),i("option",{key:w.value,value:w.value},d(w.label),9,ui))),128))],40,ri)]))])):e.control.type==="textarea"?(n(),i("textarea",{key:4,value:e.value,class:"choc__input choc__input--area",rows:s(y),placeholder:e.placeholder,onInput:c[8]||(c[8]=w=>u(w.target.value))},null,40,di)):(n(),i("input",{key:5,value:e.value,type:s(r),class:"choc__input",placeholder:e.placeholder,onInput:c[9]||(c[9]=w=>u(w.target.value))},null,40,hi))}}),pi=J(_i,[["__scopeId","data-v-0fa50fb2"]]),mi=["_other","_specify","_free_text","_notes","_detail"],fi=/\bplease specify\b|\(optional\)|^other\b/i;function yi(e,o=""){const a=(e.split(".").pop()??"").toLowerCase();return a==="other"||mi.some(h=>a.endsWith(h))?!0:fi.test(o.trim())}const vi=new Set(["username","password","email","url","website"]),bi=["_email","_username","_password","_url","_website","_handle","_domain"],gi=/^(?:[^\s@]+@[^\s@]+\.[^\s@]+|https?:\/\/\S+|www\.\S+|[a-z0-9-]+\.[a-z]{2,}(?:\/|$))/i;function ki(e,o,a){if(!e||a==="password")return e;const h=(o.split(".").pop()??"").toLowerCase();return vi.has(h)||bi.some(l=>h.endsWith(l))||gi.test(e.trim())?e:e.charAt(0).toUpperCase()+e.slice(1)}const $i=new Set(["company_and_services.certifications_selected","marketing_services.selected","appointment_setup.bookable_days"]),Ci=new Set(["industries_locations.industries_selected"]),wi=new Set(["industries_locations.locations_target"]);function Si(e){return $i.has(e)?"chips":Ci.has(e)?"groups":wi.has(e)?"tags":"plain"}const Oi=new Set(["business_info.hours_summary","marketing_services.keys","industries_locations.industries_by_group"]);function Ai(e){return Oi.has(e)}const Ei=3,Ti=/^no$/i;function Ii(e){const o=new Map;for(const h of e){const l=h.path.split(".");if(l.length<Ei)continue;const u=l.slice(0,-1).join("."),r=o.get(u);r?r.push(h):o.set(u,[h])}const a=new Set;for(const h of o.values()){const l=h.some(r=>Ti.test(r.value.trim())),u=h.every(r=>r.empty);if(!(!l&&!u))for(const r of h)r.empty&&a.add(r.path)}return a}
1const Ni={industries_locations:"Industries and Locations",platform_access:"Ads Platform Access"};function xi(e,o){return Ni[e]??o.replace(/^[*\s]+/,"").trim()}const Li={"platform_access.ad_campaign_budget":"Monthly Budget"},Mi=[[/monthly budget will be for the campaigns/i,"Monthly Budget"]];function Pi(e,o){const a=Li[e];if(a)return a;const h=o.replace(/^[*\s]+/,"").trim();for(const[l,u]of Mi)if(l.test(h))return u;return h}const Ri=new Set(["personal_info"]);function Di(e){return Ri.has(e)?"fun":"default"}const Fi={"personal_info.full_name":"🙂","personal_info.nickname":"👋","personal_info.birthday__date":"🎂","personal_info.anniversary__date":"🎉"},Hi={aries:"♈",taurus:"♉",gemini:"♊",cancer:"♋",leo:"♌",virgo:"♍",libra:"♎",scorpio:"♏",sagittarius:"♐",capricorn:"♑",aquarius:"♒",pisces:"♓"};function Bi(e,o){return e.endsWith(".zodiac")?Hi[o.trim().toLowerCase()]??"✨":Fi[e]??""}const zi={class:"chof__q"},Ui={class:"chof__label"},Vi={key:0,class:"chof__tag"},Gi={key:2,class:"chof__dot",title:"Unsaved change"},Yi={key:0,class:"chof__pwd"},ji=["value","type","placeholder"],Wi=["title"],qi={key:0,class:"chof__redacted"},Ki={key:1,class:"chof__pwd chof__pwd--read"},Ji={class:"chof__a chof__a--mono"},Xi=["title"],Zi={key:2,class:"chof__groups"},Qi={class:"chof__group-name"},el={class:"chof__chips"},tl={key:3,class:"chof__chips"},nl={key:4,class:"chof__tags"},sl={class:"chof__chips"},ol={key:5,class:"chof__a"},al={key:0,class:"chof__emoji","aria-hidden":"true"},il={key:6,class:"chof__a chof__a--na"},ll={key:7,class:"chof__a chof__a--na"},cl={key:8,class:"chof__a chof__a--empty"},je=24,rl=K({__name:"ClientHubOnboardingField",props:{field:{},editing:{type:Boolean,default:!1},draftValue:{default:void 0},startRow:{type:Boolean,default:!1},control:{default:void 0},flavor:{default:"default"}},emits:["change"],setup(e,{emit:o}){const a=e,h=o,l=j(!1),u=m(()=>a.field.input==="password"),r=m(()=>a.control??a.field.control),y=m(()=>!a.field.editable&&r.value.type==="derived"),_=m(()=>a.field.redactedReason==="role"?"Hidden — only internal admins can view this password":"Hidden — no permission to view credentials"),$=m(()=>a.draftValue!==void 0),g=m(()=>a.draftValue??a.field.value),C=m(()=>!a.editing&&a.field.missing&&a.flavor!=="fun"),k=m(()=>a.flavor==="fun"&&!a.editing?Bi(a.field.path,g.value):""),f=m(()=>a.field.hidden?"Only if it applies":"Not answered"),M=F=>ki(F,a.field.path,a.field.input),R=m(()=>M(g.value)),N=j(!1),D=m(()=>a.editing?[]:Pe(g.value,r.value.options)),B=m(()=>a.field.display==="chips"?D.value.map(F=>M(F)):[]),q=m(()=>{if(a.field.display!=="groups")return[];const F=r.value.options,E=new Map(F.map(P=>[P.value,P.group||"Other"])),c=[...new Set(F.map(P=>P.group||"Other"))],w=new Map;for(const P of D.value){const z=E.get(P)||"Other",v=w.get(z);v?v.push(M(P)):w.set(z,[M(P)])}const I=P=>{const z=c.indexOf(P);return z===-1?c.length:z};return[...w.entries()].map(([P,z])=>({name:P,items:z})).sort((P,z)=>I(P.name)-I(z.name))}),X=m(()=>a.field.display==="tags"&&!a.editing?g.value.split(",").map(F=>F.trim()).filter(Boolean):[]),S=m(()=>N.value?X.value:X.value.slice(0,je)),p=m(()=>a.editing&&["multi","textarea"].includes(r.value.type)||!a.editing&&["groups","tags"].includes(a.field.display)?!0:g.value.length>60),A=F=>{h("change",a.field.path,F)};return ce(()=>a.editing,()=>{l.value=!1,N.value=!1}),(F,E)=>{const c=ne,w=pi;return n(),i("div",{class:W(["chof",{"chof--wide":s(p),"chof--missing":s(C),"chof--dirty":s($),"chof--row-start":e.startRow,"chof--fun":e.flavor==="fun"}])},[t("div",zi,[t("span",Ui,d(e.field.label),1),e.field.hidden?(n(),i("span",Vi,"If it applies")):O("",!0),!e.field.editable&&!s(y)?(n(),Y(c,{key:1,name:"heroicons:lock-closed",size:"11",class:"chof__lock"})):O("",!0),s($)?(n(),i("span",Gi)):O("",!0)]),e.editing&&e.field.editable?(n(),i(T,{key:0},[s(u)?(n(),i("div",Yi,[t("input",{value:s(g),type:s(l)?"text":"password",class:"chof__input",placeholder:e.field.redacted?"Hidden — type to replace":s(f),autocomplete:"off",onInput:E[0]||(E[0]=I=>A(I.target.value))},null,40,ji),t("button",{type:"button",class:"chof__eye",title:s(l)?"Hide":"Show",onClick:E[1]||(E[1]=I=>l.value=!s(l))},[b(c,{name:s(l)?"heroicons:eye-slash":"heroicons:eye",size:"14"},null,8,["name"])],8,Wi)])):(n(),Y(w,{key:1,control:s(r),value:s(g),placeholder:s(f),onUpdate:A},null,8,["control","value","placeholder"]))],64)):(n(),i(T,{key:1},[e.field.redacted?(n(),i("span",qi,[b(c,{name:"heroicons:lock-closed",size:"12"}),H(" "+d(s(_)),1)])):s(u)&&s(g)?(n(),i("div",Ki,[t("span",Ji,d(s(l)?s(g):"••••••••"),1),t("button",{type:"button",class:"chof__eye",title:s(l)?"Hide":"Show",onClick:E[2]||(E[2]=I=>l.value=!s(l))},[b(c,{name:s(l)?"heroicons:eye-slash":"heroicons:eye",size:"14"},null,8,["name"])],8,Xi)])):s(q).length?(n(),i("div",Zi,[(n(!0),i(T,null,L(s(q),I=>(n(),i("div",{key:I.name,class:"chof__group"},[t("span",Qi,d(I.name),1),t("div",el,[(n(!0),i(T,null,L(I.items,(P,z)=>(n(),i("span",{key:`${P}-${z}`,class:"chof__chip"},d(P),1))),128))])]))),128))])):s(B).length?(n(),i("div",tl,[(n(!0),i(T,null,L(s(B),(I,P)=>(n(),i("span",{key:`${I}-${P}`,class:"chof__chip"},d(I),1))),128))])):s(X).length?(n(),i("div",nl,[t("div",sl,[(n(!0),i(T,null,L(s(S),(I,P)=>(n(),i("span",{key:`${I}-${P}`,class:"chof__chip chof__chip--tag"},d(I),1))),128))]),s(X).length>
1je?(n(),i("button",{key:0,type:"button",class:"chof__more",onClick:E[3]||(E[3]=I=>N.value=!s(N))},d(s(N)?"View less":`View all ${s(X).length}`),1)):O("",!0)])):s(g)?(n(),i("span",ol,[s(k)?(n(),i("span",al,d(s(k)),1)):O("",!0),H(d(s(R)),1)])):e.field.hidden?(n(),i("span",il,"Not applicable")):e.flavor==="fun"?(n(),i("span",ll,"Not shared yet")):(n(),i("span",cl,"Not answered"))],64))],2)}}}),ul=J(rl,[["__scopeId","data-v-be647339"]]),dl=3,at="days_open",hl=/^closed$/i,it="__days_closed",_e=e=>e.split(".").pop()??"",lt=e=>{const o=e.split(".");return o.length<dl?"":o.slice(0,-1).join(".")},_l=e=>{const o=_e(e).split("_").pop()??"";return o.charAt(0).toUpperCase()+o.slice(1)};function pl(e){const o=e.findIndex(y=>_e(y.path)===at);if(o===-1)return[...e];const a=e.filter(y=>hl.test(y.value.trim()));if(!a.length)return[...e];const h=new Set(a.map(y=>y.path)),l=e[o],u={path:it,label:/open/i.test(l.label)?l.label.replace(/open/i,"Closed"):"Days Closed",input:"textarea",editable:!1,value:a.map(y=>_l(y.path)).join(", "),followUp:!1,display:"plain",control:ot,missing:!1,hidden:!1,redacted:!1,redactedReason:null},r=[];for(const y of e)h.has(y.path)||(r.push(y),y.path===l.path&&r.push(u));return r}const ml="__date",fl=/^(.*)_(month|day|year)$/;function yl(e){const o=new Map;for(const r of e){const y=fl.exec(_e(r.path));if(!y)continue;const _=r.path.slice(0,r.path.length-y[2].length-1),$=o.get(_)??{};$[y[2]]=r,o.set(_,$)}const a=[...o.entries()].filter(([,r])=>r.month&&r.day&&r.year);if(!a.length)return[...e];const h=new Map,l=new Set;for(const[r,y]of a){const{month:_,day:$,year:g}=y;l.add($.path),l.add(g.path);const k=[[_.value.trim(),$.value.trim()].filter(Boolean).join(" "),g.value.trim()].filter(Boolean).join(", ");h.set(_.path,{path:`${r}${ml}`,label:_.label.replace(/\s*month$/i,"").trim()||_.label,input:"textarea",editable:!1,value:k,followUp:!1,display:"plain",control:ot,missing:!k&&_.missing,hidden:!k&&_.hidden,redacted:!1,redactedReason:null})}const u=[];for(const r of e)l.has(r.path)||u.push(h.get(r.path)??r);return u}const ct="marketing_services.selected",vl=e=>e.startsWith("marketing_services.")&&e!==ct;function bl(e){return e.some(o=>o.path===ct)?e.filter(o=>!vl(o.path)):[...e]}const gl=new Set(["bookable_days","earliest_time","latest_time"]),kl=e=>_e(e).startsWith("hours_"),$l=e=>{const o=_e(e);return o===at||o===it},Cl=e=>{const o=new Set;for(const a of e){const h=lt(a.path);h&&a.input==="password"&&o.add(h)}return o},We=(e,o)=>{if($l(e))return"days";if(kl(e))return"hours";if(gl.has(_e(e)))return"appointment-window";const a=lt(e);return a&&o.has(a)?a:null};function wl(e){const o=Cl(e);return e.map((a,h)=>{const l=We(a.path,o),u=h>0?We(e[h-1].path,o):null;return{key:a.path,field:a,startRow:l!==u}})}const Sl=["id","data-tone","data-flavor"],Ol={class:"chos__head"},Al=["aria-expanded","aria-controls"],El={class:"chos__mark"},Tl={class:"chos__name"},Il={key:0,class:"chos__ro"},Nl={class:"chos__meta"},xl=["title"],Ll={class:"chos__count"},Ml=["disabled"],Pl=["disabled"],Rl={key:0,class:"spinner"},Dl=["id"],Fl={key:0,class:"chos__empty"},Hl=K({__name:"ClientHubOnboardingSection",props:{section:{},editing:{type:Boolean,default:!1},saving:{type:Boolean,default:!1},draft:{default:()=>({})},answers:{default:()=>({})},answerOptions:{default:()=>st}},emits:["edit","cancel","save","change"],setup(e,{emit:o}){const a=e,h=o,l=m(()=>Object.keys(a.draft).length),u=m(()=>a.section.flavor==="fun"?"heroicons:sparkles-solid":a.section.missing?"heroicons:exclamation-circle-solid":"heroicons:check-circle-solid"),r=m(()=>a.editing?a.section.fields:a.section.fields.filter(k=>!k.hidden)),y=m(()=>({answer:k=>a.draft[k]??a.answers[k]??"",answerOptions:a.answerOptions})),_=k=>a.editing?tt(k.path,k.input,k.editable,y.value):k.control,$=m(()=>{const k=a.editing?r.value:yl(bl(pl(r.value)));return wl(k).map(f=>({...f,control:_(f.field)})).filter(f=>!a.editing||Ra(f.control,y.value,y.value.answer(f.field.path)))}),g=j(!0),C=()=>{g.value=!0,h("edit")};return ce(()=>a.editing,k=>{k&&(g.value=!0)}),(k,f)=>{const M=ne,R=ul;return n(),i("article",{id:`onb-${e.section.key}`,class:"chos","data-tone":e.section.tone,"data-flavor":e.section.flavor},[t("header",Ol,[t("button",{type:"button",class:"chos__title","aria-expanded":s(g),"aria-controls":`onb-body-${e.section.key}`,onClick:f[0]||(f[0]=N=>g.value=!s(g))},[b(M,{name:s(g)?"heroicons:chevron-down":"heroicons:chevron-right",size:"14",class:"chos__chevron"},null,8,["name"]),t("span",El,[b(M,{name:s(u),size:"15"},null,8,["name"])]),t("span",Tl,d(e.section.label),1),e.section.editable?O("",!0):(n(),i("span",Il,[b(M,{name:"heroicons:lock-closed",size:"11"}),f[4]||(f[4]=H(" Read only ",-1))]))],8,Al),t("div",Nl,[t("span",{class:"chos__gauge",title:`${e.section.percent}% answered`},[t("span",{class:"chos__gauge-fill",style:Q({width:`${e.section.percent}%`})},null,4)],8,xl),t("span",Ll,d(e.section.answered)+"/"+d(e.section.total),1),e.section.editable?(n(),i(T,{key:0},[e.editing?(n(),i(T,{key:0},[t("button",{type:"button",class:"chos__btn",disabled:e.saving,onClick:f[1]||(f[1]=N=>k.$emit("cancel"))}," Cancel ",8,Ml),t("button",{type:"button",class:"chos__btn chos__btn--primary",disabled:e.saving||!s(l),onClick:f[2]||(f[2]=N=>k.$emit("save"))},[e.saving?(n(),i("span",Rl)):(n(),Y(M,{key:1,name:"heroicons:check",size:"14"})),H(" "+d(s(l)?`Save ${s(l)}`:"Save"),1)],8,Pl)],64)):(n(),i("button",{key:1,type:"button",class:"chos__btn",onClick:C},[b(M,{name:"heroicons:pencil-square",size:"14"}),f[5]||(f[5]=H(" Edit ",-1))]))],64)):O("",!0)])]),de(t("div",{id:`onb-body-${e.section.key}`,class:"chos__grid"},[(n(!0),i(T,null,L(s($),N=>
1(n(),Y(R,{key:N.key,field:N.field,editing:e.editing,"draft-value":e.draft[N.field.path],"start-row":N.startRow,control:N.control,flavor:e.section.flavor,onChange:f[3]||(f[3]=(D,B)=>k.$emit("change",D,B))},null,8,["field","editing","draft-value","start-row","control","flavor"]))),128)),s($).length?O("",!0):(n(),i("p",Fl," Nothing to show here — the client was never asked any of these questions. Use Edit to fill them in anyway. "))],8,Dl),[[Ce,s(g)]])],8,Sl)}}}),Bl=J(Hl,[["__scopeId","data-v-d09f9d16"]]),zl={class:"chonb-wrap"},Ul={class:"chonb-head"},Vl={class:"chonb-head__left"},Gl={class:"chonb-head__sub"},Yl={class:"chonb-head__right"},jl=["title"],Wl=["disabled"],ql={key:0,class:"chonb-state"},Kl={key:1,class:"chonb-state"},Jl={key:2,class:"chonb-state chonb-state--error"},Xl={key:3,class:"chonb-state"},Zl={key:0,class:"chonb-error"},Ql={key:1,class:"chonb-note"},ec={key:2,class:"chonb-state"},tc={key:3,class:"chonb-body"},nc={class:"chonb-sections"},sc={key:0,class:"chonb-meta"},oc={class:"chonb-meta__summary"},ac={class:"chonb-meta__body"},ic=K({__name:"ClientHubOnboardingForm",props:{sections:{},onboarding:{},accountId:{},loading:{type:Boolean},saving:{type:Boolean},error:{},hasOnboarding:{type:Boolean},loaded:{type:Boolean},canViewCredentials:{type:Boolean},canManageCredentials:{type:Boolean},metaSections:{},answers:{},answerOptions:{},loadingSchema:{type:Boolean},savedToken:{},kickoff:{type:Boolean}},emits:["update:kickoff","refresh","clear-error","save"],setup(e,{emit:o}){const a=e,h=o,l={},u=j(null),r=j({}),y=j(null),_=new Map,$=(S,p)=>{const A=p?.$el;A instanceof HTMLElement?_.set(S,A):_.delete(S)},g=m(()=>a.canManageCredentials?a.sections:a.sections.map(S=>({...S,fields:S.fields.map(p=>p.input==="password"&&!p.redacted?{...p,value:"",editable:!1,redacted:!0,redactedReason:"role"}:p)}))),C=m(()=>a.canViewCredentials?a.canManageCredentials?null:"Only internal admins can view or edit passwords. Every other answer stays editable for you.":"Credentials are hidden for your role. Hidden fields are never overwritten when you save."),k=m(()=>{if(!a.hasOnboarding||!a.onboarding)return"Answers submitted by the client. Editable only from here.";const S=[];return a.onboarding.submitted_at&&S.push(`Submitted ${B(a.onboarding.submitted_at)}`),a.onboarding.source_email&&S.push(a.onboarding.source_email),S.length?S.join(" · "):"Answers submitted by the client. Editable only from here."}),f=S=>{h("clear-error"),u.value=S,r.value={},y.value=S},M=()=>{u.value=null,r.value={}},R=()=>{const S=g.value.find(A=>A.key===u.value);if(!S)return;const p={};for(const A of S.fields){if(!A.editable)continue;const F=r.value[A.path];F!==void 0&&(A.redacted&&F===""||F!==A.value&&(p[A.path]=F))}if(!Object.keys(p).length){M();return}h("save",p)},N=(S,p)=>{r.value={...r.value,[S]:p}},D=S=>{y.value=S;const p=_.get(S);if(!p)return;const A=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth";p.scrollIntoView({behavior:A,block:"start"})};function B(S){const p=new Date(S);return Number.isNaN(p.getTime())?S:p.toLocaleDateString("en-US",{day:"2-digit",month:"short",year:"numeric"})}ce(()=>a.savedToken,()=>{M()}),ce(()=>a.accountId,()=>{M(),y.value=null});let q=null;const X=()=>{q?.disconnect(),!(!_.size||typeof IntersectionObserver>"u")&&(q=new IntersectionObserver(S=>{const p=S.find(F=>F.isIntersecting);if(!p)return;const A=[..._.entries()].find(([,F])=>F===p.target);A&&(y.value=A[0])},{rootMargin:"-10% 0px -70% 0px"}),_.forEach(S=>q?.observe(S)))};return ce(()=>g.value.map(S=>S.key).join("|"),async()=>{await ft(),X()},{immediate:!0}),Xe(()=>q?.disconnect()),(S,p)=>{const A=ne,F=Ca,E=Bl;return n(),i("section",zl,[t("header",Ul,[t("div",Vl,[p[5]||(p[5]=t("h3",{class:"chonb-head__title"},"Client Onboarding Form",-1)),t("p",Gl,d(s(k)),1)]),t("div",Yl,[e.accountId&&e.hasOnboarding?(n(),i("button",{key:0,type:"button",class:W(["chonb-btn",{"chonb-btn--on":e.kickoff}]),title:e.kickoff?"Back to the full Clients Hub (Esc)":"Hide the rest of the hub and show only this form",onClick:p[
10]||(p[0]=c=>S.$emit("update:kickoff",!e.kickoff))},[b(A,{name:e.kickoff?"heroicons:arrow-left-start-on-rectangle":"heroicons:presentation-chart-bar",size:"14"},null,8,["name"]),H(" "+d(e.kickoff?"Exit kick-off view":"Kick-off view"),1)],10,jl)):O("",!0),e.accountId?(n(),i("button",{key:1,type:"button",class:"chonb-btn",disabled:e.loading,onClick:p[1]||(p[1]=c=>S.$emit("refresh"))},[b(A,{name:"heroicons:arrow-path",size:"14"}),p[6]||(p[6]=H(" Refresh ",-1))],8,Wl)):O("",!0)])]),e.accountId?e.loading&&!e.hasOnboarding?(n(),i("div",Kl,[...p[8]||(p[8]=[t("span",{class:"spinner"},null,-1),H(" Loading onboarding form… ",-1)])])):e.error&&!e.hasOnboarding?(n(),i("div",Jl,[b(A,{name:"heroicons:exclamation-triangle",size:"24"}),t("span",null,d(e.error),1),t("button",{type:"button",class:"chonb-btn",onClick:p[2]||(p[2]=c=>S.$emit("refresh"))},"Retry")])):e.loaded&&!e.hasOnboarding?(n(),i("div",Xl,[b(A,{name:"heroicons:inbox",size:"28"}),p[9]||(p[9]=t("span",{class:"chonb-state__title"},"Onboarding pending",-1)),p[10]||(p[10]=t("span",{class:"chonb-state__text"}," This account has not submitted the onboarding form yet. It will show up here automatically once the form arrives. ",-1))])):e.hasOnboarding?(n(),i(T,{key:4},[e.error?(n(),i("div",Zl,[t("span",null,d(e.error),1),t("button",{type:"button",class:"chonb-error__close",onClick:p[3]||(p[3]=c=>S.$emit("clear-error"))},[b(A,{name:"heroicons:x-mark",size:"14"})])])):O("",!0),s(C)?(n(),i("div",Ql,[b(A,{name:"heroicons:eye-slash",size:"14"}),H(" "+d(s(C)),1)])):O("",!0),s(g).length?(n(),i("div",tc,[b(F,{sections:s(g),"active-key":s(y),onSelect:D},null,8,["sections","active-key"]),t("div",nc,[(n(!0),i(T,null,L(s(g),c=>(n(),Y(E,{key:c.key,ref_for:!0,ref:w=>$(c.key,w),section:c,editing:s(u)===c.key,saving:e.saving&&s(u)===c.key,draft:s(u)===c.key?s(r):l,answers:e.answers,"answer-options":e.answerOptions,onEdit:w=>f(c.key),onCancel:M,onSave:R,onChange:N},null,8,["section","editing","saving","draft","answers","answer-options","onEdit"]))),128)),e.metaSections.length?(n(),i("details",sc,[t("summary",oc,[b(A,{name:"heroicons:wrench-screwdriver",size:"13"}),p[14]||(p[14]=H(" Submission metadata ",-1)),p[15]||(p[15]=t("span",{class:"chonb-meta__hint"},"form version, timestamps, tracking",-1))]),t("div",ac,[(n(!0),i(T,null,L(e.metaSections,c=>(n(),Y(E,{key:c.key,section:c},null,8,["section"]))),128))])])):O("",!0)])])):(n(),i("div",ec,[e.loadingSchema?(n(),i(T,{key:0},[p[11]||(p[11]=t("span",{class:"spinner"},null,-1)),p[12]||(p[12]=H(" Loading the form catalog… ",-1))],64)):(n(),i(T,{key:1},[b(A,{name:"heroicons:exclamation-triangle",size:"24"}),p[13]||(p[13]=t("span",null,"The onboarding question catalog could not be loaded.",-1)),t("button",{type:"button",class:"chonb-btn",onClick:p[4]||(p[4]=c=>S.$emit("refresh"))},"Retry")],64))]))],64)):O("",!0):(n(),i("div",ql,[b(A,{name:"heroicons:clipboard-document-list",size:"28"}),p[7]||(p[7]=t("span",null,"Pick an account to see its onboarding form.",-1))]))])}}}),lc=J(ic,[["__scopeId","data-v-28622d6a"]]),cc={class:"chm-modal",role:"dialog","aria-modal":"true"},rc={class:"chm-header"},uc={class:"chm-header__info"},dc={class:"chm-header__name"},hc={class:"chm-header__status"},_c={class:"chm-body"},pc={class:"chm-form__title"},mc={class:"chm-picker"},fc=["onClick"],yc={class:"chm-opt__icon"},vc={class:"chm-opt__text"},bc={class:"chm-opt__label"},gc={class:"chm-opt__desc"},kc={class:"chm-opt__check"},$c={class:"chm-picker chm-picker--sm"},Cc=["onClick"],wc={class:"chm-opt__icon chm-opt__icon--sm"},Sc={class:"chm-opt__label chm-opt__label--sm"},Oc={class:"chm-opt__check chm-opt__check--sm"},Ac={class:"chm-opt__icon"},Ec={class:"chm-opt__text"},Tc={class:"chm-opt__label"},Ic={class:"chm-opt__desc"},Nc={class:"chm-opt__check"},xc={class:"chm-field"},Lc={class:"chm-field__label"},Mc={key:0,class:"chm-req"},Pc={key:1,class:"chm-opt-tag"},Rc=["placeholder"],Dc={class:"chm-field__hint"},Fc={key:1,class:"chm-form__error"},Hc={key:2,class:"chm-form__error"},Bc={class:"chm-actions"},zc=["disabled"],Uc=["disabled"],Vc={key:0,class:"spinner spinner--sm"},Gc={class:"chm-history"},Yc={class:"chm-history__title"},jc={key:0,class:"chm-history__loading"},Wc={key:1,class:"chm-history__empty"},qc={key:2,class:"chm-timeline"},Kc={class:"chm-tl-content"},Jc={class:"chm-tl-head"},Xc={class:"chm-tl-event"},Zc={class:"chm-tl-date"},Qc={class:"chm-tl-comment"},er={class:"chm-tl-author"},tr=K({__name:"ClientHubAccountStatusModal",props:{account:{},history:{},loadingHistory:{type:Boolean},saving:{type:Boolean},error:{}},emits:["close","submit"],setup(e,{emit:o}){const a=e,h=o,l={...ve,keep:"#64748b"},u=m(()=>a.account.performance_status!==null),r=j(u.value?"keep":""),y=j(""),_=j(null),$=[{value:"happy",label:"Happy",desc:"Performing well",icon:"heroicons:face-smile",color:l.happy},{value:"caution",label:"Caution",desc:"Needs attention",icon:"heroicons:exclamation-triangle",color:l.caution},{value:"critical",label:"Critical",desc:"Immediate action",icon:"heroicons:fire",color:l.critical}],g=[{value:"onboarding",label:"Onboarding",icon:"heroicons:rocket-launch",color:l.onboarding},{value:"lost",label:"Lost",icon:"heroicons:x-circle",color:l.lost},{value:"ghl_only",label:"GHL Only",icon:"heroicons:link",color:l.ghl_only}],C={label:"Note only",desc:"Keep current status",icon:"heroicons:chat-bubble-left-ellipsis",color:l.keep},k=m(()=>r.value==="keep"?l[a.account.performance_status??"keep"]:r.value?l[r.value]:"#cbd5e1"),f=m(()=>r.value?{background:k.value,borderColor:k.value}:{}),M=m(()=>r.value==="keep"?"Add note":u.value?"Update status":"Set status"),R=m(()=>u.value),N=m(()=>u.value?r.value==="keep"?"What happened? (e.g. had a call, all good)":"Why is the status changing?":"Why is the client in this status? (optional)"),D=m(()=>R.value?"Explain what changed — this is saved to the account history.":"Optional — add context on why the client starts in this status."),B=p=>p?he[p]:"—",q=p=>p.event_type==="note"?"Note added":p.event_type==="status_set"?`Status set to ${B(p.to_status)}`:`${B(p.from_status)} → ${B(p.to_status)}`,X=p=>{const A=new Date(p);
1return Number.isNaN(A.getTime())?p:A.toLocaleString(void 0,{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})},S=()=>{if(_.value=null,!r.value){_.value="Pick a status first.";return}const p=y.value.trim();if(R.value&&!p){_.value="A note is required.";return}const A=r.value==="keep"?null:r.value;h("submit",{status:A,comment:p})};return ce(()=>a.saving,(p,A)=>{A&&!p&&!a.error&&(y.value="",_.value=null,r.value=u.value?"keep":"")}),(p,A)=>{const F=Me,E=ne;return n(),Y(yt,{to:"body"},[t("div",{class:"chm-overlay",onClick:A[4]||(A[4]=we(c=>p.$emit("close"),["self"]))},[t("div",cc,[t("div",{class:"chm-accent",style:Q({background:s(k)})},null,4),t("div",rc,[t("div",uc,[A[6]||(A[6]=t("span",{class:"chm-header__eyebrow"},"Performance status",-1)),t("span",dc,d(("formatAccountName"in p?p.formatAccountName:s(ye))(e.account.account_name)),1),t("div",hc,[A[5]||(A[5]=t("span",{class:"chm-header__label"},"Currently",-1)),b(F,{status:e.account.performance_status},null,8,["status"])])]),t("button",{class:"chm-close","aria-label":"Close",onClick:A[0]||(A[0]=c=>p.$emit("close"))},[b(E,{name:"heroicons:x-mark",size:"18"})])]),t("div",_c,[t("form",{class:"chm-form",onSubmit:we(S,["prevent"])},[t("div",pc,d(s(u)?"Update status or leave a note":"Set the initial status"),1),t("div",mc,[(n(),i(T,null,L($,c=>t("button",{key:c.value,type:"button",class:W(["chm-opt",{"chm-opt--active":s(r)===c.value}]),style:Q({"--c":c.color}),onClick:w=>r.value=c.value},[t("span",yc,[b(E,{name:c.icon,size:"20"},null,8,["name"])]),t("span",vc,[t("span",bc,d(c.label),1),t("span",gc,d(c.desc),1)]),t("span",kc,[s(r)===c.value?(n(),Y(E,{key:0,name:"heroicons:check-circle-solid",size:"18"})):O("",!0)])],14,fc)),64))]),t("div",$c,[(n(),i(T,null,L(g,c=>t("button",{key:c.value,type:"button",class:W(["chm-opt","chm-opt--sm",{"chm-opt--active":s(r)===c.value}]),style:Q({"--c":c.color}),onClick:w=>r.value=c.value},[t("span",wc,[b(E,{name:c.icon,size:"15"},null,8,["name"])]),t("span",Sc,d(c.label),1),t("span",Oc,[s(r)===c.value?(n(),Y(E,{key:0,name:"heroicons:check-circle-solid",size:"14"})):O("",!0)])],14,Cc)),64))]),s(u)?(n(),i("button",{key:0,type:"button",class:W(["chm-opt","chm-opt--wide",{"chm-opt--active":s(r)==="keep"}]),style:Q({"--c":C.color}),onClick:A[1]||(A[1]=c=>r.value="keep")},[t("span",Ac,[b(E,{name:C.icon,size:"20"},null,8,["name"])]),t("span",Ec,[t("span",Tc,d(C.label),1),t("span",Ic,d(C.desc),1)]),t("span",Nc,[s(r)==="keep"?(n(),Y(E,{key:0,name:"heroicons:check-circle-solid",size:"18"})):O("",!0)])],6)):O("",!0),t("div",xc,[t("label",Lc,[A[7]||(A[7]=H(" Note ",-1)),s(R)?(n(),i("span",Mc,"required")):(n(),i("span",Pc,"optional"))]),de(t("textarea",{"onUpdate:modelValue":A[2]||(A[2]=c=>Je(y)?y.value=c:null),class:"chm-textarea",rows:"3",placeholder:s(N)},null,8,Rc),[[Ke,s(y)]]),t("span",Dc,d(s(D)),1)]),s(_)?(n(),i("div",Fc,[b(E,{name:"heroicons:exclamation-circle",size:"15"}),H(" "+d(s(_)),1)])):e.error?(n(),i("div",Hc,[b(E,{name:"heroicons:exclamation-circle",size:"15"}),H(" "+d(e.error),1)])):O("",!0),t("div",Bc,[t("button",{type:"button",class:"chm-btn chm-btn--ghost",disabled:e.saving,onClick:A[3]||(A[3]=c=>p.$emit("close"))}," Cancel ",8,zc),t("button",{type:"submit",class:"chm-btn chm-btn--primary",style:Q(s(f)),disabled:e.saving},[e.saving?(n(),i("span",Vc)):O("",!0),H(" "+d(e.saving?"Saving…":s(M)),1)],12,Uc)])],32),t("div",Gc,[t("div",Yc,[b(E,{name:"heroicons:clock",size:"15"}),A[8]||(A[8]=H(" Status history ",-1))]),e.loadingHistory?(n(),i("div",jc,[...A[9]||(A[9]=[t("span",{class:"spinner spinner--sm"},null,-1),H(" Loading history… ",-1)])])):e.history.length?(n(),i("ul",qc,[(n(!0),i(T,null,L(e.history,c=>(n(),i("li",{key:c.id,class:"chm-tl-item"},[t("span",{class:W(["chm-tl-dot",`chm-tl-dot--${c.to_status??"none"}`])},null,2),t("div",Kc,[t("div",Jc,[t("span",Xc,d(q(c)),1),t("span",Zc,d(X(c.created)),1)]),t("p",Qc,d(c.comment),1),t("span",er,[b(E,{name:"heroicons:user-circle",size:"13"}),H(" "+d(c.changed_by_username||c.changed_by_email),1)])])]))),128))])):(n(),i("div",Wc,[b(E,{name:"heroicons:inbox",size:"22"}),A[10]||(A[10]=t("span",null,"No history yet — your first note will show up here.",-1))]))])])])])])}}}),nr=J(tr,[["__scopeId","data-v-5ee998f1"]]),sr=["meta","tracking"],rt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function or(e,o){if(!e)return;let a=e;for(const h of o.split(".")){if(!rt(a))return;a=a[h]}return a}function qe(e,o){const a=or(e,o);
1return a==null?"":typeof a=="string"?a:typeof a=="number"||typeof a=="boolean"?String(a):""}function ar(e){const o={};for(const[a,h]of Object.entries(e)){const l=a.split(".");let u=o;l.forEach((r,y)=>{if(y===l.length-1){u[r]=h;return}rt(u[r])||(u[r]={}),u=u[r]})}return o}const Ne="/api/client-hub-features",ir="ONBOARDING_REVISION_CONFLICT",lr=e=>{const o=e;return o?.message===ir?!0:(o?.response?.status??o?.statusCode??o?.status)===409},cr=()=>{const e=async()=>{const{getToken:l}=vt(),u=await l();return{Authorization:u?`Bearer ${u}`:"","Content-Type":"application/json"}};return{getSchema:async()=>{const l=await e();return await $fetch(`${Ne}/onboarding/schema`,{method:"GET",headers:l})},getAccountOnboarding:async l=>{const u=await e();return await $fetch(`${Ne}/accounts/${l}/onboarding`,{method:"GET",headers:u})??null},patchAccountOnboarding:async(l,u,r)=>{const y=await e();return await $fetch(`${Ne}/accounts/${l}/onboarding`,{method:"PATCH",headers:y,body:{revision:u,answers:r}})}}},rr=(e,o)=>!o||e===o?"complete":e>=o/2?"partial":"empty",$e=(e,o)=>{const a=e,h=a?.response?.status??a?.statusCode??a?.status;if(h===403)return"You do not have access to this account’s onboarding.";if(h===404)return"This account has no onboarding form yet.";if(h===409)return"Someone else edited this form. Reload and try again.";if(h===422)return"The backend rejected the format of these answers.";if(h===503)return"Onboarding credentials are unavailable — backend encryption key is not configured.";const l=a?.data?.detail;return typeof l=="string"&&l?l:a?.message||o},ur=bt("clientOnboarding",()=>{const{getSchema:e,getAccountOnboarding:o,patchAccountOnboarding:a}=cr(),h=j(null),l=j(!1),u=j(null),r=j(null),y=j(!1),_=j(!1),$=j(null),g=j(!1),C=m(()=>u.value!==null),k=m(()=>u.value?.can_view_credentials??!1),f=m(()=>new Set(u.value?.redacted_fields??[])),M=m(()=>h.value?Ba(h.value.answer_options):st),R=m(()=>{const c={};if(!h.value||!u.value)return c;for(const w of h.value.sections)for(const I of w.fields)c[I.path]=qe(u.value.data,I.path);return c}),N=m(()=>({answer:c=>R.value[c]??"",answerOptions:M.value})),D=c=>{const w=u.value?.data??null,I=c.fields.filter(G=>!Ai(G.path)).map(G=>{const ie=f.value.has(G.path),oe=ie?"":qe(w,G.path);return{field:G,path:G.path,redacted:ie,value:oe,empty:!ie&&oe.trim()===""}}),P=Ii(I),z=I.map(({field:G,redacted:ie,value:oe,empty:pe})=>{const ae=yi(G.path,G.label),be=pe&&(ae||P.has(G.path));return{path:G.path,label:Pi(G.path,G.label),input:G.input,editable:c.editable&&G.editable,value:oe,followUp:ae,display:Si(G.path),control:tt(G.path,G.input,c.editable&&G.editable,N.value),missing:pe&&!be,hidden:be,redacted:ie,redactedReason:ie?"permission":null}}),v=z.filter(G=>!G.hidden),x=v.filter(G=>G.missing).length,V=v.length-x;return{key:c.key,label:xi(c.key,c.label),editable:c.editable,flavor:Di(c.key),fields:z,total:v.length,answered:V,missing:x,percent:v.length?Math.round(V/v.length*100):100,tone:rr(V,v.length)}},B=c=>sr.includes(c),q=m(()=>!h.value||!u.value?[]:h.value.sections.filter(c=>!B(c.key)).map(D)),X=m(()=>!h.value||!u.value?[]:h.value.sections.filter(c=>B(c.key)).map(D)),S=async()=>{if(!(h.value||l.value)){l.value=!0;try{h.value=await e()}catch(c){$.value=$e(c,"Failed to load the onboarding form catalog")}finally{l.value=!1}}};return{schema:h,loadingSchema:l,onboarding:u,loadedAccountId:r,loading:y,saving:_,error:$,loaded:g,hasOnboarding:C,canViewCredentials:k,answerOptions:M,answers:R,sections:q,metaSections:X,fetchSchema:S,fetchOnboarding:async c=>{y.value=!0,$.value=null;try{const w=await o(c);u.value=w,r.value=c,g.value=!0,w&&await S()}catch(w){u.value=null,r.value=c,g.value=!0,$.value=$e(w,"Failed to load the onboarding form")}finally{y.value=!1}},saveDraft:async(c,w)=>{if(!u.value||!Object.keys(w).length)return!0;_.value=!0,$.value=null;const I=ar(w);try{return u.value=await a(c,u.value.revision,I),!0}catch(P){if(!lr(P))return $.value=$e(P,"Failed to save the onboarding answers"),!1;try{const z=await o(c);return z?(u.value=await a(c,z.revision,I),!0):($.value="This account no longer has an onboarding form.",u.value=null,!1)}catch(z){return $.value=$e(z,"Failed to save the onboarding answers"),!1}}finally{_.value=!1}},clear:()=>{u.value=null,r.value=null,g.value=!1,$.value=null},clearError:()=>{$.value=null}}}),dr={class:"ch-page-wrapper"},hr={key:0,class:"page-header"},_r={key:2,class:"page-error"},pr={key:3},mr={key:4},fr=K({__name:"clients-hub",setup(e){const o=kt(),a=ur(),{isInternalAdmin:h}=$t(),l=[{key:"report",label:"Performance Report",icon:"heroicons:chart-pie"},{key:"accounts",label:"Manage Accounts",icon:"heroicons:cog-6-tooth"},{key:"info",label:"Account Info",icon:"heroicons:identification"}],u=j("report"),{selectedAccountId:r,selectAccount:y}=Ct(),_=j(null),$=S=>{o.clearError(),_.value=S,o.fetchHistory(S.account_id)},g=async S=>{o.clearError(),u.value="info",await y(S.account_id)},C=()=>{r.value&&o.fetchAccountDetail(Number(r.value))},k=()=>{const S=o.accountDetail;if(!S)return;const p=o.accounts.find(A=>A.account_id===S.account_id);$(p??{account_id:S.account_id,account_name:S.account_name??"",performance_status:S.client_status,sales_coach_id:S.staff.sales_coach?.id??null,sales_coach:null})},f=()=>{_.value=null,o.clearError()},M=async S=>{if(_.value)try{await o.submitStatus(_.value.account_id,S)}catch{}},R=j(!1),N=S=>{R.value=S,S&&(u.value="info",window.scrollTo({top:0,behavior:"smooth"}))},D=S=>{S.key==="Escape"&&R.value&&N(!1)};Re(()=>window.addEventListener("keydown",D)),Xe(()=>window.removeEventListener("keydown",D)),ce(r,()=>{R.value=!1});const B=j(0),q=()=>{r.value&&a.fetchOnboarding(Number(r.value))},X=async S=>{if(!r.value)return;await a.saveDraft(Number(r.value),S)&&(B.value+=1)};return ce([r,u],([S,p])=>{if(p==="info"){if(!S){o.clearAccountDetail(),a.clear();return}(o.accountDetail?.account_id!==Number(S)||o.detailError)&&o.fetchAccountDetail(Number(S)),a.loadedAccountId!==Number(S)&&a.fetchOnboarding(Number(S))}},{immediate:!0}),Re(()=>{o.fetchSummary(),o.fetchAccounts()}),(S,p)=>{const A=_t,F=ne,E=yn,c=Un,w=ma,I=lc,P=nr;return n(),i("div",dr,[t("div",{class:W(["ch-container",{"ch-container--kickoff":s(R)}])},[s(R)?O("",!0):(n(),i("div",hr,[...p[7]||(p[7]=[t("div",{class:"page-header__left"},[t("p",{class:"page-title"},"Clients Hub"),t("p",{class:"page-subtitle"},"Performance status of active client accounts.")],-1)])])),s(R)?O("",!0):(n(),Y(A,{key:1,tabs:l,"active-tab":s(u),onTabChange:p[0]||(p[0]=z=>u.value=z)},null,8,["active-tab"])),s(o).error?(n(),i("div",_r,[t("span",null,d(s(o).error),1),t("button",{class:"page-error__close",onClick:p[1]||(p[1]=z=>s(o).clearError())},[b(F,{name:"heroicons:x-mark",size:"14"})])])):O("",!0),s(R)?O("",!0):de((n(),i("div",pr,[b(E,{summary:s(o).summary,loading:s(o).loadingSummary,accounts:s(o).accounts,onSelectAccount:g},null,8,["summary","loading","accounts"])],512)),[[Ce,s(u)==="report"]]),s(R)?O("",!0):de((n(),i("div",mr,[b(c,{accounts:s(o).filteredAccounts,loading:s(o).loadingAccounts,"sales-coac
1h-options":s(o).salesCoachOptions,search:s(o).searchQuery,"sales-coach-filter":s(o).salesCoachFilter,"status-filter":s(o).statusFilter,"onUpdate:search":p[2]||(p[2]=z=>s(o).searchQuery=z),"onUpdate:salesCoachFilter":p[3]||(p[3]=z=>s(o).salesCoachFilter=z),"onUpdate:statusFilter":p[4]||(p[4]=z=>s(o).statusFilter=z),onReset:p[5]||(p[5]=z=>s(o).resetFilters()),onSelect:$,onView:g},null,8,["accounts","loading","sales-coach-options","search","sales-coach-filter","status-filter"])],512)),[[Ce,s(u)==="accounts"]]),de(t("div",null,[s(R)?O("",!0):(n(),Y(w,{key:0,detail:s(o).accountDetail,loading:s(o).loadingDetail,error:s(o).detailError,"account-id":s(r),onRefresh:C,onManageStatus:k},null,8,["detail","loading","error","account-id"])),b(I,{sections:s(a).sections,"meta-sections":s(a).metaSections,answers:s(a).answers,"answer-options":s(a).answerOptions,onboarding:s(a).onboarding,"account-id":s(r)?Number(s(r)):null,loading:s(a).loading,saving:s(a).saving,error:s(a).error,"has-onboarding":s(a).hasOnboarding,loaded:s(a).loaded,"can-view-credentials":s(a).canViewCredentials,"can-manage-credentials":s(h),"loading-schema":s(a).loadingSchema,"saved-token":s(B),kickoff:s(R),"onUpdate:kickoff":N,onRefresh:q,onClearError:p[6]||(p[6]=z=>s(a).clearError()),onSave:X},null,8,["sections","meta-sections","answers","answer-options","onboarding","account-id","loading","saving","error","has-onboarding","loaded","can-view-credentials","can-manage-credentials","loading-schema","saved-token","kickoff"])],512),[[Ce,s(R)||s(u)==="info"]])],2),s(_)?(n(),Y(P,{key:0,account:s(_),history:s(o).historyByAccount[s(_).account_id]??[],"loading-history":s(o).loadingHistory,saving:s(o).savingStatus,error:s(o).error,onClose:f,onSubmit:M},null,8,["account","history","loading-history","saving","error"])):O("",!0)])}}}),Ar=J(fr,[["__scopeId","data-v-4335a88f"]]);export{Ar 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.