PageSourceSearch

https://r2medicalclinic.com/assets/AdminEditor-BCqJbtOl.js

js r2medicalclinic.com collected 2026-10-08 05:28:01 UTC 27,729 bytes, 67 lines download raw bytes

1import{c as m,r,s as f,j as e,k as ee,l as Xe,X as ke,m as Ke,n as Ze,f as Qe,E as et}from"./index-BvB_hACh.js";import{F as tt}from"./file-text-CyeKbvTx.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const st=m("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Se=m("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const $=m("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const rt=m("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const nt=m("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
27 * @license lucide-react v0.462.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const at=m("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
32 * @license lucide-react v0.462.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const Ce=m("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/**
37 * @license lucide-react v0.462.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const ot=m("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
42 * @license lucide-react v0.462.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const it=m("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
47 * @license lucide-react v0.462.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const lt=m("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
52 * @license lucide-react v0.462.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const dt=m("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),ct={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_SUPABASE_PROJECT_ID:"gsbypzwszbgyhaxkkwtp",VITE_SUPABASE_PUBLISHABLE_KEY:"sb_publishable_qykX6xcw2UzwxUvnTcgwCA_zr13PpvX",VITE_SUPABASE_URL:"https://gsbypzwszbgyhaxkkwtp.supabase.co"},ut=a=>new Date(a).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}),mt=a=>
56a?new Date(a).toLocaleString([],{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"",xt=10*1024*1024,ht=a=>new Promise((N,B)=>{const b=new FileReader;b.onload=()=>N(String(b.result).split(",")[1]||""),b.onerror=B,b.readAsDataURL(a)}),y=ct,pt=y==null?void 0:y.VITE_SUPABASE_URL,Ee=y==null?void 0:y.VITE_SUPABASE_PUBLISHABLE_KEY,Pe=`${pt}/functions/v1/admin-agent`,gt=["Change the main phone number","Update our weekday hours","Fix a typo in a blog post","What can you edit?"],_e=[{label:"Home",path:"/"},{label:"Medical Weight Loss",path:"/medical-weight-loss"},{label:"GLP-1 Weight Loss",path:"/glp1-weight-loss"},{label:"Hormone Health — Men",path:"/hormone-health-men"},{label:"Hormone Health — Women",path:"/hormone-health-women"},{label:"Locations",path:"/locations"},{label:"Contact",path:"/contact"},{label:"Blog",path:"/blog"},{label:"Denver",path:"/denver"},{label:"Castle Rock",path:"/castle-rock"},{label:"HIPAA Notice",path:"/hipaa-notice"}],Ae=`Hi! I'm your R2 site editor. 👋
57
58Tell me what you'd like to change on the website in plain English — for example *"change the main phone number to 720-555-0100"* or *"fix the typo in the TRT blog post title."*
59
60I'll always show you what I'm changing before it goes live, and anything can be undone.`,Le=typeof window<"u"?window.location.host:"r2medicalclinic.com";function yt(){const[a,N]=r.useState(null),[B,b]=r.useState(!0),[Te,te]=r.useState(null),[v,Ie]=r.useState(""),[se,Re]=r.useState(""),[k,h]=r.useState(""),[re,ne]=r.useState(!1),[ae,D]=r.useState(""),[Me,oe]=r.useState(!1),[z,ie]=r.useState(""),[w,S]=r.useState([{role:"assistant",content:Ae}]),[H,O]=r.useState(""),[p,le]=r.useState(!1),[j,U]=r.useState([]),[V,C]=r.useState(""),[E,$e]=r.useState([]),[de,ce]=r.useState(!1),[P,q]=r.useState(null),[Be,ue]=r.useState(!1),_=r.useRef(null),A=r.useRef(null),[c,De]=r.useState("/"),[me,F]=r.useState("/"),[W,ze]=r.useState("desktop"),[G,Y]=r.useState(0),[L,T]=r.useState(!0),[I,J]=r.useState("chat"),[xe,X]=r.useState(!1),[He,he]=r.useState(!1),pe=r.useRef(null),x=r.useRef(null),[R,K]=r.useState(!1),ge=r.useRef(null),fe=r.useRef(null),be=r.useCallback(()=>{T(!0),Y(t=>t+1)},[]),ye=r.useCallback(t=>{const s=t.trim(),n=s===""?"/":s.startsWith("/")?s:"/"+s;De(n),F(n),T(!0),Y(u=>u+1)},[]);r.useEffect(()=>()=>{pe.current&&clearTimeout(pe.current),x.current&&clearInterval(x.current)},[]);const Z=r.useCallback(async()=>{try{const n=(await(await fetch(`/?_v=${Date.now()}`,{cache:"no-store"})).text()).match(/\/assets\/index-([A-Za-z0-9_-]+)\.js/);return n?n[1]:null}catch{return null}},[]),Oe=r.useCallback(async()=>{x.current&&clearInterval(x.current);const t=await Z(),s=Date.now();x.current=setInterval(async()=>{const n=await Z(),u=t!==null&&n!==null&&n!==t,i=Date.now()-s>5*6e4;(u||i)&&(x.current&&clearInterval(x.current),x.current=null,X(!1),T(!0),Y(d=>d+1),u&&(he(!0),setTimeout(()=>he(!1),6e3)))},12e3)},[Z]);r.useEffect(()=>{var d;if(!R||L)return;const t=(d=ge.current)==null?void 0:d.contentDocument;if(!t)return;let s=null;const n=()=>{s&&(s.style.outline="",s.style.cursor="",s=null)},u=g=>{const o=g.target;!o||o===t.body||o===t.documentElement||(n(),s=o,o.style.outline="2px solid #F97316",o.style.cursor="crosshair")},i=g=>{g.preventDefault(),g.stopPropagation();const o=g.target,l=((o==null?void 0:o.innerText)||"").trim().replace(/\s+/g," ").slice(0,200);n(),K(!1),l&&(O(`On ${c}, change this: "${l}" → `),J("chat"),setTimeout(()=>{var M;return(M=fe.current)==null?void 0:M.focus()},50))};return t.addEventListener("mouseover",u,!0),t.addEventListener("click",i,!0),()=>{n(),t.removeEventListener("mouseover",u,!0),t.removeEventListener("click",i,!0)}},[R,L,G,c]);const we=r.useCallback(async()=>{if(a){ue(!0);try{const s=await(await fetch(Pe,{method:"POST",headers:{"Content-Type":"application/json",apikey:Ee,Authorization:`Bearer ${a.access_token}`},body:JSON.stringify({mode:"history"})})).json();q(s.history??[])}catch{q([])}finally{ue(!1)}}},[a]),Ue=()=>{ce(t=>{const s=!t;return s&&P===null&&we(),s})},Ve=async t=>{if(!t)return;C("");const s=[];for(const n of Array.from(t)){if(n.size>xt){C(`"${n.name}" is too big (max 10 MB).`);continue}try{s.push({name:n.name,mediaType:n.type||"application/octet-stream",data:await ht(n),size:n.size})}catch{C(`Couldn't read "${n.name}".`)}}s.length&&U(n=>[...n,...s]),A.current&&(A.current.value="")};r.useEffect(()=>{f.auth.getSession().then(({data:s})=>{N(s.session),b(!1)});const{data:t}=f.auth.onAuthStateChange((s,n)=>{N(n),s==="PASSWORD_RECOVERY"&&oe(!0)});return()=>t.subscription.unsubscribe()},[]),r.useEffect(()=>{if(!a){te(null);return}f.from("admin_users").select("user_id").eq("user_id",a.user.id).maybeSingle().then(({data:t})=>te(!!t))},[a]),r.useEffect(()=>{_.current&&(_.current.scrollTop=_.current.scrollHeight)},[w,p]);const qe=async t=>{t.preventDefault(),h(""),ne(!0);const{error:s}=await f.auth.signInWithPassword({email:v.trim(),password:se});s&&h("That email or password didn't work. Please try again."),ne(!1)},Fe=async()=>
60{if(h(""),D(""),!v.trim()){h("Enter your email address first, then click this again.");return}const{error:t}=await f.auth.resetPasswordForEmail(v.trim(),{redirectTo:`${window.location.origin}/admin`});t?h("Couldn't send the reset email. Please try again."):D("Check your email — we sent you a link to set a new password.")},We=async t=>{if(t.preventDefault(),h(""),z.length<8){h("Please use at least 8 characters.");return}const{error:s}=await f.auth.updateUser({password:z});s?h("Couldn't save that password. Please try again."):(oe(!1),ie(""),D("Password saved. You're signed in."))},je=async()=>{await f.auth.signOut(),S([{role:"assistant",content:Ae}])},Ne=r.useCallback(async t=>{const s=j;if(!t.trim()&&s.length===0||p||!a)return;const n=t.trim()+(s.length?`
61
62📎 ${s.map(i=>i.name).join(", ")}`:""),u=[...w,{role:"user",content:n||"(see attached)"}];S(u),O(""),U([]),C(""),le(!0);try{const i=await fetch(Pe,{method:"POST",headers:{"Content-Type":"application/json",apikey:Ee,Authorization:`Bearer ${a.access_token}`},body:JSON.stringify({messages:u.map(l=>({role:l.role,content:l.content})),attachments:s.map(l=>({name:l.name,mediaType:l.mediaType,data:l.data}))})}),d=await i.json();if(!i.ok)throw new Error(d.error||"Something went wrong.");let g=d.reply;const o=d.changes??[];if(o.length){const l=d.publishing?"**✅ Saved — your change goes live in about 2 minutes:**":"**✅ Saved:**";g+=`
63
64---
65`+l+`
66`+o.map(Q=>`- ${Q.field}`).join(`
67`);const M=Date.now();$e(Q=>[...o.map(ve=>({summary:ve.field,file:ve.file,at:M})),...Q]),q(null),d.publishing&&(X(!0),Oe())}S(l=>[...l,{role:"assistant",content:g}])}catch(i){S(d=>[...d,{role:"assistant",content:`⚠️ ${i.message||"Something went wrong. Please try again."}`}])}finally{le(!1)}},[w,p,a,j]);if(B)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background text-muted-foreground",children:e.jsx($,{className:"w-6 h-6 animate-spin"})});if(!a)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:e.jsxs("form",{onSubmit:qe,className:"w-full max-w-sm rounded-2xl border border-border bg-card p-8 shadow-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(ee,{className:"w-5 h-5 text-primary"}),e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"R2 Site Editor"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Sign in to edit the website."}),e.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:"Email"}),e.jsx("input",{type:"email",value:v,onChange:t=>Ie(t.target.value),required:!0,autoComplete:"username",className:"w-full mb-4 bg-muted border border-border rounded-xl px-4 py-2.5 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-primary"}),e.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",value:se,onChange:t=>Re(t.target.value),required:!0,autoComplete:"current-password",className:"w-full mb-4 bg-muted border border-border rounded-xl px-4 py-2.5 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-primary"}),k&&e.jsx("p",{className:"text-sm text-red-500 mb-4",children:k}),ae&&e.jsx("p",{className:"text-sm text-primary mb-4",children:ae}),e.jsx("button",{type:"submit",disabled:re,className:"w-full bg-primary text-primary-foreground rounded-xl py-2.5 text-sm font-medium disabled:opacity-50 hover:brightness-110 transition",children:re?"Signing in…":"Sign in"}),e.jsx("button",{type:"button",onClick:Fe,className:"w-full mt-3 text-sm text-muted-foreground hover:text-primary transition",children:"Forgot password? Email me a link"})]})});if(Me)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:e.jsxs("form",{onSubmit:We,className:"w-full max-w-sm",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground mb-1",children:"Set your password"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"Pick a password for the site editor. At least 8 characters."}),e.jsx("label",{className:"block text-xs font-medium text-muted-foreground mb-1",children:"New password"}),e.jsx("input",{type:"password",value:z,onChange:t=>ie(t.target.value),required:!0,autoComplete:"new-password",className:"w-full mb-4 bg-muted border border-border rounded-xl px-4 py-2.5 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-primary"}),k&&e.jsx("p",{className:"text-sm text-red-500 mb-4",children:k}),e.jsx("button",{type:"submit",className:"w-full bg-primary text-primary-foreground rounded-xl py-2.5 text-sm font-medium hover:brightness-110 transition",children:"Save password"})]})});if(Te===!1)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4 text-center",children:e.jsxs("div",{className:"max-w-sm",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground mb-2",children:"No editing access"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"This account isn't set up to edit the site. Contact your MBC team to be added."}),e.jsx("button",{onClick:je,className:"text-sm text-primary hover:underline",children:"Sign out"})]})});const Ge=W==="desktop"?{width:"100%"}:W==="tablet"?{width:820,maxWidth:"100%"}:{width:390,maxWidth:"100%"},Ye=`${c}${c.includes("?")?"&":"?"}_e=${G}`,Je=[{id:"desktop",Icon:at},{id:"tablet",Icon:dt},{id:"mobile",Icon:lt}];return e.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[e.jsxs("header",{className:"flex items-center justify-between gap-3 px-4 sm:px-6 h-14 border-b border-border bg-card/70 backdrop-blur shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(ee,{className:"w-5 h-5 text-primary shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground leading-tight truncate",children:"R2 Site Editor"}),e.jsx("p",{className:"text-xs text-muted-foreground leading-tight truncate",children:a.user.email})]})]}),e.jsxs("div",{className:"flex lg:hidden items-center rounded-lg border border-border p-0.5 text-xs",children:[e.jsxs("button",{onClick:()=>J("chat"),className:`flex items-center gap-1 px-2.5 py-1 rounded-md transition ${I==="chat"?"bg-primary text-primary-foreground":"text-muted-foreground"}`,children:[e.jsx(nt,{className:"w-3.5 h-3.5"})," Chat"]}),e.jsxs("button",{onClick:()=>J("preview"),className:`flex items-center gap-1 px-2.5 py-1 rounded-md transition ${I==="preview"?"bg-primary text-primary-foreground":"text-muted-foreground"}`,children:[e.jsx(st,{className:"w-3.5 h-3.5"})," Preview"]})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 shrink-0",children:[e.jsxs("button",{onClick:Ue,className:`flex items-center gap-1.5 text-xs rounded-lg px-2.5 py-1.5 border transition ${de?"bg-primary/10 border-primary/40 text-primary":"border-border text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Se,{className:"w-4 h-4"})," Edits",E.length?` (${E.length})`:""]}),e.jsxs("button",{onClick:je,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition",children:[e.jsx(rt,{className:"w-4 h-4"})," ",e.jsx("span",{className:"hidden sm:inline",children:"Sign out"})]})]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("section",{className:`relative w-full lg:w-[440px] lg:shrink-0 flex-col min-w-0 border-r border-border bg-background ${I==="chat"?"flex":"hidden"} lg:flex`,children:[e.jsx("div",{ref:_,className:"flex-1 overflow-y-auto px-4 sm:px-5 py-6",children:e.jsxs("div",{className:"max-w-2xl mx-auto 
67space-y-4",children:[w.map((t,s)=>e.jsx("div",{className:`flex ${t.role==="user"?"justify-end":"justify-start"}`,children:e.jsx("div",{className:`max-w-[88%] rounded-2xl px-4 py-3 text-[15px] leading-relaxed ${t.role==="user"?"bg-primary text-primary-foreground rounded-br-md":"bg-card text-foreground border border-border rounded-bl-md"}`,children:t.role==="assistant"?e.jsx("div",{className:"max-w-none space-y-2 text-foreground [&_p]:text-foreground [&_li]:text-foreground [&_strong]:text-foreground [&_strong]:font-semibold [&_em]:text-foreground [&_a]:text-primary [&_a]:underline [&_ul]:list-disc [&_ul]:pl-5 [&_hr]:my-3 [&_hr]:border-border",children:e.jsx(Xe,{children:t.content})}):t.content})},s)),p&&e.jsx("div",{className:"flex justify-start",children:e.jsxs("div",{className:"bg-muted rounded-2xl rounded-bl-md px-4 py-3 flex gap-1.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]"}),e.jsx("span",{className:"w-2 h-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]"}),e.jsx("span",{className:"w-2 h-2 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]"})]})}),w.length<=1&&!p&&e.jsx("div",{className:"flex flex-wrap gap-2 pt-2",children:gt.map(t=>e.jsx("button",{onClick:()=>Ne(t),className:"text-xs px-3 py-1.5 rounded-full border border-primary/40 text-primary hover:bg-primary/10 transition",children:t},t))})]})}),e.jsx("div",{className:"border-t border-border bg-card/60 px-4 sm:px-5 py-3",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[(j.length>0||V)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[j.map((t,s)=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-muted border border-border rounded-lg pl-2 pr-1 py-1 text-xs text-foreground",children:[e.jsx(tt,{className:"w-3.5 h-3.5 text-primary shrink-0"}),e.jsx("span",{className:"max-w-[160px] truncate",children:t.name}),e.jsx("button",{type:"button",onClick:()=>U(n=>n.filter((u,i)=>i!==s)),className:"p-0.5 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:e.jsx(ke,{className:"w-3.5 h-3.5"})})]},s)),V&&e.jsx("span",{className:"text-xs text-red-500",children:V})]}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),Ne(H)},className:"flex items-center gap-2",children:[e.jsx("input",{ref:A,type:"file",multiple:!0,className:"hidden",onChange:t=>Ve(t.target.files)}),e.jsx("button",{type:"button",onClick:()=>{var t;return(t=A.current)==null?void 0:t.click()},disabled:p,title:"Attach a file",className:"p-2.5 rounded-xl border border-border text-muted-foreground hover:text-foreground hover:bg-muted disabled:opacity-40 transition",children:e.jsx(ot,{className:"w-4 h-4"})}),e.jsx("input",{ref:fe,value:H,onChange:t=>O(t.target.value),disabled:p,placeholder:"Tell me what to change, or attach a file…",className:"flex-1 bg-muted border border-border rounded-xl px-4 py-3 text-[15px] text-foreground placeholder:text-muted-foreground/80 focus:outline-none focus:ring-1 focus:ring-primary"}),e.jsx("button",{type:"submit",disabled:!H.trim()&&j.length===0||p,className:"p-2.5 rounded-xl bg-primary text-primary-foreground disabled:opacity-40 hover:brightness-110 transition",children:e.jsx(Ke,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-[10px] text-muted-foreground text-center mt-2",children:"Changes go live in ~1–2 min and appear in the preview automatically. I edit text & content — not layout or design."})]})}),de&&e.jsxs("aside",{className:"absolute inset-y-0 right-0 w-80 max-w-[85%] border-l border-border bg-card shadow-2xl flex flex-col z-20",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border",children:[e.jsxs("p",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[e.jsx(Se,{className:"w-4 h-4 text-primary"})," Edits"]}),e.jsx("button",{onClick:()=>ce(!1),className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",children:e.jsx(ke,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4 space-y-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:"This session"}),E.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No edits yet. Changes you make will show up here."}):e.jsx("ul",{className:"space-y-2",children:E.map((t,s)=>e.jsxs("li",{className:"rounded-lg border border-border bg-background px-3 py-2",children:[e.jsx("p",{className:"text-foreground leading-snug",children:t.summary}),e.jsxs("p",{className:"text-[11px] text-muted-foreground mt-1 flex items-center gap-1",children:[e.jsx(Ze,{className:"w-3 h-3"})," ",ut(t.at),t.file?` · ${t.file.split("/").pop()}`:""]})]},s))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"All recent edits"}),e.jsx("button",{onClick:we,className:"text-[11px] text-primary hover:underline",children:"Refresh"})]}),Be?e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[e.jsx($,{className:"w-3.5 h-3.5 animate-spin"})," Loading…"]}):!P||P.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No past edits found."}):e.jsx("ul",{className:"space-y-2",children:P.map((t,s)=>e.jsxs("li",{className:"rounded-lg border border-border bg-background px-3 py-2",children:[e.jsx("p",{className:"text-foreground leading-snug",children:t.summary}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:mt(t.date)})]},s))})]})]})]})]}),e.jsxs("section",{className:`flex-1 flex-col min-w-0 bg-muted/40 ${I==="preview"?"flex":"hidden"} lg:flex`,children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border bg-card/70 backdrop-blur shrink-0",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsxs("select",{value:c,onChange:t=>ye(t.target.value),className:"appearance-none text-xs bg-muted border border-border rounded-lg pl-3 pr-7 py-1.5 text-foreground focus:outline-none focus:ring-1 focus:ring-primary curs
67or-pointer max-w-[170px] truncate",children:[_e.map(t=>e.jsx("option",{value:t.path,children:t.label},t.path)),!_e.some(t=>t.path===c)&&e.jsxs("option",{value:c,children:["Custom: ",c]})]}),e.jsx(Qe,{className:"w-3.5 h-3.5 absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"})]}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),ye(me)},className:"hidden sm:flex flex-1 min-w-0 items-center gap-1.5 bg-muted border border-border rounded-lg px-2.5 py-1.5 focus-within:ring-1 focus-within:ring-primary",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:Le}),e.jsx("input",{value:me,onChange:t=>F(t.target.value),onBlur:()=>F(c),spellCheck:!1,className:"flex-1 min-w-0 bg-transparent text-[11px] text-foreground focus:outline-none","aria-label":"Preview path"})]}),e.jsx("div",{className:"flex-1 sm:hidden"}),e.jsx("div",{className:"flex items-center rounded-lg border border-border p-0.5 shrink-0",children:Je.map(({id:t,Icon:s})=>e.jsx("button",{onClick:()=>ze(t),title:t[0].toUpperCase()+t.slice(1),className:`p-1.5 rounded-md transition ${W===t?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground"}`,children:e.jsx(s,{className:"w-4 h-4"})},t))}),e.jsx("button",{onClick:()=>K(t=>!t),title:"Click an element on the page to edit it",className:`p-1.5 rounded-md transition shrink-0 ${R?"bg-primary/15 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"}`,children:e.jsx(Ce,{className:"w-4 h-4"})}),e.jsx("button",{onClick:be,title:"Refresh preview",className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition shrink-0",children:e.jsx(it,{className:`w-4 h-4 ${L?"animate-spin":""}`})}),e.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",title:"Open in new tab",className:"p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition shrink-0",children:e.jsx(et,{className:"w-4 h-4"})})]}),R&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-primary/10 border-b border-primary/20 text-xs text-primary shrink-0",children:[e.jsx(Ce,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:"Click anything on the page below to edit it."}),e.jsx("button",{onClick:()=>K(!1),className:"ml-auto underline hover:no-underline shrink-0",children:"Cancel"})]}),xe&&e.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2 bg-primary/10 border-b border-primary/20 text-xs text-primary shrink-0",children:[e.jsxs("span",{className:"flex items-center gap-2 min-w-0",children:[e.jsx($,{className:"w-3.5 h-3.5 animate-spin shrink-0"}),e.jsx("span",{className:"truncate",children:"Publishing… I'll refresh this preview the moment it's live."})]}),e.jsx("button",{onClick:()=>{X(!1),x.current&&clearInterval(x.current),be()},className:"underline hover:no-underline shrink-0",children:"Refresh now"})]}),He&&!xe&&e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-green-500/10 border-b border-green-500/20 text-xs text-green-600 shrink-0",children:[e.jsx(ee,{className:"w-3.5 h-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:"Your change is live."})]}),e.jsx("div",{className:"flex-1 min-h-0 overflow-auto p-3 sm:p-5 flex justify-center",children:e.jsxs("div",{style:Ge,className:"relative h-full min-h-[480px] rounded-xl border border-border bg-white shadow-xl overflow-hidden flex flex-col transition-[width] duration-300 ease-out",children:[e.jsxs("div",{className:"flex items-center gap-2 h-8 px-3 bg-card border-b border-border shrink-0",children:[e.jsxs("span",{className:"flex gap-1.5",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-red-400/70"}),e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400/70"}),e.jsx("span",{className:"w-2.5 h-2.5 rounded-full bg-green-400/70"})]}),e.jsxs("span",{className:"mx-auto text-[10px] text-muted-foreground truncate max-w-[70%]",children:[Le,c]})]}),L&&e.jsx("div",{className:"absolute inset-x-0 bottom-0 top-8 flex items-center justify-center bg-white z-10",children:e.jsx($,{className:"w-6 h-6 animate-spin text-muted-foreground"})}),e.jsx("iframe",{ref:ge,src:Ye,title:"Site preview",onLoad:()=>T(!1),className:"flex-1 w-full bg-white"},G)]})})]})]})]})}export{yt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.