PageSourceSearch

https://pitchlab.app/assets/CmsArticleEditor-DB3DPEdN.js

js pitchlab.app collected 2026-10-02 15:48:15 UTC 24,372 bytes, 86 lines download raw bytes

1import{c as h,r as x,j as e,d as oe,u as ie,L as ce,q as K,B as C}from"./index-CcGAw3F1.js";import{t as de,s as ne,c as me,A as H,b as ue,d as pe,e as ge,n as X,f as xe,u as Z}from"./articles-Bsi3m0k1.js";import{L as he,U as fe,R as be}from"./undo-2-CrgGtsmF.js";import{I as ye}from"./image-j3xfmTin.js";import{V as ke}from"./video-ChURR-52.js";import{C as ve}from"./CmsAccessGate-B3QFj7o1.js";import{A as je}from"./arrow-left-B9KbX1p3.js";import{T as Ne}from"./trash-2-CV7QXGiW.js";import{S as we}from"./save-DKN-Ajcm.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 Ce=h("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
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 Ee=h("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
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 Ae=h("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
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 Me=h("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
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 Le=h("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"}]]);/**
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 Se=h("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
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 Te=h("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
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 He=h("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/**
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 Ie=h("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
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 Ue=h("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
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 qe=h("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
57 * @license lucide-react v0.462.0 - ISC
58 *
59 * This source code is licensed under the ISC license.
60 * See the LICENSE file in the root directory of this source tree.
61 */const Re=h("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/**
62 * @license lucide-react v0.462.0 - ISC
63 *
64 * This source code is licensed under the ISC license.
65 * See the LICENSE file in the root directory of this source tree.
66 */const De=h("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
67 * @license lucide-react v0.462.0 - ISC
68 *
69 * This source code is licensed under the ISC license.
70 * See the LICENSE file in the root directory of this source tree.
71 */const Be=h("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
72 * @license lucide-react v0.462.0 - ISC
73 *
74 * This source code is licensed under the ISC license.
75 * See the LICENSE file in the root directory of this source tree.
76 */const Pe=h("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/**
77 * @license lucide-react v0.462.0 - ISC
78 *
79 * This source code is licensed under the ISC license.
80 * See the LICENSE file in the root directory of this source tree.
81 */const ze=h("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",ke
81y:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
82 * @license lucide-react v0.462.0 - ISC
83 *
84 * This source code is licensed under the ISC license.
85 * See the LICENSE file in the root directory of this source tree.
86 */const Ve=h("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),p=({icon:o,label:b,onClick:i,disabled:y=!1})=>e.jsx("button",{type:"button",onClick:i,disabled:y,title:b,"aria-label":b,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-line bg-surface text-ink transition hover:bg-canvas disabled:cursor-not-allowed disabled:opacity-50",children:e.jsx(o,{className:"h-4 w-4"})}),$=o=>(o||"").replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Oe="p,h2,h3,h4,blockquote,figure,figcaption,li,ul,ol,div",re="​",Fe="p,h2,h3,h4,blockquote,li,figcaption,div",T=o=>{const b=document.createRange(),i=window.getSelection();b.selectNodeContents(o),b.collapse(!1),i==null||i.removeAllRanges(),i==null||i.addRange(b)},ee=()=>{const o=document.createElement("p");return o.setAttribute("data-editor-empty","true"),o.appendChild(document.createTextNode(re)),o},te=o=>{if(!o)return!1;const b=o.querySelectorAll("p,h2,h3,h4,blockquote,figure,ul,ol,li,div");return b.length===0?!1:[...b].some(i=>i.parentElement!==o)||b.length>1||o.querySelector("figure,img,iframe")},$e=({value:o,onChange:b,onImageUpload:i,onListImages:y,disabled:r=!1})=>{const d=x.useRef(null),I=x.useRef(null),[A,P]=x.useState(!1),[z,U]=x.useState(!1),[M,N]=x.useState(!1),[w,L]=x.useState([]),[j,q]=x.useState(null);x.useEffect(()=>{const t=d.current;!t||document.activeElement===t||t.innerHTML!==o&&(t.innerHTML=o||"")},[o]);const k=()=>{var n;const t=ne(((n=d.current)==null?void 0:n.innerHTML)||"");b(t)},v=()=>{var t;(t=d.current)==null||t.querySelectorAll('p[data-editor-empty="true"]').forEach(n=>{const a=n.textContent||"";a.replace(/\u200B/g,"").trim()&&(n.removeAttribute("data-editor-empty"),n.textContent=a.replace(/\u200B/g,""),T(n))})},_=()=>{v(),k()},g=(t,n=null)=>{var a;(a=d.current)==null||a.focus(),document.execCommand(t,!1,n),k()},R=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const n=t.anchorNode;return(n==null?void 0:n.nodeType)===Node.ELEMENT_NODE?n:n==null?void 0:n.parentElement},V=()=>{var a;const t=R();if(!t||!((a=d.current)!=null&&a.contains(t)))return null;const n=t.closest(Fe);return!n||!d.current.contains(n)||n===d.current||n.matches("div")&&te(n)?null:n},D=t=>{const n=document.createElement("p");return n.innerHTML=t.innerHTML||t.textContent||"<br>",n.querySelectorAll("figure").forEach(a=>{if(!a.querySelector("img, iframe")){const c=document.createElement("span");c.innerHTML=a.innerHTML||a.textContent||"",a.replaceWith(c)}}),n},W=()=>{var c;(c=d.current)==null||c.focus();const t=V();if(!t||t===d.current){g("formatBlock","p");return}const n=t.matches("h2,h3,h4")?[...t.querySelectorAll("figure")]:[];if(n.length>0){const l=document.createDocumentFragment();n.forEach(f=>{if(f.querySelector("img, iframe")){l.appendChild(f.cloneNode(!0));return}l.appendChild(D(f))}),l.childNodes.length||l.appendChild(D(t)),t.replaceWith(l),k();return}const a=D(t);t.replaceWith(a),T(a),k()},S=t=>{var c;(c=d.current)==null||c.focus();const n=V();if(!n||n===d.current){g("formatBlock",t);return}if(n.matches("figure")&&n.querySelector("img, iframe")){const l=document.createElement(t);l.textContent="Heading",n.insertAdjacentElement("afterend",l),T(l),k();return}const a=document.createElement(t);a.innerHTML=n.innerHTML||n.textContent||"Heading",a.querySelectorAll("figure").forEach(l=>{if(!l.querySelector("img, iframe")){const f=document.createElement("span");f.innerHTML=l.innerHTML||l.textContent||"",l.replaceWith(f)}}),n.replaceWith(a),T(a),k()},B=t=>{var c,l,f;(c=d.current)==null||c.focus();const n=R(),a=n==null?void 0:n.closest(Oe);if(a&&((l=d.current)!=null&&l.contains(a))&&!(a.matches("div")&&te(a))){a.setAttribute("data-align",t),a.tagName==="FIGCAPTION"&&((f=a.closest("figure"))==null||f.setAttribute("data-align",t)),k();return}g(t==="center"?"justifyCenter":t==="right"?"justifyRight":"justifyLeft")},O=()=>{const t=window.prompt("Paste the link URL");t&&g("createLink",t)},s=()=>{g("insertHTML","<hr>")},m=()=>{const t=window.prompt("Paste a YouTube or Vimeo URL");if(!t)return;const n=de(t);if(!n){window.alert("Use a valid YouTube or Vimeo URL.");return}const a=`<figure><div class="article-embed"><iframe src="${$(n)}" title="Embedded video" frameborder="0" allowfullscreen></iframe></div></figure>`;g("insertHTML",a)},u=t=>{const n=window.prompt("Image alt text",t.alt||"")||"",a=d.current,c=window.getSelection();if(!a||!c||c.rangeCount===0){const F=`<figure><img src="${$(t.url)}" alt="${$(n)}">${n?`<figcaption>${$(n)}</figcaption>`:""}</figure><p data-editor-empty="true">${re}</p>`;g("insertHTML",F);return}const l=document.createElement("figure"),f=document.createElement("img"),Y=ee(),G=document.createDocumentFragment();if(f.src=t.url,f.alt=n,l.appendChild(f),n){const F=document.createElement("figcaption");F.textContent=n,l.appendChild(F)}G.appendChild(l),G.appendChild(Y);const J=c.getRangeAt(0);
86J.deleteContents(),J.insertNode(G),T(Y),k()},E=t=>{var f;if(t.key!=="Enter")return;const n=R(),a=n==null?void 0:n.closest("figcaption"),c=a==null?void 0:a.closest("figure");if(!a||!c||!((f=d.current)!=null&&f.contains(c)))return;t.preventDefault();const l=ee();c.insertAdjacentElement("afterend",l),T(l),k()},ae=async t=>{var a;const n=(a=t.target.files)==null?void 0:a[0];if(t.target.value="",!(!n||!i)){P(!0);try{const c=await i(n);u(c)}finally{P(!1)}}},se=async()=>{if(y){U(!0),N(!0),q(null);try{const t=await y();L(t)}catch(t){q(t)}finally{N(!1)}}},le=t=>{u(t),U(!1)};return e.jsxs("div",{className:"rounded-lg border border-line bg-surface",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 border-b border-line bg-canvas p-3",children:[e.jsx(p,{icon:Me,label:"Bold",disabled:r,onClick:()=>g("bold")}),e.jsx(p,{icon:Ie,label:"Italic",disabled:r,onClick:()=>g("italic")}),e.jsx(p,{icon:ze,label:"Underline",disabled:r,onClick:()=>g("underline")}),e.jsx(p,{icon:Re,label:"Normal text",disabled:r,onClick:W}),e.jsx(p,{icon:Se,label:"Heading 2",disabled:r,onClick:()=>S("h2")}),e.jsx(p,{icon:Te,label:"Heading 3",disabled:r,onClick:()=>S("h3")}),e.jsx(p,{icon:he,label:"Bulleted list",disabled:r,onClick:()=>g("insertUnorderedList")}),e.jsx(p,{icon:qe,label:"Numbered list",disabled:r,onClick:()=>g("insertOrderedList")}),e.jsx(p,{icon:De,label:"Quote",disabled:r,onClick:()=>g("formatBlock","blockquote")}),e.jsx(p,{icon:Ue,label:"Link",disabled:r,onClick:O}),e.jsx(p,{icon:ye,label:A?"Uploading image":"Upload image",disabled:r||A,onClick:()=>{var t;return(t=I.current)==null?void 0:t.click()}}
86),e.jsx(p,{icon:He,label:"Choose existing image",disabled:r||!y,onClick:se}),e.jsx(p,{icon:ke,label:"Embed video",disabled:r,onClick:m}),e.jsx(p,{icon:Pe,label:"Divider",disabled:r,onClick:s}),e.jsx(p,{icon:Ee,label:"Align left",disabled:r,onClick:()=>B("left")}),e.jsx(p,{icon:Ce,label:"Align center",disabled:r,onClick:()=>B("center")}),e.jsx(p,{icon:Ae,label:"Align right",disabled:r,onClick:()=>B("right")}),e.jsx(p,{icon:fe,label:"Undo",disabled:r,onClick:()=>g("undo")}),e.jsx(p,{icon:be,label:"Redo",disabled:r,onClick:()=>g("redo")}),e.jsx("input",{ref:I,type:"file",accept:"image/*",className:"hidden",onChange:ae})]}),e.jsx("div",{ref:d,role:"textbox","aria-label":"Article body",contentEditable:!r,suppressContentEditableWarning:!0,onInput:_,onBlur:k,onKeyDown:E,className:"article-body min-h-[420px] px-5 py-4 text-left outline-none"}),z&&e.jsx("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/50 px-4",children:e.jsxs("div",{className:"max-h-[80vh] w-full max-w-3xl overflow-hidden rounded-lg bg-surface shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-ink",children:"Choose an image"}),e.jsx("button",{type:"button",onClick:()=>U(!1),className:"rounded-md px-3 py-1 text-sm font-semibold text-muted hover:bg-raised",children:"Close"})]}),e.jsxs("div",{className:"max-h-[60vh] overflow-y-auto p-5",children:[M&&e.jsx("p",{className:"text-sm text-muted",children:"Loading images..."}),j&&e.jsx("p",{className:"rounded-md border border-danger-line bg-danger-soft p-3 text-sm text-danger",children:j.message||"Unable to load images."}),!M&&!j&&w.length===0&&e.jsx("p",{className:"rounded-md border border-dashed border-line p-6 text-center text-sm text-muted",children:"No images have been uploaded for this article yet."}),!M&&!j&&w.length>0&&e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 md:grid-cols-3",children:w.map(t=>e.jsxs("button",{type:"button",onClick:()=>le(t),className:"overflow-hidden rounded-lg border border-line bg-surface text-left transition hover:border-amber-400 hover:shadow-sm",children:[e.jsx("img",{src:t.url,alt:t.alt||t.name,className:"aspect-video w-full object-cover"}),e.jsx("span",{className:"block truncate px-3 py-2 text-xs font-medium text-muted",children:t.name})]},t.storagePath))})]})]})})]})},Q={title:"",slug:"",excerpt:"",contentHtml:"",coverImage:null,seoTitle:"",seoDescription:"",tags:[],status:H.DRAFT},_e=()=>{var O;const{postId:o}=oe(),b=ie(),i=!o||o==="new",y=x.useMemo(()=>i?me():o,[i,o]),[r,d]=x.useState(Q),[I,A]=x.useState(""),[P,z]=x.useState(!1),[U,M]=x.useState(!i),[N,w]=x.useState(!1),[L,j]=x.useState(null),[q,k]=x.useState(!1);x.useEffect(()=>{if(i)return;let s=!0;return(async()=>{M(!0),j(null);try{const u=await ue(y);if(!u)throw new Error("Article not found.");s&&(d({...Q,...u}),A((u.tags||[]).join(", ")),z(!0))}catch(u){s&&j(u)}finally{s&&M(!1)}})(),()=>{s=!1}},[y,i]);const v=s=>{d(m=>({...m,...s}))},_=s=>{const m=s.target.value;v({title:m,slug:P?r.slug:X(m)})},g=s=>{z(!0),v({slug:X(s.target.value)})},R=s=>{const m=s.target.value;A(m),v({tags:m.split(",").map(u=>u.trim()).filter(Boolean)})},V=async s=>{var u;const m=(u=s.target.files)==null?void 0:u[0];if(s.target.value="",!!m){k(!0);try{const E=await Z(y,m);v({coverImage:{...E,alt:r.title||""}}),C.success("Cover image uploaded")}catch(E){C.error(E.message||"Unable to upload cover image")}finally{k(!1)}}},D=async s=>{try{return await Z(y,s)}catch(m){throw C.error(m.message||"Unable to upload image"),m}},W=async()=>{try{return await xe(y)}catch(s){throw C.error(s.message||"Unable to load article images"),s}},S=async({publish:s=!1,statusOverride:m=null}={})=>{w(!0),j(null);try{const u=await ge(y,{...r,status:m||r.status,tags:I.split(",").map(E=>E.trim()).filter(Boolean),contentHtml:ne(r.contentHtml)},{publish:s});d({...Q,...u}),A((u.tags||[]).join(", ")),C.success(s?"Article published":m===H.DRAFT?"Article unpublished":"Article saved"),i&&b(`/cms/posts/${y}/edit`,{replace:!0})}catch(u){j(u),C.error(u.message||"Unable to save article")}finally{w(!1)}},B=async()=>
86{if(window.confirm("Delete this article? This cannot be undone.")){w(!0);try{await pe(y),C.success("Article deleted"),b("/cms")}catch(s){C.error(s.message||"Unable to delete article")}finally{w(!1)}}};return U?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-canvas",children:e.jsx(ce,{message:"Loading article..."})}):L&&!r.title&&!i?e.jsx("div",{className:"min-h-screen bg-canvas px-4 py-16",children:e.jsxs("div",{className:"mx-auto max-w-2xl rounded-lg border border-danger-line bg-surface p-8 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-ink",children:"Article unavailable"}),e.jsx("p",{className:"mt-3 text-danger",children:L.message}),e.jsx(K,{to:"/cms",className:"mt-6 inline-flex rounded-md bg-gray-950 px-5 py-3 text-sm font-semibold text-white",children:"Back to CMS"})]})}):e.jsx("div",{className:"min-h-screen bg-canvas px-4 py-8",children:e.jsxs("div",{className:"mx-auto max-w-7xl",children:[e.jsxs("div",{className:"mb-6 flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between",children:[e.jsxs("div",{children:[e.jsxs(K,{to:"/cms",className:"inline-flex items-center gap-2 text-sm font-semibold text-muted transition hover:text-ink",children:[e.jsx(je,{className:"h-4 w-4"}),"Back to articles"]}),e.jsx("h1",{className:"mt-3 text-3xl font-bold text-ink",children:i?"New article":"Edit article"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.slug&&r.status===H.PUBLISHED&&e.jsxs(K,{to:`/${r.slug}`,className:"inline-flex items-center gap-2 rounded-md border border-line bg-surface px-4 py-2 text-sm font-semibold text-ink transition hover:bg-canvas",children:[e.jsx(Le,{className:"h-4 w-4"}),"View"]}),!i&&e.jsxs("button",{type:"button",onClick:B,disabled:N,className:"inline-flex items-center gap-2 rounded-md border border-danger-line bg-surface px-4 py-2 text-sm font-semibold text-danger transition hover:bg-danger-soft disabled:opacity-50",children:[e.jsx(Ne,{className:"h-4 w-4"}),"Delete"]}),r.status===H.PUBLISHED&&e.jsx("button",{type:"button",onClick:()=>S({statusOverride:H.DRAFT}),disabled:N,className:"inline-flex items-center gap-2 rounded-md border border-line bg-surface px-4 py-2 text-sm font-semibold text-ink transition hover:bg-canvas disabled:opacity-50",children:"Unpublish"}),e.jsxs("button",{type:"button",onClick:()=>S({publish:!1}),disabled:N,className:"inline-flex items-center gap-2 rounded-md border border-line bg-surface px-4 py-2 text-sm font-semibold text-ink transition hover:bg-canvas disabled:opacity-50",children:[e.jsx(we,{className:"h-4 w-4"}),"Save draft"]}),e.jsxs("button",{type:"button",onClick:()=>S({publish:!0}),disabled:N,className:"inline-flex items-center gap-2 rounded-md bg-amber-500 px-4 py-2 text-sm font-semibold text-white transition hover:bg-amber-600 disabled:opacity-50",children:[e.jsx(Be,{className:"h-4 w-4"}),"Publish"]})]})]}),L&&e.jsx("div",{className:"mb-6 rounded-lg border border-danger-line bg-danger-soft p-4 text-danger",children:L.message}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsxs("main",{className:"space-y-5",children:[e.jsxs("section",{className:"rounded-lg border border-line bg-surface p-5 shadow-sm",children:[e.jsxs("label",{className:"block text-left text-sm font-semibold text-ink",children:["Title",e.jsx("input",{value:r.title,onChange:_,className:"mt-2 w-full rounded-md border border-line px-3 py-3 text-lg font-semibold outline-none transition focus:border-amber-500 focus:ring-2 focus:ring-amber-200",placeholder:"Article title"})]}),e.jsxs("label",{className:"mt-4 block text-left text-sm font-semibold text-ink",children:["Slug",e.jsxs("div",{className:"mt-2 flex rounded-md border border-line bg-surface focus-within:border-amber-500 focus-within:ring-2 focus-within:ring-amber-200",children:[e.jsx("span",{className:"flex items-center border-r border-line px-3 text-sm text-muted",children:"pitchlab.app/"}),e.jsx("input",{value:r.slug,onChange:g,className:"min-w-0 flex-1 px-3 py-3 outline-none",placeholder:"article-slug"})]})]})]}),e.jsx($e,{value:r.contentHtml,onChange:s=>v({contentHtml:s}),onImageUpload:D,onListImages:W,disabled:N})]}),e.jsxs("aside",{className:"space-y-5",children:[e.jsxs("section",{className:"rounded-lg border border-line bg-surface p-5 text-left shadow-sm",children:[e.jsx("h2",{className:"text-lg font-semibold text-ink",children:"Publishing"}),e.jsxs("div",{className:"mt-4 rounded-md bg-canvas p-3 text-sm text-ink",children:["Status:"," ",e.jsx("span",{className:"font-semibold capitalize",children:r.status||H.DRAFT})]}),e.jsxs("label",{className:"mt-4 block text-sm font-semibold text-ink",children:["Excerpt",e.jsx("textarea",{value:r.excerpt,onChange:s=>v({excerpt:s.target.value}),rows:4,className:"mt-2 w-full rounded-md border border-line px-3 py-2 outline-none transition focus:border-amber-500 focus:ring-2 focus:ring-amber-200",placeholder:"Short summary for article cards and metadata"})]}),e.jsxs("label",{className:"mt-4 block text-sm font-semibold text-ink",children:["Tags",e.jsx("input",{value:I,onChange:R,className:"mt-2 w-full rounded-md border border-line px-3 py-2 outline-none transition focus:border-amber-500 focus:ring-2 focus:ring-amber-200",placeholder:"pitching, training"})]})]}),e.jsxs("section",{className:"rounded-lg border border-line bg-surface p-5 text-left shadow-sm",children:[e.jsx("h2",{className:"text-lg font-semibold text-ink",children:"Cover image"}),((O=r.coverImage)==null?void 0:O.url)&&e.jsx("img",{src:r.coverImage.url,alt:r.coverImage.alt||r.title,className:"mt-4 aspect-video w-full rounded-md object-cover"}),e.jsxs("label",{className:"mt-4 inline-flex cursor-pointer items-center gap-2 rounded-md border border-line bg-surface px-4 py-2 text-sm font-semibold text-ink transition hover:bg-canvas",children:[e.jsx(Ve,{className:"h-4 w-4"}),q?"Uploading...":"Upload cover",e.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:q,onCh
86ange:V})]})]}),e.jsxs("section",{className:"rounded-lg border border-line bg-surface p-5 text-left shadow-sm",children:[e.jsx("h2",{className:"text-lg font-semibold text-ink",children:"SEO"}),e.jsxs("label",{className:"mt-4 block text-sm font-semibold text-ink",children:["SEO title",e.jsx("input",{value:r.seoTitle,onChange:s=>v({seoTitle:s.target.value}),className:"mt-2 w-full rounded-md border border-line px-3 py-2 outline-none transition focus:border-amber-500 focus:ring-2 focus:ring-amber-200",placeholder:r.title})]}),e.jsxs("label",{className:"mt-4 block text-sm font-semibold text-ink",children:["SEO description",e.jsx("textarea",{value:r.seoDescription,onChange:s=>v({seoDescription:s.target.value}),rows:3,className:"mt-2 w-full rounded-md border border-line px-3 py-2 outline-none transition focus:border-amber-500 focus:ring-2 focus:ring-amber-200",placeholder:r.excerpt})]})]})]})]})]})})},tt=()=>e.jsx(ve,{children:e.jsx(_e,{})});export{tt 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.