@backtest-kit/ui 5.10.0 → 6.0.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 (27) hide show
  1. package/build/index.cjs +4 -0
  2. package/build/index.mjs +4 -0
  3. package/build/modules/frontend/build/assets/{Article-D0PUfsyZ.js → Article-B3sJn9jj.js} +1 -1
  4. package/build/modules/frontend/build/assets/{Background-Bp0-zX1I.js → Background-vKerKkRx.js} +1 -1
  5. package/build/modules/frontend/build/assets/{Container-BVnjAw0L.js → Container-BpsVEc--.js} +1 -1
  6. package/build/modules/frontend/build/assets/{IconPhoto-vJVt5Ncr.js → IconPhoto-OJ8YDbpd.js} +1 -1
  7. package/build/modules/frontend/build/assets/{KeyboardArrowLeft-C6uma9wN.js → KeyboardArrowLeft-BasR_jXs.js} +1 -1
  8. package/build/modules/frontend/build/assets/{Refresh-BY0j0EcE.js → Refresh-CWqrXG9u.js} +1 -1
  9. package/build/modules/frontend/build/assets/emitters-84Kl3lbG.js +1 -0
  10. package/build/modules/frontend/build/assets/{hasRouteMatch-DohEILWY.js → hasRouteMatch-CnhjHmvr.js} +1 -1
  11. package/build/modules/frontend/build/assets/{html2canvas-D2jUEpzH.js → html2canvas-D60qFSRE.js} +1 -1
  12. package/build/modules/frontend/build/assets/{index-yQQoZEqI.js → index-8foWT5Mj.js} +1 -1
  13. package/build/modules/frontend/build/assets/{index-jlDU8JcV.js → index-BWBFhgRg.js} +1 -1
  14. package/build/modules/frontend/build/assets/{index-Cg1Md-6T.js → index-CK2_oS-n.js} +1 -1
  15. package/build/modules/frontend/build/assets/{index-Bcb8nGYX.js → index-CVo6552X.js} +1 -1
  16. package/build/modules/frontend/build/assets/{index-D8XGIcxD.js → index-CcisxbBU.js} +1 -1
  17. package/build/modules/frontend/build/assets/{index--twYSr4E.js → index-Cd5VPLjQ.js} +1 -1
  18. package/build/modules/frontend/build/assets/{index-DAgM7WkM.js → index-D-1_V7j0.js} +5 -5
  19. package/build/modules/frontend/build/assets/{index-DNrZ-NLx.js → index-D5Th-vBe.js} +1 -1
  20. package/build/modules/frontend/build/assets/{index-CjPBJAjp.js → index-Dsl-2Lab.js} +1 -1
  21. package/build/modules/frontend/build/assets/{index-RtiSuyWs.js → index-DzN6_JU4.js} +1 -1
  22. package/build/modules/frontend/build/assets/{index-BTNj0TPL.js → index-UYNJGlrB.js} +1 -1
  23. package/build/modules/frontend/build/assets/{index.es-BdwPG30D.js → index.es-BD_vECSZ.js} +1 -1
  24. package/build/modules/frontend/build/assets/{markdownit-CJIyDibX.js → markdownit-CgXxhHBO.js} +1 -1
  25. package/build/modules/frontend/build/index.html +1 -1
  26. package/package.json +3 -3
  27. package/build/modules/frontend/build/assets/emitters-D7EMED_Y.js +0 -1
