1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[778],{72894:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 2 * @license lucide-react v0.294.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let a=(0,s(62898).Z)("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},68291:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 7 * @license lucide-react v0.294.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */let a=(0,s(62898).Z)("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},89416:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 12 * @license lucide-react v0.294.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */let a=(0,s(62898).Z)("BarChart2",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]])},92457:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 17 * @license lucide-react v0.294.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */let a=(0,s(62898).Z)("BarChart3",[["path",{d:"M3 3v18h18",key:"1s2lah"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]])},92919:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 22 * @license lucide-react v0.294.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */let a=(0,s(62898).Z)("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]])},28203:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 27 * @license lucide-react v0.294.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */let a=(0,s(62898).Z)("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]])},6141:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 32 * @license lucide-react v0.294.0 - ISC 33 * 34 * This source code is licensed under the ISC license. 35 * See the LICENSE file in the root directory of this source tree. 36 */let a=(0,s(62898).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},97332:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 37 * @license lucide-react v0.294.0 - ISC 38 * 39 * This source code is licensed under the ISC license. 40 * See the LICENSE file in the root directory of this source tree. 41 */let a=(0,s(62898).Z)("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},41298:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 42 * @license lucide-react v0.294.0 - ISC 43 * 44 * This source code is licensed under the ISC license. 45 * See the LICENSE file in the root directory of this source tree. 46 */let a=(0,s(62898).Z)("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]])},43030:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 47 * @license lucide-react v0.294.0 - ISC 48 * 49 * This source code is licensed under the ISC license. 50 * See the LICENSE file in the root directory of this source tree. 51 */let a=(0,s(62898).Z)("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]])},45479:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 52 * @license lucide-react v0.294.0 - ISC 53 * 54 * This source code is licensed under the ISC license. 55 * See the LICENSE file in the root directory of this source tree. 56 */let a=(0,s(62898).Z)("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},36678:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 57 * @license lucide-react v0.294.0 - ISC 58 * 59 * This source code is licensed under the ISC license. 60 * See the LICENSE file in the root directory of this source tree. 61 */let a=(0,s(62898).Z)("ShieldCheck",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},49036:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 62 * @license lucide-react v0.294.0 - ISC 63 * 64 * This source code is licensed under the ISC license. 65 * See the LICENSE file in the root directory of this source tree. 66 */let a=(0,s(62898).Z)("Shield",[["path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10",key:"1irkt0"}]])},33673:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 67 * @license lucide-react v0.294.0 - ISC 68 * 69 * This source code is licensed under the ISC license. 70 * See the LICENSE file in the root directory of this source tree. 71 */let a=(0,s(62898).Z)("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]])},82549:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});/** 72 * @license lucide-react v0.294.0 - ISC 73 * 74 * This source code is licensed under the ISC license. 75 * See the LICENSE file in the root directory of this source tree. 76 */let a=(0,s(62898).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
76],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},55463:function(e,t,s){Promise.resolve().then(s.bind(s,90176))},90176:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return tl}});var a=s(57437),r=s(2265),l=s(62898);/** 77 * @license lucide-react v0.294.0 - ISC 78 * 79 * This source code is licensed under the ISC license. 80 * See the LICENSE file in the root directory of this source tree. 81 */let n=(0,l.Z)("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2h0V5z",key:"uf6l00"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h0",key:"k2aug8"}]]);var i=s(89416),o=s(28203),c=s(49036);/** 82 * @license lucide-react v0.294.0 - ISC 83 * 84 * This source code is licensed under the ISC license. 85 * See the LICENSE file in the root directory of this source tree. 86 */let d=(0,l.Z)("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);var m=s(90998),x=s(52369),u=s(85790),p=s(92919);/** 87 * @license lucide-react v0.294.0 - ISC 88 * 89 * This source code is licensed under the ISC license. 90 * See the LICENSE file in the root directory of this source tree. 91 */let h=(0,l.Z)("Award",[["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}],["path",{d:"M15.477 12.89 17 22l-5-3-5 3 1.523-9.11",key:"em7aur"}]]),b=(0,l.Z)("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);var f=s(41298),g=s(45253),y=s(74542),v=s(16573),j=s(24235),_=s(50039),N=s(86812),w=s(79857),k=s(19223),S=s(1657),R=s(10826),F=s(11918);let C={low:150,mid:175,high:250},M={low:300,mid:400,high:500};function P(e){var t;let{label:s,eurPerKwh:r,capacityMwh:l,tone:n,headerColor:i,anchor:o,highlight:c}=e;return(0,a.jsxs)("div",{className:"rounded-lg border p-4 ".concat(n," ").concat(c?"ring-2 ring-blue-400/40":""),children:[(0,a.jsx)("div",{className:"mb-1 text-xs uppercase tracking-wide text-slate-400",children:s}),(0,a.jsx)("div",{className:"text-2xl font-bold ".concat(i),children:(t=r*l*1e3)>=1e6?"â¬".concat((t/1e6).toFixed(2),"M"):t>=1e3?"â¬".concat((t/1e3).toFixed(0),"k"):"â¬".concat(t.toFixed(0))}),(0,a.jsxs)("div",{className:"mt-1 text-sm text-slate-300",children:["â¬",r.toFixed(0)," / kWh"]}),o&&(0,a.jsx)("div",{className:"mt-2 text-xs text-blue-300/80",children:o})]})}var A=function(e){let{capacityMwh:t,powerMw:s,band:r=C,bandEuTypical:l=M,midAnchorNote:n="Anchored on your â¬3.5M quote (Huawei) for 10 MW / 20 MWh",className:i=""}=e;return(0,a.jsxs)("section",{className:"space-y-5 ".concat(i),children:[(0,a.jsxs)("header",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-slate-100",children:"CAPEX bands â Romanian vendor anchor vs European bankability"}),(0,a.jsxs)("p",{className:"text-xs text-slate-400",children:["Total project cost for"," ",(0,a.jsxs)("span",{className:"font-medium text-slate-200",children:[s.toFixed(0)," MW / ",t.toFixed(0)," MWh"]})," ","at six â¬/kWh-installed reference points."]})]}),(0,a.jsx)(F.oU,{label:"Likely-source / Scenario",short:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"mb-2 text-xs font-mono uppercase text-emerald-300",children:"Romanian vendor quotes (your reference)"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[(0,a.jsx)(P,{label:"Sermatec-equivalent",eurPerKwh:r.low,capacityMwh:t,tone:"border-emerald-500/30 bg-emerald-500/5",headerColor:"text-emerald-300"}),(0,a.jsx)(P,{label:"Huawei anchor (your quote)",eurPerKwh:r.mid,capacityMwh:t,tone:"border-blue-500/40 bg-blue-500/10 ring-1 ring-blue-500/30",headerColor:"text-blue-200",anchor:n,highlight:!0}),(0,a.jsx)(P,{label:"Premium tier-1",eurPerKwh:r.high,capacityMwh:t,tone:"border-amber-500/30 bg-amber-500/5",headerColor:"text-amber-300"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"mb-2 text-xs font-mono uppercase text-rose-300",children:"European bankability anchors (what lenders underwrite to)"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[(0,a.jsx)(P,{label:"EU low (turnkey, lean BoP)",eurPerKwh:l.low,capacityMwh:t,tone:"border-rose-500/30 bg-rose-500/5",headerColor:"text-rose-300"}),(0,a.jsx)(P,{label:"EU typical (full EPC + grid + civils)",eurPerKwh:l.mid,capacityMwh:t,tone:"border-rose-500/30 bg-rose-500/10",headerColor:"text-rose-200",anchor:"What banks (BCR / BRD / EBRD) will model against"}),(0,a.jsx)(P,{label:"EU high (premium spec + contingency)",eurPerKwh:l.high,capacityMwh:t,tone:"border-rose-500/30 bg-rose-500/5",headerColor:"text-rose-300"})]}),(0,a.jsxs)("p",{className:"mt-2 text-xs text-slate-400",children:["Your vendor quote at â¬",r.mid,"/kWh is exceptional â typical European BESS EPC including grid connection, BoP, civils, and contingency runs â¬",l.low,"ââ¬",l.high,"/kWh. ROI calculated on the vendor anchor will be 2â3\xd7 higher than what a Romanian project-finance bank actually underwrites to."]})]})]})};/** 92 * @license lucide-react v0.294.0 - ISC 93 * 94 * This source code is licensed under the ISC license. 95 * See the LICENSE file in the root directory of this source tree. 96 */let Z=(0,l.Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]),E=["year","scenario","gross_revenue_eur","energy_cost_eur","operating_cost_eur","debt_service_eur","auxiliary_cost_eur","augmentation_cost_eur","tariff_exemption_eur","fx_hedge_cost_eur","capacity_factor","cumulative_efc","warranty_status","cfads_eur","dscr","net_profit_eur","cumulative_profit_eur"],D=new Set(["gross_revenue_eur","energy_cost_eur","operating_cost_eur","debt_service_eur","auxiliary_cost_eur","augmentation_cost_eur","tariff_exemption_eur","fx_hedge_cost_eur","cfads_eur","net_profit_eur","cumulative_profit_eur"]),z=new Set(["capacity_factor","cumulative_efc","dscr"]);function q(e){return/[",\r\n]/.test(e)?'"'.concat(e.replace(/"/g,'""'),'"'):e}function I(e,t){if(null==t)return"";if("year"===e){let e=Number(t);return Number.isFinite(e)?String(Math.trunc(e)):""}if("scenario"===e||"warranty_status"===e)return q(String(t));if(D.has(e)){let e=Number(t);return Number.isFinite(e)?e.toFixed(2):""}if(z.has(e)){let e=Number(t);return Number.isFinite(e)?e.toFixed(4):""}return q(String(t))}var U=function(e){var t,s;let{frCashflow:r,pzuCashflow:l,params:n,disabled:i=!1,className:o=""}=e,c=(null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0)===0&&(null!==(s=null==l?void 0:l.length)&&void 0!==s?s:0)===0,d=i||c;return(0,a.jsxs)("button",{type:"button",onClick:()=>
96{if(d)return;let e=function(e,t){let s=[];s.push(E.map(e=>q(String(e))).join(","));let a=(e,t)=>E.map(s=>"scenario"===s?I("scenario",t):I(s,e[s])).join(",");for(let t of e)s.push(a(t,"FR"));for(let e of t)s.push(a(e,"PZU"));return s.join("\r\n")}(null!=r?r:[],null!=l?l:[]),t=new Blob(["\uFEFF"+e],{type:"text/csv;charset=utf-8;"}),s=URL.createObjectURL(t),a=document.createElement("a");a.href=s,a.download=function(e){var t,s;let a=null!==(t=null==e?void 0:e.power_mw)&&void 0!==t?t:"NA",r=null!==(s=null==e?void 0:e.capacity_mwh)&&void 0!==s?s:"NA";return"bess_cashflow_".concat(a,"MW_").concat(r,"MWh_").concat(function(){let e=new Date,t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(t).concat(s).concat(a)}(),".csv")}(n),document.body.appendChild(a),a.click(),document.body.removeChild(a),setTimeout(()=>URL.revokeObjectURL(s),0)},disabled:d,title:d?"Run the analysis first to enable cashflow export":"Download FR + PZU cashflow projection as CSV",className:"inline-flex items-center gap-2 rounded-lg border border-slate-700 bg-slate-800 px-3 py-2 text-xs sm:text-sm font-mono uppercase tracking-wide text-slate-200 hover:bg-slate-700 hover:border-[#00ffd1]/40 hover:text-[#00ffd1] transition-colors disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-slate-800 disabled:hover:border-slate-700 disabled:hover:text-slate-200 "+o,children:[(0,a.jsx)(Z,{className:"h-4 w-4"}),"Export Cashflow CSV"]})};/** 97 * @license lucide-react v0.294.0 - ISC 98 * 99 * This source code is licensed under the ISC license. 100 * See the LICENSE file in the root directory of this source tree. 101 */let L=(0,l.Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),O=(0,l.Z)("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);async function B(e){try{var t,s;if(null===(s=navigator)||void 0===s?void 0:null===(t=s.clipboard)||void 0===t?void 0:t.writeText)return await navigator.clipboard.writeText(e),!0}catch(e){}try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let s=document.execCommand("copy");return document.body.removeChild(t),s}catch(e){return!1}}function T(e){let{getUrl:t,className:s=""}=e,[l,n]=(0,r.useState)(!1),i=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let o=(0,r.useCallback)(async()=>{let e=(()=>{try{return t()}catch(e){return window.location.href}})();e&&await B(e)&&(n(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>n(!1),2e3))},[t]);return(0,a.jsx)("button",{type:"button",onClick:o,"aria-label":"Share scenario URL",className:s||"inline-flex items-center gap-2 rounded-lg border border-slate-600 bg-slate-800 px-3 py-2 text-xs sm:text-sm text-white hover:border-[#00ffd1] hover:text-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]",children:l?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{className:"w-4 h-4 text-[#00ffd1]"}),(0,a.jsx)("span",{children:"Copied!"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Share scenario"})]})})}/** 102 * @license lucide-react v0.294.0 - ISC 103 * 104 * This source code is licensed under the ISC license. 105 * See the LICENSE file in the root directory of this source tree. 106 */let W=(0,l.Z)("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),G=(0,l.Z)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]),K="bess_scenario_v1",V=["power_mw","capacity_mwh","total_investment_eur"];function Y(e){return e<10?"0".concat(e):String(e)}function H(e){let{params:t,analysis:s,onImport:l,disabled:n=!1,className:i=""}=e,[o,c]=(0,r.useState)({kind:"idle"}),d=(0,r.useRef)(null),m=(0,r.useRef)(null);(0,r.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let x=(0,r.useCallback)((e,t)=>{c(e),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c({kind:"idle"}),t)},[]),u=(0,r.useCallback)(()=>{try{var e,a,r,l,n,i,o,c,d,m;
106let x={schema_version:K,exported_at:new Date().toISOString(),params:t,analysis_snapshot:s?{fr_y1:null!==(n=null==s?void 0:null===(e=s.fr_scenario)||void 0===e?void 0:e.net_profit_after_debt_eur)&&void 0!==n?n:null,pzu_y1:null!==(i=null==s?void 0:null===(a=s.pzu_scenario)||void 0===a?void 0:a.net_profit_after_debt_eur)&&void 0!==i?i:null,fr_irr:null!==(c=null!==(o=null==s?void 0:s.fr_lifetime_irr_pct)&&void 0!==o?o:null==s?void 0:null===(r=s.fr_scenario)||void 0===r?void 0:r.roi_percentage)&&void 0!==c?c:null,pzu_irr:null!==(m=null!==(d=null==s?void 0:s.pzu_lifetime_irr_pct)&&void 0!==d?d:null==s?void 0:null===(l=s.pzu_scenario)||void 0===l?void 0:l.roi_percentage)&&void 0!==m?m:null}:null},u=JSON.stringify(x,null,2),p=new Blob([u],{type:"application/json"}),h=URL.createObjectURL(p),b=document.createElement("a");b.href=h,b.download=function(e){var t,s;let a=Number(null!==(t=null==e?void 0:e.power_mw)&&void 0!==t?t:0),r=Number(null!==(s=null==e?void 0:e.capacity_mwh)&&void 0!==s?s:0);return"bess_scenario_".concat(a,"MW_").concat(r,"MWh_").concat(function(){let e=new Date;return"".concat(e.getFullYear()).concat(Y(e.getMonth()+1)).concat(Y(e.getDate()))}(),".json")}(t),document.body.appendChild(b),b.click(),document.body.removeChild(b),URL.revokeObjectURL(h)}catch(e){console.error("[ScenarioJsonButtons] export failed",e),x({kind:"error",message:"Export failed"},3e3)}},[t,s,x]),p=(0,r.useCallback)(()=>{var e;n||null===(e=d.current)||void 0===e||e.click()},[n]),h=(0,r.useCallback)(e=>{var t;let s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",!s)return;if(s.size>1048576){x({kind:"error",message:"File too large (max 1MB)"},3e3);return}let a=new FileReader;a.onerror=()=>{console.error("[ScenarioJsonButtons] read error",a.error),x({kind:"error",message:"Could not read file"},3e3)},a.onload=()=>{let e;let t="string"==typeof a.result?a.result:"";try{e=JSON.parse(t)}catch(e){console.error("[ScenarioJsonButtons] JSON parse error",e),x({kind:"error",message:"Invalid JSON file"},3e3);return}let s=function(e){if(!e||"object"!=typeof e)return{ok:!1,error:"File is not a valid scenario object"};if(e.schema_version!==K)return{ok:!1,error:"Unsupported file version"};let t=e.params;if(!t||"object"!=typeof t||Array.isArray(t))return{ok:!1,error:"Missing params object"};for(let e of V)if(!(e in t)||"number"!=typeof t[e]||!Number.isFinite(t[e]))return{ok:!1,error:"Missing or invalid field: ".concat(e)};return{ok:!0,params:t}}(e);if(!s.ok){console.error("[ScenarioJsonButtons] validation failed",s.error),x({kind:"error",message:s.error},3e3);return}try{l(s.params),x({kind:"success",message:"Imported"},2e3)}catch(e){console.error("[ScenarioJsonButtons] onImport threw",e),x({kind:"error",message:"Import handler failed"},3e3)}},a.readAsText(s)},[x,l]),b=i||"inline-flex items-center gap-2 rounded-lg border border-slate-600 bg-slate-800 px-3 py-2 text-xs sm:text-sm text-white hover:border-[#00ffd1] hover:text-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px] disabled:opacity-50 disabled:cursor-not-allowed",f="success"===o.kind?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(L,{className:"w-4 h-4 text-[#00ffd1]"}),(0,a.jsxs)("span",{children:["Imported ",String.fromCharCode(10003)]})]}):"error"===o.kind?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(W,{className:"w-4 h-4 text-red-400"}),(0,a.jsx)("span",{className:"truncate max-w-[14ch]",title:o.message,children:o.message})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(G,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Import JSON"})]});return(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:u,disabled:n,"aria-label":"Export scenario as JSON",className:b,children:[(0,a.jsx)(Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Export JSON"})]}),(0,a.jsx)("button",{type:"button",onClick:p,disabled:n,"aria-label":"Import scenario from JSON","aria-live":"polite",className:b,children:f}),(0,a.jsx)("input",{ref:d,type:"file",accept:".json,application/json",className:"hidden",onChange:h})]})}var X=s(36678),J=s(72894);/** 107 * @license lucide-react v0.294.0 - ISC 108 * 109 * This source code is licensed under the ISC license. 110 * See the LICENSE file in the root directory of this source tree. 111 */let $=(0,l.Z)("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),Q=[{name:"anre_license_status",label:"ANRE License Status",description:"ANRE Order 6/2025 license category (storage/trader/supplier/producer). Most upstream gate â blocks ALL revenue if missing."},{name:"brp_pre_responsibility",label:"BRP / PRE Responsibility",description:"BRP/PRE responsibility (own or delegated). Required by Reg. 2019/943 Art. 5. Blocks ALL market revenue if missing."},{name:"opcom_short_term_participant",label:"OPCOM Short-Term Participant",description:"OPCOM PZU/IDM participant registration â required for day-ahead/intraday arbitrage."},{name:"fse_bsp_convention",label:"FSE / BSP Convention",description:"FSE/BSP convention with Transelectrica for aFRR/mFRR participation (ANRE Order 127/2021)."},{name:"damas_access",label:"DAMAS Access",description:"Active DAMAS account for FR product bidding/settlement."},{name:"capacity_reserve_auction_register",label:"Capacity Reserve Auction Register",description:"Registered in the capacity reserve auction register (aFRR/mFRR)."},{name:"rsf_fcr_qualification",label:"RSF / FCR Qualification",description:"Separate RSF qualification + contract for FCR â NOT covered by aFRR/mFRR registration."},{name:"settlement_account_and_guarantees",label:"Settlement Account & Guarantees",description:"OPCOM/Transelectrica financial guarantees deposited; settlement account active."},{name:"telemetry_and_metering",label:"Telemetry & Metering",description:"Real-time telemetry to TSO + ANRE-conformant settlement metering."},{name:"remit_acknowledgement",label:"REMIT Acknowledgement",description:"Reg. 1227/2011 â registered with ACER (if applicable), inside information policy in place."},{name:"storage_tariff_exemption_metering",label:"Storage Tariff Exemption Metering",description:"Metering capable of distinguishing stored/reinjected energy under Law 123 Art. 66\xb3 + ANRE Order 56/2025."}],ee=Q.reduce((e,t)=>
111(e[t.name]="not_declared",e),{});function et(e){let t=[];return"qualified"!==e.anre_license_status?t.push("ALL revenue (no ANRE-recognized activity)"):"qualified"!==e.brp_pre_responsibility?t.push("ALL market revenue (no BRP/PRE)"):("qualified"!==e.opcom_short_term_participant&&t.push("PZU / IDM arbitrage"),("qualified"!==e.fse_bsp_convention||"qualified"!==e.damas_access||"qualified"!==e.capacity_reserve_auction_register)&&t.push("aFRR / mFRR capacity + activation"),"qualified"!==e.rsf_fcr_qualification&&t.push("FCR (RSF)"),"qualified"!==e.storage_tariff_exemption_metering&&t.push("Storage tariff exemption (avoided cost) per Law 123 Art. 66\xb3")),t}let es=[{value:"not_declared",label:"Not declared",activeClasses:"bg-slate-700 text-slate-100 border-slate-500"},{value:"in_progress",label:"In progress",activeClasses:"bg-amber-600/30 text-amber-200 border-amber-500"},{value:"qualified",label:"Qualified",activeClasses:"bg-emerald-600/30 text-emerald-200 border-emerald-500"}];var ea=function(e){let{value:t,onChange:s,blockedStreams:r,className:l=""}=e,n=Q.filter(e=>"qualified"===t[e.name]).length,i=Q.length,o=n/i*100,c=function(e){for(let t of Q)if("qualified"!==e[t.name])return t.name;return null}(t),d=null!=r?r:et(t),m=d.length>0,x=(e,a)=>s({...t,[e]:a}),u=n===i?"linear-gradient(90deg, #10b981, #00ffd1)":n>0?"linear-gradient(90deg, #f59e0b, #00ffd1)":"#475569";return(0,a.jsxs)("div",{className:"rounded-lg border border-slate-700 bg-slate-900/50 ".concat(l),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 sm:px-4 py-2 sm:py-3 border-b border-slate-700",children:[(0,a.jsx)(X.Z,{className:"w-4 h-4 text-[#00ffd1]"}),(0,a.jsx)("h3",{className:"text-xs sm:text-sm font-semibold uppercase tracking-wider text-slate-300",children:"Compliance Gates Wizard"}),(0,a.jsxs)("span",{className:"ml-auto text-[10px] sm:text-xs text-slate-400 font-mono",children:[n," of ",i," qualified"]})]}),(0,a.jsxs)("div",{className:"px-3 sm:px-4 pt-3",children:[(0,a.jsx)("div",{className:"h-2 w-full rounded-full bg-slate-800 overflow-hidden",children:(0,a.jsx)("div",{className:"h-full transition-all duration-300",style:{width:"".concat(o,"%"),background:u}})}),(0,a.jsx)("p",{className:"mt-1 text-[10px] sm:text-xs text-slate-400",children:0===n?"No gates qualified yet â every revenue stream is currently blocked.":n===i?"All gates qualified â revenue streams unlocked.":"".concat(n," of ").concat(i," gates qualified.")})]}),(0,a.jsx)("div",{className:"p-3 sm:p-4 space-y-2",children:Q.map(e=>{let s=t[e.name],r=c===e.name,l=r?"border-amber-500/60 bg-amber-500/5":"qualified"===s?"border-emerald-700/40 bg-emerald-900/10":"border-slate-700 bg-slate-900/40";return(0,a.jsx)("div",{className:"rounded border p-2 sm:p-3 transition-colors ".concat(l),children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsx)("p",{className:"text-xs sm:text-sm font-semibold text-white",children:e.label}),r&&(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded bg-amber-500/20 border border-amber-500/40 px-1.5 py-0.5 text-[9px] sm:text-[10px] uppercase tracking-wider text-amber-200",children:[(0,a.jsx)(J.Z,{className:"w-3 h-3"})," Fix first"]})]}),(0,a.jsx)("p",{className:"mt-0.5 text-[10px] sm:text-[11px] text-slate-400 leading-snug",children:e.description})]}),(0,a.jsx)("div",{role:"radiogroup","aria-label":"".concat(e.label," status"),className:"inline-flex shrink-0 rounded border border-slate-700 overflow-hidden self-start",children:es.map(t=>{let r=s===t.value;return(0,a.jsx)("button",{type:"button",role:"radio","aria-checked":r,onClick:()=>x(e.name,t.value),className:"px-2 sm:px-2.5 py-1 text-[10px] sm:text-[11px] font-medium border-r last:border-r-0 transition-colors ".concat(r?t.activeClasses:"bg-slate-900 text-slate-400 border-slate-700 hover:bg-slate-800 hover:text-slate-200"),children:t.label},t.value)})})]})},e.name)})}),(0,a.jsx)("div",{className:"border-t border-slate-700 p-3 sm:p-4",children:m?(0,a.jsxs)("div",{className:"rounded border border-amber-500/40 bg-amber-500/5 p-2 sm:p-3",children:[(0,a.jsxs)("p",{className:"text-[10px] sm:text-[11px] uppercase tracking-wider text-amber-300 font-semibold mb-1.5 flex items-center gap-1",children:[(0,a.jsx)(J.Z,{className:"w-3 h-3"})," Revenue streams currently blocked"]}),(0,a.jsx)("ul",{className:"space-y-1 text-[11px] sm:text-xs text-amber-100/80",children:d.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-1.5",children:[(0,a.jsx)("span",{className:"text-amber-500 mt-0.5",children:"â¸"}),(0,a.jsx)("span",{children:e})]},t))})]}):(0,a.jsxs)("div",{className:"rounded border border-emerald-500/40 bg-emerald-500/5 p-2 sm:p-3 flex items-center gap-2",children:[(0,a.jsx)($,{className:"w-4 h-4 text-emerald-400 shrink-0"}),(0,a.jsx)("p",{className:"text-[11px] sm:text-xs text-emerald-200",children:"All revenue streams unlocked â every compliance gate is qualified."})]})})]})},er=s(6141),el=s(53711);let en=[{id:"mari",name:"MARI go-live (aFRR/mFRR)",effective_date:"2026-04-01",impact:"Min bid raises 1 MW â 5 MW for aFRR/mFRR. Smaller assets aggregate or exit.",severity:"critical",source_url:"https://www.entsoe.eu/network_codes/eb/mari/"},{id:"picasso_ro",name:"PICASSO connection â Romania",effective_date:"2026-12-01",impact:"Cross-border aFRR exchange begins. Expect 25-45% Romanian activation-price compression toward EU baseline.",severity:"warning",source_url:"https://www.entsoe.eu/network_codes/eb/picasso/"},{id:"anre_60_2024",name:"ANRE Order 60/2024 â pay-as-bid",effective_date:"2024-10-01",impact:"Settlement switched marginal â pay-as-bid. Already in effect for all current backtests.",severity:"info",source_url:"https://legislatie.just.ro/Public/DetaliiDocumentAfis/287809"}],ei={critical:{border:"border-red-500/40",dot:"bg-red-500",chip:"bg-red-500/15 border-red-500/40",chipText:"text-red-300",label:"CRITICAL"}
111,warning:{border:"border-amber-500/40",dot:"bg-amber-400",chip:"bg-amber-500/10 border-amber-500/30",chipText:"text-amber-300",label:"WARNING"},info:{border:"border-slate-600",dot:"bg-slate-400",chip:"bg-slate-700/40 border-slate-600",chipText:"text-slate-300",label:"INFO"}};var eo=function(e){let{className:t=""}=e,s=(0,r.useMemo)(()=>{let e=function(){let e=new Date,t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(s,"-").concat(a)}(),t=en.map(t=>{let s=function(e,t){let s=Date.parse("".concat(e,"T00:00:00Z"));return Math.round((Date.parse("".concat(t,"T00:00:00Z"))-s)/864e5)}(e,t.effective_date);return{...t,status:s>=0?"upcoming":"past",days:s}});return t.sort((e,t)=>e.status!==t.status?"upcoming"===e.status?-1:1:"upcoming"===e.status?e.days-t.days:t.days-e.days),t},[]);return(0,a.jsxs)("div",{className:"space-y-3 ".concat(t),children:[(0,a.jsx)("ol",{className:"relative border-l border-slate-700 ml-2",children:s.map(e=>{let t=ei[e.severity],s="past"===e.status;return(0,a.jsxs)("li",{className:"ml-4 mb-3 last:mb-0",children:[(0,a.jsx)("span",{className:"absolute -left-[7px] flex h-3.5 w-3.5 items-center justify-center rounded-full ring-2 ring-slate-900 ".concat(t.dot),"aria-hidden":"true"}),(0,a.jsxs)("div",{className:"rounded-lg border bg-slate-900/60 p-3 ".concat(t.border),children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1.5",children:[(0,a.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wider border ".concat(t.chip," ").concat(t.chipText),children:t.label}),(0,a.jsx)("h4",{className:"text-sm font-semibold text-white",children:e.name}),(0,a.jsxs)("span",{className:"text-[11px] font-mono text-slate-400 flex items-center gap-1",children:[(0,a.jsx)(o.Z,{className:"w-3 h-3"}),e.effective_date]}),(0,a.jsxs)("span",{className:"ml-auto text-[11px] font-mono flex items-center gap-1 ".concat(s?"text-emerald-300":"text-[#00ffd1]"),children:[s?(0,a.jsx)($,{className:"w-3.5 h-3.5"}):(0,a.jsx)(er.Z,{className:"w-3.5 h-3.5"}),function(e,t){let s=Math.abs(e);if("upcoming"===t){if(0===s)return"today";if(1===s)return"1 day to go";if(s<31)return"".concat(s," days to go");if(s<365){let e=Math.round(s/30);return 1===e?"~1 month to go":"~".concat(e," months to go")}let e=(s/365).toFixed(1);return"~".concat(e," years to go")}if(0===s)return"effective today";if(1===s)return"1 day ago";if(s<31)return"".concat(s," days ago");if(s<365){let e=Math.round(s/30);return 1===e?"~1 month ago":"~".concat(e," months ago")}let a=(s/365).toFixed(1);return"~".concat(a," years ago")}(e.days,e.status)]})]}),(0,a.jsxs)("p",{className:"text-[11px] sm:text-xs text-slate-300",children:[(0,a.jsx)("span",{className:"text-slate-400 uppercase tracking-wider text-[9px] mr-1",children:"Revenue impact:"}),e.impact]}),e.source_url&&(0,a.jsxs)("a",{href:e.source_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 mt-1.5 text-[10px] sm:text-[11px] text-[#00ffd1] hover:text-[#00ffd1]/80 hover:underline",children:["Source ",(0,a.jsx)(el.Z,{className:"w-3 h-3"})]})]})]},e.id)})}),(0,a.jsxs)("p",{className:"text-[10px] text-slate-400 flex items-center gap-1",children:[(0,a.jsx)(J.Z,{className:"w-3 h-3"}),"Dates for upcoming milestones are estimates; actuals subject to TSO/regulator timing."]})]})};let ec=e=>Number.isFinite(e)?"".concat((100*e).toFixed(1),"%"):"â",ed=e=>Number.isFinite(e)?new Intl.NumberFormat("en-US",{style:"currency",currency:"EUR",maximumFractionDigits:0}).format(e):"â",em=e=>Number.isFinite(e)&&e<100?"".concat(e.toFixed(1)," yr"):"â";function ex(e){let{label:t,p10:s,p50:r,p90:l,format:n}=e;return[s,r,l].every(e=>Number.isFinite(e))?(0,a.jsxs)("div",{className:"grid grid-cols-4 items-center gap-2 text-sm",children:[(0,a.jsx)("span",{className:"font-mono uppercase text-slate-400",children:t}),(0,a.jsxs)("span",{className:"text-rose-300",children:["P10 ",n(s)]}),(0,a.jsxs)("span",{className:"font-bold text-emerald-300",children:["P50 ",n(r)]}),(0,a.jsxs)("span",{className:"text-blue-300",children:["P90 ",n(l)]})]}):(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsx)("span",{className:"font-mono text-slate-400",children:t}),(0,a.jsx)("span",{className:"text-slate-400",children:"â (degenerate runs)"})]})}var eu=function(e){let{data:t}=e;return(0,a.jsxs)("div",{className:"rounded border border-slate-700 bg-slate-800/40 p-4",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-sm font-mono uppercase text-slate-300",children:"Monte Carlo P10 / P50 / P90"}),(0,a.jsxs)("span",{className:"text-[10px] text-slate-400",children:[t.runs," runs"]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(ex,{label:"IRR",p10:t.p10_irr,p50:t.p50_irr,p90:t.p90_irr,format:ec}),(0,a.jsx)(ex,{label:"NPV",p10:t.p10_npv,p50:t.p50_npv,p90:t.p90_npv,format:ed}),(0,a.jsx)(ex,{label:"Payback",p10:t.p10_payback_yr,p50:t.p50_payback_yr,p90:t.p90_payback_yr,format:em})]}),(0,a.jsx)("div",{className:"mt-3 text-[10px] text-slate-400",children:"Driver triangulars (min, mode, max): activation 5/10/20%, RTE 85/88/90%, Y1 degradation 2.0/2.5/3.5%, FX 4.85/5.00/5.20 RON/EUR, PZU spread 85/100/115%."})]})},ep=s(44909),eh=s(27978),eb=s(31346),ef=s(92457);let eg="#f59e0b",ey="#22d3ee",ev="#34d399",ej="#94a3b8",e_=e=>Number.isFinite(e)?"".concat((100*e).toFixed(1),"%"):"â";var eN=function(e){let{irrSamples:t,p10:s,p50:r,p90:l,meanIrr:n,className:i="",loading:o=!1}=e,c="rounded border border-slate-700 bg-slate-800/40 p-4 ".concat(i).trim();if(o)return(0,a.jsxs)("div",{className:c,children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,a.jsx)(ef.Z,{className:"h-4 w-4 text-slate-400"}),(0,a.jsx)("h3",{className:"font-mono text-sm uppercase text-slate-300",children:"IRR Distribution"})]}),(0,a.jsx)("div",{className:"h-64 animate-pulse rounded bg-slate-700/30"})]});if(!t||0===t.length)return(0,a.jsxs)("div",{className:c,children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center gap-2",children:[(0,a.jsx)(ef.Z,{className:"h-4 w-4 text-slate-400"}),(0,a.jsx)("h3",{className:"font-mono text-sm uppercase text-slate-300",children:"IRR Distribution"})]}),(0,a.jsx)("div",{className:"flex h-64 items-center justify-center text-sm text-slate-400",children:"Run sensitivity to see distribution"})]});let d=function(e){if(0===e.length)return[];let t=e.filter(e=>Number.isFinite(e));if(0===t.length)return[];let s=Math.min(...t),a=Math.max(...t);if(a===s)return[{binStart:s,binEnd:s,binMid:s,count:t.length,label:e_(s)}];let r=(a-s)/25,l=Array.from({length:25},(e,t)=>{let a=s+t*r;return{binStart:a,binEnd:a+r,binMid:a+r/2,count:0,label:e_(a+r/2)}});for(let e of t){let t=Math.floor((e-s)/r);t>=25&&(t=24),t<0&&(t=0),l[t].count+=1}return l}(t);return(0,a.jsxs)("div",{className:c,children:[(0,a.jsxs)("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(ef.Z,{className:"h-4 w-4 text-[#22d3ee]"}),(0,a.jsx)("h3",{className:"font-mono text-sm uppercase text-slate-300",children:"IRR Distribution"})]}),(0,a.jsxs)("span",{className:"text-[10px] text-slate-400",children:[t.length," samples ⢠",d.length," bins"]})]}),(0,a.jsxs)("div",{className:"mb-3 flex flex-wrap gap-3 text-xs",children:[(0,a.jsxs)("span",{className:"text-amber-400",children:["P10 ",e_(s)]}),(0,a.jsxs)("span",{className:"font-bold text-cyan-300",children:["P50 ",e_(r)]}),(0,a.jsxs)("span",{className:"text-emerald-300",children:["P90 ",e_(l)]}),(0,a.jsxs)("span",{className:"text-slate-400",children:["Mean ",e_(n)]})]}),(0,a.jsx)("div",{className:"h-64",children:(0,a.jsx)(g.h,{width:"100%",height:"100%",children:(0,a.jsxs)(ep.v,{data:d,margin:{top:8,right:12,left:0,bottom:8},children:[(0,a.jsx)(v.q,{strokeDasharray:"3 3",stroke:"#334155"}),(0,a.jsx)(j.K,{dataKey:"binMid",type:"number",domain:["dataMin","dataMax"],tick:{f
111ill:"#94a3b8",fontSize:10},axisLine:{stroke:"#475569"},tickLine:{stroke:"#475569"},tickFormatter:e=>"".concat((100*e).toFixed(1),"%")}),(0,a.jsx)(_.B,{tick:{fill:"#94a3b8",fontSize:10},axisLine:{stroke:"#475569"},tickLine:{stroke:"#475569"},allowDecimals:!1}),(0,a.jsx)(N.u,{contentStyle:{backgroundColor:"#1e293b",border:"1px solid #475569",borderRadius:"6px",color:"#fff",fontSize:"12px"},formatter:e=>["".concat(e," runs"),"Count"],labelFormatter:e=>"IRR â ".concat((100*e).toFixed(2),"%")}),Number.isFinite(s)&&(0,a.jsx)(eh.d,{x:s,stroke:eg,strokeWidth:2,label:{value:"P10",position:"top",fill:eg,fontSize:10}}),Number.isFinite(r)&&(0,a.jsx)(eh.d,{x:r,stroke:ey,strokeWidth:2,label:{value:"P50",position:"top",fill:ey,fontSize:10}}),Number.isFinite(l)&&(0,a.jsx)(eh.d,{x:l,stroke:ev,strokeWidth:2,label:{value:"P90",position:"top",fill:ev,fontSize:10}}),Number.isFinite(n)&&(0,a.jsx)(eh.d,{x:n,stroke:ej,strokeWidth:1.5,strokeDasharray:"4 4",label:{value:"Mean",position:"insideTopRight",fill:ej,fontSize:10}}),(0,a.jsx)(eb.$,{dataKey:"count",fill:"#475569",stroke:"#64748b"})]})})}),(0,a.jsx)("div",{className:"mt-2 text-[10px] text-slate-400",children:"Histogram of Monte Carlo IRR realisations. Tail width â project risk; skew indicates whether downside or upside dominates."})]})};let ew=e=>new Intl.NumberFormat("en-US",{style:"currency",currency:"EUR",maximumFractionDigits:0}).format(e);var ek=function(e){let{rows:t,violationYears:s=[]}=e;if(!(null==t?void 0:t.length))return(0,a.jsx)("div",{className:"rounded border border-slate-700 bg-slate-800/40 p-6 text-sm text-slate-400",children:"No cashflow rows to display."});let r=new Set(s);return(0,a.jsxs)("div",{className:"overflow-x-auto rounded border border-slate-700 bg-slate-800/40",children:[(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsxs)("caption",{className:"px-3 py-2 text-left font-mono text-xs uppercase text-slate-300",children:["DSCR per year (covenant: ⥠","1.20",")"]}),(0,a.jsx)("thead",{className:"bg-slate-900/60 text-[11px] uppercase text-slate-400",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 py-2 text-left",children:"Year"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"CFADS"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Debt service"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"DSCR"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Capacity"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Warranty"}),(0,a.jsx)("th",{className:"px-3 py-2 text-right",children:"Augmentation"})]})}),(0,a.jsx)("tbody",{children:t.map(e=>{let t=e.debt_service_eur>0&&e.dscr>0&&e.dscr<1.2||r.has(e.year);return(0,a.jsxs)("tr",{className:t?"bg-rose-900/40 text-rose-200":"exceeded"===e.warranty_status?"bg-amber-900/30 text-amber-200":"odd:bg-slate-900/30",children:[(0,a.jsx)("td",{className:"px-3 py-1 font-mono",children:e.year}),(0,a.jsx)("td",{className:"px-3 py-1 text-right",children:ew(e.cfads_eur)}),(0,a.jsx)("td",{className:"px-3 py-1 text-right",children:ew(e.debt_service_eur)}),(0,a.jsx)("td",{className:"px-3 py-1 text-right font-mono",children:e.debt_service_eur>0?e.dscr.toFixed(2):"â"}),(0,a.jsxs)("td",{className:"px-3 py-1 text-right",children:[(100*e.capacity_factor).toFixed(1),"%"]}),(0,a.jsx)("td",{className:"px-3 py-1 text-right",children:"exceeded"===e.warranty_status?(0,a.jsx)("span",{className:"text-amber-300",children:"EXCEEDED"}):(0,a.jsx)("span",{className:"text-emerald-300",children:"ok"})}),(0,a.jsx)("td",{className:"px-3 py-1 text-right",children:e.augmentation_cost_eur>0?ew(e.augmentation_cost_eur):"â"})]},e.year)})})]}),s.length>0&&(0,a.jsxs)("p",{className:"border-t border-slate-700 px-3 py-2 text-xs text-rose-300",children:["Lender covenant DSCR < ","1.20"," in years:"," ",s.join(", "),". Consider lower gearing or longer tenor."]})]})},eS=s(36612);let eR=e=>Number.isFinite(e)?new Intl.NumberFormat("en-US",{style:"currency",currency:"EUR",maximumFractionDigits:0}).format(e):"â",eF=e=>Number.isFinite(e)?"â¬".concat((e/1e3).toFixed(0),"K"):"â",eC={FR:"#00ffd1",PZU:"#2563eb"};var eM=function(e){let{cashflow:t,dscr_violation_years:s,scenario_name:r,covenant:l=1.2}=e;if(!t||0===t.length)return(0,a.jsxs)("div",{className:"rounded border border-slate-700 bg-slate-900/60 p-6 text-sm text-slate-400",children:["No ",r," cashflow projection available â run the analysis first."]});let n=t.filter(e=>{var t;return(null!==(t=e.debt_service_eur)&&void 0!==t?t:0)>0}),i=n.length,o=new Set(null!=s?s:[]),c=n.map(e=>{var t,s,a;let r=null!==(t=e.cfads_eur)&&void 0!==t?t:0,n=null!==(s=e.debt_service_eur)&&void 0!==s?s:0,i=null!==(a=e.dscr)&&void 0!==a?a:n>0?r/n:0,c=o.has(e.year)||n>0&&i<l;return{year:e.year,cfads:r,debt:n,dscr:i,isViolation:c}}),d=c.filter(e=>e.isViolation).length,m="".concat(r," scenario clears the ").concat(l.toFixed(2),"x covenant in every modelled year.");if(d>0){let e=Math.max(1,Math.floor(c.length/4)),t=c.slice(0,e).reduce((e,t)=>
111e+t.cfads,0)/e,s=c.slice(-e).reduce((e,t)=>e+t.cfads,0)/e,a=t>0?(s-t)/t:0;m=a<-.1?"CFADS erodes ".concat(Math.abs(100*a).toFixed(0),"% from early to late years while debt service stays flat â covenant breach is degradation- / augmentation-driven."):a>.1?"CFADS grows ".concat((100*a).toFixed(0),"% over time; breach is concentrated in early years â consider grace period or lower initial gearing."):"CFADS is roughly flat; covenant breach indicates debt service is sized too aggressively versus steady-state cash flow."}let x=eC[r];return(0,a.jsxs)("div",{className:"rounded border border-slate-700 bg-slate-900/60 p-4",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h3",{className:"text-sm font-mono uppercase text-slate-300",children:[r," DSCR trajectory"]}),(0,a.jsxs)("p",{className:"text-[11px] text-slate-400",children:["CFADS vs debt service \xb7 covenant ⥠",l.toFixed(2),"x"]})]}),(0,a.jsxs)("div",{className:"rounded px-2 py-1 text-[11px] font-mono uppercase ".concat(d>0?"bg-rose-900/60 text-rose-200":"bg-emerald-900/40 text-emerald-300"),children:[d," / ",i," breach",1===d?"":"es"]})]}),(0,a.jsx)("div",{className:"h-64",children:(0,a.jsx)(g.h,{width:"100%",height:"100%",children:(0,a.jsxs)(y.c,{data:c,margin:{top:10,right:30,left:10,bottom:5},children:[(0,a.jsx)(v.q,{strokeDasharray:"3 3",stroke:"#334155",vertical:!1}),(0,a.jsx)(j.K,{dataKey:"year",tick:{fill:"#64748b",fontSize:11},axisLine:{stroke:"#334155"}}),(0,a.jsx)(_.B,{yAxisId:"left",tick:{fill:"#64748b",fontSize:11},axisLine:{stroke:"#334155"},tickFormatter:eF,label:{value:"EUR",angle:-90,position:"insideLeft",fill:"#64748b",fontSize:10}}),(0,a.jsx)(_.B,{yAxisId:"right",orientation:"right",tick:{fill:x,fontSize:11},axisLine:{stroke:x,strokeOpacity:.5},tickFormatter:e=>"".concat(e.toFixed(2),"x"),domain:[0,e=>Math.max(2,1.1*e)],label:{value:"DSCR",angle:90,position:"insideRight",fill:x,fontSize:10}}),(0,a.jsx)(N.u,{contentStyle:{backgroundColor:"#0f172a",border:"1px solid #334155",borderRadius:"8px"},labelStyle:{color:"#e2e8f0",fontWeight:"bold"},itemStyle:{color:"#94a3b8",fontSize:"12px"},formatter:(e,t)=>"cfads"===t?[eR(e),"CFADS"]:"debt"===t?[eR(e),"Debt service"]:"dscr"===t?["".concat(e.toFixed(2),"x"),"DSCR"]:[e,t],labelFormatter:e=>"Year ".concat(e)}),(0,a.jsx)(w.D,{wrapperStyle:{paddingTop:"8px",fontSize:"11px"},formatter:e=>"cfads"===e?"CFADS":"debt"===e?"Debt service":"dscr"===e?"DSCR (cov. ".concat(l.toFixed(2),"x)"):e}),(0,a.jsx)(eh.d,{yAxisId:"right",y:l,stroke:"#f43f5e",strokeDasharray:"4 4",label:{value:"cov. ".concat(l.toFixed(2),"x"),fill:"#fda4af",fontSize:10,position:"right"}}),(0,a.jsx)(eb.$,{yAxisId:"left",dataKey:"cfads",name:"cfads",stackId:void 0,children:c.map(e=>(0,a.jsx)(eS.b,{fill:e.isViolation?"#7f1d1d":x,fillOpacity:.55},"cfads-".concat(e.year)))}),(0,a.jsx)(eb.$,{yAxisId:"left",dataKey:"debt",name:"debt",fill:"#475569",fillOpacity:.7}),(0,a.jsx)(k.x,{yAxisId:"right",type:"monotone",dataKey:"dscr",name:"dscr",stroke:x,strokeWidth:2.5,dot:e=>{var t,s;let{cx:r,cy:l,payload:n}=e;if(null==r||null==l)return(0,a.jsx)("g",{},"dot-empty-".concat(null!==(t=null==n?void 0:n.year)&&void 0!==t?t:"x"));let i=(null==n?void 0:n.isViolation)?"#f43f5e":"#10b981";return(0,a.jsx)("circle",{cx:r,cy:l,r:4,fill:i,stroke:"#0f172a",strokeWidth:1},"dot-".concat(null!==(s=null==n?void 0:n.year)&&void 0!==s?s:r))}})]})})}),(0,a.jsxs)("div",{className:"mt-3 border-t border-slate-700 pt-3",children:[(0,a.jsxs)("p",{className:"text-xs ".concat(d>0?"text-rose-300":"text-emerald-300"),children:[d," violation year",1===d?"":"s"," out of"," ",i," projection year",1===i?"":"s",d>0&&s&&s.length>0&&(0,a.jsxs)("span",{className:"text-slate-400",children:[" \xb7 breach years: ",s.join(", ")]})]}),(0,a.jsx)("p",{className:"mt-1 text-[11px] text-slate-400",children:m})]})]})};let eP=[{id:"small",name:"Small (5MW/10MWh)",power_mw:5,capacity_mwh:10,total_investment_eur:175e4,equity_percentage:30,loan_term_years:10},{id:"canonical",name:"Canonical (10MW/20MWh)",power_mw:10,capacity_mwh:20,total_investment_eur:35e5,equity_percentage:30,loan_term_years:10},{id:"large",name:"Large (20MW/40MWh)",power_mw:20,capacity_mwh:40,total_investment_eur:7e6,equity_percentage:30,loan_term_years:10}],eA={loan_interest_rate:6,opex_percentage:2,insurance_percentage:.5},eZ=e=>null!=e&&Number.isFinite(e)?"".concat(e.toFixed(1),"%"):"â",eE=e=>null!=e&&Number.isFinite(e)?"".concat(e.toFixed(1)," yr"):"never",eD=e=>null==e?"â":e.toString(),ez=e=>null!=e&&Number.isFinite(e)?(0,S.Py)(e):"â";var eq=function(){let[e]=(0,r.useState)(eP),[t,s]=(0,r.useState)(()=>Object.fromEntries(eP.map(e=>[e.id,{loading:!1,error:null,data:null}]))),l=async e=>{s(t=>{var s,a;
111return{...t,[e.id]:{loading:!0,error:null,data:null!==(a=null===(s=t[e.id])||void 0===s?void 0:s.data)&&void 0!==a?a:null}}});try{let t=await R.r.analyze({total_investment_eur:e.total_investment_eur,equity_percentage:e.equity_percentage,loan_interest_rate:eA.loan_interest_rate,loan_term_years:e.loan_term_years,opex_percentage:eA.opex_percentage,insurance_percentage:eA.insurance_percentage,power_mw:e.power_mw,capacity_mwh:e.capacity_mwh});s(s=>({...s,[e.id]:{loading:!1,error:null,data:t.data}}))}catch(a){let t=a instanceof Error?a.message:"Analyze failed";s(s=>({...s,[e.id]:{loading:!1,error:t,data:null}}))}},n=[{key:"fr-y1",label:"FR Y1 net profit",direction:"higher-better",values:e.map(e=>{var s,a,r,l;return null!==(l=null===(r=t[e.id])||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:null===(s=a.fr_scenario)||void 0===s?void 0:s.net_profit_after_debt_eur)&&void 0!==l?l:null}),format:ez},{key:"pzu-y1",label:"PZU Y1 net profit",direction:"higher-better",values:e.map(e=>{var s,a,r,l;return null!==(l=null===(r=t[e.id])||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:null===(s=a.pzu_scenario)||void 0===s?void 0:s.net_profit_after_debt_eur)&&void 0!==l?l:null}),format:ez},{key:"fr-irr",label:"FR lifetime IRR",direction:"higher-better",values:e.map(e=>{var s,a,r;return null!==(r=null===(a=t[e.id])||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.fr_lifetime_irr_pct)&&void 0!==r?r:null}),format:eZ},{key:"pzu-irr",label:"PZU lifetime IRR",direction:"higher-better",values:e.map(e=>{var s,a,r;return null!==(r=null===(a=t[e.id])||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.pzu_lifetime_irr_pct)&&void 0!==r?r:null}),format:eZ},{key:"payback",label:"Lifetime payback",direction:"lower-better",values:e.map(e=>{var s,a,r;return null!==(r=null===(a=t[e.id])||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.fr_lifetime_payback_years)&&void 0!==r?r:null}),format:eE},{key:"dscr",label:"DSCR violations",direction:"lower-better",values:e.map(e=>{var s,a;let r=null===(a=t[e.id])||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.dscr_violation_years;return Array.isArray(r)?r.length:null}),format:eD},{key:"rec",label:"Recommended",direction:null,values:e.map(()=>null),format:()=>""}],i=e.some(e=>{var s;return null===(s=t[e.id])||void 0===s?void 0:s.loading});return(0,a.jsxs)("div",{className:"rounded border border-slate-700 bg-slate-900/60 p-4",children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-mono uppercase text-slate-300",children:"Sizing scenario comparator"}),(0,a.jsx)("p",{className:"text-[11px] text-slate-400",children:"Compare 2-3 BESS sizing options side-by-side. Best value per row in green, worst in amber."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>{e.forEach(e=>{l(e)})},disabled:i,className:"rounded bg-[#00ffd1] px-3 py-1 text-xs font-mono uppercase text-slate-900 hover:bg-[#00d4aa] disabled:opacity-50",children:i?"Runningâ¦":"Run all"})]}),(0,a.jsx)("div",{className:"mb-4 grid grid-cols-1 gap-2 sm:grid-cols-3",children:e.map(e=>{let s=t[e.id];return(0,a.jsxs)("div",{className:"rounded border border-slate-700 bg-slate-900/60 p-3",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-white",children:e.name}),(0,a.jsxs)("p",{className:"mt-0.5 text-[10px] text-slate-400",children:[(0,S.Py)(e.total_investment_eur)," \xb7 ",e.equity_percentage,"% eq \xb7 ",e.loan_term_years,"yr"]})]}),(0,a.jsx)("button",{type:"button",onClick:()=>void l(e),disabled:null==s?void 0:s.loading,className:"rounded border border-[#00ffd1]/40 px-2 py-0.5 text-[10px] font-mono uppercase text-[#00ffd1] hover:bg-[#00ffd1]/10 disabled:opacity-50",children:(null==s?void 0:s.loading)?"â¦":"Run"})]}),(null==s?void 0:s.error)&&(0,a.jsx)("p",{className:"mt-2 text-[10px] text-rose-300",children:s.error}),!(null==s?void 0:s.error)&&(null==s?void 0:s.loading)&&(0,a.jsx)("p",{className:"mt-2 text-[10px] text-slate-400",children:"Analyzingâ¦"}),!(null==s?void 0:s.error)&&!(null==s?void 0:s.loading)&&(null==s?void 0:s.data)&&(0,a.jsx)("p",{className:"mt-2 text-[10px] text-emerald-300",children:"Done"})]},e.id)})}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-xs",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-slate-700 text-left",children:[(0,a.jsx)("th",{className:"px-2 py-2 font-mono uppercase text-slate-400",children:"Metric"}),e.map(e=>(0,a.jsx)("th",{className:"px-2 py-2 text-right font-mono uppercase text-slate-400",children:e.name},e.id))]})}),(0,a.jsx)("tbody",{children:n.map(s=>{let r=null==s.direction?s.values.map(()=>null):function(e,t){let s=e.map((e,t)=>({v:e,i:t})).filter(e=>null!=e.v&&Number.isFinite(e.v));if(s.length<2)return e.map(()=>null);let a=s.map(e=>e.v),r=Math.max(...a),l=Math.min(...a),n="higher-better"===t?r:l,i="higher-better"===t?l:r;return n===i?e.map(()=>null):e.map(e=>null!=e&&Number.isFinite(e)?e===n?"best":e===i?"worst":null:null)}(s.values,s.direction);return(0,a.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,a.jsx)("td",{className:"px-2 py-2 text-slate-300",children:s.label}),s.values.map((l,n)=>{if("rec"===s.key){var i,o;let s=null===(o=t[e[n].id])||void 0===o?void 0:null===(i=o.data)||void 0===i?void 0:i.recommended_scenario;return(0,a.jsx)("td",{className:"px-2 py-2 text-right font-mono text-slate-200",children:null!=s?s:"â"},n)}let c=r[n];return(0,a.jsx)("td",{className:"px-2 py-2 text-right font-mono ".concat("best"===c?"text-emerald-300":"worst"===c?"text-amber-300":"text-slate-200"),children:s.format(l)},n)})]},s.key)})})]})}),(0,a.jsxs)("p",{className:"mt-3 text-[10px] text-slate-400",children:["Uses /investment/analyze with ",eA.loan_interest_rate,"% rate,"," ",eA.opex_percentage,"% OPEX, ",eA.insurance_percentage,"% insurance."]})]})};let eI=e=>null==e?"n/a":Math.abs(e)>=1e6?"â¬".concat((e/1e6).toFixed(2),"M"):Math.abs(e)>=1e3?"â¬".concat(Math.round(e/1e3),"k"):"â¬".concat(Math.round(e)),eU=e=>null==e?"n/a":"".concat(e.toFixed(2),"%"),eL=e=>null==e?"never":"".concat(e.toFixed(1)," yr"),eO=e=>null==e?"n/a":"".concat(e.toFixed(2),"x");var eB=function(){let[e,t]=(0,r.useState)(null),[s,l]=(0,r.useState)(null),[n,i]=(0,r.useState)(!0);if((0,r.useEffect)(()=>{let e=!1;return R.r.scenarios({}).then(s=>{e||t(s.data)}).catch(t=>{var s;e||l(null!==(s=null==t?void 0:t.message)&&void 0!==s?s:String(t))}).finally(()=>{e||i(!1)}),()=>{e=!0}},[]),n)return(0,a.jsx)("div",{className:"rounded border border-slate-700 bg-slate-800/40 p-6 text-sm text-slate-400",children:"Loading scenariosâ¦"});if(s||!e)return(0,a.jsxs)("div",{className:"rounded border border-red-700 bg-red-900/20 p-6 text-sm text-red-300",children:["Could not load scenarios: ",null!=s?s:"unknown error"]});let o={A_current:"border-blue-500/40 bg-blue-500/5",B_picasso:"border-orange-500/40 bg-orange-500/5",C_mature:"border-yellow-500/40 bg-yellow-500/5",D_bear:"border-red-500/40 bg-red-500/5"};return(0,a.jsxs)("div",{className:"rounded border border-slate-700 bg-slate-800/40 p-4",children:[(0,a.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-sm font-mono uppercase text-slate-300",children:"Scenario engine â 4 cases (Modeled vs Realistic)"}),(0,a.jsx)("span",{className:"rounded border border-amber-500/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-mono uppercase text-amber-300",children:e.bankability_label})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:e.scenarios.map(e=>{var t,s;let r=e.modeled.kpis,l=e.realistic.kpis,n=(null!==(t=l.min_dscr)&&void 0!==t?t:0)>=1.2;return(0,a.jsxs)("div",{className:"rounded border p-3 text-xs ".concat(null!==(s=o[e.scenario_key])&&void 0!==s?s:""),children:[(0,a.jsx)("div",{className:"mb-2 font-mono uppercase text-slate-200",children:e.label}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-slate-400",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] uppercase text-slate-500",children:"Modeled (engineering)"}),(0,a.jsxs)("div",{className:"text-slate-300",children:["Y1 ",eI(r.y1_revenue_eur)," \xb7 IRR ",eU(r.equity_irr_pct)]}),(0,a.jsxs)("div",{className:"text-slate-500",children:["Payback ",eL(r.equity_payback_years)]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-[10px] uppercase text-emerald-400",children:"Realistic (lender-grade)"}),(0,a.jsxs)("div",{className:"text-emerald-300",children:["Y1 ",eI(l.y1_revenue_eur)," \xb7 IRR ",eU(l.equity_irr_pct)]}),(0,a.jsxs)("div",{className:"text-slate-400",children:["Payback ",eL(l.equity_payback_years)," \xb7 MOIC ",eO(l.moic)]})]})]}),(0,a.jsxs)("div",{className:"mt-2 grid grid-cols-3 gap-2 border-t border-slate-700/50 pt-2 text-[10px]",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-slate-500",children:"Min DSCR"}),(0,a.jsx)("div",{className:n?"text-emerald-300":"text-red-300",children:eO(l.min_dscr)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-slate-500",children:"LLCR"}),(0,a.jsx)("div",{className:"text-slate-300",children:eO(l.llcr)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-slate-500",children:"PLCR"}),(0,a.jsx)("div",{className:"text-slate-300",children:eO(l.plcr)})]})]}),l.dscr_breach_years&&l.dscr_breach_years.length>0&&(0,a.jsxs)("div",{className:"mt-2 rounded border border-red-500/40 bg-red-900/20 px-2 py-1 text-[10px] text-red-300",children:["â DSCR < 1.20 in years: ",l.dscr_breach_years.join(", ")," â covenant breach"]})]},e.scenario_key)})}),(0,a.jsxs)("p",{className:"mt-3 text-[10px] text-slate-500",children:[e.source_note," Source: app/services/scenario_engine.py â same logic as backend
111/scripts/bess_cashflow_scenarios_excel.py."]})]})},eT=s(68291);function eW(e,t){if(null==e)return null;let s=e;for(let e of t.split(".")){if(null==s)return null;s=s[e]}return null!=s?s:null}function eG(e,t){let s=eW(e,t);if(null==s)return null;let a="number"==typeof s?s:Number(s);return Number.isFinite(a)?a:null}function eK(e,t){let s=eW(e,t);return null==s?null:String(s)}function eV(e,t){let s=eW(e,t);return Array.isArray(s)?s.length:null}let eY=e=>(0,S.Py)(e),eH=e=>"".concat(e.toFixed(1),"%"),eX=e=>"".concat(e.toFixed(1)," yr"),eJ=e=>e.toString(),e$=[["fr_y1_net","FR Y1 Net Profit","fr_scenario.net_profit_after_debt_eur","higher-better",eY],["pzu_y1_net","PZU Y1 Net Profit","pzu_scenario.net_profit_after_debt_eur","higher-better",eY],["fr_irr","FR Lifetime IRR","fr_lifetime_irr_pct","higher-better",eH],["pzu_irr","PZU Lifetime IRR","pzu_lifetime_irr_pct","higher-better",eH],["fr_payback","FR Lifetime Payback","fr_lifetime_payback_years","lower-better",eX],["pzu_payback","PZU Lifetime Payback","pzu_lifetime_payback_years","lower-better",eX],["capex","Total CAPEX","params.total_investment_eur","lower-better",eY],["debt_service","Annual Debt Service","financing.annual_debt_service_eur","lower-better",eY]];function eQ(e,t){if("num"===e.kind){let s="A"===t?e.pickA:e.pickB;return null==s?(0,a.jsx)("span",{className:"text-slate-400",children:"â"}):(0,a.jsx)("span",{className:"font-mono text-white",children:e.format(s)})}let s="A"===t?e.pickA:e.pickB;return null==s?(0,a.jsx)("span",{className:"text-slate-400",children:"â"}):(0,a.jsx)("span",{className:"font-mono text-white",children:s})}function e0(e){let{analysisA:t,analysisB:s,nameA:r,nameB:l,className:n=""}=e;if(!t||!s)return(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-6 text-center ".concat(n),children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm",children:"Run two scenarios to compare"}),(0,a.jsx)("p",{className:"text-slate-400 text-xs mt-1",children:'Use "Save as A" and "Save as B" on a completed analysis to populate both slots.'})]});let i=function(e,t){let s=e$.map(s=>{let[a,r,l,n,i]=s;return{kind:"num",key:a,label:r,direction:n,format:i,pickA:eG(e,l),pickB:eG(t,l)}});return s.splice(6,0,{kind:"num",key:"dscr_violations",label:"DSCR Violations",direction:"lower-better",format:eJ,pickA:eV(e,"dscr_violation_years"),pickB:eV(t,"dscr_violation_years")}),s.splice(7,0,{kind:"str",key:"recommended",label:"Recommended Scenario",pickA:eK(e,"recommended_scenario"),pickB:eK(t,"recommended_scenario")}),s}(t,s),o=r||"Scenario A",c=l||"Scenario B";return(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden ".concat(n),children:[(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"bg-slate-800/50 border-b border-slate-700",children:[(0,a.jsx)("th",{className:"text-left px-4 py-2 text-slate-400 font-medium",children:"Metric"}),(0,a.jsxs)("th",{className:"text-right px-4 py-2 text-blue-300 font-medium",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-slate-400",children:"A"}),(0,a.jsx)("div",{className:"font-mono truncate max-w-[260px]",title:o,children:o})]}),(0,a.jsxs)("th",{className:"text-right px-4 py-2 text-emerald-300 font-medium",children:[(0,a.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-slate-400",children:"B"}),(0,a.jsx)("div",{className:"font-mono truncate max-w-[260px]",title:c,children:c})]}),(0,a.jsx)("th",{className:"text-right px-4 py-2 text-slate-400 font-medium",children:"Î (B - A)"})]})}),(0,a.jsx)("tbody",{children:i.map((e,t)=>(0,a.jsxs)("tr",{className:t%2==0?"bg-slate-900":"bg-slate-800/30",children:[(0,a.jsx)("td",{className:"px-4 py-2 text-slate-300",children:e.label}),(0,a.jsx)("td",{className:"px-4 py-2 text-right",children:eQ(e,"A")}),(0,a.jsx)("td",{className:"px-4 py-2 text-right",children:eQ(e,"B")}),(0,a.jsx)("td",{className:"px-4 py-2 text-right",children:"num"===e.kind?function(e){let{pickA:t,pickB:s,format:r,direction:l}=e;if(null==t||null==s)return(0,a.jsx)("span",{className:"text-slate-400",children:"â"});let n=s-t;if(0===n)return(0,a.jsx)("span",{className:"text-slate-400 font-mono",children:"0"});let i=0===t?null:n/Math.abs(t)*100,o=0===n?"text-slate-400":n>0==("higher-better"===l)?"text-emerald-400":"text-rose-400";return(0,a.jsxs)("span",{className:"".concat(o," font-mono text-xs sm:text-sm"),children:[n>0?"â":"â"," ",n>0?"+":"",r(n),null!=i&&(0,a.jsxs)("span",{className:"ml-1 opacity-80",children:["(",(0,S.rl)(i,{showSign:!0}),")"]})]})}(e):function(e){let{pickA:t,pickB:s}=e;return null==t||null==s?(0,a.jsx)("span",{className:"text-slate-400",children:"â"}):t===s?(0,a.jsx)("span",{className:"text-slate-400 font-mono",children:"="}):(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 text-amber-300 font-mono text-xs sm:text-sm",children:[(0,a.jsx)("span",{children:t}),(0,a.jsx)(eT.Z,{className:"w-3 h-3"}),(0,a.jsx)("span",{children:s})]})}(e)})]},e.key))})]})}),(0,a.jsx)("div",{className:"px-4 py-2 text-[10px] text-slate-400 border-t border-slate-700 bg-slate-900/50",children:"Green = change moves metric in the favorable direction. Red = unfavorable. Em-dash = data missing in one slot."})]})}/** 112 * @license lucide-react v0.294.0 - ISC 113 * 114 * This source code is licensed under the ISC license. 115 * See the LICENSE file in the root directory of this source tree. 116 */let e1=(0,l.Z)("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);function e2(e){let{currentAnalysis:t,currentLabel:s,setSlot:r,className:l=""}=e,n=null==t,i=e=>{n||r(e,t,s)},o="flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-mono uppercase tracking-wider border transition-colors disabled:opacity-40 disabled:cursor-not-allowed";return(0,a.jsxs)("div",{className:"flex items-center gap-2 ".concat(l),children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i("A"),disabled:n,title:n?"Run an analysis first":"Save current run to slot A: ".concat(s),className:"".concat(o," bg-blue-500/10 border-blue-500/30 text-blue-300 hover:bg-blue-500/20"),children:[(0,a.jsx)(e1,{className:"w-3.5 h-3.5"}),"Save as A"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>i("B"),disabled:n,title:n?"Run an analysis first":"Save current run to slot B: ".concat(s),className:"".concat(o," bg-emerald-500/10 border-emerald-500/30 text-emerald-300 hover:bg-emerald-500/20"),children:[(0,a.jsx)(e1,{className:"w-3.5 h-3.5"}),"Save as B"]})]})}var e4=s(82549);/** 117 * @license lucide-react v0.294.0 - ISC 118 * 119 * This source code is licensed under the ISC license. 120 * See the LICENSE file in the root directory of this source tree. 121 */let e3=(0,l.Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}
121],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),e5="bess_saved_reports_v1";function e8(e,t){if(t)try{window.localStorage.setItem(e5,JSON.stringify(e))}catch(e){console.error("useSavedReports: failed to write localStorage",e)}}var e6=function(){let[e,t]=(0,r.useState)([]),s=(0,r.useRef)(!1),a=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{s.current=function(){try{let e="__bess_probe__";return window.localStorage.setItem(e,e),window.localStorage.removeItem(e),!0}catch(e){return!1}}(),t(function(){try{let e=window.localStorage.getItem(e5);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>e&&"string"==typeof e.id&&"string"==typeof e.name&&"string"==typeof e.savedAt)}catch(e){return console.error("useSavedReports: failed to parse localStorage",e),[]}}()),a.current=!0},[]),{reports:e,save:(0,r.useCallback)((e,a,r)=>{let l=(e||"").trim()||"Untitled report",n={id:function(){try{if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID()}catch(e){}return"r_".concat(Date.now().toString(36),"_").concat(Math.random().toString(36).slice(2,10))}(),name:l,savedAt:new Date().toISOString(),params:a,analysis:r};return t(e=>{let t=[n,...e].slice(0,20);return e8(t,s.current),t}),n},[]),deleteById:(0,r.useCallback)(e=>{t(t=>{let a=t.filter(t=>t.id!==e);return e8(a,s.current),a})},[]),clear:(0,r.useCallback)(()=>{t(()=>(e8([],s.current),[]))},[])}};function e9(e){if(!e||"object"!=typeof e)return"";let t="number"==typeof e.power_mw?"".concat(e.power_mw,"MW"):null,s="number"==typeof e.capacity_mwh?"".concat(e.capacity_mwh,"MWh"):null,a="number"==typeof e.total_investment_eur?"â¬".concat((e.total_investment_eur/1e6).toFixed(2).replace(/\.00$/,""),"M"):null;return[t&&s?"".concat(t,"/").concat(s):t||s,a?"@ ".concat(a):null].filter(Boolean).join(" ")}function e7(e){let{currentParams:t,currentAnalysis:s,onLoad:l,className:n=""}=e,{reports:i,save:o,deleteById:c}=e6(),[m,x]=(0,r.useState)(!1),[u,p]=(0,r.useState)(""),h=null!=s,b=(0,r.useMemo)(()=>e9(t)||"Untitled report",[t]),f=()=>{h&&(o(u,t,s),p(""),x(!1))},g=()=>{p(""),x(!1)};return(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-3 sm:p-5 ".concat(n),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h3",{className:"text-white font-semibold text-sm sm:text-base",children:"Saved Reports"}),(0,a.jsxs)("span",{className:"text-slate-400 text-[10px] sm:text-xs hidden sm:inline",children:[i.length,"/20 stored locally"]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>{h&&(p(b),x(!0))},disabled:!h,title:h?"Save current analysis":"Run an analysis first",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-mono uppercase tracking-wider border bg-[#00ffd1]/10 border-[#00ffd1]/30 text-[#00ffd1] hover:bg-[#00ffd1]/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,a.jsx)(e1,{className:"w-3.5 h-3.5"}),"Save Current"]})]}),m&&(0,a.jsxs)("div",{className:"mb-3 p-3 bg-slate-800/50 border border-slate-700 rounded-md flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,a.jsx)("input",{type:"text",value:u,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"===e.key&&f(),"Escape"===e.key&&g()},placeholder:"Report name",autoFocus:!0,className:"flex-1 px-3 py-1.5 rounded-md bg-slate-900 border border-slate-700 text-sm text-white placeholder-slate-500 focus:outline-none focus:border-[#00ffd1]/50"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:f,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-mono uppercase border bg-[#00ffd1]/10 border-[#00ffd1]/30 text-[#00ffd1] hover:bg-[#00ffd1]/20",children:"Save"}),(0,a.jsxs)("button",{type:"button",onClick:g,className:"flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-mono uppercase border bg-slate-800 border-slate-700 text-slate-300 hover:bg-slate-700",children:[(0,a.jsx)(e4.Z,{className:"w-3.5 h-3.5"}),"Cancel"]})]})]}),0===i.length?(0,a.jsx)("p",{className:"text-slate-400 text-xs sm:text-sm py-4 text-center",children:"No saved reports yet."}):(0,a.jsx)("ul",{className:"divide-y divide-slate-800",children:i.map(e=>{let t=e9(e.params);return(0,a.jsxs)("li",{className:"flex flex-col sm:flex-row sm:items-center gap-2 py-2.5",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-white text-sm font-medium truncate",children:e.name}),(0,a.jsxs)("p",{className:"text-slate-400 text-[11px] font-mono",children:[t&&(0,a.jsx)("span",{className:"text-slate-400",children:t}),t&&(0,a.jsx)("span",{className:"mx-2 text-slate-400",children:"|"}),(0,a.jsx)("span",{children:function(e){try{let t=new Date(e);if(Number.isNaN(t.getTime()))return e;
121return t.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch(t){return e}}(e.savedAt)})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>null==l?void 0:l(e.params),disabled:!l,title:"Restore these parameters into the form",className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-mono uppercase border bg-[#00ffd1]/10 border-[#00ffd1]/30 text-[#00ffd1] hover:bg-[#00ffd1]/20 disabled:opacity-40 disabled:cursor-not-allowed",children:[(0,a.jsx)(G,{className:"w-3 h-3"}),"Load"]}),(0,a.jsxs)("button",{type:"button",onClick:()=>c(e.id),title:"Delete this saved report",className:"flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-mono uppercase border bg-red-500/10 border-red-500/30 text-red-300 hover:bg-red-500/20",children:[(0,a.jsx)(e3,{className:"w-3 h-3"}),"Delete"]})]})]},e.id)})})]})}function te(e,t){let s=new URL(window.location.href);for(let e of Object.keys(t))s.searchParams.delete(e);for(let a of Object.keys(t)){let t=e[a];null!=t&&("number"!=typeof t||Number.isFinite(t))&&s.searchParams.set(String(a),String(t))}return s.toString()}let tt={total_investment_eur:"number",equity_percentage:"number",loan_interest_rate:"number",loan_term_years:"number",opex_percentage:"number",insurance_percentage:"number",power_mw:"number",capacity_mwh:"number",include_tariff_exemption:"boolean"},ts={total_investment_eur:35e5,equity_percentage:50,loan_interest_rate:6,loan_term_years:3,opex_percentage:2,insurance_percentage:.5,power_mw:10,capacity_mwh:20,include_tariff_exemption:!1},ta={fr:"#00ffd1",pzu:"#2563eb"},tr=[{key:"sermatec",name:"Sermatec",orig_power_mw:15,orig_energy_mwh:30.09,offer_eur:2593410,equip_cost_per_mwh_eur:86188,norm_equipment_eur:2585653,norm_total_eur:35e5,norm_total_per_mwh_eur:116667},{key:"yess",name:"YESS / Cubenergy",orig_power_mw:15,orig_energy_mwh:30.86,offer_eur:3965500,equip_cost_per_mwh_eur:128500,norm_equipment_eur:3854990,norm_total_eur:4625988,norm_total_per_mwh_eur:154200},{key:"byd",name:"BYD",orig_power_mw:25,orig_energy_mwh:50,offer_eur:5977236,equip_cost_per_mwh_eur:119545,norm_equipment_eur:3586342,norm_total_eur:4303610,norm_total_per_mwh_eur:143454},{key:"huawei",name:"Huawei",orig_power_mw:15,orig_energy_mwh:55,offer_eur:13324800,equip_cost_per_mwh_eur:242269,norm_equipment_eur:7268073,norm_total_eur:8721687,norm_total_per_mwh_eur:290723}];function tl(){var e,t,s,l,F,C,M,P,Z,E,D,z,q,I,L,O,B,W,G,K;let[V,Y]=(0,r.useState)("sermatec"),X=tr.find(e=>e.key===V)||tr[0],[J,$,Q]=function(e,t){let s=(0,r.useRef)(t),[a,l]=(0,r.useState)(e),[n,i]=(0,r.useState)("");return(0,r.useEffect)(()=>{let t=function(e,t){try{let s=new URLSearchParams(window.location.search),a={...e};for(let e of Object.keys(t)){let r=s.get(String(e));if(null===r)continue;let l=function(e,t){if("number"===t){let t=Number(e);return Number.isFinite(t)?t:void 0}return"boolean"===t?"true"===e||"1"===e||"false"!==e&&"0"!==e&&void 0:e}(r,t[e]);void 0!==l&&(a[e]=l)}return a}catch(t){return e}}(e,s.current);l(t),i(te(t,s.current))},[]),[a,(0,r.useCallback)(e=>{l(t=>{let a="function"==typeof e?e(t):e;try{let e=te(a,s.current);window.history.replaceState(null,"",e),i(e)}catch(e){}return a})},[]),n]}(ts,tt),es=e=>{Y(e);let t=tr.find(t=>t.key===e);t&&$(e=>({...e,total_investment_eur:t.norm_total_eur}))},[er,el]=(0,r.useState)(null),[en,ei]=(0,r.useState)(!1),[ec,ed]=(0,r.useState)(null),[em,ex]=(0,r.useState)(!1),[ep,eh]=(0,r.useState)(null),[eb,ef]=(0,r.useState)(null),[eg,ey]=(0,r.useState)(!1),[ev,ej]=(0,r.useState)(!0),[e_,ew]=(0,r.useState)(!1),[eS,eR]=(0,r.useState)(!1),[eF,eC]=(0,r.useState)(ee),[eP,eA]=(0,r.useState)(null),[eZ,eE]=(0,r.useState)(500),[eD,ez]=(0,r.useState)(!1),[eI,eU]=(0,r.useState)(null),[eL,eO]=(0,r.useState)(void 0),[eT,eW]=(0,r.useState)(void 0);(0,r.useEffect)(()=>{R.r.getDefaults().then(e=>{var t,s;let a=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.capex_per_kwh_band;a&&"number"==typeof a.low&&"number"==typeof a.mid&&"number"==typeof a.high&&eO(a);let r=null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.capex_per_kwh_band_eu_typical;r&&"number"==typeof r.low&&"number"==typeof r.mid&&"number"==typeof r.high&&eW(r)}).catch(()=>{})},[]);let eG=async()=>{ei(!0),ed(null);try{let e=await fetch("".concat(R.CT,"/api/v1/investment/analyze"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...J,compliance_gates:eF})});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let t=await e.json();el(t)}catch(e){console.error("Analysis error:",e),ed(e.message||"Failed to run analysis")}finally{ei(!1)}},eK=async()=>{ez(!0),eU(null);try{let e=await R.r.sensitivity({params:{total_investment_eur:J.total_investment_eur,equity_percentage:J.equity_percentage,loan_interest_rate:J.loan_interest_rate,loan_term_years:J.loan_term_years,opex_percentage:J.opex_percentage,insurance_percentage:J.insurance_percentage,power_mw:J.power_mw,capacity_mwh:J.capacity_mwh},config:{runs:eZ,seed:42}});eA(e.data)}catch(e){eU((null==e?void 0:e.message)||"Sensitivity failed")}finally{ez(!1)}},eV=(0,r.useMemo)(()=>{let e=(J.total_investment_eur/1e6).toFixed(2).replace(/\.00$/,"");return"".concat(J.power_mw,"MW/").concat(J.capacity_mwh,"MWh @ â¬").concat(e,"M, ").concat(J.equity_percentage,"% equity")},[J]),eY=(0,r.useMemo)(()=>
121{if(!er)return null;let e=J.total_investment_eur*(J.equity_percentage/100),t=J.total_investment_eur-e;return{equity:e,debt:t,frAdvantage:er.fr_scenario.net_profit_after_debt_eur-er.pzu_scenario.net_profit_after_debt_eur,costPerMW:J.total_investment_eur/J.power_mw,costPerMWh:J.total_investment_eur/J.capacity_mwh}},[er,J]);return(0,a.jsxs)("div",{className:"space-y-4 sm:space-y-6 max-w-[1600px] mx-auto",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 border-b border-slate-800 pb-4",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:"flex items-center gap-2 sm:gap-3",children:[(0,a.jsx)("div",{className:"p-1.5 sm:p-2 rounded-lg",style:{background:"linear-gradient(135deg, #00ffd1 0%, #00d4aa 100%)"},children:(0,a.jsx)(n,{className:"w-5 h-5 sm:w-6 sm:h-6 text-slate-900"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-lg sm:text-xl md:text-2xl font-bold text-white",children:"Investment Analysis"}),(0,a.jsx)("p",{className:"text-xs sm:text-sm text-slate-400",children:"Financial Modeling ⢠FR vs PZU"})]})]})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 sm:gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 sm:gap-2 px-2 sm:px-3 py-1 sm:py-1.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[(0,a.jsx)("span",{className:"w-1.5 h-1.5 sm:w-2 sm:h-2 rounded-full bg-green-500 animate-pulse"}),(0,a.jsx)("span",{className:"text-[10px] sm:text-xs text-slate-400",children:"LIVE"})]}),(0,a.jsx)("div",{className:"px-2 sm:px-3 py-1 sm:py-1.5 rounded-lg bg-[#00ffd1]/10 border border-[#00ffd1]/30",children:(0,a.jsx)("span",{className:"text-xs sm:text-sm text-[#00ffd1] font-mono",children:"ROI CALC"})})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ex(e=>!e),"aria-expanded":em,className:"w-full px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex items-center justify-between gap-2 hover:bg-slate-800/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"Sizing Comparator"}),(0,a.jsx)("span",{className:"text-slate-400 text-[10px] sm:text-xs hidden sm:inline",children:"compare 2-3 BESS sizing options side-by-side"})]}),(0,a.jsx)("span",{className:"text-slate-400 text-xs font-mono uppercase",children:em?"Hide":"Show"})]}),em&&(0,a.jsx)("div",{className:"p-3 sm:p-5",children:(0,a.jsx)(eq,{})})]}),(0,a.jsx)("div",{className:"my-4 sm:my-6",children:(0,a.jsx)(eB,{})}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ej(e=>!e),"aria-expanded":ev,className:"w-full px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex items-center justify-between gap-2 hover:bg-slate-800/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(o.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"Regulatory Timeline"}),(0,a.jsx)("span",{className:"text-slate-400 text-[10px] sm:text-xs hidden sm:inline",children:"upcoming Romanian / EU transitions â MARI, PICASSO, ANRE 60/2024"})]}),(0,a.jsx)("span",{className:"text-slate-400 text-xs font-mono uppercase",children:ev?"Hide":"Show"})]}),ev&&(0,a.jsx)("div",{className:"p-3 sm:p-5",children:(0,a.jsx)(eo,{})})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>eR(e=>!e),"aria-expanded":eS,className:"w-full px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex items-center justify-between gap-2 hover:bg-slate-800/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"Compliance Gates"}),(0,a.jsx)("span",{className:"text-slate-400 text-[10px] sm:text-xs hidden sm:inline",children:"Romanian / EU prerequisites â toggle status to see which revenue streams unlock"})]}),(0,a.jsx)("span",{className:"text-slate-400 text-xs font-mono uppercase",children:eS?"Hide":"Show"})]}),eS&&(0,a.jsx)("div",{className:"p-3 sm:p-5",children:(0,a.jsx)(ea,{value:eF,onChange:eC,blockedStreams:null!==(C=null==er?void 0:er.compliance_revenue_streams_blocked)&&void 0!==C?C:et(eF)})})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ew(e=>!e),"aria-expanded":e_,className:"w-full px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex items-center justify-between gap-2 hover:bg-slate-800/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"Saved Reports"}),(0,a.jsx)("span",{className:"text-slate-400 text-[10px] sm:text-xs hidden sm:inline",children:"save analysis runs locally and reload them later (no backend storage)"})]}),(0,a.jsx)("span",{className:"text-slate-400 text-xs font-mono uppercase",children:e_?"Hide":"Show"})]}),e_&&(0,a.jsx)("div",{className:"p-3 sm:p-5",children:(0,a.jsx)(e7,{currentParam
121s:J,currentAnalysis:er,onLoad:e=>$(e)})})]}),(0,a.jsx)(A,{powerMw:J.power_mw,capacityMwh:J.capacity_mwh,band:eL,bandEuTypical:eT}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-3 sm:gap-4",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 bg-gradient-to-br from-slate-900 to-slate-900/50 border border-slate-700 rounded-lg sm:rounded-xl p-3 sm:p-5",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 mb-3 sm:mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-sm sm:text-lg font-semibold text-white",children:"BESS Investment Overview"})]}),(0,a.jsx)("span",{className:"sm:ml-auto text-[10px] sm:text-xs text-slate-400",children:"Romanian Market 2024-2025"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-2 sm:gap-4 mb-3 sm:mb-4",children:[(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3",children:[(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] uppercase tracking-wider text-slate-400 mb-0.5 sm:mb-1",children:"Typical CAPEX"}),(0,a.jsx)("p",{className:"text-base sm:text-xl font-bold text-[#00ffd1] font-mono",children:"â¬100-150K"}),(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] text-slate-400 mt-0.5 sm:mt-1",children:"per MWh installed"})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3",children:[(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] uppercase tracking-wider text-slate-400 mb-0.5 sm:mb-1",children:"FR Revenue"}),(0,a.jsx)("p",{className:"text-base sm:text-xl font-bold text-emerald-400 font-mono",children:"â¬250-400K"}),(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] text-slate-400 mt-0.5 sm:mt-1",children:"per MW/year"})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3",children:[(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] uppercase tracking-wider text-slate-400 mb-0.5 sm:mb-1",children:"PZU Revenue"}),(0,a.jsx)("p",{className:"text-base sm:text-xl font-bold text-blue-400 font-mono",children:"â¬80-150K"}),(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] text-slate-400 mt-0.5 sm:mt-1",children:"per MW/year"})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3",children:[(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] uppercase tracking-wider text-slate-400 mb-0.5 sm:mb-1",children:"Typical Payback"}),(0,a.jsx)("p",{className:"text-base sm:text-xl font-bold text-white font-mono",children:"2-4 yrs"}),(0,a.jsx)("p",{className:"text-[9px] sm:text-[10px] text-slate-400 mt-0.5 sm:mt-1",children:"with FR revenue"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 sm:gap-4",children:[(0,a.jsxs)("div",{className:"bg-slate-800/30 rounded-lg p-2 sm:p-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5 sm:mb-2",children:[(0,a.jsxs)("span",{className:"text-xs sm:text-sm text-[#00ffd1] font-medium flex items-center gap-1",children:[(0,a.jsx)(x.Z,{className:"w-3 h-3 sm:w-4 sm:h-4"})," Frequency Regulation"]}),(0,a.jsx)("span",{className:"text-[10px] sm:text-xs text-slate-400",children:"70-80%"})]}),(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-slate-400",children:"aFRR capacity + activation. Stable income."}),(0,a.jsx)("div",{className:"mt-1.5 sm:mt-2 h-1.5 sm:h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-[#00d4aa] to-[#00ffd1]",style:{width:"75%"}})})]}),(0,a.jsxs)("div",{className:"bg-slate-800/30 rounded-lg p-2 sm:p-3",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5 sm:mb-2",children:[(0,a.jsxs)("span",{className:"text-xs sm:text-sm text-blue-400 font-medium flex items-center gap-1",children:[(0,a.jsx)(u.Z,{className:"w-3 h-3 sm:w-4 sm:h-4"})," PZU Arbitrage"]}),(0,a.jsx)("span",{className:"text-[10px] sm:text-xs text-slate-400",children:"20-30%"})]}),(0,a.jsx)("p",{className:"text-[10px] sm:text-xs text-slate-400",children:"Day-ahead spread trading. Variable returns."}
121),(0,a.jsx)("div",{className:"mt-1.5 sm:mt-2 h-1.5 sm:h-2 bg-slate-700 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:"h-full bg-gradient-to-r from-blue-600 to-blue-400",style:{width:"25%"}})})]})]})]}),(0,a.jsxs)("div",{className:"bg-gradient-to-br from-purple-900/20 to-slate-900/50 border border-purple-500/30 rounded-lg sm:rounded-xl p-3 sm:p-5",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3 sm:mb-4",children:[(0,a.jsx)(p.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 text-purple-400"}),(0,a.jsx)("h3",{className:"text-white font-semibold text-sm sm:text-base",children:"Investment Model"})]}),(0,a.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,a.jsxs)("div",{className:"border-l-2 border-[#00ffd1] pl-3",children:[(0,a.jsx)("p",{className:"text-[#00ffd1] font-medium",children:"Step 1: Choose Vendor"}),(0,a.jsx)("p",{className:"text-slate-400 text-xs mt-1",children:"Select battery provider. CAPEX auto-fills based on normalized 15 MW / 30 MWh pricing."})]}),(0,a.jsxs)("div",{className:"border-l-2 border-blue-400 pl-3",children:[(0,a.jsx)("p",{className:"text-blue-400 font-medium",children:"Step 2: Set Financing"}),(0,a.jsx)("p",{className:"text-slate-400 text-xs mt-1",children:"Configure equity/debt split, interest rate, and loan term for your project."})]}),(0,a.jsxs)("div",{className:"border-l-2 border-emerald-400 pl-3",children:[(0,a.jsx)("p",{className:"text-emerald-400 font-medium",children:"Step 3: Compare Scenarios"}),(0,a.jsx)("p",{className:"text-slate-400 text-xs mt-1",children:"Analyze FR vs PZU strategies with ROI, payback, and cashflow projections."})]}),(0,a.jsxs)("div",{className:"bg-purple-500/10 border border-purple-500/30 rounded-lg p-3 mt-4",children:[(0,a.jsxs)("p",{className:"text-purple-400 text-xs font-medium flex items-center gap-1",children:[(0,a.jsx)(c.Z,{className:"w-3 h-3"})," Key Insight"]}),(0,a.jsx)("p",{className:"text-slate-400 text-[11px] mt-1",children:"FR typically outperforms PZU by 2-3x due to capacity payments, but requires TSO certification."})]})]})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{className:"px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(h,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"Step 1 - Choose Battery Provider"})]}),(0,a.jsx)("span",{className:"text-slate-400 text-[10px] sm:text-xs",children:"Normalized to 15 MW / 30 MWh"})]}),(0,a.jsxs)("div",{className:"p-3 sm:p-5",children:[(0,a.jsxs)("div",{className:"mb-4 sm:mb-6",children:[(0,a.jsx)("label",{className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Battery Provider"}),(0,a.jsx)("select",{value:V,onChange:e=>es(e.target.value),className:"w-full md:w-80 px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]",children:tr.map(e=>(0,a.jsxs)("option",{value:e.key,children:[e.name," - â¬",(e.norm_total_eur/1e6).toFixed(2),"M total"]},e.key))}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Pick the vendor to finance. CAPEX auto-fills from this choice."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-2 sm:gap-4 mb-4 sm:mb-6",children:[(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3 text-center",children:[(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mb-0.5 sm:mb-1",children:"Vendor"}),(0,a.jsx)("p",{className:"text-white font-semibold text-xs sm:text-sm",children:X.name})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3 text-center",children:[(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mb-0.5 sm:mb-1",children:"Offer (full)"}),(0,a.jsxs)("p",{className:"text-[#00ffd1] font-mono font-semibold text-xs sm:text-sm",children:["â¬",(X.offer_eur/1e6).toFixed(2),"M"]})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3 text-center",children:[(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mb-0.5 sm:mb-1",children:"Norm. Equip"}),(0,a.jsxs)("p",{className:"text-blue-400 font-mono font-semibold text-xs sm:text-sm",children:["â¬",(X.norm_equipment_eur/1e6).toFixed(2),"M"]})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3 text-center",children:[(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mb-0.5 sm:mb-1",children:"Total Project"}),(0,a.jsxs)("p",{className:"text-emerald-400 font-mono font-semibold text-xs sm:text-sm",children:["â¬",(X.norm_total_eur/1e6).toFixed(2),"M"]})]}),(0,a.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 sm:p-3 text-center col-span-2 sm:col-span-1",children:[(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mb-0.5 sm:mb-1",children:"â¬/MWh (total)"}),(0,a.jsxs)("p",{className:"text-[#00ffd1] font-mono font-semibold text-xs sm:text-sm",children:["â¬",X.norm_total_per_mwh_eur.toLocaleStr
121ing()]})]})]}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full text-sm",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"border-b border-slate-700",children:[(0,a.jsx)("th",{className:"text-left px-3 py-2 text-slate-400 font-medium",children:"Vendor"}),(0,a.jsx)("th",{className:"text-left px-3 py-2 text-slate-400 font-medium",children:"Original Offer"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 text-slate-400 font-medium",children:"Offer ⬠(full kit)"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 text-slate-400 font-medium",children:"â¬/MWh (offered)"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 text-slate-400 font-medium",children:"Norm. Equipment â¬"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 text-slate-400 font-medium",children:"Total Project â¬"}),(0,a.jsx)("th",{className:"text-right px-3 py-2 text-slate-400 font-medium",children:"â¬/MWh (norm.)"})]})}),(0,a.jsx)("tbody",{children:tr.map(e=>(0,a.jsxs)("tr",{className:"border-b border-slate-800 cursor-pointer hover:bg-slate-800/30 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#00ffd1] focus-visible:ring-inset ".concat(e.key===V?"bg-[#00ffd1]/10 border-[#00ffd1]/30":""),onClick:()=>es(e.key),tabIndex:0,role:"button","aria-label":"Select battery vendor ".concat(e.name),"aria-pressed":e.key===V,onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),es(e.key))},children:[(0,a.jsx)("td",{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-2 h-2 rounded-full ".concat(e.key===V?"bg-[#00ffd1]":"bg-slate-600")}),(0,a.jsx)("span",{className:e.key===V?"text-white font-medium":"text-slate-300",children:e.name})]})}),(0,a.jsxs)("td",{className:"px-3 py-2 text-slate-400",children:[e.orig_power_mw," MW / ",e.orig_energy_mwh.toFixed(1)," MWh"]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-right font-mono text-white",children:["â¬",(e.offer_eur/1e6).toFixed(2),"M"]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-right font-mono text-slate-400",children:["â¬",e.equip_cost_per_mwh_eur.toLocaleString()]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-right font-mono text-blue-400",children:["â¬",(e.norm_equipment_eur/1e6).toFixed(2),"M"]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-right font-mono text-emerald-400",children:["â¬",(e.norm_total_eur/1e6).toFixed(2),"M"]}),(0,a.jsxs)("td",{className:"px-3 py-2 text-right font-mono ".concat(e.norm_total_per_mwh_eur<=11e4?"text-emerald-400":e.norm_total_per_mwh_eur<=16e4?"text-blue-400":e.norm_total_per_mwh_eur<=2e5?"text-[#00ffd1]":"text-red-400"),children:["â¬",e.norm_total_per_mwh_eur.toLocaleString()]})]},e.key))})]})}),(0,a.jsx)("p",{className:"text-slate-400 text-xs mt-3",children:"* All values normalized to 15 MW / 30 MWh. Total Project includes \xd71.2 BOS (Balance of System) factor."})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("div",{className:"px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(b,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"Step 2 - Financing Parameters"})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 w-full sm:w-auto",children:[(0,a.jsx)(T,{getUrl:()=>Q||window.location.href}),(0,a.jsx)(H,{params:J,analysis:er,onImport:e=>$(e)}),(0,a.jsx)("button",{onClick:eG,disabled:en,className:"btn-primary flex items-center justify-center gap-2 w-full sm:w-auto min-h-[44px] sm:min-h-[36px]",children:en?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Analyzing..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x.Z,{className:"w-4 h-4"}),"Run Analysis"]})})]})]}),(0,a.jsx)("div",{className:"p-3 sm:p-5",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 sm:gap-5",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-total-investment-eur",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Total Investment (EUR)"}),(0,a.jsx)("input",{id:"bess-inv-total-investment-eur",type:"number",value:J.total_investment_eur,onChange:e=>$({...J,total_investment_eur:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"CAPEX total"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-equity-percentage",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Equity (%)"}),(0,a.jsx)("input",{id:"bess-inv-equity-percentage",type:"number",value:J.equity_percentage,onChange:e=>$({...J,equity_percentage:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Owner contribution"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-loan-interest-rate",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Interest Rate (%)"}),(0,a.jsx)("input",{id:"bess-inv-loan-interest-rate",type:"number",value:J.loan_interest_rate,onChange:e=>$({...J,loan_interest_rate:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Loan annual rate"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-loan-term-years",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Loan Term (years)"}),(0,a.jsx)("input",{id:"bess-inv-loan-term-years",type:"number",value:J.loan_term_years,onChange:e=>$({...J,loan_term_years:parseInt(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Repayment period"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-power-mw",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Power (MW)"}),(0,a.jsx)("input",{id:"bess-inv-power-mw",type:"number",value:J.power_mw,onChange:e=>$({...J,power_mw:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Battery power"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-capacity-mwh",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Capacity (MWh)"}),(0,a.jsx)("input",{id:"bess-inv-capacity-mwh",type:"number",value:J.capacity_mwh,onChange:e=>$({...J,capacity_mwh:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Energy capacity"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-opex-percentage",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"OPEX (%)"}),(0,a.jsx)("input",{id:"bess-inv-opex-percentage",type:"number",value:J.opex_percentage,onChange:e=>$({...J,opex_percentage:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Of CAPEX/year"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"bess-inv-insurance-percentage",className:"block text-slate-400 text-xs sm:text-sm mb-1.5 sm:mb-2",children:"Insurance (%)"}),(0,a.jsx)("input",{id:"bess-inv-insurance-percentage",type:"number",value:J.insurance_percentage,onChange:e=>$({...J,insurance_percentage:parseFloat(e.target.value)||0}),className:"w-full px-3 sm:px-4 py-2 sm:py-2.5 bg-slate-800 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:border-[#00ffd1] transition-colors min-h-[44px] sm:min-h-[36px]"}),(0,a.jsx)("p",{className:"text-slate-400 text-[10px] sm:text-xs mt-1",children:"Of CAPEX/year"})]})]})})]}),ec&&(0,a.jsx)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-4",children:(0,a.jsx)("p",{className:"text-red-400",children:ec})}),er&&eY&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"rounded-lg p-6 border ".concat("FR"===er.recommended_scenario?"bg-blue-500/10 border-blue-500/30":"bg-green-500/10 border-green-500/30"),children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm mb-1",children:"Recommended Strategy"}),(0,a.jsx)("p",{className:"text-3xl font-bold ".concat("FR"===er.recommended_scenario?"text-blue-400":"text-green-400"),children:"FR"===er.recommended_scenario?"Frequency Regulation":"PZU Trading"})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm mb-1",children:"Annual Advantage"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-white font-mono",children:(0,S.xG)(er.advantage_eur,{decimals:0})}),(0,a.jsxs)("p",{className:"text-green-400 text-sm",children:["+",(0,S.rl)(er.advantage_percentage)]})]})]})}),(0,a.jsxs)("div",{className:"flex flex-wrap justify-end gap-2 items-center",children:[(0,a.jsx)(e2,{currentAnalysis:er,currentLabel:eV,setSlot:(e,t,s)=>{"A"===e?eh({a:t,label:s}):ef({a:t,label:s})}}),(0,a.jsx)(U,{frCashflow:null!==(M=er.fr_cashflow)&&void 0!==M?M:[],pzuCashflow:null!==(P=er.pzu_cashflow)&&void 0!==P?P:[],params:J})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>ey(e=>!e),"aria-expanded":eg,className:"w-full px-3 sm:px-5 py-3 sm:py-4 border-b border-slate-700 flex items-center justify-between gap-2 hover:bg-slate-800/40 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4 sm:w-5 sm:h-5 text-[#00ffd1]"}),(0,a.jsx)("h2",{className:"text-white font-semibold text-sm sm:text-base",children:"A/B Scenario Diff"}),(0,a.jsx)("span",{className:"text-slate-400 text-[10px] sm:text-xs hidden sm:inline",children:"side-by-side delta on every key metric â Save as A / B from any run"}),(0,a.jsxs)("span",{className:"text-[10px] font-mono text-slate-400 ml-2",children:["[A:",ep?"set":"empty"," | B:",eb?"set":"empty","]"]})]}),(0,a.jsx)("span",{className:"text-slate-400 text-xs font-mono uppercase",children:eg?"Hide":"Show"})]}),eg&&(0,a.jsx)("div",{className:"p-3 sm:p-5",children:(0,a.jsx)(e0,{analysisA:null!==(Z=null==ep?void 0:ep.a)&&void 0!==Z?Z:null,analysisB:null!==(E=null==eb?void 0:eb.a)&&void 0!==E?E:null,nameA:null==ep?void 0:ep.label,nameB:null==eb?void 0:eb.label})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-slate-400 text-sm",children:"Total CAPEX"}),(0,a.jsx)(f.Z,{className:"w-5 h-5 text-[#00ffd1]"})]}),(0,a.jsx)("p",{className:"text-2xl font-bold text-white font-mono",children:(0,S.Py)(J.total_investment_eur)}),(0,a.jsxs)("p",{className:"text-slate-400 text-xs mt-1",children:[(0,S.Py)(eY.costPerMW),"/MW"]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-slate-400 text-sm",children:"Equity Required"}),(0,a.jsx)(n,{className:"w-5 h-5 text-green-400"})]}),(0,a.jsx)("p",{className:"text-2xl font-bold text-white font-mono",children:(0,S.Py)(eY.equity)}),(0,a.jsxs)("p",{className:"text-slate-400 text-xs mt-1",children:[J.equity_percentage,"% of CAPEX"]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-slate-400 text-sm",children:"Bank Financing"}),(0,a.jsx)(b,{className:"w-5 h-5 text-[#00ffd1]"})]}),(0,a.jsx)("p",{className:"text-2xl font-bold text-white font-mono",children:(0,S.Py)(eY.debt)}),(0,a.jsxs)("p",{className:"text-slate-400 text-xs mt-1",children:[100-J.equity_percentage,"% debt"]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-slate-400 text-sm",children:"Annual Debt Service"}),(0,a.jsx)(o.Z,{className:"w-5 h-5 text-red-400"})]}),(0,a.jsx)("p",{className:"text-2xl font-bold text-white font-mono",children:(0,S.Py)(er.financing.annual_debt_service_eur)}),(0,a.jsxs)("p",{className:"text-slate-400 text-xs mt-1",children:[J.loan_term_years," year term"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{className:"bg-slate-900 rounded-lg overflow-hidden border-2 ".concat("FR"===er.recommended_scenario?"border-blue-500":"border-slate-700"),
121children:[(0,a.jsxs)("div",{className:"px-5 py-4 border-b border-slate-700 flex items-center justify-between bg-blue-500/10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-blue-400"}),(0,a.jsx)("h3",{className:"text-white font-semibold",children:"Frequency Regulation"})]}),"FR"===er.recommended_scenario&&(0,a.jsx)("span",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 text-xs rounded-full border border-blue-500/30",children:"RECOMMENDED"})]}),(0,a.jsxs)("div",{className:"p-5 space-y-3",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Gross Revenue"}),(0,a.jsx)("span",{className:"text-white font-mono",children:(0,S.xG)(er.fr_scenario.gross_revenue_eur,{decimals:0})})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Energy Cost"}),(0,a.jsxs)("span",{className:"text-red-400 font-mono",children:["-",(0,S.xG)(er.fr_scenario.energy_cost_eur,{decimals:0})]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Operating Cost"}),(0,a.jsxs)("span",{className:"text-red-400 font-mono",children:["-",(0,S.xG)(er.fr_scenario.operating_cost_eur,{decimals:0})]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Debt Service"}),(0,a.jsxs)("span",{className:"text-red-400 font-mono",children:["-",(0,S.xG)(er.fr_scenario.annual_debt_service_eur,{decimals:0})]})]}),(0,a.jsxs)("div",{className:"border-t border-slate-700 pt-3 flex justify-between font-semibold",children:[(0,a.jsx)("span",{className:"text-white",children:"Net Profit"}),(0,a.jsx)("span",{className:"text-green-400 font-mono",children:(0,S.xG)(er.fr_scenario.net_profit_after_debt_eur,{decimals:0})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-slate-700",children:[(0,a.jsxs)("div",{className:"text-center p-2 bg-slate-800/50 rounded",children:[(0,a.jsx)("p",{className:"text-slate-400 text-xs uppercase tracking-wide",children:"Y1 ROI on Equity"}),(0,a.jsx)("p",{className:"text-blue-400 font-bold",children:(0,S.rl)(er.fr_scenario.roi_percentage)}),(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1",children:"premium-pricing year"})]}),(0,a.jsxs)("div",{className:"text-center p-2 bg-slate-800/50 rounded",children:[(0,a.jsx)("p",{className:"text-slate-400 text-xs uppercase tracking-wide",children:"Y1 Payback"}),(0,a.jsxs)("p",{className:"text-blue-400 font-bold",children:[er.fr_scenario.payback_years.toFixed(1)," yrs"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-2 border-t border-blue-500/30 bg-blue-500/5 rounded p-2",children:[(0,a.jsxs)("div",{className:"text-center p-2",children:[(0,a.jsxs)("p",{className:"text-blue-300 text-xs uppercase tracking-wide font-semibold",children:["Lifetime IRR (",null!==(D=er.projection_horizon_years)&&void 0!==D?D:15,"y)"]}),(0,a.jsx)("p",{className:"text-blue-200 font-bold",children:null==er.fr_lifetime_irr_pct?(0,a.jsx)("span",{className:"text-rose-300",children:"loss-making"}):(0,S.rl)(er.fr_lifetime_irr_pct)}),(0,a.jsx)("p",{className:"text-[10px] text-blue-300/70 mt-1",children:"bankability number"})]}),(0,a.jsxs)("div",{className:"text-center p-2",children:[(0,a.jsx)("p",{className:"text-blue-300 text-xs uppercase tracking-wide font-semibold",children:"Lifetime Payback"}),(0,a.jsx)("p",{className:"text-blue-200 font-bold",children:null==er.fr_lifetime_payback_years?(0,a.jsx)("span",{className:"text-rose-300",children:"never"}):"".concat(er.fr_lifetime_payback_years.toFixed(1)," yrs")})]})]})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 rounded-lg overflow-hidden border-2 ".concat("PZU"===er.recommended_scenario?"border-green-500":"border-slate-700"),children:[(0,a.jsxs)("div",{className:"px-5 py-4 border-b border-slate-700 flex items-center justify-between bg-green-500/10",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"w-5 h-5 text-green-400"}),(0,a.jsx)("h3",{className:"text-white font-semibold",children:"PZU Trading"})]}),"PZU"===er.recommended_scenario&&(0,a.jsx)("span",{className:"px-2 py-1 bg-green-500/20 text-green-400 text-xs rounded-full border border-green-500/30",children:"RECOMMENDED"})]}),(0,a.jsxs)("div",{className:"p-5 space-y-3",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Gross Revenue"}),(0,a.jsx)("span",{className:"text-white font-mono",children:(0,S.xG)(er.pzu_scenario.gross_revenue_eur,{decimals:0})})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Energy Cost"}),(0,a.jsxs)("span",{className:"text-red-400 font-mono",children:["-",(0,S.xG)(er.pzu_scenario.energy_cost_eur||0,{decimals:0})]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Operating Cost"}),(0,a.jsxs)("span",{className:"text-red-400 font-mono",children:["-",(0,S.xG)(er.pzu_scenario.operating_cost_eur,{decimals:0})]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-slate-400",children:"Debt Service"}),(0,a.jsxs)("span",{className:"text-red-400 font-mono",children:["-",(0,S.xG)(er.pzu_scenario.annual_debt_service_eur,{decimals:0})]})]}),(0,a.jsxs)("div",{className:"border-t border-slate-700 pt-3 flex justify-between font-semibold",children:[(0,a.jsx)("span",{className:"text-white",children:"Net Profit"}),(0,a.jsx)("span",{className:"text-green-400 font-mono",children:(0,S.xG)(er.pzu_scenario.net_profit_after_debt_eur,{decimals:0})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-slate-700",children:[(0,a.jsxs)("div",{className:"text-center p-2 bg-slate-800/50 rounded",children:[(0,a.jsx)("p",{className:"text-slate-400 text-xs uppercase tracking-wide",children:"Y1 ROI on Equity"}),(0,a.jsx)("p",{className:"text-green-400 font-bold",children:(0,S.rl)(er.pzu_scenario.roi_percentage)}),(0,a.jsx)("p",{className:"text-[10px] text-slate-400 mt-1",children:"premium-pricing year"})]}),(0,a.jsxs)("div",{className:"text-center p-2 bg-slate-800/50 rounded",children:[(0,a.jsx)("p",{className:"text-slate-400 text-xs uppercase tracking-wide",children:"Y1 Payback"}),(0,a.jsxs)("p",{className:"text-green-400 font-bold",children:[er.pzu_scenario.payback_years.toFixed(1)," yrs"]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3 pt-2 border-t border-green-500/30 bg-green-500/5 rounded p-2",children:[(0,a.jsxs)("div",{className:"text-center p-2",children:[(0,a.jsxs)("p",{className:"text-green-300 text-xs uppercase tracking-wide font-semibold",children:["Lifetime IRR (",null!==(z=er.projection_horizon_years)&&void 0!==z?z:15,"y)"]}),(0,a.jsx)("p",{className:"text-green-200 font-bold",children:null==er.pzu_lifetime_irr_pct?(0,a.jsx)("span",{className:"text-rose-300",children:"loss-making"}):(0,S.rl)(er.pzu_lifetime_irr_pct)}),(0,a.jsx)("p",{className:"text-[10px] text-green-300/70 mt-1",children:"bankability number"})]}),(0,a.jsxs)("div",{className:"text-center p-2",children:[(0,a.jsx)("p",{className:"text-green-300 text-xs uppercase tracking-wide font-semibold",children:"Lifetime Payback"}),(0,a.jsx)("p",{className:"text-green-200 font-bold",children:null==er.pzu_lifetime_payback_years?(0,a.jsx)("span",{className:"text-rose-300",children:"never"}):"".concat(er.pzu_lifetime_payback_years.toFixed(1)," yrs")})]})]})]})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-5",children:[(0,a.jsxs)("h3",{className:"text-white font-semibold mb-4 flex items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"w-5 h-5 text-[#00ffd1]"}
121),"Cumulative Cashflow Projection"]}),(0,a.jsx)("div",{className:"h-80",children:(0,a.jsx)(g.h,{width:"100%",height:"100%",children:(0,a.jsxs)(y.c,{children:[(0,a.jsx)(v.q,{strokeDasharray:"3 3",stroke:"#334155"}),(0,a.jsx)(j.K,{dataKey:"year",type:"number",domain:[0,J.loan_term_years],tick:{fill:"#94a3b8",fontSize:11},axisLine:{stroke:"#475569"},tickLine:{stroke:"#475569"},tickFormatter:e=>"Yr ".concat(e)}),(0,a.jsx)(_.B,{tick:{fill:"#94a3b8",fontSize:11},axisLine:{stroke:"#475569"},tickLine:{stroke:"#475569"},tickFormatter:e=>"â¬".concat((e/1e6).toFixed(1),"M")}),(0,a.jsx)(N.u,{contentStyle:{backgroundColor:"#1e293b",border:"1px solid #475569",borderRadius:"8px",color:"#fff"},formatter:e=>(0,S.xG)(e,{decimals:0}),labelFormatter:e=>"Year ".concat(e)}),(0,a.jsx)(w.D,{}),(0,a.jsx)(k.x,{data:er.fr_cashflow,type:"monotone",dataKey:"cumulative_profit_eur",stroke:ta.fr,strokeWidth:3,name:"FR Cumulative",dot:{fill:ta.fr,r:4}}),(0,a.jsx)(k.x,{data:er.pzu_cashflow,type:"monotone",dataKey:"cumulative_profit_eur",stroke:ta.pzu,strokeWidth:3,name:"PZU Cumulative",dot:{fill:ta.pzu,r:4}})]})})})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-5",children:[(0,a.jsxs)("h3",{className:"text-white font-semibold mb-4 flex items-center gap-2",children:[(0,a.jsx)(b,{className:"w-5 h-5 text-[#00ffd1]"}),"Financing Structure"]}),(0,a.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"text-center p-4 bg-slate-800/50 rounded-lg",children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm mb-2",children:"Total Investment"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-white font-mono",children:(0,S.Py)(er.financing.total_investment_eur)})]}),(0,a.jsxs)("div",{className:"text-center p-4 bg-slate-800/50 rounded-lg",children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm mb-2",children:"Equity Required"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-[#00ffd1] font-mono",children:(0,S.Py)(er.financing.equity_eur)}),(0,a.jsxs)("p",{className:"text-slate-400 text-xs mt-1",children:[er.financing.equity_percentage,"%"]})]}),(0,a.jsxs)("div",{className:"text-center p-4 bg-slate-800/50 rounded-lg",children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm mb-2",children:"Bank Financing"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-[#00ffd1] font-mono",children:(0,S.Py)(er.financing.debt_eur)}),(0,a.jsxs)("p",{className:"text-slate-400 text-xs mt-1",children:[er.financing.debt_percentage,"%"]})]}),(0,a.jsxs)("div",{className:"text-center p-4 bg-slate-800/50 rounded-lg",children:[(0,a.jsx)("p",{className:"text-slate-400 text-sm mb-2",children:"Annual Debt Service"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-red-400 font-mono",children:(0,S.Py)(er.financing.annual_debt_service_eur)})]})]})]}),(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg overflow-hidden",children:[(0,a.jsx)("div",{className:"px-5 py-4 border-b border-slate-700",children:(0,a.jsxs)("h3",{className:"text-white font-semibold flex items-center gap-2",children:[(0,a.jsx)(i.Z,{className:"w-5 h-5 text-blue-400"}),"Scenario Comparison"]})}),(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"bg-slate-800/50",children:[(0,a.jsx)("th",{className:"text-left px-5 py-3 text-slate-400 font-medium text-sm",children:"Metric"}),(0,a.jsx)("th",{className:"text-right px-5 py-3 text-blue-400 font-medium text-sm",children:"FR Scenario"}),(0,a.jsx)("th",{className:"text-right px-5 py-3 text-green-400 font-medium text-sm",children:"PZU Scenario"}),(0,a.jsx)("th",{className:"text-right px-5 py-3 text-slate-400 font-medium text-sm",children:"Difference"})]})}),(0,a.jsxs)("tbody",{children:[(0,a.jsxs)("tr",{className:"bg-slate-900",children:[(0,a.jsx)("td",{className:"px-5 py-3 text-slate-300",children:"Gross Revenue"}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-white",children:(0,S.xG)(er.fr_scenario.gross_revenue_eur,{decimals:0})}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-white",children:(0,S.xG)(er.pzu_scenario.gross_revenue_eur,{decimals:0})}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-slate-400",children:(0,S.xG)(er.fr_scenario.gross_revenue_eur-er.pzu_scenario.gross_revenue_eur,{decimals:0,showSign:!0})})]}),(0,a.jsxs)("tr",{className:"bg-slate-800/30",children:[(0,a.jsx)("td",{className:"px-5 py-3 text-slate-300",children:"Net Profit (After Debt)"}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-green-400 font-semibold",children:(0,S.xG)(er.fr_scenario.net_profit_after_debt_eur,{decimals:0})}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-green-400 font-semibold",children:(0,S.xG)(er.pzu_scenario.net_profit_after_debt_eur,{decimals:0})}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono font-semibold ".concat(eY.frAdvantage>=0?"text-blue-400":"text-green-400"),children:(0,S.xG)(eY.frAdvantage,{decimals:0,showSign:!0})})]}),(0,a.jsxs)("tr",{className:"bg-slate-900",children:[(0,a.jsx)("td",{className:"px-5 py-3 text-slate-300",children:"ROI on Equity"}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-blue-400",children:(0,S.rl)(er.fr_scenario.roi_percentage)}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-green-400",children:(0,S.rl)(er.pzu_scenario.roi_percentage)}),(0,a.jsx)("td",{className:"px-5 py-3 text-right font-mono text-slate-400",children:(0,S.rl)(er.fr_scenario.roi_percentage-er.pzu_scenario.roi_percentage,{showSign:!0})})]}),(0,a.jsxs)("tr",{className:"bg-slate-800/30",children:[(0,a.jsx)("td",{className:"px-5 py-3 text-slate-300",children:"Payback Period"}),(0,a.jsxs)("td",{className:"px-5 py-3 text-right font-mono text-blue-400",children:[er.fr_scenario.payback_years.toFixed(1)," years"]}),(0,a.jsxs)("td",{className:"px-5 py-3 text-right font-mono text-green-400",children:[er.pzu_scenario.payback_years.toFixed(1)," years"]}),(0,a.jsxs)("td",{className:"px-5 py-3 text-right font-mono text-slate-400",children:[(er.fr_scenario.payback_years-er.pzu_scenario.payback_years).toFixed(1)," years"]})]})]})]})})]})]}),er&&(0,a.jsxs)("div",{className:"mt-8 space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Risk & Sensitivity (Phase F)"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:"Monte Carlo over activation share, RTE, degradation, FX, PZU spread. DSCR covenant flagged in red. Augmentation + warranty status from Phase D."})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"mc-runs",className:"text-xs text-slate-400",children:"Runs"}),(0,a.jsxs)("select",{id:"mc-runs",title:"Number of Monte Carlo runs",value:eZ,onChange:e=>eE(Number(e.target.value)),className:"rounded border border-slate-700 bg-slate-900 px-2 py-1 text-xs text-white",children:[(0,a.jsx)("option",{value:200,children:"200"}),(0,a.jsx)("option",{value:500,children:"500"}),(0,a.jsx)("option",{value:1e3,children:"1000"})]}),(0,a.jsx)("button",{type:"button",onClick:eK,disabled:eD,className:"rounded bg-blue-600 px-3 py-1 text-xs font-mono uppercase text-white hover:bg-blue-500 disabled:opacity-50",children:eD?"Runningâ¦":"Run Monte Carlo"})]})]}),eI&&(0,a.jsx)("div",{className:"rounded border border-rose-700 bg-rose-900/40 p-3 text-xs text-rose-200",children:eI}
121),eP&&(0,a.jsx)(eu,{data:eP}),(eP||eD)&&(0,a.jsx)(eN,{irrSamples:null!==(q=null==eP?void 0:eP.irr_samples)&&void 0!==q?q:[],p10:null!==(I=null==eP?void 0:eP.p10_irr)&&void 0!==I?I:NaN,p50:null!==(L=null==eP?void 0:eP.p50_irr)&&void 0!==L?L:NaN,p90:null!==(O=null==eP?void 0:eP.p90_irr)&&void 0!==O?O:NaN,meanIrr:null!==(B=null==eP?void 0:eP.mean_irr)&&void 0!==B?B:NaN,loading:eD&&!eP}),(null==er?void 0:null===(e=er.fr_cashflow)||void 0===e?void 0:e.length)?(0,a.jsx)(ek,{rows:er.fr_cashflow.map(e=>{var t,s,a,r,l,n;return{year:e.year,cfads_eur:null!==(t=e.cfads_eur)&&void 0!==t?t:0,debt_service_eur:null!==(s=e.debt_service_eur)&&void 0!==s?s:0,dscr:null!==(a=e.dscr)&&void 0!==a?a:0,capacity_factor:null!==(r=e.capacity_factor)&&void 0!==r?r:1,warranty_status:null!==(l=e.warranty_status)&&void 0!==l?l:"ok",augmentation_cost_eur:null!==(n=e.augmentation_cost_eur)&&void 0!==n?n:0}}),violationYears:null!==(W=er.dscr_violation_years)&&void 0!==W?W:[]}):null,(null==er?void 0:null===(t=er.fr_cashflow)||void 0===t?void 0:t.length)||(null==er?void 0:null===(s=er.pzu_cashflow)||void 0===s?void 0:s.length)?(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2",children:[(null==er?void 0:null===(l=er.fr_cashflow)||void 0===l?void 0:l.length)?(0,a.jsx)(eM,{cashflow:er.fr_cashflow,dscr_violation_years:null!==(G=er.dscr_violation_years)&&void 0!==G?G:[],scenario_name:"FR"}):null,(null==er?void 0:null===(F=er.pzu_cashflow)||void 0===F?void 0:F.length)?(0,a.jsx)(eM,{cashflow:er.pzu_cashflow,dscr_violation_years:null!==(K=er.dscr_violation_years)&&void 0!==K?K:[],scenario_name:"PZU"}):null]}):null]}),!er&&!en&&(0,a.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-lg p-12 text-center",children:[(0,a.jsx)(n,{className:"h-12 w-12 text-slate-400 mx-auto mb-4"}),(0,a.jsx)("h3",{className:"text-lg font-medium text-white",children:"Ready to Analyze"}),(0,a.jsx)("p",{className:"text-slate-400 mt-1",children:"Configure investment parameters and click Run Analysis to compare FR vs PZU scenarios"})]})]})}},11918:function(e,t,s){"use strict";s.d(t,{cC:function(){return h},oU:function(){return p}});var a=s(57437),r=s(36678),l=s(74056),n=s(43030),i=s(72894),o=s(97332),c=s(45479),d=s(33673),m=s(85790);let x={"Confirmed-source":{bg:"bg-emerald-500/15",text:"text-emerald-300",ring:"ring-emerald-500/30",help:"Primary source supports the value AND project implementation matches.",Icon:r.Z},"Likely-source":{bg:"bg-blue-500/15",text:"text-blue-300",ring:"ring-blue-500/30",help:"Primary source supports the market rule. Project applicability is conditional.",Icon:l.Z},"Likely-source / Scenario":{bg:"bg-blue-500/15",text:"text-blue-300",ring:"ring-blue-500/30",help:"Reasonable Romanian market assumption, presented as scenario â not bankable.",Icon:n.Z},"Participant-only":{bg:"bg-amber-500/15",text:"text-amber-300",ring:"ring-amber-500/30",help:"Public data cannot prove this value. Participant settlement export required.",Icon:i.Z},"Public-data / Participant-only-for-bankability":{bg:"bg-amber-500/15",text:"text-amber-300",ring:"ring-amber-500/30",help:"Computed from public DAMAS marginal data. NOT a project-specific settlement number.",Icon:o.Z},Scenario:{bg:"bg-purple-500/15",text:"text-purple-300",ring:"ring-purple-500/30",help:"Model assumption / sensitivity, not proven revenue.",Icon:n.Z},Unverified:{bg:"bg-slate-500/15",text:"text-slate-300",ring:"ring-slate-500/30",help:"Needs counsel, operator confirmation, or source documents before use.",Icon:c.Z}},u=x.Unverified;function p(e){var t;let{label:s,className:r="",short:l=!1}=e;if(!s)return null;let n=null!==(t=x[s])&&void 0!==t?t:u,i=l&&s.includes("/")?s.split("/")[0].trim():s,o=n.Icon;return(0,a.jsxs)("span",{title:n.help,className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium ring-1 ".concat(n.bg," ").concat(n.text," ").concat(n.ring," ").concat(r),children:[(0,a.jsx)(o,{className:"w-3.5 h-3.5","aria-hidden":"true"}),i]})}function h(e){var t;let{basis:s,className:l=""}=e;if(!s)return null;let i=null!==(t=({participant_bid:{color:"bg-blue-500/15 text-blue-300 ring-blue-500/30",help:"Revenue = participant bid price \xd7 cleared MWh (pay-as-bid).",Icon:d.Z}
121,public_marginal:{color:"bg-amber-500/15 text-amber-300 ring-amber-500/30",help:"Revenue uses DAMAS public marginal prices, NOT participant settlement.",Icon:m.Z},settlement_export:{color:"bg-emerald-500/15 text-emerald-300 ring-emerald-500/30",help:"Revenue derived from real participant settlement export (bankable).",Icon:r.Z},scenario:{color:"bg-purple-500/15 text-purple-300 ring-purple-500/30",help:"Scenario / sensitivity assumption.",Icon:n.Z}})[s])&&void 0!==t?t:{color:"bg-slate-500/15 text-slate-300 ring-slate-500/30",help:"Unknown basis.",Icon:c.Z},o=i.Icon;return(0,a.jsxs)("span",{title:i.help,className:"inline-flex items-center gap-1 rounded px-2 py-0.5 text-xs font-medium ring-1 ".concat(i.color," ").concat(l),children:[(0,a.jsx)(o,{className:"w-3.5 h-3.5","aria-hidden":"true"}),s]})}},10826:function(e,t,s){"use strict";s.d(t,{Bl:function(){return c},CT:function(){return r},L9:function(){return i},gD:function(){return o},r:function(){return m},wK:function(){return d}});var a=s(54829);let r=s(62601).env.NEXT_PUBLIC_API_URL||"https://ebattery-api.onrender.com",l=a.Z.create({baseURL:"".concat(r,"/api/v1"),timeout:6e4,headers:{"Content-Type":"application/json"}}),n=[1500,3e3,6e3];l.interceptors.response.use(e=>e,async e=>{var t,s,a,r;let i=e.config;if(!i||(i.__retryCount=null!==(s=i.__retryCount)&&void 0!==s?s:0,i.__retryCount>=3))return Promise.reject(e);let o=null===(t=e.response)||void 0===t?void 0:t.status,c=!e.response,d="get"===(null!==(a=i.method)&&void 0!==a?a:"get").toLowerCase();if(!(c&&i.__retryCount<3||503===o&&d))return Promise.reject(e);let m=null!==(r=n[i.__retryCount])&&void 0!==r?r:6e3;return i.__retryCount+=1,await new Promise(e=>setTimeout(e,m)),l(i)});let i={getHistory:e=>l.get("/pzu/history",{params:e}),simulate:e=>l.post("/pzu/simulate",e),getMonthlySummary:e=>l.get("/pzu/monthly-summary",{params:e}),getStats:()=>l.get("/pzu/stats")},o={getProducts:()=>l.get("/fr/products"),getData:e=>l.get("/fr/data",{params:e}),simulate:e=>l.post("/fr/simulate",e),getMonthlyBreakdown:e=>l.get("/fr/monthly-breakdown",{params:e}),getStats:()=>l.get("/fr/stats"),getProductCatalog:()=>l.get("/fr/product-catalog"),multiProduct:e=>l.post("/fr/multi-product",e)},c={getManifest:()=>l.get("/data/manifest"),getStatus:()=>l.get("/data/status")},d={getDetailed:()=>l.get("/data/health-detailed")},m={analyze:e=>l.post("/investment/analyze",e),calculateFinancing:e=>l.post("/investment/financing",e),getDefaults:()=>l.get("/investment/defaults"),sensitivity:e=>l.post("/investment/sensitivity",e),scenarios:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l.post("/investment/scenarios",e)},scenarioDefaults:()=>l.get("/investment/scenarios/defaults")}},1657:function(e,t,s){"use strict";function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{currency:s="EUR",decimals:a=0,compact:r=!1,showSign:l=!1}=t;if(r)return n(e,{currency:s,showSign:l});let i=new Intl.NumberFormat("de-DE",{style:"currency",currency:s,minimumFractionDigits:a,maximumFractionDigits:a}).format(Math.abs(e));return l&&e>0?"+"+i:e<0?"-"+i:i}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{decimals:s=0,showSign:a=!1}=t,r=new Intl.NumberFormat("de-DE",{minimumFractionDigits:s,maximumFractionDigits:s}).format(Math.abs(e));return a&&e>0?"+"+r:e<0?"-"+r:r}function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{decimals:s=1,showSign:a=!1}=t;return"".concat(a&&e>0?"+":"").concat(e.toFixed(s),"%")}function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{currency:s="EUR",showSign:a=!1}=t,r=Math.abs(e),l=e<0?"-":a&&e>0?"+":"",n="EUR"===s?"â¬":"$";return r>=1e9?"".concat(l).concat(n).concat((r/1e9).toFixed(2),"B"):r>=1e6?"".concat(l).concat(n).concat((r/1e6).toFixed(2),"M"):r>=1e3?"".concat(l).concat(n).concat((r/1e3).toFixed(1),"K"):"".concat(l).concat(n).concat(r.toFixed(0))}s.d(t,{Py:function(){return n},rl:function(){return l},uf:function(){return r},xG:function(){return a}})},44909:function(e,t,s){"use strict";s.d(t,{v:function(){return o}});
121var a=s(53315),r=s(31346),l=s(24235),n=s(50039),i=s(39677),o=(0,a.z)({chartName:"BarChart",GraphicalChild:r.$,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:l.K},{axisType:"yAxis",AxisComp:n.B}],formatAxisMap:i.t9})}},function(e){e.O(0,[123,563,971,938,744],function(){return e(e.s=55463)}),_N_E=e.O()}]);
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.