1import{eI as m,V as f,W as e,X as x,j as t}from"./index-Db5I4EsH.js";import{c as p,l as g}from"./posts.functions-DGuyvsSS.js";import{P as h}from"./post-editor-BqPIAz5H.js";function N(){const{id:a}=m.useParams(),s=f(),[n,c]=e.useState(null),[o,i]=e.useState("loading");return e.useEffect(()=>{(async()=>{const{data:d}=await x.auth.getUser();if(!d.user)return s({to:"/login"});try{const{isAdmin:l}=await p();if(!l)return s({to:"/admin"});const r=(await g()).find(u=>u.id===a)??null;if(!r){i("notfound");return}c(r),i("ready")}catch{s({to:"/login"})}})()},[a,s]),o==="loading"?t.jsx("div",{className:"p-12 text-center text-muted-foreground",children:"Loadingâ¦"}):o==="notfound"?t.jsx("div",{className:"p-12 text-center",children:"Post not found."}):t.jsxs("section",{className:"max-w-3xl mx-auto px-6 py-16",children:[t.jsx("h1",{className:"font-display text-4xl mb-8",children:"Edit post"}),n&&t.jsx(h,{initial:n})]})}export{N as component};
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.