@backtest-kit/ui 13.6.0 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +189 -170
  2. package/build/modules/frontend/build/assets/{Article-C7I5Jc2B.js → Article-CpU7DBcT.js} +1 -1
  3. package/build/modules/frontend/build/assets/{Background-xwzJo61H.js → Background-DISIt7NA.js} +1 -1
  4. package/build/modules/frontend/build/assets/{IconPhoto-DrGLW-rX.js → IconPhoto-Czod_jkW.js} +1 -1
  5. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-BpxUzr7-.js → KeyboardArrowLeft-BUZ_pXI5.js} +1 -1
  6. package/build/modules/frontend/build/assets/{PictureAsPdfOutlined-BTv5MH3G.js → PictureAsPdfOutlined-BgifaQ0L.js} +1 -1
  7. package/build/modules/frontend/build/assets/{Refresh-DixrXBVq.js → Refresh-3cixHjvW.js} +1 -1
  8. package/build/modules/frontend/build/assets/emitters-DmNf0ttF.js +1 -0
  9. package/build/modules/frontend/build/assets/{hasRouteMatch-C0K-M4jy.js → hasRouteMatch-CqJJG3sx.js} +1 -1
  10. package/build/modules/frontend/build/assets/{html2canvas-Xo2SFHzw.js → html2canvas-Ds2vwzb-.js} +1 -1
  11. package/build/modules/frontend/build/assets/{index-wMYoZqi-.js → index-B1plXuf6.js} +1 -1
  12. package/build/modules/frontend/build/assets/{index-kQlTYlpK.js → index-BI3k7b1T.js} +5 -5
  13. package/build/modules/frontend/build/assets/{index-DP-GjNGC.js → index-BMq2INDq.js} +1 -1
  14. package/build/modules/frontend/build/assets/{index-D7cEguAr.js → index-BYiuApxW.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-DFbdj6KX.js → index-BYnSX2YX.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-CtY-cILX.js → index-C8oIDQdm.js} +1 -1
  17. package/build/modules/frontend/build/assets/{index-CwqHMGtu.js → index-CA19hrNH.js} +1 -1
  18. package/build/modules/frontend/build/assets/{index-BO8_0_6f.js → index-Cqt7co-7.js} +1 -1
  19. package/build/modules/frontend/build/assets/{index-wq7wFKoe.js → index-DJ7B8Och.js} +1 -1
  20. package/build/modules/frontend/build/assets/{index-DeRxtBVy.js → index-DwO4-4_F.js} +1 -1
  21. package/build/modules/frontend/build/assets/{index-Giwjzoy7.js → index-VxkdhxAi.js} +1 -1
  22. package/build/modules/frontend/build/assets/{index-S9fsmR5b.js → index-pxXO4P81.js} +1 -1
  23. package/build/modules/frontend/build/assets/{index-D6fbkGDu.js → index-ruSh1u75.js} +1 -1
  24. package/build/modules/frontend/build/assets/{index.es-BiwqIRwO.js → index.es-DPOJOdbj.js} +1 -1
  25. package/build/modules/frontend/build/assets/{markdownit-By9-eJJI.js → markdownit-C4X6Sysk.js} +1 -1
  26. package/build/modules/frontend/build/index.html +1 -1
  27. package/package.json +5 -5
  28. package/build/modules/frontend/build/assets/emitters-ByKSsASU.js +0 -1
