1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,523147,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(2866);let s={compact:"formatNumberShort",currency:"formatCurrency",number:"toLocaleString",date:"formatDate",percent:"appendPercentSign"};var n=e.i(341546);let l={formatNumberShort:n.formatNumberShort,formatCurrency:n.formatCurrency,formatDate:n.formatDate,toLocaleString:e=>Number(e).toLocaleString(),appendPercentSign:function(e){let t=Number(e);return Number.isFinite(t)?`${t.toFixed(2).replace(/\.?0+$/,"")}%`:"â"}};function i(e,t){if(null==e||"number"==typeof e&&!Number.isFinite(e))return"â";let a=l[s[t]||s.number]||l.toLocaleString;try{return a(e)}catch{return String(e)}}let o={pink:"#ec4899",blue:"#3b82f6",green:"#10b981",emerald:"#10b981",purple:"#8b5cf6",violet:"#8b5cf6",orange:"#f97316",amber:"#f59e0b",red:"#ef4444",indigo:"#6366f1",teal:"#14b8a6",cyan:"#06b6d4"},c=["#3b82f6","#ec4899","#10b981","#f59e0b","#8b5cf6","#06b6d4","#f97316","#6366f1"];function d(e,t=0){return o[String(e||"").toLowerCase()]||c[t%c.length]}let u={"--text-primary":"#f4f4f5","--text-secondary":"#e4e4e7","--text-tertiary":"#c4c4cd","--text-label":"#a1a1aa","--border-subtle":"rgba(255,255,255,0.09)","--border-default":"rgba(255,255,255,0.14)","--surface-panel":"rgba(24,24,29,0.97)","--surface-softer":"rgba(255,255,255,0.05)","--surface-frosted":"rgba(255,255,255,0.06)"};function p({citations:e,source:r}){let[s,n]=(0,a.useState)(!1),l=Array.isArray(e)?e.filter(Boolean):[];return 0!==l.length||r?(0,t.jsxs)("div",{className:"mt-2 pt-2",style:{borderTop:"1px solid var(--tint-softer)"},children:[(0,t.jsxs)("button",{type:"button",onClick:()=>n(e=>!e),className:"flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.1em] transition-opacity",style:{color:"var(--scout-text-soft)",opacity:s?1:.75},children:[(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-2.5 h-2.5 flex-shrink-0",style:{transform:s?"rotate(90deg)":"none",transition:"transform 0.15s"},children:(0,t.jsx)("polyline",{points:"9 18 15 12 9 6"})}),l.length>0?`Sources \xb7 ${l.length}`:"How was this calculated?"]}),s&&(0,t.jsxs)("div",{className:"mt-2 flex flex-col gap-1.5",children:[r?.tool&&(0,t.jsxs)("p",{className:"text-[10px]",style:{color:"var(--scout-text-soft)"},children:["Computed by ",(0,t.jsx)("span",{style:{fontWeight:600},children:r.tool}),r.note?` â ${r.note}`:""]}),l.map((e,a)=>{let r,s=e.label||e.metric||e.sourceType||"source",n=null!=e.value?i(e.value,"er"===(r=String(e.unit||e.metric||"").toLowerCase())||"ctr"===r||"vvr"===r||"%"===r||r.includes("percent")?"percent":r.includes("cost")||r.includes("cpv")||r.includes("budget")||r.includes("$")?"currency":"compact"):null,l=(0,t.jsxs)("span",{className:"flex items-center gap-1.5 min-w-0",children:[(0,t.jsx)("span",{className:"w-1 h-1 rounded-full flex-shrink-0",style:{background:"rgba(236,72,153,0.8)"}}),(0,t.jsx)("span",{className:"truncate",style:{color:"var(--scout-text-soft)"},title:s,children:s}),null!=n&&(0,t.jsxs)("span",{className:"ml-auto tabular-nums font-semibold flex-shrink-0",style:{color:"var(--scout-text-strong)"},children:[n,e.unit&&!["er","ctr","vvr","%","views","engagements"].includes(String(e.unit||"").toLowerCase())?` ${e.unit}`:""]})]});return e.dashboardUrl?(0,t.jsx)("a",{href:e.dashboardUrl,target:e.dashboardUrl.startsWith("http")?"_blank":"_self",rel:"noopener noreferrer",className:"text-[11px] no-underline rounded-md px-2 py-1 transition-colors",style:{background:"var(--tint-softer)"},onMouseEnter:e=>e.currentTarget.style.background="rgba(236,72,153,0.12)",onMouseLeave:e=>e.currentTarget.style.background="var(--tint-softer)",children:l},a):(0,t.jsx)("div",{className:"text-[11px] px-2 py-1",children:l},a)})]})]}):null}function h({title:e,subtitle:a,citations:r,source:s,children:n}){return(0,t.jsxs)("div",{className:"mt-2.5 rounded-2xl overflow-hidden",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-soft)",padding:"12px",...u},children:[(e||a)&&(0,t.jsxs)("div",{className:"mb-2.5 min-w-0",children:[e&&(0,t.jsx)("p",{className:"text-[11px] font-bold uppercase tracking-[0.1em] leading-tight truncate",style:{color:"var(--scout-text-strong)"},title:e,children:e}),a&&(0,t.jsx)("p",{className:"text-[10px] mt-0.5 truncate",style:{color:"var(--scout-text-soft)"},children:a})]}),n,(0,t.jsx)(p,{citations:r,source:s})]})}function f({spec:e}){let a=e.bars.map((t,a)=>({label:t.label,value:t.value,display:i(t.value,e.valueFormat),color:d(t.color,a),href:t.href}));return(0,t.jsx)(h,{title:e.title,subtitle:e.subtitle,citations:e.citations,source:e.source,children:(0,t.jsx)(r.RankedBars,{bars:a})})}function x({spec:e}){let a=e.series.map((e,t)=>({name:e.name,color:d(e.color,t),points:e.points}));return(0,t.jsx)(h,{title:e.title,subtitle:e.subtitle,citations:e.citations,source:e.source,children:(0,t.jsx)(r.MultiLineChart,{series:a,formatTick:t=>i(t,e.yFormat),height:190})})}function m({spec:e}){let a=e.stats.map((e,t)=>({label:e.label,display:i(e.value,e.format),unit:e.unit,accent:d(null,t)}));return(0,t.jsx)(h,{title:e.title,citations:e.citations,source:e.source,children:(0,t.jsx)(r.StatTiles,{stats:a})})}function g({spec:e}){let a=e.columns.map(e=>{let t;return{key:e.key,label:e.label,numeric:"compact"===(t=e.format)||"percent"===t||"currency"===t||"number"===t}}),s=e.rows.map(t=>{let a={};for(let r of e.columns){let e=t[r.key];
1a[r.key]=r.format?i(e,r.format):null==e?"":String(e)}return a});return(0,t.jsx)(h,{title:e.title,citations:e.citations,source:e.source,children:(0,t.jsx)(r.DataTable,{columns:a,rows:s})})}function b({spec:e}){let a=e.creators.map(e=>({name:e.name,image:e.image,handle:e.handle,platform:e.platform,href:e.href,metrics:Array.isArray(e.metrics)?e.metrics.map(e=>({label:e.label,display:i(e.value,e.format)})):[]}));return(0,t.jsx)(h,{title:e.title,citations:e.citations,source:e.source,children:(0,t.jsx)(r.CreatorCards,{creators:a})})}e.s(["default",0,function({spec:e}){if(!e||"object"!=typeof e)return null;try{switch(e.kind){case"bar":return Array.isArray(e.bars)&&e.bars.length?(0,t.jsx)(f,{spec:e}):null;case"line":return Array.isArray(e.series)&&e.series.length?(0,t.jsx)(x,{spec:e}):null;case"stat":return Array.isArray(e.stats)&&e.stats.length?(0,t.jsx)(m,{spec:e}):null;case"table":return Array.isArray(e.columns)&&Array.isArray(e.rows)&&e.rows.length?(0,t.jsx)(g,{spec:e}):null;case"creators":return Array.isArray(e.creators)&&e.creators.length?(0,t.jsx)(b,{spec:e}):null;default:return null}}catch{return null}}],523147)},249802,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(174080),s=e.i(341546),n=e.i(372287),l=e.i(705766);let i=a.forwardRef(function({title:e,titleId:t,...r},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z"}))}),o=a.forwardRef(function({title:e,titleId:t,...r},s){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54"}))}),c=()=>(0,t.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"w-2.5 h-2.5 flex-shrink-0",children:(0,t.jsx)("polyline",{points:"9 18 15 12 9 6"})}),d={campaign:{bg:"linear-gradient(135deg,#ec4899,#f97316)",shadow:"rgba(236,72,153,0.35)"},creator:{bg:"linear-gradient(135deg,#8b5cf6,#06b6d4)",shadow:"rgba(139,92,246,0.35)"},organization:{bg:"linear-gradient(135deg,#10b981,#06b6d4)",shadow:"rgba(16,185,129,0.35)"},post:{bg:"linear-gradient(135deg,#f59e0b,#ef4444)",shadow:"rgba(245,158,11,0.35)"},external:{bg:"rgba(255,255,255,0.12)",shadow:"var(--shadow-ambient-xl)"}},u={tiktok:{bg:"linear-gradient(135deg,#111114,#2d2d34)",shadow:"rgba(0,0,0,0.55)",color:"#fff"},instagram:{bg:"linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888)",shadow:"rgba(204,35,102,0.45)",color:"#fff"},youtube:{bg:"linear-gradient(135deg,#ff0033,#b31217)",shadow:"rgba(255,0,51,0.4)",color:"#fff"},facebook:{bg:"linear-gradient(135deg,#1877f2,#0f5bd7)",shadow:"rgba(24,119,242,0.45)",color:"#fff"},snapchat:{bg:"linear-gradient(135deg,#fffc00,#ffe500)",shadow:"rgba(255,229,0,0.35)",color:"#111"},twitch:{bg:"linear-gradient(135deg,#9146ff,#6c2bd9)",shadow:"rgba(145,70,255,0.45)",color:"#fff"},pinterest:{bg:"linear-gradient(135deg,#e60023,#ad081b)",shadow:"rgba(230,0,35,0.45)",color:"#fff"},x:{bg:"linear-gradient(135deg,#111114,#2d2d34)",shadow:"rgba(0,0,0,0.55)",color:"#fff"}},p=new Map;function h({data:e,platformMeta:a,anchorRect:n,href:l,postId:i}){if("u"<typeof document)return null;let o=e?.post?.thumbnailUrl?300:150,c=Math.max(8,Math.min(n.left+n.width/2-130,window.innerWidth-260-8)),d=n.top>o+16,u=d?n.top-8:n.bottom+8,p=e?.post;return(0,r.createPortal)((0,t.jsxs)("div",{style:{position:"fixed",left:c,top:u,width:260,zIndex:90,transform:d?"translateY(-100%)":"none",borderRadius:16,overflow:"hidden",background:"rgba(10,8,16,0.96)",backdropFilter:"blur(30px)",WebkitBackdropFilter:"blur(30px)",border:"1px solid var(--tint-soft)",boxShadow:"0 20px 60px var(--shadow-ambient-2xl)",pointerEvents:"none",animation:"fadeIn 0.15s ease-out"},children:[p?.thumbnailUrl&&(0,t.jsxs)("div",{style:{position:"relative",height:150,overflow:"hidden"},children:[(0,t.jsx)("img",{src:p.thumbnailUrl,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}),(0,t.jsx)("div",{style:{position:"absolute",inset:0,background:"linear-gradient(180deg,transparent 50%,rgba(10,8,16,0.9) 100%)"}}),a&&(0,t.jsxs)("span",{style:{position:"absolute",top:8,left:8,display:"inline-flex",alignItems:"center",gap:5,padding:"3px 8px",borderRadius:12,background:"rgba(10,8,16,0.75)",backdropFilter:"blur(8px)",fontSize:10,fontWeight:700,color:"#fff"},children:[(0,t.jsx)("img",{src:a.icon,alt:"",style:{width:10,height:10,objectFit:"contain"}}),a.displayName]}),p.monitored&&(0,t.jsx)("span",{style:{position:"absolute",top:8,right:8,padding:"3px 8px",borderRadius:12,background:"rgba(16,185,129,0.25)",border:"1px solid rgba(16,185,129,0.4)",fontSize:9,fontWeight:800,letterSpacing:"0.08em",color:"#34d399"},children:"MONITORED"})]}),(0,t.jsxs)("div",{style:{padding:"10px 12px 12px"},children:[(0,t.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8*!!p?.stats},children:[p?.creatorImage&&(0,t.jsx)("img",{src:p.creatorImage,alt:"",style:{width:22,height:22,borderRadius:9999,objectFit:"cover",flexShrink:0}}),(0,t.jsxs)("div",{style:{minWidth:0},children:[(0,t.jsx)("div",{style:{fontSize:12,fontWeight:700,color:"var(--scout-text-strong)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p?.creatorName||"View post"}
1),p?.campaignName&&(0,t.jsx)("div",{style:{fontSize:10,color:"rgba(255,255,255,0.5)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.campaignName})]})]}),p?.stats&&(0,t.jsx)("div",{style:{display:"flex",gap:10},children:[["Views",p.stats.views],["Likes",p.stats.likes],["Comments",p.stats.comments]].map(([e,a])=>(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{style:{fontSize:13,fontWeight:800,color:"var(--scout-text-strong)",lineHeight:1.1},children:(0,s.formatNumberShort)(a)}),(0,t.jsx)("div",{style:{fontSize:8.5,fontWeight:700,letterSpacing:"0.08em",textTransform:"uppercase",color:"rgba(255,255,255,0.45)"},children:e})]},e))}),!p&&(0,t.jsxs)("div",{style:{fontSize:11,color:"rgba(255,255,255,0.55)"},children:["Open on ",a?.displayName||"platform"," â"]}),i&&(0,t.jsx)("div",{style:{marginTop:8,fontSize:10,fontWeight:600,color:"rgba(236,72,153,0.9)"},children:"Click pill to open · post is in Scout"})]})]}),document.body)}function f({text:e,href:r}){e=String(e).replace(/\*+|__/g,"");let s=function(e=""){return e.includes("/campaign/")?"campaign":e.includes("/creator/")?"creator":e.includes("/organization/")?"organization":e.includes("/post/")?"post":"external"}(r),l="external"===s?function(e=""){try{let t=new URL(e).hostname.replace(/^www\./,"");if(t.endsWith("tiktok.com"))return"tiktok";if(t.endsWith("instagram.com"))return"instagram";if(t.endsWith("youtube.com")||"youtu.be"===t)return"youtube";if(t.endsWith("facebook.com")||"fb.watch"===t)return"facebook";if(t.endsWith("snapchat.com"))return"snapchat";if(t.endsWith("twitch.tv"))return"twitch";if(t.endsWith("pinterest.com"))return"pinterest";if("x.com"===t||t.endsWith("twitter.com"))return"x"}catch{}return null}(r):null,i=l?u[l]:d[s],o=l?n.default[l]:null,[x,m]=(0,a.useState)(null),g=(0,a.useRef)(0),b=(0,a.useRef)(null),y=(0,a.useCallback)(()=>{!l||window.matchMedia?.("(hover: hover)").matches&&(g.current=window.setTimeout(async()=>{let e=b.current?.getBoundingClientRect();if(!e)return;let t=p.get(r);if(!t||"pending"===t)if(t)return;else{p.set(r,"pending");try{let e=await fetch(`/api/ai/link-preview?url=${encodeURIComponent(r)}`);t=e.ok?await e.json():{found:!1}}catch{t={found:!1}}p.set(r,t)}g.current&&m({data:t,anchorRect:e})},220))},[r,l]),v=(0,a.useCallback)(()=>{g.current&&(clearTimeout(g.current),g.current=0),m(null)},[]);return(0,a.useEffect)(()=>v,[v]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("a",{href:r,ref:b,target:r.startsWith("http")?"_blank":"_self",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 align-middle mx-0.5 my-0.5 active:scale-95 no-underline",style:{padding:"3px 9px 3px 5px",borderRadius:20,background:i.bg,boxShadow:`0 2px 8px ${i.shadow}, inset 0 1px 0 var(--tint-soft)`,color:i.color||"#fff",fontSize:12,fontWeight:600,textDecoration:"none",whiteSpace:"nowrap",maxWidth:220,overflow:"hidden",textOverflow:"ellipsis",transition:"opacity 0.15s, transform 0.15s",verticalAlign:"middle"},title:o?`Open on ${o.displayName}`:void 0,onMouseEnter:e=>{e.currentTarget.style.opacity="0.82",e.currentTarget.style.transform="translateY(-1px)",y()},onMouseLeave:e=>{e.currentTarget.style.opacity="1",e.currentTarget.style.transform="translateY(0)",v()},children:[o&&(0,t.jsx)("span",{style:{width:16,height:16,borderRadius:9999,background:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,boxShadow:"0 1px 2px rgba(0,0,0,0.25)"},children:(0,t.jsx)("img",{src:o.icon,alt:o.displayName,style:{width:10,height:10,objectFit:"contain"}})}),(0,t.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:e}),(0,t.jsx)(c,{})]}),x&&(0,t.jsx)(h,{data:x.data,platformMeta:o,anchorRect:x.anchorRect,href:r,postId:x.data?.post?._id||null})]})}function x(e,a){e=e.replace(/!\[([^\]]*)\]\([^)]*\)/g,(e,t)=>t||"");let r=[],s=/\*\*([^*\n]+)\*\*|\*([^*\n]+)\*|\[([^\]]+)\]\(([^)]+)\)/g,n=0,l;for(;null!==(l=s.exec(e));)l.index>n&&r.push((0,t.jsx)("span",{children:e.slice(n,l.index)},`t${l.index}`)),null!=l[1]?r.push((0,t.jsx)("strong",{style:{fontWeight:600,color:"var(--scout-text-strong)"},children:x(l[1],a)},l.index)):null!=l[2]?r.push((0,t.jsx)("em",{style:{opacity:.75},children:x(l[2],a)},l.index)):null!=l[3]&&r.push((0,t.jsx)(f,{text:l[3],href:l[4]},l.index)),n=l.index+l[0].length;return n<e.length&&r.push((0,t.jsx)("span",{children:e.slice(n)},"end")),r}function m(e){let t=e.trim().replace(/:$/,"");return!!t.startsWith("**")&&!!t.match(/^\*\*([^*]+?)\*\*$/)}function g({text:e,isUser:a}){let r=function(e){let t=[];for(let a=0;a<e.length;a++){let r=e[a].trim();if(/^\d+[.)]\s*$/.test(r))continue;let s=r.match(/^\d+[.)]\s+(.*)$/);if(s&&/^[*_[]/.test(s[1])){t.push(s[1]);continue}t.push(e[a])}return t}(e.split("\n")),s=[],n=0;for(;n<r.length;){let e=r[n].trim();if(!e){n++;continue}if(e.match(/^[-*â¢]\s+(.*)$/)){let e=[];for(;n<r.length;){let t=r[n].trim().match(/^[-*â¢]\s+(.*)$/);if(t)e.push(t[1]),n++;else break}s.push((0,t.jsx)("ul",{className:"space-y-1 pl-1 my-1.5 text-sm",children:e.map((e,r)=>(0,t.jsxs)("li",{className:"flex gap-2 items-start leading-relaxed",children:[(0,t.jsx)("span",{className:"flex-shrink-0 mt-2 rounded-full",style:{width:4,height:4,minWidth:4,background:a?"rgba(255,255,255,0.5)":"rgba(236,72,153,0.75)"}}),(0,t.jsx)("span",{className:"flex-1 min-w-0",children:x(e,a)})]},r))},`ul${n}`));continue}let l=e.match(/^(\d+)[.)]\s+(.+)$/);if(l&&!/^[*_[]/.test(l[2])){let e=[l[2]],i=n+1;for(;i<r.length;){let t=r[i].trim().match(/^(\d+)[.)]\s+(.+)$/);if(t)e.push(t[2]),i++;else break}if(e.length>1){s.push((0,t.jsx)("ol",{className:"space-y-1.5 pl-1 my-2 text-sm",children:e.map((e,r)=>(0,t.jsxs)("li",{className:"flex gap-2 leading-relaxed",children:[(0,t.jsxs)("span",{className:"flex-shrink-0 font-bold text-xs mt-0.5 w-
15 text-right",style:{color:a?"var(--scout-text-soft)":"rgba(236,72,153,0.9)"},children:[r+1,"."]}),(0,t.jsx)("span",{className:"flex-1 min-w-0",children:x(e,a)})]},r))},`ol${n}`)),n=i;continue}s.push((0,t.jsx)("p",{className:"text-sm leading-relaxed my-1",children:x(l[2],a)},`p${n}`)),n++;continue}if(!a&&m(e)){let l=e.replace(/:\s*$/,""),i=[],o=n+1;for(;o<r.length;){let e=r[o].trim();if(!e){o++;continue}if(m(e)||/^[-*â¢]\s+/.test(e))break;i.push(e.replace(/^:\s*/,"")),o++}let c=i.join(" ");s.push((0,t.jsxs)("div",{className:"my-2.5 pl-3",style:{borderLeft:"2px solid rgba(236,72,153,0.4)"},children:[(0,t.jsx)("p",{className:"text-sm leading-snug mb-1",style:{color:"var(--scout-text-strong)",fontWeight:600},children:x(l,a)}),c&&(0,t.jsx)("p",{className:"text-sm leading-relaxed",style:{color:"var(--scout-text-soft)"},children:x(c,a)})]},`sec${n}`)),n=o;continue}s.push((0,t.jsx)("p",{className:"text-sm leading-relaxed my-1",children:x(e,a)},`p${n}`)),n++}return(0,t.jsx)("div",{className:"space-y-0.5",children:s})}let b={get_campaign_detail:"Pulled campaign metrics",get_top_campaigns:"Ranked campaigns",get_top_brands:"Ranked brands",get_campaigns_by_brand:"Rolled up a brand's campaigns",get_overall_stats:"Computed agency-wide totals",get_top_creators:"Ranked creators",get_posts_by_creator:"Pulled a creator's posts",get_posts_by_campaign:"Pulled a campaign's posts",get_top_posts:"Ranked posts",get_post_detail:"Pulled post details",get_metrics_by_period:"Bucketed metrics over time",get_agency_yearly_stats:"Computed per-year totals",search_campaigns:"Searched campaigns",search_creators:"Searched creators",get_sentiment:"Analyzed sentiment",get_campaign_sentiment:"Analyzed campaign sentiment",scout_remember:"Saved a preference",update_entity_context:"Updated saved context"};e.s(["MessageContent",0,function({content:e,isUser:a}){let r=e.replace(/```chart\n[\s\S]*?```/g,"").replace(/\n{3,}/g,"\n\n");return(0,t.jsx)("div",{style:{color:a?"var(--scout-text-strong)":"var(--scout-text-soft)",wordBreak:"break-word",overflowWrap:"break-word",minWidth:0},children:(0,t.jsx)(g,{text:r,isUser:a})})},"ScoutFeedback",0,function({messageId:e,feedbackTrace:r,question:s,answer:n,conversationId:c}){let[d,u]=(0,a.useState)(null),[p,h]=(0,a.useState)("idle"),[f,x]=(0,a.useState)(!1),[m,g]=(0,a.useState)(""),b="saved"===p,y="saving"===p,v=(0,a.useCallback)(async(t,a)=>{h("saving");try{let l=await fetch("/api/ai/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rating:t,comment:a?.trim()||void 0,question:s,answer:n,trace:r,messageId:e,...c?{conversationId:c}:{}})}),i=await l.json().catch(()=>({}));if(!l.ok||!i?.ok)throw Error(i?.error||`HTTP ${l.status}`);h("saved"),x(!1)}catch{h("idle"),u(null),x(!1),l.default.error("Couldn't save feedback")}},[e,r,s,n,c]),j=()=>{y||v("down",m)};if(b)return(0,t.jsxs)("div",{className:"pl-7 flex items-center gap-1.5",children:["up"===d?(0,t.jsx)(i,{className:"w-3.5 h-3.5",style:{color:"#10b981"}}):(0,t.jsx)(o,{className:"w-3.5 h-3.5",style:{color:"var(--scout-text-soft)"}}),(0,t.jsx)("span",{className:"text-[11px] font-medium",style:{color:"var(--scout-text-soft)"},children:"Thanks for the feedback"})]});let w=(e,t)=>({width:36,height:36,color:e?t:"var(--scout-text-soft)",background:e?`${t}24`:"transparent",border:e?`1px solid ${t}59`:"1px solid transparent",opacity:e?1:.6});return(0,t.jsxs)("div",{className:"pl-7 flex flex-col gap-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{b||y||(u("up"),x(!1),v("up"))},disabled:y,"aria-label":"Helpful answer",title:"Helpful",className:"flex items-center justify-center rounded-lg transition-all duration-150 active:scale-90 disabled:cursor-not-allowed",style:w("up"===d,"#10b981"),onMouseEnter:e=>{"up"!==d&&(e.currentTarget.style.opacity="1")},onMouseLeave:e=>{"up"!==d&&(e.currentTarget.style.opacity="0.6")},children:(0,t.jsx)(i,{className:"w-4 h-4"})}),(0,t.jsx)("button",{type:"button",onClick:()=>{b||y||(u("down"),x(!0))},disabled:y,"aria-label":"Not helpful answer",title:"Not helpful",className:"flex items-center justify-center rounded-lg transition-all duration-150 active:scale-90 disabled:cursor-not-allowed",style:w("down"===d,"#9ca3af"),onMouseEnter:e=>{"down"!==d&&(e.currentTarget.style.opacity="1")},onMouseLeave:e=>{"down"!==d&&(e.currentTarget.style.opacity="0.6")},children:(0,t.jsx)(o,{className:"w-4 h-4"})})]}),f&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("input",{type:"text",value:m,onChange:e=>g(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),j())},placeholder:"Add a comment (optional)",disabled:y,className:"flex-1 min-w-0 text-xs rounded-lg px-3 py-2 outline-none disabled:opacity-50",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-soft)",color:"var(--scout-text-strong)",caretColor:"#ec4899"}}),(0,t.jsx)("button",{type:"button",onClick:j,disabled:y,className:"flex-shrink-0 text-xs font-semibold text-white rounded-lg px-3 py-2 transition-all duration-150 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg,#ec4899,#f97316)"},children:y?"â¦":"Send"})]})]})},"ScoutTrace",0,function({feedbackTrace:e}){let[r,s]=(0,a.useState)(!1),n=Array.isArray(e?.steps)?e.steps:[];return n.length?(0,t.jsxs)("div",{className:"pl-7",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>s(e=>!e),className:"inline-flex items-center gap-1 text-[11px] font-medium transition-all",style:{color:"var(--scout-text-soft)"},onMouseEnter:e=>{e.currentTarget.style.color="rgba(255,255,255,0.8)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--scout-text-soft)"},title:"See which live-data lookups this answer is built from",children:[(0,t.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:r?"rotate(90deg)":"none",transition:"transform 0.15s"},children:(0,t.jsx)("path",{d:"m9 18 6-6-6-6"})}),r?"Hide reasoning":"How Scout got this"," · ",n.length," ",1===n.length?"step":"steps"]}),r&&(0,t.jsxs)("div",{className:"mt-1.5 flex flex-col gap-1 rounded-xl px-3 py-2.5",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-softer)"},children:[n.map((e,a)=>{var r;return(0,t.jsxs)("div",{className:"flex items-center gap-2 text-[11px] leading-snug",style:{color:"rgba(255,255,255,0.74)"},children:[(0,t.jsx)("span",{className:"flex-shrink-0 font-bold",style:{color:!1===e.ok?"#f87171":"#10b981"},children:!1===e.ok?"â":"â"}),(0,t.jsx)("span",{className:"min-w-0",children:b[r=e.tool]?b[r]:(r||"tool").replace(/^get_/,"").replace(/_/g," ").replace(/\b\w/,e=>e.toUpperCase())})]},a)}),(0,t.jsx)("div",{className:"text-[10px] mt-1 pt-1.5",style:{color:"var(--scout-text-soft)",borderTop:"1px solid var(--tint-softer)"},children:"Every figure is grounded in these live-data lookups â Scout doesn't guess."})]})]}):null}],249802)},248952,630929,e=>{"use strict";var t=e.i(271645);e.s(["useScoutPersistence",0,function(e=null){let a=(0,t.useRef)(e),r=(0,t.useCallback)(()=>a.current,[]),s=(0,t.useCallback)(e=>{a.current=e||null},[]),n=(0,t.useCallback)(()=>{a.current=null},[]),l=e=>({role:"user"===e.role?"user":"assistant",content:"string"==typeof e.content?e.content:"",messageId:e.messageId||null,visuals:Array.isArray(e.visuals)?e.visuals:void 0});return{getChatId:r,setChatId:s,reset:n,persistTurn:(0,t.useCallback)(async(e,t)=>{let r=[l(e),l(t)];try{if(!a.current){let e=await fetch("/api/ai/chats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:r})}),t=await e.json().catch(()=>({}));return t?.id&&(a.current=t.id),a.current}return await fetch(`/api/ai/chats/${a.current}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:r})}),a.current}catch{return a.current}},[]),ensurePersisted:(0,t.useCallback)(async e=>{if(a.current)return a.current;let t=(e||[]).filter(e=>e?.content);if(!t.length)return null;try{let e=await fetch("/api/ai/chats",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:t.map(l)})}),r=await e.json().catch(()=>({}));return r?.id&&(a.current=r.id),a.current}catch{return null}},[])}}],248952);var a=e.i(843476),r=e.i(174080),s=e.i(217255),n=e.i(705766);function l({state:e,busy:t,copyLink:r,onToggle:s,onRotate:n,linkFor:i}){let o=!!e?.hasLink;return(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("label",{className:"flex items-center justify-between gap-3 p-3 rounded-xl",style:{background:"var(--tint-softer)"},children:[(0,a.jsx)("span",{className:"text-[13px]",children:"Anyone in your agency with the link"}),(0,a.jsx)("input",{type:"checkbox",checked:o,disabled:t,onChange:e=>s(e.target.checked)})]}),o&&e?.token&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"flex items-center gap-2 p-2 rounded-xl text-[12px]",style:{background:"var(--tint-softer)",color:"var(--scout-text-soft)"},children:(0,a.jsx)("span",{className:"flex-1 min-w-0 truncate",children:i(e.token)})}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:r,disabled:t,className:"flex-1 py-2 rounded-xl text-xs font-semibold text-white",style:{background:"linear-gradient(135deg,#ec4899,#f97316)"},children:"Copy link"}),(0,a.jsx)("button",{onClick:n,disabled:t,className:"px-3 py-2 rounded-xl text-xs font-semibold",style:{background:"var(--tint-soft)",color:"var(--scout-text-soft)"},title:"Rotate token (revokes old links)",children:"Reset link"})]})]}),(0,a.jsx)("p",{className:"text-[11px]",style:{color:"var(--scout-text-soft)"},children:"Only people in your agency can open a shared chat, and only to read it."})]})}function i({state:e,busy:r,onAdd:s,onRemove:n}){let[l,o]=(0,t.useState)([]),[d,u]=(0,t.useState)("");(0,t.useEffect)(()=>{fetch("/api/agency-team").then(e=>e.json()).then(e=>{o(Array.isArray(e)?e:e.teammates||e.users||[])}).catch(()=>o([]))},[]);let p=new Set((e?.recipients||[]).map(e=>e.id)),h=l.filter(e=>{let t=e._id||e.id;if(!t||p.has(t.toString()))return!1;let a=(e.name||e.email||"").toLowerCase();return!d.trim()||a.includes(d.trim().toLowerCase())});return(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(e?.recipients||[]).length>0&&(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,a.jsx)("p",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--scout-text-soft)"},children:"Shared with"}),e.recipients.map(e=>(0,a.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-lg",style:{background:"var(--tint-softer)"},children:[(0,a.jsx)(c,{u:e}),(0,a.jsx)("span",{className:"text-[13px] flex-1 min-w-0 truncate",children:e.name}),(0,a.jsx)("button",{onClick:()=>n(e.id),disabled:r,className:"text-[11px]",style:{color:"#f87171"},children:"Remove"})]},e.id))]}),(0,a.jsx)("input",{value:d,onChange:e=>u(e.target.value),placeholder:"Search teammates",className:"text-sm rounded-xl px-3 py-2 outline-none",style:{background:"var(--tint-softer)",border:"1px solid var(--tint-soft)",color:"var(--scout-text-strong)"}}),(0,a.jsx)("p",{className:"text-[11px] px-1",style:{color:"var(--scout-text-soft)"},children:"Sharing gives them read-only access and sends them the chat in a DM."}),(0,a.jsx)("div",{className:"flex flex-col gap-1 max-h-56 overflow-y-auto",children:0===h.length?(0,a.jsx)("p",{className:"text-[12px] px-1 py-2",style:{color:"var(--scout-text-soft)"},children:"No teammates to add."}):h.map(e=>{let t=(e._id||e.id).toString();return(0,a.jsxs)("button",{onClick:()=>s(e),disabled:r,className:"flex items-center gap-2 px-2 py-1.5 rounded-lg text-left transition-all hover:bg-white/[0.05] disabled:opacity-50",children:[(0,a.jsx)(c,{u:e}),(0,a.jsx)("span",{className:"text-[13px] flex-1 min-w-0 truncate",children:e.name||e.email}),(0,a.jsx)("span",{className:"text-[11px]",style:{color:"#f9a8d4"},children:"Share"})]},t)})})]})}function o({chatId:e,title:r,ownerName:s,ensureToken:l,onDone:i}){let[c,d]=(0,t.useState)([]),[u,p]=(0,t.useState)(null);(0,t.useEffect)(()=>{fetch("/api/conversations").then(e=>e.json()).then(e=>{d(Array.isArray(e)?e:e.conversations||[])}).catch(()=>d([]))},[]);let h=(0,t.useCallback)(async t=>{p(t._id);try{let a=await l();if(!(await fetch("/api/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:{type:"conversation",id:t._id},text:"",scoutChatShares:[{chat:e,title:r,ownerName:s,token:a||null}]})})).ok)throw Error("failed");n.default.success("Sent to chat"),i?.()}catch{n.default.error("Couldn't send to chat")}finally{p(null)}},[e,r,s,l,i]),f=e=>
1e.name?e.name:(e.participants||[]).filter(Boolean).map(e=>e.name||e.email).slice(0,3).join(", ")||"Conversation";return(0,a.jsx)("div",{className:"flex flex-col gap-1 max-h-72 overflow-y-auto",children:0===c.length?(0,a.jsx)("p",{className:"text-[12px] px-1 py-2",style:{color:"var(--scout-text-soft)"},children:"No conversations yet."}):c.map(e=>(0,a.jsxs)("button",{onClick:()=>h(e),disabled:u===e._id,className:"flex items-center gap-2 px-2 py-2 rounded-lg text-left transition-all hover:bg-white/[0.05]",children:[(0,a.jsx)("span",{className:"w-7 h-7 rounded-lg flex items-center justify-center flex-shrink-0 text-white text-[11px] font-bold",style:{background:"linear-gradient(135deg,#8b5cf6,#06b6d4)"},children:(f(e)[0]||"#").toUpperCase()}),(0,a.jsx)("span",{className:"text-[13px] flex-1 min-w-0 truncate",children:f(e)}),(0,a.jsx)("span",{className:"text-[11px]",style:{color:u===e._id?"var(--scout-text-soft)":"#f9a8d4"},children:u===e._id?"Sendingâ¦":"Send"})]},e._id))})}function c({u:e}){return e.image?(0,a.jsx)("img",{src:e.image,alt:"",className:"w-6 h-6 rounded-full object-cover flex-shrink-0"}):(0,a.jsx)("span",{className:"w-6 h-6 rounded-full flex items-center justify-center flex-shrink-0 text-white text-[10px] font-bold",style:{background:"linear-gradient(135deg,#ec4899,#f97316)"},children:(e.name||e.email||"?")[0]?.toUpperCase()})}e.s(["default",0,function({chatId:e,title:c,onClose:d}){let{data:u}=(0,s.useSession)(),p=u?.user?.name||u?.user?.email||"",[h,f]=(0,t.useState)(null),[x,m]=(0,t.useState)("link"),[g,b]=(0,t.useState)(!1),y=h?.title||c,v=(0,t.useCallback)(async()=>{try{let t=await fetch(`/api/ai/chats/${e}/share`);t.ok&&f(await t.json())}catch{}},[e]);(0,t.useEffect)(()=>{v()},[v]);let j=(0,t.useCallback)(async t=>{b(!0);try{let a=await fetch(`/api/ai/chats/${e}/share`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),r=await a.json().catch(()=>({}));if(!a.ok)throw Error(r.error||"failed");return f(r),r}catch(e){return n.default.error("Couldn't update sharing"),null}finally{b(!1)}},[e]),w=t=>`${window.location.origin}/dashboard/user/scout?chat=${e}&share=${t}`,k=(0,t.useCallback)(async()=>{if(h?.hasLink&&h?.token)return h.token;let e=await j({visibility:"agency-link"});return e?.token||null},[h,j]),N=(0,t.useCallback)(async()=>{let e=await k();if(e)try{await navigator.clipboard.writeText(w(e)),n.default.success("Link copied")}catch{n.default.error("Copy failed â select and copy manually")}},[k]),S=(0,t.useCallback)(async t=>{let a=(t._id||t.id)?.toString();if(a){b(!0);try{if(!await j({addRecipientIds:[a]}))return;let r=await k(),s=await fetch("/api/conversations/find-or-create-dm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({otherUserId:a})}),l=await s.json().catch(()=>({})),i=l?.conversation?._id;if(!i)return void n.default.success("Shared (couldn't open a chat to notify them)");await fetch("/api/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:{type:"conversation",id:i},text:"",scoutChatShares:[{chat:e,title:y,ownerName:p,token:r||null}]})}),n.default.success(`Shared with ${t.name||t.email||"teammate"} â sent in chat`)}catch{n.default.error("Shared, but couldn't message them")}finally{b(!1)}}},[j,k,e,y,p]),C=(0,a.jsx)("div",{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.55)"},onClick:d,children:(0,a.jsxs)("div",{className:"w-full max-w-md rounded-2xl overflow-hidden flex flex-col",style:{background:"rgba(14,11,20,0.98)",border:"1px solid var(--tint-soft)",maxHeight:"85vh",color:"var(--scout-text-strong)"},onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("div",{className:"h-0.5 w-full",style:{background:"linear-gradient(90deg,#ec4899,#f97316)"}}),(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-3",style:{borderBottom:"1px solid var(--tint-softer)"},children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-bold truncate",children:"Share chat"}),(0,a.jsx)("p",{className:"text-[11px] truncate",style:{color:"var(--scout-text-soft)"},children:y})]}),(0,a.jsx)("button",{onClick:d,className:"w-8 h-8 rounded-lg flex items-center justify-center",style:{color:"var(--scout-text-soft)"},title:"Close",children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,a.jsx)("path",{d:"M18 6 6 18M6 6l12 12"})})})]}),(0,a.jsx)("div",{className:"flex gap-1 px-3 pt-2",children:[["link","Link"],["people","Teammates"],["chat","Send to chat"]].map(([e,t])=>(0,a.jsx)("button",{onClick:()=>m(e),className:"flex-1 text-xs font-semibold py-2 rounded-lg transition-all",style:x===e?{color:"#f9a8d4",background:"rgba(236,72,153,0.14)"}:{color:"var(--scout-text-soft)"},children:t},e))}),(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:["link"===x&&(0,a.jsx)(l,{state:h,busy:g,copyLink:N,onToggle:e=>j({visibility:e?"agency-link":"private"}),onRotate:()=>j({visibility:"agency-link",rotateToken:!0}),linkFor:w}),"people"===x&&(0,a.jsx)(i,{chatId:e,state:h,busy:g,onAdd:S,onRemove:e=>j({removeRecipientIds:[e]})}),"chat"===x&&(0,a.jsx)(o,{chatId:e,title:y,ownerName:p,ensureToken:k,onDone:d})]})]})});return"u"<typeof document?null:(0,r.createPortal)(C,document.body)}],630929)}]);
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.