PageSourceSearch

https://platform.blackwoodseven.com/assets/index-DLwQ18k6.js

js blackwoodseven.com collected 2026-10-04 05:23:07 UTC 48,341 bytes, 2 lines download raw bytes

1import{ah as we,ai as Kt,aj as Ve,ak as Ge,al as xa,am as wa,an as jt,ao as et,ap as Ke,u as _e,M as V,aq as zt,ar as Ne,as as Ta,at as oe,au as Pa,av as Ca,aw as Ia,ax as Ea,ay as ht,a as x,j as n,az as ut,aA as Aa,aB as He,aC as Ut,d as _a,b as Dt,l as ie,aD as La,aE as qt,aF as Fa,aG as Ra,f as se,aH as Oa,s as Ee,aI as Qt,aJ as Ba,aK as Va,aL as tt,aM as at,aN as nt,aO as Oe,aP as gt,aQ as Na,aR as $a,aS as Zt,t as Wa,e as Be,r as xe,aT as Je,aU as Ha,aV as Ga,q as Ka,aW as ja,aX as za,aY as Ua,aZ as Jt,a_ as qa,a$ as vt,b0 as Ae,V as Qa,D as bt,b1 as St,b2 as Ye,b3 as Xe,b4 as yt,b5 as Za,b6 as Ja,b7 as Ya,b8 as Xa,b9 as en,k as tn,ba as Yt,bb as an,bc as nn,bd as We,be as pt,bf as on}from"./index-BsB7HIV2.js";import{a as P,b as sn,r as U,c as rn}from"./vendor-pzayoL5T.js";import{e as le,u as b}from"./redux-CSIyppIs.js";import{u as ln,b as cn,E as dn,S as un,c as pn,D as mn,I as fn,d as hn,C as gn,e as vn,t as bn,f as yn,s as kn,l as Dn,h as Sn,i as Mn,j as xn,k as wn,n as Tn,o as Pt,q as Pn,r as ot,v as Cn,w as Ct,x as Mt,y as Xt,F as In,z as It,G as En,J as An,L as _n,K as Ln,T as Fn,N as Rn,P as Ie,H as On,Q as qe}from"./collapse-Ch5dwlgW.js";import{k as Bn,e as re,l as it,m as Vn,n as Nn,o as $n,p as ea,q as ta,t as Wn,H as Hn,F as Gn,v as Kn,w as jn,x as zn,M as Et}from"./useMediaHistoricalQuery-DoHHAdAm.js";import{u as Le,a as xt,F as aa,b as na,C as oa}from"./useControllableLongPollingJobs-5OGGNksd.js";import{u as je,g as Un,a as wt,f as At}from"./useEffectiveStackRelations-CNQ4VVke.js";import{T as qn}from"./index-DyzRkYa3.js";import{u as st,a as _,T as kt,C as ia,d as Me,L as Qn,a2 as Zn}from"./mui-BIzjK2H4.js";import{S as Jn,C as Yn,M as _t,V as Xn,g as eo,u as sa,a as to,b as Lt,p as Ft,c as ao,d as no,e as oo,D as io,f as so}from"./buildMediaInsightsDualPanePlotOverlays-B7JqMlOn.js";import{S as ro}from"./index-CuVG6WN2.js";import{P as ra}from"./index-CWIqysK4.js";import{u as la}from"./useTabsData-DWLDYGXF.js";import{D as lo}from"./index-CRosR5UM.js";import{u as co,g as uo,a as po,b as mo,v as fo,c as ho,d as ca}from"./getStackRelationTitleSuffix-utGzo3IV.js";import"./index-B5_crkTH.js";import"./KeyboardArrowDown-BWgQzu2S.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"jupiter-frontend--20260924T085157Z--7f0b2cf"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8af45e7e-d09d-439b-98cd-421e4c501c41",e._sentryDebugIdIdentifier="sentry-dbid-8af45e7e-d09d-439b-98cd-421e4c501c41")}catch{}})();function go({stackModelFilterTitleSuffix:e,defaultPeriod:t,showComparisonPeriod:a}){const o=le(),i=b(we),s=b(Kt),p=b(Ve),r=b(Ge),c=b(xa),l=b(wa),m=b(jt),f=b(et),u=b(Ke),{isFeatureAvailable:h}=_e(),[v,d]=P.useTransition(),g=ln(),S=V.useSelectedModel(),C=V.useHasStackModelData(),N=V.useHasLongTermData(),k=V.useModelDateRanges("decomposition"),D=cn("decomposition"),M=C&&h("stackedModels"),T=u,{mediaGroupings:F,weekly:L,weekStart:R,mediaInsightsPlus__impact_per_dimension_v1:G=zt,type:O,hasLongTermData:I}=S,{modellingEndDate:$,dataEndDate:y}=k,E=V.useDimValues({onlyMedia:!0}),w=Bn({mediaGroupings:F,filter:p,groupByDimension:m})??"#7023A8",B=V.getAvailableDimensionsForModel(G,O,I??!1,r),K=vo(E,B),W=P.useMemo(()=>Ne(O,I??!1),[O,I]),j=Ta({showPresetsPast:!0,showPresetsFuture:!1,modellingEndDate:$,longtermEndDate:N?y:null,allowedInterval:D,getAdjustedPeriod:A=>ut(A,{forceWeekly:L,weekStartsOn:R})}),J=P.useMemo(()=>({start:oe(i[0]),end:oe(i[1])}),[i]),ce=P.useMemo(()=>j.find(({interval:A})=>Pa({interval:A,comparisonInterval:J,weeklyModel:L,weekStartsOn:R}))?.label??"Custom",[j,J,L,R]),de=P.useMemo(()=>L?Ca(i,R):Ia(i,q=>Ra(i,q,"end")),[i,L,R]),ae=P.useMemo(()=>({start:oe(s[0]),end:oe(s[1])}),[s]),Y=P.useMemo(()=>de.find(({interval:A})=>Ea({interval:A,comparisonInterval:ae}))?.label??"Custom",[de,ae]),Z=A=>{A.stopPropagation(),o(He({period:t}))},X=Le(S),{defaultSelectedEffectType:Te}=re(),he=(A,q,ne,ee)=>{const ve=bn(()=>yn(A,q,ne,ee));return ve.error?(console.error("buildTreeFromFlatRelations failed; using empty tree fallback.",ve.error),[]):ve.data},{stackParticipants:ue,labels:fe}=V.useStackModelMetaData(),ge=je({stackRelationsFromStore:T}),De=P.useMemo(()=>M?he(ge,ue,fe,X):[],[ge,ue,fe,X,M]),Pe=P.useCallback(A=>{const q=Un(A,ue);d(()=>{const ne=f?.find(ee=>ee.value===m);o(ht({stackRelations:A,...q!==void 0&&ne?.isStackParticipant?{cardsGroupBy:q}:{}}))})},[o,ue,f,m]);return g&&sn.createPortal(x(vn,{children:[n(dn,{selected:Te}),n(un,{period:i,vsPeriod:s,selectedPeriodDataTestId:"media-insights-selected-period",comparisonPeriodDataTestId:"media-insights-comparison-period",onPeriodChange:(A,q)=>{o(He({period:ut(A,{forceWeekly:L,weekStartsOn:R})})),q&&o(Ut({activePlanId:q})),r!=="combined"&&q&&_a.dispatch(Dt({message:"The activity details are accessible only in the combined data view"}))},onVsPeriodChange:A=>{o(Aa({vsPeriod:A}))},onLocalPeriodChange:A=>ut(A,{forceWeekly:L,weekStartsOn:R}),defaultPeriod:t,handleResetPeriod:Z,hideActivityPresets:!1,showComparisonPeriod:a}),M&&n(qn,{selectionLabel:e.slug==="total"?"All":e.label,headerText:fe.stackViewLabel,dataTestId:"media-insights-stack-access",tree:De,relations:ge,hierarchyKeys:ue,selectionKey:"isSelected",labelsByKey:fe,labelDictionary:X,validation:{isValid:!0,duplicates:[]},onRelationsChange:Pe,showBusyOverlay:v}),n(mn,{filter:p,onChange:(A,q)=>{const ne=!!q&&ie.isEmpty(A)&&u.some(ee=>ee?.isSelected===!1);o(La({newFilter:A,options:{dimensionOptions:f,goingBack:!!q}})),q&&l&&!ne&&o(qt({increaseLevel:!1,dimensionOptions:f}))},dimensionValues:K,groupingToFilter:{},selectionLabelSuffix:"media drivers",expandedByDefault:f?.filter(A=>A.selected&&!A.isStackParticipant)?.[0]?.value,hiddenDimensions:pn,labelDictionary:X,color:ie.isEmpty(p)?void 0:w,preferredDimensionOrder:f?.filter(A=>!A.isStackParticipant).map(A=>A.value),dimensionOptions:f},r),W&&n(fn,{impact:r,selectedImpacts:c,onChange:A=>o(Fa({impact:A})),isMultiSelect:I}),n(gn,{currentModule:hn.MEDIA_INSIGHTS,period:i,comparisonPeriod:s,selectedPeriodLabel:ce,comparisonPeriodLabel:Y})]}),g)}function vo(e,t){const a=[];return t===void 0||e?.forEach(o=>{a.push(ie.pick(o,t))}),a}function bo({xScale:e,yScale:t,data:a,dataKeys:o,background:i=!1,outlined:s=!1,timelineChartColor:p}){const r=st(),c=p||r.palette.primary.main,l=t.range()[1],m=i?"#dadada":c,f=o?.[0],u=.0015;return a.filter(h=>e(h.date)!==void 0&&typeof h[f]=="number").map(h=>{const v=h[f],d=Math.abs(t(v)-t(0)),g=v<0?d+u:-u;return x(P.Fragment,{children:[n(yo,{fill:s?"none":m,stroke:m,x:e(h.date),y:l-t(Math.max(0,v)),width:e.bandwidth(),height:d}),s&&n(ko,{fill:"none",stroke:"#f7f7f7",x1:e(h.date)-.005,x2:e(h.date)+e.bandwidth()+.005,y1:l-t(Math.max(0,v))+g,y2:l-t(Math.max(0,v))+g})]},h.date)})}const yo=_("rect",{target:"eu2oh1i1"})({name:"ptgxck",styles:"transition:y 0.1s,height 0.1s,fill 0.7s,opacity 0.1s;stroke-width:0.15%"}),ko=_("line",{target:"eu2oh1i0"})({name:"gcuiq7",styles:"transition:y1 0.1s,y2 0.1s;stroke-width:0.15%"});function Do({xScale:e,yScale:t,data:a,dataKeys:o=[],outlined:i=!1,smooth:s=!0,dots:p,timelineChartColor:r}){const c=xt(),l=s?Sn:Mn,m=t.range()[1],u=kn().keys(o).value((d,g)=>d[g])(a),h=Dn().defined(d=>!isNaN(d[1])&&e(d.data.date)!==void 0).x(d=>e(d.data.date)+e.bandwidth()/2).y(d=>m-t(d[1])).curve(l),v=xn().defined(d=>!isNaN(d[0])&&e(d.data.date)!==void 0).x(d=>e(d.data.date)+e.bandwidth()/2).y0(()=>m).y1(d=>m-t(d[1])).curve(l);return x(se,{children:[n("defs",{children:u.map(d=>{const g=r||c(d.key).backgroundColor,S=`gradient-${d.key}`;return n("pattern",{id:S,patternUnits:"userSpaceOnUse",width:"100%",height:"100%",children:n("rect",{width:"100%",height:"100%",fill:g,fillOpacity:"0.5"})},d.key)})}),[...u].reverse().map(d=>{const g=r||c(d.key).color,S=`gradient-${d.key}`;return x(P.Fragment,{children:[!i&&n(Rt,{d:v(d),fill:`url(#${S})`}),n(Rt,{fill:"none",stroke:i?"#222222":g,strokeDasharray:i?"2 3":"",d:h(d)})]},d.key)}),p&&u.map(d=>d.map((g,S)=>{if(e(g.data.date)===void 0)return null;const C=r||c(d.key).color;return n("circle",{cx:e(g.data.date)+e.bandwidth()/2,cy:m-t(g[1]),r:"0.002",fill:i?"#222222":C},`${d.key}-${S}`)}))]})}const Rt=_("path",{target:"em3nlo70"})({name:"113bmt1",styles:"transition:0.05s;stroke-width:0.15%"}),So=_("g",{target:"e1ivj3d51"})("--grayscale-value:",e=>e.faded?1:0,";--opacity-value:",e=>e.faded?.3:1,";--transition-property:",e=>e.faded?"filter":"none",";--pointer-events:",e=>e.faded?"none":"all",";filter:grayscale(var(--grayscale-value)) opacity(var(--opacity-value));transition:var(--transition-property) var(--transition-duration, 0.3s) ease-in-out;pointer-events:var(--pointer-events);"),Mo=_("g",{target:"e1ivj3d50"})("@starting-style{opacity:0;}opacity:",e=>e.showing?1:0,";pointer-events:",e=>e.showing?"initial":"none",";transition:opacity var(--animation-duration, 0.3s) ease-in-out;"),xo=5;function wo({currentBottomPosition:e,previousBottomPosition:t}){return t===null?!1:Math.abs(e-t)<xo}function To({hasLongTermData:e,longtermOverlayStartDate:t,date:a,effectType:o}){if(!e||!t)return!1;const i=wn(a,t),s=Oa(o,"hideInLongtermOverlay");return i&&s}function Po(e){const{previousBottomPosition:t,currentBottomPosition:a,hasLongTermData:o,longtermOverlayStartDate:i,date:s,effectType:p}=e;return wo({currentBottomPosition:a,previousBottomPosition:t})||To({hasLongTermData:o,longtermOverlayStartDate:i,date:s,effectType:p})}const Co=6.5/1,rt=["profit_aggregated","effects_aggregated","profit_observed","effects_observed"],mt=(e,t)=>rt.includes(t)?e.toReversed():e;function Io(e){switch(e){case"net_spend":return{Chart:t=>n(bo,{...t}),minValue:1e-4,labelFormatter:Ee};case"net_spend/effects_aggregated":case"profit_aggregated/net_spend":case"profit_observed/net_spend":case"net_spend/effects_observed":return{Chart:t=>n(Jn,{...t}),minValue:1e-4,labelFormatter:Ee};default:return{Chart:t=>n(Do,{...t}),minValue:1e-4,labelFormatter:Ee}}}function Ot({kpi:e,xScale:t,focusMode:a,filtered:o,historicalWhole:i,historicalPart:s,interval:p,labelsOn:r,impact:c,activityFocused:l,dataKeys:m=[],splitViewglobal:f,timelineChartColor:u,showLongtermOverlay:h=!1,xCoordinateForOverlayInLongterm:v,xCoordinateEndForOverlayInLongterm:d,longtermOverlayStartDate:g,hasLongTermData:S}
1){const C=1/Co,{Chart:N,minValue:k,labelFormatter:D}=Io(e),{effectsUsed:M}=it(),{maxDataValue:T,minDataValue:F}=_o(f,e,a,i,m,s),L=l?1.5:1.2,R=[Math.min(F,0),Math.max(T,k)*L],G=Tn().range([0,C]).domain(R),O=p==="day"||p==="week",I=d!==void 0&&v!==void 0?d-v:1,$=S&&r?f?M.length===1:M.length>=1:r;return x("div",{style:{position:"relative"},children:[x("svg",{viewBox:`0 0 1 ${C}`,style:{display:"block","--transition-duration":"0.5s"},children:[x(So,{faded:o,children:[n(N,{data:i,xScale:t,yScale:G,smooth:O,dots:$,impact:c,kpi:e,timelineChartColor:u,dataKeys:mt(m,e)}),h&&n(ro,{x:v??0,y:0,fill:"#E3E2DF80",height:C,width:I}),h&&v!==0&&n(Pt,{x1:v??0,x2:v??0,y1:0,y2:C}),h&&d!==1&&n(Pt,{x1:d??1,x2:d??1,y1:0,y2:C})]}),n(Mo,{showing:o,children:n(N,{data:s,xScale:t,yScale:G,smooth:O,dots:$,impact:c,kpi:e,dataKeys:mt(m,e),timelineChartColor:u})})]}),$&&n(Eo,{kpi:e,xScale:t,yScale:G,filtered:o,historicalWhole:i,historicalPart:s,labelFormatter:D,height:C,dataKeys:mt(m,e),longtermOverlayStartDate:g,hasLongTermData:S})]})}function Eo({kpi:e,xScale:t,yScale:a,filtered:o,historicalWhole:i,historicalPart:s,labelFormatter:p,height:r,longtermOverlayStartDate:c,hasLongTermData:l,dataKeys:m=[]}){const f=rt.includes(e);return(o?s:i).map(u=>{const{date:h}=u;let v=0,d=null;return m.map((g,S)=>{if(S>0&&e==="net_spend")return null;const C=u[g];v+=C;const k=a(f?v:C)/r*100;return Po({previousBottomPosition:d,currentBottomPosition:k,hasLongTermData:l,longtermOverlayStartDate:c,date:h,effectType:g})?null:(d=k,n(Ao,{style:{bottom:`calc(${k}% + 5px)`,left:`${t(h)*100}%`,width:`${t.bandwidth()*100}%`,fontSize:`${10+t.bandwidth()*50}px`},children:p(C)},g+C))})})}const Ao=_("div",{target:"e1fbzsqx0"})({name:"5tk6zb",styles:"position:absolute;text-align:center;color:#9a9a9a"});function _o(e,t,a,o,i,s){let p=0,r=0;if(e&&rt.includes(t)){const c=l=>{let m=0;i.forEach(f=>{m+=l[f]||0}),p=Math.max(p,m),r=Math.min(r,m)};(a?[]:o).forEach(l=>{c(l)}),(a?s:[]).forEach(l=>{c(l)})}else{const c=l=>{i.forEach(m=>{p=Math.max(p,l[m]??0),r=Math.min(r,l[m]??0)})};(a?[]:o).forEach(l=>{c(l)}),s.forEach(l=>{c(l)})}return{maxDataValue:p,minDataValue:r}}function Lo(){const e=le(),t=b(Ve),a=b(Qt),o=Object.keys(t).length>0;return n(Pn,{isFiltered:o,focusMode:a,onToggle:()=>e(Ba())})}function Fo(){const e=V.useSelectedModel(),{isFeatureAvailable:t}=_e(),a=V.useHasStackModelData(),{modelHandle:o,metrics__v1:i,type:s}=e,p=V.useHasLongTermData(),{metricToPickFromConf:r}=re(),[c,l]=P.useState(null),m=Le(e),f=le(),{defaultFilter:u,table:h,metricFlagKey:v}=re(),d=ot(v),g=Va(s,p)??[],{effectsUsed:S,excludeImpactFilter:C}=it(),N=b(tt),k=b(at),D=b(we),M=b(Ve),T=b(Ge),F=b(nt),L=b(et),R=P.useMemo(()=>i?.[r]??[],[i,r]),O=(R.map(B=>B.slug)??[]).map(B=>({value:B,selected:!0})),I={metric:"net_spend",ascending:!1},$=!1,y=P.useMemo(()=>({...R.reduce((W,j)=>(W[j.slug]=d(j.slug),W),{}),...{"effect_type.total":"Combined"}}),[R,d]),E=t("stackedModels")&&a;return x(Ro,{children:[x(Yn,{children:[n(_t,{drives:"top",interval:N,timelines:k,selectKPI:B=>f(Oe(B)),metricKey:r}),n(Xn,{}),n(_t,{drives:"bottom",interval:N,timelines:k,selectKPI:B=>f(Oe(B)),metricKey:r})]}),x(Oo,{children:[!E&&x(se,{children:[n(kt,{title:"Download data in excel file",arrow:!0,children:n(Vn,{onClick:B=>l(B.currentTarget),children:n(aa,{height:20,width:20})})}),n(Nn,{downloadAnchorEl:c,setDownloadAnchorEl:l,downloadExcel:B=>{f(Dt({message:x(se,{children:[n(ia,{size:20,sx:{color:"#fff"}})," Preparing to download"]}),isPersistent:!0,closeButton:!1}));const K="v3/export/historical-generic",W=g.map(Z=>Z==="combined"?"total":Z),j={keysForCombinedImpact:W,keysForSelectedImpact:T===$a?W:[T]};!C&&S?.length>1&&(j.keysForSelectedImpact=[...S,"total"]);const J={table:h,endpoint:K,download:N?Cn:void 0},{top:ce,bottom:de}=k,ae=B.key==="selection"?O.filter(Z=>Z.value===ce||Z.value===de):O,Y=eo(B.key,N);$n(J,K==="v3/export/historical-generic",o,e,B,D,F,ae,L,M,u,m,I,$,T,y,j,a,Y).then(()=>f(gt())).catch(()=>f(Na()))},labelDictionary:m})]}),n(Lo,{})]})]})}const Ro=_("div",{target:"e1sir0gn1"})({name:"1mn35ml",styles:"margin:0px 0px 10px 0px;position:relative;display:flex;align-items:center;justify-content:space-between"}),Oo=_("div",{target:"e1sir0gn0"})({name:"1ev5jkv",styles:"display:flex;align-items:flex-end;
1gap:20px"});function Bo(){const e=le(),t=b(we);return n(ra,{period:t,changePeriodFn:({period:a})=>e(He({period:a}))})}function Bt({dataPoint:e,dataKey:t,kpi:a,backgroundColor:o,chartColor:i,currency:s,showCurrency:p,showDISplit:r,impactLabel:c,dataTestId:l=""}){const{metricFlagKey:m}=re(),f=ot(m);return x(Vo,{children:[a==="net_spend"?n(da,{$color:i}):rt.includes(a)?n(ua,{$color:i,$bg:o}):n(pa,{chartColor:i}),n(No,{children:x($o,{children:[a==="net_spend"||r===!1?x("div",{children:[f(a),p&&` (${s})`]}):n("div",{children:r&&c&&`${c} impact`}),x("div",{"data-testid":`${l}:tooltipValue`,children:[Zt(e[t],{isTwoDecimal:Wa("net_spend")})," "]})]})})]})}const Vo=_("div",{target:"e473f2112"})("color:",({theme:e})=>e.palette.blackish.main,";display:grid;grid-template-columns:16px 1fr;column-gap:",({theme:e})=>e.scale.md,";font-size:",({theme:e})=>e.scale.lg,";padding:",({theme:e})=>e.scale.xs," 0;"),No=_("div",{target:"e473f2111"})({name:"s5xdrg",styles:"display:flex;align-items:center"}),$o=_("div",{target:"e473f2110"})({name:"11vwntr",styles:"width:100%;display:flex;justify-content:space-between;align-items:center"}),da=_("div",{target:"e473f219"})("height:",({theme:e})=>e.scale.xl,";width:",({theme:e})=>e.scale.xl,";background:",({$color:e})=>e,";"),ua=_("div",{target:"e473f218"})("height:",({theme:e})=>e.scale.xl,";width:",({theme:e})=>e.scale.xl,";border-top:",({theme:e})=>e.scale.xs," solid ",({$color:e})=>e,";background:",({$bg:e})=>`oklch(from ${e} l c h / 0.5)`,";");function pa({chartColor:e}){return n(Wo,{children:n(Ho,{$chartColor:e})})}const Wo=_("div",{target:"e473f217"})({name:"1tqtt73",styles:"width:16px;height:16px;background-color:#fff;display:flex;align-items:center"}),Ho=_("div",{target:"e473f216"})("width:100%;height:2.5px;background-color:",({$chartColor:e})=>e,";");function Vt({metricName:e,rows:t}){return t?.length?x(Ko,{children:[e?x(jo,{"aria-label":"header-wrapper",children:[n(zo,{children:e}),n(Uo,{"aria-label":"line"})]}):n(qo,{"aria-label":"just-line"}),t.map((a,o)=>x(Qo,{children:[n(Go,{kind:a.indicatorKind,color:a.color}),n("div",{children:a.label}),n("div",{children:Zt(a.value)})]},a.id??`${a.label}-${o}`))]}):null}function Go({kind:e,color:t}){const a=t??"transparent";return e==="solid"?n(da,{$color:a}):e==="areaspline"?n(ua,{$color:a,$bg:a}):n(pa,{chartColor:a})}const Ko=_("div",{target:"e473f215"})("display:flex;flex-direction:column;gap:",({theme:e})=>e.scale.lg,";"),jo=_("div",{target:"e473f214"})("display:flex;align-items:center;align-self:stretch;gap:",({theme:e})=>e.scale.md,";"),zo=_("div",{target:"e473f213"})("font-size:",({theme:e})=>e.scale.lg,";color:",({theme:e})=>e.palette.blackish.main,";"),Uo=_("div",{target:"e473f212"})("height:0.5px;flex:1;background-color:",({theme:e})=>e.palette.greyish[25],";overflow:hidden;"),qo=_("div",{target:"e473f211"})("height:0.5px;width:100%;background-color:",({theme:e})=>e.palette.greyish[20],";overflow:hidden;"),Qo=_("div",{target:"e473f210"})("display:grid;grid-template-columns:",({theme:e})=>e.scale.xl," 1fr auto;column-gap:",({theme:e})=>e.scale.md,";align-items:center;font-size:",({theme:e})=>e.scale.lg,";color:",({theme:e})=>e.palette.blackish.main,";");function Zo({xScale:e,dataTop:t,dataBottom:a,filtered:o,color:i,dataKeys:s}){const p=V.useSelectedModel(),{currency:r,weekStart:c,type:l,objectiveUnitName:m,hasLongTermData:f}=p,u=Ne(l,f),h=st(),v=i||h.palette.primary.main,{metricFlagKey:d}=re(),g=ot(d),S=na(),C=xt(),N=e.domain().length===1;return n("div",{style:{position:"absolute",left:0,top:0,bottom:0,right:0},children:e.domain().map(k=>{const D=[t,a].map(({kpi:M,...T},F)=>{const{historicalPart:L,historicalWhole:R}=ie.mapValues(ie.pick(T,["historicalPart","historicalWhole"]),y=>y.find(E=>E.date===k)),G=F===0,O=o?L:R;if(O===void 0)return null;if(M==="net_spend")return x(Nt,{children:[n(Ct,{kpi:M,text:g(M),isSplitOrCombinedAvailable:u,isTopChart:G}),n(Bt,{dataPoint:O,dataKey:s?.[0],kpi:M,chartColor:v,showCurrency:!0,currency:r,dataTestId:"MIPlus-timline-netspend"})]},k);const I=Mt(M,"isMoney",d),$=!u&&(M==="effects_aggregated"||M==="effects_observed");return x(Nt,{children:[n(Ct,{kpi:M,text:g(M),isSplitOrCombinedAvailable:u,isTopChart:G}),n(se,{children:s.map(y=>{const{color:E,backgroundColor:w}=C(y);return n(Bt,{dataPoint:O,dataKey:y,kpi:M,chartColor:i||E,backgroundColor:i||w,showCurrency:I,currency:r,showUnit:$,unitName:m,showDISplit:u,impactLabel:S(y),dataTestId:"MIPlus-timeline"},y)})})]},k)}).map((M,T)=>M&&n(Yo,{children:M},T));return n(oa,{content:x(Jo,{"data-test-id":`timeline-hover-legend-${k}`,children:[n(Xt,{date:k,weekStart:c,dataTop:t,dataTestId:"MIPlus-timeline-chart"}),D]}),hasOneBarOnly:N,tooltipStyleOverrides:{border:"none"},children:n(Xo,{style:{left:`${e(k)*100}%`,width:`${e.bandwidth()*100}%`}},k)},k)})})}const Jo=_("div",{target:"e2bugt23"})("padding:",({theme:e})=>e.scale.lg,";line-height:var(--default-line-height);color:#9a9a9a;display:flex;flex-direction:column;gap:",({theme:e})=>e.scale.md,";.date{color:",({theme:e})=>e.palette.greyish[50],";text-transform:uppercase;margin-bottom:",({theme:e})=>e.scale.sm,";}"),Yo=_("div",{target:"e2bugt22"})({name:"1e0dqk7",styles:"color:black"}),Xo=_("div",{target:"e2bugt21"})({name:"pghjfk",styles:"position:absolute;top:0;bottom:0;-webkit-transform:translateZ(0);:hover{background-color:#8c8c8c10;}"}),Nt=_("div",{target:"e2bugt20"})("display:flex;flex-direction:column;gap:",({theme:e})=>e.scale.md,";"),$t={dedupingInterval:240*1e3};function ma({metric:e,period:t,interval:a,filter:o,groupBy:i,filter_effect:s,stackFilters:p}){const r=b(g=>g.seqNum.activities),[c,l]=t,{url:m,defaultFilter:f}=re(),{data:u,loading:h}=Be.useData(m,{seqNum:r,startDate:c,endDate:l,interval:a,groupBy:i,metrics:e,...xe(o),...xe(f),...xe(s)},{...$t}),{data:v,loading:d}=Be.useData(m,{seqNum:r,startDate:c,endDate:l,interval:a,groupBy:i,metrics:e,...xe(s),...xe(f),...xe(p)},{...$t});return{historicalWhole:v||[],historicalPart:ie.isEmpty(o)?[]:u||[],loading:d||!ie.isEmpty(o)&&h}}function fa({socketSlug:e,period:t,filter:a={}}){const o=b(r=>r.seqNum.activities),[i,s]=t,{data:p=[]}=Be.useData("v2/activities",{modelSlug:e,seqNum:o,startDate:i,endDate:s,active:!0,...xe(a)});return U.useMemo(()=>p.map(r=>{const{startDate:c,endDate:l}=r.investmentPlans[r.activePlanId];return{id:r.id,activePlanId:r.activePlanId,name:r.activePlanName||r.name,startDate:c,endDate:l}}),[p])}const ei=({title:e,titleId:t,...a},o)=>U.createElement("svg",{width:24,height:25,viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",ref:o,"aria-labelledby":t,...a},e?U.createElement("title",{id:t},e):null,U.createElement("g",{id:"Deactivate"},U.createElement("circle",{id:"Ellipse 6",cx:12,cy:12.5,r:9,stroke:"black",strokeWidth:2}),U.createElement("path",{id:"Vector 12",d:"M5.63574 6.13605L18.3637 18.864",stroke:"black",strokeWidth:2}))),ti=U.forwardRef(ei);function ai({socketSlug:e,activePlanId:t,startDate:a,endDate:o}){const{type:i,hasLongTermData:s}=V.useSelectedModel(),p=Ne(i,s??!1),{metrics:r=[]}=la(),c=s?"effects_observed":"effects_aggregated",l=r.map(({slug:S})=>
1S).filter(Boolean),{data:m={},loading:f=!0}=Be.useData(`v4/investment-plans/${e}/${t}`,{dateRangeType:s?Je.LongTermPeriod:Je.ShortTermPeriod,metrics:l.join(",")},{dedupingInterval:240*1e3}),{url:u,defaultFilter:h}=re(),{data:v=[],loading:d=!0}=Be.useData(u,{startDate:a,endDate:o,metrics:l.join(","),...xe(h)},{dedupingInterval:240*1e3});let g;return p?s?g=m?.metricsData?.[0]?.[c]:g=m?.metricsData?.[0]?.[c]?.mean:g=m?.metricsData?.[0]?.[c]?.total??m?.metricsData?.[0]?.[c]?.["90"],{loading:f||d,actualInvestmentToDate:v?.[0]?.net_spend,actualEffectToDate:v?.[0]?.[c],recommendedInvestment:m?.metricsData?.[0]?.net_spend,plannedEffect:g}}function ni(e,t,a,o){if(!e||!t||!a||!o)return{label:"No data",accentColor:"#D4D4C9"};const i=e/a*100,p=t/o*100-i;return p<-15?{label:"Poor performance",accentColor:"#E10000",description:"Less than -15%"}:-15<=p&&p<=-5?{label:"Mediocre performance",accentColor:"#ED6666",description:"Between -15% and -5%"}:-5<p&&p<15?{label:"Good performance",accentColor:"#66E466",description:"Between -5% and +15%"}:{label:"Excellent performance",accentColor:"#00D200",description:"Exceeding 15%"}}function ha({modelConf:e,socketSlug:t,activityId:a,activePlanId:o,name:i,startDate:s,endDate:p,modeFullWidth:r,style:c={},objectiveUnitName:l,currency:m,topMetricsIsBar:f}){const u=le(),[h,v]=P.useState(!1),d=()=>{u(He({period:[s,p]})),u(Ut({activePlanId:o}))},g=$=>u(ja($)),S=()=>u(za()),{actualInvestmentToDate:C,actualEffectToDate:N,recommendedInvestment:k,plannedEffect:D}=ai({socketSlug:t,activePlanId:o,startDate:s,endDate:p}),M=Le(e),T=ni(C,N,k,D),F={borderTop:`${r?"4px":" 6px"} solid ${T?.accentColor}`},L=P.useRef(null),R=h||f&&!r,{top:G,bottom:O,...I}=c;return x(se,{children:[n(si,{ref:L,style:{...c}}),R&&n(oa,{content:n("div",{style:{margin:20},children:n(Wt,{name:i,modeFullWidth:r,startDate:s,endDate:p,performanceInfo:T,actualInvestmentToDate:C,recommendedInvestment:k,actualEffectToDate:N,plannedEffect:D,objectiveUnitName:l,currency:m,modelConf:e,socketSlug:t,labelDictionary:M,activityId:a,planId:o,deactivateActivity:g})}),children:n(ii,{style:{...c,...F},onClick:d})}),n(ri,{style:{visibility:R?"hidden":"visible",...I,...F},modeFullWidth:r,onClick:r?void 0:d,children:n(Wt,{name:i,modeFullWidth:r,startDate:s,endDate:p,performanceInfo:T,actualInvestmentToDate:C,recommendedInvestment:k,actualEffectToDate:N,plannedEffect:D,objectiveUnitName:l,currency:m,modelConf:e,socketSlug:t,labelDictionary:M,activityId:a,planId:o,deactivateActivity:g,mediaInsightsPlusRemoveSelectedActivity:S,setModeTooltip:v,activityBackdropWidth:L?.current?.clientWidth})})]})}const Wt=({modelConf:e,name:t,modeFullWidth:a,startDate:o,endDate:i,performanceInfo:s,actualInvestmentToDate:p,recommendedInvestment:r,actualEffectToDate:c,plannedEffect:l,objectiveUnitName:m,currency:f,labelDictionary:u,socketSlug:h,activityId:v,planId:d,deactivateActivity:g,mediaInsightsPlusRemoveSelectedActivity:S,setModeTooltip:C,activityBackdropWidth:N})=>{const k=st(),D=le(),{type:M,hasLongTermData:T}=V.useSelectedModel(),F=Ne(M,T),{metrics:L=[]}=la(),R=L.reduce(($,y)=>($[y.slug]=y.name,$),{}),G=`v3/export/investment-plans/${h}/${d}`,O=Ha({isBrandHealthDataAvailable:F,dateRangeType:T?Je.LongTermPeriod:Je.ShortTermPeriod}),I=P.useRef(null);return P.useLayoutEffect(()=>{const $=()=>{I?.current&&C?.(I.current.scrollWidth>I.current.clientWidth||N<200)};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[N,C]),x(se,{children:[a&&n(In,{style:{margin:"6px 46px 0px 0px",backgroundColor:"#7023A8","&:hover":{backgroundColor:"#7023A8"}},onClick:$=>{$.stopPropagation(),$.preventDefault(),D(Ga())}}),x("div",{style:{flexGrow:"1",display:"flex",flexDirection:a?"row":"column",justifyContent:a?"space-between":"start"},children:[x(Ze,{style:{marginBottom:a?"0px":"26px"},children:[n(Me,{noWrap:!0,style:{font:"inherit",fontSize:a?"18px":"16px",marginBottom:"4px",textAlign:"start"},"data-test-id":"mi-graph-activity-label",ref:I,children:t}),n(Qe,{modeFullWidth:a,children:n(Me,{noWrap:!0,style:{font:"inherit",color:a?"black":k.palette.greyish[50],textAlign:"start"},children:Ka([o,i],{showYear:!0})})})]}),x(Ze,{style:{marginBottom:a?"0px":"16px",borderLeft:`4px solid ${s?.accentColor}`,paddingLeft:6},children:[n(Qe,{modeFullWidth:a,children:n(Me,{noWrap:!0,style:{color:k.palette.greyish[50],textAlign:"start",fontSize:"12px",fontWeight:"400",marginBottom:"2px"},children:"ROI to target"})}),x(Me,{noWrap:!0,style:{font:"inherit",fontSize:a?"18px":"16px",fontWeight:"400",textAlign:"start"},children:[s?.label,s?.description&&":",n("br",{}),s?.description]})]}),x(Ze,{style:{marginBottom:a?"0px":"16px"},children:[n(Qe,{modeFullWidth:a,children:n(Me,{noWrap:!0,style:{font:"inherit",color:k.palette.greyish[25],textAlign:"start",fontSize:"12px",fontWeight:"400",marginBottom:"2px"},children:"Media investment"})}),x(Me,{noWrap:!0,style:{font:"inherit",fontSize:a?"18px":"16px",fontWeight:"400",textAlign:"start"},children:[p?`${f} ${Ee(p)} / `:"0 / ",Ee(r)]})]}),x(Ze,{children:[n(Qe,{modeFullWidth:a,children:n(Me,{noWrap:!0,style:{font:"inherit",color:k.palette.greyish[25],textAlign:"start",fontSize:"12px",fontWeight:"400",marginBottom:"2px"},children:m.toUpperCase()})}),x(Me,{noWrap:!0,style:{font:"inherit",fontSize:a?"18px":"16px",fontWeight:"400",textAlign:"start"},children:[c?`${Ee(c)} / `:"0 / ",Ee(l)]})]})]}),a&&x("div",{style:{width:"125px",height:"37px",display:"flex",justifyContent:"flex-end",alignItems:"center",gap:"18px",margin:"-1px 1px 0px 27px"},children:[n(kt,{title:"Download Buying Brief in an excel file",arrow:!0,placement:"bottom",children:n(aa,{height:20,width:20,onClick:()=>{D(Dt({message:x(se,{children:[n(ia,{size:20,sx:{color:"#fff"}})," Preparing to download"]}),isPersistent:!0,closeButton:!1})),Be.downloadBinary(G+O,`${oi(e)}`,{method:"POST",body:JSON.stringify({...u,...R}),headers:{"Content-Type":"application/json"}}).then(()=>D(gt())).catch($=>{console.error("Download failed:",$),D(gt())})}})}),n(kt,{title:"Deactivate Activity",arrow:!0,placement:"bottom",children:n(ti,{height:20,width:20,onClick:()=>{g({activityId:v,planId:d,socketSlug:h}),S()}})})]})]})};function oi(e){return`${e.brand} ${e.name}_Optimisation_${Ua()}.xlsx`}const ii=_("div",{target:"e3ieoti4"})("position:absolute;top:0;bottom:0;z-index:400;cursor:pointer;pointer-events:auto;border-left:1.5px ",({theme:e})=>e.palette.greyish[20]," solid;border-right:1.5px ",({theme:e})=>e.palette.greyish[20]," solid;"),si=_("div",{target:"e3ieoti3"})({name:"lulynl",styles:"position:absolute;top:0;bottom:0;pointer-events:none;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1)"}),ri=_("div",{target:"e3ieoti2"})("display:flex;flex-direction:",e=>e.modeFullWidth&&"row"||"column",";position:absolute;top:0;bottom:",({modeFullWidth:e})=>!e&&0,";padding:",e=>e.modeFullWidth&&"10px 15px"||"15px 20px",";text-align:",e=>e.modeFullWidth&&"center"||"default",";z-index:300;overflow:hidden;pointer-events:auto;cursor:",({modeFullWidth:e})=>e?"inherit":"pointer",";border-left:1.5px ",({theme:e})=>e.palette.greyish[20]," solid;border-right:1.5px ",({theme:e})=>e.palette.greyish[20]," solid;background-color:",({modeFullWidth:e})=>!e&&"rgba(255,255,255, 0.7)",";"),Qe=_("div",{target:"e3ieoti1"})({name:"1lfykf4",styles:"font-size:12px;text-transform:uppercase"}),Ze=_("div",{target:"e3ieoti0"})({name:"bjn8wh",styles:"position:relative"});function li({timelineChartColor:e}){const t=le(),a=b(we),o=b(tt),i=b(Qt),s=b(Ve),p=b(at),r=b(Ge),c=b(Jt),l=b(nt),m=b(Ke),f=b(qa),u=V.useSelectedModel(),h=V.useHasStackModelData(),{type:v,metrics__v1:d,socketSlug:g,
1weekStart:S,objectiveUnitName:C,currency:N,weekly:k}=u,{isFeatureAvailable:D}=_e(),M=je({stackRelationsFromStore:m}),{excludeImpactFilter:T,effectsUsed:F}=it(),L=wt(M),R=h&&D("stackedModels");P.useEffect(()=>{k&&o==="day"&&t(vt({interval:"week"}))},[o,t,k]);const{metricToPickFromConf:G}=re(),O=d?.[G]??[],I=P.useCallback((H,Q)=>{t(Oe({chartId:"top",newKpi:H})),t(Oe({chartId:"bottom",newKpi:Q}))},[t]);sa({availableMetrics:O,initCallback:I});const $=ea({isStackModelAvailable:R,stackFilters:L,filter:s,effectsUsed:F,excludeImpactFilter:T}),{top:y,bottom:E}=p,{historicalWhole:w,historicalPart:B}=ma({period:a,interval:o,filter:$,filter_effect:c,groupBy:l?"effect_type":void 0,metric:y+","+E,stackFilters:L}),K={historicalWhole:[],historicalPart:[],interval:o,maxDataValue:0,minDataValue:0,maxStackDataValue:0},W=structuredClone(K),j=structuredClone(K);let J=[];if(r==="combined"&&l){J=F;const H=(Q,be,te,pe,Se)=>{be.forEach((me,Ce)=>{const ye=te[Q].find(ze=>ze.date===me.date);ye?ye[pe]=me[Se]??0:te[Q].push({date:me.date,[pe]:me[Se]??0,index:Ce})})};F.forEach(Q=>{const be=w.filter(({effect_type:te})=>te===Q);if(H("historicalWhole",be,W,Q,y),H("historicalWhole",be,j,Q,E),B&&B.length>0){const te=B.filter(({effect_type:pe})=>pe===Q);H("historicalPart",te,W,Q,y),H("historicalPart",te,j,Q,E)}})}else J=[r],w?.length>0&&ie.forEach(w,H=>{H[y]!==void 0&&W.historicalWhole.push({date:H.date,[r]:H[y]??0}),H[E]!==void 0&&j.historicalWhole.push({date:H.date,[r]:H[E]??0})}),B?.length>0&&ie.forEach(B,(H,Q)=>{H[y]!==void 0&&W.historicalPart.push({date:H.date,[r]:H[y]??0,index:Q}),H[E]!==void 0&&j.historicalPart.push({date:H.date,[r]:H[E]??0,index:Q})});const ce=fa({socketSlug:g,period:a,filter:s}),de=a?.map(oe),ae=ta(a,o,S),Y=It().domain(ae).paddingInner(.2),Z=Wn(de,"day"),X=It().domain(Z).paddingInner(.2),Te=()=>ce.map(({id:H,activePlanId:Q,name:be,startDate:te,endDate:pe})=>{const[Se,me]=[te,pe].map(ye=>ye+"T00:00:00Z"),Ce=te===a[0]&&pe===a[1]&&l===!1;return n(ha,{activityId:H,style:{left:X(Se)!==void 0?`${X(Se)*100}%`:0,right:X(me)!==void 0?`${(1-X(me)-X.bandwidth())*100}%`:0},modelConf:u,socketSlug:g,activePlanId:Q,name:be,startDate:te,endDate:pe,modeFullWidth:Ce,objectiveUnitName:C,currency:N,period:a,topMetricsIsBar:y==="net_spend"},H)}),he=D("Activity evaluation")&&(o==="day"||o==="week")&&r==="combined",ue=(!he||ce.length===0)&&ae.length<=31&&(!l||F.length===1),fe=r==="combined"&&l===!1&&f,De=(H=>X(Qa(H)+"T00:00:00Z"))(de[1])??1,Pe=V.useModelDateRanges("media"),A=Pe.modellingEndDate,q=Pe.dataEndDate,ne=Ae(A,o,S),ee=Ae(q,o,S),ve=V.useHasLongTermData(),{xCoordinateForOverlayInLongterm:Fe,xCoordinateEndForOverlayInLongterm:Re,showOverlay:$e}=En(a,ne,ee,Y,ve),{textRef:lt}=An({xCoordinateForOverlayInLongterm:Fe,xCoordinateEndForOverlayInLongterm:Re,scaledEnd:De,period:a,interval:o,weekStart:S});return x(se,{children:[n(Fo,{}),x(ci,{children:[he&&Te(),x(di,{children:[n(Ot,{timelineChartColor:R?e:void 0,kpi:y,xScale:Y,focusMode:i,filtered:!ie.isEmpty(s),...W,labelsOn:ue,impact:r,activityFocused:fe,dataKeys:J,splitViewglobal:l,showLongtermOverlay:$e,xCoordinateForOverlayInLongterm:Fe,xCoordinateEndForOverlayInLongterm:Re,longtermOverlayStartDate:ne,hasLongTermData:ve}),n(Ot,{timelineChartColor:R?e:void 0,kpi:E,xScale:Y,focusMode:i,filtered:!ie.isEmpty(s),...j,labelsOn:ue,impact:r,activityFocused:fe,dataKeys:J,splitViewglobal:l,showLongtermOverlay:$e,xCoordinateForOverlayInLongterm:Fe,xCoordinateEndForOverlayInLongterm:Re,longtermOverlayStartDate:ne,hasLongTermData:ve}),n(_n,{showOverlay:$e,xCoordinateForOverlayInLongterm:Fe,xCoordinateEndForOverlayInLongterm:Re,textRef:lt,showEndOverlayTooltip:!0}),n(Ln,{transformDateForXscale:H=>Ae(H,o,S),xScale:Y,table:"media"})]}),n(Zo,{xScale:Y,dataTop:{kpi:y,...W},dataBottom:{kpi:E,...j},filtered:!ie.isEmpty(s),impact:r,splitViewglobal:l,modelType:v,dataKeys:J,color:R?e:void 0})]}),n(Bo,{}),n(Fn,{xScale:Y,interval:W.interval,weekStartsOn:S,firstWeekContainsDate:u?.firstWeekContainsDate||(S===1?4:1),period:a})]})}const ci=_("div",{target:"e1m1atp31"})("position:relative;width:100%;border:0.5px solid ",({theme:e})=>e.palette.greyish[20],";background-color:#f7f7f7;"),di=_("div",{target:"e1m1atp30"})({name:"bjn8wh",styles:"position:relative"});function ui(){const e=le(),t=b(tt),a=b(we),o=b(at),i=V.useSelectedModel(),{isFeatureAvailable:s}=_e(),{weekly:p}=i,{metricFlagKey:r}=re(),c=Object.values(o).some(u=>Mt(u,"dailyDisabled",r)),{configuredIntervals:l,availableIntervals:m}=Rn({period:a,weeklyModel:p}),f=m.filter(u=>c?u!=="day":!0);return P.useEffect(()=>{f.length>0&&!f.includes(t)&&e(vt({interval:f[0]}))}
1,[f,t,e]),n(bt,{help:"Change the period to activate disabled intervals."+(s("Activity evaluation")?" Change to daily/weekly to see activities.":""),value:s("Activity evaluation")?t==="day"||t==="week"?Ie[t]+" + Activities":Ie[t]:Ie[t],selected:Ie[t],options:l.map(u=>({id:u,label:s("Activity evaluation")?u==="day"||u==="week"?Ie[u]+" + Activities":Ie[u]:Ie[u],disabled:!f.includes(u)})),onChange:u=>e(vt({interval:u})),fixedWidth:"100%"})}const pi=()=>{const e=le(),t=b(nt),a=b(Ge),o=b(St),i=V.useSelectedModel(),s=V.useHasStackModelData(),{stackParticipants:p}=V.useStackModelMetaData(),{isFeatureAvailable:r}=_e(),c=s&&r("stackedModels"),{currency:l,mediaInsightsPlus__impact_per_dimension_v1:m=zt,type:f,hasLongTermData:u}=i,h=Le(i),v=P.useMemo(()=>V.getAvailableDimensionsForModel(m,f,u??!1,a),[m,f,u,a]),[d,g]=P.useState(()=>Ye(v??[],p,c));P.useEffect(()=>{g(k=>{const D=Ye(v??[],p,c,k);return e(Xe({dimensionOptions:D,nextLevel:!0})),D})},[v,p,c,e]),P.useEffect(()=>{a!=="combined"&&e(yt({splitViewglobal:!1}))},[a,e]);const S=P.useMemo(()=>Ne(f,u??!1),[f,u]);return x(Ja,{title:"DATA VIEW",children:[S&&n(lo,{splitView:t,setSplitView:k=>{e(yt({splitViewglobal:k}))},impact:a}),n(Gn,{title:"Time granularity",children:n(ui,{})}),d?.filter(k=>!k.isStackParticipant).length>1&&n(Hn,{dimensionOptions:d.filter(k=>!k.isStackParticipant),setDimensionOptions:k=>{let D=Za(d,k);o==="mediaDrivers"&&(D=D.filter(M=>!M.isStackParticipant)),g(D),e(Xe({dimensionOptions:D,nextLevel:!0}))},labelDictionary:h,checkMetricFlag:Mt,currency:l})]})};function mi(){const e=le(),t=V.useSelectedModel(),{stackParticipants:a,labels:o}=V.useStackModelMetaData(),{metrics__v1:i,objectiveUnitName:s}=t,{metricToPickFromConf:p}=re(),r=i?.[p]??[],c=Le(t),l=b(Ke),m=b(we),f=b(Ve),u=b(et),h=b(St),v=je({stackRelationsFromStore:l}),d=wt(v),g=Ye(u?.filter(y=>!y.isStackParticipant)?.map(y=>y.value)??[],a,!0),S=Ya(g),{data:C,loading:N}=Kn({period:m,metrics:r.filter(y=>y.slug==="effects_aggregated"||y.slug==="net_spend"),filter:{}}),k=C?.combined?.effects_aggregated??0,D=C?.combined?.net_spend??0,{data:M=[],loading:T,isRefreshing:F}=co({stateStackRelations:l,startDate:m?.[0],endDate:m?.[1],labelDictionary:c,totalLabel:o.total,filter:{...d,...f},url:On+"/"+t.modelHandle+"/media",metrics:r.map(y=>y.slug).includes("effects_aggregated")?"effects_aggregated,net_spend":"net_spend",getTooltipData:y=>uo({item:y,totalValue:k,objectiveUnitName:s?.toLowerCase(),getExtraRowsForDetails:()=>[{label:"Investment share",value:ho(y.net_spend,D)}]})}),L=U.useMemo(()=>po(v,o)??[],[v,o]),R=U.useCallback((y,E)=>Xa(c,y,E),[c]),G=U.useMemo(()=>v.filter(y=>y.isSelected),[v]),O=U.useCallback(y=>{const{meta:E}=y,w=typeof E?.dimensionKey=="string"?E.dimensionKey:void 0,B=E?.dimensionValue;if(!w||w==="total"||B==null)return;const W=S.map(Z=>Z.value).indexOf(w);if(W===-1||W>=S.length-1||!S[W].isStackParticipant)return;const J=String(B),ce=At(v,w,J),de=a[a.length-1],ae=mo({stackRelations:ce,visibleStackRelations:G,stackParticipants:a,labelDictionary:c,labels:o}).slug,Y=de===w;if(Y&&h==="stacks"&&e(qt({increaseLevel:!0,dimensionOptions:u??[],cardsGroupBy:S[W+1]?.value,filter:void 0})),ae!==J){const Z=Y?void 0:a[W+1];e(ht({stackRelations:ce,...Z!==void 0&&h==="stacks"?{cardsGroupBy:Z}:{}}))}},[S,v,a,G,c,o,h,e,u]),I=U.useCallback((y,E)=>{const w=y==="total"?v.map(j=>({...j,isSelected:!0})):At(v,y,String(E)),K=S.map(j=>j.value).indexOf(y),W=a[K+1];e(ht({stackRelations:w,...W!==void 0&&h==="stacks"&&{cardsGroupBy:W}}))},[v,S,a,e,h]),$=U.useCallback(y=>{const{dimensionKey:E,dimensionValue:w}=y?.meta??{};!E||w==null||I(E,w)},[I]);return x(se,{children:[n(en,{breadcrumbs:L.map((y,E)=>{const w=R(y.meta.dimensionValue,y.meta.dimensionKey);return{label:w,onClick:E<L.length-1?()=>$(y):void 0,tooltip:E<L.length-1?`Return to ${w} view`:void 0}}),styles:{container:{textTransform:"none",marginBottom:"5px"}}}),n("div",{children:n(fo,{data:M,onNodeClick:O,isLoading:T||N,isRefreshing:F,dataTestId:"media-insights-icicle-chart",emptyStateMessage:"No icicle chart data",config:{zoom:{enabled:!1}}})})]})}function Ht(e){return{historicalWhole:[],historicalPart:[],interval:e,maxDataValue:0,minDataValue:0,maxStackDataValue:0}}function fi({historicalWhole:e=[],historicalPart:t=[],top:a,bottom:o,interval:i,impact:s,splitViewglobal:p,effectsUsed:r}){const c=Ht(i),l=Ht(i);let m=[];const f=e??[],u=t??[];if(s==="combined"&&p){m=[...r];const h=D=>{const M=new Map;return D.forEach(T=>{const F=T.effect_type;if(F===void 0)return;const L=M.get(F);L?L.push(T):M.set(F,[T])}),M},v=h(f),d=h(u),g=(D,M,T,F)=>{M.forEach((L,R)=>{const G=L.date;if(G===null)return;const O=L[F]??0,I=D.get(G);I?I[T]=O:D.set(G,{date:G,[T]:O,index:R})})},S=new Map,C=new Map,N=new Map,k=new Map;r.forEach(D=>{const M=v.get(D)??[];g(S,M,D,a),g(C,M,D,o);const T=d.get(D)??[];g(N,T,D,a),g(k,T,D,o)}),c.historicalWhole=[...S.values()],l.historicalWhole=[...C.values()],c.historicalPart=[...N.values()],l.historicalPart=[...k.values()]}else m=[s],f.forEach(h=>{h[a]!==void 0&&c.historicalWhole.push({date:h.date,[s]:h[a]??0}),h[o]!==void 0&&l.historicalWhole.push({date:h.date,[s]:h[o]??0})}),u.forEach((h,v)=>{h[a]!==void 0&&c.historicalPart.push({date:h.date,[s]:h[a]??0,index:v}),h[o]!==void 0&&l.historicalPart.push({date:h.date,[s]:h[o]??0,index:v})});return{dataTop:c,dataBottom:l,dataKeys:m}}function hi(e){if(e==null)return NaN;if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="string"){const t=Date.parse(e);return Number.isNaN(t)?NaN:t}if(typeof e=="object"&&typeof e.getTime=="function"){const t=e.getTime();return typeof t=="number"&&Number.isFinite(t)?t:NaN}return NaN}function gi(e){const t=hi(e);return Number.isFinite(t)?tn(t,"yyyy-MM-dd"):""}function vi({payload:e,interval:t,weekStart:a}){const o=to(e);return!e?.points?.length||!o?null:rn.createPortal(n(bi,{payload:e,interval:t,weekStart:a}),o)}function bi({payload:e,interval:t,weekStart:a}){const{category:o,points:i}=e,s=gi(o),p=Gt(i.filter(c=>c.yAxisIndex===0)),r=Gt(i.filter(c=>c.yAxisIndex===1));return x(yi,{"data-test-id":"media-insights-dual-pane-tooltip",children:[n(Xt,{date:s,weekStart:a,dataTop:{interval:t},dataTestId:"MIPlus-dual-pane-chart"}),n(Vt,{metricName:p.metricName,rows:p.rows}),n(Vt,{metricName:r.metricName,rows:r.rows})]})}function Gt(e){return{metricName:e[0]?.metricName,rows:e.map((t,a)=>({id:t.seriesId??`${t.seriesName}-${a}`,label:t.seriesName,value:t.y,color:t.color,indicatorKind:t.indicatorKind}))}}const yi=_("div",{target:"e8cwvgg0"})("padding:",({theme:e})=>e.scale.lg,";background-color:",({theme:e})=>e.palette.common.white,";box-shadow:0px 4px 20px 3px rgba(0, 0, 0, 0.1);line-height:var(--default-line-height);color:",({theme:e})=>e.palette.blackish.main,";display:flex;flex-direction:column;gap:",({theme:e})=>e.scale.md,";.date{color:",({theme:e})=>e.palette.greyish[50],";text-transform:uppercase;margin-bottom:",({theme:e})=>e.scale.sm,";}"),ki=.2;function Di(e){const[t,a]=e;if(t==null||a==null)return[];const o=oe(t),i=oe(a),s=Yt(i,o)+1;return s<=0?[]:Array.from({length:s},(p,r)=>an(jn(o,{days:r})))}function Si(e,t,a){const o=Di(a);if(o.length===0)return{left:0,right:0};const s=1/o.length,p=s*(1-ki),r=`${e}T00:00:00Z`,c=`${t}T00:00:00Z`,l=o.indexOf(r),m=o.indexOf(c),f=l===-1?0:l*s*100,u=m===-1?0:(1-(m*s+p))*100;return{left:`${Math.max(0,f)}%`,right:`${Math.max(0,u)}%`}}const Mi=440;function xi(){const e=st(),t=le(),{isFeatureAvailable:a}=_e(),o=b(we),i=b(tt),s=b(Ve),p=b(Jt),r=b(at),c=b(Ge),l=b(nt),m=b(Ke),f=V.useSelectedModel(),u=V.useHasStackModelData(),{stackParticipants:h,stackRelations:v,labels:d}=V.useStackModelMetaData(),{weekStart:g=1,metrics__v1:S,socketSlug:C,objectiveUnitName:N,currency:k}=f,D=Le(f),M=u&&a("stackedModels"),T=je({stackRelationsFromStore:m}),F=U.useMemo(()=>T.filter(z=>z.isSelected),[T]),L=U.useMemo(()=>T.length>0?T:v,[T,v]),R=ca({stackRelations:L,visibleStackRelations:F,stackParticipants:h,labelDictionary:D,labels:d}),G=M?R.color:void 0,O=wt(T),{metricToPickFromConf:I,metricFlagKey:$}=re(),y=S?.[I]??[],E=ot($),{effectsUsed:w,excludeImpactFilter:B}=it(),{top:K,bottom:W}=r,j=fa({socketSlug:C,period:o,filter:s}),J=a("Activity evaluation")&&(i==="day"||i==="week")&&c==="combined",ce=P.useCallback((z,ke)=>{t(Oe({chartId:"top",newKpi:z})),t(Oe({chartId:"bottom",newKpi:ke}))},[t]);sa({availableMetrics:y,initCallback:ce});const de=ea({isStackModelAvailable:M,stackFilters:O,filter:s,effectsUsed:w,excludeImpactFilter:B}),{historicalWhole:ae,historicalPart:Y,loading:Z}=ma({period:o,interval:i,filter:de,filter_effect:p,groupBy:l?"effect_type":void 0,stackFilters:O,metric:`${K},${W}`}),{dataTop:X,dataBottom:Te,dataKeys:he}=P.useMemo(()=>fi({historicalWhole:ae,historicalPart:Y,top:K,bottom:W,interval:i,impact:c,splitViewglobal:l,effectsUsed:w}),[W,w,Y,ae,c,i,l,K]),ue=na(),fe=xt(),ge=P.useCallback(z=>ue(z)??String(z),[ue]),De=P.useCallback((z,{kpi:ke})=>G||(ke==="net_spend"?e.palette.primary.main:fe(z).color),[fe,e.palette.primary.main,G]),Pe=E(K),A=E(W),q=U.useMemo(()=>Lt({kpi:K,metricLabel:Pe,historicalWhole:X.historicalWhole,historicalPart:X.historicalPart,dataKeys:he,splitViewglobal:l,getEffectLabel:ge,getSeriesColor:De,paneId:"top"}),[K,Pe,X,he,l,ge,De]),ne=U.useMemo(()=>Lt({kpi:W,metricLabel:A,historicalWhole:Te.historicalWhole,historicalPart:Te.historicalPart,dataKeys:he,splitViewglobal:l,getEffectLabel:ge,getSeriesColor:De,paneId:"bottom"}),[W,A,Te,he,l,ge,De]),ee=Array.isArray(o)&&o.length===2,ve=Ft(q)||Ft(ne),Fe=P.useCallback(({period:z})=>{t(He({period:z}))},[t]),[Re,$e]=P.useState(null),lt=P.useCallback(z=>{$e(ke=>ao(ke,z)?ke:z)},[]),H=V.useModelDateRanges("media"),Q=oe(Ae(H.modellingEndDate,i,g)).getTime(),be=oe(Ae(H.dataEndDate,i,g)).getTime(),te=oe(Ae(H.dataStartDate,i,g)).getTime(),pe=f?.customPeriodSelector?.date,Se=pe?oe(Ae(pe,i,g)).getTime():null,me=V.useHasLongTermData(),Ce=U.useMemo(()=>ee?ta(o,i,g):[],[ee,o,i,g]),ye=U.useMemo(()=>Ce.map(z=>oe(z).getTime()),[Ce]),ze=ye.length>=2?ye[1]-ye[0]:0,Ue=P.useMemo(()=>
1({theme:e,hasLongTermData:me,modellingStartMs:Se,trainingPeriodStartMs:te,columnWidthMs:ze,longtermOverlayStartMs:Q,longtermOverlayEndMs:be}),[e,me,Se,te,ze,Q,be]),ga=P.useMemo(()=>no(Ue),[Ue]),va=P.useMemo(()=>oo(Ue),[Ue]),ba=U.useMemo(()=>{const z={groupPadding:.01,pointPadding:.1};return i==="month"||i==="week"||i==="quarter"||i==="year"?z:(ee?Yt(o[1],o[0]):0)>=210?{groupPadding:0,pointPadding:0,borderWidth:0}:z},[i,ee,o]),ya=(!J||j.length===0)&&Ce.length<=31&&(!l||w.length===1)&&(!me||(l?w.length===1:w.length>=1)),ka=!ee||Z,Da=U.useMemo(()=>f?.firstWeekContainsDate||(g===1?4:1),[f?.firstWeekContainsDate,g]);return x(Pi,{children:[ka&&x(se,{children:[n(Qn,{}),n(Zn,{width:"100%",height:370,variant:"rectangular"})]}),ee&&!Z&&x(se,{children:[n(vi,{payload:Re,interval:i,weekStart:g}),x(wi,{children:[n(io,{topPane:q,bottomPane:ne,chartHeight:Mi,onTooltipChange:lt,overlapBackgroundColumns:ve,plotLineArray:ga,plotBandArray:va,columnPadding:ba,isMarkerEnabled:ya,interval:i,weekStartsOn:g,firstWeekContainsDate:Da,axisDates:ye}),J&&j.map(({id:z,activePlanId:ke,name:Sa,startDate:ct,endDate:dt})=>{const Tt=ct===o[0]&&dt===o[1]&&l===!1,Ma=Tt?{left:0,right:0}:Si(ct,dt,o);return n(Ti,{style:Ma,children:n(ha,{activityId:z,style:{left:0,right:0,top:0,bottom:0},modelConf:f,socketSlug:C,activePlanId:ke,name:Sa,startDate:ct,endDate:dt,modeFullWidth:Tt,objectiveUnitName:N,currency:k,topMetricsIsBar:K==="net_spend"})},z)})]}),n(ra,{period:o,changePeriodFn:Fe})]})]})}const wi=_("div",{target:"eft41032"})({name:"bjn8wh",styles:"position:relative"}),Ti=_("div",{target:"eft41031"})("position:absolute;top:0;bottom:",so,"px;z-index:1;pointer-events:none;"),Pi=_("div",{target:"eft41030"})("margin-top:",({theme:e})=>e.scale["2xl"],";width:100%;position:relative;overflow:visible;padding-bottom:",({theme:e})=>e.scale["3xl"],";"),ft=[{id:"cards",label:"Cards"},{id:"dataTable",label:"Data table"}];function zi(){const e=le(),t=b(we),a=b(Kt),o=b(nn),i=b(St),s=b(et),p=b(Ke),r=b(jt),c=V.useSelectedModel(),l=V.useHasStackModelData(),{stackParticipants:m,stackRelations:f,labels:u}=V.useStackModelMetaData(),{type:h,hasLongTermData:v,metrics__v1:d,objectiveUnitName:g}=c,{isFeatureAvailable:S}=_e(),{metricToPickFromConf:C}=re(),N=Le(c),k=d?.[C]??[],D=je({stackRelationsFromStore:p}),M=D.filter(w=>w.isSelected),T=s?.find(w=>w.value===r),[F,L]=P.useState("cards"),R=P.useMemo(()=>D.filter(w=>w.isSelected),[D]),G=P.useMemo(()=>D.length>0?D:f,[D,f]),O=ca({stackRelations:G,visibleStackRelations:R,stackParticipants:m,labelDictionary:N,labels:u}),I=l&&S("stackedModels"),$=!I,y=S("Timeseries Highchart"),E=P.useMemo(()=>Ne(h,v),[h,v]);return P.useEffect(()=>{E||e(yt({splitViewglobal:!1}))},[E,e,h]),!t||!a||k.length===0?null:x("div",{"data-test-id":"mediaInsightsPlus",children:[n(go,{stackModelFilterTitleSuffix:I?O:void 0,defaultPeriod:o?.period,showComparisonPeriod:$}),n(pi,{}),n(qe,{header:I?`Media performance over time - ${O.label}`:"Media performance over time",styles:{container:{paddingTop:"20px"}},staggeredIndex:0,children:n(We,{fallbackTitle:"Media Insights Timeline Chart",children:n(li,{timelineChartColor:O.color})})}),y?n(xi,{}):null,I&&n(qe,{header:`Media-driven ${g} - ${O.label}`,dataTestId:"miIcicleChartSection",styles:{container:{paddingBottom:"10px"}},staggeredIndex:1,children:n(We,{fallbackTitle:"Media Drivers Icicle Chart",children:n(mi,{})})}),x(qe,{header:I?`Media performance summary - ${O.label}`:"Media performance summary",staggeredIndex:I?2:1,actions:I&&x(se,{children:[F!=="dataTable"&&(T?.isStackParticipant||M?.length>1)&&n(bt,{value:pt?.find(w=>w.id===i)?.label,selected:pt?.find(w=>w.id===i)?.label,options:pt,onChange:w=>{if(e(on({stackView:w})),w==="mediaDrivers")e(Xe({dimensionOptions:s.filter(B=>!B.isStackParticipant),nextLevel:!1}));else{const B=Ye(s.filter(K=>!K.isStackParticipant).map(K=>K.value),m,I);e(Xe({dimensionOptions:B,nextLevel:!0}))}},title:"SHOW",dataTestId:"media-performance-summary-show-option"}),n(bt,{value:ft?.find(w=>w.id===F)?.label,selected:ft?.find(w=>w.id===F)?.label,options:ft,onChange:L,title:"VIEW AS",dataTestId:"media-performance-summary-view-as-option"})]}),children:[(!I||F==="cards")&&n(We,{fallbackTitle:"Media Insights Cards",children:n(zn,{titleSuffix:O.label})}),F==="dataTable"&&I&&n(We,{fallbackTitle:"Media Overview Table",children:n(Et,{})})]}),!I&&n(qe,{header:"Media performance data table",styles:{container:{paddingBottom:"0px"}},staggeredIndex:2,children:n(We,{fallbackTitle:"Media Overview Table",children:n(Et,{})})})]})}export{zi as default};
2//# sourceMappingURL=index-DLwQ18k6.js.map

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.