@@ -1 +1 @@
1
- import{h as e,f as t,c as n,r,i,S as o,m as a,U as l}from"./index-kQlTYlpK.js";const[c,s]=e("pine-code-context"),u=e=>t(c,{initialState:'//@version=5\nindicator("Simple MA", overlay=true)\n\nlength = input.int(20, "Length")\nsma = ta.sma(close, length)\n\nplot(sma, "SMA", color.blue, linewidth=2)',children:e.children}),[d,h]=e("pine-from-date-context"),v=e=>t(d,{initialState:"",children:e.children}),[m,p]=e("pine-limit-context"),g=e=>t(m,{initialState:250,children:e.children}),[f,y]=e("pine-symbol-context"),b=e=>t(f,{initialState:"BTCUSDT",children:e.children}),[C,D]=e("pine-timeframe-context"),x=e=>t(C,{initialState:"1",children:e.children}),[S,w]=e("pine-to-date-context"),T=e=>t(S,{initialState:"",children:e.children}),k=n(e=>t("div",{style:e.v0,children:[t("input",{type:"text",value:e.v1,onChange:e.v2,style:e.v3,placeholder:"BTCUSDT"}),t("select",{value:e.v4,onChange:e.v5,style:e.v6,children:e.v7}),t("input",{type:"number",value:e.v8,min:100,step:100,onChange:e.v9,style:e.v10,title:"Bars limit"}),t("input",{type:"date",value:e.v11,onChange:e.v12,style:e.v13,title:"From date"}),t("input",{type:"date",value:e.v14,onChange:e.v15,style:e.v16,title:"To date"}),t("button",{onClick:e.v17,disabled:e.v18,style:e.v19,children:e.v20}),e.v21]}),{name:"Toolbar_1",portals:["v7","v20","v21"]}),R=function({symbol:e,timeframe:n,fromDate:r,toDate:i,limit:o,running:a,status:l,onSymbolChange:c,onTimeframeChange:s,onFromDateChange:u,onToDateChange:d,onLimitChange:h,onRun:v}){return t(k,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>c(e.target.value.toUpperCase()),v3:{...B,width:100},v4:n,v5:e=>s(e.target.value),v6:B,v7:z.map(e=>t("option",{children:e},e)),v8:o,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:r,v12:e=>u(e.target.value),v13:F,v14:i,v15:e=>d(e.target.value),v16:F,v17:v,v18:a,v19:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v20:a?"...":"▶ Run",v21:l&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:l})})},z=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},F={...B,colorScheme:"dark"},U=n(e=>t("textarea",{value:e.v0,onChange:e.v1,onKeyDown:e.v2,spellCheck:!1,style:e.v3}),{name:"CodeEditor_1"}),E=function({value:e,onChange:n,onRun:r}){return t(U,{v0:e,v1:e=>n(e.target.value),v2:e=>{e.ctrlKey&&"Enter"===e.key&&(e.preventDefault(),r())},v3:{width:320,flexShrink:0,resize:"none",background:"#1e293b",color:"#e2e8f0",border:"none",borderRight:"1px solid #334155",padding:12,fontFamily:"monospace",fontSize:13,lineHeight:1.5,outline:"none"}})},$={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h",360:"6h",480:"8h","1D":"1d",D:"1d"};function L(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class I{async getMarketData(e,t,n,r,o){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=$[t]??t;return(await i.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:o})).map(e=>({openTime:e.timestamp,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}))}async getSymbolInfo(e){const t=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),n=t.replace(/USDT$|BUSD$|USD$/,""),r=t.replace(n,"");return{ticker:t,tickerid:t,description:`${n}/${r}`,type:"crypto",basecurrency:n,currency:r||"USDT",timezone:"UTC"}}}const M=()=>t(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),P=()=>{const e=r.useRef(null),[n,i]=s(),[o,l]=y(),[c,u]=D(),[d,v]=h(),[m,g]=w(),[f,b]=p(),{run:C,status:x,running:S}=function(){const e=r.useRef(null),t=r.useRef(null),n=r.useRef(null),[i,o]=r.useState(""),[a,l]=r.useState(!1);function c(){if(n.current){try{n.current.stop()}catch{}n.current=null}}function s(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function u(e){o(`Error: ${e.message}`),l(!1)}return r.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),c(),s()}},[]),{run:function({symbol:r,timeframe:i,fromDate:a,toDate:d,limit:h,code:v,containerRef:m}){if(!m.current)return;l(!0),o("Connecting..."),c(),s();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(v);let g=!1;try{const c=a?new Date(a).getTime():void 0,s=d?new Date(d).getTime():void 0,f=new I,y=new PineTS(f,r,i,h,c,s).stream(v,{pageSize:500,live:!0,interval:3e3});n.current=y,y.on("data",a=>{var c,s;if(n.current===y)if(g)t.current&&a.plots&&t.current.updateData(a.plots),null==(s=e.current)||s.updateData([L(a.marketData[a.marketData.length-1])]);else{g=!0;const n=a.marketData.map(L);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${r} · ${i}`,backgroundColor:"#0f172a",height:"100%",padding:.1,databox:{position:"right",triggerOn:"mousemove"},dataZoom:{visible:!0,position:"top",height:6,start:80,end:101},layout:{mainPaneHeight:"70%",gap:5},controls:{collapse:!1,maximize:!1,fullscreen:!1}}),e.current.setMarketData(n);const s=(null==(c=a.fullContext)?void 0:c.plots)??a.plots;t.current=e.current.addIndicator("indicator",s,{overlay:p,height:p?void 0:30,controls:{collapse:!1,maximize:!1}}),e.current.registerPlugin(new QFChart.MeasureTool),e.current.registerPlugin(new QFChart.LineTool),e.current.registerPlugin(new QFChart.FibonacciTool),o(`${n.length} bars loaded`),l(!1)}}),y.on("error",u)}catch(f){u(f)}},status:i,running:a}}();function T(){C({symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,code:n,containerRef:e})}return t(a,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(R,{symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,running:S,status:x,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:v,onToDateChange:g,onLimitChange:b,onRun:T}),t("div",{style:{display:"flex",flex:1,overflow:"clip"},children:[t(E,{value:n,onChange:i,onRun:T}),t("div",{style:{flex:1},children:t("div",{ref:e,style:{width:"100%",height:"100%"},children:t("p",{style:{color:"#475569",textAlign:"center",marginTop:"20%"},children:["Press ",t("b",{children:"▶ Run"})," or ",t("b",{children:"Ctrl+Enter"})," to load the chart"]})})})]}),t(M,{})]})})},A=l(e=>t(u,{children:e}),e=>t(v,{children:e}),e=>t(T,{children:e}),e=>t(g,{children:e}),e=>t(b,{children:e}),e=>t(x,{children:e})),N=()=>A(t(P,{}));export{N as PinePage,N as default};
1
+ import{h as e,f as t,c as n,r,i,S as o,m as a,U as l}from"./index-BI3k7b1T.js";const[c,s]=e("pine-code-context"),u=e=>t(c,{initialState:'//@version=5\nindicator("Simple MA", overlay=true)\n\nlength = input.int(20, "Length")\nsma = ta.sma(close, length)\n\nplot(sma, "SMA", color.blue, linewidth=2)',children:e.children}),[d,h]=e("pine-from-date-context"),v=e=>t(d,{initialState:"",children:e.children}),[m,p]=e("pine-limit-context"),g=e=>t(m,{initialState:250,children:e.children}),[f,y]=e("pine-symbol-context"),b=e=>t(f,{initialState:"BTCUSDT",children:e.children}),[C,D]=e("pine-timeframe-context"),x=e=>t(C,{initialState:"1",children:e.children}),[S,w]=e("pine-to-date-context"),T=e=>t(S,{initialState:"",children:e.children}),k=n(e=>t("div",{style:e.v0,children:[t("input",{type:"text",value:e.v1,onChange:e.v2,style:e.v3,placeholder:"BTCUSDT"}),t("select",{value:e.v4,onChange:e.v5,style:e.v6,children:e.v7}),t("input",{type:"number",value:e.v8,min:100,step:100,onChange:e.v9,style:e.v10,title:"Bars limit"}),t("input",{type:"date",value:e.v11,onChange:e.v12,style:e.v13,title:"From date"}),t("input",{type:"date",value:e.v14,onChange:e.v15,style:e.v16,title:"To date"}),t("button",{onClick:e.v17,disabled:e.v18,style:e.v19,children:e.v20}),e.v21]}),{name:"Toolbar_1",portals:["v7","v20","v21"]}),R=function({symbol:e,timeframe:n,fromDate:r,toDate:i,limit:o,running:a,status:l,onSymbolChange:c,onTimeframeChange:s,onFromDateChange:u,onToDateChange:d,onLimitChange:h,onRun:v}){return t(k,{v0:{display:"flex",gap:8,padding:"8px 12px",background:"#1e293b",alignItems:"center",flexShrink:0},v1:e,v2:e=>c(e.target.value.toUpperCase()),v3:{...B,width:100},v4:n,v5:e=>s(e.target.value),v6:B,v7:z.map(e=>t("option",{children:e},e)),v8:o,v9:e=>h(Number(e.target.value)),v10:{...B,width:80},v11:r,v12:e=>u(e.target.value),v13:F,v14:i,v15:e=>d(e.target.value),v16:F,v17:v,v18:a,v19:{background:"#3b82f6",color:"#fff",border:"none",borderRadius:4,padding:"5px 16px",fontSize:13,cursor:"pointer"},v20:a?"...":"▶ Run",v21:l&&t("span",{style:{fontSize:12,color:"#94a3b8",marginLeft:8},children:l})})},z=["1","5","15","60","D"],B={background:"#1e293b",color:"#e2e8f0",border:"1px solid #334155",borderRadius:4,padding:"4px 8px",fontSize:13},F={...B,colorScheme:"dark"},U=n(e=>t("textarea",{value:e.v0,onChange:e.v1,onKeyDown:e.v2,spellCheck:!1,style:e.v3}),{name:"CodeEditor_1"}),E=function({value:e,onChange:n,onRun:r}){return t(U,{v0:e,v1:e=>n(e.target.value),v2:e=>{e.ctrlKey&&"Enter"===e.key&&(e.preventDefault(),r())},v3:{width:320,flexShrink:0,resize:"none",background:"#1e293b",color:"#e2e8f0",border:"none",borderRight:"1px solid #334155",padding:12,fontFamily:"monospace",fontSize:13,lineHeight:1.5,outline:"none"}})},$={1:"1m",3:"3m",5:"5m",15:"15m",30:"30m",60:"1h",120:"2h",240:"4h",360:"6h",480:"8h","1D":"1d",D:"1d"};function L(e){return{time:e.openTime,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}}class I{async getMarketData(e,t,n,r,o){const a=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),l=$[t]??t;return(await i.exchangeViewService.getRangeCandles({symbol:a,interval:l,limit:n,sDate:r,eDate:o})).map(e=>({openTime:e.timestamp,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}))}async getSymbolInfo(e){const t=e.toUpperCase().replace(/^BINANCE:|^BYBIT:|^OKX:/,""),n=t.replace(/USDT$|BUSD$|USD$/,""),r=t.replace(n,"");return{ticker:t,tickerid:t,description:`${n}/${r}`,type:"crypto",basecurrency:n,currency:r||"USDT",timezone:"UTC"}}}const M=()=>t(o,{children:"\n #root > .MuiBox-root {\n padding-left: 0;\n padding-right: 0;\n }\n "}),P=()=>{const e=r.useRef(null),[n,i]=s(),[o,l]=y(),[c,u]=D(),[d,v]=h(),[m,g]=w(),[f,b]=p(),{run:C,status:x,running:S}=function(){const e=r.useRef(null),t=r.useRef(null),n=r.useRef(null),[i,o]=r.useState(""),[a,l]=r.useState(!1);function c(){if(n.current){try{n.current.stop()}catch{}n.current=null}}function s(){e.current&&(e.current.destroy(),e.current=null,t.current=null)}function u(e){o(`Error: ${e.message}`),l(!1)}return r.useEffect(()=>{const t=()=>{var t;return null==(t=e.current)?void 0:t.resize()};return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),c(),s()}},[]),{run:function({symbol:r,timeframe:i,fromDate:a,toDate:d,limit:h,code:v,containerRef:m}){if(!m.current)return;l(!0),o("Connecting..."),c(),s();const p=/indicator\([^)]*overlay\s*=\s*true/i.test(v);let g=!1;try{const c=a?new Date(a).getTime():void 0,s=d?new Date(d).getTime():void 0,f=new I,y=new PineTS(f,r,i,h,c,s).stream(v,{pageSize:500,live:!0,interval:3e3});n.current=y,y.on("data",a=>{var c,s;if(n.current===y)if(g)t.current&&a.plots&&t.current.updateData(a.plots),null==(s=e.current)||s.updateData([L(a.marketData[a.marketData.length-1])]);else{g=!0;const n=a.marketData.map(L);m.current.innerHTML="",e.current=new QFChart.QFChart(m.current,{title:`${r} · ${i}`,backgroundColor:"#0f172a",height:"100%",padding:.1,databox:{position:"right",triggerOn:"mousemove"},dataZoom:{visible:!0,position:"top",height:6,start:80,end:101},layout:{mainPaneHeight:"70%",gap:5},controls:{collapse:!1,maximize:!1,fullscreen:!1}}),e.current.setMarketData(n);const s=(null==(c=a.fullContext)?void 0:c.plots)??a.plots;t.current=e.current.addIndicator("indicator",s,{overlay:p,height:p?void 0:30,controls:{collapse:!1,maximize:!1}}),e.current.registerPlugin(new QFChart.MeasureTool),e.current.registerPlugin(new QFChart.LineTool),e.current.registerPlugin(new QFChart.FibonacciTool),o(`${n.length} bars loaded`),l(!1)}}),y.on("error",u)}catch(f){u(f)}},status:i,running:a}}();function T(){C({symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,code:n,containerRef:e})}return t(a,{children:t("div",{style:{display:"flex",flexDirection:"column",height:"100vh",background:"#0f172a",color:"#e2e8f0",fontFamily:"monospace"},children:[t(R,{symbol:o,timeframe:c,fromDate:d,toDate:m,limit:f,running:S,status:x,onSymbolChange:l,onTimeframeChange:u,onFromDateChange:v,onToDateChange:g,onLimitChange:b,onRun:T}),t("div",{style:{display:"flex",flex:1,overflow:"clip"},children:[t(E,{value:n,onChange:i,onRun:T}),t("div",{style:{flex:1},children:t("div",{ref:e,style:{width:"100%",height:"100%"},children:t("p",{style:{color:"#475569",textAlign:"center",marginTop:"20%"},children:["Press ",t("b",{children:"▶ Run"})," or ",t("b",{children:"Ctrl+Enter"})," to load the chart"]})})})]}),t(M,{})]})})},A=l(e=>t(u,{children:e}),e=>t(v,{children:e}),e=>t(T,{children:e}),e=>t(g,{children:e}),e=>t(b,{children:e}),e=>t(x,{children:e})),N=()=>A(t(P,{}));export{N as PinePage,N as default};
@@ -1 +1 @@
1
- import{g as e,a as t,b as a,f as o,r,u as n,_ as i,d as s,I as l,C as c,e as d,j as p,k as h,s as v,P as m,l as u,n as g,T as f,o as y,B as w,M as $,t as x,p as b,q as S,D as z,F as C,v as P,i as L,w as M,Q as k,x as A,y as V,X as R,z as N,L as D,A as H,E as T,G as F,H as I,J as B,K as W,N as E,O,R as j,V as Y,W as J,Y as _,Z as G,$ as U,a0 as q,a1 as Z,a2 as K,a3 as Q,a4 as X,a5 as ee,a6 as te,a7 as ae}from"./index-kQlTYlpK.js";import{r as oe}from"./emitters-ByKSsASU.js";import{C as re,R as ne}from"./Refresh-DixrXBVq.js";function ie(t){return e("MuiAlert",t)}const se=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),le=a(o("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),ce=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),de=a(o("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),pe=a(o("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),he=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],ve=v(m,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.variant],t[`${a.variant}${p(a.color||a.severity)}`]]}})(({theme:e,ownerState:t})=>{const a="light"===e.palette.mode?u:g,o="light"===e.palette.mode?g:u,r=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},r&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:o(e.palette[r].light,.9),[`& .${se.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${se.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${r}FilledColor`],backgroundColor:e.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[r].dark:e.palette[r].main,color:e.palette.getContrastText(e.palette[r].main)}))}),me=v("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ue=v("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ge=v("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),fe={success:o(le,{fontSize:"inherit"}),warning:o(ce,{fontSize:"inherit"}),error:o(de,{fontSize:"inherit"}),info:o(pe,{fontSize:"inherit"})},ye=r.forwardRef(function(e,t){var a,r,v,m,u,g;const f=n({props:e,name:"MuiAlert"}),{action:y,children:w,className:$,closeText:x="Close",color:b,components:S={},componentsProps:z={},icon:C,iconMapping:P=fe,onClose:L,role:M="alert",severity:k="success",slotProps:A={},slots:V={},variant:R="standard"}=f,N=i(f,he),D=s({},f,{color:b,severity:k,variant:R}),H=(e=>{const{variant:t,color:a,severity:o,classes:r}=e,n={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(n,ie,r)})(D),T=null!=(a=null!=(r=V.closeButton)?r:S.CloseButton)?a:l,F=null!=(v=null!=(m=V.closeIcon)?m:S.CloseIcon)?v:c,I=null!=(u=A.closeButton)?u:z.closeButton,B=null!=(g=A.closeIcon)?g:z.closeIcon;return o(ve,s({role:M,elevation:0,ownerState:D,className:d(H.root,$),ref:t},N,{children:[!1!==C?o(me,{ownerState:D,className:H.icon,children:C||P[k]||fe[k]}):null,o(ue,{ownerState:D,className:H.message,children:w}),null!=y?o(ge,{ownerState:D,className:H.action,children:y}):null,null==y&&L?o(ge,{ownerState:D,className:H.action,children:o(T,s({size:"small","aria-label":x,title:x,color:"inherit",onClick:L},I,{children:o(F,s({fontSize:"small"},B))}))}):null]}))}),we=a([o("path",{d:"M13 17c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h6V5H5v14h14v-2h-6z",opacity:".3"}),o("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.38-1-1.72zM20 9v6h-7V9h7zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2H5z"}),o("circle",{cx:"16",cy:"12",r:"1.5"})],"AccountBalanceWalletTwoTone"),$e=a([o("path",{d:"M8 6h8v6H8zm11 8H5c-.55 0-1 .45-1 1v3h16v-3c0-.55-.45-1-1-1zm-1 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z",opacity:".3"}),o("path",{d:"M19 12h-1V4H6v8H5c-1.66 0-3 1.34-3 3v5h20v-5c0-1.66-1.34-3-3-3zM8 6h8v6H8V6zm12 12H4v-3c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v3z"}),o("circle",{cx:"18",cy:"16",r:"1"})],"AdfScannerTwoTone"),xe=a([o("path",{d:"M9 4H7v2H5v12h2v2h2v-2h2V6H9V4zm0 12H7V8h2v8z"}),o("path",{d:"M7 8h2v8H7zm8 2h2v3h-2z",opacity:".3"}),o("path",{d:"M19 8h-2V4h-2v4h-2v7h2v5h2v-5h2V8zm-2 5h-2v-3h2v3z"})],"CandlestickChartTwoTone"),be=a([o("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm0 14.5c-.83 0-1.5-.67-1.5-1.5h3c0 .83-.67 1.5-1.5 1.5zm5-2.5H7v-2h1v-2.61C8 9.27 9.03 7.47 11 7v-.5c0-.57.43-1 1-1s1 .43 1 1V7c1.97.47 3 2.28 3 4.39V14h1v2z",opacity:".3"}),o("path",{d:"M12 18.5c.83 0 1.5-.67 1.5-1.5h-3c0 .83.67 1.5 1.5 1.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4-8.61c0-2.11-1.03-3.92-3-4.39v-.5c0-.57-.43-1-1-1s-1 .43-1 1V7c-1.97.47-3 2.27-3 4.39V14H7v2h10v-2h-1v-2.61zM14 14h-4v-3c0-1.1.9-2 2-2s2 .9 2 2v3z"})],"CircleNotificationsTwoTone"),Se=a(o("path",{d:"M21.5 14.98c-.02 0-.03 0-.05.01C21.2 13.3 19.76 12 18 12c-1.4 0-2.6.83-3.16 2.02C13.26 14.1 12 15.4 12 17c0 1.66 1.34 3 3 3l6.5-.02c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5zM10 4.26v2.09C7.67 7.18 6 9.39 6 12c0 1.77.78 3.34 2 4.44V14h2v6H4v-2h2.73C5.06 16.54 4 14.4 4 12c0-3.73 2.55-6.85 6-7.74zM20 6h-2.73c1.43 1.26 2.41 3.01 2.66 5h-2.02c-.23-1.36-.93-2.55-1.91-3.44V10h-2V4h6v2z"}),"CloudSync"),ze=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),Ce=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Pe=a([o("path",{d:"M14 4H6v16h12V8h-4V4zm2 7v4c0 2.21-1.79 4-4 4s-4-1.79-4-4V9.5C8 8.12 9.12 7 10.5 7S13 8.12 13 9.5V15h-2V9.5c0-.28-.22-.5-.5-.5s-.5.22-.5.5V15c0 1.1.9 2 2 2s2-.9 2-2v-4h2z",opacity:".3"}),o("path",{d:"M14 15c0 1.1-.9 2-2 2s-2-.9-2-2V9.5c0-.28.22-.5.5-.5s.5.22.5.5V15h2V9.5C13 8.12 11.88 7 10.5 7S8 8.12 8 9.5V15c0 2.21 1.79 4 4 4s4-1.79 4-4v-4h-2v4z"}),o("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h8v4h4v12z"})],"FilePresentTwoTone"),Le=a([o("path",{d:"M19 5H5v14h14V5zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z",opacity:".3"}),o("path",{d:"M3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2zm2 0h14v14H5V5zm2 5h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"})],"InsertChartTwoTone"),Me=a([o("path",{d:"M10 5h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z",opacity:".3"}),o("path",{d:"M16 11V3H8v6H2v12h20V11h-6zm-6-6h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z"})],"LeaderboardTwoTone"),ke=a(o(r.Fragment,{children:[o("path",{d:"M12 20c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8zM10 7.5l6 4.5-6 4.5v-9z",opacity:".3"}),o("path",{d:"M12 22c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm0-18c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8zm-2 3.5v9l6-4.5z"})]}),"PlayCircleFilledWhiteTwoTone"),Ae=a([o("path",{d:"M4 18h16V8H4v10zm8-3h6v2h-6v-2zm-5.91-4.59L7.5 9l4 4-4 4-1.41-1.41L8.67 13l-2.58-2.59z",opacity:".3"}),o("path",{d:"M12 15h6v2h-6z"}),o("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H4V8h16v10z"}),o("path",{d:"m7.5 17 4-4-4-4-1.41 1.41L8.67 13l-2.58 2.59z"})],"TerminalTwoTone"),Ve=b()(e=>({root:{marginTop:e.spacing(1),marginBottom:e.spacing(2),marginLeft:e.spacing(2),marginRight:e.spacing(3),background:"white",transition:"opacity 500ms","&:hover":{opacity:1},opacity:.35,cursor:"pointer"},open:{opacity:1},expandButton:{cursor:"pointer !important",marginLeft:e.spacing(1)},copyButton:{cursor:"pointer !important",marginRight:e.spacing(1)},downloadButton:{cursor:"pointer !important"}})),Re=(e,t="%")=>e?`${e.toFixed(2)}${t}`:"—",Ne=e=>e?`${e.toFixed(1)} min`:"—",De=e=>window.Translate?window.Translate.translateText(e):e,He=({data:e})=>{const{classes:t,cx:a}=Ve(),[n,i]=r.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:r,portfolioStdDev:n,portfolioSortinoRatio:i,portfolioCalmarRatio:s,portfolioRecoveryFactor:l,portfolioExpectancy:c,portfolioAvgPeakPnl:d,portfolioAvgFallPnl:p,portfolioPeakProfitPnl:h,portfolioMaxDrawdownPnl:v,portfolioAvgDuration:m,portfolioMedianPnl:u,portfolioAvgConsecutiveWinPnl:g,portfolioAvgConsecutiveLossPnl:f,portfolioAvgWinDuration:y,portfolioAvgLossDuration:w,portfolioAnnualizedSharpeRatio:$,portfolioCertaintyRatio:x,portfolioExpectedYearlyReturns:b,portfolioTradesPerYear:S,symbols:z,backtest:C}=e,P=De(C?"Backtest":"Live"),L=t.frameName?` / ${t.frameName}`:"",M=[`## ${P}: ${t.strategyName} / ${t.exchangeName}${L}`,"",`**${De("Total PNL")}:** ${Re(a)} `,`**Sharpe Ratio:** ${Re(o,"")} `,`**${De("Annualized Sharpe")}:** ${Re($,"")} `,`**${De("Certainty Ratio")}:** ${Re(x,"")} `,`**${De("Expected Yearly Returns")}:** ${Re(b)} `,`**${De("Trades Per Year")}:** ${null!==S?S.toFixed(1):"—"} `,`**${De("Total trades")}:** ${r} `,`**${De("Standard Deviation Per Trade")}:** ${Re(n)} `,`**${De("Sortino Ratio")}:** ${Re(i,"")} `,`**${De("Calmar Ratio")}:** ${Re(s,"")} `,`**${De("Recovery Factor Per Equity Drawdown")}:** ${Re(l,"")} `,`**${De("Expectancy")}:** ${Re(c)} `,`**${De("Median PNL")}:** ${Re(u)} `,`**${De("Avg Peak PNL")}:** ${Re(d)} `,`**${De("Avg Drawdown PNL")}:** ${Re(p)} `,`**${De("Peak Profit PNL")}:** ${Re(h)} `,`**${De("Max Drawdown PNL")}:** ${Re(v)} `,`**${De("Avg Duration")}:** ${Ne(m)} `,`**${De("Avg Win Duration")}:** ${Ne(y)} `,`**${De("Avg Loss Duration")}:** ${Ne(w)} `,`**${De("Avg Consecutive Win PNL")}:** ${Re(g)} `,`**${De("Avg Consecutive Loss PNL")}:** ${Re(f)}`,""];for(const k of z)M.push(`### ${k.symbol}`,"",`**PNL:** ${Re(k.totalPnl)} `,`**${De("Avg PNL")}:** ${Re(k.avgPnl)} `,`**${De("Median PNL")}:** ${Re(k.medianPnl)} `,`**Win Rate:** ${Re(k.winRate)} `,`**Profit Factor:** ${Re(k.profitFactor,"")} `,`**Max Drawdown:** ${Re(k.maxDrawdown)} `,`**Expectancy:** ${Re(k.expectancy)} `,`**Sharpe Ratio:** ${Re(k.sharpeRatio,"")} `,`**Annualized Sharpe:** ${Re(k.annualizedSharpeRatio,"")} `,`**Certainty Ratio:** ${Re(k.certaintyRatio,"")} `,`**Expected Yearly Returns:** ${Re(k.expectedYearlyReturns)} `,`**Trades Per Year:** ${null!==k.tradesPerYear?k.tradesPerYear.toFixed(1):"—"} `,`**Sortino Ratio:** ${Re(k.sortinoRatio,"")} `,`**Calmar Ratio:** ${Re(k.calmarRatio,"")} `,`**Recovery Factor Per Equity Drawdown:** ${Re(k.recoveryFactor,"")} `,`**Standard Deviation:** ${Re(k.stdDev)} `,`**Avg Win:** ${Re(k.avgWin)} `,`**Avg Loss:** ${Re(k.avgLoss)} `,`**Max Win Streak:** ${k.maxWinStreak} `,`**Max Loss Streak:** ${k.maxLossStreak} `,`**Avg Peak PNL:** ${Re(k.avgPeakPnl)} `,`**Avg Drawdown PNL:** ${Re(k.avgFallPnl)} `,`**Peak Profit PNL:** ${Re(k.peakProfitPnl)} `,`**Max Drawdown PNL:** ${Re(k.maxDrawdownPnl)} `,`**Avg Duration:** ${Ne(k.avgDuration)} `,`**Avg Win Duration:** ${Ne(k.avgWinDuration)} `,`**Avg Loss Duration:** ${Ne(k.avgLossDuration)} `,`**Avg Consecutive Win PNL:** ${Re(k.avgConsecutiveWinPnl)} `,`**Avg Consecutive Loss PNL:** ${Re(k.avgConsecutiveLossPnl)} `,`**${De("Trades")}:** ${k.totalTrades}`,"");return M.join("\n")})(e),c=()=>{i(!n)},d=async e=>{e.stopPropagation(),await M(s)},p=async e=>{e.stopPropagation(),await P(s)&&L.alertService.notify("Copied!")};return o(ye,{className:a(t.root,{[t.open]:n}),action:o(C,{children:[o(l,{className:t.copyButton,onClick:p,size:"small",children:o(S,{})}),o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(z,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(n?ze:Ce,{})})]}),onClick:c,variant:"outlined",severity:"info",children:o(f,{minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",width:"100%",children:[o(f,{variant:"body2",sx:{opacity:n?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?"Backtest":"Live",": ",e.context.strategyName]}),o(y,{in:n,timeout:"auto",unmountOnExit:!0,children:[o(w,{paddingBottom:"16px"}),o($,{content:s}),o(w,{paddingBottom:"32px"})]}),!n&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[x(s).slice(0,150),"..."]})]})})},Te="backtest-kit__groupHeader",Fe="backtest-kit__groupRoot",Ie="backtest-kit__symbolImage",Be=b()({root:{[`& .${Fe}:hover .${Te}`]:{opacity:"1 !important"}}});function We(e){return te(e,"#000000")>te(e,"#FFFFFF")}const Ee=[{type:j.Component,element:()=>{const{reloadTrigger:e,doReload:t}=k(15e3),[a,{execute:r}]=A(async()=>{L.runtimeViewService.getRuntimeInfo.clear();const e=V(L.runtimeViewService.getRuntimeInfo,{defaultValue:null});return await e()},{onLoadStart:()=>L.layoutService.setAppbarLoader(!0),onLoadEnd:()=>L.layoutService.setAppbarLoader(!1),deps:[e]});R(()=>oe.subscribe(r));return o(H,{direction:"row",alignItems:"center",children:[o(N,{"aria-label":"breadcrumb",children:[o(D,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:"Main"}),o(D,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:"Navigation"})]}),o(w,{flex:1}),(()=>{if(!a)return null;const{symbol:e,when:r,currentPrice:n,backtest:i}=a;return o(W,{placement:"bottom",description:i?"Backtest mode":"Live mode",children:o(H,{direction:"row",alignItems:"center",spacing:1,sx:{display:{xs:"none",sm:"flex"},cursor:"pointer",userSelect:"none"},onClick:()=>{L.runtimeViewService.getRuntimeInfo.clear(),t()},children:[o(l,{size:"small",children:o(Se,{})}),o(f,{variant:"body2",sx:{opacity:.5},children:["Symbol:",T.nbsp,o("b",{children:e})]}),o(F,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:["Time:",T.nbsp,o("b",{children:I(r).format("HH:mm DD MMM YYYY")})]}),o(F,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:["Price:",T.nbsp,o("b",{children:[B(n,E(n)),"$"]})]})]})})})(),o(w,{pr:1})]})}}],Oe=[{action:"download-json",label:"Download Heatmap JSON",icon:()=>o(G,{icon:_,color:"#4caf50"})},{action:"download-markdown",label:"Download Heatmap Markdown",icon:()=>o(G,{icon:U,color:"#4caf50"})},{action:"download-pdf",label:"Download Heatmap PDF",icon:()=>o(G,{icon:q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(G,{icon:ne,color:"#4caf50"})}],je=(e,t)=>({type:K.Group,className:Fe,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:K.Component,className:Te,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(H,{direction:"row",children:[o(Q,{variant:"outlined",size:"medium",color:"info",label:`${T.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(w,{flex:1})]})},{type:K.Group,fields:t.map(({label:e,description:t,to:a,color:r,icon:n})=>((e,t,a,r,n)=>({type:K.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(W,{description:a,children:o(X,{component:ee,onClick:()=>{L.routerService.push(e)},sx:{width:"100%",background:r,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ie}`]:{transition:"filter 500ms"},"&:hover":{background:()=>We(r)?u(r,.33):g(r,.33),[`& .${Ie}`]:{transition:"filter 500ms",filter:We(r)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:Ie}),children:t})})}))(a,e,t,r,n))}]}),Ye=[{label:"Portfolio Overview",description:ae.newline("Closed trading signals grouped by symbol for Backtest and Live modes","Each card shows position type, entry price, TP/SL levels, PNL amount and percent","Displays DCA entry count and partial close count where applicable","Supports JSON export and manual refresh of the signal list"),to:"/overview",color:"#0033AD",icon:we},{label:"PNL Performance",description:ae.newline("KPI dashboard with aggregated trading performance metrics per symbol","Shows daily trade counts, success rates, resolved/rejected breakdowns","Revenue analytics across today, yesterday, 7-day and 31-day windows","Toggle between Backtest and Live modes; supports JSON export"),to:"/dashboard",color:"#E6007A",icon:Le},{label:"System Logs",description:ae.newline("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log","Each entry shows topic, timestamp and raw JSON arguments in monospace","Filter by keyword or regex via search prompt","Supports full log export as JSON file"),to:"/logs",color:"#58BF00",icon:Ae}],Je=[{label:"Notifications",description:ae.newline("Event feed for all trading signals: opens, closes, schedules, errors","Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices","Infinite-scroll pagination; click any card to open a detailed modal","Supports manual refresh to pull the latest activity"),to:"/notifications",color:"#F7931A",icon:be},{label:"Pending Status",description:ae.newline("Live view of active trading signals grouped by strategy","Grid of strategy buttons; click to inspect individual signal state","Detail view shows entry, exit, effective price, DCA and partial counts","Supports per-signal JSON export and manual refresh"),to:"/status",color:"#6F42C1",icon:ke},{label:"Dump Explorer",description:ae.newline("Tree-structured file browser for backtest output and artifact files","Icons indicate file type: image, JSON, plain text or generic","Click any file to open a full-screen preview modal","Supports keyword search and manual refresh of the file tree"),to:"/dump",color:"#0090FF",icon:Pe}],_e=[{label:"Markdown Reports",description:ae.newline("Strategy performance reports rendered from markdown for Backtest and Live runs","Grid of strategy buttons grouped by type and sorted by signal volume","Download reports as markdown, PDF or raw JSON","Supports manual refresh to regenerate report content"),to:"/report",color:"#009688",icon:$e},{label:"Price Charts",description:ae.newline("Interactive candlestick charts powered by TradingView Lightweight Charts","Navigate by symbol then interval (1m, 15m, 1h) to view price history","Overlays active signal lines: entry, take profit (green) and stop loss (red)","Supports chart image export and signal detail inspection"),to:"/price_chart",color:"#1565C0",icon:xe},{label:"Heatmap",description:ae.newline("Color-coded performance heatmap across all tracked symbols","Cells show win rate, profit factor, Sharpe ratio and other key metrics","Download heatmap as JSON, markdown report or PDF","Supports manual refresh to recalculate aggregated statistics"),to:"/heat",color:"#8D6E63",icon:Me}],Ge=[je("Application",Ye),je("Live",Je),je("Other",_e)],Ue=()=>o(Z,{sx:{width:"100%",height:"75px"}}),qe=()=>{const{classes:e}=Be();return o(re,{children:[o(O,{items:Ee,actions:Oe,onAction:async e=>{"update-now"===e&&await(async()=>{L.statusViewService.getStatusInfo.clear(),oe.next()})(),"download-markdown"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);L.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport();await M(e)})(),"download-json"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);L.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),o(Y,{Loader:Ue,reloadSubject:oe,children:async()=>{const e=await L.statusViewService.getStatusInfo();return e?o(He,{data:e}):null}}),o(J,{className:e.root,fields:Ge,payload:()=>({history:history})}),o(w,{paddingBottom:"24px"})]})};export{qe as MainPage,qe as default};
1
+ import{g as e,a as t,b as a,f as o,r,u as n,_ as i,d as s,I as l,C as c,e as d,j as p,k as h,s as v,P as m,l as u,n as g,T as f,o as y,B as w,M as $,t as x,p as b,q as S,D as z,F as C,v as P,i as L,w as M,Q as k,x as A,y as V,X as R,z as N,L as D,A as H,E as T,G as F,H as I,J as B,K as W,N as E,O,R as j,V as Y,W as J,Y as _,Z as G,$ as U,a0 as q,a1 as Z,a2 as K,a3 as Q,a4 as X,a5 as ee,a6 as te,a7 as ae}from"./index-BI3k7b1T.js";import{r as oe}from"./emitters-DmNf0ttF.js";import{C as re,R as ne}from"./Refresh-3cixHjvW.js";function ie(t){return e("MuiAlert",t)}const se=t("MuiAlert",["root","action","icon","message","filled","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),le=a(o("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),ce=a(o("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),de=a(o("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),pe=a(o("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),he=["action","children","className","closeText","color","components","componentsProps","icon","iconMapping","onClose","role","severity","slotProps","slots","variant"],ve=v(m,{name:"MuiAlert",slot:"Root",overridesResolver:(e,t)=>{const{ownerState:a}=e;return[t.root,t[a.variant],t[`${a.variant}${p(a.color||a.severity)}`]]}})(({theme:e,ownerState:t})=>{const a="light"===e.palette.mode?u:g,o="light"===e.palette.mode?g:u,r=t.color||t.severity;return s({},e.typography.body2,{backgroundColor:"transparent",display:"flex",padding:"6px 16px"},r&&"standard"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),backgroundColor:e.vars?e.vars.palette.Alert[`${r}StandardBg`]:o(e.palette[r].light,.9),[`& .${se.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"outlined"===t.variant&&{color:e.vars?e.vars.palette.Alert[`${r}Color`]:a(e.palette[r].light,.6),border:`1px solid ${(e.vars||e).palette[r].light}`,[`& .${se.icon}`]:e.vars?{color:e.vars.palette.Alert[`${r}IconColor`]}:{color:e.palette[r].main}},r&&"filled"===t.variant&&s({fontWeight:e.typography.fontWeightMedium},e.vars?{color:e.vars.palette.Alert[`${r}FilledColor`],backgroundColor:e.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:"dark"===e.palette.mode?e.palette[r].dark:e.palette[r].main,color:e.palette.getContrastText(e.palette[r].main)}))}),me=v("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(e,t)=>t.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ue=v("div",{name:"MuiAlert",slot:"Message",overridesResolver:(e,t)=>t.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ge=v("div",{name:"MuiAlert",slot:"Action",overridesResolver:(e,t)=>t.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),fe={success:o(le,{fontSize:"inherit"}),warning:o(ce,{fontSize:"inherit"}),error:o(de,{fontSize:"inherit"}),info:o(pe,{fontSize:"inherit"})},ye=r.forwardRef(function(e,t){var a,r,v,m,u,g;const f=n({props:e,name:"MuiAlert"}),{action:y,children:w,className:$,closeText:x="Close",color:b,components:S={},componentsProps:z={},icon:C,iconMapping:P=fe,onClose:L,role:M="alert",severity:k="success",slotProps:A={},slots:V={},variant:R="standard"}=f,N=i(f,he),D=s({},f,{color:b,severity:k,variant:R}),H=(e=>{const{variant:t,color:a,severity:o,classes:r}=e,n={root:["root",`${t}${p(a||o)}`,`${t}`],icon:["icon"],message:["message"],action:["action"]};return h(n,ie,r)})(D),T=null!=(a=null!=(r=V.closeButton)?r:S.CloseButton)?a:l,F=null!=(v=null!=(m=V.closeIcon)?m:S.CloseIcon)?v:c,I=null!=(u=A.closeButton)?u:z.closeButton,B=null!=(g=A.closeIcon)?g:z.closeIcon;return o(ve,s({role:M,elevation:0,ownerState:D,className:d(H.root,$),ref:t},N,{children:[!1!==C?o(me,{ownerState:D,className:H.icon,children:C||P[k]||fe[k]}):null,o(ue,{ownerState:D,className:H.message,children:w}),null!=y?o(ge,{ownerState:D,className:H.action,children:y}):null,null==y&&L?o(ge,{ownerState:D,className:H.action,children:o(T,s({size:"small","aria-label":x,title:x,color:"inherit",onClick:L},I,{children:o(F,s({fontSize:"small"},B))}))}):null]}))}),we=a([o("path",{d:"M13 17c-1.1 0-2-.9-2-2V9c0-1.1.9-2 2-2h6V5H5v14h14v-2h-6z",opacity:".3"}),o("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.38-1-1.72zM20 9v6h-7V9h7zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2H5z"}),o("circle",{cx:"16",cy:"12",r:"1.5"})],"AccountBalanceWalletTwoTone"),$e=a([o("path",{d:"M8 6h8v6H8zm11 8H5c-.55 0-1 .45-1 1v3h16v-3c0-.55-.45-1-1-1zm-1 3c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z",opacity:".3"}),o("path",{d:"M19 12h-1V4H6v8H5c-1.66 0-3 1.34-3 3v5h20v-5c0-1.66-1.34-3-3-3zM8 6h8v6H8V6zm12 12H4v-3c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v3z"}),o("circle",{cx:"18",cy:"16",r:"1"})],"AdfScannerTwoTone"),xe=a([o("path",{d:"M9 4H7v2H5v12h2v2h2v-2h2V6H9V4zm0 12H7V8h2v8z"}),o("path",{d:"M7 8h2v8H7zm8 2h2v3h-2z",opacity:".3"}),o("path",{d:"M19 8h-2V4h-2v4h-2v7h2v5h2v-5h2V8zm-2 5h-2v-3h2v3z"})],"CandlestickChartTwoTone"),be=a([o("path",{d:"M12 4c-4.41 0-8 3.59-8 8s3.59 8 8 8 8-3.59 8-8-3.59-8-8-8zm0 14.5c-.83 0-1.5-.67-1.5-1.5h3c0 .83-.67 1.5-1.5 1.5zm5-2.5H7v-2h1v-2.61C8 9.27 9.03 7.47 11 7v-.5c0-.57.43-1 1-1s1 .43 1 1V7c1.97.47 3 2.28 3 4.39V14h1v2z",opacity:".3"}),o("path",{d:"M12 18.5c.83 0 1.5-.67 1.5-1.5h-3c0 .83.67 1.5 1.5 1.5zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4-8.61c0-2.11-1.03-3.92-3-4.39v-.5c0-.57-.43-1-1-1s-1 .43-1 1V7c-1.97.47-3 2.27-3 4.39V14H7v2h10v-2h-1v-2.61zM14 14h-4v-3c0-1.1.9-2 2-2s2 .9 2 2v3z"})],"CircleNotificationsTwoTone"),Se=a(o("path",{d:"M21.5 14.98c-.02 0-.03 0-.05.01C21.2 13.3 19.76 12 18 12c-1.4 0-2.6.83-3.16 2.02C13.26 14.1 12 15.4 12 17c0 1.66 1.34 3 3 3l6.5-.02c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5zM10 4.26v2.09C7.67 7.18 6 9.39 6 12c0 1.77.78 3.34 2 4.44V14h2v6H4v-2h2.73C5.06 16.54 4 14.4 4 12c0-3.73 2.55-6.85 6-7.74zM20 6h-2.73c1.43 1.26 2.41 3.01 2.66 5h-2.02c-.23-1.36-.93-2.55-1.91-3.44V10h-2V4h6v2z"}),"CloudSync"),ze=a(o("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess"),Ce=a(o("path",{d:"M16.59 8.59 12 13.17 7.41 8.59 6 10l6 6 6-6z"}),"ExpandMore"),Pe=a([o("path",{d:"M14 4H6v16h12V8h-4V4zm2 7v4c0 2.21-1.79 4-4 4s-4-1.79-4-4V9.5C8 8.12 9.12 7 10.5 7S13 8.12 13 9.5V15h-2V9.5c0-.28-.22-.5-.5-.5s-.5.22-.5.5V15c0 1.1.9 2 2 2s2-.9 2-2v-4h2z",opacity:".3"}),o("path",{d:"M14 15c0 1.1-.9 2-2 2s-2-.9-2-2V9.5c0-.28.22-.5.5-.5s.5.22.5.5V15h2V9.5C13 8.12 11.88 7 10.5 7S8 8.12 8 9.5V15c0 2.21 1.79 4 4 4s4-1.79 4-4v-4h-2v4z"}),o("path",{d:"M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h8v4h4v12z"})],"FilePresentTwoTone"),Le=a([o("path",{d:"M19 5H5v14h14V5zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z",opacity:".3"}),o("path",{d:"M3 5v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2zm2 0h14v14H5V5zm2 5h2v7H7zm4-3h2v10h-2zm4 6h2v4h-2z"})],"InsertChartTwoTone"),Me=a([o("path",{d:"M10 5h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z",opacity:".3"}),o("path",{d:"M16 11V3H8v6H2v12h20V11h-6zm-6-6h4v14h-4V5zm-6 6h4v8H4v-8zm16 8h-4v-6h4v6z"})],"LeaderboardTwoTone"),ke=a(o(r.Fragment,{children:[o("path",{d:"M12 20c4.41 0 8-3.59 8-8s-3.59-8-8-8-8 3.59-8 8 3.59 8 8 8zM10 7.5l6 4.5-6 4.5v-9z",opacity:".3"}),o("path",{d:"M12 22c5.52 0 10-4.48 10-10S17.52 2 12 2 2 6.48 2 12s4.48 10 10 10zm0-18c4.41 0 8 3.59 8 8s-3.59 8-8 8-8-3.59-8-8 3.59-8 8-8zm-2 3.5v9l6-4.5z"})]}),"PlayCircleFilledWhiteTwoTone"),Ae=a([o("path",{d:"M4 18h16V8H4v10zm8-3h6v2h-6v-2zm-5.91-4.59L7.5 9l4 4-4 4-1.41-1.41L8.67 13l-2.58-2.59z",opacity:".3"}),o("path",{d:"M12 15h6v2h-6z"}),o("path",{d:"M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm0 14H4V8h16v10z"}),o("path",{d:"m7.5 17 4-4-4-4-1.41 1.41L8.67 13l-2.58 2.59z"})],"TerminalTwoTone"),Ve=b()(e=>({root:{marginTop:e.spacing(1),marginBottom:e.spacing(2),marginLeft:e.spacing(2),marginRight:e.spacing(3),background:"white",transition:"opacity 500ms","&:hover":{opacity:1},opacity:.35,cursor:"pointer"},open:{opacity:1},expandButton:{cursor:"pointer !important",marginLeft:e.spacing(1)},copyButton:{cursor:"pointer !important",marginRight:e.spacing(1)},downloadButton:{cursor:"pointer !important"}})),Re=(e,t="%")=>e?`${e.toFixed(2)}${t}`:"—",Ne=e=>e?`${e.toFixed(1)} min`:"—",De=e=>window.Translate?window.Translate.translateText(e):e,He=({data:e})=>{const{classes:t,cx:a}=Ve(),[n,i]=r.useState(!1),s=(e=>{const{context:t,portfolioTotalPnl:a,portfolioSharpeRatio:o,portfolioTotalTrades:r,portfolioStdDev:n,portfolioSortinoRatio:i,portfolioCalmarRatio:s,portfolioRecoveryFactor:l,portfolioExpectancy:c,portfolioAvgPeakPnl:d,portfolioAvgFallPnl:p,portfolioPeakProfitPnl:h,portfolioMaxDrawdownPnl:v,portfolioAvgDuration:m,portfolioMedianPnl:u,portfolioAvgConsecutiveWinPnl:g,portfolioAvgConsecutiveLossPnl:f,portfolioAvgWinDuration:y,portfolioAvgLossDuration:w,portfolioAnnualizedSharpeRatio:$,portfolioCertaintyRatio:x,portfolioExpectedYearlyReturns:b,portfolioTradesPerYear:S,symbols:z,backtest:C}=e,P=De(C?"Backtest":"Live"),L=t.frameName?` / ${t.frameName}`:"",M=[`## ${P}: ${t.strategyName} / ${t.exchangeName}${L}`,"",`**${De("Total PNL")}:** ${Re(a)} `,`**Sharpe Ratio:** ${Re(o,"")} `,`**${De("Annualized Sharpe")}:** ${Re($,"")} `,`**${De("Certainty Ratio")}:** ${Re(x,"")} `,`**${De("Expected Yearly Returns")}:** ${Re(b)} `,`**${De("Trades Per Year")}:** ${null!==S?S.toFixed(1):"—"} `,`**${De("Total trades")}:** ${r} `,`**${De("Standard Deviation Per Trade")}:** ${Re(n)} `,`**${De("Sortino Ratio")}:** ${Re(i,"")} `,`**${De("Calmar Ratio")}:** ${Re(s,"")} `,`**${De("Recovery Factor Per Equity Drawdown")}:** ${Re(l,"")} `,`**${De("Expectancy")}:** ${Re(c)} `,`**${De("Median PNL")}:** ${Re(u)} `,`**${De("Avg Peak PNL")}:** ${Re(d)} `,`**${De("Avg Drawdown PNL")}:** ${Re(p)} `,`**${De("Peak Profit PNL")}:** ${Re(h)} `,`**${De("Max Drawdown PNL")}:** ${Re(v)} `,`**${De("Avg Duration")}:** ${Ne(m)} `,`**${De("Avg Win Duration")}:** ${Ne(y)} `,`**${De("Avg Loss Duration")}:** ${Ne(w)} `,`**${De("Avg Consecutive Win PNL")}:** ${Re(g)} `,`**${De("Avg Consecutive Loss PNL")}:** ${Re(f)}`,""];for(const k of z)M.push(`### ${k.symbol}`,"",`**PNL:** ${Re(k.totalPnl)} `,`**${De("Avg PNL")}:** ${Re(k.avgPnl)} `,`**${De("Median PNL")}:** ${Re(k.medianPnl)} `,`**Win Rate:** ${Re(k.winRate)} `,`**Profit Factor:** ${Re(k.profitFactor,"")} `,`**Max Drawdown:** ${Re(k.maxDrawdown)} `,`**Expectancy:** ${Re(k.expectancy)} `,`**Sharpe Ratio:** ${Re(k.sharpeRatio,"")} `,`**Annualized Sharpe:** ${Re(k.annualizedSharpeRatio,"")} `,`**Certainty Ratio:** ${Re(k.certaintyRatio,"")} `,`**Expected Yearly Returns:** ${Re(k.expectedYearlyReturns)} `,`**Trades Per Year:** ${null!==k.tradesPerYear?k.tradesPerYear.toFixed(1):"—"} `,`**Sortino Ratio:** ${Re(k.sortinoRatio,"")} `,`**Calmar Ratio:** ${Re(k.calmarRatio,"")} `,`**Recovery Factor Per Equity Drawdown:** ${Re(k.recoveryFactor,"")} `,`**Standard Deviation:** ${Re(k.stdDev)} `,`**Avg Win:** ${Re(k.avgWin)} `,`**Avg Loss:** ${Re(k.avgLoss)} `,`**Max Win Streak:** ${k.maxWinStreak} `,`**Max Loss Streak:** ${k.maxLossStreak} `,`**Avg Peak PNL:** ${Re(k.avgPeakPnl)} `,`**Avg Drawdown PNL:** ${Re(k.avgFallPnl)} `,`**Peak Profit PNL:** ${Re(k.peakProfitPnl)} `,`**Max Drawdown PNL:** ${Re(k.maxDrawdownPnl)} `,`**Avg Duration:** ${Ne(k.avgDuration)} `,`**Avg Win Duration:** ${Ne(k.avgWinDuration)} `,`**Avg Loss Duration:** ${Ne(k.avgLossDuration)} `,`**Avg Consecutive Win PNL:** ${Re(k.avgConsecutiveWinPnl)} `,`**Avg Consecutive Loss PNL:** ${Re(k.avgConsecutiveLossPnl)} `,`**${De("Trades")}:** ${k.totalTrades}`,"");return M.join("\n")})(e),c=()=>{i(!n)},d=async e=>{e.stopPropagation(),await M(s)},p=async e=>{e.stopPropagation(),await P(s)&&L.alertService.notify("Copied!")};return o(ye,{className:a(t.root,{[t.open]:n}),action:o(C,{children:[o(l,{className:t.copyButton,onClick:p,size:"small",children:o(S,{})}),o(l,{className:t.downloadButton,onClick:d,size:"small",children:o(z,{})}),o(l,{className:t.expandButton,onClick:c,size:"small",children:o(n?ze:Ce,{})})]}),onClick:c,variant:"outlined",severity:"info",children:o(f,{minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",width:"100%",children:[o(f,{variant:"body2",sx:{opacity:n?.5:1,transition:"opacity 500ms"},minHeight:"100%",display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"center",children:[e.backtest?"Backtest":"Live",": ",e.context.strategyName]}),o(y,{in:n,timeout:"auto",unmountOnExit:!0,children:[o(w,{paddingBottom:"16px"}),o($,{content:s}),o(w,{paddingBottom:"32px"})]}),!n&&o(f,{variant:"caption",sx:{opacity:.7,mt:1},children:[x(s).slice(0,150),"..."]})]})})},Te="backtest-kit__groupHeader",Fe="backtest-kit__groupRoot",Ie="backtest-kit__symbolImage",Be=b()({root:{[`& .${Fe}:hover .${Te}`]:{opacity:"1 !important"}}});function We(e){return te(e,"#000000")>te(e,"#FFFFFF")}const Ee=[{type:j.Component,element:()=>{const{reloadTrigger:e,doReload:t}=k(15e3),[a,{execute:r}]=A(async()=>{L.runtimeViewService.getRuntimeInfo.clear();const e=V(L.runtimeViewService.getRuntimeInfo,{defaultValue:null});return await e()},{onLoadStart:()=>L.layoutService.setAppbarLoader(!0),onLoadEnd:()=>L.layoutService.setAppbarLoader(!1),deps:[e]});R(()=>oe.subscribe(r));return o(H,{direction:"row",alignItems:"center",children:[o(N,{"aria-label":"breadcrumb",children:[o(D,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:"Main"}),o(D,{underline:"always",color:"inherit",href:"#",onClick:e=>e.preventDefault(),children:"Navigation"})]}),o(w,{flex:1}),(()=>{if(!a)return null;const{symbol:e,when:r,currentPrice:n,backtest:i}=a;return o(W,{placement:"bottom",description:i?"Backtest mode":"Live mode",children:o(H,{direction:"row",alignItems:"center",spacing:1,sx:{display:{xs:"none",sm:"flex"},cursor:"pointer",userSelect:"none"},onClick:()=>{L.runtimeViewService.getRuntimeInfo.clear(),t()},children:[o(l,{size:"small",children:o(Se,{})}),o(f,{variant:"body2",sx:{opacity:.5},children:["Symbol:",T.nbsp,o("b",{children:e})]}),o(F,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:["Time:",T.nbsp,o("b",{children:I(r).format("HH:mm DD MMM YYYY")})]}),o(F,{orientation:"vertical",flexItem:!0}),o(f,{variant:"body2",sx:{opacity:.5},children:["Price:",T.nbsp,o("b",{children:[B(n,E(n)),"$"]})]})]})})})(),o(w,{pr:1})]})}}],Oe=[{action:"download-json",label:"Download Heatmap JSON",icon:()=>o(G,{icon:_,color:"#4caf50"})},{action:"download-markdown",label:"Download Heatmap Markdown",icon:()=>o(G,{icon:U,color:"#4caf50"})},{action:"download-pdf",label:"Download Heatmap PDF",icon:()=>o(G,{icon:q,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>o(G,{icon:ne,color:"#4caf50"})}],je=(e,t)=>({type:K.Group,className:Fe,sx:{p:2},desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fields:[{type:K.Component,className:Te,style:{transition:"opacity 500ms",opacity:.5},element:()=>o(H,{direction:"row",children:[o(Q,{variant:"outlined",size:"medium",color:"info",label:`${T.bullet} ${e}`,sx:{mb:1,pr:.5,fontSize:"16px",background:"white",cursor:"not-allowed"}}),o(w,{flex:1})]})},{type:K.Group,fields:t.map(({label:e,description:t,to:a,color:r,icon:n})=>((e,t,a,r,n)=>({type:K.Component,desktopColumns:"6",tabletColumns:"12",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:()=>o(W,{description:a,children:o(X,{component:ee,onClick:()=>{L.routerService.push(e)},sx:{width:"100%",background:r,color:"white",fontWeight:"bold",fontSize:"18px",height:"75px",minHeight:"125px",textWrap:"wrap",padding:"16px",[`& .${Ie}`]:{transition:"filter 500ms"},"&:hover":{background:()=>We(r)?u(r,.33):g(r,.33),[`& .${Ie}`]:{transition:"filter 500ms",filter:We(r)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:o(n,{className:Ie}),children:t})})}))(a,e,t,r,n))}]}),Ye=[{label:"Portfolio Overview",description:ae.newline("Closed trading signals grouped by symbol for Backtest and Live modes","Each card shows position type, entry price, TP/SL levels, PNL amount and percent","Displays DCA entry count and partial close count where applicable","Supports JSON export and manual refresh of the signal list"),to:"/overview",color:"#0033AD",icon:we},{label:"PNL Performance",description:ae.newline("KPI dashboard with aggregated trading performance metrics per symbol","Shows daily trade counts, success rates, resolved/rejected breakdowns","Revenue analytics across today, yesterday, 7-day and 31-day windows","Toggle between Backtest and Live modes; supports JSON export"),to:"/dashboard",color:"#E6007A",icon:Le},{label:"System Logs",description:ae.newline("Virtualized feed of runtime log entries with type badges: Debug, Info, Warn, Log","Each entry shows topic, timestamp and raw JSON arguments in monospace","Filter by keyword or regex via search prompt","Supports full log export as JSON file"),to:"/logs",color:"#58BF00",icon:Ae}],Je=[{label:"Notifications",description:ae.newline("Event feed for all trading signals: opens, closes, schedules, errors","Color-coded cards with symbol, position, PNL, entry/exit/TP/SL prices","Infinite-scroll pagination; click any card to open a detailed modal","Supports manual refresh to pull the latest activity"),to:"/notifications",color:"#F7931A",icon:be},{label:"Pending Status",description:ae.newline("Live view of active trading signals grouped by strategy","Grid of strategy buttons; click to inspect individual signal state","Detail view shows entry, exit, effective price, DCA and partial counts","Supports per-signal JSON export and manual refresh"),to:"/status",color:"#6F42C1",icon:ke},{label:"Dump Explorer",description:ae.newline("Tree-structured file browser for backtest output and artifact files","Icons indicate file type: image, JSON, plain text or generic","Click any file to open a full-screen preview modal","Supports keyword search and manual refresh of the file tree"),to:"/dump",color:"#0090FF",icon:Pe}],_e=[{label:"Markdown Reports",description:ae.newline("Strategy performance reports rendered from markdown for Backtest and Live runs","Grid of strategy buttons grouped by type and sorted by signal volume","Download reports as markdown, PDF or raw JSON","Supports manual refresh to regenerate report content"),to:"/report",color:"#009688",icon:$e},{label:"Price Charts",description:ae.newline("Interactive candlestick charts powered by TradingView Lightweight Charts","Navigate by symbol then interval (1m, 15m, 1h) to view price history","Overlays active signal lines: entry, take profit (green) and stop loss (red)","Supports chart image export and signal detail inspection"),to:"/price_chart",color:"#1565C0",icon:xe},{label:"Heatmap",description:ae.newline("Color-coded performance heatmap across all tracked symbols","Cells show win rate, profit factor, Sharpe ratio and other key metrics","Download heatmap as JSON, markdown report or PDF","Supports manual refresh to recalculate aggregated statistics"),to:"/heat",color:"#8D6E63",icon:Me}],Ge=[je("Application",Ye),je("Live",Je),je("Other",_e)],Ue=()=>o(Z,{sx:{width:"100%",height:"75px"}}),qe=()=>{const{classes:e}=Be();return o(re,{children:[o(O,{items:Ee,actions:Oe,onAction:async e=>{"update-now"===e&&await(async()=>{L.statusViewService.getStatusInfo.clear(),oe.next()})(),"download-markdown"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport(),t=new Blob([e],{type:"text/plain"}),a=URL.createObjectURL(t);L.layoutService.downloadFile(a,`heat_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatReport();await M(e)})(),"download-json"===e&&await(async()=>{const e=await L.heatViewService.getStrategyHeatData(),t=JSON.stringify(e,null,2),a=new Blob([t],{type:"text/plain"}),o=URL.createObjectURL(a);L.layoutService.downloadFile(o,`heat_${Date.now()}.json`)})()}}),o(Y,{Loader:Ue,reloadSubject:oe,children:async()=>{const e=await L.statusViewService.getStatusInfo();return e?o(He,{data:e}):null}}),o(J,{className:e.root,fields:Ge,payload:()=>({history:history})}),o(w,{paddingBottom:"24px"})]})};export{qe as MainPage,qe as default};
@@ -1 +1 @@
1
- import{f as e,b7 as t,M as a,B as i,q as r,bj as o,i as n,bk as l,v as s,b3 as c,bl as d,Y as w,Z as p,$ as h,a0 as m,b0 as k,bm as g,aI as b,bn as v,av as y,bh as u,b5 as f,ad as S,A as x,bo as _,ax as D,w as V,Q as N,x as O,O as R,R as L,p as B,a2 as A,T as P,b2 as C,W as $,F as j,a3 as J,E as M,a5 as G,l as F,n as X,a4 as H,a6 as I,aj as E}from"./index-kQlTYlpK.js";import{h as z}from"./hasRouteMatch-C0K-M4jy.js";import{I as T}from"./IconPhoto-DrGLW-rX.js";import{C as U,R as W}from"./Refresh-DixrXBVq.js";import{K as q}from"./KeyboardArrowLeft-BpxUzr7-.js";const K=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Q=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Y=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Z=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,className:a,style:i,sx:r,disabled:t,options:Z,onAction:s})},te=y(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:y}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},y=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:K,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Y,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:y,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return I(e,"#000000")>I(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(q,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:W,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${M.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:r,type:o,color:n})=>((t,a,r,o,n)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:l})=>e(H,{component:G,onClick:()=>{l.handleOpen(t,a)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(n)?F(n,.33):X(n,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:r}),children:e(i,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(r,o,t,a,n))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(j,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(E,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
1
+ import{f as e,b7 as t,M as a,B as i,q as r,bj as o,i as n,bk as l,v as s,b3 as c,bl as d,Y as w,Z as p,$ as h,a0 as m,b0 as k,bm as g,aI as b,bn as v,av as y,bh as u,b5 as f,ad as S,A as x,bo as _,ax as D,w as V,Q as N,x as O,O as R,R as L,p as B,a2 as A,T as P,b2 as C,W as $,F as j,a3 as J,E as M,a5 as G,l as F,n as X,a4 as H,a6 as I,aj as E}from"./index-BI3k7b1T.js";import{h as z}from"./hasRouteMatch-CqJJG3sx.js";import{I as T}from"./IconPhoto-Czod_jkW.js";import{C as U,R as W}from"./Refresh-3cixHjvW.js";import{K as q}from"./KeyboardArrowLeft-BUZ_pXI5.js";const K=[{id:"backtest",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/backtest")},{id:"live",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/live")},{id:"breakeven",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/breakeven")},{id:"risk",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/risk")},{id:"partial",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/partial")},{id:"highest_profit",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/highest_profit")},{id:"max_drawdown",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/max_drawdown")},{id:"schedule",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/schedule")},{id:"performance",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/performance")},{id:"sync",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/sync")},{id:"heat",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/heat")},{id:"strategy",element:({data:r})=>e(i,{sx:{height:"100%",width:"100%",pt:1},children:e(t,{withScrollbar:!0,hideOverflowX:!0,sx:{height:"100%"},children:e("div",{children:[e(a,{content:r||"# Нет данных"}),e(i,{sx:{paddingBottom:"65px"}})]})})}),isActive:e=>e.includes("/markdown_report/strategy")}],Q=[{id:"backtest",label:"Backtest",isVisible:({type:e})=>"backtest"===e},{id:"live",label:"Live",isVisible:({type:e})=>"live"===e},{id:"strategy",label:"Strategy"},{id:"breakeven",label:"Breakeven"},{id:"risk",label:"Risk"},{id:"partial",label:"Partial"},{id:"highest_profit",label:"Highest Profit"},{id:"max_drawdown",label:"Max Drawdown"},{id:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Y=({disabled:t,className:a,style:i,sx:c,onClick:d,color:w})=>e(l,{className:a,style:i,sx:c,disabled:t,color:w,size:36,onClick:async e=>{const[t,{resolve:a}]=o();e.preventDefault(),e.stopPropagation(),await d(e,e=>a(e));const i=await t;await(async e=>{let t=!1;t=t||"string"==typeof e,t=t||"number"==typeof e,t=t||"boolean"==typeof e,t=t||void 0===e,t=t||null===e,t&&await s(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Z=[{action:"json",label:"Download JSON",icon:()=>e(p,{icon:w,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(p,{icon:h,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(p,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:l})=>{const s=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await l()});return e(d,{transparent:!0,className:a,style:i,sx:r,disabled:t,options:Z,onAction:s})},te=y(),ae=D(async(e,t)=>{const a=("backtest"===t?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(t=>t.id===e);if(!a)throw new Error(`Item not found: ${e}`);const{symbol:i,strategyName:r,exchangeName:o,frameName:l}=a,[s,c,d,w,p,h,m,k,g,b,v,y]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,l):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,l,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,l,"backtest"===t),n.markdownViewService.getMaxDrawdownReport(i,r,o,l,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,l,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,l,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,l,"backtest"===t),n.markdownViewService.getHeatReport(r,o,l,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,l,"backtest"===t)]);return{type:t,backtest:s,live:c,breakeven:d,risk:w,partial:p,highest_profit:h,max_drawdown:m,schedule:k,performance:g,sync:b,heat:v,strategy:y}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),s=g(),{push:c,pop:d}=s,[w,p]=b(te.location.pathname),h=async()=>{const e=(await ae(t.current,r.current))[w.current.replace("/markdown_report/","")];"string"==typeof e&&await V(e)},m=async()=>{const e=await ae(t.current,r.current),a=w.current.replace("/markdown_report/",""),i=e[a];if("string"==typeof i){const e=new Blob([i],{type:"text/plain"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${a}_${r.current}_${Date.now()}.md`)}},y=async()=>{const e=("backtest"===r.current?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t.current);if(!e)throw new Error(`Item not found: ${t.current}`);const{symbol:a,strategyName:i,exchangeName:o,frameName:l}=e,s=w.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===s?d=await n.markdownViewService.getBacktestData(a,i,o,l):"live"===s?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===s?d=await n.markdownViewService.getBreakevenData(a,i,o,l,c):"risk"===s?d=await n.markdownViewService.getRiskData(a,i,o,l,c):"partial"===s?d=await n.markdownViewService.getPartialData(a,i,o,l,c):"highest_profit"===s?d=await n.markdownViewService.getHighestProfitData(a,i,o,l,c):"max_drawdown"===s?d=await n.markdownViewService.getMaxDrawdownData(a,i,o,l,c):"schedule"===s?d=await n.markdownViewService.getScheduleData(a,i,o,l,c):"performance"===s?d=await n.markdownViewService.getPerformanceData(a,i,o,l,c):"sync"===s?d=await n.markdownViewService.getSyncData(a,i,o,l,c):"heat"===s?d=await n.markdownViewService.getHeatData(i,o,l,c):"strategy"===s&&(d=await n.markdownViewService.getStrategyData(a,i,o,l,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${s}_${r.current}_${Date.now()}.json`)}},{pickData:D,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),p(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:K,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(l,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(l,{sx:{mr:"10px"},onClick:()=>h(),children:e(f,{})}),e(Y,{onClick:async(e,a)=>{await(async(e,t,a,i)=>{const r=("backtest"===a?await n.backtestGlobalService.list():await n.liveGlobalService.list()).find(e=>e.id===t);if(!r)throw new Error(`Item not found: ${t}`);const{symbol:o,strategyName:l,exchangeName:s,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,l,s,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,l,s),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,l,s,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,l,s,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,l,s,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,l,s,c,d),null,2)):e.includes("/markdown_report/max_drawdown")?i(JSON.stringify(await n.markdownViewService.getMaxDrawdownData(o,l,s,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,l,s,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,l,s,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,l,s,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(l,s,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,l,s,c,d),null,2))})(w.current,t.current,r.current,a)},sx:{mr:"10px",mt:"2.5px"}}),e(ee,{sx:{mr:"10px",mt:"0.5px"},onDownloadJson:y,onDownloadMarkdown:m,onDownloadPdf:h}),e(l,{onClick:a,children:e(S,{})})]}),fetchState:async()=>await ae(t.current,r.current),mapInitialData:([{type:e,backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,max_drawdown:l,schedule:s,performance:c,sync:d,heat:w,strategy:p,type:e}),mapPayload:([{type:e}])=>({type:e}),onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),onClose:()=>{d()}});return(e,t)=>{c({id:"markdown_report_modal",render:N,onInit:()=>{const e="live"===t?"/markdown_report/live":"/markdown_report/backtest";te.push(e),p(e)},onMount:()=>{a(e),o(t),D()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",le=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function se(e){return I(e,"#000000")>I(e,"#FFFFFF")}const ce=[{type:L.Link,action:"back-action",label:e(q,{sx:{display:"block"}})},{type:L.Link,action:"back-action",label:"Main"},{type:L.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(p,{icon:W,color:"#4caf50"})}],we=(t,a)=>({type:A.Group,className:oe,sx:{p:2},tabletColumns:"12",desktopColumns:"3",fields:[{type:A.Component,className:re,style:{transition:"opacity 500ms",opacity:.5},element:()=>e(x,{direction:"row",children:[e(J,{variant:"outlined",size:"small",color:"info",label:`${M.bullet} ${t}`,sx:{mb:1,pr:.5,fontSize:"14px",background:"white",cursor:"not-allowed"}}),e(i,{flex:1})]})},{type:A.Group,fields:a.map(({symbol:t,label:a,id:r,type:o,color:n})=>((t,a,r,o,n)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:l})=>e(H,{component:G,onClick:()=>{l.handleOpen(t,a)},sx:{width:"100%",background:n,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>se(n)?F(n,.33):X(n,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:se(n)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:r}),children:e(i,{sx:{overflow:"hidden",textOverflow:"ellipsis",width:"75px"},children:o})})}))(r,o,t,a,n))}]}),pe=[{id:"main",element:()=>{const{classes:t}=le(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:l}]=O(async()=>await(async()=>{const[e,t,a]=await Promise.all([n.symbolGlobalService.getSymbolMap(),n.backtestGlobalService.list(),n.liveGlobalService.list()]),i={},r={};t.forEach(t=>{const a=e[t.symbol],r=t.strategyName;i[r]||(i[r]=[]),i[r].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",type:"backtest",id:t.id})}),a.forEach(t=>{const a=e[t.symbol],i=t.strategyName;r[i]||(r[i]=[]),r[i].push({symbol:t.symbol,label:(null==a?void 0:a.displayName)||t.symbol,color:(null==a?void 0:a.color)||"#ccc",id:t.id,type:"live"})});const o=Object.entries(i).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t)),l=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>we(e,t));return l.length||o.length?[{type:A.Fragment,isVisible:()=>!!o.length,fields:[{type:A.Line,title:"Backtest"},{type:A.Group,columns:"12",fields:o}]},{type:A.Fragment,isVisible:()=>!!l.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:l}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),s=ie(),c=(e,t)=>{s(e,t)};return e(U,{children:[e(R,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),l||!o?e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"Loading..."})}):o.length?e(j,{children:[e($,{className:t.root,fields:o,payload:()=>({handleOpen:c})},a),e(i,{paddingBottom:"24px"})]}):e(C,{children:e(P,{variant:"h6",sx:{opacity:.5},children:"No pending signals"})})]})},isActive:e=>z(["/report"],e)}],he=({id:t})=>e(E,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:pe,params:{id:t}});export{he as StatusPage,he as default};
@@ -1 +1 @@
1
- import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as y,T as x,aq as v,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as R,I as F,at as z,F as $,au as N,av as D}from"./index-kQlTYlpK.js";import{R as O,C as T}from"./Refresh-DixrXBVq.js";import{K as j}from"./KeyboardArrowLeft-BpxUzr7-.js";import{I as C}from"./IconPhoto-DrGLW-rX.js";import{B as W}from"./Background-xwzJo61H.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),A=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),V=new o,E=[{type:t.Link,action:"back-action",label:a(j,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"},{type:t.Button,action:"update-now",label:"Refresh",icon:O}],H=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:B,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:A,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:O,color:"#4caf50"})}],I=()=>a(n,{items:E,actions:H,onAction:V.next});const M=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:N}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),D=d(i),O=d(e);p(()=>V.subscribe(e=>{if("update-now"===e&&N(),"download-action"===e){const e=new Blob([JSON.stringify(D.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${O.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${O.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),j=e=>{const o=T[e]||[];return o.length?a($,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(b,{primary:a(y,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(x,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:P("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",o.length-n]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===t.position?"#1976D2":"#F57C00",color:"white"},children:"long"===t.position?"LONG":"SHORT"}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),R(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceOpen),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),R(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceTakeProfit),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),R(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),R(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(x,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:t.pnl.pnlPercentage>=0?P("#4caf50",.15):P("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",R(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?P("#4caf50",.2):"scheduled"===t.status?P("#ff9800",.2):"closed"===t.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(x,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(i=t.createdAt,new Date(i).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a(F,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(u,{children:a(b,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[T],children:async()=>{const o=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",s=(null==(n=T[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(C,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(x,{variant:"body2",sx:{fontWeight:"medium"},children:v(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:j(e)})]})},`section-${e}`);var l}):a(u,{children:a(b,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=D(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:M,isActive:e=>J(["/backtest"],e)},{id:"live",element:M,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(T,{children:[a(N,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:I,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(W,{})]})};export{X as OverviewPage,X as default};
1
+ import{b as e,f as a,a8 as o,R as t,O as n,D as i,Z as r,ak as s,x as l,i as c,al as d,X as p,am as h,V as m,an as u,ao as b,ap as g,B as y,T as x,aq as v,l as f,n as k,ar as S,a6 as w,as as L,ah as P,J as R,I as F,at as z,F as $,au as N,av as D}from"./index-BI3k7b1T.js";import{R as O,C as T}from"./Refresh-3cixHjvW.js";import{K as j}from"./KeyboardArrowLeft-BUZ_pXI5.js";import{I as C}from"./IconPhoto-Czod_jkW.js";import{B as W}from"./Background-DISIt7NA.js";const B=e(a("path",{d:"M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"}),"Dashboard"),A=e(a("path",{d:"M3 10h11v2H3v-2zm0-2h11V6H3v2zm0 8h7v-2H3v2zm15.01-3.13.71-.71c.39-.39 1.02-.39 1.41 0l.71.71c.39.39.39 1.02 0 1.41l-.71.71-2.12-2.12zm-.71.71-5.3 5.3V21h2.12l5.3-5.3-2.12-2.12z"}),"EditNote"),V=new o,E=[{type:t.Link,action:"back-action",label:a(j,{sx:{display:"block"}})},{type:t.Link,action:"back-action",label:"Main"},{type:t.Link,action:"back-action",label:"Overview"},{type:t.Button,action:"update-now",label:"Refresh",icon:O}],H=[{action:"download-action",label:"Download",icon:()=>a(r,{icon:i,color:"#4caf50"})},{divider:!0},{action:"dashboard-action",label:"Dashboard",icon:()=>a(r,{icon:B,color:"#4caf50"})},{action:"logs-action",label:"Logs",icon:()=>a(r,{icon:A,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>a(r,{icon:O,color:"#4caf50"})}],I=()=>a(n,{items:E,actions:H,onAction:V.next});const M=({data:{type:e},setLoading:o})=>{const{elementRef:t,size:n}=s({closest:".MuiContainer-root",compute:e=>(e.height-=150,e)}),[i,{loading:r,execute:N}]=l(async()=>{if("live"===e){return(await c.storageViewService.listSignalLive()).filter(e=>"closed"===e.status)}return(await c.storageViewService.listSignalBacktest()).filter(e=>"closed"===e.status)},{onLoadStart:()=>o(!0),onLoadEnd:()=>o(!1),deps:[e]}),D=d(i),O=d(e);p(()=>V.subscribe(e=>{if("update-now"===e&&N(),"download-action"===e){const e=new Blob([JSON.stringify(D.current,null,2)],{type:"application/json"}),a=URL.createObjectURL(e);c.layoutService.downloadFile(a,`signals_${O.current}_${Date.now()}.json`)}"dashboard-action"===e&&c.routerService.push(`/dashboard/${O.current}`),"logs-action"===e&&c.routerService.push("/logs"),"back-action"===e&&c.routerService.push("/main")}));const T=h.useMemo(()=>i?i.reduce((e,a)=>(e[a.symbol]||(e[a.symbol]=[]),e[a.symbol].push(a),e),{}):{},[i]),j=e=>{const o=T[e]||[];return o.length?a($,{children:o.map((t,n)=>{return a(L,{sx:{background:e=>n%2==1?P(e.palette.getContrastText(e.palette.background.paper),.02):void 0},onClick:()=>c.layoutService.pickSignal(t.id),children:[a(b,{primary:a(y,{sx:{display:"flex",gap:1,flexWrap:"wrap",alignItems:"center"},children:[a(x,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,opacity:.5,borderRadius:1,transition:"opacity 500ms",background:P("#9e9e9e",.2),color:"#616161","&:hover":{opacity:1}},children:["#",o.length-n]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:"long"===t.position?"#1976D2":"#F57C00",color:"white"},children:"long"===t.position?"LONG":"SHORT"}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Entry:"}),R(t.priceOpen),"$",null!=t.originalPriceOpen&&Number(t.originalPriceOpen).toFixed(6)!==Number(t.priceOpen).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceOpen),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"success.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"TP:"}),R(t.priceTakeProfit),"$",null!=t.originalPriceTakeProfit&&Number(t.originalPriceTakeProfit).toFixed(6)!==Number(t.priceTakeProfit).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceTakeProfit),"$"]})]}),a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium",color:"error.main"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"SL:"}),R(t.priceStopLoss),"$",null!=t.originalPriceStopLoss&&Number(t.originalPriceStopLoss).toFixed(6)!==Number(t.priceStopLoss).toFixed(6)&&a(y,{component:"span",sx:{color:"text.disabled",ml:.5,fontSize:"0.75em",textDecoration:"line-through"},children:[R(t.originalPriceStopLoss),"$"]})]}),"pnl"in t&&a(x,{variant:"body2",component:"span",sx:{fontWeight:"medium"},children:[a(y,{component:"span",sx:{color:"text.secondary",mr:.5},children:"Invested:"}),R(t.pnl.pnlEntries),"$"]}),"pnl"in t&&a(x,{variant:"body2",component:"span",sx:{fontWeight:"bold",px:1,py:.5,borderRadius:1,background:t.pnl.pnlPercentage>=0?P("#4caf50",.15):P("#f44336",.15),color:t.pnl.pnlPercentage>=0?"#2e7d32":"#c62828"},children:["PNL: ",t.pnl.pnlPercentage>=0?"+":"",t.pnl.pnlPercentage.toFixed(2),"%"," / ",t.pnl.pnlCost>=0?"+":"",R(t.pnl.pnlCost),"$"]}),t.totalEntries>1&&a(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#2196f3",.15),color:"#1565c0"},children:["DCA×",t.totalEntries]}),t.totalPartials>0&&a(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:P("#9c27b0",.15),color:"#6a1b9a"},children:["Partial×",t.totalPartials]}),a(x,{variant:"caption",component:"span",sx:{px:1,py:.25,borderRadius:.5,background:"opened"===t.status?P("#4caf50",.2):"scheduled"===t.status?P("#ff9800",.2):"closed"===t.status?P("#9e9e9e",.2):P("#f44336",.2),color:"opened"===t.status?"#2e7d32":"scheduled"===t.status?"#e65100":"closed"===t.status?"#616161":"#c62828"},children:t.status})]}),secondary:a(x,{pt:.5,variant:"subtitle2",sx:{opacity:.5},children:(i=t.createdAt,new Date(i).toLocaleString([],{year:"numeric",month:"numeric",day:"numeric",hourCycle:"h24",hour:"2-digit",minute:"2-digit",second:"2-digit"}))})}),a(F,{disableRipple:!0,children:a(z,{})})]},`item-${e}-${t.id}`);var i})}):a(u,{children:a(b,{sx:{"& .MuiTypography-body2":{maxWidth:"435px"}},primary:"No signals",secondary:"Signals will be displayed here after they appear"})})};return r?null:a(S,{ref:t,sx:{width:"100%",maxHeight:n.height,overflowX:"hidden",overflowY:"auto",scrollbarWidth:"thin",bgcolor:"background.paper",position:"relative","& ul":{padding:0}},subheader:a("li",{}),children:a(m,{deps:[T],children:async()=>{const o=Object.keys(T),t=await c.symbolGlobalService.getSymbolMap();return o.length?o.map(e=>{var o,n,i;const r=(null==(o=t[e])?void 0:o.color)||"#ccc",s=(null==(n=T[e])?void 0:n.length)||0;return a("li",{children:a("ul",{children:[a(g,{sx:{background:(l=r,w(l,"#000000")>w(l,"#FFFFFF")?f(r,.1):k(r,.1)),color:"white !important",zIndex:9,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[a(y,{sx:{position:"relative",paddingRight:"8px"},children:a(C,{symbol:e})}),(null==(i=t[e])?void 0:i.displayName)||e,a(y,{flex:1}),a(x,{variant:"body2",sx:{fontWeight:"medium"},children:v(s,{one:"Signal",two:"Signals",many:"Signals"})})]}),a(y,{sx:{marginTop:"16px",marginBottom:"16px"},children:j(e)})]})},`section-${e}`);var l}):a(u,{children:a(b,{primary:"No signals yet",secondary:"live"===e?"Live signals will be displayed here":"Backtest signals will be displayed here"})})}})})},G=D(),J=(e,a)=>e.some(e=>e.includes(a)),K=[{id:"backtest",element:M,isActive:e=>J(["/backtest"],e)},{id:"live",element:M,isActive:e=>J(["/live"],e)}],U=[{id:"backtest",label:"Backtest"},{id:"live",label:"Live"}],X=()=>{p(()=>G.replace("/backtest"));return a(T,{children:[a(N,{withScroll:!0,sx:{height:"calc(100vh - 105px)"},BeforePaper:I,onLoadStart:()=>c.layoutService.setAppbarLoader(!0),onLoadEnd:()=>c.layoutService.setAppbarLoader(!1),routes:K,tabs:U,history:G,initialData:()=>({backtest:{type:"backtest"},live:{type:"live"}}),onTabChange:(e,a)=>{"backtest"===e&&a.replace("/backtest"),"live"===e&&a.replace("/live")}}),a(W,{})]})};export{X as OverviewPage,X as default};
@@ -1 +1 @@
1
- import{b as e,f as t,x as i,i as n,X as a,a8 as o,O as r,R as l,Z as s,Y as d,$ as c,a0 as p,a2 as m,W as g,w as f,a9 as u,T as _,l as h,B as y,aa as C,P as E,ab as A,ac as x,a4 as b,D as w,ad as S,ae as M,af as R,ag as v,a7 as T,ah as O,ai as D,aj as N}from"./index-kQlTYlpK.js";import{h as L}from"./hasRouteMatch-C0K-M4jy.js";import{P as k}from"./PictureAsPdfOutlined-BTv5MH3G.js";import{C as I,R as B}from"./Refresh-DixrXBVq.js";import{K as P}from"./KeyboardArrowLeft-BpxUzr7-.js";const W=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),F=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),V=144,G=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Button,action:"download-pdf",label:"Download PDF",icon:k},{type:l.Fab,action:"setup-action",label:"Settings",icon:W}],K=[{action:"setup-action",label:"Settings",icon:()=>t(s,{icon:W,color:"#4caf50"})},{divider:!0},{action:"download-json",label:"Download JSON",icon:()=>t(s,{icon:d,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(s,{icon:c,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(s,{icon:p,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],X=({name:e,title:t})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:m.Div},{type:m.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${C("ms")}`:t:"-",name:e}]}),H=({name:e,title:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:i},{type:m.Div},{type:m.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:i})=>{const n="github"===e,a=n?"#6A1B9A":"#24A1DE";return t(b,{size:"medium",disabled:!i,startIcon:t(u,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(n?x:F,{sx:{color:a,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:a,"&:hover":{background:"white",color:a}},onClick:()=>{if(n)A(String(i));else{const e=String(i).replaceAll("@","");A(`https://t.me/${e}`)}},children:C(i?"Open":"Not configured")})},name:e}]}),U=[{type:m.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:m.Layout,customLayout:({children:e})=>t(E,{sx:{width:"335px"},children:e}),fields:[{type:m.Component,element:()=>t(y,{sx:{background:e=>h(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(u,{sx:{height:V,width:V,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(_,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:m.Layout,customLayout:({children:e})=>t(y,{p:1,children:e}),fields:[{type:m.Div,style:{height:"2px"}},{type:m.Div,style:{height:"12px"}},X({name:"totalEvents",title:C("Total events")}),X({name:"totalDuration",title:C("Total time")}),X({name:"avgDuration",title:C("Average time")}),H({name:"channel",title:C("Channel")}),H({name:"github",title:"GitHub"})]}]}}],Y=new o,j=new o,z=({title:e,name:t,idx:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr 125px",pointerEvents:"none",alignItems:"center",background:e=>i%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent",padding:"8px",paddingLeft:"8px",paddingRight:"8px"},fields:[{type:m.Typography,style:{fontSize:"12px"},typoVariant:"subtitle2",fieldBottomMargin:"0",placeholder:e},{type:m.Box,sx:{minWidth:"8px"}},{type:m.Text,readonly:!0,outlined:i%2==0,name:t,compute(e){const i=D.get(e,t);return String(i)},title:"",fieldBottomMargin:"0",fieldRightMargin:"0"}]}),$=[{type:m.Box,sx:{maxWidth:420,minWidth:340},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto auto",alignItems:"center",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"4px"},fields:[{type:m.Typography,style:{opacity:.5},fieldBottomMargin:"0",typoVariant:"subtitle2",placeholder:"Runtime Configuration"},{type:m.Box},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:w,async click(e,t,i,n){await j.next(),await n.handleDownloadConfig()}},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:S,click:()=>j.next()}]},{type:m.Layout,customLayout:({children:e})=>t(y,{sx:{overflow:"clip",overflowY:"auto",marginBottom:"16px",maxHeight:{xs:"min(365px, 80vh - 235px)",sm:"min(475px, 80vh - 235px)"},width:"100%"},children:e}),fields:[z({idx:0,title:"CC_SCHEDULE_AWAIT_MINUTES",name:"config.CC_SCHEDULE_AWAIT_MINUTES",description:T.newline("Time to wait for scheduled signal to activate (in minutes).","If signal does not activate within this time, it will be cancelled.")}),z({idx:1,title:"CC_AVG_PRICE_CANDLES_COUNT",name:"config.CC_AVG_PRICE_CANDLES_COUNT",description:T.newline("Number of candles to use for average price calculation (VWAP).","Default: 5 candles (last 5 minutes when using 1m interval).")}),z({idx:2,title:"CC_PERCENT_SLIPPAGE",name:"config.CC_PERCENT_SLIPPAGE",description:T.newline("Slippage percentage applied to entry and exit prices.","Simulates market impact and order book depth.","Applied twice (entry and exit) for realistic execution simulation.","Default: 0.1% per transaction.")}),z({idx:3,title:"CC_PERCENT_FEE",name:"config.CC_PERCENT_FEE",description:T.newline("Fee percentage charged per transaction.","Applied twice (entry and exit) for total fee calculation.","Default: 0.1% per transaction (total 0.2%).")}),z({idx:4,title:"CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",name:"config.CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",description:T.newline("Minimum TakeProfit distance from priceOpen (percentage).","Must be greater than (slippage + fees) to ensure profitable trades.","Default: 0.5% (covers all costs + minimum profit margin).")}),z({idx:5,title:"CC_MIN_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MIN_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Minimum StopLoss distance from priceOpen (percentage).","Prevents signals from being immediately stopped out due to price volatility.","Default: 0.5% (buffer to avoid instant stop loss on normal market fluctuations).")}),z({idx:6,title:"CC_MAX_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MAX_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Maximum StopLoss distance from priceOpen (percentage).","Prevents catastrophic losses from extreme StopLoss values.","Default: 20% (one signal cannot lose more than 20% of position).")}),z({idx:7,title:"CC_MAX_SIGNAL_LIFETIME_MINUTES",name:"config.CC_MAX_SIGNAL_LIFETIME_MINUTES",description:T.newline("Maximum signal lifetime in minutes.","Also used as the default when minuteEstimatedTime is not provided in ISignalDto.","Prevents eternal signals that block risk limits for weeks/months.","Use Infinity to allow signals to live indefinitely (until TP/SL or explicit close).","Default: 1440 minutes (1 day).")}),z({idx:8,title:"CC_MAX_SIGNAL_GENERATION_SECONDS",name:"config.CC_MAX_SIGNAL_GENERATION_SECONDS",description:T.newline("Maximum time allowed for signal generation (in seconds).","Prevents long-running or stuck signal generation routines from blocking execution or consuming resources indefinitely.","If generation exceeds this threshold the attempt should be aborted, logged and optionally retried.","Default: 180 seconds (3 minutes).")}),z({idx:9,title:"CC_GET_CANDLES_RETRY_COUNT",name:"config.CC_GET_CANDLES_RETRY_COUNT",description:T.newline("Number of retries for getCandles function.","Default: 3 retries.")}),z({idx:10,title:"CC_GET_CANDLES_RETRY_DELAY_MS",name:"config.CC_GET_CANDLES_RETRY_DELAY_MS",description:T.newline("Delay between retries for getCandles function (in milliseconds).","Default: 5000 ms (5 seconds).")}),z({idx:11,title:"CC_MAX_CANDLES_PER_REQUEST",name:"config.CC_MAX_CANDLES_PER_REQUEST",description:T.newline("Maximum number of candles to request per single API call.","If a request exceeds this limit, data will be fetched using pagination.","Default: 1000 candles per request.")}),z({idx:12,title:"CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",name:"config.CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",description:T.newline("Maximum allowed deviation factor for price anomaly detection.","Price should not be more than this factor lower than reference price.","Example: BTC at $50,000 median → threshold $50 (catches $0.01-1 anomalies).")}),z({idx:13,title:"CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",name:"config.CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",description:T.newline("Minimum number of candles required for reliable median calculation.","Below this threshold, use simple average instead of median.","Example: 3 candles = 12 points (use average), 5 candles = 20 points (use median).")}),z({idx:14,title:"CC_REPORT_SHOW_SIGNAL_NOTE",name:"config.CC_REPORT_SHOW_SIGNAL_NOTE",description:T.newline("Controls visibility of signal notes in markdown report tables.",'When enabled, the "Note" column will be displayed in all markdown reports (backtest, live, schedule, risk, etc.)',"Default: false (notes are hidden to reduce table width and improve readability).")}),z({idx:15,title:"CC_BREAKEVEN_THRESHOLD",name:"config.CC_BREAKEVEN_THRESHOLD",description:T.newline("Breakeven threshold percentage - minimum profit distance from entry to enable breakeven.","When price moves this percentage in profit direction, stop-loss can be moved to entry (breakeven).","Default: 0.2% (additional buffer above costs to ensure no loss when moving to breakeven).")}),z({idx:16,title:"CC_ORDER_BOOK_TIME_OFFSET_MINUTES",name:"config.CC_ORDER_BOOK_TIME_OFFSET_MINUTES",description:T.newline("Time offset in minutes for order book fetching.","Subtracts this amount from the current time when fetching order book data.","This helps get a more stable snapshot of the order book by avoiding real-time volatility.","Default: 10 minutes.")}),z({idx:17,title:"CC_ORDER_BOOK_MAX_DEPTH_LEVELS",name:"config.CC_ORDER_BOOK_MAX_DEPTH_LEVELS",description:T.newline("Maximum depth levels for order book fetching.","Specifies how many price levels to fetch from both bids and asks.","Default: 20 levels.")}),z({idx:18,title:"CC_AGGREGATED_TRADES_MAX_MINUTES",name:"config.CC_AGGREGATED_TRADES_MAX_MINUTES",description:T.newline("Maximum minutes of aggregated trades to fetch when no limit is provided.","If limit is not specified, the system will fetch aggregated trades for this many minutes starting from the current time minus the offset.","Binance requirement.")}),z({idx:19,title:"CC_MAX_BACKTEST_MARKDOWN_ROWS",name:"config.CC_MAX_BACKTEST_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in backtest markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:20,title:"CC_MAX_BREAKEVEN_MARKDOWN_ROWS",name:"config.CC_MAX_BREAKEVEN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in breakeven markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:21,title:"CC_MAX_HEATMAP_MARKDOWN_ROWS",name:"config.CC_MAX_HEATMAP_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in heatmap markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:22,title:"CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",name:"config.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in highest profit markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:23,title:"CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",name:"config.CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in max drawdown markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:24,title:"CC_MAX_LIVE_MARKDOWN_ROWS",name:"config.CC_MAX_LIVE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in live markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:25,title:"CC_MAX_PARTIAL_MARKDOWN_ROWS",name:"config.CC_MAX_PARTIAL_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in partial markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:26,title:"CC_MAX_RISK_MARKDOWN_ROWS",name:"config.CC_MAX_RISK_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in risk markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:27,title:"CC_MAX_SCHEDULE_MARKDOWN_ROWS",name:"config.CC_MAX_SCHEDULE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in schedule markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:28,title:"CC_MAX_STRATEGY_MARKDOWN_ROWS",name:"config.CC_MAX_STRATEGY_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in strategy markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:29,title:"CC_MAX_SYNC_MARKDOWN_ROWS",name:"config.CC_MAX_SYNC_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in sync markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:30,title:"CC_WALKER_MARKDOWN_TOP_N",name:"config.CC_WALKER_MARKDOWN_TOP_N",description:T.newline("Number of top strategies to include in the walker comparison table.","Default: 10 strategies.")}),z({idx:31,title:"CC_MAX_PERFORMANCE_MARKDOWN_ROWS",name:"config.CC_MAX_PERFORMANCE_MARKDOWN_ROWS",description:T.newline("Maximum number of performance metric events to keep in storage.","Older events are removed when this limit is exceeded.","Higher than other report event limits because performance metrics are lightweight and benefit from larger sample sizes for accurate statistical analysis.","Default: 10000 events.")}),z({idx:32,title:"CC_MAX_NOTIFICATIONS",name:"config.CC_MAX_NOTIFICATIONS",description:T.newline("Maximum number of notifications to keep in storage.","Older notifications are removed when this limit is exceeded.","Default: 500 notifications.")}),z({idx:33,title:"CC_MAX_SIGNALS",name:"config.CC_MAX_SIGNALS",description:T.newline("Maximum number of signals to keep in storage.","Older signals are removed when this limit is exceeded.","Default: 50 signals.")}),z({idx:34,title:"CC_MAX_LOG_LINES",name:"config.CC_MAX_LOG_LINES",description:T.newline("Maximum number of log lines to keep in storage.","Older log lines are removed when this limit is exceeded.","This helps prevent unbounded log growth which can consume memory and degrade performance over time.","Default: 1000 log lines.")}),z({idx:35,title:"CC_ENABLE_CANDLE_FETCH_MUTEX",name:"config.CC_ENABLE_CANDLE_FETCH_MUTEX",description:T.newline("Enables mutex locking for candle fetching to prevent concurrent fetches of the same candles.","This can help avoid redundant API calls and ensure data consistency when multiple processes/threads attempt to fetch candles simultaneously.","Default: true (mutex locking enabled for candle fetching).")}),z({idx:36,title:"CC_ENABLE_BACKTEST_PARALLEL_SPIN",name:"config.CC_ENABLE_BACKTEST_PARALLEL_SPIN",description:T.newline("Enables cooperative interleaving of concurrently running backtests after each candle fetch.","Hands the event loop to a peer backtest waiting on the same mutex, so multiple parallel Backtest.run / Walker workloads progress in round-robin fashion instead of one monopolizing the event loop until completion.","Default: true (parallel backtests are interleaved on each candle fetch boundary).")}),z({idx:37,title:"CC_ENABLE_DCA_EVERYWHERE",name:"config.CC_ENABLE_DCA_EVERYWHERE",description:T.newline("Enables DCA (Dollar-Cost Averaging) logic even if antirecord is not broken.","Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.","Default: false (DCA logic enabled only when antirecord is broken).")}),z({idx:38,title:"CC_ENABLE_PPPL_EVERYWHERE",name:"config.CC_ENABLE_PPPL_EVERYWHERE",description:T.newline("Enables PPPL (Partial Profit, Partial Loss) logic even if this breaks a direction of exits.","Allows to take partial profit or loss on a position even if it results in a mix of profit and loss exits.","Default: false (PPPL logic is only applied when it does not break the direction of exits, ensuring clearer profit/loss outcomes).")}),z({idx:39,title:"CC_ENABLE_LONG_SIGNAL",name:"config.CC_ENABLE_LONG_SIGNAL",description:T.newline("Enables long signals in strategies that are primarily designed for short signals.","This allows the strategy to generate and manage long signals in addition to short signals, even if the original design was focused on short trading.","Default: false (long signals are only enabled in strategies that are designed for them, ensuring strategy logic is aligned with signal types).")}),z({idx:40,title:"CC_ENABLE_SHORT_SIGNAL",name:"config.CC_ENABLE_SHORT_SIGNAL",description:T.newline("Enables short signals in strategies that are primarily designed for long signals.","This allows the strategy to generate and manage short signals in addition to long signals, even if the original design was focused on long trading.")}),z({idx:41,title:"CC_ENABLE_TRAILING_EVERYWHERE",name:"config.CC_ENABLE_TRAILING_EVERYWHERE",description:T.newline("Enables trailing logic (Trailing Take / Trailing Stop) without requiring absorption conditions.","Allows trailing mechanisms to be activated regardless of whether absorption has been detected.","Default: false (trailing logic is applied only when absorption conditions are met).")}),z({idx:42,title:"CC_POSITION_ENTRY_COST",name:"config.CC_POSITION_ENTRY_COST",description:T.newline("Cost of entering a position (in USD).","This is used as a default value for calculating position size and risk management when cost data is not provided by the strategy.","Default: $100 per position.")})]},{type:m.Box,sx:{p:1},child:{type:m.Button,fieldBottomMargin:"0",fieldRightMargin:"0",buttonVariant:"contained",title:"Download",click:async(e,t,i,n)=>{await j.next(),await n.handleDownloadConfig()},icon:w}}]}],q=[{type:m.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"center"},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"1fr"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Running mode"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:"Historical data processing"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:"Real-time exchange integration"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:"UI only"}]},{type:m.Box},{type:m.Component,fieldBottomMargin:"0",element:({_fieldData:e,payload:i})=>t(M,{noBadge:!0,size:"small",sx:{transform:"translate(10px, -28px)",opacity:"0.5",transition:"opacity 500ms","&:hover":{opacity:"1.0"}},oneSx:{padding:"0 !important"},fields:$,closeSubject:j,payload:i,handler:()=>e,children:t(W,{})})}]},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:"Historical data"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:"Real-time"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:"Frontend only"}]},{type:m.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:m.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Log mode"},{type:m.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:"Logs take up disk space but are needed for debugging"}]},...[{title:"JSONL files",description:"Files processed by Claude Code, HuggingFace, Parquet",name:"recent_enabled"},{title:"Markdown files",description:"Human-readable files. Useful when running without a GUI",name:"markdown_enabled"},{title:"Dump files",description:"Conversation dump with the AI agent used for trading signals",name:"dump_enabled"}].map(({name:e,title:t,description:i},n)=>(({title:e,description:t,name:i,idx:n})=>({type:m.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>n%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:m.Box,fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:i}]}))({name:e,title:t,description:i,idx:n}))]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"User interface"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save notifications",name:"notification_enabled"},{type:m.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:"Event history is saved to disk"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save signals",name:"storage_enabled"},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:"Latest signal state is saved to disk"}]}]},{type:m.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Strategy"},{type:m.Typography,placeholder:"Broker"},{type:m.Outline,fieldBottomMargin:"3",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Connected to mainnet (production)",name:"broker_enabled"}]},{type:m.Typography,placeholder:"Market signals"},{type:m.Outline,fieldBottomMargin:"4",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use BM25 for RAG",name:"memory_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use stateful strategies",name:"state_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Save previous signal",name:"recent_enabled"}]}]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:"Risk management"},{type:m.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:"Use LONG or SHORT positions depending on market conditions"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Enable LONG",name:"enable_long"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"1",title:"Enable SHORT",name:"enable_short"}]}]},{type:m.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const i=R();return t(v,{variant:"contained",size:"large",startIcon:t(B,{}),onClick:async()=>{await e.handleReload(),i()},children:"Refresh"})}}],J=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Link,action:"back-action",label:"Settings"},{type:l.Button,action:"update-now",label:"Refresh",icon:B}],Q=[{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],Z=new o,ee=async()=>{n.setupViewService.getSetupData.clear(),await Z.next()},te=async()=>{const{config:e}=await n.setupViewService.getSetupData(),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`config_${Date.now()}.json`)},ie=[{id:"search",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.performanceViewService.getPerformanceData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Y.subscribe(o));const[s,{execute:d,loading:c}]=i(async()=>await n.environmentViewService.getEnvironmentData());a(()=>Y.subscribe(d));return t(I,{children:[t(r,{items:G,actions:K,onAction:async e=>{"back-action"===e&&n.routerService.push("/main"),"setup-action"===e&&n.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{n.performanceViewService.getPerformanceData.clear(),n.performanceViewService.getPerformanceReport.clear(),n.environmentViewService.getEnvironmentData.clear(),await Y.next()})(),"download-markdown"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport();await f(e)})(),"download-json"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),i=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(i);n.layoutService.downloadFile(a,`performance_${Date.now()}.json`)})()}}),e&&s?l||c?null:t(g,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:s.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:U}):null]})},isActive:e=>L(["/about"],e)},{id:"main",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.setupViewService.getSetupData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Z.subscribe(o));return t(I,{children:[t(r,{items:J,actions:Q,onAction:async e=>{"back-action"===e&&n.routerService.push("/about"),"update-now"===e&&await ee()}}),e?l?null:t(g,{handler:e,payload:()=>({handleReload:ee,handleDownloadConfig:te}),fields:q}):null]})},isActive:e=>L(["/about/setup"],e)}],ne=()=>t(N,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:ie});export{ne as AboutPage,ne as default};
1
+ import{b as e,f as t,x as i,i as n,X as a,a8 as o,O as r,R as l,Z as s,Y as d,$ as c,a0 as p,a2 as m,W as g,w as f,a9 as u,T as _,l as h,B as y,aa as C,P as E,ab as A,ac as x,a4 as b,D as w,ad as S,ae as M,af as R,ag as v,a7 as T,ah as O,ai as D,aj as N}from"./index-BI3k7b1T.js";import{h as L}from"./hasRouteMatch-CqJJG3sx.js";import{P as k}from"./PictureAsPdfOutlined-BgifaQ0L.js";import{C as I,R as B}from"./Refresh-3cixHjvW.js";import{K as P}from"./KeyboardArrowLeft-BUZ_pXI5.js";const W=e(t("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"}),"Settings"),F=e(t("path",{d:"M9.78 18.65l.28-4.23 7.68-6.92c.34-.31-.07-.46-.52-.19L7.74 13.3 3.64 12c-.88-.25-.89-.86.2-1.3l15.97-6.16c.73-.33 1.43.18 1.15 1.3l-2.72 12.81c-.19.91-.74 1.13-1.5.71L12.6 16.3l-1.99 1.93c-.23.23-.42.42-.83.42z"}),"Telegram"),V=144,G=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Button,action:"download-pdf",label:"Download PDF",icon:k},{type:l.Fab,action:"setup-action",label:"Settings",icon:W}],K=[{action:"setup-action",label:"Settings",icon:()=>t(s,{icon:W,color:"#4caf50"})},{divider:!0},{action:"download-json",label:"Download JSON",icon:()=>t(s,{icon:d,color:"#4caf50"})},{action:"download-markdown",label:"Download Markdown",icon:()=>t(s,{icon:c,color:"#4caf50"})},{action:"download-pdf",label:"Download PDF",icon:()=>t(s,{icon:p,color:"#4caf50"})},{divider:!0},{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],X=({name:e,title:t})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:t},{type:m.Div},{type:m.Typography,typoVariant:"h6",style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",compute:({[e]:t})=>t||0===t?"totalEvents"===e?Number(t).toFixed(2):"totalDuration"===e||"avgDuration"===e?`${Number(t).toFixed(2)} ${C("ms")}`:t:"-",name:e}]}),H=({name:e,title:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",paddingBottom:"8px",alignItems:"center"},fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:i},{type:m.Div},{type:m.Component,style:{textAlign:"right",fontWeight:"bold"},fieldBottomMargin:"0",fieldRightMargin:"0",element:({[e]:i})=>{const n="github"===e,a=n?"#6A1B9A":"#24A1DE";return t(b,{size:"medium",disabled:!i,startIcon:t(u,{sx:{background:"#eee",height:"25px",width:"25px"},children:t(n?x:F,{sx:{color:a,fontSize:"16px !important",transform:"translate(-0.5px, 0px)"}})}),sx:{background:"white",color:a,"&:hover":{background:"white",color:a}},onClick:()=>{if(n)A(String(i));else{const e=String(i).replaceAll("@","");A(`https://t.me/${e}`)}},children:C(i?"Open":"Not configured")})},name:e}]}),U=[{type:m.Box,sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"80vh"},child:{type:m.Layout,customLayout:({children:e})=>t(E,{sx:{width:"335px"},children:e}),fields:[{type:m.Component,element:()=>t(y,{sx:{background:e=>h(e.palette.background.paper,.13),display:"flex",alignItems:"center",flexDirection:"column",gap:1,p:1},children:[t(u,{sx:{height:V,width:V,marginTop:"36px",marginBottom:"36px"},src:"/logo/icon512_maskable.png"}),t(_,{variant:"subtitle2",sx:{opacity:.5},children:"Backtest Kit"})]})},{type:m.Layout,customLayout:({children:e})=>t(y,{p:1,children:e}),fields:[{type:m.Div,style:{height:"2px"}},{type:m.Div,style:{height:"12px"}},X({name:"totalEvents",title:C("Total events")}),X({name:"totalDuration",title:C("Total time")}),X({name:"avgDuration",title:C("Average time")}),H({name:"channel",title:C("Channel")}),H({name:"github",title:"GitHub"})]}]}}],Y=new o,j=new o,z=({title:e,name:t,idx:i})=>({type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr 125px",pointerEvents:"none",alignItems:"center",background:e=>i%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent",padding:"8px",paddingLeft:"8px",paddingRight:"8px"},fields:[{type:m.Typography,style:{fontSize:"12px"},typoVariant:"subtitle2",fieldBottomMargin:"0",placeholder:e},{type:m.Box,sx:{minWidth:"8px"}},{type:m.Text,readonly:!0,outlined:i%2==0,name:t,compute(e){const i=D.get(e,t);return String(i)},title:"",fieldBottomMargin:"0",fieldRightMargin:"0"}]}),$=[{type:m.Box,sx:{maxWidth:420,minWidth:340},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto auto",alignItems:"center",paddingTop:"4px",paddingBottom:"4px",paddingLeft:"8px",paddingRight:"4px"},fields:[{type:m.Typography,style:{opacity:.5},fieldBottomMargin:"0",typoVariant:"subtitle2",placeholder:"Runtime Configuration"},{type:m.Box},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:w,async click(e,t,i,n){await j.next(),await n.handleDownloadConfig()}},{type:m.Icon,fieldBottomMargin:"0",fieldRightMargin:"0",icon:S,click:()=>j.next()}]},{type:m.Layout,customLayout:({children:e})=>t(y,{sx:{overflow:"clip",overflowY:"auto",marginBottom:"16px",maxHeight:{xs:"min(365px, 80vh - 235px)",sm:"min(475px, 80vh - 235px)"},width:"100%"},children:e}),fields:[z({idx:0,title:"CC_SCHEDULE_AWAIT_MINUTES",name:"config.CC_SCHEDULE_AWAIT_MINUTES",description:T.newline("Time to wait for scheduled signal to activate (in minutes).","If signal does not activate within this time, it will be cancelled.")}),z({idx:1,title:"CC_AVG_PRICE_CANDLES_COUNT",name:"config.CC_AVG_PRICE_CANDLES_COUNT",description:T.newline("Number of candles to use for average price calculation (VWAP).","Default: 5 candles (last 5 minutes when using 1m interval).")}),z({idx:2,title:"CC_PERCENT_SLIPPAGE",name:"config.CC_PERCENT_SLIPPAGE",description:T.newline("Slippage percentage applied to entry and exit prices.","Simulates market impact and order book depth.","Applied twice (entry and exit) for realistic execution simulation.","Default: 0.1% per transaction.")}),z({idx:3,title:"CC_PERCENT_FEE",name:"config.CC_PERCENT_FEE",description:T.newline("Fee percentage charged per transaction.","Applied twice (entry and exit) for total fee calculation.","Default: 0.1% per transaction (total 0.2%).")}),z({idx:4,title:"CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",name:"config.CC_MIN_TAKEPROFIT_DISTANCE_PERCENT",description:T.newline("Minimum TakeProfit distance from priceOpen (percentage).","Must be greater than (slippage + fees) to ensure profitable trades.","Default: 0.5% (covers all costs + minimum profit margin).")}),z({idx:5,title:"CC_MIN_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MIN_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Minimum StopLoss distance from priceOpen (percentage).","Prevents signals from being immediately stopped out due to price volatility.","Default: 0.5% (buffer to avoid instant stop loss on normal market fluctuations).")}),z({idx:6,title:"CC_MAX_STOPLOSS_DISTANCE_PERCENT",name:"config.CC_MAX_STOPLOSS_DISTANCE_PERCENT",description:T.newline("Maximum StopLoss distance from priceOpen (percentage).","Prevents catastrophic losses from extreme StopLoss values.","Default: 20% (one signal cannot lose more than 20% of position).")}),z({idx:7,title:"CC_MAX_SIGNAL_LIFETIME_MINUTES",name:"config.CC_MAX_SIGNAL_LIFETIME_MINUTES",description:T.newline("Maximum signal lifetime in minutes.","Also used as the default when minuteEstimatedTime is not provided in ISignalDto.","Prevents eternal signals that block risk limits for weeks/months.","Use Infinity to allow signals to live indefinitely (until TP/SL or explicit close).","Default: 1440 minutes (1 day).")}),z({idx:8,title:"CC_MAX_SIGNAL_GENERATION_SECONDS",name:"config.CC_MAX_SIGNAL_GENERATION_SECONDS",description:T.newline("Maximum time allowed for signal generation (in seconds).","Prevents long-running or stuck signal generation routines from blocking execution or consuming resources indefinitely.","If generation exceeds this threshold the attempt should be aborted, logged and optionally retried.","Default: 180 seconds (3 minutes).")}),z({idx:9,title:"CC_GET_CANDLES_RETRY_COUNT",name:"config.CC_GET_CANDLES_RETRY_COUNT",description:T.newline("Number of retries for getCandles function.","Default: 3 retries.")}),z({idx:10,title:"CC_GET_CANDLES_RETRY_DELAY_MS",name:"config.CC_GET_CANDLES_RETRY_DELAY_MS",description:T.newline("Delay between retries for getCandles function (in milliseconds).","Default: 5000 ms (5 seconds).")}),z({idx:11,title:"CC_MAX_CANDLES_PER_REQUEST",name:"config.CC_MAX_CANDLES_PER_REQUEST",description:T.newline("Maximum number of candles to request per single API call.","If a request exceeds this limit, data will be fetched using pagination.","Default: 1000 candles per request.")}),z({idx:12,title:"CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",name:"config.CC_GET_CANDLES_PRICE_ANOMALY_THRESHOLD_FACTOR",description:T.newline("Maximum allowed deviation factor for price anomaly detection.","Price should not be more than this factor lower than reference price.","Example: BTC at $50,000 median → threshold $50 (catches $0.01-1 anomalies).")}),z({idx:13,title:"CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",name:"config.CC_GET_CANDLES_MIN_CANDLES_FOR_MEDIAN",description:T.newline("Minimum number of candles required for reliable median calculation.","Below this threshold, use simple average instead of median.","Example: 3 candles = 12 points (use average), 5 candles = 20 points (use median).")}),z({idx:14,title:"CC_REPORT_SHOW_SIGNAL_NOTE",name:"config.CC_REPORT_SHOW_SIGNAL_NOTE",description:T.newline("Controls visibility of signal notes in markdown report tables.",'When enabled, the "Note" column will be displayed in all markdown reports (backtest, live, schedule, risk, etc.)',"Default: false (notes are hidden to reduce table width and improve readability).")}),z({idx:15,title:"CC_BREAKEVEN_THRESHOLD",name:"config.CC_BREAKEVEN_THRESHOLD",description:T.newline("Breakeven threshold percentage - minimum profit distance from entry to enable breakeven.","When price moves this percentage in profit direction, stop-loss can be moved to entry (breakeven).","Default: 0.2% (additional buffer above costs to ensure no loss when moving to breakeven).")}),z({idx:16,title:"CC_ORDER_BOOK_TIME_OFFSET_MINUTES",name:"config.CC_ORDER_BOOK_TIME_OFFSET_MINUTES",description:T.newline("Time offset in minutes for order book fetching.","Subtracts this amount from the current time when fetching order book data.","This helps get a more stable snapshot of the order book by avoiding real-time volatility.","Default: 10 minutes.")}),z({idx:17,title:"CC_ORDER_BOOK_MAX_DEPTH_LEVELS",name:"config.CC_ORDER_BOOK_MAX_DEPTH_LEVELS",description:T.newline("Maximum depth levels for order book fetching.","Specifies how many price levels to fetch from both bids and asks.","Default: 20 levels.")}),z({idx:18,title:"CC_AGGREGATED_TRADES_MAX_MINUTES",name:"config.CC_AGGREGATED_TRADES_MAX_MINUTES",description:T.newline("Maximum minutes of aggregated trades to fetch when no limit is provided.","If limit is not specified, the system will fetch aggregated trades for this many minutes starting from the current time minus the offset.","Binance requirement.")}),z({idx:19,title:"CC_MAX_BACKTEST_MARKDOWN_ROWS",name:"config.CC_MAX_BACKTEST_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in backtest markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:20,title:"CC_MAX_BREAKEVEN_MARKDOWN_ROWS",name:"config.CC_MAX_BREAKEVEN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in breakeven markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:21,title:"CC_MAX_HEATMAP_MARKDOWN_ROWS",name:"config.CC_MAX_HEATMAP_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in heatmap markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:22,title:"CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",name:"config.CC_MAX_HIGHEST_PROFIT_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in highest profit markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:23,title:"CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",name:"config.CC_MAX_MAX_DRAWDOWN_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in max drawdown markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:24,title:"CC_MAX_LIVE_MARKDOWN_ROWS",name:"config.CC_MAX_LIVE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in live markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:25,title:"CC_MAX_PARTIAL_MARKDOWN_ROWS",name:"config.CC_MAX_PARTIAL_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in partial markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:26,title:"CC_MAX_RISK_MARKDOWN_ROWS",name:"config.CC_MAX_RISK_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in risk markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:27,title:"CC_MAX_SCHEDULE_MARKDOWN_ROWS",name:"config.CC_MAX_SCHEDULE_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in schedule markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:28,title:"CC_MAX_STRATEGY_MARKDOWN_ROWS",name:"config.CC_MAX_STRATEGY_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in strategy markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:29,title:"CC_MAX_SYNC_MARKDOWN_ROWS",name:"config.CC_MAX_SYNC_MARKDOWN_ROWS",description:T.newline("Maximum number of events to keep in sync markdown report storage.","Older events are removed (FIFO) when this limit is exceeded.","Default: 250 events.")}),z({idx:30,title:"CC_WALKER_MARKDOWN_TOP_N",name:"config.CC_WALKER_MARKDOWN_TOP_N",description:T.newline("Number of top strategies to include in the walker comparison table.","Default: 10 strategies.")}),z({idx:31,title:"CC_MAX_PERFORMANCE_MARKDOWN_ROWS",name:"config.CC_MAX_PERFORMANCE_MARKDOWN_ROWS",description:T.newline("Maximum number of performance metric events to keep in storage.","Older events are removed when this limit is exceeded.","Higher than other report event limits because performance metrics are lightweight and benefit from larger sample sizes for accurate statistical analysis.","Default: 10000 events.")}),z({idx:32,title:"CC_MAX_NOTIFICATIONS",name:"config.CC_MAX_NOTIFICATIONS",description:T.newline("Maximum number of notifications to keep in storage.","Older notifications are removed when this limit is exceeded.","Default: 500 notifications.")}),z({idx:33,title:"CC_MAX_SIGNALS",name:"config.CC_MAX_SIGNALS",description:T.newline("Maximum number of signals to keep in storage.","Older signals are removed when this limit is exceeded.","Default: 50 signals.")}),z({idx:34,title:"CC_MAX_LOG_LINES",name:"config.CC_MAX_LOG_LINES",description:T.newline("Maximum number of log lines to keep in storage.","Older log lines are removed when this limit is exceeded.","This helps prevent unbounded log growth which can consume memory and degrade performance over time.","Default: 1000 log lines.")}),z({idx:35,title:"CC_ENABLE_CANDLE_FETCH_MUTEX",name:"config.CC_ENABLE_CANDLE_FETCH_MUTEX",description:T.newline("Enables mutex locking for candle fetching to prevent concurrent fetches of the same candles.","This can help avoid redundant API calls and ensure data consistency when multiple processes/threads attempt to fetch candles simultaneously.","Default: true (mutex locking enabled for candle fetching).")}),z({idx:36,title:"CC_ENABLE_BACKTEST_PARALLEL_SPIN",name:"config.CC_ENABLE_BACKTEST_PARALLEL_SPIN",description:T.newline("Enables cooperative interleaving of concurrently running backtests after each candle fetch.","Hands the event loop to a peer backtest waiting on the same mutex, so multiple parallel Backtest.run / Walker workloads progress in round-robin fashion instead of one monopolizing the event loop until completion.","Default: true (parallel backtests are interleaved on each candle fetch boundary).")}),z({idx:37,title:"CC_ENABLE_DCA_EVERYWHERE",name:"config.CC_ENABLE_DCA_EVERYWHERE",description:T.newline("Enables DCA (Dollar-Cost Averaging) logic even if antirecord is not broken.","Allows to commitAverageBuy if currentPrice is not the lowest price since entry, but still lower than priceOpen.","Default: false (DCA logic enabled only when antirecord is broken).")}),z({idx:38,title:"CC_ENABLE_PPPL_EVERYWHERE",name:"config.CC_ENABLE_PPPL_EVERYWHERE",description:T.newline("Enables PPPL (Partial Profit, Partial Loss) logic even if this breaks a direction of exits.","Allows to take partial profit or loss on a position even if it results in a mix of profit and loss exits.","Default: false (PPPL logic is only applied when it does not break the direction of exits, ensuring clearer profit/loss outcomes).")}),z({idx:39,title:"CC_ENABLE_LONG_SIGNAL",name:"config.CC_ENABLE_LONG_SIGNAL",description:T.newline("Enables long signals in strategies that are primarily designed for short signals.","This allows the strategy to generate and manage long signals in addition to short signals, even if the original design was focused on short trading.","Default: false (long signals are only enabled in strategies that are designed for them, ensuring strategy logic is aligned with signal types).")}),z({idx:40,title:"CC_ENABLE_SHORT_SIGNAL",name:"config.CC_ENABLE_SHORT_SIGNAL",description:T.newline("Enables short signals in strategies that are primarily designed for long signals.","This allows the strategy to generate and manage short signals in addition to long signals, even if the original design was focused on long trading.")}),z({idx:41,title:"CC_ENABLE_TRAILING_EVERYWHERE",name:"config.CC_ENABLE_TRAILING_EVERYWHERE",description:T.newline("Enables trailing logic (Trailing Take / Trailing Stop) without requiring absorption conditions.","Allows trailing mechanisms to be activated regardless of whether absorption has been detected.","Default: false (trailing logic is applied only when absorption conditions are met).")}),z({idx:42,title:"CC_POSITION_ENTRY_COST",name:"config.CC_POSITION_ENTRY_COST",description:T.newline("Cost of entering a position (in USD).","This is used as a default value for calculating position size and risk management when cost data is not provided by the strategy.","Default: $100 per position.")})]},{type:m.Box,sx:{p:1},child:{type:m.Button,fieldBottomMargin:"0",fieldRightMargin:"0",buttonVariant:"contained",title:"Download",click:async(e,t,i,n)=>{await j.next(),await n.handleDownloadConfig()},icon:w}}]}],q=[{type:m.Group,fieldRightMargin:"1",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"auto 1fr auto",alignItems:"center"},fields:[{type:m.Box,sx:{display:"grid",gridTemplateColumns:"1fr"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Running mode"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"backtest"===e,style:{color:"orange"},typoVariant:"body1",placeholder:"Historical data processing"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"live"===e,style:{color:"green"},typoVariant:"body1",placeholder:"Real-time exchange integration"},{type:m.Typography,fieldBottomMargin:"1",isVisible:({running_mode:e})=>"none"===e,style:{color:"red"},typoVariant:"body1",placeholder:"UI only"}]},{type:m.Box},{type:m.Component,fieldBottomMargin:"0",element:({_fieldData:e,payload:i})=>t(M,{noBadge:!0,size:"small",sx:{transform:"translate(10px, -28px)",opacity:"0.5",transition:"opacity 500ms","&:hover":{opacity:"1.0"}},oneSx:{padding:"0 !important"},fields:$,closeSubject:j,payload:i,handler:()=>e,children:t(W,{})})}]},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"backtest",title:"Historical data"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"live",title:"Real-time"},{type:m.Radio,readonly:!0,fieldBottomMargin:"0",name:"running_mode",radioValue:"none",title:"Frontend only"}]},{type:m.Paper,fieldBottomMargin:"1",innerPadding:"0px",fields:[{type:m.Box,sx:{paddingTop:"16px",paddingLeft:"16px",paddingRight:"16px"},fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"Log mode"},{type:m.Typography,fieldBottomMargin:"2",style:{opacity:.5},typoVariant:"caption",placeholder:"Logs take up disk space but are needed for debugging"}]},...[{title:"JSONL files",description:"Files processed by Claude Code, HuggingFace, Parquet",name:"recent_enabled"},{title:"Markdown files",description:"Human-readable files. Useful when running without a GUI",name:"markdown_enabled"},{title:"Dump files",description:"Conversation dump with the AI agent used for trading signals",name:"dump_enabled"}].map(({name:e,title:t,description:i},n)=>(({title:e,description:t,name:i,idx:n})=>({type:m.Box,sx:{display:"grid",alignItems:"center",gridTemplateColumns:"1fr auto",paddingLeft:"16px",paddingRight:"16px",paddingTop:"4px",paddingBottom:"4px",background:e=>n%2==0?O(e.palette.getContrastText(e.palette.background.paper),.04):"transparent"},fields:[{type:m.Box,fields:[{type:m.Typography,fieldBottomMargin:"0",typoVariant:"body1",placeholder:e},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:t}]},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",fieldRightMargin:"0",title:"",name:i}]}))({name:e,title:t,description:i,idx:n}))]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"1",typoVariant:"h6",placeholder:"User interface"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save notifications",name:"notification_enabled"},{type:m.Typography,fieldBottomMargin:"1",style:{opacity:.5},typoVariant:"caption",placeholder:"Event history is saved to disk"},{type:m.Switch,readonly:!0,fieldBottomMargin:"0",title:"Save signals",name:"storage_enabled"},{type:m.Typography,fieldBottomMargin:"0",style:{opacity:.5},typoVariant:"caption",placeholder:"Latest signal state is saved to disk"}]}]},{type:m.Group,fieldRightMargin:"1",fieldBottomMargin:"2",phoneColumns:"12",tabletColumns:"12",desktopColumns:"6",fields:[{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"3",typoVariant:"h6",placeholder:"Strategy"},{type:m.Typography,placeholder:"Broker"},{type:m.Outline,fieldBottomMargin:"3",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Connected to mainnet (production)",name:"broker_enabled"}]},{type:m.Typography,placeholder:"Market signals"},{type:m.Outline,fieldBottomMargin:"4",fields:[{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use BM25 for RAG",name:"memory_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Use stateful strategies",name:"state_enabled"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Save previous signal",name:"recent_enabled"}]}]},{type:m.Paper,fieldBottomMargin:"1",fields:[{type:m.Typography,fieldBottomMargin:"2",typoVariant:"h6",placeholder:"Risk management"},{type:m.Typography,fieldBottomMargin:"3",style:{opacity:.5},typoVariant:"body1",placeholder:"Use LONG or SHORT positions depending on market conditions"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"0",title:"Enable LONG",name:"enable_long"},{type:m.Checkbox,readonly:!0,fieldBottomMargin:"1",title:"Enable SHORT",name:"enable_short"}]}]},{type:m.Component,desktopHidden:!0,fieldBottomMargin:"5",fieldRightMargin:"1",element:({payload:e})=>{const i=R();return t(v,{variant:"contained",size:"large",startIcon:t(B,{}),onClick:async()=>{await e.handleReload(),i()},children:"Refresh"})}}],J=[{type:l.Link,action:"back-action",label:t(P,{sx:{display:"block"}})},{type:l.Link,action:"back-action",label:"Dashboard"},{type:l.Link,action:"back-action",label:"Performance"},{type:l.Link,action:"back-action",label:"Settings"},{type:l.Button,action:"update-now",label:"Refresh",icon:B}],Q=[{action:"update-now",label:"Refresh",icon:()=>t(s,{icon:B,color:"#4caf50"})}],Z=new o,ee=async()=>{n.setupViewService.getSetupData.clear(),await Z.next()},te=async()=>{const{config:e}=await n.setupViewService.getSetupData(),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`config_${Date.now()}.json`)},ie=[{id:"search",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.performanceViewService.getPerformanceData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Y.subscribe(o));const[s,{execute:d,loading:c}]=i(async()=>await n.environmentViewService.getEnvironmentData());a(()=>Y.subscribe(d));return t(I,{children:[t(r,{items:G,actions:K,onAction:async e=>{"back-action"===e&&n.routerService.push("/main"),"setup-action"===e&&n.routerService.push("/about/setup"),"update-now"===e&&await(async()=>{n.performanceViewService.getPerformanceData.clear(),n.performanceViewService.getPerformanceReport.clear(),n.environmentViewService.getEnvironmentData.clear(),await Y.next()})(),"download-markdown"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport(),t=new Blob([e],{type:"text/plain"}),i=URL.createObjectURL(t);n.layoutService.downloadFile(i,`performance_${Date.now()}.md`)})(),"download-pdf"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceReport();await f(e)})(),"download-json"===e&&await(async()=>{const e=await n.performanceViewService.getPerformanceData(),t=JSON.stringify(e,null,2),i=new Blob([t],{type:"text/plain"}),a=URL.createObjectURL(i);n.layoutService.downloadFile(a,`performance_${Date.now()}.json`)})()}}),e&&s?l||c?null:t(g,{handler:()=>{const t=e.totalEvents>0?e.totalDuration/e.totalEvents:0;return{channel:s.telegram_channel,github:"https://github.com/tripolskypetr/backtest-kit",totalEvents:e.totalEvents,totalDuration:e.totalDuration,avgDuration:t}},fields:U}):null]})},isActive:e=>L(["/about"],e)},{id:"main",element:()=>{const[e,{execute:o,loading:l}]=i(async()=>await n.setupViewService.getSetupData(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1)});a(()=>Z.subscribe(o));return t(I,{children:[t(r,{items:J,actions:Q,onAction:async e=>{"back-action"===e&&n.routerService.push("/about"),"update-now"===e&&await ee()}}),e?l?null:t(g,{handler:e,payload:()=>({handleReload:ee,handleDownloadConfig:te}),fields:q}):null]})},isActive:e=>L(["/about/setup"],e)}],ne=()=>t(N,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:ie});export{ne as AboutPage,ne as default};
@@ -1 +1 @@
1
- import{r as e,f as a,P as i,B as r,A as n,a9 as t,T as o,H as c,a3 as s,aa as l,N as d,J as p,F as m,G as u,M as b,aO as v,aP as y,aQ as g,aR as h,ad as x,aS as k,aT as f,aU as $,aV as P,aW as w,aX as C,aY as S,i as _,aG as A,a8 as O,aH as N,O as E,R as D,aZ as L,a_ as F,Z as z}from"./index-kQlTYlpK.js";import{C as T,R as j}from"./Refresh-DixrXBVq.js";import{K as R}from"./KeyboardArrowLeft-BpxUzr7-.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(C,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(x,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(P,{sx:i});case"breakeven.available":case"breakeven.commit":return a(w,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(f,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(h,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(y,{sx:i});case"error.critical":return a(g,{sx:i});default:return a(v,{sx:i})}},I=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;default:return l("Unknown")}},U=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},W=e=>"symbol"in e,M=e=>"position"in e,H=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,Y=e=>"pnlPercentage"in e,V=e=>"level"in e,G=e=>"percentToClose"in e,K=e=>"currentPrice"in e,Z=e=>"duration"in e,q=e=>"closeReason"in e,J=e=>"cancelReason"in e,Q=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),ee=e=>"message"in e,ae=e=>"rejectionNote"in e,ie=e=>"activePositionCount"in e,re=e=>"effectivePriceOpen"in e,ne=e=>"totalEntries"in e&&e.totalEntries>1,te=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),oe=e=>"totalPartials"in e&&e.totalPartials>0,ce=e=>"cost"in e,se=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,le=e=>"peakProfitPriceClose"in e,de=e=>"maxDrawdownPriceClose"in e,pe=e.forwardRef(({item:e,className:v,style:y,sx:g},h)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:v,style:y,ref:h,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":_.layoutService.pickRisk(e.id);break;case"signal.opened":_.layoutService.pickSignalOpened(e.id);break;case"signal.closed":_.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":_.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":_.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":_.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":_.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":_.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":_.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":_.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":_.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":_.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":_.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":_.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":_.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":_.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":_.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":_.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":_.layoutService.pickClosePending(e.id);break;case"signal.info":_.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...g},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:I(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:U(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),W(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),Y(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"PnL: "+(e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"),color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ie(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}$`:"N/A"}`,variant:"outlined"}),re(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):"N/A"}`,variant:"outlined",color:"warning"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):"N/A"}`,variant:"outlined"})]}),H(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[K(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):"N/A"]})]})]}),se(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}$`:"N/A"]})]})]}),le(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}$`:"N/A"]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}$`:"N/A"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(b,{content:e.note})})]}),ae(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),ee(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),me=[{action:"update-now",label:"Refresh manually",icon:()=>a(z,{icon:j,color:"#4caf50"})}],ue=[{type:D.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:D.Link,action:"back-action",label:"Main"},{type:D.Link,action:"back-action",label:"Notifications"}],be=new O,ve=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=A({handler:async(e,a)=>{const i=await _.notificationViewService.getList(),r=N(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>_.layoutService.setAppbarLoader(!0),onLoadEnd:()=>_.layoutService.setAppbarLoader(!1),reloadSubject:be});return a(T,{children:[a(E,{items:ue,actions:me,onAction:async e=>{"back-action"===e&&_.routerService.push("/"),"update-now"===e&&await be.next()}}),a(L,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:F,hasMore:i,children:e.map(e=>a(pe,{item:e,sx:{mb:1}},e.id))})]})};export{ve as NotificationPage,ve as default};
1
+ import{r as e,f as a,P as i,B as r,A as n,a9 as t,T as o,H as c,a3 as s,aa as l,N as d,J as p,F as m,G as u,M as b,aO as v,aP as y,aQ as g,aR as h,ad as x,aS as k,aT as f,aU as $,aV as P,aW as w,aX as C,aY as S,i as _,aG as A,a8 as O,aH as N,O as E,R as D,aZ as L,a_ as F,Z as z}from"./index-BI3k7b1T.js";import{C as T,R as j}from"./Refresh-3cixHjvW.js";import{K as R}from"./KeyboardArrowLeft-BUZ_pXI5.js";const B=e=>{const i={color:"white",fontSize:28};switch(e.type){case"signal.opened":case"partial_profit.available":case"partial_profit.commit":return a(C,{sx:i});case"signal.closed":case"signal_sync.close":case"close_pending.commit":return a(x,{sx:i});case"signal.scheduled":return a(S,{sx:i});case"signal.cancelled":case"cancel_scheduled.commit":return a(k,{sx:i});case"partial_loss.available":case"partial_loss.commit":case"average_buy.commit":return a(P,{sx:i});case"breakeven.available":case"breakeven.commit":return a(w,{sx:i});case"activate_scheduled.commit":case"signal_sync.open":return a(f,{sx:i});case"trailing_stop.commit":case"trailing_take.commit":return a($,{sx:i});case"risk.rejection":return a(h,{sx:i});case"error.info":case"error.validation":case"signal.info":return a(y,{sx:i});case"error.critical":return a(g,{sx:i});default:return a(v,{sx:i})}},I=e=>{switch(e.type){case"signal.opened":return`${l("Opened")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.closed":return`${l("Closed")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"signal.scheduled":return`${l("Scheduled")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal.cancelled":return`${l("Cancelled")} ${e.symbol}`;case"partial_profit.available":return`${l("Partial profit")} ${e.level}% ${e.symbol}`;case"partial_profit.commit":return`${l("Profit fixed")} ${e.percentToClose}% ${e.symbol}`;case"partial_loss.available":return`${l("Partial loss")} ${e.level}% ${e.symbol}`;case"partial_loss.commit":return`${l("Loss fixed")} ${e.percentToClose}% ${e.symbol}`;case"breakeven.available":return`${l("Breakeven available")} ${e.symbol}`;case"breakeven.commit":return`${l("Breakeven set")} ${e.symbol}`;case"activate_scheduled.commit":return`${l("Activated")} ${e.position.toUpperCase()} ${e.symbol}`;case"average_buy.commit":return`${l("Average Buy")} ${e.symbol}`;case"trailing_stop.commit":return`${l("Trailing stop")} ${e.symbol}`;case"trailing_take.commit":return`${l("Trailing take")} ${e.symbol}`;case"signal_sync.open":return`${l("Sync Open")} ${e.position.toUpperCase()} ${e.symbol}`;case"signal_sync.close":return`${l("Sync Close")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;case"cancel_scheduled.commit":return`${l("Cancel Scheduled")} ${e.symbol}`;case"close_pending.commit":return`${l("Close Pending")} ${e.symbol}`;case"risk.rejection":return`${l("Rejected")} ${e.position.toUpperCase()} ${e.symbol}`;case"error.info":return`${l("Error")}: ${e.message}`;case"error.validation":return`${l("Validation")}: ${e.message}`;case"error.critical":return`${l("Critical")}: ${e.message}`;case"signal.info":return`${l("Signal Info")} ${e.symbol} (${e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"})`;default:return l("Unknown")}},U=e=>{switch(e.type){case"signal.opened":return l("Signal Opened");case"signal.closed":return l("Signal Closed");case"signal.scheduled":return l("Signal Scheduled");case"signal.cancelled":return l("Signal Cancelled");case"partial_profit.available":return l("Partial Profit Available");case"partial_profit.commit":return l("Partial Profit Commit");case"partial_loss.available":return l("Partial Loss Available");case"partial_loss.commit":return l("Partial Loss Commit");case"breakeven.available":return l("Breakeven Available");case"breakeven.commit":return l("Breakeven Commit");case"activate_scheduled.commit":return l("Activated Scheduled");case"average_buy.commit":return l("Average Buy");case"trailing_stop.commit":return l("Trailing Stop");case"trailing_take.commit":return l("Trailing Take");case"signal_sync.open":return l("Signal Sync Open");case"signal_sync.close":return l("Signal Sync Close");case"cancel_scheduled.commit":return l("Cancel Scheduled");case"close_pending.commit":return l("Close Pending");case"risk.rejection":return l("Risk Rejection");case"error.info":return l("Info Error");case"error.validation":return l("Validation Error");case"error.critical":return l("Critical Error");case"signal.info":return l("Signal Info");default:return l("Unknown")}},W=e=>"symbol"in e,M=e=>"position"in e,H=e=>"priceOpen"in e&&"priceTakeProfit"in e&&"priceStopLoss"in e,Y=e=>"pnlPercentage"in e,V=e=>"level"in e,G=e=>"percentToClose"in e,K=e=>"currentPrice"in e,Z=e=>"duration"in e,q=e=>"closeReason"in e,J=e=>"cancelReason"in e,Q=e=>"percentShift"in e,X=e=>"signal.opened"===e.type?"note"in e&&!!e.note:"signal.info"===e.type?"note"in e&&!!e.note&&!!e.notificationId:"activate_scheduled.commit"===e.type?"note"in e&&!!e.note&&!!e.activateId:"close_pending.commit"===e.type?"note"in e&&!!e.note&&!!e.closeId:"cancel_scheduled.commit"===e.type&&("note"in e&&!!e.note&&!!e.cancelId),ee=e=>"message"in e,ae=e=>"rejectionNote"in e,ie=e=>"activePositionCount"in e,re=e=>"effectivePriceOpen"in e,ne=e=>"totalEntries"in e&&e.totalEntries>1,te=e=>"originalPriceOpen"in e&&"priceOpen"in e&&null!=e.originalPriceOpen&&Number(e.originalPriceOpen).toFixed(6)!==Number(e.priceOpen).toFixed(6),oe=e=>"totalPartials"in e&&e.totalPartials>0,ce=e=>"cost"in e,se=e=>"pnlPriceOpen"in e&&"pnlPriceClose"in e&&"pnlCost"in e&&"pnlEntries"in e,le=e=>"peakProfitPriceClose"in e,de=e=>"maxDrawdownPriceClose"in e,pe=e.forwardRef(({item:e,className:v,style:y,sx:g},h)=>{const x=(e=>{switch(e.type){case"signal.opened":case"activate_scheduled.commit":case"signal_sync.open":return"#4CAF50";case"signal.closed":case"signal_sync.close":return"#2196F3";case"signal.scheduled":case"average_buy.commit":case"error.info":case"error.validation":return"#FF9800";case"signal.cancelled":case"cancel_scheduled.commit":default:return"#9E9E9E";case"partial_profit.available":case"partial_profit.commit":return"#8BC34A";case"partial_loss.available":case"partial_loss.commit":return"#FF5722";case"breakeven.available":case"breakeven.commit":return"#00BCD4";case"trailing_stop.commit":case"trailing_take.commit":return"#673AB7";case"close_pending.commit":return"#607D8B";case"risk.rejection":return"#F44336";case"error.critical":return"#D32F2F";case"signal.info":return"#9C27B0"}})(e),k=(e=>"timestamp"in e)(e)?e.timestamp:Date.now();return a("div",{className:v,style:y,ref:h,children:a(i,{variant:"outlined",onClick:()=>(e=>{switch(e.type){case"risk.rejection":_.layoutService.pickRisk(e.id);break;case"signal.opened":_.layoutService.pickSignalOpened(e.id);break;case"signal.closed":_.layoutService.pickSignalClosed(e.id);break;case"signal.scheduled":_.layoutService.pickSignalScheduled(e.id);break;case"signal.cancelled":_.layoutService.pickSignalCancelled(e.id);break;case"partial_profit.available":_.layoutService.pickPartialProfitAvailable(e.id);break;case"partial_profit.commit":_.layoutService.pickPartialProfitCommit(e.id);break;case"partial_loss.available":_.layoutService.pickPartialLossAvailable(e.id);break;case"partial_loss.commit":_.layoutService.pickPartialLossCommit(e.id);break;case"breakeven.available":_.layoutService.pickBreakevenAvailable(e.id);break;case"breakeven.commit":_.layoutService.pickBreakevenCommit(e.id);break;case"trailing_stop.commit":_.layoutService.pickTrailingStop(e.id);break;case"trailing_take.commit":_.layoutService.pickTrailingTake(e.id);break;case"activate_scheduled.commit":_.layoutService.pickActivateScheduled(e.id);break;case"average_buy.commit":_.layoutService.pickAverageBuyCommit(e.id);break;case"signal_sync.open":_.layoutService.pickSignalSyncOpen(e.id);break;case"signal_sync.close":_.layoutService.pickSignalSyncClose(e.id);break;case"cancel_scheduled.commit":_.layoutService.pickCancelScheduled(e.id);break;case"close_pending.commit":_.layoutService.pickClosePending(e.id);break;case"signal.info":_.layoutService.pickSignalNotify(e.id)}})(e),sx:{transition:"box-shadow 0.2s ease",cursor:"pointer",display:"flex",alignItems:"stretch",justifyContent:"stretch","&:hover":{boxShadow:4},...g},children:a(r,{sx:{flex:1,position:"relative",overflow:"clip",height:"100%",width:"100%",borderRadius:"12px"},children:[a(n,{direction:"row",spacing:2,sx:{p:2},children:[a(t,{sx:{width:56,height:56,background:x},children:B(e)}),a(n,{flex:1,spacing:1,children:[a(n,{direction:"row",justifyContent:"space-between",alignItems:"flex-start",children:[a(o,{variant:"h6",sx:{fontWeight:600},children:I(e)}),a(o,{variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap",ml:2},children:c(k).format("HH:mm DD/MM/YYYY")})]}),a(n,{mt:-1,direction:"row",flexWrap:"wrap",children:[a(s,{size:"small",label:U(e),sx:{background:x,mt:1,mr:1,color:"white",fontWeight:500}}),W(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.symbol,variant:"outlined"}),M(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.position.toUpperCase(),variant:"outlined",color:"long"===e.position?"success":"error"}),Y(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:"PnL: "+(e.pnlPercentage?`${e.pnlPercentage>0?"+":""}${e.pnlPercentage.toFixed(2)}%`:"N/A"),color:e.pnlPercentage>=0?"success":"error",variant:"outlined"}),V(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Level")}: ${e.level}%`,variant:"outlined"}),G(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Close")}: ${e.percentToClose}%`,variant:"outlined"}),Z(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Duration")}: ${e.duration} ${l("min")}`,variant:"outlined"}),q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.closeReason,variant:"outlined",color:"info"}),J(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:e.cancelReason,variant:"outlined",color:"info"}),Q(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Shift")}: ${e.percentShift>0?"+":""}${e.percentShift}%`,variant:"outlined"}),ie(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Active")}: ${e.activePositionCount}`,variant:"outlined"}),ne(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Entries")}: ${e.totalEntries}`,variant:"outlined"}),oe(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Partials")}: ${e.totalPartials}`,variant:"outlined"}),ce(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Cost")}: ${e.cost?`${e.cost.toFixed(d(e.cost))}$`:"N/A"}`,variant:"outlined"}),re(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Avg entry")}: ${e.effectivePriceOpen?p(e.effectivePriceOpen,d(e.effectivePriceOpen)):"N/A"}`,variant:"outlined",color:"warning"}),te(e)&&a(s,{size:"small",sx:{mt:1,mr:1},label:`${l("Orig entry")}: ${e.originalPriceOpen?p(e.originalPriceOpen,d(e.originalPriceOpen)):"N/A"}`,variant:"outlined"})]}),H(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[K(e)&&a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Current"),":"," "]}),e.currentPrice?p(e.currentPrice,d(e.currentPrice)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Take Profit"),":"," "]}),e.priceTakeProfit?p(e.priceTakeProfit,d(e.priceTakeProfit)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Stop Loss"),":"," "]}),e.priceStopLoss?p(e.priceStopLoss,d(e.priceStopLoss)):"N/A"]})]})]}),se(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Entry"),":"," "]}),e.pnlPriceOpen?p(e.pnlPriceOpen,d(e.pnlPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL Exit"),":"," "]}),e.pnlPriceClose?p(e.pnlPriceClose,d(e.pnlPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("PnL"),":"," "]}),a(o,{component:"span",color:e.pnlCost>=0?"success.main":"error.main",children:e.pnlCost?`${e.pnlCost>=0?"+":""}${e.pnlCost.toFixed(d(e.pnlCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.pnlEntries?`${e.pnlEntries.toFixed(d(e.pnlEntries))}$`:"N/A"]})]})]}),le(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Entry"),":"," "]}),e.peakProfitPriceOpen?p(e.peakProfitPriceOpen,d(e.peakProfitPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak Exit"),":"," "]}),e.peakProfitPriceClose?p(e.peakProfitPriceClose,d(e.peakProfitPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Peak"),":"," "]}),a(o,{component:"span",color:e.peakProfitCost>=0?"success.main":"error.main",children:e.peakProfitCost?`${e.peakProfitCost>=0?"+":""}${e.peakProfitCost.toFixed(d(e.peakProfitCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.peakProfitEntries?`${e.peakProfitEntries.toFixed(d(e.peakProfitEntries))}$`:"N/A"]})]})]}),de(e)&&a(m,{children:[a(u,{sx:{my:1}}),a(n,{direction:"row",spacing:3,flexWrap:"wrap",children:[a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Entry"),":"," "]}),e.maxDrawdownPriceOpen?p(e.maxDrawdownPriceOpen,d(e.maxDrawdownPriceOpen)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown Exit"),":"," "]}),e.maxDrawdownPriceClose?p(e.maxDrawdownPriceClose,d(e.maxDrawdownPriceClose)):"N/A"]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Drawdown"),":"," "]}),a(o,{component:"span",color:e.maxDrawdownCost>=0?"success.main":"error.main",children:e.maxDrawdownCost?`${e.maxDrawdownCost>=0?"+":""}${e.maxDrawdownCost.toFixed(d(e.maxDrawdownCost))}$`:"N/A"})]}),a(o,{variant:"body2",children:[a(o,{component:"span",color:"text.secondary",children:[l("Invested"),":"," "]}),e.maxDrawdownEntries?`${e.maxDrawdownEntries.toFixed(d(e.maxDrawdownEntries))}$`:"N/A"]})]})]})]})]}),X(e)&&a(r,{onClick:e=>{e.preventDefault(),e.stopPropagation()},sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(r,{component:"pre",sx:{m:0,whiteSpace:"pre-wrap",wordWrap:"break-word"},children:a(b,{content:e.note})})]}),ae(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"error",children:e.rejectionNote})]}),ee(e)&&!X(e)&&a(r,{sx:{px:2,pb:2},children:[a(u,{sx:{mb:1.5}}),a(o,{variant:"body2",color:"text.secondary",children:e.message})]}),a(r,{sx:{position:"absolute",top:0,left:0,bottom:0,width:6,zIndex:1,background:x}})]})})})}),me=[{action:"update-now",label:"Refresh manually",icon:()=>a(z,{icon:j,color:"#4caf50"})}],ue=[{type:D.Link,action:"back-action",label:a(R,{sx:{display:"block"}})},{type:D.Link,action:"back-action",label:"Main"},{type:D.Link,action:"back-action",label:"Notifications"}],be=new O,ve=()=>{const{data:e,hasMore:i,loading:r,onSkip:n}=A({handler:async(e,a)=>{const i=await _.notificationViewService.getList(),r=N(e,a);for(const n of i)if(r([n]).done)break;return r().rows},onLoadStart:()=>_.layoutService.setAppbarLoader(!0),onLoadEnd:()=>_.layoutService.setAppbarLoader(!1),reloadSubject:be});return a(T,{children:[a(E,{items:ue,actions:me,onAction:async e=>{"back-action"===e&&_.routerService.push("/"),"update-now"===e&&await be.next()}}),a(L,{sx:{height:"calc(100vh - 155px)"},withScrollbar:!0,minHeight:72,loading:r,onDataRequest:n,bufferSize:F,hasMore:i,children:e.map(e=>a(pe,{item:e,sx:{mb:1}},e.id))})]})};export{ve as NotificationPage,ve as default};