PageSourceSearch

https://pionex.ai/assets/KlineChartImpl-m9z70tmw.js

js pionex.ai collected 2026-10-05 14:32:05 UTC 7,405 bytes, 1 lines download raw bytes

1import{r as n,j as F}from"./vendor-react-C7snOpfu.js";import{q as ge,n as Re,R as xe,p as Le}from"./vendor-charts-6fKpjf46.js";import{u as Ne,g as ce}from"./candlePalette-BtwAc8fk.js";import{u as Se}from"./vendor-i18n-CeqKB46a.js";import"./index-BPvvT87T.js";import"./vendor-redux-DVG1W9QJ.js";import"./vendor-router-Bvr19Whe.js";import"./MobileBottomSheet-B6kysGgQ.js";import"./index-DWaP_4KW.js";import"./index-Cbj206Rk.js";import"./keycode-BXpp3jFq.js";import"./index-DnOxCY4g.js";import"./useCurrentMarket-C7mMkbTP.js";/* empty css              */import"./reasoningEffort-DMqdhCXG.js";import"./chatBootstrap-CnhKjAU0.js";import"./index-D1AptkyS.js";import"./useChatSSE-DC2XAVY8.js";function ve(g,b,c){return g.length===0?b:g[g.length-1].close<g[0].open?c:b}class ye{constructor(b,c,m){this._low=b,this._high=c,this._color=m,this._paneViews=[{zOrder:()=>"bottom",renderer:()=>{const R=this._series;if(!R)return null;const M=this._low,x=this._high,P=this._color;return{draw(K){const L=R.priceToCoordinate(M),j=R.priceToCoordinate(x);L==null||j==null||K.useBitmapCoordinateSpace(({context:V,bitmapSize:N,verticalPixelRatio:p})=>{const h=Math.min(j,L)*p,C=Math.max(j,L)*p;V.save(),V.fillStyle=P,V.fillRect(0,h,N.width,C-h),V.restore()})}}}}]}_series=null;_paneViews;attached(b){this._series=b.series}detached(){this._series=null}updateAllViews(){}paneViews(){return this._paneViews}}const ae=20;function He({base:g,quote:b,lowPrice:c,highPrice:m,liqPriceUp:R,liqPriceDown:M,height:x=200,interval:P,count:K,candleData:L,candleLoading:j,candleError:V,chartType:N="candle",upColor:p=ce().upColor,downColor:h=ce().downColor,markers:C,interactive:w=!1,preserveViewportOnUpdate:Y=!1,onLoadMore:Z,onLoadNewer:$,onChartReady:ue,onChartDestroy:fe}){const D=n.useRef(null),_=n.useRef(null),O=n.useRef(null),z=n.useRef(null),Q=n.useRef(Z);Q.current=Z;const J=n.useRef($);J.current=$;const W=n.useRef(!1),k=n.useRef(!1),A=n.useRef(0),S=n.useRef(0),T=n.useRef(0),U=n.useRef(!1),X=Ne({base:L?"":g,quote:L?"":b,interval:P,count:K}),r=L??X.data,ee=j??X.loading,me=V??X.error,{t:B}=Se(),G=ve(r,p,h),te=n.useRef(G);return te.current=G,n.useEffect(()=>{if(!D.current)return;const e=document.documentElement.getAttribute("data-theme")==="dark",i=ge(D.current,{width:D.current.clientWidth,height:x,layout:{background:{color:"transparent"},textColor:e?"#9aa0aa":"#6e727d",fontSize:10},grid:{vertLines:{color:e?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)"},horzLines:{color:e?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.04)"}},rightPriceScale:{borderVisible:!1,entireTextOnly:!0,scaleMargins:{top:.15,bottom:.1}},timeScale:{borderVisible:!1,timeVisible:!0},crosshair:{horzLine:{visible:!1},vertLine:{visible:!1}},handleScroll:w,handleScale:w});_.current=i;const f=N==="line"?i.addSeries(Re,{color:te.current,lineWidth:2,priceLineVisible:!1,lastValueVisible:!0}):i.addSeries(xe,{upColor:p,downColor:h,borderUpColor:p,borderDownColor:h,wickUpColor:p,wickDownColor:h});O.current=f,w&&i.timeScale().subscribeVisibleLogicalRangeChange(a=>{if(!a||U.current)return;const o=f.barsInLogicalRange(a);o!==null&&(Q.current&&!W.current&&o.barsBefore!==null&&o.barsBefore<ae&&(W.current=!0,Promise.resolve(Q.current()).finally(()=>{W.current=!1})),J.current&&!k.current&&o.barsAfter!==null&&o.barsAfter<ae&&(k.current=!0,Promise.resolve(J.current()).finally(()=>{k.current=!1})))});const s=new ResizeObserver(a=>{for(const o of a)i.applyOptions({width:o.contentRect.width})});return s.observe(D.current),T.current=0,A.current=0,S.current=0,ue?.({chart:i,series:f}),()=>{fe?.(),s.disconnect(),i.remove(),_.current=null,O.current=null,z.current=null}},[N,p,h,w,B]),n.useEffect(()=>{_.current&&_.current.applyOptions({height:x})},[x]),n.useEffect(()=>{const e=O.current,i=_.current;if(!e||!i)return;if(r.length===0){T.current=0,A.current=0,S.current=0,W.current=!1,k.current=!1;return}const f=r[0].time,s=r[r.length-1].time,a=T.current>0,o=a&&A.current>0&&f<A.current,I=w&&a&&!o&&S.current>0&&s>S.current,q=I&&!Y,H=I||Y&&!o&&a,d=o||q?i.timeScale().getVisibleLogicalRange():null,v=d&&S.current>0?r.findIndex(l=>l.time===S.current):-1,y=v<0?null:v-(T.current-1);if(N==="line"){const l=e;l.applyOptions({color:G}),l.setData(r.map(E=>({time:E.time,value:E.close})))}else e.setData(r.map(l=>({time:l.time,open:l.open,high:l.high,low:l.low,close:l.close})));d&&y!==null?i.timeScale().setVisibleLogicalRange({from:d.from+y,to:d.to+y}):!o&&!H&&(U.current=!0,i.timeScale().fitContent(),setTimeout(()=>{U.current=!1},300)),T.current=r.length,A.current=f,S.current=s,a||(W.current=!1,k.current=!1)},[r,N,Y,w,G]),n.useEffect(()=>{const e=O.current;if(!e)return;const f=(C?[...C].sort((s,a)=>s.time-a.time):[]).map(s=>({time:s.time,position:s.position,color:s.color,shape:s.shape,text:s.text}));if(z.current?.series!==e){z.current={series:e,plugin:Le(e,f)};return}z.current.plugin.setMarkers(f)},[C]),n.useEffect(()=>{const e=O.current,i=_.current;if(!e||!i||r.length===0)return;for(const t of e.priceLines())e.removePriceLine(t);const f=document.documentElement.getAttribute("data-theme")==="dark",s=r.map(t=>t.high),a=r.map(t=>t.low),o=Math.max(...s),I=Math.min(...a),q=c?Number(c):NaN,H=m?Number(m):NaN,d=R?Number(R):NaN,v=M?Number(M):NaN,y=[I,q,v].reduce((t,u)=>Number.isFinite(u)?Math.min(t,u):t,I),l=[o,H,d].reduce((t,u)=>Number.isFinite(u)?Math.max(t,u):t,o),E=l-y,re=(l+y)/2*.005,de=E*.08,ne=E<re,be=Number.isFinite(q)||Number.isFinite(H)||Number.isFinite(d)||Number.isFinite(v),ie=ne?(re-E)/2:de,pe=t=>{const u=t();return!u?.priceRange||!ne&&!be?u:{...u,priceRange:{minValue:y-ie,maxValue:l+ie}}};e.applyOptions({autoscaleInfoProvider:pe});const se=i.priceScale("right");if(se.options().autoScale&&se.setAutoScale(!0),c&&m){const t=Number(c),u=Number(m);if(Number.isFinite(t)&&Number.isFinite(u)&&t<u){const he=f?"rgba(0, 181, 120, 0.13)":"rgba(0, 181, 120, 0.10)";e.attachPrimitive(new ye(t,u,he))}
1e.createPriceLine({price:Number(c),color:"#00b578",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:""}),e.createPriceLine({price:Number(m),color:"#00b578",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:""})}else c&&e.createPriceLine({price:Number(c),color:"#00b578",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:""}),m&&e.createPriceLine({price:Number(m),color:"#00b578",lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:""});if((c||m)&&r.length>0){const t=r[r.length-1].close;e.createPriceLine({price:t,color:f?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.45)",lineWidth:1,lineStyle:1,axisLabelVisible:!1,title:""})}const oe="#E0195C",le=B("gridBot.liqPrice");Number.isFinite(d)&&e.createPriceLine({price:d,color:oe,lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:le}),Number.isFinite(v)&&e.createPriceLine({price:v,color:oe,lineWidth:1,lineStyle:2,axisLabelVisible:!0,title:le})},[r,N,c,m,R,M,B]),me?F.jsx("div",{className:"flex items-center justify-center text-xs text-accent-sub",style:{height:x},children:B("chart.loadFailed")}):F.jsxs("div",{className:"relative ps-3",style:{height:x},children:[ee&&F.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:F.jsx("div",{className:"w-5 h-5 border-2 border-divider border-t-primary rounded-full animate-spin"})}),!ee&&r.length===0&&F.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-xs text-accent-sub",children:B("chart.noData")}),F.jsx("div",{ref:D,className:"w-full h-full [&_a[href*='tradingview']]:!hidden"})]})}export{He as KlineChart};

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