@gearbox-protocol/ui-kit 4.0.0-next.54 → 4.0.0-next.56
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.
- package/dist/cjs/components/base/chart-with-side-card/chart-with-side-card.cjs +1 -1
- package/dist/cjs/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/locale/en.json.cjs +1 -1
- package/dist/esm/components/base/chart-with-side-card/chart-with-side-card.js +6 -6
- package/dist/esm/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.js +62 -61
- package/dist/esm/components/graph/graph.js +64 -63
- package/dist/esm/locale/en.json.js +2 -0
- package/dist/types/components/base/pool-apy-breakdown-card/pool-apy-breakdown-card.d.ts +3 -2
- package/dist/types/locale/en.json.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./constants.cjs");function r({chart:i,side:a}){return e.jsxs("div",{className:"flex w-full flex-wrap gap-4","data-testid":t.ChartWithSideCardTest.root,children:[e.jsx("div",{className:"min-w-[min(100%,40rem)] grow-[999] basis-0","data-testid":t.ChartWithSideCardTest.chart,children:i}),e.jsx("div",{className:"min-w-[min(100%,300px)] grow
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./constants.cjs");function r({chart:i,side:a}){return e.jsxs("div",{className:"flex w-full flex-wrap gap-4","data-testid":t.ChartWithSideCardTest.root,children:[e.jsx("div",{className:"min-w-[min(100%,40rem)] grow-[999] basis-0","data-testid":t.ChartWithSideCardTest.chart,children:i}),e.jsx("div",{className:"min-w-[min(100%,300px)] grow basis-[22.5rem]","data-testid":t.ChartWithSideCardTest.side,children:a})]})}exports.ChartWithSideCardTest=t.ChartWithSideCardTest;exports.ChartWithSideCard=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("../apy-breakdown-body/apy-breakdown-body.cjs"),l=require("../values/no-value.cjs"),p=require("../../../utils/apy-breakdown.cjs");require("@gearbox-protocol/sdk/onchain");require("clsx");require("tailwind-merge");require("luxon");require("../../../utils/z-index.cjs");require("viem");require("react");const a=require("./constants.cjs"),m=require("../../points-icon/points-icon.cjs"),u=require("../../token-icon/token-icon.cjs");require("../../tooltip/simple-tooltip.cjs");require("../../tooltip/tooltip.cjs");const t=require("../../typed-intl/index.cjs");require("../../badge/badge.cjs");require("../../badge/chip.cjs");function k({data:s,period:r}){const d=s?p.totalApyOf(s):void 0,i=s?.organicApy,c=s?p.tokenRewardsOf(s):[],y=s?p.pointProgramsOf(s):[];return e.jsxs(o.ApyBreakdownBody,{testId:a.PoolApyBreakdownCardTest.root,title:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(r,"components.poolApyBreakdownCard.title","components.poolApyBreakdownCard.title7d")}),chip:d==null?e.jsx(l.NoValue,{reason:r}):o.formatBreakdownRate(d),chipPositive:(d??0)>0,chipTestId:a.PoolApyBreakdownCardTest.net,children:[e.jsx(o.ApyBreakdownRow,{valueTestId:a.PoolApyBreakdownCardTest.value,label:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(r,"components.poolApyBreakdownCard.organicApy","components.poolApyBreakdownCard.organicApy7d")}),value:i==null?e.jsx(l.NoValue,{reason:r}):o.formatBreakdownRate(i)}),c.length>0?c.map(n=>e.jsx(o.ApyBreakdownRow,{valueTestId:a.PoolApyBreakdownCardTest.value,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(r,"components.poolApyBreakdownCard.tokenIncentiveApy","components.poolApyBreakdownCard.tokenIncentiveApy7d"),values:{symbol:n.token.symbol}})}),e.jsx(u.TokenIcon,{token:n.token,symbol:n.token.symbol,size:16,className:"shrink-0"})]}),value:o.formatBreakdownRate(n.supplyApr??0)},`incentive-${n.token.address}`)):e.jsx(o.ApyBreakdownRow,{valueTestId:a.PoolApyBreakdownCardTest.value,label:e.jsx(t.FormattedMessageTyped,{messageId:o.periodMessageId(r,"components.poolApyBreakdownCard.incentiveApy","components.poolApyBreakdownCard.incentiveApy7d")}),value:s==null?e.jsx(l.NoValue,{reason:r}):o.formatBreakdownRate(0)}),y.length>0?e.jsxs(e.Fragment,{children:[e.jsx(o.ApyBreakdownDivider,{}),y.map(n=>e.jsx(o.ApyBreakdownRow,{valueTestId:a.PoolApyBreakdownCardTest.points,label:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{children:e.jsx(t.FormattedMessageTyped,{messageId:"components.yieldBreakdown.programPoints",values:{name:n.name}})}),e.jsx(m.PointsIcon,{reward:{name:n.name,type:n.id},size:16,className:"shrink-0"})]}),value:n.multiplier!=null?`${n.multiplier}×`:o.BREAKDOWN_DASH},n.id))]}):null]})}exports.PoolApyBreakdownCardTest=a.PoolApyBreakdownCardTest;exports.PoolApyBreakdownCard=k;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),Z=require("lightweight-charts"),p=require("react"),ct=require("../../hooks/use-media-query.cjs"),H=require("../../utils/cn.cjs"),X=require("../../utils/colors.cjs"),D=require("./default-config.cjs"),ne=require("./formatters.cjs"),ut=require("./graph-current-value.cjs"),ft=require("./graph-tooltip.cjs"),ht=require("./plugins/vertical-line.cjs"),He=require("./y-axis-scale.cjs");function gt(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,u.get?u:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const Te=gt(p);function re(e){return e.id??e.label}function Ze(e,n,a){if(!a)return e.values().next().value;const u=e.get(a);if(u)return u;const h=n.find(f=>f.id===a||f.label===a);return h?e.get(re(h)):void 0}class dt{_yTop;_yBottom;_color;constructor(n,a,u){this._yTop=n,this._yBottom=a,this._color=u}draw(n){n.useBitmapCoordinateSpace(a=>{const u=a.context,h=a.verticalPixelRatio,f=this._yTop===null?0:this._yTop*h,x=this._yBottom===null?a.bitmapSize.height:this._yBottom*h,P=Math.min(f,x),k=Math.max(f,x);u.fillStyle=this._color,u.fillRect(0,P,a.bitmapSize.width,k-P)})}}class pt{_source;_yTop=null;_yBottom=null;constructor(n){this._source=n}update(){const n=this._source.series;this._yTop=this._source.priceTop===void 0?null:n.priceToCoordinate(this._source.priceTop),this._yBottom=this._source.priceBottom===void 0?null:n.priceToCoordinate(this._source.priceBottom)}zOrder(){return"bottom"}renderer(){return new dt(this._yTop,this._yBottom,this._source.color)}}class mt{series;priceTop;priceBottom;color;_paneViews;constructor(n,a,u,h){this.series=n,this.priceTop=a,this.priceBottom=u,this.color=h,this._paneViews=[new pt(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function bt(e,n){switch(e){case Z.LineStyle.Dotted:return[n,n];case Z.LineStyle.Dashed:return[2*n,2*n];case Z.LineStyle.LargeDashed:return[6*n,6*n];case Z.LineStyle.SparseDotted:return[n,4*n];default:return[]}}class St{_y;_color;_lineWidth;_lineStyle;constructor(n,a,u,h){this._y=n,this._color=a,this._lineWidth=u,this._lineStyle=h}draw(n){n.useBitmapCoordinateSpace(a=>{if(this._y===null)return;const u=a.context,h=a.verticalPixelRatio,f=Math.max(1,Math.round(this._lineWidth*h)),x=Math.round(this._y*h);u.save(),u.strokeStyle=this._color,u.lineWidth=f,u.setLineDash(bt(this._lineStyle,f)),u.beginPath(),u.moveTo(0,x),u.lineTo(a.bitmapSize.width,x),u.stroke(),u.restore()})}}class Ct{_source;_y=null;constructor(n){this._source=n}update(){this._y=this._source.series.priceToCoordinate(this._source.price)}zOrder(){return"top"}renderer(){return new St(this._y,this._source.color,this._source.lineWidth,this._source.lineStyle)}}class xt{series;price;color;lineWidth;lineStyle;_paneViews;constructor(n,a,u,h,f){this.series=n,this.price=a,this.color=u,this.lineWidth=h,this.lineStyle=f,this._paneViews=[new Ct(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function Qe(e,n,a){const u=e.labelText??"",h=e.value,f=h===void 0?"":typeof h=="number"?n==="$"?`$${ne.formatExactValue(h,void 0,a)}`:n==="%"?`${ne.formatExactValue(h,void 0,a)}%`:ne.formatExactValue(h,n!=="none"&&n!=="%"&&n!=="$"&&!ne.isRatioUnit(n)?n:void 0,a):String(h);return{labelText:u,valueStr:f}}const Le=4;function Ye(e,n,a){const u={left:e,transform:"translateX(-50%)"};if(n<=0||!a||a<=0)return u;const h=a/2,f=Le+h,x=n-Le-h;return x<f?{left:n/2,transform:"translateX(-50%)"}:{left:Math.min(Math.max(e,f),x),transform:"translateX(-50%)"}}function Je(e,n){for(let a=e.length-1;a>=0;a--)if(Number(e[a].time)<=n)return e[a].value;return 0}const Se=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],vt=137.5;function Ne(e){if(e<Se.length)return Se[e];const a=(e-Se.length)*vt%360,u=X.hslToHex(a,70,50),{topColor:h,bottomColor:f}=X.generateColorsFromBase(u);return{line:u,top:h,bottom:f}}function yt({series:e,className:n,showLegend:a=!1,onUnselectSeries:u,xMeasureUnit:h="time",yMeasureUnit:f="token",optionsOverrides:x,verticalLineOptions:P,priceLineOptions:k,zoneOptions:F,currentValueDecimals:ae,useSharedPriceScale:Q=!1,dualYAxis:A=!1,defaultVisiblePriceScaleId:Ve="right",leftPriceScaleTitle:Ee,rightPriceScaleTitle:_t,showCurrentValue:et=!0,graphTitle:Ce,yScaleMin:Ie,yScaleMinMultiple:De,visibleTimeFrom:ee,disableZoom:Me=!1,hideDefaultTooltip:xe=!1}){const j=p.useRef(null),E=p.useRef(new Map),ve=p.useRef(!1),ke=p.useRef(!0),Ae=p.useRef([]),le=p.useRef(0),B=p.useRef(null),ye=p.useRef(null),je=p.useRef(null),T=ct.useIsMobile(),ce=Te.useMemo(()=>e.flatMap(t=>t.data),[e]),tt=Te.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Be,_e]=p.useState(()=>{if(!tt)return;const t=new Map;for(const l of e)l.data.length>0&&t.set(l.label,l.data[l.data.length-1]);return t}),[Fe,J]=p.useState(null),[ze,Ge]=p.useState([]),[ot,Xe]=p.useState(0),qe=p.useRef(new Map),[rt,nt]=p.useState({}),[te,it]=p.useState(0);p.useEffect(()=>{const t=()=>{try{if(B.current&&Xe(B.current.clientWidth),j.current&&B.current){const s=B.current.clientWidth,c=B.current.clientHeight;j.current.resize(s,c);try{le.current=j.current.paneSize().height}catch{}}}catch{}},l=B.current,i=l?new ResizeObserver(t):null;return je.current=i,l&&i?.observe(l),()=>{l&&i?.unobserve(l),i?.disconnect(),je.current=null}},[]),p.useEffect(()=>{if(!ye.current||ve.current)return;const t=D.getDefaultOptions(),l=X.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)"),i=Z.createChart(ye.current,{...t,leftPriceScale:{...t.leftPriceScale||{},visible:!1,textColor:l},rightPriceScale:{...t.rightPriceScale||{},visible:!T,textColor:l},...T&&{crosshair:{...t.crosshair,mode:Z.CrosshairMode.Magnet}}});j.current=i,ve.current=!0;try{le.current=i.paneSize().height}catch{le.current=0}return it(s=>s+1),()=>{i.remove(),j.current=null,ve.current=!1,E.current.clear()}},[T]),p.useEffect(()=>{const t=j.current;t&&t.applyOptions(Me?{handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:!1,axisDoubleClickReset:!1},handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1}}:{handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:!0,axisDoubleClickReset:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}})},[te,Me]),p.useEffect(()=>{const t=j.current;!t||!x||t.applyOptions(x)},[te,x]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const i=e.filter(r=>r.data.length>0).length<=1?Ie:De,s=h==="time"?ne.getXFormatters(h,ce):ne.getXFormatters(h),c=new Map;{let r=0;for(const o of e)o.data.length!==0&&(c.set(o.label,o.priceScaleId??(r===0?"left":"right")),r++)}const g=(r,o,d)=>{const{formatter:z,tickmarksFormatter:N,updateVisibleRange:V}=ne.createAdaptiveYAxisFormatter(r,o,{yScaleMin:i});return{formatter:z,tickmarksFormatter:N,updateVisibleRange:V,labels:d}},m=[];if(A)for(const r of["left","right"]){const o=new Set,d=[];let z=f;for(const N of e)if(N.data.length!==0&&c.get(N.label)===r){o.size===0&&N.yMeasureUnit&&(z=N.yMeasureUnit),o.add(N.label);for(const V of N.data)d.push(V.value)}o.size>0&&m.push(g(d,z,o))}else{const r=ce.map(d=>d.value),o=new Set(e.filter(d=>d.data.length>0).map(d=>d.label));m.push(g(r,f,o))}Ae.current=m;const _=new Map;for(const r of m)for(const o of r.labels)_.set(o,r);const w=D.getDefaultOptions();t.applyOptions({localization:{...w.localization||{},timeFormatter:r=>s.timeFormatter(parseFloat(r),void 0)},timeScale:{...w.timeScale||{},...x?.timeScale,tickMarkFormatter:s.tickMarkFormatter,minBarSpacing:0}});const v=!A&&e.length>1&&!Q,q=A?T:e.length>1&&!Q||T,I=X.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)");t.applyOptions({...A&&{defaultVisiblePriceScaleId:Ve},leftPriceScale:{...w.leftPriceScale||{},...x?.leftPriceScale,visible:A&&!T,textColor:I,...A&&Ee&&{}},rightPriceScale:{...w.rightPriceScale||{},...x?.rightPriceScale,visible:A?!T:!q,textColor:I}});const oe=new Set(E.current.keys()),W=new Set(e.map(re));for(const r of oe)if(!W.has(r)){const o=E.current.get(r);o&&(t.removeSeries(o),E.current.delete(r))}const b=D.getDefaultSeries(),M=[];let L=0;const K=e.find(r=>r.data.length>0),y=new Map;if(k&&k.length>0)for(const r of k){if(!Number.isFinite(r.price))continue;const o=r.seriesLabel??K?.label;if(!o)continue;const d=y.get(o)??[];d.push(r.price),y.set(o,d)}if(F&&F.length>0)for(const r of F){const o=r.seriesLabel??K?.label;if(!o)continue;const d=y.get(o)??[];Number.isFinite(r.priceTop)&&d.push(r.priceTop),Number.isFinite(r.priceBottom)&&d.push(r.priceBottom),y.set(o,d)}for(let r=0;r<e.length;r++){const o=e[r],d=re(o),z=Ne(r),N=o.lineColor??o.color??z.line;let V,U;if(o.lineColor??o.color)if(o.topColor&&o.bottomColor)V=o.topColor,U=o.bottomColor;else if(o.topColor){const S=X.generateColorsFromBase(N);V=o.topColor,U=S.bottomColor}else if(o.bottomColor)V=X.generateColorsFromBase(N).topColor,U=o.bottomColor;else{const S=X.generateColorsFromBase(N);V=S.topColor,U=S.bottomColor}else V=o.topColor||z.top,U=o.bottomColor||z.bottom;if(o.data.length===0){const S=E.current.get(d);S&&(t.removeSeries(S),E.current.delete(d));continue}const pe=o.data.length>0?Math.min(...o.data.map(S=>S.value)):0,ue=o.data.length>0?Math.max(...o.data.map(S=>S.value)):0,fe=pe<0,Y=o.data.some(S=>S.value===0),me=!fe&&Y,he=He.pickMinMove(ue-pe),ge=A?o.priceScaleId??(L===0?"left":"right"):Q||!v||L===0?"right":`scale-${L}`;v&&M.push({priceScaleId:ge||"right",seriesIndex:L});const we=(Q||!v)&&i!==void 0&&typeof i=="number",st=y.get(o.label)??[],at=S=>{const R=S();if(R?.priceRange){we&&(R.priceRange.minValue=i);for(const O of st)O<R.priceRange.minValue&&(R.priceRange.minValue=O),O>R.priceRange.maxValue&&(R.priceRange.maxValue=O);const se=we?i:me&&R.priceRange.minValue>=0?0:void 0,be=le.current>0?le.current:B.current?.clientHeight??0;if(be>0){const O=He.niceAxisRange({min:R.priceRange.minValue,max:R.priceRange.maxValue,floor:se,scaleHeightPx:be,fontSizePx:D.AXIS_FONT_SIZE,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,minMove:he,edgePaddingPx:D.AXIS_EDGE_LABEL_PADDING_PX,edgePaddingTopPx:D.AXIS_TOP_LABEL_PADDING_PX});R.priceRange.minValue=O.min,R.priceRange.maxValue=O.max}R.margins={above:D.AXIS_TOP_LABEL_PADDING_PX,below:D.AXIS_EDGE_LABEL_PADDING_PX}}return R},Ke=_.get(o.label)??m[0],$e=Ke.formatter,lt=Ke.tickmarksFormatter,Re={lineColor:N,topColor:V,bottomColor:U,priceScaleId:ge,...o.seriesType==="line"&&{lineStyle:o.lineStyle??Z.LineStyle.Solid},priceFormat:{type:"custom",minMove:he,formatter:we&&typeof i=="number"?S=>$e(S<i?i:S):$e,tickmarksFormatter:lt},autoscaleInfoProvider:at},Oe=o.seriesType==="line";let G=E.current.get(d);const ie=o.data.map(S=>({...S,time:S.time}));if(ee!==void 0&&ie.length>0&&Number(ie[0].time)>ee){const S=Number(ie[0].time),R=S-ee,se=86400,be=R>180*se?7*se:R>30*se?se:6*3600,O=[];for(let Pe=ee;Pe<S;Pe+=be)O.push({time:Pe});ie.unshift(...O)}G&&G.seriesType()!==(Oe?"Line":"Area")&&(t.removeSeries(G),E.current.delete(d),G=void 0),G?(G.applyOptions(Re),G.setData(ie)):(Oe?G=t.addSeries(Z.LineSeries,{...b,...Re}):G=t.addSeries(Z.AreaSeries,{...b,...Re}),G.setData(ie),E.current.set(d,G)),L++}if(A)try{const r=t.priceScale("left"),o=t.priceScale("right"),d={visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...x?.rightPriceScale};r?.applyOptions(d),o?.applyOptions(d)}catch{}else if(v&&M.length>0)for(const r of M)try{const o=t.priceScale(r.priceScaleId);o&&o.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I})}catch(o){console.warn(`Failed to configure price scale ${r.priceScaleId} for series ${r.seriesIndex}:`,o)}else if(!v)try{const r=t.priceScale("right");r&&r.applyOptions({visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...x?.rightPriceScale})}catch{}if(i!==void 0&&!T&&(Q||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),ce.length>0){const r=ce.map(o=>Number(o.time)).filter(o=>Number.isFinite(o));if(r.length>0){const o=Math.min(...r),d=ee!==void 0?Math.min(ee,o):o,z=Math.max(...r);if(Number(d)<=Number(z)){const N=()=>{const V=t.timeScale();if(h!=="time"){V.applyOptions({fixLeftEdge:!0,fixRightEdge:!0});return}const U=A&&!T,pe=A?!T:!q,ue=!U,fe=!pe;if(V.applyOptions({fixLeftEdge:!ue,fixRightEdge:!fe}),!ue&&!fe)return;const Y=V.getVisibleLogicalRange(),me=V.width();if(!Y||!(me>0))return;const he=Y.to-Y.from;if(!(he>0))return;const ge=D.AXIS_TIME_EDGE_PADDING_PX*he/me;V.setVisibleLogicalRange({from:ue?Y.from-ge:Y.from,to:fe?Y.to+ge:Y.to})};try{t.timeScale().setVisibleRange({from:d,to:z}),N()}catch{try{t.timeScale().fitContent(),N()}catch{}}}}}ke.current&&(ke.current=!1),x&&t.applyOptions(x);const $=new Map;for(const r of e)r.data.length>0&&$.set(r.label,r.data[r.data.length-1]);_e($.size>0?$:void 0)},[te,e,ce,h,f,T,Q,A,Ve,Ee,Ie,De,ee,k,F,x]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const l=e.length===1;let i;for(const c of e)if(c.data.length>0){i=c.data[c.data.length-1].time;break}if(!i)return;const s=c=>{const{time:g=i,seriesData:m,point:_}=c||{},w=e[0],v=w?E.current.get(re(w)):void 0;if(!_||!g){const W=new Map;for(const b of e)b.data.length>0&&W.set(b.label,b.data[b.data.length-1]);if(_e(W.size>0?W:void 0),l||Q||xe)J(null);else if(v&&i){const b=e[0];if(b&&b.data.length>0){const L=t.timeScale().timeToCoordinate(i),K=b.data[b.data.length-1].value,y=v.priceToCoordinate(K);L!==null&&y!==null&&J({x:L,y})}}return}const q=new Map;let I,oe=v;for(let W=0;W<e.length;W++){const b=e[W],M=E.current.get(re(b));if(!M)continue;const L=m?.get(M),K=L&&"value"in L?L.value:void 0;let y;if(K!==void 0)y=K;else if(l){const $=Number(g),r=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;$<r?y=Number.NaN:y=b.data[b.data.length-1]?.value??0}else{const $=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;if(Number(g)<$)continue;y=Je(b.data,Number(g))}Number.isNaN(y)||(I===void 0&&(I=y,oe=M),q.set(b.label,{value:y,time:g}))}if(_e(q),I!==void 0&&oe){const b=t.timeScale().timeToCoordinate(g),M=oe.priceToCoordinate(I);if(b!==null&&M!==null){const L=B.current;if(L){const K=L.querySelector(".LightweightChart");if(K){const y=K.getBoundingClientRect(),$=L.getBoundingClientRect(),r=b+(y.left-$.left),o=M+(y.top-$.top);J({x:r,y:o})}else J({x:b,y:M})}else J({x:b,y:M})}else J(null)}else J(null)};return t.subscribeCrosshairMove(s),T&&t.subscribeClick(s),!l&&!Q&&!xe&&requestAnimationFrame(()=>{const c=e[0],g=c?E.current.get(re(c)):void 0;if(g&&i&&c.data.length>0){const _=t.timeScale().timeToCoordinate(i),w=c.data[c.data.length-1].value,v=g.priceToCoordinate(w);_!==null&&v!==null&&J({x:_,y:v})}}),()=>{t.unsubscribeCrosshairMove(s),T&&t.unsubscribeClick(s)}},[e,Q,T,xe]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const l=t.timeScale(),i=()=>{const s=Ae.current;if(s.length===0)return;const c=l.getVisibleRange();if(!c)return;const g=Number(c.from),m=Number(c.to);for(const _ of s){const w=[];for(const v of e)if(_.labels.has(v.label))for(const q of v.data){const I=Number(q.time);I>=g&&I<=m&&w.push(q.value)}w.length>0&&_.updateVisibleRange(w)}};return l.subscribeVisibleLogicalRangeChange(i),()=>{l.unsubscribeVisibleLogicalRangeChange(i)}},[e]),p.useEffect(()=>{const t=j.current,l=Array.from(E.current.values()),i=[];if(t&&l.length>0&&P){const s=D.getDefaultVerticalLine(),c=l[0];for(const g of P){const m={...s,...g.options||{}};m.color&&(m.color=X.resolveCSSColor(m.color,m.color));const _=new ht.VertLine(t,c,g.xCoordinate,m);c.attachPrimitive(_),i.push(_)}}return()=>{if(l.length>0){const s=l[0];for(const c of i)try{s.detachPrimitive(c)}catch{}}}},[P,e,te]),p.useEffect(()=>{const t=[],l=[];if(k&&k.length>0){const i=X.resolveCSSColor("hsl(var(--destructive))","rgb(239, 68, 68)");for(const s of k){if(!Number.isFinite(s.price))continue;const c=Ze(E.current,e,s.seriesLabel);if(!c)continue;const g=s.color?X.resolveCSSColor(s.color,s.color):i,m=s.lineWidth??1,_=s.lineStyle??Z.LineStyle.Dashed,w=c.createPriceLine({price:s.price,color:g,lineWidth:m,lineStyle:_,axisLabelVisible:s.axisLabelVisible??!0,title:s.title??""});t.push({series:c,line:w});const v=new xt(c,s.price,g,m,_);c.attachPrimitive(v),l.push({series:c,primitive:v})}}return()=>{for(const{series:i,primitive:s}of l)try{i.detachPrimitive(s)}catch{}for(const{series:i,line:s}of t)try{i.removePriceLine(s)}catch{}}},[k,e,te]),p.useEffect(()=>{const t=[];if(F&&F.length>0){const l="rgba(239, 68, 68, 0.12)";for(const i of F){const s=Ze(E.current,e,i.seriesLabel);if(!s)continue;const c=i.color?X.resolveCSSColor(i.color,l):l,g=new mt(s,i.priceTop,i.priceBottom,c);s.attachPrimitive(g),t.push({series:s,zone:g})}}return()=>{for(const{series:l,zone:i}of t)try{l.detachPrimitive(i)}catch{}}},[F,e,te]),p.useEffect(()=>{const t=j.current;if(!t||!P?.length){Ge([]);return}const l=()=>{const c=t.timeScale(),g=P.map(m=>c.timeToCoordinate(m.xCoordinate)??null);Ge(g),B.current&&Xe(B.current.clientWidth)};l();const i=t.timeScale(),s=()=>{l()};return i.subscribeVisibleLogicalRangeChange(s),()=>{i.unsubscribeVisibleLogicalRangeChange(s)}},[P,e,te]),p.useLayoutEffect(()=>{nt(t=>{const l={};let i=!1;for(const[s,c]of qe.current){if(!c)continue;const g=c.offsetWidth;l[s]=g,t[s]!==g&&(i=!0)}return Object.keys(t).length!==Object.keys(l).length&&(i=!0),i?l:t})});const de=e.length===1,We=Te.useMemo(()=>{if(de&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[de,e]);return C.jsxs("div",{ref:B,className:H.cn("relative z-[1] w-full h-full overflow-hidden p-0",n),children:[Ce!=null&&Ce!==!1&&de?C.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:C.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:Ce})}):et&&de&&We&&C.jsx(ut.GraphCurrentValue,{point:We,xMeasureUnit:h,yMeasureUnit:f,decimals:ae}),Be&&Fe&&C.jsx(ft.GraphTooltip,{points:Be,xMeasureUnit:h,yMeasureUnit:f,series:e,position:Fe,containerRef:B,decimals:ae}),a&&C.jsx(Ue,{series:e,onUnselect:u}),P&&P.length>0&&ze.length===P.length&&C.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:P.map((t,l)=>{const i=ze[l],s=t.options??{};if(i===null)return null;const{labelText:c,valueStr:g}=Qe(s,f,ae),m=s.tooltipText??"";if(!(c||g||m))return null;const w=s.labelBackgroundColor??s.color??"hsl(var(--background))",v=s.labelTextColor??"hsl(var(--foreground))",q=`${String(t.xCoordinate)}-${c}-${m}`,I=Ye(i,ot,rt[l]);return C.jsxs("div",{ref:oe=>{qe.current.set(l,oe)},className:H.cn("group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",m&&"pointer-events-auto cursor-default"),style:{...I,backgroundColor:w,color:v},children:[c&&C.jsx("span",{className:"block",children:c}),g&&C.jsx("span",{className:H.cn("block",c&&"mt-0.5"),children:g}),m&&C.jsx("span",{className:"pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",role:"tooltip",children:m})]},q)})}),C.jsx("div",{ref:ye,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ue({series:e,markers:n,onUnselect:a,inline:u=!1}){const h=e.every(f=>f.data.length===0);return C.jsxs("div",{className:H.cn("flex flex-wrap",u?"items-center justify-center gap-6":"absolute top-0 left-2 z-[10] gap-2"),children:[e.map((f,x)=>{const P=Ne(x),k=(f.lineColor??f.color)||P.line,F=!h&&f.data.length===0;return C.jsxs("div",{className:H.cn("flex items-center gap-1.5",!u&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",F&&"opacity-50"),children:[C.jsx("div",{className:H.cn(u?"size-2 rounded-full":"h-3 w-3 rounded-sm"),style:{backgroundColor:k}}),C.jsxs("span",{className:H.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:[f.label,F&&" (no data)"]}),a&&C.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),a(f.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${f.label}`,children:C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[C.jsx("title",{children:"Close"}),C.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},f.id??f.label)}),n?.map(f=>C.jsxs("div",{className:H.cn("flex items-center gap-1.5",!u&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border"),children:[C.jsx("div",{className:H.cn("w-0.5","h-3"),style:{backgroundColor:f.color}}),C.jsx("span",{className:H.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:f.label})]},f.id))]})}exports.DEFAULT_SERIES_COLORS=Se;exports.Graph=yt;exports.GraphLegend=Ue;exports.VERTICAL_LINE_LABEL_EDGE_PADDING=Le;exports.getSeriesColorPalette=Ne;exports.getStepForwardValue=Je;exports.getVerticalLineLabelStyle=Ye;exports.getVerticalLineTooltipContent=Qe;exports.seriesIdentity=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),H=require("lightweight-charts"),p=require("react"),ct=require("../../hooks/use-media-query.cjs"),Y=require("../../utils/cn.cjs"),X=require("../../utils/colors.cjs"),D=require("./default-config.cjs"),ne=require("./formatters.cjs"),ut=require("./graph-current-value.cjs"),ft=require("./graph-tooltip.cjs"),ht=require("./plugins/vertical-line.cjs"),He=require("./y-axis-scale.cjs");function gt(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const u=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,u.get?u:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const Te=gt(p);function re(e){return e.id??e.label}function Ze(e,n,a){if(!a)return e.values().next().value;const u=e.get(a);if(u)return u;const h=n.find(f=>f.id===a||f.label===a);return h?e.get(re(h)):void 0}class dt{_yTop;_yBottom;_color;constructor(n,a,u){this._yTop=n,this._yBottom=a,this._color=u}draw(n){n.useBitmapCoordinateSpace(a=>{const u=a.context,h=a.verticalPixelRatio,f=this._yTop===null?0:this._yTop*h,x=this._yBottom===null?a.bitmapSize.height:this._yBottom*h,P=Math.min(f,x),k=Math.max(f,x);u.fillStyle=this._color,u.fillRect(0,P,a.bitmapSize.width,k-P)})}}class pt{_source;_yTop=null;_yBottom=null;constructor(n){this._source=n}update(){const n=this._source.series;this._yTop=this._source.priceTop===void 0?null:n.priceToCoordinate(this._source.priceTop),this._yBottom=this._source.priceBottom===void 0?null:n.priceToCoordinate(this._source.priceBottom)}zOrder(){return"bottom"}renderer(){return new dt(this._yTop,this._yBottom,this._source.color)}}class mt{series;priceTop;priceBottom;color;_paneViews;constructor(n,a,u,h){this.series=n,this.priceTop=a,this.priceBottom=u,this.color=h,this._paneViews=[new pt(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function bt(e,n){switch(e){case H.LineStyle.Dotted:return[n,n];case H.LineStyle.Dashed:return[2*n,2*n];case H.LineStyle.LargeDashed:return[6*n,6*n];case H.LineStyle.SparseDotted:return[n,4*n];default:return[]}}class St{_y;_color;_lineWidth;_lineStyle;constructor(n,a,u,h){this._y=n,this._color=a,this._lineWidth=u,this._lineStyle=h}draw(n){n.useBitmapCoordinateSpace(a=>{if(this._y===null)return;const u=a.context,h=a.verticalPixelRatio,f=Math.max(1,Math.round(this._lineWidth*h)),x=Math.round(this._y*h);u.save(),u.strokeStyle=this._color,u.lineWidth=f,u.setLineDash(bt(this._lineStyle,f)),u.beginPath(),u.moveTo(0,x),u.lineTo(a.bitmapSize.width,x),u.stroke(),u.restore()})}}class Ct{_source;_y=null;constructor(n){this._source=n}update(){this._y=this._source.series.priceToCoordinate(this._source.price)}zOrder(){return"top"}renderer(){return new St(this._y,this._source.color,this._source.lineWidth,this._source.lineStyle)}}class xt{series;price;color;lineWidth;lineStyle;_paneViews;constructor(n,a,u,h,f){this.series=n,this.price=a,this.color=u,this.lineWidth=h,this.lineStyle=f,this._paneViews=[new Ct(this)]}updateAllViews(){for(const n of this._paneViews)n.update()}paneViews(){return this._paneViews}}function Qe(e,n,a){const u=e.labelText??"",h=e.value,f=h===void 0?"":typeof h=="number"?n==="$"?`$${ne.formatExactValue(h,void 0,a)}`:n==="%"?`${ne.formatExactValue(h,void 0,a)}%`:ne.formatExactValue(h,n!=="none"&&n!=="%"&&n!=="$"&&!ne.isRatioUnit(n)?n:void 0,a):String(h);return{labelText:u,valueStr:f}}const Le=4;function Ye(e,n,a){const u={left:e,transform:"translateX(-50%)"};if(n<=0||!a||a<=0)return u;const h=a/2,f=Le+h,x=n-Le-h;return x<f?{left:n/2,transform:"translateX(-50%)"}:{left:Math.min(Math.max(e,f),x),transform:"translateX(-50%)"}}function Je(e,n){for(let a=e.length-1;a>=0;a--)if(Number(e[a].time)<=n)return e[a].value;return 0}const Se=[{line:"#02c39a",top:"rgba(2, 195, 154, 0.56)",bottom:"rgba(2, 195, 154, 0.04)"},{line:"#3b82f6",top:"rgba(59, 130, 246, 0.56)",bottom:"rgba(59, 130, 246, 0.04)"},{line:"#ef4444",top:"rgba(239, 68, 68, 0.56)",bottom:"rgba(239, 68, 68, 0.04)"},{line:"#f59e0b",top:"rgba(245, 158, 11, 0.56)",bottom:"rgba(245, 158, 11, 0.04)"},{line:"#8b5cf6",top:"rgba(139, 92, 246, 0.56)",bottom:"rgba(139, 92, 246, 0.04)"},{line:"#ec4899",top:"rgba(236, 72, 153, 0.56)",bottom:"rgba(236, 72, 153, 0.04)"},{line:"#06b6d4",top:"rgba(6, 182, 212, 0.56)",bottom:"rgba(6, 182, 212, 0.04)"},{line:"#ea580c",top:"rgba(234, 88, 12, 0.56)",bottom:"rgba(234, 88, 12, 0.04)"},{line:"#84cc16",top:"rgba(132, 204, 22, 0.56)",bottom:"rgba(132, 204, 22, 0.04)"},{line:"#d946ef",top:"rgba(217, 70, 239, 0.56)",bottom:"rgba(217, 70, 239, 0.04)"},{line:"#0ea5e9",top:"rgba(14, 165, 233, 0.56)",bottom:"rgba(14, 165, 233, 0.04)"},{line:"#14b8a6",top:"rgba(20, 184, 166, 0.56)",bottom:"rgba(20, 184, 166, 0.04)"},{line:"#eab308",top:"rgba(234, 179, 8, 0.56)",bottom:"rgba(234, 179, 8, 0.04)"},{line:"#f43f5e",top:"rgba(244, 63, 94, 0.56)",bottom:"rgba(244, 63, 94, 0.04)"},{line:"#6366f1",top:"rgba(99, 102, 241, 0.56)",bottom:"rgba(99, 102, 241, 0.04)"},{line:"#10b981",top:"rgba(16, 185, 129, 0.56)",bottom:"rgba(16, 185, 129, 0.04)"},{line:"#78716c",top:"rgba(120, 113, 108, 0.56)",bottom:"rgba(120, 113, 108, 0.04)"},{line:"#64748b",top:"rgba(100, 116, 139, 0.56)",bottom:"rgba(100, 116, 139, 0.04)"},{line:"#475569",top:"rgba(71, 85, 105, 0.56)",bottom:"rgba(71, 85, 105, 0.04)"}],vt=137.5;function Ne(e){if(e<Se.length)return Se[e];const a=(e-Se.length)*vt%360,u=X.hslToHex(a,70,50),{topColor:h,bottomColor:f}=X.generateColorsFromBase(u);return{line:u,top:h,bottom:f}}function yt({series:e,className:n,showLegend:a=!1,onUnselectSeries:u,xMeasureUnit:h="time",yMeasureUnit:f="token",optionsOverrides:x,verticalLineOptions:P,priceLineOptions:k,zoneOptions:F,currentValueDecimals:ae,useSharedPriceScale:Z=!1,dualYAxis:A=!1,defaultVisiblePriceScaleId:Ve="right",leftPriceScaleTitle:Ee,rightPriceScaleTitle:_t,showCurrentValue:et=!0,graphTitle:Ce,yScaleMin:Ie,yScaleMinMultiple:De,visibleTimeFrom:ee,disableZoom:Me=!1,hideDefaultTooltip:xe=!1}){const j=p.useRef(null),E=p.useRef(new Map),ve=p.useRef(!1),ke=p.useRef(!0),Ae=p.useRef([]),le=p.useRef(0),B=p.useRef(null),ye=p.useRef(null),je=p.useRef(null),T=ct.useIsMobile(),ce=Te.useMemo(()=>e.flatMap(t=>t.data),[e]),tt=Te.useMemo(()=>{if(e.length>0){const t=e[e.length-1];if(t.data.length>0)return t.data[t.data.length-1]}},[e]),[Be,_e]=p.useState(()=>{if(!tt)return;const t=new Map;for(const l of e)l.data.length>0&&t.set(l.label,l.data[l.data.length-1]);return t}),[Fe,J]=p.useState(null),[ze,Ge]=p.useState([]),[ot,Xe]=p.useState(0),qe=p.useRef(new Map),[rt,nt]=p.useState({}),[te,it]=p.useState(0);p.useEffect(()=>{const t=()=>{try{if(B.current&&Xe(B.current.clientWidth),j.current&&B.current){const s=B.current.clientWidth,c=B.current.clientHeight;j.current.resize(s,c);try{le.current=j.current.paneSize().height}catch{}}}catch{}},l=B.current,i=l?new ResizeObserver(t):null;return je.current=i,l&&i?.observe(l),()=>{l&&i?.unobserve(l),i?.disconnect(),je.current=null}},[]),p.useEffect(()=>{if(!ye.current||ve.current)return;const t=D.getDefaultOptions(),l=X.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)"),i=H.createChart(ye.current,{...t,leftPriceScale:{...t.leftPriceScale||{},visible:!1,textColor:l},rightPriceScale:{...t.rightPriceScale||{},visible:!T,textColor:l},...T&&{crosshair:{...t.crosshair,mode:H.CrosshairMode.Magnet}}});j.current=i,ve.current=!0;try{le.current=i.paneSize().height}catch{le.current=0}return it(s=>s+1),()=>{i.remove(),j.current=null,ve.current=!1,E.current.clear()}},[T]),p.useEffect(()=>{const t=j.current;t&&t.applyOptions(Me?{handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:!1,axisDoubleClickReset:!1},handleScroll:{mouseWheel:!1,pressedMouseMove:!1,horzTouchDrag:!1,vertTouchDrag:!1}}:{handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:!0,axisDoubleClickReset:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}})},[te,Me]),p.useEffect(()=>{const t=j.current;!t||!x||t.applyOptions(x)},[te,x]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const i=e.filter(r=>r.data.length>0).length<=1?Ie:De,s=h==="time"?ne.getXFormatters(h,ce):ne.getXFormatters(h),c=new Map;{let r=0;for(const o of e)o.data.length!==0&&(c.set(o.label,o.priceScaleId??(r===0?"left":"right")),r++)}const g=(r,o,d)=>{const{formatter:z,tickmarksFormatter:N,updateVisibleRange:V}=ne.createAdaptiveYAxisFormatter(r,o,{yScaleMin:i});return{formatter:z,tickmarksFormatter:N,updateVisibleRange:V,labels:d}},m=[];if(A)for(const r of["left","right"]){const o=new Set,d=[];let z=f;for(const N of e)if(N.data.length!==0&&c.get(N.label)===r){o.size===0&&N.yMeasureUnit&&(z=N.yMeasureUnit),o.add(N.label);for(const V of N.data)d.push(V.value)}o.size>0&&m.push(g(d,z,o))}else{const r=ce.map(d=>d.value),o=new Set(e.filter(d=>d.data.length>0).map(d=>d.label));m.push(g(r,f,o))}Ae.current=m;const _=new Map;for(const r of m)for(const o of r.labels)_.set(o,r);const w=D.getDefaultOptions();t.applyOptions({localization:{...w.localization||{},timeFormatter:r=>s.timeFormatter(parseFloat(r),void 0)},timeScale:{...w.timeScale||{},...x?.timeScale,tickMarkFormatter:s.tickMarkFormatter,minBarSpacing:0}});const v=!A&&e.length>1&&!Z,q=A?T:e.length>1&&!Z||T,I=X.resolveCSSColor("hsl(var(--muted-foreground))","rgb(163, 163, 163)");t.applyOptions({...A&&{defaultVisiblePriceScaleId:Ve},leftPriceScale:{...w.leftPriceScale||{},...x?.leftPriceScale,visible:A&&!T,textColor:I,...A&&Ee&&{}},rightPriceScale:{...w.rightPriceScale||{},...x?.rightPriceScale,visible:A?!T:!q,textColor:I}});const oe=new Set(E.current.keys()),W=new Set(e.map(re));for(const r of oe)if(!W.has(r)){const o=E.current.get(r);o&&(t.removeSeries(o),E.current.delete(r))}const b=D.getDefaultSeries(),M=[];let L=0;const K=e.find(r=>r.data.length>0),y=new Map;if(k&&k.length>0)for(const r of k){if(!Number.isFinite(r.price))continue;const o=r.seriesLabel??K?.label;if(!o)continue;const d=y.get(o)??[];d.push(r.price),y.set(o,d)}if(F&&F.length>0)for(const r of F){const o=r.seriesLabel??K?.label;if(!o)continue;const d=y.get(o)??[];Number.isFinite(r.priceTop)&&d.push(r.priceTop),Number.isFinite(r.priceBottom)&&d.push(r.priceBottom),y.set(o,d)}for(let r=0;r<e.length;r++){const o=e[r],d=re(o),z=Ne(r),N=o.lineColor??o.color??z.line;let V,U;if(o.lineColor??o.color)if(o.topColor&&o.bottomColor)V=o.topColor,U=o.bottomColor;else if(o.topColor){const S=X.generateColorsFromBase(N);V=o.topColor,U=S.bottomColor}else if(o.bottomColor)V=X.generateColorsFromBase(N).topColor,U=o.bottomColor;else{const S=X.generateColorsFromBase(N);V=S.topColor,U=S.bottomColor}else V=o.topColor||z.top,U=o.bottomColor||z.bottom;if(o.data.length===0){const S=E.current.get(d);S&&(t.removeSeries(S),E.current.delete(d));continue}const pe=o.data.length>0?Math.min(...o.data.map(S=>S.value)):0,ue=o.data.length>0?Math.max(...o.data.map(S=>S.value)):0,fe=pe<0,Q=o.data.some(S=>S.value===0),me=!fe&&Q,he=He.pickMinMove(ue-pe),ge=A?o.priceScaleId??(L===0?"left":"right"):Z||!v||L===0?"right":`scale-${L}`;v&&M.push({priceScaleId:ge||"right",seriesIndex:L});const we=(Z||!v)&&i!==void 0&&typeof i=="number",st=y.get(o.label)??[],at=S=>{const R=S();if(R?.priceRange){we&&(R.priceRange.minValue=i);for(const O of st)O<R.priceRange.minValue&&(R.priceRange.minValue=O),O>R.priceRange.maxValue&&(R.priceRange.maxValue=O);const se=we?i:me&&R.priceRange.minValue>=0?0:void 0,be=le.current>0?le.current:B.current?.clientHeight??0;if(be>0){const O=He.niceAxisRange({min:R.priceRange.minValue,max:R.priceRange.maxValue,floor:se,scaleHeightPx:be,fontSizePx:D.AXIS_FONT_SIZE,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,minMove:he,edgePaddingPx:D.AXIS_EDGE_LABEL_PADDING_PX,edgePaddingTopPx:D.AXIS_TOP_LABEL_PADDING_PX});R.priceRange.minValue=O.min,R.priceRange.maxValue=O.max}R.margins={above:D.AXIS_TOP_LABEL_PADDING_PX,below:D.AXIS_EDGE_LABEL_PADDING_PX}}return R},Ke=_.get(o.label)??m[0],$e=Ke.formatter,lt=Ke.tickmarksFormatter,Re={lineColor:N,topColor:V,bottomColor:U,priceScaleId:ge,...o.seriesType==="line"&&{lineStyle:o.lineStyle??H.LineStyle.Solid},priceFormat:{type:"custom",minMove:he,formatter:we&&typeof i=="number"?S=>$e(S<i?i:S):$e,tickmarksFormatter:lt},autoscaleInfoProvider:at},Oe=o.seriesType==="line";let G=E.current.get(d);const ie=o.data.map(S=>({...S,time:S.time}));if(ee!==void 0&&ie.length>0&&Number(ie[0].time)>ee){const S=Number(ie[0].time),R=S-ee,se=86400,be=R>180*se?7*se:R>30*se?se:6*3600,O=[];for(let Pe=ee;Pe<S;Pe+=be)O.push({time:Pe});ie.unshift(...O)}G&&G.seriesType()!==(Oe?"Line":"Area")&&(t.removeSeries(G),E.current.delete(d),G=void 0),G?(G.applyOptions(Re),G.setData(ie)):(Oe?G=t.addSeries(H.LineSeries,{...b,...Re}):G=t.addSeries(H.AreaSeries,{...b,...Re}),G.setData(ie),E.current.set(d,G)),L++}if(A)try{const r=t.priceScale("left"),o=t.priceScale("right"),d={visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...x?.rightPriceScale};r?.applyOptions(d),o?.applyOptions(d)}catch{}else if(v&&M.length>0)for(const r of M)try{const o=t.priceScale(r.priceScaleId);o&&o.applyOptions({visible:!1,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I})}catch(o){console.warn(`Failed to configure price scale ${r.priceScaleId} for series ${r.seriesIndex}:`,o)}else if(!v)try{const r=t.priceScale("right");r&&r.applyOptions({visible:!T,autoScale:!0,scaleMargins:{top:0,bottom:0},alignLabels:!0,entireTextOnly:!1,tickMarkDensity:D.AXIS_TICK_MARK_DENSITY,textColor:I,...x?.rightPriceScale})}catch{}if(i!==void 0&&!T&&(Z||!v)&&t.applyOptions({handleScroll:{vertTouchDrag:!1}}),ce.length>0){const r=ce.map(o=>Number(o.time)).filter(o=>Number.isFinite(o));if(r.length>0){const o=Math.min(...r),d=ee!==void 0?Math.min(ee,o):o,z=Math.max(...r);if(Number(d)<=Number(z)){const N=()=>{const V=t.timeScale();if(h!=="time"){V.applyOptions({fixLeftEdge:!0,fixRightEdge:!0});return}const U=A&&!T,pe=A?!T:!q,ue=!U,fe=!pe;if(V.applyOptions({fixLeftEdge:!ue,fixRightEdge:!fe}),!ue&&!fe)return;const Q=V.getVisibleLogicalRange(),me=V.width();if(!Q||!(me>0))return;const he=Q.to-Q.from;if(!(he>0))return;const ge=D.AXIS_TIME_EDGE_PADDING_PX*he/me;V.setVisibleLogicalRange({from:ue?Q.from-ge:Q.from,to:fe?Q.to+ge:Q.to})};try{t.timeScale().setVisibleRange({from:d,to:z}),N()}catch{try{t.timeScale().fitContent(),N()}catch{}}}}}ke.current&&(ke.current=!1),x&&t.applyOptions(x);const $=new Map;for(const r of e)r.data.length>0&&$.set(r.label,r.data[r.data.length-1]);_e($.size>0?$:void 0)},[te,e,ce,h,f,T,Z,A,Ve,Ee,Ie,De,ee,k,F,x]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const l=e.length===1;let i;for(const c of e)if(c.data.length>0){i=c.data[c.data.length-1].time;break}if(!i)return;const s=c=>{const{time:g=i,seriesData:m,point:_}=c||{},w=e[0],v=w?E.current.get(re(w)):void 0;if(!_||!g){const W=new Map;for(const b of e)b.data.length>0&&W.set(b.label,b.data[b.data.length-1]);if(_e(W.size>0?W:void 0),l||Z||xe)J(null);else if(v&&i){const b=e[0];if(b&&b.data.length>0){const L=t.timeScale().timeToCoordinate(i),K=b.data[b.data.length-1].value,y=v.priceToCoordinate(K);L!==null&&y!==null&&J({x:L,y})}}return}const q=new Map;let I,oe=v;for(let W=0;W<e.length;W++){const b=e[W],M=E.current.get(re(b));if(!M)continue;const L=m?.get(M),K=L&&"value"in L?L.value:void 0;let y;if(K!==void 0)y=K;else if(l){const $=Number(g),r=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;$<r?y=Number.NaN:y=b.data[b.data.length-1]?.value??0}else{const $=b.data.length>0?Number(b.data[0].time):Number.POSITIVE_INFINITY;if(Number(g)<$)continue;y=Je(b.data,Number(g))}Number.isNaN(y)||(I===void 0&&(I=y,oe=M),q.set(b.label,{value:y,time:g}))}if(_e(q),I!==void 0&&oe){const b=t.timeScale().timeToCoordinate(g),M=oe.priceToCoordinate(I);if(b!==null&&M!==null){const L=B.current;if(L){const K=L.querySelector(".LightweightChart");if(K){const y=K.getBoundingClientRect(),$=L.getBoundingClientRect(),r=b+(y.left-$.left),o=M+(y.top-$.top);J({x:r,y:o})}else J({x:b,y:M})}else J({x:b,y:M})}else J(null)}else J(null)};return t.subscribeCrosshairMove(s),T&&t.subscribeClick(s),!l&&!Z&&!xe&&requestAnimationFrame(()=>{const c=e[0],g=c?E.current.get(re(c)):void 0;if(g&&i&&c.data.length>0){const _=t.timeScale().timeToCoordinate(i),w=c.data[c.data.length-1].value,v=g.priceToCoordinate(w);_!==null&&v!==null&&J({x:_,y:v})}}),()=>{t.unsubscribeCrosshairMove(s),T&&t.unsubscribeClick(s)}},[e,Z,T,xe]),p.useEffect(()=>{const t=j.current;if(!t||e.length===0)return;const l=t.timeScale(),i=()=>{const s=Ae.current;if(s.length===0)return;const c=l.getVisibleRange();if(!c)return;const g=Number(c.from),m=Number(c.to);for(const _ of s){const w=[];for(const v of e)if(_.labels.has(v.label))for(const q of v.data){const I=Number(q.time);I>=g&&I<=m&&w.push(q.value)}w.length>0&&_.updateVisibleRange(w)}};return l.subscribeVisibleLogicalRangeChange(i),()=>{l.unsubscribeVisibleLogicalRangeChange(i)}},[e]),p.useEffect(()=>{const t=j.current,l=Array.from(E.current.values()),i=[];if(t&&l.length>0&&P){const s=D.getDefaultVerticalLine(),c=l[0];for(const g of P){const m={...s,...g.options||{}};m.color&&(m.color=X.resolveCSSColor(m.color,m.color));const _=new ht.VertLine(t,c,g.xCoordinate,m);c.attachPrimitive(_),i.push(_)}}return()=>{if(l.length>0){const s=l[0];for(const c of i)try{s.detachPrimitive(c)}catch{}}}},[P,e,te]),p.useEffect(()=>{const t=[],l=[];if(k&&k.length>0){const i=X.resolveCSSColor("hsl(var(--destructive))","rgb(239, 68, 68)");for(const s of k){if(!Number.isFinite(s.price))continue;const c=Ze(E.current,e,s.seriesLabel);if(!c)continue;const g=s.color?X.resolveCSSColor(s.color,s.color):i,m=s.lineWidth??1,_=s.lineStyle??H.LineStyle.Dashed,w=c.createPriceLine({price:s.price,color:g,lineWidth:m,lineStyle:_,axisLabelVisible:s.axisLabelVisible??!0,title:s.title??""});t.push({series:c,line:w});const v=new xt(c,s.price,g,m,_);c.attachPrimitive(v),l.push({series:c,primitive:v})}}return()=>{for(const{series:i,primitive:s}of l)try{i.detachPrimitive(s)}catch{}for(const{series:i,line:s}of t)try{i.removePriceLine(s)}catch{}}},[k,e,te]),p.useEffect(()=>{const t=[];if(F&&F.length>0){const l="rgba(239, 68, 68, 0.12)";for(const i of F){const s=Ze(E.current,e,i.seriesLabel);if(!s)continue;const c=i.color?X.resolveCSSColor(i.color,l):l,g=new mt(s,i.priceTop,i.priceBottom,c);s.attachPrimitive(g),t.push({series:s,zone:g})}}return()=>{for(const{series:l,zone:i}of t)try{l.detachPrimitive(i)}catch{}}},[F,e,te]),p.useEffect(()=>{const t=j.current;if(!t||!P?.length){Ge([]);return}const l=()=>{const c=t.timeScale(),g=P.map(m=>c.timeToCoordinate(m.xCoordinate)??null);Ge(g),B.current&&Xe(B.current.clientWidth)};l();const i=t.timeScale(),s=()=>{l()};return i.subscribeVisibleLogicalRangeChange(s),()=>{i.unsubscribeVisibleLogicalRangeChange(s)}},[P,e,te]),p.useLayoutEffect(()=>{nt(t=>{const l={};let i=!1;for(const[s,c]of qe.current){if(!c)continue;const g=c.offsetWidth;l[s]=g,t[s]!==g&&(i=!0)}return Object.keys(t).length!==Object.keys(l).length&&(i=!0),i?l:t})});const de=e.length===1,We=Te.useMemo(()=>{if(de&&e.length>0){const t=e[0];if(t.data.length>0)return t.data[t.data.length-1]}},[de,e]);return C.jsxs("div",{ref:B,className:Y.cn("relative z-[1] w-full h-full overflow-hidden p-0",n),children:[Ce!=null&&Ce!==!1&&de?C.jsx("div",{className:"absolute top-2 left-2 right-2 z-[100] pointer-events-none",children:C.jsx("div",{className:"text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis",children:Ce})}):et&&de&&We&&C.jsx(ut.GraphCurrentValue,{point:We,xMeasureUnit:h,yMeasureUnit:f,decimals:ae}),Be&&Fe&&C.jsx(ft.GraphTooltip,{points:Be,xMeasureUnit:h,yMeasureUnit:f,series:e,position:Fe,containerRef:B,decimals:ae}),a&&C.jsx(Ue,{series:e,onUnselect:u}),P&&P.length>0&&ze.length===P.length&&C.jsx("div",{className:"absolute inset-0 z-[5] pointer-events-none","aria-hidden":!0,children:P.map((t,l)=>{const i=ze[l],s=t.options??{};if(i===null)return null;const{labelText:c,valueStr:g}=Qe(s,f,ae),m=s.tooltipText??"";if(!(c||g||m))return null;const w=s.labelBackgroundColor??s.color??"hsl(var(--background))",v=s.labelTextColor??"hsl(var(--foreground))",q=`${String(t.xCoordinate)}-${c}-${m}`,I=Ye(i,ot,rt[l]);return C.jsxs("div",{ref:oe=>{qe.current.set(l,oe)},className:Y.cn("group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",m&&"pointer-events-auto cursor-default"),style:{...I,backgroundColor:w,color:v},children:[c&&C.jsx("span",{className:"block",children:c}),g&&C.jsx("span",{className:Y.cn("block",c&&"mt-0.5"),children:g}),m&&C.jsx("span",{className:"pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",role:"tooltip",children:m})]},q)})}),C.jsx("div",{ref:ye,className:"LightweightChart w-full h-full overflow-hidden"})]})}function Ue({series:e,markers:n,onUnselect:a,inline:u=!1}){const h=e.every(f=>f.data.length===0);return C.jsxs("div",{className:Y.cn("flex flex-wrap",u?"items-center justify-center gap-6":"absolute top-0 left-2 z-[10] gap-2"),children:[e.map((f,x)=>{const P=Ne(x),k=(f.lineColor??f.color)||P.line,F=!h&&f.data.length===0;return C.jsxs("div",{className:Y.cn("flex shrink-0 items-center gap-1.5",!u&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",F&&"opacity-50"),children:[C.jsx("div",{className:Y.cn("shrink-0",u?"size-2 rounded-full":"h-3 w-3 rounded-sm"),style:{backgroundColor:k}}),C.jsxs("span",{className:Y.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:[f.label,F&&" (no data)"]}),a&&C.jsx("button",{type:"button",onClick:ae=>{ae.stopPropagation(),a(f.label)},className:"ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer","aria-label":`Remove ${f.label}`,children:C.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground hover:text-foreground","aria-hidden":"true",children:[C.jsx("title",{children:"Close"}),C.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},f.id??f.label)}),n?.map(f=>C.jsxs("div",{className:Y.cn("flex shrink-0 items-center gap-1.5",!u&&"px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border"),children:[C.jsx("div",{className:"h-3 w-0.5 shrink-0",style:{backgroundColor:f.color}}),C.jsx("span",{className:Y.cn("font-medium text-foreground",u?"text-sm":"text-[10px] sm:text-xs"),children:f.label})]},f.id))]})}exports.DEFAULT_SERIES_COLORS=Se;exports.Graph=yt;exports.GraphLegend=Ue;exports.VERTICAL_LINE_LABEL_EDGE_PADDING=Le;exports.getSeriesColorPalette=Ne;exports.getStepForwardValue=Je;exports.getVerticalLineLabelStyle=Ye;exports.getVerticalLineTooltipContent=Qe;exports.seriesIdentity=re;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.networkIndicator.title":"Network","components.infiniteScrollWrapper.showMore":"Show more","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.sdkStatus.connecting":"Connecting…","components.sdkStatus.connected":"Connected","components.sdkStatus.disconnected":"Not connected","components.creditAccountHistory.table.protocol":"Protocol","components.creditAccountHistory.table.operation":"Operation","components.creditAccountHistory.table.details":"Details","components.notificationCenter.empty":"No notifications yet","components.notificationCenter.requests":"Requests","components.notificationCenter.recent":"Recent","components.notificationCenter.clear":"Clear all","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.amountLabel":"Amount","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.smartNumberInput.selectToken":"Select token","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","components.value.accruing":"Averaged data is still being computed and will be available shortly.","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current Price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current Price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model Price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY Type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.yieldBreakdown.titleNetAtLeverage":"Net APY at {leverage}× Leverage","components.yieldBreakdown.titleNetAtLeverage7d":"Net APY at {leverage}× Leverage (7d)","components.yieldBreakdown.titleNet":"Net APY","components.yieldBreakdown.titleNet7d":"Net APY (7d)","components.yieldBreakdown.collateralApy":"Collateral APY","components.yieldBreakdown.collateralApy7d":"Collateral APY (7d)","components.yieldBreakdown.baseApy":"Base APY","components.yieldBreakdown.baseApy7d":"Base APY (7d)","components.yieldBreakdown.incentive":"Incentive","components.yieldBreakdown.incentiveApy":"Incentive APY","components.yieldBreakdown.incentiveApy7d":"Incentive APY (7d)","components.yieldBreakdown.borrowRate":"Borrow Rate","components.yieldBreakdown.borrowRate7d":"Borrow Rate (7d)","components.yieldBreakdown.programPoints":"{name} Points","components.yieldBreakdown.points":"Points","components.openCopyButtons.copy":"Copy to clipboard","components.openCopyButtons.explorer":"View in explorer","components.poolAssetsTable.asset":"Name","components.poolAssetsTable.rate":"Effective Rate","components.poolAssetsTable.exposure":"Exposure","components.poolAssetsTable.cap":"Cap","components.poolAssetsTable.capUtilization":"Cap Utilization","components.poolAssetsTable.usage":"{amount} of {total}","components.poolAssetsTable.head.name":"Credit Manager","components.poolAssetsTable.head.currentDebt":"Current Debt","components.poolAssetsTable.head.assets":"Asset LT","components.poolCreditManagersTable.assets":"{amount} assets","components.creditManagerInfo.title":"Assets and LT’s","components.creditManagerInfo.info.title":"Credit Managers","components.creditManagerInfo.info.copy.tip":"Copy Credit Manager address","components.creditManagerInfo.info.minDebt":"Min Debt","components.creditManagerInfo.info.maxDebt":"Max Debt","components.creditManagerInfo.info.liquidationFee":"Liquid. Fee","components.creditManagerInfo.info.liquidationPremium":"Liquid. Premium","components.creditManagerInfo.info.interestFee":"Interest Fee","components.creditManagerInfo.info.debtLimit":"Debt Limit","components.creditManagerInfo.info.maxEnabledTokens":"Max Tokens","dialogs.oraclesAndLTInfo.filter.hide0Quota":"Hide 0-Quota","components.oraclesAndLTInfo.title":"Oracles and LTs","components.oraclesAndLTTable.head.token":"Token","components.oraclesAndLTTable.head.oracles":"Oracles","components.oraclesAndLTTable.head.lt":"LT","components.poolTable.pool":"Market","components.poolTable.market":"Market","components.poolTable.description.universal":"Universal","components.poolTable.supply":"Supply","components.poolTable.borrowed":"Borrowed","components.poolTable.supplyApy":"Supply APY","components.poolTable.supplyApy.tip":"Annual percentage yield that you earn for supplying capital. This number constantly changes as the utilization of the Markets goes up and down","components.poolTable.depositApy":"Deposit APY","components.poolTable.depositApy.tip":"Deposit APY breakdown: base rate, extra rewards, and points","components.poolTable.borrowApy":"Borrow Rate","components.poolTable.utilizationApy":"Utilization APY","components.poolTable.borrowApy.tip":"On top of the utilization borrow rate, there is a borrow quota rate for different assets","components.poolTable.utilization":"Utilization","components.poolTable.collateral":"Collateral","components.poolTable.collateral.showAll":"Show All","components.poolTable.balance":"Your Balance","components.poolTable.balance.tip":`You don't earn token rewards, only organic yield. Please migrate liquidity by using "Migrate" flow above.`,"components.poolTable.emptyList":"No Pools found","components.poolTable.notFound.dashboard":"You currently have no open Market positions.","components.poolTable.notFound.list":"No Markets found","components.poolTable.notFound.description.dashboard":"Choose earn above.","components.poolTable.notFound.description.list":"Choose another chain or toggle Show All Markets","components.poolTable.externalApy.tooltipShort":"{value} APY boost when depositing via {name}","components.poolTable.line.rwa.tip":"This is RWA market.","components.rewardsTooltip.without.title":"Without Leverage","components.rewardsTooltip.without.extra":"Extra APY","components.rewardsTooltip.without.extra.tip":"Any deposit through Gearbox","components.rewardsTooltip.with.title":"With {leverage} Leverage","components.rewardsTooltip.with.borrowRate":"{symbol} borrow rate","components.rewardsTooltip.with.quotaRate":"Quota Rate","components.rewardsTooltip.with.extra":"+ Extra APR","components.rewardsTooltip.button":"Click to show rewards details","components.strategiesTable.head.name":"Strategy","components.strategiesTable.head.rewards":"Rewards","components.strategiesTable.head.leverage":"Max Leverage","components.strategiesTable.head.earn":"You Can Earn","components.strategiesTable.body.notFound":"No strategy found","components.strategiesTable.line.disabled":"This strategy is currently not available, cause of lack or quota or liquidity. Please contact us on Discord, and we’ll assist you.","components.strategiesTable.line.name.disabled":"This strategy is currently not available","components.strategiesTable.line.points.tip":"For debt nominated in {symbol}","components.strategiesTable.line.points.tipAny":"For debt","components.strategiesTable.line.0slippage":"0-slippage","components.strategiesTable.line.0slippage.tip":"Wrapping/unwrapping happens directly through smart-contracts, so {symbol} deposits and withdrawals don't incur slippage.","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This strategy is available on RWA market.","dialogs.common.review":"Review","components.amountInput.max":"Max","components.amountInput.label":"Amount","components.amountInput.balance":"Balance","components.amountInput.selectToken":"Select token","components.amountInput.inputTitle":"Token Amount","components.leverageInput.label":"Leverage","components.leverageInput.reset":"Reset","components.leverageInput.available":"Available Leverage","components.healthFactorBlock.label":"Health Factor","components.healthFactorBlock.tip":"Health Factor is a numeric representation of your account 'health'. If your health factor drops below 1 or close to it, you might be liquidated.","components.liquidationPriceBlock.label":"Liquidation Price","components.liquidationPriceBlock.tip":"The asset price at which the account's health factor would reach 1 and become eligible for liquidation.","components.timeToLiquidationBlock.label":"Time to Liquidation","components.timeToLiquidationBlock.tip":"Time to liquidation estimates how long the account can stay open if prices remain constant and no yield is earned—only accounting for borrow interest accrual.","components.historyChart.error":"Couldn't load chart data","components.historyChart.empty":"No data","components.positionTypeBadge.pool":"LP","components.positionTypeBadge.strategy":"Strategy","components.positionTypeBadge.liquidation":"Liquidation","components.positionStatusBadge.active":"Active","components.positionStatusBadge.repaid":"Repaid","components.titleMeta.unknownCurator":"Curator","components.moreAccordion.more":"More details","components.moreAccordion.less":"Less details","components.poolApyBreakdownCard.title":"Net APY","components.poolApyBreakdownCard.title7d":"Net APY (7d)","components.poolApyBreakdownCard.organicApy":"Base APY","components.poolApyBreakdownCard.organicApy7d":"Base APY (7d)","components.poolApyBreakdownCard.incentiveApy":"Incentive APY","components.poolApyBreakdownCard.incentiveApy7d":"Incentive APY (7d)","components.strategyApyBreakdownCard.formula":"{leverage} × {base}","components.strategyApyBreakdownCard.borrowFormula":"{leverage} × {totalRate} − {borrowRate}","components.leveragePresetChips.label":"Leverage:","components.liquidationParamsTable.lt":"Liquidation Threshold","components.liquidationParamsTable.penalty":"Liquidation Discount","components.liquidationParamsTable.premium":"Liquidation Premium","components.liquidationParamsTable.fee":"Liquidation Fee","components.borrowRateBlock.label":"Borrow Rate","components.borrowRateBlock.tip":"Borrow rate is displayed for your entire position size in total. You can reduce it in quota management.","components.borrowRateBlock.description":"Your borrow rate consists of the Base Rate plus the Quota Rates for every asset separately.","components.borrowRateBlock.baseRate":"Base Rate for Debt","components.borrowRateBlock.normalization":"Rates Normalization","components.borrowRateBlock.normalization.tip":"Borrowers pay {quota} and {utilization}, which have a different base. Therefore, the total borrow rate value is normalized by Account value or Debt amount.","components.transactionConfirm.previewLoading":"Parsing transaction…","components.transactionConfirm.previewErrorTitle":"Preview error"};module.exports=e;
|
|
1
|
+
"use strict";const e={"errors.networkError":"Network error. Can't fetch data","errors.incorrectAddressError":"Incorrect address. Please, check url","errors.noOpenedAccountsError":"You have no opened Credit Accounts. Perhaps, you have recently been liquidated? Check notification centre to see more.","errors.notFound":"Not found","errors.tooManyRequests":"Too many requests","errors.incorrectAddress":"Incorrect address","components.errorMessage.oops":"Oops...","components.networkIndicator.title":"Network","components.infiniteScrollWrapper.showMore":"Show more","components.alertModal.ok":"Ok","components.footer.privacy":"Privacy Notice","components.footer.terms":"Terms of Service","components.footer.disclosure":"Risk Disclosure Statement","components.footer.legalNotice":"Legal Notice","components.footer.legal":"Legal Info","components.footer.gearbox":"Copyright © Gearbox Foundation 2023-2026.","components.footer.built":"Built at ETHGlobal MarketMake hackathon.","components.footer.version":"Version {value}","components.sdkStatus.connecting":"Connecting…","components.sdkStatus.connected":"Connected","components.sdkStatus.disconnected":"Not connected","components.creditAccountHistory.table.protocol":"Protocol","components.creditAccountHistory.table.operation":"Operation","components.creditAccountHistory.table.details":"Details","components.notificationCenter.empty":"No notifications yet","components.notificationCenter.requests":"Requests","components.notificationCenter.recent":"Recent","components.notificationCenter.clear":"Clear all","components.liquidationPrice.check":"Check Area","components.loading.loading":"Loading","components.loading.loadingPercent":"Loading {percent}%","components.loading.wait":"Please wait...","components.smartNumberInput.balance":"Balance","components.smartNumberInput.amountLabel":"Amount","components.smartNumberInput.inputTitle":"Token Amount","components.smartNumberInput.confirm.input":"Input","components.smartNumberInput.selectToken":"Select token","components.tipWindow.title":"Tip","components.healthFactor.low":"Extremely low! This HF may not cover possible oracle deviations.","components.headCell":"Sort by {value}","components.graphView.noData":"Can't get data for this graph","components.filterBlock.reset":"Reset All","components.filterModal.searchPlaceholder":"Search options...","components.filterModal.noOptionsAvailable":"No options available","components.filterModal.noOptionsMatchSearch":"No options match your search","components.filterModal.reset":"Reset","components.filterModal.apply":"Apply","components.value.accruing":"Averaged data is still being computed and will be available shortly.","components.APY.tip":"These APYs are derived from the underlying protocols’ APIs and may differ in reality. Check respective protocols for their methodology.","components.creditSessionDetailedLiquidation.graph.noData":"No data","components.creditSessionDetailedLiquidation.graph.legend.point":"Current Price","components.creditSessionDetailedLiquidation.graph.legend.area":"Liquidation Area","components.creditSessionDetailedLiquidation.graph.tip.hf":"Health Factor","components.creditSessionDetailedLiquidation.graph.tip.price":"Price","components.creditSessionDetailedLiquidation.table.noData":"No data","components.creditSessionDetailedLiquidation.table.seeGraph":"See graph","components.creditSessionDetailedLiquidation.table.asset":"Asset","components.creditSessionDetailedLiquidation.table.currentPrice":"Current Price","components.creditSessionDetailedLiquidation.table.modelPrice":"Model Price","components.apyParts.features.points":"Points","components.apyParts.features.incent":"Incent.","components.apyParts.supplyAPY":"Organic APY","components.apyParts.title":"APY Type","components.apyParts.supplyAPY.tip":"Yield from lending funds","components.apyParts.tokenYield":"Intrinsic APY","components.apyParts.tokenYield.tip":"Yield from holding wstETH","components.apyParts.extraAPY":"{symbol} Incentive","components.apyParts.extraAPY.tip":"Calculated at the current rate","components.apyParts.totalAPY":"Overall APY","components.apyParts.points":"{symbol} Incentive","components.apyParts.points.condition.crossDeposit":"For cross-chain deposits made via Omni","components.yieldBreakdown.titleNetAtLeverage":"Net APY at {leverage}× Leverage","components.yieldBreakdown.titleNetAtLeverage7d":"Net APY at {leverage}× Leverage (7d)","components.yieldBreakdown.titleNet":"Net APY","components.yieldBreakdown.titleNet7d":"Net APY (7d)","components.yieldBreakdown.collateralApy":"Collateral APY","components.yieldBreakdown.collateralApy7d":"Collateral APY (7d)","components.yieldBreakdown.baseApy":"Base APY","components.yieldBreakdown.baseApy7d":"Base APY (7d)","components.yieldBreakdown.incentive":"Incentive","components.yieldBreakdown.incentiveApy":"Incentive APY","components.yieldBreakdown.incentiveApy7d":"Incentive APY (7d)","components.yieldBreakdown.borrowRate":"Borrow Rate","components.yieldBreakdown.borrowRate7d":"Borrow Rate (7d)","components.yieldBreakdown.programPoints":"{name} Points","components.yieldBreakdown.points":"Points","components.openCopyButtons.copy":"Copy to clipboard","components.openCopyButtons.explorer":"View in explorer","components.poolAssetsTable.asset":"Name","components.poolAssetsTable.rate":"Effective Rate","components.poolAssetsTable.exposure":"Exposure","components.poolAssetsTable.cap":"Cap","components.poolAssetsTable.capUtilization":"Cap Utilization","components.poolAssetsTable.usage":"{amount} of {total}","components.poolAssetsTable.head.name":"Credit Manager","components.poolAssetsTable.head.currentDebt":"Current Debt","components.poolAssetsTable.head.assets":"Asset LT","components.poolCreditManagersTable.assets":"{amount} assets","components.creditManagerInfo.title":"Assets and LT’s","components.creditManagerInfo.info.title":"Credit Managers","components.creditManagerInfo.info.copy.tip":"Copy Credit Manager address","components.creditManagerInfo.info.minDebt":"Min Debt","components.creditManagerInfo.info.maxDebt":"Max Debt","components.creditManagerInfo.info.liquidationFee":"Liquid. Fee","components.creditManagerInfo.info.liquidationPremium":"Liquid. Premium","components.creditManagerInfo.info.interestFee":"Interest Fee","components.creditManagerInfo.info.debtLimit":"Debt Limit","components.creditManagerInfo.info.maxEnabledTokens":"Max Tokens","dialogs.oraclesAndLTInfo.filter.hide0Quota":"Hide 0-Quota","components.oraclesAndLTInfo.title":"Oracles and LTs","components.oraclesAndLTTable.head.token":"Token","components.oraclesAndLTTable.head.oracles":"Oracles","components.oraclesAndLTTable.head.lt":"LT","components.poolTable.pool":"Market","components.poolTable.market":"Market","components.poolTable.description.universal":"Universal","components.poolTable.supply":"Supply","components.poolTable.borrowed":"Borrowed","components.poolTable.supplyApy":"Supply APY","components.poolTable.supplyApy.tip":"Annual percentage yield that you earn for supplying capital. This number constantly changes as the utilization of the Markets goes up and down","components.poolTable.depositApy":"Deposit APY","components.poolTable.depositApy.tip":"Deposit APY breakdown: base rate, extra rewards, and points","components.poolTable.borrowApy":"Borrow Rate","components.poolTable.utilizationApy":"Utilization APY","components.poolTable.borrowApy.tip":"On top of the utilization borrow rate, there is a borrow quota rate for different assets","components.poolTable.utilization":"Utilization","components.poolTable.collateral":"Collateral","components.poolTable.collateral.showAll":"Show All","components.poolTable.balance":"Your Balance","components.poolTable.balance.tip":`You don't earn token rewards, only organic yield. Please migrate liquidity by using "Migrate" flow above.`,"components.poolTable.emptyList":"No Pools found","components.poolTable.notFound.dashboard":"You currently have no open Market positions.","components.poolTable.notFound.list":"No Markets found","components.poolTable.notFound.description.dashboard":"Choose earn above.","components.poolTable.notFound.description.list":"Choose another chain or toggle Show All Markets","components.poolTable.externalApy.tooltipShort":"{value} APY boost when depositing via {name}","components.poolTable.line.rwa.tip":"This is RWA market.","components.rewardsTooltip.without.title":"Without Leverage","components.rewardsTooltip.without.extra":"Extra APY","components.rewardsTooltip.without.extra.tip":"Any deposit through Gearbox","components.rewardsTooltip.with.title":"With {leverage} Leverage","components.rewardsTooltip.with.borrowRate":"{symbol} borrow rate","components.rewardsTooltip.with.quotaRate":"Quota Rate","components.rewardsTooltip.with.extra":"+ Extra APR","components.rewardsTooltip.button":"Click to show rewards details","components.strategiesTable.head.name":"Strategy","components.strategiesTable.head.rewards":"Rewards","components.strategiesTable.head.leverage":"Max Leverage","components.strategiesTable.head.earn":"You Can Earn","components.strategiesTable.body.notFound":"No strategy found","components.strategiesTable.line.disabled":"This strategy is currently not available, cause of lack or quota or liquidity. Please contact us on Discord, and we’ll assist you.","components.strategiesTable.line.name.disabled":"This strategy is currently not available","components.strategiesTable.line.points.tip":"For debt nominated in {symbol}","components.strategiesTable.line.points.tipAny":"For debt","components.strategiesTable.line.0slippage":"0-slippage","components.strategiesTable.line.0slippage.tip":"Wrapping/unwrapping happens directly through smart-contracts, so {symbol} deposits and withdrawals don't incur slippage.","components.strategiesTable.line.rwa":"RWA","components.strategiesTable.line.rwa.tip":"This strategy is available on RWA market.","dialogs.common.review":"Review","components.amountInput.max":"Max","components.amountInput.label":"Amount","components.amountInput.balance":"Balance","components.amountInput.selectToken":"Select token","components.amountInput.inputTitle":"Token Amount","components.leverageInput.label":"Leverage","components.leverageInput.reset":"Reset","components.leverageInput.available":"Available Leverage","components.healthFactorBlock.label":"Health Factor","components.healthFactorBlock.tip":"Health Factor is a numeric representation of your account 'health'. If your health factor drops below 1 or close to it, you might be liquidated.","components.liquidationPriceBlock.label":"Liquidation Price","components.liquidationPriceBlock.tip":"The asset price at which the account's health factor would reach 1 and become eligible for liquidation.","components.timeToLiquidationBlock.label":"Time to Liquidation","components.timeToLiquidationBlock.tip":"Time to liquidation estimates how long the account can stay open if prices remain constant and no yield is earned—only accounting for borrow interest accrual.","components.historyChart.error":"Couldn't load chart data","components.historyChart.empty":"No data","components.positionTypeBadge.pool":"LP","components.positionTypeBadge.strategy":"Strategy","components.positionTypeBadge.liquidation":"Liquidation","components.positionStatusBadge.active":"Active","components.positionStatusBadge.repaid":"Repaid","components.titleMeta.unknownCurator":"Curator","components.moreAccordion.more":"More details","components.moreAccordion.less":"Less details","components.poolApyBreakdownCard.title":"Net APY","components.poolApyBreakdownCard.title7d":"Net APY (7d)","components.poolApyBreakdownCard.organicApy":"Base APY","components.poolApyBreakdownCard.organicApy7d":"Base APY (7d)","components.poolApyBreakdownCard.incentiveApy":"Incentive APY","components.poolApyBreakdownCard.incentiveApy7d":"Incentive APY (7d)","components.poolApyBreakdownCard.tokenIncentiveApy":"{symbol} Incentive APY","components.poolApyBreakdownCard.tokenIncentiveApy7d":"{symbol} Incentive APY (7d)","components.strategyApyBreakdownCard.formula":"{leverage} × {base}","components.strategyApyBreakdownCard.borrowFormula":"{leverage} × {totalRate} − {borrowRate}","components.leveragePresetChips.label":"Leverage:","components.liquidationParamsTable.lt":"Liquidation Threshold","components.liquidationParamsTable.penalty":"Liquidation Discount","components.liquidationParamsTable.premium":"Liquidation Premium","components.liquidationParamsTable.fee":"Liquidation Fee","components.borrowRateBlock.label":"Borrow Rate","components.borrowRateBlock.tip":"Borrow rate is displayed for your entire position size in total. You can reduce it in quota management.","components.borrowRateBlock.description":"Your borrow rate consists of the Base Rate plus the Quota Rates for every asset separately.","components.borrowRateBlock.baseRate":"Base Rate for Debt","components.borrowRateBlock.normalization":"Rates Normalization","components.borrowRateBlock.normalization.tip":"Borrowers pay {quota} and {utilization}, which have a different base. Therefore, the total borrow rate value is normalized by Account value or Debt amount.","components.transactionConfirm.previewLoading":"Parsing transaction…","components.transactionConfirm.previewErrorTitle":"Preview error"};module.exports=e;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as e, jsx as
|
|
1
|
+
import { jsxs as e, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { ChartWithSideCardTest as i } from "./constants.js";
|
|
3
3
|
function m({
|
|
4
|
-
chart:
|
|
4
|
+
chart: r,
|
|
5
5
|
side: t
|
|
6
6
|
}) {
|
|
7
7
|
return /* @__PURE__ */ e(
|
|
@@ -10,18 +10,18 @@ function m({
|
|
|
10
10
|
className: "flex w-full flex-wrap gap-4",
|
|
11
11
|
"data-testid": i.root,
|
|
12
12
|
children: [
|
|
13
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ a(
|
|
14
14
|
"div",
|
|
15
15
|
{
|
|
16
16
|
className: "min-w-[min(100%,40rem)] grow-[999] basis-0",
|
|
17
17
|
"data-testid": i.chart,
|
|
18
|
-
children:
|
|
18
|
+
children: r
|
|
19
19
|
}
|
|
20
20
|
),
|
|
21
|
-
/* @__PURE__ */
|
|
21
|
+
/* @__PURE__ */ a(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
24
|
-
className: "min-w-[min(100%,300px)] grow
|
|
24
|
+
className: "min-w-[min(100%,300px)] grow basis-[22.5rem]",
|
|
25
25
|
"data-testid": i.side,
|
|
26
26
|
children: t
|
|
27
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e, Fragment as
|
|
2
|
-
import { ApyBreakdownBody as
|
|
3
|
-
import { NoValue as
|
|
4
|
-
import { totalApyOf as
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { ApyBreakdownBody as A, formatBreakdownRate as l, ApyBreakdownRow as p, periodMessageId as i, ApyBreakdownDivider as v, BREAKDOWN_DASH as w } from "../apy-breakdown-body/apy-breakdown-body.js";
|
|
3
|
+
import { NoValue as d } from "../values/no-value.js";
|
|
4
|
+
import { totalApyOf as g, tokenRewardsOf as B, pointProgramsOf as I } from "../../../utils/apy-breakdown.js";
|
|
5
5
|
import "@gearbox-protocol/sdk/onchain";
|
|
6
6
|
import "clsx";
|
|
7
7
|
import "tailwind-merge";
|
|
@@ -9,105 +9,106 @@ import "luxon";
|
|
|
9
9
|
import "../../../utils/z-index.js";
|
|
10
10
|
import "viem";
|
|
11
11
|
import "react";
|
|
12
|
-
import { PoolApyBreakdownCardTest as
|
|
13
|
-
import { PointsIcon as
|
|
14
|
-
import { TokenIcon as
|
|
12
|
+
import { PoolApyBreakdownCardTest as t } from "./constants.js";
|
|
13
|
+
import { PointsIcon as f } from "../../points-icon/points-icon.js";
|
|
14
|
+
import { TokenIcon as h } from "../../token-icon/token-icon.js";
|
|
15
15
|
import "../../tooltip/simple-tooltip.js";
|
|
16
16
|
import "../../tooltip/tooltip.js";
|
|
17
17
|
import { FormattedMessageTyped as s } from "../../typed-intl/index.js";
|
|
18
18
|
import "../../badge/badge.js";
|
|
19
19
|
import "../../badge/chip.js";
|
|
20
|
-
function
|
|
20
|
+
function W({
|
|
21
21
|
data: n,
|
|
22
22
|
period: r
|
|
23
23
|
}) {
|
|
24
|
-
const
|
|
24
|
+
const m = n ? g(n) : void 0, c = n?.organicApy, y = n ? B(n) : [], k = n ? I(n) : [];
|
|
25
25
|
return /* @__PURE__ */ a(
|
|
26
|
-
|
|
26
|
+
A,
|
|
27
27
|
{
|
|
28
|
-
testId:
|
|
28
|
+
testId: t.root,
|
|
29
29
|
title: /* @__PURE__ */ e(
|
|
30
30
|
s,
|
|
31
31
|
{
|
|
32
|
-
messageId:
|
|
32
|
+
messageId: i(
|
|
33
33
|
r,
|
|
34
34
|
"components.poolApyBreakdownCard.title",
|
|
35
35
|
"components.poolApyBreakdownCard.title7d"
|
|
36
36
|
)
|
|
37
37
|
}
|
|
38
38
|
),
|
|
39
|
-
chip:
|
|
40
|
-
chipPositive: (
|
|
41
|
-
chipTestId:
|
|
39
|
+
chip: m == null ? /* @__PURE__ */ e(d, { reason: r }) : l(m),
|
|
40
|
+
chipPositive: (m ?? 0) > 0,
|
|
41
|
+
chipTestId: t.net,
|
|
42
42
|
children: [
|
|
43
43
|
/* @__PURE__ */ e(
|
|
44
|
-
|
|
44
|
+
p,
|
|
45
45
|
{
|
|
46
|
-
valueTestId:
|
|
46
|
+
valueTestId: t.value,
|
|
47
47
|
label: /* @__PURE__ */ e(
|
|
48
48
|
s,
|
|
49
49
|
{
|
|
50
|
-
messageId:
|
|
50
|
+
messageId: i(
|
|
51
51
|
r,
|
|
52
52
|
"components.poolApyBreakdownCard.organicApy",
|
|
53
53
|
"components.poolApyBreakdownCard.organicApy7d"
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
56
|
),
|
|
57
|
-
value:
|
|
57
|
+
value: c == null ? /* @__PURE__ */ e(d, { reason: r }) : l(c)
|
|
58
58
|
}
|
|
59
59
|
),
|
|
60
|
-
/* @__PURE__ */ e(
|
|
61
|
-
|
|
60
|
+
y.length > 0 ? y.map((o) => /* @__PURE__ */ e(
|
|
61
|
+
p,
|
|
62
|
+
{
|
|
63
|
+
valueTestId: t.value,
|
|
64
|
+
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
65
|
+
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
66
|
+
s,
|
|
67
|
+
{
|
|
68
|
+
messageId: i(
|
|
69
|
+
r,
|
|
70
|
+
"components.poolApyBreakdownCard.tokenIncentiveApy",
|
|
71
|
+
"components.poolApyBreakdownCard.tokenIncentiveApy7d"
|
|
72
|
+
),
|
|
73
|
+
values: { symbol: o.token.symbol }
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
/* @__PURE__ */ e(
|
|
77
|
+
h,
|
|
78
|
+
{
|
|
79
|
+
token: o.token,
|
|
80
|
+
symbol: o.token.symbol,
|
|
81
|
+
size: 16,
|
|
82
|
+
className: "shrink-0"
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
] }),
|
|
86
|
+
value: l(o.supplyApr ?? 0)
|
|
87
|
+
},
|
|
88
|
+
`incentive-${o.token.address}`
|
|
89
|
+
)) : /* @__PURE__ */ e(
|
|
90
|
+
p,
|
|
62
91
|
{
|
|
63
|
-
valueTestId:
|
|
92
|
+
valueTestId: t.value,
|
|
64
93
|
label: /* @__PURE__ */ e(
|
|
65
94
|
s,
|
|
66
95
|
{
|
|
67
|
-
messageId:
|
|
96
|
+
messageId: i(
|
|
68
97
|
r,
|
|
69
98
|
"components.poolApyBreakdownCard.incentiveApy",
|
|
70
99
|
"components.poolApyBreakdownCard.incentiveApy7d"
|
|
71
100
|
)
|
|
72
101
|
}
|
|
73
102
|
),
|
|
74
|
-
value:
|
|
103
|
+
value: n == null ? /* @__PURE__ */ e(d, { reason: r }) : l(0)
|
|
75
104
|
}
|
|
76
105
|
),
|
|
77
|
-
k.length > 0 ? /* @__PURE__ */ a(
|
|
78
|
-
/* @__PURE__ */ e(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
i,
|
|
82
|
-
{
|
|
83
|
-
valueTestId: l.reward,
|
|
84
|
-
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
85
|
-
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
86
|
-
s,
|
|
87
|
-
{
|
|
88
|
-
messageId: "components.apyParts.extraAPY",
|
|
89
|
-
values: { symbol: o.token.symbol }
|
|
90
|
-
}
|
|
91
|
-
) }),
|
|
92
|
-
/* @__PURE__ */ e(
|
|
93
|
-
C,
|
|
94
|
-
{
|
|
95
|
-
token: o.token,
|
|
96
|
-
symbol: o.token.symbol,
|
|
97
|
-
size: 16,
|
|
98
|
-
className: "shrink-0"
|
|
99
|
-
}
|
|
100
|
-
)
|
|
101
|
-
] }),
|
|
102
|
-
value: p(o.supplyApr)
|
|
103
|
-
},
|
|
104
|
-
`incentive-${o.token.address}-${o.supplyApr}`
|
|
105
|
-
)
|
|
106
|
-
),
|
|
107
|
-
A.map((o) => /* @__PURE__ */ e(
|
|
108
|
-
i,
|
|
106
|
+
k.length > 0 ? /* @__PURE__ */ a(u, { children: [
|
|
107
|
+
/* @__PURE__ */ e(v, {}),
|
|
108
|
+
k.map((o) => /* @__PURE__ */ e(
|
|
109
|
+
p,
|
|
109
110
|
{
|
|
110
|
-
valueTestId:
|
|
111
|
+
valueTestId: t.points,
|
|
111
112
|
label: /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
112
113
|
/* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
|
|
113
114
|
s,
|
|
@@ -117,7 +118,7 @@ function _({
|
|
|
117
118
|
}
|
|
118
119
|
) }),
|
|
119
120
|
/* @__PURE__ */ e(
|
|
120
|
-
|
|
121
|
+
f,
|
|
121
122
|
{
|
|
122
123
|
reward: { name: o.name, type: o.id },
|
|
123
124
|
size: 16,
|
|
@@ -125,7 +126,7 @@ function _({
|
|
|
125
126
|
}
|
|
126
127
|
)
|
|
127
128
|
] }),
|
|
128
|
-
value: o.multiplier != null ? `${o.multiplier}×` :
|
|
129
|
+
value: o.multiplier != null ? `${o.multiplier}×` : w
|
|
129
130
|
},
|
|
130
131
|
o.id
|
|
131
132
|
))
|
|
@@ -135,6 +136,6 @@ function _({
|
|
|
135
136
|
);
|
|
136
137
|
}
|
|
137
138
|
export {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
W as PoolApyBreakdownCard,
|
|
140
|
+
t as PoolApyBreakdownCardTest
|
|
140
141
|
};
|
|
@@ -3,7 +3,7 @@ import { createChart as ht, CrosshairMode as dt, LineStyle as le, LineSeries as
|
|
|
3
3
|
import * as Ve from "react";
|
|
4
4
|
import { useRef as K, useState as ne, useEffect as G, useLayoutEffect as pt } from "react";
|
|
5
5
|
import { useIsMobile as bt } from "../../hooks/use-media-query.js";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as O } from "../../utils/cn.js";
|
|
7
7
|
import { hslToHex as St, generateColorsFromBase as Ce, resolveCSSColor as ie } from "../../utils/colors.js";
|
|
8
8
|
import { getDefaultOptions as Je, getDefaultSeries as vt, AXIS_TICK_MARK_DENSITY as ve, getDefaultVerticalLine as Ct, AXIS_FONT_SIZE as xt, AXIS_EDGE_LABEL_PADDING_PX as Qe, AXIS_TOP_LABEL_PADDING_PX as Ye, AXIS_TIME_EDGE_PADDING_PX as yt } from "./default-config.js";
|
|
9
9
|
import { formatExactValue as Le, isRatioUnit as _t, getXFormatters as Ue, createAdaptiveYAxisFormatter as wt } from "./formatters.js";
|
|
@@ -36,7 +36,7 @@ class Lt {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
class
|
|
39
|
+
class kt {
|
|
40
40
|
_source;
|
|
41
41
|
_yTop = null;
|
|
42
42
|
_yBottom = null;
|
|
@@ -55,14 +55,14 @@ class Mt {
|
|
|
55
55
|
return new Lt(this._yTop, this._yBottom, this._source.color);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
class
|
|
58
|
+
class Mt {
|
|
59
59
|
series;
|
|
60
60
|
priceTop;
|
|
61
61
|
priceBottom;
|
|
62
62
|
color;
|
|
63
63
|
_paneViews;
|
|
64
64
|
constructor(i, c, u, h) {
|
|
65
|
-
this.series = i, this.priceTop = c, this.priceBottom = u, this.color = h, this._paneViews = [new
|
|
65
|
+
this.series = i, this.priceTop = c, this.priceBottom = u, this.color = h, this._paneViews = [new kt(this)];
|
|
66
66
|
}
|
|
67
67
|
updateAllViews() {
|
|
68
68
|
for (const i of this._paneViews) i.update();
|
|
@@ -167,7 +167,7 @@ function At(e, i) {
|
|
|
167
167
|
return e[c].value;
|
|
168
168
|
return 0;
|
|
169
169
|
}
|
|
170
|
-
const
|
|
170
|
+
const ke = [
|
|
171
171
|
// 0 green (emerald)
|
|
172
172
|
{
|
|
173
173
|
line: "#02c39a",
|
|
@@ -284,9 +284,9 @@ const Me = [
|
|
|
284
284
|
}
|
|
285
285
|
], Gt = 137.5;
|
|
286
286
|
function ot(e) {
|
|
287
|
-
if (e <
|
|
288
|
-
return
|
|
289
|
-
const c = (e -
|
|
287
|
+
if (e < ke.length)
|
|
288
|
+
return ke[e];
|
|
289
|
+
const c = (e - ke.length) * Gt % 360, u = St(c, 70, 50), { topColor: h, bottomColor: f } = Ce(u);
|
|
290
290
|
return { line: u, top: h, bottom: f };
|
|
291
291
|
}
|
|
292
292
|
function oo({
|
|
@@ -301,9 +301,9 @@ function oo({
|
|
|
301
301
|
priceLineOptions: I,
|
|
302
302
|
zoneOptions: F,
|
|
303
303
|
currentValueDecimals: se,
|
|
304
|
-
useSharedPriceScale:
|
|
304
|
+
useSharedPriceScale: Z = !1,
|
|
305
305
|
dualYAxis: D = !1,
|
|
306
|
-
defaultVisiblePriceScaleId:
|
|
306
|
+
defaultVisiblePriceScaleId: Me = "right",
|
|
307
307
|
leftPriceScaleTitle: Ie,
|
|
308
308
|
rightPriceScaleTitle: Xt,
|
|
309
309
|
showCurrentValue: rt = !0,
|
|
@@ -469,19 +469,19 @@ function oo({
|
|
|
469
469
|
minBarSpacing: 0
|
|
470
470
|
}
|
|
471
471
|
});
|
|
472
|
-
const v = !D && e.length > 1 && !
|
|
472
|
+
const v = !D && e.length > 1 && !Z, W = D ? N : e.length > 1 && !Z || N, k = ie(
|
|
473
473
|
"hsl(var(--muted-foreground))",
|
|
474
474
|
"rgb(163, 163, 163)"
|
|
475
475
|
);
|
|
476
476
|
t.applyOptions({
|
|
477
477
|
...D && {
|
|
478
|
-
defaultVisiblePriceScaleId:
|
|
478
|
+
defaultVisiblePriceScaleId: Me
|
|
479
479
|
},
|
|
480
480
|
leftPriceScale: {
|
|
481
481
|
...y.leftPriceScale || {},
|
|
482
482
|
...S?.leftPriceScale,
|
|
483
483
|
visible: D && !N,
|
|
484
|
-
textColor:
|
|
484
|
+
textColor: k,
|
|
485
485
|
...D && Ie && {
|
|
486
486
|
// lightweight-charts uses scale margins; title shown via localization if needed
|
|
487
487
|
}
|
|
@@ -490,7 +490,7 @@ function oo({
|
|
|
490
490
|
...y.rightPriceScale || {},
|
|
491
491
|
...S?.rightPriceScale,
|
|
492
492
|
visible: D ? !N : !W,
|
|
493
|
-
textColor:
|
|
493
|
+
textColor: k
|
|
494
494
|
}
|
|
495
495
|
});
|
|
496
496
|
const ee = new Set(L.current.keys()), X = new Set(e.map(ae));
|
|
@@ -499,7 +499,7 @@ function oo({
|
|
|
499
499
|
const o = L.current.get(r);
|
|
500
500
|
o && (t.removeSeries(o), L.current.delete(r));
|
|
501
501
|
}
|
|
502
|
-
const p = vt(),
|
|
502
|
+
const p = vt(), M = [];
|
|
503
503
|
let R = 0;
|
|
504
504
|
const $ = e.find((r) => r.data.length > 0), C = /* @__PURE__ */ new Map();
|
|
505
505
|
if (I && I.length > 0)
|
|
@@ -539,12 +539,12 @@ function oo({
|
|
|
539
539
|
b && (t.removeSeries(b), L.current.delete(m));
|
|
540
540
|
continue;
|
|
541
541
|
}
|
|
542
|
-
const pe = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, fe = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, he = pe < 0,
|
|
543
|
-
v &&
|
|
542
|
+
const pe = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, fe = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, he = pe < 0, q = o.data.some((b) => b.value === 0), be = !he && q, de = Tt(fe - pe), me = D ? o.priceScaleId ?? (R === 0 ? "left" : "right") : Z || !v || R === 0 ? "right" : `scale-${R}`;
|
|
543
|
+
v && M.push({
|
|
544
544
|
priceScaleId: me || "right",
|
|
545
545
|
seriesIndex: R
|
|
546
546
|
});
|
|
547
|
-
const Ne = (
|
|
547
|
+
const Ne = (Z || !v) && n !== void 0 && typeof n == "number", ct = C.get(o.label) ?? [], ut = (b) => {
|
|
548
548
|
const _ = b();
|
|
549
549
|
if (_?.priceRange) {
|
|
550
550
|
Ne && (_.priceRange.minValue = n);
|
|
@@ -617,14 +617,14 @@ function oo({
|
|
|
617
617
|
alignLabels: !0,
|
|
618
618
|
entireTextOnly: !1,
|
|
619
619
|
tickMarkDensity: ve,
|
|
620
|
-
textColor:
|
|
620
|
+
textColor: k,
|
|
621
621
|
...S?.rightPriceScale
|
|
622
622
|
};
|
|
623
623
|
r?.applyOptions(m), o?.applyOptions(m);
|
|
624
624
|
} catch {
|
|
625
625
|
}
|
|
626
|
-
else if (v &&
|
|
627
|
-
for (const r of
|
|
626
|
+
else if (v && M.length > 0)
|
|
627
|
+
for (const r of M)
|
|
628
628
|
try {
|
|
629
629
|
const o = t.priceScale(r.priceScaleId);
|
|
630
630
|
o && o.applyOptions({
|
|
@@ -637,7 +637,7 @@ function oo({
|
|
|
637
637
|
alignLabels: !0,
|
|
638
638
|
entireTextOnly: !1,
|
|
639
639
|
tickMarkDensity: ve,
|
|
640
|
-
textColor:
|
|
640
|
+
textColor: k
|
|
641
641
|
});
|
|
642
642
|
} catch (o) {
|
|
643
643
|
console.warn(
|
|
@@ -658,12 +658,12 @@ function oo({
|
|
|
658
658
|
alignLabels: !0,
|
|
659
659
|
entireTextOnly: !1,
|
|
660
660
|
tickMarkDensity: ve,
|
|
661
|
-
textColor:
|
|
661
|
+
textColor: k,
|
|
662
662
|
...S?.rightPriceScale
|
|
663
663
|
});
|
|
664
664
|
} catch {
|
|
665
665
|
}
|
|
666
|
-
if (n !== void 0 && !N && (
|
|
666
|
+
if (n !== void 0 && !N && (Z || !v) && t.applyOptions({
|
|
667
667
|
handleScroll: {
|
|
668
668
|
vertTouchDrag: !1
|
|
669
669
|
}
|
|
@@ -686,14 +686,14 @@ function oo({
|
|
|
686
686
|
fixLeftEdge: !fe,
|
|
687
687
|
fixRightEdge: !he
|
|
688
688
|
}), !fe && !he) return;
|
|
689
|
-
const
|
|
690
|
-
if (!
|
|
691
|
-
const de =
|
|
689
|
+
const q = V.getVisibleLogicalRange(), be = V.width();
|
|
690
|
+
if (!q || !(be > 0)) return;
|
|
691
|
+
const de = q.to - q.from;
|
|
692
692
|
if (!(de > 0)) return;
|
|
693
693
|
const me = yt * de / be;
|
|
694
694
|
V.setVisibleLogicalRange({
|
|
695
|
-
from: fe ?
|
|
696
|
-
to: he ?
|
|
695
|
+
from: fe ? q.from - me : q.from,
|
|
696
|
+
to: he ? q.to + me : q.to
|
|
697
697
|
});
|
|
698
698
|
};
|
|
699
699
|
try {
|
|
@@ -719,9 +719,9 @@ function oo({
|
|
|
719
719
|
h,
|
|
720
720
|
f,
|
|
721
721
|
N,
|
|
722
|
-
|
|
722
|
+
Z,
|
|
723
723
|
D,
|
|
724
|
-
|
|
724
|
+
Me,
|
|
725
725
|
Ie,
|
|
726
726
|
De,
|
|
727
727
|
Ee,
|
|
@@ -746,7 +746,7 @@ function oo({
|
|
|
746
746
|
const X = /* @__PURE__ */ new Map();
|
|
747
747
|
for (const p of e)
|
|
748
748
|
p.data.length > 0 && X.set(p.label, p.data[p.data.length - 1]);
|
|
749
|
-
if (Pe(X.size > 0 ? X : void 0), l ||
|
|
749
|
+
if (Pe(X.size > 0 ? X : void 0), l || Z || ye)
|
|
750
750
|
J(null);
|
|
751
751
|
else if (v && n) {
|
|
752
752
|
const p = e[0];
|
|
@@ -758,11 +758,11 @@ function oo({
|
|
|
758
758
|
return;
|
|
759
759
|
}
|
|
760
760
|
const W = /* @__PURE__ */ new Map();
|
|
761
|
-
let
|
|
761
|
+
let k, ee = v;
|
|
762
762
|
for (let X = 0; X < e.length; X++) {
|
|
763
|
-
const p = e[X],
|
|
764
|
-
if (!
|
|
765
|
-
const R = g?.get(
|
|
763
|
+
const p = e[X], M = L.current.get(ae(p));
|
|
764
|
+
if (!M) continue;
|
|
765
|
+
const R = g?.get(M), $ = R && "value" in R ? R.value : void 0;
|
|
766
766
|
let C;
|
|
767
767
|
if ($ !== void 0)
|
|
768
768
|
C = $;
|
|
@@ -774,29 +774,29 @@ function oo({
|
|
|
774
774
|
if (Number(d) < H) continue;
|
|
775
775
|
C = At(p.data, Number(d));
|
|
776
776
|
}
|
|
777
|
-
Number.isNaN(C) || (
|
|
777
|
+
Number.isNaN(C) || (k === void 0 && (k = C, ee = M), W.set(p.label, { value: C, time: d }));
|
|
778
778
|
}
|
|
779
|
-
if (Pe(W),
|
|
780
|
-
const p = t.timeScale().timeToCoordinate(d),
|
|
781
|
-
if (p !== null &&
|
|
779
|
+
if (Pe(W), k !== void 0 && ee) {
|
|
780
|
+
const p = t.timeScale().timeToCoordinate(d), M = ee.priceToCoordinate(k);
|
|
781
|
+
if (p !== null && M !== null) {
|
|
782
782
|
const R = B.current;
|
|
783
783
|
if (R) {
|
|
784
784
|
const $ = R.querySelector(
|
|
785
785
|
".LightweightChart"
|
|
786
786
|
);
|
|
787
787
|
if ($) {
|
|
788
|
-
const C = $.getBoundingClientRect(), H = R.getBoundingClientRect(), r = p + (C.left - H.left), o =
|
|
788
|
+
const C = $.getBoundingClientRect(), H = R.getBoundingClientRect(), r = p + (C.left - H.left), o = M + (C.top - H.top);
|
|
789
789
|
J({ x: r, y: o });
|
|
790
790
|
} else
|
|
791
|
-
J({ x: p, y:
|
|
791
|
+
J({ x: p, y: M });
|
|
792
792
|
} else
|
|
793
|
-
J({ x: p, y:
|
|
793
|
+
J({ x: p, y: M });
|
|
794
794
|
} else
|
|
795
795
|
J(null);
|
|
796
796
|
} else
|
|
797
797
|
J(null);
|
|
798
798
|
};
|
|
799
|
-
return t.subscribeCrosshairMove(a), N && t.subscribeClick(a), !l && !
|
|
799
|
+
return t.subscribeCrosshairMove(a), N && t.subscribeClick(a), !l && !Z && !ye && requestAnimationFrame(() => {
|
|
800
800
|
const s = e[0], d = s ? L.current.get(ae(s)) : void 0;
|
|
801
801
|
if (d && n && s.data.length > 0) {
|
|
802
802
|
const x = t.timeScale().timeToCoordinate(n), y = s.data[s.data.length - 1].value, v = d.priceToCoordinate(y);
|
|
@@ -805,7 +805,7 @@ function oo({
|
|
|
805
805
|
}), () => {
|
|
806
806
|
t.unsubscribeCrosshairMove(a), N && t.unsubscribeClick(a);
|
|
807
807
|
};
|
|
808
|
-
}, [e,
|
|
808
|
+
}, [e, Z, N, ye]), G(() => {
|
|
809
809
|
const t = E.current;
|
|
810
810
|
if (!t || e.length === 0) return;
|
|
811
811
|
const l = t.timeScale(), n = () => {
|
|
@@ -819,8 +819,8 @@ function oo({
|
|
|
819
819
|
for (const v of e)
|
|
820
820
|
if (x.labels.has(v.label))
|
|
821
821
|
for (const W of v.data) {
|
|
822
|
-
const
|
|
823
|
-
|
|
822
|
+
const k = Number(W.time);
|
|
823
|
+
k >= d && k <= g && y.push(W.value);
|
|
824
824
|
}
|
|
825
825
|
y.length > 0 && x.updateVisibleRange(y);
|
|
826
826
|
}
|
|
@@ -911,7 +911,7 @@ function oo({
|
|
|
911
911
|
n.seriesLabel
|
|
912
912
|
);
|
|
913
913
|
if (!a) continue;
|
|
914
|
-
const s = n.color ? ie(n.color, l) : l, d = new
|
|
914
|
+
const s = n.color ? ie(n.color, l) : l, d = new Mt(
|
|
915
915
|
a,
|
|
916
916
|
n.priceTop,
|
|
917
917
|
n.priceBottom,
|
|
@@ -967,7 +967,7 @@ function oo({
|
|
|
967
967
|
"div",
|
|
968
968
|
{
|
|
969
969
|
ref: B,
|
|
970
|
-
className:
|
|
970
|
+
className: O(
|
|
971
971
|
"relative z-[1] w-full h-full overflow-hidden p-0",
|
|
972
972
|
i
|
|
973
973
|
),
|
|
@@ -1008,7 +1008,7 @@ function oo({
|
|
|
1008
1008
|
se
|
|
1009
1009
|
), g = a.tooltipText ?? "";
|
|
1010
1010
|
if (!(s || d || g)) return null;
|
|
1011
|
-
const y = a.labelBackgroundColor ?? a.color ?? "hsl(var(--background))", v = a.labelTextColor ?? "hsl(var(--foreground))", W = `${String(t.xCoordinate)}-${s}-${g}`,
|
|
1011
|
+
const y = a.labelBackgroundColor ?? a.color ?? "hsl(var(--background))", v = a.labelTextColor ?? "hsl(var(--foreground))", W = `${String(t.xCoordinate)}-${s}-${g}`, k = zt(
|
|
1012
1012
|
n,
|
|
1013
1013
|
it,
|
|
1014
1014
|
at[l]
|
|
@@ -1019,18 +1019,18 @@ function oo({
|
|
|
1019
1019
|
ref: (ee) => {
|
|
1020
1020
|
je.current.set(l, ee);
|
|
1021
1021
|
},
|
|
1022
|
-
className:
|
|
1022
|
+
className: O(
|
|
1023
1023
|
"group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
|
|
1024
1024
|
g && "pointer-events-auto cursor-default"
|
|
1025
1025
|
),
|
|
1026
1026
|
style: {
|
|
1027
|
-
...
|
|
1027
|
+
...k,
|
|
1028
1028
|
backgroundColor: y,
|
|
1029
1029
|
color: v
|
|
1030
1030
|
},
|
|
1031
1031
|
children: [
|
|
1032
1032
|
s && /* @__PURE__ */ w("span", { className: "block", children: s }),
|
|
1033
|
-
d && /* @__PURE__ */ w("span", { className:
|
|
1033
|
+
d && /* @__PURE__ */ w("span", { className: O("block", s && "mt-0.5"), children: d }),
|
|
1034
1034
|
g && /* @__PURE__ */ w(
|
|
1035
1035
|
"span",
|
|
1036
1036
|
{
|
|
@@ -1067,7 +1067,7 @@ function Wt({
|
|
|
1067
1067
|
return /* @__PURE__ */ te(
|
|
1068
1068
|
"div",
|
|
1069
1069
|
{
|
|
1070
|
-
className:
|
|
1070
|
+
className: O(
|
|
1071
1071
|
"flex flex-wrap",
|
|
1072
1072
|
u ? "items-center justify-center gap-6" : "absolute top-0 left-2 z-[10] gap-2"
|
|
1073
1073
|
),
|
|
@@ -1077,8 +1077,8 @@ function Wt({
|
|
|
1077
1077
|
return /* @__PURE__ */ te(
|
|
1078
1078
|
"div",
|
|
1079
1079
|
{
|
|
1080
|
-
className:
|
|
1081
|
-
"flex items-center gap-1.5",
|
|
1080
|
+
className: O(
|
|
1081
|
+
"flex shrink-0 items-center gap-1.5",
|
|
1082
1082
|
!u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
|
|
1083
1083
|
F && "opacity-50"
|
|
1084
1084
|
),
|
|
@@ -1086,7 +1086,8 @@ function Wt({
|
|
|
1086
1086
|
/* @__PURE__ */ w(
|
|
1087
1087
|
"div",
|
|
1088
1088
|
{
|
|
1089
|
-
className:
|
|
1089
|
+
className: O(
|
|
1090
|
+
"shrink-0",
|
|
1090
1091
|
u ? "size-2 rounded-full" : "h-3 w-3 rounded-sm"
|
|
1091
1092
|
),
|
|
1092
1093
|
style: { backgroundColor: I }
|
|
@@ -1095,7 +1096,7 @@ function Wt({
|
|
|
1095
1096
|
/* @__PURE__ */ te(
|
|
1096
1097
|
"span",
|
|
1097
1098
|
{
|
|
1098
|
-
className:
|
|
1099
|
+
className: O(
|
|
1099
1100
|
"font-medium text-foreground",
|
|
1100
1101
|
u ? "text-sm" : "text-[10px] sm:text-xs"
|
|
1101
1102
|
),
|
|
@@ -1145,22 +1146,22 @@ function Wt({
|
|
|
1145
1146
|
i?.map((f) => /* @__PURE__ */ te(
|
|
1146
1147
|
"div",
|
|
1147
1148
|
{
|
|
1148
|
-
className:
|
|
1149
|
-
"flex items-center gap-1.5",
|
|
1149
|
+
className: O(
|
|
1150
|
+
"flex shrink-0 items-center gap-1.5",
|
|
1150
1151
|
!u && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border"
|
|
1151
1152
|
),
|
|
1152
1153
|
children: [
|
|
1153
1154
|
/* @__PURE__ */ w(
|
|
1154
1155
|
"div",
|
|
1155
1156
|
{
|
|
1156
|
-
className:
|
|
1157
|
+
className: "h-3 w-0.5 shrink-0",
|
|
1157
1158
|
style: { backgroundColor: f.color }
|
|
1158
1159
|
}
|
|
1159
1160
|
),
|
|
1160
1161
|
/* @__PURE__ */ w(
|
|
1161
1162
|
"span",
|
|
1162
1163
|
{
|
|
1163
|
-
className:
|
|
1164
|
+
className: O(
|
|
1164
1165
|
"font-medium text-foreground",
|
|
1165
1166
|
u ? "text-sm" : "text-[10px] sm:text-xs"
|
|
1166
1167
|
),
|
|
@@ -1176,7 +1177,7 @@ function Wt({
|
|
|
1176
1177
|
);
|
|
1177
1178
|
}
|
|
1178
1179
|
export {
|
|
1179
|
-
|
|
1180
|
+
ke as DEFAULT_SERIES_COLORS,
|
|
1180
1181
|
oo as Graph,
|
|
1181
1182
|
Wt as GraphLegend,
|
|
1182
1183
|
tt as VERTICAL_LINE_LABEL_EDGE_PADDING,
|
|
@@ -188,6 +188,8 @@ const e = {
|
|
|
188
188
|
"components.poolApyBreakdownCard.organicApy7d": "Base APY (7d)",
|
|
189
189
|
"components.poolApyBreakdownCard.incentiveApy": "Incentive APY",
|
|
190
190
|
"components.poolApyBreakdownCard.incentiveApy7d": "Incentive APY (7d)",
|
|
191
|
+
"components.poolApyBreakdownCard.tokenIncentiveApy": "{symbol} Incentive APY",
|
|
192
|
+
"components.poolApyBreakdownCard.tokenIncentiveApy7d": "{symbol} Incentive APY (7d)",
|
|
191
193
|
"components.strategyApyBreakdownCard.formula": "{leverage} × {base}",
|
|
192
194
|
"components.strategyApyBreakdownCard.borrowFormula": "{leverage} × {totalRate} − {borrowRate}",
|
|
193
195
|
"components.leveragePresetChips.label": "Leverage:",
|
|
@@ -11,7 +11,8 @@ export interface PoolApyBreakdownCardProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* How a pool's net APY is arrived at: base yield plus incentives.
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* A token reward names the incentive row (`GEAR Incentive APY`). With none,
|
|
15
|
+
* that row is still shown as Incentive APY at 0%. Points sit under a divider
|
|
16
|
+
* when present; they are not addends.
|
|
16
17
|
*/
|
|
17
18
|
export declare function PoolApyBreakdownCard({ data, period, }: PoolApyBreakdownCardProps): React.ReactElement;
|
|
@@ -228,6 +228,8 @@ declare const _default: {
|
|
|
228
228
|
"components.poolApyBreakdownCard.organicApy7d": "Base APY (7d)",
|
|
229
229
|
"components.poolApyBreakdownCard.incentiveApy": "Incentive APY",
|
|
230
230
|
"components.poolApyBreakdownCard.incentiveApy7d": "Incentive APY (7d)",
|
|
231
|
+
"components.poolApyBreakdownCard.tokenIncentiveApy": "{symbol} Incentive APY",
|
|
232
|
+
"components.poolApyBreakdownCard.tokenIncentiveApy7d": "{symbol} Incentive APY (7d)",
|
|
231
233
|
"components.strategyApyBreakdownCard.formula": "{leverage} × {base}",
|
|
232
234
|
"components.strategyApyBreakdownCard.borrowFormula": "{leverage} × {totalRate} − {borrowRate}",
|
|
233
235
|
|