PageSourceSearch

https://www.socialscout.ai/_next/static/immutable/chunks/3sjkxh71ao41r.js

js socialscout.ai collected 2026-10-05 15:08:08 UTC 151,929 bytes, 9 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,961512,e=>{"use strict";var t=e.i(843476),r=e.i(271645),a=e.i(522016),n=e.i(217255),s=e.i(618566);function i(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)"__proto__"!==a&&(e[a]=r[a])}return e}var o=function e(t,r){function a(e,a,n){if("u">typeof document){"number"==typeof(n=i({},r,n)).expires&&(n.expires=new Date(Date.now()+864e5*n.expires)),n.expires&&(n.expires=n.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var o in n)n[o]&&(s+="; "+o,!0!==n[o]&&(s+="="+n[o].split(";")[0]));return document.cookie=e+"="+t.write(a,e)+s}}return Object.create({set:a,get:function(e){if("u">typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],a={},n=0;n<r.length;n++){var s=r[n].split("="),i=s.slice(1).join("=");try{var o=decodeURIComponent(s[0]);if(o in a||(a[o]=t.read(i,o)),e===o)break}catch(e){}}return e?a[e]:a}},remove:function(e,t){a(e,"",i({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,i({},this.attributes,t))},withConverter:function(t){return e(i({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"}),l=e.i(925489),c=e.i(673130),d=e.i(237264);let u={notifications:[],unreadCount:0,loading:!0},x=new Set,m=null,p=null,h=!1,g=0,f=null;function b(e){for(let t of(u={...u,...e},x))t()}async function y(){return p||(p=fetch("/api/notifications?limit=20").then(e=>401===e.status?(C(),null):e.ok?e.json():null).then(e=>{if(!e){u.loading&&b({loading:!1});return}let t=e.notifications||[];if(f){let e=t.filter(e=>!e.read&&!f.has(e._id));e.length&&function(e){for(let t of e)t.task&&window.dispatchEvent(new CustomEvent("ss-task-event",{detail:{taskId:"object"==typeof t.task?t.task._id:t.task,type:t.type,sender:t.sender}}))}(e)}f=new Set(t.map(e=>e._id)),g=Date.now(),b({notifications:t,unreadCount:e.unreadCount||0,loading:!1})}).catch(()=>{u.loading&&b({loading:!1})}).finally(()=>{p=null}))}function v(){return"u"<typeof document||"hidden"!==document.visibilityState}function k(){m||(m=setInterval(y,3e4))}function w(){m&&(clearInterval(m),m=null)}function j(){v()?(y(),k()):w()}function N(){y()}function C(){w(),h&&(window.removeEventListener("ss-notifications-changed",N),document.removeEventListener("visibilitychange",j),h=!1)}async function S(e){let t=u;b({notifications:u.notifications.map(t=>t._id===e?{...t,read:!0}:t),unreadCount:Math.max(0,u.unreadCount-1)});try{await fetch("/api/notifications/read",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({notificationId:e})})}catch{b({notifications:t.notifications,unreadCount:t.unreadCount})}}async function z(){let e=u;b({notifications:u.notifications.map(e=>({...e,read:!0})),unreadCount:0});try{await fetch("/api/notifications/read",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({all:!0})})}catch{b({notifications:e.notifications,unreadCount:e.unreadCount})}}function E(){let[,e]=(0,r.useState)(0),{status:t}=(0,n.useSession)();(0,r.useEffect)(()=>{if("authenticated"!==t)return;let r=()=>e(e=>e+1);return x.add(r),1===x.size?(v()&&(y(),k()),h||(h=!0,window.addEventListener("ss-notifications-changed",N),document.addEventListener("visibilitychange",j))):Date.now()-g>3e4&&y(),()=>{x.delete(r),0===x.size&&C()}},[t]);let a=(0,r.useCallback)(e=>S(e),[]),s=(0,r.useCallback)(()=>z(),[]),i=(0,r.useCallback)(()=>y(),[]);return{notifications:u.notifications,unreadCount:u.unreadCount,loading:u.loading,markAsRead:a,markAllAsRead:s,refresh:i}}var T=e.i(662060),M=e.i(779529),L=e.i(259030),I=e.i(263150),_=e.i(163858),R=e.i(639793),A=e.i(269519),D=e.i(754863),$=e.i(507153),P=e.i(247103);let W={task_assigned:T.UserPlusIcon,task_status_changed:M.ArrowPathIcon,task_comment:L.ChatBubbleLeftIcon,task_comment_reply:L.ChatBubbleLeftIcon,task_mention:R.AtSymbolIcon,task_due_soon:I.ExclamationTriangleIcon,task_overdue:I.ExclamationTriangleIcon,task_completed:_.CheckCircleIcon,org_claim_requested:A.BuildingOfficeIcon,org_claim_approved:A.BuildingOfficeIcon,org_claim_rejected:A.BuildingOfficeIcon,org_merge_requested:D.ArrowsRightLeftIcon,org_merge_approved:D.ArrowsRightLeftIcon,org_merge_executed:D.ArrowsRightLeftIcon,org_merge_failed:D.ArrowsRightLeftIcon},B={task_assigned:"text-blue-500",task_status_changed:"text-orange-500",task_comment:"text-gray-500 dark:text-zinc-400",task_comment_reply:"text-gray-500 dark:text-zinc-400",task_mention:"text-purple-500",task_due_soon:"text-yellow-600",task_overdue:"text-red-500",task_completed:"text-green-500",org_claim_requested:"text-emerald-500",org_claim_approved:"text-emerald-500",org_claim_rejected:"text-red-500",org_merge_requested:"text-indigo-500",org_merge_approved:"text-indigo-500",org_merge_executed:"text-emerald-500",org_merge_failed:"text-red-500"};function F({notifications:e,pendingApprovals:r=[],onMarkAsRead:a,onMarkAllAsRead:n,onClose:i}){let o=(0,s.useRouter)();return(0,t.jsxs)("div",{className:"absolute right-0 mt-2 w-80 bg-white dark:bg-zinc-950 rounded-2xl shadow-2xl border border-gray-100 dark:border-zinc-800 overflow-hidden z-[100]",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-100 dark:border-zinc-800",children:[(0,t.jsx)("h3",{className:"text-sm font-bold text-gray-800 dark:text-zinc-100",children:"Notifications"}),e.some(e=>!e.read)&&(0,t.jsx)("button",{onClick:n,className:"text-[11px] text-orange-500 hover:text-orange-600 font-medium",children:"Mark all read"})]}),r.length>0&&(0,t.jsxs)("div",{className:"border-b border-gray-100 dark:border-zinc-800",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 pt-3 pb-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)($.CheckBadgeIcon,{className:"w-3.5 h-3.5 text-indigo-500"}),(0,t.jsx)("span",{className:"text-[10px] font-bold uppercase tracking-widest text-indigo-500 dark:text-indigo-400",children:"Approvals"}),(0,t.jsx)("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded-full",style:{background:"rgba(99,102,241,0.12)",color:"#6366f1"},children:r.length})]}),(0,t.jsxs)("button",{onClick:()=>{o.push("/dashboard/user/tasks?taskType=approval"),i()},className:"text-[10px] font-semibold text-indigo-500 hover:text-indigo-600 dark:text-indigo-400 dark:hover:text-indigo-300 flex items-center gap-0.5 transition-colors",children:["View all ",(0,t.jsx)(P.ChevronRightIcon,{className:"w-2.5 h-2.5"})]})]}),r.slice(0,3).map(e=>(0,t.jsxs)("button",{onClick:()=>{o.push("/dashboard/user/tasks?taskType=approval"),i()},className:"w-full text-left px-4 py-2 flex items-start gap-2.5 transition-colors hover:bg-indigo-50/40 dark:hover:bg-indigo-500/10",children:[(0,t.jsx)("div",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0 mt-1.5",style:{background:"#6366f1"}}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"text-xs font-semibold text-gray-800 dark:text-zinc-100 line-clamp-1",children:e.title}),e.dueDate&&(0,t.jsxs)("p",{className:"text-[10px] text-gray-400 dark:text-zinc-500 mt-0.5",children:["Due ",new Date(e.dueDate).toLocaleDateString()]})]})]},e._id)),r.length>3&&(0,t.jsxs)("p",{className:"px-4 pb-2 text-[10px] text-gray-400 dark:text-zinc-500",children:["+",r.length-3," more"]})]}),(0,t.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:0===e.length?(0,t.jsx)("div",{className:"py-12 text-center",children:(0,t.jsx)("p",{className:"text-sm text-gray-400 dark:text-zinc-500",children:"No notifications"})}):e.slice(0,15).map(e=>{let r=W[e.type]||_.CheckCircleIcon,n=B[e.type]||"text-gray-400 dark:text-zinc-500";return(0,t.jsxs)("button",{onClick:()=>{let t;
1return e.read||a(e._id),void((t=function(e){if(e.link)return e.link;switch(e.type){case"org_claim_requested":return"/dashboard/admin/claims";case"org_claim_approved":case"org_claim_rejected":return e.metadata?.orgId?`/dashboard/user/organization/${e.metadata.orgId}`:"/dashboard/user/notifications";case"org_merge_requested":case"org_merge_approved":return"/dashboard/admin/merges";case"org_merge_executed":case"org_merge_failed":return e.metadata?.destinationOrgId?`/dashboard/user/organization/${e.metadata.destinationOrgId}`:"/dashboard/admin/merges";default:return null}}(e))&&o.push(t),i())},className:`w-full text-left px-4 py-3 flex items-start gap-3 transition-colors hover:bg-gray-50 dark:hover:bg-zinc-900 ${!e.read?"bg-blue-50/40 dark:bg-blue-500/10":""}`,children:[(0,t.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:(0,t.jsx)(r,{className:`w-5 h-5 ${n}`})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:`text-xs ${!e.read?"font-semibold text-gray-800 dark:text-zinc-100":"text-gray-600 dark:text-zinc-400"} line-clamp-2`,children:e.title}),e.body&&(0,t.jsx)("p",{className:"text-[11px] text-gray-400 dark:text-zinc-500 mt-0.5 truncate",children:e.body}),(0,t.jsx)("p",{className:"text-[10px] text-gray-400 dark:text-zinc-500 mt-1",children:function(e){let t=Math.floor((new Date-new Date(e))/1e3);if(t<60)return"just now";let r=Math.floor(t/60);if(r<60)return`${r}m ago`;let a=Math.floor(r/60);if(a<24)return`${a}h ago`;let n=Math.floor(a/24);return`${n}d ago`}(e.createdAt)})]}),!e.read&&(0,t.jsx)("div",{className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0 mt-1.5"})]},e._id)})}),e.length>0&&(0,t.jsx)("div",{className:"border-t border-gray-100 dark:border-zinc-800 px-4 py-2.5",children:(0,t.jsx)("button",{onClick:()=>{o.push("/dashboard/user/notifications"),i()},className:"w-full text-xs text-center text-orange-500 hover:text-orange-600 font-medium",children:"View all notifications"})})]})}function O(){let{notifications:e,unreadCount:a,markAsRead:s,markAllAsRead:i}=E(),{pendingApprovals:o,count:l}=function(){let{data:e}=(0,n.useSession)(),[t,a]=(0,r.useState)([]),[s,i]=(0,r.useState)(0),o=(0,r.useRef)(null),l=(0,r.useCallback)(async()=>{if(!e?.user)return;let t=e.user._id||e.user.id;if(t)try{let e=await fetch(`/api/tasks?taskType=approval&assignee=${t}&excludeStatuses=Done&limit=10`);if(e.ok){let t=(await e.json()).tasks||[];a(t),i(t.length)}}catch{}},[e]);return(0,r.useEffect)(()=>{if(e?.user)return l(),o.current=setInterval(l,6e4),window.addEventListener("ss-notifications-changed",t),window.addEventListener("ss-task-event",t),()=>{o.current&&clearInterval(o.current),window.removeEventListener("ss-notifications-changed",t),window.removeEventListener("ss-task-event",t)};function t(){l()}},[e,l]),{pendingApprovals:t,count:s}}(),[c,u]=(0,r.useState)(!1),x=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){x.current&&!x.current.contains(e.target)&&u(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let m=a+l;return(0,t.jsxs)("div",{ref:x,className:"relative",children:[(0,t.jsxs)("button",{onClick:()=>u(!c),className:"relative w-9 h-9 flex items-center justify-center rounded-full hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors",children:[(0,t.jsx)(d.BellIcon,{className:"w-5 h-5 text-gray-500 dark:text-zinc-400"}),m>0&&(0,t.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[18px] h-[18px] flex items-center justify-center bg-red-500 text-white text-[10px] font-bold rounded-full px-1 animate-pulse",children:m>99?"99+":m})]}),c&&(0,t.jsx)(F,{notifications:e,pendingApprovals:o,onMarkAsRead:s,onMarkAllAsRead:i,onClose:()=>u(!1)})]})}var q=e.i(992733),U=e.i(40280),H=e.i(489970),G=e.i(879945);let K=["light","dark","system"],V={light:"Light theme",dark:"Dark theme",system:"System theme"};function J({className:e=""}){let{theme:r,setTheme:a}=(0,G.useTheme)(),n="dark"===r?U.MoonIcon:"light"===r?q.SunIcon:H.ComputerDesktopIcon;return(0,t.jsx)("button",{type:"button",onClick:()=>{let e=K.indexOf(r);a(K[(e+1)%K.length])},title:V[r],"aria-label":`Switch theme (currently ${V[r]}
1)`,className:"w-9 h-9 rounded-xl flex items-center justify-center transition-all duration-200 bg-[var(--surface-soft)] hover:bg-[var(--surface-softer)] text-gray-700 dark:text-zinc-300 hover:text-gray-900 dark:hover:text-zinc-100 "+e,children:(0,t.jsx)(n,{className:"w-4 h-4"})})}let Q=[{key:"all",label:"All"},{key:"super_admin",label:"Super admin"},{key:"admin",label:"Admin"},{key:"user",label:"User"},{key:"creator",label:"Creator"},{key:"organization",label:"Organization"},{key:"agency",label:"My agency"}];function Y(){let{data:e,update:a}=(0,n.useSession)(),i=(0,s.useRouter)(),[o,l]=(0,r.useState)(!1),[c,d]=(0,r.useState)(""),[u,x]=(0,r.useState)("all"),[m,p]=(0,r.useState)([]),[h,g]=(0,r.useState)(!1),[f,b]=(0,r.useState)(!1),y=(0,r.useRef)(null),v=e?.realRole,k=e?.viewAs,w=e?.user?.agency?.id||null;(0,r.useEffect)(()=>{if(!o)return;let e=e=>{y.current&&!y.current.contains(e.target)&&l(!1)},t=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[o]),(0,r.useEffect)(()=>{if(!o)return;let e=!1;g(!0);let t=setTimeout(async()=>{try{let t=await fetch(`/api/view-as/search?q=${encodeURIComponent(c)}&limit=30`);if(!t.ok)return;let r=await t.json();e||p(r.users||[])}finally{e||g(!1)}},200);return()=>{e=!0,clearTimeout(t)}},[o,c]);let j=m.filter(e=>"all"===u||("creator"===u?!!e.creator:"organization"===u?!!e.organization:"agency"===u?w&&e.agency?._id?.toString?.()===w.toString():e.role===u)),N=(0,r.useCallback)(async e=>{b(!0);try{await a({viewAsUserId:e}),l(!1),i.refresh(),window.location.reload()}finally{b(!1)}},[a,i]),C=(0,r.useCallback)(async()=>{b(!0);try{await a({viewAsUserId:null}),l(!1),i.refresh(),window.location.reload()}finally{b(!1)}},[a,i]);if("super_admin"!==v)return null;let S=!!k?.active,z=k?.target?.name||"";return(0,t.jsxs)("div",{className:"relative",ref:y,children:[(0,t.jsx)("button",{onClick:()=>l(e=>!e),className:`group relative flex items-center gap-2 px-3 py-1.5 rounded-xl text-[12px] font-medium transition-all duration-200 ${S?"text-white":"text-gray-700 dark:text-zinc-300 hover:bg-white/60 dark:hover:bg-zinc-950/60"}`,style:S?{background:"linear-gradient(to right, #ec4899, #f97316)"}:void 0,children:S?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-white dark:bg-white animate-pulse"}),(0,t.jsxs)("span",{className:"truncate max-w-[140px]",children:["Viewing as ",z.split(" ")[0]]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),(0,t.jsx)("span",{children:"View as…"})]})}),o&&(0,t.jsxs)("div",{className:"absolute right-0 mt-2 w-[360px] rounded-2xl border border-gray-200/70 dark:border-zinc-800/70 bg-white/95 dark:bg-zinc-950/95 backdrop-blur-xl shadow-2xl shadow-black/5 z-50 overflow-hidden",children:[S&&(0,t.jsx)("div",{className:"px-4 py-2.5 border-b border-gray-200/70 dark:border-zinc-800/70 bg-pink-50/60 dark:bg-pink-950/20",children:(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"text-[12px] text-gray-700 dark:text-zinc-300 truncate",children:["Currently viewing as"," ",(0,t.jsx)("span",{className:"font-semibold",children:z})]}),(0,t.jsx)("button",{onClick:C,disabled:f,className:"text-[12px] font-semibold text-pink-600 dark:text-pink-400 hover:underline disabled:opacity-50",children:"Exit"})]})}),(0,t.jsxs)("div",{className:"p-3 border-b border-gray-200/70 dark:border-zinc-800/70",children:[(0,t.jsx)("input",{autoFocus:!0,t
1ype:"text",value:c,onChange:e=>d(e.target.value),placeholder:"Search by name or email…",className:"w-full px-3 py-2 text-[13px] rounded-lg bg-white dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 text-gray-900 dark:text-zinc-100 placeholder-gray-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-pink-500/30"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:Q.map(e=>(0,t.jsx)("button",{onClick:()=>x(e.key),className:`px-2.5 py-1 text-[11px] font-medium rounded-full transition-colors ${u===e.key?"bg-gradient-to-r from-pink-500 to-orange-400 text-white shadow-sm":"bg-gray-100 dark:bg-zinc-900 text-gray-600 dark:text-zinc-400 hover:bg-gray-200 dark:hover:bg-zinc-800"}`,children:e.label},e.key))})]}),(0,t.jsxs)("div",{className:"max-h-[320px] overflow-y-auto",children:[h&&(0,t.jsx)("div",{className:"px-4 py-6 text-center text-[12px] text-gray-500 dark:text-zinc-400",children:"Loading…"}),!h&&0===j.length&&(0,t.jsx)("div",{className:"px-4 py-6 text-center text-[12px] text-gray-500 dark:text-zinc-400",children:"No users match."}),!h&&j.map(e=>{let r=S&&k?.target?._id?.toString()===e._id?.toString(),a=(e.name||e.email||"?").split(" ").map(e=>e[0]).join("").slice(0,2).toUpperCase(),n=[];return e.role&&n.push(e.role.replace("_"," ")),e.agency?.name&&n.push(e.agency.name),e.creator?.name&&n.push("creator"),e.organization?.name&&n.push("org"),(0,t.jsxs)("button",{onClick:()=>!r&&N(e._id),disabled:f||r,className:`w-full flex items-center gap-3 px-4 py-2.5 text-left hover:bg-gray-50 dark:hover:bg-zinc-900 transition-colors disabled:opacity-50 ${r?"bg-pink-50/40 dark:bg-pink-950/10":""}`,children:[e.image?(0,t.jsx)("img",{src:e.image,alt:e.name,className:"w-8 h-8 rounded-full object-cover"}):(0,t.jsx)("div",{className:"w-8 h-8 rounded-full bg-gradient-to-br from-gray-700 to-gray-900 flex items-center justify-center dark:from-zinc-300 dark:to-zinc-100",children:(0,t.jsx)("span",{className:"text-[10px] font-bold text-white",children:a})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-[13px] font-semibold text-gray-900 dark:text-zinc-100 truncate",children:e.name||e.email}),(0,t.jsx)("div",{className:"text-[11px] text-gray-500 dark:text-zinc-400 truncate",children:e.email}),n.length>0&&(0,t.jsx)("div",{className:"mt-0.5 flex flex-wrap gap-1",children:n.map((e,r)=>(0,t.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-gray-100 dark:bg-zinc-900 text-gray-600 dark:text-zinc-400",children:e},r))})]}),r&&(0,t.jsx)("span",{className:"text-[10px] font-semibold text-pink-600 dark:text-pink-400",children:"ACTIVE"})]},e._id)})]})]})]})}function Z(){let{data:e,status:i}=(0,n.useSession)(),d=(0,s.useRouter)(),u=(0,s.usePathname)(),[x,m]=(0,r.useState)(!1),p=(0,r.useRef)(null);if((0,r.useEffect)(()=>{if(x)return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)};function e(e){p.current&&!p.current.contains(e.target)&&m(!1)}function t(e){"Escape"===e.key&&m(!1)}},[x]),u.includes("/dashboard/user/campaign/"))return null;let h=async()=>{o.remove("next-auth.session-token"),o.remove("next-auth.csrf-token"),await (0,n.signOut)({redirect:!1}),localStorage.clear(),sessionStorage.clear(),d.push("/login")},g=["admin","super_admin","qyou_studios"].includes(e?.user?.role?.trim().toLowerCase()),f=`/dashboard/${g?"admin":"user"}`,b=e?.user?.name?e.user.name.split(" ").map(e=>e[0]).join("").slice(0,2).toUpperCase():"?",y=(0,t.jsx)(t.Fragment,{children:e?.user?.image?(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute -inset-0.5 bg-gradient-to-r from-pink-500 to-orange-400 rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),(0,t.jsx)("img",{src:e.user.image,alt:e.user.name,className:"relative w-8 h-8 rounded-full object-cover ring-2 ring-white dark:ring-zinc-950"})]}):(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute -inset-0.5 bg-gradient-to-r from-pink-500 to-orange-400 rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),(0,t.jsx)("div",{className:"relative w-8 h-8 rounded-full bg-gradient-to-br from-gray-800 to-gray-900 ring-2 ring-white dark:ring-zinc-950 flex items-center justify-center",children:(0,t.jsx)("span",{className:"text-[11px] font-bold text-white leading-none",children:b})})]})});return(0,t.jsx)("nav",{className:"relative z-50",children:(0,t.jsx)("div",{className:"mx-4 sm:mx-6 md:mx-28",children:(0,t.jsxs)("div",{className:"flex items-center justify-between h-16 gap-2",children:[(0,t.jsxs)(a.default,{href:"/",className:"flex items-center gap-2.5 group flex-shrink-0",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-pink-500 to-orange-400 rounded-xl opacity-0 group-hover:opacity-100 blur-lg transition-opacity duration-500"}),(0,t.jsx)("img",{src:"/social-scout-logo.svg",alt:"Social Scout",className:"relative w-9 h-9 transition-transform duration-300 group-hover:scale-110"})]}),(0,t.jsxs)("span",{className:"text-[15px] font-bold tracking-tight text-gray-900 dark:text-zinc-100 whitespace-nowrap",children:["Social",(0,t.jsx)("span",{className:"bg-gradient-to-r from-pink-500 to-orange-400 bg-clip-text text-transparent",children:"Scout"})]})]}),"authenticated"===i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"hidden md:flex items-center gap-3 flex-shrink-0",children:[(0,t.jsxs)(a.default,{href:f,className:"group relative flex items-center gap-2.5 px-2 py-1.5 rounded-xl transition-all duration-200 hover:bg-white/60 dark:hover:bg-zinc-950/60",children:[y,(0,t.jsx)("span",{className:"text-sm font-medium text-gray-700 dark:text-zinc-300 group-hover:text-gray-900 dark:group-hover:text-zinc-100 transition-colors",children:e.user.name?.split(" ")[0]})]}),(0,t.jsx)(Y,{}),(0,t.jsx)(O,{}),(0,t.jsx)(J,{}),(0,t.jsx)("div",{className:"h-5 w-px bg-gray-200 dark:bg-zinc-800"}),(0,t.jsx)("button",{onClick:h,className:"text-[13px] font-medium text-gray-400 dark:text-zinc-500 hover:text-gray-700 dark:hover:text-zinc-300 transition-colors duration-200 px-2 py-1.5 rounded-lg hover:bg-white/60 dark:hover:bg-zinc-950/60",children:"Logout"})]}),(0,t.jsxs)("div",{className:"md:hidden flex items-center gap-1.5 flex-shrink-0",children:[(0,t.jsx)(O,{}),(0,t.jsxs)("div",{ref:p,className:"relative",children:[(0,t.jsx)("button",{onClick:()=>m(e=>!e),"aria-label":"Account menu","aria-expanded":x,className:"group relative flex items-center justify-center p-1 rounded-xl transition-all duration-200 hover:bg-white/60 dark:hover:bg-zinc-950/60",children:y}),x&&(0,t.jsxs)("div",{role:"menu",className:"absolute right-0 mt-2 w-64 roun
1ded-2xl overflow-hidden",style:{background:"var(--surface-panel)",backdropFilter:"blur(28px)",border:"1px solid var(--border-default)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 2px rgba(0,0,0,0.04), 0 18px 40px -12px rgba(0,0,0,0.28)"},children:[(0,t.jsx)("div",{className:"h-[3px] w-full bg-gradient-to-r from-pink-500 via-rose-500 to-orange-400"}),(0,t.jsxs)("div",{className:"px-4 pt-4 pb-3 flex items-center gap-3",children:[y,(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-[13px] font-bold text-gray-900 dark:text-zinc-100 truncate",children:e.user.name||"User"}),e.user.email&&(0,t.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-zinc-500 truncate",children:e.user.email})]})]}),(0,t.jsxs)("div",{className:"px-2 pb-2 pt-1 space-y-0.5",children:[(0,t.jsxs)(a.default,{href:f,onClick:()=>m(!1),role:"menuitem",className:"w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-[13px] font-medium text-gray-700 dark:text-zinc-300 hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors",children:[(0,t.jsx)(c.UserCircleIcon,{className:"w-4 h-4 text-gray-400 dark:text-zinc-500"}),g?"Admin dashboard":"Dashboard"]}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2.5 px-2.5 py-1.5 rounded-lg",children:[(0,t.jsx)("span",{className:"text-[13px] font-medium text-gray-700 dark:text-zinc-300",children:"Appearance"}),(0,t.jsx)(J,{})]})]}),(0,t.jsx)("div",{className:"px-2 py-2",style:{borderTop:"1px solid var(--surface-softer)"},children:(0,t.jsxs)("button",{onClick:()=>{m(!1),h()},role:"menuitem",className:"w-full flex items-center gap-2.5 px-2.5 py-2 rounded-lg text-[13px] font-medium text-red-500 hover:bg-red-50 dark:hover:bg-red-500/10 transition-colors",children:[(0,t.jsx)(l.ArrowRightOnRectangleIcon,{className:"w-4 h-4"}),"Sign out"]})})]})]})]})]}):(0,t.jsxs)(a.default,{href:"/login",className:"relative group px-4 sm:px-5 py-2 rounded-xl text-sm font-semibold text-white overflow-hidden transition-all duration-300 hover:shadow-lg hover:shadow-pink-200/50 hover:-translate-y-0.5 flex-shrink-0",children:[(0,t.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-pink-500 to-orange-400 transition-all duration-300 group-hover:scale-105"}),(0,t.jsx)("span",{className:"relative",children:"Login"})]})]})})})}function X(e,t,r){return{r:e.r+(t.r-e.r)*r,g:e.g+(t.g-e.g)*r,b:e.b+(t.b-e.b)*r}}function ee(e,t){return`rgba(${0|e.r},${0|e.g},${0|e.b},${t})`}function et(e,t){return e+Math.random()*(t-e)}let er={r:249,g:115,b:22},ea={r:254,g:215,b:170},en={r:234,g:88,b:12};function es(e){return{frame(t,r,a,n){e.clearRect(0,0,a,n);let s=.5*a,i=.92*n,o=[];for(let e=0;e<40;e++){o[e]=[];for(let r=0;r<80;r++){let a=(r-40)*16,n=16*e,l=20*Math.sin(.1*r+.8*t)+12*Math.sin(.08*e+.05*r+.5*t)+8*Math.cos(.03*r+.12*e+.35*t)+6*Math.sin(.07*r+.04*e+.6*t),c=.3153223623952687*n-.9489846193555862*l,d=500/(500+(.9489846193555862*n+.3153223623952687*l+150));o[e][r]={sx:s+a*d,sy:i-c*d,wave:l}}}for(let t=38;t>=0;t--)for(let r=0;r<79;r++){let a=o[t][r],n=o[t][r+1],s=o[t+1][r+1],i=o[t+1][r],l=Math.max(0,Math.min(1,((a.wave+n.wave+s.wave+i.wave)/4+46)/92)),c=l>.5?X(er,ea,(l-.5)*2):X(en,er,2*l),d=Math.abs(r-40)/40,u=.18*(1-d*d*d)*Math.sin(t/39*Math.PI*.85);u<.003||(e.beginPath(),e.moveTo(a.sx,a.sy),e.lineTo(n.sx,n.sy),e.lineTo(s.sx,s.sy),e.lineTo(i.sx,i.sy),e.closePath(),e.fillStyle=ee(c,u),e.fill())}}}}let ei=[{c:{r:139,g:92,b:246},x:.18,y:.78,r:.42,ax:.1,ay:.06,px:61,py:47,ph:0},{c:{r:99,g:102,b:241},x:.62,y:.88,r:.48,ax:.12,ay:.05,px:73,py:53,ph:2.1},{c:{r:168,g:85,b:247},x:.88,y:.55,r:.36,ax:.07,ay:.08,px:67,py:41,ph:4.2},{c:{r:236,g:72,b:153},x:.4,y:.5,r:.3,ax:.09,ay:.07,px:83,py:59,ph:1.3},{c:{r:99,g:102,b:241},x:.05,y:.35,r:.28,ax:.06,ay:.09,px:71,py:43,ph:3.4}],eo=[{r:139,g:92,b:246},{r:99,g:102,b:241}],el=[{r:139,g:92,b:246},{r:236,g:72,b:153},{r:244,g:63,b:94},{r:251,g:146,b:60}],ec=[{r:124,g:58,b:237},{r:219,g:39,b:119},{r:225,g:29,b:72},{r:249,g:115,b:22}],ed=2*Math.PI/120,eu=[{base:.42,slope:-.1,thick:.2,amp:.1,freq:1.4,k:5,k2:3,phase:0,alpha:.17,shift:0},{base:.6,slope:.08,thick:.16,amp:.08,freq:1.9,k:4,k2:3,phase:2.1,alph
1a:.16,shift:.35},{base:.76,slope:-.05,thick:.22,amp:.07,freq:1.1,k:3,k2:2,phase:4,alpha:.14,shift:.7},{base:.92,slope:.04,thick:.18,amp:.05,freq:2.4,k:6,k2:4,phase:1.3,alpha:.12,shift:1}];function ex(e,t){return e[Math.min(e.length-1,Math.max(0,t))]}let em={wave:es,drift:function(e,t,r){let a=[];function n(e,t,r,a){return e.x=et(0,t),e.y=a?et(.2*r,r):r+10,e.vy=-et(6,14),e.sway=et(.2,.5),e.ph=et(0,2*Math.PI),e.r=et(1.4,2.6),e.c=eo[.6>Math.random()?0:1],e}function s(e,t){let r=Math.max(8,Math.min(18,Math.round(e*t/8e4)));a=[];for(let s=0;s<r;s++)a.push(n({},e,t,!0))}return s(t,r),{resize(e,t){s(e,t)},frame(t,r,s,i,o){e.clearRect(0,0,s,i);let l=!!(o&&o.dark),c=l?.26:.22,d=Math.min(s,i);for(let r of ei){let a=(r.x+Math.sin(t/r.px*Math.PI*2+r.ph)*r.ax)*s,n=(r.y+Math.cos(t/r.py*Math.PI*2+r.ph)*r.ay)*i,o=1+.08*Math.sin(.11*t+r.ph),l=r.r*d*o,u=e.createRadialGradient(a,n,0,a,n,l);u.addColorStop(0,ee(r.c,c)),u.addColorStop(.45,ee(r.c,.45*c)),u.addColorStop(1,ee(r.c,0)),e.fillStyle=u,e.beginPath(),e.arc(a,n,l,0,2*Math.PI),e.fill()}for(let o of a){o.y+=o.vy*r,o.x+=6*Math.sin(t*o.sway+o.ph)*r,o.y<-10&&n(o,s,i,!1);let a=o.y/i,c=Math.min(1,(1-a)*4)*Math.min(1,Math.max(0,(a-.08)*5))*(l?.5:.4);c<.01||(e.fillStyle=ee(o.c,.25*c),e.beginPath(),e.arc(o.x,o.y,3.2*o.r,0,2*Math.PI),e.fill(),e.fillStyle=ee(o.c,c),e.beginPath(),e.arc(o.x,o.y,o.r,0,2*Math.PI),e.fill())}}}},aurora:function(e){return{frame(t,r,a,n,s){e.clearRect(0,0,a,n);let i=!!(s&&s.dark),o=i?ec:el,l=i?1.35:1,c=t%120;for(let t of eu){let r=[],s=[],i=[];for(let e=-14;e<=a+14;e+=14){let o=e/a,l=Math.sin(o*Math.PI*t.freq+c*ed*t.k+t.phase)*t.amp+Math.sin(o*Math.PI*t.freq*2.3-c*ed*t.k2+t.phase)*t.amp*.35+Math.cos(o*Math.PI*.7+c*ed*2)*t.amp*.4,d=(t.base+(o-.5)*t.slope+l)*n,u=t.thick*n*(.75+.25*Math.sin(o*Math.PI*3.1+c*ed*5+t.phase));r.push(e),s.push(d),i.push(u)}let d=e.createLinearGradient(0,0,a,0),u=(Math.sin(c*ed+t.shift*Math.PI)+1)/2;for(let e=0;e<5;e++){let r=e/4,a=(1-Math.abs(2*((.5*r+u+t.shift)%1)-1))*(o.length-1),n=Math.floor(a),s=X(ex(o,n),ex(o,n+1),a-n);d.addColorStop(r,ee(s,1))}e.fillStyle=d;for(let a=0;a<10;a++){let n=1-a/10;e.globalAlpha=.16*t.alpha*l,e.beginPath();for(let t=0;t<r.length;t++){let a=s[t]-i[t]*n*.5;0===t?e.moveTo(r[t],a):e.lineTo(r[t],a)}for(let t=r.length-1;t>=0;t--)e.lineTo(r[t],s[t]+i[t]*n*.5);e.closePath(),e.fill()}e.globalAlpha=1}}}}};function ep(){var e;let a=(0,r.useRef)(null),n=(0,r.useRef)(null),i=(e=(0,s.usePathname)())?e.startsWith("/dashboard/user/sales/deal/")?"aurora":e.startsWith("/dashboard/user/sales")?"drift":"wave":"wave";return(0,r.useEffect)(()=>{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let e=a.current;if(!e)return;let t=e.getContext("2d");if(!t)return;let r=Math.min(window.devicePixelRatio||1,2),s=null;function o(){e.width=window.innerWidth*r,e.height=window.innerHeight*r,e.style.width=window.innerWidth+"px",e.style.height=window.innerHeight+"px",t.setTransform(r,0,0,r,0,0),s&&s.resize&&s.resize(window.innerWidth,window.innerHeight)}o(),window.addEventListener("resize",o),s=(em[i]||es)(t,window.innerWidth,window.innerHeight);let l=null,c=null,d={dark:!1};return n.current=requestAnimationFrame(function e(t){null===l&&(l=t);let r=(t-l)/1e3,a=null===c?.016:Math.min(.05,(t-c)/1e3);c=t,d.dark=document.documentElement.classList.contains("dark"),s.frame(r,a,window.innerWidth,window.innerHeight,d),n.current=requestAnimationFrame(e)}),()=>{cancelAnimationFrame(n.current),window.removeEventListener("resize",o),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height)}},[i]),(0,t.jsx)("canvas",{ref:a,"aria-hidden":"true",style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",zIndex:0,pointerEvents:"none"}})}var eh=e.i(705766),eg=e.i(518763),ef=e.i(846932),eb=e.i(88653),ey=e.i(427217),ev=e.i(39875),ek=e.i(847604),ew=e.i(220316),ej=e.i(913107),eN=e.i(142663),eC=e.i(607271),eS=e.i(82291),ez=e.i(809182),eE=e.i(313004),eT=e.i(136604),eM=e.i(946366),eL=e.i(923792);let eI=[.25,.46,.45,.94];function e_({richStatus:e,binaryOnline:t}){return"dnd"===e?"dnd":t||"online"===e?"online":"away"===e?"away":"offline"}function eR({open:e,onClose:a,online:s=[],offline:i=[],loading:o=!1,initialTab:l="conversations",openSignal:c=0}){let{data:d}
1=(0,n.useSession)(),{open:u,openOrCreateDM:x}=(0,eN.useConversation)(),[m,p]=(0,r.useState)(l),h=(0,r.useRef)(e);(0,r.useEffect)(()=>{e&&!h.current&&p(l),h.current=e},[e,l]),(0,r.useEffect)(()=>{c&&p(l)},[c]);let[g,f]=(0,r.useState)(""),[b,y]=(0,r.useState)([]),[v,k]=(0,r.useState)(!1),[w,j]=(0,r.useState)(0);async function N(){try{let e=await fetch("/api/conversations");if(!e.ok)return;let t=await e.json();y(t.conversations||[])}catch{}}(0,r.useEffect)(()=>{function e(){N()}return N(),window.addEventListener("ss-conversation-event",e),()=>window.removeEventListener("ss-conversation-event",e)},[]);let C=(0,r.useMemo)(()=>{if(!g.trim())return b;let e=g.trim().toLowerCase();return b.filter(t=>eO(t,d).toLowerCase().includes(e)||(t.lastMessagePreview||"").toLowerCase().includes(e))},[b,g,d]),{onlineMatches:S,offlineMatches:z}=(0,r.useMemo)(()=>{let e=g.trim().toLowerCase(),t=t=>e?t.filter(t=>(t.name||"").toLowerCase().includes(e)||(t.email||"").toLowerCase().includes(e)):t;return{onlineMatches:t(s),offlineMatches:t(i)}},[s,i,g]),E=(0,r.useMemo)(()=>{let e=d?.user?._id?.toString();return e?b.filter(t=>{let r=(t.readState||[]).find(t=>t.user?.toString?.()===e)?.lastReadAt;return t.lastMessageAt&&(!r||new Date(t.lastMessageAt)>new Date(r))}).length:0},[b,d?.user?._id]),{statuses:T}=function(e){let[t,a]=(0,r.useState)({}),[n,s]=(0,r.useState)(!0),i=(0,r.useRef)([]),o=[...new Set((e||[]).filter(Boolean).map(String))].sort().join(",");return i.current=o?o.split(","):[],(0,r.useEffect)(()=>{if(!o){a({}),s(!1);return}let e=!1,t=null;async function r(){try{let t=await fetch("/api/users/presence",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userIds:i.current})});if(!t.ok)return;let r=await t.json();!e&&r?.statuses&&a(r.statuses)}catch{}finally{e||s(!1)}}function n(){"visible"===document.visibilityState&&r()}return r(),!function a(){e||(t=setTimeout(async()=>{"visible"===document.visibilityState&&await r(),a()},3e4))}(),document.addEventListener("visibilitychange",n),()=>{e=!0,t&&clearTimeout(t),document.removeEventListener("visibilitychange",n)}},[o]),{statuses:t,loading:n}}((0,r.useMemo)(()=>{let e=new Set;for(let t of b){if(t?.type==="group")continue;let r=eq(t,d),a=r?._id?.toString?.()||r?._id;a&&e.add(String(a))}for(let t of s)t?._id&&e.add(String(t._id));for(let t of i)t?._id&&e.add(String(t._id));return[...e]},[b,s,i,d])),M=(0,r.useMemo)(()=>"conversations"===m?C.map(e=>({kind:"conversation",id:e._id,conversation:e})):[...S.map(e=>({kind:"user",id:e._id,user:e,online:!0})),...z.map(e=>({kind:"user",id:e._id,user:e,online:!1}))],[m,C,S,z]);return(0,r.useEffect)(()=>{j(0)},[m,g]),(0,r.useEffect)(()=>{if(e)return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t);function t(e){if("Escape"===e.key)return void a?.();let t=document.activeElement;if(!(t&&("INPUT"===t.tagName||"TEXTAREA"===t.tagName)&&t.closest?.("[data-team-presence-panel]"))||"Enter"===e.key||"Tab"===e.key||"ArrowDown"===e.key||"ArrowUp"===e.key){if("ArrowDown"===e.key){if(0===M.length)return;e.preventDefault(),j(e=>(e+1)%M.length);return}if("ArrowUp"===e.key){if(0===M.length)return;e.preventDefault(),j(e=>(e-1+M.length)%M.length);return}if("Tab"===e.key){e.preventDefault(),p(e=>"conversations"===e?"team":"conversations");return}if("Enter"===e.key){let t=M[w];if(!t)return;e.preventDefault(),"conversation"===t.kind?(u(t.id?.toString?.()),a?.()):"user"===t.kind&&(x({otherUserId:t.id}),a?.())}}}},[e,a,M,w,u,x]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eb.AnimatePresence,{children:e&&(0,t.jsxs)(ef.motion.div,{"data-team-presence-panel":"true",initial:{opacity:0,y:12,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:12,scale:.96},transition:{duration:.25,ease:eI},className:"fixed z-30 rounded-2xl overflow-hidden flex flex-col left-2 right-2 max-md:bottom-[calc(4rem+env(safe-area-inset-bottom)+0.5rem)] md:left-auto md:right-6 md:bottom-[5.5rem] md:w-[360px] md:max-w-[calc(100vw-2rem)]",style:{background:"var(--surface-panel)",backdropFilter:"blur(28px)",border:"1px solid var(--border-default)",boxShadow:"inset 0 1px 0 var(--inset-highlight), 0 1px 2px var(--shadow-ambient-sm), 0 24px 60px -16px var(--shadow-ambient-2xl), 0 8px 22px -8px rgba(16,185,129,0.18)",maxHeight:"min(620px, calc(100dvh - 4rem - env(safe-area-inset-bottom) - 1.5rem))"},children:[(0,t.jsx)("div",{className:"absolute top-0 left-0 right-0 h-[3px] bg-gradient-to-r from-emerald-500 via-pink-500 to-orange-400"}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4 pb-3 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"linear-gradient(135deg, rgba(16,185,129,0.14), rgba(99,102,241,0.14))",border:"1px solid rgba(16,185,129,0.22)"},children:(0,t.jsx)(ek.ChatBubbleLeftRightIcon,{className:"w-4 h-4 text-emerald-500"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-[10px] font-bold uppercase tracking-[0.14em] text-gray-400 dark:text-zinc-500",children:"Comms"}),(0,t.jsxs)("div",{className:"text-[13px] font-bold text-gray-900 dark:text-zinc-100 leading-tight truncate",children:[s.length," online",(0,t.jsxs)("span",{className:"text-gray-400 dark:text-zinc-500 font-medium",children:[" ","· ",b.length," ",1===b.length?"conversation":"conversations"]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>k(!0),className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-[11px] font-bold text-white",style:{background:"linear-gradient(135deg, #EC4899, #F97316)",boxShadow:"0 4px 12px rgba(236,72,153,0.25)"},title:"New conversation",children:[(0,t.jsx)(ej.PlusIcon,{className:"w-3 h-3"}),"New"]}),(0,t.jsx)("button",{type:"button",onClick:a,className:"w-8 h-8 flex items-center justify-center rounded-lg hover:bg-gray-100 dark:hover:bg-zinc-900 text-gray-400 dark:text-zinc-500 hover:text-gray-700 dark:hover:text-zinc-300 transition-colors","aria-label":"Close",children:(0,t.jsx)(ey.XMarkIcon,{className:"w-4 h-4"})})]})]}),(0,t.jsxs)("div",{className:"px-4 pb-3 flex gap-1.5 flex-shrink-0",children:[(0,t.jsx)(eA,{active:"conversations"===m,onClick:()=>p("conversations"),Icon:ek.ChatBubbleLeftRightIcon,label:"Conversations",badge:E>0?E:null,badgeKind:"unread"}),(0,t.jsx)(eA,{active:"team"===m,onClick:()=>p("team"),Icon:ew.UsersIcon,label:"Team",badge:s.length>0?s.length:null,badgeKind:"online"})]}),(0,t.jsxs)("div",{className:"px-4 pb-3 flex-shrink-0 flex items-center gap-2",children:[(0,t.jsx)(eM.default,{}),(0,t.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-2 rounded-xl min-w-0",style:{background:"var(--surface-soft)",border:"1px solid var(--border-default)"},children:[(0,t.jsx)(ev.MagnifyingGlassIcon,{className:"w-3.5 h-3.5 text-gray-400 dark:text-zinc-500 flex-shrink-0"}),(0,t.jsx)("input",{value:g,onChange:e=>f(e.target.value),placeholder:"conversations"===m?"Search conversations…":"Find a teammate…",className:"flex-1 min-w-0 text-xs bg-transparent border-none focus:outline-none text-gray-900 dark:text-zinc-100 placeholder-gray-400 dark:placeholder-zinc-500"})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto pb-3",style:{borderTop:"1px solid var(--surface-softer)"},children:"conversations"===m?0===C.length?(0,t.jsx)(eF,{search:!!g,label:g?"No conversations match.":"No conversations yet.",onCompose:()=>k(!0)}):(0,t.jsx)("div",{className:"px-2 pt-2",children:C.map((e,r)=>{let n="group"===e.type?null:eq(e,d),s=n?._id?.toString?.()||n?._id||null,i=s?T[String(s)]:null;return(0,t.jsx)(eD,{conversation:e,session:d,status:i,active:r===w,onMouseEnter:()=>j(r),onClick:()=>{u(e._id?.toString()),a?.()}},e._id)})}):o&&0===s.length&&0===i.length?(0,t.jsx)("div",{className:"py-8 flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-6 h-6 border-2 border-pink-400/30 border-t-pink-500 rounded-full animate-spin"})}):(0,t.jsxs)(t.Fragment,{children:[S.length>0&&(0,t.jsx)(eW,{label:"Online",children:S.map((e,r)=>(0,t.jsx)(eB,{user:e,online:!0,status:T[String(e._id)],active:r===w,onMouseEnter:()=>j(r),onMessage:()=>{x({otherUserId:e._id}),a?.()}},e._id))}),z.length>0&&(0,t.jsx)(eW,{label:"Offline",children:z.map((e,r)=>{let n=S.length+r;return(0,t.jsx)(eB,{user:e,online:!1,status:T[String(e._id)],active:n===w,onMouseEnter:()=>j(n),onMessage:()=>{x({otherUserId:e._id}),a?.()}},e._id)})}),0===S.length&&0===z.length&&(0,t.jsx)(eF,{label:g?"No teammates match.":"No teammates yet."})]})})]})}),v&&(0,t.jsx)(eC.default,{onClose:()=>k(!1),onCreated:e=>{k(!1);let t=e?._id?.toString?.();t&&(u(t),a?.()),N()}})]})}function eA({active:e,onClick:r,Icon:a,label:n,badge:s,badgeKind:i}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:"flex-1 inline-flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-xl text-[11.5px] font-bold transition-colors",style:e?{background:"rgba(236,72,153,0.10)",border:"1px solid rgba(236,72,153,0.28)",color:"#db2777"}:{background:"var(--surface-soft)",border:"1px solid var(--border-subtle)",color:"var(--text-tertiary)"},children:[(0,t.jsx)(a,{className:"w-3.5 h-3.5"}),n,null!=s&&(0,t.jsx)("span",{className:"inline-flex items-center justify-center min-w-[16px] h-[16px] px-1 rounded-full text-[9px] font-bold",style:"unread"===i?{background:"#10b981",color:"white"}:{background:"rgba(16,185,129,0.18)",color:"#059669"},children:s})]})}function eD({conversation:e,session:a,active:n,onClick:s,onMouseEnter:i,status:o}){let l=eO(e,a),c=eq(e,a),d="group"===e.type?e.image:c?.image,u=a?.user?._id?.toString(),x=(e.readState||[]).find(e=>e.user?.toString?.()===u)?.lastReadAt,m=e.lastMessageAt&&(!x||new Date(e.lastMessageAt)>new Date(x)),p="group"===e.type?null:c?._id,{online:h,lastSeenAt:g}=(0,ez.useUserPresence)(p),f="group"!==e.type,b=e.lastMessageBy?.toString?.()||e.lastMessageBy||null,y=!!(b&&u&&b===u),v=f&&p?(e.readState||[]).find(e=>(e.user?.toString?.()||e.user)===p.toString())?.lastReadAt:null,k=f&&y&&v&&e.lastMessageAt&&new Date(v)>=new Date(e.lastMessageAt),w=(0,r.useMemo)(()=>({type:"conversation",id:e._id}),[e._id]),{typers:j}=(0,eE.default)({parent:w,selfUserId:u}),N=j.length>0;return(0,t.jsxs)("button",{type:"button",onClick:s,onMouseEnter:i,className:`w-full flex items-center gap-2.5 px-2.5 py-2 mb-1 rounded-lg text-left transition-colors ${n?"bg-orange-50 dark:bg-orange-500/10 ring-1 ring-orange-300/40 dark:ring-orange-400/30":"hover:bg-gray-50 dark:hover:bg-zinc-900/50"}`,children:[(0,t.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,t.jsx)(eS.default,{name:l,image:d,sizeClass:"w-9 h-9",textClass:"text-[11px]",ringClass:"ring-2 ring-white dark:ring-zinc-950"}),"group"!==e.type&&(0,t.jsx)(eL.default,{status:e_({richStatus:o?.status,binaryOnline:h}),size:10,ringWidth:2,className:"!-bottom-0.5 !-right-0.5"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-[12.5px] font-bold text-gray-900 dark:text-zinc-100 truncate",children:l}),"group"!==e.type&&o?.customStatus?.emoji&&(0,t.jsx)("span",{className:"text-[12px] flex-shrink-0",title:o.customStatus.text||"",children:o.customStatus.emoji})]}),e.lastMessageAt&&(0,t.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-zinc-500 flex-shrink-0",children:(0,eT.timeAgo)(e.lastMessageAt)}
1)]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[N?(0,t.jsxs)("p",{className:"flex-1 text-[11px] text-pink-500 dark:text-pink-400 truncate flex items-center gap-1.5 font-semibold",children:[(0,t.jsx)(e$,{}),(0,t.jsx)("span",{className:"truncate",children:function(e){if(!e||0===e.length)return"";let t=e.map(e=>e.name?.split(" ")[0]||"Someone");if(1===t.length)return`${t[0]} is typing`;if(2===t.length)return`${t[0]} and ${t[1]} are typing`;let r=t.length-2;return`${t[0]}, ${t[1]} and ${r} ${1===r?"other":"others"} are typing`}(j)})]}):(0,t.jsxs)(t.Fragment,{children:[f&&y&&(0,t.jsx)(eP,{seen:!!k}),(0,t.jsx)("p",{className:"flex-1 text-[11px] text-gray-500 dark:text-zinc-400 truncate",children:e.lastMessagePreview||"No messages yet"})]}),m&&(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full flex-shrink-0",style:{background:"#F97316"}})]}),f&&!h&&g&&(0,t.jsxs)("div",{className:"text-[10px] text-gray-400 dark:text-zinc-500 truncate mt-0.5",children:["Last seen ",(0,eT.timeAgo)(g)]})]})]})}function e$(){return(0,t.jsx)("span",{className:"inline-flex items-end gap-0.5 flex-shrink-0","aria-hidden":"true",children:[0,150,300].map(e=>(0,t.jsx)("span",{className:"w-1 h-1 rounded-full bg-pink-400 dark:bg-pink-300 animate-bounce",style:{animationDelay:`${e}ms`,animationDuration:"1s"}},e))})}function eP({seen:e}){return(0,t.jsx)("span",{className:"inline-flex items-center flex-shrink-0",title:e?"Seen":"Delivered","aria-label":e?"Seen":"Delivered",children:(0,t.jsxs)("svg",{viewBox:"0 0 14 10",className:"w-3.5 h-2.5",fill:"none",stroke:e?"#10b981":"var(--text-label)",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("polyline",{points:"0.5 5 4 8.5 9 1.5"}),e&&(0,t.jsx)("polyline",{points:"4.5 5 8 8.5 13 1.5"})]})})}function eW({label:e,children:r}){return(0,t.jsxs)("div",{className:"pt-2",children:[(0,t.jsx)("div",{className:"px-4 py-1 text-[9px] font-bold uppercase tracking-[0.16em] text-gray-400 dark:text-zinc-500",children:e}),(0,t.jsx)("div",{children:r})]})}function eB({user:e,online:r,active:a,onMessage:n,onMouseEnter:s,status:i}){let o=e?.lastSeenAt,l=e_({richStatus:i?.status,binaryOnline:r}),c=i?.customStatus,d=e?.email;return c?.text?d=c.text:"dnd"===l?d="On Do Not Disturb":!r&&o&&(d=`Last seen ${(0,eT.timeAgo)(o)}`),(0,t.jsxs)("button",{type:"button",onClick:n,onMouseEnter:s,className:`w-full px-3 py-2 flex items-center gap-3 mx-1 rounded-xl transition-colors group text-left ${a?"bg-orange-50 dark:bg-orange-500/10 ring-1 ring-orange-300/40 dark:ring-orange-400/30":"hover:bg-gray-50/80 dark:hover:bg-zinc-900/60"}`,children:[(0,t.jsxs)("div",{className:"relative flex-shrink-0",children:[(0,t.jsx)(eS.default,{name:e.name,image:e.image,sizeClass:"w-9 h-9",textClass:"text-[12px]",ringClass:"ring-2 ring-white dark:ring-zinc-950 shadow-sm"}),(0,t.jsx)(eL.default,{status:l,size:10,ringWidth:2,className:"!-bottom-0.5 !-right-0.5"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 min-w-0",children:[(0,t.jsx)("div",{className:"text-[13px] font-semibold text-gray-900 dark:text-zinc-100 truncate",children:e.name||e.email||"Unknown"}),c?.emoji&&(0,t.jsx)("span",{className:"text-[12px] flex-shrink-0",title:c.text||"",children:c.emoji})]}),d&&(0,t.jsx)("div",{className:"text-[11px] text-gray-400 dark:text-zinc-500 truncate",children:d})]}),(0,t.jsx)("span",{"aria-hidden":!0,className:"opacity-0 group-hover:opacity-100 transition-opacity w-8 h-8 flex items-center justify-center rounded-lg text-pink-500 dark:text-pink-400 bg-pink-50 dark:bg-pink-500/10",title:`Message ${e.name?.split(" ")[0]||""}`.trim(),children:(0,t.jsx)(ek.ChatBubbleLeftRightIcon,{className:"w-4 h-4"})})]})}function eF({label:e,onCompose:r}){return(0,t.jsxs)("div",{className:"flex flex-col items-center text-center px-6 py-10",children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-pink-100 to-orange-50 mb-2 flex items-center justify-center",children:(0,t.jsx)(ek.ChatBubbleLeftRightIcon,{className:"w-6 h-6 text-pink-500"})}),(0,t.jsx)("p",{className:"text-[12px] text-gray-500 dark:text-zinc-400 max-w-[220px]",children:e}),r&&(0,t.jsxs)("button",{type:"button",onClick:r,className:"mt-3 inline-flex items-center gap-1 px-3 py-1.5 rounded-full text-[11px] font-bold text-white",style:{background:"linear-gradient(135deg, #EC4899, #F97316)"},children:[(0,t.jsx)(ej.PlusIcon,{className:"w-3 h-3"}),"New conversation"]})]})}function eO(e,t){if(e?.type==="group")return e.name||"Group chat";let r=eq(e,t);return r?.name||r?.email||"Direct message"}function eq(e,t){if(!e||!Array.isArray(e.participants))return null;let r=t?.user?._id?.toString(),a=e.participants.find(e=>(e?._id?.toString?.()||e?.toString?.())!==r);if(a)return a;let n=(e.externalParticipants||[])[0];return n?{name:n.name||n.email,email:n.email,image:null}:null}var eU=e.i(523147),eH=e.i(249802),eG=e.i(248952),eK=e.i(630929);e.i(174080);var eV=e.i(416965),eJ=e.i(807576);let eQ="idle",eY="listening",eZ="thinking",eX="speaking",e0=[{id:"19STyYD15bswVz51nqLf",name:"Aria",description:"Warm & expressive"},{id:"21m00Tcm4TlvDq8ikWAM",name:"Rachel",description:"Clear & professional"},{id:"EXAVITQu4vr4xnSDxMaL",name:"Sarah",description:"Soft & friendly"},{id:"onwK4e9ZLuTAKqWW03F9",name:"Daniel",description:"Deep & authoritative"},{id:"TX3LPaxmHKxFdv7VOQHJ",name:"Liam",description:"Confident & articulate"},{id:"pFZP5JQG7iQjIQuC4Bku",name:"Lily",description:"Warm British accent"}],e1=[{cmd:"/spotlight",label:"Spotlight",hint:"Generate sales outreach copy",href:"/dashboard/user/spotlight",icon:"✨"},{cmd:"/pacing",label:"Pacing",hint:"Goal attainment across campaigns",query:"Which campaigns are on track vs behind their goals? Give me the pacing breakdown.",icon:"📊"},{cmd:"/anomalies",label:"Anomalies",hint:"Spikes, drops, unusual activity",query:"Are there any performance anomalies or unusual activity I should know about across campaigns?",icon:"⚡"},{cmd:"/top",label:"Top campaigns",hint:"Current top performers",query:"What are the top 5 performing campaigns right now by views and ER?",icon:"🏆"},{cmd:"/wins",label:"Biggest wins",hint:"Quarterly highlights",query:"What are the biggest wins this quarter? Which campaigns exceeded goals?",icon:"🎉"},{cmd:"/risk",label:"At-risk",hint:"Campaigns behind on goals",query:"Which campaigns are behind on their goals and why?",icon:"⚠️"},{cmd:"/creators",label:"Top creators",hint:"Most consistent performers",query:"Who are our most consistent creators right now?",icon:"👤"},{cmd:"/compare",label:"Compare",hint:"This period vs last",query:"Compare this week's performance to last week.",icon:"🔁"},{cmd:"/reset",label:"Reset chat",hint:"Clear conversation",action:"reset",icon:"↻"}],e5=()=>
1(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:(0,t.jsx)("path",{d:"M3.478 2.405a.75.75 0 00-.926.94l2.432 7.905H13.5a.75.75 0 010 1.5H4.984l-2.432 7.905a.75.75 0 00.926.94 60.519 60.519 0 0018.445-8.986.75.75 0 000-1.218A60.517 60.517 0 003.478 2.405z"})}),e2=()=>(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-3 h-3",children:[(0,t.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,t.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),e3=()=>(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-4 h-4",children:(0,t.jsx)("path",{d:"M12 2.25a.75.75 0 01.75.75v2.25a.75.75 0 01-1.5 0V3a.75.75 0 01.75-.75zM7.5 12a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM18.894 6.166a.75.75 0 00-1.06-1.06l-1.591 1.59a.75.75 0 101.06 1.061l1.591-1.59zM21.75 12a.75.75 0 01-.75.75h-2.25a.75.75 0 010-1.5H21a.75.75 0 01.75.75zM17.834 18.894a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 10-1.061 1.06l1.59 1.591zM12 18a.75.75 0 01.75.75V21a.75.75 0 01-1.5 0v-2.25A.75.75 0 0112 18zM7.758 17.303a.75.75 0 00-1.061-1.06l-1.591 1.59a.75.75 0 001.06 1.061l1.592-1.59zM6 12a.75.75 0 01-.75.75H3a.75.75 0 010-1.5h2.25A.75.75 0 016 12zM6.697 7.757a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 00-1.061 1.06l1.59 1.591z"})}),e4=()=>(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:[(0,t.jsx)("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),(0,t.jsx)("path",{d:"M3 3v5h5"})]}),e6=()=>(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"w-4 h-4",children:[(0,t.jsx)("path",{d:"M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3z"}),(0,t.jsx)("path",{d:"M19 10v2a7 7 0 01-14 0v-2"}),(0,t.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),(0,t.jsx)("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]});function e9(){return(0,t.jsx)("div",{className:"flex items-center gap-1.5 py-0.5 px-1",children:[0,1,2].map(e=>(0,t.jsx)("span",{className:"w-2 h-2 rounded-full animate-bounce",style:{background:"linear-gradient(135deg,#ec4899,#f97316)",animationDelay:`${.18*e}s`,animationDuration:"0.8s"}},e))})}let e7=[3,6,10,16,22,18,28,20,26,16,10,14,8,14,20,18,10,6,12,8,4];function e8({name:e,onDismiss:a}){return(0,r.useEffect)(()=>{let e=setTimeout(a,3e3);return()=>clearTimeout(e)},[a]),(0,t.jsx)("div",{className:"absolute bottom-full left-3 right-3 mb-2 pointer-events-none z-10",children:(0,t.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2.5 rounded-2xl text-white text-xs font-semibold shadow-lg",style:{background:"linear-gradient(135deg,#ec4899,#f97316)"},children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-white dark:bg-zinc-950 animate-pulse flex-shrink-0"}),"Navigating to ",e,"…"]})})}function te(){let e=(0,s.useRouter)(),a=(0,s.usePathname)(),i=a?.startsWith("/dashboard/user/scout"),{data:o}=(0,n.useSession)(),{isOpen:l,setIsOpen:c,teamOpen:d,setTeamOpen:u,teamPanelInitialTab:x,teamPanelOpenSignal:m,openTeamPanel:p,pageContext:h,setPageContext:g,messages:f,setMessages:b,conversationHistory:y,setConversationHistory:v,filterPanelOpen:k,aiLauncherHiddenCount:w}=(0,eg.useAI)(),j=k||w>0,[N,C]=(0,r.useState)(""),[S,z]=(0,r.useState)(!1),[E,T]=(0,r.useState)(null),[M,L]=(0,r.useState)([]),[I,_]=(0,r.useState)(0),[R,A]=(0,r.useState)(!1),[D,$]=(0,r.useState)(null),[P,W]=(0,r.useState)(!1),B=(0,r.useCallback)(async()=>{W(!0);try{let e=await fetch("/api/ai/memory"),t=await e.json();$({user:t.user||[],agency:t.agency||[]})}catch{$({user:[],agency:[]})}finally{W(!1)}},[]),F=(0,r.useCallback)(()=>{A(e=>{let t=!e;return t&&B(),t})},[B]),O=(0,r.useCallback)(async e=>{try{await fetch(e?`/api/ai/memory?id=${e}`:"/api/ai/memory",{method:"DELETE"}),B()}catch{}},[B]),[q,U]=(0,r.useState)(()=>"nested"===localStorage.getItem("scout_chat_mode")?"nested":"lite"),H=(0,r.useCallback)(e=>{U(e);try{localStorage.setItem("scout_chat_mode",e)}catch{}},[]),G=N.startsWith("/"),K=G?N.slice(1).toLowerCase():"",V=G?e1.filter(e=>e.cmd.slice(1).includes(K)||e.label.toLowerCase().includes(K)):[],[J,Q]=(0,r.useState)(!1),[Y,Z]=(0,r.useState)(eQ),[X,ee]=(0,r.useState)(!1),[et,er]=(0,r.useState)(""),[ea,en]=(0,r.useState)(()=>localStorage.getItem("scout_voice_id")||"19STyYD15bswVz51nqLf"),[es,ei]=(0,r.useState)(!1),eo=(0,ez.useOnlineUsers)(),el=0===eo.at,ec=eo.online.length,[ed,eu]=(0,r.useState)([]);(0,r.useEffect)(()=>{let e=!1;async function t(){try{let t=await fetch("/api/conversations");
1if(!t.ok)return;let r=await t.json();e||eu(r.conversations||[])}catch{}}function r(){t()}return t(),window.addEventListener("ss-conversation-event",r),()=>{e=!0,window.removeEventListener("ss-conversation-event",r)}},[]);let ex=(0,r.useMemo)(()=>{let e=o?.user?._id?.toString();return e?ed.filter(t=>(0,eT.isConversationUnread)(t,e)).length:0},[ed,o?.user?._id]),em=(0,r.useRef)(null),ep=(0,r.useRef)(null),eh=(0,r.useRef)(null),eb=(0,r.useRef)(null),ey=(0,r.useRef)(null),ev=(0,r.useRef)(!1),ek=(0,r.useRef)(eQ),ew=(0,r.useRef)({}),ej=function(e){let{screen:t,campaignName:r,creatorName:a,organizationName:n}=e||{},s={label:"✨ Spotlight",hint:"Sales outreach copy",href:"/dashboard/user/spotlight",featured:!0};return"campaign"===t&&r?[s,{label:"Are we on track?",query:`Are we on track with the ${r} goals?`},{label:"Top posts",query:`Show me the top posts in ${r}`},{label:"Goal pacing",query:`What's the goal pacing for ${r}?`},{label:"Platform breakdown",query:`Break down ${r} by platform`},{label:"vs last quarter",query:`Compare ${r} to last quarter`}]:"creator"===t&&a?[s,{label:"Top posts",query:`Show ${a}'s top posts`},{label:"Consistency",query:`How consistent is ${a}'s performance?`},{label:"Best platform",query:`Which platform does ${a} perform best on?`},{label:"Sentiment",query:`Sentiment on ${a}'s posts?`},{label:"Campaign history",query:`Campaigns ${a} has been in`}]:"organization"===t&&n?[s,{label:"Campaign overview",query:`Overview of ${n}'s campaigns`},{label:"Best campaign",query:`Best performing ${n} campaign`},{label:"Total impact",query:`Total views and engagement for ${n}`},{label:"Trending?",query:`Is ${n} trending up or down?`}]:[s,{label:"Top campaigns",query:"What are the top performing campaigns right now?"},{label:"Any anomalies?",query:"Are there any performance anomalies I should know about?"},{label:"Most consistent creator",query:"Who is the most consistent creator?"},{label:"Behind on goals",query:"Which campaigns are behind on their goals?"},{label:"Biggest wins",query:"What are the biggest wins this quarter?"}]}(h),eN=f.length>0,eC=h?.campaignName||h?.creatorName||h?.organizationName;(0,r.useEffect)(()=>{ek.current=Y},[Y]),(0,r.useEffect)(()=>{let e=async e=>{try{let t=await fetch(`/api/ai/sfx?sound=${e}`);if(!t.ok)return;let r=await t.blob();ew.current[e]=URL.createObjectURL(r)}catch{}};e("voice_on"),e("voice_off")},[]),(0,r.useEffect)(()=>{let e=window.webkitSpeechRecognition||window.SpeechRecognition;if(!e)return;ee(!0);let t=new e;t.continuous=!1,t.interimResults=!0,t.lang="en-US",t.onresult=e=>{let t="",r="";for(let a of e.results)a.isFinal?r+=a[0].transcript:t+=a[0].transcript;er(r||t),r&&tr(r.trim(),!0)},t.onerror=e=>{"no-speech"!==e.error&&console.error("[Voice]",e.error);let t=ek.current;ev.current&&t!==eZ&&t!==eX&&eE()},t.onend=()=>{let e=ek.current;ev.current&&e!==eZ&&e!==eX&&setTimeout(eE,300)},eb.current=t},[]);let eS=(0,r.useCallback)(e=>{let t=ew.current[e];if(!t)return;let r=new Audio(t);r.volume=.5,r.play().catch(()=>{})},[]),eE=(0,r.useCallback)(()=>{if(ev.current&&eb.current)try{eb.current.start(),Z(eY)}catch{}},[]),eM=(0,r.useCallback)(async e=>{try{eb.current?.stop()}catch{}ey.current&&(ey.current.pause(),ey.current=null),Z(eX);try{let t=await fetch("/api/ai/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e,voiceId:ea})});if(!t.ok){console.warn("[Voice] ElevenLabs TTS failed, status:",t.status),ev.current&&setTimeout(eE,500);return}let r=await t.blob(),a=URL.createObjectURL(r),n=new Audio(a);ey.current=n,n.onended=()=>{URL.revokeObjectURL(a),ey.current=null,ev.current&&setTimeout(eE,500)},n.onerror=()=>{URL.revokeObjectURL(a),ey.current=null,ev.current&&setTimeout(eE,500)},await n.play()}catch(e){console.warn("[Voice] ElevenLabs TTS error:",e.message),ev.current&&setTimeout(eE,500)}},[eE,ea]),eL=(0,r.useCallback)(()=>{ev.current=!0,Q(!0),c(!1),er(""),ei(!1),Z(eY),eS("voice_on");try{eb.current?.start()}catch{}},[c,eS]),eI=(0,r.useCallback)(()=>{eS("voice_off"),ev.current=!1,Q(!1),Z(eQ),er("");try{eb.current?.stop()}catch{}ey.current&&(ey.current.pause(),ey.current=null)},[eS]);(0,r.useEffect)(()=>{em.current?.scrollIntoView({behavior:"smooth"})},[f]),(0,r.useEffect)(()=>{l&&!J&&setTimeout(()=>ep.current?.focus(),150)},[l,J]),(0,r.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&"j"===e.key&&(e.preventDefault(),c(e=>(e||u(!1),!e))),(e.metaKey||e.ctrlKey)&&e.shiftKey&&"s"===e.key.toLowerCase()){e.preventDefault(),ev.current?eI():eL();return}if("Escape"===e.key){if(ev.current)return void eI();l&&c(!1)}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[l,c,eI,eL]),(0,r.useEffect)(()=>{function e(){u(e=>(e||c(!1),!e))}return window.addEventListener("ss-toggle-team-panel",e),()=>window.removeEventListener("ss-toggle-team-panel",e)},[]);let{getChatId:e_,reset:eA,persistTurn:eD,ensurePersisted:e$}=(0,eG.useScoutPersistence)(),eP=(0,r.useCallback)(()=>{b([]),v([]),L([]),C(""),eA(),eh.current&&(eh.current.style.height="20px")},[b,v,eA]),eW=(0,r.useCallback)(async()=>{let t=e_();t||(t=await e$(f)),e.push(t?`/dashboard/user/scout?chat=${t}`:"/dashboard/user/scout")},[e_,e$,f,e]),[eB,eF]=(0,r.useState)(!1),[eO,eq]=(0,r.useState)(null),te=(0,r.useCallback)(async()=>{let e=e_();
1e||(e=await e$(f)),e&&(eq(e),eF(!0))},[e_,e$,f]),tt=f.find(e=>"user"===e.role)?.content?.slice(0,60)||"Scout chat",tr=(0,r.useCallback)(async(t,r=!1)=>{if(!t?.trim()||S)return;let a=t.trim();C(""),L([]),er(""),eh.current&&(eh.current.style.height="20px");let n={role:"user",content:a},s=[...y,n];if(b(e=>[...e,n,{role:"assistant",content:""}]),z(!0),r){try{eb.current?.stop()}catch{}Z(eZ)}try{var i,o;let t,a,l=await fetch("/api/ai/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:s,pageContext:h,mode:q})});if(!l.ok)throw Error(`HTTP ${l.status}`);let{content:c,navigationEvents:d,followUps:u,messageId:x,feedbackTrace:m,visuals:p}=await l.json();if(b(e=>{let t=[...e];return t.at(-1)?.role==="assistant"&&(t[t.length-1]={role:"assistant",content:c,messageId:x,feedbackTrace:m,visuals:Array.isArray(p)?p:[]}),t}),v([...s,{role:"assistant",content:c}]),eD(n,{role:"assistant",content:c,messageId:x,visuals:Array.isArray(p)?p:[]}),d?.length){let t=d[0];if(t.navigated&&t.route){T(t.resolvedName||"destination");let r=t.route.match(/\/dashboard\/user\/(campaign|creator|organization)\/([a-f0-9]+)/);if(r){let e=r[1],a=r[2],n={screen:e};"campaign"===e?(n.campaignId=a,n.campaignName=t.resolvedName||void 0):"creator"===e?(n.creatorId=a,n.creatorName=t.resolvedName||void 0):"organization"===e&&(n.organizationId=a,n.organizationName=t.resolvedName||void 0),g(n)}e.push(t.route)}}L(Array.isArray(u)&&u.length?u:(i=c,o=h,t=i.toLowerCase(),a=o?.campaignName,t.includes("on track")||t.includes("behind")||t.includes("pacing")?["What's causing the gap?","Show top posts","Compare to last month"]:t.includes("anomal")||t.includes("spike")||t.includes("drop")?["Which post caused it?","Is it still trending?","Platform breakdown"]:t.includes("creator")?["Their top posts","Consistency score","Sentiment data"]:t.includes("view")||t.includes("impression")?["By platform","vs last quarter","Who's driving this?"]:t.includes("sentiment")?["Top positive comments?","Which posts score best?"]:a?["Goal attainment?","Any anomalies?","Top creators"]:["Tell me more","Show the data","Recommendations?"])),r&&ev.current&&eM(c)}catch{b(e=>{let t=[...e];return t.at(-1)?.role==="assistant"&&(t[t.length-1]={role:"assistant",content:"Something went wrong. Please try again."}),t}),r&&ev.current&&setTimeout(eE,500)}finally{z(!1)}},[S,y,h,e,b,v,g,eM,eE,q,eD]),ta=(0,r.useCallback)(t=>{if(C(""),eh.current&&(eh.current.style.height="20px"),"reset"===t.action)return void eP();if(t.href){e.push(t.href),c(!1);return}t.query&&tr(t.query)},[eP,e,c,tr]);(0,r.useEffect)(()=>{_(0)},[K]);let tn=o?.user?.role,ts=o?.user?.agency?.id;return o&&("super_admin"===tn||ts)&&!i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("style",{children:`
2        @keyframes waveBar { from { transform: scaleY(0.25); opacity:0.4; } to { transform: scaleY(1); opacity:1; } }
3        @keyframes voiceRing { 0% { transform:scale(1); opacity:0.5; } 100% { transform:scale(1.5); opacity:0; } }
4        @keyframes orbPulse { 0%,100% { box-shadow: 0 0 30px rgba(236,72,153,0.4), 0 0 60px rgba(249,115,22,0.15); } 50% { box-shadow: 0 0 50px rgba(236,72,153,0.6), 0 0 90px rgba(249,115,22,0.25); } }
5        @keyframes orbBreath { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
6      `}),J&&(0,t.jsxs)("div",{className:"fixed bottom-6 right-6 z-30 flex flex-col items-end gap-3",style:{transition:"all 0.3s ease-in-out"},children:[es&&(0,t.jsxs)("div",{className:"w-56 rounded-2xl overflow-hidden",style:{background:"rgba(10,8,16,0.92)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",border:"1px solid var(--tint-soft)",boxShadow:"0 20px 60px var(--shadow-ambient-2xl)"},children:[(0,t.jsx)("div",{style:{height:2,width:"100%",background:"linear-gradient(90deg,#ec4899,#f97316)"}}),(0,t.jsx)("div",{style:{padding:"6px 12px",fontSize:10,fontWeight:700,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--scout-text-soft)",borderBottom:"1px solid var(--tint-softer)"},children:"Voice"}),(0,t.jsx)("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:4,padding:8},children:e0.map(e=>{let r=ea===e.id;return(0,t.jsxs)("button",{onClick:()=>{en(e.id),localStorage.setItem("scout_voice_id",e.id),ei(!1)},style:{display:"flex",flexDirection:"column",alignItems:"flex-start",padding:"6px 10px",borderRadius:8,textAlign:"left",background:r?"linear-gradient(135deg,rgba(236,72,153,0.2),rgba(249,115,22,0.15))":"var(--tint-softer)",border:r?"1px solid rgba(236,72,153,0.4)":"1px solid var(--tint-softer)",cursor:"pointer"},children:[(0,t.jsx)("span",{style:{fontSize:11,fontWeight:600,color:r?"#ec4899":"rgba(255,255,255,0.72)"},children:e.name}),(0,t.jsx)("span",{style:{fontSize:9,color:"var(--scout-text-soft)"},children:e.description})]},e.id)})})]}),f.length>0&&!es&&(0,t.jsx)("div",{style:{width:288,borderRadius:16,overflow:"hidden",background:"rgba(10,8,16,0.88)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",border:"1px solid var(--tint-softer)",boxShadow:"0 12px 40px var(--shadow-ambient-xl)"},children:(0,t.jsx)("div",{style:{padding:"8px 12px",maxHeight:144,overflowY:"auto"},children:f.slice(-2).map((e,r)=>(0,t.jsxs)("div",{style:{fontSize:11,padding:"6px 10px",borderRadius:8,marginBottom:6,background:"user"===e.role?"rgba(236,72,153,0.1)":"var(--tint-softer)",color:"user"===e.role?"rgba(255,255,255,0.65)":"rgba(255,255,255,0.5)"},children:[(0,t.jsx)("span",{style:{fontWeight:600,marginRight:6,color:"user"===e.role?"#ec4899":"var(--tint-strong)"},children:"user"===e.role?"You":"Scout"}),(e.content||"").replace(/```[\s\S]*?```/g,"[chart]").slice(0,100),(e.content||"").length>100?"…":""]},r))})}),et&&(0,t.jsx)("div",{style:{width:256,padding:"8px 12px",borderRadius:12,textAlign:"center",background:"rgba(10,8,16,0.85)",backdropFilter:"blur(30px)",WebkitBackdropFilter:"blur(30px)",border:"1px solid var(--tint-softer)"},children:(0,t.jsxs)("p",{style:{fontSize:11,color:"var(--scout-text-soft)",fontStyle:"italic",margin:0},children:['"',et,'"']})}),(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[(0,t.jsxs)("button",{onClick:()=>ei(e=>!e),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 12px",borderRadius:999,fontSize:11,fontWeight:500,cursor:"pointer",color:"var(--scout-text-soft)",background:"rgba(10,8,16,0.85)",backdropFilter:"blur(30px)",WebkitBackdropFilter:"blur(30px)",border:es?"1px solid rgba(236,72,153,0.4)":"1px solid var(--tint-soft)"},children:[(0,t.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,t.jsx)("path",{d:"M12 1v6m0 6v6m11-7h-6m-6 0H1"})]}),e0.find(e=>e.id===ea)?.name||"Voice"]}),(0,t.jsxs)("button",{onClick:eI,title:"Exit voice mode",style:{position:"relative",display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none",cursor:"pointer",padding:0},children:[(Y===eY||Y===eX)&&[1,2].map(e=>(0,t.jsx)("span",{style:{position:"absolute",borderRadius:"50%",pointerEvents:"none",width:56+20*e,height:56+20*e,background:"linear-gradient(135deg,rgba(236,72,153,0.1),rgba(249,115,22,0.06))",border:"1px solid rgba(236,72,153,0.1)",animation:"voiceRing 1.8s ease-out infinite",animationDelay:`${.4*e}s`}},e)),(0,t.jsx)("div",{style:{position:"relative",zIndex:10,width:56,height:56,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Y===eZ?"linear-gradient(135deg,rgba(236,72,153,0.45),rgba(249,115,22,0.45))":"linear-gradient(135deg,#ec4899,#f97316)",animation:Y===eY||Y===eX?"orbBreath 2.5s ease-in-out infinite, orbPulse 2.5s ease-in-out infinite":"none",boxShadow:Y===eZ?"0 0 25px rgba(236,72,153,0.2)":"0 0 35px rgba(236,72,153,0.45), 0 0 70px rgba(249,115,22,0.15)",transition:"all 0.3s"},children:Y===eZ?(0,t.jsx)("div",{style:{display:"flex",gap:4},children:[0,1,2].map(e=>(0,t.jsx)("span",{className:"animate-bounce",style:{width:6,height:6,borderRadius:"50%",background:"white",animationDelay:`${.15*e}s`,opacity:.7}},e))}):(0,t.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"1.75",style:{width:20,height:20},children:[(0,t.jsx)("path",{d:"M12 1a3 3 0 00-3 3v8a3 3 0 006 0V4a3 3 0 00-3-3z"}),(0,t.jsx)("path",{d:"M19 10v2a7 7 0 01-14 0v-2"}),(0,t.jsx)("line",{x1:"12",y1:"19",x2:"12",y2:"23"}),(0,t.jsx)("line",{x1:"8",y1:"23",x2:"16",y2:"23"})]})})]})]}),(0,t.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:4,marginRight:4},children:[(Y===eY||Y===eX)&&(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:2,height:16},children:e7.slice(0,12).map((e,r)=>(0,t.jsx)("div",{style:{width:2,height:Math.max(.5*e,2),borderRadius:999,background:"linear-gradient(180deg,#ec4899,#f97316)",animation:`waveBar ${.5+r%4*.15}s ease-in-out infinite alternate`,animationDelay:`${.04*r}s`,opacity:.7}},r))}),(0,t.jsx)("p",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.1em",textTransform:"uppercase",color:"var(--scout-text-soft)",margin:0},children:"listening"===Y?"Listening…":"thinking"===Y?"Thinking…":"speaking"===Y?"Speaking…":""})]})]}),!l&&!J&&(0,t.jsxs)("button",{onClick:()=>((e=!0)=>{e&&u(!1),c(e)})(!0),title:`Scout AI  ${"u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?"⌘":"Ctrl+"}J`,className:`hidden md:block fixed bottom-6 right-6 z-20 group transition-all duration-300 ease-in-out ${j?"translate-y-[calc(100%+3rem)] opacity-0 pointer-events-none":"translate-y-0 opacity-100"}`,children:[(0,t.jsx)("span",{className:"absolute inset-0 rounded-2xl opacity-0 group-hover:opacity-100 transition-opacity duration-300",style:{background:"linear-gradient(135deg,#ec4899,#f97316)",filter:"blur(14px)",transform:"scale(1.25)"}}),(0,t.jsxs)("div",{className:"relative flex items-stretch rounded-2xl overflow-hidden",style:{background:"linear-gradient(135deg,#ec4899 0%,#f97316 100%)",boxShadow:"0 4px 20px rgba(236,72,153,0.45), inset 0 1px 0 var(--tint-strong)"},children:[(0,t.jsxs)("span",{className:"flex items-center gap-2 pl-4 pr-3 py-3 text-white font-semibold text-sm transition-transform duration-200 group-hover:scale-[1.02]",children:[(0,t.jsx)(e3,{}),"Ask Scout"]}),(0,t.jsx)("span",{"aria-hidden":"true",className:"w-px self-stretch",style:{background:"var(--tint-strong)"}}),(0,t.jsxs)("span",{role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),e.preventDefault(),p("conversations")},onKeyDown:e=>
6{("Enter"===e.key||" "===e.key)&&(e.stopPropagation(),e.preventDefault(),p("conversations"))},title:ex>0?`${ex} unread message${1===ex?"":"s"}`:"Open conversations",className:"flex items-center gap-1.5 pl-3 pr-3 py-3 text-white text-sm cursor-pointer transition-all duration-200 hover:bg-white/10 active:scale-95",children:[(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-3.5 h-3.5","aria-hidden":!0,children:(0,t.jsx)("path",{d:"M21 11.5a8.38 8.38 0 0 1-9 8.5 8.5 8.5 0 0 1-3.7-.9L3 21l1.4-4.2A8.5 8.5 0 1 1 21 11.5z"})}),ex>0?(0,t.jsx)("span",{className:"font-bold tabular-nums",children:ex>99?"99+":ex}):(0,t.jsx)("span",{className:"hidden sm:inline text-[11px] font-semibold opacity-80",children:"Chats"})]}),(0,t.jsx)("span",{"aria-hidden":"true",className:"w-px self-stretch my-2",style:{background:"var(--tint-strong)"}}),(0,t.jsxs)("span",{role:"button",tabIndex:0,onClick:e=>{e.stopPropagation(),e.preventDefault(),p("team")},onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.stopPropagation(),e.preventDefault(),p("team"))},title:`${ec} teammate${1===ec?"":"s"} online — open team list`,className:"flex items-center gap-1.5 pl-3 pr-4 py-3 text-white text-sm cursor-pointer transition-all duration-200 hover:bg-white/10 active:scale-95",children:[(0,t.jsxs)("span",{className:"relative flex items-center justify-center w-2.5 h-2.5",children:[ec>0&&(0,t.jsx)("span",{className:"absolute inline-flex w-full h-full rounded-full opacity-70 animate-ping bg-emerald-300"}),(0,t.jsx)("span",{className:"relative inline-flex w-2.5 h-2.5 rounded-full",style:{background:ec>0?"#34d399":"rgba(255,255,255,0.5)",boxShadow:ec>0?"0 0 10px rgba(52,211,153,0.7)":"none"}})]}),(0,t.jsx)("span",{className:"font-bold tabular-nums",children:el?"·":ec}),(0,t.jsx)("span",{className:"hidden sm:inline text-[11px] font-semibold opacity-90",children:"online"})]})]})]}),!j&&(0,t.jsx)(eR,{open:d,onClose:()=>u(!1),online:eo.online,offline:eo.offline,loading:el,initialTab:x,openSignal:m}),l&&!J&&(0,t.jsxs)(ef.motion.div,{layoutId:"scout-frame",transition:{layout:{type:"spring",stiffness:220,damping:30,mass:.9}},className:`fixed z-20 flex flex-col
7            left-2 right-2 max-md:bottom-[calc(4rem+env(safe-area-inset-bottom)+0.5rem)] max-md:top-[5.5rem]
8            md:left-auto md:right-6 md:bottom-6 md:top-auto md:w-[400px] md:h-[600px]
9            ${j?"opacity-0 pointer-events-none":"opacity-100"}`,style:{borderRadius:24,overflow:"hidden",border:"1px solid var(--tint-soft)",boxShadow:"0 40px 100px var(--overlay-scrim-strong)"},children:[(0,t.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 pointer-events-none",style:{zIndex:-1,borderRadius:24,background:"rgba(10,8,16,0.82)",backdropFilter:"blur(60px) saturate(200%)",WebkitBackdropFilter:"blur(60px) saturate(200%)",transform:"translateZ(0)",willChange:"transform",isolation:"isolate",contain:"paint"}}),(0,t.jsx)("div",{className:"h-0.5 w-full flex-shrink-0",style:{background:"linear-gradient(90deg,#ec4899,#f97316)"}}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 pt-3.5 pb-3 flex-shrink-0",style:{borderBottom:"1px solid var(--tint-softer)"},children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0 text-white",style:{background:"linear-gradient(135deg,#ec4899 0%,#f97316 100%)",boxShadow:"0 2px 10px rgba(236,72,153,0.4)"},children:(0,t.jsx)(e3,{})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-white text-sm font-bold leading-none tracking-tight",children:"Scout"}),(0,t.jsx)("p",{className:"text-xs mt-1 leading-none font-medium",style:{color:"var(--scout-text-soft)"},children:eC?`On: ${eC}`:"Campaign Intelligence"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("button",{onClick:()=>H("lite"===q?"nested":"lite"),className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl text-xs font-semibold transition-all",style:"nested"===q?{color:"#a85
95f7",background:"rgba(168,85,247,0.14)",border:"1px solid rgba(168,85,247,0.35)"}:{color:"var(--scout-text-soft)",background:"var(--tint-softer)",border:"1px solid transparent"},title:"lite"===q?"Lite mode: classifier picks one specialist (fast, cheap). Click to switch to Nested.":"Nested mode: orchestrator delegates to multiple specialists (slower, more powerful). Click to switch to Lite.",children:[(0,t.jsx)("span",{className:`w-1.5 h-1.5 rounded-full ${"nested"===q?"bg-purple-400":"bg-pink-400"}`}),(0,t.jsx)("span",{children:"nested"===q?"Nested":"Lite"})]}),X&&(0,t.jsxs)("button",{onClick:eL,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl text-xs font-semibold transition-all",style:{color:"var(--scout-text-soft)",background:"var(--tint-softer)"},title:"Start voice mode",children:[(0,t.jsx)(e6,{}),(0,t.jsx)("span",{children:"Voice"})]}),eN&&(0,t.jsx)("button",{onClick:te,className:"flex items-center justify-center w-8 h-8 rounded-xl transition-all",style:{color:"var(--scout-text-soft)",background:"var(--tint-softer)"},onMouseEnter:e=>{e.currentTarget.style.color="rgba(255,255,255,0.8)",e.currentTarget.style.background="var(--tint-soft)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--scout-text-soft)",e.currentTarget.style.background="var(--tint-softer)"},title:"Share this chat",children:(0,t.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("circle",{cx:"18",cy:"5",r:"3"}),(0,t.jsx)("circle",{cx:"6",cy:"12",r:"3"}),(0,t.jsx)("circle",{cx:"18",cy:"19",r:"3"}),(0,t.jsx)("path",{d:"M8.6 13.5 15.4 17.5M15.4 6.5 8.6 10.5"})]})}),(0,t.jsx)(eJ.AttentionButton,{onClick:eW,title:"Open full screen",ariaLabel:"Open full screen",shimmerKey:l?"scout-expand":"closed",sizeClassName:"w-8 h-8",colorClassName:"text-zinc-400 hover:bg-white/10",className:"rounded-xl",children:(0,t.jsx)(eV.ArrowsPointingOutIcon,{className:"w-4 h-4"})}),(0,t.jsx)("button",{onClick:F,className:"flex items-center justify-center w-8 h-8 rounded-xl text-xs font-medium transition-all",style:R?{color:"#ec4899",background:"rgba(236,72,153,0.14)",border:"1px solid rgba(236,72,153,0.35)"}:{color:"var(--scout-text-soft)",background:"var(--tint-softer)",border:"1px solid transparent"},title:"What Scout remembers about you",children:(0,t.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,t.jsx)("path",{d:"M12 2a7 7 0 0 0-7 7c0 2.4 1.2 4 2 5 .5.7 1 1.5 1 2.5V19a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-.5c0-1 .5-1.8 1-2.5.8-1 2-2.6 2-5a7 7 0 0 0-7-7Z"}),(0,t.jsx)("path",{d:"M9 22h6"})]})}),eN&&(0,t.jsxs)("button",{onClick:eP,className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded-xl text-xs font-medium transition-all",style:{color:"var(--scout-text-soft)",background:"var(--tint-softer)"},onMouseEnter:e=>{e.currentTarget.style.color="rgba(255,255,255,0.8)",e.currentTarget.style.background="var(--tint-soft)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--tint-strong)",e.currentTarget.style.background="var(--tint-softer)"},children:[(0,t.jsx)(e4,{}),(0,t.jsx)("span",{children:"Reset"})]}),(0,t.jsx)("button",{onClick:()=>{c(!1)},className:"w-7 h-7 rounded-full flex items-center justify-center ml-0.5 transition-all",style:{color:"var(--scout-text-soft)"},onMouseEnter:e=>{e.currentTarget.style.color="rgba(255,255,255,0.8)",e.currentTarget.style.background="var(--tint-soft)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--tint-strong)",e.currentTarget.style.background="transparent"},children:(0,t.jsx)(e2,{})})]})]}),R&&(0,t.jsxs)("div",{className:"absolute left-0 right-0 z-30 flex flex-col",style:{top:49,bottom:0,background:"rgba(10,8,16,0.97)",backdropFilter:"blur(30px)",WebkitBackdropFilter:"blur(30px)"},children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 flex-shrink-0",style:{borderBottom:"1px solid var(--tint-softer)"},children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-white text-sm font-bold leading-none tracking-tight",children:"What Scout remembers"}),(0,t.jsx)("p",{className:"text-xs mt-1 leading-none",style:{color:"var(--scout-text-soft)"},children:"Preferences & corrections it carries forward"})]}),D&&D.user.length>0&&(0,t.jsx)("button",{onClick:()=>O(null),className:"px-2.5 py-1.5 rounded-xl text-xs font-semibold transition-all",style:{color:"#f87171",background:"rgba(239,68,68,0.12)",border:"1px solid rgba(239,68,68,0.3)"},title:"Clear all of your personal memory",children:"Clear mine"})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-3",style:{scrollbarWidth:"none"},children:P?(0,t.jsx)("p",{className:"text-xs",style:{color:"var(--scout-text-soft)"},children:"Loading…"}):D&&(0!==D.user.length||0!==D.agency.length)?(0,t.jsx)(t.Fragment,{children:[{label:"Yours",items:D.user,canDelete:!0},{label:"Team",items:D.agency,canDelete:!1}].filter(e=>e.items.length>0).map(e=>(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-[0.12em] mb-2",style:{color:"var(--scout-text-soft)"},children:e.label}),(0,t.jsx)("div",{className:"flex flex-col gap-1.5",children:e.items.map(r=>(0,t.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 rounded-xl",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-softer)"},children:[(0,t.jsx)("span",{className:"mt-0.5 px-1.5 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider flex-shrink-0",style:{color:"correction"===r.kind?"#f59e0b":"#ec4899",background:"correction"===r.kind?"rgba(245,158,11,0.14)":"rgba(236,72,153,0.12)"},children:r.kind}),(0,t.jsx)("span",{className:"text-xs leading-snug flex-1 min-w-0",style:{color:"rgba(255,255,255,0.82)"},children:r.text}),e.canDelete&&(0,t.jsx)("button",{onClick:()=>O(r.id),className:"flex-shrink-0 w-6 h-6 rounded-lg flex items-center justify-center transition-all",style:{color:"var(--scout-text-soft)"},onMouseEnter:e=>{e.currentTarget.style.color="#f87171",e.currentTarget.style.background="rgba(239,68,68,0.12)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--scout-text-soft)",e.currentTarget.style.background="transparent"},title:"Forget this",children:(0,t.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,t.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]},r.id))})]},e.label))}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center text-center py-10 px-4",children:[(0,t.jsx)("p",{className:"text-white text-sm font-semibold mb-1",children:"Nothing remembered yet"}),(0,t.jsx)("p",{className:"text-xs",style:{color:"var(--scout-text-soft)"},children:'Tell Scout a preference like "always show ER as a percentage" and it\'ll remember it here.'})]})})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",style:{scrollbarWidth:"none"},children:eN?(0,t.jsxs)("div",{className:"px-4 py-4 space-y-3",children:[f.map((e,r)=>(0,t.jsx)("div",{className:`flex gap-2 w-full ${"user"===e.role?"justify-end":"justify-start"}`,children:"user"===e.role?(0,t.jsx)("div",{className:"px-4 py-2.5",style:{maxWidth:"80%",minWidth:0,background:"linear-gradient(135deg,#ec4899 0%,#f97316 100%)",borderRadius:"18px 18px 4px 18px",boxShadow:"0 2px 12px rgba(236,72,153,0.3)",wordBreak:"break-word",overflowWrap:"break-word"},children:(0,t.jsx)(eH.MessageContent,{content:e.content,isUser:!0})}):(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex gap-2 min-w-0",children:[(0,t.jsx)("div",{className:"w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0 mt-0.5 text-white",style:{background:"linear-gradient(135deg,#ec4899,#f97316)",boxShadow:"0 1px 6px rgba(236,72,153,0.35)"},children:(0,t.jsx)(e3,{})}),(0,t.jsxs)("div",{className:"px-4 py-2.5 min-w-0 flex-1",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-softer)",borderRadius:"4px 18px 18px 18px",color:"var(--scout-text-strong)",wordBreak:"break-word",overflowWrap:"break-word",overflow:"hidden"},children:[!e.content&&S&&r===f.length-1?(0,t.jsx)(e9,{}):(0,t.jsx)(eH.MessageContent,{content:e.content,isUser:!1}),e.content&&e.messageId&&Array.isArray(e.visuals)&&e.visuals.length>0&&!(S&&r===f.length-1)&&(0,t.jsx)("div",{className:"mt-1",children:e.visuals.map((e,r)=>(0,t.jsx)(eU.default,{spec:e},r))})]})]}),e.content&&e.messageId&&!(S&&r===f.length-1)&&(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(eH.ScoutTrace,{feedbackTrace:e.feedbackTrace}),(0,t.jsx)(eH.ScoutFeedback,{messageId:e.messageId,feedbackTrace:e.feedbackTrace,question:f[r-1]?.role==="user"?f[r-1].content:"",answer:e.content},e.messageId)]})]})},r)),M.length>0&&!S&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 pl-7 pt-1",children:M.map((e,r)=>(0,t.jsx)("button",{onClick:()=>tr(e),className:"text-xs px-3 py-1.5 rounded-full transition-all duration-150 active:scale-95",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-softer)",color:"var(--scout-text-soft)"},onMouseEnter:e=>{e.currentTarget.style.background="rgba(236,72,153,0.12)",e.currentTarget.style.borderColor="rgba(236,72,153,0.25)",e.currentTarget.style.color="rgba(255,255,255,0.85)"},onMouseLeave:e=>{e.currentTarget.style.background="var(--tint-softer)",e.currentTarget.style.borderColor="var(--tint-softer)",e.currentTarget.style.color="var(--shimmer-highlight)"},children:e},r))}),(0,t.jsx)("div",{ref:em})]}):(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full px-5 py-6",children:[(0,t.jsx)("div",{className:"w-14 h-14 roun
9ded-2xl flex items-center justify-center text-white mb-4 flex-shrink-0",style:{background:"linear-gradient(135deg,#ec4899 0%,#f97316 100%)",boxShadow:"0 8px 30px rgba(236,72,153,0.35)"},children:(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-7 h-7",children:(0,t.jsx)("path",{d:"M12 2.25a.75.75 0 01.75.75v2.25a.75.75 0 01-1.5 0V3a.75.75 0 01.75-.75zM7.5 12a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM18.894 6.166a.75.75 0 00-1.06-1.06l-1.591 1.59a.75.75 0 101.06 1.061l1.591-1.59zM21.75 12a.75.75 0 01-.75.75h-2.25a.75.75 0 010-1.5H21a.75.75 0 01.75.75zM17.834 18.894a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 10-1.061 1.06l1.59 1.591zM12 18a.75.75 0 01.75.75V21a.75.75 0 01-1.5 0v-2.25A.75.75 0 0112 18zM7.758 17.303a.75.75 0 00-1.061-1.06l-1.591 1.59a.75.75 0 001.06 1.061l1.592-1.59zM6 12a.75.75 0 01-.75.75H3a.75.75 0 010-1.5h2.25A.75.75 0 016 12zM6.697 7.757a.75.75 0 001.06-1.06l-1.59-1.591a.75.75 0 00-1.061 1.06l1.59 1.591z"})})}),(0,t.jsx)("p",{className:"text-white font-bold text-lg mb-1 tracking-tight",children:"Ask Scout"}),(0,t.jsx)("p",{className:"text-xs text-center mb-6 leading-relaxed max-w-[220px]",style:{color:"var(--scout-text-soft)"},children:eC?`I'm on ${eC}. Tap a question or type below.`:"Live data from every campaign, creator, and post."}),(0,t.jsx)("div",{className:"w-full grid grid-cols-2 gap-2",children:ej.map((r,a)=>{let n=r.featured?{background:"linear-gradient(135deg,rgba(236,72,153,0.18),rgba(249,115,22,0.12))",border:"1px solid rgba(236,72,153,0.35)",color:"var(--scout-text-strong)",boxShadow:"0 2px 10px rgba(236,72,153,0.15)"}:{background:"var(--tint-softer)",border:"1px solid var(--tint-softer)",color:"var(--scout-text-soft)"};return(0,t.jsxs)("button",{onClick:()=>{r.href?(e.push(r.href),c(!1)):r.query&&tr(r.query)},className:"text-left px-3 py-2.5 rounded-xl text-xs font-medium transition-all duration-150 active:scale-95",style:n,onMouseEnter:e=>{r.featured?(e.currentTarget.style.background="linear-gradient(135deg,rgba(236,72,153,0.28),rgba(249,115,22,0.2))",e.currentTarget.style.borderColor="rgba(236,72,153,0.6)"):(e.currentTarget.style.background="rgba(236,72,153,0.12)",e.currentTarget.style.borderColor="rgba(236,72,153,0.3)",e.currentTarget.style.color="rgba(255,255,255,0.9)")},onMouseLeave:e=>{r.featured?(e.currentTarget.style.background="linear-gradient(135deg,rgba(236,72,153,0.18),rgba(249,115,22,0.12))",e.currentTarget.style.borderColor="rgba(236,72,153,0.35)"):(e.currentTarget.style.background="var(--tint-softer)",e.currentTarget.style.borderColor="var(--tint-softer)",e.currentTarget.style.color="rgba(255,255,255,0.65)")},children:[(0,t.jsx)("div",{children:r.label}),r.hint&&(0,t.jsx)("div",{className:"text-[10px] font-normal mt-0.5",style:{color:r.featured?"var(--shimmer-highlight)":"var(--tint-strong)"},children:r.hint})]},a)})}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-1 mt-4",children:[(0,t.jsxs)("p",{className:"text-[10px] tracking-wide",style:{color:"var(--scout-text-soft)"},children:["Tip: type ",(0,t.jsx)("span",{style:{color:"rgba(236,72,153,0.9)",fontWeight:600},children:"/"})," for quick commands"]}),X&&(0,t.jsxs)("p",{className:"text-[10px] tracking-wide",style:{color:"var(--scout-text-soft)"},children:[(0,t.jsx)("span",{style:{color:"rgba(236,72,153,0.9)",fontWeight:600},children:"u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?"⌘⇧S":"Ctrl+Shift+S"})," for voice mode"]})]})]})}),(0,t.jsxs)("div",{className:"px-3 pb-4 pt-2 flex-shrink-0 relative",style:{borderTop:"1px solid var(--tint-softer)"},children:[E&&(0,t.jsx)(e8,{name:E,onDismiss:()=>T(null)}),G&&V.length>0&&(0,t.jsxs)("div",{className:"absolute bottom-full left-3 right-3 mb-2 overflow-hidden z-20",style:{borderRadius:16,background:"rgba(12,8,20,0.95)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",border:"1px solid rgba(236,72,153,0.25)",boxShadow:"0 20px 50px var(--shadow-ambient-2xl)"},children:[(0,t.jsx)("div",{className:"h-0.5 w-full",style:{background:"linear-gradient(90deg,#ec4899,#f97316)"}}),(0,t.jsx)("div",{className:"px-3 py-1.5 text-[10px] font-bold tracking-widest uppercase",style:{color:"var(--scout-text-soft)",borderBottom:"1px solid var(--tint-softer)",letterSpacing:"0.12em"}
9,children:"Quick commands"}),(0,t.jsx)("div",{className:"max-h-60 overflow-y-auto py-1",style:{scrollbarWidth:"none"},children:V.map((e,r)=>{let a=r===I;return(0,t.jsxs)("button",{onMouseEnter:()=>_(r),onClick:()=>ta(e),className:"w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",style:{background:a?"linear-gradient(90deg,rgba(236,72,153,0.18),rgba(249,115,22,0.1))":"transparent"},children:[(0,t.jsx)("span",{className:"text-base flex-shrink-0",children:e.icon}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-semibold",style:{color:a?"white":"rgba(255,255,255,0.85)"},children:e.cmd}),(0,t.jsx)("span",{className:"text-[10px]",style:{color:a?"var(--shimmer-highlight)":"var(--tint-strong)"},children:e.label})]}),(0,t.jsx)("div",{className:"text-[10px] mt-0.5 truncate",style:{color:a?"rgba(255,255,255,0.72)":"rgba(255,255,255,0.5)"},children:e.hint})]}),a&&(0,t.jsx)("span",{className:"text-[9px] font-semibold uppercase tracking-widest flex-shrink-0",style:{color:"rgba(236,72,153,0.8)",letterSpacing:"0.1em"},children:"↵ run"})]},e.cmd)})})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2 px-3.5 py-2.5 rounded-2xl transition-all duration-150",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-soft)"},onFocusCapture:e=>{e.currentTarget.style.borderColor="rgba(236,72,153,0.5)",e.currentTarget.style.background="var(--tint-softer)"},onBlurCapture:e=>{e.currentTarget.style.borderColor="var(--tint-soft)",e.currentTarget.style.background="var(--tint-softer)"},children:[(0,t.jsx)("textarea",{ref:e=>{ep.current=e,eh.current=e},value:N,onChange:e=>C(e.target.value),onKeyDown:e=>{if(G&&V.length){if("ArrowDown"===e.key){e.preventDefault(),_(e=>(e+1)%V.length);return}if("ArrowUp"===e.key){e.preventDefault(),_(e=>(e-1+V.length)%V.length);return}if("Tab"===e.key){e.preventDefault(),C(V[I].cmd+" ");return}if("Escape"===e.key){e.preventDefault(),C("");return}if("Enter"===e.key&&!e.shiftKey){e.preventDefault(),ta(V[I]);return}}"Enter"!==e.key||e.shiftKey||(e.preventDefault(),tr(N))},placeholder:eC?`Ask about ${eC}…`:"Ask Scout anything…",rows:1,disabled:S,className:"flex-1 bg-transparent text-sm resize-none outline-none leading-5 max-h-24 disabled:opacity-50",style:{color:"var(--scout-text-strong)",minHeight:"20px",caretColor:"#ec4899"},onInput:e=>{e.target.style.height="auto",e.target.style.height=`${Math.min(e.target.scrollHeight,96)}px`}}),(0,t.jsx)("button",{onClick:()=>tr(N),disabled:!N.trim()||S,className:"w-8 h-8 rounded-xl flex items-center justify-center text-white transition-all duration-150 active:scale-90 disabled:opacity-30 disabled:cursor-not-allowed flex-shrink-0",style:{background:N.trim()&&!S?"linear-gradient(135deg,#ec4899,#f97316)":"var(--tint-soft)",boxShadow:N.trim()&&!S?"0 2px 10px rgba(236,72,153,0.35)":"none",transition:"all 0.15s"},children:(0,t.jsx)(e5,{})})]})]})]}),eB&&eO&&(0,t.jsx)(eK.default,{chatId:eO,title:tt,onClose:()=>eF(!1)})]}):null}var tt=e.i(270744),tr=e.i(372287),ta=e.i(467415),tn=e.i(63495),ts=e.i(984174),ti=e.i(787906),to=e.i(178263);let tl={critical:"#EF4444",high:"#F59E0B",medium:"#6366F1",low:"#9CA3AF"};function tc({onCreated:e}){let[a,n]=(0,r.useState)(""),[s,i]=(0,r.useState)(!1),[o,l]=(0,r.useState)([]),[c,d]=(0,r.useState)(new Set),[u,x]=(0,r.useState)(!1);async function m(){if(a.trim()){i(!0),l([]),d(new Set);try{let e=await fetch("/api/tasks/ai/extract",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a})});if(e.ok){let t=await e.json();l(t.tasks||[]),d(new Set(t.tasks.map((e,t)=>t)))}else eh.default.error("Couldn't extract tasks")}catch{eh.default.error("Couldn't extract tasks")}finally{i(!1)}}}async function p(){x(!0);let t=0;for(let e of c){let r=o[e];try{(await fetch("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:r.title,priority:r.priority||"medium",dueDate:r.dueDate,group:"To Do"})})).ok&&(t+=1)}catch{}}x(!1),e?.(t)}let h=c.size;return(0,t.jsx)("div",{className:"p-5",children:o.length?(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-sm font-black text-gray-900 dark:text-zinc-100",children:[o.length," action item",1===o.length?"":"s"," found"]}
9),(0,t.jsx)("p",{className:"text-[10px] text-gray-400 dark:text-zinc-500 mt-0.5",children:"Uncheck any you don't want, then create"})]}),(0,t.jsx)("button",{onClick:()=>{l([]),d(new Set)},className:"text-[11px] font-semibold text-gray-400 dark:text-zinc-500 hover:text-gray-700 dark:hover:text-zinc-300",children:"← Back"})]}),(0,t.jsx)("div",{className:"space-y-1.5 mb-4 max-h-[50vh] overflow-y-auto",children:o.map((e,r)=>{let a=c.has(r),n=tl[e.priority]||"#6366F1";return(0,t.jsxs)(ef.motion.button,{initial:{opacity:0,x:-4},animate:{opacity:1,x:0},transition:{delay:.04*r},onClick:()=>{d(e=>{let t=new Set(e);return t.has(r)?t.delete(r):t.add(r),t})},className:"w-full text-left p-3 rounded-xl transition-all duration-150 group flex items-start gap-3",style:{background:a?"rgba(99,102,241,0.04)":"var(--shadow-ambient-xs)",border:a?"1px solid rgba(99,102,241,0.18)":"1px solid var(--surface-softer)"},children:[(0,t.jsx)("div",{className:"w-5 h-5 rounded-md flex items-center justify-center flex-shrink-0 mt-0.5",style:a?{background:"#6366F1",boxShadow:"0 0 8px rgba(99,102,241,0.3)"}:{border:"1.5px dashed var(--shadow-ambient-xl)"},children:a&&(0,t.jsx)(ti.CheckIcon,{className:"w-3 h-3 text-white",strokeWidth:3})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 flex-wrap",children:[(0,t.jsx)("span",{className:`text-[13px] font-semibold flex-1 ${a?"text-gray-800 dark:text-zinc-100":"text-gray-500 dark:text-zinc-400"}`,children:e.title}),e.priority&&(0,t.jsxs)("span",{className:"text-[9px] font-black uppercase tracking-wider px-1.5 py-0.5 rounded flex items-center gap-0.5 flex-shrink-0",style:{background:`${n}15`,color:n},children:["critical"===e.priority&&(0,t.jsx)(to.FireIcon,{className:"w-2.5 h-2.5"}),e.priority]}),e.dueDate&&(0,t.jsx)("span",{className:"text-[10px] font-semibold px-1.5 py-0.5 rounded flex-shrink-0",style:{background:"var(--surface-softer)",color:"var(--text-tertiary)"},children:new Date(e.dueDate).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]}),e.reason&&(0,t.jsxs)("p",{className:"text-[10px] text-gray-400 dark:text-zinc-500 italic mt-0.5",children:["“",e.reason,"”"]})]})]},r)})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:p,disabled:0===h||u,className:"flex-1 text-xs px-4 py-2.5 text-white rounded-xl font-semibold disabled:opacity-40 transition-all duration-300 hover:shadow-md flex items-center justify-center gap-1.5",style:{background:h>0?"linear-gradient(135deg, #F97316, #EC4899)":"var(--border-default)",boxShadow:h>0?"0 4px 12px rgba(236,72,153,0.25)":"none"},children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M.ArrowPathIcon,{className:"w-3 h-3 animate-spin"}),"Creating…"]}):(0,t.jsxs)(t.Fragment,{children:["Create ",h," task",1===h?"":"s"]})}),(0,t.jsx)("button",{onClick:()=>{l([]),n(""),d(new Set)},className:"text-xs px-4 py-2.5 rounded-xl font-semibold text-gray-600 dark:text-zinc-400 hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors",children:"Reset"})]})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"linear-gradient(135deg, #6366F1, #A855F7)",boxShadow:"0 2px 8px rgba(168,85,247,0.25)"},children:(0,t.jsx)(ts.SparklesIcon,{className:"w-3.5 h-3.5 text-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-black text-gray-900 dark:text-zinc-100",children:"Paste, extract, ship"}),(0,t.jsx)("p",{className:"text-[10px] text-gray-400 dark:text-zinc-500 mt-0.5",children:"Drop in a meeting note, brief, or Slack thread — AI pulls out action items"})]})]}),(0,t.jsx)("textarea",{value:a,onChange:e=>n(e.target.value),autoFocus:!0,rows:8,placeholder:"Paste anything…\n\nExamples:\n• Meeting notes from sync with Charli\n• Brand brief PDF text\n• Slack thread about Q2 launch",className:"w-full text-[13px] p-4 rounded-xl focus:outline-none focus:ring-2 focus:ring-violet-300/50 resize-none transition-all leading-relaxed",style:{background:"var(--surface-soft)",border:"1px solid var(--border-subtle)",minHeight:200}}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-3",children:[(0,t.jsx)("span",{className:"text-[11px] text-gray-400 dark:text-zinc-500",children:a.length>0?`${a.length} chars`:"No text yet"}),(0,t.jsx)("button",{onClick:m,disabled:!a.trim()||s,className:"text-xs px-5 py-2 text-white rounded-xl font-semibold disabled:opacity-40 transition-all duration-300 hover:shadow-md hover:-translate-y-0.5 flex items-center gap-1.5",style:{background:a.trim()?"linear-gradient(135deg, #6366F1, #A855F7)":"var(--border-default)",boxShadow:a.trim()?"0 4px 12px rgba(168,85,247,0.25)":"none"},children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M.ArrowPathIcon,{className:"w-3 h-3 animate-spin"}),"Extracting…"]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ts.SparklesIcon,{className:"w-3 h-3"}),"Extract tasks"]})})]})]})})}let td={creator:{label:"Creator",className:"bg-pink-50 dark:bg-pink-500/10 text-pink-600 dark:text-pink-300 border border-pink-100 dark:border-pink-500/30"},campaign:{label:"Campaign",className:"bg-orange-50 dark:bg-orange-500/10 text-orange-600 dar
9k:text-orange-300 border border-orange-100 dark:border-orange-500/30"},organization:{label:"Org",className:"bg-purple-50 dark:bg-purple-500/10 text-purple-600 dark:text-purple-300 border border-purple-100 dark:border-purple-500/30"},deal:{label:"Deal",className:"bg-emerald-50 dark:bg-emerald-500/10 text-emerald-600 dark:text-emerald-300 border border-emerald-100 dark:border-emerald-500/30"}},tu={creators:[],campaigns:[],organizations:[],deals:[]},tx=["creators","campaigns","organizations","deals"],tm={creators:{label:"Creators",type:"creator"},campaigns:{label:"Campaigns",type:"campaign"},organizations:{label:"Organizations",type:"organization"},deals:{label:"Deals",type:"deal"}};function tp({item:e,type:a,isSelected:n,onSelect:s,onHover:i}){let[o,l]=(0,r.useState)(!1),c=td[a],d=(0,r.useRef)(null);return(0,r.useEffect)(()=>{n&&d.current?.scrollIntoView({block:"nearest"})},[n]),(0,t.jsxs)("div",{ref:d,className:`flex items-center cursor-pointer p-3 rounded-xl transition-all duration-150 ${n?"bg-gradient-to-r from-pink-50/80 to-orange-50/80 dark:from-pink-500/10 dark:to-orange-500/10 shadow-sm dark:shadow-none dark:ring-1 dark:ring-pink-500/20":"hover:bg-gray-50/80 dark:hover:bg-zinc-900/80"}`,onClick:()=>s(a,e._id),onMouseEnter:i,children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:!o&&e.image?(0,t.jsx)("img",{src:e.image,alt:"",className:"w-12 h-12 rounded-xl object-cover shadow-sm",loading:"lazy",onError:()=>l(!0)}):(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-pink-400 to-orange-400 flex items-center justify-center shadow-sm",children:(0,t.jsx)("span",{className:"text-white text-lg font-semibold",children:e.name?.charAt(0).toUpperCase()})})}),(0,t.jsxs)("div",{className:"ml-3 flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:`text-sm font-semibold truncate transition-colors ${n?"text-pink-600":"text-gray-900 dark:text-zinc-100"}`,children:e.name}),(0,t.jsx)("span",{className:`inline-flex items-center px-1.5 py-0.5 rounded-md text-[10px] font-medium flex-shrink-0 ${c.className}`,children:c.label})]}),"creator"===a&&e.socials&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:Object.entries(e.socials).slice(0,3).map(([e,r])=>{let a=tr.default[e];return a?(0,t.jsxs)("span",{className:`inline-flex items-center px-2 py-0.5 rounded-md text-[10px] ${a.bg} ${"pinterest"===e?"text-black dark:text-black":"text-white"}`,children:[(0,t.jsx)("img",{src:a.icon,alt:"",className:"w-3 h-3 mr-1"}),(0,ta.formatNumberReturn)(r.followers)]},e):null})}),"campaign"===a&&e.organization?.name&&(0,t.jsx)("p",{className:"text-xs text-gray-400 dark:text-zinc-500 mt-0.5 truncate",children:e.organization.name}),"organization"===a&&e.vertical&&(0,t.jsx)("p",{className:"text-xs text-gray-400 dark:text-zinc-500 mt-0.5 truncate",children:e.vertical}),"deal"===a&&(0,t.jsx)("p",{className:"text-xs text-gray-400 dark:text-zinc-500 mt-0.5 truncate",children:[e.organization?.name,e.stageName||e.stage,function(e,t){if(!e)return null;try{return new Intl.NumberFormat("en-US",{style:"currency",currency:t||"USD",maximumFractionDigits:0}).format(e)}catch{return`$${Math.round(e).toLocaleString()}`}}(e.amount,e.currency)].filter(Boolean).join(" · ")})]}),n&&(0,t.jsxs)("div",{className:"ml-2 flex-shrink-0 flex items-center gap-1.5",children:[(0,t.jsx)("kbd",{className:"hidden sm:inline-flex px-1.5 py-0.5 rounded text-[10px] font-medium text-gray-400 dark:text-zinc-500 bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800",children:"Enter"}),(0,t.jsx)("svg",{className:"w-4 h-4 text-pink-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})]})}let th=[{key:"search",label:"Search",icon:ev.MagnifyingGlassIcon},{key:"create",label:"Add task",icon:ej.PlusIcon},{key:"extract",label:"Paste → tasks",icon:tt.ClipboardDocumentIcon}];function tg(){let[e,a]=(0,r.useState)(!1),[i,o]=(0,r.useState)("search"),[l,c]=(0,r.useState)(""),[d,u]=(0,r.useState)(tu),[x,m]=(0,r.useState)(!1),[p,h]=(0,r.useState)(0),[g,f]=(0,r.useState)([]),b=(0,r.useRef)(null),y=(0,r.useRef)(null),v=(0,r.useRef)(null),k=(0,s.useRouter)(),{data:w}
9=(0,n.useSession)();(0,r.useEffect)(()=>{let t=t=>{(t.metaKey||t.ctrlKey)&&"k"===t.key&&(t.preventDefault(),a(e=>!e)),"Escape"===t.key&&e&&(t.preventDefault(),j())};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e]),(0,r.useEffect)(()=>{e&&setTimeout(()=>b.current?.focus(),50)},[e]);let j=(0,r.useCallback)(()=>{a(!1),c(""),u(tu),h(0),o("search"),y.current&&y.current.abort()},[]);async function N(e){try{let t=await fetch("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e.title,group:"To Do",assignees:e.assignees||[],linkedCreator:e.linkedCreator||null,linkedCampaign:e.linkedCampaign||null,parentDeal:e.parentDeal||null,status:e.status||"To Do",statusColor:e.statusColor,priority:e.priority,dueDate:e.dueDate})});if(t.ok){let r=await t.json();eh.default.success("Task created"),e.linkedCampaign?k.push(`/dashboard/user/campaign/${e.linkedCampaign}?tab=tasks&taskId=${r.task._id}`):e.linkedCreator?k.push(`/dashboard/user/creator/${e.linkedCreator}?tab=tasks&taskId=${r.task._id}`):k.push(`/dashboard/user/tasks?taskId=${r.task._id}`),j()}else eh.default.error("Failed to create task")}catch{eh.default.error("Failed to create task")}}(0,r.useEffect)(()=>{("create"===i||"extract"===i)&&0===g.length&&fetch("/api/agency-team").then(e=>e.ok?e.json():{users:[]}).then(e=>f(e.users||e.team||[])).catch(()=>{})},[i,g.length]);let C=(0,r.useCallback)(async e=>{if(y.current&&y.current.abort(),!e.trim()){u(tu),m(!1);return}m(!0);try{y.current=new AbortController;let t=await fetch(`https://www.socialscout.ai/api/searchAutoCompleteAll?search=${encodeURIComponent(e)}`,{signal:y.current.signal});if(!t.ok)throw Error(`HTTP ${t.status}`);let r=await t.json();u({creators:(r.creators??[]).filter(Boolean),campaigns:(r.campaigns??[]).filter(Boolean),organizations:(r.organizations??[]).filter(Boolean),deals:(r.deals??[]).filter(Boolean)}),h(0)}catch(e){"AbortError"!==e.name&&console.error("Search error:",e)}finally{m(!1)}},[]),S=(0,r.useCallback)(e=>{let t=e.target.value;c(t),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>C(t),300)},[C]),z=(0,r.useMemo)(()=>{let e=[];for(let t of d.creators)e.push({type:"creator",item:t});for(let t of d.campaigns)e.push({type:"campaign",item:t});for(let t of d.organizations)e.push({type:"organization",item:t});for(let t of d.deals)e.push({type:"deal",item:t});return e},[d]),E=(0,r.useCallback)((e,t)=>{let r={creator:`/dashboard/user/creator/${t}`,campaign:`/dashboard/user/campaign/${t}`,organization:`/dashboard/user/organization/${t}`,deal:`/dashboard/user/sales/deal/${t}`};r[e]&&(k.push(r[e]),j())},[k,j]),T=(0,r.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),h(e=>Math.min(e+1,z.length-1));else if("ArrowUp"===e.key)e.preventDefault(),h(e=>Math.max(e-1,0));else if("Enter"===e.key&&z[p]){e.preventDefault();let{type:t,item:r}=z[p];E(t,r._id)}},[z,p,E]),M=(0,r.useMemo)(()=>{let e=0,t={};for(let r of tx)t[r]=e,e+=d[r].length;return t},[d]);if(!e)return null;let L=z.length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-[100] transition-opacity duration-200",onClick:j}),(0,t.jsx)("div",{className:"fixed inset-0 z-[101] flex items-start justify-center pt-[12vh] px-4 pointer-events-none",children:(0,t.jsxs)("div",{className:"w-full max-w-2xl bg-white dark:bg-zinc-950 rounded-2xl shadow-2xl border border-gray-200 dark:border-zinc-800 overflow-hidden pointer-events-auto animate-in fade-in slide-in-from-top-4 duration-200",role:"dialog","aria-modal":"true","aria-label":"Quick search",children:[(0,t.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-pink-500 to-orange-400"}),(0,t.jsxs)("div",{className:"flex items-center gap-1 px-3 pt-2.5 pb-2 border-b border-gray-100 dark:border-zinc-800",children:[th.map(e=>{let r=e.icon,a=i===e.key;return(0,t.jsxs)("button",{onClick:()=>o(e.key),className:"flex items-center gap-1.5 px-3 py-1.5 text-[12px] font-bold rounded-lg transition-all duration-200",style:{color:a?"white":"var(--text-tertiary)",background:a?"linear-gradient(135deg, #F97316, #EC4899)":"transparent",boxShadow:a?"0 2px 8px rgba(236,72,153,0.25)":"none"},children:[(0,t.jsx)(r,{className:"w-3.5 h-3.5"}),e.label]},e.key)}),(0,t.jsx)("span",{className:"ml-auto text-[10px] font-medium text-gray-400 dark:text-zinc-500 pr-1",children:"⌘K"})]}),"search"===i&&(0,t.jsxs)("div",{className:"flex items-center px-5 border-b border-gray-100 dark:border-zinc-800",children:[(0,t.jsx)(ev.MagnifyingGlassIcon,{className:"w-5 h-5 text-gray-400 dark:text-zinc-500 flex-shrink-0"}
9),(0,t.jsx)("input",{ref:b,type:"text",value:l,onChange:S,onKeyDown:T,placeholder:"Search creators, campaigns, organizations, deals...",className:"flex-1 py-4 px-3 text-[15px] bg-transparent border-0 outline-none placeholder-gray-400 dark:placeholder-zinc-500 text-gray-900 dark:text-zinc-100"}),l&&(0,t.jsx)("button",{onClick:()=>{c(""),u(tu),b.current?.focus()},className:"p-1 rounded-md hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors mr-2",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400 dark:text-zinc-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),(0,t.jsx)("kbd",{className:"hidden sm:inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium text-gray-400 dark:text-zinc-500 bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800",children:"ESC"})]}),"create"===i&&(0,t.jsxs)("div",{className:"p-2 max-h-[55vh] overflow-y-auto",children:[(0,t.jsx)(tn.default,{teamMembers:g,placeholder:"What needs to be done? Type @ to tag, / for actions",onSubmit:N,onCancel:j,groupColor:"#F97316"}),(0,t.jsxs)("div",{className:"px-5 pt-2 pb-3 text-[10px] text-gray-400 dark:text-zinc-500 leading-relaxed",children:["Tip: tag a campaign or creator with ",(0,t.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"@"}),", set priority/due-date with ",(0,t.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"/"}),". The task will open in the right place automatically."]})]}),"extract"===i&&(0,t.jsx)("div",{className:"max-h-[60vh] overflow-y-auto",children:(0,t.jsx)(tc,{teamMembers:g,onCreated:e=>{eh.default.success(`${e} task${1===e?"":"s"} created`),j()}})}),"search"===i&&(0,t.jsxs)("div",{className:"max-h-[55vh] overflow-y-auto overscroll-contain",children:[x&&(0,t.jsx)("div",{className:"p-4 space-y-2",children:[0,1,2,3].map(e=>(0,t.jsxs)("div",{className:"flex items-center p-3 rounded-xl animate-pulse",children:[(0,t.jsx)("div",{className:"w-12 h-12 rounded-xl bg-gray-100 dark:bg-zinc-900 flex-shrink-0"}),(0,t.jsxs)("div",{className:"ml-3 flex-1 space-y-2",children:[(0,t.jsx)("div",{className:"h-4 bg-gray-100 dark:bg-zinc-900 rounded-full w-2/3"}),(0,t.jsx)("div",{className:"h-3 bg-gray-50 dark:bg-zinc-900 rounded-full w-1/3"})]})]},e))}),!x&&L>0&&(0,t.jsxs)("div",{className:"p-3",children:[(0,t.jsxs)("div",{className:"px-3 pb-2 text-[11px] text-gray-400 dark:text-zinc-500",children:[L," result",1!==L?"s":""," for"," ",(0,t.jsxs)("span",{className:"font-medium text-gray-500 dark:text-zinc-400",children:["“",l,"”"]})]}),Object.entries(tm).map(([e,{label:r,type:a}])=>{let n=d[e];if(!n.length)return null;let s=M[e];return(0,t.jsxs)("div",{className:"mb-3 last:mb-0",children:[(0,t.jsxs)("div",{className:"flex items-center mb-1.5 px-3 py-1.5",children:[(0,t.jsx)("div",{className:"h-3.5 w-0.5 rounded-full bg-gradient-to-b from-pink-500 to-orange-400 mr-2"}),(0,t.jsx)("h3",{className:"text-[11px] font-bold tracking-widest uppercase text-gray-400 dark:text-zinc-500",children:r}),(0,t.jsx)("div",{className:"ml-2 px-1.5 py-0.5 bg-gradient-to-r from-pink-500 to-orange-400 rounded-full text-[10px] font-semibold text-white min-w-[18px] text-center",children:n.length})]}),n.map((e,r)=>(0,t.jsx)(tp,{item:e,type:a,isSelected:p===s+r,onSelect:E,onHover:()=>h(s+r)},e._id))]},e)})]}),!x&&l&&0===L&&(0,t.jsxs)("div",{className:"p-10 text-center",children:[(0,t.jsx)("div",{className:"w-14 h-14 rounded-full bg-gray-50 dark:bg-zinc-900 flex items-center justify-center mx-auto mb-4",children:(0,t.jsx)(ev.MagnifyingGlassIcon,{className:"w-7 h-7 text-gray-300 dark:text-zinc-700"})}),(0,t.jsx)("p",{className:"text-sm font-semibold text-gray-600 dark:text-zinc-400",children:"No results found"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 dark:text-zinc-500 mt-1",children:"Try adjusting your search terms"})]}),!l&&!x&&(0,t.jsxs)("div",{className:"p-10 text-center",children:[(0,t.jsx)("div",{className:"w-14 h-14 roun
9ded-full bg-gradient-to-br from-pink-50 to-orange-50 dark:from-pink-500/10 dark:to-orange-500/10 flex items-center justify-center mx-auto mb-4",children:(0,t.jsx)(ev.MagnifyingGlassIcon,{className:"w-7 h-7 text-pink-300 dark:text-pink-400"})}),(0,t.jsx)("p",{className:"text-sm font-medium text-gray-600 dark:text-zinc-400",children:"Quick navigation"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 dark:text-zinc-500 mt-1",children:"Search across creators, campaigns, organizations, and deals"}),(0,t.jsxs)("div",{className:"mt-4 flex items-center justify-center gap-2",children:[(0,t.jsxs)("button",{onClick:()=>o("create"),className:"text-[11px] font-bold px-3 py-1.5 rounded-lg flex items-center gap-1.5 transition-all duration-200 hover:shadow-md",style:{background:"linear-gradient(135deg, #F97316, #EC4899)",color:"white",boxShadow:"0 2px 8px rgba(236,72,153,0.25)"},children:[(0,t.jsx)(ej.PlusIcon,{className:"w-3 h-3"}),"New task"]}),(0,t.jsxs)("button",{onClick:()=>o("extract"),className:"text-[11px] font-bold px-3 py-1.5 rounded-lg flex items-center gap-1.5 transition-all duration-200",style:{background:"rgba(99,102,241,0.08)",color:"#6366F1",border:"1px solid rgba(99,102,241,0.18)"},children:[(0,t.jsx)(tt.ClipboardDocumentIcon,{className:"w-3 h-3"}),"Paste notes"]})]})]})]}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-2.5 border-t border-gray-100 dark:border-zinc-800 bg-gray-50/50 dark:bg-zinc-900/50 text-[11px] text-gray-400 dark:text-zinc-500",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"↑"}),(0,t.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"↓"}),"navigate"]}),(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"Enter"}),"open"]})]}),(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)("kbd",{className:"px-1.5 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"ESC"}),"close"]})]})]})})]})}function tf({open:e,onClose:r,pinned:a,sections:n}){return e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:`fixed inset-0 z-[200] transition-opacity duration-150 ${a?"bg-black/40 backdrop-blur-sm":"bg-black/20 backdrop-blur-[2px] pointer-events-none"}`,onClick:a?r:void 0}),(0,t.jsx)("div",{className:"fixed inset-0 z-[201] flex items-center justify-center px-4 pointer-events-none",children:(0,t.jsxs)("div",{className:`w-full max-w-lg bg-white dark:bg-zinc-950 rounded-2xl shadow-2xl border overflow-hidden pointer-events-auto transition-all duration-200 ${a?"border-gray-200 dark:border-zinc-800 scale-100":"border-pink-200/60 scale-[0.98]"}`,children:[(0,t.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-pink-500 to-orange-400"}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100 dark:border-zinc-800",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)("h2",{className:"text-base font-bold text-gray-900 dark:text-zinc-100",children:"Keyboard Shortcuts"}),!a&&(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-pink-50 text-pink-500 border border-pink-100",children:"Release to dismiss"})]}),a&&(0,t.jsx)("button",{onClick:r,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors",children:(0,t.jsx)("svg",{className:"w-4 h-4 text-gray-400 dark:text-zinc-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsx)("div",{className:"px-6 py-4 max-h-[60vh] overflow-y-auto space-y-5",children:n.map(e=>(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center mb-3",children:[(0,t.jsx)("div",{className:"h-3.5 w-0.5 rounded-full bg-gradient-to-b from-pink-500 to-orange-400 mr-2"}),(0,t.jsx)("h3",{className:"text-[11px] font-bold tracking-widest uppercase text-gray-400 dark:text-zinc-500",children:e.title})]}),(0,t.jsx)("div",{className:"space-y-1",children:e.shortcuts.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between py-2 px-3 rounded-lg hover:bg-gray-50 dark:hover:bg-zinc-900 transition-colors",children:[(0,t.jsx)("span",{className:"text-sm text-gray-700 dark:text-zinc-300",children:e.description}),(0,t.jsx)("div",{className:"flex items-center gap-1",children:e.keys.map((r,a)=>(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[a>0&&(0,t.jsx)("span",{className:"text-[10px] text-gray-300 dark:text-zinc-700 mx-0.5",children:e.isMeta?"":"+"}),(0,t.jsx)("kbd",{className:"inline-flex items-center justify-center min-w-[24px] px-1.5 py-1 rounded-md text-[11px] font-semibold text-gray-600 dark:text-zinc-400 bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 shadow-sm",children:r})]},a))})]},e.description))})]},e.title))})]})})]}):null}function tb(){let e=(0,s.useRouter)(),a=(0,s.usePathname)(),{setIsOpen:n,setInsightPanelVisible:i}=(0,eg.useAI)(),o=function(){let[e,t]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{t("u">typeof navigator&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent))},[]),e}(),[l,c]=(0,r.useState)(!1),[d,u]=(0,r.useState)(!1),x=(0,r.useRef)(null),m=(0,r.useRef)(!1),p=(0,r.useRef)(!1),h=(0,r.useRef)(null),g=o?"⌘":"Ctrl",f=(0,r.useMemo)(()=>[{title:"Navigation",shortcuts:[{keys:[g,"K"],description:"Quick search"},{keys:[g,"H"],description:"Go home"},{keys:["G","C"],description:"Go to Campaigns"},{keys:["G","R"],description:"Go to Creators"},{keys:["G","O"],description:"Go to Organizations"},{keys:["G","P"],description:"Go to Posts"},{keys:["G","I"],description:"Go to Campaign Intelligence"},{keys:["G","M"],description:"Go to Messages"}]},{title:"Tasks",shortcuts:[{keys:["T"],description:"New task — tag entities, assign owners & collaborators"}]},{title:"AI & Panels",shortcuts:[{keys:[g,"J"],description:"Open Scout AI"},{keys:[g,"⇧","S"],description:"Toggle voice mode"},{keys:[g,"."],description:"Toggle Scout Analysis panel"},{keys:["G","T"],description:"Toggle Team comms panel"}]},{title:"Chat & comments",shortcuts:[{keys:["↵"],description:"Send (toggle in composer to require Cmd+Enter)"},{keys:[g,"↵"],description:"Send (always)"},{keys:["⇧","↵"],description:"Insert newline"},{keys:["@"],description:"Mention user / creator / campaign / org"},{keys:["Tab"],description:"Jump to next mention category (← / → also)"},{keys:["↑","↓"],description:"Move within mentions / Comms panel rows"}]},{title:"General",shortcuts:[{keys:[g],description:"Hold to show shortcuts",isMeta:!0},{keys:[g,"/"],description:"Pin shortcuts overlay"},{keys:["Esc"],description:"Close any open modal"}]}],[g]),b=l||d,y=(0,r.useCallback)(()=>{c(!1),u(!1),m.current=!1,x.current&&clearTimeout(x.current)},[]),v=(0,r.useCallback)(()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName.toLowerCase();return"input"===t||"textarea"===t||"select"===t||e.isContentEditable},[]),k=(0,r.useCallback)(t=>{"/"===a||""===a?window.dispatchEvent(new CustomEvent("navigate-tab",{detail:t})):e.push(`/?tab=${t}`)},[a,e]);return(0,r.useEffect)(()=>{let t=t=>{let r=t.metaKey||t.ctrlKey;
9if(!v()||r){if(("Meta"===t.key||"Control"===t.key)&&!t.shiftKey&&!t.altKey){m.current=!0,x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{m.current&&!d&&c(!0)},400);return}if(r&&x.current&&(clearTimeout(x.current),m.current=!1,c(!1)),r)switch(t.key){case"/":t.preventDefault(),u(e=>!e),c(!1);return;case"h":t.preventDefault(),e.push("/");return;case".":t.preventDefault(),i(e=>!e);return}if("Escape"===t.key&&d){t.preventDefault(),u(!1);return}if(!v()){if("g"===t.key&&!r){p.current=!0,h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{p.current=!1},800);return}if(p.current&&!r){switch(p.current=!1,h.current&&clearTimeout(h.current),t.key){case"c":t.preventDefault(),k("campaigns");break;case"r":t.preventDefault(),k("creators");break;case"o":t.preventDefault(),k("organizations");break;case"p":t.preventDefault(),k("posts");break;case"h":t.preventDefault(),k("home");break;case"i":t.preventDefault(),k("intelligence");break;case"m":t.preventDefault(),e.push("/dashboard/messages");break;case"t":t.preventDefault(),window.dispatchEvent(new CustomEvent("ss-toggle-team-panel"))}return}if("t"===t.key&&!r&&!t.altKey){t.preventDefault(),window.dispatchEvent(new CustomEvent("ss-open-create-task"));return}}}},r=e=>{("Meta"===e.key||"Control"===e.key)&&(m.current=!1,x.current&&clearTimeout(x.current),c(!1))},a=()=>{m.current=!1,x.current&&clearTimeout(x.current),c(!1)};return window.addEventListener("keydown",t),window.addEventListener("keyup",r),window.addEventListener("blur",a),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",r),window.removeEventListener("blur",a),h.current&&clearTimeout(h.current),x.current&&clearTimeout(x.current)}},[e,a,d,v,k,n,i]),(0,t.jsx)(tf,{open:b,onClose:y,pinned:d,sections:f})}var ty=e.i(633576),tv=e.i(766972),tk=e.i(683512),tw=e.i(833786),tj=e.i(789321);let tN=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function tC({label:e,users:a=[],externals:n=[],teamMembers:s=[],accent:i="#6366F1",emptyHint:o="No one yet",onUsersChange:l,onAddExternal:c,onRemoveExternal:d,icon:u=tk.EyeIcon,description:x,enableTeamPicker:m=!1}){let[p,h]=(0,r.useState)(!1),[g,f]=(0,r.useState)(""),b=(0,r.useRef)(null);(0,r.useEffect)(()=>{function e(e){b.current&&!b.current.contains(e.target)&&h(!1)}return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let y=new Set((a||[]).map(e=>(e._id||e).toString())),v=new Set((n||[]).map(e=>e.email?.toLowerCase())),k=s.filter(e=>e.name?.toLowerCase().includes(g.toLowerCase())||e.email?.toLowerCase().includes(g.toLowerCase())),w=g.trim(),j=tN.test(w)&&!k.some(e=>e.email?.toLowerCase()===w.toLowerCase())&&!v.has(w.toLowerCase());async function N(){j&&(await c?.(w.toLowerCase()),f(""),h(!1))}return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-2.5",children:[(0,t.jsxs)("label",{className:"text-[10px] font-bold text-gray-400 dark:text-zinc-500 uppercase tracking-[0.14em] flex items-center gap-1.5",children:[(0,t.jsx)(u,{className:"w-3 h-3",style:{color:i}}),e,a.length+n.length>0&&(0,t.jsx)("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded-md",style:{background:`${i}15`,color:i},children:a.length+n.length})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[m&&(0,t.jsx)(tj.default,{accent:i,buttonLabel:"Add a team",onResolve:function(e){let t=new Set((a||[]).map(e=>(e._id||e).toString())),r=(e||[]).filter(e=>!t.has((e._id||e).toString()));r.length>0&&l?.([...a,...r])}}),(0,t.jsxs)("div",{ref:b,className:"relative",children:[(0,t.jsxs)("button",{onClick:()=>h(!p),className:"text-[11px] font-semibold px-2 py-1 rounded-lg flex items-center gap-1 transition-all duration-200",style:{background:`${i}10`,border:`1px solid ${i}25`,color:i},children:[(0,t.jsx)(ej.PlusIcon,{className:"w-3 h-3"}),"Add"]}),(0,t.jsx)(eb.AnimatePresence,{children:p&&(0,t.jsxs)(ef.motion.div,{initial:{opacity:0,y:-4,scale:.96},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-4,scale:.96},transition:{duration:.14},className:"absolute z-50 right-0 mt-1.5 rounded-xl py-2 w-72",style:{background:"var(--surface-panel)",backdropFilter:"blur(20px)",boxShadow:"0 12px 40px var(--shadow-ambient-lg), 0 2px 8px var(--border-subtle)",border:"1px solid var(--border-default)"},children:[(0,t.jsx)("div",{className:"px-3 pb-2",children:(0,t.jsx)("input",{autoFocus:!0,t
9ype:"text",placeholder:"Search team or paste email…",value:g,onChange:e=>f(e.target.value),onKeyDown:e=>{"Enter"===e.key&&j&&(e.preventDefault(),N())},className:"w-full text-xs px-3 py-2 rounded-lg focus:outline-none focus:ring-2 transition-all text-gray-900 dark:text-zinc-100 placeholder-gray-400 dark:placeholder-zinc-500",style:{background:"var(--surface-soft)",border:"1px solid var(--border-default)"}})}),(0,t.jsxs)("div",{className:"max-h-56 overflow-y-auto",children:[k.map(e=>{let r=y.has(e._id.toString());return(0,t.jsxs)("button",{onClick:()=>{y.has(e._id.toString())?l?.(a.filter(t=>(t._id||t).toString()!==e._id.toString())):l?.([...a,e]),f("")},className:"w-full px-3 py-2 flex items-center gap-2.5 hover:bg-gray-50/80 dark:hover:bg-zinc-900/80 text-xs",children:[(0,t.jsx)(tw.default,{user:e,size:28}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,t.jsx)("div",{className:"text-gray-700 dark:text-zinc-300 font-medium truncate",children:e.name}),e.email&&(0,t.jsx)("div",{className:"text-[10px] text-gray-400 dark:text-zinc-500 truncate",children:e.email})]}),r&&(0,t.jsx)("div",{className:"w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0",style:{background:"#10B981",boxShadow:"0 0 6px rgba(16,185,129,0.3)"},children:(0,t.jsx)("svg",{className:"w-3 h-3 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]},e._id)}),0===k.length&&!j&&(0,t.jsx)("p",{className:"px-3 py-3 text-xs text-gray-400 dark:text-zinc-500 text-center",children:g?"No team members match":"Start typing to search"})]}),j&&(0,t.jsx)("div",{className:"border-t mt-1 pt-1.5",style:{borderColor:"var(--border-subtle)"},children:(0,t.jsxs)("button",{onClick:N,className:"w-full px-3 py-2 flex items-center gap-2.5 text-xs",style:{background:`linear-gradient(90deg, ${i}10, transparent)`},children:[(0,t.jsx)("div",{className:"w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",style:{background:`linear-gradient(135deg, ${i}, #EC4899)`,boxShadow:`0 2px 6px ${i}30`},children:(0,t.jsx)(tv.EnvelopeIcon,{className:"w-3.5 h-3.5 text-white"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,t.jsxs)("div",{className:"text-gray-800 dark:text-zinc-100 font-bold",children:["Invite external: ",w]}),(0,t.jsx)("div",{className:"text-[10px] text-gray-500 dark:text-zinc-400",children:"They'll be looped in via email"})]}),(0,t.jsx)("span",{className:"text-[9px] font-bold px-1.5 py-0.5 rounded",style:{background:`${i}20`,color:i},children:"EXT"})]})})]})})]})]})]}),x&&(0,t.jsx)("p",{className:"text-[11px] text-gray-400 dark:text-zinc-500 italic mb-2",children:x}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[a.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-xl pl-1 pr-3 py-1.5 group transition-all duration-200 hover:shadow-sm",style:{background:`${i}08`,border:`1px solid ${i}18`},children:[(0,t.jsx)(tw.default,{user:e,size:28}),(0,t.jsx)("span",{className:"text-xs text-gray-700 dark:text-zinc-300 font-medium truncate max-w-[120px]",children:e.name||e.email||"User"}),(0,t.jsx)("button",{onClick:()=>l?.(a.filter(t=>(t._id||t).toString()!==(e._id||e).toString())),className:"ml-0.5 text-gray-300 dark:text-zinc-700 hover:text-red-400 opacity-0 group-hover:opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",children:(0,t.jsx)(ey.XMarkIcon,{className:"w-3.5 h-3.5"})})]},e._id||e)),n.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-xl pl-1 pr-3 py-1.5 group transition-all duration-200 hover:shadow-sm",style:{background:`linear-gradient(90deg, ${i}10, rgba(245,158,11,0.04))`,border:`1px solid ${i}25`},title:`External \xb7 added by ${e.addedBy?.name||"someone"}`,children:[(0,t.jsx)("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-white shadow-sm",style:{background:`linear-gradient(135deg, ${i}, #EC4899)`},children:(0,t.jsx)(tv.EnvelopeIcon,{className:"w-3.5 h-3.5"})}),(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsx)("span",{className:"text-xs text-gray-800 dark:text-zinc-100 font-semibold leading-tight",children:e.email}),(0,t.jsx)("span",{className:"text-[9px] font-bold uppercase tracking-wider leading-tight",style:{color:i}
9,children:"External"})]}),(0,t.jsx)("button",{onClick:()=>d?.(e.email),className:"ml-1 opacity-0 group-hover:opacity-100 hover:text-red-500 transition-opacity",style:{color:`${i}80`},children:(0,t.jsx)(ey.XMarkIcon,{className:"w-3.5 h-3.5"})})]},e.email)),0===a.length&&0===n.length&&(0,t.jsx)("span",{className:"text-xs text-gray-300 dark:text-zinc-700 italic",children:o})]})]})}function tS(){let{data:e}=(0,n.useSession)(),a=e?.user,[s,i]=(0,r.useState)(!1),[o,l]=(0,r.useState)([]),[c,d]=(0,r.useState)([]),[u,x]=(0,r.useState)([]),[m,p]=(0,r.useState)(null),[h,g]=(0,r.useState)(!1),f=(0,r.useCallback)(()=>{i(!1),d([]),x([])},[]);async function b(e){if(h)return!1;g(!0);try{let t={title:e.title,...m?.id?{board:m.id}:{},group:m?.group||"To Do",assignees:e.assignees||[],...e.assignees?.length?{}:{autoAssignOwnerIfEmpty:!0},...c.length?{collaborators:c.map(e=>e._id)}:{},...u.length?{externalCollaborators:u.map(e=>({email:e.email}))}:{},linkedCreator:e.linkedCreator||null,linkedCampaign:e.linkedCampaign||null,organization:e.organization||null,parentDeal:e.parentDeal||null,...e.isPrivate?{isPrivate:!0}:{},...e.media?.length?{media:e.media}:{},...e.status?{status:e.status,statusColor:e.statusColor}:{},...e.priority?{priority:e.priority}:{},...e.dueDate?{dueDate:e.dueDate}:{}},r=await fetch("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok){let e=await r.json().catch(()=>({}));throw Error(e.error||"Failed to create task")}let a=await r.json(),n=a.task||a;return n?._id&&window.dispatchEvent(new CustomEvent("ss-task-event",{detail:{taskId:n._id,type:"task_assigned",kind:"create"}})),eh.default.success("Task created"),f(),!0}catch(e){return eh.default.error(e.message||"Failed to create task"),!1}finally{g(!1)}}return((0,r.useEffect)(()=>{let e=()=>i(!0);return window.addEventListener("ss-open-create-task",e),()=>window.removeEventListener("ss-open-create-task",e)},[]),(0,r.useEffect)(()=>{if(!s)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),f())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[s,f]),(0,r.useEffect)(()=>{if(!s||o.length>0)return;let e=!1;return fetch("/api/agency-team").then(e=>e.ok?e.json():{users:[]}).then(t=>{e||l(t.users||t.team||[])}).catch(()=>{}),()=>{e=!0}},[s,o.length]),(0,r.useEffect)(()=>{if(!s||!a?._id)return;let e=!1,t=null;try{t=localStorage.getItem(`task-board:lastActive:${a._id}`)}catch{t=null}if(t)return fetch(`/api/task-boards/${t}`).then(e=>e.ok?e.json():null).then(t=>{!e&&t?.board&&p({id:t.board._id,group:t.board.groups?.[0]?.name||"Default"})}).catch(()=>{}),()=>{e=!0}},[s,a?._id]),s)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-[100] transition-opacity duration-200",onClick:f}),(0,t.jsx)("div",{className:"fixed inset-0 z-[101] flex items-start justify-center pt-[12vh] px-4 pointer-events-none",children:(0,t.jsxs)("div",{className:"w-full max-w-2xl bg-white dark:bg-zinc-950 rounded-2xl shadow-2xl border border-gray-200 dark:border-zinc-800 overflow-hidden pointer-events-auto animate-in fade-in slide-in-from-top-4 duration-200",role:"dialog","aria-modal":"true","aria-label":"New task",children:[(0,t.jsx)("div",{className:"h-0.5 w-full bg-gradient-to-r from-pink-500 to-orange-400"}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-4 pt-3 pb-2.5 border-b border-gray-100 dark:border-zinc-800",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(249,115,22,0.08)"},children:(0,t.jsx)(ej.PlusIcon,{className:"w-4 h-4",style:{color:"#F97316"}})}),(0,t.jsx)("h2",{className:"text-sm font-bold text-gray-900 dark:text-zinc-100 tracking-tight",children:"New task"}),(0,t.jsxs)("span",{className:"ml-auto flex items-center gap-2",children:[(0,t.jsx)("kbd",{className:"hidden sm:inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium text-gray-400 dark:text-zinc-500 bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800",children:"T"}),(0,t.jsx)("button",{onClick:f,className:"p-1.5 rounded-full hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors","aria-label":"Close",children:(0,t.jsx)(ey.XMarkIcon,{className:"w-4 h-4 text-gray-400 dark:text-zinc-500"})})]})]}),(0,t.jsxs)("div",{className:"p-2 max-h-[65vh] overflow-y-auto",children:[(0,t.jsx)(tn.default,{teamMembers:o,placeholder:"What needs to be done? Type @ to tag, / for actions",onSubmit:b,onCancel:f,groupColor:"#F97316",portalPopovers:!0}),(0,t.jsxs)("div",{className:"px-5 pt-3 pb-4",children:[(0,t.jsx)("div",{className:"h-px bg-gradient-to-r from-transparent via-gray-200 dark:via-zinc-800 to-transparent mb-3"}),(0,t.jsx)(tC,{label:"Collaborators",users:c,externals:u,teamMembers:o,accent:"#8B5CF6",emptyHint:"No one looped in yet",icon:ty.UserGroupIcon,enableTeamPicker:!0,onUsersChange:d,onAddExternal:e=>x(t=>t.some(t=>t.email===e)?t:[...t,{email:e}]),onRemoveExternal:e=>x(t=>t.filter(t=>t.email!==e))})]}),(0,t.jsxs)("div",{className:"px-5 pb-3 text-[10px] text-gray-400 dark:text-zinc-500 leading-relaxed",children:["Tip: tag a creator, campaign or organization with"," ",(0,t.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"@"})," ","(owners too), set priority or due date with"," ",(0,t.jsx)("kbd",{className:"px-1 py-0.5 rounded bg-gray-100 dark:bg-zinc-900 border border-gray-200 dark:border-zinc-800 font-medium",children:"/"}),". Unassigned tasks land in your queue."]})]})]})})]}):null}let tz=null;function tE(e,{freq:t,dur:r=.09,delay:a=0,gain:n=.16,type:s="triangle"}){let i=e.createOscillator(),o=e.createGain();i.type=s,i.frequency.value=t;let l=e.currentTime+a;o.gain.setValueAtTime(1e-4,l),o.gain.exponentialRampToValueAtTime(n,l+.008),o.gain.exponentialRampToValueAtTime(1e-4,l+r),i.connect(o),o.connect(e.destination),i.start(l),i.stop(l+r+.02)}function tT(){let{data:e,status:a}
9=(0,n.useSession)(),i=e?.user?._id,o=(0,s.useRouter)(),l=(0,s.usePathname)()||"",{open:c,openIds:d}=(0,eN.useConversation)(),u=(0,r.useRef)(null),x=(0,r.useRef)(c),m=(0,r.useRef)(d),p=(0,r.useRef)(l),h=(0,r.useRef)(o);return(0,r.useEffect)(()=>{x.current=c},[c]),(0,r.useEffect)(()=>{m.current=d},[d]),(0,r.useEffect)(()=>{p.current=l},[l]),(0,r.useEffect)(()=>{h.current=o},[o]),(0,r.useEffect)(()=>{if("authenticated"!==a||!i||!("EventSource"in window))return;let e=e=>{let t={};try{t=JSON.parse(e.data||"{}")}catch{}eh.default.error(t.reason||"Your session was ended. Redirecting to login…",{duration:4e3});try{u.current?.close()}catch{}setTimeout(()=>{(0,n.signOut)({callbackUrl:"/login"})},600)},r={task:"ss-task-event",video_version:"ss-video-event",casting_creator:"ss-casting-event",conversation:"ss-conversation-event"};function s(e,t){let a={};try{a=JSON.parse(t.data||"{}")}catch{}let n=r[a?.parent?.type];n&&window.dispatchEvent(new CustomEvent(n,{detail:{...a,kind:e}}))}let o=e=>{s("created",e);let r={};try{r=JSON.parse(e.data||"{}")}catch{return}let a=r?.parent?.type,n=r?.conversationId,i=p.current.startsWith("/dashboard/messages"),o=!!n&&m.current.includes(n.toString());if(!(i||o)){var l;let e=r.sender?.name||"Someone",s=r.sender?.image,i=(l=r,"conversation"===l?.parent?.type?"group"===l.conversationType?l.conversationName||"Group chat":null:l.surfaceLabel||null);!function({senderName:e,senderImage:r,preview:a,surfaceLabel:n,onClick:s}){eh.default.custom(i=>(0,t.jsxs)("button",{type:"button",onClick:()=>{s?.(),eh.default.dismiss(i.id)},className:"text-left flex items-start gap-3 max-w-[360px] w-full px-3.5 py-3 rounded-2xl shadow-lg",style:{background:"var(--surface-panel)",border:"1px solid var(--border-default)",boxShadow:"0 14px 40px var(--shadow-ambient-xl)",backdropFilter:"blur(20px)",opacity:+!!i.visible,transform:i.visible?"translateY(0)":"translateY(-8px)",transition:"all 220ms cubic-bezier(0.25,0.46,0.45,0.94)"},children:[(0,t.jsx)(eS.default,{name:e,image:r,sizeClass:"w-9 h-9",textClass:"text-[11px]",ringClass:"ring-2 ring-white dark:ring-zinc-950"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,t.jsx)("span",{className:"text-[12.5px] font-bold text-gray-900 dark:text-zinc-100 truncate",children:e}),n&&(0,t.jsxs)("span",{className:"text-[10px] text-gray-400 dark:text-zinc-500 truncate",children:["· ",n]})]}),a&&(0,t.jsx)("p",{className:"text-[12px] text-gray-600 dark:text-zinc-300 mt-0.5 line-clamp-2",children:a})]})]}),{duration:4500})}({senderName:e,senderImage:s,preview:r.preview,surfaceLabel:i,onClick:()=>{"conversation"===a&&n?x.current?.(n.toString()):r.link&&h.current?.push(r.link)}})}!function(){if(!function(){try{let e=window.localStorage.getItem("ss.sounds.enabled");return null===e||"1"===e}catch{return!0}}())return;let e=function(){if(tz)return tz;let e=window.AudioContext||window.webkitAudioContext||null;return e?tz=new e:null}();e&&("suspended"===e.state&&e.resume?.().catch(()=>{}),tE(e,{freq:659.25,dur:.09,delay:0,gain:.14}),tE(e,{freq:830.61,dur:.12,delay:.06,gain:.16}))}()},l=e=>s("deleted",e),c=e=>s("edited",e),d=e=>{let t={};try{t=JSON.parse(e.data||"{}")}catch{}window.dispatchEvent(new CustomEvent("ss-typing-event",{detail:t}))},g=e=>{let t={};try{t=JSON.parse(e.data||"{}")}catch{}window.dispatchEvent(new CustomEvent("ss-conversation-event",{detail:{...t,kind:"read"}}))},f=e=>{let t={};try{t=JSON.parse(e.data||"{}")}catch{}window.dispatchEvent(new CustomEvent("ss-status-changed",{detail:t}))};function b(){if(u.current)return;let t=new EventSource("/api/presence/stream");u.current=t,t.addEventListener("kick",e),t.addEventListener("message_event",o),t.addEventListener("message_deleted",l),t.addEventListener("message_edited",c),t.addEventListener("typing_event",d),t.addEventListener("conversation_read",g),t.addEventListener("status_changed",f),t.addEventListener("error",()=>{})}function y(){let t=u.current;if(t){try{t.removeEventListener("kick",e),t.removeEventListener("message_event",o),t.removeEventListener("message_deleted",l),t.removeEventListener("message_edited",c),t.removeEventListener("typing_event",d),t.removeEventListener("conversation_read",g),t.removeEventListener("status_changed",f),t.close()}catch{}u.current=null}}
9function v(){return"u"<typeof document||"hidden"!==document.visibilityState}function k(){v()?b():y()}return v()&&b(),document.addEventListener("visibilitychange",k),()=>{document.removeEventListener("visibilitychange",k),y()}},[a,i]),null}function tM(e){return e?"/"===e||""===e?"home":e.startsWith("/dashboard/admin")?"admin":e.startsWith("/dashboard/messages")?"messages":e.startsWith("/dashboard/casting")?"casting":e.startsWith("/dashboard/management")?"management":e.startsWith("/dashboard/user/campaign")?"campaigns":e.startsWith("/dashboard/user/creator")?"creators":e.startsWith("/dashboard/user/post")?"posts":e.startsWith("/dashboard/user/organization")?"organizations":e.startsWith("/dashboard/user/task")||e.startsWith("/dashboard/user/tasks")?"tasks":e.startsWith("/dashboard/user/notifications")?"notifications":e.startsWith("/dashboard/user/settings")?"settings":e.startsWith("/dashboard/user/import")?"imports":e.startsWith("/dashboard/user/spotlight")?"spotlight":e.startsWith("/dashboard/user/creatorTool")?"creator-tool":e.startsWith("/dashboard/user")?"dashboard":"other":"other"}let tL="/api/activity/events",tI="ss_interaction_session",t_=[{re:/\/dashboard\/user\/campaign\/([^/?#]+)/,type:"campaign"},{re:/\/dashboard\/user\/creator\/([^/?#]+)/,type:"creator"},{re:/\/dashboard\/user\/post\/([^/?#]+)/,type:"post"},{re:/\/dashboard\/user\/organization\/([^/?#]+)/,type:"organization"},{re:/\/dashboard\/user\/contracts\/([^/?#]+)/,type:"contract"},{re:/\/dashboard\/user\/task[s]?\/([^/?#]+)/,type:"task"},{re:/\/dashboard\/admin\/heatmap\/user\/([^/?#]+)/,type:"user"}];function tR(e){if(!e)return;let t=String(e).trim().replace(/\s+/g," ");if(t)return t.length>80?t.slice(0,80):t}function tA(e,t){if(window.sessionStorage)try{window.sessionStorage.setItem(tI,JSON.stringify({sessionId:e,entrySurface:t,lastSeenAt:Date.now()}))}catch{}}function tD(){let{status:e}=(0,n.useSession)(),t=(0,s.usePathname)()||"",a=(0,r.useRef)(tM(t)),i=(0,r.useRef)(t),o=(0,r.useRef)([]),l=(0,r.useRef)(Date.now()),c=(0,r.useRef)(Date.now()),d=(0,r.useRef)(0),u=(0,r.useRef)(0),x=(0,r.useRef)(0),m=(0,r.useRef)(!1),p=(0,r.useRef)(null),h=(0,r.useRef)(null),g=(0,r.useRef)({key:null,at:0}),f=(0,r.useRef)(null);(0,r.useEffect)(()=>{a.current=tM(t),i.current=t},[t]),(0,r.useEffect)(()=>{if("authenticated"!==e)return;let r=function(){if("u"<typeof navigator||!navigator.userAgent)return"desktop";let e=navigator.userAgent;return/iPad|Tablet/i.test(e)||/Android/i.test(e)&&!/Mobile/i.test(e)||/Macintosh/i.test(e)&&(navigator.maxTouchPoints||0)>1?"tablet":/Mobi|Android|iPhone|iPod/i.test(e)?"mobile":"desktop"}(),n=tM(t),{sessionId:s,entrySurface:b}=function(){let e={sessionId:"u">typeof crypto&&crypto.randomUUID?crypto.randomUUID():`sess_${Date.now()}_${Math.random().toString(36).slice(2)}`,entrySurface:null};if(!window.sessionStorage)return e;try{let e=window.sessionStorage.getItem(tI);if(e){let t=JSON.parse(e),r=Date.now()-(t.lastSeenAt||0);if(t.sessionId&&r>=0&&r<18e5)return{sessionId:t.sessionId,entrySurface:t.entrySurface||null}}}catch{}return e}();function y(e){let t=new Date,{entityType:r,entityId:n}=function(e){if(!e)return{entityType:void 0,entityId:void 0};for(let{re:t,type:r}of t_){let a=e.match(t);if(a&&a[1])return{entityType:r,entityId:a[1]}}return{entityType:void 0,entityId:void 0}}(i.current),s={type:e.type,surface:e.surface||a.current,path:e.path||i.current,label:e.label,entityType:void 0!==e.entityType?e.entityType:r,entityId:void 0!==e.entityId?e.entityId:n,ts:t.toISOString(),localHour:t.getHours(),localDow:t.getDay(),metadata:e.metadata};return o.current.push(s),o.current.length>300&&o.current.splice(0,o.current.length-300),s}function v(){let e=Date.now(),t=e-l.current;if(l.current=e,!(t<=0)){if(m.current){x.current+=t;return}e-c.current>=6e4?x.current+=t:u.current+=t}}function k(){let e=Date.now();e-d.current<250||(d.current=e,c.current=e)}p.current=s,h.current=b||n,tA(s,h.current),m.current="u">typeof document&&document.hidden,l.current=Date.now(),c.current=Date.now(),u.current=0,x.current=0,f.current=y,y({type:"page_view"});let w={passive:!0};function j(e){k();let t=function(e){if(!e||"function"!=typeof e.closest)return null;let t=e.closest("[data-track]");if(t){let e=t.getAttribute("data-track");if(e)return tR(e)}let r=e.closest("button, a, [role='button'], [role='menuitem'], [role='tab'], input[type='submit'], input[type='button']");if(!r)return null;let a=r.getAttribute("aria-label");if(a)return tR(a);let n=(r.textContent||"").trim().replace(/\s+/g," ");
9if(n)return tR(n);let s=r.getAttribute("role")||r.tagName;return s?tR(s.toLowerCase()):null}(e.target);if(!t)return;let r=`${i.current}::${t}`,a=Date.now();g.current.key===r&&a-g.current.at<400||(g.current={key:r,at:a},y({type:"click",label:t}))}function N(e){v();let t=o.current.length>0,n=u.current>0||x.current>0;if(!t&&!n)return;let s=o.current.splice(0,100),i=u.current,l=x.current;u.current=0,x.current=0,tA(p.current,h.current);let c=JSON.stringify({sessionId:p.current,events:s,session:{activeMs:i,idleMs:l,entrySurface:h.current,exitSurface:a.current,device:r,reason:e}});if(("hidden"===e||"pagehide"===e)&&"u">typeof navigator&&navigator.sendBeacon)try{let e=new Blob([c],{type:"application/json"});if(navigator.sendBeacon(tL,e))return}catch{}fetch(tL,{method:"POST",headers:{"Content-Type":"application/json"},body:c,keepalive:!0}).catch(()=>{})}document.addEventListener("mousemove",k,w),document.addEventListener("scroll",k,{passive:!0,capture:!0}),document.addEventListener("keydown",k,w),document.addEventListener("click",j,w);let C=setInterval(()=>N("interval"),3e4);function S(){v(),m.current=document.hidden,l.current=Date.now(),document.hidden?N("hidden"):c.current=Date.now()-6e4-1e3}function z(){N("pagehide")}return document.addEventListener("visibilitychange",S),window.addEventListener("pagehide",z),()=>{clearInterval(C),document.removeEventListener("mousemove",k,w),document.removeEventListener("scroll",k,{capture:!0}),document.removeEventListener("keydown",k,w),document.removeEventListener("click",j,w),document.removeEventListener("visibilitychange",S),window.removeEventListener("pagehide",z),N("unmount"),f.current=null}},[e]);let b=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{if("authenticated"===e&&f.current){if(!b.current){b.current=!0;return}f.current({type:"page_view"})}},[t,e]),null}function t$(){return(0,r.useEffect)(()=>{if(!window.fetch)return;let e=window.fetch.bind(window);return window.fetch=function(t,r){let a;if(!function(e,t){try{let r,a=(t?.method||(e instanceof Request?e.method:"GET")).toUpperCase();if("GET"===a||"HEAD"===a||"OPTIONS"===a)return!1;if((r="string"==typeof e?e:e instanceof URL?e.href:e instanceof Request?e.url:String(e)).startsWith("/")&&!r.startsWith("//"))return!0;return new URL(r,window.location.href).origin===window.location.origin}catch{return!1}}(t,r))return e(t,r);let n=new Date,s=String(n.getHours()),i=String(n.getDay());return(a=r?.headers instanceof Headers||r?.headers?new Headers(r.headers):t instanceof Request&&t.headers?new Headers(t.headers):new Headers).has("x-local-hour")||a.set("x-local-hour",s),a.has("x-local-dow")||a.set("x-local-dow",i),e(t,{...r,headers:a})},()=>{window.fetch=e}},[]),null}let tP=/^\(\d+\)\s+/;function tW(e){return(e||"").replace(tP,"")}function tB(){let{unreadCount:e}=E(),{data:t,status:a}=(0,n.useSession)(),s=t?.user?._id?.toString(),[i,o]=(0,r.useState)([]);(0,r.useEffect)(()=>{if("authenticated"!==a)return;let e=!1;async function t(){try{let t=await fetch("/api/conversations");if(!t.ok)return;let r=await t.json();e||o(r.conversations||[])}catch{}}function r(){t()}return t(),window.addEventListener("ss-conversation-event",r),()=>{e=!0,window.removeEventListener("ss-conversation-event",r)}},[a]);let l=Math.max(e,(0,r.useMemo)(()=>s?i.filter(e=>(0,eT.isConversationUnread)(e,s)).length:0,[i,s])),c=(0,r.useRef)(0),d=(0,r.useRef)(null),u=(0,r.useRef)(!1),x=(0,r.useRef)(null);return(0,r.useEffect)(()=>{function e(e){let t=e.detail||{};if(t.kind&&"created"!==t.kind)return;let r=t.sender?.name;if(!r)return;let a=function(e){if(!e||"string"!=typeof e)return"";let t=e.trim();return t?t.split(/\s+/)[0]:""}(r)||r,n="group"===t.conversationType,s=(t.conversationName||"").trim();x.current=n&&s?`${a} in ${s}`:a}return window.addEventListener("ss-conversation-event",e),window.addEventListener("ss-task-event",e),()=>{window.removeEventListener("ss-conversation-event",e),window.removeEventListener("ss-task-event",e)}},[]),(0,r.useEffect)(()=>{if("u"<typeof document)return;function e(){let e=tW(document.title);document.title=l>0?`(${l}) ${e}`:e}function t(){d.current&&(clearInterval(d.current),d.current=null),u.current=!1}let r=c.current;c.current=l,e();let a="hidden"===document.visibilityState;function n(){"visible"===document.visibilityState&&(t(),e())}return l>r&&l>0&&a?d.current||(d.current=setInterval(()=>{u.current=!u.current;let e=tW(document.title),t=x.current,r=t?`💬 ${t}`:"💬 New message";document.title=u.current?r:`(${l}) ${e}`},1e3)):0===l&&(t(),x.current=null),document.addEventListener("visibilitychange",n),(
9)=>{document.removeEventListener("visibilitychange",n),t()}},[l]),(0,r.useEffect)(()=>()=>{"u">typeof document&&(document.title=tW(document.title))},[]),null}var tF=e.i(750534);function tO(){let e=(0,s.usePathname)(),t=(0,s.useSearchParams)(),a=t?.toString()||"";return(0,r.useEffect)(()=>{e&&(0,tF.recordLocation)(a?`${e}?${a}`:e)},[e,a]),null}function tq(){return(0,t.jsx)(r.Suspense,{fallback:null,children:(0,t.jsx)(tO,{})})}var tU=e.i(694214);let tH=r.forwardRef(function({title:e,titleId:t,...a},n){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},a),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))}),tG=r.forwardRef(function({title:e,titleId:t,...a},n){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},a),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))});var tK=e.i(349967);let tV={success:{color:"#10b981",icon:tU.CheckCircleIcon},error:{color:"#ef4444",icon:tH},loading:{color:"#ec4899",icon:null},blank:{color:"#6366f1",icon:tG}};function tJ({t:e}){let r=tV[e.type]||tV.blank,a=r.icon,n=r.color,s=e.visible?"opacity-100 translate-y-0 scale-100":"opacity-0 -translate-y-2 scale-95";return(0,t.jsxs)("div",{className:"relative pointer-events-auto",style:{width:360,maxWidth:"calc(100vw - 24px)"},children:[(0,t.jsx)("div",{"aria-hidden":"true",className:"absolute -inset-3 rounded-2xl blur-2xl pointer-events-none toast-halo",style:{background:`radial-gradient(ellipse at center, ${n}55, ${n}15 45%, transparent 70%)`}}),(0,t.jsxs)("div",{className:`toast-shimmer relative overflow-hidden rounded-xl transition-all duration-300 ease-out ${s}`,style:{background:"var(--surface-panel)",backdropFilter:"blur(28px)",WebkitBackdropFilter:"blur(28px)",border:"1px solid var(--border-default)",boxShadow:`inset 0 1px 0 var(--panel-65), inset 0 -1px 0 var(--shadow-ambient-sm), 0 1px 2px var(--shadow-ambient-sm), 0 18px 40px -10px rgba(0,0,0,0.25), 0 8px 24px -8px ${n}40`},children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"absolute left-0 top-0 bottom-0 w-[3px]",style:{background:`linear-gradient(180deg, ${n}, ${n}AA)`}}),(0,t.jsx)("span",{"aria-hidden":"true",className:"absolute left-0 right-0 top-0 h-[1px] pointer-events-none",style:{background:"linear-gradient(90deg, transparent, var(--panel-65), transparent)"}}),(0,t.jsxs)("div",{className:"relative flex items-start gap-3 px-4 py-3 pl-5",children:["loading"===e.type?(0,t.jsx)("span",{className:"mt-0.5 w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0",style:{background:`${n}1a`},children:(0,t.jsx)("span",{className:"w-3.5 h-3.5 rounded-full border-2 border-t-transparent animate-spin",style:{borderColor:n,borderTopColor:"transparent"}})}):a?(0,t.jsx)("span",{className:"mt-0.5 w-5 h-5 rounded-full flex items-center justify-center flex-shrink-0",style:{background:`${n}1a`,boxShadow:`0 0 0 1px ${n}25 inset`},children:(0,t.jsx)(a,{className:"w-3.5 h-3.5",style:{color:n}})}):null,(0,t.jsx)("div",{className:"flex-1 min-w-0 text-[13px] font-medium leading-snug text-gray-900 dark:text-zinc-100 pt-0.5",children:(0,eh.resolveValue)(e.message,e)}),(0,t.jsx)("button",{type:"button",onClick:()=>eh.toast.dismiss(e.id),className:"mt-0.5 -mr-1 w-5 h-5 flex items-center justify-center rounded-md text-gray-400 dark:text-zinc-500 hover:text-gray-700 dark:hover:text-zinc-200 hover:bg-gray-100 dark:hover:bg-zinc-900 transition-colors flex-shrink-0","aria-label":"Dismiss",children:(0,t.jsx)(tK.XMarkIcon,{className:"w-3.5 h-3.5"})})]})]})]})}e.s(["default",0,function({children:e}){return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(n.SessionProvider,{children:(0,t.jsx)(G.ThemeProvider,{children:(0,t.jsx)(eg.AIProvider,{children:(0,t.jsxs)(eN.ConversationProvider,{children:[(0,t.jsx)(eh.Toaster,{position:"top-right",gutter:12,containerStyle:{to
9p:80,right:20},toastOptions:{duration:3500},children:e=>(0,t.jsx)(tJ,{t:e})}),(0,t.jsx)(ep,{}),(0,t.jsx)(tT,{}),(0,t.jsx)(tD,{}),(0,t.jsx)(t$,{}),(0,t.jsx)(tB,{}),(0,t.jsx)(tq,{}),(0,t.jsxs)("div",{className:"relative",style:{zIndex:1,isolation:"isolate"},children:[(0,t.jsx)(Z,{}),e]}),(0,t.jsx)(te,{}),(0,t.jsx)(tg,{}),(0,t.jsx)(tS,{}),(0,t.jsx)(tb,{}),(0,t.jsx)(eJ.default,{})]})})})})})}],961512)}]);

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.