PageSourceSearch

https://app.ololand.ai/assets/ValuationScenariosView-BhAUcbTK.js

js ololand.ai collected 2026-10-05 12:21:22 UTC 9,887 bytes, 1 lines download raw bytes

1import{r as d,j as e,ag as A,ac as T,a1 as E,a2 as L,a3 as B,a4 as D,bt as F,a5 as y,a9 as K,aI as M}from"./vendor-CJ3Pa3Ob.js";import{s as O,R as z}from"./RealOptionsPanel-BBuOp2FV.js";import{cJ as G}from"./index-CT7QwV5N.js";const P={recession:"#64748b",rate_spike:"#f59e0b",sector_downturn:"#f43f5e",credit_crunch:"#ef4444",stagflation:"#a855f7"},I={revenue_growth:"Revenue Growth",ebitda_margin:"EBITDA Margin",wacc:"WACC",terminal_growth:"Terminal Growth"},N=r=>`${(r*100).toFixed(1)}%`,U=({active:r,payload:i,label:o,isDark:s})=>!r||!i||i.length===0?null:e.jsxs("div",{className:`border-theme-divider bg-theme-surface rounded-lg border px-3 py-2 text-xs shadow-lg ${s?"text-white/80":"text-theme-text-secondary"}`,children:[e.jsx("p",{className:"mb-1 font-medium",children:o}),i.map(n=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full",style:{backgroundColor:n.color}}),e.jsxs("span",{children:[n.name,":"]}),e.jsx("span",{className:"font-semibold tabular-nums",children:N(n.value)})]},n.dataKey))]}),V=({scenarios:r,baseParams:i,isDark:o})=>{const s=d.useMemo(()=>["revenue_growth","ebitda_margin","wacc","terminal_growth"].map(l=>{const p={parameter:I[l],base:i[l]??0};return r.forEach(g=>{p[g.scenario_type]=g.applied_params[l]}),p}),[r,i]),n=d.useMemo(()=>[...new Set(r.map(a=>a.scenario_type))],[r]),h=o?{grid:"rgba(255,255,255,0.04)",axis:"rgba(255,255,255,0.3)",baseLine:"rgba(255,255,255,0.25)"}:{grid:"rgba(0,0,0,0.04)",axis:"rgba(0,0,0,0.35)",baseLine:"rgba(0,0,0,0.2)"};return r.length===0?e.jsx("div",{className:`flex items-center justify-center rounded-lg border py-12 text-sm ${o?"border-white/[0.06] text-white/30":"border-theme-divider text-theme-text-muted"}`,children:"Run a stress test to see scenario comparison."}):e.jsx("div",{className:"w-full",children:e.jsx(A,{width:"100%",height:340,children:e.jsxs(T,{data:s,margin:{top:8,right:16,bottom:4,left:8},barCategoryGap:"20%",barGap:2,children:[e.jsx(E,{strokeDasharray:"3 3",stroke:h.grid,vertical:!1}),e.jsx(L,{dataKey:"parameter",tick:{fontSize:11,fill:h.axis},axisLine:!1,tickLine:!1}),e.jsx(B,{tickFormatter:a=>N(a),tick:{fontSize:10,fill:h.axis},axisLine:!1,tickLine:!1,width:56}),e.jsx(D,{content:e.jsx(U,{isDark:o}),cursor:{fill:o?"rgba(255,255,255,0.03)":"rgba(0,0,0,0.03)"}}),e.jsx(F,{wrapperStyle:{fontSize:11,paddingTop:8},formatter:a=>a.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase())}),e.jsx(y,{dataKey:"base",name:"Base Case",fill:o?"#6366f1":"#4f46e5",radius:[2,2,0,0],children:s.map((a,l)=>e.jsx(K,{opacity:.5},l))}),n.map(a=>e.jsx(y,{dataKey:a,name:a.replace(/_/g," ").replace(/\b\w/g,l=>l.toUpperCase()),fill:P[a]??"#94a3b8",radius:[2,2,0,0]},a)),s.map(a=>e.jsx(M,{y:a.base,stroke:h.baseLine,strokeDasharray:"4 3",strokeWidth:1,ifOverflow:"extendDomain"},`ref-${a.parameter}`))]})})})},W=[{id:"recession",label:"Recession"},{id:"rate_spike",label:"Rate Spike"}
1,{id:"sector_downturn",label:"Sector Downturn"},{id:"credit_crunch",label:"Credit Crunch"},{id:"stagflation",label:"Stagflation"}],Y=["mild","moderate","severe"],q={revenue_growth:"Revenue Growth",ebitda_margin:"EBITDA Margin",wacc:"WACC",terminal_growth:"Terminal Growth"},H={revenue_growth:.08,ebitda_margin:.25,wacc:.1,terminal_growth:.025},v=r=>`${(r*100).toFixed(1)}%`,J=r=>`${r>0?"+":""}${(r*100).toFixed(1)}pp`,X=({dealId:r,baseParams:i})=>{const{resolvedTheme:o}=G(),s=o==="dark",[n,h]=d.useState(new Set(["recession","rate_spike"])),[a,l]=d.useState("moderate"),[p,g]=d.useState(!1),[f,w]=d.useState(null),[m,S]=d.useState(null),j=m?.base_params??i??H,C=d.useCallback(t=>{h(x=>{const c=new Set(x);return c.has(t)?c.delete(t):c.add(t),c})},[]),k=d.useCallback(async()=>{if(n.size!==0){g(!0),w(null);try{const t=await O.stressTest(r,{scenario_types:Array.from(n),severity:a,...i?{base_params:i}:{}});S(t)}catch(t){w(t instanceof Error?t.message:"Stress test request failed.")}finally{g(!1)}}},[r,j,n,a]);return e.jsxs("div",{className:"space-y-0",children:[e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-theme-text text-lg font-semibold tracking-tight",children:"Scenario Stress Testing"}),e.jsxs("span",{className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-widest ${s?"bg-amber-950/60 text-amber-400 ring-1 ring-amber-800/40":"bg-
1amber-50 text-amber-700 ring-1 ring-amber-200"}`,children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),n.size," selected"]})]}),e.jsx("p",{className:"text-theme-text-secondary mt-1 text-xs",children:"Apply macro-economic stress scenarios to base DCF assumptions"}),!i&&e.jsx("p",{className:"text-theme-text-secondary mt-2 text-[11px]",children:"Base parameters will auto-load from the latest financial snapshot when you run the analysis."})]})}),e.jsxs("div",{className:"mt-5 space-y-3",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:W.map(({id:t,label:x})=>{const c=n.has(t);return e.jsx("button",{type:"button",onClick:()=>C(t),className:`rounded-lg px-3 py-1.5 text-xs font-medium transition-all ${c?s?"text-white ring-1 ring-white/20 dark:bg-white/10":"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/20":s?"text-white/40 ring-1 ring-white/[0.06] hover:text-white/60 dark:bg-white/[0.03] dark:hover:bg-white/[0.06]":"bg-background text-muted-foreground ring-1 ring-border hover:bg-muted/60 hover:text-foreground"}`,children:x},t)})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("select",{value:a,onChange:t=>l(t.target.value),className:`border-theme-divider rounded-lg px-3 py-1.5 text-xs font-medium ring-1 transition-all ${s?"text-white/70 ring-white/10 dark:bg-white/[0.04]":"bg-theme-surface text-theme-text-secondary ring-[var(--theme-divider)]"}`,children:Y.map(t=>e.jsx("option",{value:t,children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsx("button",{type:"button",onClick:()=>{k()},disabled:p||n.size===0,className:`flex items-center gap-1.5 rounded-lg px-4 py-1.5 text-xs font-medium transition-all ${s?"bg-[var(--theme-button-primary-bg)] text-[var(--theme-button-primary-text)] hover:bg-[var(--theme-button-primary-hover)] disabled:opacity-40":"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground disabled:opacity-100"}`,children:p?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-current border-t-transparent"}),"Running..."]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M4 2l10 6-10 6V2z"})}),"Run Stress Test"]})})]})]}),f&&e.jsx("div",{className:`mt-4 rounded-lg border px-4 py-3 text-xs ${s?"border-red-800/40 bg-red-900/10 text-red-400":"border-red-200 bg-red-50 text-red-700"}`,children:f}),m&&m.scenarios.length>0&&e.jsxs("div",{className:"mt-6 space-y-6",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:`border-b ${s?"border-white/[0.06]":"border-theme-divider"}`,children:[e.jsx("th",{className:`px-3 py-2 text-left font-medium ${s?"text-white/40":"text-theme-text-muted"}`,children:"Parameter"}),e.jsx("th",{className:`px-3 py-2 text-right font-medium ${s?"text-white/40":"text-theme-text-muted"}`,children:"Base"}),m.scenarios.map(t=>e.jsx("th",{className:`px-3 py-2 text-right font-medium ${s?"text-white/60":"text-theme-text-secondary"}`,children:t.scenario_type.replace(/_/g," ").replace(/\b\w/g,x=>x.toUpperCase())},t.scenario_type))]})}),e.jsx("tbody",{children:["revenue_growth","ebitda_margin","wacc","terminal_growth"].map(t=>{const x=j[t],c=Q(t);return e.jsxs("tr",{className:`border-b ${s?"border-white/[0.03] dark:hover:bg-white/[0.02]":"border-theme-divider hover:bg-theme-surface-light"}`,children:[e.jsx("td",{className:`px-3 py-2.5 font-medium ${s?"text-white/60":"text-theme-text-secondary"}`,children:q[t]}),e.jsx("td",{className:`px-3 py-2.5 text-right font-semibold tabular-nums ${s?"text-white/70":"text-theme-text-secondary"}`,children:v(x)}),m.scenarios.map(u=>{const R=u.applied_params[t],b=c?u.deltas[c]:0,$=t==="wacc"?b>0:b<0;return e.jsxs("td",{className:"px-3 py-2.5 text-right",children:[e.jsx("span",{className:`font-semibold tabular-nums ${s?"text-white/80":"text-theme-text"}`,children:v(R)}),e.jsx("span",{className:`ml-1.5 text-[10px] font-medium tabular-nums ${$?s?"text-red-400":"text-red-600":s?"text-emerald-400":"text-emerald-600"}`,children:J(b)})]},u.scenario_type)})]},t)})})]})}),e.jsx(V,{scenarios:m.scenarios,baseParams:m.base_params,isDark:s})]}),e.jsx("div",{className:`mt-6 border-t pt-3 ${s?"border-white/[0.06]":"border-theme-divider"}`,children:e.jsx("p",{className:`text-[10px] ${s?"text-white/30":"text-theme-text-muted"}`,children:"Stress scenarios apply calibrated shocks to base DCF assumptions. Severity levels scale shock magnitude (mild 1x, moderate 2x, severe 3x)."})})]})};function Q(r){return{revenue_growth:"revenue_growth_delta",ebitda_margin:"margin_compression",wacc:"wacc_delta",terminal_growth:"terminal_growth_delta"}[r]??null}const _=({children:r})=>e.jsx("h3",{className:"font-display text-theme-text text-[13px] font-semibold",children:r}),se=({dealId:r})=>e.jsxs("div",{className:"@container flex min-h-0 flex-col gap-6",children:[e.jsxs("section",{className:"flex min-w-0 flex-col gap-2","aria-label":"Stress test",children:[e.jsx(_,{children:"Stress test"}),e.jsx(X,{dealId:r})]}),e.jsxs("section",{className:"flex min-w-0 flex-col gap-2","aria-label":"Real options",children:[e.jsx(_,{children:"Real options"}),e.jsx(z,{dealId:r})]})]});
1export{se as ValuationScenariosView,se as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.