@@ -1 +1 @@
1
- import{f as e,aY as t,M as a,B as i,aZ as r,a_ as o,v as n,a$ as s,b0 as l,aV as c,b1 as d,x as p,y as h,z as w,A as m,aQ as k,b2 as g,aq as b,b3 as v,aa as y,b4 as u,b5 as f,at as S,S as x,b6 as _,ad as V,q as D,aS as N,W as O,t as L,Z as R,o as B,G as A,T as P,aT as C,w as $,F as j,H as J,K as G,N as M,i as F,l as X,L as H,Q as I,aX as E}from"./index-DAgM7WkM.js";import{h as z}from"./hasRouteMatch-DohEILWY.js";import{I as T}from"./IconPhoto-vJVt5Ncr.js";import{C as U}from"./Container-BVnjAw0L.js";import{R as q}from"./Refresh-BY0j0EcE.js";import{K}from"./KeyboardArrowLeft-C6uma9wN.js";const W=[{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:"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:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Z=({disabled:t,className:a,style:i,sx:c,onClick:d,color:p})=>e(s,{className:a,style:i,sx:c,disabled:t,color:p,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 l(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Y=[{action:"json",label:"Download JSON",icon:()=>e(h,{icon:p,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(h,{icon:w,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(h,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:s})=>{const l=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await s()});return e(d,{transparent:!0,keepMounted:!0,className:a,style:i,sx:r,disabled:t,options:Y,onAction:l})},te=y(),ae=V(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:s}=a,[l,c,d,p,h,w,m,k,g,b,v]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,s):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,s,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,s,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,s,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,s,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,s,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,s,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,s,"backtest"===t),n.markdownViewService.getHeatReport(r,o,s,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,s,"backtest"===t)]);return{type:t,backtest:l,live:c,breakeven:d,risk:p,partial:h,highest_profit:w,schedule:m,performance:k,sync:g,heat:b,strategy:v}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),l=g(),{push:c,pop:d}=l,[p,h]=b(te.location.pathname),w=async()=>{const e=(await ae(t.current,r.current))[p.current.replace("/markdown_report/","")];"string"==typeof e&&await D(e)},m=async()=>{const e=await ae(t.current,r.current),a=p.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:s}=e,l=p.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===l?d=await n.markdownViewService.getBacktestData(a,i,o,s):"live"===l?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===l?d=await n.markdownViewService.getBreakevenData(a,i,o,s,c):"risk"===l?d=await n.markdownViewService.getRiskData(a,i,o,s,c):"partial"===l?d=await n.markdownViewService.getPartialData(a,i,o,s,c):"highest_profit"===l?d=await n.markdownViewService.getHighestProfitData(a,i,o,s,c):"schedule"===l?d=await n.markdownViewService.getScheduleData(a,i,o,s,c):"performance"===l?d=await n.markdownViewService.getPerformanceData(a,i,o,s,c):"sync"===l?d=await n.markdownViewService.getSyncData(a,i,o,s,c):"heat"===l?d=await n.markdownViewService.getHeatData(i,o,s,c):"strategy"===l&&(d=await n.markdownViewService.getStrategyData(a,i,o,s,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${l}_${r.current}_${Date.now()}.json`)}},{pickData:V,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),h(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:W,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(s,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(s,{sx:{mr:"10px"},onClick:()=>w(),children:e(f,{})}),e(Z,{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:s,exchangeName:l,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,s,l,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,s,l),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,s,l,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,s,l,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,s,l,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,s,l,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,s,l,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,s,l,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,s,l,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(s,l,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,s,l,c,d),null,2))})(p.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:w}),e(s,{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,schedule:s,performance:l,sync:c,heat:d,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,schedule:s,performance:l,sync:c,heat:d,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),h(e)},onMount:()=>{a(e),o(t),V()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",se=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function le(e){return I(e,"#000000")>I(e,"#FFFFFF")}const ce=[{type:R.Link,action:"back-action",label:e(K,{sx:{display:"block"}})},{type:R.Link,action:"back-action",label:"Main"},{type:R.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(h,{icon:q,color:"#4caf50"})}],pe=(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:`${G.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:i,type:r,color:o})=>((t,a,i,r,o)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:n})=>e(H,{component:M,onClick:()=>{n.handleOpen(t,a)},sx:{width:"100%",background:o,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>le(o)?F(o,.33):X(o,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:le(o)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:i}),children:r})}))(i,r,t,a,o))}]}),he=[{id:"main",element:()=>{const{classes:t}=se(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:s}]=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])=>pe(e,t)),s=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>pe(e,t));return s.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:()=>!!s.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:s}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),l=ie(),c=(e,t)=>{l(e,t)};return e(U,{children:[e(L,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),s||!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)}],we=({id:t})=>e(E,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:he,params:{id:t}});export{we as StatusPage,we as default};
1
+ import{f as e,aY as t,M as a,B as i,aZ as r,a_ as o,v as n,a$ as s,b0 as l,aV as c,b1 as d,x as p,y as h,z as w,A as m,aQ as k,b2 as g,aq as b,b3 as v,aa as y,b4 as u,b5 as f,at as S,S as x,b6 as _,ad as V,q as D,aS as N,W as O,t as L,Z as R,o as B,G as A,T as P,aT as C,w as $,F as j,H as J,K as G,N as M,i as F,l as X,L as H,Q as I,aX as E}from"./index-D-1_V7j0.js";import{h as z}from"./hasRouteMatch-CnhjHmvr.js";import{I as T}from"./IconPhoto-OJ8YDbpd.js";import{C as U}from"./Container-BpsVEc--.js";import{R as q}from"./Refresh-CWqrXG9u.js";import{K}from"./KeyboardArrowLeft-BasR_jXs.js";const W=[{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:"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:"schedule",label:"Schedule"},{id:"performance",label:"Performance"},{id:"sync",label:"Sync"},{id:"heat",label:"Heat"}],Z=({disabled:t,className:a,style:i,sx:c,onClick:d,color:p})=>e(s,{className:a,style:i,sx:c,disabled:t,color:p,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 l(String(e))})(i),n.alertService.notify("Copied!")},children:e(r,{})}),Y=[{action:"json",label:"Download JSON",icon:()=>e(h,{icon:p,color:"#4caf50"})},{action:"markdown",label:"Download Markdown",icon:()=>e(h,{icon:w,color:"#4caf50"})},{action:"pdf",label:"Download PDF",icon:()=>e(h,{icon:m,color:"#4caf50"})}],ee=({disabled:t,className:a,style:i,sx:r,onDownloadJson:o,onDownloadMarkdown:n,onDownloadPdf:s})=>{const l=c(async e=>{"json"===e?await o():"markdown"===e?await n():"pdf"===e&&await s()});return e(d,{transparent:!0,keepMounted:!0,className:a,style:i,sx:r,disabled:t,options:Y,onAction:l})},te=y(),ae=V(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:s}=a,[l,c,d,p,h,w,m,k,g,b,v]=await Promise.all(["backtest"===t?n.markdownViewService.getBacktestReport(i,r,o,s):Promise.resolve(""),"live"===t?n.markdownViewService.getLiveReport(i,r,o):Promise.resolve(""),n.markdownViewService.getBreakevenReport(i,r,o,s,"backtest"===t),n.markdownViewService.getRiskReport(i,r,o,s,"backtest"===t),n.markdownViewService.getPartialReport(i,r,o,s,"backtest"===t),n.markdownViewService.getHighestProfitReport(i,r,o,s,"backtest"===t),n.markdownViewService.getScheduleReport(i,r,o,s,"backtest"===t),n.markdownViewService.getPerformanceReport(i,r,o,s,"backtest"===t),n.markdownViewService.getSyncReport(i,r,o,s,"backtest"===t),n.markdownViewService.getHeatReport(r,o,s,"backtest"===t),n.markdownViewService.getStrategyReport(i,r,o,s,"backtest"===t)]);return{type:t,backtest:l,live:c,breakeven:d,risk:p,partial:h,highest_profit:w,schedule:m,performance:k,sync:g,heat:b,strategy:v}},{timeout:45e3,key:([e,t])=>`${e}_${t}`}),ie=()=>{const[t,a]=k(""),[r,o]=k("backtest"),l=g(),{push:c,pop:d}=l,[p,h]=b(te.location.pathname),w=async()=>{const e=(await ae(t.current,r.current))[p.current.replace("/markdown_report/","")];"string"==typeof e&&await D(e)},m=async()=>{const e=await ae(t.current,r.current),a=p.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:s}=e,l=p.current.replace("/markdown_report/",""),c="backtest"===r.current;let d;if("backtest"===l?d=await n.markdownViewService.getBacktestData(a,i,o,s):"live"===l?d=await n.markdownViewService.getLiveData(a,i,o):"breakeven"===l?d=await n.markdownViewService.getBreakevenData(a,i,o,s,c):"risk"===l?d=await n.markdownViewService.getRiskData(a,i,o,s,c):"partial"===l?d=await n.markdownViewService.getPartialData(a,i,o,s,c):"highest_profit"===l?d=await n.markdownViewService.getHighestProfitData(a,i,o,s,c):"schedule"===l?d=await n.markdownViewService.getScheduleData(a,i,o,s,c):"performance"===l?d=await n.markdownViewService.getPerformanceData(a,i,o,s,c):"sync"===l?d=await n.markdownViewService.getSyncData(a,i,o,s,c):"heat"===l?d=await n.markdownViewService.getHeatData(i,o,s,c):"strategy"===l&&(d=await n.markdownViewService.getStrategyData(a,i,o,s,c)),void 0!==d){const e=new Blob([JSON.stringify(d,null,2)],{type:"application/json"}),t=URL.createObjectURL(e);n.layoutService.downloadFile(t,`${l}_${r.current}_${Date.now()}.json`)}},{pickData:V,render:N}=v({tabs:Q,withStaticAction:!0,onTabChange:(e,t)=>{const a=`/markdown_report/${e}`;t.replace(a),h(a)},animation:"none",title:"Markdown Report",sizeRequest:u,history:te,routes:W,BeforeTitle:({onClose:t})=>{const{total:a}=g();return e(i,{sx:{mr:1,display:1===a?"none":"flex"},children:e(s,{onClick:t,children:e(_,{})})})},AfterTitle:({onClose:a})=>e(x,{direction:"row",gap:1,children:[e(s,{sx:{mr:"10px"},onClick:()=>w(),children:e(f,{})}),e(Z,{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:s,exchangeName:l,frameName:c}=r,d="backtest"===a;e.includes("/markdown_report/backtest")?i(JSON.stringify(await n.markdownViewService.getBacktestData(o,s,l,c),null,2)):e.includes("/markdown_report/live")?i(JSON.stringify(await n.markdownViewService.getLiveData(o,s,l),null,2)):e.includes("/markdown_report/breakeven")?i(JSON.stringify(await n.markdownViewService.getBreakevenData(o,s,l,c,d),null,2)):e.includes("/markdown_report/risk")?i(JSON.stringify(await n.markdownViewService.getRiskData(o,s,l,c,d),null,2)):e.includes("/markdown_report/partial")?i(JSON.stringify(await n.markdownViewService.getPartialData(o,s,l,c,d),null,2)):e.includes("/markdown_report/highest_profit")?i(JSON.stringify(await n.markdownViewService.getHighestProfitData(o,s,l,c,d),null,2)):e.includes("/markdown_report/schedule")?i(JSON.stringify(await n.markdownViewService.getScheduleData(o,s,l,c,d),null,2)):e.includes("/markdown_report/performance")?i(JSON.stringify(await n.markdownViewService.getPerformanceData(o,s,l,c,d),null,2)):e.includes("/markdown_report/sync")?i(JSON.stringify(await n.markdownViewService.getSyncData(o,s,l,c,d),null,2)):e.includes("/markdown_report/heat")?i(JSON.stringify(await n.markdownViewService.getHeatData(s,l,c,d),null,2)):e.includes("/markdown_report/strategy")&&i(JSON.stringify(await n.markdownViewService.getStrategyData(o,s,l,c,d),null,2))})(p.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:w}),e(s,{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,schedule:s,performance:l,sync:c,heat:d,strategy:p}])=>({backtest:t,live:a,breakeven:i,risk:r,partial:o,highest_profit:n,schedule:s,performance:l,sync:c,heat:d,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),h(e)},onMount:()=>{a(e),o(t),V()}})}},re="backtest-kit__groupHeader",oe="backtest-kit__groupRoot",ne="backtest-kit__symbolImage",se=B()({root:{[`& .${oe}:hover .${re}`]:{opacity:"1 !important"}}});function le(e){return I(e,"#000000")>I(e,"#FFFFFF")}const ce=[{type:R.Link,action:"back-action",label:e(K,{sx:{display:"block"}})},{type:R.Link,action:"back-action",label:"Main"},{type:R.Link,action:"back-action",label:"Markdown Report"}],de=[{action:"update-now",label:"Refresh",icon:()=>e(h,{icon:q,color:"#4caf50"})}],pe=(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:`${G.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:i,type:r,color:o})=>((t,a,i,r,o)=>({type:A.Component,desktopColumns:"6",tabletColumns:"6",phoneColumns:"12",fieldRightMargin:"1",fieldBottomMargin:"1",element:({payload:n})=>e(H,{component:M,onClick:()=>{n.handleOpen(t,a)},sx:{width:"100%",background:o,color:"white",fontWeight:"bold",fontSize:"14px",height:"75px",minHeight:"75px",textWrap:"wrap",padding:"16px",[`& .${ne}`]:{transition:"filter 500ms"},"&:hover":{background:()=>le(o)?F(o,.33):X(o,.33),[`& .${ne}`]:{transition:"filter 500ms",filter:le(o)?"brightness(0.7) contrast(1.2)":"brightness(1.3) contrast(0.5)"}},transition:"background 500ms"},startIcon:e(T,{className:ne,symbol:i}),children:r})}))(i,r,t,a,o))}]}),he=[{id:"main",element:()=>{const{classes:t}=se(),{reloadTrigger:a,doReload:r}=N(),[o,{loading:s}]=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])=>pe(e,t)),s=Object.entries(r).sort(([,e],[,t])=>t.length-e.length).map(([e,t])=>pe(e,t));return s.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:()=>!!s.length,fields:[{type:A.Line,title:"Live"},{type:A.Group,columns:"12",fields:s}]}]:[]})(),{onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),deps:[a]}),l=ie(),c=(e,t)=>{l(e,t)};return e(U,{children:[e(L,{items:ce,actions:de,onAction:e=>{"back-action"===e&&n.routerService.push("/"),"update-now"===e&&r()}}),s||!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)}],we=({id:t})=>e(E,{history:n.routerService,onLoadStart:()=>n.layoutService.setAppbarLoader(!0),onLoadEnd:()=>n.layoutService.setAppbarLoader(!1),routes:he,params:{id:t}});export{we as StatusPage,we as default};