1import{j as e,r as d}from"./react-vendor-vJOsxo8t.js";import{c as te,b as Za,u as Wt,a as Xa,t as v,B as T,s as $s}from"./index-ZAU6i7ZR.js";import{S as Os,ak as Qs,al as Hs,am as Ks,an as Ys,ao as Js,ap as Zs,aq as Xs,ar as eo,as as to,a9 as We,at as ue,f as Re,E as _e,au as gt,e as fe,av as pt,aw as ao,ax as so,ay as oo,az as no,b as ze,aA as ro,aB as co,aC as lo,aD as io,aE as mo,aF as po,aG as es,aH as xo,aI as ho,k as ts,aJ as bo,aK as uo,aL as go,aM as vo,aN as fo,aO as jo,A as et,aP as $e,ae as _t,aQ as yo,aR as lt,aa as vt,U as qt,w as as,ab as ss,aS as os,aT as No,aU as ko,aV as Yt,aW as Oe,L as oe,aX as ft,r as jt,aY as Sa,h as Pe,aZ as Co,a_ as La,a$ as ns,b0 as wo,V as it,b1 as rs,b2 as Je,b3 as Jt,b4 as mt,b5 as Po,F as Nt,b6 as ba,c as $t,b7 as cs,X as ds,C as ya,b8 as ls,D as yt,T as Ze,b9 as Eo,ba as So,bb as Lo,bc as is,z as ms,bd as ps,s as Fo,n as Bo,y as Na,be as xs,u as hs,$ as Ao,bf as bs,bg as Wo,bh as Mo,bi as Io,bj as Ot,bk as Do,bl as Fa,bm as Qt,bn as To,bo as Ba,bp as Uo,bq as Vo,br as Go,bs as zo,bt as aa,bu as Ro,bv as us,p as _o,bw as qo,bx as $o,q as Ht,by as Oo,bz as Qo,bA as ua,bB as Ho,M as Ko,a0 as gs,bC as vs,ah as Yo,bD as Jo,bE as Zo,bF as Xo,bG as en,bH as tn}from"./ui-vendor-nKrsgPEc.js";import{i as an,y as sn,A as on,B as nn,E as rn,C as M,Q as Aa}from"./vendor-DJSewRPU.js";import{T as cn}from"./data-vendor-DkenEAQv.js";const dn=an("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function se({className:t,variant:s,asChild:a=!1,...o}){const n=a?Os:"span";return e.jsx(n,{"data-loc":"client/src/components/ui/badge.tsx:38","data-slot":"badge",className:te(dn({variant:s}),t),...o})}function kt({...t}){return e.jsx(Qs,{"data-loc":"client/src/components/ui/alert-dialog.tsx:10","data-slot":"alert-dialog",...t})}function ln({...t}){return e.jsx(to,{"data-loc":"client/src/components/ui/alert-dialog.tsx:17","data-slot":"alert-dialog-trigger",...t})}function mn({...t}){return e.jsx(Xs,{"data-loc":"client/src/components/ui/alert-dialog.tsx:25","data-slot":"alert-dialog-portal",...t})}function pn({className:t,...s}){return e.jsx(eo,{"data-loc":"client/src/components/ui/alert-dialog.tsx:34","data-slot":"alert-dialog-overlay",className:te("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),...s})}function Ct({className:t,...s}){return e.jsxs(mn,{"data-loc":"client/src/components/ui/alert-dialog.tsx:50",children:[e.jsx(pn,{"data-loc":"client/src/components/ui/alert-dialog.tsx:51"}),e.jsx(Hs,{"data-loc":"client/src/components/ui/alert-dialog.tsx:52","data-slot":"alert-dialog-content",className:te("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",t),...s})]})}function wt({className:t,...s}){return e.jsx("div",{"data-loc":"client/src/components/ui/alert-dialog.tsx:69","data-slot":"alert-dialog-header",className:te("flex flex-col gap-2 text-center sm:text-left",t),...s})}function Pt({className:t,...s}){return e.jsx("div",{"data-loc":"client/src/components/ui/alert-dialog.tsx:82","data-slot":"alert-dialog-footer",className:te("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),...s})}function Et({className:t,...s}){return e.jsx(Ks,{"data-loc":"client/src/components/ui/alert-dialog.tsx:98","data-slot":"alert-dialog-title",className:te("text-lg font-semibold",t),...s})}function St({className:t,...s}){return e.jsx(Ys,{"data-loc":"client/src/components/ui/alert-dialog.tsx:111","data-slot":"alert-dialog-description",className:te("text-muted-foreground text-sm",t),...s})}function Lt({className:t,...s}){return e.jsx(Zs,{"data-loc":"client/src/components/ui/alert-dialog.tsx:124",className:te(Za(),t),...s})}function Ft({className:t,...s}){return e.jsx(Js,{"data-loc":"client/src/components/ui/alert-dialog.tsx:136",className:te(Za({variant:"outline"}),t),...s})}function fs(t={}){const{onKeyDown:s,onCompositionStart:a,onCompositionEnd:o}=t,n=d.useRef(!1),l=d.useRef(null),r=d.useRef(null),i=Wt(k=>{l.current&&(clearTimeout(l.current),l.current=null),r.current&&(clearTimeout(r.current),r.current=null),n.current=!0,a?.(k)}),x=Wt(k=>{l.current=setTimeout(()=>{r.current=setTimeout(()=>{n.current=!1})}),o?.(k)}),f=Wt(k=>{if(n.current&&(k.key==="Escape"||k.key==="Enter"&&!k.shiftKey)){k.stopPropagation();return}s?.(k)}),c=Wt(()=>n.current);return{onCompositionStart:i,onCompositionEnd:x,onKeyDown:f,isComposing:c}}function A({className:t,type:s,onKeyDown:a,onCompositionStart:o,onCompositionEnd:n,...l}){const r=Xa(),{onCompositionStart:i,onCompositionEnd:x,onKeyDown:f}=fs({onKeyDown:c=>{const k=c.nativeEvent.isComposing||r.justEndedComposing();c.key==="Enter"&&k||a?.(c)},onCompositionStart:c=>{r.setComposing(!0),o?.(c)},onCompositionEnd:c=>{r.markCompositionEnd(),setTimeout(()=>{r.setComposing(!1)},100),n?.(c)}});return e.jsx("input",{"data-loc":"client/src/components/ui/input.tsx:53",type:s,"data-slot":"input",className:te("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),onCompositionStart:i,onCompositionEnd:x,onKeyDown:f,...l})}function re({className:t,onKeyDown:s,onCompositionStart:a,onCompositionEnd:o,...n}){const l=Xa(),{onCompositionStart:r,onCompositionEnd:i,onKeyDown:x}=fs({onKeyDown:f=>{const c=f.nativeEvent.isComposing||l.justEndedComposing();f.key==="Enter"&&!f.shiftKey&&c||s?.(f)},onCompositionStart:f=>{l.setComposing(!0),a?.(f)},onCompositionEnd:f=>{l.markCompositionEnd(),setTimeout(()=>{l.setComposing(!1)},100),o?.(f)}});return e.jsx("textarea",{"data-loc":"client/src/components/ui/textarea.tsx:53","data-slot":"textarea",className:te("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),onCompositionStart:r,onCompositionEnd:i,onKeyDown:x,...n})}function js({value:t,onChange:s,disabled:a=!1}){const o=sn({extensions:[on,nn.configure({openOnClick:!1,autolink:!0,linkOnPaste:!0})],content:t,editorProps:{attributes:{class:"min-h-[360px] rounded-b-xl border-x border-b border-slate-200 bg-white p-5 text-[15px] leading-7 text-slate-800 outline-none prose prose-slate max-w-none"}},onUpdate:({editor:r})=>s(r.getHTML())});if(d.useEffect(()=>{o&&o.getHTML()!==t&&o.commands.setContent(t,{emitUpdate:!1})},[o,t]),d.useEffect(()=>{o?.setEditable(!a)},[a,o]),!o)return e.jsx("div",{"data-loc":"client/src/components/dashboard/RichTextEditor.tsx:30",className:"rounded-xl border border-slate-200 p-5 text-sm text-slate-500",children:"Loading editorâ¦"});const n=(r,i,x)=>e.jsx("button",{"data-loc":"client/src/components/dashboard/RichTextEditor.tsx:33",type:"button",onClick:x,disabled:a,className:`rounded px-2.5 py-1 text-xs font-semibold ${i?"bg-[#0B00E4] text-white":"bg-white text-slate-600 hover:bg-slate-100"}`,children:r}),l=()=>{const r=window.prompt("Paste an approved link",o.getAttributes("link").href||"");r!==null&&(r.trim()?o.chain().focus().extendMarkRange("link").setLink({href:r.trim()}).run():o.chain().focus().extendMarkRange("link").unsetLink().run())};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/RichTextEditor.tsx:51",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/RichTextEditor.tsx:52",className:"flex flex-wrap gap-1 rounded-t-xl border border-slate-200 bg-slate-50 p-2",children:[n("B",o.isActive("bold"),()=>o.chain().focus().toggleBold().run()),n("I",o.isActive("italic"),()=>o.chain().focus().toggleItalic().run()),n("H2",o.isActive("heading",{level:2}),()=>o.chain().focus().toggleHeading({level:2}).run()),n("H3",o.isActive("heading",{level:3}),()=>o.chain().focus().toggleHeading({level:3}).run()),n("⢠List",o.isActive("bulletList"),()=>o.chain().focus().toggleBulletList().run()),n("1. List",o.isActive("orderedList"),()=>o.chain().focus().toggleOrderedList().run()),n("Link",o.isActive("link"),l),n("Undo",!1,()=>
1o.chain().focus().undo().run()),n("Redo",!1,()=>o.chain().focus().redo().run())]}),e.jsx(rn,{"data-loc":"client/src/components/dashboard/RichTextEditor.tsx:63",editor:o})]})}const Wa={published:{label:"Published",className:"bg-green-100 text-green-700"},draft:{label:"Draft",className:"bg-yellow-100 text-yellow-700"},archived:{label:"Archived",className:"bg-gray-100 text-gray-500"}},xn={masters:"Masters","graduate-diploma":"Grad Dip",bachelor:"Bachelor"};function hn({onEdit:t}){const[s,a]=d.useState(""),[o,n]=d.useState("all"),[l,r]=d.useState("all"),{data:i=[],isLoading:x,refetch:f}=v.cms.listProgrammes.useQuery(),c=v.cms.publishProgramme.useMutation({onSuccess:()=>f()}),k=v.cms.archiveProgramme.useMutation({onSuccess:()=>f()}),E=i.filter(g=>{const C=!s||g.title.toLowerCase().includes(s.toLowerCase())||g.programmeCode.toLowerCase().includes(s.toLowerCase())||g.slug.toLowerCase().includes(s.toLowerCase()),b=o==="all"||g.status===o,W=l==="all"||g.qualification===l;return C&&b&&W}),N={all:i.length,published:i.filter(g=>g.status==="published").length,draft:i.filter(g=>g.status==="draft").length,archived:i.filter(g=>g.status==="archived").length};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:73",className:"p-6 max-w-7xl",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:75",className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:76",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:77",className:"text-xl font-bold text-[#111111]",children:"Programme Pages"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:78",className:"text-sm text-gray-500 mt-0.5",children:[N.all," programmes · ",N.published," published"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:80",className:"flex items-center gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:81",onClick:()=>f(),className:"p-2 rounded-lg border border-gray-200 hover:bg-gray-50 transition-colors",title:"Refresh",children:e.jsx(We,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:86",size:16,className:"text-gray-500"})}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:88",className:"flex items-center gap-2 bg-[#0B00E4] text-white text-sm font-semibold px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors opacity-50 cursor-not-allowed",title:"Create new programme â coming in a later stage",disabled:!0,children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:93",size:16}),"New Programme"]})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:100",className:"flex gap-1 mb-4 bg-gray-100 rounded-lg p-1 w-fit",children:["all","published","draft","archived"].map(g=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:102",onClick:()=>n(g),className:`px-3 py-1.5 rounded-md text-xs font-semibold transition-colors capitalize ${o===g?"bg-white text-[#0B00E4] shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[g==="all"?"All":g.charAt(0).toUpperCase()+g.slice(1)," (",N[g],")"]},g))}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:117",className:"flex gap-3 mb-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:118",className:"relative flex-1 max-w-sm",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:119",size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:120",type:"text",placeholder:"Search by title, code or slugâ¦",value:s,onChange:g=>a(g.target.value),className:"w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]"})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:128",value:l,onCh
1ange:g=>r(g.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:133",value:"all",children:"All qualifications"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:134",value:"masters",children:"Master's Degrees"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:135",value:"graduate-diploma",children:"Graduate Diplomas"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:136",value:"bachelor",children:"Bachelor's Degrees"})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:141",className:"bg-white rounded-2xl border border-gray-200 overflow-hidden",children:x?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:143",className:"flex items-center justify-center py-16 text-gray-400",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:144",size:20,className:"animate-spin mr-2"}),"Loading programmesâ¦"]}):E.length===0?e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:148",className:"text-center py-16 text-gray-400 text-sm",children:"No programmes match your filters."}):e.jsxs("table",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:152",className:"w-full text-sm",children:[e.jsx("thead",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:153",children:e.jsxs("tr",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:154",className:"border-b border-gray-100 bg-gray-50",children:[e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:155",className:"text-left px-4 py-3 font-semibold text-gray-600 w-8",children:"#"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:156",className:"text-left px-4 py-3 font-semibold text-gray-600",children:"Programme"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:157",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden md:table-cell",children:"Qualification"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:158",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden lg:table-cell",children:"Intake"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:159",className:"text-left px-4 py-3 font-semibold text-gray-600",children:"Status"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:160",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden xl:table-cell",children:"Updated"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:161",className:"text-right px-4 py-3 font-semibold text-gray-600",children:"Actions"})]})}),e.jsx("tbody",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:164",children:E.map((g,C)=>{const b=Wa[g.status]??Wa.draft,W=xn[g.qualification]??g.qualification,j=g.updatedAt?new Date(g.updatedAt).toLocaleDateString("en-SG",{day:"numeric",month:"short",year:"numeric"}):"â";return e.jsxs("tr",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:172",className:"border-b border-gray-50 hover:bg-gray-50/50 transition-colors",children:[e.jsx("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:173",className:"px-4 py-3 text-gray-400 text-xs",children:C+1}),e.jsxs("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:174",className:"px-4 py-3",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:175",className:"font-semibold text-[#111111] leading-snug",children:g.shortTitle||g.title}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:176",className:"text-xs text-gray-400 font-mono mt-0.5",children:g.slug})]}),e.jsx("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:178",className:"px-4 py-3 hidden md:table-cell",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:179",className:"text-xs text-gray-500",children:W})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:181",className:"px-4 py-3 hidden lg:table-cell",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:182",className:"text-xs text-gray-500",children:g.startDate||"â"})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:184",className:"px-4 py-3",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:185",className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold ${b.className}`,children:b.label})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:189",className:"px-4 py-3 hidden xl:table-cell",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:190",className:"text-xs text-gray-400",children:j})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:192",className:"px-4 py-3",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:193",className:"flex items-center justify-end gap-1",children:[e.jsx("a",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:195",href:`/${g.slug}/`,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded-lg hover:bg-gray-100 transition-colors text-gray-400 hover:text-gray-600",title:"Preview live page",children:e.jsx(_e,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:202",size:15})}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:205",onClick:()=>
1t(g.id),className:"p-1.5 rounded-lg hover:bg-[#EEF2FF] transition-colors text-gray-400 hover:text-[#0B00E4]",title:"Edit programme",children:e.jsx(gt,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:210",size:15})}),g.status!=="published"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:214",onClick:()=>c.mutate({id:g.id}),disabled:c.isPending,className:"p-1.5 rounded-lg hover:bg-green-50 transition-colors text-gray-400 hover:text-green-600",title:"Publish",children:e.jsx(fe,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:220",size:15})}),g.status==="published"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:225",onClick:()=>k.mutate({id:g.id}),disabled:k.isPending,className:"p-1.5 rounded-lg hover:bg-red-50 transition-colors text-gray-400 hover:text-red-500",title:"Archive",children:e.jsx(pt,{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:231",size:15})})]})})]},g.id)})})]})}),E.length>0&&e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeList.tsx:245",className:"text-xs text-gray-400 mt-3 text-right",children:["Showing ",E.length," of ",i.length," programmes"]})]})}function Ne({className:t,...s}){return e.jsx(ao,{"data-loc":"client/src/components/ui/label.tsx:11","data-slot":"label",className:te("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",t),...s})}function bn({...t}){return e.jsx(so,{"data-loc":"client/src/components/ui/select.tsx:10","data-slot":"select",...t})}function un({...t}){return e.jsx(ro,{"data-loc":"client/src/components/ui/select.tsx:22","data-slot":"select-value",...t})}function gn({className:t,size:s="default",children:a,...o}){return e.jsxs(oo,{"data-loc":"client/src/components/ui/select.tsx:34","data-slot":"select-trigger","data-size":s,className:te("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...o,children:[a,e.jsx(no,{"data-loc":"client/src/components/ui/select.tsx:44",asChild:!0,children:e.jsx(ze,{"data-loc":"client/src/components/ui/select.tsx:45",className:"size-4 opacity-50"})})]})}function vn({className:t,children:s,position:a="popper",align:o="center",...n}){return e.jsx(co,{"data-loc":"client/src/components/ui/select.tsx:59",children:e.jsxs(lo,{"data-loc":"client/src/components/ui/select.tsx:60","data-slot":"select-content",className:te("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,align:o,...n,children:[e.jsx(fn,{"data-loc":"client/src/components/ui/select.tsx:72"}),e.jsx(io,{"data-loc":"client/src/components/ui/select.tsx:73",className:te("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),e.jsx(jn,{"data-loc":"client/src/components/ui/select.tsx:82"})]})})}function Mt({className:t,children:s,...a}){return e.jsxs(mo,{"data-loc":"client/src/components/ui/select.tsx:107","data-slot":"select-item",className:te("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...a,children:[e.jsx("span",{"data-loc":"client/src/components/ui/select.tsx:115",className:"absolute right-2 flex size-3.5 items-center justify-center",children:e.jsx(po,{"data-loc":"client/src/components/ui/select.tsx:116",children:e.jsx(es,{"data-loc":"client/src/components/ui/select.tsx:117",className:"size-4"})})}),e.jsx(xo,{"data-loc":"client/src/components/ui/select.tsx:120",children:s})]})}function fn({className:t,...s}){return e.jsx(ho,{"data-loc":"client/src/components/ui/select.tsx:143","data-slot":"select-scroll-up-button",className:te("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(ts,{"data-loc":"client/src/components/ui/select.tsx:151",className:"size-4"})})}function jn({className:t,...s}){return e.jsx(bo,{"data-loc":"client/src/components/ui/select.tsx:161","data-slot":"select-scroll-down-button",className:te("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(ze,{"data-loc":"client/src/components/ui/select.tsx:169",className:"size-4"})})}function Ma({className:t,...s}){return e.jsx(uo,{"data-loc":"client/src/components/ui/switch.tsx:11","data-slot":"switch",className:te("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(go,{"data-loc":"client/src/components/ui/switch.tsx:19","data-slot":"switch-thumb",className:te("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}function yn({...t}){return e.jsx(vo,{"data-loc":"client/src/components/ui/collapsible.tsx:6","data-slot":"collapsible",...t})}function Nn({...t}){return e.jsx(fo,{"data-loc":"client/src/components/ui/collapsible.tsx:13","data-slot":"collapsible-trigger",...t})}function kn({...t}){return e.jsx(jo,{"data-loc":"client/src/components/ui/collapsible.tsx:24","data-slot":"collapsible-content",...t})}function Fe({title:t,defaultOpen:s=!1,children:a}
1){const[o,n]=d.useState(s);return e.jsxs(yn,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:77",open:o,onOpenChange:n,children:[e.jsx(Nn,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:78",asChild:!0,children:e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:79",type:"button",className:"flex w-full items-center justify-between rounded-lg border border-slate-200 bg-white px-4 py-3 text-left font-semibold text-slate-800 hover:bg-slate-50 transition-colors",children:[t,e.jsx(ze,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:84",size:16,className:`transition-transform ${o?"rotate-180":""}`})]})}),e.jsx(kn,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:90",children:e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:91",className:"mt-2 rounded-lg border border-slate-200 bg-white p-5 space-y-4",children:a})})]})}function R({label:t,hint:s,children:a}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:111",className:"space-y-1",children:[e.jsx(Ne,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:112",className:"text-sm font-medium text-slate-700",children:t}),s&&e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:113",className:"text-xs text-slate-500",children:s}),a]})}function It({label:t,hint:s,items:a,onChange:o,placeholder:n,multiline:l}){const r=(f,c)=>{const k=[...a];k[f]=c,o(k)},i=f=>o(a.filter((c,k)=>k!==f)),x=()=>o([...a,""]);return e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:145",label:t,hint:s,children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:146",className:"space-y-2",children:[a.map((f,c)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:148",className:"flex gap-2 items-start",children:[l?e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:150",value:f,onChange:k=>r(c,k.target.value),placeholder:n,className:"flex-1 min-h-[80px] text-sm"}):e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:157",value:f,onChange:k=>r(c,k.target.value),placeholder:n,className:"flex-1 text-sm"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:164",type:"button",onClick:()=>i(c),className:"mt-1 text-slate-400 hover:text-red-500 transition-colors",children:e.jsx(lt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:169",size:14})})]},c)),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:173",type:"button",variant:"outline",size:"sm",onClick:x,children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:174",size:14,className:"mr-1"})," Add item"]})]})})}function Cn({programmeId:t,onBack:s}){const a=v.useUtils(),{data:o,isLoading:n}=v.cms.getProgramme.useQuery({id:t}),[l,r]=d.useState({}),[i,x]=d.useState([]),[f,c]=d.useState([]),[k,E]=d.useState(!1);d.useEffect(()=>{if(!o?.programme)return;const p=o.programme;r({title:p.title??"",shortTitle:p.shortTitle??"",displayTitle:p.displayTitle??"",eyebrow:p.eyebrow??"",qualification:p.qualification??"",qualificationLabel:p.qualificationLabel??"",studyModes:p.studyModes??[],startDate:p.startDate??"",duration:p.duration??"",schedule:p.schedule??"",assessment:p.assessment??"",awardedBy:p.awardedBy??"",mobileAwardedBy:p.mobileAwardedBy??"",institution:p.institution??"",institutionLogo:p.institutionLogo??"",heroImage:p.heroImage??"",cardImage:p.cardImage??"",cardDescription:p.cardDescription??"",positioningStatement:p.positioningStatement??"",mobilePositioningStatement:p.mobilePositioningStatement??"",heroBadgeLabel:p.heroBadgeLabel??"",heroBadgeDetail:p.heroBadgeDetail??"",citationClaim:p.citationClaim??"",citationSource:p.citationSource??"",overviewParagraphs:p.overviewParagraphs??[],personaCards:p.personaCards??[],modules:p.modules??[],admissionCriteria:p.admissionCriteria??[],languageRequirements:p.languageRequirements??[],generalEligibility:p.generalEligibility??[],faqs:p.faqs??[],badgeType:p.badgeType??"none",badgeLabel:p.badgeLabel??"",isFeatured:p.isFeatured===1,seoTitle:p.seoTitle??"",seoDescription:p.seoDescription??"",ogTitle:p.ogTitle??"",ogDescription:p.ogDescription??"",ogImage:p.ogImage??"",canonicalUrl:p.canonicalUrl??"",noIndex:p.noIndex===1,advisorMessage:p.advisorMessage??"",applyUrl:p.applyUrl??""}),x((o.faculty??[]).map(u=>({name:u.name,qualification:u.qualification??"",photoUrl:u.photoUrl??"",highlight1:u.highlight1??"",highlight2:u.highlight2??"",bio:u.bio??""}))),c((o.testimonials??[]).map(u=>({quote:u.quote,headline:u.headline??"",name:u.name,role:u.role??"",org:u.org??"",programmeLabel:u.programmeLabel??""}))),E(!1)},[o]);const N=(p,u)=>{r(S=>({...S,[p]:u})),E(!0)},g=p=>l[p]??"",C=p=>l[p]??[],b=p=>!!l[p],W=v.cms.updateProgramme.useMutation({onSuccess:()=>
1{M.success("Changes saved"),E(!1),a.cms.getProgramme.invalidate({id:t}),a.cms.listProgrammes.invalidate()},onError:p=>M.error(`Save failed: ${p.message}`)}),j=v.cms.publishProgramme.useMutation({onSuccess:()=>{M.success("Programme published"),a.cms.getProgramme.invalidate({id:t}),a.cms.listProgrammes.invalidate()},onError:p=>M.error(`Publish failed: ${p.message}`)}),P=v.cms.archiveProgramme.useMutation({onSuccess:()=>{M.success("Programme archived"),a.cms.getProgramme.invalidate({id:t}),a.cms.listProgrammes.invalidate()},onError:p=>M.error(`Archive failed: ${p.message}`)}),U=()=>{const{...p}=l;W.mutate({id:t,data:{...p,isFeatured:b("isFeatured")?1:0,noIndex:b("noIndex")?1:0},faculty:i.map(u=>({name:u.name,qualification:u.qualification,photoUrl:u.photoUrl||null,highlight1:u.highlight1,highlight2:u.highlight2,bio:u.bio||null})),testimonials:f.map(u=>({quote:u.quote,headline:u.headline||null,name:u.name,role:u.role||null,org:u.org||null,programmeLabel:u.programmeLabel||null}))})};if(n)return e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:337",className:"flex items-center justify-center h-64",children:e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:338",className:"animate-spin rounded-full h-8 w-8 border-b-2 border-[#0B00E4]"})});if(!o?.programme)return e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:345",className:"p-6 text-center text-slate-500",children:"Programme not found."});const y=o.programme,V=y.status==="published"?"bg-green-100 text-green-800":y.status==="archived"?"bg-slate-100 text-slate-600":"bg-yellow-100 text-yellow-800";return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:358",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:360",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:361",className:"flex items-center gap-3",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:362",type:"button",onClick:s,className:"flex items-center gap-1 text-sm text-slate-500 hover:text-slate-800 transition-colors",children:[e.jsx(et,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:367",size:14})," Back to list"]}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:369",className:"text-slate-300",children:"|"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:370",className:"text-lg font-bold text-slate-900",children:y.title}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:371",className:`text-xs font-semibold px-2 py-0.5 rounded-full ${V}`,children:y.status}),k&&e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:375",className:"text-xs text-amber-600 font-medium",children:"Unsaved changes"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:378",className:"flex items-center gap-2",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:379",type:"button",variant:"outline",size:"sm",onClick:()=>window.open(`/${y.slug}/`,"_blank"),children:[e.jsx(gt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:385",size:14,className:"mr-1"})," Preview"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:387",type:"button",variant:"outline",size:"sm",onClick:U,disabled:W.isPending||!k,children:[e.jsx($e,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:394",size:14,className:"mr-1"}),W.isPending?"Savingâ¦":"Save draft"]}),y.status!=="published"&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:398",type:"button",size:"sm",className:"bg-[#0B00E4] hover:bg-[#0900c0] text-white",onClick:()=>j.mutate({id:t}),disabled:j.isPending,children:[e.jsx(_t,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:405",size:14,className:"mr-1"}),j.isPending?"Publishingâ¦":"Publish"]}),y.status==="published"&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:410",type:"button",variant:"outline",size:"sm",onClick:()=>P.mutate({id:t}),disabled:P.isPending,className:"text-slate-600",children:[e.jsx(pt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:418",size:14,className:"mr-1"}
1),P.isPending?"Archivingâ¦":"Archive"]})]})]}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:428",title:"Basic Info",defaultOpen:!0,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:429",className:"grid grid-cols-2 gap-4",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:430",label:"Title",hint:"Full formal programme title",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:431",value:g("title"),onChange:p=>N("title",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:433",label:"Short Title",hint:"Used in cards and breadcrumbs",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:434",value:g("shortTitle"),onChange:p=>N("shortTitle",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:436",label:"Display Title",hint:"Hero headline (may differ from title)",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:437",value:g("displayTitle"),onChange:p=>N("displayTitle",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:439",label:"Eyebrow",hint:"Small label above the hero title",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:440",value:g("eyebrow"),onChange:p=>N("eyebrow",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:442",label:"Qualification",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:443",value:g("qualification"),onChange:p=>N("qualification",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:445",label:"Qualification Label",hint:"Shown in Programme Finder filter",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:446",value:g("qualificationLabel"),onChange:p=>N("qualificationLabel",p.target.value)})})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:449",className:"grid grid-cols-3 gap-4",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:450",label:"Start Date",hint:'e.g. "Oct 2026"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:451",value:g("startDate"),onChange:p=>N("startDate",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:453",label:"Duration",hint:'e.g. "12 Months"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:454",value:g("duration"),onChange:p=>N("duration",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:456",label:"Schedule",hint:'e.g. "Weekend Classes"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:457",value:g("schedule"),onChange:p=>N("schedule",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:459",label:"Assessment",hint:'e.g. "100% Coursework, No Exams"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:460",value:g("assessment"),onChange:p=>N("assessment",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:462",label:"Awarded By",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:463",value:g("awardedBy"),onChange:p=>N("awardedBy",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:465",label:"Institution",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:466",value:g("institution"),onChange:p=>N("institution",p.target.value)})})]}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:469",label:"Institution Logo URL",hint:"Leave blank for Aventis-awarded programmes",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:470",value:g("institutionLogo"),onChange:p=>N("institutionLogo",p.target.value),placeholder:"https://..."})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:472",className:"flex items-center gap-2",children:[e.jsx(Ma,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:473",checked:b("isFeatured"),onCheckedChange:p=>N("isFeatured",p)}),e.jsx(Ne,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:477",children:"Featured programme (shown prominently on homepage)"})]})]}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:482",title:"Hero & Images",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:483",label:"Hero Image URL",hint:"16:9 WebP, max 1920px wide",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:484",value:g("heroImage"),onChange:p=>N("heroImage",p.target.value),placeholder:"https://..."})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:486",label:"Card Image URL",hint:"3:2 WebP, max 1200px wide",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:487",value:g("cardImage"),onChange:p=>N("cardImage",p.target.value),placeholder:"https://..."})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:489",label:"Card Description",hint:"Shown on programme cards in the finder",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:490",value:g("cardDescription"),onChange:p=>N("cardDescription",p.target.value),className:"min-h-[80px]"})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:492",label:"Positioning Statement",hint:"Desktop hero subtitle",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:493",value:g("positioningStatement"),onChange:p=>N("positioningStatement",p.target.value),className:"min-h-[80px]"})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:495",label:"Mobile Positioning Statement",hint:"Shorter version for mobile hero",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:496",value:g("mobilePositioningStatement"),onChange:p=>N("mobilePositioningStatement",p.target.value),className:"min-h-[60
1px]"})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:498",className:"grid grid-cols-2 gap-4",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:499",label:"Hero Badge Label",hint:'e.g. "Ranked #1"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:500",value:g("heroBadgeLabel"),onChange:p=>N("heroBadgeLabel",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:502",label:"Hero Badge Detail",hint:'e.g. "Singapore Business Review"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:503",value:g("heroBadgeDetail"),onChange:p=>N("heroBadgeDetail",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:505",label:"Citation Claim",hint:"Ranking proof text (both fields required to show)",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:506",value:g("citationClaim"),onChange:p=>N("citationClaim",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:508",label:"Citation Source",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:509",value:g("citationSource"),onChange:p=>N("citationSource",p.target.value)})})]})]}),e.jsx(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:515",title:"Overview",children:e.jsx(It,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:516",label:"Overview Paragraphs",hint:"Each item is one paragraph of body text",items:C("overviewParagraphs"),onChange:p=>N("overviewParagraphs",p),placeholder:"Enter paragraph textâ¦",multiline:!0})}),e.jsx(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:527",title:"Modules",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:528",className:"space-y-3",children:[C("modules").map((p,u)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:530",className:"flex gap-3 items-start p-3 bg-slate-50 rounded-lg",children:[e.jsx(yo,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:531",size:16,className:"mt-2 text-slate-400 shrink-0"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:532",className:"flex-1 grid grid-cols-2 gap-3",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:533",label:"Module Name",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:534",value:p.name,onChange:S=>{const m=[...C("modules")];m[u]={...m[u],name:S.target.value},N("modules",m)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:543",label:"Description",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:544",value:p.description,onChange:S=>{const m=[...C("modules")];m[u]={...m[u],description:S.target.value},N("modules",m)}})})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:554",type:"button",onClick:()=>N("modules",C("modules").filter((S,m)=>m!==u)),className:"mt-2 text-slate-400 hover:text-red-500 transition-colors",children:e.jsx(lt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:559",size:14})})]},u)),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:563",type:"button",variant:"outline",size:"sm",onClick:()=>N("modules",[...C("modules"),{name:"",description:""}]),children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:569",size:14,className:"mr-1"})," Add module"]})]})}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:575",title:"Ideal Candidate Cards",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:576",className:"text-xs text-slate-500",children:"Exactly 3 cards. Each has an icon (emoji or lucide name), a badge label, a title, and body text."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:577",className:"space-y-3",children:[C("personaCards").map((p,u)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:579",className:"p-3 bg-slate-50 rounded-lg space-y-3",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:580",className:"text-xs font-semibold text-slate-500",children:["Card ",u+1]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:581",className:"grid grid-cols-2 gap-3",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:582",label:"Icon",hint:"Emoji or icon name",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:583",value:p.icon,onChange:S=>{const m=[...C("personaCards")];m[u]={...m[u],icon:S.target.value},N("personaCards",m)}
1})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:592",label:"Badge",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:593",value:p.badge,onChange:S=>{const m=[...C("personaCards")];m[u]={...m[u],badge:S.target.value},N("personaCards",m)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:602",label:"Title",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:603",value:p.title,onChange:S=>{const m=[...C("personaCards")];m[u]={...m[u],title:S.target.value},N("personaCards",m)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:612",label:"Body",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:613",value:p.body,onChange:S=>{const m=[...C("personaCards")];m[u]={...m[u],body:S.target.value},N("personaCards",m)},className:"min-h-[60px]"})})]})]},u)),C("personaCards").length<3&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:627",type:"button",variant:"outline",size:"sm",onClick:()=>N("personaCards",[...C("personaCards"),{icon:"",badge:"",title:"",body:""}]),children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:638",size:14,className:"mr-1"})," Add card"]})]})]}),e.jsx(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:645",title:"Expert Faculty",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:646",className:"space-y-3",children:[i.map((p,u)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:648",className:"p-3 bg-slate-50 rounded-lg space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:649",className:"flex items-center justify-between",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:650",className:"text-xs font-semibold text-slate-500",children:["Faculty member ",u+1]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:651",type:"button",onClick:()=>{x(i.filter((S,m)=>m!==u)),E(!0)},className:"text-slate-400 hover:text-red-500 transition-colors",children:e.jsx(lt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:656",size:14})})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:659",className:"grid grid-cols-2 gap-3",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:660",label:"Name",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:661",value:p.name,onChange:S=>{const m=[...i];m[u]={...m[u],name:S.target.value},x(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:663",label:"Qualification",hint:'e.g. "PhD, University of London"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:664",value:p.qualification,onChange:S=>{const m=[...i];m[u]={...m[u],qualification:S.target.value},x(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:666",label:"Photo URL",hint:"Paste /manus-storage/... URL",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:667",value:p.photoUrl,onChange:S=>{const m=[...i];m[u]={...m[u],photoUrl:S.target.value},x(m),E(!0)},placeholder:"https://..."})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:669",label:"Highlight 1",hint:"Most impressive credential",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:670",value:p.highlight1,onChange:S=>{const m=[...i];m[u]={...m[u],highlight1:S.target.value},x(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:672",label:"Highlight 2",hint:"Core expertise in 5-7 words",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:673",value:p.highlight2,onChange:S=>{const m=[...i];m[u]={...m[u],highlight2:S.target.value},x(m),E(!0)}})})]}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:676",label:"Bio",hint:"2-3 sentence narrative",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:677",value:p.bio,onChange:S=>{const m=[...i];m[u]={...m[u],bio:S.target.value},x(m),E(!0)},className:"min-h-[80px]"})})]},u)),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:681",type:"button",variant:"outline",size:"sm",onClick:()=>{x([...i,{name:"",qualification:"",photoUrl:"",highlight1:"",highlight2:"",bio:""}]),E(!0)},children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:687",size:14,className:"mr-1"})," Add faculty member"]})]})}),e.jsx(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:693",title:"Graduate Testimonials",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:694",className:"space-y-3",children:[f.map((p,u)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:696",className:"p-3 bg-slate-50 rounded-lg space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:697",className:"flex items-center justify-between",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:698",className:"text-xs font-semibold text-slate-500",children:["Testimonial ",u+1]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:699",type:"button",onClick:()=>{c(f.filter((S,m)=>m!==u)),E(!0)},className:"text-slate-400 hover:text-red-500 transition-colors",children:e.jsx(lt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:704",size:14})})]}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:707",label:"Quote",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:708",value:p.quote,onChange:S=>{const m=[...f];m[u]={...m[u],quote:S.target.value},c(m),E(!0)},className:"min-h-[80px]"})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:710",className:"grid grid-cols-2 gap-3",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:711",label:"Headline",hint:"Bold pull-quote (1 sentence)",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:712",value:p.headline,onChange:S=>{const m=[...f];m[u]={...m[u],headline:S.target.value},c(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:714",label:"Name",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:715",value:p.name,onChange:S=>{const m=[...f];m[u]={...m[u],name:S.target.value},c(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:717",label:"Title",hint:'e.g. "Senior Director, APAC"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:718",value:p.role,onChange:S=>{const m=[...f];m[u]={...m[u],role:S.target.value},c(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:720",label:"Organisation",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:721",value:p.org,onChange:S=>{const m=[...f];m[u]={...m[u],org:S.target.value},c(m),E(!0)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:723",label:"Programme Label",hint:'e.g. "MBA â Class of 2026"',children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:724",value:p.programmeLabel,onChange:S=>{const m=[...f];m[u]={...m[u],programmeLabel:S.target.value},c(m),E(!0)}})})]})]},u)),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:729",type:"button",variant:"outline",size:"sm",onClick:()=>{c([...f,{quote:"",headline:"",name:"",role:"",org:"",programmeLabel:""}]),E(!0)},children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:735",size:14,className:"mr-1"})," Add testimonial"]})]})}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:741",title:"Admission Requirements",children:[e.jsx(It,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:742",label:"Academic Requirements",hint:'Each item is one OR-pathway. Shown under "Meet any ONE of the following"',items:C("admissionCriteria"),onChange:p=>N("admissionCriteria",p),placeholder:"e.g. Bachelor's degree in any discipline from a recognised university",multiline:!0}),e.jsx(It,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:750",label:"Language Requirements",hint:'Each item is one OR-pathway. Shown under "Meet any ONE of the following"',items:C("languageRequirements"),onChange:p=>N("languageRequirements",p),placeholder:"e.g. IELTS 6.0 or above"}),e.jsx(It,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:757",label:"General Eligibility",hint:"Mandatory conditions (tick icons, NOT OR-pathways)",items:C("generalEligibility"),onChange:p=>N("generalEligibility",p),placeholder:"e.g. Minimum age: 21 years at the time of application"})]}),e.jsx(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:767",title:"FAQs",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:768",className:"space-y-3",children:[C("faqs").map((p,u)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:770",className:"p-3 bg-slate-50 rounded-lg space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:771",className:"flex items-center justify-between",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:772",className:"text-xs font-semibold text-slate-500",children:["FAQ ",u+1]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:773",type:"button",onClick:()=>N("faqs",C("faqs").filter((S,m)=>m!==u)),className:"text-slate-400 hover:text-red-500 transition-colors",children:e.jsx(lt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:778",size:14})})]}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:781",label:"Question",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:782",value:p.question,onChange:S=>{const m=[...C("faqs")];m[u]={...m[u],question:S.target.value},N("faqs",m)}})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:791",label:"Answer",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:792",value:p.answer,onChange:S=>{const m=[...C("faqs")];m[u]={...m[u],answer:S.target.value},N("faqs",m)},className:"min-h-[80px]"})})]},u)),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:804",type:"button",variant:"outline",size:"sm",onClick:()=>N("faqs",[...C("faqs"),{question:"",answer:""}]),children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:810",size:14,className:"mr-1"})," Add FAQ"]})]})}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:816",title:"Programme Badge",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:817",className:"grid grid-cols-3 gap-4",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:818",label:"Badge Type",children:e.jsxs(bn,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:819",value:g("badgeType"),onValueChange:p=>N("badgeType",p),children:[e.jsx(gn,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:820",children:e.jsx(un,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:821"})}),e.jsxs(vn,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:823",children:[e.jsx(Mt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:824",value:"none",children:"None"}),e.jsx(Mt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:825",value:"new",children:"New"}),e.jsx(Mt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:826",value:"most_popular",children:"Most Popular"}),e.jsx(Mt,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:827",value:"custom",children:"Custom"})]})]})}),g("badgeType")==="custom"&&e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:832",label:"Badge Label",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:833",value:g("badgeLabel"),onChange:p=>N("badgeLabel",p.target.value)})})]}),g("badgeType")!=="none"&&e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:838",className:"text-xs text-slate-500",children:'Badge expiry is set automatically to 90 days from first publish for "New" badges. Contact a developer to set a custom expiry date.'})]}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:846",title:"SEO & Metadata",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:847",className:"grid grid-cols-2 gap-4",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:848",label:"SEO Title",hint:"Defaults to programme title if blank",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:849",value:g("seoTitle"),onChange:p=>N("seoTitle",p.target.value)})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:851",label:"OG Title",hint:"Open Graph title for social sharing",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:852",value:g("ogTitle"),onChange:p=>N("ogTitle",p.target.value)})})]}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:855",label:"SEO Description",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:856",value:g("seoDescription"),onChange:p=>N("seoDescription",p.target.value),className:"min-h-[80px]"})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:858",label:"OG Description",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:859",value:g("ogDescription"),onChange:p=>
1N("ogDescription",p.target.value),className:"min-h-[60px]"})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:861",className:"grid grid-cols-2 gap-4",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:862",label:"OG Image URL",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:863",value:g("ogImage"),onChange:p=>N("ogImage",p.target.value),placeholder:"https://..."})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:865",label:"Canonical URL",hint:"Leave blank to auto-generate",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:866",value:g("canonicalUrl"),onChange:p=>N("canonicalUrl",p.target.value),placeholder:"https://aventis.edu.sg/..."})})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:869",className:"flex items-center gap-2",children:[e.jsx(Ma,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:870",checked:b("noIndex"),onCheckedChange:p=>N("noIndex",p)}),e.jsx(Ne,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:874",children:"noIndex â exclude from sitemap and Google index"})]})]}),e.jsxs(Fe,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:879",title:"Conversion Settings",children:[e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:880",label:"WhatsApp Pre-filled Message",hint:"Leave blank to auto-generate from programme title",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:881",value:g("advisorMessage"),onChange:p=>
1N("advisorMessage",p.target.value),className:"min-h-[60px]",placeholder:"Hi, I'm interested in theâ¦"})}),e.jsx(R,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:883",label:"Apply URL Override",hint:"Leave blank to use the standard /apply/ page",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:884",value:g("applyUrl"),onChange:p=>N("applyUrl",p.target.value),placeholder:"https://..."})})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:889",className:"sticky bottom-0 bg-white border-t border-slate-200 px-4 py-3 flex items-center justify-between -mx-4 mt-6",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:890",className:"text-sm text-slate-500",children:k?"You have unsaved changes.":"All changes saved."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:893",className:"flex gap-2",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:894",type:"button",variant:"outline",size:"sm",onClick:U,disabled:W.isPending||!k,children:[e.jsx($e,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:901",size:14,className:"mr-1"}),W.isPending?"Savingâ¦":"Save draft"]}),y.status!=="published"&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:905",type:"button",size:"sm",className:"bg-[#0B00E4] hover:bg-[#0900c0] text-white",onClick:()=>j.mutate({id:t}),disabled:j.isPending,children:[e.jsx(_t,{"data-loc":"client/src/components/dashboard/ProgrammeEditor.tsx:912",size:14,className:"mr-1"}),j.isPending?"Publishingâ¦":"Publish"]})]})]})]})}const Ia={published:{label:"Published",className:"bg-green-100 text-green-700"},draft:{label:"Draft",className:"bg-yellow-100 text-yellow-700"},archived:{label:"Archived",className:"bg-gray-100 text-gray-500"}},Da={preview_session:"Preview Session",open_house:"Open House",webinar:"Webinar",workshop:"Workshop",info_session:"Info Session"},wn={online:e.jsx(ss,{"data-loc":"client/src/components/dashboard/EventList.tsx:37",size:12,className:"inline mr-1"}),in_person:e.jsx(as,{"data-loc":"client/src/components/dashboard/EventList.tsx:38",size:12,className:"inline mr-1"}),hybrid:e.jsx(qt,{"data-loc":"client/src/components/dashboard/EventList.tsx:39",size:12,className:"inline mr-1"})};function Pn({onEdit:t,onCreate:s}){const[a,o]=d.useState(""),[n,l]=d.useState("all"),[r,i]=d.useState("all"),{data:x=[],isLoading:f,refetch:c}=v.cms.listEvents.useQuery(),k=v.cms.publishEvent.useMutation({onSuccess:()=>c()}),E=v.cms.archiveEvent.useMutation({onSuccess:()=>c()}),N=x.filter(b=>{const W=!a||b.title.toLowerCase().includes(a.toLowerCase())||b.slug.toLowerCase().includes(a.toLowerCase()),j=n==="all"||b.status===n,P=r==="all"||b.eventType===r;return W&&j&&P}),g={all:x.length,published:x.filter(b=>b.status==="published").length,draft:x.filter(b=>b.status==="draft").length,archived:x.filter(b=>b.status==="archived").length};function C(b){return b.dateTbc?"Date TBC":b.eventDate?new Date(b.eventDate).toLocaleDateString("en-SG",{day:"numeric",month:"short",year:"numeric"}):"â"}return e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:100",className:"p-6 max-w-7xl",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:102",className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:103",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/EventList.tsx:104",className:"text-xl font-bold text-[#111111]",children:"Events & Info Sessions"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/EventList.tsx:105",className:"text-sm text-gray-500 mt-0.5",children:[g.all," events · ",g.published," published"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:109",className:"flex items-center gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:110",onClick:()=>c(),className:"p-2 rounded-lg border border-gray-200 hover:bg-gray-50 transition-colors",title:"Refresh",children:e.jsx(We,{"data-loc":"client/src/components/dashboard/EventList.tsx:115",size:16,className:"text-gray-500"})}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:117",onClick:s,className:"flex items-center gap-2 bg-[#0B00E4] text-white text-sm font-semibold px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/EventList.tsx:121",size:16}),"New Event"]})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:128",className:"flex gap-1 mb-4 bg-gray-100 rounded-lg p-1
1w-fit",children:["all","published","draft","archived"].map(b=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:130",onClick:()=>l(b),className:`px-3 py-1.5 rounded-md text-xs font-semibold transition-colors capitalize ${n===b?"bg-white text-[#0B00E4] shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[b==="all"?"All":b.charAt(0).toUpperCase()+b.slice(1)," (",g[b],")"]},b))}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:145",className:"flex gap-3 mb-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:146",className:"relative flex-1 max-w-sm",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/EventList.tsx:147",size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventList.tsx:148",type:"text",placeholder:"Search by title or slugâ¦",value:a,onChange:b=>o(b.target.value),className:"w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]"})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/EventList.tsx:156",value:r,onChange:b=>i(b.target.value),className:"text-sm border border-gray-200 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/EventList.tsx:161",value:"all",children:"All event types"}),Object.entries(Da).map(([b,W])=>e.jsx("option",{"data-loc":"client/src/components/dashboard/EventList.tsx:163",value:b,children:W},b))]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:169",className:"bg-white rounded-2xl border border-gray-200 overflow-hidden",children:f?e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:171",className:"flex items-center justify-center py-16 text-gray-400",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/EventList.tsx:172",size:20,className:"animate-spin mr-2"}),"Loading eventsâ¦"]}):N.length===0?e.jsx("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:176",className:"text-center py-16 text-gray-400 text-sm",children:x.length===0?e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:178",children:[e.jsx(vt,{"data-loc":"client/src/components/dashboard/EventList.tsx:179",size:32,className:"mx-auto mb-3 opacity-30"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/EventList.tsx:180",children:"No events yet."}),e.jsx("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:181",onClick:s,className:"mt-3 text-[#0B00E4] font-semibold hover:underline text-sm",children:"Create your first event â"})]}):"No events match your filters."}):e.jsxs("table",{"data-loc":"client/src/components/dashboard/EventList.tsx:193",className:"w-full text-sm",children:[e.jsx("thead",{"data-loc":"client/src/components/dashboard/EventList.tsx:194",children:e.jsxs("tr",{"data-loc":"client/src/components/dashboard/EventList.tsx:195",className:"border-b border-gray-100 bg-gray-50",children:[e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:196",className:"text-left px-4 py-3 font-semibold text-gray-600 w-8",children:"#"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:197",className:"text-left px-4 py-3 font-semibold text-gray-600",children:"Event"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:198",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden md:table-cell",children:"Type"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:199",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden lg:table-cell",children:"Date"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:200",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden lg:table-cell",children:"Mode"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:201",className:"text-left px-4 py-3 font-semibold text-gray-600",children:"Status"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:202",className:"text-left px-4 py-3 font-semibold text-gray-600 hidden xl:table-cell",children:"Updated"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/EventList.tsx:203",className:"text-right px-4 py-3 font-semibold text-gray-600",children:"Actions"})]})}),e.jsx("tbody",{"data-loc":"client/src/components/dashboard/EventList.tsx:206",children:N.map((b,W)=>{const j=Ia[b.status]??Ia.draft,P=b.updatedAt?new Date(b.updatedAt).toLocaleDateString("en-SG",{day:"numeric",month:"short",year:"numeric"}):"â";return e.jsxs("tr",{"data-loc":"client/src/components/dashboard/EventList.tsx:217",className:"border-b border-gray-50 hover:bg-gray-50/50 transition-colors",children:[e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:221",className:"px-4 py-3 text-gray-400 text-xs",children:W+1}),e.jsxs("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:222",className:"px-4 py-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:223",className:"flex items-center gap-1.5",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:224",className:"font-semibold text-[#111111] leading-snug",children:b.title}),b.isFeatured===1&&e.jsx("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:228",className:"text-[10px] bg-[#EEF2FF] text-[#0B00E4] px-1.5 py-0.5 rounded font-semibold",children:"Featured"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:233",className:"text-xs text-gray-400 font-mono mt-0.5",children:["/events/",b.slug,"/"]})]}),e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:235",className:"px-4 py-3 hidden md:table-cell",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:236",className:"text-xs text-gray-500",children:Da[b.eventType]??b.eventType})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:240",className:"px-4 py-3 hidden lg:table-cell",children:e.jsxs("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:241",className:"text-xs text-gray-500 flex items-center gap-1",children:[e.jsx(vt,{"data-loc":"client/src/components/dashboard/EventList.tsx:242",size:11}),C(b)]})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:246",className:"px-4 py-3 hidden lg:table-cell",children:e.jsxs("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:247",className:"text-xs text-gray-500 capitalize",children:[wn[b.mode],b.mode==="in_person"?"In Person":b.mode.charAt(0).toUpperCase()+b.mode.slice(1)]})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:252",className:"px-4 py-3",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:253",className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-semibold ${j.className}`,children:j.label})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:259",className:"px-4 py-3 hidden xl:table-cell",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/EventList.tsx:260",className:"text-xs text-gray-400",children:P})}),e.jsx("td",{"data-loc":"client/src/components/dashboard/EventList.tsx:262",className:"px-4 py-3",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventList.tsx:263",className:"flex items-center justify-end gap-1",children:[b.status==="published"&&e.jsx("a",{"data-loc":"client/src/components/dashboard/EventList.tsx:266",href:`/events/${b.slug}/`,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 rounded-lg hover:bg-gray-100 transition-colors text-gray-400 hover:text-gray-600",title:"Preview live page",children:e.jsx(_e,{"data-loc":"client/src/components/dashboard/EventList.tsx:273",size:15})}),e.jsx("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:277",onClick:()=>
1t(b.id),className:"p-1.5 rounded-lg hover:bg-[#EEF2FF] transition-colors text-gray-400 hover:text-[#0B00E4]",title:"Edit event",children:e.jsx(gt,{"data-loc":"client/src/components/dashboard/EventList.tsx:282",size:15})}),b.status!=="published"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:286",onClick:()=>k.mutate({id:b.id}),disabled:k.isPending,className:"p-1.5 rounded-lg hover:bg-green-50 transition-colors text-gray-400 hover:text-green-600",title:"Publish",children:e.jsx(fe,{"data-loc":"client/src/components/dashboard/EventList.tsx:292",size:15})}),b.status==="published"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/EventList.tsx:297",onClick:()=>E.mutate({id:b.id}),disabled:E.isPending,className:"p-1.5 rounded-lg hover:bg-red-50 transition-colors text-gray-400 hover:text-red-500",title:"Archive",children:e.jsx(pt,{"data-loc":"client/src/components/dashboard/EventList.tsx:303",size:15})})]})})]},b.id)})})]})}),N.length>0&&e.jsxs("p",{"data-loc":"client/src/components/dashboard/EventList.tsx:317",className:"text-xs text-gray-400 mt-3 text-right",children:["Showing ",N.length," of ",x.length," events"]})]})}const En=[{value:"preview_session",label:"Preview Session"},{value:"open_house",label:"Open House"},{value:"webinar",label:"Webinar"},{value:"workshop",label:"Workshop"},{value:"info_session",label:"Info Session"}],Sn=[{value:"online",label:"Online"},{value:"in_person",label:"In Person"},{value:"hybrid",label:"Hybrid"}],Ln=[{id:"basic",title:"Basic Info",icon:e.jsx(os,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:47",size:15})},{id:"datetime",title:"Date & Location",icon:e.jsx(vt,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:48",size:15})},{id:"content",title:"Description & Body",icon:e.jsx(No,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:49",size:15})},{id:"registration",title:"Registration",icon:e.jsx(ko,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:50",size:15})},{id:"hero",title:"Hero Image",icon:e.jsx(Yt,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:51",size:15})},{id:"seo",title:"SEO & Metadata",icon:e.jsx(_t,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:52",size:15})}];function Fn({eventId:t,onBack:s}){const a=t===null,{data:o,isLoading:n,refetch:l}=v.cms.getEvent.useQuery({id:t??0},{enabled:!a&&t!==null}),{data:r=[]}=v.cms.listProgrammes.useQuery(),i=v.cms.updateEvent.useMutation({onSuccess:()=>{J(!1),l()}}),x=v.cms.createEvent.useMutation({onSuccess:me=>{me.ok&&s()}}),f=v.cms.publishEvent.useMutation({onSuccess:()=>l()}),c=v.cms.archiveEvent.useMutation({onSuccess:()=>l()}),[k,E]=d.useState(""),[N,g]=d.useState(""),[C,b]=d.useState("preview_session"),[W,j]=d.useState("online"),[P,U]=d.useState(!0),[y,V]=d.useState(""),[p,u]=d.useState(""),[S,m]=d.useState(""),[$,G]=d.useState(""),[B,K]=d.useState(""),[ne,_]=d.useState(""),[O,q]=d.useState(""),[ge,pe]=d.useState(""),[ce,he]=d.useState(""),[I,w]=d.useState(""),[H,L]=d.useState(!1),[X,Ee]=d.useState(!1),[Se,He]=d.useState(""),[st,Ke]=d.useState(""),[Ye,J]=d.useState(!1),[be,ot]=d.useState(new Set(["basic","datetime","content","registration"]));d.useEffect(()=>{o&&(E(o.title??""),g(o.slug??""),b(o.eventType??"preview_session"),j(o.mode??"online"),U(o.dateTbc===1),V(o.eventDate?new Date(o.eventDate).toISOString().slice(0,16):""),u(o.endDate?new Date(o.endDate).toISOString().slice(0,16):""),m(o.location??""),G(o.zoomLink??""),K(o.description??""),_(o.body??""),q(o.programmeSlug??""),pe(o.registrationUrl??""),he(o.heroImage??""),w(o.maxAttendees?String(o.maxAttendees):""),L(o.isFeatured===1),Ee(o.noIndex===1),He(o.seoTitle??""),Ke(o.seoDescription??""),J(!1))},[o]),d.useEffect(()=>{if(!a)return;const me=k.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").slice(0,80);g(me)},[k,a]);function F(){J(!0)}function de(me){ot(rt=>{const z=new Set(rt);return z.has(me)?z.delete(me):z.add(me),z})}function je(){return{title:k,eventType:C,mode:W,dateTbc:P,eventDate:P?null:y||null,endDate:p||null,location:S||null,zoomLink:$||null,description:B||null,body:ne||null,programmeSlug:O||null,registrationUrl:ge||null,heroImage:ce||null,maxAttendees:I?parseInt(I,10):null,isFeatured:H,noIndex:X,seoTitle:Se||null,seoDescription:st||null}}function Me(){a?x.mutate({slug:N,...je()}):t&&i.mutate({id:t,data:je()})}if(!a&&n)return e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:189",className:"flex items-center justify-center py-24 text-gray-400",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:190",size:20,className:"animate-spin mr-2"}),"Loading eventâ¦"]});const ye=o?.status??"draft",nt=i.isPending||x.isPending;return e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:200",className:"p-6 max-w-4xl",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:202",className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:203",className:"flex items-center gap-3",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:204",onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 transition-colors text-gray-500",title:"Back to list",children:e.jsx(et,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:209",size:18})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:211",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:212",className:"text-xl font-bold text-[#111111]",children:a?"New Event":k||"Edit Event"}),!a&&e.jsxs("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:216",className:"text-xs text-gray-400 font-mono mt-0.5",children:["/events/",N,"/"]})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:220",className:"flex items-center gap-2",children:[Ye&&e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:222",className:"text-xs text-amber-600 font-semibold bg-amber-50 px-2 py-1 rounded",children:"Unsaved changes"}),!a&&ye==="published"&&e.jsxs("a",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:228",href:`/events/${N}/`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-sm text-gray-500 border border-gray-200 px-3 py-2 rounded-lg hover:bg-gray-50 transition-colors",children:[e.jsx(_e,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:234",size:14}),"Preview"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:239",onClick:Me,disabled:nt||!Ye&&!a,className:"flex items-center gap-2 bg-[#0B00E4] text-white text-sm font-semibold px-4 py-2 rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[nt?e.jsx(We,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:244",size:14,className:"animate-spin"}):e.jsx($e,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:244",size:14}),a?"Create Event":"Save Draft"]}),!a&&ye!=="published"&&e.jsxs("button",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:249",onClick:()=>t&&f.mutate({id:t}),disabled:f.isPending||Ye,className:"flex items-center gap-2 bg-green-600 text-white text-sm font-semibold px-4 py-2 rounded-lg hover:bg-green-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:Ye?"Save changes before publishing":"Publish event",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:255",size:14}),"Publish"]}),!a&&ye==="published"&&e.jsxs("button",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:261",onClick:()=>t&&c.mutate({id:t}),disabled:c.isPending,className:"flex items-center gap-2 text-sm text-red-500 border border-red-200 px-3 py-2 rounded-lg hover:bg-red-50 transition-colors",children:[e.jsx(pt,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:266",size:14}),"Archive"]})]})]}),!a&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:275",className:"mb-6 flex items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:276",className:`inline-flex items-center px-3 py-1 rounded-full text-xs font-semibold ${ye==="published"?"bg-green-100 text-green-700":ye==="archived"?"bg-gray-100 text-gray-500":"bg-yellow-100 text-yellow-700"}`,children:ye.charAt(0).toUpperCase()+ye.slice(1)}),o?.publishedAt&&e.jsxs("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:284",className:"text-xs text-gray-400",children:["Published ",new Date(o.publishedAt).toLocaleDateString("en-SG")]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:292",className:"space-y-3",children:Ln.map(me=>{const rt=be.has(me.id);return e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:296",className:"bg-white rounded-2xl border border-gray-200 overflow-hidden",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:297",onClick:()=>de(me.id),className:"w-full flex items-center justify-between px-5 py-4 hover:bg-gray-50 transition-colors",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:301",className:"flex items-center gap-2.5 text-sm font-semibold text-[#111111]",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:302",className:"text-[#0B00E4]",children:me.icon}),me.title]}),rt?e.jsx(ts,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:305",size:16,className:"text-gray-400"}):e.jsx(ze,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:305",size:16,className:"text-gray-400"})]}),rt&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:309",className:"px-5 pb-5 border-t border-gray-100",children:[me.id==="basic"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:312",className:"space-y-4 pt-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:313",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:314",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Event Title *"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:315",type:"text",value:k,onChange:z=>{E(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:"e.g. MBA Programme Preview Session"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:323",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:324",className:"block text-xs font-semibold text-gray-600 mb-1",children:"URL Slug *"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:325",className:"flex items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:326",className:"text-xs text-gray-400 font-mono",children:"/events/"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:327",type:"text",value:N,onChange:z=>{g(z.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),F()},className:"flex-1 px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4] font-mono",placeholder:"mba-preview-oct-2026",readOnly:!a}),e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:335",className:"text-xs text-gray-400 font-mono",children:"/"})]}),!a&&e.jsx("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:338",className:"text-xs text-gray-400 mt-1",children:"Slug cannot be changed after creation."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:341",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:342",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:343",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Event Type *"}),e.jsx("select",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:344",value:C,onChange:z=>{b(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",children:En.map(z=>e.jsx("option",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:350",value:z.value,children:z.label},z.value))})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:354",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:355",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Linked Programme"}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:356",value:O,onChange:z=>{q(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:361",value:"",children:"All Programmes"}),r.map(z=>e.jsx("option",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:363",value:z.slug,children:z.title},z.slug))]})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:368",className:"flex items-center gap-3",children:e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:369",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:370",type:"checkbox",checked:H,onChange:z=>{L(z.target.checked),F()},className:"w-4 h-4 accent-[#0B00E4]"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:376",className:"text-sm text-gray-700",children:"Feature this event (pin to top of listing)"})]})})]}),me.id==="datetime"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:384",className:"space-y-4 pt-4",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:385",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:386",type:"checkbox",checked:P,onChange:z=>{U(z.target.checked),F()},className:"w-4 h-4 accent-[#0B00E4]"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:392",className:"text-sm text-gray-700 font-semibold",children:'Date TBC â show "Date TBC" on the public page'})]}),!P&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:395",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:396",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:397",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Start Date & Time (SGT)"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:398",type:"datetime-local",value:y,onChange:z=>{V(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:405",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:406",className:"block text-xs font-semibold text-gray-600 mb-1",children:"End Date & Time (optional)"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:407",type:"datetime-local",value:p,onChange:z=>{u(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:416",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:417",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Mode *"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:418",className:"flex gap-2",children:Sn.map(z=>e.jsx("button",{"data-loc":"clien
1t/src/components/dashboard/EventEditor.tsx:420",type:"button",onClick:()=>{j(z.value),F()},className:`flex-1 py-2 text-sm rounded-lg border font-semibold transition-colors ${W===z.value?"bg-[#0B00E4] text-white border-[#0B00E4]":"bg-white text-gray-600 border-gray-200 hover:border-[#0B00E4]"}`,children:z.label},z.value))})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:435",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:436",className:"block text-xs font-semibold text-gray-600 mb-1",children:[e.jsx(as,{"data-loc":"client/src/components/dashboard/EventEditor.tsx:437",size:12,className:"inline mr-1"}),"Location / Venue"]}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:440",type:"text",value:S,onChange:z=>{m(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:"e.g. Online via Zoom · or · Orchard Road Campus, Singapore"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:448",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:449",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Zoom Join Link"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:450",type:"url",value:$,onChange:z=>{G(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:"https://us02web.zoom.us/j/..."}),e.jsx("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:457",className:"text-xs text-gray-400 mt-1",children:"For online or hybrid events. Shown only after registration."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:459",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:460",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Max Attendees (optional)"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:461",type:"number",value:I,onChange:z=>{w(z.target.value),F()},className:"w-32 px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:"e.g. 50",min:1})]})]}),me.id==="content"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:475",className:"space-y-4 pt-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:476",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:477",className:"block text-xs font-semibold text-gray-600 mb-1",children:["Short Description",e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:479",className:"text-gray-400 font-normal ml-1",children:"(shown on listing cards, max ~200 chars)"})]}),e.jsx("textarea",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:481",value:B,onChange:z=>{K(z.target.value),F()},rows:3,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4] resize-y",placeholder:"A brief overview of the event for the listing card."}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:488",className:"text-xs text-gray-400 mt-1",children:[B.length," / 200 chars"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:490",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:491",className:"block text-xs font-semibold text-gray-600 mb-1",children:["Full Event Details",e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:493",className:"text-gray-400 font-normal ml-1",children:"(shown on the individual event page)"})]}),e.jsx("textarea",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:495",value:ne,onChange:z=>{_(z.target.value),F()},rows:8,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4] resize-y font-mono text-xs",placeholder:"Full agenda, what to expect, who should attend, etc."})]})]}),me.id==="registration"&&e.jsx("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:508",className:"space-y-4 pt-4",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:509",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:510",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Registration URL *"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:513",type:"url",value:ge,onChange:z=>{pe(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:"https://www.eventbrite.com/e/... or https://us02web.zoom.us/webinar/register/..."}),e.jsx("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:520",className:"text-xs text-gray-400 mt-1",children:'Paste the Eventbrite, Zoom webinar registration, or Google Form link. The "Register Now" button on the event page will open this URL in a new tab.'})]})}),me.id==="hero"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:529",className:"space-y-4 pt-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:530",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:531",className:"block text-xs font-semibold text-gray-600 mb-1",children:"Hero / Banner Image URL"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:532",type:"text",value:ce,onChange:z=>{he(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:"/manus-storage/event-banner-abc123.webp"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:539",className:"text-xs text-gray-400 mt-1",children:"Upload images via the Media Library (B4) and paste the storage URL here."})]}),ce&&e.jsx("img",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:544",src:ce,alt:"Hero preview",className:"rounded-xl border border-gray-200 max-h-40 object-cover w-full"})]}),me.id==="seo"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:555",className:"space-y-4 pt-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:556",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:557",className:"block text-xs font-semibold text-gray-600 mb-1",children:["SEO Title",e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:559",className:"text-gray-400 font-normal ml-1",children:"(auto-generated from event title if blank)"})]}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:561",type:"text",value:Se,onChange:z=>{He(z.target.value),F()},className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4]",placeholder:k||"Event title â Aventis Graduate School",maxLength:120}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:569",className:"text-xs text-gray-400 mt-1",children:[Se.length," / 120 chars"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:571",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:572",className:"block text-xs font-semibold text-gray-600 mb-1",children:["SEO Description",e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:574",className:"text-gray-400 font-normal ml-1",children:"(auto-generated from description if blank)"})]}),e.jsx("textarea",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:576",value:st,onChange:z=>{Ke(z.target.value),F()},rows:3,className:"w-full px-3 py-2 text-sm border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-[#0B00E4]/20 focus:border-[#0B00E4] resize-none",placeholder:B||"Event description for search engines.",maxLength:300}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:584",className:"text-xs text-gray-400 mt-1",children:[st.length," / 300 chars"]})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:586",className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:587",type:"checkbox",checked:X,onChange:z=>{Ee(z.target.checked),F()},className:"w-4 h-4 accent-[#0B00E4]"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/EventEditor.tsx:593",className:"text-sm text-gray-700",children:"No-index â exclude from sitemap and search engines"})]})]})]})]},me.id)})})]})}const Bn=[{id:"programme-guide",label:"Programme guide",description:"Explain a programme format, fit and questions to ask.",articleType:"Programme guide",primaryGoal:"Programme Awareness",tone:"Clear, credible and practical",searchIntent:"informational",funnelStage:"awareness",targetWordCount:"1000",clusterLabel:"Programme discovery",prompt:"Use only verified programme facts. Explain the format, audience fit and questions a prospective learner should ask. Do not make admissions, fee, ranking or career-outcome claims unless separately verified."},{id:"career-guide",label:"Career guide",description:"Help readers assess a professional development decision without outcome promises.",articleType:"Career guide",primaryGoal:"C
1onsideration",tone:"Professional, balanced and evidence-led",searchIntent:"informational",funnelStage:"consideration",targetWordCount:"1100",clusterLabel:"Career and study decisions",prompt:"Frame the topic as a decision guide. Use only verified programme facts and clearly separate general editorial advice from Aventis-specific statements. Do not promise jobs, salaries or admissions outcomes."},{id:"programme-comparison",label:"Programme comparison",description:"Compare study routes with an explicit fact-check boundary.",articleType:"Comparison guide",primaryGoal:"Consideration",tone:"Neutral, practical and transparent",searchIntent:"comparison",funnelStage:"consideration",targetWordCount:"1200",clusterLabel:"Study route comparisons",prompt:"Compare only staff-verified characteristics. Flag any unavailable comparison evidence rather than inferring a claim. Do not create public links or calls to action."},{id:"event-awareness",label:"Event awareness",description:"Build awareness around a planned event or information session.",articleType:"Event awareness article",primaryGoal:"Programme Awareness",tone:"Inviting, precise and factual",searchIntent:"informational",funnelStage:"awareness",targetWordCount:"700",clusterLabel:"Events and information sessions",prompt:"Use only approved event details and verified programme facts. Keep dates, speakers and attendance details marked for human confirmation. Do not publish or add a CTA automatically."},{id:"faq-explainer",label:"FAQ explainer",description:"Answer common programme questions using verified internal facts.",articleType:"FAQ explainer",primaryGoal:"Consideration",tone:"Direct, helpful and factual",searchIntent:"decision",funnelStage:"decision",targetWordCount:"850",clusterLabel:"Programme FAQ",prompt:"Answer only questions supported by verified sources and programme facts. Mark any policy, eligibility, fee or intake question for staff confirmation before future publication."}];function An(t,s=new Date){const a=t.filter(x=>x.status!=="archived"),o={draft:a.filter(x=>x.status==="draft").length,in_review:a.filter(x=>x.status==="in_review").length,changes_requested:a.filter(x=>x.status==="changes_requested").length,approved:a.filter(x=>x.status==="approved").length},n=a.filter(x=>x.sourceReviewStatus!=="verified").length,l=a.filter(x=>x.programmeFactReviewStatus!=="verified").length,r=a.filter(x=>x.status==="draft"&&x.sourceReviewStatus==="verified"&&x.programmeFactReviewStatus==="verified").length,i=a.filter(x=>x.reviewDueAt!==null&&new Date(x.reviewDueAt).getTime()<s.getTime()).length;return{total:a.length,needsEvidence:n,needsFacts:l,readyForOutline:r,inProgress:o.draft+o.in_review+o.changes_requested,overdue:i,pipeline:o}}function Wn({onOpenLegacy:t,onCreated:s}){const[a,o]=d.useState(""),[n,l]=d.useState(""),[r,i]=d.useState(!1),[x,f]=d.useState("Working professionals"),[c,k]=d.useState("Programme Awareness"),[E,N]=d.useState("Medium"),[g,C]=d.useState("Professional"),[b,W]=d.useState(null),[j,P]=d.useState(""),[U,y]=d.useState(""),[V,p]=d.useState(""),[u,S]=d.useState(""),[m,$]=d.useState(""),[G,B]=d.useState(""),[K,ne]=d.useState(""),[_,O]=d.useState([]),{data:q,isLoading:ge}=v.articleCreation.config.useQuery(),pe=v.articleCreation.create.useMutation({onSuccess:I=>{W(I),P(I.article.contentHtml),p(I.article.title),S(I.article.excerpt),$(I.article.seoTitle),B(I.article.metaDescription),ne(I.article.primaryKeyword),O(I.article.secondaryKeywords),M.success("Article ready for review"),s?.(I.contentItemId)},onError:I=>M.error(I.message)});v.articleCreation.edit.useMutation({onSuccess:I=>{P(I.contentHtml),y(""),M.success("AI edit applied locally â review before saving")},onError:I=>M.error(I.message)});const ce=v.articleCreation.saveDraft.useMutation({onSuccess:()=>M.success("Article draft saved privately for review"),onError:I=>M.error(I.message)});d.useMemo(()=>j.replace(/<[^>]*>/g," ").trim().split(/\s+/).filter(Boolean).length,[j]);const he=()=>{if(!a)return M.error("Select a programme before creating an article.");pe.mutate({canonicalProgrammeId:a,topic:n||null,targetAudience:x,primaryGoal:c,wordCount:E,tone:g})};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"space-y-5",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"overflow-hidden rounded-2xl border border-[#0B00E4]/20 bg-gradient-to-br from-[#F7F8FF] via-white to-[#EEF2FF]",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"border-b border-[#0B00E4]/10 px-5 py-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"flex items-center gap-2 text-[#0B00E4]",children:[e.jsx(Oe,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",size:18}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"text-sm font-semibold",children:"Create Article"})]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"mt-1 text-2xl font-semibold text-slate-950",children:"Start with what you want to promote"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"mt-1 max-w-3xl text-sm text-slate-600",children:"Choose a programme and the system will prepare an article for you to read, review and save."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"border border-slate-200 bg-white text-slate-700",children:"Draft only"})]})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"grid gap-5 p-5 lg:grid-cols-[1.15fr_.85fr]",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:["Programme ",e.jsx("span",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"text-rose-600",children:"*"})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",value:a,onChange:I=>o(I.target.value),className:"mt-1 h-11 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",value:"",children:"Select a Marketing Portal programme"}),q?.programmes?.map(I=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",value:I.canonicalProgrammeId,children:I.label},I.canonicalProgrammeId))]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:["Topic or idea ",e.jsx("span",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"text-slate-400",children:"optional"})]}),e.jsx(A,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"mt-1",value:n,onChange:I=>l(I.target.value),placeholder:"Leave blank and AI will choose a to
1pic"})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",type:"button",onClick:()=>i(!r),className:"flex items-center gap-1 text-sm font-semibold text-[#0B00E4]",children:["Advanced options ",e.jsx(ze,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:`transition-transform ${r?"rotate-180":""}`,size:16})]}),r&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"grid gap-3 rounded-xl border border-slate-200 bg-white p-4 sm:grid-cols-2",children:[e.jsx(Dt,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",label:"Target audience",value:x,onChange:f,options:q?.audiences??[]}),e.jsx(Dt,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",label:"Primary goal",value:c,onChange:k,options:q?.goals??[]}),e.jsx(Dt,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",label:"Article length",value:E,onChange:N,options:q?.lengths??[]}),e.jsx(Dt,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",label:"Tone",value:g,onChange:C,options:q?.tones??[]})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"w-full bg-[#0B00E4] text-white hover:bg-[#0900b8]",disabled:pe.isPending||ge,onClick:he,children:pe.isPending?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"animate-spin",size:16})," Generating articleâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(ft,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",size:16})," Generate Article"]})})]}),e.jsxs("aside",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"rounded-xl border border-slate-200 bg-white p-4 text-sm text-slate-600",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"font-semibold text-slate-900",children:"What happens next"}),e.jsxs("ul",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"mt-3 space-y-2",children:[e.jsx("li",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:"⢠The article opens ready to read"}),e.jsx("li",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:"⢠Programme information and article structure are checked"}),e.jsx("li",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:"⢠SEO details are prepared automatically"}),e.jsx("li",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:"⢠You can edit and save the draft when needed"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"mt-4 rounded-lg bg-slate-50 p-3 text-xs",children:"Nothing is published when you generate or save a draft."})]})]})]}),b&&!s&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"space-y-5 rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"text-sm font-semibold text-[#0B00E4]",children:["Draft #",b.contentItemId]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"mt-1 text-2xl font-semibold text-slate-950",children:"Article ready for review"})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"border border-slate-200 bg-white text-slate-700",children:"Draft · not published"})]}),e.jsx(js,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",value:j,onChange:P}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"flex flex-wrap justify-between gap-3 border-t border-slate-100 pt-5",children:[e.jsx(T,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",variant:"outline",onClick:t,children:"More editorial tools"}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",disabled:ce.isPending,onClick:()=>ce.mutate({contentItemId:b.contentItemId,title:V,excerpt:u,contentHtml:j,seoTitle:m,metaDescription:G,primaryKeyword:K,secondaryKeywords:_}),children:ce.isPending?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",className:"animate-spin",size:16})," Saving draftâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx($e,{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:27",size:16})," Save draft"]})})]})]})]})}function Dt({label:t,value:s,onChange:a,options:o}){return e.jsxs("label",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:30",className:"space-y-1",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:30",className:"text-sm font-medium text-slate-700",children:t}),e.jsx("select",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:30",value:s,onChange:n=>a(n.target.value),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:o.map(n=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ArticleCreationV1.tsx:30",value:n,children:n},n))})]})}const Ta=t=>t.replace(/<[^>]+>
1/g," ").trim().split(/\s+/).filter(Boolean).length,Mn=t=>(t.match(/<a\b/gi)??[]).length,In=t=>(t.match(/\[[^\]]+\]\([^\s)]+\)/g)??[]).length,Ua=t=>t?new Date(t).toLocaleString("en-SG",{day:"numeric",month:"short",year:"numeric",hour:"numeric",minute:"2-digit"}):"â";function Dn({contentItemId:t,status:s,onPublished:a}){const o=v.useUtils(),[n,l]=d.useState(""),[r,i]=d.useState(!1),x=v.contentFoundation.publicationPreview.useQuery({id:t,proposedSlug:n||null},{enabled:s==="approved"||s==="published",retry:!1}),f=x.data;d.useEffect(()=>{f?.publicArticle?.slug&&!n&&l(f.publicArticle.slug)},[f?.publicArticle?.slug,n]);const c=v.contentFoundation.publishApprovedToBlog.useMutation({onSuccess:async g=>{i(!1),await Promise.all([o.contentFoundation.get.invalidate({id:t}),o.contentFoundation.list.invalidate(),o.blog.list.invalidate()]),await a?.(),M.success(`Published to Blog: ${g.publicUrl}`)},onError:g=>M.error(g.message)}),k=d.useMemo(()=>f?{words:Ta(f.privateArticle.contentHtml),links:Mn(f.privateArticle.contentHtml)}:null,[f]),E=d.useMemo(()=>f?{words:Ta(f.publicArticle.contentMarkdown),links:In(f.publicArticle.contentMarkdown)}:null,[f]);if(s!=="approved"&&s!=="published")return e.jsx("section",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:53",className:"rounded-2xl border border-slate-200 bg-slate-50 p-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:53",className:"flex items-start gap-3",children:[e.jsx(jt,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:53",className:"mt-0.5 text-slate-500",size:19}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:53",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:53",className:"font-semibold text-slate-900",children:"Public Blog publishing is locked"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:53",className:"mt-1 text-sm leading-6 text-slate-600",children:"A named Marketing Portal reviewer must approve this article internally before a separate publisher can review and publish it. Nothing is public at this stage."})]})]})});if(x.isLoading)return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:56",className:"rounded-2xl border border-slate-200 bg-white p-5 text-sm text-slate-500",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:56",className:"mr-2 inline animate-spin",size:16})," Preparing the public Blog reviewâ¦"]});if(x.error)return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:57",className:"rounded-2xl border border-rose-200 bg-rose-50 p-5 text-sm text-rose-900",children:["The public Blog review could not be prepared: ",x.error.message]});if(!f)return null;const N=f.status==="published";return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"overflow-hidden rounded-2xl border border-[#0B00E4]/20 bg-white shadow-sm","data-testid":"content-foundation-publication-panel",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"border-b border-[#0B00E4]/10 bg-gradient-to-r from-[#F7F8FF] via-white to-[#EEF2FF] px-5 py-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"flex items-center gap-2 text-[#0B00E4]",children:[e.jsx(Sa,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",size:18}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"text-sm font-semibold",children:"Public Blog publishing"})]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"mt-1 text-xl font-semibold text-slate-950",children:N?"Published Blog record":"Review before publishing"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:"mt-1 max-w-3xl text-sm leading-6 text-slate-600",children:"The private approved article is mapped to the existing Aventis Blog without AI generation, external search, metadata rewriting, CTA insertion, or automatic publishing."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:61",className:`border ${N?"border-emerald-200 bg-emerald-50 text-emerald-800":"border-amber-200 bg-amber-50 text-amber-800"}`,children:N?"Published":"Awaiting explicit publish"})]})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"grid gap-5 p-5 xl:grid-cols-2",children:[e.jsxs("article",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"rounded-xl border border-slate-200 bg-slate-50 p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"font-semibold text-slate-900",children:"Private approved record"}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"border border-slate-200 bg-white text-slate-700",children:"Internal source"})]}),e.jsxs("dl",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"mt-4 space-y-3 text-sm",children:[e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",label:"Title",value:f.privateArticle.title}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",label:"Format",value:"Private rich-text draft"}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",label:"Author",value:f.privateArticle.author||"Aventis Editorial Team"}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",label:"Category",value:f.privateArticle.category||"Uncategorised"}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",label:"Body",value:`${k?.words??0} words · ${k?.links??0} existing link${k?.links===1?"":"s"}`}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",label:"SEO metadata",value:"Preserved for the public Blog record"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",className:"mt-4 rounded-lg border border-slate-200 bg-white p-3 text-xs leading-5 text-slate-600",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:63",children:"Internal approval:"})," ",Ua(f.internalApproval.approvedAt),f.internalApproval.approver?` by ${f.internalApproval.approver.name||f.internalApproval.approver.email||`staff #${f.internalApproval.approver.id}`}`:""]})]}),e.jsxs("article",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"rounded-xl border border-[#0B00E4]/20 bg-[#F7F8FF] p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"font-semibold text-slate-900",children:"Public Blog record"}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"border border-[#0B00E4]/15 bg-white text-[#0B00E4]",children:"Existing Blog renderer"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"mt-4",children:[e.jsx("label",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"text-sm font-medium text-slate-700",children:"Public Blog URL"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"mt-1 flex flex-col gap-2 sm:flex-row",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"flex min-w-0 items-center rounded-md border border-slate-300 bg-white px-3 text-sm text-slate-500",children:"/blog/"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",value:n,disabled:N,onChange:g=>l(g.target.value.toLowerCase().replace(/\s+/g,"-")),"aria-label":"Public Blog URL slug"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"flex items-center rounded-md border border-slate-300 bg-white px-3 text-sm text-slate-500",children:"/"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"mt-2 break-all text-xs text-slate-500",children:f.publicArticle.url})]}),e.jsxs("dl",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",className:"mt-4 space-y-3 text-sm",children:[e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",label:"Title",value:f.publicArticle.title}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",label:"Format",value:"Markdown for the current public Blog renderer"}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",label:"Author",value:f.publicArticle.author}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",label:"Category",value:f.publicArticle.category||"Uncategorised"}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",label:"Body",value:`${E?.words??0} words · ${E?.links??0} preserved link${E?.links===1?"":"s"}`}),e.jsx(Be,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:65",label:"Cover image",value:f.publicArticle.coverImage?"Existing approved image reference preserved":"None â existing Blog gradient fallback"})]})]})]}),N?e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"border-t border-slate-100 bg-emerald-50/70 px-5 py-4",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"flex items-start gap-3",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"mt-0.5 text-emerald-600",size:19}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"font-semibold text-emerald-900",children:"Published and locked"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"mt-1 text-sm text-emerald-800",children:["Published ",Ua(f.publication.publishedAt),f.publication.publisher?` by ${f.publication.publisher.name||f.publication.publisher.email||`staff #${f.publication.publisher.id}`}`:"",". The private source and the linked Blog record retain separate approval and publisher audit details."]})]})]}),f.publication.publicUrl?e.jsxs("a",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",href:f.publication.publicUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-md border border-emerald-300 bg-white px-3 py-2 text-sm font-semibold text-emerald-800 hover:bg-emerald-100",children:[e.jsx(_e,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",size:15})," Open public Blog"]}):null]})}):e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"border-t border-slate-100 px-5 py-4",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"max-w-3xl",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"flex items-center gap-2",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",size:17,className:"text-[#0B00E4]"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"font-semibold text-slate-900",children:"Explicit human publishing decision required"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"mt-1 text-sm leading-6 text-slate-600",children:"Publishing creates a public Blog record
1immediately. It does not schedule, alter any programme page, create a CTA, generate an image, call AI, or connect to Google Search Console or another external service."}),f.blockingReasons.length>0?e.jsx("ul",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"mt-3 space-y-1 text-sm text-amber-800",children:f.blockingReasons.map(g=>e.jsxs("li",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:["⢠",g]},g))}):null]}),e.jsxs(kt,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",open:r,onOpenChange:i,children:[e.jsx(ln,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",asChild:!0,children:e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",disabled:!f.canPublish||c.isPending,className:"shrink-0 bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:[e.jsx(Sa,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",size:16})," Publish to Blog"]})}),e.jsxs(Ct,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:[e.jsxs(wt,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:[e.jsx(Et,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:"Publish this approved article to the public Blog?"}),e.jsxs(St,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:["The article will become publicly available at ",e.jsx("strong",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:f.publicArticle.url}),". This action is recorded with the publishing staff member and time. No automatic or scheduled publishing is involved."]})]}),e.jsxs(Pt,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",children:[e.jsx(Ft,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",disabled:c.isPending,children:"Cancel"}),e.jsx(Lt,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",disabled:c.isPending,onClick:g=>{g.preventDefault(),c.mutate({id:t,proposedSlug:n})},className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:c.isPending?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:67",className:"animate-spin",size:16})," Publishingâ¦"]}):"Confirm and publish"})]})]})]})]})})]})}function Be({label:t,value:s}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:71",className:"grid grid-cols-[115px_1fr] gap-3",children:[e.jsx("dt",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:71",className:"text-slate-500",children:t}),e.jsx("dd",{"data-loc":"client/src/components/dashboard/ContentFoundationPublicationPanel.tsx:71",className:"min-w-0 break-words font-medium text-slate-800",children:s})]})}const Tn={programmeId:"",topic:"",audience:"Working professionals",goal:"Programme Awareness",length:"Medium",tone:"Professional"},Un={title:"",contentHtml:"",excerpt:"",seoTitle:"",metaDescription:"",primaryKeyword:"",secondaryKeywords:"",coverImageUrl:"",coverImageAlt:""},ys={draft:"Working Draft",in_review:"In Review",changes_requested:"Changes Requested",approved:"Approved",published:"Published",archived:"Archived"},Vn={draft:"border-amber-200 bg-amber-50 text-amber-800",in_review:"border-blue-200 bg-blue-50 text-blue-800",changes_requested:"border-rose-200 bg-rose-50 text-rose-800",approved:"border-emerald-200 bg-emerald-50 text-emerald-800",published:"border-[#0B00E4]/20 bg-[#F7F8FF] text-[#0B00E4]",archived:"border-slate-200 bg-slate-100 text-slate-600"},Gn=t=>t.replace(/<[^>]+>/g," ").trim().split(/\s+/).filter(Boolean).length,zn=t=>t.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-").slice(0,280),ga=t=>t.replaceAll("_"," ").replace(/\b\w/g,s=>s.toUpperCase());function Ns({status:t}){return e.jsx(se,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:59",className:`border ${Vn[t]}`,children:ys[t]})}function ke({label:t,children:s,detail:a}){return e.jsxs("label",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:63",className:"space-y-1.5",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:63",className:"text-sm font-medium text-slate-700",children:t}),s,a&&e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:63",className:"text-xs leading-5 text-slate-500",children:a})]})}function Tt({value:t,onChange:s,options:a,placeholder:o}){return e.jsxs("select",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:67",value:t,onChange:n=>s(n.target.value),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm text-slate-800",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:67",value:"",children:o??"Select an option"}),a.map(n=>e.jsx("option",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:67",value:n,children:n},n))]})}function Rn({label:t,state:s,note:a}){const o=s==="Good"?"border-emerald-200 bg-emerald-50 text-emerald-900":s==="Missing"?"border-rose-200 bg-rose-50 text-rose-900":"border-amber-200 bg-amber-50 text-amber-900";return e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:72",className:"rounded-xl border border-slate-200 p-3.5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:72",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:72",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:72",className:"text-sm font-semibold text-slate-900",children:t}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:72",className:"mt-1 text-sm leading-5 text-slate-600",children:a})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:72",className:`shrink-0 border ${o}`,children:s})]})})}function _n({onOpenLegacy:t}){const s=v.useUtils(),[a,o]=d.useState("overview"),[n,l]=d.useState(Tn),[r,i]=d.use
1State([]),[x,f]=d.useState([]),[c,k]=d.useState(!1),[E,N]=d.useState(null),[g,C]=d.useState(Un),[b,W]=d.useState("quality"),[j,P]=d.useState(""),{data:U,isLoading:y}=v.articleCreation.config.useQuery(),{data:V=[]}=v.contentFoundation.list.useQuery(),p=v.contentFoundation.get.useQuery({id:E},{enabled:E!==null}),u=v.articleCreation.reviewGuidance.useQuery({contentItemId:E},{enabled:E!==null}),S=p.data?.item,m=p.data;d.useEffect(()=>{S&&(C({title:S.title??"",contentHtml:S.content??"",excerpt:S.excerpt??"",seoTitle:S.seoTitle??"",metaDescription:S.metaDescription??"",primaryKeyword:S.primaryKeyword??"",secondaryKeywords:Array.isArray(S.secondaryKeywords)?S.secondaryKeywords.join(", "):"",coverImageUrl:S.coverImageUrl??"",coverImageAlt:S.coverImageAlt??""}),P(S.internalReviewNotes??""))},[S]);const $=()=>{i([]),f([]),k(!1)},G=(F,de)=>{l(je=>({...je,[F]:de})),(F==="programmeId"||F==="topic")&&$()},B=()=>({canonicalProgrammeId:n.programmeId,topic:n.topic||null,targetAudience:n.audience,primaryGoal:n.goal,wordCount:n.length,tone:n.tone,contextConfirmed:!0}),K=async()=>{await Promise.all([s.contentFoundation.list.invalidate(),s.contentFoundation.summary.invalidate(),E?s.contentFoundation.get.invalidate({id:E}):Promise.resolve()])},ne=v.articleCreation.suggestIdeas.useMutation({onSuccess:F=>{i(F),M.success("Suggested ideas are ready for review")},onError:F=>M.error(F.message)}),_=v.articleCreation.generateOutline.useMutation({onSuccess:F=>{f(F.sections),k(!1),!n.topic&&F.title&&l(de=>({...de,topic:F.title})),M.success("Outline created for review")},onError:F=>M.error(F.message)}),O=v.articleCreation.create.useMutation({onSuccess:async F=>{N(F.contentItemId),o("review"),f([]),k(!1),await K(),M.success("Private article draft created for review")},onError:F=>M.error(F.message)}),q=v.articleCreation.saveDraft.useMutation({onSuccess:async()=>{await K(),M.success("Private article draft saved")},onError:F=>M.error(F.message)}),ge=v.contentFoundation.submitForReview.useMutation({onSuccess:async()=>{await K(),M.success("Article submitted for review")},onError:F=>M.error(F.message)}),pe=v.contentFoundation.review.useMutation({onSuccess:async()=>{await K(),M.success("Review decision recorded")},onError:F=>M.error(F.message)}),ce=v.contentFoundation.returnToDraft.useMutation({onSuccess:async()=>{await K(),M.success("Article returned to working draft")},onError:F=>M.error(F.message)}),he=V.filter(F=>F.status!=="archived"),I=he.filter(F=>F.status==="in_review"||F.status==="changes_requested"),w=[...he].sort((F,de)=>+new Date(de.updatedAt)-+new Date(F.updatedAt)).slice(0,5),H=S?.status??"draft",L=Gn(g.contentHtml),X=S?.targetWordCount??1100,Ee=d.useMemo(()=>S?[{label:"Article structure",state:/<h[23]\b/i.test(g.contentHtml)?"Good":"Needs attention",note:/<h[23]\b/i.test(g.contentHtml)?"Headings are present for a clear reading hierarchy.":"Add clear section headings before review."},{label:"Target length",state:L>=Math.floor(X*.7)?"Good":"Needs attention",note:`${L.toLocaleString()} words against a ${X.toLocaleString()}-word guidance target.`},{label:"SEO title",state:g.seoTitle.trim()&&g.seoTitle.length<=60?"Good":g.seoTitle.trim()?"Needs attention":"Missing",note:g.seoTitle.trim()?`${g.seoTitle.length}/60 characters.`:"Add a concise SEO title."},{label:"Meta description",state:g.metaDescription.trim()&&g.metaDescription.length<=155?"Good":g.metaDescription.trim()?"Needs attention":"Missing",note:g.metaDescription.trim()?`${g.metaDescription.length}/155 characters.`:"Add a concise meta description."},{label:"Sources and programme facts",state:S.sourceReviewStatus==="verified"&&S.programmeFactReviewStatus==="verified"?"Good":"Needs attention",note:S.sourceReviewStatus==="verified"&&S.programmeFactReviewStatus==="verified"?"Required internal evidence checks are verified.":"Complete the existing evidence and programme-fact review before approval."}]:[],[g.contentHtml,g.metaDescription,g.seoTitle,S,X,L]),Se=Ee.filter(F=>F.state!=="Good").length,He=[...m?.sources??[],...m?.programmeFacts??[]].filter(F=>(F.sourceStatus??F.reviewStatus)!=="verified").length,st=F=>{l(de=>({...de,topic:F.topic})),f([]),k(!1),o("create"),M.message("Idea added to the article brief. No draft has been created.")},Ke=(F,de)=>f(je=>{const Me=F+de;if(Me<0||Me>=je.length)return je;const ye=[...je];return[ye[F],ye[Me]]=[ye[Me],ye[F]],ye}),Ye=(F,de)=>{C(je=>({...je,contentHtml:`${je.contentHtml}<p>Related reading: <a href="${F}">${de}</a></p>`})),M.success("Link added to the unsaved working draft")},J=()=>{if(!E||!g.title.trim()||!g.contentHtml.trim()||!g.seoTitle.trim()||!g.metaDescription.trim()||!g.primaryKeyword.trim())return M.error("Title, body, SEO title, meta description and primary keyword are required.");q.mutate({contentItemId:E,title:g.title.trim(),contentHtml:g.contentHtml,excerpt:g.excerpt,seoTitle:g.seoTitle.trim(),metaDescription:g.metaDescription.trim(),primaryKeyword:g.primaryKeyword.trim(),secondaryKeywords:g.secondaryKeywords.split(",").map(F=>
1F.trim()).filter(Boolean),coverImageUrl:g.coverImageUrl||null,coverImageAlt:g.coverImageAlt||null})},be=()=>{if(!n.programmeId)return M.error("Select a programme first.");if(!c||!x.length)return M.error("Generate, review and confirm an outline before creating the private draft.");O.mutate({canonicalProgrammeId:n.programmeId,topic:n.topic||null,targetAudience:n.audience,primaryGoal:n.goal,wordCount:n.length,tone:n.tone,approvedOutline:x})},ot=[{id:"overview",label:"Overview"},{id:"ideas",label:"Suggested Ideas"},{id:"create",label:"Create Article"}];return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:144",className:"space-y-6","data-testid":"blog-ai-generator-v2",children:[e.jsxs("header",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",className:"flex flex-col gap-4 border-b border-slate-200 pb-5 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",className:"flex items-center gap-2 text-[#0B00E4]",children:[e.jsx(Oe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",size:18}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",className:"text-sm font-semibold",children:"Content"})]}),e.jsx("h1",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",className:"mt-1 text-2xl font-semibold text-slate-950",children:"Blog & AI Generator"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",className:"mt-1 text-sm text-slate-600",children:"Plan, create, review and publish grounded Aventis articles."})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",onClick:()=>o("create"),className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:145",size:16})," Create Article"]})]}),e.jsx("nav",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:146",className:"flex w-full gap-1 overflow-x-auto rounded-xl border border-slate-200 bg-white p-1.5","aria-label":"Blog and AI Generator sections",children:ot.map(F=>e.jsx("button",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:146",type:"button",onClick:()=>o(F.id),className:`shrink-0 rounded-lg px-4 py-2 text-sm font-semibold transition-colors ${a===F.id?"bg-[#0B00E4] text-white":"text-slate-600 hover:bg-slate-50"}`,children:F.label},F.id))}),a==="overview"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"space-y-5",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"text-lg font-semibold text-slate-950",children:"Needs your attention"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-1 text-sm text-slate-500",children:"Only private articles that need a human decision appear here."})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",size:"sm",variant:"outline",onClick:()=>o("create"),children:[e.jsx(ft,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",size:15})," Create Article"]})]}),I.length?e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-4 space-y-2",children:I.map(F=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",onClick:()=>{N(F.id),o("review")},className:"flex w-full flex-col gap-2 rounded-xl border border-amber-200 bg-amber-50/50 p-4 text-left transition-colors hover:bg-amber-50 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"font-semibold text-slate-950",children:F.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-1 text-sm text-amber-900",children:F.status==="in_review"?"Internal approval needed":"Changes requested"})]}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"text-sm font-semibold text-[#0B00E4]",children:"Review â"})]},F.id))}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-4 flex items-center gap-3 rounded-xl bg-emerald-50 p-4 text-emerald-900",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"shrink-0",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"font-semibold",children:"Youâre all caught up."}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-0.5 text-sm text-emerald-800",children:"No private article currently needs a decision."})]})]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"text-lg font-semibold text-slate-950",children:"Recent articles"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-1 text-sm text-slate-500",children:"Open an existing private draft to edit, review or publish through the approved workflow."})]}),w.length?e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-4 divide-y divide-slate-100",children:w.map(F=>e.jsxs("article",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"flex flex-col gap-3 py-4 first:pt-0 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"min-w-0",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"truncate font-semibold text-slate-950",children:F.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-1 text-sm text-slate-500",children:F.programmeTitleSnapshot??"No programme selected"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"flex items-center gap-3",children:[e.jsx(Ns,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",status:F.status}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",size:"sm",variant:"outline",onClick:()=>{N(F.id),o("review")},children:"Open"})]})]},F.id))}):e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:148",className:"mt-4 rounded-xl bg-slate-50 p-4 text-sm text-slate-600",children:"No private articles yet. Start with a suggested idea or create a new article."})]})]}),a==="ideas"&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"space-y-5",children:[e.jsx(Va,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",brief:n,config:U,loading:y,onChange:G}),e.jsx("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"rounded-2xl border border-[#0B00E4]/20 bg-[#F7F8FF] p-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"flex items-center gap-2 text-[#0B00E4]",children:[e.jsx(Co,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",size:18}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"text-sm font-semibold",children:"Suggested Ideas"})]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-1 text-xl font-semibold text-slate-950",children:"Find a grounded starting point"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-1 max-w-3xl text-sm leading-6 text-slate-600",children:"Ideas use the selected programmeâs approved context. They are editorial prompts only and do not represent search, trend or performance demand."})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",disabled:!n.programmeId||ne.isPending,onClick:()=>ne.mutate(B()),className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:ne.isPending?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"animate-spin",size:16})," Generatingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(La,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",size:16})," Suggest Ideas"]})})]})}),r.length>0&&e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"grid gap-4 lg:grid-cols-3",children:r.map(F=>e.jsxs("article",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsx(se,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"border border-[#0B00E4]/20 bg-[#F7F8FF] text-[#0B00E4]",children:F.articleType||"Article"}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-3 text-lg font-semibold text-slate-950",children:F.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-2 text-sm leading-6 text-slate-600",children:F.rationale}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-4 text-xs font-semibold uppercase tracking-wide text-slate-500",children:"Focus keyword"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-1 text-sm text-slate-700",children:F.primaryKeyword||"To be defined"}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:150",className:"mt-5 w-full",variant:"outline",onClick:()=>st(F),children:"Use This Idea"})]},`${F.title}-${F.topic}`))})]}),a==="create"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"space-y-5",children:[e.jsx(Va,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",brief:n,config:U,loading:y,onChange:G}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"flex items-center gap-2 text-[#0B00E4]",children:[e.jsx(ft,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:18}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"text-sm font-semibold",children:"Outline"})]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"mt-1 text-xl font-semibold text-slate-950",children:"Review the article structure first"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"mt-1 text-sm leading-6 text-slate-600",children:"The outline is temporary. It becomes a private article draft only when you explicitly create the article."})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",variant:"outline",disabled:!n.programmeId||_.isPending,onClick:()=>_.mutate(B()),children:_.isPending?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"animate-spin",size:16})," Generatingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(La,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:16})," Generate Outline"]})})]}),x.length>0?e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"mt-5 space-y-2",children:[x.map((F,de)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-50 p-3",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"w-6 text-center text-sm font-semibold text-slate-500",children:de+1}),e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",value:F,onChange:je=>{const Me=[...x];Me[de]=je.target.value,f(Me),k(!1)}}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"flex shrink-0 gap-1",children:[e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:"icon",variant:"ghost",disabled:de===0,onClick:()=>{Ke(de,-1),k(!1)},"aria-label":"Move section up",children:e.jsx(ns,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:16})}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:"icon",variant:"ghost",disabled:de===x.length-1,onClick:()=>{Ke(de,1),k(!1)},"aria-label":"Move section down",children:e.jsx(wo,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:16})})]})]},`${de}-${F}`)),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-[#0B00E4]/20 bg-[#F7F8FF] p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"text-sm text-slate-700",children:c?"Outline confirmed. You can now create a private draft.":"Review and confirm the outline before creating a private draft."}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",onClick:()=>{k(!0),M.success("Outline confirmed for this article creation session")},variant:c?"outline":"default",className:c?"":"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:c?e.jsxs(e.Fragment,{children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:16})," Confirmed"]}):e.jsxs(e.Fragment,{children:[e.jsx(it,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:16})," Confirm Outline"]})})]})]}):e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"mt-5 rounded-xl bg-slate-50 p-4 text-sm text-slate-600",children:"Generate an outline to review the structure before a draft is created."})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"flex flex-col gap-4 roun
1ded-2xl border border-[#0B00E4]/20 bg-gradient-to-br from-[#F7F8FF] via-white to-[#EEF2FF] p-5 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"font-semibold text-slate-950",children:"Create private article draft"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"mt-1 text-sm text-slate-600",children:"Generation uses the selected programmeâs approved context. Nothing publishes automatically."})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",disabled:!n.programmeId||!c||O.isPending,onClick:be,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:O.isPending?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",className:"animate-spin",size:16})," Creatingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:152",size:16})," Create Article"]})})]})]}),a==="review"&&e.jsx(e.Fragment,{children:E?p.isLoading||!S?e.jsx("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:154",className:"rounded-2xl border border-slate-200 bg-white p-6 text-sm text-slate-600",children:"Loading articleâ¦"}):e.jsx(qn,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:154",item:S,detail:m,editor:g,setEditor:C,activePanel:b,setActivePanel:W,quality:Ee,attentionChecks:Se,verificationCount:He,guidance:u.data,guidanceLoading:u.isLoading,wordCount:L,targetWords:X,reviewNotes:j,setReviewNotes:P,status:H,onBack:()=>o("overview"),onSave:J,savePending:q.isPending,onAddLink:Ye,onSubmit:()=>ge.mutate({id:E}),onApprove:()=>pe.mutate({id:E,decision:"approved",notes:j||null}),onRequestChanges:()=>pe.mutate({id:E,decision:"changes_requested",notes:j||null}),onReturnToDraft:()=>ce.mutate({id:E}),onPublished:K}):e.jsx("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:154",className:"rounded-2xl border border-slate-200 bg-white p-6 text-sm text-slate-600",children:"Select a private article from Overview to review it."})}),e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:156",className:"flex justify-end",children:e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:156",size:"sm",variant:"ghost",className:"text-slate-500 hover:text-slate-700",onClick:t,children:"More editorial tools"})})]})}function Va({brief:t,config:s,loading:a,onChange:o}){return e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",className:"text-sm font-semibold text-[#0B00E4]",children:"Article brief"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",className:"mt-1 text-xl font-semibold text-slate-950",children:"Set the editorial direction"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",className:"mt-1 text-sm text-slate-500",children:"These settings feed the existing private Article Creation workflow."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",className:"mt-5 grid gap-4 lg:grid-cols-2",children:[e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",label:"Programme",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",disabled:a,value:t.programmeId,onChange:n=>o("programmeId",n.target.value),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:"",children:"Select a Marketing Portal programme"}),s?.programmes?.map(n=>e.jsx("option",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:n.canonicalProgrammeId,children:n.label},n.canonicalProgrammeId))]})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",label:"Topic or idea",detail
1:"Optional. Use a clear editorial angle, not a performance claim.",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:t.topic,onChange:n=>o("topic",n.target.value),placeholder:"e.g. Preparing for a healthcare leadership role"})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",label:"Target audience",children:e.jsx(Tt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:t.audience,onChange:n=>o("audience",n),options:s?.audiences??[]})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",label:"Content goal",children:e.jsx(Tt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:t.goal,onChange:n=>o("goal",n),options:s?.goals??[]})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",label:"Article length",children:e.jsx(Tt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:t.length,onChange:n=>o("length",n),options:s?.lengths??[]})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",label:"Tone",children:e.jsx(Tt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:161",value:t.tone,onChange:n=>o("tone",n),options:s?.tones??[]})})]})]})}function qn({item:t,detail:s,editor:a,setEditor:o,activePanel:n,setActivePanel:l,quality:r,attentionChecks:i,verificationCount:x,guidance:f,guidanceLoading:c,wordCount:k,targetWords:E,reviewNotes:N,setReviewNotes:g,status:C,onBack:b,onSave:W,savePending:j,onAddLink:P,onSubmit:U,onApprove:y,onRequestChanges:V,onReturnToDraft:p,onPublished:u}){const S=[{id:"quality",label:"SEO & Quality",count:i},{id:"sources",label:"Sources",count:x},{id:"links",label:"Links & Similar",count:f?.similarContent?.length??0},{id:"approval",label:"Approval"}],m=(G,B)=>o(K=>({...K,[G]:B})),$=C!=="published"&&C!=="archived"&&C!=="approved";return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"space-y-6",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",variant:"ghost",size:"sm",onClick:b,children:[e.jsx(et,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",size:16})," Back to Overview"]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"rounded-2xl border border-slate-200 bg-white p-5 sm:p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"flex items-center gap-2 text-[#0B00E4]",children:[e.jsx(it,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",size:18}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"text-sm font-semibold",children:"Article Review"})]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-1 text-xl font-semibold text-slate-950",children:"Improve the draft without leaving the editor"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-1 max-w-3xl text-sm leading-6 text-slate-600",children:"Review quality, supporting information and link choices alongside the existing private draft."})]}),e.jsx(Ns,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",status:C})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-5 grid gap-3 sm:grid-cols-3",children:[e.jsx(sa,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Looking good",value:r.filter(G=>G.state==="Good").length,note:"Checks already in good shape",tone:"emerald"}),e.jsx(sa,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Needs attention",value:i,note:"Improvement opportunities",tone:"amber"}),e.jsx(sa,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Verify before approval",value:x,note:"Source or fact checks still open",tone:x?"rose":"slate"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"grid items-start gap-6 xl:grid-cols-[minmax(0,1.6fr)_minmax(360px,.8fr)]",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"overflow-hidden rounded-2xl border border-slate-200 bg-white",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"border-b border-slate-200 px-5 py-4 sm:px-6",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"text-sm font-semibold text-slate-950",children:"Article Editor"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-1 text-sm text-slate-500",children:[k.toLocaleStr
1ing()," words · ",E.toLocaleString()," word guidance · ",ys[C]]})]}),$?e.jsx(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",size:"sm",disabled:j,onClick:W,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:j?e.jsxs(e.Fragment,{children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"animate-spin",size:15})," Savingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx($e,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",size:15})," Save draft"]})}):e.jsx(se,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"border border-slate-200 bg-slate-50 text-slate-600",children:"Editing locked"})]})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"space-y-5 p-5 sm:p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Article title",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,value:a.title,onChange:G=>m("title",G.target.value)})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Slug",detail:"Validated against the public Blog only when the existing Phase 1 publication panel is opened.",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!0,value:zn(a.title)})})]}),e.jsx(js,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",value:a.contentHtml,onChange:G=>m("contentHtml",G),disabled:!$}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"grid gap-4 lg:grid-cols-2",children:[e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Excerpt",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,rows:4,value:a.excerpt,onChange:G=>m("excerpt",G.target.value)})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Cover image URL",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,value:a.coverImageUrl,onChange:G=>m("coverImageUrl",G.target.value),placeholder:"Optional approved image URL"})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"SEO title",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,value:a.seoT
1itle,onChange:G=>m("seoTitle",G.target.value)})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Meta description",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,rows:3,value:a.metaDescription,onChange:G=>m("metaDescription",G.target.value)})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Primary keyword",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,value:a.primaryKeyword,onChange:G=>m("primaryKeyword",G.target.value)})}),e.jsx(ke,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",label:"Supporting keywords",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",disabled:!$,value:a.secondaryKeywords,onChange:G=>m("secondaryKeywords",G.target.value)})})]})]})]}),e.jsxs("aside",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"space-y-4 xl:sticky xl:top-6 xl:self-start",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"rounded-2xl border border-[#0B00E4]/20 bg-[#F7F8FF] p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"text-sm font-semibold text-slate-950",children:"Review guidance"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-1 text-sm leading-5 text-slate-600",children:"Choose one area to review while the editor stays available."})]}),e.jsx(ft,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"text-[#0B00E4]",size:20})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-4 grid gap-2 sm:grid-cols-2 xl:grid-cols-1",children:S.map(G=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",type:"button",onClick:()=>l(G.id),className:`flex items-center justify-between rounded-lg border px-3 py-2.5 text-left text-sm font-semibold transition-colors ${n===G.id?"border-[#0B00E4] bg-[#0B00E4] text-white":"border-slate-200 bg-white text-slate-700 hover:border-[#0B00E4]/40"}`,children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",children:G.label}),typeof G.count=="number"&&G.count>0&&e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:`rounded-full px-2 py-0.5 text-xs ${n===G.id?"bg-white/20":"bg-amber-100 text-amber-900"}`,children:G.count})]},G.id))})]}),n==="quality"&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"flex items-start gap-3",children:[e.jsx(rs,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-0.5 text-[#0B00E4]",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"text-lg font-semibold text-slate-950",children:"SEO & Quality"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-1 text-sm leading-6 text-slate-600",children:"Clear editorial guidance, not a ranking prediction."})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",className:"mt-5 space-y-3",children:r.map(G=>e.jsx(Rn,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",...G},G.label))})]}),n==="sources"&&e.jsx($n,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",detail:s}),n==="links"&&e.jsx(On,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",guidance:f,loading:c,canEdit:$,onAddLink:P}),n==="approval"&&e.jsx(Qn,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:168",status:C,reviewNotes:N,setReviewNotes:g,onSubmit:U,onApprove:y,onRequestChanges:V,onReturnToDraft:p,item:t,onPublished:u})]})]})]})}function sa({label:t,value:s,note:a,tone:o}){const n=o==="emerald"?"border-emerald-200 bg-emerald-50":o==="amber"?"border-amber-200 bg-amber-50":o==="rose"?"border-rose-200 bg-rose-50":"border-slate-200 bg-slate-50";return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:171",className:`rounded-xl border p-4 ${n}`,children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:171",className:"text-sm font-semibold text-slate-900",children:t}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:171",className:"mt-2 text-2xl font-semibold text-slate-950",children:s}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:171",className:"mt-1 text-xs leading-5 text-slate-600",children:a})]})}function $n({detail:t}){const s=t?.sources??[],a=t?.programmeFacts??[];return e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",className:"flex items-start gap-3",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",className:"mt-0.5 text-emerald-700",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",className:"text-lg font-semibold text-slate-950",children:"Sources & Fact Check"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",className:"mt-1 text-sm leading-6 text-slate-600",children:"Existing Content Foundation evidence is shown here. Reviewers decide what is supported."})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",className:"mt-5 space-y-4",children:[e.jsx(Ga,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",label:"Sources",rows:s,value:o=>o.claimSummary||o.sourceTitle,status:o=>o.sourceStatus}),e.jsx(Ga,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:173",label:"Programme facts",rows:a,value:o=>o.proposedStatement,status:o=>o.reviewStatus})]})]})}function Ga({label:t,rows:s,value:a,status:o}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",className:"rounded-xl border border-slate-200 bg-slate-50 p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",className:"text-sm font-semibold text-slate-900",children:t}),s.length?e.jsx("ul",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",className:"mt-3 space-y-2",children:s.map(n=>e.jsxs("li",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",className:"rounded-lg border border-slate-200 bg-white p-3 text-sm text-slate-700",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",children:a(n)}),e.jsx(se,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",className:`mt-2 border ${o(n)==="verified"?"border-emerald-200 bg-emerald-50 text-emerald-800":"border-amber-200 bg-amber-50 text-amber-800"}`,children:ga(o(n))})]},n.id))}):e.jsxs("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:174",className:"mt-2 text-sm leading-6 text-slate-600",children:["No ",t.toLowerCase()," have been attached to this private draft yet."]})]})}function On({guidance:t,loading:s,canEdit:a,onAddLink:o}){return e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"space-y-4",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"flex items-start gap-3",children:[e.jsx(Je,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-0.5 text-[#0B00E4]",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"text-lg font-semibold text-slate-950",children:"Internal Link Suggestions"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-1 text-sm leading-6 text-slate-600",children:"Computed from published Aventis Blog and programme records. Links are never inserted automatically."})]})]}),s?e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-5 text-sm text-slate-500",children:"Calculating suggestionsâ¦"}):t?.links?.length?e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-5 space-y-3",children:t.links.map(n=>e.jsxs("article",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"rounded-xl border border-slate-200 p-4",children:[e.jsx(se,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"border border-slate-200 bg-slate-50 text-slate-600",children:ga(n.type)}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-2 font-semibold text-slate-900",children:n.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-1 text-sm text-slate-600",children:n.rationale}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",size:"sm",className:"mt-3",variant:"outline",disabled:!a,onClick:()=>o(n.url,n.title),children:[e.jsx(Je,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",size:15})," Add link"]})]},`${n.type}-${n.url}`))}):e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-5 rounded-xl bg-slate-50 p-4 text-sm leading-6 text-slate-600",children:"No lexical link suggestions surfaced from the current reference set."})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"flex items-start gap-3",children:[e.jsx(rs,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-0.5 text-amber-700",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"text-lg font-semibold text-slate-950",children:"Similar Content"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-1 text-sm leading-6 text-slate-600",children:"Basic lexical comparison only. It is not a high-confidence duplicate-content detector."})]})]}),s?e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-5 text-sm text-slate-500",children:"Comparing internal titles and termsâ¦"}):t?.similarContent?.length?e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-5 space-y-3",children:t.similarContent.map(n=>e.jsxs("article",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"rounded-xl border border-amber-200 bg-amber-50/40 p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"font-semibold text-slate-900",children:n.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-1 text-sm text-slate-600",children:n.rationale}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-2 text-xs font-medium uppercase tracking-wide text-amber-800",children:ga(n.status)})]},`${n.title}-${n.status}`))}):e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:176",className:"mt-5 rounded-xl bg-slate-50 p-4 text-sm leading-6 text-slate-600",children:"No lexical overlap surfaced from the current internal reference set."})]})]})}function Qn({status:t,reviewNotes:s,setReviewNotes:a,onSubmit:o,onApprove:n,onRequestChanges:l,onReturnToDraft:r,item:i,onPublished:x}){return e.jsxs("section",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"rounded-2xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"flex items-start gap-3",children:[e.jsx(it,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-0.5 text-[#0B00E4]",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"text-lg font-semibold text-slate-950",children:"Review & Approval"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-1 text-sm leading-6 text-slate-600",children:"Uses the existing Content Foundation a
1pproval workflow. Publishing remains a separate, explicit Phase 1 action."})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-5 grid gap-3",children:[e.jsx(oa,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",title:"Working Draft",active:t==="draft"||t==="changes_requested",complete:t==="in_review"||t==="approved"||t==="published",detail:"Edit and save the private article."}),e.jsx(oa,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",title:"In Review",active:t==="in_review",complete:t==="approved"||t==="published",detail:"Complete the human review decision."}),e.jsx(oa,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",title:"Approved",active:t==="approved",complete:t==="published",detail:"Continue to the existing Phase 1 publication panel when ready."})]}),t!=="published"&&e.jsxs(e.Fragment,{children:[e.jsx(re,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-5",rows:3,value:s,onChange:f=>a(f.target.value),placeholder:"Internal review note (optional)"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-3 flex flex-col gap-2",children:[(t==="draft"||t==="changes_requested")&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",variant:"outline",onClick:o,children:[e.jsx(Jt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",size:16})," Submit for review"]}),t==="in_review"&&e.jsxs(e.Fragment,{children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",onClick:n,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",size:16})," Approve internally"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",variant:"outline",onClick:l,children:[e.jsx(mt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",size:16})," Request changes"]})]}),t==="changes_requested"&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",variant:"outline",onClick:r,children:[e.jsx(et,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",size:16})," Return to working draft"]})]})]}),t==="approved"&&e.jsx("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-5 border-t border-slate-100 pt-5",children:e.jsx(Dn,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",contentItemId:i.id,status:t,onPublished:x})}),t!=="approved"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-5 flex gap-3 rounded-xl border border-slate-200 bg-slate-50 p-4 text-sm leading-6 text-slate-600",children:[e.jsx(jt,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:178",className:"mt-0.5 shrink-0",size:18}),"Publishing is unavailable until a staff reviewer approves the article. The existing Phase 1 publication panel remains the only publishing mechanism."]})]})}function oa({title:t,active:s,complete:a,detail:o}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",className:`rounded-xl border p-4 ${s?"border-[#0B00E4]/30 bg-[#F7F8FF]":a?"border-emerald-200 bg-emerald-50":"border-slate-200 bg-white"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",className:"flex items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",className:`inline-flex h-6 w-6 items-center justify-center rounded-full ${s?"bg-[#0B00E4] text-white":a?"bg-emerald-600 text-white":"bg-slate-100 text-slate-500"}`,children:a?e.jsx(fe,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",size:15}):s?e.jsx(ns,{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",size:15}):""}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",className:"font-semibold text-slate-900",children:t})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BlogAiGeneratorV2.tsx:179",className:"mt-3 text-sm leading-5 text-slate-600",children:o})]})}const na={title:"",proposedSlug:"",sourceMode:"manual",articleType:"",category:"",targetAudience:"",primaryGoal:"",tone:"",targetWordCount:"",searchIntent:"",funnelStage:"",clusterLabel:"",editorialPriority:"normal",priorityReason:"",editorialOwner:"",reviewDueAt:"",programmeId:"",programmeTitleSnapshot:"",excerpt:"",content:"",authorName:"",coverImageUrl:"",coverImageAlt:"",imageRightsStatus:"not_reviewed",internalLinkPlan:"",seoTitle:"",metaDescription:"",primaryKeyword:"",secondaryKeywords:"",internalReviewNotes:""},za={title:"",rationale:"",status:"open",programmeId:"",programmeTitleSnapshot:"",targetAudience:"",editorialPriority:"normal",sourceContext:""},ks=d.createContext(null),va={draft:"Draft",in_review:"In review",changes_requested:"Changes requested",approved:"Approved internally",published:"Published",archived:"Archived"},Hn={draft:"bg-amber-50 text-amber-700 border-amber-200",in_review:"bg-blue-50 text-blue-700 border-blue-200",changes_requested:"bg-rose-50 text-rose-700 border-rose-200",approved:"bg-emerald-50 text-emerald-700 border-emerald-200",published:"bg-[#F7F8FF] text-[#0B00E4] border-[#0B00E4]/20",archived:"bg-slate-100 text-slate-600 border-slate-200"},we=t=>t?t.replaceAll("_"," ").replace(/\b\w/g,s=>s.toUpperCase()):"Not set",Ra=t=>t?new Date(t).toISOString().slice(0,10):"",Kn=t=>t.toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-").slice(0,280),Yn=t=>t.trim()?t.trim().split(/\s+/).length:0;function Jn({initialArea:t}){const s=v.useUtils(),[a,o]=d.useState("article"),[n,l]=d.useState(!1),[r,i]=d.use
1State(null),[x,f]=d.useState("all"),[c,k]=d.useState(""),[E,N]=d.useState("all"),[g,C]=d.useState("all"),[b,W]=d.useState("all"),[j,P]=d.useState(na),[U,y]=d.useState("draft"),[V,p]=d.useState({claimSummary:"",sourceTitle:"",sourceUrl:"",publisher:"",freshnessNote:""}),[u,S]=d.useState({factType:"programme_name",proposedStatement:""}),[m,$]=d.useState({relatedId:"",relationshipType:"related",rationale:""}),[G,B]=d.useState(za),[K,ne]=d.useState(""),[_,O]=d.useState(""),[q,ge]=d.useState("all"),[pe,ce]=d.useState("brief"),[he,I]=d.useState(null),[w,H]=d.useState(!1),{data:L}=v.contentFoundation.summary.useQuery(),{data:X=[]}=v.contentFoundation.list.useQuery(),{data:Ee=[]}=v.contentFoundation.attentionQueue.useQuery(),{data:Se}=v.contentFoundation.strategy.useQuery(),{data:He=[]}=v.contentFoundation.programmeOptions.useQuery(),{data:st=[]}=v.contentFoundation.opportunities.useQuery(),{data:Ke}=v.contentFoundation.aiPilotStatus.useQuery(),J=v.contentFoundation.get.useQuery({id:r},{enabled:r!==null}).data;d.useEffect(()=>{t&&(o(t),i(null))},[t]);const be=async()=>{await Promise.all([s.contentFoundation.summary.invalidate(),s.contentFoundation.list.invalidate(),s.contentFoundation.attentionQueue.invalidate(),s.contentFoundation.strategy.invalidate(),s.contentFoundation.opportunities.invalidate(),r?s.contentFoundation.get.invalidate({id:r}):Promise.resolve()])},ot=v.contentFoundation.create.useMutation({onSuccess:async h=>{i(h.id),o("create"),await be(),M.success("Private internal draft created")},onError:h=>M.error(h.message)}),F=v.contentFoundation.update.useMutation({onSuccess:async()=>{ne(""),await be(),M.success("New internal version saved")},onError:h=>M.error(h.message)}),de=v.contentFoundation.addSource.useMutation({onSuccess:async()=>{p({claimSummary:"",sourceTitle:"",sourceUrl:"",publisher:"",freshnessNote:""}),await be(),M.success("Source added for human review")},onError:h=>M.error(h.message)}),je=v.contentFoundation.addProgrammeFact.useMutation({onSuccess:async()=>{S({factType:"programme_name",proposedStatement:""}),await be(),M.success("Programme statement added for review")},onError:h=>M.error(h.message)}),Me=v.contentFoundation.reviewSource.useMutation({onSuccess:be,onError:h=>M.error(h.message)}),ye=v.contentFoundation.reviewProgrammeFact.useMutation({onSuccess:be,onError:h=>M.error(h.message)}),nt=v.contentFoundation.saveQualityReview.useMutation({onSuccess:be,onError:h=>M.error(h.message)}),me=v.contentFoundation.saveRelationship.useMutation({onSuccess:async()=>{$({relatedId:"",relationshipType:"related",rationale:""}),await be(),M.success("Private draft relationship saved")},onError:h=>M.error(h.message)});v.contentFoundation.createOpportunity.useMutation({onSuccess:async()=>{B(za),await be(),M.success("Manual opportunity saved privately")},onError:h=>M.error(h.message)}),v.contentFoundation.updateOpportunity.useMutation({onSuccess:be,onError:h=>M.error(h.message)});const rt=v.contentFoundation.submitForReview.useMutation({onSuccess:async()=>{await be(),M.success("Draft submitted for human review")},onError:h=>M.error(h.message)}),z=v.contentFoundation.review.useMutation({onSuccess:async()=>{await be(),M.success("Internal review decision recorded")},onError:h=>M.error(h.message)}),Bs=v.contentFoundation.returnToDraft.useMutation({onSuccess:be,onError:h=>M.error(h.message)}),Ca=v.contentFoundation.archiveControlledTest.useMutation({onSuccess:async()=>{i(null),await be(),M.success("Controlled test item archived; its private audit history is retained.")},onError:h=>M.error(h.message)}),wa=v.contentFoundation.requestAi.useMutation({onSuccess:h=>{h?.type==="suggestion"&&typeof h.text=="string"?(I({task:pe,text:h.text,reviewRequired:!0}),M.success("Private suggestion ready for Marketing review")):(M.success("Private AI-generated version saved for Marketing review"),be())},onError:h=>M.error(h.message)}),As={contentItemId:r,task:pe,contextConfirmed:w,setContextConfirmed:H,result:he,requestPending:wa.isPending,request:h=>{if(r===null)return M.error("Save this private draft before requesting an AI suggestion.");wa.mutate({contentItemId:r,task:h,contextConfirmed:!0})},discard:()=>{I(null),M.message("Private AI suggestion discarded from this browser session")},useAsWorkingCopy:()=>{he&&(P(h=>({...h,content:he.text})),I(null),M.success("Suggestion placed in the local working copy. Save a new internal version only after Marketing review."))}};d.useEffect(()=>{if(!J?.item)return;const h=J.item;P({title:h.title??"",proposedSlug:h.proposedSlug??"",sourceMode:h.sourceMode??"manual",articleType:h.articleType??"",category:h.category??"",targetAudience:h.targetAudience??"",primaryGoal:h.primaryGoal??"",tone:h.tone??"",targetWordCount:h.targetWordCount?.toString()??"",searchIntent:h.searchIntent??"",funnelStage:h.funnelStage??"",clusterLabel:h.clusterLabel??"",editorialPriority:h.editorialPriority??"normal",priorityReason:h.priorityReason??"",editorialOwner:h.editorialOwner??"",reviewDueAt:Ra(h.reviewDueAt),programmeId:h.programmeId?.toString()??"",programmeTitleSnapshot:h.programmeTitleSnapshot??"",excerpt:h.excerpt??"",content:h.content??"",authorName:h.authorName??"",coverImageUrl:h.coverImageUrl??"",coverImageAlt:h.c
1overImageAlt??"",imageRightsStatus:h.imageRightsStatus??"not_reviewed",internalLinkPlan:h.internalLinkPlan??"",seoTitle:h.seoTitle??"",metaDescription:h.metaDescription??"",primaryKeyword:h.primaryKeyword??"",secondaryKeywords:Array.isArray(h.secondaryKeywords)?h.secondaryKeywords.join(", "):"",internalReviewNotes:h.internalReviewNotes??""}),O(h.internalReviewNotes??"")},[J?.item]);const ae=(h,Z)=>P(Q=>{const De={...Q,[h]:Z};return h==="title"&&!Q.proposedSlug&&(De.proposedSlug=Kn(Z)),h==="programmeId"&&(De.programmeTitleSnapshot=He.find(D=>String(D.id)===Z)?.title??""),De}),Pa=()=>({...j,proposedSlug:j.proposedSlug||null,articleType:j.articleType||null,category:j.category||null,targetAudience:j.targetAudience||null,primaryGoal:j.primaryGoal||null,tone:j.tone||null,targetWordCount:j.targetWordCount?Number(j.targetWordCount):null,searchIntent:j.searchIntent||null,funnelStage:j.funnelStage||null,clusterLabel:j.clusterLabel||null,priorityReason:j.priorityReason||null,editorialOwner:j.editorialOwner||null,reviewDueAt:j.reviewDueAt?new Date(`${j.reviewDueAt}T00:00:00`):null,programmeId:j.programmeId?Number(j.programmeId):null,programmeTitleSnapshot:j.programmeTitleSnapshot||null,excerpt:j.excerpt||null,authorName:j.authorName||null,coverImageUrl:j.coverImageUrl||null,coverImageAlt:j.coverImageAlt||null,internalLinkPlan:j.internalLinkPlan||null,seoTitle:j.seoTitle||null,metaDescription:j.metaDescription||null,primaryKeyword:j.primaryKeyword||null,secondaryKeywords:j.secondaryKeywords.split(",").map(h=>h.trim()).filter(Boolean),internalReviewNotes:j.internalReviewNotes||null}),Xt=()=>{i(null),P(na),ne(""),y("draft"),o("create")},ea=(h,Z="create")=>{i(h),y("draft"),o(Z)},Le=X,Ws=d.useMemo(()=>An(Le),[Le]),Ms=h=>{i(null),P({...na,articleType:h.articleType,category:"Blog & AI Generator",primaryGoal:h.primaryGoal,tone:h.tone,targetWordCount:h.targetWordCount,searchIntent:h.searchIntent,funnelStage:h.funnelStage,clusterLabel:h.clusterLabel,content:`Private guided brief only. 2 3${h.prompt} 4 5Verified-fact boundary: attach and review current Aventis source evidence and programme facts before requesting any private AI suggestion.`,internalReviewNotes:"Private guided brief template. No public publishing, CTA change, Google, CRM, advertising, web/news, notification or automatic action is authorised."}),ce("outline"),ne(""),y("draft"),o("create"),M.success(`${h.label} template loaded into a private draft.`)},Ea=d.useMemo(()=>{const h=J?.item;if(!h)return[];const Z=h.title.trim().toLowerCase(),Q=h.proposedSlug?.trim().toLowerCase(),De=h.primaryKeyword?.trim().toLowerCase();return Le.filter(D=>D.id!==h.id&&(Z&&D.title.trim().toLowerCase()===Z||Q&&D.proposedSlug?.trim().toLowerCase()===Q||De&&D.primaryKeyword?.trim().toLowerCase()===De)).map(D=>D.title)},[Le,J?.item]),Is=d.useMemo(()=>[{label:"Brief",detail:"Purpose and audience",complete:!!(j.title.trim()&&j.articleType.trim()&&j.targetAudience.trim()&&j.primaryGoal.trim())},{label:"Strategy",detail:"Intent and priority",complete:!!(j.searchIntent&&j.funnelStage&&j.clusterLabel.trim()&&j.editorialOwner.trim())},{label:"Draft",detail:"Staff-authored content",complete:!!j.content.trim()},{label:"Review",detail:"Evidence and facts",complete:!r||J?.item?.sourceReviewStatus==="verified"&&J?.item?.programmeFactReviewStatus==="verified"}],[J?.item?.programmeFactReviewStatus,J?.item?.sourceReviewStatus,j.articleType,j.clusterLabel,j.content,j.editorialOwner,j.funnelStage,j.primaryGoal,j.searchIntent,j.targetAudience,j.title,r]),Ds=d.useMemo(()=>(J?.qualityChecks??[]).filter(h=>q==="all"||(q==="complete"?h.state==="complete":h.state!=="complete")),[J?.qualityChecks,q]),ta=d.useMemo(()=>Le.filter(h=>{const Z=!c.trim()||`${h.title} ${h.programmeTitleSnapshot??""} ${h.articleType??""} ${h.editorialOwner??""} ${h.clusterLabel??""}`.toLowerCase().includes(c.toLowerCase()),Q=x==="all"||h.status===x,De=E==="all"||h.programmeTitleSnapshot===E,D=g==="all"||h.editorialPriority===g,_s=h.reviewDueAt?new Date(h.reviewDueAt).getTime()<Date.now()?"overdue":new Date(h.reviewDueAt).getTime()-Date.now()<=14*864e5?"due_soon":"scheduled":"not_set",qs=b==="all"||b==="needs_evidence"&&h.sourceReviewStatus!=="verified"||b==="needs_facts"&&h.programmeFactReviewStatus!=="verified"||b===_s;return Z&&Q&&De&&D&&qs}),[Le,c,x,E,g,b]),At=()=>e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:230",className:"rounded-xl border border-[#0B00E4]/20 bg-[#EEF2FF] px-4 py-3 text-sm text-slate-700",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:230",className:"flex gap-2",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:230",className:"mt-0.5 shrink-0 text-[#0B00E4]",size:17}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:230",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:230",children:"Stage 1 internal foundation."})," Stage 2 adds private staff-entered planning fields only. The B3 AI assistant status is shown in Create and remains private, confirmation-led, and human-reviewed. Google Search Console, CRM, ads, external intelligence, public publishing, and automatic actions remain disabled. Notifications are also disabled."]})]})}),Ts=()=>e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:231",className:"rounded-xl border border-slate-200 bg-white p-2",children:e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:231",className:"flex flex-wrap gap-1",children:[{id:"article",label:"Create Article",icon:Oe},{id:"overview",label:"Editorial Workspace",icon:Po},{id:"create",label:"Manual Draft",icon:ft},{id:"optimise",label:"Optimise",icon:it},{id:"strategy",label:"Strategy",icon:Oe},{id:"manage",label:"Manage",icon:Nt}].map(({id:h,label:Z,icon:Q})=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:231",onClick:()=>{o(h),h==="create"&&r===null&&Xt()},className:`flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-semibold ${a===h?"bg-[#0B00E4] text-white":"text-slate-600 hover:bg-slate-50"}`,children:[e.jsx(Q,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:231",size:15}),Z]},h))})}),Us=()=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"text-2xl font-semibold text-slate-950",children:"B3 Internal Content Foundation"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"mt-1 text-sm text-slate-500",children:"Private content planning, evidence review and staff-managed editorial attention."})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",onClick:Xt,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",size:16})," New internal draft"]})]}),e.jsx(At,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[{label:"Total",value:L?.total??0,colour:"text-slate-950"},{label:"In review",value:L?.inReview??0,colour:"text-blue-700"},{label:"High priority",value:L?.highPriority??0,colour:"text-rose-700"},{label:"Due / overdue",value:(L?.dueSoon??0)+(L?.overdue??0),colour:"text-amber-700"}].map(h=>e.jsx(sr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",...h},h.label))}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"font-semibold text-slate-950",children:"Editorial attention queue"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"mt-1 text-sm text-slate-500",children:"Only real internal
5conditions are shown: evidence, programme-fact review, staff priority and review dates."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"border border-slate-200 bg-slate-50 text-slate-600",children:"Internal signals only"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"mt-4 space-y-2",children:Ee.length===0?e.jsx(xt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",text:"No internal attention items yet. Create a private draft to begin."}):Ee.map(h=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",onClick:()=>ea(h.id,"optimise"),className:"flex w-full flex-col justify-between gap-2 rounded-lg border border-slate-200 p-3 text-left hover:bg-slate-50 sm:flex-row sm:items-center",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"font-medium text-slate-900",children:h.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"mt-1 text-xs text-slate-500",children:h.reasons.join(" · ")})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"flex gap-2",children:[e.jsx(da,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",priority:h.editorialPriority}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233",className:"border border-slate-200 bg-white text-slate-600",children:we(h.dueState)})]})]},h.id))})]}),e.jsx(cr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:233"})]}),Vs=()=>{const h=J?.item,Z=r===null,Q=h?.status==="approved",De=()=>{if(!j.title.trim()||!j.content.trim())return M.error("A title and draft content are required.");Z?ot.mutate(Pa()):F.mutate({id:r,data:Pa(),changeSummary:K||null})};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"flex gap-3",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",variant:"ghost",size:"sm",onClick:()=>{i(null),o("manage")},children:[e.jsx(et,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",size:16})," Back"]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"text-xl font-semibold text-slate-950",children:Z?"New internal draft":h?.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"mt-1 text-sm text-slate-500",children:Z?"Private manual brief creation":`Internal status: ${va[h.status]}`})]})]}),!Z&&e.jsx(qa,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",status:h.status})]}),e.jsx(At,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236"}),(Z||U==="draft")&&e.jsx(tr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",steps:Is}),(Z||U==="draft")&&e.jsx(ar,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",task:pe,setTask:ce,form:j,status:Ke,canUseExistingDraft:!Z&&!!h}),!Z&&e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"flex flex-wrap gap-1 border-b border-slate-200",children:["draft","sources","facts","review"].map(D=>e.jsx("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",onClick:()=>y(D),className:`border-b-2 px-3 py-2 text-sm font-medium ${U===D?"border-[#0B00E4] text-[#0B00E4]":"border-transparent text-slate-500 hover:text-slate-700"}`,children:D==="draft"?"Brief & strategy":D==="sources"?`Sources (${J?.sources?.length??0})`:D==="facts"?`Programme facts (${J?.programmeFacts?.length??0})`:"Quality & review"},D))}),(Z||U==="draft")&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"space-y-5 rounded-xl border border-slate-200 bg-white p-5",children:[e.jsxs(ra,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",t
5itle:"Brief essentials",children:[e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Working title *",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.title,onChange:D=>ae("title",D.target.value)})}),e.jsxs(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Proposed future URL slug",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.proposedSlug,onChange:D=>ae("proposedSlug",D.target.value)}),e.jsx(ct,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:"Private planning only; this creates no public URL."})]})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",columns:"3",children:[e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Source mode",value:j.sourceMode,disabled:Q,onChange:D=>ae("sourceMode",D),options:["manual","recommended_brief","legacy_reference"]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Article type",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.articleType,onChange:D=>ae("articleType",D.target.value),placeholder:"e.g. Career Guide"})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Category",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.category,onChange:D=>ae("category",D.target.value),placeholder:"e.g. Career advice"})})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Linked Aventis programme",children:e.jsx(er,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",programmes:He,value:j.programmeId,disabled:Q,onChange:D=>ae("programmeId",D)})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Target audience",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.targetAudience,onChange:D=>ae("targetAudience",D.target.value),placeholder:"e.g. Mid-career professionals"})})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",columns:"3",children:[e.jsx(Xn,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Primary goal",value:j.primaryGoal,disabled:Q,onChange:D=>ae("primaryGoal",D)}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Tone",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.tone,onChange:D=>ae("tone",D.target.value),placeholder:"e.g. Educational"})}),e.jsxs(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Target word count",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,type:"number",min:"100",value:j.targetWordCount,onChange:D=>ae("targetWordCount",D.target.value)}),e.jsxs(ct,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[Yn(j.content)," current words â guidance only."]})]})]})]}),e.jsxs(ra,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",title:"Private strategy fields",children:[e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",columns:"3",children:[e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Search intent",value:j.searchIntent,disabled:Q,onChange:D=>ae("searchIntent",D),emptyLabel:"Select intent",options:["informational","comparison","commercial_investigation","decision"]}),e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Funnel stage",value:j.funnelStage,disabled:Q,onChange:D=>ae("funnelStage",D),emptyLabel:"Select stage",options:["awareness","consideration","decision"]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Topic cluster",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.clusterLabel,onChange:D=>ae("clusterLabel",D.target.value),placeholder:"e.g. Executive MBA decision journey"})})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",columns:"3",children:[e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Editorial priority",value:j.editorialPriority,disabled:Q,onChange:D=>ae("editorialPriority",D),options:["low","normal","high"]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Internal owner",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.editorialOwner,onChange:D=>ae("editorialOwner",D.target.value),placeholder:"Name or team"})}),e.jsxs(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Internal review date",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,type:"date",value:j.reviewDueAt,onChange:D=>ae("reviewDueAt",D.target.value)}),e.jsx(ct,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:"Visible internally only; no automated reminder is sent."})]})]}),j.editorialPriority==="high"&&e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Reason for High priority *",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.priorityReason,onChange:D=>ae("priorityReason",D.target.value),rows:2,placeholder:"Record why Marketing needs to prioritise this item."})})]}),e.jsxs(ra,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",t
5itle:"Draft, metadata and accessibility planning",children:[e.jsxs(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Draft content *",children:[e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.content,onChange:D=>ae("content",D.target.value),rows:14,placeholder:"Write or paste an internal article draft. This is not public."}),e.jsx(ct,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:"The staged assistant will not send, generate, or rewrite text until its separate activation gate is approved."})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Excerpt",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.excerpt,onChange:D=>ae("excerpt",D.target.value),rows:3})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Internal author",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.authorName,onChange:D=>ae("authorName",D.target.value),placeholder:"Name or internal team"})})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[e.jsxs(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"SEO title",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.seoTitle,onChange:D=>ae("seoTitle",D.target.value)}),e.jsxs(ct,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[j.seoTitle.length,"/200 characters â guidance only."]})]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Primary keyword",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.primaryKeyword,onChange:D=>ae("primaryKeyword",D.target.value)})})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[e.jsxs(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Meta description",children:[e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.metaDescription,onChange:D=>ae("metaDescription",D.target.value),rows:3}),e.jsxs(ct,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",children:[j.metaDescription.length,"/500 characters â guidance only."]})]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Secondary keywords",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.secondaryKeywords,onChange:D=>ae("secondaryKeywords",D.target.value),rows:3,placeholder:"Separate with commas"})})]}),e.jsxs(Te,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",columns:"3",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Cover image URL",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.coverImageUrl,onChange:D=>ae("coverImageUrl",D.target.value),placeholder:"Optional approved image URL"})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Image alt text",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.coverImageAlt,onChange:D=>ae("coverImageAlt",D.target.value)})}),e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Image-use review",value:j.imageRightsStatus,disabled:Q,onChange:D=>ae("imageRightsStatus",D),options:["not_reviewed","confirmed","not_applicable"]})]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Private internal-link plan",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.internalLinkPlan,onChange:D=>ae("internalLinkPlan",D.target.value),rows:2,placeholder:"Record a future approved Aventis destination or related draft. This cannot add a public link."})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Internal review notes",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q,value:j.internalReviewNotes,onChange:D=>ae("internalReviewNotes",D.target.value),rows:3,placeholder:"Private context for reviewers"})}),!Z&&!Q&&e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",label:"Version change summary",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",value:K,onChange:D=>ne(D.target.value),placeholder:"What changed in this version?"})}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",className:"flex justify-end",children:e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",disabled:Q||ot.isPending||F.isPending,onClick:De,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:Z?"Create internal draft":"Save new internal version"})})]})]}),!Z&&U==="sources"&&e.jsx(lr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",detail
5:J,form:V,setForm:p,add:de,review:Me}),!Z&&U==="facts"&&e.jsx(ir,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",detail:J,form:u,setForm:S,add:je,review:ye}),!Z&&U==="review"&&e.jsx(mr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:236",detail:J,reviewNotes:_,setReviewNotes:O,submit:rt,decide:z,returnToDraft:Bs,qualityReview:nt})]})},Gs=()=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"text-xl font-semibold text-slate-950",children:"Optimise"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-1 text-sm text-slate-500",children:"Transparent internal guidance based only on the selected private draft and verified B3 records."})]}),e.jsx(At,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238"}),e.jsx(nr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",items:Le,selectedId:r,onSelect:i}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"rounded-xl border border-slate-200 bg-white p-5",children:J?.item?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"font-semibold text-slate-950",children:J.item.title}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-1 text-sm text-slate-500",children:"These are transparent internal checks, not a Google score and not publishing controls."})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",variant:"outline",size:"sm",onClick:()=>ea(J.item.id,"create"),children:"Edit draft"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"text-sm font-semibold text-slate-900",children:"Quality review lens"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"text-xs text-slate-500",children:"Review grouped checks without a single score or automatic recommendation."})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"flex flex-wrap gap-2",children:["all","needs_review","complete"].map(h=>e.jsx(ca,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",selected:q===h,onClick:()=>ge(h),children:h==="all"?`All (${J.qualityChecks?.length??0})`:h==="needs_review"?`Needs review (${J.qualityChecks?.filter(Z=>Z.state!=="complete").length??0})`:`Complete (${J.qualityChecks?.filter(Z=>Z.state==="complete").length??0})`},h))})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-4 grid gap-3 lg:grid-cols-2",children:Ds.map(h=>e.jsx(rr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",check:h,onAcknowledge:()=>nt.mutate({contentItemId:J.item.id,checkKey:h.key,decision:"acknowledged",note:null}),pending:nt.isPending},h.key))}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-4 rounded-xl border border-slate-200 bg-slate-50 p-4",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"font-semibold text-slate-900",children:"Duplicate-topic review"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-1 text-sm text-slate-600",children:"This is an exact private-catalogue comparison of title, future slug, and primary keyword. A person decides whether topics conflict."}),Ea.length?e.jsx("ul",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-3 list-disc pl-5 text-sm text-amber-800",children:Ea.map(h=>e.jsx("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",children:h},h))}):e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-3 text-sm text-emerald-700",children:"No exact private title, slug, or primary-keyword match was found."})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-4 rounded-xl border border-slate-200 bg-slate-50 p-4",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"font-semibold text-slate-900",children:"Private CTA guidance"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",className:"mt-1 text-sm text-slate-600",children:[pr(J.item.primaryGoal)," This guid
5ance does not add or modify a public CTA, link, button, or form."]})]})]}):e.jsx(xt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:238",text:"Select an internal draft to review its advisory checks."})})]}),zs=()=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:240",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:241",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:242",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:242",className:"text-xl font-semibold text-slate-950",children:"Strategy"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:242",className:"mt-1 text-sm text-slate-500",children:"Staff-managed clusters, programme coverage and private draft relationships."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:243",className:"border border-slate-200 bg-slate-50 text-slate-600",children:"No trend, Google, CRM or ad data"})]}),e.jsx(At,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:245"}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:246",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:247",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:247",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:247",className:"font-semibold text-slate-950",children:"Internal planning pulse"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:247",className:"mt-1 text-sm text-slate-500",children:"A compact view of staff-created private drafts, not market demand or lead performance."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:247",className:"border border-slate-200 bg-slate-50 text-slate-600",children:"Private catalogue only"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:248",className:"mt-4 grid gap-3 sm:grid-cols-3",children:[e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:248",label:"Private drafts",value:Le.length}),e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:248",label:"Topic clusters",value:Se?.clusters?.length??0}),e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:248",label:"Programmes covered",value:Se?.programmes?.length??0})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:249",className:"mt-4 text-sm text-slate-600",children:"Create a private draft directly when Marketing has a new article, event, or awareness idea. The optional opportunity register has been removed from this workspace."})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"font-semibold text-slate-950",children:"Programme content overview"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"mt-1 text-sm text-slate-500",children:"Coverage is calculated only from private B3 drafts linked to an Aventis programme."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"mt-4 grid gap-3 lg:grid-cols-2",children:Se?.programmes?.length?Se.programmes.map(h=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"rounded-xl border border-slate-200 p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"font-medium text-slate-900",children:h.label}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"mt-1 text-xs text-slate-500",children:[h.total," private draft",h.total===1?"":"s"," · ",h.draft," draft · ",h.inReview," in review"]})]}),e.jsxs(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"border border-slate-200 bg-slate-50 text-slate-600",children:[h.approved," internal approval"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"mt-3 grid grid-cols-3 gap-2 text-center text-xs",children:[e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",label:"Awareness",value:h.awareness}),e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",label:"Consideration",value:h.consideration}),e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",label:"Decision",value:h.decision})]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",className:"mt-3 text-xs text-slate-500",children:["Planning gaps: ",h.missingFunnelStages.length?h.missingFunnelStages.map(we).join(", "):"None recorded",". This is not a market or search opportunity."]})]},h.label)):e.jsx(xt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:251",text:"No linked private drafts yet. Programme coverage will appear only after staff create and link drafts."})})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"font-semibold text-slate-950",children:"Topic clusters and pillars"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"mt-4 grid gap-3",children:Se?.clusters?.length?Se.clusters.map(h=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"rounded-xl border border-slate-200 p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"flex justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"font-medium text-slate-900",children:h.label}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"mt-1 text-xs text-slate-500",children:[h.total," private item",h.total===1?"":"s"]})]}),h.highPriority>0&&e.jsx(da,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",priority:"high"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",className:"mt-3 grid grid-cols-3 gap-2 text-center text-xs",children:[e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",label:"Awareness",value:h.awareness}),e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",label:"Consideration",value:h.consideration}),e.jsx(Ge,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",label:"Decision",value:h.decision})]})]},h.label)):e.jsx(xt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",text:"No cluster data yet. Set a topic cluster on a private draft."})})]}),e.jsx(dr,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:252",items:Le,selectedId:r,setSelectedId:i,relationship:m,setRelationship:$,saveRelationship:me,detail
5:J})]})]}),Rs=()=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"text-xl font-semibold text-slate-950",children:"Manage"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"mt-1 text-sm text-slate-500",children:"Private catalogue of internal briefs, review evidence, versions and editorial attention."})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",onClick:Xt,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",size:16})," New internal draft"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-200 bg-slate-50 p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"font-semibold text-slate-900",children:"Private catalogue view"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"mt-1 text-sm text-slate-500",children:["Showing ",ta.length," of ",Le.length," internal item",Le.length===1?"":"s",". No external performance or publishing data is shown here."]})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",variant:"outline",size:"sm",onClick:()=>{k(""),f("all"),N("all"),C("all"),W("all")},children:"Clear filters"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"grid gap-2 rounded-xl border border-slate-200 bg-white p-4 lg:grid-cols-4",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",value:c,onChange:h=>k(h.target.value),placeholder:"Search title, programme, type, owner or clusterâ¦",className:"lg:col-span-2"}),e.jsx(_a,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",value:E,onChange:N,options:["all",...Array.from(new Set(Le.flatMap(h=>h.programmeTitleSnapshot?[h.programmeTitleSnapshot]:[])))],labels:{all:"All programmes"}}),e.jsx(_a,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",value:g,onChange:C,options:["all","low","normal","high"],labels:{all:"All priorities"}})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"flex flex-wrap gap-2",children:[["all","draft","in_review","changes_requested","approved"].map(h=>e.jsx(ca,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",selected:x===h,onClick:()=>f(h),children:h==="all"?"All":va[h]},h)),["needs_evidence","needs_facts","due_soon","overdue"].map(h=>e.jsx(ca,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",selected:b===h,onClick:()=>W(b===h?"all":h),children:we(h)},h))]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"overflow-hidden rounded-xl border border-slate-200 bg-white",children:ta.length===0?e.jsx(xt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",text:"No private content items match the current filters."}):ta.map(h=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"flex flex-col gap-3 border-b border-slate-100 p-4 last:border-b-0 lg:flex-row lg:items-center",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",onClick:()=>ea(h.id),className:"min-w-0 flex-1 text-left hover:text-[#0B00E4]",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"font-semibold text-slate-900",children:h.title}),e.jsx(qa,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",status:h.status})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-slate-500",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:h.programmeTitleSnapshot??"Programme not linked"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:h.articleType??"Type not set"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:we(h.funnelStage)}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:h.editorialOwner??"Owner not set"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",children:h.sourceReviewStatus==="verified"?"Evidence verified":"Evidence needs review"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"flex flex-wrap items-center gap-2 text-xs",children:[e.jsx(da,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",priority:h.editorialPriority}),e.jsxs(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",className:"border border-slate-200 bg-white text-slate-600",children:["Review: ",h.reviewDueAt?Ra(h.reviewDueAt):"not set"]}),/^test\b/i.test(h.title)&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",size:"sm",variant:"outline",className:"text-slate-700",disabled:Ca.isPending,onClick:()=>{window.confirm("Archive this controlled test item? It will be removed from active B3 views, but its private audit history will be retained.")&&Ca.mutate({id:h.id})},children:[e.jsx(pt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:255",size:14})," Archive test"]})]})]}
5,h.id))})]});return n?e.jsx(ks.Provider,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",value:As,children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",className:"space-y-6",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",className:"flex justify-end",children:e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",size:"sm",variant:"ghost",onClick:()=>l(!1),children:"Return to Articles"})}),e.jsx(Ts,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258"}),a==="article"&&e.jsx(Wn,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",onOpenLegacy:()=>o("overview")}),a==="overview"&&e.jsxs(e.Fragment,{children:[e.jsx(or,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",metrics:Ws,onStartTemplate:Ms,onShowEvidence:()=>{W("needs_evidence"),o("manage")},onShowFacts:()=>{W("needs_facts"),o("manage")},onShowPipeline:()=>{f("draft"),o("manage")}}),e.jsx(Us,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258"})]}),a==="create"&&(r!==null&&!J?.item?e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258",className:"rounded-xl border border-slate-200 bg-white p-5 text-sm text-slate-600",children:"Loading private draftâ¦"}):Vs()),a==="optimise"&&e.jsx(Gs,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258"}),a==="strategy"&&e.jsx(zs,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258"}),a==="manage"&&e.jsx(Rs,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:258"})]})}):e.jsx(_n,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:257",onOpenLegacy:()=>{l(!0),o("overview")}})}function Zn(){const t=d.useContext(ks);if(!t)return null;const{data:s,isLoading:a}=v.contentFoundation.aiPilotStatus.useQuery(),o=a||!s,n=s?.staffRequestsEnabled!==!0,l={brief:"Recommended brief",outline:"Outline assistant",metadata:"Metadata alignment",refine:"Draft refinement",first_draft:"Generate private draft"},r=async()=>{if(t.result)try{await navigator.clipboard.writeText(t.result.text),M.success("Private suggestion copied for Marketing review")}catch{M.error("Copy is unavailable in this browser. Select the text manually instead.")}};return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-4 rounded-lg border border-slate-200 bg-white p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"text-sm font-semibold text-slate-900",children:"Private result review"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-1 text-xs text-slate-500",children:"Suggestions stay in this browser session until Marketing explicitly copies or uses one as a local working copy."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:`border ${o?"border-slate-200 bg-slate-50 text-slate-600":n?"border-amber-200 bg-amber-50 text-amber-700":"border-emerald-200 bg-emerald-50 text-emerald-700"}`,children:o?"Checking pilot statusâ¦":n?"Model requests disabled":"Private request available"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-4 flex items-start gap-2 rounded-md bg-slate-50 p-3 text-sm text-slate-700",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",type:"checkbox",checked:t.contextConfirmed,onChange:i=>t.setContextConfirmed(i.target.checked),className:"mt-0.5 h-4 w-4 accent-[#0B00E4]"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",children:"I confirm that the displayed context is private, non-sensitive, and ready to send only for this selected task."})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-3",variant:"outline",disabled:o||n||t.contentItemId===null||!t.contextConfirmed||t.requestPending,onClick:()=>t.request(t.task),children:t.requestPending?"Requesting private suggestionâ¦":`Request ${l[t.task]}`}),o?e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-2 text-xs font-medium text-slate-600",children:"Checking the protected pilot availability."}):n&&e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-2 text-xs font-medium text-slate-600",children:"Model requests are not currently available."}),t.result?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-4 rounded-lg border border-[#0B00E4]/20 bg-[#F7F8FF] p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"text-sm font-semibold text-slate-900",children:"Private suggestion â review required"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-1 text-xs text-slate-600",children:"Unverified. Check every claim, source, programme statement, link and tone before any internal save."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"flex gap-2",children:[e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",size:"sm",variant:"outline",onClick:r,children:"Copy"}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",size:"sm",variant:"outline",onClick:t.discard,children:"Discard"})]})]}),e.jsx("pre",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-3 max-h-80 overflow-auto whitespace-pre-wrap rounded-md bg-white p-3 text-sm leading-6 text-slate-700",children:t.result.text}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-3 flex flex-wrap items-center justify-between gap-3 rounded-md border border-amber-200 bg-amber-50 p-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"text-xs text-amber-900",children:"Using this as a working copy changes only the local editor. A separate **Save new internal version** action remains required."}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",size:"sm",onClick:t.useAsWorkingCopy,className:"bg-[#0B00E4] text-white hover:bg-[#0900b8]",children:"Use as working copy"})]})]}):e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:273",className:"mt-4 rounded-md bg-slate-50 px-3 py-3 text-sm text-slate-600",children:"No private suggestion is open in this browser session."})]})}function Y({label:t,children:s}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:276",className:"space-y-1.5",children:[e.jsx(Ne,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:276",children:t}),s]})}function ct({children:t}){return e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:277",className:"text-xs text-slate-400",children:t})}function Te({children:t,columns:s="2"}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:278",className:`grid gap-4 ${s==="3"?"md:grid-cols-3":"md:grid-cols-2"}`,children:t})}function ra({title:t,children:s}){return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:279",className:"space-y-4",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:279",className:"border-b border-slate-100 pb-2 font-semibold text-slate-900",children:t}),s]})}function qe({label:t,value:s,onChange:a,options:o,disabled:n,emptyLabel:l}){return e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:280",label:t,children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:280",disabled:n,value:s,onChange:r=>a(r.target.value),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[l&&e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:280",value:"",children:l}),o.map(r=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:280",value:r,children:we(r)},r))]})})}function _a({value:t,onChange:s,options:a,labels:o={}}){return e.jsx("select",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:281",value:t,onChange:n=>s(n.target.value),className:"h-10 rounded-md border border-slate-300 bg-white px-3 text-sm",children:a.map(n=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:281",value:n,children:o[n]??we(n)},n))})}function Xn({label:t,value:s,onChange:a,disabled:o}){return e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:282",label:t,value:s,onChange:a,disabled:o,emptyLabel:"Select goal",options:["SEO Traffic","Programme Awareness","Consideration","Lead Generation"]})}function er({programmes:t,value:s,onChange:a,disabled:o}){return e.jsxs("select",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:283",disabled:o,value:s,onChange:n=>a(n.target.value),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:283",value:"",children:"Select programme"}),t.map(n=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:283",value:n.id,children:n.title},n.id))]})}function tr({steps:t}){const s=t.filter(a=>a.complete).length;return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"rounded-xl border border-slate-200 bg-white p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"font-semibold text-slate-950",children:"Brief workspace"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"mt-1 text-sm text-slate-500",children:"A staff checklist for the private brief;
5 it does not create content or send data anywhere."})]}),e.jsxs(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"border border-slate-200 bg-slate-50 text-slate-600",children:[s,"/",t.length," planning areas complete"]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:t.map(a=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:`rounded-lg border p-3 ${a.complete?"border-emerald-200 bg-emerald-50":"border-slate-200 bg-slate-50"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"flex items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:`flex h-5 w-5 items-center justify-center rounded-full text-xs font-semibold ${a.complete?"bg-emerald-600 text-white":"bg-slate-200 text-slate-600"}`,children:a.complete?"â":""}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"font-medium text-slate-900",children:a.label})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:284",className:"mt-2 text-xs text-slate-500",children:a.detail})]},a.label))})]})}function ar({task:t,setTask:s,form:a,status:o,canUseExistingDraft:n}){const l=[{id:"brief",label:"Recommended brief",detail:"Review a future brief direction before staff write."},{id:"outline",label:"Outline assistant",detail:"Review a future heading and section plan."},{id:"metadata",label:"Metadata alignment",detail:"Review a future title and description alignment check."},{id:"refine",label:"Draft refinement",detail:"Review a future clarity and structure suggestion."},{id:"first_draft",label:"Generate private draft",detail:"Create a future first draft for mandatory Marketing review."}],r=l.find(x=>x.id===t),i=o?!o.staffRequestsEnabled:!1;return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:295",className:"rounded-xl border border-[#0B00E4]/20 bg-[#F7F8FF] p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:296",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:297",className:"flex gap-3",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:297",className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-[#0B00E4] text-white",children:e.jsx(Oe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:297",size:18})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:297",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:297",className:"font-semibold text-slate-950",children:"AI Content Assistant"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:297",className:"mt-1 text-sm text-slate-600",children:"Protected internal pilot. Requests remain private and require staff context confirmation and human review."})]})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:298",className:`border ${i?"border-amber-200 bg-amber-50 text-amber-700":"border-emerald-200 bg-emerald-50 text-emerald-700"}`,children:i?"Staged â not enabled":"Private pilot enabled"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:300",className:"mt-4 grid gap-2 sm:grid-cols-2 lg:grid-cols-5",children:l.map(x=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:300",type:"button",onClick:()=>s(x.id),className:`rounded-lg border p-3 text-left transition-colors ${t===x.id?"border-[#0B00E4] bg-white ring-1 ring-[#0B00E4]/20":"border-slate-200 bg-white hover:border-slate-300"}`,children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:300",className:"text-sm font-semibold text-slate-900",children:x.label}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:300",className:"mt-1 text-xs text-slate-500",children:x.detail})]},x.id))}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:301",className:"mt-4 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",className:"rounded-lg border border-slate-200 bg-white p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",className:"text-sm font-semibold text-slate-900",children:"Selected private context"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",className:"mt-1 text-sm text-slate-600",children:["Selected task: ",e.jsx("strong",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",children:r.label})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",className:"mt-3 space-y-1 text-xs text-slate-500",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",children:["Working title: ",a.title||"Not set"]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",children:["Programme: ",a.programmeTitleSnapshot||"Not linked"]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",children:["Audience: ",a.targetAudience||"Not set"]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",children:["Goal: ",a.primaryGoal||"Not set"]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",children:"Verified evidence only: staff must select and review sources/programme facts before a later request."})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",className:"mt-4",variant:"outline",disabled:!0,title:o?.reason??"Use the protected request control below",children:r.id==="first_draft"?"Generate private draft":`Request ${r.label}`}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:302",className:"mt-3 rounded-md bg-slate-50 px-3 py-2 text-xs font-medium text-slate-600",children:[i?"Not sent. No model call, prompt transmission, generated text, or draft update occurs while the pilot is staged.":"Use the protected request control below only after confirming this selected context is private and non-sensitive."," ",r.id==="first_draft"&&n?"A first draft will save as a private version marked AI-generated â review required.":""]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",className:"rounded-lg border border-slate-200 bg-white p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",className:"text-sm font-semibold text-slate-900",children:"Human review remains required"}),e.jsxs("ul",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",className:"mt-2 space-y-2 text-sm text-slate-600",children:[e.jsx("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",children:"⢠Marketing must fact-check every claim, source, programme statement, link and tone before any future approval."}),e.jsxs("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",children:["⢠Generated first drafts will be private versions labelled ",e.jsx("strong",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",children:"AI-generated â review required"}),"."]}),e.jsx("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",children:"⢠Google Search Console, web/news search, C
5RM, ads and external tools remain off."}),e.jsx("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",children:"⢠No public publication, CTA change, notification or automatic action is available."}),e.jsxs("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:303",children:["⢠Pilot benchmark: ",o?.monthlyRequestCap??100," requests/month; ",o?.hourlyUserCap??10," successful requests per user/hour."]})]})]})]}),e.jsx(Zn,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:305"})]})}function Ge({label:t,value:s}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:308",className:"rounded-lg bg-slate-50 p-3",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:308",className:"text-lg font-semibold text-slate-900",children:s}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:308",className:"mt-1 text-slate-500",children:t})]})}function sr({label:t,value:s,colour:a}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:309",className:"rounded-xl border border-slate-200 bg-white p-4",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:309",className:`text-2xl font-semibold ${a}`,children:s}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:309",className:"mt-1 text-xs text-slate-500",children:t})]})}function or({metrics:t,onStartTemplate:s,onShowEvidence:a,onShowFacts:o,onShowPipeline:n}){return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"overflow-hidden rounded-2xl border border-[#0B00E4]/20 bg-gradient-to-br from-[#F7F8FF] via-white to-[#EEF2FF] shadow-sm",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"border-b border-[#0B00E4]/10 px-5 py-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"flex items-center gap-2",children:[e.jsx(Oe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",size:18,className:"text-[#0B00E4]"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"text-sm font-semibold text-[#0B00E4]",children:"B3 Editorial Command Centre"})]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-1 text-2xl font-semibold text-slate-950",children:"What needs Marketingâs attention?"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-1 max-w-3xl text-sm text-slate-600",children:"Private workflow signals from B3 records only. No Google, CRM, advertising, web/news, notification or public-publishing data is used."})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"border border-[#0B00E4]/15 bg-white text-[#0B00E4]",children:"Private editorial workspace"})]})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"grid gap-3 p-5 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(Ut,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Needs evidence review",value:t.needsEvidence,detail:"Attach or verify source records before AI or internal review.",tone:"amber",onClick:a}),e.jsx(Ut,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Needs programme-fact review",value:t.needsFacts,detail:"Confirm Aventis-specific statements before future use.",tone:"rose",onClick:o}),e.jsx(Ut,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Ready for outline",value:t.readyForOutline,detail:"Private drafts with verified evidence and programme facts.",tone:"blue",onClick:n}),e.jsx(Ut,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Overdue internal review",value:t.overdue,detail
5:"Staff-set review dates only; no reminder is sent.",tone:"slate",onClick:n})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"grid gap-5 border-t border-[#0B00E4]/10 bg-white/70 p-5 xl:grid-cols-[1fr_1.45fr]",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"text-sm font-semibold text-slate-900",children:"Private editorial pipeline"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-1 text-xs text-slate-500",children:"A real-time view of active B3 records. Archived test items are excluded."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-4 grid grid-cols-2 gap-2",children:[e.jsx(Vt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Draft",value:t.pipeline.draft}),e.jsx(Vt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"In review",value:t.pipeline.in_review}),e.jsx(Vt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Changes requested",value:t.pipeline.changes_requested}),e.jsx(Vt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",label:"Approved internally",value:t.pipeline.approved})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"text-sm font-semibold text-slate-900",children:"Guided Brief Builder"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-1 text-xs text-slate-500",children:"Choose a private template to prefill the existing draft workflow. It does not create or publish a record until Marketing explicitly saves it."})]}),e.jsxs(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"border border-slate-200 bg-slate-50 text-slate-600",children:[t.total," active private item",t.total===1?"":"s"]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:Bn.map(l=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",onClick:()=>s(l),className:"rounded-xl border border-slate-200 bg-white p-3 text-left transition-colors hover:border-[#0B00E4]/40 hover:bg-[#F7F8FF]",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"text-sm font-semibold text-slate-900",children:l.label}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-1 text-xs leading-5 text-slate-500",children:l.description}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:311",className:"mt-3 inline-flex text-xs font-semibold text-[#0B00E4]",children:"Use template â"})]},l.id))})]})]})]})}function Ut({label:t,value:s,detail:a,tone:o,onClick:n}){const l={amber:"border-amber-200 bg-amber-50 text-amber-800",rose:"border-rose-200 bg-rose-50 text-rose-800",blue:"border-blue-200 bg-blue-50 text-blue-800",slate:"border-slate-200 bg-slate-50 text-slate-800"}[o];return e.jsxs("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:313",onClick:n,className:`rounded-xl border p-4 text-left transition-transform hover:-translate-y-0.5 ${l}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:313",className:"flex items-start justify-between gap-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:313",className:"text-sm font-semibold",children:t}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:313",className:"text-2xl font-semibold",children:s})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:313",className:"mt-2 text-xs leading-5 opacity-80",children:a}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:313",className:"mt-3 inline-flex text-xs font-semibold",children:"Review records â"})]})}function Vt({label:t,value:s}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:314",className:"rounded-lg border border-slate-200 bg-slate-50 p-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:314",className:"text-lg font-semibold text-slate-900",children:s}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:314",className:"mt-1 text-xs text-slate-500",children:t})]})}function xt({text:t}){return e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:315",className:"rounded-lg bg-slate-50 p-4 text-sm text-slate-500",children:t})}function ca({selected:t,onClick:s,children:a}){return e.jsx("button",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:316",onClick:s,className:`rounded-lg px-3 py-2 text-sm font-medium ${t?"bg-[#0B00E4] text-white":"bg-white text-slate-600 ring-1 ring-slate-200 hover:bg-slate-50"}`,children:a})}function da({priority:t}){return e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:317",className:`border ${t==="high"?"border-rose-200 bg-rose-50 text-rose-700":t==="low"?"border-slate-200 bg-slate-50 text-slate-500":"border-blue-200 bg-blue-50 text-blue-700"}`,children:we(t)})}function qa({status:t}){return e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:318",className:`border ${Hn[t]}`,children:va[t]})}function nr({items:t,selectedId:s,onSelect:a}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:319",className:"rounded-xl border border-slate-200 bg-white p-4",children:e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:319",label:"Select internal draft",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:319",value:s??"",onChange:o=>a(o.target.value?Number(o.target.value):null),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:319",value:"",children:"Select a draft"}),t.map(o=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:319",value:o.id,children:o.title},o.id))]})})})}function rr({check:t,onAcknowledge:s,pending:a}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",className:`rounded-xl border p-4 ${t.state==="complete"?"border-emerald-200 bg-emerald-50":"border-amber-200 bg-amber-50"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",className:"font-semibold text-slate-900",children:t.label}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",className:"mt-1 text-sm text-slate-600",children:t.detail})]}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",className:`border ${t.state==="complete"?"border-emerald-200 bg-white text-emerald-700":"border-amber-200 bg-white text-amber-700"}`,children:t.state==="complete"?"Complete":"Needs review"})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:320",className:"mt-3",variant:"outline",size:"sm",disabled:a,onClick:s,children:"Acknowledge for review"})]})}function cr(){const t=[{title:"Google Search Performance",detail:"No connection and no performance data. Google authorisation is required."},{title:"Market & Career Intelligence",detail:"No source connection or trend data. Create a private draft when Marketing has a new internal idea."},{title:"AI Content Assistant",detail:"A protected AI pilot is staged in Create. Model requests, web search and staff content transmission remain disabled pending separate validation."},{title:"Public Blog publishing",detail:"Available only through the Blog & AI Generator after internal approval and a separate explicit human publishing decision."}];return e.jsxs("section",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"font-semibold text-slate-950",children:"Connection-ready panels"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"mt-1 text-sm text-slate-500",children:"These future capabilities remain inactive until their own approval gates are met."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"mt-4 grid gap-3 md:grid-cols-2",children:t.map(s=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"rounded-lg border border-dashed border-slate-300 p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"flex items-center gap-2",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",size:15,className:"text-slate-500"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"font-medium text-slate-800",children:s.title})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"mt-2 text-sm text-slate-500",children:s.detail}),e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:321",className:"mt-3 border border-slate-200 bg-slate-50 text-slate-600",children:s.title==="Public Blog publishing"?"Available after approval":"Connection required"})]},s.title))})]})}function dr({items:t,selectedId:s,setSelectedId:a,relationship:o,setRelationship:n,saveRelationship:l,detail:r}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"font-semibold text-slate-950",children:"Private draft relationships"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"mt-1 text-sm text-slate-500",children:"Plan pillar, supporting, or related drafts. This never inserts a public link."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"mt-4 grid gap-3 md:grid-cols-3",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",label:"Source draft",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:s??"",onChange:i=>a(i.target.value?Number(i.target.value):null),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:"",children:"Select source"}),t.map(i=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:i.id,children:i.title},i.id))]})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",label:"Related draft",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:o.relatedId,onChange:i=>n(x=>({...x,relatedId:i.target.value})),className:"h-10 w-full rounded-md border border-slate-300 bg-white px-3 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:"",children:"Select related draft"}),t.filter(i=>i.id!==s).map(i=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:i.id,children:i.title},i.id))]})}),e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",label:"Relationship",value:o.relationshipType,onCh
5ange:i=>n(x=>({...x,relationshipType:i})),options:["pillar","supporting","related"]})]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",label:"Private rationale",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",value:o.rationale,onChange:i=>n(x=>({...x,rationale:i.target.value})),rows:2,placeholder:"Why are these drafts related?"})}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"mt-3 bg-[#0B00E4] text-white hover:bg-[#0900b8]",disabled:!s||!o.relatedId||l.isPending,onClick:()=>l.mutate({sourceContentItemId:s,relatedContentItemId:Number(o.relatedId),relationshipType:o.relationshipType,rationale:o.rationale||null}),children:[e.jsx(Je,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",size:15})," Save private relationship"]}),r?.relationships?.length>0&&e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"mt-4 space-y-2",children:r.relationships.map(i=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:322",className:"rounded-lg bg-slate-50 px-3 py-2 text-sm text-slate-700",children:[we(i.relationshipType)," relationship to internal draft #",i.relatedContentItemId,i.rationale?` â ${i.rationale}`:""]},i.id))})]})}function lr({detail:t,form:s,setForm:a,add:o,review:n}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"font-semibold text-slate-950",children:"Add source evidence"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"mt-1 text-sm text-slate-500",children:"Record a claim, source and optional freshness context. Human verification is required."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",label:"Claim supported *",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",value:s.claimSummary,onChange:l=>a(r=>({...r,claimSummary:l.target.value})),rows:3})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"space-y-3",children:[e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",label:"Source title *",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",value:s.sourceTitle,onChange:l=>a(r=>({...r,sourceTitle:l.target.value}))})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",label:"Publisher",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",value:s.publisher,onChange:l=>a(r=>({...r,publisher:l.target.value}))})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",label:"Source URL",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",value:s.sourceUrl,onChange:l=>a(r=>({...r,sourceUrl:l.target.value})),placeholder:"https://â¦"})}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",label:"Freshness note",children:e.jsx(A,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",value:s.freshnessNote,onChange:l=>a(r=>({...r,freshnessNote:l.target.value})),placeholder:"Staff-reviewed date or context"})})]})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"mt-4 bg-[#0B00E4] text-white hover:bg-[#0900b8]",disabled:o.isPending,onClick:()=>
5{if(!s.claimSummary.trim()||!s.sourceTitle.trim())return M.error("Claim summary and source title are required.");o.mutate({contentItemId:t.item.id,...s,sourceUrl:s.sourceUrl||null,publisher:s.publisher||null,freshnessNote:s.freshnessNote||null})},children:"Add source for review"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"space-y-3",children:t.sources?.map(l=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"rounded-xl border border-slate-200 bg-white p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"font-medium text-slate-900",children:l.sourceTitle}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"mt-1 text-sm text-slate-600",children:l.claimSummary}),l.freshnessNote&&e.jsxs("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"mt-2 text-xs text-slate-500",children:["Freshness note: ",l.freshnessNote]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"mt-3 flex gap-2",children:[e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",className:"border border-slate-200 bg-slate-50 text-slate-600",children:we(l.sourceStatus)}),l.sourceStatus==="needs_review"&&e.jsxs(e.Fragment,{children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",size:"sm",variant:"outline",onClick:()=>n.mutate({sourceId:l.id,status:"verified",reviewerNotes:null}),children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",size:14})," Verify"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",size:"sm",variant:"outline",className:"text-rose-700",onClick:()=>n.mutate({sourceId:l.id,status:"rejected",reviewerNotes:null}),children:[e.jsx(mt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:326",size:14})," Reject"]})]})]})]},l.id))})]})}function ir({detail:t,form:s,setForm:a,add:o,review:n}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"font-semibold text-slate-950",children:"Add programme statement for review"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsx(qe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",label:"Fact type",value:s.factType,onChange:l=>a(r=>({...r,factType:l})),options:["programme_name","study_mode","duration","entry_requirement","fee","intake","university","module","other"]}),e.jsx(Y,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",label:"Proposed statement *",children:e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",value:s.proposedStatement,onChange:l=>a(r=>({...r,proposedStatement:l.target.value})),rows:3})})]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"mt-4 bg-[#0B00E4] text-white hover:bg-[#0900b8]",disabled:o.isPending,onClick:()=>{if(!t.item.programmeId)return M.error("Link an Aventis programme first.");if(!s.proposedStatement.trim())return M.error("Programme statement is required.");o.mutate({contentItemId:t.item.id,programmeId:t.item.programmeId,...s})},children:"Add fact for review"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"space-y-3",children:t.programmeFacts?.map(l=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"rounded-xl border border-slate-200 bg-white p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"text-xs font-semibold uppercase tracking-wide text-slate-500",children:we(l.factType)}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"mt-1 text-sm text-slate-800",children:l.proposedStatement}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"mt-3 flex gap-2",children:[e.jsx(se,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",className:"border border-slate-200 bg-slate-50 text-slate-600",children:we(l.reviewStatus)}),l.reviewStatus==="needs_review"&&e.jsxs(e.Fragment,{children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",size:"sm",variant:"outline",onClick:()=>n.mutate({factId:l.id,status:"verified",reviewerNotes:null}),children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",size:14})," Verify"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",size:"sm",variant:"outline",className:"text-rose-700",onClick:()=>n.mutate({factId:l.id,status:"rejected",reviewerNotes:null}),children:[e.jsx(mt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:327",size:14})," Reject"]})]})]})]},l.id))})]})}
5function mr({detail:t,reviewNotes:s,setReviewNotes:a,submit:o,decide:n,returnToDraft:l,qualityReview:r}){const i=t.item,x=t.readiness;return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:`rounded-xl border p-5 ${x.readyForApproval?"border-emerald-200 bg-emerald-50":"border-amber-200 bg-amber-50"}`,children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"font-semibold text-slate-950",children:"Internal approval readiness"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-2 text-sm text-slate-600",children:x.readyForApproval?"All required internal checks are complete. Approval is not public publishing.":"Resolve the following before internal approval:"}),!x.readyForApproval&&e.jsx("ul",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3 space-y-1 text-sm text-slate-700",children:x.blockingReasons.map(f=>e.jsxs("li",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",children:["⢠",f]},f))})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"font-semibold text-slate-950",children:"Human review decision"}),e.jsx(re,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3",value:s,onChange:f=>a(f.target.value),rows:4,placeholder:"Record review context or required changes"}),i.status==="draft"||i.status==="changes_requested"?e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3 bg-[#0B00E4] text-white hover:bg-[#0900b8]",onClick:()=>o.mutate({id:i.id}),children:[e.jsx(Jt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",size:15})," Submit for review"]}):i.status==="in_review"?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3 flex gap-2",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"bg-emerald-600 text-white hover:bg-emerald-700",onClick:()=>n.mutate({id:i.id,decision:"approved",notes:s||null}),children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",size:15})," Approve internally"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",variant:"outline",onClick:()=>n.mutate({id:i.id,decision:"changes_requested",notes:s||null}),children:[e.jsx(mt,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",size:15})," Request changes"]})]}):i.status==="changes_requested"?e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3",variant:"outline",onClick:()=>l.mutate({id:i.id}),children:"Return to draft"}):e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3 text-sm font-medium text-emerald-700",children:"Approved internally. This has not published or scheduled anything."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"font-semibold text-slate-950",children:"Advisory quality review history"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-1 text-sm text-slate-500",children:"Acknowledgements are private audit notes only; they do not override evidence or programme-fact verification."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3 space-y-2",children:t.qualityReviews?.length?t.qualityReviews.map(f=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"rounded-lg bg-slate-50 px-3 py-2 text-sm text-slate-700",children:[we(f.checkKey)," â ",we(f.decision)]},f.id)):e.jsx("p",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"text-sm text-slate-500",children:"No advisory checks have been acknowledged yet."})}),e.jsx(T,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",className:"mt-3",variant:"outline",size:"sm",onClick:()=>r.mutate({contentItemId:i.id,checkKey:"internal_review",decision:"acknowledged",note:null}),children:"Record review acknowledgement"})]})]}),e.jsx($a,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",title:"Version history",rows:t.versions,render:f=>`Version ${f.versionNumber} · ${f.changeSummary??"Saved"}`}),e.jsx($a,{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:328",title:"Audit history",rows:t.auditEvents,render:f=>we(f.action)})]})}function $a({title:t,rows:s,render:a}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:329",className:"rounded-xl border border-slate-200 bg-white p-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:329",className:"font-semibold text-slate-950",children:t}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:329",className:"mt-3 space-y-2",children:s?.map(o=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:329",className:"flex flex-wrap justify-between gap-2 rounded-lg bg-slate-50 px-3 py-2 text-sm",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:329",children:a(o)}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ContentFoundationWorkspace.tsx:329",className:"text-xs text-slate-400",children:new Date(o.createdAt).toLocaleStr
5ing("en-SG")})]},o.id))})]})}function pr(t){return t==="SEO Traffic"?"For a future publication, review whether a related approved reading path is more suitable than a conversion CTA.":t==="Programme Awareness"?"For a future publication, review whether the approved programme overview is suitable.":t==="Consideration"?"For a future publication, review whether an approved brochure, comparison, eligibility or information-session action is suitable.":t==="Lead Generation"?"For a future publication, use only an approved lead action after a human review.":"Set a primary goal to receive private editorial CTA guidance."}const xr={masters:1,mba:1,emba:1,"executive-mba":1,"graduate-diploma":2,"postgraduate-diploma":2,"professional-diploma":2,bachelor:3,bsc:3};function hr(t){const s=(t??"").toLowerCase();for(const[a,o]of Object.entries(xr))if(s.includes(a))return o;return 2}function Cs(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function ws(t){return new Promise((s,a)=>{const o=new FileReader;o.onload=()=>{const n=o.result;s(n.split(",")[1])},o.onerror=a,o.readAsDataURL(t)})}function br({studyMode:t,asset:s,onUpload:a,onDelete:o}){const[n,l]=d.useState(!1),[r,i]=d.useState(!1),[x,f]=d.useState(!1),c=d.useRef(null),k=async C=>{if(C.type!=="application/pdf"){alert("Only PDF files are accepted for brochures.");return}if(C.size>20*1024*1024){alert("File is too large. Maximum size is 20 MB.");return}l(!0);try{await a(C)}finally{l(!1)}},E=t==="part-time"?"Part-Time":"Full-Time",N=t==="part-time"?"bg-blue-50 text-blue-700":"bg-purple-50 text-purple-700",g=async()=>{if(s?.stablePublicUrl)try{await navigator.clipboard.writeText(s.stablePublicUrl),f(!0),window.setTimeout(()=>f(!1),1800)}catch{window.prompt("Copy this permanent public link:",s.stablePublicUrl)}};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:150",className:"grid gap-3 px-4 py-4 lg:grid-cols-[minmax(0,1.15fr)_minmax(13rem,0.75fr)_auto] lg:items-center lg:px-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:151",className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:152",className:`shrink-0 rounded-full px-2.5 py-1 text-[11px] font-semibold ${N}`,children:E}),s?e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:156",className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:157",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-red-50 text-red-500",children:e.jsx(Nt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:158",size:16})}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:160",className:"min-w-0",children:[e.jsx("a",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:161",href:s.publicUrl,target:"_blank",rel:"noopener noreferrer",className:"block truncate text-sm font-medium text-slate-800 hover:text-[#0B00E4] hover:underline",title:s.filename,children:s.filename}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:170",className:"mt-0.5 flex items-center gap-1.5 text-xs text-slate-500",children:[e.jsx(ba,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:171",size:12,className:"shrink-0 text-emerald-500"}),"Active PDF · ",Cs(s.fileSize)]})]})]}):e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:177",className:"flex min-w-0 items-center gap-2.5 text-sm text-slate-500",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:178",className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-amber-50 text-amber-500",children:e.jsx(ya,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:178",size:16})}),"No brochure uploaded"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:184",className:"min-w-0 lg:border-l lg:border-slate-100 lg:pl-4",children:[e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:185",className:"mb-1 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.12em] text-slate-400",children:[e.jsx(Je,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:186",size:12})," Public Link"]}),s?.stablePublicUrl?e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:189",className:"block truncate text-xs font-medium text-slate-600",title:s.stablePublicUrl,children:s.stablePublicUrl.replace(/^https?:\/\/[^/]+/,"aventis.edu.sg")}):e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:191",className:"block text-xs text-slate-400",children:"Available after upload"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:195",className:"flex flex-wrap items-center gap-1.5 lg:justify-end",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:196",ref:c,type:"file",accept:"application/pdf",className:"hidden",onChange:C=>{const b=C.target.files?.[0];b&&k(b),C.target.value=""}}),s?.stablePublicUrl&&e.jsxs(e.Fragment,{children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:209",type:"button",size:"sm",variant:"outline",onClick:g,className:"h-8 border-[#B9C9FF] bg-[#F8FAFF] px-2.5 text-xs text-[#0B00E4] hover:bg-[#
5EEF2FF]",children:[x?e.jsx(ba,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:210",size:12,className:"mr-1"}):e.jsx(ls,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:210",size:12,className:"mr-1"}),x?"Copied":"Copy Link"]}),e.jsx(T,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:213",asChild:!0,type:"button",size:"sm",variant:"outline",className:"h-8 border-[#B9C9FF] bg-[#F8FAFF] px-2.5 text-xs text-[#0B00E4] hover:bg-[#EEF2FF]",children:e.jsxs("a",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:214",href:s.stablePublicUrl,target:"_blank",rel:"noopener noreferrer","aria-label":"Open Link",children:[e.jsx(_e,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:215",size:12,className:"mr-1"}),"Open"]})})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:221",size:"sm",variant:"outline",onClick:()=>c.current?.click(),disabled:n,className:"h-8 border-slate-200 px-2.5 text-xs text-slate-600 hover:bg-slate-50",children:[n?e.jsx(We,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:229",size:12,className:"animate-spin mr-1"}):e.jsx(cs,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:231",size:12,className:"mr-1"}),s?"Replace":"Upload PDF"]}),s&&e.jsxs(T,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:236",size:"sm",variant:"ghost",onClick:()=>i(!0),className:"h-8 px-2 text-xs text-red-500 hover:bg-red-50 hover:text-red-600",children:[e.jsx(lt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:242",size:12,className:"mr-1"}),"Delete"]})]}),e.jsx(kt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:248",open:r,onOpenChange:i,children:e.jsxs(Ct,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:249",children:[e.jsxs(wt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:250",children:[e.jsx(Et,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:251",children:"Delete brochure?"}),e.jsxs(St,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:252",children:["This will permanently remove the ",E,' brochure for this programme. The download button on the website will show "Brochure coming soon" until a new one is uploaded.']})]}),e.jsxs(Pt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:257",children:[e.jsx(Ft,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:258",children:"Cancel"}),e.jsx(Lt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:259",onClick:()=>{i(!1),o()},className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})})]})}function ur({previewData:t}){const s=v.useUtils(),{data:a=[],isLoading:o}=v.programmes.catalogue.useQuery(void 0,{enabled:!t}),{data:n=[],isLoading:l}=v.media.listBrochures.useQuery(void 0,{enabled:!t}),r=t?.programmes??a,i=t?.brochures??n,[x,f]=d.useState(()=>new Set),c=v.media.uploadBrochure.useMutation({onSuccess:()=>s.media.listBrochures.invalidate()}),k=v.media.deleteBrochure.useMutation({onSuccess:()=>s.media.listBrochures.invalidate()}),E=new Map(i.map(W=>[`${W.programmeSlug}::${W.studyMode}`,W])),N=async(W,j,P)=>{const U=await ws(P);await c.mutateAsync({programmeSlug:W,studyMode:j,filename:P.name,mimeType:"application/pdf",fileSize:P.size,base64:U})};if(!t&&(o||l))return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:306",className:"flex items-center justify-center gap-2 text-gray-400 py-16",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:307",size:18,className:"animate-spin"})," Loading programmesâ¦"]});const g=[{label:"Master's Degrees & MBAs",rank:1},{label:"Graduate & Professional Diplomas",rank:2},{label:"Bachelor's Degrees",rank:3}],C=new Map;for(const W of r){const j=hr(W.qualification);C.has(j)||C.set(j,[]),C.get(j).push(W)}const b=W=>{const j=W.studyModes,P=[];return(!j||j.includes("part-time"))&&P.push("part-time"),j?.includes("full-time")&&P.push("full-time"),P.length>0?P:["part-time"]};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:336",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:337",className:"flex flex-col gap-3 rounded-2xl border border-[#DDE5FF] bg-[linear-gradient(120deg,#F8FAFF_0%,#FFFFFF_65%)] px-4 py-4 sm:flex-row sm:items-center sm:justify-between lg:px-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:338",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:339",className:"text-sm font-semibold text-slate-900",children:"Programme brochure library"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:340",className:"mt-1 text-xs leading-5 text-slate-500",children:"One active PDF per programme and study mode. Replacing a PDF keeps its permanent public link unchanged."})]}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:342",className:"inline-flex w-fit items-center rounded-full border border-emerald-100 bg-emerald-50 px-2.5 py-1 text-[11px] font-semibold text-emerald-700",children:"Permanent links enabled"})]}),g.map(({label:W,rank:j})=>{const P=C.get(j)??[];return P.length===0?null:e.jsxs("section",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:349",className:"overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-[0_8px_24px_rgba(15,23,42,0.04)]",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:350",type:"button",onClick:()=>{f(U=>{const y=new Set(U);
5return y.has(j)?y.delete(j):y.add(j),y})},"aria-expanded":!x.has(j),className:"flex w-full items-center justify-between gap-4 border-b border-slate-100 bg-white px-4 py-4 text-left transition-colors hover:bg-[#F8FAFF] lg:px-5",children:[e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:362",className:"flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:363",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-[#EEF2FF] text-[#0B00E4]",children:x.has(j)?e.jsx($t,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:363",size:15}):e.jsx(ze,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:363",size:15})}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:364",className:"truncate text-sm font-bold text-slate-900",children:W})]}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:366",className:"shrink-0 rounded-full bg-slate-100 px-2.5 py-1 text-xs font-medium text-slate-600",children:[P.length," programmes"]})]}),!x.has(j)&&e.jsx("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:369",className:"grid gap-3 bg-slate-50/50 p-3 lg:p-4",children:P.map(U=>{const y=b(U);return e.jsxs("article",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:373",className:"overflow-hidden rounded-xl border border-slate-200 bg-white shadow-[0_2px_8px_rgba(15,23,42,0.035)]",children:[e.jsxs("header",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:374",className:"flex min-w-0 flex-col gap-2 border-b border-slate-100 px-4 py-3.5 sm:flex-row sm:items-center sm:justify-between lg:px-5",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:375",className:"min-w-0 text-sm font-bold leading-5 text-slate-900",children:U.title}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:376",className:"shrink-0 text-xs text-slate-400",children:[y.length," ",y.length===1?"brochure":"brochures"]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:378",className:"divide-y divide-slate-100",children:y.map(V=>e.jsx(br,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:380",studyMode:V,asset:E.get(`${U.slug}::${V}`)??null,onUpload:p=>N(U.slug,V,p),onDelete:()=>{const p=E.get(`${U.slug}::${V}`);p&&k.mutate({id:p.id})}},`${U.slug}-${V}`))})]},U.slug)})})]},j)})]})}function gr(){const t=v.useUtils(),[s,a]=d.useState(""),[o,n]=d.useState(!1),[l,r]=d.useState(!1),[i,x]=d.useState(null),f=d.useRef(null),{data:c=[],isLoading:k}=v.media.listImages.useQuery({search:s||void 0}),E=v.media.uploadImage.useMutation({onSuccess:()=>t.media.listImages.invalidate()}),N=v.media.deleteImage.useMutation({onSuccess:()=>t.media.listImages.invalidate()}),g=d.useCallback(async C=>{const b=["image/jpeg","image/png","image/webp"],W=Array.from(C).filter(j=>b.includes(j.type));if(W.length===0){alert("Only JPG, PNG, and WebP images are accepted.");return}r(!0);try{for(const j of W){if(j.size>10*1024*1024){alert(`${j.name} is too large. Maximum size is 10 MB.`);continue}const P=await ws(j);await E.mutateAsync({filename:j.name,mimeType:j.type,fileSize:j.size,base64:P})}}finally{r(!1)}},[E]);return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:449",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:451",className:`border-2 border-dashed rounded-xl p-8 text-center transition-colors cursor-pointer ${o?"border-[#0B00E4] bg-[#EEF2FF]":"border-gray-200 hover:border-[#0B00E4]/40"}`,onDragOver:C=>{C.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:C=>{C.preventDefault(),n(!1),g(C.dataTransfer.files)},onClick:()=>f.current?.click(),children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:464",ref:f,type:"file",accept:"image/jpeg,image/png,image/webp",multiple:!0,className:"hidden",onChange:C=>{C.target.files&&g(C.target.files),C.target.value=""}}),l?e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:476",className:"flex items-center justify-center gap-2 text-[#0B00E4]",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:477",size:20,className:"animate-spin"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:478",className:"text-sm font-medium",children:"Uploadingâ¦"})]}):e.jsxs(e.Fragment,{children:[e.jsx(cs,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:482",size:28,className:"mx-auto text-gray-300 mb-2"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:483",className:"text-sm font-medium text-gray-600",children:"Drag & drop images here, or click to select"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:484",className:"text-xs text-gray-400 mt-1",children:"JPG, PNG, WebP â max 10 MB per file"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:490",className:"relative",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:491",size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:492",placeholder:"Search by filenameâ¦",value:s,onChange:C=>a(C.target.value),className:"pl-8 text-sm"}),s&&e.jsx("button",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:499",onClick:()=>a(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:e.jsx(ds,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:500",size:14})})]}),k?e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:507",className:"flex items-center justify-center gap-2 text-gray-400 py-12",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:508",size:18,className:"animate-spin"})," Loading imagesâ¦"]}):c.length===0?e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:511",className:"text-center py-12 text-gray-400",children:[e.jsx(Yt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:512",size:32,className:"mx-auto mb-2 opacity-30"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:513",className:"text-sm",children:s?"No images match your search.":"No images uploaded yet."})]}):e.jsx("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:516",className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 ga
5p-3",children:c.map(C=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:518",className:"group relative rounded-lg overflow-hidden border border-gray-200 bg-gray-50 aspect-square",children:[e.jsx("img",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:519",src:C.publicUrl,alt:C.altText??C.filename,className:"w-full h-full object-cover"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:525",className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex flex-col items-center justify-center gap-2 p-2",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:526",className:"text-white text-xs text-center truncate w-full",children:C.filename}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:527",className:"text-white/60 text-xs",children:Cs(C.fileSize)}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:528",className:"flex gap-2",children:[e.jsx("a",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:529",href:C.publicUrl,target:"_blank",rel:"noopener noreferrer",className:"bg-white/20 hover:bg-white/30 text-white text-xs px-2 py-1 rounded",onClick:b=>b.stopPropagation(),children:"View"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:538",onClick:()=>x({id:C.id,filename:C.filename}),className:"bg-red-500/80 hover:bg-red-600 text-white text-xs px-2 py-1 rounded",children:"Delete"})]})]})]},C.id))}),e.jsx(kt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:552",open:!!i,onOpenChange:C=>!C&&x(null),children:e.jsxs(Ct,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:553",children:[e.jsxs(wt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:554",children:[e.jsx(Et,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:555",children:"Delete image?"}),e.jsxs(St,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:556",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:557",children:i?.filename})," will be permanently removed from storage. Any programme, event, or blog post that references this image URL will show a broken image."]})]}),e.jsxs(Pt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:561",children:[e.jsx(Ft,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:562",children:"Cancel"}),e.jsx(Lt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:563",onClick:()=>{i&&N.mutate({id:i.id}),x(null)},className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})})]})}function vr({previewData:t}){const[s,a]=d.useState("brochures");return e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:584",className:"w-full max-w-none p-4 sm:p-6 xl:p-8",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:586",className:"mb-6 flex flex-col gap-3 border-b border-slate-200 pb-5 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:587",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:588",className:"mb-1 text-[11px] font-bold uppercase tracking-[0.16em] text-[#0B00E4]",children:"Marketing asset library"}),e.jsx("h1",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:589",className:"text-2xl font-bold tracking-tight text-slate-950",children:"Brochures & Media"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:590",className:"mt-1 text-sm text-slate-500",children:"Manage programme brochures and the shared image library."})]}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:594",className:"inline-flex w-fit items-center gap-1.5 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-xs font-medium text-slate-600",children:[e.jsx(ba,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:594",size:13,className:"text-emerald-500"})," Active assets ready to share"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:598",className:"mb-6 inline-flex max-w-full gap-1 rounded-xl border border-slate-200 bg-white p-1.5
5shadow-sm",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:599",onClick:()=>a("brochures"),className:`flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-semibold transition-colors ${s==="brochures"?"bg-[#0B00E4] text-white shadow-sm":"text-slate-500 hover:bg-slate-50 hover:text-[#0B00E4]"}`,children:[e.jsx(Nt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:607",size:15}),"Brochures"]}),!t&&e.jsxs("button",{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:611",onClick:()=>a("images"),className:`flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-semibold transition-colors ${s==="images"?"bg-[#0B00E4] text-white shadow-sm":"text-slate-500 hover:bg-slate-50 hover:text-[#0B00E4]"}`,children:[e.jsx(Yt,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:619",size:15}),"Images"]})]}),s==="brochures"?e.jsx(ur,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:626",previewData:t}):e.jsx(gr,{"data-loc":"client/src/components/dashboard/BrochuresMedia.tsx:626"})]})}function fr(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"aventis-campaign"}function Ps({finalUrl:t,fileStem:s,compact:a=!1}){const[o,n]=d.useState(null),l=fr(s);async function r(){await navigator.clipboard.writeText(t),M.success("Campaign link copied")}async function i(f){try{if(n(f),f==="svg"){const c=await Aa.toString(t,{type:"svg",errorCorrectionLevel:"M",margin:2,color:{dark:"#111111",light:"#FFFFFF"}}),k=URL.createObjectURL(new Blob([c],{type:"image/svg+xml"})),E=document.createElement("a");E.href=k,E.download=`${l}.svg`,E.click(),URL.revokeObjectURL(k)}else{const c=await Aa.toDataURL(t,{errorCorrectionLevel:"M",margin:2,width:1200,color:{dark:"#111111",light:"#FFFFFF"}}),k=document.createElement("a");k.href=c,k.download=`${l}.png`,k.click()}M.success(`QR code downloaded as ${f.toUpperCase()}`)}catch{M.error("QR code could not be generated. Please try again.")}finally{n(null)}}const x=a?"h-8 px-2 text-xs":"h-9 px-3 text-sm";return e.jsxs("div",{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:64",className:"flex flex-wrap gap-1.5",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:65",type:"button",variant:"outline",className:x,onClick:r,title:"Copy campaign link",children:[e.jsx(ls,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:66",size:a?13:14,className:a?"":"mr-1.5"}),!a&&"Copy link"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:69",type:"button",variant:"outline",className:x,onClick:()=>i("svg"),disabled:o!==null,children:[o==="svg"?e.jsx(oe,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:70",size:a?13:14,className:"animate-spin"}):e.jsx(yt,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:70",size:a?13:14,className:a?"":"mr-1.5"}),!a&&"SVG"]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:73",type:"button",variant:"outline",className:x,onClick:()=>i("png"),disabled:o!==null,children:[o==="png"?e.jsx(oe,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:74",size:a?13:14,className:"animate-spin"}):e.jsx(yt,{"data-loc":"client/src/components/dashboard/QrCodeActions.tsx:74",size:a?13:14,className:a?"":"mr-1.5"}),!a&&"PNG"]})]})}function jr(t){const{redirectOnUnauthenticated:s=!1,redirectPath:a}={},o=v.useUtils(),n=v.auth.me.useQuery(void 0,{retry:!1,refetchOnWindowFocus:!1}),l=v.auth.logout.useMutation({onSuccess:()=>{o.auth.me.setData(void 0,null)}}),r=d.useCallback(async()=>{try{await l.mutateAsync()}catch(x){if(x instanceof cn&&x.data?.code==="UNAUTHORIZED")return;throw x}finally{try{sessionStorage.removeItem("manus-cookie")}catch{}o.auth.me.setData(void 0,null),await o.auth.me.invalidate()}},[l,o]),i=d.useMemo(()=>{if(typeof window<"u")try{localStorage.setItem("manus-runtime-user-info",JSON.stringify(n.data))}catch{}return{user:n.data??null,loading:n.isLoading||l.isPending,error:n.error??l.error??null,isAuthenticated:!!n.data}},[n.data,n.error,n.isLoading,l.error,l.isPending]);return d.useEffect(()=>{s&&(n.isLoading||l.isPending||i.user||typeof window>"u"||a&&window.location.pathname===a||(a?window.location.href=a:$s()))},[s,a,l.isPending,n.isLoading,i.user]),{...i,refresh:()=>n.refetch(),logout:r}}function yr({onEdit:t,onCreate:s}){const{user:a}
5=jr(),[o,n]=d.useState(""),[l,r]=d.useState("active"),[i,x]=d.useState(null),f=v.useUtils(),{data:c,isLoading:k}=v.utm.list.useQuery({status:l,search:o.trim()||void 0,limit:50}),E=v.utm.archive.useMutation({onSuccess:()=>{M.success("Campaign link archived. Managed redirects are disabled; legacy direct QR codes remain printed collateral."),x(null),f.utm.list.invalidate()},onError:b=>M.error(b.message)}),N=v.utm.duplicate.useMutation({onSuccess:b=>{M.success("Campaign link duplicated. Review the copy before use."),f.utm.list.invalidate(),b?.id&&t(b.id)},onError:b=>M.error(b.message)}),g=v.utm.approveRedirect.useMutation({onSuccess:()=>{M.success("Managed QR redirect approved. QR exports now use the stable Aventis link."),f.utm.list.invalidate()},onError:b=>M.error(b.message)}),C=c?.items??[];return e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:81",className:"p-6 max-w-6xl w-full space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:82",className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:83",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:84",className:"text-2xl font-bold text-[#111111]",children:"Campaign Links & QR Codes"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:85",className:"text-sm text-gray-500 mt-1",children:"Create governed campaign URLs, download print-ready QR codes, and verify programme destinations before reuse."})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:87",onClick:s,className:"bg-[#0B00E4] hover:bg-[#0900b8] text-white gap-2 shrink-0",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:87",size:16})," New Campaign Link"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:90",className:"border border-[#0B00E4]/20 bg-[#EEF2FF] rounded-xl p-4 text-sm text-[#111111] flex gap-3",children:[e.jsx(Je,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:91",size:18,className:"text-[#0B00E4] shrink-0 mt-0.5"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:92",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:92",children:"Managed QR links use Aventis redirect URLs."})," New QR exports are available after Super Admin approval and remain editable if a destination changes. Older direct QR codes stay marked legacy until collateral is reprinted."]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:95",className:"flex flex-wrap gap-3 items-center",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:96",className:"relative flex-1 min-w-[240px]",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:96",size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:96",value:o,onChange:b=>n(b.target.value),placeholder:"Search name, campaign, programme, or pathâ¦",className:"pl-9 h-9"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:97",className:"flex gap-1 bg-[#EEF2FF] rounded-lg p-1",children:["active","archived","all"].map(b=>e.jsx("button",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:98",onClick:()=>r(b),className:`px-3 py-1 rounded-md text-sm font-medium ${l===b?"bg-[#0B00E4] text-white":"text-gray-600 hover:text-[#0B00E4]"}`,children:b.charAt(0).toUpperCase()+b.slice(1)},b))})]}),k?e.jsx("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:102",className:"py-16 text-center text-sm text-gray-400",children:"Loading campaign linksâ¦"}):C.length===0?e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:103",className:"border border-dashed border-gray-300 rounded-xl py-16 text-center",children:[e.jsx(Je,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:103",size:28,className:"mx-auto text-[#0B00E4] mb-3"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:103",className:"font-semibold text-[#111111]",children:"No campaign links foun
5d"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:103",className:"text-sm text-gray-500 mt-1",children:"Create a governed UTM link for your next paid, email, partner, or QR campaign."})]}):e.jsx("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:104",className:"space-y-3",children:C.map(b=>e.jsx("article",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:105",className:"border border-gray-200 rounded-xl bg-white p-4 hover:border-[#0B00E4]/30 transition-colors",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:106",className:"flex gap-3",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:107",className:`w-2 h-2 rounded-full mt-2 shrink-0 ${b.isActive?"bg-green-500":"bg-gray-300"}`}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:108",className:"flex-1 min-w-0 space-y-2",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:"flex flex-wrap items-center gap-2",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:"font-bold text-[#111111]",children:b.name}),e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:`text-xs px-2 py-0.5 rounded-full ${b.isActive?"bg-green-50 text-green-700":"bg-gray-100 text-gray-600"}`,children:b.isActive?"Active":"Archived"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:`text-xs px-2 py-0.5 rounded-full ${b.redirectStatus==="managed"?"bg-[#EEF2FF] text-[#0B00E4]":b.redirectStatus==="pending_approval"?"bg-amber-50 text-amber-700":"bg-gray-100 text-gray-600"}`,children:b.redirectStatus==="managed"?"Managed QR":b.redirectStatus==="pending_approval"?"Approval required":"Legacy direct QR"}),b.isCustomCampaign?e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:"text-xs px-2 py-0.5 rounded-full border border-amber-200 bg-amber-50 text-amber-700",children:"Custom campaign"}):null,b.isCustomSource?e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:"text-xs px-2 py-0.5 rounded-full border border-amber-200 bg-amber-50 text-amber-700",children:"Custom source"}):null,b.isCustomMedium?e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:"text-xs px-2 py-0.5 rounded-full border border-amber-200 bg-amber-50 text-amber-700",children:"Custom medium"}):null,b.destinationStale?e.jsxs("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",className:"text-xs px-2 py-0.5 rounded-full bg-amber-50 border border-amber-300 text-amber-800 inline-flex items-center gap-1",children:[e.jsx(Ze,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:109",size:11})," Destination may have changed"]}):null]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:110",className:"flex flex-wrap gap-2 text-xs",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:110",className:"px-2 py-1 rounded bg-[#EEF2FF] text-[#0B00E4] font-medium",children:b.utmSource}),e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:110",className:"px-2 py-1 rounded bg-[#EEF2FF] text-[#0B00E4] font-medium",children:b.utmMedium}),e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:110",className:"px-2 py-1 rounded bg-gray-100 text-gray-700 font-mono",children:b.utmCampaign})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:111",className:"text-xs text-gray-500",children:["Destination: ",e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:111",className:"font-mono text-[#111111]",children:b.destinationPath}),b.currentProgramme?e.jsxs("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:111",children:[" · Current: ",b.currentProgramme.title]}):null]}),e.jsxs("a",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:112",href:b.qrUrl??b.managedUrl,target:"_blank",rel:"noreferrer",className:"font-mono text-xs text-[#0B00E4] break-all hover:underline inline-flex items-center gap-1",children:[b.qrUrl??b.managedUrl,e.jsx(_e,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:112",size:11})]}),b.destinationStale?e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:113",className:"text-xs text-amber-800",children:"Managed links fall back to the Aventis homepage while retaining UTMs. Legacy direct QR material needs reprint review."}):null]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",className:"flex flex-col gap-2 shrink-0 items-end",children:[b.qrUrl?e.jsx(Ps,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",finalUrl:b.qrUrl,fileStem:b.name,compact:!0}):e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",className:"text-xs text-amber-700 text-right max-w-32",children:"Awaiting Super Admin redirect approval before QR export."}),b.redirectStatus==="pending_approval"&&a?.role==="admin"?e.jsx(T,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",size:"sm",className:"h-8 text-xs bg-[#0B00E4] hover:bg-[#0900b8] text-white",disabled:g.isPending,onClick:()=>g.mutate({id:b.id}),children:"Approve QR"}):null,e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",className:"flex gap-1",children:[e.jsx(T,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>t(b.id),children:"Edit"}),e.jsx(T,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",variant:"outline",size:"sm",className:"h-8 w-8 p-0",title:"Duplicate",onClick:()=>N.mutate({id:b.id,name:`${b.name} copy`}),children:e.jsx(Eo,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",size:14})}),b.isActive?e.jsx(T,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",variant:"outline",size:"sm",className:"h-8 w-8 p-0 text-amber-700",title:"Archive",onClick:()=>x(b),children:e.jsx(pt,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:115",size:14})}):null]})]})]})},b.id))}),e.jsx(kt,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:120",o
5pen:i!==null,onOpenChange:b=>{b||x(null)},children:e.jsxs(Ct,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",children:[e.jsxs(wt,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",children:[e.jsx(Et,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",children:"Archive this campaign link?"}),e.jsx(St,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",children:"Archiving disables its managed redirect. Existing legacy direct QR collateral cannot be revoked remotely and should be reprinted or retired separately."})]}),e.jsxs(Pt,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",children:[e.jsx(Ft,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",children:"Cancel"}),e.jsx(Lt,{"data-loc":"client/src/components/dashboard/UtmLinkList.tsx:121",onClick:()=>i&&E.mutate({id:i.id}),className:"bg-amber-600 hover:bg-amber-700 text-white",children:"Archive Link"})]})]})})]})}const Nr=["meta","google","linkedin","tiktok","email","organic_social","partner","print"],kr=["paid_social","paid_search","email","organic_social","referral","qr"],Cr=["brochure","enquiry","open_house","info_session","application","scholarship","awareness","retargeting"],wr=["oct_2026","jan_2027","mar_2027","jul_2027","evergreen"],Es=()=>new Date().toISOString().slice(0,7).replace("-",""),Pr=()=>({name:"",notes:"",destinationKind:"programme",destinationPath:"",programmeCode:"",utmSource:"meta",utmMedium:"paid_social",utmTerm:"",utmContent:"",isCustomSource:!1,customSourceReason:"",isCustomMedium:!1,customMediumReason:"",isCustomCampaign:!1,customCampaignName:"",customCampaignReason:"",campaignTheme:"",campaignIntake:"oct_2026",campaignObjective:"brochure",campaignPeriod:Es()});function Er({linkId:t,onBack:s}){const[a,o]=d.useState(Pr),[n,l]=d.useState(null),[r,i]=d.useState(null),{data:x,isLoading:f}=v.utm.destinations.useQuery(),{data:c,isLoading:k}=v.utm.get.useQuery({id:t??1},{enabled:t!==null}),E=v.useUtils();d.useEffect(()=>{if(!c)return;const y=c.destinationType==="programme"?"programme":c.destinationType==="static_page"?"static":"custom";o({name:c.name,notes:c.notes??"",destinationKind:y,destinationPath:c.destinationPath,programmeCode:c.programmeCode??"",utmSource:c.utmSource,utmMedium:c.utmMedium,utmTerm:c.utmTerm??"",utmContent:c.utmContent??"",isCustomSource:!!c.isCustomSource,customSourceReason:c.customSourceReason??"",isCustomMedium:!!c.isCustomMedium,customMediumReason:c.customMediumReason??"",isCustomCampaign:!!c.isCustomCampaign,customCampaignName:c.isCustomCampaign?c.utmCampaign:"",customCampaignReason:c.customCampaignReason??"",campaignTheme:c.campaignTheme??"",campaignIntake:c.campaignIntake??"oct_2026",campaignObjective:c.campaignObjective??"brochure",campaignPeriod:c.campaignPeriod??Es()}),i(c.finalUrl)},[c]);const N=d.useMemo(()=>a.isCustomCampaign?a.customCampaignName||"custom_campaign":[a.campaignTheme||"theme",a.campaignIntake,a.campaignObjective,a.campaignPeriod].join("_"),[a]),g=()=>({name:a.name,notes:a.notes||null,destinationPath:a.destinationPath,destinationType:a.destinationKind==="programme"?"programme":a.destinationKind==="static"?"static_page":"custom_internal_path",programmeCode:a.destinationKind==="programme"&&a.programmeCode||null,utmSource:a.utmSource,utmMedium:a.utmMedium,utmTerm:a.utmTerm||null,utmContent:a.utmContent||null,isCustomSource:a.isCustomSource,customSourceReason:a.customSourceReason||null,isCustomMedium:a.isCustomMedium,customMediumReason:a.customMediumReason||null,isCustomCampaign:a.isCustomCampaign,customCampaignName:a.customCampaignName||null,customCampaignReason:a.customCampaignReason||null,campaignTheme:a.campaignTheme||null,campaignIntake:a.campaignIntake||null,campaignObjective:a.campaignObjective||null,campaignPeriod:a.campaignPeriod||null}),C=v.utm.create.useMutation({onSuccess:y=>{if(!y.created){l(y.similar);return}i(y.item?.finalUrl??null),M.success("Campaign link created"),E.utm.list.invalidate(),E.utm.get.invalidate()},onError:y=>M.error(y.message)}),b=v.utm.update.useMutation({onSuccess:y=>{i(y?.finalUrl??null),M.success("Campaign link updated"),E.utm.list.invali
5date(),E.utm.get.invalidate()},onError:y=>M.error(y.message)});function W(y){const V=x?.programmes.find(p=>p.programmeCode===y);o(p=>({...p,programmeCode:y,destinationPath:V?.path??""}))}function j(y){o(V=>({...V,destinationPath:y}))}function P(y=!1){t===null?C.mutate({...g(),confirmSimilar:y}):b.mutate({id:t,data:g()})}if(t!==null&&k||f)return e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:182",className:"p-8 text-sm text-gray-400 flex items-center gap-2",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:182",size:16,className:"animate-spin"})," Loading campaign linkâ¦"]});const U=C.isPending||b.isPending;return e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:187",className:"p-6 max-w-5xl space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:188",className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:189",children:[e.jsxs(T,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:190",variant:"ghost",size:"sm",onClick:s,className:"-ml-2 mb-2 gap-1.5 text-gray-600",children:[e.jsx(et,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:190",size:15})," Back to Campaign Links"]}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:191",className:"text-2xl font-bold text-[#111111]",children:t===null?"New Campaign Link":"Edit Campaign Link"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:192",className:"text-sm text-gray-500 mt-1",children:"Create a governed UTM link and download a matching QR code for campaign assets."})]}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:194",onClick:()=>P(!1),disabled:U,className:"bg-[#0B00E4] hover:bg-[#0900b8] text-white gap-2",children:[U?e.jsx(oe,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:195",size:16,className:"animate-spin"}):e.jsx($e,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:195",size:16})," ",t===null?"Create Link":"Save Changes"]})]}),c?.destinationStale&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:200",className:"border border-amber-300 bg-amber-50 text-amber-900 rounded-lg p-4 flex gap-3 text-sm",children:[e.jsx(Ze,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:201",size:18,className:"shrink-0 mt-0.5"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:202",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:202",children:"Destination may have changed."})," This programme is unpublished or its current URL differs from the saved destination. Verify and regenerate any printed QR material before reuse."]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:206",className:"bg-white border border-gray-200 rounded-xl p-5 space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:207",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:207",className:"font-bold text-[#111111]",children:"1. Campaign Identity"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:207",className:"text-xs text-gray-500 mt-1",children:"This name is internal and makes the link easy to find later."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:208",className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:209",className:"space-y-1.5",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:209",children:["Campaign link name ",e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:209",className:"text-red-600",children:"*"})]}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:209",value:a.name,onChange:y=>o({...a,name:y.target.value}),placeholder:"MBA October brochure â Meta"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:210",className:"space-y-1.5",children:[e.jsx(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:210",children:"Internal notes"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:210",value:a.notes,onChange:y=>o({...a,notes:y.target.value}),placeholder:"Optional audience or creative notes"})]})]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:214",className:"bg-white border border-gray-200 rounded-xl p-5 space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:215",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:215",className:"font-bold text-[#111111]",children:"2. Destination"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:215",className:"text-xs text-gray-500 mt-1",children:"Campaign links only point to Aventis-owned internal pages."})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:216",className:"flex flex-wrap gap-2",children:["programme","static","custom"].map(y=>e.jsx("button",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:217",onClick:()=>o({...a,destinationKind:y,programmeCode:"",destinationPath:""}),className:`px-3 py-1.5 rounded-md text-sm font-medium ${a.destinationKind===y?"bg-[#0B00E4] text-white":"bg-[#EEF2FF] text-[#0B00E4]"}`,children:y==="programme"?"Programme":y==="static"?"Site page":"Internal path"},y))}),a.destinationKind==="programme"?e.jsxs("select",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:219",className:"w-full h-10 px-3 border border-gray-200 rounded-md text-sm bg-white",value:a.programmeCode,onChange:y=>W(y.target.value),children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:219",value:"",children:"Choose a published programme"}),x?.programmes.map(y=>e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:219",value:y.programmeCode,children:y.title},y.programmeCode))]}):a.destinationKind==="static"?e.jsxs("select",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:220",className:"w-full h-10 px-3 border border-gray-200 rounded-md text-sm bg-white",value:a.destinationPath,onChange:y=>j(y.target.value),children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:220",value:"",children:"Choose an Aventis page"}),x?.staticPages.map(y=>e.jsxs("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:220",value:y.path,children:[y.label," â ",y.path]},y.path))]}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:221",className:"space-y-1.5",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:221",children:["Aventis-relative path ",e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:221",className:"text-red-600",children:"*"})]}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:221",value:a.destinationPath,onChange:y=>o({...a,destinationPath:y.target.value}),placeholder:"/events/graduate-school-open-house/"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:221",className:"text-xs text-gray-500",children:"Must begin with one slash. External URLs are not permitted."})]}),a.destinationPath&&e.jsxs("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:222",className:"font-mono text-xs text-[#0B00E4] bg-[#EEF2FF] rounded-md p-2",children:["Destination: ",a.destinationPath]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:225",className:"bg-white border border-gray-200 rounded-xl p-5 space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:226",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:226",className:"font-bold text-[#111111]",children:"3. Attribution"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:226",className:"text-xs text-gray-500 mt-1",children:"Structured fields protect the campaign key used by future lead and performance reporting."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:227",className:"grid md:grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",className:"space-y-1.5",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",children:["Source ",e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",className:"text-red-600",children:"*"})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",className:"w-full h-10 px-3 border border-gray-200 rounded-md text-sm bg-white",value:a.isCustomSource?"custom"
5:a.utmSource,onChange:y=>o({...a,isCustomSource:y.target.value==="custom",utmSource:y.target.value==="custom"?"":y.target.value}),children:[Nr.map(y=>e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",value:y,children:y},y)),e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",value:"custom",children:"Custom source"})]}),a.isCustomSource&&e.jsxs(e.Fragment,{children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",className:"mt-2",value:a.utmSource,onChange:y=>o({...a,utmSource:y.target.value}),placeholder:"Custom source value"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:228",className:"mt-2",value:a.customSourceReason,onChange:y=>o({...a,customSourceReason:y.target.value}),placeholder:"Why is this source custom?"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",className:"space-y-1.5",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",children:["Medium ",e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",className:"text-red-600",children:"*"})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",className:"w-full h-10 px-3 border border-gray-200 rounded-md text-sm bg-white",value:a.isCustomMedium?"custom"
5:a.utmMedium,onChange:y=>o({...a,isCustomMedium:y.target.value==="custom",utmMedium:y.target.value==="custom"?"":y.target.value}),children:[kr.map(y=>e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",value:y,children:y},y)),e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",value:"custom",children:"Custom medium"})]}),a.isCustomMedium&&e.jsxs(e.Fragment,{children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",className:"mt-2",value:a.utmMedium,onChange:y=>o({...a,utmMedium:y.target.value}),placeholder:"Custom medium value"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:229",className:"mt-2",value:a.customMediumReason,onChange:y=>o({...a,customMediumReason:y.target.value}),placeholder:"Why is this medium custom?"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:230",className:"space-y-1.5",children:[e.jsx(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:230",children:"UTM content"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:230",value:a.utmContent,onChange:y=>o({...a,utmContent:y.target.value}),placeholder:"instagram_reel_v2 or a4_mba_brochure"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:231",className:"space-y-1.5",children:[e.jsx(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:231",children:"UTM term"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:231",value:a.utmTerm,onChange:y=>o({...a,utmTerm:y.target.value}),placeholder:"Paid-search keyword or ad-set label"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:233",className:"border-t border-gray-100 pt-4 space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:234",className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:234",children:[e.jsxs(Ne,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:234",children:["Campaign composition ",e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:234",className:"text-red-600",children:"*"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:234",className:"text-xs text-gray-500 mt-1",children:"Use structured fields by default. Custom names require an internal reason."})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:234",type:"button",onClick:()=>o({...a,isCustomCampaign:!a.isCustomCampaign}),className:"text-sm font-medium text-[#0B00E4]",children:a.isCustomCampaign?"Use structured campaign":"Use Custom campaign"})]}),a.isCustomCampaign?e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",className:"grid md:grid-cols-2 gap-3",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",value:a.customCampaignName,onChange:y=>o({...a,customCampaignName:y.target.value}),placeholder:"Custom campaign name"}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",value:a.customCampaignReason,onChange:y=>o({...a,customCampaignReason:y.target.value}),placeholder:"Why is this campaign custom?"})]}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",className:"grid md:grid-cols-4 gap-3",children:[e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",value:a.campaignTheme,onChange:y=>o({...a,campaignTheme:y.target.value}),placeholder:"Programme or theme"}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",className:"h-10 px-3 border border-gray-200 rounded-md text-sm bg-white",value:a.campaignIntake,onChange:y=>o({...a,campaignIntake:y.target.value}),children:[wr.map(y=>e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",value:y,children:y},y)),e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",value:"custom",children:"custom"})]}),e.jsx("select",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",className:"h-10 px-3 border border-gray-200 rounded-md text-sm bg-white",value:a.campaignObjective,onChange:y=>o({...a,campaignObjective:y.target.value}),children:Cr.map(y=>e.jsx("option",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",value:y,children:y},y))}),e.jsx(A,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:235",type:"month",value:`${a.campaignPeriod.slice(0,4)}-${a.campaignPeriod.slice(4)}`,onChange:y=>o({...a,campaignPeriod:y.target.value.replace("-","")})})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:236",className:"font-mono text-xs bg-[#EEF2FF] text-[#0B00E4] rounded-md p-2",children:["utm_campaign=",N]})]})]}),r&&e.jsx("section",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",className:"bg-[#EEF2FF] border border-[#0B00E4]/20 rounded-xl p-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",className:"flex items-center gap-2 font-bold text-[#111111]",children:[e.jsx(Oe,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",size:16,className:"text-[#0B00E4]"})," Campaign Link Ready"]}),e.jsxs("a",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",href:r,target:"_blank",rel:"noreferrer",className:"text-xs font-mono text-[#0B00E4] break-all mt-2 inline-flex items-center gap-1 hover:underline",children:[r,e.jsx(_e,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",size:12})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",className:"text-xs text-gray-600 mt-2",children:"QR codes encode this direct URL. Verify stale-destination warnings before reprinting physical material."})]}),e.jsx(Ps,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:240",finalUrl:r,fileStem:a.name||"aventis-campaign"})]})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:242",className:"flex justify-end gap-2 pb-6",children:[e.jsx(T,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:242",variant:"outline",onClick:s,children:"Cancel"}),e.jsxs(T,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:242",onClick:()=>P(!1),disabled:U,className:"bg-[#0B00E4] hover:bg-[#0900b8] text-white gap-2",children:[U?e.jsx(oe,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:242",size:16,className:"animate-spin"}):e.jsx($e,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:242",size:16}),t===null?"Create Campaign Link":"Save Changes"]})]}),e.jsx(kt,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:244",open:n!==null,onOpenChange:y=>{y||l(null)},children:e.jsxs(Ct,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:245",children:[e.jsxs(wt,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:246",children:[e.jsx(Et,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:246",children:"Similar campaign link already exists"}),e.jsx(St,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:246",children:"A matching active link was found. This can be intentional, but review it before creating another record."})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:247",className:"space-y-2 max-h-44 overflow-y-auto",children:n?.map(y=>e.jsxs("a",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:247",href:y.finalUrl,target:"_blank",rel:"noreferrer",className:"block border border-gray-200 rounded-md p-2 text-sm hover:border-[#0B00E4]",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:247",children:y.name}),e.jsx("span",{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:247",className:"block text-xs text-gray-500 truncate mt-1",children:y.finalUrl})]},y.id))}),e.jsxs(Pt,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:248",children:[e.jsx(Ft,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:248",children:"Go back"}),e.jsx(Lt,{"data-loc":"client/src/components/dashboard/UtmLinkEditor.tsx:248",onClick:()=>{l(null),P(!0)},className:"bg-[#0B00E4] hover:bg-[#0900b8] text-white",children:"Create anyway"})]})]})})]})}const fa={meta:{label:"Meta Lead Ads",description:"Facebook and Instagram Instant Form submissions.",webhookPath:"/api/webhooks/meta/lead",available:!0},linkedin:{label:"LinkedIn Lead Gen Forms",description:"Visible for planning; connection is not configured in this release.",webhookPath:"/api/webhooks/linkedin/lead",available:!1},tiktok:{label:"TikTok Lead Generation",description:"Visible for planning; connection is not configured in this release.",webhookPath:"/api/webhooks/tiktok/lead",available:!1}};function Ss({health:t}){const s={not_configured:{label:"Not configured",className:"bg-[#EEF2FF] text-[#0B00E4]",Icon:ps},needs_verification:{label:"Needs verification",className:"bg-amber-50 text-amber-800 border border-amber-200",Icon:Ze},attention:{label:"Needs attention",className:"bg-red-50 text-red-700 border border-red-200",Icon:Ze},healthy:{label:"Healthy",className:"bg-emerald-50 text-emerald-700 border border-emerald-200",Icon:fe}}[t];return e.jsxs("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:23",className:te("inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-semibold",s.className),children:[e.jsx(s.Icon,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:23",size:13}),s.label]})}function Sr(){const t=v.useUtils(),{data:s=[],isLoading:a}
5=v.paidSources.list.useQuery(),[o,n]=d.useState(null),[l,r]=d.useState(null),i=s.find(f=>f.id===l)??null,x=d.useMemo(()=>Object.keys(fa).map(f=>({platform:f,meta:fa[f],source:s.find(c=>c.platform===f)??null})),[s]);if(a)return e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:34",className:"p-6",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:34",className:"flex items-center gap-2 text-sm text-[#111111]",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:34",className:"animate-spin text-[#0B00E4]",size:18})," Loading paid lead sourcesâ¦"]})});if(o){const f=s.find(c=>c.platform===o)??null;return e.jsx(Lr,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:37",source:f,platform:o,onBack:()=>n(null),onSaved:c=>{r(c),n(null),t.paidSources.list.invalidate()}})}return i?e.jsx(Fr,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:39",source:i,onBack:()=>r(null),onEdit:()=>n(i.platform)}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:41",className:"p-6 max-w-6xl w-full space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:42",className:"flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:42",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:42",className:"text-xs font-bold tracking-[0.14em] text-[#0B00E4] uppercase",children:"Inbound acquisition"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:42",className:"mt-1 text-2xl font-bold text-[#111111]",children:"Paid Lead Sources"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:42",className:"mt-1 max-w-2xl text-sm text-[#4B5563]",children:"Connect approved paid-form sources to the same contact and lead-event model used by the website. Meta is the first available provider."})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:42",className:"rounded-lg border border-[#0B00E4] bg-white px-3 py-2 text-xs font-medium text-[#0B00E4]",children:"Every inbound lead is normalised before it becomes WATI-eligible."})]}),e.jsx("section",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"grid gap-4 lg:grid-cols-3",children:x.map(({platform:f,meta:c,source:k})=>e.jsxs("article",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"rounded-2xl border border-[#E5E7EB] bg-white p-5 shadow-sm",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"flex items-start justify-between gap-3",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"flex h-10 w-10 items-center justify-center rounded-xl bg-[#0B00E4] text-white",children:f==="meta"?e.jsx(So,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",size:20}):f==="linkedin"?e.jsx(Je,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",size:20}):e.jsx(Lo,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",size:20})}),e.jsx(Ss,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",health:k?.health??"not_configured"})]}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"mt-5 font-bold text-[#111111]",children:c.label}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"mt-1 min-h-10 text-sm leading-5 text-[#6B7280]",children:c.description}),k&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"mt-4 rounded-lg bg-[#EEF2FF] px-3 py-2 text-xs text-[#111111]",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"font-semibold",children:k.mappingCount})," form mapping",k.mappingCount===1?"":"s"," · ",e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"font-semibold",children:k.failedCount})," failed delivery",k.failedCount===1?"":"ies"]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"mt-5 flex gap-2",children:[k&&e.jsx("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",onClick:()=>r(k.id),className:"flex-1 rounded-lg border border-[#0B00E4] px-3 py-2 text-sm font-semibold text-[#0B00E4] transition-colors hover:bg-[#
5EEF2FF]",children:"View source"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",disabled:!c.available,onClick:()=>n(f),className:te("rounded-lg px-3 py-2 text-sm font-semibold transition-colors",c.available?"bg-[#0B00E4] text-white hover:bg-[#0900bc]":"cursor-not-allowed bg-[#E5E7EB] text-[#6B7280]"),children:k?e.jsx(is,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",size:16}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:43",className:"mr-1 inline",size:16})," Configure"]})})]})]},f))}),e.jsx("section",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",className:"rounded-2xl border border-[#E5E7EB] bg-white p-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",className:"flex items-start gap-3",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",className:"mt-0.5 text-[#0B00E4]",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",className:"font-bold text-[#111111]",children:"Connection safety"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",className:"mt-1 text-sm leading-6 text-[#4B5563]",children:["Provider credentials remain server-side. A source stays disabled until its webhook verification, form mapping, and test delivery have been checked. Unmapped forms are retained as ",e.jsx("code",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:44",className:"rounded bg-[#EEF2FF] px-1 py-0.5 text-[#0B00E4]",children:"needs_mapping"})," rather than becoming incomplete leads."]})]})]})})]})}function Lr({source:t,platform:s,onBack:a,onSaved:o}){const n=v.useUtils(),l=fa[s],[r,i]=d.useState(t?.label??`${l.label} â Primary`),[x,f]=d.useState(t?.credentialProfile??`${s}_primary`),[c,k]=d.useState(t?.externalAccountId??""),[E,N]=d.useState(!!t?.isEnabled),[g,C]=d.useState(null),b=v.paidSources.create.useMutation(),W=v.paidSources.update.useMutation(),j=b.isPending||W.isPending;async function P(){C(null);try{const U={label:r,credentialProfile:x,externalAccountId:c||null,webhookPath:l.webhookPath,isEnabled:E},y=t?await W.mutateAsync({id:t.id,data:U}):await b.mutateAsync({platform:s,...U});await n.paidSources.list.invalidate(),o(y.id)}catch(U){C(U instanceof Error?U.message:"Unable to save source.")}}return e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"p-6 max-w-3xl w-full space-y-6",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",onClick:a,className:"inline-flex items-center gap-1 text-sm font-semibold text-[#0B00E4]",children:[e.jsx(ms,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",size:16})," Back to paid sources"]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"text-xs font-bold tracking-[0.14em] text-[#0B00E4] uppercase",children:l.label}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"mt-1 text-2xl font-bold text-[#111111]",children:t?"Configure source":"Add source"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"rounded-2xl border border-[#E5E7EB] bg-white p-6 space-y-5",children:[e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",label:"Internal label",value:r,onChange:i}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",label:"Credential profile",value:x,onChange:f,help:"A reference label only. Tokens are stored as protected server secrets, not here."}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",label:"Meta Page / account ID",value:c,onChange:k,help:"Required before this source can be verified."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"text-sm font-semibold text-[#111111]",children:"Webhook callback URL"}),e.jsxs("code",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"mt-2 block overflow-x-auto rounded-lg bg-[#EEF2FF] px-3 py-2 text-xs text-[#0B00E4]",children:[typeof window>"u"?"":window.location.origin,l.webhookPath]})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"flex cursor-pointer items-start gap-3 rounded-lg border border-[#
5E5E7EB] p-4",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",type:"checkbox",checked:E,onChange:U=>N(U.target.checked),className:"mt-1 h-4 w-4 accent-[#0B00E4]"}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"block text-sm font-semibold text-[#111111]",children:"Enable source after verification"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"mt-1 block text-xs leading-5 text-[#6B7280]",children:"Leave off until the Meta callback, credentials, mapping, and test lead are confirmed."})]})]}),g&&e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"text-sm text-red-600",children:g}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"flex justify-end gap-3",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",onClick:a,className:"rounded-lg border border-[#E5E7EB] px-4 py-2 text-sm font-semibold text-[#111111]",children:"Cancel"}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",disabled:j,onClick:P,className:"inline-flex items-center gap-2 rounded-lg bg-[#0B00E4] px-4 py-2 text-sm font-semibold text-white disabled:opacity-60",children:[j?e.jsx(oe,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",className:"animate-spin",size:16}):e.jsx($e,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:70",size:16})," Save source"]})]})]})]})}function Fr({source:t,onBack:s,onEdit:a}){const o=v.useUtils(),{data:n,isLoading:l}=v.paidSources.get.useQuery({id:t.id}),{data:r=[]}=v.paidSources.recentEvents.useQuery({sourceId:t.id,limit:20}),{data:i=[]}=v.paidSources.programmeOptions.useQuery(),x=v.paidSources.discoverMetaForms.useQuery({sourceId:t.id},{enabled:!1}),[f,c]=d.useState(!1),[k,E]=d.useState(""),[N,g]=d.useState(""),[C,b]=d.useState("email"),[W,j]=d.useState("full_name"),[P,U]=d.useState("phone_number"),[y,V]=d.useState("dedicated"),[p,u]=d.useState(""),[S,m]=d.useState(""),[$,G]=d.useState([{answer:"",programmeCode:""}]),[B,K]=d.useState(""),[ne,_]=d.useState(null),O=v.paidSources.createMapping.useMutation(),q=x.data??[],ge=I=>{const w=i.find(H=>H.programmeCode===I);return w?`${w.displayTitle} · ${w.programmeCode}`:I};function pe(I){g(I.id),E(I.name||`Meta Instant Form ${I.id}`);const w=(I.questions??[]).map(H=>String(H.key??H.label??"").trim().toLowerCase());w.includes("email")&&b("email"),w.includes("full_name")&&j("full_name"),w.includes("phone_number")&&U("phone_number"),c(!0),_(null)}async function ce(){_(null);const I={[C]:"email",[W]:"name",[P]:"rawPhone"},w=Object.fromEntries($.filter(H=>H.answer.trim()&&H.programmeCode).map(H=>[H.answer.trim(),H.programmeCode]));try{await O.mutateAsync({sourceId:t.id,externalFormId:N,label:k,fieldMapping:I,programmeResolutionMode:y,programmeFieldKey:y==="selection"&&S||null,programmeValueMap:y==="selection"?w:null,defaultProgrammeCode:y==="dedicated"&&p||null,defaultCountry:B||null,isEnabled:!0,utmLinkId:null}),c(!1),E(""),g(""),u(""),m(""),G([{answer:"",programmeCode:""}]),await o.paidSources.get.invalidate({id:t.id}),await o.paidSources.list.invalidate()}catch(H){_(H instanceof Error?H.message:"Unable to save mapping.")}}const he=!!(k&&N&&C&&W&&(y==="dedicated"?p:S&&$.some(I=>I.answer.trim()&&I.programmeCode)));return l||!n?e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:134",className:"p-6",children:e.jsx(oe,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:134",className:"animate-spin text-[#0B00E4]",size:20})}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:136",className:"p-6 max-w-6xl w-full space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:137",className:"flex items-center justify-between gap-4",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:137",onClick:s,className:"inline-flex items-center gap-1 text-sm font-semibold text-[#0B00E4]",children:[e.jsx(ms,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:137",size:16})," Back to paid sources"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:137",onClick:a,className:"inline-flex items-center gap-2 rounded-lg border border-[#0B00E4] px-3 py-2 text-sm font-semibold text-[#0B00E4]",children:[e.jsx(is,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:137",size:16})," Configure source"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",className:"rounded-2xl border border-[#
5E5E7EB] bg-white p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",className:"flex flex-wrap items-start justify-between gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",className:"text-xs font-bold tracking-[0.14em] text-[#0B00E4] uppercase",children:n.platform}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",className:"mt-1 text-2xl font-bold text-[#111111]",children:n.label}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",className:"mt-1 text-sm text-[#6B7280]",children:["Profile: ",n.credentialProfile]})]}),e.jsx(Ss,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",health:n.health})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",className:"mt-5 grid gap-3 sm:grid-cols-3",children:[e.jsx(la,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",label:"Mappings",value:n.mappings.length}),e.jsx(la,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",label:"Received",value:n.lastReceivedAt?new Date(n.lastReceivedAt).toLocaleDateString():"â"}),e.jsx(la,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:138",label:"Last processed",value:n.lastProcessedAt?new Date(n.lastProcessedAt).toLocaleDateString():"â"})]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",className:"rounded-2xl border border-[#E5E7EB] bg-white p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",className:"font-bold text-[#111111]",children:"External form mappings"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",className:"mt-1 text-sm text-[#6B7280]",children:"Sync existing Meta Instant Forms, then approve how each form resolves an Aventis programme."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",className:"flex gap-2",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",disabled:x.isFetching||n.platform!=="meta",onClick:()=>x.refetch(),className:"inline-flex items-center gap-2 rounded-lg border border-[#0B00E4] px-3 py-2 text-sm font-semibold text-[#0B00E4] disabled:opacity-50",children:[x.isFetching?e.jsx(oe,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",className:"animate-spin",size:16}):e.jsx(We,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",size:16})," Sync Meta Forms"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",onClick:()=>c(I=>!I),className:"inline-flex items-center gap-2 rounded-lg bg-[#0B00E4] px-3 py-2 text-sm font-semibold text-white",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:139",size:16})," Add mapping"]})]})]}),x.error&&e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:140",className:"mt-4 rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:x.error.message}),q.length>0&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"mt-5 rounded-xl border border-[#0B00E4] bg-[#EEF2FF] p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"font-semibold text-[#111111]",children:"Discovered Meta forms"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"mt-1 text-xs text-[#4B5563]",children:"Select a form to prefill a draft mapping. It will not be activated until you save and later enable the source."})]}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"rounded-full bg-white px-2 py-1 text-xs font-semibold text-[#0B00E4]",children:[q.length," found"]}
5)]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"mt-3 grid gap-2",children:q.map(I=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",onClick:()=>pe(I),className:"flex items-center justify-between gap-4 rounded-lg border border-white bg-white px-3 py-3 text-left transition-colors hover:border-[#0B00E4]",children:[e.jsxs("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"block text-sm font-semibold text-[#111111]",children:I.name||"Untitled Meta form"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"mt-0.5 block font-mono text-xs text-[#4B5563]",children:I.id})]}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:141",className:"text-xs font-semibold text-[#0B00E4]",children:"Use this form â"})]},I.id))})]}),f&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",className:"mt-5 rounded-xl border border-[#0B00E4] bg-[#EEF2FF] p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",label:"Mapping label",value:k,onChange:E}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",label:"Meta form ID",value:N,onChange:g}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",label:"Email field label",value:C,onChange:b}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",label:"Full name field label",value:W,onChange:j}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",label:"Phone field label",value:P,onChange:U}),e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:142",label:"Default country (optional)",value:B,onChange:K,help:"Use only for a confirmed single-country campaign; otherwise leave blank."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:"mt-5 rounded-xl border border-[#0B00E4] bg-white p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:"text-sm font-bold text-[#111111]",children:"Programme Resolution"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:"mt-1 text-xs leading-5 text-[#4B5563]",children:"Both paths produce one permanent Aventis programme code for CRM and attribution."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:"mt-4 space-y-3",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:te("flex cursor-pointer gap-3 rounded-lg border p-3",y==="dedicated"?"border-[#0B00E4]":"border-[#E5E7EB]"),children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",type:"radio",checked:y==="dedicated",onChange:()=>V("dedicated"),className:"mt-1 accent-[#0B00E4]"}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:"block text-sm font-semibold text-[#111111]",children:"This form represents one programme"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",className:"mt-1 block text-xs text-[#4B5563]",children:"Use for a dedicated campaign, such as the MSc HRM & Org Psychology form."})]})]}),y==="dedicated"&&e.jsx(Br,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:143",label:"Select programme",value:p,onChange:u,programmes:i}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:te("flex cursor-pointer gap-3 rounded-lg border p-3",y==="selection"?"border-[#0B00E4]":"border-[#
5E5E7EB]"),children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",type:"radio",checked:y==="selection",onChange:()=>V("selection"),className:"mt-1 accent-[#0B00E4]"}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"block text-sm font-semibold text-[#111111]",children:"This form asks the prospect to select a programme"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"mt-1 block text-xs text-[#4B5563]",children:"Use for one form that supports several Aventis programmes."})]})]}),y==="selection"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"space-y-3 pl-7",children:[e.jsx(Ve,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",label:"Select programme field",value:S,onChange:m,placeholder:"programme_interest"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"text-sm font-semibold text-[#111111]",children:"Configure value mapping"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"mt-1 text-xs text-[#4B5563]",children:"Map each exact Meta answer to the permanent Aventis programme."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"mt-3 space-y-2",children:$.map((I,w)=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",className:"grid gap-2 sm:grid-cols-[1fr_1fr_auto]",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",value:I.answer,onChange:H=>G(L=>L.map((X,Ee)=>Ee===w?{...X,answer:H.target.value}:X)),placeholder:"Meta answer, e.g. MBA",className:"rounded-lg border border-[#E5E7EB] px-3 py-2 text-sm text-[#111111]"}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",value:I.programmeCode,onChange:H=>G(L=>L.map((X,Ee)=>Ee===w?{...X,programmeCode:H.target.value}:X)),className:"rounded-lg border border-[#E5E7EB] bg-white px-3 py-2 text-sm text-[#111111]",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",value:"",children:"Select Aventis programme"}),i.map(H=>e.jsx("option",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",value:H.programmeCode,children:ge(H.programmeCode)},H.programmeCode))]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",type:"button",onClick:()=>G(H=>H.length>1?H.filter((L,X)=>X!==w):H),className:"rounded-lg border border-[#E5E7EB] px-3 py-2 text-xs font-semibold text-[#111111]",children:"Remove"})]},w))}),e.jsx("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:144",type:"button",onClick:()=>G(I=>[...I,{answer:"",programmeCode:""}]),className:"mt-3 text-sm font-semibold text-[#0B00E4]",children:"+ Add programme answer"})]})]})]})]}),ne&&e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:145",className:"mt-4 text-sm text-red-600",children:ne}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:145",className:"mt-5 flex justify-end gap-3",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:145",onClick:()=>c(!1),className:"rounded-lg border border-[#0B00E4] px-3 py-2 text-sm font-semibold text-[#0B00E4]",children:"Cancel"}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:145",disabled:O.isPending||!he,onClick:ce,className:"inline-flex items-center gap-2 rounded-lg bg-[#0B00E4] px-3 py-2 text-sm font-semibold text-white disabled:opacity-50",children:[O.isPending&&e.jsx(oe,{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:145",size:16,className:"animate-spin"})," Save mapping"]})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"mt-5 overflow-x-auto",children:e.jsxs("table",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"w-full min-w-[720px] text-left text-sm",children:[e.jsx("thead",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"border-b border-[#
5E5E7EB] text-xs uppercase tracking-wide text-[#6B7280]",children:e.jsxs("tr",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",children:[e.jsx("th",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"pb-3 pr-4",children:"Mapping"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"pb-3 pr-4",children:"External form"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"pb-3 pr-4",children:"Programme resolution"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"pb-3",children:"Status"})]})}),e.jsx("tbody",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",children:n.mappings.length===0?e.jsx("tr",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",children:e.jsx("td",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",colSpan:4,className:"py-8 text-center text-[#6B7280]",children:"No form mappings yet. Sync Meta Forms or add one before enabling the source."})}):n.mappings.map(I=>e.jsxs("tr",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"border-b border-[#F3F4F6]",children:[e.jsx("td",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"py-3 pr-4 font-medium text-[#111111]",children:I.label}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"py-3 pr-4 font-mono text-xs text-[#4B5563]",children:I.externalFormId}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"py-3 pr-4 text-xs text-[#4B5563]",children:I.programmeResolutionMode==="selection"?`${I.programmeFieldKey||"Programme field"} · ${Object.keys(I.programmeValueMap??{}).length} answers`:ge(I.defaultProgrammeCode||"No programme")}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:"py-3",children:e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:146",className:te("rounded-full px-2 py-1 text-xs font-semibold",I.isEnabled?"bg-emerald-50 text-emerald-700":"bg-[#EEF2FF] text-[#0B00E4]"),children:I.isEnabled?"Enabled":"Disabled"})})]},I.id))})]})})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:"rounded-2xl border border-[#E5E7EB] bg-white p-6",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:"font-bold text-[#111111]",children:"Recent deliveries"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:"mt-4 space-y-2",children:r.length===0?e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:"py-4 text-sm text-[#6B7280]",children:"No webhook deliveries recorded for this source."}):r.map(I=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border border-[#E5E7EB] px-3 py-2 text-sm",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:"font-mono text-xs text-[#4B5563]",children:I.platformEventId}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:148",className:te("rounded-full px-2 py-1 text-xs font-semibold",I.status==="processed"?"bg-emerald-50 text-emerald-700":I.status==="needs_mapping"?"bg-amber-50 text-amber-800":I.status==="failed"?"bg-red-50 text-red-700":"bg-[#EEF2FF] text-[#0B00E4]"),children:I.status})]},I.id))})]})]})}function Br({label:t,value:s,onChange:a,programmes:o}){return e.jsxs("label",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:153",className:"block pl-7",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:153",className:"text-sm font-semibold text-[#111111]",children:t}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:153",value:s,onChange:n=>a(n.target.value),className:"mt-1.5 w-full rounded-lg border border-[#
5E5E7EB] bg-white px-3 py-2 text-sm text-[#111111] outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/20",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:153",value:"",children:"Select an Aventis programme"}),o.map(n=>e.jsxs("option",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:153",value:n.programmeCode,children:[n.displayTitle," · ",n.programmeCode]},n.programmeCode))]})]})}function Ve({label:t,value:s,onChange:a,help:o,placeholder:n}){return e.jsxs("label",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:156",className:"block",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:156",className:"text-sm font-semibold text-[#111111]",children:t}),e.jsx("input",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:156",value:s,onChange:l=>a(l.target.value),placeholder:n,className:"mt-1.5 w-full rounded-lg border border-[#E5E7EB] px-3 py-2 text-sm text-[#111111] outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/20"}),o&&e.jsx("span",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:156",className:"mt-1 block text-xs leading-5 text-[#6B7280]",children:o})]})}function la({label:t,value:s}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:157",className:"rounded-xl bg-[#EEF2FF] px-4 py-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:157",className:"text-xs font-semibold uppercase tracking-wide text-[#0B00E4]",children:t}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PaidLeadSources.tsx:157",className:"mt-1 truncate text-sm font-bold text-[#111111]",children:s})]})}const Oa=["all","new","contacted","consultation_scheduled","application_submitted","no_response","unqualified","lost"],Gt=t=>t.replaceAll("_"," ");function Ar(){const t=v.useUtils(),[s,a]=d.useState(""),[o,n]=d.useState("all"),[l,r]=d.useState(null),[i,x]=d.useState(""),f=d.useMemo(()=>({search:s||void 0,workflowState:o,limit:50}),[s,o]),c=v.leadInbox.list.useQuery(f),k=v.leadInbox.detail.useQuery({contactId:l},{enabled:l!==null}),E=v.leadInbox.consultants.useQuery(),N=()=>{t.leadInbox.list.invalidate(),l&&t.leadInbox.detail.invalidate({contactId:l})},g=v.leadInbox.changeWorkflow.useMutation({onSuccess:N}),C=v.leadInbox.assignConsultant.useMutation({onSuccess:N}),b=v.leadInbox.addNote.useMutation({onSuccess:()=>{x(""),N()}}),W=v.leadInbox.export.useQuery(f,{enabled:!1}),j=async()=>{const U=(await W.refetch()).data??[],y=Object.keys(U[0]??{}),V=[y.join(","),...U.map(S=>y.map(m=>JSON.stringify(String(S[m]??""))).join(","))].join(` 6`),p=URL.createObjectURL(new Blob([V],{type:"text/csv"})),u=document.createElement("a");u.href=p,u.download="aventis-leads.csv",u.click(),URL.revokeObjectURL(p)};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:33",className:"p-6 max-w-[1500px] mx-auto space-y-5 w-full",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",className:"flex flex-col md:flex-row gap-4 md:items-end justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",className:"text-xs uppercase tracking-[.18em] text-[#0B00E4] font-semibold",children:"Leads"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",className:"text-2xl font-bold text-[#111111]",children:"Lead Inbox"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",className:"text-sm text-gray-500 mt-1",children:"Programme context, ownership and activity in one operational view."})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",onClick:j,className:"border border-[#0B00E4] text-[#0B00E4] px-4 py-2 rounded-lg text-sm font-semibold inline-flex items-center gap-2",children:[e.jsx(yt,{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:34",size:16}),"Export CSV"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",className:"bg-[#EEF2FF] rounded-xl p-3 grid grid-cols-1 md:grid-cols-[1fr_220px] gap-3",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",className:"bg-white rounded-lg px-3 flex items-center gap-2",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",size:16,className:"text-[#0B00E4]"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",value:s,onChange:P=>a(P.target.value),placeholder:"Search name, email or phone",className:"w-full py-2.5 outline-none text-sm"})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",value:o,onChange:P=>n(P.target.value),className:"bg-white rounded-lg px-3 text-sm capitalize",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",value:"all",children:"All workflow states"}),Oa.slice(1).map(P=>e.jsx("option",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:35",value:P,children:Gt(P)},P))]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"grid grid-cols-1 xl:grid-cols-[minmax(0,1.25fr)_minmax(360px,.75fr)] gap-5",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"border border-gray-200 rounded-xl overflow-hidden bg-white",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"grid grid-cols-[1.3fr_1fr_120px] gap-3 px-4 py-3 border-b text-[11px] uppercase font-semibold tracking-wider text-gray-500",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",children:"Lead"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",children:"Programme / campaign"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",children:"Workflow"})]}),c.isLoading?e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"p-8 text-sm text-gray-500",children:"Loadingâ¦"}):c.data?.length?c.data.map(P=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",onClick:()=>r(P.id),className:`w-full text-left grid grid-cols-[1.3fr_1fr_120px] gap-3 px-4 py-4 border-b hover:bg-[#
6EEF2FF] ${P.id===l?"bg-[#EEF2FF]":""}`,children:[e.jsxs("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"min-w-0",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"block text-sm truncate",children:P.name}),e.jsx("small",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"block text-xs text-gray-500 truncate",children:P.email}),e.jsx("small",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"block text-xs text-gray-400",children:P.consultantName??"Unassigned"})]}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"min-w-0",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"block text-sm truncate",children:P.programmeInterested??"No programme"}),e.jsx("small",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"block text-xs text-gray-500 truncate",children:P.firstTouchUtmCampaign??P.firstTouchType})]}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"text-xs capitalize",children:[e.jsx("b",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"inline-block bg-[#0B00E4] text-white px-2 py-1 rounded",children:Gt(P.workflowState)}),e.jsx("small",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"block text-gray-400 mt-2",children:P.phoneStatus})]})]},P.id)):e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:36",className:"p-8 text-sm text-gray-500",children:"No matching leads."})]}),e.jsx("aside",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"border border-gray-200 rounded-xl bg-white p-5 min-h-[420px]",children:l?k.isLoading?e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-sm text-gray-500",children:"Loading leadâ¦"}):k.data?e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-lg font-bold",children:k.data.contact.name}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-sm text-gray-500",children:k.data.contact.email}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-xs text-gray-500 mt-1",children:[k.data.contact.phoneE164??k.data.contact.rawPhone??"No phone"," · ",k.data.contact.phoneStatus]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"grid gap-3",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-xs uppercase tracking-wider text-gray-500 font-semibold",children:["Workflow",e.jsx("select",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",value:k.data.contact.workflowState,onChange:P=>g.mutate({contactId:l,state:P.target.value}),className:"mt-1 w-full border rounded-lg p-2 text-sm capitalize",children:Oa.slice(1).map(P=>e.jsx("option",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",value:P,children:Gt(P)},P))})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-xs uppercase tracking-wider text-gray-500 font-semibold",children:["Consultant",e.jsxs("select",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",value:k.data.contact.assignedConsultantId??"",onChange:P=>C.mutate({contactId:l,consultantId:P.target.value?Number(P.target.value):null}),className:"mt-1 w-full border rounded-lg p-2 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",value:"",children:"Unassigned"}),E.data?.map(P=>e.jsx("option",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",value:P.id,children:P.name},P.id))]})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"border-t pt-4",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-sm font-semibold mb-2",children:"Programme inquiries"}),k.data.inquiries.length?k.data.inquiries.map(P=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"border-l-2 border-[#0B00E4] pl-3 py-1 mb-2 text-xs",children:[e.jsx("b",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",children:P.title??P.programmeSlug}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"block text-gray-500 capitalize",children:[Gt(P.workflowState)," · Cycle ",P.cycleNumber," · ",P.ownerName??"Unassigned"]})]},P.id)):e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-xs text-gray-500",children:"No inquiry records yet."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"border-t pt-4",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-sm font-semibold mb-2",children:"Internal note"}),e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",value:i,onChange:P=>x(P.target.value),className:"w-full border rounded-lg p-2 text-sm min-h-20",placeholder:"Visible internally only"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",disabled:!i.trim()||b.isPending,onClick:()=>b.mutate({contactId:l,body:i}),className:"mt-2 bg-[#0B00E4] text-white px-3 py-2 rounded-lg text-sm font-semibold disabled:opacity-50",children:"Save note"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"border-t pt-4",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-sm font-semibold mb-2",children:"Recent activity"}),k.data.events.slice(0,12).map(P=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-xs mb-2",children:[e.jsx("b",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",children:P.source}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"block text-gray-500",children:[P.programmeSlug??"No programme"," · ",new Date(P.createdAt).toLocaleStr
6ing()]})]},P.id))]}),k.data.contact.phoneStatus==="normalised"&&e.jsxs("a",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",href:`https://wa.me/${k.data.contact.phoneE164?.replace(/\D/g,"")??""}`,target:"_blank",rel:"noreferrer",className:"text-[#0B00E4] text-sm font-semibold inline-flex gap-2 items-center",children:[e.jsx(Bo,{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",size:16}),"Open WhatsApp"]})]}):e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"text-sm text-red-600",children:"Lead not found."}):e.jsx("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"min-h-[330px] flex items-center justify-center text-center text-sm text-gray-500",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",children:[e.jsx(Fo,{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",className:"mx-auto mb-3 text-[#0B00E4]"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LeadInbox.tsx:37",children:"Select a lead to see programme inquiries and history."})]})})})]})]})}function Wr(){const t=v.useUtils(),[s,a]=d.useState(""),[o,n]=d.useState(""),l=v.emailNurture.list.useQuery();v.emailNurture.deliveryStatus.useQuery();const r=v.emailNurture.create.useMutation({onSuccess:()=>{a(""),n(""),t.emailNurture.list.invalidate()}}),i=v.emailNurture.setStatus.useMutation({onSuccess:()=>t.emailNurture.list.invalidate()});return e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"p-6 max-w-[1300px] mx-auto space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-xs uppercase tracking-[.18em] font-semibold text-[#0B00E4]",children:"Outreach"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-2xl font-bold text-[#111111]",children:"Email Nurture"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-sm text-gray-500 mt-1",children:"Programme-led sequences with manual enrolment and controlled delivery safeguards."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"border border-amber-300 bg-amber-50 rounded-xl p-4 flex gap-3",children:[e.jsx(Ze,{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-amber-700 shrink-0"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-sm text-[#111111]",children:"Delivery remains inactive"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-sm text-gray-600",children:"Mailgun credentials, DNS authentication, and approved pilot activation are required before any external email can be sent."})]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"grid grid-cols-1 lg:grid-cols-[.8fr_1.2fr] gap-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"border rounded-xl p-5 bg-white",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"font-semibold mb-4",children:"Create draft sequence"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"space-y-3",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",value:s,onChange:x=>a(x.target.value),placeholder:"Sequence name",className:"w-full border rounded-lg p-2.5 text-sm"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",value:o,onChange:x=>n(x.target.value),placeholder:"Programme slug",className:"w-full border rounded-lg p-2.5 text-sm"}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",disabled:!s.trim()||!o.trim()||r.isPending,onClick:()=>r.mutate({name:s,programmeSlug:o}),className:"w-full bg-[#0B00E4] text-white rounded-lg px-4 py-2.5 font-semibold text-sm disabled:opacity-50 inline-flex justify-center gap-2",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",size:16}),"Create draft"]})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"border rounded-xl overflow-hidden bg-white",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"px-5 py-4 border-b flex items-center gap-2",children:[e.jsx(Na,{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-[#0B00E4]",size:18}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"font-semibold",children:"Sequences"})]}),l.isLoading?e.jsx("p",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"p-5 text-sm text-gray-500",children:"Loadingâ¦"}):l.data?.length?e.jsx("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",children:l.data.map(x=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"p-5 border-b flex flex-col sm:flex-row gap-3 sm:items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"block text-sm",children:String(x.name)}),e.jsxs("small",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"text-gray-500",children:[String(x.programmeSlug)," · ",String(x.status)]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"flex gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",onClick:()=>i.mutate({id:Number(x.id),status:"review"}),className:"text-xs border rounded px-3 py-1.5",children:"Review"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",onClick:()=>i.mutate({id:Number(x.id),status:"paused"}),className:"text-xs border rounded px-3 py-1.5",children:"Pause"})]})]},String(x.id)))}):e.jsx("p",{"data-loc":"client/src/components/dashboard/EmailNurture.tsx:13",className:"p-5 text-sm text-gray-500",children:"No sequences yet. Create a draft; activation remains disabled until Mailgun is verified."})]})]})]})}function Mr(){const t=v.useUtils(),[s,a]=d.useState(""),[o,n]=d.use
6State(""),[l,r]=d.useState(null),[i,x]=d.useState(null),[f,c]=d.useState(""),[k,E]=d.useState([]),[N,g]=d.useState(null),C=v.whatsappAutomation.deliveryStatus.useQuery(),b=v.whatsappAutomation.list.useQuery(),W=d.useMemo(()=>b.data?.find(m=>m.id===l)??null,[b.data,l]),j=v.whatsappAutomation.versions.useQuery({sequenceId:l??0},{enabled:!!l}),P=v.whatsappAutomation.create.useMutation({onSuccess:async m=>{await t.whatsappAutomation.list.invalidate(),r(m.sequenceId),x(m.versionId),a(""),n(""),g("Draft sequence created. Version 1 is inactive and contains no message until you add the approved template.")},onError:m=>g(m.message)}),U=v.whatsappAutomation.replaceDraftSteps.useMutation({onSuccess:()=>g("The approved template and its two required variables are now configured on this draft version."),onError:m=>g(m.message)}),y=v.whatsappAutomation.setVersionStatus.useMutation({onSuccess:()=>{j.refetch(),g("Draft moved to review. Approval and activation remain staff-controlled.")},onError:m=>g(m.message)}),V=v.whatsappAutomation.dryRun.useMutation({onSuccess:m=>{E(m),g("Pilot preflight completed. Nothing was enrolled or sent.")},onError:m=>{E([]),g(m.message)}}),p=()=>[...new Set(f.split(/[\s,]+/).map(Number).filter(m=>Number.isInteger(m)&&m>0))],u=!C.data?.readiness.enabled,S=j.data?.find(m=>m.id===i)??null;return e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:52",className:"p-6 max-w-6xl space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:53",className:"flex flex-col lg:flex-row lg:items-end justify-between gap-4 border-b-2 border-[#111111] pb-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:54",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:55",className:"text-xs font-bold tracking-[0.16em] text-[#0B00E4] uppercase",children:"B15 · Pilot foundation"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:56",className:"mt-1 text-3xl font-bold text-[#111111]",children:"WhatsApp Automation"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:57",className:"mt-2 max-w-2xl text-sm text-[#111111]",children:"Controlled WATI template sequences for already consented contacts. Replies hand off to WATI; the Dashboard does not replace the consultant inbox. A Dashboard opt-out stops all future automation immediately; staff then apply WATI Spam & Block manually."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:59",className:"flex items-center gap-2 border border-[#111111] px-3 py-2 text-xs font-semibold text-[#111111]",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:60",size:16,className:"text-[#0B00E4]"}),"Pilot cap: ",C.data?.settings.pilotRecipientLimit??20," recipients"]})]}),u?e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:66",className:"border-2 border-[#0B00E4] bg-[#EEF2FF] p-4 flex gap-3",children:[e.jsx(Ze,{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:67",className:"text-[#0B00E4] shrink-0",size:20}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:68",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:69",className:"font-bold text-[#111111]",children:"WATI delivery is inactive"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:70",className:"text-sm text-[#111111] mt-1",children:"You may draft sequences and run eligibility preflight checks. No WhatsApp message can be sent until a separately authorised WATI connection and delivery activation are complete."})]})]}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:74",className:"border-2 border-[#0B00E4] p-4 flex gap-3",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:75",className:"text-[#0B00E4] shrink-0",size:20}),e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:76",className:"text-sm font-semibold text-[#111111]",children:"WATI provider delivery is enabled. Send activation still requires the separately approved pilot workflow."})]}),N&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:80",className:"border border-[#111111] p-3 text-sm text-[#111111] flex justify-between gap-4",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:80",children:N}),e.jsx("button",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:80",className:"font-bold text-[#0B00E4]",onClick:()=>g(null),children:"Dismiss"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:82",className:"grid xl
6:grid-cols-[1.1fr_0.9fr] gap-6",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:83",className:"border border-[#111111] p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:84",className:"flex items-center gap-2",children:[e.jsx(xs,{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:84",size:18,className:"text-[#0B00E4]"}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:84",className:"font-bold text-[#111111]",children:"Draft a template sequence"})]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:85",className:"mt-2 text-sm text-[#111111]",children:["Every new sequence starts inactive. The only initial template allowed is ",e.jsx("code",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:85",className:"font-semibold",children:"faye_cybersecurity_ai"})," with Name and Programme Interested variables."]}),e.jsxs("form",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:86",className:"mt-5 space-y-3",onSubmit:m=>{m.preventDefault(),P.mutate({name:s,programmeSlug:o})},children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:87",className:"block text-xs font-bold text-[#111111]",children:["Sequence name",e.jsx("input",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:87",required:!0,value:s,onChange:m=>a(m.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",placeholder:"Cybersecurity AI follow-up"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:88",className:"block text-xs font-bold text-[#111111]",children:["Programme slug",e.jsx("input",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:88",required:!0,value:o,onChange:m=>n(m.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",placeholder:"masters-cybersecurity-ai"})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:89",disabled:P.isPending,className:"bg-[#0B00E4] text-white px-4 py-2.5 text-sm font-bold disabled:opacity-60",children:P.isPending?"Creatingâ¦":"Create inactive draft"})]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:93",className:"border border-[#111111] p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:94",className:"flex items-center gap-2",children:[e.jsx(hs,{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:94",size:18,className:"text-[#0B00E4]"}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:94",className:"font-bold text-[#111111]",children:"Sequence inventory"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:95",className:"mt-4 space-y-2 max-h-64 overflow-auto",children:b.data?.length?b.data.map(m=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:97",onClick:()=>{r(m.id),x(m.activeVersionId??null),E([])},className:`w-full text-left border p-3 ${l===m.id?"border-[#0B00E4] bg-[#EEF2FF]":"border-[#111111]"}`,children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:98",className:"font-semibold text-sm text-[#111111]",children:m.name}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:98",className:"text-xs text-[#111111] mt-1",children:[m.programmeSlug," · ",m.status]})]},m.id)):e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:100",className:"text-sm text-[#111111]",children:"No WhatsApp sequences have been drafted."})})]})]}),W&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:106",className:"border-2 border-[#111111] p-5 space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",className:"flex flex-col md:flex-row justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",className:"text-xs font-bold text-[#0B00E4] uppercase",children:"Selected sequence"}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",className:"text-xl font-bold text-[#111111]",children:W.name})]}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",value:i??"",onChange:m=>x(Number(m.target.value)),className:"border border-[#111111] px-3 py-2 text-sm",children:[" ",e.jsx("option",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",value:"",children:"Select a ver
6sion"}),j.data?.map(m=>e.jsxs("option",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:107",value:m.id,children:["Version ",m.versionNumber," · ",m.status]},m.id))]})]}),S&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:108",className:"flex flex-wrap gap-3",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:108",onClick:()=>U.mutate({versionId:S.id,steps:[{stepNumber:1,delayHours:0,templateName:"faye_cybersecurity_ai",variableMapping:["name","programmeInterested"]}]}),disabled:S.status!=="draft"||U.isPending,className:"border border-[#111111] px-3 py-2 text-sm font-bold text-[#111111] disabled:opacity-40",children:"Add approved template"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:108",onClick:()=>y.mutate({versionId:S.id,status:"review"}),disabled:S.status!=="draft"||y.isPending,className:"border border-[#0B00E4] px-3 py-2 text-sm font-bold text-[#0B00E4] disabled:opacity-40",children:"Submit draft for review"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:110",className:"border-t border-[#111111] pt-5",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:111",className:"text-xs font-bold tracking-[0.14em] text-[#0B00E4] uppercase",children:"Manual pilot preflight"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:112",className:"mt-1 text-sm text-[#111111]",children:"Enter Contact Inbox IDs for explicitly WATI-consented contacts. The preflight checks the 20-recipient limit, E.164 phone quality, local opt-out, active enrolment, and approved sequence version. It does not enrol or send."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:113",className:"mt-3 flex flex-col md:flex-row gap-3",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:113",value:f,onChange:m=>c(m.target.value),className:"flex-1 border border-[#111111] p-2.5 text-sm",placeholder:"For example: 14, 27, 35"}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:113",onClick:()=>{if(!S){g("Select an approved sequence version first.");return}V.mutate({contactIds:p(),sequenceId:W.id,sequenceVersionId:S.id})},disabled:!S||V.isPending,className:"bg-[#0B00E4] text-white px-4 py-2.5 text-sm font-bold disabled:opacity-60",children:[e.jsx(Ao,{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:113",className:"inline mr-2",size:16}),V.isPending?"Checkingâ¦":"Run preflight"]})]}),k.length>0&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",className:"mt-4 border border-[#111111]",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",className:"grid grid-cols-[80px_1fr_1fr] text-xs font-bold border-b border-[#111111] p-2",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",children:"ID"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",children:"Contact"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",children:"Result"})]}),k.map(m=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",className:"grid grid-cols-[80px_1fr_1fr] text-sm p-2 border-b border-[#111111]/20",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",children:m.contactId||"â"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",children:m.name??"â"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/WhatsappAutomation.tsx:114",className:m.eligible?"text-[#0B00E4] font-semibold":"text-[#111111]",children:m.eligible?"Eligible":m.reason})]},`${m.contactId}-${m.reason}`))]})]})]})]})}const zt=t=>t.replaceAll("_"," "),ia=t=>t?new Date(t).toLocaleString("en-SG",{dateStyle:"medium",timeStyle:"short"}):"Not scheduled";function Ir(){const t=v.useUtils(),[s,a]=d.useState(""),[o,n]=d.use
6State(""),[l,r]=d.useState("instagram"),[i,x]=d.useState("Learn more"),[f,c]=d.useState("Explore the programme"),[k,E]=d.useState(""),[N,g]=d.useState(""),[C,b]=d.useState(""),[W,j]=d.useState(""),[P,U]=d.useState(null),[y,V]=d.useState(""),[p,u]=d.useState(""),[S,m]=d.useState(null),$=v.socialContent.dashboard.useQuery(),G=v.socialContent.get.useQuery({id:P??0},{enabled:!!P}),B=v.media.listImages.useQuery({search:""}),K=$.data?.items??[],ne=$.data?.channels??[],_=G.data,O=d.useMemo(()=>k.split(/[\s,]+/).map(L=>L.trim()).filter(Boolean).map(L=>L.startsWith("#")?L:`#${L}`),[k]),q=async()=>{await t.socialContent.dashboard.invalidate(),P&&await t.socialContent.get.invalidate({id:P})},ge=v.socialContent.create.useMutation({onSuccess:async L=>{U(L.id),a(""),n(""),E(""),g(""),b(""),j(""),m("Draft created. It is not approved or published."),await q()},onError:L=>m(L.message)}),pe=v.socialContent.transition.useMutation({onSuccess:async()=>{m("Lifecycle updated and audited."),await q()},onError:L=>m(L.message)}),ce=v.socialContent.replaceAssets.useMutation({onSuccess:async()=>{m("Media Library reference attached to the editable draft."),await q()},onError:L=>m(L.message)}),he=v.socialContent.recordPublication.useMutation({onSuccess:async()=>{u(""),m("Manual native publication recorded. The original post remains in the native channel."),await q()},onError:L=>m(L.message)}),I=L=>{if(L.preventDefault(),O.length>3){m("Use no more than three hashtags.");return}ge.mutate({channelKey:l,title:s,caption:o,ctaType:i,ctaText:f,hashtags:O,campaignLabel:N||null,youtubeUrl:C||null,plannedAt:W?new Date(W):null})},w=L=>{_&&pe.mutate({id:_.id,toStatus:L,reason:L==="changes_requested"?"Update requested by reviewer":null})},H=()=>{!_||!y||ce.mutate({contentItemId:_.id,assets:[{assetType:"image",mediaAssetId:Number(y),externalUrl:null,thumbnailUrl:null,sortOrder:1}]})};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:76",className:"p-6 max-w-7xl space-y-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:77",className:"flex flex-col xl:flex-row xl:items-end justify-between gap-4 border-b-2 border-[#111111] pb-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:78",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:79",className:"text-xs font-bold tracking-[0.16em] text-[#0B00E4] uppercase",children:"B16 · Hybrid social operations"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:80",className:"mt-1 text-3xl font-bold text-[#111111]",children:"Social Content"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:81",className:"mt-2 max-w-3xl text-sm text-[#111111]",children:"Aventis owns the content plan, makerâchecker approval, manual publication record and lead attribution. Instagram/Facebook publishing stays native. respond.io is reserved for a later approved conversation connection."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:83",className:"border-2 border-[#0B00E4] bg-[#EEF2FF] px-4 py-3 flex gap-3 max-w-md",children:[e.jsx(ps,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:84",className:"text-[#0B00E4] shrink-0",size:19}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:85",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:85",className:"font-bold text-[#111111] text-sm",children:"respond.io is inactive"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:85",className:"text-xs text-[#111111] mt-1",children:"No account, token, channel, private reply, conversation import, or message is connected from this workspace."})]})]})]}),S&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:89",className:"border border-[#111111] p-3 text-sm text-[#111111] flex justify-between gap-4",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:89",children:S}),e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:89",className:"font-bold text-[#0B00E4]",onClick:()=>m(null),children:"Dismiss"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:91",className:"grid xl
6:grid-cols-[1.05fr_0.95fr] gap-6",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:92",className:"border border-[#111111] p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:93",className:"flex gap-2 items-center",children:[e.jsx(bs,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:93",className:"text-[#0B00E4]",size:18}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:93",className:"font-bold text-[#111111]",children:"Create a content draft"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:94",className:"mt-2 text-sm text-[#111111]",children:"A draft is internal only. Publishing remains impossible until a separate reviewer approves it and readiness checks pass."}),e.jsxs("form",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:95",onSubmit:I,className:"mt-5 grid md:grid-cols-2 gap-3",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:96",className:"text-xs font-bold text-[#111111] md:col-span-2",children:["Working title",e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:96",required:!0,value:s,onChange:L=>a(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",placeholder:"MSc Cybersecurity programme spotlight"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:97",className:"text-xs font-bold text-[#111111]",children:["Channel",e.jsx("select",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:97",value:l,onChange:L=>r(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",children:ne.filter(L=>Number(L.isEnabled)).map(L=>e.jsx("option",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:97",value:L.channelKey,children:L.label},L.channelKey))})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:98",className:"text-xs font-bold text-[#111111]",children:["Planned native publish time",e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:98",type:"datetime-local",value:W,onChange:L=>j(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:99",className:"text-xs font-bold text-[#111111] md:col-span-2",children:["Caption",e.jsx("textarea",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:99",required:!0,value:o,onChange:L=>n(L.target.value),className:"mt-1 w-full min-h-28 border border-[#111111] p-2.5 text-sm",placeholder:"Draft caption for independent review"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:100",className:"text-xs font-bold text-[#111111]",children:["CTA type",e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:100",required:!0,value:i,onChange:L=>x(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:101",className:"text-xs font-bold text-[#111111]",children:["CTA text",e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:101",required:!0,value:f,onChange:L=>c(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:102",className:"text-xs font-bold text-[#111111]",children:["Hashtags ",e.jsx("span",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:102",className:"font-normal",children:"(up to 3)"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:102",value:k,onChange:L=>E(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",placeholder:"#Aventis #GraduateSchool #Singapore"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:103",className:"text-xs font-bold text-[#111111]",children:["Campaign label",e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:103",value:N,onChange:L=>g(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",placeholder:"cybersecurity_oct_2026"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:104",className:"text-xs font-bold text-[#111111] md:col-span-2",children:["YouTube URL ",e.jsx("span",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:104",className:"font-normal",children:"(external reference only)"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:104",value:C,onChange:L=>b(L.target.value),className:"mt-1 w-full border border-[#111111] p-2.5 text-sm",placeholder:"https://www.youtube.com/watch?v=â¦"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:105",className:"md:col-span-2 flex items-center justify-between gap-3",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:105",className:"text-xs text-[#111111]",children:["Hashtags parsed: ",O.length,"/3"]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:105",disabled:ge.isPending,className:"bg-[#0B00E4] text-white px-4 py-2.5 text-sm font-bold disabled:opacity-60",children:ge.isPending?"Creatingâ¦":"Create draft"})]})]})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:109",className:"border border-[#111111] p-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:110",className:"flex gap-2 items-center",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:110",className:"text-[#0B00E4]",size:18}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:110",className:"font-bold text-[#111111]",children:"Content inventory"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:111",className:"mt-2 text-sm text-[#111111]",children:"Every item retains its lifecycle and publication record. No content is auto-posted."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:112",className:"mt-4 space-y-2 max-h-[34rem] overflow-auto",children:K.length?K.map(L=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:113",onClick:()=>U(L.id),className:`w-full text-left border p-3 ${P===L.id?"border-[#0B00E4] bg-[#EEF2FF]":"border-[#111111]"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:113",className:"flex justify-between gap-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:113",className:"font-semibold text-sm text-[#111111]",children:L.title}),e.jsx("span",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:113",className:"text-xs uppercase font-bold text-[#0B00E4]",children:zt(L.status)})]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:113",className:"mt-1 text-xs text-[#111111]",children:[L.channelKe
6y," · ",L.campaignLabel||"No campaign"," · ",ia(L.plannedAt)]})]},L.id)):e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:113",className:"text-sm text-[#111111]",children:"No social content has been drafted."})})]})]}),_&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:118",className:"border-2 border-[#111111] p-5 space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",className:"flex flex-col md:flex-row md:items-start justify-between gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",className:"text-xs font-bold tracking-[0.14em] text-[#0B00E4] uppercase",children:"Selected content"}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",className:"mt-1 text-xl font-bold text-[#111111]",children:_.title}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",className:"mt-1 text-sm text-[#111111]",children:[_.channelKey," · ",zt(_.status)," · ",ia(_.plannedAt)]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",className:"flex flex-wrap gap-2",children:[_.status==="draft"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",onClick:()=>w("in_review"),className:"border border-[#0B00E4] text-[#0B00E4] px-3 py-2 text-sm font-bold",children:"Submit for review"}),_.status==="in_review"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",onClick:()=>w("changes_requested"),className:"border border-[#111111] px-3 py-2 text-sm font-bold text-[#111111]",children:"Request changes"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",onClick:()=>w("approved"),className:"bg-[#0B00E4] text-white px-3 py-2 text-sm font-bold",children:"Approve"})]}),_.status==="approved"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",onClick:()=>w("publish_ready"),className:"bg-[#0B00E4] text-white px-3 py-2 text-sm font-bold",children:"Run readiness check"}),_.status!=="published"&&_.status!=="archived"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:119",onClick:()=>w("archived"),className:"border border-[#111111] px-3 py-2 text-sm font-bold text-[#111111]",children:"Archive"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:121",className:"grid lg:grid-cols-3 gap-4 border-t border-[#111111] pt-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",className:"lg:col-span-2",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",className:"text-xs font-bold text-[#111111] uppercase",children:"Caption"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",className:"mt-2 whitespace-pre-wrap text-sm text-[#111111]",children:_.caption}),e.jsx("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",className:"mt-3 flex flex-wrap gap-2",children:_.hashtags.map(L=>e.jsx("span",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",className:"border border-[#111111] text-xs px-2 py-1",children:L},L))}),_.youtubeUrl&&e.jsxs("a",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",href:_.youtubeUrl,target:"_blank",rel:"noreferrer",className:"mt-4 inline-flex items-center gap-2 text-sm font-bold text-[#0B00E4]",children:[e.jsx(Wo,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",size:17}),"View external YouTube reference ",e.jsx(_e,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:122",size:14})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",className:"border border-[#111111] p-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",className:"text-xs font-bold text-[#111111] uppercase",children:"Media Library reference"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",className:"mt-1 text-xs text-[#111111]",children:"Images remain in the B4 Media Library; no file bytes are copied here."}),e.jsxs("select",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",value:y,onChange:L=>V(L.target.value),className:"mt-3 w-full border border-[#111111] p-2 text-sm",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",value:"",children:"Select an image"}),(B.data??[]).slice(0,50).map(L=>e.jsx("option",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",value:L.id,children:L.filename},L.id))]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",disabled:!y||!["draft","changes_requested"].includes(_.status)||ce.isPending,onClick:H,className:"mt-2 border border-[#0B00E4] text-[#0B00E4] px-3 py-2 text-sm font-bold disabled:opacity-40",children:[e.jsx(Mo,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",className:"inline mr-1",size:15}),"Attach image"]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:123",className:"mt-3 text-xs text-[#111111]",children:["Attached: ",_.assets.length?_.assets.map(L=>L.assetType).join(", "):"none"]})]})]}),_.status==="publish_ready"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"border-2 border-[#0B00E4] bg-[#EEF2FF] p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"flex gap-2 items-start",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"text-[#0B00E4] shrink-0",size:18}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"font-bold text-[#111111]",children:"Ready for native publication"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"mt-1 text-sm text-[#111111]",children:"Publish manually in the selected native channel, then record the canonical post URL below. This action never posts on your behalf."})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"mt-3 flex flex-col md:flex-row gap-3",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",value:p,onChange:L=>u(L.target.value),className:"flex-1 border border-[#111111] bg-white p-2.5 text-sm",placeholder:"https://www.instagram.com/p/..."}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",disabled:!p||he.isPending,onClick:()=>he.mutate({contentItemId:_.id,publishedUrl:p,externalPostId:null,publishedAt:new Date}),className:"bg-[#0B00E4] text-white px-4 py-2.5 text-sm font-bold disabled:opacity-60",children:[e.jsx(Jt,{"data-loc":"client/src/components/dashboard/SocialContent.tsx:126",className:"inline mr-1",size:15}),"Record publication"]})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:128",className:"border-t border-[#111111] pt-4",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:128",className:"text-xs font-bold tracking-[0.14em] text-[#0B00E4] uppercase",children:"Audit timeline"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:128",className:"mt-3 space-y-2",children:_.transitions.map(L=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:128",className:"border-l-2 border-[#0B00E4] pl-3",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:128",className:"text-sm font-semibold text-[#111111]",children:[L.fromStatus?`${zt(L.fromStatus)} â `:"",zt(L.toStatus)]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/SocialContent.tsx:128",className:"text-xs text-[#111111]",children:[ia(L.createdAt),L.reason?` · ${L.reason}`:""]})]},L.id))})]})]})]})}function Ls(t){return t.split(` 7`).map(s=>
7s.trim()).filter(Boolean)}function Qa(t){return Ls(t).map(s=>{const[a,...o]=s.split("|");return{title:a.trim(),body:o.join("|").trim()}}).filter(s=>s.title)}function Dr({draft:t,programmeLabel:s,viewport:a}){const o=Ls(t.trustLines).slice(0,4),n=Qa(t.highlightLines).slice(0,4),l=Qa(t.faqLines).slice(0,3),r=!!t.heroImage.trim();return e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:50",className:`overflow-hidden rounded-xl border border-gray-200 bg-gray-100 p-3 shadow-sm ${a==="mobile"?"mx-auto max-w-[380px]":""}`,children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:51",className:`mx-auto overflow-hidden rounded-lg bg-white shadow-sm ${a==="mobile"?"w-[320px]":"w-full"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:52",className:"flex items-center justify-between border-b border-gray-100 px-4 py-2 text-[9px] font-semibold text-gray-400",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:53",children:"Aventis Graduate School"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:54",className:"rounded bg-gray-100 px-1.5 py-0.5",children:"Preview only"})]}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:57",className:`relative overflow-hidden bg-[#0B00E4] px-5 py-8 text-white ${a==="mobile"?"py-7":"md:px-8 md:py-10"}`,style:r?{backgroundImage:`linear-gradient(90deg, rgba(11,0,228,0.97), rgba(11,0,228,0.72)), url(${t.heroImage})`,backgroundPosition:"center",backgroundSize:"cover"}:void 0,children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:61",className:"text-[9px] font-bold uppercase tracking-[0.14em] text-white/75",children:t.heroEyebrow||"Aventis Graduate School"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:62",className:`mt-3 font-bold leading-tight ${a==="mobile"?"text-2xl":"text-3xl"}`,children:t.heroHeading||"Your landing page headline"}),t.heroSubheading&&e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:63",className:"mt-3 max-w-xl text-xs leading-relaxed text-white/85",children:t.heroSubheading}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:64",type:"button",className:"mt-5 rounded-md bg-white px-4 py-2 text-[11px] font-semibold text-[#0B00E4] shadow-sm",children:t.heroCta||"Call to action"})]}),o.length>0&&e.jsx("section",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:67",className:"grid grid-cols-2 gap-px bg-gray-100 md:grid-cols-4",children:o.map(i=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:68",className:"bg-white px-3 py-3 text-center text-[9px] font-semibold text-gray-700",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:68",className:"mx-auto mb-1 h-3.5 w-3.5 text-[#0B00E4]"}),i]},i))}),e.jsxs("section",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:71",className:`grid gap-5 px-5 py-7 ${a==="mobile"?"grid-cols-1":"md:grid-cols-[1.15fr_0.85fr] md:px-8"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:72",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:73",className:"text-[9px] font-bold uppercase tracking-[0.12em] text-[#0B00E4]",children:s||t.templateType.replaceAll("_"," ")}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:74",className:"mt-2 text-lg font-bold text-[#111111]",children:"Designed for your next professional step."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:75",className:"mt-4 grid gap-2",children:n.map(i=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:76",className:"flex gap-2 rounded-lg bg-[#EEF2FF] p-3",children:[e.jsx(es,{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:76",className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[#0B00E4]"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:76",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:76",className:"text-[10px] font-semibold text-[#111111]",children:i.title}),i.body&&e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:76",className:"mt-0.5 text-[9px] leading-relaxed text-gray-600",children:i.body})]})]},`${i.title}-${i.body}`))})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:79",className:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:80",className:"text-sm font-bold text-[#111111]",children:t.formHeading||"Request information"}),t.formDescription&&e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:81",className:"mt-1 text-[9px] leading-relaxed text-gray-600",children:t.formDescription}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:82",className:"mt-3 space-y-2",children:[["N
7ame","Email address","Phone number"].map(i=>e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:83",className:"rounded-md border border-gray-200 px-2.5 py-2 text-[9px] text-gray-400",children:i},i)),t.programmeSlug&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:84",className:"flex items-center justify-between rounded-md border border-gray-200 px-2.5 py-2 text-[9px] text-gray-500",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:84",children:s||"Selected programme"}),e.jsx(ze,{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:84",className:"h-3 w-3"})]})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:86",type:"button",className:"mt-3 w-full rounded-md bg-[#0B00E4] px-3 py-2 text-[10px] font-semibold text-white",children:t.formSubmit||"Request Information"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:87",className:"mt-2 flex items-center gap-1 text-[8px] text-gray-500",children:[e.jsx(jt,{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:87",className:"h-2.5 w-2.5"}),"Preview only â no data is captured."]})]})]}),l.length>0&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"border-t border-gray-100 px-5 py-6 md:px-8",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"text-sm font-bold text-[#111111]",children:"Frequently asked questions"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"mt-3 space-y-2",children:l.map(i=>e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"rounded-lg border border-gray-200 p-3",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"flex gap-2",children:[e.jsx(Io,{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[#0B00E4]"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"text-[10px] font-semibold text-[#111111]",children:i.title}),i.body&&e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPageLivePreview.tsx:91",className:"mt-1 text-[9px] leading-relaxed text-gray-600",children:i.body})]})]})},`${i.title}-${i.body}`))})]})]})})}const ja=()=>({title:"",slug:"",templateType:"programme_enquiry",programmeSlug:"",heroEyebrow:"Aventis Graduate School",heroHeading:"Advance your professional future",heroSubheading:"Speak with an Aventis programme consultant about your next step.",heroCta:"Speak with a Programme Consultant",heroImage:"",highlightLines:`Industry-relevant curriculum | Learn from experienced practitioners 8Flexible learning pathways | Built for working professionals`,trustLines:`University partners 9Industry-relevant learning`,faqLines:"Who is this programme for? | Professionals seeking a recognised qualification.",youtubeUrl:"",formHeading:"Request programme information",formDescription:"Complete the form and a consultant will contact you.",formSubmit:"Request Information",seoTitle:"",seoDescription:""});function Tr(t){const s=t?.versions?.[0],a=s?.content??{},o=s?.formConfig??{};return{...ja(),title:t?.title??"",slug:t?.slug??"",templateType:t?.templateType??"programme_enquiry",programmeSlug:t?.programmeSlug??"",heroEyebrow:a.hero?.eyebrow??"",heroHeading:a.hero?.heading??"",heroSubheading:a.hero?.subheading??"",heroCta:a.hero?.ctaLabel??"",heroImage:a.hero?.imageUrl??"",highlightLines:(a.highlights??[]).map(n=>`${n.title} | ${n.body}`).join(` 10`),trustLines:(a.trustItems??[]).join(` 11`),faqLines:(a.faq??[]).map(n=>`${n.question} | ${n.answer}`).join(` 12`),youtubeUrl:a.youtubeUrl??"",formHeading:o.heading??"",formDescription:o.description??"",formSubmit:o.submitLabel??"",seoTitle:s?.seoTitle??"",seoDescription:s?.seoDescription??""}}function Ur(t){return t.split(` 13`).map(s=>
13s.trim()).filter(Boolean).slice(0,6).map(s=>{const[a,...o]=s.split("|");return{title:a?.trim()??"",body:o.join("|").trim()}}).filter(s=>s.title&&s.body)}function Vr(t){return t.split(` 14`).map(s=>s.trim()).filter(Boolean).slice(0,8).map(s=>{const[a,...o]=s.split("|");return{question:a?.trim()??"",answer:o.join("|").trim()}}).filter(s=>s.question&&s.answer)}function Rt(t){return{title:t.title.trim(),slug:t.slug.trim(),templateType:t.templateType,programmeSlug:t.programmeSlug||null,content:{hero:{eyebrow:t.heroEyebrow||void 0,heading:t.heroHeading,subheading:t.heroSubheading||void 0,ctaLabel:t.heroCta,imageUrl:t.heroImage||void 0},trustItems:t.trustLines.split(` 15`).map(s=>s.trim()).filter(Boolean).slice(0,6),highlights:Ur(t.highlightLines),faq:Vr(t.faqLines),finalCta:{heading:t.heroHeading,body:t.heroSubheading||void 0,label:t.heroCta},youtubeUrl:t.youtubeUrl||void 0},formConfig:{heading:t.formHeading,description:t.formDescription||void 0,programmeRequired:!!t.programmeSlug,fixedProgrammeSlug:t.programmeSlug||null,submitLabel:t.formSubmit},seoTitle:t.seoTitle||null,seoDescription:t.seoDescription||null,ogImage:t.heroImage||null}}function ht({status:t}){const s=t==="published"||t==="running"?"bg-[#0B00E4] text-white":t==="approved"?"border border-[#0B00E4] bg-white text-[#0B00E4]":"border border-gray-300 bg-white text-gray-600";return e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:100",className:`inline-flex rounded-full px-2.5 py-1 text-[10px] font-semibold uppercase tracking-[0.1em] ${s}`,children:t?.replaceAll("_"," ")??"draft"})}function le({label:t,children:s}){return e.jsxs("label",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:104",className:"block text-xs font-semibold text-[#111111]",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:104",children:t}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:104",className:"mt-1.5 [&_input]:w-full [&_input]:rounded-lg [&_input]:border [&_input]:border-gray-300 [&_input]:bg-white [&_input]:px-3 [&_input]:py-2.5 [&_input]:text-sm [&_input]:outline-none [&_input]:transition [&_input]:focus:border-[#0B00E4] [&_input]:focus:ring-2 [&_input]:focus:ring-[#EEF2FF] [&_select]:w-full [&_select]:rounded-lg [&_select]:border [&_select]:border-gray-300 [&_select]:bg-white [&_select]:px-3 [&_select]:py-2.5 [&_select]:text-sm [&_select]:outline-none [&_select]:transition [&_select]:focus:border-[#0B00E4] [&_select]:focus:ring-2 [&_select]:focus:ring-[#EEF2FF] [&_textarea]:w-full [&_textarea]:rounded-lg [&_textarea]:border [&_textarea]:border-gray-300 [&_textarea]:bg-white [&_textarea]:px-3 [&_textarea]:py-2.5 [&_textarea]:text-sm [&_textarea]:outline-none [&_textarea]:transition [&_textarea]:focus:border-[#0B00E4] [&_textarea]:focus:ring-2 [&_textarea]:focus:ring-[#EEF2FF]",children:s})]})}function Ue({children:t,className:s=""}){return e.jsx("section",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:108",className:`rounded-xl border border-gray-200 bg-white p-5 shadow-sm ${s}`,children:t})}function ma({label:t,value:s,note:a,icon:o}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",className:"rounded-xl border border-gray-200 bg-white p-4 shadow-sm",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",className:"text-xs font-medium text-gray-500",children:t}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",className:"mt-2 text-2xl font-bold tracking-tight text-[#111111]",children:s.toLocaleString()}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",className:"mt-1 text-xs text-gray-500",children:a})]}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",className:"rounded-lg bg-[#EEF2FF] p-2 text-[#0B00E4]",children:e.jsx(o,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:112",size:17})})]})})}function Gr(){const t=v.useUtils(),s=v.landingPages.list.useQuery(),a=v.landingPages.workspaceSummary.useQuery(),o=v.paidSources.programmeOptions.useQuery(),[n,l]=d.useState(null),r=v.landingPages.get.useQuery({id:typeof n=="number"?n:0},{enabled:typeof n=="number"}
15),[i,x]=d.useState(ja),[f,c]=d.useState(null),[k,E]=d.useState(!1),[N,g]=d.useState(""),[C,b]=d.useState(""),[W,j]=d.useState(""),[P,U]=d.useState(50),[y,V]=d.useState("desktop");d.useEffect(()=>{n==="new"&&x(ja())},[n]),d.useEffect(()=>{r.data&&x(Tr(r.data))},[r.data]);const p=r.data?.versions?.[0],u=r.data?.experiments?.[0],S=o.data?.find(w=>w.slug===i.programmeSlug)?.title??i.programmeSlug,m=async()=>{await Promise.all([t.landingPages.list.invalidate(),t.landingPages.get.invalidate()])},$=v.landingPages.create.useMutation({onSuccess:async w=>{l(w.id),c("Draft landing page created."),await m()},onError:w=>c(w.message)}),G=v.landingPages.updateDraft.useMutation({onSuccess:async()=>{c("Draft saved."),await m()},onError:w=>c(w.message)}),B=v.landingPages.transition.useMutation({onSuccess:async()=>{c("Lifecycle updated."),await m()},onError:w=>c(w.message)}),K=v.landingPages.createDraftVersion.useMutation({onSuccess:async()=>{c("Editable draft version ready."),await m()},onError:w=>c(w.message)}),ne=v.landingPages.createExperiment.useMutation({onSuccess:async()=>{E(!1),c("Experiment draft created. Submit it for independent approval before starting."),await m()},onError:w=>c(w.message)}),_=v.landingPages.transitionExperiment.useMutation({onSuccess:async()=>{c("Experiment lifecycle updated."),await m()},onError:w=>c(w.message)}),O=v.landingPages.report.useQuery({experimentId:Number(u?.id??0)},{enabled:!!u?.id}),q=(w,H)=>x(L=>({...L,[w]:H})),ge=()=>{const w=Rt(i);n==="new"?$.mutate(w):typeof n=="number"&&p&&G.mutate({...w,pageId:n,versionId:Number(p.id)})},pe=n&&n!=="new"?`/lp/${i.slug}/`:"",ce=P,he=100-ce,I={...Rt({...i,heroHeading:W||`${i.heroHeading} â Variant B`}),content:{...Rt(i).content,hero:{...Rt(i).content.hero,heading:W||`${i.heroHeading} â Variant B`}}};if(n===null){const w=a.data,H=s.data?.slice(0,8)??[],L=(w?.experiments.running??0)+(w?.experiments.approved??0)+(w?.experiments.inReview??0)+(w?.experiments.draft??0);return e.jsxs("section",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:164",className:"p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:165",className:"flex flex-wrap items-end justify-between gap-4 border-b border-gray-200 pb-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:166",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:166",className:"text-xs font-semibold uppercase tracking-[0.1em] text-[#0B00E4]",children:"Growth · B10"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:166",className:"mt-2 text-2xl font-bold text-[#111111]",children:"Landing Page Workspace"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:166",className:"mt-2 max-w-3xl text-sm text-gray-600",children:"Create controlled, noindex acquisition pages, monitor real aggregate activity, and open a pageâs structured editor. All publication and experiment decisions remain independently governed."})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:167",onClick:()=>l("new"),className:"inline-flex items-center gap-2 rounded-lg bg-[#0B00E4] px-4 py-2.5 text-sm font-semibold text-white shadow-sm",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:167",size:16}),"Create landing page"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:170",className:"mt-6 grid gap-5 xl:grid-cols-[minmax(0,1.15fr)_minmax(320px,0.85fr)]",children:[e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",className:"text-base font-semibold text-[#111111]",children:"Quick actions"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",className:"mt-4 grid gap-3 sm:grid-cols-2",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",onClick:()=>l("new"),className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white p-3 text-left text-sm font-semibold text-[#0B00E4] transition [@media(hover:hover)]:hover:border-[#0B00E4] [@media(hover:hover)]:hover:bg-[#
15EEF2FF]",children:[e.jsx(Ot,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",size:17}),"Create new page"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",onClick:()=>document.getElementById("b10-page-library")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white p-3 text-left text-sm font-semibold text-gray-700 transition [@media(hover:hover)]:hover:border-[#0B00E4] [@media(hover:hover)]:hover:bg-[#EEF2FF]",children:[e.jsx(Do,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",size:17,className:"text-[#0B00E4]"}),"Open page library"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",onClick:()=>document.getElementById("b10-experiment-queue")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-3 rounded-lg border border-gray-200 bg-white p-3 text-left text-sm font-semibold text-gray-700 transition [@media(hover:hover)]:hover:border-[#0B00E4] [@media(hover:hover)]:hover:bg-[#EEF2FF]",children:[e.jsx(Fa,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",size:17,className:"text-[#0B00E4]"}),"Review experiment queue"]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",className:"rounded-lg border border-dashed border-gray-300 bg-gray-50 p-3 text-sm text-gray-600",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",className:"font-semibold text-[#111111]",children:"Governed publishing"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:171",className:"mt-1 block text-xs",children:"Approval is required before a page or experiment can go live."})]})]})]}),e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",className:"flex items-start justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",className:"text-base font-semibold text-[#111111]",children:"Quick reporting"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",className:"mt-1 text-xs text-gray-500",children:"Last 30 days · aggregate landing-page activity only"})]}),e.jsx(Qt,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",size:18,className:"text-[#0B00E4]"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",className:"mt-4 grid grid-cols-3 gap-3",children:[e.jsx(ma,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",label:"Visits",value:w?.interactions.visits??0,note:"Unique landing visitors",icon:hs}),e.jsx(ma,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",label:"Conversions",value:w?.interactions.conversions??0,note:"Successful form submits",icon:it}),e.jsx(ma,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",label:"CTA interactions",value:w?.interactions.ctaInteractions??0,note:"Landing CTA clicks",icon:To})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:172",className:"mt-4 rounded-lg bg-gray-50 p-3 text-xs text-gray-600",children:(w?.interactions.visits??0)===0?"No public landing-page interactions have been recorded in the last 30 days.":"Reporting excludes crawler and preview activity. Conversion outcome selection remains manual."})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",id:"b10-page-library",className:"mt-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"text-lg font-semibold text-[#111111]",children:"Page library"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"mt-1 text-sm text-gray-600",children:"Recent controlled pages, lifecycle state and direct editor access."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",id:"b10-experiment-queue",className:"rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs text-gray-600",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"font-semibold text-[#111111]",children:"Experiment queue:"})," ",L," awaiting, approved or running"]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"mt-4 overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:s.isLoading?e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"flex items-center gap-2 p-6 text-sm text-gray-600",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"animate-spin text-[#0B00E4]"}),"Loading page libraryâ¦"]}):H.length?e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"hidden grid-cols-[minmax(220px,1.7fr)_minmax(110px,0.7fr)_minmax(120px,0.8fr)_minmax(120px,0.8fr)_auto] gap-4 border-b border-gray-200 bg-gray-50 px-5 py-3 text-[11px] font-semibold uppercase tracking-[0.08em] text-gray-500 lg:grid",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:"Page"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:"Template"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:"Lifecycle"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:"Last updated"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:"Actions"})]}),H.map(X=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"grid gap-3 border-b border-gray-100 px-5 py-4 last:border-b-0 lg:grid-cols-[minmax(220px,1.7fr)_minmax(110px,0.7fr)_minmax(120px,0.8fr)_minmax(120px,0.8fr)_auto] lg:items-center lg:gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"font-semibold text-[#111111]",children:X.title}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"mt-1 font-mono text-xs text-[#0B00E4]",children:["/lp/",X.slug,"/"]})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"text-xs font-medium capitalize text-gray-600",children:X.templateType.replaceAll("_"," ")}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"flex flex-wrap gap-2",children:[e.jsx(ht,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",status:X.status}),X.experimentStatus&&e.jsx(ht,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",status:X.experimentStatus})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"text-xs text-gray-500",children:X.updatedAt?new Date(X.updatedAt).toLocaleDateString():"â"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"flex items-center gap-2",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",onClick:()=>l(X.id),className:"inline-flex items-center gap-1 rounded-md bg-[#0B00E4] px-2.5 py-1.5 text-xs font-semibold text-white",children:[e.jsx(Ba,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",size:13}),"Open editor"]}),X.status==="published"&&e.jsxs("a",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",href:`/lp/${X.slug}/`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1.5 text-xs font-semibold text-gray-700",children:[e.jsx(gt,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",size:13}),"Preview"]})]})]},X.id))]}):e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"p-8 text-sm text-gray-600",children:[e.jsx(Ot,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"text-[#0B00E4]"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"mt-3 font-semibold text-[#111111]",children:"No landing pages yet."}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:175",className:"mt-1",children:"Create a controlled Campaign, Programme Enquiry, or Event / Information Session page to begin."})]})})]})]})}return e.jsxs("section",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:179",className:"p-6",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:180",onClick:()=>l(null),className:"inline-flex items-center gap-2 text-sm font-semibold text-[#0B00E4]",children:[e.jsx(et,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:180",size:16}),"All landing pages"]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:181",className:"mt-5 flex flex-wrap items-start justify-between gap-4 border-b border-gray-200 pb-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",className:"text-xs font-semibold uppercase tracking-[0.1em] text-[#0B00E4]",children:"Controlled page editor"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",className:"mt-2 text-2xl font-bold text-[#111111]",children:n==="new"?"New landing page":r.data?.title}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",className:"mt-3 flex flex-wrap gap-2",children:[e.jsx(ht,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",status:r.data?.status??"draft"}),u&&e.jsx(ht,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",status:u.status}),pe&&e.jsxs("a",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",href:pe,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-semibold text-gray-700",children:[e.jsx(gt,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:182",size:13}),"Public preview"]})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:183",className:"flex flex-wrap gap-2",children:[n!=="new"&&p&&["draft","changes_requested"].includes(String(p.status))&&e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:184",onClick:ge,disabled:G.isPending,className:"rounded-lg bg-[#0B00E4] px-4 py-2 text-sm font-semibold text-white disabled:opacity-40",children:"Save draft"}),n==="new"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:185",onClick:ge,disabled:$.isPending,className:"rounded-lg bg-[#0B00E4] px-4 py-2 text-sm font-semibold text-white disabled:opacity-40",children:"Create draft"}),r.data?.status==="draft"&&e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:186",onClick:()=>B.mutate({pageId:Number(r.data.id),toStatus:"in_review"}),className:"rounded-lg border border-[#0B00E4] bg-white px-4 py-2 text-sm font-semibold text-[#0B00E4]",children:[e.jsx(Jt,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:186",size:14,className:"mr-1 inline"}),"Submit review"]}),r.data?.status==="in_review"&&e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:187",onClick:()=>B.mutate({pageId:Number(r.data.id),toStatus:"approved"}),className:"rounded-lg bg-[#0B00E4] px-4 py-2 text-sm font-semibold text-white",children:[e.jsx(it,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:187",size:14,className:"mr-1 inline"}),"Approve"]}),r.data?.status==="approved"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:188",onClick:()=>B.mutate({pageId:Number(r.data.id),toStatus:"published"}),className:"rounded-lg bg-[#0B00E4] px-4 py-2 text-sm font-semibold text-white",children:"Publish"}),r.data?.status==="published"&&e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:189",onClick:()=>K.mutate({pageId:Number(r.data.id)}),className:"rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-semibold text-gray-700",children:[e.jsx(Ba,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:189",size:14,className:"mr-1 inline"}),"New draft version"]})]})]}),f&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:192",className:"mt-4 flex gap-2 rounded-lg border border-[#0B00E4] bg-[#EEF2FF] p-3 text-sm font-medium text-[#111111]",children:[e.jsx(ya,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:192",size:17,className:"shrink-0 text-[#0B00E4]"}),f]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:194",className:"mt-6 grid gap-6 xl:grid-cols-[minmax(0,1fr)_minmax(440px,0.9fr)] xl:items-start",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:195",className:"space-y-5",children:[e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",className:"text-base font-semibold text-[#111111]",children:"Page identity"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",className:"mt-4 grid gap-4 md:grid-cols-2",children:[e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",label:"Internal page title",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:i.title,onChange:w=>q("title",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",label:"Public URL slug",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",disabled:n!=="new",value:i.slug,onChange:w=>q("slug",w.target.value.toLowerCase().replace(/[^a-z0-9-]/g,""))})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",label:"Template",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:i.templateType,onCh
15ange:w=>q("templateType",w.target.value),children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:"programme_enquiry",children:"Programme Enquiry"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:"event_info",children:"Event / Information Session"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:"campaign_scholarship",children:"Campaign / Scholarship"})]})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",label:"Fixed programme",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:i.programmeSlug,onChange:w=>q("programmeSlug",w.target.value),children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:"",children:"No fixed programme"}),o.data?.map(w=>e.jsx("option",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:196",value:w.slug,children:w.title},w.slug))]})})]})]}),e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",className:"text-base font-semibold text-[#111111]",children:"Hero and conversion prompt"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",className:"mt-4 grid gap-4",children:[e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",label:"Eyebrow",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",value:i.heroEyebrow,onChange:w=>q("heroEyebrow",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",label:"Heading",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",rows:2,value:i.heroHeading,onChange:w=>q("heroHeading",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",label:"Supporting copy",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",rows:3,value:i.heroSubheading,onChange:w=>q("heroSubheading",w.target.value)})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",className:"grid gap-4 md:grid-cols-2",children:[e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",label:"CTA label",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",value:i.heroCta,onChange:w=>q("heroCta",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",label:"B4 image URL (optional)",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:197",value:i.heroImage,onChange:w=>q("heroImage",w.target.value)})})]})]})]}),e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",className:"text-base font-semibold text-[#111111]",children:"Approved content blocks"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",className:"mt-1 text-xs text-gray-600",children:["Use one item per line. For Highlights and FAQs, separate the title/question and supporting text with a vertical bar ",e.jsx("code",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",children:"|"}),"."]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",className:"mt-4 grid gap-4",children:[e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",label:"Trust strip",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",rows:3,value:i.trustLines,onChange:w=>q("trustLines",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",label:"Highlights",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",rows:5,value:i.highlightLines,onChange:w=>q("highlightLines",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",label:"FAQs",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",rows:5,value:i.faqLines,onChange:w=>q("faqLines",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",label:"YouTube video URL (optional)",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:198",value:i.youtubeUrl,onChange:w=>q("youtubeUrl",w.target.value),placeholder:"https://www.youtube.com/watch?v=â¦"})})]})]}),e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",className:"text-base font-semibold text-[#111111]",children:"Lead form and search preview"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",className:"mt-4 grid gap-4",children:[e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",label:"Form heading",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",value:i.formHeading,onChange:w=>q("formHeading",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",label:"Form supporting copy",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",rows:2,value:i.formDescription,onChange:w=>q("formDescription",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",label:"Submit label",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",value:i.formSubmit,onChange:w=>q("formSubmit",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",label:"Browser title",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",value:i.seoTitle,onChange:w=>q("seoTitle",w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",label:"Description",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",rows:2,value:i.seoDescription,onChange:w=>q("seoDescription",w.target.value)})})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:199",className:"mt-4 border-l-4 border-[#0B00E4] pl-3 text-xs font-medium text-gray-700",children:"All `/lp/*` pages are noindex, excluded from the sitemap, and use the existing lead anti-abuse controls. No scripts, HTML, CSS, or pixels may be inserted here."})]})]}),e.jsxs("aside",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:202",className:"space-y-5 xl:sticky xl:top-6",children:[e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",className:"overflow-hidden p-0",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",className:"flex flex-wrap items-center justify-between gap-3 border-b border-gray-200 bg-white px-4 py-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",className:"text-sm font-semibold text-[#111111]",children:"Live page preview"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",className:"mt-0.5 text-xs text-gray-500",children:"Updates as you edit. Preview controls do not save or publish."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",className:"inline-flex rounded-lg border border-gray-200 bg-gray-50 p-1",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",type:"button","aria-pressed":y==="desktop",onClick:()=>V("desktop"),className:`inline-flex items-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-semibold ${y==="desktop"?"bg-white text-[#0B00E4] shadow-sm":"text-gray-500"}`,children:[e.jsx(ss,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",size:14}),"Desktop"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",type:"button","aria-pressed":y==="mobile",onClick:()=>V("mobile"),className:`inline-flex items-center gap-1 rounded-md px-2.5 py-1.5 text-xs font-semibold ${y==="mobile"?"bg-white text-[#0B00E4] shadow-sm":"text-gray-500"}`,children:[e.jsx(Uo,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",size:14}),"Mobile"]})]})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",className:"max-h-[72vh] overflow-auto bg-gray-50 p-4",children:e.jsx(Dr,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:203",draft:i,programmeLabel:S,viewport:y})})]}),n!=="new"&&r.data?e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:205",className:"space-y-5",children:[e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"flex items-center justify-between",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"text-base font-semibold text-[#111111]",children:"Manual A/B experiment"}),e.jsx(Fa,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"text-[#0B00E4]"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"mt-2 text-sm text-gray-600",children:"A page must be published and independently approved before an experiment can run. Assignment and winner selection are never automatic."}),u?e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"mt-5",children:[e.jsx(ht,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",status:u.status}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"mt-3 font-semibold text-[#111111]",children:u.name}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"mt-1 text-xs text-gray-600",children:["Goal: ",String(u.primaryGoal).replaceAll("_"," ")]}),u.status==="draft"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>_.mutate({experimentId:Number(u.id),toStatus:"in_review"}),className:"mt-4 rounded-lg border border-[#0B00E4] bg-white px-3 py-2 text-xs font-semibold text-[#0B00E4]",children:"Submit review"}),u.status==="in_review"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>_.mutate({experimentId:Number(u.id),toStatus:"approved"}),className:"mt-4 rounded-lg bg-[#0B00E4] px-3 py-2 text-xs font-semibold text-white",children:"Approve experiment"}),u.status==="approved"&&e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>_.mutate({experimentId:Number(u.id),toStatus:"running"}),className:"mt-4 rounded-lg bg-[#0B00E4] px-3 py-2 text-xs font-semibold text-white",children:"Start experiment"}),u.status==="running"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",className:"mt-4 grid grid-cols-3 gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>_.mutate({experimentId:Number(u.id),toStatus:"ended",outcome:"control"}),className:"rounded-md border border-gray-300 bg-white p-2 text-[10px] font-semibold text-gray-700",children:"Control wins"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>_.mutate({experimentId:Number(u.id),toStatus:"ended",outcome:"variant_b"}),className:"rounded-md border border-gray-300 bg-white p-2 text-[10px] font-semibold text-gray-700",children:"B wins"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>_.mutate({experimentId:Number(u.id),toStatus:"ended",outcome:"no_winner"}),className:"rounded-md border border-gray-300 bg-white p-2 text-[10px] font-semibold text-gray-700",children:"No winner"})]})]}):e.jsxs("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",onClick:()=>{E(!0),j(`${i.heroHeading} â Variant B`)},disabled:r.data.status!=="published",className:"mt-5 w-full rounded-lg bg-[#0B00E4] px-4 py-2.5 text-sm font-semibold text-white disabled:opacity-40",children:[e.jsx(Vo,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:206",size:15,className:"mr-1 inline"}),"Create experiment draft"]})]}),u&&e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"flex items-center justify-between",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"text-base font-semibold text-[#111111]",children:"Performance"}),e.jsx(Qt,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"text-[#0B00E4]"})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"mt-2 text-xs text-gray-600",children:"Descriptive data is always visible. Confidence is advisory only when sufficient data exists; no fixed duration or traffic gate is used."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"mt-4 space-y-3",children:O.data?.variants?.map(w=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"rounded-lg border border-gray-200 p-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"font-semibold capitalize text-[#111111]",children:w.variantKey.replaceAll("_"," ")}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"mt-1 text-sm text-gray-700",children:[w.visitors," unique visitors · ",w.converters," conversions"]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"text-xs text-gray-500",children:[w.visitors?(w.converters/w.visitors*100).toFixed(2):"0.00","% conversion rate"]})]},w.variantKey))}),O.data?.confidence&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:`mt-4 rounded-lg border p-3 text-xs ${O.data.confidence.sufficient?"border-[#0B00E4] bg-[#EEF2FF]":"border-gray-200 bg-gray-50"}`,children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"font-semibold text-[#111111]",children:O.data.confidence.sufficient?O.data.confidence.significant?`${((O.data.confidence.confidence??0)*100).toFixed(1)}% advisory confidence`:"No 95% advisory confidence yet":"Confidence unavailable"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"mt-1 text-gray-600",children:O.data.confidence.sufficient?"Winner selection remains manual.":O.data.confidence.reason})]}),O.data?.srm&&e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:`mt-3 text-xs font-medium ${O.data.srm.warning?"text-red-700":"text-[#0B00E4]"}`,children:O.data.srm.eligible?O.data.srm.warning?"Allocation-quality warning: observed traffic materially differs from the configured split.":"Allocation-quality check passed.":"Allocation-quality warning becomes eligible after each variant has 200 observed visitors."}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:207",className:"mt-4 text-xs font-medium text-[#0B00E4]",children:[O.data?.excludedBotTraffic??0," crawler/preview events excluded from denominators."]})]}),e.jsxs(Ue,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",className:"text-base font-semibold text-[#111111]",children:"Audit timeline"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",className:"mt-4 space-y-3",children:r.data.transitions?.slice(0,12).map(w=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",className:"border-l-2 border-[#0B00E4] pl-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",className:"text-xs font-semibold uppercase text-[#111111]",children:w.toStatus.re
15placeAll("_"," ")}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",className:"text-xs text-gray-500",children:[w.changedByName||"Marketing staff"," · ",new Date(w.createdAt).toLocaleString()]}),w.reason&&e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:208",className:"mt-1 text-xs text-gray-600",children:w.reason})]},w.id))})]})]}):null]})]}),k&&e.jsx("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",className:"fixed inset-0 z-50 grid place-items-center bg-black/50 p-4",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",className:"w-full max-w-xl rounded-xl bg-white p-6 shadow-xl",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",className:"flex items-start justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",className:"text-xs font-semibold uppercase tracking-[0.1em] text-[#0B00E4]",children:"Experiment draft"}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",className:"mt-2 text-xl font-semibold text-[#111111]",children:"Control A versus Variant B"})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",onClick:()=>E(!1),className:"text-sm font-semibold text-gray-600",children:"Close"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",className:"mt-5 space-y-4",children:[e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",label:"Experiment name",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",value:N,onChange:w=>g(w.target.value),placeholder:"Scholarship headline test"})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",label:"Hypothesis",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",rows:3,value:C,onChange:w=>b(w.target.value),placeholder:"A more specific outcome headline will increase qualified form submissions."})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",label:"Variant B hero heading",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",rows:2,value:W,onChange:w=>j(w.target.value)})}),e.jsx(le,{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",label:`Control A allocation: ${ce}% / Variant B: ${he}%`,children:e.jsx("input",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",type:"range",min:"1",max:"99",value:ce,onChange:w=>U(Number(w.target.value)),className:"w-full"})})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/LandingPages.tsx:213",onClick:()=>ne.mutate({landingPageId:Number(n),name:N,hypothesis:C,primaryGoal:"form_submit",allocationControl:ce,allocationVariant:he,variantContent:I.content,variantFormConfig:I.formConfig}),disabled:!N.trim()||!C.trim()||ne.isPending,className:"mt-6 w-full rounded-lg bg-[#0B00E4] px-4 py-3 text-sm font-semibold text-white disabled:opacity-40",children:"Create controlled experiment draft"})]})})]})}const ee="mt-1 h-10 w-full rounded-lg border border-gray-300 bg-white px-3 text-sm text-[#111111] shadow-sm outline-none placeholder:text-gray-400 focus:border-[#0B00E4] focus:ring-2 focus:ring-[#EEF2FF]",Zt="mt-1 w-full rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm text-[#111111] shadow-sm outline-none placeholder:text-gray-400 focus:border-[#0B00E4] focus:ring-2 focus:ring-[#EEF2FF]",Ie="inline-flex min-h-10 items-center justify-center gap-2 rounded-lg bg-[#0B00E4] px-4 py-2 text-sm font-semibold text-white shadow-sm transition-colors [@media(hover:hover)]:hover:bg-[#0800bd] active:bg-[#0800bd] disabled:cursor-not-allowed disabled:opacity-45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0B00E4] focus-visible:ring-offset-2",Xe="inline-flex min-h-10 items-center justify-center gap-2 rounded-lg border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-[#111111] shadow-sm transition-colors [@media(hover:hover)]:hover:border-[#0B00E4]/40 [@media(hover:hover)]:hover:bg-[#
15EEF2FF] active:bg-[#EEF2FF] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#0B00E4] focus-visible:ring-offset-2";function tt({children:t,className:s}){return e.jsx("section",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:10",className:te("w-full max-w-6xl space-y-6 p-6",s),children:t})}function at({eyebrow:t,title:s,description:a,actions:o}){return e.jsxs("header",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:15",className:"flex flex-col gap-4 border-b border-gray-200 pb-6 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:16",children:[t?e.jsx("p",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:17",className:"text-[11px] font-semibold uppercase tracking-[0.12em] text-[#0B00E4]",children:t}):null,e.jsx("h2",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:18",className:"mt-1 text-2xl font-bold tracking-tight text-[#111111]",children:s}),e.jsx("p",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:19",className:"mt-1 max-w-3xl text-sm leading-6 text-gray-500",children:a})]}),o?e.jsx("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:21",className:"shrink-0",children:o}):null]})}function xe({children:t,className:s}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:27",className:te("rounded-xl border border-gray-200 bg-white p-5 shadow-sm",s),children:t})}function ve({title:t,icon:s,description:a,className:o}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:32",className:te("mb-4",o),children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:33",className:"flex items-center gap-2",children:[s?e.jsx("span",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:34",className:"text-[#0B00E4]",children:s}):null,e.jsx("h3",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:35",className:"text-sm font-semibold text-[#111111]",children:t})]}),a?e.jsx("p",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:37",className:"mt-1 text-xs leading-5 text-gray-500",children:a}):null]})}function Qe({children:t}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:43",className:"rounded-lg border border-dashed border-gray-300 bg-gray-50 px-4 py-5 text-sm leading-6 text-gray-500",children:t})}function Ae({children:t,tone:s="blue"}){const a={blue:"bg-[#EEF2FF] text-[#0B00E4]",amber:"bg-amber-50 text-amber-700",green:"bg-emerald-50 text-emerald-700",gray:"bg-gray-100 text-gray-600"};return e.jsx("span",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:53",className:te("inline-flex items-center rounded-full px-2.5 py-1 text-[11px] font-semibold",a[s]),children:t})}function ka({children:t}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:57",className:"rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm leading-6 text-amber-900",children:t})}function pa({title:t,value:s,detail:a}){return e.jsxs(xe,{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:61",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:61",className:"text-[11px] font-semibold uppercase tracking-[0.1em] text-[#0B00E4]",children:t}),e.jsx("p",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:61",className:"mt-2 text-2xl font-bold tracking-tight text-[#111111]",children:s}),e.jsx("p",{"data-loc":"client/src/components/dashboard/DashboardWorkspaceUI.tsx:61",className:"mt-1 text-xs text-gray-500",children:a})]})}const bt={meta:{title:"Meta Ads",exportHint:"Campaign report with Day, Campaign ID, Campaign name and Amount spent.",accent:"bg-[#eaf2ff] text-[#1855bd] ring-[#bfd5ff]"},google:{title:"Google Ads",exportHint:"Campaign report with Day, Campaign ID, Campaign, Cost and Currency.",accent:"bg-[#eef8ef] text-[#14753b] ring-[#c5e7cb]"},linkedin:{title:"LinkedIn Ads",exportHint:"Campaign report with Date, Campaign ID, Campaign name and Total spend.",accent:"bg-[#eef3ff] text-[#283c97] ring-[#cbd5ff]"}},Kt=(t,s="SGD")=>t==null?"Not reported in SGD":new Intl.NumberFormat("en-SG",{style:"currency",currency:s,minimumFractionDigits:2}).format(t/100);function zr({issues:t,title:s="Needs attention"}){return t.length?e.jsxs(xe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:37",className:"border-amber-200 bg-amber-50/50",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:38",title:s,icon:e.jsx(Ze,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:38",size:17,className:"text-amber-700"}),description:"Nothing is silently discarded. Resolve blocking items or review the rows that will be excluded before confirming."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:39",className:"space-y-2",children:t.map((a,o)=>e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:41",className:`rounded-lg border p-3 text-sm ${a.severity==="error"?"border-red-200 bg-red-50 text-red-800":"border-amber-200 bg-white text-amber-900"}`,children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:42",className:"flex gap-2",children:[e.jsx(ya,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:42",size:16,className:"mt-0.5 shrink-0"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:42",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:42",children:a.sourceRowNumber?`Row ${a.sourceRowNumber}: `:"File check: "}),a.message]})]})},`${a.issueCode}-${a.sourceRowNumber??"file"}-${o}`))})]}):null}function Rr(){const t=v.useUtils(),s=v.performanceImport.configuration.useQuery(),a=v.performanceImport.preview.useMutation(),o=v.performanceImport.confirm.useMutation({onSuccess:B=>{y(B),W("Your validated campaign performance data was imported successfully. The current review has been retained for your records."),s.refetch(),t.performanceImport.configuration.invalidate()}}
15),[n,l]=d.useState("meta"),[r,i]=d.useState(""),[x,f]=d.useState(""),[c,k]=d.useState(null),[E,N]=d.useState({}),[g,C]=d.useState(""),[b,W]=d.useState(""),[j,P]=d.useState(!1),[U,y]=d.useState(null),V=d.useMemo(()=>c?.campaigns.filter(B=>B.duplicateRowCount<B.rowCount)??[],[c]),p=V.some(B=>{const K=E[B.platformCampaignId];return!K||K.mappingType==="programme"&&!K.canonicalProgrammeId}),u=d.useMemo(()=>{const B=V,K=B.filter(O=>O.mapping?.isRemembered||O.mapping?.isSuggested),ne=B.filter(O=>!O.mapping?.isRemembered&&!O.mapping?.isSuggested),_=c?.campaigns.filter(O=>O.duplicateRowCount===O.rowCount)??[];return{autoMapped:K,needsAttention:ne,alreadyImported:_}},[c,V]),S=async()=>{if(C(""),W(""),y(null),k(null),!r||!x){C("Choose a CSV export before previewing it.");return}try{const B=await a.mutateAsync({platform:n,originalFilename:x,csvText:r});k(B),N(Object.fromEntries(B.campaigns.map(K=>[K.platformCampaignId,{utmCampaign:K.mapping?.utmCampaign??"",mappingType:K.mapping?.mappingType??"programme",canonicalProgrammeId:K.mapping?.canonicalProgrammeId??""}])))}catch(B){C(B instanceof Error?B.message:"We could not preview this file. Please try again.")}},m=async B=>{if(C(""),W(""),y(null),k(null),N({}),!!B){if(!B.name.toLowerCase().endsWith(".csv")){C("Please choose a CSV file exported from Meta Ads, Google Ads, or LinkedIn Ads.");return}if(B.size>2*1024*1024){C("This CSV is larger than 2 MB. Export one advertising account and a shorter date range, then try again.");return}try{i(await B.text()),f(B.name)}catch{C("We could not read that file in your browser. Please export it again as a UTF-8 CSV.")}}},$=(B,K)=>{N(ne=>({...ne,[B]:{...ne[B],...K}}))},G=async()=>{if(!(!c||j||o.isPending||U)){if(C(""),W(""),!c.canContinue){C("Resolve the file-level items above before confirming an import.");return}if(p){C("Complete the Aventis programme or Portfolio / General mapping for every new campaign before confirming. A UTM is optional when no trustworthy campaign match exists; that spend remains explicitly unattributed.");return}P(!0);try{await o.mutateAsync({platform:n,originalFilename:x,csvText:r,mappings:V.map(B=>({platformCampaignId:B.platformCampaignId,...E[B.platformCampaignId]}))})}catch(B){C(B instanceof Error?B.message:"The performance data could not be imported. Nothing was silently added.")}finally{P(!1)}}};return e.jsxs("section",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:162",id:"performance-import-workflow",tabIndex:-1,"aria-labelledby":"performance-import-title",className:"space-y-6 scroll-mt-6 focus:outline-none",children:[e.jsxs(xe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:163",className:"border-blue-200 shadow-sm",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:164",title:"1. Select platform and upload CSV",icon:e.jsx(Go,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:164",size:17}),description:"Start here. Choose the advertising platform, then browse for one campaign-performance CSV from one advertising account."}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:165",id:"performance-import-title",className:"sr-only",children:"Import Performance Data workflow"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:166","aria-label":"Select advertising platform",className:"grid gap-4 xl:grid-cols-3",children:Object.keys(bt).map(B=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:168",type:"button","aria-pressed":n===B,onClick:()=>{l(B),k(null),C(""),W("")},className:`rounded-xl border p-4 text-left transition-all ${n===B?`ring-1 ${bt[B].accent}`:"border-gray-200 bg-white hover:border-blue-200 hover:bg-blue-50/40"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:169",className:"flex items-center justify-between gap-3",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:169",className:"text-sm text-[#111111]",children:bt[B].title}),n===B&&e.jsx(fe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:169",size:18})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:170",className:"mt-2 text-xs leading-5 text-gray-600",children:bt[B].exportHint})]},B))}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:174",className:"grid gap-4 md:grid-cols-[1fr_auto] md:items-end",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:175",className:"block rounded-xl border-2 border-dashed border-blue-200 bg-blue-50/40 px-4 py-5 text-center cursor-pointer hover:border-blue-400 transition-colors",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:176",type:"file",accept:".csv,text/csv",className:"sr-only",onChange:B=>void m(B.target.files?.[0])}),e.jsx(zo,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:177",size:22,className:"mx-auto text-[#0B00E4]"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:178",className:"mt-2 block text-sm font-semibold text-[#111111]",children:x||"Choose a CSV export"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:179",className:"mt-1 block text-xs text-gray-500",children:"Meta Ads, Google Ads, or LinkedIn Ads · maximum 2 MB"})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:181",type:"button",onClick:()=>void S(),disabled:!r||a.isPending,className:`${Ie} min-w-44 justify-center disabled:cursor-not-allowed disabled:opacity-50`,children:[a.isPending?e.jsx(oe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:182",className:"animate-spin",size:16}):e.jsx(aa,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:182",size:16}),"Detect & preview",e.jsx($t,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:182",size:16})]})]})]}),e.jsxs(ka,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:187",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:188",size:16,className:"mr-2 inline text-blue-700"}),e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:189",children:"CSV foundation only."})," This imports campaign performance facts; it does not connect advertising APIs, change campaigns, publish content, or send messages."]}),s.isError&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:192",role:"alert",className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:192",children:"Import configuration is unavailable. "}),s.error.message||"Please refresh and try again. No performance data has been changed."]}),g&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:194",role:"alert",className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:194",children:"Import not completed. "}),g]}),b&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:195",role:"status",className:"rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:195",children:"Import completed. "}),b]}),c&&e.jsxs(e.Fragment,{children:[e.jsxs(xe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:198",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:199",title:"2. Import preview",icon:e.jsx(aa,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:199",size:17}
15),description:"Review the detected account, period, campaigns, spend, and platform-reported lead figures before the portal writes any performance data."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:200",className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:201",label:"Platform",value:bt[n].title}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:202",label:"Advertising account",value:c.accountName??"Not detected"}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:203",label:"Detected date range",value:c.sourceDateStart&&c.sourceDateEnd?`${c.sourceDateStart} to ${c.sourceDateEnd}`:"Cannot be determined"}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:204",label:"Campaigns / rows",value:`${c.campaigns.length} / ${c.rowCount}`}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:205",label:"Total media spend",value:Kt(c.totalOriginalSpendCents,c.currencies[0]??"SGD")}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:206",label:"Reporting spend",value:c.currencies.includes("SGD")?Kt(c.totalReportingSpendCents):"Not reported in SGD"}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:207",label:"Platform-reported leads",value:c.platformReportedLeads===null?"Not supplied":String(c.platformReportedLeads)}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:208",label:"Rows eligible to import",value:`${c.validRowCount} of ${c.rowCount}`})]})]}),e.jsx(zr,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:212",issues:c.issues}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:214",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:215",title:"3. Review campaign mapping",icon:e.jsx(Ro,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:215",size:17}),description:"Confirmed platform Campaign IDs are reused first. New campaigns receive a programme suggestion only when the campaign name has one clear match; untrustworthy UTM attribution stays visibly unattributed."}),c.campaigns.length?e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:216",className:"space-y-5",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:217",className:"flex flex-wrap gap-2",children:[e.jsxs(Ae,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:217",tone:"green",children:[u.autoMapped.length," mapped automatically"]}),e.jsxs(Ae,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:217",tone:u.needsAttention.length?"amber":"green",children:[u.needsAttention.length," need attention"]}),u.alreadyImported.length>0&&e.jsxs(Ae,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:217",tone:"gray",children:[u.alreadyImported.length," already imported"]})]}),u.needsAttention.length>0&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:218","aria-labelledby":"needs-attention-mapping",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:218",id:"needs-attention-mapping",className:"mb-3 text-sm font-semibold text-[#111111]",children:"Needs attention"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:218",className:"space-y-3",children:u.needsAttention.map(B=>e.jsx(Ha,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:218",campaign:B,mapping:E[B.platformCampaignId],programmes:s.data?.programmeOptions??[],utmCampaigns:s.data?.utmCampaigns??[],onChange:$,expanded:!0},B.platformCampaignId))})]}),u.autoMapped.length>0&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:219","aria-labelledby":"auto-mapped-campaigns",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:219",id:"auto-mapped-campaigns",className:"mb-3 text-sm font-semibold text-[#111111]",children:"Auto-mapped"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:219",className:"space-y-2",children:u.autoMapped.map(B=>e.jsx(Ha,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:219",campaign:B,mapping:E[B.platformCampaignId],programmes:s.data?.programmeOptions??[],utmCampaigns:s.data?.utmCampaigns??[],onChange:$},B.platformCampaignId))})]}),u.alreadyImported.length>0&&e.jsxs("section",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:220","aria-labelledby":"already-imported-campaigns",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:220",id:"already-imported-campaigns",className:"mb-3 text-sm font-semibold text-gray-600",children:"Already imported"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:220",className:"space-y-2",children:u.alreadyImported.map(B=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:220",className:"rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-600",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:220",children:B.campaignName}),e.jsxs("span",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:220",className:"ml-2 text-xs",children:["Campaign ID: ",B.platformCampaignId," · no rows will be added again."]})]},B.platformCampaignId))})]}),e.jsx("datalist",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:221",id:"known-utm-campaigns",children:s.data?.utmCampaigns.map(B=>e.jsx("option",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:221",value:
15B.utmCampaign,children:B.name},`${B.utmCampaign}-${B.name}`))})]}):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:222",children:"No valid campaigns could be read from this file. Review the file-level items above and export the report again."})]}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:225",className:"border-blue-200 bg-blue-50/40",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:226",title:"4. Confirm import",description:"Only rows that passed validation, are not duplicates, and have a confirmed programme or Portfolio / General mapping will be stored. Campaigns without a trustworthy UTM remain visible as spend but are not Aventis-attributed for lead/CPL reporting."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:227",className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:227",className:"text-sm text-gray-700",children:[c.validRowCount," validated row",c.validRowCount===1?"":"s"," are ready to import. ",c.rejectedRowCount>0?`${c.rejectedRowCount} invalid or duplicate row${c.rejectedRowCount===1?"":"s"} will be recorded as an issue and excluded.`:"No rejected rows are currently detected."]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:227",type:"button",onClick:()=>void G(),disabled:!c.canContinue||p||j||o.isPending||!!U,className:`${Ie} justify-center disabled:cursor-not-allowed disabled:opacity-50`,children:[j||o.isPending?e.jsx(oe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:227",className:"animate-spin",size:16}):e.jsx(fe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:227",size:16}),U?"Import completed":j||o.isPending?"Importingâ¦":"Confirm import"]})]}),j&&e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:228",role:"status",className:"mt-3 text-sm font-medium text-blue-800",children:"Importing validated rows and saving campaign mappings. Keep this page open; repeated clicks are disabled."}),U&&e.jsx(_r,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:229",result:U})]})]}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:233",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:234",title:"Recent imports",icon:e.jsx(aa,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:234",size:17}),description:"A concise audit trail of approved data imports. This does not expose advertising credentials or connect any advertising platform."}),s.isLoading?e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"text-sm text-gray-500",children:"Loading import historyâ¦"}):s.data?.recentBatches.length?e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"overflow-x-auto",children:e.jsxs("table",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"min-w-full text-left text-sm",children:[e.jsx("thead",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"border-b border-gray-200 text-xs uppercase tracking-wide text-gray-500",children:e.jsxs("tr",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",children:[e.jsx("th",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-2",children:"Imported"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-2",children:"Platform"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-2",children:"Account"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-2",children:"Period"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-2",children:"Rows"}),e.jsx("th",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-2",children:"Status"})]})}),e.jsx("tbody",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",children:s.data.recentBatches.map(B=>e.jsxs("tr",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"border-b border-gray-100",children:[e.jsx("td",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-3 text-gray-600",children:new Date(B.importedAt).toLocaleStr
15ing()}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-3 font-medium capitalize",children:B.platform}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-3 text-gray-600",children:B.accountName}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-3 text-gray-600",children:B.sourceDateStart&&B.sourceDateEnd?`${B.sourceDateStart} to ${B.sourceDateEnd}`:"Not available"}),e.jsxs("td",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-3 text-gray-600",children:[B.acceptedRowCount," accepted",B.rejectedRowCount?` · ${B.rejectedRowCount} excluded`:""]}),e.jsx("td",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",className:"px-2 py-3",children:e.jsx(Ae,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",tone:B.status==="completed"?"green":B.status==="completed_with_issues"?"amber":"gray",children:B.status.replaceAll("_"," ")})})]},B.id))})]})}):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:235",children:"No performance CSV has been imported yet."})]})]})}function Ha({campaign:t,mapping:s,programmes:a,utmCampaigns:o,onChange:n,expanded:l=!1}){const r=!!(s?.utmCampaign&&o.some(x=>x.utmCampaign===s.utmCampaign)),i=e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:264",className:"mt-4 grid gap-3 lg:grid-cols-3",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:265",className:"block text-sm font-medium text-[#111111]",children:["UTM campaign ",e.jsx("span",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:265",className:"font-normal text-gray-500",children:"(optional)"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:265",value:s?.utmCampaign??"",onChange:x=>n(t.platformCampaignId,{utmCampaign:x.target.value}),list:"known-utm-campaigns",placeholder:"No matching UTM / Unattributed",className:`${ee} mt-1`})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:266",className:"block text-sm font-medium text-[#111111]",children:["Marketing programme",e.jsxs("select",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:266",value:s?.mappingType??"programme",onChange:x=>n(t.platformCampaignId,{mappingType:x.target.value,canonicalProgrammeId:x.target.value==="portfolio_general"?"":s?.canonicalProgrammeId??""}),className:`${ee} mt-1`,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:266",value:"programme",children:"Programme-specific campaign"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:266",value:"portfolio_general",children:"Portfolio / General campaign"})]})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:267",className:"block text-sm font-medium text-[#111111]",children:[s?.mappingType==="portfolio_general"?"Programme allocation":"Select programme",s?.mappingType==="portfolio_general"?e.jsx("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:267",className:"mt-1 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2.5 text-sm text-gray-600",children:"Not allocated to an individual programme."}):e.jsxs("select",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:267",value:s?.canonicalProgrammeId??"",onChange:x=>n(t.platformCampaignId,{canonicalProgrammeId:x.target.value}),className:`${ee} mt-1`,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:267",value:"",children:"Choose programme"}),a.map(x=>e.jsx("option",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:267",value:x.canonicalProgrammeId,children:x.label},x.canonicalProgrammeId))]})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:268",className:"lg:col-span-3 text-xs leading-5 text-gray-500",children:s?.utmCampaign?r?"Matches an active managed UTM link.":"This UTM value is not in the managed-link inventory. Confirm it is exactly the UTM used in the live campaign destination.":"No matching UTM / Unattributed. Spend can be imported, but Aventis-attributed leads and CPL will remain unavailable until reliable attribution exists."})]});return e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:270",className:`rounded-xl border p-${l?"4":"3"} ${l?"border-amber-200 bg-amber-50/30":"border-gray-200 bg-white"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",className:"font-semibold text-[#111111]",children:t.campaignName}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",className:"mt-1 break-all text-xs text-gray-500",children:["Campaign ID: ",t.platformCampaignId," · ",t.dateStart," to ",t.dateEnd," · ",t.rowCount," row",t.rowCount===1?"":"s"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",className:"flex flex-wrap gap-2",children:[e.jsx(Ae,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",tone:t.mapping?.isRemembered?"green":t.mapping?.isSuggested?"blue":"amber",children:t.mappingStatus}),!s?.utmCampaign&&e.jsx(Ae,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:271",tone:"gray",children:"Unattributed"})]})]}),l?i:e.jsxs("details",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:272",className:"mt-3",children:[e.jsx("summary",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:272",className:"cursor-pointer text-sm font-medium text-[#0B00E4]",children:"Review or override mapping"}),i]})]})}function Ce({label:t,value:s}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:277",className:"rounded-lg border border-gray-200 bg-white p-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:277",className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:t}),e.jsx("p",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:277",className:"mt-1 break-words text-sm font-semibold text-[#111111]",children:s})]})}function _r({result:t}){const s=t.originalCurrencyCodes[0]??"SGD";return e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",className:"mt-4 rounded-xl border border-emerald-200 bg-emerald-50 p-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",className:"flex items-center gap-2 text-sm font-semibold text-emerald-900",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",size:17}),"Import result"]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",className:"mt-3 grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",label:"Rows imported",value:String(t.acceptedRowCount)}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",label:"Campaigns imported",value:String(t.campaignCount)}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",label:"Mappings saved",value:String(t.mappingsSaved)}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",label:"Total spend imported",value:Kt(t.totalOriginalSpendCents,s)}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",label:"Unattributed campaigns",value:String(t.unattributedCampaignCount)}),e.jsx(Ce,{"data-loc":"client/src/components/dashboard/PerformanceDataImport.tsx:282",label:"Unattributed spend",value:Kt(t.unattributedOriginalSpendCents,s)})]})]})}const qr=()=>new Date().toISOString().slice(0,7);function ie({label:t,children:s}){return e.jsxs("label",{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:23",className:"block text-sm font-medium text-[#111111]",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:23",children:t}),s]})}function Bt({children:t}){return e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:27",className:"rounded-lg border border-gray-200 bg-white p-4",children:t})}function $r(){const t=v.useUtils(),s=v.testimonialBank.list.useQuery(),a=v.testimonialBank.create.useMutation({onSuccess:()=>t.testimonialBank.list.invalidate()}),o=v.testimonialBank.setStatus.useMutation({onSuccess:()=>t.testimonialBank.list.invalidate()}),[n,l]=d.useState({quote:"",displayName:"",role:"",organisation:"",sourceReference:"",consentConfirmed:!1});return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:37",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:38",eyebrow:"Content · B5",title:"Testimonial Bank",description:"Store only real, authorised testimonials. Entries remain internal drafts until a staff member approves them; this workspace never creates public testimonials automatically."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:39",className:"grid gap-6 lg:grid-cols-[.85fr_1.15fr]",children:[e.jsx("form",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:40",className:"space-y-4",onSubmit:r=>{r.preventDefault(),a.mutate({quote:n.quote,displayName:n.displayName,role:n.role||null,organisation:n.organisation||null,sourceReference:n.sourceReference||null,programmeTags:[],consentConfirmed:!0})},children:e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:41",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:42",title:"Add verified source material",description:"Record only a real testimonial with documented permission."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:43",className:"space-y-3",children:[e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:44",label:"Quote",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:44",required:!0,minLength:10,value:n.quote,onChange:r=>l({...n,quote:r.target.value}),className:Zt,rows:5})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:45",label:"Name",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:45",required:!0,value:n.displayName,onChange:r=>l({...n,displayName:r.target.value}),className:ee})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:46",className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:46",label:"Role",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:46",value:n.role,onChange:r=>l({...n,role:r.target.value}),className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:46",label:"Organisation",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:46",value:n.organisation,onChange:r=>l({...n,organisation:r.target.value}),className:ee})})]}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:47",label:"Source reference",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:47",value:n.sourceReference,onChange:r=>l({...n,sourceReference:r.target.value}
15),placeholder:"Internal consent or source record reference",className:ee})}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:48",className:"flex gap-2 rounded-lg bg-gray-50 p-3 text-sm leading-5 text-gray-600",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:48",required:!0,type:"checkbox",checked:n.consentConfirmed,onChange:r=>l({...n,consentConfirmed:r.target.checked}),className:"mt-0.5 accent-[#0B00E4]"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:48",children:"I confirm this is a real testimonial with recorded permission to store it."})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:49",disabled:!n.consentConfirmed||a.isPending,className:`${Ie} w-full`,children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:49",size:16}),"Save as draft"]})]})]})}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:53",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:54",title:"Bank entries",icon:e.jsx(us,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:54",size:17}),description:"Internal records only; nothing is published automatically."}),e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"space-y-3",children:s.isLoading?e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"text-sm text-gray-500",children:"Loadingâ¦"}):s.data?.length?s.data.map(r=>e.jsxs(Bt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"text-sm text-[#111111]",children:r.displayName}),e.jsx(Ae,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",children:r.status})]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"mt-2 text-sm leading-6 text-gray-600",children:["â",r.quote,"â"]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"mt-2 text-xs text-gray-500",children:[r.role,r.organisation].filter(Boolean).join(" · ")||"No role supplied"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",type:"button",onClick:()=>o.mutate({id:r.id,status:"approved"}),className:Xe,children:"Approve"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",type:"button",onClick:()=>o.mutate({id:r.id,status:"archived"}),className:Xe,children:"Archive"})]})]},r.id)):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:55",children:"No testimonials have been entered. Nothing is seeded or fabricated."})})]})]})]})}function Or(){const t=v.useUtils(),s=v.contentCalendar.list.useQuery({from:new Date(new Date().setDate(new Date().getDate()-14))}),a=v.contentCalendar.create.useMutation({onSuccess:()=>t.contentCalendar.list.invalidate()}),o=v.contentCalendar.setStatus.useMutation({onSuccess:()=>t.contentCalendar.list.invalidate()}),[n,l]=d.useState({title:"",contentType:"blog",scheduledFor:new Date().toISOString().slice(0,16),notes:""});return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:67",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:68",eyebrow:"Content · B6",title:"Content Calendar",description:"A unified internal planning calendar. Creating a calendar entry does not publish an event, blog, page, or social post."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:69",className:"grid gap-6 lg:grid-cols-[.8fr_1.2fr]",children:[e.jsx("form",{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:70",onSubmit:r=>{r.preventDefault(),a.mutate({...n,scheduledFor:new Date(n.scheduledFor),status:"planned"})},children:e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",title:"Plan an item"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",className:"space-y-3",children:[e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",label:"Content type",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:n.contentType,onChange:r=>l({...n,contentType:r.target.value}),className:ee,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:"blog",children:"Blog"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:"event",children:"Event"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:"social",children:"Social"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:"landing_page",children:"Landing page"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:"campaign",children:"Campaign"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:"custom",children:"Custom"})]})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",label:"Title",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",required:!0,value:n.title,onChange:r=>l({...n,title:r.target.value}),className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",label:"Planned date and time",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",required:!0,type:"datetime-local",value:n.scheduledFor,onChange:r=>l({...n,scheduledFor:r.target.value}),className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",label:"Notes",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",value:n.notes,onChange:r=>l({...n,notes:r.target.value}),className:Zt,rows:4})}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",className:`${Ie} w-full`,disabled:a.isPending,children:[e.jsx(_o,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:70",size:16}),"Add plan"]})]})]})}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:71",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:71",title:"Upcoming and recent plans"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",className:"space-y-3",children:s.data?.length?s.data.map(r=>e.jsx(Bt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",className:"text-sm font-semibold text-[#111111]",children:r.title}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",className:"mt-1 text-xs text-gray-500",children:[r.contentType.replace("_"," ")," · ",new Date(r.scheduledFor).toLocaleString()]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",className:"flex items-center gap-2",children:[e.jsx(Ae,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",children:r.status}),e.jsx("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:72",type:"button",onClick:()=>o.mutate({id:r.id,status:"completed"}),className:Xe,children:"Complete"})]})]})},r.id)):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:72",children:"No calendar items are scheduled."})})]})]})]})}function Qr(){const t=v.useUtils(),s=v.conversionPrompts.list.useQuery(),a=v.conversionPrompts.create.useMutation({onSuccess:()=>t.conversionPrompts.list.invalidate()}),o=v.conversionPrompts.setStatus.useMutation({onSuccess:()=>t.conversionPrompts.list.invalidate()}),[n,l]=d.useState({name:"",promptType:"exit_intent",headline:"",body:"",ctaLabel:"Learn more",frequencyCapHours:168});return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:81",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:81",eyebrow:"Growth · B10",title:"Exit-Intent & Banners",description:"Create and approve internal prompt definitions. Public rendering is deliberately disabled in this release."}),e.jsxs(ka,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:82",children:[e.jsx(qo,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:82",className:"mr-2 inline text-amber-700",size:16}),e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:82",children:"Safety boundary:"})," saved prompts cannot render on the public website until a separately approved activation step is implemented."]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",className:"grid gap-6 lg:grid-cols-[.8fr_1.2fr]",children:[e.jsx("form",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",onSubmit:r=>{r.preventDefault(),a.mutate({promptType:n.promptType,name:n.name,frequencyCapHours:n.frequencyCapHours,targeting:{device:"all",path:"internal-draft"},content:{headline:n.headline,body:n.body,ctaLabel:n.ctaLabel}})},children:e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",title:"New internal prompt"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",className:"space-y-3",children:[e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",label:"Name",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",required:!0,value:n.name,onChange:r=>l({...n,name:r.target.value}),className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",label:"Type",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",value:n.promptType,onChange:r=>l({...n,promptType:r.target.value}),className:ee,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",value:"exit_intent",children:"Exit intent"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",value:"banner",children:"Banner"})]})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",label:"Headline",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",required:!0,value:n.headline,onChange:r=>l({...n,headline:r.target.value}),className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",label:"Body",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",required:!0,value:n.body,onChange:r=>l({...n,body:r.target.value}),className:Zt,rows:3})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",label:"CTA label",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",required:!0,value:n.ctaLabel,onChange:r=>l({...n,ctaLabel:r.target.value}),className:ee})}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",className:`${Ie} w-full`,children:[e.jsx(Ot,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",size:16}),"Save disabled draft"]})]})]})}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:83",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:83",title:"Prompt inventory"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",className:"space-y-3",children:s.data?.length?s.data.map(r=>e.jsxs(Bt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",className:"text-sm text-[#111111]",children:r.name}),e.jsx(Ae,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",children:r.status})]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",className:"mt-2 text-xs text-gray-500",children:[r.promptType.replace("_"," ")," · public rendering: ",e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",children:"disabled"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",className:"mt-3 flex flex-wrap gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",type:"button",onClick:()=>o.mutate({id:r.id,status:"in_review"}),className:Xe,children:"Review"}),e.jsx("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",type:"button",onClick:()=>o.mutate({id:r.id,status:"approved"}),className:Xe,children:"Approve internal definition"})]})]},r.id)):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:84",children:"No internal prompts have been created."})})]})]})]})}function Hr(){const t=v.useUtils(),s=v.seoPanel.programmes.useQuery(),a=v.seoPanel.requests.useQuery(),o=v.seoPanel.requestChange.useMutation({onSuccess:()=>t.seoPanel.requests.invalidate()}),[n,l]=d.useState(""),[r,i]=d.useState("canonical"),[x,f]=d.useState("");return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:92",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:92",eyebrow:"Settings · B18",title:"SEO Management",description:"Review programme search metadata and submit governed requests. Search-impacting changes are held for Admin review; this workspace does not apply them automatically."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"grid gap-6 lg:grid-cols-[.8fr_1.2fr]",children:[e.jsx("form",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",onSubmit:c=>{c.preventDefault(),n&&o.mutate({programmeId:n,changeType:r,proposedValue:x||null})},children:e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",title:"Submit governed change"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"space-y-3",children:[e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",label:"Programme",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",required:!0,value:n,onChange:c=>l(Number(c.target.value)||""),className:ee,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:"",children:"Choose programme"}),s.data?.map(c=>e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:c.id,children:c.title},c.id))]})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",label:"Change type",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:r,onChange:c=>i(c.target.value),className:ee,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:"canonical",children:"Canonical URL"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:"noindex",children:"Noindex"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:93",value:"slug",children:"Slug"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:"archive",children:"Archive"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:"redirect",children:"Redirect"})]})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",label:"Proposed value",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",value:x,onChange:c=>f(c.target.value),className:ee,placeholder:r==="canonical"?"https://aventis.edu.sg/...":"Describe the approved change"})}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:`${Ie} w-full`,disabled:!n||o.isPending,children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",size:16}),"Submit for Admin review"]})]})]})}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",title:"Governance queue"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"space-y-3",children:a.data?.length?a.data.map(c=>e.jsxs(Bt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"capitalize text-sm",children:c.changeType}),e.jsx(Ae,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",children:c.status})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"mt-2 break-words text-sm text-gray-600",children:c.proposedValue||"No proposed value supplied"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",className:"mt-2 text-xs text-gray-500",children:c.validationSummary})]},c.id)):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:93",children:"No SEO change requests are awaiting governance."})})]})]})]})}function xa({mode:t}){const s=v.useUtils(),[a,o]=d.useState(qr()),[n,l]=d.useState("snapshot"),r=v.marketingOverview.summary.useQuery({monthKey:a}),i=v.marketingOverview.addCost.useMutation({onSuccess:()=>s.marketingOverview.summary.invalidate()}),[x,f]=d.useState({channel:"",campaignName:"",amount:""}),c=t==="website"?"Website Insights":t==="roi"?"Campaign ROI & CPL":"Lead Capture Analytics",k=d.useMemo(()=>r.data?.ctas.reduce((N,g)=>N+Number(g.count),0)??0,[r.data]),E=()=>{l("import"),requestAnimationFrame(()=>{const N=document.getElementById("performance-import-workflow");N?.scrollIntoView({block:"start"}),N?.focus({preventScroll:!0})})};return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:109",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:109",eyebrow:"Overview · Aggregate Phase 1 data",title:c,description:t==="roi"?"Import validated campaign performance data here. The decision dashboard and AI analysis remain intentionally out of scope until the data foundation is established.":"Uses bounded CTA, campaign-link and manual paid-cost data only. It does not expose individual CRM or student records."}),t==="roi"&&e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",className:"mb-6 grid gap-3 rounded-xl border border-blue-200 bg-blue-50/50 p-3 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",className:"text-sm font-semibold text-[#111111]",children:"Campaign performance data"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",className:"mt-1 text-xs leading-5 text-gray-600",children:"Upload a validated Meta Ads, Google Ads, or LinkedIn Ads CSV before reviewing Campaign ROI and CPL. The current snapshot and Manual Campaign Cost remain available below."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:110",className:"flex flex-wrap gap-2",children:[e.jsx("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",type:"button",onClick:()=>l("snapshot"),className:`${n==="snapshot"?Ie:Xe} px-3 py-2 text-sm`,children:"Current snapshot"}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",type:"button","aria-label":"Import Performance Data",onClick:E,className:`${n==="import"?Xe:Ie} px-3 py-2 text-sm`,children:[e.jsx(Ot,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:110",size:16}),"Import Performance Data"]})]})]}),t==="roi"&&n==="import"?e.jsx(Rr,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:111"}):e.jsxs(e.Fragment,{children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:112",className:"max-w-xs",children:e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:112",label:"Month",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:112",type:"month",value:a,onChange:N=>o(N.target.value),className:ee})})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:113",className:"grid gap-4 md:grid-cols-3",children:[e.jsx(pa,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:113",title:"Tracked CTA actions",value:String(k),detail:"Brochure, WhatsApp and Apply clicks"}),e.jsx(pa,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:113",title:"Manual paid cost",value:`S$${((r.data?.totalCostCents??0)/100).toFixed(2)}`,detail:"Current selected month"}),e.jsx(pa,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:113",title:"Active campaign links",value:String(r.data?.activeCampaignLinks.length??0),detail:"Managed UTM/QR inventory"})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",title:"CTA activity"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",className:"space-y-1",children:r.data?.ctas.length?r.data.ctas.map(N=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",className:"flex justify-between border-b border-gray-100 py-2.5 text-sm",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",className:"capitalize text-gray-600",children:N.ctaType}),e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",children:String(N.count)})]},N.ctaType)):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",children:"No CTA events in the selected month."})})]}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",title:"Manual campaign cost",description:"Add a monthly cost manually. No advertising platform account is connected."}),e.jsxs("form",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",className:"grid gap-3",onSubmit:N=>{N.preventDefault(),i.mutate({monthKey:a,channel:x.channel,campaignName:x.campaignName||null,amountCents:Math.round(Number(x.amount)*100),currency:"SGD",notes:null})},children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",required:!0,placeholder:"Channel, e.g. Meta",value:x.channel,onChange:N=>f({...x,channel:N.target.value}),className:ee}),e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",placeholder:"Campaign name (optional)",value:x.campaignName,onChange:N=>f({...x,campaignName:N.target.value}),className:ee}),e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",required:!0,type:"number",min:"0",step:"0.01",placeholder:"Cost in SGD",value:x.amount,onChange:N=>f({...x,amount:N.target.value}),className:ee}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:114",className:Ie,children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:114",size:16}),"Add manual cost"]})]})]})]})]})]})}function Kr(){const t=v.useUtils(),s=v.integrationHealth.list.useQuery(),a=v.integrationHealth.save.useMutation({onSuccess:()=>t.integrationHealth.list.invalidate()}),[o,n]=d.useState({providerKey:"",displayName:"",status:"unconfigured",statusNote:""});return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:121",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:121",eyebrow:"Settings · Credential-safe",title:"Integration Health",description:"Record readiness and issues without storing or displaying credentials. This workspace cannot activate any provider."}),e.jsxs(ka,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:122",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:122",className:"mr-2 inline text-amber-700",size:16}),e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:122",children:"Activation remains disabled."})," Provider connection, sending, publishing and external data flows stay off until separately approved."]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:"grid gap-6 lg:grid-cols-[.8fr_1.2fr]",children:[e.jsx("form",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",onSubmit:l=>{l.preventDefault(),a.mutate(o)},children:e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",title:"Add or update health record"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:"space-y-3",children:[e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",label:"Provider key",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",required:!0,value:o.providerKey,onChange:l=>n({...o,providerKey:l.target.value.toLowerCase().replace(/[^a-z0-9_-]/g,"")}),placeholder:"mailgun",className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",label:"Display name",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",required:!0,value:o.displayName,onChange:l=>n({...o,displayName:l.target.value}),placeholder:"Mailgun",className:ee})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",label:"Status",children:e.jsxs("select",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",value:o.status,onChange:l=>n({...o,status:l.target.value}),className:ee,children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",value:"unconfigured",children:"Unconfigured"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",value:"inactive",children:"Inactive"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",value:"ready_for_review",children:"Ready for review"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",value:"error",children:"Error"})]})}),e.jsx(ie,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",label:"Operational note",children:e.jsx("textarea",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",value:o.statusNote,onChange:l=>n({...o,statusNote:l.target.value}),className:Zt,rows:4})}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:`${Ie} w-full`,children:[e.jsx($o,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",size:16}),"Save status only"]})]})]})}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",children:[e.jsx(ve,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",title:"Recorded provider states"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/MarketingWorksp
15aces.tsx:123",className:"space-y-3",children:s.data?.length?s.data.map(l=>e.jsxs(Bt,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:"text-sm",children:l.displayName}),e.jsx(Ae,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",tone:"gray",children:l.status})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:"mt-2 text-sm text-gray-600",children:l.statusNote||"No operational note recorded."}),e.jsx("p",{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",className:"mt-2 text-xs text-gray-500",children:"Activation: disabled"})]},l.id)):e.jsx(Qe,{"data-loc":"client/src/components/dashboard/MarketingWorkspaces.tsx:123",children:"No provider health records have been added."})})]})]})]})}function Yr(t){return`"${String(t??"").replace(/"/g,'""')}"`}function Jr(t){if(!t.length)return;const s=Object.keys(t[0]),a=[s.join(","),...t.map(r=>s.map(i=>Yr(r[i])).join(","))].join(`\r 16`),o=new Blob([a],{type:"text/csv;charset=utf-8"}),n=URL.createObjectURL(o),l=document.createElement("a");l.href=n,l.download=`aventis-interim-applications-${new Date().toISOString().slice(0,10)}.csv`,l.click(),URL.revokeObjectURL(n)}function ha(t){return t?new Date(t).toLocaleString("en-SG",{dateStyle:"medium",timeStyle:"short"}):"â"}function Zr(){const[t,s]=d.useState(""),[a,o]=d.useState(null),[n,l]=d.useState(null),r=d.useMemo(()=>({search:t||void 0,limit:100}),[t]),i=v.interimApplications.list.useQuery(r),x=d.useMemo(()=>a?{applicationId:a}:void 0,[a]),f=v.interimApplications.detail.useQuery(x,{enabled:!!x}),c=v.interimApplications.exportCsv.useQuery(void 0,{enabled:!1}),k=v.interimApplications.createDocumentDownload.useMutation(),E=v.interimApplications.setRetention.useMutation({onSuccess:()=>{i.refetch(),f.refetch()}});d.useEffect(()=>{!a&&i.data?.[0]&&o(i.data[0].id)},[i.data,a]);const N=f.data,g=async()=>{l(null);const b=await c.refetch();if(!b.data?.length){l("There are no interim applications to export yet.");return}Jr(b.data),l("The protected CSV export has been downloaded to this device.")},C=async(b,W)=>{l(null);const j=await k.mutateAsync({documentId:b});window.open(j.url,"_blank","noopener,noreferrer"),l(`A 15-minute secure download link was generated for ${W}.`)};return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:60",className:"p-5 md:p-6 max-w-7xl w-full",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:61",className:"flex flex-col lg:flex-row lg:items-start lg:justify-between gap-4 mb-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:62",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:62",className:"text-xs font-bold tracking-[0.12em] uppercase text-[#0B00E4] mb-2",children:"Private interim workflow"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:62",className:"text-2xl font-bold text-[#111111] tracking-tight",children:"Applications"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:62",className:"text-sm text-[#6B7280] mt-1 max-w-2xl",children:"Applicant records and documents are available only to the authorised administrator. This workspace is separate from Marketing leads, CRM, payment and Phase 3 systems."})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:63",onClick:g,disabled:c.isFetching,className:"inline-flex items-center justify-center gap-2 rounded-lg bg-[#0B00E4] text-white px-4 py-2.5 text-sm font-semibold hover:bg-[#0900c4] disabled:opacity-50",children:[e.jsx(yt,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:63",size:16}),c.isFetching?"Preparing CSVâ¦":"Export CSV"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:65",className:"rounded-xl border border-[#D1D5DB] bg-[#EEF2FF] p-4 flex gap-3 mb-5",children:[e.jsx(Pe,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:65",size:18,className:"text-[#0B00E4] shrink-0 mt-0.5"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:65",className:"text-sm text-[#374151] leading-relaxed",children:"CSV exports include application metadata and document filenames only. They never contain permanent document URLs or private storage keys. Generate document downloads from the selected application; each link expires after 15 minutes."})]}),n&&e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:66",className:"mb-5 rounded-lg border border-[#BFDBFE] bg-[#EFF6FF] px-4 py-3 text-sm text-[#1D4ED8]",children:n}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:67",className:"grid xl
16:grid-cols-[minmax(320px,0.9fr)_minmax(0,1.4fr)] gap-5",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:68",className:"rounded-xl border border-[#D1D5DB] bg-white overflow-hidden",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:68",className:"p-4 border-b border-[#E5E7EB]",children:e.jsxs("label",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:68",className:"relative block",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:68",size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#6B7280]"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:68",value:t,onChange:b=>s(b.target.value),placeholder:"Search reference, name, email or programme",className:"w-full rounded-lg border border-[#D1D5DB] pl-9 pr-3 py-2.5 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15"})]})}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",className:"max-h-[65vh] overflow-y-auto divide-y divide-[#E5E7EB]",children:i.isLoading?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",className:"p-8 text-center text-sm text-[#6B7280]",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",size:18,className:"animate-spin mx-auto mb-2"}),"Loading applicationsâ¦"]}):i.data?.length?i.data.map(b=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",onClick:()=>o(b.id),className:`w-full p-4 text-left hover:bg-[#F9FAFB] transition-colors ${a===b.id?"bg-[#EEF2FF] border-l-4 border-[#0B00E4] pl-3":"border-l-4 border-transparent"}`,children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",className:"text-sm font-bold text-[#111111] truncate",children:b.fullName}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",className:"text-xs text-[#4B5563] truncate mt-0.5",children:b.programmeTitle}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",className:"flex justify-between gap-2 mt-2 text-xs text-[#6B7280]",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",children:b.applicationReference}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",children:ha(b.submittedAt)})]})]},b.id)):e.jsx("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:69",className:"p-8 text-center text-sm text-[#6B7280]",children:"No interim applications found."})})]}),e.jsx("section",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"rounded-xl border border-[#D1D5DB] bg-white min-h-[420px]",children:f.isLoading?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"p-12 text-center text-sm text-[#6B7280]",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",size:18,className:"animate-spin mx-auto mb-2"}),"Loading applicationâ¦"]}):N?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"p-5 md:p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4 pb-5 border-b border-[#E5E7EB]",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"text-xs font-mono text-[#0B00E4]",children:N.applicationReference}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"text-xl font-bold text-[#111111] mt-1",children:N.fullName}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"text-sm text-[#6B7280] mt-1",children:["Submitted ",ha(N.submittedAt)]})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",onClick:()=>E.mutate({applicationId:N.id,retained:!N.retainedAt}),disabled:E.isPending,className:`rounded-lg border px-3 py-2 text-xs font-bold ${N.retainedAt?"border-amber-300 bg-amber-50 text-amber-800":"border-[#D1D5DB] text-[#374151] hover:border-[#0B00E4]"}`,children:N.retainedAt?"Manually retained":"Retain beyond 12 months"})]}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:72",className:"grid md:grid-cols-2 gap-x-8 gap-y-4 py-5",children:[["Programme",N.programmeTitle],["Mode",N.studyMode],["Preferred intake",N.intakeDate],["Source",N.leadSource],["Consultant",N.consultantName],["Email",N.email],["Phone",N.phone],["NRIC / Passport",N.nricPassport],["Date of birth",N.dateOfBirth],["Nationality",N.nationality],["Residency",N.residencyStatus],["Address",[N.addressLine1,N.addressLine2,N.postalCode,N.country].filter(
16Boolean).join(", ")],["Qualification",N.highestQualification],["Institution",N.institution],["Work experience",N.yearsExperience],["Retention until",ha(N.retentionExpiresAt)]].map(([b,W])=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:72",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:72",className:"text-xs font-semibold uppercase tracking-wide text-[#6B7280]",children:b}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:72",className:"text-sm text-[#111111] mt-1 break-words",children:W||"â"})]},b))}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"pt-5 border-t border-[#E5E7EB]",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"text-sm font-bold text-[#111111] mb-3",children:"Supporting documents"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"space-y-2",children:N.documents.map(b=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"flex flex-col sm:flex-row sm:items-center gap-3 justify-between rounded-lg border border-[#E5E7EB] p-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"flex items-center gap-3 min-w-0",children:[e.jsx(Nt,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",size:18,className:"text-[#0B00E4] shrink-0"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"min-w-0",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"text-sm font-medium text-[#111111] truncate",children:b.originalName}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",className:"text-xs text-[#6B7280] capitalize",children:[b.documentType," · ",Math.ceil(b.sizeBytes/1024)," KB"]})]})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",onClick:()=>C(b.id,b.originalName),disabled:k.isPending,className:"inline-flex justify-center items-center gap-1.5 rounded-lg border border-[#0B00E4] text-[#0B00E4] px-3 py-2 text-xs font-bold hover:bg-[#EEF2FF] disabled:opacity-50",children:[e.jsx(yt,{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:73",size:14}),"Download"]})]},b.id))})]})]}):e.jsx("div",{"data-loc":"client/src/components/dashboard/ApplicationsWorkspace.tsx:71",className:"p-12 text-center text-sm text-[#6B7280]",children:"Select an application to review its protected details."})})]})]})}const Xr={name:"",programme:"",phone:"",email:"",consultant:"",amount:""};function dt({id:t,label:s,helper:a,children:o}){return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:35",children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:36",htmlFor:`enets-preview-${t}`,className:"text-sm font-medium text-[#111111]",children:[s,e.jsx("span",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:37",className:"ml-1 text-[#0B00E4]",children:"*"})]}),o,a?e.jsx("p",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:40",className:"mt-1 text-xs leading-5 text-gray-500",children:a}):null]})}function ec(){const[t,s]=d.useState(Xr),a=(o,n)=>{s(l=>({...l,[o]:n}))};return e.jsxs(tt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:53",className:"max-w-3xl",children:[e.jsx(at,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:54",eyebrow:"Legacy Application Fee Mock-Up â Inactive",title:"Legacy payment preview",description:"This internal mock-up is not connected to the active Programme Fee Payment via eNETS workflow. It cannot create a request, store details, or open eNETS.",actions:e.jsx(Ae,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:58",tone:"amber",children:"Inactive mock-up"})}),e.jsxs(xe,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:61",className:"overflow-hidden p-0",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:62",className:"border-b border-[#
16E7E9F2] bg-[#F8F8FF] px-6 py-5 sm:px-8",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:63",className:"flex items-start gap-3",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:64",className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-white text-[#0B00E4] shadow-sm",children:e.jsx(Ht,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:64",size:18})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:65",children:[e.jsx("h2",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:65",className:"text-base font-semibold text-[#111111]",children:"Legacy mock-up fields"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:65",className:"mt-1 text-sm leading-6 text-gray-600",children:"These fields are illustrative only. The active Programme Fee Payment via eNETS flow uses staff-authorised, server-controlled details."})]})]})}),e.jsxs("form",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:69",className:"space-y-5 px-6 py-7 sm:px-8",onSubmit:o=>o.preventDefault(),noValidate:!0,children:[e.jsx(dt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:70",id:"name",label:"Name",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:71",id:"enets-preview-name",autoComplete:"off",value:t.name,onChange:o=>a("name",o.target.value),placeholder:"Enter your full name",className:ee})}),e.jsx(dt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:73",id:"programme",label:"Programme",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:74",id:"enets-preview-programme",autoComplete:"off",value:t.programme,onChange:o=>a("programme",o.target.value),placeholder:"Enter your programme name",className:ee})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:76",className:"grid gap-5 sm:grid-cols-2",children:[e.jsx(dt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:77",id:"phone",label:"Phone Number",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:78",id:"enets-preview-phone",type:"tel",autoComplete:"off",value:t.phone,onChange:o=>a("phone",o.target.value),placeholder:"Enter your phone number",className:ee})}),e.jsx(dt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:80",id:"email",label:"Email",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:81",id:"enets-preview-email",type:"email",autoComplete:"off",value:t.email,onChange:o=>a("email",o.target.value),placeholder:"Enter your email address",className:ee})})]}),e.jsx(dt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:84",id:"consultant",label:"Consultant",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:85",id:"enets-preview-consultant",autoComplete:"off",value:t.consultant,onChange:o=>a("consultant",o.target.value),placeholder:"Enter your consultant's name",className:ee})}),e.jsx(dt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:87",id:"amount",label:"Payment Amount (SGD)",helper:"Enter the exact amount advised by your consultant. Use digits only; do not include a $ sign, comma or decimal point.",children:e.jsx("input",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:88",id:"enets-preview-amount",inputMode:"numeric",autoComplete:"off",value:t.amount,onChange:o=>a("amount",o.target.value),placeholder:"e.g. 6758",className:ee})}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:91",className:"rounded-sm border border-[#D8DCF0] bg-[#F8F8FF] p-4 text-sm leading-6 text-gray-700",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:92",className:"flex gap-3",children:[e.jsx(jt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:92",className:"mt-0.5 shrink-0 text-[#0B00E4]",size:17}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:92",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:92",className:"font-semibold text-[#111111]",children:"DBS/POSB Credit Card Instalment Plan"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:92",className:"mt-1",children:["Eligible DBS/POSB Credit Card payments can be completed on the eNETS secure payment page with a ",e.jsx("strong",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:92",children:"0% instalment plan over 12 months"}),"."]})]})]})}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:95",className:"pt-1",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:96",type:"button",disabled:!0,"aria-disabled":"true",className:`${Ie} w-full cursor-not-allowed opacity-50`,children:[e.jsx(jt,{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:96",size:16}),"Proceed to eNETS"]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:97",className:"mt-3 text-center text-xs leading-5 text-gray-500",children:"Preview mode â payment is not available from this review link."})]})]})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ENetsPaymentPreview.tsx:102",className:"text-center text-xs leading-5 text-gray-500",children:"Internal review only. This preview does not send, store or process payment information."})]})}const Fs={pending:"Pending",processing:"Processing",paid_verified:"Paid / verified",failed:"Failed",cancelled:"Cancelled",expired:"Expired",revoked:"Revoked",needs_review:"Needs review"},tc={pending:"bg-blue-50 text-blue-800 border-blue-200",processing:"bg-amber-50 text-amber-800 border-amber-200",paid_verified:"bg-emerald-50 text-emerald-800 border-emerald-200",failed:"bg-red-50 text-red-800 border-red-200",cancelled:"bg-slate-100 text-slate-700 border-slate-200",expired:"bg-slate-100 text-slate-700 border-slate-200",revoked:"bg-slate-100 text-slate-700 border-slate-200",needs_review:"bg-orange-50 text-orange-800 border-orange-200"};
16function ut(t){return t?new Date(t).toLocaleString("en-SG",{dateStyle:"medium",timeStyle:"short"}):"â"}function Ka({status:t}){return e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:34",className:`inline-flex items-center rounded-full border px-2.5 py-1 text-xs font-bold ${tc[t]}`,children:Fs[t]})}const Ya={payerName:"",programmeCode:"",paymentDescription:"",amount:"",expiresInDays:"30"};function ac(){const t=v.useUtils(),[s,a]=d.useState(""),[o,n]=d.useState(null),[l,r]=d.useState(!1),[i,x]=d.useState(Ya),[f,c]=d.useState(null),[k,E]=d.useState(null),N=d.useMemo(()=>({search:s.trim()||void 0,limit:100}),[s]),g=v.programmeFeePayments.list.useQuery(N),C=v.programmeFeePayments.programmeOptions.useQuery(),b=v.programmeFeePayments.detail.useQuery({id:o??1},{enabled:!!o}),W=v.programmeFeePayments.create.useMutation({onSuccess:async u=>{E(u.paymentLink),c(`Payment request ${u.paymentReference} was created. Copy the secure link before sending it to the payer.`),x(Ya),r(!1),n(u.id),await Promise.all([t.programmeFeePayments.list.invalidate(),t.programmeFeePayments.detail.invalidate()])},onError:u=>c(u.message)}),j=v.programmeFeePayments.revoke.useMutation({onSuccess:async()=>{c("The payment request was revoked. Its secure link can no longer reveal payment details or proceed."),await Promise.all([t.programmeFeePayments.list.invalidate(),t.programmeFeePayments.detail.invalidate()])},onError:u=>c(u.message)}),P=v.programmeFeePayments.query.useMutation({onSuccess:async u=>{c(u.message),await t.programmeFeePayments.detail.invalidate()},onError:u=>c(u.message)});d.useEffect(()=>{!o&&g.data?.[0]&&n(g.data[0].id)},[g.data,o]);const U=async u=>{try{await navigator.clipboard.writeText(u),c("The secure payment link was copied to this device.")}catch{c("Copy was unavailable in this browser. Select and copy the secure payment link manually.")}},y=u=>{u.preventDefault(),c(null),W.mutate({payerName:i.payerName,programmeCode:i.programmeCode,paymentDescription:i.paymentDescription,amount:i.amount,expiresInDays:Number(i.expiresInDays)})},V=b.data,p=V&&!["paid_verified","revoked","expired"].includes(V.status);return e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:105",className:"p-5 md:p-6 max-w-7xl w-full",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:106",className:"flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between mb-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:107",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:108",className:"text-xs font-bold tracking-[0.12em] uppercase text-[#0B00E4] mb-2",children:"Restricted finance workflow"}),e.jsx("h2",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:109",className:"text-2xl font-bold text-[#111111] tracking-tight",children:"Programme Fee Payment via eNETS"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:110",className:"mt-1 max-w-3xl text-sm leading-6 text-[#6B7280]",children:"Create authorised, server-controlled SGD payment requests for programme or course fees. eNETS requests require at least S$500.00. Payment links contain only an opaque token; amounts and payer details cannot be changed by the recipient."})]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:112",onClick:()=>{r(!0),E(null),c(null)},className:"inline-flex items-center justify-center gap-2 rounded-lg bg-[#0B00E4] px-4 py-2.5 text-sm font-semibold text-white hover:bg-[#0900c4]",children:[e.jsx(ue,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:112",size:16}),"New payment request"]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:115",className:"mb-5 flex gap-3 rounded-xl border border-[#C7D2FE] bg-[#EEF2FF] p-4 text-sm leading-6 text-[#334155]",children:[e.jsx(Oo,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:115",size:18,className:"mt-0.5 shrink-0 text-[#0B00E4]"}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:115",children:[e.jsx("strong",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:115",children:"Gateway safety:"})," eNETS payment handoff is fail-closed until Aventis confirms a UAT or production merchant environment and protected server credentials are configured. A browser return is not payment proof; only a verified eNETS server notification or authorised Transaction Query can settle a request. Do not use this workspace to collect card or bank details."]})]}),f?e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:116",className:"mb-5 rounded-lg border border-[#BFDBFE] bg-[#EFF6FF] px-4 py-3 text-sm leading-6 text-[#1D4ED8]",children:f}):null,l?e.jsxs("section",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:118",className:"mb-6 rounded-xl border border-[#D1D5DB] bg-white p-5 md:p-6 shadow-sm",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:119",className:"mb-5 flex items-start justify-between gap-4",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:119",children:[e.jsx("h3",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:119",className:"text-lg font-bold text-[#111111]",children:"Authorise Programme Fee Payment via eNETS"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:119",className:"mt-1 text-sm leading-6 text-[#6B7280]",children:"The authorised amount is converted to integer cents on the server. It must be at least S$500.00 and will not be placed in the payerâs editable URL or form."})]}),e.jsx("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:119",onClick:()=>r(!1),"aria-label":"Close payment request form",className:"rounded-lg p-2 text-slate-500 hover:bg-slate-100",children:e.jsx(mt,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:119",size:18})})]}),e.jsxs("form",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:120",onSubmit:y,className:"grid gap-5 md:grid-cols-2",noValidate:!0,children:[e.jsxs("label",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:121",className:"text-sm font-medium text-[#111111]",children:["Student / Payer Name",e.jsx("input",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:121",required:!0,value:i.payerName,onChange:u=>x(S=>({...S,payerName:u.target.value})),className:"mt-1.5 w-full rounded-lg border border-[#D1D5DB] px-3 py-2.5 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15",placeholder:"Full name"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:122",className:"text-sm font-medium text-[#111111]",children:["Programme",e.jsxs("select",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:122",required:!0,value:i.programmeCode,onChange:u=>x(S=>({...S,programmeCode:u.target.value})),className:"mt-1.5 w-full rounded-lg border border-[#D1D5DB] bg-white px-3 py-2.5 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:122",value:"",children:"Select programme"}),C.data?.map(u=>e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:122",value:u.programmeCode,children:u.title},u.programmeCode))]})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:123",className:"text-sm font-medium text-[#111111] md:col-span-2",children:["Payment Description",e.jsx("input",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:123",required:!0,value:i.paymentDescription,onChange:u=>x(S=>({...S,paymentDescription:u.target.value})),className:"mt-1.5 w-full rounded-lg border border-[#D1D5DB] px-3 py-2.5 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15",placeholder:"e.g. Programme fee instalment 1"})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:124",className:"text-sm font-medium text-[#111111]",children:["Authorised Amount (SGD)",e.jsx("input",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:124",required:!0,inputMode:"decimal",min:"500",value:i.amount,onChange:u=>x(S=>({...S,amount:u.target.value})),className:"mt-1.5 w-full rounded-lg border border-[#D1D5DB] px-3 py-2.5 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15",placeholder:"e.g. 6758.00"}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:124",className:"mt-1 block text-xs font-normal text-[#6B7280]",children:"Minimum S$500.00. Up to two decimal places. The server stores integer cents."})]}),e.jsxs("label",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",className:"text-sm font-medium text-[#111111]",children:["Link Expiry",e.jsxs("select",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",value:i.expiresInDays,onChange:u=>x(S=>({...S,expiresInDays:u.target.value})),className:"mt-1.5 w-full rounded-lg border border-[#D1D5DB] bg-white px-3 py-2.5 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15",children:[e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",value:"7",children:"7 days"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",value:"14",children:"14 days"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",value:"30",children:"30 days"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",value:"60",children:"60 days"}),e.jsx("option",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:125",value:"90",children:"90 days"})]})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:126",className:"md:col-span-2 flex flex-wrap items-center gap-3 pt-1",children:[e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:126",type:"submit",disabled:W.
16isPending,className:"inline-flex items-center gap-2 rounded-lg bg-[#0B00E4] px-4 py-2.5 text-sm font-semibold text-white hover:bg-[#0900c4] disabled:opacity-50",children:[W.isPending?e.jsx(oe,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:126",size:16,className:"animate-spin"}):e.jsx(Ht,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:126",size:16}),W.isPending?"Creating requestâ¦":"Create secure payment link"]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:126",className:"text-xs leading-5 text-[#6B7280]",children:"Creating a request does not send a payment, publish a link, or initiate any eNETS transaction."})]})]})]}):null,k?e.jsx("section",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",className:"mb-6 rounded-xl border border-emerald-200 bg-emerald-50 p-5",children:e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",className:"flex items-start gap-3",children:[e.jsx(fe,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",size:20,className:"mt-0.5 shrink-0 text-emerald-700"}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",className:"min-w-0 flex-1",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",className:"font-bold text-emerald-900",children:"Secure payment link created"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",className:"mt-1 text-sm leading-6 text-emerald-900/80",children:"Send this link only to the intended payer. The URL contains no readable payer, programme or amount values."}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",className:"mt-3 flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",readOnly:!0,value:k,"aria-label":"Secure payment link",className:"min-w-0 flex-1 rounded-lg border border-emerald-300 bg-white px-3 py-2 text-sm text-slate-700"}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",onClick:()=>void U(k),className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-lg border border-emerald-700 px-3 py-2 text-sm font-bold text-emerald-800 hover:bg-emerald-100",children:[e.jsx(Qo,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:130",size:15}),"Copy link"]})]})]})]})}):null,e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:132",className:"grid gap-5 xl:grid-cols-[minmax(320px,0.92fr)_minmax(0,1.35fr)]",children:[e.jsxs("section",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:133",className:"overflow-hidden rounded-xl border border-[#D1D5DB] bg-white",children:[e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:133",className:"border-b border-[#E5E7EB] p-4",children:e.jsxs("label",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:133",className:"relative block",children:[e.jsx(Re,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:133",size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#6B7280]"}),e.jsx("input",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:133",value:s,onChange:u=>a(u.target.value),placeholder:"Search payer, programme or reference",className:"w-full rounded-lg border border-[#D1D5DB] py-2.5 pl-9 pr-3 text-sm outline-none focus:border-[#0B00E4] focus:ring-2 focus:ring-[#0B00E4]/15"})]})}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"max-h-[66vh] divide-y divide-[#E5E7EB] overflow-y-auto",children:g.isLoading?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"p-8 text-center text-sm text-[#6B7280]",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",size:18,className:"mx-auto mb-2 animate-spin"}),"Loading payment requestsâ¦"]}):g.data?.length?g.data.map(u=>e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",onClick:()=>n(u.id),className:`w-full border-l-4 p-4 text-left transition-colors hover:bg-[#F9FAFB] ${o===u.id?"border-[#0B00E4] bg-[#EEF2FF] pl-3":"border-transparent"}`,children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"flex items-start justify-between gap-3",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"min-w-0 truncate text-sm font-bold text-[#111111]",children:u.payerName}),e.jsx(Ka,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",status:u.status})]}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"mt-1 truncate text-xs text-[#4B5563]",children:u.programmeTitle}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"mt-2 flex items-center justify-between gap-2 text-xs text-[#6B7280]",children:[e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",children:u.paymentReference}),e.jsx("span",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",children:u.amount})]})]},u.id)):e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:134",className:"p-8 text-center text-sm text-[#6B7280]",children:"No programme-fee payment requests have been created."})})]}),e.jsx("section",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"min-h-[460px] rounded-xl border border-[#D1D5DB] bg-white",children:b.isLoading?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"p-12 text-center text-sm text-[#6B7280]",children:[e.jsx(oe,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",size:18,className:"mx-auto mb-2 animate-spin"}),"Loading payment requestâ¦"]}):V?e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"p-5 md:p-6",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"flex flex-col gap-4 border-b border-[#
16E5E7EB] pb-5 sm:flex-row sm:items-start sm:justify-between",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"font-mono text-xs text-[#0B00E4]",children:V.paymentReference}),e.jsx("h3",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"mt-1 text-xl font-bold text-[#111111]",children:V.payerName}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"mt-1 text-sm text-[#6B7280]",children:["Created ",ut(V.createdAt)]})]}),e.jsx(Ka,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",status:V.status})]}),e.jsx("dl",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:137",className:"grid gap-x-8 gap-y-4 py-5 md:grid-cols-2",children:[["Programme",V.programmeTitle],["Payment description",V.paymentDescription],["Amount due",V.amount],["Currency",V.currency],["Expires",ut(V.expiresAt)],["Paid",ut(V.paidAt)],["Revoked",ut(V.revokedAt)],["Payment status",Fs[V.status]]].map(([u,S])=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:137",children:[e.jsx("dt",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:137",className:"text-xs font-semibold uppercase tracking-wide text-[#6B7280]",children:u}),e.jsx("dd",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:137",className:"mt-1 break-words text-sm text-[#111111]",children:S||"â"})]},u))}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",className:"flex flex-wrap gap-3 border-t border-[#E5E7EB] pt-5",children:[p?e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",onClick:()=>j.mutate({id:V.id}),disabled:j.isPending,className:"inline-flex items-center gap-2 rounded-lg border border-red-300 px-3 py-2 text-xs font-bold text-red-700 hover:bg-red-50 disabled:opacity-50",children:[e.jsx(mt,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",size:15}),j.isPending?"Revokingâ¦":"Revoke link"]}):null,e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",onClick:()=>P.mutate({id:V.id}),disabled:P.isPending,className:"inline-flex items-center gap-2 rounded-lg border border-[#0B00E4] px-3 py-2 text-xs font-bold text-[#0B00E4] hover:bg-[#EEF2FF] disabled:opacity-50",children:[e.jsx(We,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",size:15,className:P.isPending?"animate-spin":""}),P.isPending?"Checkingâ¦":"Authoritative Transaction Query"]}),e.jsxs("button",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",onClick:()=>E(`${window.location.origin}/payment/enets/`),className:"inline-flex items-center gap-2 rounded-lg border border-[#D1D5DB] px-3 py-2 text-xs font-bold text-slate-700 hover:bg-slate-50",disabled:!0,children:[e.jsx(_e,{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:138",size:15}),"Link available only when created"]})]}),e.jsxs("aside",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:139",className:"mt-6 rounded-xl border border-[#E7E9F2] bg-[#F8FAFC] p-4 text-sm leading-6 text-[#475569]",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:139",className:"font-bold text-[#111111]",children:"Administrator-only reconciliation"}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:139",className:"mt-1",children:"Use the authoritative Transaction Query for a pending or processing request. A late success, invalid result, duplicate result, reversal, refund, or dispute must remain under finance review; do not manually mark a request paid or issue another link until eNETS evidence and the payment audit history have been reconciled."})]}),e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"mt-6 border-t border-[#
16E5E7EB] pt-5",children:[e.jsx("h4",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"text-sm font-bold text-[#111111]",children:"Payment audit history"}),e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"mt-3 space-y-3",children:V.events.length?V.events.map(u=>e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"rounded-lg border border-[#E5E7EB] p-3",children:[e.jsxs("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"text-sm font-semibold text-[#111111]",children:u.outcome.replace(/_/g," ")}),e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"text-xs text-[#6B7280]",children:ut(u.createdAt)})]}),e.jsxs("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"mt-1 text-xs uppercase tracking-wide text-[#6B7280]",children:[u.source,u.macValid===null?"":u.macValid?" · MAC verified":" · MAC invalid"]})]},u.id)):e.jsx("p",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:140",className:"text-sm text-[#6B7280]",children:"No payment events have been recorded."})})]})]}):e.jsx("div",{"data-loc":"client/src/components/dashboard/ProgrammeFeePaymentsWorkspace.tsx:136",className:"p-12 text-center text-sm text-[#6B7280]",children:"Select a payment request to review its server-controlled details and status history."})})]})]})}const Ja=[{id:"overview",label:"Overview",icon:e.jsx(ua,{"data-loc":"client/src/pages/MarketingDashboard.tsx:46",size:18}),children:[{id:"website-insights",label:"Website Insights"},{id:"campaign-roi",label:"Campaign ROI & CPL"},{id:"lead-analytics",label:"Lead Capture Analytics"}]},{id:"content",label:"Content",icon:e.jsx(gs,{"data-loc":"client/src/pages/MarketingDashboard.tsx:56",size:18}),children:[{id:"programmes",label:"Programme Pages"},{id:"events",label:"Events & Info Sessions"},{id:"blog",label:"Blog & AI Generator"},{id:"media",label:"Brochures & Media"},{id:"testimonials",label:"Testimonial Bank"},{id:"calendar",label:"Content Calendar"}]},{id:"leads",label:"Leads",icon:e.jsx(qt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:69",size:18}),children:[{id:"lead-inbox",label:"Lead Inbox"}]},{id:"applications",label:"Applications",icon:e.jsx(vs,{"data-loc":"client/src/pages/MarketingDashboard.tsx:77",size:18}),children:[{id:"interim-applications",label:"Applications"},{id:"programme-fee-payments",label:"Programme Fee Payments"}]},{id:"growth",label:"Growth",icon:e.jsx(Yo,{"data-loc":"client/src/pages/MarketingDashboard.tsx:86",size:18}),children:[{id:"landing-pages",label:"Landing Page Builder"},{id:"paid-leads",label:"Paid Lead Sources"},{id:"utm-generator",label:"UTM & QR Generator"},{id:"exit-intent",label:"Exit-Intent Pop-ups"}]},{id:"outreach",label:"Outreach",icon:e.jsx(Na,{"data-loc":"client/src/pages/MarketingDashboard.tsx:97",size:18}),children:[{id:"email-drip",label:"Email Drip Campaigns"},{id:"whatsapp",label:"WhatsApp Automation"},{id:"social",label:"Social Media Publisher"},{id:"ai-agent",label:"AI Comment & DM Agent"}]},{id:"settings",label:"Settings",icon:e.jsx(os,{"data-loc":"client/src/pages/MarketingDashboard.tsx:108",size:18}),children:[{id:"seo",label:"SEO Panel"},{id:"enets-payment-preview",label:"eNETS Payment Preview"},{id:"integrations",label:"Integrations"}]}],sc={"website-insights":e.jsx(Qt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:120",size:32}),"campaign-roi":e.jsx(Qt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:121",size:32}),"lead-analytics":e.jsx(qt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:122",size:32}),"lead-inbox":e.jsx(qt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:123",size:32}),"interim-applications":e.jsx(vs,{"data-loc":"client/src/pages/MarketingDashboard.tsx:124",size:32}),"programme-fee-payments":e.jsx(Ht,{"data-loc":"client/src/pages/MarketingDashboard.tsx:125",size:32}),programmes:e.jsx(gs,{"data-loc":"client/src/pages/MarketingDashboard.tsx:126",size:32}),events:e.jsx(vt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:127",size:32}),blog:e.jsx(Nt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:128",size:32}),media:e.jsx(Yt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:129",size:32}),testimonials:e.jsx(us,{"data-loc":"client/src/pages/MarketingDashboard.tsx:130",size:32}),calendar:e.jsx(vt,{"data-loc":"client/src/pages/MarketingDashboard.tsx:131",size:32}),"landing-pages":e.jsx(_t,{"data-loc":"client/src/pages/MarketingDashboard.tsx:132",size:32}),"paid-leads":e.jsx(tn,{"data-loc":"client/src/pages/MarketingDashboard.tsx:133",size:32}),"utm-generator":e.jsx(en,{"data-loc":"client/src/pages/MarketingDashboard.tsx:134",size:32}),"exit-intent":e.jsx(Xo,{"data-loc":"client/src/pages/MarketingDashboard.tsx:135",size:32}),"email-drip":e.jsx(Na,{"data-loc":"client/src/pages/MarketingDashboard.tsx:136",size:32}),whatsapp:e.jsx(xs,{"data-loc":"client/src/pages/MarketingDashboard.tsx:137",size:32}),social:e.jsx(bs,{"data-loc":"client/src/pages/MarketingDashboard.tsx:138",size:32}),"ai-agent":e.jsx(Zo,{"data-loc":"client/src/pages/MarketingDashboard.tsx:139",size:32}),seo:e.jsx(Re,{"data-loc":"client/src/pages/MarketingDashboard.tsx:140",size:32}),pdpa:e.jsx(Pe,{"data-loc":"client/src/pages/MarketingDashboard.tsx:141",size:32}),"enets-payment-preview":e.jsx(Ht,{"data-loc":"client/src/pages/MarketingDashboard.tsx:142",size:32}),integrations:e.jsx(Jo,{"data-loc":"client/src/pages/MarketingDashboard.tsx:143",size:32})},oc=`
17 .marketing-dashboard-standard input:not([type="checkbox"]):not([type="radio"]), 18 .marketing-dashboard-standard textarea, 19 .marketing-dashboard-standard select { 20 border-color: #d1d5db !important; 21 border-radius: 0.5rem !important; 22 box-shadow: 0 1px 2px rgb(0 0 0 / 0.03); 23 } 24 .marketing-dashboard-standard input:not([type="checkbox"]):not([type="radio"]):focus, 25 .marketing-dashboard-standard textarea:focus, 26 .marketing-dashboard-standard select:focus { 27 border-color: #0B00E4 !important; 28 outline: 2px solid #EEF2FF !important; 29 outline-offset: 0 !important; 30 } 31 .marketing-dashboard-standard [class*="border-2"][class*="border-[#111111]"] { 32 border-width: 1px !important; 33 border-color: #e5e7eb !important; 34 border-radius: 0.75rem !important; 35 box-shadow: 0 1px 2px rgb(0 0 0 / 0.04); 36 } 37 .marketing-dashboard-standard [class*="border"][class*="border-[#111111]"] { 38 border-color: #d1d5db !important; 39 } 40 .marketing-dashboard-standard [class*="bg-[#111111]"] { 41 background-color: #0B00E4 !important; 42 } 43 .marketing-dashboard-standard [class*="font-black"] { 44 font-weight: 600 !important; 45 } 46 .marketing-dashboard-standard [class*="text-3xl"] { 47 font-size: 1.5rem !important; 48 line-height: 2rem !important; 49 letter-spacing: -0.025em; 50 } 51 .marketing-dashboard-standard [class*="tracking-[0.16em]"] { 52 letter-spacing: 0.1em !important; 53 } 54 .marketing-dashboard-standard [class*="shadow-[5px_5px_0_#0B00E4]"], 55 .marketing-dashboard-standard [class*="shadow-[8px_8px_0_#0B00E4]"] { 56 box-shadow: 0 4px 14px rgb(11 0 228 / 0.12) !important; 57 transform: none !important; 58 } 59`;function ic(){const t=v.useUtils(),{data:s,isLoading:a}=v.dashboardGoogleAuth.me.useQuery(void 0,{retry:!1}),o=v.dashboardGoogleAuth.logout.useMutation({onSuccess:async()=>{await t.dashboardGoogleAuth.me.invalidate(),t.dashboardGoogleAuth.me.setData(void 0,null)}}),[n,l]=d.useState(!0),[r,i]=d.useState(!1),[x,f]=d.useState(new Set(["content"])),[c,k]=d.useState("programmes"),[E,N]=d.useState(null),[g,C]=d.useState(null),[b,W]=d.useState(null),[j,P]=d.useState(void 0);if(d.useEffect(()=>{new URLSearchParams(window.location.search).get("stage2-b3");const m=new URLSearchParams(window.location.search).get("internal-review");if(new URLSearchParams(window.location.search).get("workspace")==="programme-fee-payments"){k("programme-fee-payments"),f(G=>new Set([...G,"applications"]));return}if(m==="enets-payment"){k("enets-payment-preview"),f(G=>new Set([...G,"settings"]));return}},[]),a)return e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:234",className:"min-h-screen flex items-center justify-center bg-white",children:e.jsx(oe,{"data-loc":"client/src/pages/MarketingDashboard.tsx:235",className:"animate-spin text-[#0B00E4]",size:32})});if(!s)return e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:243",className:"min-h-screen flex items-center justify-center bg-white",children:e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:244",className:"w-full max-w-sm px-6 text-center",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:245",className:"w-16 h-16 bg-[#0B00E4] rounded-2xl flex items-center justify-center mx-auto mb-6",children:e.jsx(ua,{"data-loc":"client/src/pages/MarketingDashboard.tsx:246",size:28,className:"text-white"})}),e.jsx("h1",{"data-loc":"client/src/pages/MarketingDashboard.tsx:248",className:"text-2xl font-bold text-[#111111] mb-2",children:"Marketing Dashboard"}),e.jsx("p",{"data-loc":"client/src/pages/MarketingDashboard.tsx:249",className:"text-gray-500 mb-6 text-sm",children:"Sign in with your approved Google Workspace account to access the Aventis Marketing Platform."}),e.jsx("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:250",type:"button",onClick:()=>window.location.assign("/api/dashboard/google/launch"),className:"w-full bg-[#0B00E4] text-white font-semibold py-3 px-6 rounded-lg hover:bg-blue-700 transition-colors",children:"Continue with Google"})]})});if(s.role!=="marketing"&&s.role!=="admin")return e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:261",className:"min-h-screen flex items-center justify-center bg-white",children:e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:262",className:"text-center max-w-sm px-6",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:263",className:"w-16 h-16 bg-red-50 rounded-2xl flex items-center justify-center mx-auto mb-6",children:e.jsx(Pe,{"data-loc":"client/src/pages/MarketingDashboard.tsx:264",size:28,className:"text-red-500"})}),e.jsx("h1",{"data-loc":"client/src/pages/MarketingDashboard.tsx:266",className:"text-xl font-bold text-[#111111] mb-2",children:"Access Restricted"}),e.jsxs("p",{"data-loc":"client/src/pages/MarketingDashboard.tsx:267",className:"text-gray-500 text-sm mb-4",children:["This area is for marketing staff only. Your account (",s.email??s.name,") does not have the required permissions."]}),e.jsx("p",{"data-loc":"client/src/pages/MarketingDashboard.tsx:270",className:"text-gray-400 text-xs",children:"Contact your administrator to request access."})]})});const U=s.role==="admin",y=U?Ja:Ja.filter(m=>m.id!=="applications");function V(m){f($=>{const G=new Set($);return G.has(m)?G.delete(m):G.add(m),G})}const p=y.flatMap(m=>m.children??[]).find(m=>m.id===c),u=e.jsxs("aside",{"data-loc":"client/src/pages/MarketingDashboard.tsx:297",className:`flex flex-col h-full bg-white text-slate-700 border-r border-slate-200 ${n?"w-64":"w-16"} transition-all duration-200 shrink-0`,children:[e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:299",className:"flex items-center gap-3 px-4 py-5 border-b border-slate-200",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:300",className:"w-8 h-8 rounded-lg bg-[#0B00E4] flex items-center justify-center shrink-0",children:e.jsx("img",{"data-loc":"client/src/pages/MarketingDashboard.tsx:301",src:"/manus-storage/aventis_logo_white.webp",alt:"Aventis",className:"w-6 h-6 object-contain",onError:m=>{m.target.style.display="none"}})}),n&&e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:311",className:"overflow-hidden",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:312",className:"text-sm font-bold text-[#172554] leading-tight",children:"Aventis"}),e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:313",className:"text-xs text-slate-500 leading-tight",children:"Marketing Dashboard"})]}),e.jsx("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:316",onClick:()=>l(m=>!m),className:"ml-auto p-1 rounded text-slate-500 hover:bg-slate-100 hover:text-slate-700 transition-colors hidden lg:flex","aria-label":n?"Collapse sidebar":"Expand sidebar",children:n?e.jsx(ze,{"data-loc":"client/src/pages/MarketingDashboard.tsx:321",size:14,className:"rotate-90"}):e.jsx($t,{"data-loc":"client/src/pages/MarketingDashboard.tsx:321",size:14})})]}),e.jsx("nav",{"data-loc":"client/src/pages/MarketingDashboard.tsx:326",className:"flex-1 overflow-y-auto py-3 px-2",children:y.map(m=>e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:328",className:"mb-1",children:[e.jsxs("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:329",onClick:()=>V(m.id),className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-slate-600 hover:text-[#172554] hover:bg-slate-100 transition-colors text-left",children:[e.jsx("span",{"data-loc":"client/src/pages/MarketingDashboard.tsx:333",className:"shrink-0",children:m.icon}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-loc":"client/src/pages/MarketingDashboard.tsx:336",className:"text-sm font-semibold flex-1",children:m.label}),x.has(m.id)?e.jsx(ze,{"data-loc":"client/src/pages/MarketingDashboard.tsx:338",size:14,className:"shrink-0 text-slate-400"}):e.jsx($t,{"data-loc":"client/src/pages/MarketingDashboard.tsx:340",size:14,className:"shrink-0 text-slate-400"})]})]}),n&&x.has(m.id)&&m.children&&e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:347",className:"ml-2 mt-0.5 space-y-0.5",children:m.children.map($=>e.jsx("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:349",onClick:()=>k($.id),"aria-current":c===$.id?"page":void 0,className:`w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors text-left ${c===$.id?"bg-[#E8F0FF] text-[#173A7A] font-semibold":"text-slate-600 hover:text-[#172554] hover:bg-slate-100"}`,children:e.jsx("span",{"data-loc":"client/src/pages/MarketingDashboard.tsx:359",className:"flex-1",children:$.label})},$.id))})]},m.id))}),e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:369",className:"border-t border-slate-200 px-3 py-3",children:e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:370",className:"flex items-center gap-3",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:371",className:"w-8 h-8 rounded-full bg-[#E8F0FF] text-[#173A7A] flex items-center justify-center text-sm font-bold shrink-0",children:(s.name??s.email??"?")[0].toUpperCase()}),n&&e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:375",className:"flex-1 overflow-hidden",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:376",className:"text-sm font-medium text-slate-700 truncate",children:s.name??"Marketing Staff"}),e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:377",className:"text-xs text-slate-500 truncate",children:s.email??s.role})]}),n&&e.jsx("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:381",onClick:()=>o.mutate(),disabled:o.isPending,className:"p-1.5 rounded text-slate-500 hover:bg-slate-100 hover:text-slate-700 transition-colors","aria-label":"Sign out",children:e.jsx(Ho,{"data-loc":"client/src/pages/MarketingDashboard.tsx:387",size:14})})]})})]}),S=e.jsxs("main",{"data-loc":"client/src/pages/MarketingDashboard.tsx:398",className:"flex-1 overflow-auto bg-gray-50",children:[e.jsxs("header",{"data-loc":"client/src/pages/MarketingDashboard.tsx:400",className:"bg-white border-b border-gray-200 px-6 py-4 flex items-center gap-4 sticky top-0 z-10",children:[e.jsx("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:401",onClick:()=>i(!0),className:"lg:hidden p-2 rounded-lg hover:bg-gray-100 transition-colors","aria-label":"Open menu",children:e.jsx(Ko,{"data-loc":"client/src/pages/MarketingDashboard.tsx:406",size:20})}),e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:408",children:[e.jsx("h1",{"data-loc":"client/src/pages/MarketingDashboard.tsx:409",className:"text-lg font-bold text-[#111111]",children:p?.label??"Dashboard"}),e.jsx("p",{"data-loc":"client/src/pages/MarketingDashboard.tsx:412",className:"text-xs text-gray-400",children:"Aventis Marketing Platform"})]})]}),c==="programmes"?E?e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:419",className:"p-6 max-w-5xl",children:e.jsx(Cn,{"data-loc":"client/src/pages/MarketingDashboard.tsx:420",programmeId:E,onBack:()=>N(null)})}):e.jsx(hn,{"data-loc":"client/src/pages/MarketingDashboard.tsx:426",onEdit:m=>N(m)}):c==="events"?g!==null?e.jsx(Fn,{"data-loc":"client/src/pages/MarketingDashboard.tsx:430",eventId:g==="new"?null:g,onBack:()=>C(null)}):e.jsx(Pn,{"data-loc":"client/src/pages/MarketingDashboard.tsx:435",onEdit:m=>C(m),onCreate:()=>C("new")}):c==="blog"?e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:441",className:"p-6 max-w-6xl w-full",children:e.jsx(Jn,{"data-loc":"client/src/pages/MarketingDashboard.tsx:442",initialArea:j})}):c==="media"?e.jsx(vr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:445"}):c==="utm-generator"?b!==null?e.jsx(Er,{"data-loc":"client/src/pages/MarketingDashboard.tsx:448",linkId:b==="new"?null:b,onBack:()=>W(null)}):e.jsx(yr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:453",onEdit:m=>W(m),onCreate:()=>W("new")}):c==="paid-leads"?e.jsx(Sr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:459"}):c==="landing-pages"?e.jsx(Gr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:461"}):c==="lead-inbox"?e.jsx(Ar,{"data-loc":"client/src/pages/MarketingDashboard.tsx:463"}):c==="interim-applications"&&U?e.jsx(Zr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:465"}):c==="programme-fee-payments"&&U?e.jsx(ac,{"data-loc":"client/src/pages/MarketingDashboard.tsx:467"}):c==="email-drip"?e.jsx(Wr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:469"}):c==="whatsapp"?e.jsx(Mr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:471"}):c==="social"?e.jsx(Ir,{"data-loc":"client/src/pages/MarketingDashboard.tsx:473"}):c==="testimonials"?e.jsx($r,{"data-loc":"client/src/pages/MarketingDashboard.tsx:475"}):c==="calendar"?e.jsx(Or,{"data-loc":"client/src/pages/MarketingDashboard.tsx:477"}):c==="exit-intent"?e.jsx(Qr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:479"}):c==="seo"?e.jsx(Hr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:481"}):c==="enets-payment-preview"?e.jsx(ec,{"data-loc":"client/src/pages/MarketingDashboard.tsx:483"}):c==="website-insights"?e.jsx(xa,{"data-loc":"client/src/pages/MarketingDashboard.tsx:485",mode:"website"}):c==="campaign-roi"?e.jsx(xa,{"data-loc":"client/src/pages/MarketingDashboard.tsx:487",mode:"roi"}):c==="lead-analytics"?e.jsx(xa,{"data-loc":"client/src/pages/MarketingDashboard.tsx:489",mode:"leads"}):c==="integrations"?e.jsx(Kr,{"data-loc":"client/src/pages/MarketingDashboard.tsx:491"}):e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:493",className:"p-6 max-w-4xl",children:e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:494",className:"bg-white rounded-2xl border border-gray-200 p-12 text-center",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:495",className:"w-16 h-16 bg-[#EEF2FF] rounded-2xl flex items-center justify-center mx-auto mb-4 text-[#0B00E4]",children:sc[c]??e.jsx(ua,{"data-loc":"client/src/pages/MarketingDashboard.tsx:496",size:32})}),e.jsx("h2",{"data-loc":"client/src/pages/MarketingDashboard.tsx:498",className:"text-xl font-bold text-[#111111] mb-2",children:p?.label??"Dashboard"}),e.jsx("p",{"data-loc":"client/src/pages/MarketingDashboard.tsx:501",className:"text-gray-500 text-sm mb-4 max-w-sm mx-auto",children:"This workspace is not available yet. Its navigation entry remains accessible for planned functional testing."}),e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:504",className:"inline-flex items-center gap-2 bg-[#EEF2FF] text-[#0B00E4] text-xs font-semibold px-3 py-1.5 rounded-full",children:[e.jsx("span",{"data-loc":"client/src/pages/MarketingDashboard.tsx:505",className:"w-2 h-2 rounded-full bg-[#0B00E4]"}),"Placeholder only"]})]})})]});return e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:517",className:"marketing-d
59ashboard-standard flex h-screen overflow-hidden font-sans",children:[e.jsx("style",{"data-loc":"client/src/pages/MarketingDashboard.tsx:518",children:oc}),e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:520",className:"hidden lg:flex h-full",children:u}),r&&e.jsxs("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:526",className:"fixed inset-0 z-50 lg:hidden",children:[e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:527",className:"absolute inset-0 bg-black/40",onClick:()=>i(!1)}),e.jsx("div",{"data-loc":"client/src/pages/MarketingDashboard.tsx:531",className:"absolute left-0 top-0 h-full",children:u}),e.jsx("button",{"data-loc":"client/src/pages/MarketingDashboard.tsx:534",onClick:()=>i(!1),className:"absolute top-4 right-4 p-2 bg-white rounded-full shadow","aria-label":"Close menu",children:e.jsx(ds,{"data-loc":"client/src/pages/MarketingDashboard.tsx:539",size:16})})]}),S]})}export{ic 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.