1import{K as L,m as S,r as u,j as e,L as E,S as g}from"./app-m2ZZUNZw.js";import{A as D}from"./admin-layout-C91JKj_-.js";import{B as d}from"./button-CRVr6_Jn.js";import{I as n}from"./input-4JWFrMmk.js";import{L as a}from"./label-CDpbFxrK.js";import{C as j}from"./checkbox-D1-uNkkk.js";import{R as F}from"./rich-text-editor-DuJBHR5P.js";import{E as P}from"./external-link-DcWPyGpL.js";import{S as v}from"./save-CiC_mpEL.js";import{X as R}from"./x-CPNFyxTU.js";import{U}from"./upload-Cl02QRx7.js";/* empty css */import"./app-sidebar-header-BeHEwfqk.js";import"./createLucideIcon-h_FJXIk9.js";import"./app-logo-icon-DGsD5m6d.js";import"./breadcrumb-DkQFKr2Z.js";import"./index-lluC3nh6.js";import"./utils--0HDzF2j.js";import"./chevron-right-kLG2TwML.js";import"./tooltip-DVBzVA2t.js";import"./floating-ui.react-dom-WW8yS3hh.js";import"./floating-ui.dom-B7cXm8BB.js";import"./layout-dashboard-1YUSHNiB.js";import"./tag-BbQILWHS.js";import"./folder-tree-CQzKnXc3.js";import"./monitor-BZ3vkWgi.js";import"./file-text-DRvew6Hs.js";import"./sparkles-D3zaZYDw.js";import"./users-CXPmENOx.js";import"./mail-DvU1hLxm.js";import"./message-square-B38F35zt.js";import"./settings-C0yz9s95.js";import"./index-B-21rVin.js";import"./index-Doc5EJrq.js";import"./check-DDaIUxjw.js";import"./maximize-2-B6AgKRmK.js";import"./image-CCo3lgpY.js";function I(s){return s.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function je(){const{post:s}=L().props,N=[{title:"Dashboard",href:"/admin/dashboard"},{title:"Blog",href:"/admin/blog"},{title:"Edit Post",href:`/admin/blog/${s.id}/edit`}],{data:r,setData:i,put:_,processing:c,errors:l}=S({title:s.title??"",slug:s.slug??"",excerpt:s.excerpt??"",content:s.content??"",featured_image:"",featured_image_file:null,remove_image:!1,meta_title:s.meta_title??"",meta_description:s.meta_description??"",is_published:s.is_published??!1,published_at:s.published_at?s.published_at.slice(0,16):""}),y=s.image_url||s.featured_image||"",[p,x]=u.useState(y),o=u.useRef(null),w=t=>{var b;const h=(b=t.target.files)==null?void 0:b[0];h&&(i("featured_image_file",h),i("featured_image",""),i("remove_image",!1),x(URL.createObjectURL(h)))},C=()=>{i("featured_image_file",null),i("featured_image",""),i("remove_image",!0),x(""),o.current&&(o.current.value="")},[m,f]=u.useState(!1);u.useEffect(()=>{m&&r.title&&i("slug",I(r.title))},[r.title,m]);const k=t=>{t.preventDefault(),_(route("admin.blog.update",s.id),{forceFormData:!0})};return e.jsxs(D,{breadcrumbs:N,children:[e.jsx(E,{title:`Edit: ${s.title} â Blog`}),e.jsxs("div",{className:"max-w-[1400px] mx-auto px-4 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsx("h1",{className:"text-3xl font-extrabold tracking-tight",children:"Edit Post"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(d,{type:"button",variant:"outline",asChild:!0,children:e.jsxs("a",{href:`/blog/${s.slug}`,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(P,{className:"w-4 h-4 mr-1"}),"View Live"]})}),e.jsx(d,{type:"button",variant:"outline",onClick:()=>g.visit(route("admin.blog.index")),children:"Cancel"}),e.jsxs(d,{type:"submit",form:"blog-form",disabled:c,className:"min-w-[130px]",children:[e.jsx(v,{className:"w-4 h-4 mr-1"}),c?"Saving...":"Update Post"]})]})]}),e.jsx("form",{id:"blog-form",onSubmit:k,children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{htmlFor:"title",children:"Title *"}),e.jsx(n,{id:"title",value:r.title,onChange:t=>i("title",t.target.value),placeholder:"Post title",className:l.title?"border-red-500":""}),l.title&&e.jsx("p",{className:"text-red-500 text-sm",children:l.title})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a,{htmlFor:"slug",children:"Slug"}),e.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[e.jsx(j,{checked:m,onCheckedChange:t=>f(!!t)}),"Auto-generate"]})]}),e.jsx(n,{id:"slug",value:r.slug,onChange:t=>{f(!1),i("slug",t.target.value)},placeholder:"post-slug",disabled:m,className:"font-mono text-sm"}),r.slug&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["/blog/",r.slug]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{htmlFor:"excerpt",children:"Excerpt"}),e.jsx("textarea",{id:"excerpt",value:r.excerpt,onChange:t=>i("excerpt",t.target.value),placeholder:"Brief summary shown in listings and SEO",rows:3,maxLength:500,className:"flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[r.excerpt.length,"/500"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{children:"Content *"}),e.jsx(F,{value:r.content,onChange:t=>i("content",t),placeholder:"Write your post content here...",minHeight:500},s.id),l.content&&e.jsx("p",{className:"text-red-500 text-sm",children:l.content})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-4 border-t border-border",children:[e.jsx(d,{type:"button",variant:"outline",onClick:()=>g.visit(route("admin.blog.index")),children:"Cancel"}
1),e.jsxs(d,{type:"submit",disabled:c,className:"min-w-[130px]",children:[e.jsx(v,{className:"w-4 h-4 mr-1"}),c?"Saving...":"Update Post"]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-card border border-border rounded-xl p-5 space-y-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Publish"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(j,{id:"is_published",checked:r.is_published,onCheckedChange:t=>i("is_published",!!t)}),e.jsx(a,{htmlFor:"is_published",className:"font-normal cursor-pointer text-sm",children:r.is_published?"Visible to public":"Draft â hidden from public"})]}),e.jsxs("div",{className:"space-y-2 border-t border-border pt-4",children:[e.jsx(a,{htmlFor:"published_at",children:"Publish Date"}),e.jsx(n,{id:"published_at",type:"datetime-local",value:r.published_at,onChange:t=>i("published_at",t.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to publish immediately when toggled on"})]})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-5 space-y-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"Featured Image"}),p&&e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:p,alt:"Preview",className:"w-full aspect-video object-cover rounded-lg border border-border",onError:t=>t.target.style.display="none"}),e.jsx("button",{type:"button",onClick:C,className:"absolute top-2 right-2 w-6 h-6 bg-black/60 text-white rounded-full flex items-center justify-center hover:bg-black/80",children:e.jsx(R,{className:"w-3.5 h-3.5"})})]}),e.jsxs("div",{children:[e.jsx("input",{ref:o,type:"file",accept:"image/*",className:"hidden",onChange:w}),e.jsxs("button",{type:"button",onClick:()=>{var t;return(t=o.current)==null?void 0:t.click()},className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 border border-dashed border-border rounded-lg text-sm text-muted-foreground hover:border-primary hover:text-primary transition-colors",children:[e.jsx(U,{className:"w-4 h-4"}),p?"Change image":"Upload image"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(a,{htmlFor:"featured_image",className:"text-xs text-muted-foreground",children:"Or paste URL"}),e.jsx(n,{id:"featured_image",value:r.featured_image,onChange:t=>{i("featured_image",t.target.value),i("featured_image_file",null),i("remove_image",!1),x(t.target.value),o.current&&(o.current.value="")},placeholder:"https://example.com/image.jpg",className:"text-sm"})]})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl p-5 space-y-4",children:[e.jsx("h3",{className:"font-semibold text-sm text-muted-foreground uppercase tracking-wider",children:"SEO"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{htmlFor:"meta_title",children:"Meta Title"}),e.jsx(n,{id:"meta_title",value:r.meta_title,onChange:t=>i("meta_title",t.target.value),placeholder:"Defaults to post title",maxLength:255}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[r.meta_title.length,"/255"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a,{htmlFor:"meta_description",children:"Meta Description"}),e.jsx("textarea",{id:"meta_description",value:r.meta_description,onChange:t=>i("meta_description",t.target.value),placeholder:"Max 160 characters",rows:3,maxLength:160,className:"flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"}),e.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[r.meta_description.length,"/160"]}),l.meta_description&&e.jsx("p",{className:"text-red-500 text-sm",children:l.meta_description})]})]}),e.jsxs("div",{className:"bg-card border border-destructive/30 rounded-xl p-5 space-y-3",children:[e.jsx("h3",{className:"font-semibold text-sm text-destructive uppercase tracking-wider",children:"Danger Zone"}),e.jsx(d,{type:"button",variant:"destructive",size:"sm",className:"w-full",onClick:()=>{confirm("Delete this post? This action cannot be undone.")&&g.delete(route("admin.blog.destroy",s.id))},children:"Delete Post"})]})]})]})})]})]})}export{je 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.