1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="06b52965-9a52-47c5-ba98-67ed0289fdf0",e._sentryDebugIdIdentifier="sentry-dbid-06b52965-9a52-47c5-ba98-67ed0289fdf0")}catch(as){}import{j as e,u as t,a as n,b as r,c as a}from"./chunk-CgByYZHX.js";import{a as s,u as o}from"./chunk-BeYjNzwJ.js";import{u as i}from"./chunk-ZAVbCnbv.js";import{r as l,y as d,aC as c,j as u,as as m,d3 as p,d4 as x,d1 as h,a1 as g,d0 as f,l as b,at as v,g as y,a0 as j,du as N,dv as k,d9 as w,dw as S,dx as _,c0 as C,dy as I,aO as T,af as E,T as P,dz as R,U as A,W as M,X as D,aJ as O,bK as F,dA as B,ck as L,cX as z,ab as $,ac as W,V as U,cq as Y,cr as H,aK as K,dB as V,au as G,aR as q,dk as J,J as Q,K as X,L as Z,M as ee,N as te,O as ne,Q as re,R as ae,i as se,d as oe,dr as ie,cP as le}from"./index-DL-fWBsy.js";import{i as de}from"./chunk-DhMTiyCr.js";import{i as ce,U as ue,X as me,c as pe,y as xe,b4 as he,C as ge,A as fe,L as be,b5 as ve,b6 as ye,b7 as je,b8 as Ne,b9 as ke,ba as we,bb as Se,aZ as _e,bc as Ce,bd as Ie,w as Te,be as Ee,v as Pe,z as Re,bf as Ae,bg as Me,bh as De,bi as Oe,bj as Fe,ak as Be,bk as Le,o as ze,bl as $e,bm as We,E as Ue,bn as Ye,p as He,h as Ke,b as Ve,a0 as Ge,bo as qe,aW as Je,q as Qe,P as Xe,I as Ze}from"./chunk-CEwvejrK.js";import{C as et}from"./chunk-1wCFIGBB.js";import{s as tt}from"./chunk-1K3vx6-M.js";import{a as nt,m as rt,i as at,w as st,u as ot,s as it,b as lt,c as dt}from"./chunk-DAedeIak.js";import{a as ct,b as ut,g as mt,u as pt,c as xt,d as ht}from"./chunk-CxRR0qp1.js";import{R as gt}from"./chunk-DcEGcngO.js";import{M as ft,a as bt}from"./chunk-DOw2x4pE.js";import{E as vt}from"./chunk-B885l9Ih.js";import{n as yt,i as jt,I as Nt}from"./chunk-Cd7tSVZt.js";import{m as kt}from"./chunk-E0jD8gbK.js";import{c as wt}from"./chunk-CRe-PdzA.js";import{S as St,P as _t,r as Ct}from"./chunk-BFMRHDu0.js";import{L as It,a as Tt}from"./chunk-CBJXVSzh.js";import{P as Et,a as Pt,b as Rt}from"./chunk-DgKLKxfG.js";import{D as At,e as Mt,a as Dt,c as Ot,d as Ft,b as Bt}from"./chunk-B0qriUTO.js";import{u as Lt}from"./chunk-jCsMJQPN.js";import{u as zt}from"./chunk-CepYTq64.js";import{o as $t,s as Wt,a as Ut,u as Yt,l as Ht,e as Kt}from"./chunk-CVCxDu2f.js";import{t as Vt}from"./chunk-Dm0ZhSp5.js";import{T as Gt}from"./chunk-fGX9N-BB.js";import{P as qt}from"./chunk-DtIf2usH.js";import{s as Jt,t as Qt,B as Xt}from"./chunk-Co_VUhz2.js";import{s as Zt}from"./chunk-ad8ZEOQz.js";import{S as en,a as tn,b as nn,c as rn,d as an}from"./chunk-C_Kkv3fp.js";import{W as sn,T as on,f as ln,b as dn,u as cn}from"./chunk-C31bISHh.js";import{D as un}from"./chunk-BK8gsDSA.js";import{u as mn}from"./chunk-BKSZ9DW_.js";const pn="personal",xn=60,hn=[{type:"personal",label:"Personal brand",nameLabel:"Your name",placeholder:"e.g. Sarah Chen"},{type:"business",label:"Business",nameLabel:"Business name",placeholder:"e.g. Bright Path Coaching"}];function gn(e){return"personal"===e.brandType?e.brandName.trim():""}function fn(e){return nt(e.ownerName,"")||e.businessName.trim()}function bn(e){return"personal"===(e.brandType??(fn(e)===e.businessName.trim()?"personal":"business"))}function vn(e){return e.isFree?"Free":"inquiry"===e.pricingType?"Inquire":`$${e.price}`}function yn(e){return"package"===e.fulfillmentType&&e.sessionCount?`${e.sessionCount}-session package`:`${e.durationMinutes} min`}function jn({building:t=!1}){return e.jsxs("div",{style:t?{"--shimmer-duration":"1s"}:void 0,className:"relative overflow-hidden rounded-[16px] border border-border bg-card shadow-[0_12px_48px_rgba(0,0,0,0.05)]",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/40 px-3.5 py-2.5",children:[e.jsx("div",{className:"flex gap-1.5",children:[0,1,2].map(t=>e.jsx("span",{className:"h-2 w-2 rounded-full bg-border"},t))}),e.jsx(l,{animated:t,className:"mx-auto h-[18px] max-w-[220px] flex-1"}),e.jsx("div",{className:"w-6"})]}),e.jsxs("div",{className:"flex flex-col items-center px-[30px] pb-2 pt-[34px] text-center",children:[e.jsx(l,{animated:t,className:"h-[52px] w-[52px] rounded-full"}
1),e.jsx(l,{animated:t,className:"mt-4 h-[24px] w-[190px]"}),e.jsx(l,{animated:t,className:"mt-2.5 h-2 w-[90px] bg-muted/60"}),e.jsxs("div",{className:"mt-3.5 flex w-full flex-col items-center gap-1.5",children:[e.jsx(l,{animated:t,className:"h-3 w-[300px] max-w-full bg-muted/60"}),e.jsx(l,{animated:t,className:"h-3 w-[240px] max-w-full bg-muted/60"})]})]}),e.jsx("div",{className:"px-[30px] pt-5",children:e.jsxs("div",{className:"rounded-[13px] border border-border bg-card px-4 py-3.5",children:[e.jsx(l,{animated:t,className:"h-2 w-20"}),e.jsx(l,{animated:t,className:"mt-3 h-2.5 w-full bg-muted/60"}),e.jsx(l,{animated:t,className:"mt-1.5 h-2.5 w-[92%] bg-muted/60"}),e.jsx(l,{animated:t,className:"mt-1.5 h-2.5 w-[78%] bg-muted/60"})]})}),e.jsx("div",{className:"px-[30px] pb-[30px] pt-3.5",children:e.jsxs("div",{className:"overflow-hidden rounded-[13px] border border-border",children:[e.jsx("div",{className:"px-4 pb-2 pt-3",children:e.jsx(l,{animated:t,className:"h-2 w-16"})}),[0,1,2].map(n=>e.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto] items-center gap-3 border-t border-border px-4 py-3.5",children:[e.jsxs("div",{children:[e.jsx(l,{animated:t,className:"h-3 w-3/5"}),e.jsx(l,{animated:t,className:"mt-1.5 h-2 w-2/5 bg-muted/60"})]}),e.jsx(l,{animated:t,className:"h-3.5 w-9"}),e.jsx(l,{animated:t,className:"h-7 w-[52px]"})]},n))]})}),!t&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-border bg-card/90 px-3.5 py-2 text-[12px] font-semibold text-muted-foreground shadow-[0_4px_16px_rgba(0,0,0,0.04)]",children:[e.jsx(ce,{className:"h-3.5 w-3.5","aria-hidden":!0})," Your storefront will appear here"]})})]})}const Nn="storefront-reveal-section";function kn({shape:t,path:n,fallback:r,sizeClass:a,canUpload:o,uploading:i,onPick:l,label:u,cacheKey:m}){const p=s.useRef(null),[x,h]=s.useState(!1),g="circle"===t?"rounded-full":"rounded-[14px]",f=n?c(n,void 0,void 0,m):null;s.useEffect(()=>{h(!1)},[f]);const b=i?e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted",children:e.jsx(be,{className:"h-4 w-4 animate-spin text-muted-foreground","aria-hidden":!0})}):f&&!x?e.jsx("img",{src:f,alt:"",onError:()=>h(!0),className:"h-full w-full object-cover"}):r,v=d("relative flex-none overflow-hidden",a,g);return o?e.jsxs("div",{className:d("relative flex-none",a),children:[e.jsxs("button",{type:"button","aria-label":u,disabled:i,onClick:()=>p.current?.click(),className:d("group relative block h-full w-full cursor-pointer overflow-hidden",g),children:[b,e.jsx("span",{className:"pointer-events-none absolute inset-0 hidden items-center justify-center bg-black/40 group-hover:flex",children:e.jsx(he,{className:"h-4 w-4 text-white","aria-hidden":!0})})]}),!i&&e.jsx("span",{className:"pointer-events-none absolute -right-1 -top-1 inline-flex h-[18px] w-[18px] items-center justify-center rounded-full border-2 border-card bg-foreground text-background shadow-sm",children:e.jsx(he,{className:"h-2.5 w-2.5","aria-hidden":!0})}),e.jsx("input",{ref:p,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const t=e.target.files?.[0];t&&l?.(t),e.target.value=""}})]}):e.jsx("div",{className:v,children:b})}function wn({as:t,value:n,editable:r,multiline:a,onCommit:o,className:i,clampLines:l}){const c=s.useRef(null),[u,m]=s.useState(!1);s.useEffect(()=>{c.current&&!u&&c.current.innerText!==n&&(c.current.innerText=n)},[n,u]);const p=t;return e.jsx(p,{ref:c,contentEditable:r,suppressContentEditableWarning:!0,spellCheck:!1,tabIndex:r?0:void 0,role:r?"textbox":void 0,"aria-multiline":r?Boolean(a):void 0,"aria-label":r?"Edit text":void 0,onFocus:()=>m(!0),onBlur:e=>{m(!1);const t=e.currentTarget.innerText.trim();t!==n.trim()&&o?.(t)},onKeyDown:e=>{a||"Enter"!==e.key||(e.preventDefault(),e.currentTarget.blur())},className:d("rounded outline-none transition-[box-shadow,background,text-decoration-color]",r&&"cursor-text underline decoration-foreground/25 decoration-dashed underline-offset-[3px] hover:bg-foreground
1/[0.03] hover:decoration-foreground/50 focus:bg-foreground/[0.04] focus:decoration-transparent focus:shadow-[0_0_0_2px_hsl(var(--foreground))]",3===l&&!u&&"line-clamp-3",2===l&&!u&&"line-clamp-2",i),children:n})}function Sn({gen:t,instant:n=!1,revealStaggerMs:r,editable:a=!1,onEditBusinessName:o,onEditHeadline:i,onEditRole:c,onEditAbout:u,onEditStat:m,onRemoveStat:p,onEditServiceName:x,onEditServicePrice:h,canUpload:g=!1,onPickLogo:f,onPickHeadshot:b,logoUploading:v,headshotUploading:y,imageCacheKey:j,onOpenServiceEditor:N,editableServiceIndices:k,servicesFocused:w=!1,streamingReveal:S=!1}){const _=w?"opacity-40 blur-[2px] saturate-[0.85] transition-[opacity,filter] duration-300":"transition-[opacity,filter] duration-300",C=s.useRef(null);s.useEffect(()=>{if(!w)return;const e=requestAnimationFrame(()=>{C.current?.scrollIntoView({behavior:"smooth",block:"center"})});return()=>cancelAnimationFrame(e)},[w]);const I=t.stats.length>=1,{sessions:T,packages:E}=function(e){const t=[],n=[];return e.forEach((e,r)=>{"package"===e.fulfillmentType?n.push({service:e,index:r}):t.push({service:e,index:r})}),{sessions:t,packages:n}}(t.services),P=t.services.filter(e=>"session"===e.fulfillmentType).find(e=>"fixed"===e.pricingType&&!e.isFree&&e.price>0)??null,R=S,A=!R||t.about.trim().length>0||t.stats.length>0,M=!R||T.length>0||E.length>0,D=R?"storefront-reveal-section":"contents",O=s.useRef(null);!function(e,t={}){const{enabled:n=!0,staggerMs:r=90}=t,a=s.useRef(!1);s.useLayoutEffect(()=>{if(!n||a.current)return;const t=e.current;if(!t)return;const s=t.querySelectorAll("[data-sf-section]");0!==s.length&&(a.current=!0,s.forEach((e,t)=>{e.style.animationDelay=t*r+"ms",e.classList.add(Nn),e.addEventListener("animationend",()=>{e.classList.remove(Nn),e.style.animationDelay=""},{once:!0})}))},[e,n,r])}(O,{enabled:!n,staggerMs:r});const F="personal"===(t.brandType??(fn(t)===t.businessName.trim()?"personal":"business")),B=fn(t),L=B.trim().split(/\s+/)[0]??"",z=B!==t.businessName.trim(),$=({service:t,index:n},r)=>{const s="package"===t.fulfillmentType,o=s?function(e,t){const n=e.sessionCount??0;return n<=0?yn(e):t?`${n} Ã ${t}`:`${n} ${1===n?"session":"sessions"}`}(t,P?.name??null):yn(t),i=s?(t.includes??[]).filter(e=>"string"==typeof e&&e.trim().length>0):[],l=s?function(e,t){const n=e.sessionCount??0;if(n<=0||e.isFree)return null;if(!t||"fixed"!==t.pricingType||t.isFree||t.price<=0)return null;const{amountCents:r}=wt(100*t.price,n,100*e.price);return r>0?Math.round(r/100):null}(t,P):null,c=i.length>0;return e.jsxs("div",{className:d("grid grid-cols-[1fr_auto_auto] gap-3 px-4 py-3.5",c?"items-start":"items-center",!r&&"border-t border-border"),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(wn,{as:"span",value:t.name,editable:a,onCommit:e=>x?.(n,e),className:"font-aeonik text-[14px] font-bold tracking-[-0.015em] text-foreground"}),t.pill&&e.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 text-[9.5px] font-semibold text-emerald-600",children:t.pill})]}),e.jsx("div",{className:"mt-[3px] text-[11px] text-muted-foreground",children:o}),c&&e.jsx("ul",{className:"mt-2 grid list-none gap-1.5 p-0",children:i.map((t,n)=>e.jsxs("li",{className:"grid grid-cols-[13px_1fr] items-start gap-2 text-[11px] leading-[1.4] text-muted-foreground",children:[e.jsx(ge,{className:"mt-[1px] h-2.5 w-2.5 text-foreground",strokeWidth:2.2,"aria-hidden":!0}),e.jsx("span",{children:t})]},n))})]}),e.jsxs("div",{className:"text-right",children:[e.jsx(wn,{as:"span",value:vn(t),editable:a,onCommit:e=>h?.(n,e),className:"font-aeonik text-[15px] font-bold text-foreground"}),null!=l&&e.jsxs("div",{className:"mt-0.5 text-[10px] font-semibold text-emerald-600",children:["Save $",l]})]}),e.jsxs("div",{className:"flex flex-col items-end gap-1.5",children:[!a&&e.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap rounded-lg bg-foreground px-2.5 py-1.5 text-[11.5px] font-semibold text-background",children:["View ",e.jsx(fe,{className:"h-2.5 w-2.5","aria-hidden":!0})]}),a&&N&&k?.has(n)&&e.jsxs("button",{type:"button",onClick:()=>N(n),className:d("inline-flex items-center gap-1 whitespace-nowrap rounded-lg px-2.5 py-1 text-[11px] font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",w?"border border-foreground bg-foreground text-background hover:bg-foreground
1/90":"border border-border bg-card text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[e.jsx(pe,{className:"h-2.5 w-2.5","aria-hidden":!0})," Edit"]})]})]},n)};return e.jsxs("div",{ref:O,className:"overflow-hidden rounded-[16px] border border-border bg-card shadow-[0_12px_48px_rgba(0,0,0,0.10)]",children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border bg-muted/40 px-3.5 py-2.5",children:[e.jsx("div",{className:"flex gap-1.5",children:[0,1,2].map(t=>e.jsx("span",{className:"h-2 w-2 rounded-full bg-border"},t))}),e.jsxs("div",{className:"mx-auto inline-flex max-w-[280px] flex-1 items-center justify-center gap-1.5 rounded-md border border-border bg-card px-3 py-1 font-mono text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),"glintly.co/",t.handle]}),e.jsx("div",{className:"w-6"})]}),e.jsxs("div",{className:d("flex flex-col items-center px-[30px] pb-2 pt-[34px] text-center",_),children:[e.jsxs("div",{"data-sf-section":"hero",className:d("flex w-full flex-col items-center",R&&"storefront-reveal-section"),children:[e.jsx(kn,{shape:"circle",path:F?t.headshotPath:t.logoPath,cacheKey:j,sizeClass:"h-[50px] w-[50px]",canUpload:g,uploading:F?y:v,onPick:F?b:f,label:F?"Upload your photo":"Upload your logo",fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:e.jsx(ue,{className:"h-6 w-6","aria-hidden":!0})})}),e.jsx("h1",{className:"mt-4 font-aeonik text-[28px] font-bold leading-[1.04] tracking-[-0.035em] text-foreground",children:e.jsx(wn,{as:"span",value:t.businessName,editable:a,onCommit:o})}),F&&t.role&&e.jsx("div",{className:"mt-1.5 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:e.jsx(wn,{as:"span",value:t.role,editable:a,onCommit:c})}),e.jsx(wn,{as:"p",value:t.headline,editable:a,multiline:!0,onCommit:i,className:"mt-3 max-w-[380px] text-[15px] leading-[1.5] text-foreground/70"})]}),e.jsx("div",{"data-sf-section":"about",className:"mt-5 w-full text-left",children:A?e.jsx("div",{className:D,children:e.jsxs("div",{className:"rounded-[13px] border border-border bg-card px-4 py-3.5 shadow-[0_1px_3px_rgba(0,0,0,0.04)]",children:[e.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:F?L?`About ${L}`:"About":z?`Meet ${L}`:"Your professional"}),!F&&e.jsxs("div",{className:"mt-2.5 flex items-center gap-3",children:[e.jsx(kn,{shape:"circle",path:t.headshotPath,cacheKey:j,sizeClass:"h-11 w-11",canUpload:g,uploading:y,onPick:b,label:"Upload your photo",fallback:e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted text-muted-foreground",children:e.jsx(ue,{className:"h-5 w-5","aria-hidden":!0})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13.5px] font-bold leading-tight tracking-[-0.01em] text-foreground",children:B}),t.role&&e.jsx("div",{className:"mt-0.5 text-[9.5px] font-semibold uppercase tracking-[0.07em] text-muted-foreground",children:e.jsx(wn,{as:"span",value:t.role,editable:a,onCommit:c})})]})]}),a?e.jsx(wn,{as:"p",value:t.about,editable:!0,multiline:!0,clampLines:3,onCommit:u,className:"mt-2.5 text-[13px] leading-[1.6] text-foreground/60"}):e.jsx("div",{className:"mt-2.5",children:e.jsx(et,{lines:3,textClassName:"whitespace-pre-line text-[13px] leading-[1.6] text-foreground/60",fadeClassName:"from-card via-card",children:t.about})}),I&&e.jsx("div",{className:"mt-3.5 flex gap-[26px]",children:t.stats.slice(0,3).map((t,n)=>e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"font-aeonik text-[16px] font-bold tracking-[-0.02em] text-foreground",children:e.jsx(wn,{as:"span",value:t.value,editable:a,onCommit:e=>m?.(n,"value",e)})}),e.jsx("div",{className:"mt-0.5 text-[9px] font-semibold uppercase tracking-[0.07em] text-muted-foreground",children:e.jsx(wn,{as:"span",value:t.label,editable:a,onCommit:e=>m?.(n,"label",e)})}),a&&p&&e.jsx("button",{type:"button","aria-label":`Remove ${[t.value,t.label].filter(
1Boolean).join(" ")||"stat"}`,onClick:()=>p(n),className:"absolute -right-3 -top-2 inline-flex h-[18px] w-[18px] items-center justify-center rounded-full border border-border bg-card text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(me,{className:"h-2.5 w-2.5","aria-hidden":!0})})]},n))})]})}):e.jsxs("div",{className:"w-full",children:[e.jsx(l,{className:"h-[11px] w-full bg-muted/60"}),e.jsx(l,{className:"mt-1.5 h-[11px] w-[85%] bg-muted/60"}),e.jsx(l,{className:"mt-1.5 h-[11px] w-[70%] bg-muted/60"})]})})]}),e.jsxs("div",{ref:C,"data-sf-section":"services",className:"px-[30px] pt-3.5",children:[w&&e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11.5px] font-semibold text-foreground",children:[e.jsx(pe,{className:"h-3 w-3","aria-hidden":!0})," Tap a service to make it yours"]}),M?e.jsxs("div",{className:D,children:[T.length>0&&e.jsxs("div",{className:d("overflow-hidden rounded-[13px] border bg-card transition-shadow duration-300",w?"border-foreground
1/20 shadow-[0_10px_34px_rgba(0,0,0,0.13)] ring-1 ring-foreground/10":"border-border shadow-[0_1px_3px_rgba(0,0,0,0.04)]"),children:[e.jsx("div",{className:"px-4 pb-2 pt-3 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:"Services"}),T.map((e,t)=>$(e,0===t))]}),E.length>0&&e.jsxs("div",{className:d("overflow-hidden rounded-[13px] border bg-card transition-shadow duration-300",w?"border-foreground/20 shadow-[0_10px_34px_rgba(0,0,0,0.13)] ring-1 ring-foreground/10":"border-border shadow-[0_1px_3px_rgba(0,0,0,0.04)]",T.length>0&&"mt-3"),children:[e.jsx("div",{className:"px-4 pb-2 pt-3 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:"Packages"}),E.map((e,t)=>$(e,0===t))]}),e.jsxs("div",{className:"mt-3 flex items-center justify-center gap-1.5 text-[11px] text-muted-foreground",children:[e.jsx(xe,{className:"h-3 w-3","aria-hidden":!0})," Payments secured by Stripe"]})]}):e.jsxs("div",{className:"overflow-hidden rounded-[13px] border border-border",children:[e.jsx("div",{className:"px-4 pb-2 pt-3",children:e.jsx(l,{className:"h-2 w-16"})}),[0,1,2].map(t=>e.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto] items-center gap-3 border-t border-border px-4 py-3.5",children:[e.jsxs("div",{children:[e.jsx(l,{className:"h-3 w-3/5"}),e.jsx(l,{className:"mt-1.5 h-2 w-2/5 bg-muted/60"})]}),e.jsx(l,{className:"h-3.5 w-9"}),e.jsx(l,{className:"h-7 w-[52px]"})]},t))]})]}),e.jsxs("div",{className:d("py-5 text-center text-[11px] text-muted-foreground/70",_),children:["Powered by ",e.jsx("span",{className:"font-aeonik font-bold tracking-[-0.02em]",children:"glintly"})]})]})}const _n=(e,t)=>t.trim()?{...e,businessName:t}:e,Cn=(e,t)=>({...e,ownerName:t}),In=(e,t)=>t.trim()?{...e,role:t}:e,Tn=(e,t)=>({...e,headline:t}),En=(e,t)=>({...e,about:t}),Pn="2024-01-01T00:00:00.000Z",Rn="ai-preview-storefront",An="ai-preview-org",Mn=["about"];function Dn(e,t){const n={};e.includes.length>0&&(n.includes=e.includes),e.idealFor.length>0&&(n.ideal_for=e.idealFor);const r=function(e){if("inquiry"!==e.pricingType)return e.isFree||!Number.isFinite(e.price)||e.price<=0?0:Math.round(100*e.price)}(e);return{id:`ai-preview-svc-${t}`,storefront_id:Rn,org_id:An,business_id:null,name:e.name,description:e.description||null,...void 0!==r?{unit_amount:r}:{},currency:"USD",duration_minutes:"package"===e.fulfillmentType?null:e.durationMinutes,meeting_format:e.meetingFormat??null,meeting_location:null,service_type:"session",fulfillment_type:e.fulfillmentType,pricing_type:e.pricingType,is_active:!0,sort_order:t,position:t,availability:null,booking_buffer_minutes:null,booking_url:null,buffer_after_minutes:null,buffer_before_minutes:null,cancellation_policy_hours:null,category:null,external_id:null,image_url:null,max_horizon_days:null,max_participants:null,min_lead_time_minutes:null,requires_confirmation:null,settings:null,tags:null,created_at:Pn,updated_at:Pn,metadata:n}}function On(e,t={}){const{reveal:n}=t,r=e=>!n||n.has(e),a=nt(t.ownerName,e.ownerName),{firstName:s,lastName:o}=tt(a),i=e.businessName.trim(),l=e.brandType??((a||i)===i?"personal":"business"),d=r("about")?{id:"ai-preview-owner",first_name:s||null,last_name:o||null,avatar_path:null,bio:e.about||null,professional_title:e.role||null,profile_social_links:null}:void 0,c={};r("about")&&e.stats.length>0&&(c.stats=e.stats.map(e=>({value:e.value,label:e.label})));const u=e.services.map(Dn);return{id:Rn,org_id:An,user_id:null,business_id:null,slug:e.handle,display_name:e.businessName,business_name:e.businessName,brand_type:l,tagline:e.headline,description:e.tagline,primary_color:t.primaryColor??"#0A0A0A",brand_color:t.primaryColor??"#0A0A0A",avatar_path:null,is_published:!1,is_primary:!0,status:"draft",published_at:null,layout:"booking_page",layout_config:null,display_mode:"solo",primary_professional_id:null,theme:"default",custom_domain:null,custom_css:null,seo_settings:null,analytics_id:null,stripe_account_id:null,checkout_enabled:!1,created_at:Pn,updated_at:Pn,metadata:c,services:u,...d?{ownerProfile:d}:{},persona:null,teamMembers:[],effectiveDisplayMode:"solo",hideBranding:!1}}function Fn(e){return{businessName:e.businessName??"",ownerName:e.ownerName??"",handle:e.handle??"",role:e.role??"",headline:e.headline??"",tagline:e.tagline??"",about:e.about??"",stats:e.stats??[],services:e.services??[],testimonial:e.testimonial??null,...e.brandType?{brandType:e.brandType}:{},...e.logoPath?{logoPath:e.logoPath}:{}
1,...e.headshotPath?{headshotPath:e.headshotPath}:{}}}const Bn=["Building your storefront","Adding your identity","Writing your services and prices","Finishing your page"],Ln={payoffMs:1500};function zn(e){const t=Math.max(1,Math.round(e/1e3));return 1===t?"Built in 1 second":`Built in ${t} seconds`}function $n({handle:t,onChange:n,onCommit:r}){const[a,o]=s.useState(!1),i=s.useRef(t);return e.jsxs("label",{className:d("inline-flex cursor-text items-center overflow-hidden rounded-[9px] border transition-[border-color,box-shadow,background]",a?"border-foreground bg-card shadow-[0_0_0_3px_hsl(var(--foreground)/0.08)]":"border-border bg-muted/40"),children:[e.jsx("span",{className:"pl-2.5 font-mono text-[13px] text-muted-foreground",children:"glintly.co/"}),e.jsx("input",{value:t,spellCheck:!1,onFocus:()=>{o(!0),i.current=t},onBlur:()=>{o(!1);const e=ut(t);e!==t&&n(e),e!==i.current&&r?.(e)},onChange:e=>n(ct(e.target.value)),"aria-label":"Your storefront link",className:"min-w-[78px] max-w-[60vw] border-0 bg-transparent py-2.5 pl-1.5 pr-1.5 font-mono text-[13px] font-semibold text-foreground outline-none sm:max-w-[260px]",style:{width:`${Math.min(Math.max(8,t.length+1),26)}ch`}}),e.jsx("span",{className:d("pr-2.5",a?"text-foreground":"text-muted-foreground"),children:e.jsx(pe,{className:"h-3 w-3","aria-hidden":!0})})]})}function Wn({elapsedMs:t,handle:n,onEditHandle:r,claimButton:a,onCustomize:s}){return e.jsxs("div",{className:"mx-auto w-full max-w-[460px]",children:[e.jsx("p",{className:"font-mono text-[11.5px] font-medium uppercase tracking-[0.1em] text-accent",children:zn(t)}),e.jsx("h1",{className:"mt-2.5 font-aeonik text-[30px] font-bold leading-[1.05] tracking-[-0.03em] text-foreground",children:"Your storefront's ready."}),e.jsx("p",{className:"mt-2.5 text-[14.5px] leading-[1.55] text-muted-foreground",children:"Here it is, built from your words. Claim it, or keep shaping the details."}),e.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[e.jsxs("div",{className:"mb-3.5 flex flex-wrap items-center justify-between gap-2.5",children:[e.jsx("span",{className:"text-[12.5px] font-semibold text-foreground",children:"Your link"}),e.jsx($n,{handle:n,onChange:r})]}),e.jsx("div",{className:"hidden lg:block",children:a})]}),e.jsx("div",{className:"mt-4",children:e.jsx("button",{type:"button",onClick:s,className:"text-[13px] font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline",children:"Customize first"})})]})}function Un({brandName:t,reducedMotion:n}){const[r,a]=s.useState(0),o=t.trim();s.useEffect(()=>{if(n)return;const e=setInterval(()=>a(e=>(e+1)%Bn.length),1400);return()=>clearInterval(e)},[n]);const i=Bn[r]??Bn[0];return e.jsxs("div",{className:"mx-auto w-full max-w-[460px]",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11.5px] font-semibold uppercase tracking-[0.12em] text-accent",children:[e.jsx(ce,{className:"h-3.5 w-3.5","aria-hidden":!0}),"Crafting your page"]}),e.jsx("p",{className:"mt-4 font-aeonik text-[30px] font-bold leading-[1.1] tracking-[-0.03em] text-foreground",children:o||"Your page"}),e.jsx("p",{className:"mt-2 text-[15px] leading-[1.5] text-muted-foreground",children:"Your booking page is taking shape."}),e.jsxs("div",{className:"mt-7 inline-flex items-center gap-2.5 text-[13.5px] font-medium text-muted-foreground",children:[e.jsx("span",{className:d("inline-block h-4 w-4 rounded-full border-2 border-muted-foreground/25 border-t-accent",!n&&"genesis-spin"),"aria-hidden":!0}),e.jsx("span",{"aria-hidden":!0,children:i})]}),e.jsx("span",{className:"sr-only",role:"status",children:"Building your storefront. This takes a few seconds."})]})}
1const Yn={rose:"bg-rose-50 text-rose-600 dark:bg-rose-950/40 dark:text-rose-400",teal:"bg-teal-50 text-teal-600 dark:bg-teal-950/40 dark:text-teal-400",orange:"bg-orange-50 text-orange-600 dark:bg-orange-950/40 dark:text-orange-400",sky:"bg-sky-50 text-sky-600 dark:bg-sky-950/40 dark:text-sky-400",indigo:"bg-indigo-50 text-indigo-600 dark:bg-indigo-950/40 dark:text-indigo-400",emerald:"bg-emerald-50 text-emerald-600 dark:bg-emerald-950/40 dark:text-emerald-400",amber:"bg-amber-50 text-amber-600 dark:bg-amber-950/40 dark:text-amber-400"},Hn={hair:{id:"hair",label:"Hair styling",icon:Ye,examples:"Cuts, color, protective styles",role:"Hair Stylist",namePlaceholder:"e.g. Sasha Kim",tagline:"Cuts, color, and protective styles, booked and paid online.",starter:"I'm a hairstylist. I do cuts, color, and protective styles like knotless braids, by appointment."},barber:{id:"barber",label:"Barber",icon:Ye,examples:"Cuts, fades, beard work",role:"Barber",namePlaceholder:"e.g. Andre Cole",tagline:"Cuts, fades, and beard work, booked and paid online.",starter:"I'm a barber. I do cuts, fades, and beard trims by appointment."},nails:{id:"nails",label:"Nails",icon:ce,examples:"Manicures, full sets, art",role:"Nail Tech",namePlaceholder:"e.g. Tasha Ray",tagline:"Gel sets, fills, and nail art, booked and paid in one link.",starter:"I'm a nail tech. I do gel manicures, full sets, and custom nail art by appointment."},lashes:{id:"lashes",label:"Lashes & brows",icon:Ue,examples:"Extensions, lifts, brows",role:"Lash & Brow Artist",namePlaceholder:"e.g. Bella Cruz",tagline:"Lashes and brows that make mornings easy.",starter:"I do lash extensions, lifts, and brow shaping by appointment."},makeup:{id:"makeup",label:"Makeup",icon:We,examples:"Events, bridal, lessons",role:"Makeup Artist",namePlaceholder:"e.g. Ana Rivera",tagline:"Makeup, lashes, and brows for the days that matter.",starter:"I'm a makeup artist. I do event and bridal makeup plus lashes and brows by appointment."},skincare:{id:"skincare",label:"Skincare & facials",icon:$e,examples:"Facials, peels, skincare",role:"Esthetician",namePlaceholder:"e.g. Nina Park",tagline:"Facials and skincare tailored to your skin.",starter:"I'm an esthetician. I offer facials, peels, and skincare treatments by appointment."},massage:{id:"massage",label:"Deep tissue & recovery",icon:ve,examples:"Therapeutic bodywork",role:"Massage Therapist",namePlaceholder:"e.g. Lena Ford",tagline:"Deep tissue and recovery bodywork, booked and paid before you arrive.",starter:"I'm a massage therapist. I offer deep tissue, recovery, and relaxation sessions by appointment."},"sports-massage":{id:"sports-massage",label:"Sports massage",icon:ze,examples:"Recovery & mobility",role:"Sports Massage Therapist",namePlaceholder:"e.g. Chris Vaughn",tagline:"Sports and recovery bodywork for active bodies.",starter:"I'm a sports massage therapist. I offer recovery and mobility-focused sessions by appointment."},relaxation:{id:"relaxation",label:"Relaxation & spa",icon:Le,examples:"Swedish, hot stone",role:"Massage Therapist",namePlaceholder:"e.g. Mia Sato",tagline:"Relaxing spa massage, booked and paid before you arrive.",starter:"I offer relaxation and spa massage like Swedish and hot stone by appointment."},"personal-trainer":{id:"personal-trainer",label:"Personal training",icon:ye,examples:"Strength & general fitness",role:"Personal Trainer",namePlaceholder:"e.g. Marcus Reed",tagline:"Programmed sessions and written follow-ups, measurable progress.",starter:"I'm a personal trainer. I offer a free assessment, 1:1 training sessions, and a multi-week program."},strength:{id:"strength",label:"Strength",icon:ye,examples:"Barbell & powerlifting",role:"Strength Coach",namePlaceholder:"e.g. Ray Coleman",tagline:"Barbell coaching and programming that adds up.",starter:"I'm a strength coach. I offer a free assessment, 1:1 barbell sessions, and a training program."},boxing:{id:"boxing",label:"Boxing",icon:Be,examples:"Pad work & conditioning",role:"Boxing Coach",namePlaceholder:"e.g. Deon Fields",tagline:"Pad work, conditioning, and real progress, session by session.",starter:"I'm a boxing coach. I offer a free assessment, 1:1 pad-work sessions, and a conditioning program."},tennis:{id:"tennis",label:"Tennis",icon:Fe,examples:"Lessons & match play",role:"Tennis Coach",namePlaceholder:"e.g. Elena Ross",tagline:"Lessons and match play built around your level.",starter:"I'm a tennis coach. I offer a free assessment, 1:1 lessons, and a multi-week program."},yoga:{id:"yoga",label:"Yoga & Pilates",icon:Oe,examples:"Private & small group",role:"Yoga Instru
1ctor",namePlaceholder:"e.g. Mia Flores",tagline:"Private and small-group yoga built around you.",starter:"I'm a yoga instructor. I offer private sessions and small-group classes by appointment."},tutor:{id:"tutor",label:"Academic tutoring",icon:je,examples:"Math, science, writing",role:"Tutor",namePlaceholder:"e.g. Dana Park",tagline:"Focused 1:1 lessons that move grades and confidence.",starter:"I'm a tutor. I offer a free intro session, 1:1 lessons, and a multi-session package."},"test-prep":{id:"test-prep",label:"Test prep",icon:De,examples:"SAT, ACT, GRE",role:"Test Prep Tutor",namePlaceholder:"e.g. Priya Nair",tagline:"Focused test prep that moves your score.",starter:"I'm a test prep tutor for the SAT and ACT. I offer a free diagnostic, 1:1 lessons, and a package."},music:{id:"music",label:"Music lessons",icon:Me,examples:"Piano, guitar, voice",role:"Music Teacher",namePlaceholder:"e.g. Leo Rivera",tagline:"Private music lessons at your pace.",starter:"I'm a music teacher. I offer a free intro lesson, 1:1 lessons, and a lesson package."},language:{id:"language",label:"Language lessons",icon:Ae,examples:"Spanish, French, ESL",role:"Language Tutor",namePlaceholder:"e.g. Sofia Marin",tagline:"Conversational language lessons that stick.",starter:"I'm a language tutor. I offer a free intro session, 1:1 lessons, and a package."},coach:{id:"coach",label:"Life coaching",icon:Ne,examples:"Direction, habits, mindset",role:"Life Coach",namePlaceholder:"e.g. Sarah Kim",tagline:"Practical 1:1 coaching for people doing the work.",starter:"I'm a life coach. I offer a free intro call, focused 1:1 sessions, and a multi-session package."},"career-coach":{id:"career-coach",label:"Career coaching",icon:Re,examples:"Interviews, transitions",role:"Career Coach",namePlaceholder:"e.g. Sarah Kim",tagline:"Career coaching for your next move.",starter:"I'm a career coach. I offer a free intro call, 1:1 sessions, and a package."},"business-coach":{id:"business-coach",label:"Business coaching",icon:Pe,examples:"Founders & operators",role:"Business Coach",namePlaceholder:"e.g. Jordan Ellis",tagline:"Practical coaching for founders and operators.",starter:"I'm a business coach for founders. I offer a free intro call, 1:1 sessions, and a package."},"wellness-coach":{id:"wellness-coach",label:"Health & wellness",icon:Ee,examples:"Nutrition, habits, energy",role:"Wellness Coach",namePlaceholder:"e.g. Dana Lowe",tagline:"Coaching for health, habits, and energy.",starter:"I'm a wellness coach. I offer a free intro call, 1:1 sessions, and a package."},consultant:{id:"consultant",label:"Strategy",icon:ke,examples:"Planning & operations",role:"Consultant",namePlaceholder:"e.g. Priya Shah",tagline:"Strategy, structure, and a written plan you can ship.",starter:"I'm a strategy consultant. I offer a discovery call, a focused strategy sprint, and monthly advisory."},"marketing-consultant":{id:"marketing-consultant",label:"Marketing",icon:Te,examples:"Growth, brand, content",role:"Marketing Consultant",namePlaceholder:"e.g. Alex Monroe",tagline:"Marketing strategy you can actually ship.",starter:"I'm a marketing consultant. I offer a discovery call, a strategy sprint, and monthly advisory."},"finance-consultant":{id:"finance-consultant",label:"Finance & bookkeeping",icon:Ie,examples:"Books, taxes, planning",role:"Finance Consultant",namePlaceholder:"e.g. Grace Tan",tagline:"Financial clarity for small businesses.",starter:"I'm a finance consultant. I offer a discovery call, a focused engagement, and monthly advisory."},"specialist-consultant":{id:"specialist-consultant",label:"Specialist advisory",icon:Ce,examples:"Your area of expertise",role:"Consultant",namePlaceholder:"e.g. Priya Shah",tagline:"Expert advisory in your field, booked in one link.",starter:"I'm an independent specialist consultant. I offer a discovery call, a focused engagement, and monthly advisory."},brand:{id:"brand",label:"Brand & graphic design",icon:we,examples:"Logos, identity, collateral",role:"Brand Designer",namePlaceholder:"e.g. Alex Rivera",tagline:"Brand and design work, booked and paid in one link.",starter:"I'm a brand designer. I offer a free intro call, a brand sprint, and a monthly design retainer."},web:{id:"web",label:"Web & product design",icon:_e,examples:"Sites, apps, UX",role:"Product Designer",namePlaceholder:"e.g. Sam Park",tagline:"Design work, booked and paid in one link.",starter:"I'm a product designer. I offer a free intro call, a design sprint, and a monthly retainer."},illustration:{id:"illustration",label:"Illustration & art",icon:Se,examples:"Custom art & assets",role:"Illustrator",namePlaceholder:"e.g. Robin Sol",tagline:"Custom illustration, booked and paid in one link.",starter:"I'm an illustrator. I offer a free intro call, a commission project, and ongoing illustration work."},photographer:{id:"photographer",label:"Photography",icon:he,examples:"Portraits, weddings, events",role:"Photographer",namePlaceholder:"e.g. Jordan Lee",tagline:"Photo sessions, booked and paid in one link.",starter:"I'm a photographer. I offer portrait sessions, event and wedding coverage, and a mini-session package, by appointment."}},Kn=[{id:"beauty",label:"Beauty & personal care",icon:ce,colorKey:"rose",examples:"Hair, nails, makeup, lashes",specialtyIds:["hair","barber","nails","lashes","makeup","skincare"],otherSpecialtyId:"hair"},{id:"massage",label:"Massage & bodywork",icon:ve,colorKey:"teal",examples:"Deep tissue, sports, relaxation",specialtyIds:["massage","sports-massage","relaxation"],otherSpecialtyId:"massage"},{id:"fitness",label:"Fitness & training",icon:ye,colorKey:"orange",examples:"Personal, strength, boxing, yoga",specialtyIds:["personal-trainer","strength","boxing","tennis","yoga"],otherSpecialtyId:"personal-trainer"},{id:"tutoring",label:"Tutoring & lessons",icon:je,colorKey:"sky",examples:"Academic, test prep, music",specialtyIds:["tutor","test-prep","music","language"],otherSpecialtyId:"tutor"},{id:"coaching",label:"Coaching",icon:Ne,colorKey:"indigo",examples:"Life, career, business, wellness",specialtyIds:["coach","career-coach","business-coach","wellness-coach"],otherSpecialtyId:"c
1oach"},{id:"consulting",label:"Consulting",icon:ke,colorKey:"emerald",examples:"Strategy, marketing, finance",specialtyIds:["consultant","marketing-consultant","finance-consultant","specialist-consultant"],otherSpecialtyId:"consultant"},{id:"creative",label:"Creative & design",icon:we,colorKey:"amber",examples:"Photography, brand, web",specialtyIds:["photographer","brand","web","illustration"],otherSpecialtyId:"brand"}],Vn="__other__",Gn="__other_category__",qn={id:"__general_other__",label:"Something else",icon:ce,examples:"Tell us in a few words",role:"Service Professional",namePlaceholder:"e.g. Jordan Rivera",tagline:"Book my services online.",starter:"I offer services that clients can book and pay for online by appointment."};function Jn(e){return Kn.find(t=>t.id===e)}function Qn(e){return Hn[e]}function Xn(e){const t=Jn(e);return t?t.specialtyIds.map(e=>Hn[e]).filter(e=>Boolean(e)):[]}function Zn(e){return Yn[e]}function er({choices:t,onSelect:n,columns:r=2,className:a}){return e.jsx("div",{className:d("grid gap-2.5",2===r?"grid-cols-1 sm:grid-cols-2":"grid-cols-1",a),children:t.map(t=>{const r=t.icon;return e.jsxs("button",{type:"button",onClick:()=>n(t.id),className:d("group flex min-h-[64px] min-w-0 items-center gap-3 rounded-[14px] border-[1.5px] border-border bg-card px-3.5 py-3 text-left","transition-colors hover:border-foreground focus-visible:border-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"),children:[r&&e.jsx("span",{className:d("inline-flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-[11px]",t.colorChip??"bg-muted text-muted-foreground"),children:e.jsx(r,{className:"h-[19px] w-[19px]","aria-hidden":!0})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-[15px] font-semibold text-foreground",children:t.label}),t.examples&&e.jsx("span",{className:"mt-0.5 block truncate text-[13px] text-muted-foreground",children:t.examples})]}),e.jsx("span",{className:"inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full bg-foreground text-background transition-transform group-hover:scale-105",children:e.jsx(fe,{className:"h-4 w-4","aria-hidden":!0})})]},t.id)})})}const tr=hn;function nr({value:t,onChange:n,inputId:r="brand-name",className:a,focusOnMount:o=!1}){const i=tr.find(e=>e.type===t.brandType)??tr[0],l=s.useRef(null);s.useEffect(()=>{o&&l.current?.focus()},[o]);const c=`${r}-type-label`;return e.jsxs("div",{className:d("grid gap-3",a),children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{id:c,className:"text-[13px] font-semibold text-foreground",children:"Storefront type"}),e.jsx("div",{role:"group","aria-labelledby":c,className:"inline-flex w-fit rounded-full border border-border bg-muted/40 p-0.5",children:tr.map(r=>{const a=r.type===t.brandType;return e.jsx("button",{type:"button","aria-pressed":a,onClick:()=>n({brandType:r.type,brandName:t.brandName}),className:d("rounded-full px-3.5 py-1.5 text-[13px] font-semibold transition-colors",a?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:r.label},r.type)})})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("label",{htmlFor:r,className:"text-[13px] font-semibold text-foreground",children:i.nameLabel}),e.jsx("input",{ref:l,id:r,type:"text",autoComplete:"name",value:t.brandName,onChange:e=>n({brandType:t.brandType,brandName:e.target.value.slice(0,60)}),placeholder:i.placeholder,maxLength:60,className:"w-full rounded-[12px] border-[1.5px] border-border bg-card px-4 py-3 text-[15px] font-semibold text-foreground outline-none transition-[border-color] placeholder:font-normal placeholder:text-muted-foreground focus:border-foreground"})]})]})}function rr(){return e.jsxs("p",{className:"mt-5 inline-flex items-center gap-1.5 text-[12px] text-muted-foreground",children:[e.jsx(ge,{className:"h-3 w-3",strokeWidth:2.5,"aria-hidden":!0})," Free to start, no card needed. Change everything after."]})}function ar({description:t,brand:n,onBrandChange:r,onSubmit:a}){return e.jsxs("div",{className:"w-full max-w-[540px]",children:[e.jsx("h1",{className:"font-aeonik text-[34px] font-bold leading-[1.02] tracking-[-0.035em] text-foreground sm:text-[38px]",children:"One last thing."}),e.jsx("p",{className:"mt-3 text-[15px] leading-[1.5] text-muted-foreground",children:"Add your name and we'll build your page from what you described."}),e.jsx("div",{className:"mt-5 empty:mt-0",children:e.jsx(gt,{})}),e.jsx(nr,{value:n,onChange:r,inputId:"intake-handoff-name",className:"mt-5",focusOnMount:!0}),e.jsxs(u,{type:"button",variant:"primary",size:"default",className:"mt-5 w-full gap-2",onClick:()=>a(t,n),disabled:0===n.brandName.trim().length,children:["Build my page",e.jsx(fe,{className:"h-4 w-4","aria-hidden":!0})]}),e.jsx(rr,{})]})}function sr({brandType:t,value:n,onChange:r,onContinue:a,canContinue:o,placeholder:i}){const l=(d=t,hn.find(e=>e.type===d)??hn[0]);var d;const c=s.useRef(null);return s.useEffect(()=>{c.current?.focus()},[]),e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("label",{htmlFor:"intake-brand-name",className:"text-[13px] font-semibold text-foreground",children:l.nameLabel}),e.jsx("input",{ref:c,id:"intake-brand-name",type:"text",autoComplete:"name",value:n,maxLength:60,onChange:e=>r(e.target.value),onKeyDown:e=>{"Enter"===e.key&&o&&(e.preventDefault(),a())},placeholder:i??l.placeholder,className:"w-full rounded-[12px] border-[1.5px] border-border bg-card px-4 py-3 text-[15px] font-semibold text-foreground outline-none transition-[border-color] placeholder:font-normal placeholder:text-muted-foreground focus:border-foreground"})]}),e.jsxs(u,{type:"button",variant:"primary",size:"default",className:"w-full gap-2",onClick:a,disabled:!o,children:["Build my page",e.jsx(fe,{className:"h-4 w-4","aria-hidden":!0})]})]})}function or({categoryId:t,isOther:n,otherText:r,onSelectSpecialty:a,onChooseOther:o,onOtherTextChange:i,onConfirmOther:l,canConfirmOther:d}){const c=s.useRef(null);if(s.useEffect(()=>{n&&c.current?.focus()},[n]),n)return e.jsxs("div",{className:"grid gap-3",children:[e.jsx("textarea",{ref:c,value:r,onChange:e=>i(e.target.value.slice(0,ft)),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&d&&(e.preventDefault(),l())},rows:3,placeholder:"e.g. I'm a dog groomer. I do baths, full grooms, and nail trims by appointment.",className:"w-full resize-none rounded-[14px] border-[1.5px] border-border bg-card px-4 py-3 text-[15px] leading-[1.5] text-foreground outline-none transition-[border-color] placeholder:text-muted-foreground focus:border-foreground"}),e.jsxs(u,{type:"button",variant:"primary",size:"default",className:"w-full gap-2",onClick:l,disabled:!d,children:["Continue",e.jsx(fe,{className:"h-4 w-4","aria-hidden":!0})]})]});const m=(()=>{const e=Jn(t);return e?Zn(e.colorKey):void 0})(),p=[...Xn(t).map(e=>({id:e.id,label:e.label,examples:e.examples,icon:e.icon,colorChip:m})),{id:Vn,label:"Something else",examples:"Tell us in a few words",icon:pe}];return e.jsx(er,{choices:p,onSelect:e=>e===Vn?o():a(e)})}function ir({brandName:t,role:n,tagline:r,isPersonal:a}){const s=t.trim();return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"w-full overflow-hidden rounded-[20px] border border-border bg-card shadow-[0_12px_48px_rgba(0,0,0,0.06)]",children:[e.jsxs("div",{className:"flex flex-col items-center px-8 pb-8 pt-9 text-center",children:[e.jsx(vt,{className:"h-[88px] w-[88px] border border-border/40",iconClassName:"h-8 w-8"}),e.jsx("h2",{className:s?"mt-5 break-words font-aeonik text-[26px] font-bold leading-[1.05] tracking-[-0.035em] text-foreground":"mt-5 break-words font-aeonik text-[26px] font-bold leading-[1.05] tracking-[-0.035em] text-muted-foreground",children:s||(a?"Your name":"Your business")}),a&&n&&e.jsx("p",{className:"mt-2 text-[10px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:n}),e.jsx("p",{className:"mt-2.5 max-w-[300px] text-[14px] leading-[1.5] text-muted-foreground",children:r??"A clean page your clients can book in one tap."})]}),e.jsxs("div",{className:"border-t border-border bg-muted/30 px-6 pb-6 pt-5",children:[e.jsx("p",{className:"mb-3 text-[11px] font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:"Book a service"}),e.jsx("div",{className:"flex flex-col gap-2.5",children:[0,1,2].map(t=>e.jsxs("div",{className:"flex items-center gap-3 rounded-[14px] border border-border bg-card px-4 py-3.5",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(l,{animated:!1,className:"h-2.5 w-[55%] rounded-full"}),e.jsx(l,{animated:!1,className:"mt-2 h-2 w-[30%] rounded-full bg-muted/60"})]}),e.jsx(l,{animated:!1,className:"h-2.5 w-12 rounded-full"}
1),e.jsx("span",{"aria-hidden":!0,className:"inline-flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-full border border-border bg-muted/40 text-muted-foreground",children:e.jsx(He,{className:"h-4 w-4"})})]},t))})]})]}),e.jsxs("p",{className:"mt-5 inline-flex items-center gap-1.5 text-[13px] text-muted-foreground",children:[e.jsx(ce,{className:"h-3.5 w-3.5 text-foreground/55","aria-hidden":!0}),"Live preview. Your full page builds next."]})]})}const lr=["category","specialty","brandType","name"],dr=[{id:"personal",label:"Just me",examples:"A personal brand under my name",icon:ue,colorChip:"bg-accent/10 text-accent"},{id:"business",label:"It's a business",examples:"A business name and brand",icon:Ve,colorChip:"bg-accent/10 text-accent"}],cr=[...Kn.map(e=>({id:e.id,label:e.label,examples:e.examples,icon:e.icon,colorChip:Zn(e.colorKey)})),{id:Gn,label:"Something else",examples:"Groomer, cleaner, event planner",icon:ce}];function ur({onSubmit:t,handoffDescription:n,initialBrand:r,onStepView:a,onPersonaSelect:o}){const i=n?.trim()??"",l=i.length>0,d=function({initialBrand:e}={}){const[t,n]=s.useState("category"),[r,a]=s.useState(null),[o,i]=s.useState(null),[l,d]=s.useState(""),[c,u]=s.useState(e??{brandName:"",brandType:pn}),m=o===Vn,p=s.useMemo(()=>{if(!o)return null;if(m){if(r===Gn)return qn;const e=r?Jn(r):void 0;return e?Qn(e.otherSpecialtyId)??null:null}return Qn(o)??null},[o,m,r]),x=s.useMemo(()=>m?l.trim():p?.starter??"",[m,l,p]),h=x.length>=bt,g=c.brandName.trim().length>0,f=h&&g,b="name"===t?f:!m||h,v=lr.indexOf(t);return{stepId:t,stepIndex:v,totalSteps:lr.length,canBack:v>0,categoryId:r,specialtyId:o,isOther:m,otherText:l,brand:c,baseSpecialty:p,description:x,canContinue:b,canSubmit:f,selectCategory:e=>{a(e),d(""),i(e===Gn?Vn:null),n("specialty")},selectSpecialty:e=>{i(e),n("brandType")},chooseOther:()=>{i(Vn)},setOtherText:e=>d(e),confirmOther:()=>{m&&h&&n("brandType")},selectBrandType:e=>{u(t=>({...t,brandType:e})),n("name")},setBrandName:e=>u(t=>({...t,brandName:e.slice(0,60)})),back:()=>{if("specialty"===t&&m)return r===Gn?(i(null),a(null),d(""),void n("category")):(i(null),void d(""));const e=lr[v-1];e&&n(e)}}}({initialBrand:r}),[c,u]=s.useState(r),m=s.useRef(null);s.useEffect(()=>{const e=l?"handoff":d.stepId;m.current!==e&&(m.current=e,l?a?.("handoff",0):a?.(d.stepId,d.stepIndex))},[l,d.stepId]);const p=l?c.brandName:d.brand.brandName,x="personal"===(l?c.brandType:d.brand.brandType),h=function(e,t,n){switch(e){case"category":return{title:"What do you do?",sub:"Pick the closest. You can change everything after."};case"specialty":return t?{title:"Tell us what you do",sub:"A sentence is plenty."}:{title:"What do you specialize in?",sub:"This tailors your page to your work."};case"brandType":return{title:"Is this just you, or a business?",sub:"This shapes how your page introduces you."};case"name":return n?{title:"What's it called?",sub:"This becomes your page name and link."}:{title:"What's your name?",sub:"This becomes your page name and link."}}}(d.stepId,d.isOther,"business"===d.brand.brandType),g=l?e.jsx(ar,{description:i,brand:c,onBrandChange:u,onSubmit:t}):e.jsxs("div",{className:"w-full max-w-[540px]",children:[d.canBack&&e.jsxs("button",{type:"button",onClick:d.back,className:"mb-4 inline-flex items-center gap-1 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(Ke,{className:"h-4 w-4","aria-hidden":!0})," Back"]}),e.jsx("h1",{className:"font-aeonik text-[30px] font-bold leading-[1.05] tracking-[-0.035em] text-foreground sm:text-[34px]",children:h.title}),e.jsx("p",{className:"mt-2.5 text-[15px] leading-[1.5] text-muted-foreground",children:h.sub}),e.jsx("div",{className:"mt-4 empty:mt-0",children:e.jsx(gt,{})}),e.jsxs("div",{className:"mt-6",children:["category"===d.stepId&&e.jsx(er,{choices:cr,onSelect:e=>{const t=cr.find(t=>t.id===e);o?.({field:"category",categoryId:e,categoryLabel:t?.label??e,isTopLevelOther:e===Gn}),d.selectCategory(e)}}),"specialty"===d.stepId&&d.categoryId&&e.jsx(or,{categoryId:d.categoryId,isOther:d.isOther,otherText:d.otherText,onSelectSpecialty:e=>{o?.({field:"specialty",categoryId:d.categoryId??"",specialtyId:e,specialtyLabel:Qn(e)?.label??e,isOther:!1,isTopLevelOther:!1}),d.selectSpecialty(e)},onChooseOther:d.chooseOther,onOtherTextChange:d.setOtherText,onConfirmOther:()=>{var e;o?.({field:"specialty",categoryId:d.categoryId??"",specialtyId:Vn,specialtyLabel:"Something else",isOther:!0,isTopLevelOther:d.categoryId===Gn,otherText:(e=d.otherText,e.trim().slice(0,100))}),d.confirmOther()},canConfirmOther:d.canContinue}),"brandType"===d.stepId&&e.jsx(er,{choices:dr,columns:1,onSelect:e=>{return t="business"===e?"business":"personal",o?.({field:"brandType",brandType:t}),void d.selectBrandType(t);var t}}),"name"===d.stepId&&e.jsx(sr,{brandType:d.brand.brandType,value:d.brand.brandName,onChange:d.setBrandName,onContinue:()=>d.canSubmit&&t(d.description,d.brand),canContinue:d.canSubmit,placeholder:"personal"===d.brand.brandType?d.baseSpecialty?.namePlaceholder:void 0})]}),e.jsx(rr,{})]});return e.jsxs("div",{className:"grid flex-1 grid-cols-1 lg:grid-cols-[0.82fr_1fr] lg:overflow-hidden",children:[e.jsx("div",{className:"flex items-start justify-center overflow-y-auto px-5 py-8 lg:items-center lg:justify-end lg:border-r lg:border-border lg:px-11",children:g}),e.jsx("div",{className:"hidden flex-col items-center justify-center overflow-y-auto bg-muted/40 lg:flex lg:px-12 lg:py-10",children:e.jsx("div",{className:"w-full max-w-[480px]",children:e.jsx(ir,{brandName:p,role:l?null:d.baseSpecialty?.role??null,tagline:l?null:d.baseSpecialty?.tagline??null,isPersonal:x})})})]})}function mr(e){if(!Number.isFinite(e)||e<=0)return 0;const t=Math.round(e);return t>=100?50*Math.round(t/50):5*Math.round(t/5)}const pr=[{label:"Make it warmer",kind:"model",instruction:"Rewrite the copy in a warmer, more personal, encouraging tone. Keep the same services and prices."},{label:"Lower the prices",kind:"pure",transform:function(e){return{...e,services:e.services.map(e=>{return(t=e).isFree||"inquiry"===t.pricingType?t:{...t,price:mr(.8*t.price)};var t})}}},{label:"Add a package",kind:"model",instruction:"Add one multi-session package option, priced appropriately for this field, alongside the existing services."},{label:"More concise",kind:"model",instruction:"Make all the copy more concise and punchy. Keep the same services and prices."}];function xr({onPureRefine:t,onModelRefine:n,onRegenerate:r,disabled:a=!1}){const[o,i]=s.useState(""),l=()=>{const e=o.trim();e&&!a&&(n(e),i(""))}
1,c="rounded-full border border-border bg-card px-2.5 py-1.5 text-[12px] font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50";return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"mb-2.5 flex flex-wrap gap-1.5",children:[pr.map(r=>e.jsx("button",{type:"button",disabled:a,onClick:()=>{"pure"===r.kind&&r.transform?t(r.transform):"model"===r.kind&&r.instruction&&n(r.instruction)},className:c,children:r.label},r.label)),e.jsxs("button",{type:"button",disabled:a,onClick:r,className:d(c,"inline-flex items-center gap-1.5 text-muted-foreground"),children:[e.jsx(Ge,{className:"h-3 w-3","aria-hidden":!0})," Try another direction"]})]}),e.jsxs("div",{className:d("flex items-end gap-2 rounded-[14px] border border-border bg-card py-2 pl-3.5 pr-2 transition-shadow",a&&"shadow-[0_0_0_3px_hsl(var(--foreground)/0.05)]"),children:[e.jsx("label",{htmlFor:"ai-refine",className:"sr-only",children:"Describe a change"}),e.jsx("textarea",{id:"ai-refine",rows:1,value:o,disabled:a,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"===e.key&&!e.shiftKey&&o.trim()&&(e.preventDefault(),l())},placeholder:a?"Updating your pageâ¦":"Describe a changeâ¦",className:"max-h-[124px] flex-1 resize-none border-0 bg-transparent py-1.5 text-[14px] leading-[1.5] text-foreground outline-none placeholder:text-muted-foreground"}),e.jsx("button",{type:"button",disabled:a||!o.trim(),onClick:l,"aria-label":"Apply change",className:d("inline-flex h-9 w-9 flex-none items-center justify-center rounded-[9px] transition-colors",o.trim()&&!a?"bg-foreground text-background":"cursor-default bg-muted text-muted-foreground"),children:e.jsx(fe,{className:"h-[15px] w-[15px]","aria-hidden":!0})})]})]})}async function hr(e,t,n={}){const r=rt(e,{ownerName:n.ownerName}),{handle:a,services:s,timezone:o,...i}=r.onboarding,l={...i,orgId:t.orgId,storefrontId:t.storefrontId},d=await g.rpc("save_onboarding_progress",{data:l});return!d.error&&at(d.data)&&d.data.success?(await st(t.storefrontId,r.onboarding.tagline,r.storefrontDescription,r.professional.stats,r.logoPath,r.brandType),await ot(t.storefrontId,r.professional),v(!0)):(b.warn("liveUpdateStorefront: save_onboarding_progress failed",{storefrontId:t.storefrontId,error:d.error?.message??(at(d.data)?d.data.error:void 0)}),m({type:"save_failed",message:"We could not save your latest change. We will keep trying."}))}const gr=[{id:"hours",label:"Hours"},{id:"earnings",label:"Earnings"},{id:"send",label:"Send"},{id:"post",label:"Post"},{id:"done",label:"Done"}],fr=gr.map(e=>e.id);function br(e,t){return"hours"===e?t?"Save and continue":"Looks right":"Continue"}const vr="glintShareStep";function yr(e){if("object"!=typeof e||null===e)return null;const t=e[vr];return function(e){return fr.some(t=>t===e)}(t)?t:null}function jr(e,t){return{..."object"==typeof e&&null!==e?e:{},[vr]:t}}const Nr="__glintOnboardingBack";function kr(){return window.history.state??{}}function wr(){return!0===kr()[Nr]}function Sr(e){window.history.pushState({...kr(),[Nr]:!0},"",e)}const _r=[{key:"read",status:"Reading your description",ms:850},{key:"header",status:"Naming your storefront",ms:700},{key:"headline",status:"Writing your headline",ms:750},{key:"about",status:"Telling your story",ms:750},{key:"services",status:"Pricing your services",ms:1050},{key:"proof",status:"Adding social proof",ms:650}];function Cr({canRestart:t,onRestart:n,onExit:r}){return e.jsxs("header",{className:"flex h-[60px] flex-shrink-0 items-center justify-between border-b border-border bg-background px-5 sm:px-7",children:[e.jsx(E,{size:"sm",linkTo:"/"}),e.jsxs("div",{className:"flex items-center gap-4",children:[t&&e.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1.5 text-[12.5px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(Je,{className:"h-3 w-3","aria-hidden":!0})," Start over"]}),r&&e.jsx("button",{type:"button",onClick:r,className:"text-[12.5px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:"Save & exit"})]})]})}function Ir({ownerName:n,initialBrandName:r,initialBrandType:a,onBrandChange:l,primaryColor:c,initialDescription:E="",autoStart:P=!1,onPublish:R,publishLabel:A,isPublishing:M,onExit:D,uploadUserId:O,mode:F="create",renderShared:B,liveTarget:L,initialGenerated:z,onStartOver:$,analyticsSource:W}
1){const[U,Y]=s.useState({brandName:r??n??"",brandType:a??pn}),H=function(e={}){const[t,n]=s.useState(e.initialGenerated?"ready":"idle"),[r,a]=s.useState(""),[o,i]=s.useState(()=>new Set(e.initialGenerated?Mn:[])),[l,d]=s.useState(e.initialGenerated??null),[c,u]=s.useState(null),[m,p]=s.useState(!1),[x,h]=s.useState(null),[g,f]=s.useState(!1),[b,v]=s.useState(null),w=s.useRef([]),S=s.useRef(0),_=s.useRef(null),C=s.useRef(e.initialDescription??""),I=s.useRef(void 0),{track:T}=y(),E=s.useRef(e.analyticsSource),P=s.useCallback(()=>{for(const e of w.current)clearTimeout(e);w.current=[]},[]);s.useEffect(()=>()=>{P(),S.current++,_.current?.abort()},[P]);const R=s.useCallback(e=>{let t=0;for(const n of _r){const r=t;w.current.push(setTimeout(()=>{S.current===e&&a(n.status)},r)),t+=n.ms}w.current.push(setTimeout(()=>{S.current===e&&a("Putting it all together")},t))},[]),A=s.useCallback(e=>{0!==Mn.length?Mn.forEach((t,r)=>{w.current.push(setTimeout(()=>{S.current===e&&(i(e=>new Set(e).add(t)),r===Mn.length-1&&n("ready"))},220*(r+1)))}):n("ready")},[]),M=s.useCallback(e=>{P();const t=++S.current;_.current?.abort();const r=new AbortController;_.current=r,n("building"),d(null),u(null),p(!1),i(new Set),h(null),f(!1),v(null),a(_r[0]?.status??""),R(t);const s=Date.now();T(j.GENERATION_STARTED,{source:E.current,prompt_length:e.length,brand_type:I.current?.brandType??null,name_provided:Boolean(I.current?.brandName.trim())});let o,l=!1;N(e,{source:E.current,mode:"initial",brand:I.current,signal:r.signal,onSection:(e,n)=>{S.current===t&&(void 0===o&&(o=Date.now()-s),u(e=>({...e??{},...n})))},onFellBack:()=>{l=!0}}).then(e=>{S.current===t&&(P(),"ok"===e.status?(T(j.GENERATION_READY,{source:E.current,latency_ms:Date.now()-s,persona:lt(e.storefront.role),role_title:e.storefront.role,streamed:!l,fell_back:l,...void 0!==o?{time_to_first_section_ms:o}:{}}),u(null),d(e.storefront),p(!l),l?A(t):(i(new Set(Mn)),n("ready"))):"declined"===e.status?(T(j.GENERATION_DECLINED,{source:E.current}),u(null),h(e.message),n("declined")):(T(j.GENERATION_FAILED,{source:E.current,reason:"error"===e.status&&e.reason||e.status}),u(null),h(e.message),n("error")))})},[P,A,R,T]),D=s.useCallback((e,t)=>{C.current=e,t&&(I.current=t),M(e)},[M]),O=s.useCallback(e=>{P(),_.current?.abort();const t=++S.current;f(!0),v(null),k(e,{source:E.current,mode:"refine",brand:I.current}).then(e=>{S.current===t&&(f(!1),"ok"===e.status?d(e.storefront):v(e.message))})},[P]),F=s.useCallback(()=>{C.current?(T(j.GENERATION_REGENERATED,{source:E.current}),l?O(C.current):M(C.current)):v("We couldn't rebuild your page. Try Start over to build a fresh one.")},[l,O,M,T]),B=s.useCallback(e=>{if(!l)return;if(!C.current)return void v("We couldn't apply that change. Try Start over to rebuild your page.");const t=ft-341-2;if(e.length>t)return void v("That change is too long. Try describing it more briefly.");T(j.GENERATION_REFINED,{kind:"model",source:E.current});const n=`\n\nThe user reviewed the draft above and asked for this change. Apply it fully and rewrite every part it affects (services, prices, copy, tone). If it changes the type of business, REPLACE the trade entirely and do not keep the old services or wording. This instruction takes priority over the description above wherever they conflict. Change: ${e}`,r=C.current.slice(0,Math.max(0,ft-n.length));O(`${r}${n}`)},[l,O,T]),L=s.useCallback(e=>{d(t=>t?e(t):t),v(null)},[]),z=s.useCallback(()=>{P(),_.current?.abort(),S.current++,n("idle"),a(""),i(new Set),d(null),u(null),p(!1),h(null),f(!1),v(null)},[P]),$=s.useMemo(()=>{if(l){const n="ready"===t?void 0:o;return On(l,{ownerName:e.ownerName,primaryColor:e.primaryColor,reveal:n})}return c&&(c.services?.length??0)>0?function(e,t={}){const n=new Set;return(e.about||(e.stats?.length??0)>0)&&n.add("about"),On(Fn(e),{...t,reveal:n})}(c,{ownerName:e.ownerName,primaryColor:e.primaryColor}):null},[l,c,o,t,e.ownerName,e.primaryColor]);return{state:t,statusLine:r,revealed:o,preview:$,generated:l,partial:c,streamedReveal:m,message:x,refining:g,refineError:b,generate:D,regenerate:F,applyRefine:L,refineWithInstruction:B,reset:z}}({ownerName:"personal"===U.brandType&&U.brandName.trim()?U.brandName.trim():n,primaryColor:c,initialGenerated:z,initialDescription:z?E:void 0,analyticsSource:W}),K=t(),V=o(),G=w(),[q,J]=s.useState(E),[Q,X]=s.useState(!1),[Z,ee]=s.useState(!1),[te,ne]=s.useState(0),[re,ae]=s.useState(null),[se,oe]=s.useState(!1),ie=s.useRef(0),[le,ce]=s.useState(null),ue=s.useRef(!1),me=s.useRef(null),pe=(e,t=U)=>{J(e),Y(t),l?.(t),H.generate(e,t)};s.useEffect(()=>{P&&E&&!ue.current&&(ue.current=!0,pe(E))},[P,E]);const{state:xe,generated:he,partial:ve,streamedReveal:ye,refining:je,refineError:Ne}=H,ke="shared"===F,we="building"===xe,Se="ready"===xe,_e=!ke&&Boolean(M),Ce="declined"===xe||"error"===xe,Ie="idle"===xe,Te=!ke&&!G&&!z,[Ee,Pe]=s.useState(!1),Re=s.useRef(!1);s.useEffect(()=>{!Se||!he||ke||G||Re.current||(Re.current=!0,Pe(!0))},[Se,he,ke,G]),s.useEffect(()=>{!ke&&Se&&he&&(S(q,he),O&&_(O,q,he))},[ke,Se,he,q,O]),s.useEffect(()=>{ke&&(C(),O&&I(O))},[ke,O]);const Ae=()=>{C(),O&&I(O),$?.(),H.reset()};s.useEffect(()=>{!we||he||ke||(ie.current=Date.now(),ae(null),oe(!1))},[we,he,ke]),s.useEffect(()=>{he&&null===re&&ie.current>0&&ae(Math.max(0,Date.now()-ie.current))},[he,re]);const Me=function({resolved:e,reducedMotion:t,beats:n}){const[r,a]=s.useState("reading");return s.useEffect(()=>{if(!e)return void a("reading");if(t)return void a("payoff");const r=performance.now();a("assembling");let s=0;const o=e=>{const t=e-r;a(function(e,t=Ln){return e>=t.payoffMs?"payoff":"assembling"}(t,n)),t<(n?.payoffMs??1500)&&(s=requestAnimationFrame(o))};return s=requestAnimationFrame(o),()=>cancelAnimationFrame(s)},[e,t,n]),r}({resolved:null!==he,reducedMotion:G}),De=Te&&!se&&(we||Se)&&!_e,Oe=De&&(!he||"payoff"!==Me),Fe=De&&null!==he&&"payoff"===Me,Be=De&&null!==he&&"assembling"===Me,Le=s.useRef(null),[ze,$e]=s.useState(0),We=s.useMemo(()=>de(),[])?"pb-[max(2.75rem,env(safe-area-inset-bottom))]":"pb-[max(0.75rem,env(safe-area-inset-bottom))]";s.useEffect(()=>{const e=Le.current;if(!e||"undefined"==typeof ResizeObserver)return void $e(0);const t=()=>$e(e.offsetHeight);t();const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[ke,Se,_e,Oe]);const Ue=s.useMemo(()=>L&&le?{...L,publishedHandle:le}:L??null,[L,le]),{status:Ye}=function({enabled:e,generated:t,target:n,ownerName:r}){const[a,o]=s.useState("idle"),l=s.useRef(null),d=s.useRef(!1),c=s.useRef(!1),u=s.useRef(!1),m=s.useRef(!0),p=s.useRef(!1),x=s.useRef(null),h=s.useRef({generated:t,target:n,ownerName:r});h.current={generated:t,target:n,ownerName:r};const g=s.useCallback(async()=>{const{generated:e,target:t,ownerName:n}=h.current;if(!e||!t)return;
1d.current=!0,c.current=!1,o("saving");const r=await hr(e,t,{ownerName:n});if(d.current=!1,r.ok&&(x.current=JSON.stringify(e)),m.current)if(r.ok){if(c.current)return void g();u.current=!1,it(t.publishedHandle,{generated:e,target:t}),o("saved")}else o("error"),i.error(r.error.message)},[]);return s.useEffect(()=>{if(e&&t&&n){if(!p.current)return p.current=!0,void(x.current=JSON.stringify(t));if(u.current||JSON.stringify(t)!==x.current){if(u.current=!0,!d.current)return l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,g()},1e3),()=>{l.current&&(clearTimeout(l.current),l.current=null)};c.current=!0}}},[e,t,n,g]),s.useEffect(()=>(m.current=!0,()=>{if(m.current=!1,l.current&&clearTimeout(l.current),!u.current)return;if(d.current&&!c.current)return;const{generated:e,target:t,ownerName:n}=h.current;e&&t&&(it(t.publishedHandle,{generated:e,target:t}),hr(e,t,{ownerName:n}).catch(()=>{}))}),[]),{status:a}}({enabled:ke,generated:he,target:Ue,ownerName:n}),{track:He,setUserProperties:Ke}=y(),Ve=(e,t="edit")=>He(j.DRAFT_EDITED,{field:e,action:t,phase:ke?"post_publish":"draft",source:W}),Ge=e=>H.applyRefine(t=>({...t,handle:e})),Je=async(e,t,n,r)=>{if(!O)return;n(!0);const a=await async function(e,t){let n;try{n=await yt(e)}catch{return m({message:"We couldn't read that image. Try a JPG or PNG."})}if(!p(n.type))return m({message:`This image format is not supported. Please use ${x}.`});if(!jt(n,5))return m({message:"Image must be smaller than 5MB."});const r=h(n.type)??"jpg",a=`profiles/${t.userId}/ai-${t.kind}.${r}`,{error:s}=await g.storage.from(f).upload(a,n,{upsert:!0,contentType:n.type});return s?(b.warn("uploadAioImage failed",{kind:t.kind,error:s.message}),m({message:"Couldn't upload that image. Please try again."})):v(a)}(t,{userId:O,kind:e});n(!1),a.ok?(Ve("photo"),H.applyRefine(e=>r(e,a.value)),ne(e=>e+1)):i.error(a.error.message)},Qe=e=>Je("logo",e,X,(e,t)=>({...e,logoPath:t})),Xe=e=>Je("headshot",e,ee,(e,t)=>({...e,headshotPath:t})),Ze=Se&&!_e&&!je&&Boolean(O),et=e.jsxs("div",{className:"relative",children:[e.jsx(u,{type:"button",size:"xl",onClick:()=>he&&R(he),disabled:_e||je||!he,className:"w-full rounded-[12px]",children:_e?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0}),"Creating your pageâ¦"]}):e.jsxs(e.Fragment,{children:[A??"Claim my storefront",e.jsx(fe,{className:"ml-2 h-4 w-4","aria-hidden":!0})]})}),Ee&&!_e&&e.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 overflow-hidden rounded-[12px]",children:e.jsx("span",{onAnimationEnd:()=>Pe(!1),className:"absolute inset-y-0 left-0 w-[45%] animate-cta-sheen bg-gradient-to-r from-transparent via-white/30 to-transparent dark:via-black/10"})})]}),tt=ke?e.jsx("span",{role:"status","aria-live":"polite",className:"inline-flex items-center gap-1.5 text-[12px] font-medium text-muted-foreground",children:"saving"===Ye?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"h-3 w-3 animate-spin","aria-hidden":!0})," Savingâ¦"]}):"error"===Ye?e.jsxs(e.Fragment,{children:[e.jsx(qe,{className:"h-3 w-3","aria-hidden":!0})," Not saved"]}):e.jsxs(e.Fragment,{children:[e.jsx(ge,{className:"h-3 w-3",strokeWidth:2.5,"aria-hidden":!0})," Saved"]})}):null,nt=ke&&he&&Ue&&B?B({generated:he,applyRefine:H.applyRefine,onPickLogo:Qe,onPickHeadshot:Xe,logoUploading:Q,headshotUploading:Z,saveIndicator:tt,canUpload:Ze,liveTarget:Ue,onSlugRenamed:e=>{if(!L)return;ce(e),H.applyRefine(t=>({...t,handle:e}));const t={...L,publishedHandle:e};he&&it(e,{generated:{...he,handle:e},target:t});try{window.history.replaceState(window.history.state,"",`${window.location.pathname}?slug=${encodeURIComponent(e)}`)}catch{}K.invalidateQueries({queryKey:T.bySlug(L.publishedHandle)}),K.invalidateQueries({queryKey:T.bySlug(e)}),K.invalidateQueries({queryKey:T.org(L.orgId)})}}):null;!function({active:e,resolve:t,onRelease:n}){const r=s.useRef(t);r.current=t;const a=s.useRef(n);a.current=n;const o=s.useRef("");s.useEffect(()=>{wr()&&(o.current=window.location.href)}),s.useEffect(()=>{o.current=window.location.href,wr()||Sr(window.location.href);const e=()=>{if(wr()||null!==yr(window.history.state))return;const e=r.current();"step"===e.type?(e.run(),Sr(o.current||window.location.href)):a.current(e.to)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[e])}({active:!0,resolve:()=>{return"shared"===(e={mode:ke?"shared":"create",engineState:xe,miyOnBack:nt?.onBack,toDescribe:Ae}).mode?e.miyOnBack?{type:"step",run:e.miyOnBack}:{type:"release",to:"/dashboard"}:"idle"===e.engineState?{type:"release",to:"/"}:{type:"step",run:e.toDescribe};var e},onRelease:e=>V(e,{replace:!0})});const rt=ke&&Boolean(nt?.shareMoment),at=ke&&Boolean(nt)&&!rt;s.useEffect(()=>{if(!rt)return;me.current&&(me.current.scrollTop=0);const e=document.scrollingElement;e&&(e.scrollTop=0)},[rt]);const st=s.useMemo(()=>!he&&we&&ve?.businessName?.trim()?Fn(ve):null,[he,we,ve]),ot=he??st,dt=!he&&null!==st,ct=e.jsxs("div",{className:"relative mx-auto w-full max-w-[480px]",children:[e.jsx("div",{className:"transition-opacity duration-300",style:{opacity:_e||je?.55:1},children:ot?e.jsx(Sn,{gen:ot,streamingReveal:dt,instant:!!dt||(Se||_e)&&(ye||!Be),revealStaggerMs:dt||!Be||ye?void 0:200,editable:Boolean(he)&&Se&&!_e&&!je&&(!Te||se),onEditBusinessName:e=>{e.trim()&&(Ve("business_name"),H.applyRefine(t=>{const n=_n(t,e);return fn(t)===t.businessName.trim()?Cn(n,e):n}))},onEditHeadline:e=>{Ve("headline"),H.applyRefine(t=>Tn(t,e))},onEditRole:e=>{e.trim()&&(Ve("role"),H.applyRefine(t=>In(t,e)))},onEditAbout:e=>{Ve("bio"),H.applyRefine(t=>En(t,e))}
1,onEditStat:(e,t,n)=>{n.trim()&&(Ve("stat"),H.applyRefine(r=>({...r,stats:r.stats.map((r,a)=>a===e?{...r,[t]:n}:r)})))},onRemoveStat:e=>{Ve("stat","remove"),H.applyRefine(t=>({...t,stats:t.stats.filter((t,n)=>n!==e)}))},onEditServiceName:(e,t)=>{Ve("service_name"),H.applyRefine(n=>({...n,services:n.services.map((n,r)=>r===e?{...n,name:t}:n)})),ke&&nt?.onInlineServiceEdit?.(e,{name:t})},onEditServicePrice:(e,t)=>{const n=Number(t.replace(/[^0-9.]/g,""));if(!Number.isFinite(n)||n<=0||Math.round(n)<1)return;const r=Math.round(n);Ve("service_price"),H.applyRefine(t=>({...t,services:t.services.map((t,n)=>n===e?{...t,price:r,isFree:!1,pricingType:"fixed"}:t)})),ke&&nt?.onInlineServiceEdit?.(e,{priceDollars:r})},canUpload:Ze,onPickLogo:Qe,onPickHeadshot:Xe,logoUploading:Q,headshotUploading:Z,imageCacheKey:te,onOpenServiceEditor:nt?.onOpenServiceEditor,editableServiceIndices:nt?.editableServiceIndices,servicesFocused:nt?.servicesFocused}):e.jsx(jn,{building:we})}),je&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-start justify-center pt-10",children:e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-border bg-card/95 px-3.5 py-2 text-[12.5px] font-semibold text-foreground shadow-[0_4px_16px_rgba(0,0,0,0.08)]",children:[e.jsx(be,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," Updating your pageâ¦"]})})]});return e.jsxs("div",{"data-onboarding-surface":!0,className:"flex min-h-[100svh] flex-col bg-background lg:h-[100svh] lg:min-h-0 lg:overflow-hidden",children:[e.jsx(Cr,{canRestart:!Ie&&!ke,onRestart:Ae,onExit:D}),Ce&&e.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 px-6 py-12 text-center",children:[e.jsx("p",{className:"max-w-md text-base text-foreground",children:H.message??"We couldn't build your page just now."}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(u,{type:"button",variant:"secondary",onClick:Ae,children:"Edit description"}),"error"===xe&&e.jsx(u,{type:"button",onClick:H.regenerate,children:"Try again"})]})]}),Ie&&e.jsx(ur,{onSubmit:pe,handoffDescription:E,initialBrand:U,onStepView:(e,t)=>He(j.INTAKE_STEP_VIEWED,{step:e,index:t,source:W}),onPersonaSelect:e=>{"category"===e.field?(He(j.INTAKE_CATEGORY_SELECTED,{category_id:e.categoryId,category_label:e.categoryLabel,is_top_level_other:e.isTopLevelOther,source:W}),Ke({intake_category:e.categoryId,intake_category_label:e.categoryLabel})):"specialty"===e.field?(He(j.INTAKE_SPECIALTY_SELECTED,{category_id:e.categoryId,specialty_id:e.specialtyId,specialty_label:e.specialtyLabel,is_other:e.isOther,is_top_level_other:e.isTopLevelOther,...e.otherText?{other_text:e.otherText}:{},source:W}),Ke({intake_specialty:e.specialtyId,intake_specialty_label:e.specialtyLabel,intake_is_other:e.isOther})):(He(j.INTAKE_BRAND_TYPE_SELECTED,{brand_type:e.brandType,source:W}),Ke({intake_brand_type:e.brandType}))}}),(we||Se||_e)&&!Ce&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid flex-1 grid-cols-1 lg:grid-cols-[0.82fr_1fr] lg:overflow-hidden",children:[e.jsx("div",{ref:me,className:d("flex-col overflow-y-auto px-5 lg:justify-center lg:border-r lg:border-border lg:px-11",!ke&&"flex justify-start py-8",ke&&at&&"hidden justify-start py-8 lg:flex",ke&&!at&&"flex scroll-mt-[76px] justify-start pb-8 pt-6 lg:justify-start lg:py-8"),children:ke?e.jsxs("div",{className:"mx-auto w-full max-w-[460px]",children:[!rt&&e.jsx("div",{className:"mb-4 hidden lg:block",children:tt}),nt?.rail??tt]}):Oe?e.jsx(Un,{brandName:U.brandName,reducedMotion:G}):Fe?e.jsx(Wn,{elapsedMs:re??0,handle:he?.handle??"",onEditHandle:Ge,claimButton:et,onCustomize:()=>oe(!0)}):we&&!he?e.jsxs("div",{className:"mx-auto w-full max-w-[460px] text-center",children:[e.jsx("div",{className:"mx-auto inline-flex h-14 w-14 items-center justify-center rounded-full bg-foreground text-background",children:e.jsx(be,{className:"h-6 w-6 animate-spin","aria-hidden":!0})}),e.jsx("h2",{className:"mt-5 font-aeonik text-[26px] font-bold leading-[1.08] tracking-[-0.03em] text-foreground",children:"Building your storefrontâ¦"}),e.jsx("p",{className:"mt-3 text-[14.5px] text-muted-foreground",children:H.statusLine})]}):e.jsxs("div",{className:"mx-auto w-full max-w-[460px]",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-accent/10 px-2.5 py-1 text-[11.5px] font-semibold text-accent",children:[e.jsx(ge,{className:"h-3 w-3",strokeWidth:2.5,"aria-hidden":!0})," First draft ready"]}),e.jsx("h1",{className:"mt-4 font-aeonik text-[30px] font-bold leading-[1.05] tracking-[-0.03em] text-foreground",children:"Here's your first draft."}),e.jsx("p",{className:"mt-2.5 text-[14.5px] leading-[1.55] text-muted-foreground",children:"Tap any text on your page to edit it, or describe a change below."}),e.jsxs("div",{className:"mt-5",children:[e.jsx(xr,{onPureRefine:H.applyRefine,onModelRefine:H.refineWithInstruction,onRegenerate:H.regenerate,disabled:_e||je}),Ne&&e.jsxs("p",{className:"mt-2 text-[12.5px] text-muted-foreground",children:[Ne," Your page is unchanged."]})]}),e.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[e.jsxs("div",{className:"mb-3.5 flex flex-wrap items-center justify-between gap-2.5",children:[e.jsx("span",{className:"text-[12.5px] font-semibold text-foreground",children:"Your link"}),he&&e.jsx($n,{handle:he.handle,onChange:Ge,onCommit:()=>Ve("handle")}
1)]}),e.jsx("div",{className:"hidden lg:block",children:et})]})]})}),e.jsx("div",{style:{"--miy-bottom-bar-h":`${ze}px`},className:d("flex flex-col items-center overflow-y-auto bg-muted/40 px-5 pt-8 lg:px-12 lg:py-10",!he&&"justify-center","pb-[calc(var(--miy-bottom-bar-h)+1.5rem)] lg:pb-10",rt&&"border-t border-border lg:border-t-0"),children:ct})]}),ke?e.jsx("div",{ref:Le,className:d("fixed inset-x-0 bottom-0 z-40 border-t border-border bg-background/95 px-5 pt-3 backdrop-blur lg:hidden",We),children:nt?.bottomBar??e.jsx("div",{className:"flex items-center justify-center",children:tt})}):(Se||_e)&&!Oe&&e.jsx("div",{ref:Le,className:d("fixed inset-x-0 bottom-0 z-40 border-t border-border bg-background/95 px-5 pt-3 backdrop-blur lg:hidden",We),children:et})]})]})}const Tr="glintly_aha_viewed_slugs";function Er(e){try{const t=sessionStorage.getItem(Tr),n=t?JSON.parse(t):[];return!n.includes(e)&&(n.push(e),sessionStorage.setItem(Tr,JSON.stringify(n)),!0)}catch{return!0}}function Pr({slug:t,storefrontUrl:n,onShared:r,onViewStorefront:a,canEditLink:s,onEditLink:o,previewName:i,previewTagline:l,previewAvatarUrl:d,previewPersonName:c,previewVersion:u,hoursSummary:m,className:p}){return e.jsxs("section",{className:p,"aria-label":"Get your first booking",children:[m&&e.jsxs("p",{className:"mb-4 inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(ge,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400","aria-hidden":!0}),"Hours set ",m]}),e.jsx(St,{slug:t,storefrontUrl:n,previewName:i,previewTagline:l,previewAvatarUrl:d,previewPersonName:c,previewVersion:u,onShared:r,onViewStorefront:a,canEditLink:s,onEditLink:o})]})}const Rr={proof:"Know it works before anyone else sees it.",collect:"Takes about 3 minutes.",share:"One message is usually enough."};function Ar({storefrontUrl:t,onOwnPage:n,onDashboard:r,onBack:a,className:s}){return e.jsxs("div",{className:d("flex flex-col gap-2",s),children:[e.jsxs("div",{className:"flex items-center gap-2 lg:gap-3",children:[e.jsxs(u,{type:"button",variant:"secondary",size:"default",onClick:a,children:[e.jsx(Ke,{className:"mr-1 h-4 w-4","aria-hidden":!0}),"Back"]}),e.jsx(u,{asChild:!0,variant:"primary",size:"default",className:"flex-1",children:e.jsxs("a",{href:t,onClick:n,children:["Test your booking page",e.jsx(fe,{className:"ml-2 h-4 w-4","aria-hidden":!0})]})})]}),e.jsx("button",{type:"button",onClick:r,className:"inline-flex h-10 items-center justify-center rounded-md text-sm font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Go to my dashboard"})]})}const Mr=({className:t})=>e.jsx("ol",{className:d("divide-y divide-border overflow-hidden rounded-2xl border border-border bg-card",t),children:It.map((t,n)=>{const r=0===n;return e.jsxs("li",{"data-rung":t,"data-emphasis":r?"primary":"quiet",className:"flex gap-3 p-4",children:[e.jsx("span",{"aria-hidden":!0,className:d("mt-px inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full border font-mono text-[11px] tabular-nums",r?"border-transparent bg-foreground text-background":"border-border bg-background text-muted-foreground"),children:n+1}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:d("text-sm leading-6",r?"font-semibold text-foreground":"text-muted-foreground"),children:Tt[t].quiet}),e.jsx("p",{className:"mt-0.5 text-sm leading-relaxed text-muted-foreground",children:Rr[t]})]})]},t)})});function Dr({storefrontLabel:t}){return e.jsxs("div",{className:"animate-fade-in-blur",children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-emerald-500 text-white ring-[6px] ring-emerald-50 dark:ring-emerald-950/60",children:e.jsx(ge,{className:"h-6 w-6",strokeWidth:2.5})}),e.jsxs("h1",{className:"mt-4 font-aeonik text-[1.875rem] font-bold leading-[1] tracking-[-0.035em] text-foreground lg:text-[2.375rem]",children:[e.jsx("span",{className:"block",children:"Your page is live."}),e.jsx("span",{className:"block",children:"Three things left."})]}),e.jsxs("p",{className:"mt-3 text-sm text-muted-foreground",children:["Live at"," ",e.jsx("span",{className:"font-mono text-[13px] font-semibold text-foreground",children:t})]}),e.jsx("p",{className:"mt-4 max-w-md text-sm leading-relaxed text-muted-foreground",children:"Each one takes a minute, and each one earns you the next. We will keep them on your dashboard."}),e.jsx(Mr,{className:"mt-7 max-w-md"})]})}function Or({current:t,onSelect:n,steps:r=gr}){const a=r.findIndex(e=>e.id===t);return e.jsx("div",{className:"flex flex-wrap items-center justify-center gap-1.5 sm:flex-nowrap sm:justify-start",role:"group","aria-label":"Progress",children:r.map((r,s)=>{const o=r.id===t,i=s<a;return e.jsxs("button",{type:"button","aria-current":o?"step":void 0,"aria-label":r.label,onClick:()=>n(r.id),className:d("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold transition-colors",o?"bg-foreground text-background":"text-muted-foreground hover:text-foreground"),children:[e.jsx("span",{"aria-hidden":!0,
1className:d("inline-flex h-4 w-4 items-center justify-center rounded-full text-[10px] font-bold",o?"bg-background/20 text-background":i?"bg-foreground/15 text-foreground":"bg-muted text-muted-foreground"),children:i?e.jsx(ge,{className:"h-2.5 w-2.5",strokeWidth:3}):s+1}),e.jsx("span",{"aria-hidden":!0,className:d(o?"inline":"hidden sm:inline"),children:r.label})]},r.id)})})}function Fr({step:t,steps:n=gr,onNext:r,onBack:a,onOwnPage:o,onDashboard:i,onGoToStep:l,hours:c,earnings:m,storefrontUrl:p,onShared:x,onMarkShared:h,onViewStorefront:g,slugEditable:f,onEditLink:b,previewName:v,previewTagline:y,previewAvatarUrl:j,previewPersonName:N,previewVersion:k,storyCard:w,className:S}){const _=function(e){try{return new URL(e).pathname.replace(/^\/+/,"")}catch{return""}}(p),C=w??Ct({business_name:v??null,display_name:null,brand_type:null,tagline:y??null,description:null,avatar_path:null,persona_avatar_path:null,services:[]}),I=p.replace(/^https?:\/\//,""),T="done"===t?null:br(t,c.dirty),E="hours"===t&&(c.saving||c.dirty&&c.hasErrors),P=s.useRef(null),R=s.useRef(null),A=s.useRef(t);return s.useEffect(()=>{A.current!==t&&(A.current=t,R.current?.scrollIntoView?.({block:"start",behavior:"smooth"}),P.current?.focus({preventScroll:!0}))},[t]),e.jsxs("div",{ref:R,className:d("animate-fade-in",S),children:[e.jsx(Or,{current:t,steps:n,onSelect:l}),e.jsxs("div",{ref:P,tabIndex:-1,className:"mt-6 outline-none",children:["hours"===t&&c.body,"earnings"===t&&m,"
1send"===t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3.5 inline-flex items-center gap-2 text-emerald-600 dark:text-emerald-400",children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex h-6 w-6 items-center justify-center rounded-full bg-emerald-50 dark:bg-emerald-950",children:e.jsx(ge,{className:"h-3.5 w-3.5",strokeWidth:2.5})}),e.jsx("span",{className:"text-[13px] font-semibold",children:"You're live"})]}),e.jsx("h1",{className:"font-aeonik text-[1.875rem] font-bold leading-[1] tracking-[-0.035em] text-foreground lg:text-[2.375rem]",children:"Get your first booking"}),e.jsx("p",{className:"mt-3.5 max-w-md text-sm leading-relaxed text-muted-foreground",children:"It starts with a message to someone who already knows you."}),e.jsx("div",{className:"mt-6 max-w-md",children:e.jsx(Pr,{slug:_,storefrontUrl:p,previewName:v,previewTagline:y,previewAvatarUrl:j,previewPersonName:N,previewVersion:k,hoursSummary:c.enabled?c.summary:null,onShared:(e,t)=>{x?.(e,t),h?.()},onViewStorefront:g,canEditLink:Boolean(f&&b),onEditLink:b})})]}),"post"===t&&e.jsx("div",{className:"max-w-md",children:e.jsx(_t,{slug:_,storefrontUrl:p,card:C,onShared:h})}),"done"===t&&e.jsx(Dr,{storefrontLabel:I})]}),"done"===t?e.jsx("div",{className:"mt-7 hidden max-w-md lg:block",children:e.jsx(Ar,{storefrontUrl:p,onOwnPage:o,onDashboard:i,onBack:a})}):e.jsxs("div",{className:"mt-7 hidden max-w-md items-center gap-3 lg:flex",children:[e.jsxs(u,{type:"button",variant:"secondary",size:"default",onClick:a,children:[e.jsx(Ke,{className:"mr-1 h-4 w-4","aria-hidden":!0}),"Back"]}),e.jsxs(u,{type:"button",variant:"primary",size:"default",className:"flex-1",onClick:r,disabled:E,children:[T,e.jsx(fe,{className:"ml-2 h-4 w-4","aria-hidden":!0})]})]})]})}function Br(e){const t=Number(e.replace(/[^0-9.]/g,""));if(!Number.isFinite(t)||t<=0)return null;const n=Math.round(t);return n>=1?Math.min(n,1e6):null}function Lr({name:t,label:n,perSession:r,currentPrice:a,value:s,onChange:o}){const i=Br(s),l=e=>o(String(Math.max(1,(i??0)+e)));return e.jsxs("div",{children:[e.jsxs("p",{className:"truncate text-[14px] font-medium text-foreground",children:[t,r&&e.jsx("span",{className:"ml-1.5 text-[11px] font-normal text-muted-foreground",children:"/ session"})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2.5",children:[e.jsx("button",{type:"button","aria-label":`Decrease ${n} price`,onClick:()=>l(-5),disabled:(i??0)<=1,className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-input text-foreground transition-colors hover:bg-muted disabled:opacity-30 disabled:hover:bg-transparent",children:e.jsx(Qe,{className:"h-4 w-4","aria-hidden":!0})}),e.jsxs("div",{className:"relative flex flex-1 items-center",children:[e.jsx("span",{className:"pointer-events-none absolute left-3 text-[17px] font-semibold text-muted-foreground",children:"$"}),e.jsx("input",{inputMode:"decimal","aria-label":`Price for ${n}`,value:s,onChange:e=>o(e.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>o(String(Br(s)??a)),className:"w-full rounded-lg border border-input bg-background py-2 pl-7 pr-3 text-center text-[18px] font-semibold tabular-nums text-foreground focus:border-foreground focus:outline-none"})]}),e.jsx("button",{type:"button","aria-label":`Increase ${n} price`,onClick:()=>l(5),className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full border border-input text-foreground transition-colors hover:bg-muted",children:e.jsx(Xe,{className:"h-4 w-4","aria-hidden":!0})})]})]})}function zr({prices:t,values:n,setValue:r,previewRevenue:a,onDone:s}
1){const o=new Map;for(const e of t){const t=Br(n[e.serviceIndex]??String(e.currentPrice));null!==t&&o.set(e.serviceIndex,t)}const i=new Map;for(const e of t)i.set(e.name,(i.get(e.name)??0)+1);const l=new Map,d=new Map;for(const e of t)if((i.get(e.name)??0)<=1)l.set(e.serviceIndex,e.name);else{const t=(d.get(e.name)??0)+1;d.set(e.name,t),l.set(e.serviceIndex,`${e.name} ${t}`)}return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-4 grid gap-4",children:t.map(t=>e.jsx(Lr,{name:t.name,label:l.get(t.serviceIndex)??t.name,perSession:t.perSession,currentPrice:t.currentPrice,value:n[t.serviceIndex]??String(t.currentPrice),onChange:e=>r(t.serviceIndex,e)},t.serviceIndex))}),e.jsxs("p",{className:"mt-5 text-center text-[13px] text-muted-foreground","aria-live":"polite",children:[e.jsx("span",{className:"font-semibold text-foreground",children:(c=a(o),`$${c.toLocaleString("en-US")}`)})," a year"]}),e.jsx(u,{variant:"primary",size:"lg",onClick:s,className:"mt-4 w-full",children:"Done"})]});var c}function $r({prices:t,previewRevenue:n,onSave:r}){const a=Lt("(max-width: 768px)"),[o,i]=s.useState(!1),[l,d]=s.useState({}),c=s.useCallback((e,t)=>{d(n=>({...n,[e]:t}))},[]),m=s.useCallback(e=>{if(i(e),e)d(Object.fromEntries(t.map(e=>[e.serviceIndex,String(e.currentPrice)])));else{const e=new Map;for(const n of t){const t=Br(l[n.serviceIndex]??"");null!==t&&t!==n.currentPrice&&e.set(n.serviceIndex,t)}e.size>0&&r(e)}},[t,l,r]),p=e.jsxs(u,{type:"button",variant:"secondary",size:"sm",className:"mt-3 w-full",children:[e.jsx(pe,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),"Edit your prices"]}),x="Edit your prices",h="Raise or lower a price and watch your projected earnings change.",g=e.jsx(zr,{prices:t,values:l,setValue:c,previewRevenue:n,onDone:()=>m(!1)});return a?e.jsxs(At,{open:o,onOpenChange:m,children:[e.jsx(Mt,{asChild:!0,children:p}),e.jsxs(Dt,{className:"px-5 pb-[max(1.25rem,env(safe-area-inset-bottom))] pt-2",children:[e.jsx(Ot,{className:"text-lg font-bold tracking-tight",children:x}),e.jsx(Ft,{className:"mt-0.5 text-xs text-muted-foreground",children:h}),g]})]}):e.jsxs(P,{open:o,onOpenChange:m,children:[e.jsx(R,{asChild:!0,children:p}),e.jsxs(A,{className:"sm:max-w-md",children:[e.jsx(M,{children:x}),e.jsx(D,{className:"text-xs text-muted-foreground",children:h}),g]})]})}function Wr({label:t,hint:n,value:r,display:a,min:s,max:o,step:i,onChange:l}){const d=o>s?(r-s)/(o-s)*100:0,c=`linear-gradient(to right, hsl(var(--accent)) 0%, hsl(var(--accent)) ${d}%, hsl(var(--muted-foreground) / 0.22) ${d}%, hsl(var(--muted-foreground) / 0.22) 100%)`;return e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-[13px] font-semibold text-foreground",children:t}),e.jsx("span",{className:"font-aeonik text-[15px] font-bold tabular-nums text-foreground",children:a})]}),e.jsx("div",{className:"-my-1.5 py-1.5",children:e.jsx("input",{type:"range",min:s,max:o,step:i,value:r,onChange:e=>l(Number(e.target.value)),"aria-label":t,style:{background:c},className:"earnings-range w-full"})}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:n})]})}function Ur(e,t,n){const r=L.fixed/100,a=50*t,s=a*e,o=a*Math.max(0,e*(L.percentage+n)+r),i=Math.max(0,s-o),l=Math.round(s),d=Math.round(o),c=Math.round(.3*i);return{annualRevenue:l,annualFees:d,annualTax:c,annualTakeHome:Math.max(0,l-d-c)}}function Yr(e){const t=e.sessionCount;return"package"===e.fulfillmentType&&null!=t&&t>0?{price:Math.round(e.price/t),perSession:!0}:{price:Math.round(e.price),perSession:!1}}function Hr(e){return+(100*e).toFixed(2)+"%"}function Kr({platformRate:t,isOnTrial:n,postTrialRate:r}){const a=n&&r!==t;return e.jsxs(Et,{children:[e.jsx(Pt,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":"How platform and Stripe fees work",className:"-m-1.5 inline-flex items-center p-1.5 text-muted-foreground/70 transition-colors hover:text-foreground",children:e.jsx(Ze,{className:"h-3.5 w-3.5","aria-hidden":!0})})}),e.jsxs(Rt,{align:"start",className:"w-72 text-[13px]",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"How fees work"}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Taken out of each booking:"}),e.jsxs("dl",{className:"mt-2.5 grid gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Platform fee"}),e.jsx("dd",{className:"font-medium tabular-nums text-foreground",children:Hr(t)})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Stripe"}),e.jsxs("dd",{className:"font-medium tabular-nums text-foreground",children:[Hr(L.percentage)," + ",L.fixed,"¢"]})]})]}),a&&e.jsxs("p",{className:"mt-2.5 border-t border-border pt-2.5 text-[12px] leading-relaxed text-muted-foreground",children:[Hr(t)," is your ",z,"-day Pro-trial rate, then"," ",Hr(r)," after (or keep ",Hr(t)," on Pro)."]})]})]})}
1function Vr(e){return`$${e.toLocaleString("en-US")}`}function Gr({label:t,amount:n,negative:r,strong:a}){return e.jsxs("div",{className:qr(a),children:[e.jsx("span",{className:a?"font-semibold text-foreground":"text-muted-foreground",children:t}),e.jsx("span",{className:a?"font-aeonik text-[15px] font-bold tabular-nums text-foreground":"tabular-nums text-foreground",children:r?`â${n}`:n})]})}function qr(e){return e?"flex items-baseline justify-between gap-3 border-t border-border pt-2.5 text-[14px]":"flex items-baseline justify-between gap-3 text-[13.5px]"}function Jr({services:t,onEditPrice:n,editableServiceIndices:r}){const a=function(e){const{organization:t}=O(),n=null!=t?.platformFeeBps?t.platformFeeBps/1e4:F.free,r=t?.isOnTrial??!1,a=t?B[t.planTier]/1e4:F.free,o=s.useMemo(()=>e.map((e,t)=>({s:e,serviceIndex:t})).filter(({s:e})=>{return!("fixed"!==(t=e).pricingType||t.isFree||!Number.isFinite(t.price)||t.price<=0)&&("package"!==t.fulfillmentType||null!=t.sessionCount&&t.sessionCount>0);var t}).map(({s:e,serviceIndex:t})=>({name:e.name,serviceIndex:t,...Yr(e)})),[e]),i=o.length>0,l=s.useMemo(()=>{return i?Math.round((e=o.map(e=>e.price)).reduce((e,t)=>e+t,0)/e.length):100;var e},[o,i]),[d,c]=s.useState(20),{annualRevenue:u,annualFees:m,annualTax:p,annualTakeHome:x}=s.useMemo(()=>Ur(l,d,n),[d,l,n]);return{eligible:i,basis:o,avgBooking:l,bookingsPerWeek:d,setBookingsPerWeek:c,annualRevenue:u,annualFees:m,annualTax:p,annualTakeHome:x,platformRate:n,isOnTrial:r,postTrialRate:a}}(t),{track:o}=y(),i=n?a.basis.filter(e=>r?.has(e.serviceIndex)).map(e=>({serviceIndex:e.serviceIndex,name:e.name,currentPrice:e.price,perSession:e.perSession})):[],l=s.useRef(a.bookingsPerWeek),d=s.useRef(0),c=s.useRef({bookings:a.bookingsPerWeek,takeHome:a.annualTakeHome});s.useEffect(()=>{c.current={bookings:a.bookingsPerWeek,takeHome:a.annualTakeHome}});const u=s.useRef(!1);return s.useEffect(()=>{if(u.current)return;u.current=!0;const e=l.current;return o(j.EARNINGS_STEP_VIEWED,{eligible:a.eligible,avg_booking:a.avgBooking,bookings_per_week:a.bookingsPerWeek,projected_revenue:a.annualRevenue,projected_take_home:a.annualTakeHome,platform_rate:a.platformRate}),()=>{if(0===d.current)return;const{bookings:t,takeHome:n}=c.current;o(j.EARNINGS_ADJUSTED,{slider:"bookings",final_bookings_per_week:t,final_take_home:n,adjust_count:d.current,direction:t>e?"up":t<e?"down":"flat"})}},[]),e.jsxs("div",{className:"max-w-md",children:[e.jsxs("div",{className:"mb-3.5 inline-flex items-center gap-2 text-accent",children:[e.jsx("span",{"aria-hidden":!0,className:"inline-flex h-6 w-6 items-center justify-center rounded-full bg-accent/10",children:e.jsx(Re,{className:"h-3.5 w-3.5",strokeWidth:2.5})}),e.jsx("span",{className:"text-[13px] font-semibold",children:a.eligible?"Your potential":"Example"})]}),e.jsx("h1",{className:"font-aeonik text-[1.875rem] font-bold leading-[1.05] tracking-[-0.035em] text-foreground lg:text-[2.25rem]",children:"Now, what it could earn you."}),e.jsxs("div",{className:"mt-5 rounded-[16px] border border-border bg-card p-5",children:[e.jsxs("p",{className:"font-aeonik text-[2.5rem] font-bold leading-none tracking-[-0.04em] text-foreground",children:[Vr(a.annualRevenue),e.jsx("span",{className:"ml-1.5 text-[15px] font-semibold text-muted-foreground",children:"a year"})]}),e.jsxs("p",{className:"mt-2 text-[13.5px] text-muted-foreground",children:[a.bookingsPerWeek," bookings a week à ",Vr(a.avgBooking)," average booking à 50 weeks",a.eligible?", at your prices.":" (example)."]}),e.jsxs("div",{className:"mt-4 grid gap-2",children:[e.jsx(Gr,{label:"Revenue",amount:Vr(a.annualRevenue)}),e.jsx(Gr,{label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Platform + Stripe fees",e.jsx(Kr,{platformRate:a.platformRate,isOnTrial:a.isOnTrial,postTrialRate:a.postTrialRate})]}),amount:Vr(a.annualFees),negative:!0}),e.jsx(Gr,{label:"Set aside for taxes (~30%)",amount:Vr(a.annualTax),negative:!0}),e.jsx(Gr,{label:"You keep",amount:Vr(a.annualTakeHome),strong:!0})]})]}),e.jsx("div",{className:"mt-5",children:e.jsx(Wr,{label:"Total bookings a week",hint:"Everyone at your business who takes bookings. About 15 to 25 bookings a week per person.",value:a.bookingsPerWeek,display:`${a.bookingsPerWeek}`,min:1,max:120,step:1,onChange:e=>{d.current+=1,a.setBookingsPerWeek(e)}})}),a.eligible&&e.jsxs("div",{className:"mt-5 rounded-[14px] border border-border bg-muted/30 p-4",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("p",{className:"text-[12px] font-semibold uppercase tracking-[0.08em] text-muted-foreground",children:"Your prices"}),e.jsxs("p",{className:"text-[12px] text-muted-foreground",children:[Vr(a.avgBooking)," average booking"]})]}),e.jsx("ul",{className:"mt-2.5 grid gap-1",children:a.basis.slice(0,4).map((t,n)=>e.jsxs("li",{className:"flex items-baseline justify-between gap-3 text-[13.5px]",children:[e.jsx("span",{className:"truncate text-foreground",children:t.name}),e.jsxs("span",{className:"whitespace-nowrap font-semibold tabular-nums text-foreground",children:[Vr(t.price),t.perSession&&e.jsx("span",{className:"ml-1 font-normal text-muted-foreground",children:"/ session"})]})]},`${t.name}-${n}`))}),a.basis.length>4&&e.jsxs("p",{className:"mt-2 text-[12px] text-muted-foreground",children:["plus ",a.basis.length-4," more, all counted in the average"]}),i.length>0&&n?e.jsx($r,{prices:i,previewRevenue:e=>{const t=a.basis.map(t=>
1e.get(t.serviceIndex)??t.price);return Ur(t.length?Math.round(t.reduce((e,t)=>e+t,0)/t.length):0,a.bookingsPerWeek,a.platformRate).annualRevenue},onSave:e=>e.forEach((e,t)=>n(t,e))}):null]}),e.jsx("p",{className:"mt-4 text-[12px] leading-relaxed text-muted-foreground",children:"An estimate from a schedule you set and your own prices, not a guarantee of income. What you actually earn depends on how many clients you book. Set aside for taxes and costs, and raising your prices or your booked days is how the take-home grows."})]})}const Qr=["15","30","45","60","90","120"],Xr=[{value:"video",label:"Video"},{value:"phone",label:"Phone"},{value:"in_person",label:"In person"}],Zr=e=>d("rounded-[10px] border px-2 py-2 text-[13px] font-semibold transition-colors",e?"border-foreground bg-foreground text-background":"border-border bg-card text-foreground hover:bg-muted/60");function ea({state:t,set:n}){const{type:r,name:a,price:s,duration:o,sessions:i,format:l}=t;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 gap-2",role:"group","aria-label":"Service type",children:["session","package"].map(t=>e.jsx("button",{type:"button","aria-pressed":r===t,onClick:()=>n("type",t),className:d(Zr(r===t),"capitalize"),children:t},t))}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-add-name",children:"Name"}),e.jsx(W,{id:"miy-add-name",autoComplete:"off",value:a,onChange:e=>n("name",e.target.value),placeholder:"e.g. Strategy Intensive"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-add-price",children:"Price"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),e.jsx(W,{id:"miy-add-price",type:"number",min:0,className:"pl-7",value:s,onChange:e=>n("price",e.target.value)})]})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"package"===r?"miy-add-sessions":"miy-add-duration",children:"package"===r?"Sessions":"Duration (min)"}),"package"===r?e.jsx(W,{id:"miy-add-sessions",type:"number",min:2,value:i,onChange:e=>n("sessions",e.target.value)}):e.jsx("select",{id:"miy-add-duration",value:o,onChange:e=>n("duration",e.target.value),className:"h-10 rounded-[10px] border border-border bg-card px-3 text-sm text-foreground",children:Qr.map(t=>e.jsxs("option",{value:t,children:[t," min"]},t))})]})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{children:"How you meet"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",role:"group","aria-label":"How you meet",children:Xr.map(t=>e.jsx("button",{type:"button","aria-pressed":l===t.value,onClick:()=>n("format",t.value),className:Zr(l===t.value),children:t.label},t.value))})]})]})}function ta(e){const t=e.detail.originalEvent.target;return t instanceof Element&&null!==t.closest("[data-radix-popper-content-wrapper]")}function na({children:t,className:n}){const r=s.useRef(null),a=s.useRef(null),[o,i]=s.useState(!1),l=s.useCallback(()=>{const e=r.current;e&&i(e.scrollHeight-e.scrollTop-e.clientHeight>8)},[]);return s.useLayoutEffect(l),s.useEffect(()=>{const e=a.current;if(!e)return;const t=new ResizeObserver(l);return t.observe(e),()=>t.disconnect()},[l]),e.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[e.jsx("div",{ref:r,onScroll:l,className:d("min-h-0 flex-1 overflow-y-auto",n),children:e.jsx("div",{ref:a,children:t})}),e.jsx("div",{"aria-hidden":!0,className:d("pointer-events-none absolute inset-x-0 bottom-0 z-10 h-12 bg-gradient-to-t from-background via-background to-transparent transition-opacity duration-200",o?"opacity-100":"opacity-0")})]})}function ra({open:t,onOpenChange:n,title:r,description:a,children:s,footer:o}){return zt()?e.jsx(At,{open:t,onOpenChange:n,children:e.jsxs(Dt,{className:"flex max-h-[92svh] flex-col overflow-hidden",onPointerDownOutside:e=>{ta(e)&&e.preventDefault()},children:[e.jsxs(Bt,{className:"shrink-0 text-left",children:[e.jsx(Ot,{className:"font-aeonik text-[22px] font-bold tracking-[-0.02em]",children:r}),e.jsx(Ft,{className:"text-[13.5px] leading-[1.5]",children:a})]}),e.jsx(na,{className:"px-4",children:s}),o&&e.jsx("div",{className:"shrink-0 border-t border-border px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-3",children:o})]})}):e.jsx(P,{open:t,onOpenChange:n,children:e.jsxs(A,{className:"flex max-h-[88vh] max-w-[440px] flex-col gap-0 overflow-hidden",onInteractOutside:e=>{ta(e)&&e.preventDefault()},children:[e.jsxs(U,{className:"shrink-0 pb-4",children:[e.jsx(M,{className:"font-aeonik text-[22px] font-bold tracking-[-0.02em]",children:r}),e.jsx(D,{className:"text-[13.5px] leading-[1.5]",children:a})]}),e.jsx(na,{children:s}),o&&e.jsx("div",{className:"shrink-0 border-t border-border pt-3",children:o})]})})}
1function aa(e,t){return{...e,services:e.services.filter((e,n)=>n!==t)}}function sa(e){const t="package"===e.fulfillmentType,n=e.includes.map(e=>e.trim()).filter(Boolean),r=e.idealFor.map(e=>e.trim()).filter(Boolean),a={};return n.length>0&&(a.includes=n),r.length>0&&(a.ideal_for=r),t&&e.sessionCount&&(a.session_count=e.sessionCount),{name:e.name,description:e.description||void 0,unit_amount:H(e.price,"USD"),currency:"USD",duration_minutes:e.durationMinutes,service_type:"session",fulfillment_type:t?"package":"session",...Object.keys(a).length>0?{metadata:a}:{}}}function oa(e,t){return{...sa(e),storefront_id:t.storefrontId,meeting_format:t.meetingFormat,meeting_location:t.meetingLocation?.trim()||void 0}}function ia(e){return sa(e)}const la=$t({text:Wt().min(1)}),da=$t({service:V}),ca=$t({services:Ut(V).min(1)}),ua="We couldn't do that just now. Please try again.";class ma extends Error{}async function pa(e,t){let n,r;try{const t=K().getDistinctId(),{data:a}=await g.auth.getSession(),s=a.session?.access_token,o=await async function(e){let t;try{return await Promise.race([e,new Promise((e,n)=>{t=setTimeout(()=>n(new ma),3e4)})])}finally{t&&clearTimeout(t)}}(g.functions.invoke("generate-storefront",{body:{...e,...t?{distinct_id:t}:{}},...s?{headers:{Authorization:`Bearer ${s}`}}:{}}));n=o.error,r=o.data}catch(as){return b.error("AI action request threw",{action:e.action,error:as instanceof Error?as.message:String(as)}),{status:"error",message:ua}}if(n)return b.error("AI action failed",{action:e.action,error:n instanceof Error?n.message:String(n)}),{status:"error",message:ua};const a=t.safeParse(r);return a.success?{status:"ok",data:a.data}:(b.error("AI action response failed validation",{action:e.action,issues:a.error.issues.length}),{status:"error",message:ua})}function xa(){const[e,t]=s.useState(!1),[n,r]=s.useState(null),a=s.useCallback(async function(e){t(!0),r(null);try{const t=await e();return"ok"===t.status?t.data:(r(t.message),null)}finally{t(!1)}},[]),o=s.useCallback(e=>a(()=>function(e){return pa({...e},la)}(e)).then(e=>e?.text??null),[a]),i=s.useCallback(e=>a(()=>function(e){return pa({...e},da)}(e)).then(e=>e?.service??null),[a]),l=s.useCallback(e=>a(()=>function(e){return pa({...e},ca)}(e)).then(e=>e?.services??null),[a]);return{pending:e,error:n,clearError:s.useCallback(()=>r(null),[]),rewriteText:o,addService:i,redoServices:l}}const ha=e=>["miy-live-services",e],ga=e=>e.trim().toLowerCase();function fa(e,t){const n=function(e,t){const n=new Map;for(const r of t){const e=ga(r.name),t=n.get(e);t?t.push(r):n.set(e,[r])}return e.length===t.length?t.slice():e.map(e=>(e=>{const t=n.get(ga(e));return t&&1===t.length?t[0]:null})(e.name))}(e,t),r=new Set,a=[];return e.forEach((e,t)=>{n[t]?r.add(t):a.push(t)}),{pairings:n,editableIndices:r,ambiguousIndices:a}}function ba(e,t){return e instanceof G?e.userMessage||e.message:t}function va(e){const n=t(),[a,o]=s.useState(!1),[l,d]=s.useState(!1),c=()=>n.invalidateQueries({queryKey:ha(e)}),u=r({mutationFn:({id:e,data:t})=>pt(e,t),onSuccess:()=>{c()},onError:e=>{b.error("MIY: service save failed",{error:e}),i.error(ba(e,"We could not save this service. Please try again."))}}),m=r({mutationFn:e=>xt(e),onSuccess:()=>{c()},onError:e=>{b.error("MIY: service create failed",{error:e}),i.error(ba(e,"We could not add this service. Please try again."))}});return{create:async e=>{try{return await m.mutateAsync(e)}catch{return null}},save:async(e,t)=>{try{return await u.mutateAsync({id:e,data:t})}catch{return null}},remove:async e=>{o(!0);try{return await ht(e),await c(),"deleted"}catch(t){if(t instanceof G&&t.code===q.SERVICE_HAS_BOOKINGS)try{return await pt(e,{is_active:!1}),await c(),"deactivated"}catch(n){return b.error("MIY: service deactivate failed",{error:n}),i.error(ba(n,"We could not remove this service.")),null}return b.error("MIY: service delete failed",{error:t}),i.error(ba(t,"We could not remove this service.")),null}finally{o(!1)}},applyRedo:async(e,t)=>{d(!0);try{for(const t of e.updates)await pt(t.id,ia(t.service));for(const n of e.creates)await xt(oa(n,{storefrontId:t.storefrontId,meetingFormat:t.createMeetingFormat}));for(const t of e.deactivations)await pt(t,{is_active:!1});return!0}catch(n){return b.error("MIY: redo services failed",{error:n}),i.error("Something failed partway. Review your services, some changes may have applied."),!1}finally{await c(),d(!1)}},creating:m.isPending,saving:u.isPending,removing:a,redoing:l}}const ya={type:"session",name:"",price:"0",duration:"60",sessions:"6",format:"video"};function ja({open:t,onOpenChange:n,ctx:r,onReviewed:a}){const{track:o}=y(),i=r.liveTarget.storefrontId,l=va(i),{addService:d,pending:c,error:m}=xa(),[p,x]=s.useState(ya),h=c||l.creating;return e.jsx(ra,{open:t,onOpenChange:e=>n(e),title:"Add a service",description:"Give us the facts. Glintly writes the description and what's included. You can edit every word after.",children:e.jsxs("div",{className:"grid gap-4 pb-1",children:[e.jsx(ea,{state:p,set:(e,t)=>x(n=>({...n,[e]:t}))}),m&&e.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:m}),e.jsx(u,{type:"button",size:"default",className:"mt-1",disabled:h||!p.name.trim(),onClick:()=>{(async()=>
1{if(!p.name.trim()||h)return;const e="package"===p.type?Math.max(2,Number(p.sessions)||6):void 0,t=await d({action:"add_service",type:p.type,name:p.name.trim(),price:Math.max(0,Number(p.price)||0),durationMinutes:Number(p.duration)||60,meetingFormat:p.format,...e?{sessionCount:e}:{},context:{role:r.generated.role,businessName:r.generated.businessName}});t&&await l.create(oa(t,{storefrontId:i,meetingFormat:p.format}))&&(r.applyRefine(e=>function(e,t){return{...e,services:[...e.services,t]}}(e,t)),o(J.MIY_SERVICE_ADDED,{type:p.type}),a(),x(ya),n(!1))})()},children:h?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0})," Writing your service"]}):"Add service"})]})})}const Na=[{id:"shorter",label:"Shorter",instruction:"Make it shorter and punchier."},{id:"warmer",label:"Warmer",instruction:"Make it warmer and more personable."},{id:"more_detail",label:"More detail",instruction:"Add a little more specific detail."},{id:"confident",label:"More confident",instruction:"Make it more confident and self-assured, without inventing any facts."}];function ka({field:t,getValue:n,onApply:r,context:a}){const o=function({field:e,getValue:t,onApply:n,context:r}){const{track:a}=y(),{rewriteText:o,pending:i,error:l,clearError:d}=xa(),[c,u]=s.useState(!1),[m,p]=s.useState(""),[x,h]=s.useState(null),g=s.useCallback(e=>{u(e),e||d()},[d]),f=s.useCallback(async(s,l)=>{const d=t().trim();if(!d||!l.trim()||i)return;const c=await o({action:"rewrite_text",text:d,instruction:l,field:e,context:r});null!==c&&(h(d),n(c),a(J.MIY_REWRITE_USED,{direction:s,field:e}),p(""),u(!1))},[t,i,o,e,r,n,a]),b=s.useCallback(()=>{null!==x&&(n(x),h(null),a(J.MIY_REWRITE_UNDONE,{field:e}))},[x,n,a,e]);return{open:c,onOpenChange:g,freeform:m,setFreeform:p,pending:i,error:l,undoSnapshot:x,run:f,undo:b}}({field:t,getValue:n,onApply:r,context:a});
1return null!==o.undoSnapshot?e.jsxs("button",{type:"button",onClick:o.undo,className:"inline-flex items-center gap-1 text-[12px] font-semibold text-muted-foreground underline-offset-4 hover:text-foreground hover:underline",children:[e.jsx(Je,{className:"h-3 w-3","aria-hidden":!0})," Undo rewrite"]}):e.jsxs(Et,{open:o.open,onOpenChange:o.onOpenChange,children:[e.jsx(Pt,{asChild:!0,children:e.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-full border border-border bg-card px-2.5 py-1 text-[12px] font-semibold text-foreground transition-colors hover:bg-muted/60",children:[e.jsx(ce,{className:"h-3 w-3","aria-hidden":!0})," Rewrite"]})}),e.jsxs(Rt,{role:"group","aria-label":"Rewrite this text",align:"end",sideOffset:6,collisionPadding:12,className:"w-64 p-3",children:[e.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Na.map(t=>e.jsx("button",{type:"button",disabled:o.pending,onClick:()=>{o.run(t.id,t.instruction)},className:"rounded-[9px] border border-border bg-card px-2 py-1.5 text-[12.5px] font-medium text-foreground transition-colors hover:bg-muted/60 disabled:opacity-50",children:t.label},t.id))}),e.jsx("p",{className:"mb-1.5 mt-3 text-[11.5px] font-medium text-muted-foreground",children:"Or say it yourself"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(W,{value:o.freeform,onChange:e=>o.setFreeform(e.target.value),onKeyDown:e=>{"Enter"===e.key&&o.freeform.trim()&&!o.pending&&(e.preventDefault(),o.run("freeform",o.freeform))},placeholder:"e.g. mention I coach in Spanish",disabled:o.pending,className:"h-8 text-[13px]"}),e.jsx(u,{type:"button",size:"sm",disabled:o.pending||!o.freeform.trim(),onClick:()=>{o.run("freeform",o.freeform)},children:o.pending?e.jsx(be,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):"Go"})]}),o.pending&&e.jsxs("p",{role:"status",className:"mt-2 inline-flex items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx(be,{className:"h-3 w-3 animate-spin","aria-hidden":!0})," Rewriting..."]}),o.error&&e.jsx("p",{className:"mt-2 text-[12px] text-destructive",children:o.error})]})]})}const wa=$t({name:Wt().max(80,"Keep your name under 80 characters."),profession:Wt().max(80,"Keep your profession under 80 characters."),tagline:Wt().max(200,"Keep your tagline under 200 characters."),about:Wt().max(1200,"Keep your about under 1200 characters.")});function Sa({open:t,onOpenChange:n,ctx:r}){const{track:s}=y(),{generated:o}=r,i=bn(o),l={name:i?fn(o):o.businessName,profession:o.role,tagline:o.headline,about:o.about},{register:d,handleSubmit:c,reset:m,getValues:p,setValue:x,setError:h,formState:{errors:g}}=a({resolver:Vt(wa),values:l}),f={role:o.role,businessName:o.businessName},b=()=>{m(l),n(!1)};return e.jsx(ra,{open:t,onOpenChange:e=>e?n(!0):b(),title:"Your details",description:"Everything at the top of your page, in one place. Type over anything the AI wrote.",children:e.jsxs("form",{onSubmit:c(e=>{if(i&&!e.name.trim())return void h("name",{message:"Add a name so your page has a heading."});const t=[];e.name!==l.name&&t.push("name"),e.profession!==l.profession&&t.push("profession"),e.tagline!==l.tagline&&t.push("tagline"),e.about!==l.about&&t.push("about"),0!==t.length?(r.applyRefine(t=>{let n=i?Cn(t,e.name):_n(t,e.name);return n=In(n,e.profession),n=Tn(n,e.tagline),n=En(n,e.about),n}),s(J.MIY_DETAILS_SAVED,{fields_changed:t}),n(!1)):n(!1)}),className:"mt-1 grid gap-4 pb-1",children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-name",children:"Name"}),e.jsx(W,{id:"miy-name",autoComplete:"off","aria-invalid":!!g.name||void 0,...d("name")}),g.name&&e.jsx("p",{role:"alert",className:"text-[12px] text-destructive",children:g.name.message})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-profession",children:"Profession"}),e.jsx(W,{id:"miy-profession",autoComplete:"off",maxLength:80,"aria-invalid":!!g.profession||void 0,...d("profession")}),g.profession&&e.jsx("p",{role:"alert",className:"text-[12px] text-destructive",children:g.profession.message})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx($,{htmlFor:"miy-tagline",children:"Tagline"}),e.jsx(ka,{field:"tagline",getValue:()=>p("tagline"),onApply:e=>x("tagline",e,{shouldDirty:!0}),context:f})]}),e.jsx(W,{id:"miy-tagline",autoComplete:"off",maxLength:200,"aria-invalid":!!g.tagline||void 0,...d("tagline")}),g.tagline&&e.jsx("p",{role:"alert",className:"text-[12px] text-destructive",children:g.tagline.message})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx($,{htmlFor:"miy-about",children:"About"}),e.jsx(ka,{field:"about",getValue:()=>p("about"),onApply:e=>x("about",e,{shouldDirty:!0}),context:f})]}),e.jsx(Gt,{id:"miy-about",rows:4,maxLength:1200,"aria-invalid":!!g.about||void 0,...d("about")}),g.about&&e.jsx("p",{role:"alert",className:"text-[12px] text-destructive",children:g.about.message})]}),e.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2.5",children:[e.jsx(u,{type:"button",variant:"secondary",size:"default",onClick:b,children:"Cancel"}),e.jsx(u,{type:"submit",size:"default",children:"Save changes"})]})]})})}function _a({label:t,index:n,state:r,onClick:a}){const s=e.jsxs(e.Fragment,{children:[e.jsx("span",{className:d("relative z-10 flex h-7 w-7 items-center justify-center rounded-full border text-[12px] font-semibold transition-colors","done"===r?"border-emerald-500 bg-emerald-500 text-white":"active"===r?"border-foreground bg-background text-foreground":"border-border bg-background text-muted-foreground"),children:"done"===r?e.jsx(ge,{className:"h-3.5 w-3.5",
1strokeWidth:3,"aria-hidden":!0}):n}),e.jsx("span",{className:d("text-[11px] font-medium","todo"===r?"text-muted-foreground":"text-foreground"),children:t})]});return a?e.jsx("button",{type:"button",onClick:a,"aria-label":`Go to ${t}`,className:"flex flex-1 flex-col items-center gap-1.5 rounded-[10px] py-1 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:s}):e.jsx("div",{className:"flex flex-1 flex-col items-center gap-1.5 py-1",children:s})}const Ca=["Two quick steps","Halfway there","Ready to share"];function Ia({guide:t,hasEditableServices:n,onAddService:r,onRedoServices:a,onAddPhoto:s,canUpload:o,className:i}){const l=(e,t)=>e?"done":t?"active":"todo",c=t.currentStep,m=e=>t.canVisitStep(e)?()=>t.goToStep(e):void 0,p="identity"===c?"Skip for now":"Skip, share as is",x="identity"===c?t.skipStep:t.skipAll;return e.jsxs("div",{className:d("animate-fade-in-blur",i),children:[e.jsx("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 text-[11.5px] font-semibold text-muted-foreground",children:Ca[t.completedCount]}),e.jsx("h1",{className:"mt-3 font-aeonik text-[30px] font-bold leading-[1.05] tracking-[-0.03em] text-foreground",children:"Make it yours."}),e.jsx("p",{className:"mt-2.5 max-w-md text-[14.5px] leading-[1.55] text-muted-foreground",children:"We built you a starting point. Add your photo, make the words yours, and itâs ready to share."}),e.jsxs("div",{className:"relative mt-6",children:[e.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-[18px] mx-[16.666%] -translate-y-1/2",children:[e.jsx("div",{className:"h-[2px] w-full rounded-full bg-border"}),e.jsx("div",{className:"absolute inset-y-0 left-0 rounded-full bg-emerald-500 transition-[width] duration-300",style:{width:100*t.trackFill+"%"}})]}),e.jsxs("div",{className:"relative flex items-start gap-2",children:[e.jsx(_a,{label:"You",index:1,state:l(t.photoDone,"identity"===c),onClick:m("identity")}),e.jsx(_a,{label:"Services",index:2,state:l(t.servicesDone,"services"===c),onClick:m("services")}),e.jsx(_a,{label:"Share",index:3,state:l(!1,"share"===c),onClick:m("share")})]})]}),e.jsxs("div",{className:"mt-6",children:["identity"===c&&e.jsxs("div",{className:"rounded-[13px] border border-border bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-bold text-foreground",children:t.photoDone?"Looking good.":"Add your photo"}),e.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:t.photoDone?"Your photo is in. Fine-tune your name and words any time, or move on.":"Clients book faster when they see who theyâre meeting. Add your photo, then make the words yours."}),t.photoDone&&e.jsxs(u,{type:"button",size:"default",className:"mt-3 w-full",onClick:()=>t.goToStep("services"),children:["Next ",e.jsx(He,{className:"ml-1 h-4 w-4","aria-hidden":!0})]}),e.jsxs(u,{type:"button",variant:t.photoDone?"secondary":"primary",size:"default",className:"mt-2 w-full",disabled:!o,"aria-label":t.photoDone?"Replace your photo":"Add your photo",onClick:s,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":!0}),t.photoDone?"Replace your photo":"Add your photo"]}),!o&&e.jsx("p",{role:"status",className:"mt-2 text-center text-[12.5px] text-muted-foreground",children:"Getting your account readyâ¦"}),e.jsxs(u,{type:"button",variant:"secondary",size:"default",className:"mt-2 w-full",onClick:()=>t.open("details"),children:[e.jsx(pe,{className:"mr-2 h-4 w-4","aria-hidden":!0})," Edit name and details"]})]}),"services"===c&&e.jsxs("div",{className:"rounded-[13px] border border-border bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-bold text-foreground",children:"Review your services"}),e.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:n?"Tap any service to edit it, then confirm the list looks right.":"Add a session, or describe what you offer and we will rebuild the list."}),e.jsx(u,{type:"button",variant:"primary",size:"default",className:"mt-3 w-full",onClick:t.confirmServicesAndShare,children:"Looks good"}),e.jsxs("div",{className:"mt-2 grid gap-2",children:[e.jsxs(u,{type:"button",variant:"secondary",size:"default",onClick:r,children:[e.jsx(Xe,{className:"mr-2 h-4 w-4","aria-hidden":!0})," Add a service"]}),e.jsx("button",{type:"button",onClick:a,className:"w-full rounded-lg px-3 py-2.5 text-center text-[12.5px] font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Not what you actually offer? Describe your services."})]})]}),"share"===c&&e.jsxs("div",{className:"rounded-[13px] border border-border bg-card p-4",children:[e.jsx("div",{className:"text-[15px] font-bold text-foreground",children:"Your page is ready."}),e.jsx("p",{className:"mt-1 text-[13px] text-muted-foreground",children:"Next, share it to get your first booking."}),e.jsxs(u,{type:"button",size:"default",className:"mt-3 w-full",onClick:t.goShare,children:["Next ",e.jsx(He,{className:"ml-1 h-4 w-4","aria-hidden":!0})]})]})]}),e.jsxs("div",{className:"mt-5 flex items-center",children:[t.onBack&&e.jsxs("button",{type:"button",onClick:t.onBack,className:"inline-flex items-center gap-1 text-[13px] font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline",children:[e.jsx(Ke,{className:"h-3.5 w-3.5","aria-hidden":!0})," Back"]}),"share"!==c&&x&&e.jsx("button",{type:"button",onClick:x,className:"ml-auto text-[13px] font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline",children:p})]})]})}function Ta({dotState:t,fillRatio:n,className:r}){return e.jsxs("span",{className:d("relative flex w-11 flex-shrink-0 items-center justify-between",r),"aria-hidden":!0,
1children:[e.jsx("span",{className:"absolute inset-x-[3px] top-1/2 h-px -translate-y-1/2 rounded-full bg-border"}),e.jsx("span",{className:"absolute left-[3px] top-1/2 h-px -translate-y-1/2 rounded-full bg-accent transition-[width] duration-300",style:{width:`calc((100% - 6px) * ${n})`}}),t.map((t,n)=>e.jsx("span",{className:d("relative z-10 h-1.5 w-1.5 rounded-full","done"===t?"bg-emerald-500":"active"===t?"bg-foreground":"bg-border")},n))]})}function Ea({guide:t,onAddPhoto:n,canUpload:r,dotState:a}){return e.jsxs("div",{className:"rounded-[15px] border border-border bg-card p-4 shadow-sm",children:[e.jsxs("button",{type:"button","aria-expanded":t.expanded,"aria-label":"Open the Make It Yours checklist",onClick:()=>t.setExpanded(!0),className:"flex items-center gap-2.5",children:[e.jsx(Ta,{dotState:a,fillRatio:t.trackFill}),e.jsx("span",{className:"text-[11.5px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Step 1 of 3"})]}),e.jsx("h2",{className:"mt-2.5 font-aeonik text-[19px] font-bold leading-[1.1] tracking-[-0.02em] text-foreground",children:"Make it yours."}),e.jsx("p",{className:"mt-1.5 text-[13.5px] leading-[1.5] text-muted-foreground",children:t.photoDone?"Your photoâs in. Fine-tune your name and words any time, or keep going.":"Clients book faster when they see who theyâre meeting. Add your photo, then make the words yours."}),t.photoDone?e.jsxs(e.Fragment,{children:[e.jsxs(u,{type:"button",size:"default",className:"mt-3.5 w-full",onClick:()=>t.goToStep("services"),children:["Next",e.jsx(He,{className:"ml-1 h-4 w-4","aria-hidden":!0})]}),e.jsxs(u,{type:"button",variant:"secondary",size:"default",className:"mt-2 w-full",disabled:!r,"aria-label":"Replace your photo",onClick:n,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":!0}),"Replace your photo"]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(u,{type:"button",size:"default",className:"mt-3.5 w-full",disabled:!r,"aria-label":"Add your photo",onClick:n,children:[e.jsx(he,{className:"mr-2 h-4 w-4","aria-hidden":!0}),"Add your photo"]}),!r&&e.jsx("p",{role:"status",className:"mt-2 text-center text-[12px] text-muted-foreground",children:"Getting your account readyâ¦"}),e.jsx("button",{type:"button",onClick:t.skipStep,className:"mt-2.5 w-full rounded-lg px-3 py-2 text-center text-[13px] font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:"Skip for now"})]})]})}function Pa({guide:t,onAddService:n,onRedoServices:r,hasEditableServices:a,saveIndicator:s,onAddPhoto:o,canUpload:i}){const l=t.currentStep,d="identity"===l,c="services"===l?"Review your services":"Your page is ready.",m="services"===l?"Looks good":"Next",p="services"===l?t.confirmServicesAndShare:t.goShare,x=[t.photoDone?"done":"identity"===l?"active":"todo",t.servicesDone?"done":"services"===l?"active":"todo","share"===l?"active":"todo"];return e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"mb-1.5 flex justify-center",children:s}),d?e.jsx(Ea,{guide:t,onAddPhoto:o,canUpload:i,dotState:x}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{type:"button","aria-expanded":t.expanded,"aria-label":"Open the Make It Yours checklist",onClick:()=>t.setExpanded(!0),className:"flex min-w-0 flex-1 items-center gap-2.5",children:[e.jsx(Ta,{dotState:x,fillRatio:t.trackFill}),e.jsx("span",{className:"truncate text-[13.5px] font-semibold text-foreground",children:c})]}),e.jsx(u,{type:"button",variant:"primary",size:"default",className:"flex-shrink-0 px-5",onClick:p,children:m})]}),e.jsx(At,{open:t.expanded,onOpenChange:t.setExpanded,children:e.jsx(Dt,{className:"max-h-[88svh]",children:e.jsx("div",{className:"overflow-y-auto px-5 pb-[max(1rem,env(safe-area-inset-bottom))] pt-2",children:e.jsx(Ia,{guide:t,onAddService:n,onRedoServices:r,hasEditableServices:a,onAddPhoto:o,canUpload:i})})})})]})}function Ra({open:t,onOpenChange:n,ctx:r,liveServices:a,onReviewed:o}){const{track:i}=y(),l=va(r.liveTarget.storefrontId),{redoServices:d,pending:c,error:m}=xa(),[p,x]=s.useState(""),[h,g]=s.useState(null),f=c||l.redoing,b=()=>{x(""),g(null),n(!1)};return e.jsx(ra,{open:t,onOpenChange:e=>e?n(!0):b(),title:"Describe your services",description:"Not what you actually offer? Say it in a sentence and we'll rebuild the list. Nothing changes until you approve it.",children:h?e.jsxs("div",{className:"grid gap-3 pb-1",children:[e.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Here's the new list. Approve to update your page."}),e.jsx("ul",{className:"grid gap-2",children:h.map((t,n)=>e.jsxs("li",{className:"flex items-center justify-between rounded-[11px] border border-border bg-card px-3.5 py-2.5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[14px] font-semibold text-foreground",children:t.name}),e.jsx("div",{className:"text-[12px] text-muted-foreground",children:yn(t)})]}),e.jsx("div",{className:"ml-3 shrink-0 text-[13px] font-semibold text-foreground",children:vn(t)})]},`${t.name}-${n}`))}),m&&e.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:m}),e.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2.5",children:[e.jsx(u,{type:"button",variant:"secondary",size:"default",onClick:()=>g(null),children:"Back"}),e.jsx(u,{type:"button",size:"default",disabled:f,onClick:()=>{(async()=>
1{if(!h||f)return;const e=function(e,t){const n=[],r=[],a=[];e.forEach((e,a)=>{const s=t[a];s?n.push({id:s.id,service:e}):r.push(e)});for(let s=e.length;s<t.length;s+=1)a.push(t[s].id);return{updates:n,creates:r,deactivations:a}}(h,a);await l.applyRedo(e,{storefrontId:r.liveTarget.storefrontId,createMeetingFormat:a[0]?.meeting_format??"video"})&&(r.applyRefine(e=>{return t=e,n=h,{...t,services:n};var t,n}),i(J.MIY_SERVICES_REDONE,{count:h.length}),o(),b())})()},children:f?e.jsx(be,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"Use these"})]})]}):e.jsxs("div",{className:"grid gap-3 pb-1",children:[e.jsx(Gt,{rows:4,value:p,onChange:e=>x(e.target.value),placeholder:"I do 45- and 90-minute 1:1 sessions, a 10-session package, and a free intro call.","aria-label":"Describe your services"}),m&&e.jsx("p",{role:"alert",className:"text-[13px] text-destructive",children:m}),e.jsx(u,{type:"button",size:"default",disabled:f||p.trim().length<12,onClick:()=>{(async()=>{if(p.trim().length<12||f)return;const e=await d({action:"redo_services",description:p.trim(),context:{role:r.generated.role,businessName:r.generated.businessName}});e&&g(e)})()},children:f?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":!0})," Rebuilding"]}):"Rebuild my services"})]})})}function Aa(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]}function Ma(e){const t=e?.currency||"USD";return{name:e?.name||"",description:e?.description||"",price:Y(e?.unit_amount??0,t),currency:t,duration_minutes:String(e?.duration_minutes||60),category:e?.metadata?.category||"Consultation",color:e?.metadata?.color||"#3B82F6",is_active:e?.is_active??!0,imagePath:e?.metadata?.imagePath||"",imageUpdatedAt:"number"==typeof e?.metadata?.imageUpdatedAt?e.metadata.imageUpdatedAt:void 0,buffer_before_minutes:e?.buffer_before_minutes?.toString()??"",buffer_after_minutes:e?.buffer_after_minutes?.toString()??"",min_lead_time_minutes:e?.min_lead_time_minutes?.toString()??"",max_horizon_days:e?.max_horizon_days?.toString()??"",meeting_format:e?.meeting_format??"video",meeting_location:e?.meeting_location??"",payment_timing:qt.catch("at_booking").parse(e?.payment_timing)}}const Da={video:"Video",phone:"Phone",in_person:"In person"};function Oa({children:t}){return e.jsx("span",{className:"inline-flex items-center rounded-full bg-muted px-2.5 py-1 text-[11.5px] font-semibold text-muted-foreground",children:t})}function Fa({editor:t,pricingType:n,isPackage:r=!1}){const{form:a,includes:s}=t,o=a.watch("name"),i=a.watch("price"),l=a.watch("currency"),d=a.watch("duration_minutes")??"60",u=a.watch("meeting_format")??"video",m=a.watch("description"),p=a.watch("imagePath"),x=p?c(p):null,h=Math.round(100*(Number(i)||0)),g=Zt({pricingType:n,unitAmount:h,currency:l}),f=s.map(e=>e.trim()).filter(Boolean);return e.jsxs("div",{className:"grid gap-4 pb-1",children:[e.jsxs("div",{className:"overflow-hidden rounded-[14px] border border-border bg-card",children:[x&&e.jsx("img",{src:x,alt:"",className:"aspect-square w-full object-cover",onError:e=>e.currentTarget.style.display="none"}),e.jsxs("div",{className:"grid gap-3 p-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-aeonik text-[19px] font-bold tracking-[-0.02em] text-foreground",children:o||"Your service"}),e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[!r&&e.jsx(Oa,{children:`${d} min`}),e.jsx(Oa,{children:Da[u]}),e.jsx(Oa,{children:g})]})]}),m?.trim()&&e.jsx("p",{className:"text-[13.5px] leading-[1.55] text-foreground/70",children:m}),f.length>0&&e.jsx("ul",{className:"grid list-none gap-2 p-0",children:f.map((t,n)=>e.jsxs("li",{className:"grid grid-cols-[16px_1fr] items-start gap-2 text-[13px] leading-[1.45] text-foreground/80",children:[e.jsx(ge,{className:"mt-[2px] h-3.5 w-3.5 text-muted-foreground",strokeWidth:2.4,"aria-hidden":!0}),e.jsx("span",{children:t})]},n))}),e.jsx("button",{type:"button",disabled:!0,"aria-disabled":!0,className:"mt-1 w-full cursor-default rounded-[11px] bg-foreground
1/90 px-4 py-2.5 text-[14px] font-semibold text-background opacity-70",children:"inquiry"===n?"Send an inquiry":r?"Get this package":"Book now"})]})]}),e.jsx("p",{className:"text-center text-[12px] text-muted-foreground",children:"What a client sees before booking."})]})}const Ba=["15","30","45","60","90","120","180","240"],La=e=>Number(e)>=60?`${Number(e)/60} hr${Number(e)>=120?"s":""}`:`${e} min`,za=[{value:"in_person",label:"In person"},{value:"video",label:"Video"},{value:"phone",label:"Phone"}],$a={video:"Meeting link",phone:"Phone number",in_person:"Address"};function Wa({message:t}){return t?e.jsx("p",{role:"alert",className:"text-[12px] text-destructive",children:t}):null}function Ua({editor:t,storefrontId:n,serviceId:r,isPackage:a=!1,rewriteContext:s}){const{form:o,includes:i,setIncludes:l}=t,c=o.watch("meeting_format")??"video",u=o.watch("duration_minutes"),{errors:m}=o.formState;return e.jsxs("div",{className:"grid gap-4 pb-1",children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-svc-name",children:"Name"}),e.jsx(W,{id:"miy-svc-name",autoComplete:"off","aria-invalid":!!m.name||void 0,className:"text-[15px] font-semibold",...o.register("name")}),e.jsx(Wa,{message:m.name?.message})]}),e.jsxs("div",{className:d("grid gap-3",!a&&"grid-cols-2"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-svc-price",children:"Price"}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-sm text-muted-foreground",children:"$"}),e.jsx(W,{id:"miy-svc-price",type:"number",min:0,step:"1","aria-invalid":!!m.price||void 0,className:"pl-7",...o.register("price",{valueAsNumber:!0})})]}),e.jsx(Wa,{message:m.price?"Enter a price (a number, 0 or more).":void 0})]}),!a&&e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{htmlFor:"miy-svc-duration",children:"Duration"}),e.jsxs(en,{value:u,onValueChange:e=>o.setValue("duration_minutes",e,{shouldDirty:!0}),children:[e.jsx(tn,{id:"miy-svc-duration",children:e.jsx(nn,{})}),e.jsx(rn,{children:(p=u,p&&!Ba.includes(p)?[...Ba,p].sort((e,t)=>Number(e)-Number(t)):[...Ba]).map(t=>e.jsx(an,{value:t,children:La(t)},t))})]}),e.jsx(Wa,{message:m.duration_minutes?.message})]})]}),!a&&e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{children:"How you meet"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",role:"group","aria-label":"How you meet",children:za.map(t=>{const n=c===t.value;return e.jsx("button",{type:"button","aria-pressed":n,onClick:()=>o.setValue("meeting_format",t.value,{shouldDirty:!0}),className:d("rounded-[10px] border px-2 py-2 text-[13px] font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",n?"border-foreground bg-foreground text-background":"border-border bg-card text-foreground hover:bg-muted/60"),children:t.label},t.value)})}),e.jsx(W,{"aria-label":$a[c],placeholder:$a[c],autoComplete:"off","aria-invalid":!!m.meeting_location||void 0,className:"mt-1",...o.register("meeting_location")}),e.jsx(Wa,{message:m.meeting_location?.message})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx($,{htmlFor:"miy-svc-description",children:"Description"}),e.jsx(ka,{field:"service_description",getValue:()=>o.getValues("description")??"",onApply:e=>o.setValue("description",e,{shouldDirty:!0}),context:s})]}),e.jsx(Gt,{id:"miy-svc-description",rows:3,...o.register("description")})]}),e.jsx(Xt,{label:"What's included",items:i,onChange:l,addLabel:"Add item",placeholder:"e.g., 30-minute strategy call",helper:"Shown with a check on the detail page."}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx($,{children:"Photo"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional. Square, around 1200 by 1200 pixels. Shows at the top of this service."}),e.jsx(Nt,{value:o.watch("imagePath"),cacheKey:o.watch("imageUpdatedAt"),onChange:e=>{o.setValue("imagePath",e||void 0,{shouldDirty:!0}),e&&o.setValue("imageUpdatedAt",Date.now(),{shouldDirty:!0})},storagePath:`storefronts/${n}/services/${r}`,filename:"image",shape:"square",size:"md",enableCrop:!0,maxSizeMB:5})]})]});var p}function Ya(e){const{linked_service_id:t,...n}=e??{};return n}function Ha({open:n,onOpenChange:r,index:o,service:l,ctx:c,onReviewed:m,linkedPackages:p=[]}){const{track:x}=y(),h=c.liveTarget.storefrontId,g=function(e){const t=a({resolver:Vt(Jt),defaultValues:Ma(e),mode:"onChange"}),[n,r]=s.useState(Aa(e?.metadata?.includes)),[o,i]=s.useState(Aa(e?.metadata?.ideal_for));return s.useEffect(()=>{e&&(t.reset(Ma(e)),r(Aa(e.metadata?.includes)),i(Aa(e.metadata?.ideal_for)))},[e,t]),{form:t,includes:n,setIncludes:r,idealFor:o,setIdealFor:i,buildPayload:()=>Qt(t.getValues(),{includes:n,idealFor:o})}}(l),f=va(h),[v,j]=s.useState("preview"),[N,k]=s.useState(!1),w=s.useRef(g.includes.join("\n")),S="package"===l.fulfillment_type,_=g.form.handleSubmit(async()=>{const e=g.buildPayload();if(S){const t=e;delete t.service_type,delete t.fulfillment_type,delete t.duration_minutes,t.metadata={...l.metadata??{},...t.metadata??{}}}if(!(await f.save(l.id,e)))return;const t=Object.keys(g.form.formState.dirtyFields);g.includes.join("\n")!==w.current&&t.push("includes"),c.applyRefine(t=>function(e,t,n,r){const a=Math.round(Y(n.unit_amount,n.currency)),s=r.map(e=>
1e.trim()).filter(Boolean);return{...e,services:e.services.map((e,r)=>{if(r!==t)return e;const o=a>0?"fixed":e.pricingType;return{...e,name:n.name,description:n.description??"",price:a,pricingType:o,isFree:0===a&&"fixed"===o,durationMinutes:n.duration_minutes??e.durationMinutes,includes:s}})}}(t,o,e,g.includes)),x(J.MIY_SERVICE_EDITED,{service_index:o,fields_changed:t}),m(),r(!1)},()=>{j("edit"),i.error("Check the highlighted fields.")}),C=p.length>0,I=function({index:e,service:n,linkedPackages:r,ctx:a,persist:o,onReviewed:l,onOpenChange:d}){const c=t(),[u,m]=s.useState(!1),p=a.liveTarget.storefrontId,x=()=>c.invalidateQueries({queryKey:ha(p)}),h=()=>{l(),d(!1)};return{keepPackages:async()=>{m(!0);try{for(const e of r)await pt(e.service.id,{metadata:Ya(e.service.metadata)});if(!(await o.remove(n.id)))return;a.applyRefine(t=>aa(t,e)),await x(),h()}catch(t){b.error("MIY: keep-packages remove flow failed",{error:t}),i.error("We could not finish removing the service. Please try again.")}finally{m(!1)}},removeAll:async()=>{m(!0);try{if(!(await o.remove(n.id)))return;for(const e of r)await o.remove(e.service.id);const t=r.map(e=>e.draftIndex).filter(e=>null!=e);a.applyRefine(n=>function(e,t){const n=new Set(t);return{...e,services:e.services.filter((e,t)=>!n.has(t))}}(n,[e,...t])),await x(),h()}catch(t){b.error("MIY: remove base + linked packages failed",{error:t}),i.error("We could not remove every item. Please try again.")}finally{m(!1)}},busy:u}}({index:o,service:l,linkedPackages:p,ctx:c,persist:f,onReviewed:m,onOpenChange:r}),T=p.length,E=p.map(e=>e.service.name),P=f.removing||I.busy;return e.jsxs(ra,{open:n,onOpenChange:r,title:S?"Your package":"Your service",description:"The offer exactly as clients see it. Edit anything, then tap Done.",footer:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(u,{type:"button",variant:"secondary",size:"default",onClick:()=>k(!0),disabled:P,children:"Remove"}),e.jsx(u,{type:"button",size:"default",className:"flex-1",onClick:()=>{_()},disabled:f.saving,children:"Done"})]}),children:[e.jsx("div",{className:"mb-4 inline-flex rounded-[11px] border border-border bg-muted/50 p-0.5",children:["edit","preview"].map(t=>e.jsxs("button",{type:"button","aria-pressed":v===t,onClick:()=>j(t),className:d("inline-flex items-center gap-1.5 rounded-[9px] px-3.5 py-1.5 text-[13px] font-semibold transition-colors",v===t?"bg-card text-foreground shadow-sm":"text-muted-foreground"),children:["edit"===t?e.jsx(pe,{className:"h-3.5 w-3.5","aria-hidden":!0}):e.jsx(Ue,{className:"h-3.5 w-3.5","aria-hidden":!0}),"edit"===t?"Edit":"Preview"]},t))}),"edit"===v?e.jsx(Ua,{editor:g,storefrontId:h,serviceId:l.id,isPackage:S,rewriteContext:{role:c.generated.role,businessName:c.generated.businessName}}):e.jsx(Fa,{editor:g,pricingType:l.pricing_type,isPackage:S}),e.jsx(Q,{open:N,onOpenChange:k,children:e.jsxs(X,{children:[e.jsxs(Z,{children:[e.jsx(ee,{children:"Remove this service?"}),e.jsx(te,{children:C?e.jsxs(e.Fragment,{children:[(R=E,1===R.length?`"${R[0]}"`:2===R.length?`"${R[0]}" and "${R[1]}"`:`${R.slice(0,-1).map(e=>`"${e}"`).join(", ")}, and "${R[R.length-1]}"`)," ",1===T?"is":"are"," built on this service. You can keep ",1===T?"it":"them"," as"," ",1===T?"a standalone package":"standalone packages",", or remove"," ",1===T?"it":"them"," too."]}):e.jsx(e.Fragment,{children:"It will no longer show on your page. If a client has already booked it, we keep it for that booking and just hide it."})})]}),e.jsxs(ne,{children:[e.jsx(re,{disabled:P,children:C?"Cancel":"Keep it"}),C?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"bg-secondary text-secondary-foreground hover:bg-secondary/80",disabled:P,onClick:e=>{e.preventDefault(),I.removeAll()},children:1===T?"Remove both":"Remove all"}),e.jsx(ae,{disabled:P,onClick:e=>{e.preventDefault(),I.keepPackages()},children:1===T?"Keep the package":"Keep the packages"})]}):e.jsx(ae,{className:"bg-secondary text-secondary-foreground hover:bg-secondary/80",onClick:e=>{e.preventDefault(),(async()=>{const e=await f.remove(l.id);k(!1),e&&(c.applyRefine(e=>aa(e,o)),m(),r(!1))})()},children:"Remove"})]})]})})]});var R}function Ka({ctx:t,liveServices:n,openIndex:r,onClose:a,onReviewed:o}){const i=t.generated.services,{pairings:l,ambiguousIndices:d}=s.useMemo(()=>fa(i,n),[i,n]),c=s.useRef(new Set);s.useEffect(()=>{if(0!==n.length)for(const e of d){const n=`${t.liveTarget.storefrontId}:${e}`;c.current.has(n)||(c.current.add(n),b.warn("MIY: could not pair a draft service to a live row; edit disabled",{storefrontId:t.liveTarget.storefrontId,index:e,name:i[e]?.name}))}},[d,i,n.length,t.liveTarget.storefrontId]);const u=null!=r?l[r]:null,m=s.useMemo(()=>
1{if(!u)return[];const e=[];for(const t of n){if("package"!==t.fulfillment_type)continue;if(t.metadata?.linked_service_id!==u.id)continue;const n=l.findIndex(e=>e?.id===t.id);e.push({service:t,draftIndex:n>=0?n:null})}return e},[u,n,l]);return null!=r&&u?e.jsx(Ha,{open:!0,onOpenChange:e=>!e&&a(),index:r,service:u,ctx:t,onReviewed:o,linkedPackages:m},r):null}const Va=Yt([$t({ok:Ht(!0),slug:Wt().min(1)}),$t({ok:Ht(!1),error:Kt(["taken","has_bookings","not_owner","invalid"])})]),Ga="We could not update your link. Please try again.";function qa({open:t,onOpenChange:n,ctx:r}){const{track:a}=y(),o=r.liveTarget.publishedHandle,i=r.liveTarget.storefrontId,[l,d]=s.useState(o),[c,p]=s.useState("idle"),[x,h]=s.useState(!1),[f,j]=s.useState(null);s.useEffect(()=>{t&&(d(o),p("idle"),j(null))},[t,o]),s.useEffect(()=>{const e=ut(l);if(e===o)return void p("idle");if(e.length<3)return void p("invalid");p("checking");const t=setTimeout(()=>{se.validateSlugAvailability(e,i).then(e=>{p(e.ok?e.value?"available":"taken":"error")}).catch(()=>p("error"))},400);return()=>clearTimeout(t)},[l,o,i]);const N="available"===c&&ut(l)!==o&&!x;return e.jsx(ra,{open:t,onOpenChange:n,title:"Your link",description:"This is the address clients visit and the one you share. Keep it short and memorable.",children:e.jsxs("div",{className:"mt-1 grid gap-3 pb-1",children:[e.jsxs("div",{className:"flex items-center overflow-hidden rounded-[10px] border border-border bg-muted/40 focu
1s-within:border-foreground",children:[e.jsx("span",{className:"pl-3 font-mono text-[13px] text-muted-foreground",children:"glintly.co/"}),e.jsx("input",{value:l,spellCheck:!1,autoCapitalize:"off","aria-label":"Your storefront link",onChange:e=>d(ct(e.target.value)),className:"min-w-0 flex-1 border-0 bg-transparent py-2.5 pl-1 pr-3 font-mono text-[13px] font-semibold text-foreground outline-none"}),e.jsx("span",{className:"pr-3","aria-hidden":!0,children:"checking"===c?e.jsx(be,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}):"available"===c?e.jsx(ge,{className:"h-3.5 w-3.5 text-emerald-600",strokeWidth:2.5}):null})]}),e.jsxs("p",{role:"status","aria-live":"polite",className:"min-h-[18px] text-[12.5px]",children:["available"===c&&e.jsx("span",{className:"text-emerald-600",children:"Available"}),"taken"===c&&e.jsx("span",{className:"text-muted-foreground",children:"That one is taken."}),"invalid"===c&&e.jsx("span",{className:"text-muted-foreground",children:"Links need at least 3 characters."}),"error"===c&&e.jsx("span",{className:"text-muted-foreground",children:"Could not check that. Try again."})]}),e.jsx("p",{className:"text-[12.5px] leading-[1.5] text-muted-foreground",children:"You can change your link now because nothing points to it yet. The old link will stop working."}),f&&e.jsx("p",{className:"text-[12.5px] text-destructive",children:f}),e.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2.5",children:[e.jsx(u,{type:"button",variant:"secondary",size:"default",onClick:()=>n(!1),children:"Cancel"}),e.jsx(u,{type:"button",size:"default",disabled:!N,onClick:()=>{(async()=>{h(!0),j(null);const e=await async function(e,t){try{const{data:n,error:r}=await g.rpc("rename_storefront_slug",{p_storefront_id:e,p_new_slug:t});if(r)return b.warn("renameStorefrontSlug: rpc error",{storefrontId:e,error:r.message}),m({type:"network",message:Ga});const a=Va.safeParse(n);return a.success?a.data.ok?v({slug:a.data.slug}):m({type:a.data.error}):(b.warn("renameStorefrontSlug: malformed response",{storefrontId:e}),m({type:"network",message:Ga}))}catch(as){return b.warn("renameStorefrontSlug: threw",{storefrontId:e,error:as instanceof Error?as.message:String(as)}),m({type:"network",message:Ga})}}(i,ut(l));h(!1),e.ok?(a(J.MIY_SLUG_RENAMED,{from_length:o.length,to_length:e.value.slug.length}),r.onSlugRenamed(e.value.slug),n(!1)):j(function(e){switch(e.type){case"taken":return"That link is already taken. Try another.";case"has_bookings":return"Your link is locked because you already have bookings on it.";case"not_owner":return"You don't have permission to change this link.";case"invalid":return"That link is too short or reserved. Try another.";case"network":return e.message}}(e.error))})()},children:x?e.jsx(be,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):"Save link"})]})]})})}function Ja({photoDone:e,photoKind:t,currentStep:n,onFirstPhoto:r}){const{track:a}=y(),o=s.useRef(e),i=s.useRef(e),l=s.useRef(n);return s.useLayoutEffect(()=>{e&&!o.current&&(o.current=!0,"identity"===l.current&&r?.())},[e,r]),s.useEffect(()=>{l.current=n},[n]),s.useEffect(()=>{e&&!i.current&&(i.current=!0,a(J.MIY_PHOTO_ADDED,{kind:t}),a(J.MIY_STEP_COMPLETED,{step:"identity"}))},[e,t,a]),null}function Qa({currentHours:t,timezone:n,isLoading:r,isSaving:a,isSavingTimezone:s,onHoursChange:o,onValidationChange:i,onTimezoneChange:l,onSkip:d}){return e.jsxs("div",{className:"animate-fade-in",children:[e.jsx("div",{className:"mb-3.5 text-[13px] font-semibold text-emerald-600 dark:text-emerald-400",children:"You're live"}),e.jsx("h1",{className:"font-aeonik text-[1.875rem] font-bold leading-[1] tracking-[-0.035em] text-foreground lg:text-[2.375rem]",children:"When can clients book you?"}),e.jsx("p",{className:"mt-3.5 max-w-md text-sm leading-relaxed text-muted-foreground",children:"We started you with a schedule. Adjust anything, or keep it and go."}),r?e.jsxs("div",{className:"mt-6 flex items-center justify-center py-12",children:[e.jsx(be,{className:"h-6 w-6 animate-spin text-muted-foreground","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:"Loading your schedule"})]}
1):e.jsxs("div",{className:"mt-6 max-w-md space-y-6",children:[e.jsx(sn,{weeklyHours:t,onChange:o,showInheritOption:!1,disabled:a,onValidationChange:i}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Time zone"}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Booking times and confirmation emails use this."}),e.jsx(on,{value:n,onSelect:l,disabled:s,className:"mt-2"})]}),e.jsx("button",{type:"button",onClick:d,className:"text-[13px] font-medium text-muted-foreground underline-offset-4 transition-colors hover:text-foreground hover:underline",children:"I'll adjust later"})]})]})}function Xa(e,t){const n="inquiry"===e.pricingType;return{name:e.name,duration_minutes:e.durationMinutes,unit_amount:n?null:Math.round(100*(e.isFree?0:e.price)),pricing_type:e.pricingType,is_active:!0,position:t,sort_order:t,meeting_format:e.meetingFormat??null}}const Za={monday:"Mon",tuesday:"Tue",wednesday:"Wed",thursday:"Thu",friday:"Fri",saturday:"Sat",sunday:"Sun"};const es="glintly_miy_done";function ts(){const e=localStorage.getItem(es);if(!e)return{};const t=JSON.parse(e);if(!t||"object"!=typeof t||Array.isArray(t))return{};const n={};for(const[r,a]of Object.entries(t))"completed"!==a&&"skipped"!==a||(n[r]=a);return n}const ns=["identity","services","share"];function rs(r,a,l){const{track:d}=y(),{user:m,loading:p}=oe(),x=o(),h=t(),f=!function(e){const{data:t}=n({queryKey:["miy-has-bookings",e??""],queryFn:async()=>{if(!e)return!0;const{count:t,error:n}=await g.from("bookings").select("*",{count:"exact",head:!0}).eq("org_id",e).eq("is_self_booking",!1);return!!n||(t??0)>=1},enabled:Boolean(e),staleTime:6e4});return t??!1}(r?.orgId??null),v=function(){const{schedule:e,isLoading:t,saveSchedule:n,isSaving:r}=dn(void 0,{analyticsSurface:"onboarding"}),{schedule:a,isLoading:o,timezone:l,saveTimezone:d,isSavingTimezone:c}=cn(),{isLoading:u}=mn(),[m,p]=s.useState(null),[x,h]=s.useState(!1),g=e?.weekly_hours,f=a?.weekly_hours,b=s.useMemo(()=>un.reduce((e,t)=>(e[t]=g?.[t]??f?.[t]??[],e),{}),[g,f]),v=m??b,y=null!==m,j=s.useMemo(()=>function(e){const t=un.filter(t=>{return n=e[t],Array.isArray(n)&&n.length>0;var n}),n=t.length>0?e[t[0]]:void 0;
1if(!n||0===n.length)return null;const r=n[0],a=t.every(t=>{const n=e[t];return!!n&&1===n.length&&n[0].start===r.start&&n[0].end===r.end}),s=t.map(e=>un.indexOf(e));if(a&&function(e){for(let t=1;t<e.length;t++)if(e[t]!==e[t-1]+1)return!1;return!0}(s)){const e=`${ln((o=r).start)} to ${ln(o.end)}`;return t.length===un.length?`Every day, ${e}`:1===t.length?`${Za[t[0]]}, ${e}`:`${Za[t[0]]} to ${Za[t[t.length-1]]}, ${e}`}var o;const i=t.map(e=>Za[e]);return i.length<=3?i.join(", "):`${i.slice(0,3).join(", ")} + ${i.length-3} more`}(b),[b]),N=s.useCallback(e=>{p(e)},[]),k=s.useCallback(async e=>{if(e!==l)try{await d(e),i.success("Timezone updated")}catch{i.error("Could not update timezone. Please try again.")}},[l,d]),w=s.useCallback(async()=>{if(!m)return!0;const e=un.reduce((e,t)=>(e[t]=m[t]??[],e),{});try{return await n(e)?(p(null),!0):(i.error("We could not save your hours. Please try again."),!1)}catch{return i.error("We could not save your hours. Please try again."),!1}},[m,n]);return{currentHours:v,timezone:l,isLoading:t||o||u,isSaving:r,isSavingTimezone:c,hasErrors:x,dirty:y,summary:j,onHoursChange:N,onValidationChange:h,onTimezoneChange:k,commit:w}}(),N=Boolean(m),k=s.useMemo(()=>N?[...gr]:gr.filter(e=>"hours"!==e.id),[N]),w=s.useMemo(()=>k.map(e=>e.id),[k]),S=w[0],_=function({slug:e,storefrontId:t,surface:n}){const{track:r}=y(),a=zt(),[o,i]=s.useState(!1),[l,d]=s.useState(!1),[c,u]=s.useState(!1),[m,p]=s.useState(null),[x,h]=s.useState(null),[g,f]=s.useState(!1),b=!!t&&function(e){try{return Boolean(ts()[e])}catch{return!0}}(t),v=g||!o&&!b?"guide":"done",j=s.useRef(Date.now()),N=s.useRef(!1);s.useEffect(()=>{t&&"guide"===v&&!N.current&&(N.current=!0,j.current=Date.now(),r(J.MIY_GUIDE_SHOWN,{slug:e,surface:n,viewport:a?"mobile":"desktop"}))},[t,v,e,n,a,r]);const k=s.useCallback(e=>{u(!1),p(e)},[]),w=s.useCallback(()=>p(null),[]),S=s.useCallback(()=>{h(null),l||(d(!0),r(J.MIY_STEP_COMPLETED,{step:"services"}))},[l,r]),_=s.useCallback(e=>h(e),[]),C=s.useCallback(e=>{f(!0),i(!1),h(e),u(!1),p(null)},[]),I=s.useCallback((e,n)=>{"done"!==v&&(b||(function(e,t){try{const n=ts();n[e]=t,localStorage.setItem(es,JSON.stringify(n))}catch{}}(t,e),"completed"===e?r(J.MIY_COMPLETED,{steps_completed:n,duration_ms:Date.now()-j.current}):r(J.MIY_SKIPPED_ALL,{steps_completed:n})),p(null),u(!1),h(null),f(!1),i(!0))},[v,b,t,r]),T=s.useCallback(e=>I("skipped",e),[I]),E=s.useCallback(e=>I("completed",e),[I]);return{phase:v,servicesReviewed:l,expanded:c,setExpanded:u,openSheet:m,open:k,closeSheet:w,confirmServices:S,stepOverride:x,goToStep:_,reopenForEditing:C,skipAll:T,goShare:E}}({slug:r?.publishedHandle??"",storefrontId:r?.storefrontId??"",surface:l}),{services:C}=function(e){const{data:t,isLoading:r}=n({queryKey:ha(e),queryFn:()=>mt(e),enabled:Boolean(e),staleTime:6e4});return{services:(t??[]).filter(e=>e.is_active),isLoading:r}}(r?.storefrontId??""),[I,T]=s.useState(null),[E,P]=s.useState(null),[R,A]=s.useState(S),M=s.useRef(null);s.useEffect(()=>{"done"!==_.phase&&A(S)},[_.phase,S]);const D=s.useRef(!1),O=s.useRef(!1),F=s.useRef(null);s.useEffect(()=>{if("done"!==_.phase)return void(D.current=!1);if(p||D.current)return;D.current=!0;let e=S;if(!O.current){O.current=!0;const t=yr(window.history.state);t&&w.includes(t)&&(e=t)}F.current=e,A(e)},[_.phase,p,S,w]);const B=s.useRef(!1);s.useEffect(()=>{"done"===_.phase?N&&"hours"===R&&!B.current&&(B.current=!0,d(j.HOURS_VIEWED,{surface:l})):B.current=!1},[_.phase,R,N,d,l]);const L=s.useRef(!1);s.useEffect(()=>{"done"===_.phase?"done"!==R||L.current||(L.current=!0,d(ie.HANDOFF_VIEWED,{})):L.current=!1},[_.phase,R,d]);const z=s.useRef(null);s.useEffect(()=>{if("done"!==_.phase)return void(z.current=null);if(p||z.current===R)return;if(null===z.current&&R!==(F.current??S))return;const e=w.indexOf(R);if(e<0)return;const t=z.current;z.current=R,d(j.RAIL_STEP_VIEWED,{step:R,index:e,from:t,surface:l})},[_.phase,R,p,S,w,d,l]);const $=s.useRef(!1);return s.useEffect(()=>{if("done"!==_.phase)return void($.current=!1);if(p)return;$.current||($.current=!0,window.history.replaceState(jr(window.history.state,F.current??S),"",window.location.href));const e=()=>{const e=yr(window.history.state);e&&w.includes(e)&&A(e)};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[_.phase,S,p,w]),t=>
1{const n=t.liveTarget.publishedHandle,r=Boolean(t.generated.headshotPath||t.generated.logoPath),s=function(e,t){const n=e.servicesReviewed,r=(t?1:0)+(n?1:0),a=t?"services":"identity",s=e.stepOverride??a,o=((t?1:0)+("share"===s?1:0))/2,i=e=>"identity"===e||"services"===e&&t||"share"===e&&t&&n,l=ns.indexOf(s),d=l>0?()=>e.goToStep(ns[l-1]):void 0,c=l<ns.length-1?()=>e.goToStep(ns[l+1]):void 0;return{phase:e.phase,photoDone:t,servicesDone:n,completedCount:r,trackFill:o,currentStep:s,goToStep:t=>i(t)&&e.goToStep(t),canVisitStep:i,onBack:d,skipStep:c,reopenForEditing:()=>e.reopenForEditing("services"),expanded:e.expanded,setExpanded:e.setExpanded,openSheet:e.openSheet,open:e.open,closeSheet:e.closeSheet,confirmServices:e.confirmServices,confirmServicesAndShare:()=>{e.confirmServices(),e.goShare(r+(n?0:1))},skipAll:()=>e.skipAll(r),goShare:()=>e.goShare(r)}}(_,r),o=f?e.jsx(qa,{open:"slug"===_.openSheet,onOpenChange:e=>!e&&_.closeSheet(),ctx:t}):null,m=()=>{d(ie.HANDOFF_CTA_CLICKED,{cta:"dashboard"}),dt(),x("/dashboard?welcome=1",{replace:!0})},p=()=>{d(ie.HANDOFF_CTA_CLICKED,{cta:"own_page"}),d(j.STOREFRONT_FIRST_VIEW,{source:"aha_url",slug:n,role:a}),dt()},{editableIndices:g,pairings:y}=fa(t.generated.services,C),S=(e,n,r)=>{const a=y[e];if(!a)return void b.warn("MIY: inline service edit on an unpaired row; not persisted",{storefrontId:t.liveTarget.storefrontId,index:e});const s={};void 0!==n.name&&(s.name=n.name),void 0!==n.priceDollars&&(s.unit_amount=H(n.priceDollars,a.currency)),void 0===s.name&&void 0===s.unit_amount||pt(a.id,s).then(()=>h.invalidateQueries({queryKey:ha(t.liveTarget.storefrontId)}),t=>{b.error("MIY: inline service edit failed to persist",{error:t,index:e}),i.error("We could not save that change. Please try again."),r?.()})},D=(e,n)=>{const r=t.generated.services[e];if(!r||!Number.isFinite(n)||n<=0)return;const a=Math.min(function(e,t){const n=e.sessionCount;return"package"===e.fulfillmentType&&null!=n&&n>0?Math.round(t*n):Math.round(t)}(r,n),9999999);if(a<1)return;const s=r.price;t.applyRefine(t=>({...t,services:t.services.map((t,n)=>n===e?{...t,price:a}:t)})),S(e,{priceDollars:a},()=>{t.applyRefine(t=>({...t,services:t.services.map((t,n)=>n===e&&t.price===a?{...t,price:s}:t)}))})};if("done"===_.phase){const r=w.indexOf(R),i=e=>{window.history.pushState(jr(window.history.state,e),"",window.location.href),A(e)},x=()=>{r<w.length-1&&i(w[r+1])},h=()=>{if("hours"===R){const e=v.dirty;return void v.commit().then(t=>{t&&(d(j.HOURS_SAVED,{edited:e,surface:l}),x())})}x()},b=()=>{d(j.HOURS_SKIPPED,{surface:l}),x()},y=()=>r>0?window.history.back():s.reopenForEditing(),S=e=>{const t=w.indexOf(e);t<0||t===r||i(e)},C={enabled:N,body:N?e.jsx(Qa,{currentHours:v.currentHours,timezone:v.timezone,isLoading:v.isLoading,isSaving:v.isSaving,isSavingTimezone:v.isSavingTimezone,onHoursChange:v.onHoursChange,onValidationChange:v.onValidationChange,onTimezoneChange:e=>{v.onTimezoneChange(e)},onSkip:b}):null,dirty:v.dirty,saving:v.isSaving,hasErrors:v.hasErrors,summary:v.summary},I="done"===R?null:br(R,v.dirty),T="hours"===R&&(v.isSaving||v.dirty&&v.hasErrors),E=`${window.location.origin}/${n}`,P=(O=t.generated,Ct(function(e){return{business_name:e.businessName,display_name:fn(e),brand_type:bn(e)?"personal":"business",tagline:e.headline,description:e.tagline,avatar_path:e.logoPath??null,persona_avatar_path:e.headshotPath??null,services:e.services.map(Xa)}}(O))),M=c(P.logoPath)??void 0,F=P.isPersonal?P.primaryName:void 0;return{rail:e.jsxs(e.Fragment,{children:[e.jsx(Fr,{step:R,steps:k,onNext:h,onBack:y,onOwnPage:p,onDashboard:m,onGoToStep:S,hours:C,earnings:e.jsx(Jr,{services:t.generated.services,onEditPrice:D,editableServiceIndices:g}),storefrontUrl:E,slugEditable:f,onEditLink:f?()=>_.open("slug"):void 0,previewName:t.generated.businessName,previewTagline:t.generated.headline,previewAvatarUrl:M,previewPersonName:F,previewVersion:t.generated.headshotPath??t.generated.logoPath??void 0,storyCard:P,onShared:(e,t)=>{d(j.STOREFRONT_SHARED,{channel:e,source:le.AHA,slug:n,format:"link",...t?.audience?{audience:t.audience}:{}})},onMarkShared:()=>kt(t.liveTarget.storefrontId),onViewStorefront:()=>d(j.STOREFRONT_FIRST_VIEW,{source:"aha_url",slug:n,role:a})}),o]}),bottomBar:"done"===R?e.jsx(Ar,{storefrontUrl:E,onOwnPage:p,onDashboard:m,onBack:y}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(u,{type:"button",variant:"secondary",onClick:y,children:[e.jsx(Ke,{className:"mr-1 h-4 w-4","aria-hidden":!0}),"Back"]}),e.jsxs(u,{type:"button",className:"flex-1",onClick:h,disabled:T,children:[I,e.jsx(fe,{className:"ml-2 h-4 w-4","aria-hidden":!0})]})]}),shareMoment:!0,onBack:y}}var O;const F=()=>{t.canUpload&&M.current?.click()},B=e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:M,type:"file",accept:"image/*",className:"hidden",onChange:e=>{const n=e.target.files?.[0];e.target.value="",n&&(bn(t.generated)?t.onPickHeadshot(n):t.onPickLogo(n))}}),e.jsx(Sa,{open:"details"===_.openSheet,onOpenChange:e=>!e&&_.closeSheet(),ctx:t}),o,e.jsx(Ka,{ctx:t,liveServices:C,openIndex:I,onClose:()=>T(null),onReviewed:_.confirmServices}),e.jsx(ja,{open:"add"===E,onOpenChange:e=>!e&&P(null),ctx:t,onReviewed:_.confirmServices}),e.jsx(Ra,{open:"redo"===E,onOpenChange:e=>!e&&P(null),ctx:t,liveServices:C,onReviewed:_.confirmServices}),e.jsx(Ja,{photoDone:r,photoKind:t.generated.headshotPath?"headshot":"logo",currentStep:s.currentStep,onFirstPhoto:()=>_.goToStep("identity")})]}),L=e=>{_.setExpanded(!1),P(e)};return{rail:e.jsxs(e.Fragment,{children:[e.jsx(Ia,{className:"hidden lg:block",guide:s,hasEditableServices:g.size>0,onAddService:()=>L("add"),onRedoServices:()=>L("redo"),onAddPhoto:F,canUpload:t.canUpload}),B]}),bottomBar:e.jsx(Pa,{guide:s,onAddService:()=>L("add"),onRedoServices:()=>L("redo"),hasEditableServices:g.size>0,saveIndicator:t.saveIndicator,onAddPhoto:F,canUpload:t.canUpload}),onBack:s.onBack,onOpenServiceEditor:e=>{g.has(e)&&T(e)},editableServiceIndices:g,servicesFocused:"services"===s.currentStep,onInlineServiceE
1dit:S}}}export{xn as B,pn as D,Ir as S,Er as m,gn as r,rs as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.