1import{r as a,j as e}from"./three-pny7X8No.js";import{c,i as et}from"./index-CGL8chKl.js";import{U as ke,H as tt}from"./HtmlFrame-bObVfEC7.js";import{C as Se,f as Ce,s as Me,i as st,b as at,a as lt}from"./contentData-mC_EcMub.js";import{C as _e}from"./calendar-B3Xl9YUD.js";import{M as Le}from"./map-pin-C6Z8xTWR.js";import{L as nt}from"./link-AI_Q0Wod.js";import"./router-COUbMDE1.js";import"./motion-Vh4ILtUT.js";const rt=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],it=c("arrow-down",rt);const ot=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ct=c("arrow-up",ot);const dt=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ht=c("download",dt);const mt=[["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"}]],xt=c("eye",mt);const ut=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],gt=c("file-code",ut);const bt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],pt=c("file-plus",bt);const ft=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],yt=c("image",ft);const jt=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],vt=c("key-round",jt);const wt=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Te=c("lock",wt);const Nt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],kt=c("pencil",Nt);const St=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Ct=c("rocket",St);const Mt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_t=c("shield-check",Mt);const Lt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ee=c("trash-2",Lt),De="/api/blog-publish.php",Pe=()=>new Date().toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),de=(y,n)=>{const C=URL.createObjectURL(n),d=document.createElement("a");d.href=C,d.download=y,document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>URL.revokeObjectURL(C),1e4)},u="w-full bg-brand-darker border border-gray-700 rounded-lg px-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-brand-accent transition-colors",m="block text-gray-300 text-xs font-semibold uppercase tracking-wider mb-2",he={blog:"INSIGHTS",events:"EVENT","case-studies":"CASE STUDY"},Ht=()=>{const y=a.useMemo(()=>et(),[]),[n,C]=a.useState("blog"),[d,b]=a.useState([]),[o,O]=a.useState(null),[$e,M]=a.use
1State(null),[V,R]=a.useState(""),[j,B]=a.useState(""),[ze,_]=a.useState(""),[Fe,L]=a.useState(!1),[T,q]=a.useState(""),[E,G]=a.useState(he.blog),[J,W]=a.useState(Pe()),[D,Y]=a.useState("London"),[P,K]=a.useState(""),[me,Q]=a.useState(""),[$,X]=a.useState(""),[xe,Z]=a.useState(""),[p,z]=a.useState(""),[Ie,ee]=a.useState(""),[F,k]=a.useState("article"),[x,te]=a.useState(null),[Ae,ue]=a.useState(""),[se,ge]=a.useState(!1),[be,g]=a.useState(""),[pe,f]=a.useState(""),[I,w]=a.useState(!1),[He,ae]=a.useState(""),[le,ne]=a.useState(!1),[re,fe]=a.useState(""),[ye,S]=a.useState(!0),[je,ie]=a.useState(""),v=Se.find(t=>t.id===n),Ue=()=>{try{return window.localStorage.getItem("cocie_blog_token")??""}catch{return""}},ve=async t=>{const s=new FormData;s.set("action","verify"),s.set("token",t);const l=await fetch(De,{method:"POST",body:s});let i;try{i=await l.json()}catch{throw new Error("Cannot reach the publishing endpoint â the admin tools only work on the live site.")}return l.ok&&i.ok===!0};a.useEffect(()=>{if(!y){S(!1);return}const t=Ue();if(t===""){S(!1);return}let s=!1;return ve(t).then(l=>{if(!s)if(l)ae(t),ne(!0);else try{window.localStorage.removeItem("cocie_blog_token")}catch{}}).catch(()=>{}).finally(()=>{s||S(!1)}),()=>{s=!0}},[y]),a.useEffect(()=>{!y||!le||Ce(n).then(b).catch(()=>b([]))},[y,le,n]);const Oe=async()=>{const t=re.trim();if(t!==""){ie(""),S(!0);try{if(await ve(t)){try{window.localStorage.setItem("cocie_blog_token",t)}catch{}ae(t),ne(!0),fe("")}else ie("That token is not valid.")}catch(s){ie(s instanceof Error?s.message:"Verification failed")}finally{S(!1)}}},Ve=()=>{try{window.localStorage.removeItem("cocie_blog_token")}catch{}ae(""),ne(!1),b([])};if(!y)return e.jsx("div",{className:"min-h-screen bg-brand-dark flex items-center justify-center",children:e.jsx("p",{className:"text-gray-400",children:"Page not found."})});if(!le)return e.jsxs("div",{className:"min-h-screen bg-brand-dark relative overflow-hidden flex items-center justify-center px-4",children:[e.jsx("div",{className:"absolute top-0 right-1/4 w-96 h-96 bg-brand-accent/5 rounded-full blur-3xl"}),e.jsxs("div",{className:"relative w-full max-w-md bg-brand-card/40 border border-gray-700 rounded-2xl p-8",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-brand-accent/10 border border-brand-accent/30 rounded-full mb-6",children:[e.jsx(Te,{className:"h-4 w-4 text-brand-accent"}),e.jsx("span",{className:"text-brand-accent text-sm font-medium",children:"CONTENT ADMIN"})]}),e.jsx("h1",{className:"text-2xl font-bold text-white mb-2 tracking-tight",children:"Publish token required"}),e.jsx("p",{className:"text-gray-400 text-sm leading-relaxed mb-6",children:"Enter your publish token to use the content tools."}),e.jsxs("form",{onSubmit:t=>{t.preventDefault(),Oe()},children:[e.jsx("input",{type:"password",className:u,value:re,onChange:t=>fe(t.target.value),placeholder:"Publish token",autoComplete:"off",autoFocus:!0}),e.jsxs("button",{type:"submit",disabled:re.trim()===""||ye,className:"mt-4 w-full inline-flex items-center justify-center gap-2 px-5 py-2.5 bg-brand-accent hover:bg-brand-accent-hover text-brand-darker rounded-full font-bold text-sm transition-all shadow-md shadow-brand-accent/20 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(vt,{size:16}),ye?"Checkingâ¦":"Unlock"]})]}),je&&e.jsx("p",{className:"text-red-400 text-sm mt-4",children:je})]})]});const r=Fe?ze:Me(j),Re=x?(x.name.split(".").pop()??"jpg").toLowerCase():"",oe=x?`${r}-header.${Re}`:"",A=Ae||V,Be=x!==null||V!=="",H=j.trim()!==""&&st(r)&&p.trim()!==""&&Be,U=(t=n)=>{O(null),M(null),R(""),B(""),_(""),L(!1),q(""),G(he[t]),W(Pe()),Y("London"),K(""),Q(""),X(""),Z(""),z(""),ee(""),k("article"),te(null),ue(""),ge(!1),g(""),f("")},qe=t=>{t!==n&&(C(t),U(t))},Ge=async t=>{U(),O(t.slug),B(t.title),_(t.slug),L(!0),q(t.subtitle??""),G(t.category??""),W(t.date),Y(t.location??""),K(t.author??""),Q(t.link??""),X(t.stat??""),Z((t.partners??[]).join(", ")),k(t.layout==="page"?"page":"article"),R(t.image);try{const s=await lt(n,t.slug);z(s),ee(`${t.slug}.html (current version)`)}catch{g("Could not load the current body â upload the HTML file manually.")}window.scrollTo({top:0,behavior:"smooth"})},ce=async t=>{t.set("token",He.trim()),t.set("collection",n);const s=await fetch(De,{method:"POST",body:t});let l;try{l=await s.json()}catch{throw new Error("Publishing endpoint not reachable â it only works on the live site (not the local dev server).")}if(!s.ok||!l.ok||!Array.isArray(l.posts))throw new Error(l.error??`Publish failed (${s.status})`);return l.posts},Je=async t=>{M(null),g(""),f(""),o===t.slug&&U();const s=new FormData;s.set("action","delete"),s.set("slug",t.slug);try{w(!0);const l=await ce(s);b(l),g(`Deleted "${t.title}" from the live site.`)}catch(l){f(l instanceof Error?l.message:"Delete failed")}finally{w(!1)}},we=async(t,s)=>{const l=t+s;if(l<0||l>=d.length)return;g(""),f("");const i=[...d];[i[t],i[l]]=[i[l],i[t]],b(i);const h=new FormData;h.set("action","reorder"),h.set("slugs",JSON.stringify(i.map(N=>N.slug)));try{w(!0),b(await ce(h)),g("Order updated on the live site.")}catch(N){b(d),f(N instanceof Error?N.message:"Reorder failed")}finally{w(!1)}},We=t=>{t&&t.text().then(s=>{if(at(s))z(s.trim()),k("page");else{const l=new DOMParser().parseFromString(s,"text/html");z(l.body.innerHTML.trim()),k("article")}ee(t.name)})},Ye=t=>{if(!t)return;te(t);const s=new FileReader;s.onload=()=>ue(String(s.result)),s.readAsDataURL(t)},Ne=()=>{const t=xe.split(",").map(s=>s.trim()).filter(s=>s!=="");return{slug:r,title:j.trim(),subtitle:T.trim()||void 0,category:E.trim()||void 0,date:J.trim(),author:P.trim()||void 0,location:D.trim()||void 0,link:me.trim()||void 0,stat:$.trim()||void 0,partners:t.length>0?t:void 0,layout:F,image:x?`/content/${n}/${oe}`:V,imageAlt:j.trim()}},Ke=async()=>
1{if(!H)return;g(""),f("");const t=new FormData;t.set("action","publish"),t.set("meta",JSON.stringify(Ne())),t.set("html",p),o&&t.set("editingSlug",o),x&&t.set("image",x);try{w(!0);const s=await ce(t);b(s);const l=s.find(i=>i.slug===r);O(r),L(!0),_(r),l&&R(l.image),te(null),g(`Published live â now at ${v.route}/${r}.`)}catch(s){f(s instanceof Error?s.message:"Publish failed")}finally{w(!1)}},Qe=async()=>{if(!H)return;g(""),f("");const t=Ne();let s=[];try{s=await Ce(n)}catch{}let l;o!==null&&s.some(h=>h.slug===o)?l=s.map(h=>h.slug===o?t:h).filter((h,N,Xe)=>Xe.findIndex(Ze=>Ze.slug===h.slug)===N):l=[t,...s.filter(h=>h.slug!==r)];const i=[`${r}.html`,"posts.json"];de(`${r}.html`,new Blob([p],{type:"text/html"})),x&&(i.splice(1,0,oe),window.setTimeout(()=>de(oe,x),400)),window.setTimeout(()=>de("posts.json",new Blob([JSON.stringify(l,null,2)],{type:"application/json"})),800),b(l),g(`Downloaded ${i.join(", ")}. Copy them into public/content/${n}/ and run ./deploy.sh.`)};return e.jsxs("div",{className:"min-h-screen bg-brand-dark relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-0 right-1/4 w-96 h-96 bg-brand-accent/5 rounded-full blur-3xl"}),e.jsxs("div",{className:"py-32 px-4 sm:px-6 lg:px-8 max-w-4xl mx-auto relative",children:[e.jsxs("div",{className:"mb-10",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 mb-6",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 bg-brand-accent/10 border border-brand-accent/30 rounded-full",children:[e.jsx(_t,{className:"h-4 w-4 text-brand-accent"}),e.jsx("span",{className:"text-brand-accent text-sm font-medium",children:"CONTENT ADMIN"})]}),e.jsxs("button",{onClick:Ve,className:"inline-flex items-center gap-1.5 px-4 py-2 bg-white/5 border border-white/20 hover:bg-white/10 text-gray-300 hover:text-white rounded-full text-xs font-medium transition-all",children:[e.jsx(Te,{size:12}),"Lock"]})]}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-white mb-4 tracking-tight",children:o?`Edit ${v.label.toLowerCase().replace(/s$/,"")}`:`Create ${n==="events"?"an event":n==="case-studies"?"a case study":"a blog post"}`}),e.jsx("p",{className:"text-gray-400 text-sm md:text-base leading-relaxed",children:"Fill in the details, upload the body as an HTML file and a header image, preview the result, then publish live or download the generated files. Select an existing item below to edit it."})]}),e.jsx("div",{className:"flex gap-2 mb-8",children:Se.map(t=>e.jsx("button",{onClick:()=>qe(t.id),className:`px-5 py-2 rounded-full text-sm font-semibold transition-all ${n===t.id?"bg-brand-accent text-brand-darker shadow-md shadow-brand-accent/20":"bg-white/5 border border-white/20 text-gray-300 hover:bg-white/10"}`,children:t.label},t.id))}),e.jsxs("div",{className:"bg-brand-card/40 border border-gray-700 rounded-2xl p-6 md:p-8 space-y-6",children:[o&&e.jsxs("div",{className:"flex items-center justify-between gap-4 bg-brand-accent/10 border border-brand-accent/30 rounded-lg px-4 py-3",children:[e.jsxs("p",{className:"text-brand-accent text-sm",children:["Editing ",e.jsxs("span",{className:"font-semibold",children:[v.route,"/",o]})]}),e.jsxs("button",{onClick:()=>U(),className:"inline-flex items-center gap-1.5 text-gray-300 hover:text-white text-sm font-medium transition-colors shrink-0",children:[e.jsx(pt,{size:14}),"New item"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Title *"}),e.jsx("input",{className:u,value:j,onChange:t=>B(t.target.value),placeholder:"Title"})]}),e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Slug (URL) *"}),e.jsx("input",{className:u,value:r,onChange:t=>{L(!0),_(Me(t.target.value))},placeholder:"auto-generated-from-title"}),e.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:["Will live at ",v.route,"/",r||"â¦"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Subtitle"}),e.jsx("textarea",{className:`${u} resize-none`,rows:2,value:T,onChange:t=>q(t.target.value),placeholder:"One-sentence standfirst shown under the title"})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Category tag"}),e.jsx("input",{className:u,value:E,onChange:t=>G(t.target.value),placeholder:he[n]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:m,children:[e.jsx(_e,{className:"inline h-3 w-3 mr-1"}),"Date *"]}),e.jsx("input",{className:u,value:J,onChange:t=>W(t.target.value)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:m,children:[e.jsx(Le,{className:"inline h-3 w-3 mr-1"}),"Location"]}),e.jsx("input",{className:u,value:D,onChange:t=>Y(t.target.value)})]}),e.jsxs("div",{children:[e.jsxs("label",{className:m,children:[e.jsx(ke,{className:"inline h-3 w-3 mr-1"}),"Author"]}),e.jsx("input",{className:u,value:P,onChange:t=>K(t.target.value),placeholder:"Name, role"})]}
1),e.jsxs("div",{className:n==="case-studies"?"":"md:col-span-2",children:[e.jsxs("label",{className:m,children:[e.jsx(nt,{className:"inline h-3 w-3 mr-1"}),"Link override"]}),e.jsx("input",{className:u,value:me,onChange:t=>Q(t.target.value),placeholder:"Optional: card links here instead of the detail page"})]}),n==="case-studies"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:m,children:"Result stat"}),e.jsx("input",{className:u,value:$,onChange:t=>X(t.target.value),placeholder:'e.g. "72% lower eCPM"'})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:m,children:"Partners (comma-separated)"}),e.jsx("input",{className:u,value:xe,onChange:t=>Z(t.target.value),placeholder:"e.g. dentsu B2B, PubMatic, Cocie AI"})]})]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:m,children:[e.jsx(gt,{className:"inline h-3 w-3 mr-1"}),"Body (HTML file) *"]}),e.jsxs("label",{className:"flex items-center justify-center gap-2 border border-dashed border-gray-600 hover:border-brand-accent rounded-lg px-4 py-6 text-sm text-gray-400 hover:text-brand-accent cursor-pointer transition-colors",children:[Ie||"Choose .html file",e.jsx("input",{type:"file",accept:".html,.htm,text/html",className:"hidden",onChange:t=>We(t.target.files?.[0])})]}),e.jsxs("p",{className:"text-gray-500 text-xs mt-1.5",children:[F==="page"?"Full designed page detected â it keeps its own styling and is shown exactly as authored.":"Article fragment: p, h2âh4, blockquote, ul/ol, table, a, img. Styling is applied automatically, and the page adds the title and subtitle above the body â don't repeat them inside the file.",o&&" The current body is loaded â upload a file only to replace it."]}),p!==""&&e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx("span",{className:"text-gray-500 text-xs",children:"Render as:"}),["article","page"].map(t=>e.jsx("button",{onClick:()=>k(t),className:`px-3 py-1 rounded-full text-xs font-semibold transition-all ${F===t?"bg-brand-accent text-brand-darker":"bg-white/5 border border-white/20 text-gray-300 hover:bg-white/10"}`,children:t==="article"?"Article":"Full page"},t))]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:m,children:[e.jsx(yt,{className:"inline h-3 w-3 mr-1"}),"Header image ",o?"":"*"]}),e.jsxs("label",{className:"flex items-center justify-center gap-2 border border-dashed border-gray-600 hover:border-brand-accent rounded-lg px-4 py-6 text-sm text-gray-400 hover:text-brand-accent cursor-pointer transition-colors overflow-hidden",children:[x?x.name:o?"Choose image to replace current":"Choose image (16:9 recommended)",e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:t=>Ye(t.target.files?.[0])})]}),A&&e.jsx("div",{className:"mt-3 aspect-[16/9] rounded-lg overflow-hidden border border-gray-700",children:e.jsx("img",{src:A,alt:"Header preview",className:"w-full h-full object-cover"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-4 pt-2",children:[e.jsxs("button",{onClick:()=>ge(!se),disabled:p==="",className:"inline-flex items-center gap-2 px-5 py-2.5 bg-white/5 border border-white/20 hover:bg-white/10 text-white rounded-full font-medium text-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(xt,{size:16}),se?"Hide preview":"Preview"]}),e.jsxs("button",{onClick:Ke,disabled:!H||I,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-brand-accent hover:bg-brand-accent-hover text-brand-darker rounded-full font-bold text-sm transition-all shadow-md shadow-brand-accent/20 disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Ct,{size:16}),I?"Publishingâ¦":"Publish live"]}),e.jsxs("button",{onClick:Qe,disabled:!H,className:"inline-flex items-center gap-2 px-5 py-2.5 bg-white/5 border border-white/20 hover:bg-white/10 text-white rounded-full font-medium text-sm transition-all disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(ht,{size:16}),"Download files"]})]}),be&&e.jsx("p",{className:"text-brand-accent text-sm",children:be}),pe&&e.jsx("p",{className:"text-red-400 text-sm",children:pe})]}),e.jsxs("div",{className:"mt-8 bg-brand-card/40 border border-gray-700 rounded-2xl p-6 md:p-8",children:[e.jsxs("h2",{className:"text-white font-bold text-lg mb-1",children:["Existing ",v.label.toLowerCase()]}),e.jsx("p",{className:"text-gray-500 text-xs mb-4",children:"Shown on the site in this order â use the arrows to change it."}),d.length===0?e.jsx("p",{className:"text-gray-500 text-sm",children:"Nothing in this collection yet."}):e.jsx("ul",{className:"divide-y divide-gray-700/60",children:d.map((t,s)=>e.jsxs("li",{className:"flex items-center justify-between gap-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:`text-sm font-medium truncate ${o===t.slug?"text-brand-accent":"text-white"}`,children:t.title}),e.jsxs("p",{className:"text-gray-500 text-xs mt-0.5 truncate",children:[v.route,"/",t.slug," · ",t.date]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("button",{onClick:()=>we(s,-1),disabled:s===0||I,title:"Move up",className:"text-gray-400 hover:text-brand-accent disabled:opacity-25 disabled:hover:text-gray-400 transition-colors",children:e.jsx(ct,{size:14})}),e.jsx("button",{onClick:()=>we(s,1),disabled:s===d.length-1||I,title:"Move down",className:"text-gray-400 hover:text-brand-accent disabled:opacity-25 disabled:hover:text-gray-400 transition-colors",children:e.jsx(it,{size:14})})]}),e.jsxs("button",{onClick:()=>Ge(t),className:"inline-flex items-center gap-1.5 px-4 py-1.5 bg-white/5 border border-white/20 hover:bg-white/10 text-white rounded-full text-xs font-medium transition-all",children:[e.jsx(kt,{size:12}),"Edit"]}),$e===t.slug?e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>Je(t),className:"inline-flex items-center gap-1.5 px-4 py-1.5 bg-red-500/80 hover:bg-red-500 text-white rounded-full text-xs font-semibold transition-all",children:[e.jsx(Ee,{size:12}),"Confirm delete"]}),e.jsx("button",{onClick:()=>M(null),className:"px-3 py-1.5 text-gray-400 hover:text-white text-xs font-medium transition-colors",children:"Cancel"})]}):e.jsxs("button",{onClick:()=>M(t.slug),className:"inline-flex items-center gap-1.5 px-4 py-1.5 bg-white/5 border border-red-400/30 hover:bg-red-500/10 text-red-300 rounded-full text-xs font-medium transition-all",children:[e.jsx(Ee,{size:12}),"Delete"]})]})]},t.slug))})]}),e.jsxs("div",{className:"mt-8 bg-brand-card/40 border border-gray-700 rounded-2xl p-6 md:p-8",children:[e.jsx("h2",{className:"text-white font-bold text-lg mb-4",children:"How publishing works"}),e.jsxs("div",{className:"space-y-4 text-gray-400 text-sm leading-relaxed",children:[e.jsxs("p",{children:[e.jsx("span",{className:"text-white font-semibold",children:"Publish live"})," (recommended): the item is saved directly onto the live site and is visible at"," ",e.jsxs("code",{className:"text-brand-accent",children:["cocie.ai",v.route,"/",r||"<slug>"]})," immediately. Works only on the live site, not on a local dev server."]}),e.jsxs("p",{children:[e.jsx("span",{className:"text-white font-semibold",children:"Download files"})," (manual fallback): downloads"," ",e.jsxs("code",{className:"text-brand-accent",children:[r||"<slug>",".html"]}),", the renamed header image (only if you chose a new one) and an updated ",e.jsx("code",{className:"text-brand-accent",children:"posts.json"}),". Copy them into ",e.jsxs("code",{className:"text-brand-accent",children:["public/content/",n,"/"]})," in the website project and run ",e.jsx("code",{className:"text-brand-accent",children:"./deploy.sh"}),"."]})]})]}),se&&p!==""&&e.jsxs("div",{className:"mt-12",children:[e.jsx("h2",{className:"text-white font-bold text-lg mb-6",children:"Preview"}),F==="page"?e.jsx("div",{className:"rounded-2xl overflow-hidden shadow-lg bg-white",children:e.jsx(tt,{html:p,title:j||"Preview"})}):e.jsxs("article",{className:"bg-gradient-to-b from-white to-gray-50 rounded-2xl overflow-hidden shadow-lg",children:[e.jsx("div",{className:"h-1 bg-gradient-to-r from-brand-accent to-teal-400"}),A&&e.jsx("div",{className:"w-full aspect-[16/9] overflow-hidden bg-brand-darker",children:e.jsx("img",{src:A,alt:"Header",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-8 md:p-10",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4 mb-5",children:[E&&e.jsx("span",{className:"text-teal-700 text-xs font-semibold tracking-widest uppercase",children:E}),e.jsxs("span",{className:"flex items-center gap-1.5 text-gray-400 text-xs",children:[e.jsx(_e,{size:12}),J]}),D&&e.jsxs("span",{className:"flex items-center gap-1.5 text-gray-400 text-xs",children:[e.jsx(Le,{size:12}),D]}),P&&e.jsxs("span",{className:"flex items-center gap-1.5 text-gray-400 text-xs",children:[e.jsx(ke,{size:12}),P]}),$&&e.jsx("span",{className:"ml-auto px-3 py-1 bg-teal-50 text-teal-700 text-xs font-bold rounded-full",children:$})]}),e.jsx("h1",{className:"text-gray-900 font-bold text-2xl md:text-3xl mb-4 leading-tight",children:j||"Untitled"}),T&&e.jsx("p",{className:"text-teal-700 font-medium text-sm md:text-base mb-6",children:T}),e.jsx("div",{className:"blog-content",dangerouslySetInnerHTML:{__html:p}})]})]})]})]})]})};export{Ht 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.