(()=>{const r=window.React;if(!r)return;const e=r.createElement,c=r.useState,g=r.useEffect,a={bg:"var(--app-bg,#0e0e10)",surface:"var(--app-surface,#1a1a1c)",elevated:"var(--app-elevated,#2a2a2e)",rule:"var(--app-rule,rgba(255,255,255,.07))",ink:"var(--app-ink,#e6e3da)",inkSoft:"var(--app-ink-soft,rgba(230,227,218,.62))",inkFaint:"var(--app-ink-faint,rgba(230,227,218,.38))",accent:"var(--app-accent,#00f3ff)",accentDim:"var(--app-accent-dim,rgba(0,243,255,.16))",success:"var(--app-success,#00d4b8)",warn:"var(--app-warn,#f8d974)",mono:'var(--app-font-mono,"JetBrains Mono",SFMono-Regular,monospace)',body:'var(--app-font-body,"Inter",system-ui,sans-serif)'},l={source:"snapshot-fallback",window:{start:"20260513",end:"20260521"},heroKpis:[{label:"Sessions",value:"12,480",delta:"+4.2%",trend:"up"},{label:"Opens",value:"3,940",delta:"+2.1%",trend:"up"},{label:"Clicks",value:"1,180",delta:"+0.6%",trend:"up"},{label:"Conv. rate",value:"9.5%",delta:"+0.3pp",trend:"up"}],items:[{ab_variant:"A",persona:"security-builder",human_opened:1240,human_clicked:380},{ab_variant:"B",persona:"security-builder",human_opened:1310,human_clicked:420},{ab_variant:"A",persona:"enterprise-ops",human_opened:690,human_clicked:190},{ab_variant:"B",persona:"enterprise-ops",human_opened:700,human_clicked:190}]},p={source:"snapshot-fallback",project:"91756",window:{start:"20260513",end:"20260521"},note:"Live token expired \u2014 serving vendored snapshot.",heroKpis:[{label:"Visitors",value:"8,240",trend:"flat"},{label:"Funnel conv.",value:"6.8%",trend:"flat"}],funnelSteps:[{label:"Landing",value:8240},{label:"Pricing",value:2410},{label:"Signup",value:940},{label:"Activated",value:560}]},u="analytics-suite-style";function y(){if(document.getElementById(u))return;const n=`
    .anasuite{display:flex;flex-direction:column;gap:16px;height:100%;min-height:0;font-size:14px;line-height:1.45;color:${a.ink};font-family:${a.body};}
    .anasuite *,.anasuite *::before,.anasuite *::after{box-sizing:border-box;}
    .anasuite .mono{font-family:${a.mono};font-variant-numeric:tabular-nums;}
    .anasuite .kpi-strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px;padding:10px 0;border-top:1px solid ${a.rule};border-bottom:1px solid ${a.rule};}
    .anasuite .kpi-tile{padding:8px 14px;border-right:1px solid ${a.rule};}
    .anasuite .kpi-tile:last-child{border-right:none;}
    .anasuite .kpi-label{font-size:10px;color:${a.inkFaint};text-transform:uppercase;letter-spacing:.14em;}
    .anasuite .kpi-value{margin-top:5px;font-family:${a.mono};font-size:22px;color:${a.ink};font-weight:500;}
    .anasuite .card{background:${a.surface};border:1px solid ${a.rule};border-radius:12px;padding:16px;}
    .anasuite .card-h{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px;flex-wrap:wrap;}
    .anasuite .card-h h3{margin:0;font-size:15px;font-weight:700;color:${a.ink};}
    .anasuite .card-tag{font-family:${a.mono};font-size:10px;letter-spacing:.1em;text-transform:uppercase;color:${a.inkFaint};}
    .anasuite table{width:100%;border-collapse:collapse;}
    .anasuite table thead th{text-align:left;padding:10px 12px;border-bottom:1px solid ${a.rule};font-family:${a.mono};font-size:9.5px;text-transform:uppercase;letter-spacing:.1em;color:${a.inkFaint};}
    .anasuite table tbody td{padding:10px 12px;border-bottom:1px solid ${a.rule};font-size:12.5px;}
    .anasuite table tbody tr:last-child td{border-bottom:0;}
    .anasuite .funnel-row{display:grid;grid-template-columns:110px 1fr 70px;gap:10px;align-items:center;margin-bottom:10px;}
    .anasuite .funnel-row:last-child{margin-bottom:0;}
    .anasuite .funnel-label{font-size:12px;color:${a.inkSoft};}
    .anasuite .funnel-track{height:10px;border-radius:999px;background:${a.bg};overflow:hidden;}
    .anasuite .funnel-fill{display:block;height:100%;border-radius:999px;background:${a.accent};}
    .anasuite .funnel-num{font-family:${a.mono};font-size:11px;color:${a.inkFaint};text-align:right;}
    .anasuite .note{font-size:11.5px;color:${a.warn};margin-top:8px;}
    .anasuite .grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;}
    @media(max-width:900px){.anasuite .grid2{grid-template-columns:1fr;}}
    `,i=document.createElement("style");i.id=u,i.textContent=n,document.head.appendChild(i)}function b(n){return e("div",{className:"kpi-strip"},(n.kpis||[]).map((i,t)=>e("div",{className:"kpi-tile",key:i.label||t},[e("div",{className:"kpi-label",key:"l"},i.label),e("div",{className:"kpi-value",key:"v"},i.value)])))}function h(n){const i=Array.isArray(n.items)?n.items:[];return e("div",{className:"card"},[e("div",{className:"card-h",key:"h"},[e("h3",{key:"t"},"GA4 email-outreach funnel"),e("span",{className:"card-tag",key:"p"},n.source||"seed")]),e("table",{key:"tbl"},[e("thead",{key:"h"},e("tr",{},[e("th",{key:"v"},"Variant"),e("th",{key:"p"},"Persona"),e("th",{key:"o"},"Opened"),e("th",{key:"c"},"Clicked")])),e("tbody",{key:"b"},i.map((t,s)=>e("tr",{key:s},[e("td",{className:"mono",key:"v"},t.ab_variant),e("td",{key:"p"},t.persona),e("td",{className:"mono",key:"o"},String(t.human_opened)),e("td",{className:"mono",key:"c"},String(t.human_clicked))])))])])}function k(n){const i=Array.isArray(n.funnelSteps)?n.funnelSteps:[],t=i.reduce((s,o)=>Math.max(s,Number(o.value)||0),1);return e("div",{className:"card"},[e("div",{className:"card-h",key:"h"},[e("h3",{key:"t"},"PostHog website funnel"),e("span",{className:"card-tag",key:"p"},n.source||"seed")]),...i.map((s,o)=>e("div",{className:"funnel-row",key:o},[e("span",{className:"funnel-label",key:"l"},s.label),e("div",{className:"funnel-track",key:"t"},e("span",{className:"funnel-fill",style:{width:`${Math.round((Number(s.value)||0)/t*100)}%`}})),e("span",{className:"funnel-num mono",key:"n"},String(s.value))])),n.note?e("div",{className:"note",key:"note"},n.note):null])}function d(){y();const n=()=>window.KIND_REGISTRY&&window.KIND_REGISTRY.analyticsSuite&&window.KIND_REGISTRY.analyticsSuite.ga4||l,i=()=>window.KIND_REGISTRY&&window.KIND_REGISTRY.analyticsSuite&&window.KIND_REGISTRY.analyticsSuite.posthog||p,[t,s]=c(n),[o,v]=c(i);g(()=>{const m=()=>s(n()),f=()=>v(i());return window.addEventListener("ga4-funnel-live-hydrated",m),window.addEventListener("posthog-funnel-live-hydrated",f),()=>{window.removeEventListener("ga4-funnel-live-hydrated",m),window.removeEventListener("posthog-funnel-live-hydrated",f)}},[]);const w=[...Array.isArray(t&&t.heroKpis)?t.heroKpis:[],...Array.isArray(o&&o.heroKpis)?o.heroKpis:[]];return e("div",{className:"anasuite"},[e(b,{kpis:w,key:"kpi"}),e("div",{className:"grid2",key:"grid"},[e(h,{key:"ga4",items:t&&t.items,source:t&&t.source}),e(k,{key:"ph",funnelSteps:o&&o.funnelSteps,source:o&&o.source,note:o&&o.note})])])}d.displayName="AnalyticsSuiteView",window.ANALYTICS_SUITE_VIEW_FN=d,window.VIEWS=window.VIEWS||{},window.VIEWS.analyticsSuite=d,window.KIND_REGISTRY=window.KIND_REGISTRY||{},window.KIND_REGISTRY.analyticsSuite=window.KIND_REGISTRY.analyticsSuite||{id:"analyticsSuite",label:"Marketing Analytics",workspaceLabel:"Marketing Analytics",workspaceIcon:"monitoring",description:"GA4 email-outreach funnel (BigQuery, bot-filtered) + PostHog website funnel \u2014 A/B variant \xD7 persona breakdown. Identity + entitlement gated; live only for tenants entitled to marketing.ga4 / marketing.posthog.",defaultView:"analyticsSuite",defaultDetail:"none",agentTreatment:"implicit",primaryAction:{label:"Refresh",kind:"primary",icon:"sync"},secondaryActions:[],heroKpis:l.heroKpis,ga4:l,posthog:p},window.STREAMS=window.STREAMS||{},window.STREAMS.analytics||(window.STREAMS.analytics={id:"analytics",label:"Marketing Analytics",icon:"monitoring",subPages:[{id:"ga4-funnel",label:"GA4 / PostHog",kind:"analyticsSuite"}]})})();
