PageSourceSearch

https://meetborderless.com/build/assets/index-CaKYRRG6.js

js meetborderless.com collected 2026-10-09 22:42:21 UTC 31,697 bytes, 1 lines download raw bytes

1import{j as e}from"./app-C1iegf7Q.js";import{b as r,H as te,L as y,f as F}from"./inertia-BpyZy4w-.js";import{A as se}from"./admin-badge-CnLlmTcA.js";import{W as ne}from"./whatsapp-digest-output-BLLEplbC.js";import{a as ie}from"./admin-layout-BhXWbUlP.js";import{a as m}from"./utils-BiuKVCuu.js";import{P as O}from"./play-FaiXzTos.js";import{E as K}from"./external-link-avvfS30C.js";import{L as w}from"./loader-circle-C_KBZAGS.js";import{C as E}from"./check-0O-UND6N.js";import{S as ae}from"./square-pen-DgHxGDPS.js";import{C as M}from"./chevron-down-B1YaU0K5.js";import{S as Q}from"./send-COySMMwK.js";import{T as re}from"./trash-2-CrI9a2Po.js";import{S as le}from"./square-check-CTjGeuh-.js";import{I as ce}from"./image-vCg-0Xge.js";import{X as q}from"./x-DQSeRCcH.js";import{R as W}from"./refresh-cw-Cog2DILh.js";import{U as I}from"./upload-C1CGckSw.js";import{C as de}from"./calendar-C9IvR7oY.js";/* empty css            */import"./clipboard-DVTW5dV8.js";import"./createLucideIcon-wqc1LSWg.js";import"./app-logo-Dz0wogSq.js";import"./logo-light-DU4bWymm.js";import"./flash-toast-C6O0iVL1.js";import"./info-D2ZN_yLm.js";import"./triangle-alert-C7AVwNi-.js";import"./circle-x-Bp6Mbpgt.js";import"./circle-check-BMWvzPMx.js";import"./arrow-left-DCX0fhKH.js";import"./menu-BR3Nc3Gr.js";import"./users-BCcupCXV.js";import"./folder-open-I72SPUVk.js";import"./pound-sterling-D16GLaAZ.js";import"./book-open-DVFlG_9t.js";const oe={completed:"bg-green/10 text-green-ink",running:"bg-amber/12 text-amber-ink",pending:"bg-amber/12 text-amber-ink",failed:"bg-red/10 text-red"},xe={completed:"Done",running:"Running",pending:"Queued",failed:"Failed"},me={high:"bg-red/10 text-red",medium:"bg-amber/12 text-amber-ink",low:"bg-ink/8 text-ink-2"};function $(){return document.querySelector('meta[name="csrf-token"]')?.content??""}async function X(t,s){return(await fetch(t,{method:"PATCH",headers:{"Content-Type":"application/json","X-CSRF-TOKEN":$(),Accept:"application/json"},body:JSON.stringify(s)})).json()}async function P(t,s){const i=s instanceof FormData;return(await fetch(t,{method:"POST",headers:i?{"X-CSRF-TOKEN":$(),Accept:"application/json"}:{"Content-Type":"application/json","X-CSRF-TOKEN":$(),Accept:"application/json"},body:i?s:JSON.stringify(s)})).json()}function J({label:t,action:s}){return e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink",children:t}),s]})}const ue={x:"bg-ink text-white",linkedin:"bg-[#0A66C2] text-white",instagram:"bg-[#E1306C] text-white",facebook:"bg-[#1877F2] text-white"},V={x:"X",linkedin:"in",instagram:"IG",facebook:"fb"},pe={strategist:"bg-lime/20 text-lime-ink",policy_update:"bg-amber/12 text-amber-ink",event:"bg-teal/12 text-teal",library:"bg-green/10 text-green-ink",product:"bg-red/14 text-red"},he={draft:"bg-bg-2 text-ink-3",approved:"bg-teal/12 text-teal",queued:"bg-lime/20 text-lime-ink",published:"bg-green/10 text-green-ink"};function ge({item:t,cardUrl:s}){const i=t.platform==="x";return e.jsxs("div",{className:m("rounded-card border overflow-hidden text-sm",i?"border-line bg-[#0f1117]":"border-line bg-white"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3",children:[e.jsx("div",{className:"h-8 w-8 flex-shrink-0 rounded-full bg-lime/30 flex items-center justify-center",children:e.jsx("span",{className:"text-2xs font-bold text-lime-ink",children:"B"})}),e.jsxs("div",{children:[e.jsx("p",{className:m("text-xs font-semibold leading-tight",i?"text-white":"text-ink"),children:"Borderless"}),e.jsx("p",{className:"text-2xs text-ink-3",children:i?"@borderless":"UK Immigration Intelligence"})]})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx("p",{className:m("whitespace-pre-wrap leading-relaxed text-sm",i?"text-white/90":"text-ink"),children:t.copy})}),s&&e.jsx("div",{className:"border-t border-line/20",children:e.jsx("img",{src:s,alt:"Post card",className:"w-full object-cover"})}),i&&e.jsx("div",{className:"flex gap-6 border-t border-white/10 px-4 py-2.5",children:["♡","↩","↗"].map(a=>e.jsxs("span",{className:"text-sm text-white/30",children:[a," ",e.jsx("span",{className:"text-2xs",children:"0"})]},a))})]})}function fe({item:t}){const[s,i]=r.useState(t.card_image_url),[a,n]=r.useState(!1),[p,d]=r.useState(!1);async function u(){if(s){d(!0);return}n(!0);const o=await P(`/admin/social/queue/${t.uuid}/preview-card`,{});n(!1);const h=o.card_image_url;h&&(i(h),d(!0))}return t.has_card?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:u,className:"flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md bg-bg-2 text-ink-3 hover:bg-bg hover:text-ink transition-colors",title:"Preview card",children:a?e.jsx(w,{size:13,className:"animate-spin"}):e.jsx(ce,{size:13})}),p&&s&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-ink/60 p-6",onClick:()=>d(!1),children:e.jsxs("div",{className:"relative max-h-full max-w-md",onClick:o=>o.stopPropagation(),children:[e.jsx("img",{src:s,alt:"Social card",className:"rounded-card shadow-xl"}),e.jsx("button",{onClick:()=>d(!1),className:"absolute -right-3 -top-3 flex h-7 w-7 items-center justify-center rounded-full bg-white shadow",children:e.jsx(q,{size:14})})]})})]}):null}const be={twitter:"X (Twitter)",linkedin:"LinkedIn",instagram:"Instagram",facebook:"Facebook"};function je({item:t,profiles:s,onDone:i,onCancel:a}){const n=t.platform==="x"?"twitter":t.platform,p=s.filter(c=>c.service===n).map(c=>c.id),d=["instagram","tiktok"].includes(t.platform),[u,o]=r.useState(""),[h,C]=r.useState(!1),[b,N]=r.useState(p.length?p:s.map(c=>c.id)),[x,j]=r.useState(null),[v,k]=r.useState(null),[S,z]=r.useState(null),[R,g]=r.useState(!1),[_,A]=r.useState(null),L=r.useRef(null),B=r.useRef(null);function D(c){N(l=>l.includes(c)?l.filter(f=>f!==c):[...l,c])}function U(c){const l=c.target.files?.[0]??null;j(l),k(l?URL.createObjectURL(l):null)}async function T(){if(b.length===0){A("Select at least one account.");return}g(!0),A(null);const c=new FormData;u&&c.append("scheduled_at",u),b.forEach(f=>c.append("profile_ids[]",f)),h?(c.append("as_reel","1"),S&&c.append("audio",S)):x&&c.append("background",x);const l=await P(`/admin/social/queue/${t.uuid}/approve`,c);if(g(!1),l.error){A(l.error);return}i(l.item)}return e.jsxs("div",{className:"space-y-3 rounded-card border border-line bg-bg-2 p-4 mt-3",children:[e.jsx("p",{className:"text-xs font-medium text-ink-2",children:"Queue to Buffer"}),s.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(c=>{const l=b.includes(c.id);return e.jsxs("button",{type:"button",onClick:()=>D(c.id),className:m("flex items-center gap-1.5 rounded-tag px-2.5 py-1 text-2xs font-medium transition-colors",l?"bg-ink text-white":"border border-line bg-white text-ink-3 hover:border-ink hover:text-ink"),children:[l&&e.jsx(E,{size:10,strokeWidth:3}),be[c.service]??c.service,c.name&&e.jsxs("span",{className:"opacity-60",children:["· ",c.name]})]},c.id)})}):e.jsx("p",{className:"text-xs text-ink-3",children:"No connected Buffer accounts found."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{size:13,className:"text-ink-3 flex-shrink-0"}),e.jsx("input",{type:"datetime-local",value:u,onChange:c=>o(c.target.value),className:"flex-1 rounded-md border border-line bg-white px-2 py-1.5 text-xs text-ink focus:outline-none focus:ring-1 focus:ring-ink"})]}),d&&e.jsxs("button",{type:"button",onClick:()=>C(c=>!c),className:m("flex items-center gap-2 rounded-tag px-3 py-1.5 text-xs font-medium transition-colors",h?"bg-ink text-white":"border border-line text-ink-2 hover:border-ink hover:text-ink"),children:[e.jsx("span",{children:h?"✦":"○"}),"Post as Reel (image + audio)"]}),h?e.jsxs("div",{children:[e.jsx("input",{ref:B,type:"file",accept:"audio/mpeg,audio/aac,audio/mp4,.mp3,.aac,.m4a",className:"hidden",onChange:c=>z(c.target.files?.[0]??null)}),S?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"flex-1 truncate text-xs text-ink-2",children:S.name}),e.jsx("button",{onClick:()=>z(null),className:"text-ink-3 hover:text-red",children:e.jsx(q,{size:13})})]}):e.jsxs("button",{onClick:()=>B.current?.click(),className:"flex items-center gap-1.5 text-xs text-ink-3 hover:text-ink",children:[e.jsx(I,{size:12})," Custom audio track (optional — uses pool if empty)"]})]}
1):t.has_card?e.jsxs("div",{children:[e.jsx("input",{ref:L,type:"file",accept:"image/jpeg,image/jpg,image/png",className:"hidden",onChange:U}),v?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:v,className:"h-10 w-16 rounded object-cover",alt:"bg"}),e.jsx("span",{className:"flex-1 truncate text-xs text-ink-2",children:x?.name}),e.jsx("button",{onClick:()=>{j(null),k(null)},className:"text-ink-3 hover:text-red",children:e.jsx(q,{size:13})})]}):e.jsxs("button",{onClick:()=>L.current?.click(),className:"flex items-center gap-1.5 text-xs text-ink-3 hover:text-ink",children:[e.jsx(I,{size:12})," Custom background (optional)"]})]}):null,_&&e.jsx("p",{className:"text-xs text-red",children:_}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>{T()},disabled:R||b.length===0,className:"flex items-center gap-1.5 rounded-md bg-ink px-3 py-1.5 text-xs font-medium text-white hover:bg-ink/90 disabled:opacity-50",children:[R?e.jsx(w,{size:12,className:"animate-spin"}):e.jsx(Q,{size:12}),h?u?"Schedule Reel":"Queue as Reel":u?"Schedule":"Queue now"]}),e.jsx("button",{onClick:a,className:"px-2 text-xs text-ink-3 hover:text-ink",children:"Cancel"})]})]})}function ke({item:t,cardUrl:s,onSaved:i,onCardUpdated:a}){const[n,p]=r.useState(t.copy),[d,u]=r.useState(t.card_config??{}),[o,h]=r.useState(!1),[C,b]=r.useState(!1),[N,x]=r.useState(!1),[j,v]=r.useState(null),[k,S]=r.useState(null),[z,R]=r.useState(!1),[g,_]=r.useState(!1),A=r.useRef(null);function L(l){p(l),R(l!==t.copy)}function B(l){const f={...d,...l};u(f),_(JSON.stringify(f)!==JSON.stringify(t.card_config??{}))}async function D(){h(!0);const l=await X(`/admin/social/queue/${t.uuid}`,{copy:n});h(!1),l.item&&(i(l.item),R(!1))}async function U(){b(!0);const l=await X(`/admin/social/queue/${t.uuid}`,{card_config:d});b(!1),l.item&&(i(l.item),_(!1))}async function T(l){x(!0);const f=new FormData,H=l??j;H&&f.append("background",H);const ee=await P(`/admin/social/queue/${t.uuid}/preview-card`,f);x(!1);const G=ee.card_image_url;G&&a(G)}function c(l){const f=l.target.files?.[0]??null;f&&(v(f),S(URL.createObjectURL(f)),T(f))}return e.jsxs("div",{className:"space-y-5 rounded-card border border-line bg-bg-2 p-4",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-eyebrow text-ink-3",children:"Edit post"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-ink-2",children:"Post copy"}),e.jsx("textarea",{value:n,onChange:l=>L(l.target.value),rows:5,className:"w-full resize-y rounded-md border border-line bg-white p-2.5 text-sm text-ink focus:outline-none focus:ring-1 focus:ring-ink"}),z&&e.jsxs("button",{onClick:()=>{D()},disabled:o,className:"mt-1.5 flex items-center gap-1 text-xs font-medium text-teal hover:text-teal/80 disabled:opacity-50",children:[o?e.jsx(w,{size:11,className:"animate-spin"}):e.jsx(E,{size:11}),"Save copy"]})]}),t.has_card&&e.jsxs("div",{className:"space-y-3 border-t border-line pt-4",children:[e.jsx("p",{className:"text-xs font-medium text-ink-2",children:"Card text"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-2xs text-ink-3",children:"Headline"}),e.jsx("input",{type:"text",value:d.headline??"",onChange:l=>B({headline:l.target.value}),className:"w-full rounded-md border border-line bg-white px-2.5 py-1.5 text-sm text-ink focus:outline-none focus:ring-1 focus:ring-ink"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-2xs text-ink-3",children:"Highlight phrase (lime accent)"}),e.jsx("input",{type:"text",value:d.highlight??"",onChange:l=>B({highlight:l.target.value}),className:"w-full rounded-md border border-line bg-white px-2.5 py-1.5 text-sm text-ink focus:outline-none focus:ring-1 focus:ring-ink",placeholder:"Optional"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-2xs text-ink-3",children:"Subtitle"}),e.jsx("input",{type:"text",value:d.subtitle??"",onChange:l=>B({subtitle:l.target.value}),className:"w-full rounded-md border border-line bg-white px-2.5 py-1.5 text-sm text-ink focus:outline-none focus:ring-1 focus:ring-ink",placeholder:"Optional"})]}),g&&e.jsxs("button",{onClick:()=>{U()},disabled:C,className:"flex items-center gap-1 text-xs font-medium text-teal hover:text-teal/80 disabled:opacity-50",children:[C?e.jsx(w,{size:11,className:"animate-spin"}):e.jsx(E,{size:11}),"Save card text"]})]}),t.has_card&&e.jsxs("div",{className:"space-y-2 border-t border-line pt-4",children:[e.jsx("p",{className:"text-xs font-medium text-ink-2",children:"Card background"}),e.jsx("input",{ref:A,type:"file",accept:"image/jpeg,image/jpg,image/png",className:"hidden",onChange:c}),k?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:k,className:"h-14 w-20 rounded-md object-cover border border-line",alt:"bg"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs text-ink-2",children:j?.name}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>A.current?.click(),className:"text-xs text-ink-3 hover:text-ink",children:"Change"}),e.jsxs("button",{onClick:()=>{T()},disabled:N,className:"flex items-center gap-1 text-xs text-teal hover:text-teal/80 disabled:opacity-50",children:[N?e.jsx(w,{size:11,className:"animate-spin"}):e.jsx(W,{size:11}),"Re-render"]})]})]})]}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>A.current?.click(),className:"flex items-center gap-1.5 rounded-md border border-line px-3 py-1.5 text-xs text-ink-2 hover:bg-bg transition-colors",children:[e.jsx(I,{size:12})," Upload background"]}
1),s&&e.jsxs("button",{onClick:()=>{T()},disabled:N,className:"flex items-center gap-1.5 text-xs text-ink-3 hover:text-ink disabled:opacity-50",children:[N?e.jsx(w,{size:11,className:"animate-spin"}):e.jsx(W,{size:11}),"Re-render from pool"]})]}),N&&!k&&e.jsx("p",{className:"text-xs text-ink-3",children:"Rendering card…"})]})]})}function Ne({item:t,profiles:s,selected:i,onSelect:a}){const[n,p]=r.useState(t),[d,u]=r.useState(!1),[o,h]=r.useState(!1),[C,b]=r.useState(!1),[N,x]=r.useState(!1),[j,v]=r.useState(n.card_image_url);if(N)return null;const k=["queued","published","dismissed"].includes(n.status);async function S(){await P(`/admin/social/queue/${n.uuid}/dismiss`,{}),x(!0)}async function z(){const g=!d;if(u(g),g&&n.has_card&&!j){const _=await P(`/admin/social/queue/${n.uuid}/preview-card`,{});_.card_image_url&&v(_.card_image_url)}}function R(g){p(g),JSON.stringify(g.card_config)!==JSON.stringify(n.card_config)&&v(null)}return e.jsxs("div",{className:m("rounded-card border border-line bg-white",i&&"ring-2 ring-ink/20"),children:[e.jsxs("div",{className:"flex items-start gap-3 p-4",children:[!k&&e.jsx("button",{onClick:()=>a(n.uuid,!i),className:m("mt-0.5 flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border transition-colors",i?"border-ink bg-ink text-white":"border-line-2 hover:border-ink"),children:i&&e.jsx(E,{size:10,strokeWidth:3})}),e.jsx("span",{className:m("flex-shrink-0 rounded-tag px-1.5 py-0.5 text-2xs font-bold uppercase tracking-eyebrow",ue[n.platform]??"bg-bg-2 text-ink"),children:V[n.platform]??n.platform}),e.jsxs("div",{className:"flex flex-shrink-0 flex-col gap-0.5",children:[e.jsx("span",{className:m("rounded-tag px-1.5 py-0.5 text-2xs font-medium tracking-pill",pe[n.source]??"bg-bg-2 text-ink-3"),children:n.source_label}),e.jsx("span",{className:"text-2xs uppercase tracking-eyebrow text-ink-3",children:n.content_type})]}),e.jsx("p",{className:"min-w-0 flex-1 line-clamp-2 text-sm leading-relaxed text-ink",children:n.copy}),e.jsxs("div",{className:"flex flex-shrink-0 items-start gap-2",children:[e.jsx(fe,{item:{...n,card_image_url:j}}),n.suggested_timing&&e.jsx("span",{className:"whitespace-nowrap text-2xs text-ink-3",children:n.suggested_timing}),e.jsx("span",{className:m("rounded-tag px-1.5 py-0.5 text-2xs font-medium capitalize tracking-pill",he[n.status]??"bg-bg-2 text-ink-3"),children:n.status}),!k&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{h(!o),d||u(!0)},className:m("text-ink-3 hover:text-ink transition-colors",o&&"text-ink"),title:"Edit post",children:e.jsx(ae,{size:14})}),e.jsx("button",{onClick:()=>{z()},className:"text-ink-3 hover:text-ink transition-colors",children:e.jsx(M,{size:16,className:m("transition-transform",d&&"rotate-180")})})]})]})]}),d&&!k&&e.jsxs("div",{className:"border-t border-line px-4 pb-5 pt-4 space-y-4",children:[o&&e.jsx(ke,{item:n,cardUrl:j,onSaved:R,onCardUpdated:g=>v(g)}),e.jsx("div",{className:"max-w-[500px]",children:e.jsx(ge,{item:n,cardUrl:j})}),C?e.jsx(je,{item:n,profiles:s,onDone:g=>{p(g),b(!1),u(!1)},onCancel:()=>b(!1)}):e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>b(!0),className:"flex items-center gap-1.5 rounded-md bg-ink px-3 py-1.5 text-xs font-medium text-white hover:bg-ink/90 transition-colors",children:[e.jsx(Q,{size:12})," Queue to Buffer"]}),e.jsxs("button",{onClick:()=>{S()},className:"flex items-center gap-1.5 rounded-md border border-line px-3 py-1.5 text-xs text-ink-3 hover:border-red hover:text-red transition-colors",children:[e.jsx(re,{size:12})," Dismiss"]})]})]})]})}function ve({selected:t,onClear:s}){const[i,a]=r.useState(!1),[n,p]=r.useState(null);async function d(){a(!0);const u=await P("/admin/social/queue/bulk-approve",{uuids:t});a(!1),p({queued:u.queued??0,failed:u.failed??0}),setTimeout(()=>{s(),F.reload()},1500)}return t.length===0?null:e.jsxs("div",{className:"sticky bottom-4 z-30 flex items-center justify-between rounded-card border border-line bg-white px-4 py-3 shadow-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(le,{size:15,className:"text-ink-2"}),e.jsxs("span",{className:"text-sm font-medium text-ink",children:[t.length," selected"]})]}),n?e.jsxs("span",{className:"text-sm text-green-ink",children:[n.queued," queued",n.failed>0?`, ${n.failed} failed`:""]}):e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:s,className:"px-2 text-xs text-ink-3 hover:text-ink",children:"Clear"}),e.jsxs("button",{onClick:()=>{d()},disabled:i,className:"flex items-center gap-1.5 rounded-md bg-ink px-3 py-1.5 text-xs font-medium text-white hover:bg-ink/90 disabled:opacity-50",children:[i?e.jsx(w,{size:12,className:"animate-spin"}):e.jsx(Q,{size:12}),"Queue ",t.length," to Buffer"]})]})]})}function ye({data:t,driverName:s,profiles:i}){const[a]=r.useState(t.items),[n,p]=r.useState([]),[d,u]=r.useState("all"),o=t.counts,h=(o.draft??0)+(o.approved??0),
1C=d==="all"?a:a.filter(x=>x.platform===d);function b(x,j){p(v=>j?[...v,x]:v.filter(k=>k!==x))}function N(){F.post("/admin/assistants/social_strategist/run",{},{onSuccess:()=>F.reload()})}return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[h>0&&e.jsxs("span",{className:"rounded-full bg-lime/20 px-3 py-1 text-xs font-medium text-lime-ink",children:[h," waiting"]}),e.jsxs("span",{className:"text-xs text-ink-3",children:[o.queued??0," queued · ",o.published??0," published"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!s&&e.jsx("span",{className:"text-xs text-red",children:"Buffer not connected"}),e.jsxs("button",{onClick:N,className:"flex items-center gap-1.5 rounded-md border border-line px-3 py-1.5 text-xs font-medium text-ink-2 hover:bg-bg transition-colors",children:[e.jsx(O,{size:12})," Run strategist"]})]})]}),e.jsx("div",{className:"flex gap-1.5",children:["all","x","linkedin","instagram"].map(x=>e.jsx("button",{onClick:()=>u(x),className:m("rounded-tag px-2.5 py-1 text-xs font-medium capitalize tracking-pill transition-colors",d===x?"bg-ink text-white":"bg-bg-2 text-ink-2 hover:bg-bg"),children:x==="all"?"All":V[x]??x},x))}),C.length===0?e.jsxs("div",{className:"rounded-card border border-line bg-bg-2 py-12 text-center",children:[e.jsx("p",{className:"text-sm text-ink-3",children:"Nothing waiting for review."}),e.jsx("p",{className:"mt-1 text-xs text-ink-3",children:"Run the strategist or publish a policy update to populate the queue."})]}):e.jsx("div",{className:"space-y-2",children:C.map(x=>e.jsx(Ne,{item:x,profiles:i,selected:n.includes(x.uuid),onSelect:b},x.uuid))}),e.jsx(ve,{selected:n,onClear:()=>p([])})]})}const Y={policy:"bg-amber/12 text-amber-ink",news:"bg-teal/10 text-teal",sponsor_announcement:"bg-green/10 text-green-ink"},Z={policy:"Policy",news:"News",sponsor_announcement:"Sponsor"};function we({u:t}){const[s,i]=r.useState(!1),a=!!(t.x_copy||t.ig_copy);return e.jsxs("div",{className:"border-b border-line-2 last:border-b-0",children:[e.jsxs("button",{type:"button",onClick:()=>i(n=>!n),className:"flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-bg-2",children:[e.jsx(M,{className:m("h-3.5 w-3.5 shrink-0 text-ink-3 transition-transform",s&&"rotate-180")}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-ink",children:t.title}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[e.jsx("span",{className:m("rounded-tag px-2 py-0.5 text-2xs font-medium",Y[t.kind]??"bg-ink/8 text-ink-2"),children:Z[t.kind]??t.kind}),t.published_at&&e.jsx("span",{className:"text-2xs text-ink-3",children:t.published_at}),a?e.jsx("span",{className:"text-2xs text-green-ink",children:"Copy ready"}):e.jsx("span",{className:"text-2xs text-amber-ink",children:"No copy yet"})]})]}),e.jsx(y,{href:`/admin/policy-updates/${t.uuid}`,onClick:n=>n.stopPropagation(),className:"shrink-0 text-ink-3 hover:text-teal",children:e.jsx(K,{className:"h-3 w-3"})})]}),s&&e.jsx("div",{className:"border-t border-line-2 bg-bg-2/40 px-4 pb-3 pt-3",children:a?e.jsxs("p",{className:"text-xs text-ink-3",children:["Social copy generated. Review and queue from the"," ",e.jsx(y,{href:"/admin/social/queue?source=policy_update",className:"text-teal hover:underline",children:"Social Queue"}),"."]}):e.jsx(Ce,{uuid:t.uuid})})]})}function Ce({uuid:t}){const[s,i]=r.useState("idle");async function a(){i("loading");const n=await P(`/admin/social/generate-policy-copy/${t}`,{});i(n.x_copy||n.ig_copy?"done":"error")}return s==="done"?e.jsx("p",{className:"text-xs text-green-ink",children:"Copy generated. Check the Social Queue."}):s==="error"?e.jsx("p",{className:"text-xs text-red",children:"Generation failed. Try from the policy update page."}):e.jsxs("button",{onClick:()=>{a()},disabled:s==="loading",className:"flex items-center gap-1.5 rounded-md border border-line px-2.5 py-1 text-xs font-medium text-ink-2 hover:bg-bg disabled:opacity-50",children:[s==="loading"?e.jsx(w,{size:12,className:"animate-spin"}):e.jsx(O,{size:12}),s==="loading"?"Generating…":"Generate social copy"]})}function Se({data:t}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx(J,{label:`Pending review${t.pending_count>0?` (${t.pending_count})`:""}`,action:e.jsx(y,{href:"/admin/policy-updates?status=pending",className:"text-2xs text-teal hover:underline",children:"View all"})}),t.pending.length===0?e.jsx("div",{className:"rounded-card border border-line bg-bg-2 px-4 py-3 text-sm text-ink-3",children:"All caught up."}):e.jsx("div",{className:"rounded-card border border-line bg-white",children:t.pending.map((s,i)=>e.jsxs("div",{className:m("flex items-start gap-3 px-4 py-3",i<t.pending.length-1&&"border-b border-line-2"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-ink leading-snug",children:s.title}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:m("rounded-tag px-2 py-0.5 text-2xs font-medium",Y[s.kind]??"bg-ink/8 text-ink-2"),children:Z[s.kind]??s.kind}),s.impact_level&&e.jsx("span",{className:m("rounded-tag px-2 py-0.5 text-2xs font-medium",me[s.impact_level]??"bg-ink/8 text-ink-2"),children:s.impact_level}),s.original_published_at&&e.jsx("span",{className:"text-2xs text-ink-3",children:s.original_published_at})]}),s.excerpt&&e.jsx("p",{className:"mt-1 text-xs text-ink-2 line-clamp-2",children:s.excerpt})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 pt-0.5",children:[e.jsx(_e,{uuid:s.uuid}),e.jsxs(y,{href:`/admin/policy-updates/${s.uuid}`,className:"inline-flex items-center gap-1 rounded-md border border-line px-2.5 py-1 text-2xs font-medium text-ink-2 hover:bg-bg",children:["Review ",e.jsx(K,{className:"h-3 w-3"})]})]})]},s.uuid))})]}),e.jsxs("div",{children:[e.jsx(J,{label:"Recently published",action:e.jsx(y,{href:"/admin/policy-updates?status=published",className:"text-2xs text-teal hover:underline",children:"All published"})}),t.recent.length===0?e.jsx("p",{className:"text-sm text-ink-3",children:"None published yet."}):e.jsx("div",{className:"rounded-card border border-line bg-white",children:t.recent.map(s=>e.jsx(we,{u:s},s.uuid))})]}),e.jsx("div",{className:"border-t border-line-2 pt-3",children:e.jsx(y,{href:"/admin/policy-updates",className:"text-xs text-teal hover:underline",children:"All policy updates"})})]})}function _e({uuid:t}){const[s,i]=r.useState(!1),[a,n]=r.useState(!1);function p(){i(!0),F.post(`/admin/policy-updates/${t}/approve-and-publish`,{},{onSuccess:()=>n(!0),onFinish:()=>i(!1)})}return a?e.jsx("span",{className:"text-2xs text-green-ink",children:"Published"}):e.jsxs("button",{type:"button",onClick:p,disabled:s,className:"inline-flex items-center gap-1 rounded-md border border-green/30 bg-green/8 px-2.5 py-1 text-2xs font-medium text-green-ink hover:bg-green/12 disabled:opacity-50",children:[s?e.jsx(w,{className:"h-3 w-3 animate-spin"}):e.jsx(E,{className:"h-3 w-3"}),s?"…":"Approve & publish"]})}function Re({whatsapp:t}){const[s,i]=r.useState(!1);function a(){i(!0),F.post("/admin/assistants/whatsapp/run-all",{},{onFinish:()=>i(!1)})}return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-ink-2",children:"Four community digest groups — generated 
1weekly, copy and paste to WhatsApp."}),e.jsxs("button",{type:"button",onClick:a,disabled:s,className:"inline-flex items-center gap-1.5 rounded-md border border-line px-3 py-1.5 text-xs font-medium text-ink-2 hover:bg-bg disabled:opacity-50",children:[s?e.jsx(w,{className:"h-3 w-3 animate-spin"}):e.jsx(O,{className:"h-3 w-3"}),s?"Running…":"Run all digests"]})]}),t.digests.map(n=>e.jsx(Ae,{digest:n},n.slug))]})}function Ae({digest:t}){const[s,i]=r.useState(!1),a=t.latest_run;function n(){i(!0),F.post(`/admin/assistants/${t.slug}/run`,{},{onFinish:()=>i(!1)})}return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("h2",{className:"text-sm font-semibold text-ink",children:t.label}),a&&e.jsx("span",{className:m("rounded-tag px-2 py-0.5 text-2xs font-bold",oe[a.status]??"bg-bg-2 text-ink-3"),children:xe[a.status]??a.status}),e.jsxs("button",{type:"button",onClick:n,disabled:s||a?.status==="running"||a?.status==="pending",className:"ml-auto inline-flex items-center gap-1.5 rounded-md border border-line px-2.5 py-1 text-2xs font-medium text-ink-2 hover:bg-bg disabled:opacity-50",children:[s?e.jsx(w,{className:"h-3 w-3 animate-spin"}):e.jsx(O,{className:"h-3 w-3"}),s?"Queuing…":"Run"]})]}),a?.output?e.jsx(ne,{output:a.output}):e.jsx("div",{className:"rounded-card border border-line bg-bg-2 px-4 py-3 text-sm text-ink-3",children:a?.status==="running"||a?.status==="pending"?"Generating — check back in a moment.":"No digest yet."})]})}function Pe({broadcasts:t}){return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex gap-6",children:[e.jsxs("span",{className:"text-sm text-ink-2",children:[e.jsx("span",{className:"font-semibold text-ink",children:t.total})," total"]}),t.scheduled_count>0&&e.jsxs("span",{className:"text-sm text-ink-2",children:[e.jsx("span",{className:"font-semibold text-amber-ink",children:t.scheduled_count})," scheduled"]})]}),e.jsx(y,{href:"/admin/broadcasts/create",className:"inline-flex items-center gap-1.5 rounded-md bg-ink px-3 py-1.5 text-xs font-medium text-white hover:bg-ink/90",children:"New broadcast"})]}),t.recent.length===0?e.jsx("p",{className:"text-sm text-ink-3",children:"No broadcasts yet."}):e.jsx("div",{className:"rounded-card border border-line bg-white",children:t.recent.map((s,i)=>e.jsxs(y,{href:`/admin/broadcasts/${s.uuid}`,className:"flex items-center gap-3 border-b border-line-2 px-4 py-3 last:border-b-0 hover:bg-bg-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-ink",children:s.title}),s.scheduled_at&&e.jsx("p",{className:"text-2xs text-ink-3",children:new Date(s.scheduled_at).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.sent_count>0&&e.jsxs("span",{className:"text-2xs text-ink-3",children:[s.sent_count.toLocaleString()," sent"]}),e.jsx(se,{variant:s.status_badge,children:s.status})]})]},i))}),e.jsxs("div",{className:"flex items-center gap-4 border-t border-line-2 pt-3",children:[e.jsx(y,{href:"/admin/broadcasts",className:"text-xs text-teal hover:underline",children:"All broadcasts"}),e.jsx(y,{href:"/admin/suppressions",className:"text-xs text-ink-3 hover:underline",children:"Email suppressions"}),e.jsx(y,{href:"/admin/newsletter",className:"text-xs text-ink-3 hover:underline",children:"Newsletter"})]})]})}const ze=[{id:"social",label:"Social Queue"},{id:"policy",label:"Policy Updates"},{id:"whatsapp",label:"WhatsApp"},{id:"broadcasts",label:"Broadcasts"}];function pt({social_queue:t,whatsapp:s,broadcasts:i,policy_updates:a,publishing_driver:n,publishing_profiles:p}){const[d,u]=r.useState("social");return e.jsxs(ie,{children:[e.jsx(te,{title:"Publish — Admin"}),e.jsxs("div",{className:"sticky top-12 z-10 flex overflow-x-auto border-b border-line bg-surface lg:top-0",children:[ze.map(o=>e.jsxs("button",{type:"button",onClick:()=>u(o.id),className:m("-mb-px whitespace-nowrap border-b-2 px-4 py-3 text-sm font-medium transition-colors",d===o.id?"border-ink font-semibold text-ink":"border-transparent text-ink-3 hover:text-ink"),children:[o.label,o.id==="social"&&t.counts.draft+t.counts.approved>0&&e.jsx("span",{className:"ml-1.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-lime/20 px-1 text-2xs font-bold text-lime-ink",children:t.counts.draft+t.counts.approved}),o.id==="policy"&&a.pending_count>0&&e.jsx("span",{className:"ml-1.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-amber/20 px-1 text-2xs font-bold text-amber-ink",children:a.pending_count})]},o.id)),e.jsx("span",{className:m("ml-auto flex items-center gap-1.5 px-4 text-2xs",n?"text-green-ink":"text-red"),
1children:n?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-green"}),n," connected"]}):"Buffer not configured"})]}),e.jsxs("div",{className:"px-4 py-5 sm:px-7 sm:py-6",children:[d==="social"&&e.jsx(ye,{data:t,driverName:n,profiles:p}),d==="policy"&&e.jsx(Se,{data:a}),d==="whatsapp"&&e.jsx(Re,{whatsapp:s}),d==="broadcasts"&&e.jsx(Pe,{broadcasts:i})]})]})}export{pt 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.