1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8062],{27606:function(e,t,i){i.r(t);var n=i(85893),r=i(39277),s=i(67294),a=i(19827),l=i(8965),o=i(82604),u=i.n(o);function c(e){return new Date(new Date().toLocaleString("en-US",{timeZone:e}))}let h=/^(\d{1,2}):(\d{2})$/;function d(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=h.exec(String(e||""));return n?{h:+n[1],m:+n[2]}:{h:t,m:i}}function f(e){return 60*e.getHours()+e.getMinutes()}function m(e){let t=e.getDay();return t>=1&&t<=5}let g="https://stock-app-charting-read.project-turbine.in/v1/stock-charting-read/line-chart",p=[{label:"D",interval:"1m",rangeType:"today"},{label:"1W",interval:"30m",rangeType:"last_7_days"}];function v(e,t){let i=new Set;return e.map(e=>{let[i,n,r]=e.t.split(" "),s=Math.floor(new Date(`${i}T${n}${r}`).getTime()/1e3),[a,l,o]=i.split("-"),u=new Date(+a,+l-1).toLocaleString("en",{month:"short"});return t[s]=`${+o} ${u} ${a.slice(2)} ${n.slice(0,5)}`,{time:s,value:e.v,date:i}}).sort((e,t)=>e.time-t.time).filter(e=>!i.has(e.time)&&(i.add(e.time),!0))}function b(e){if(!e)return null;let t=e.timeScale();return{logicalRange:t.getVisibleLogicalRange(),timeRange:t.getVisibleRange()}}t.default=(0,s.memo)(function(e){let{exchange:t,symbol:i="IDEAFORGE",defaultRangeLabel:o="D",height:h=400,refresh:_=3e3,heigh:y,isMobile:S,setStockData:w,chartUrl:z,low:R,open:x="09:00",close:C="16:00"}=e,E=(0,s.useRef)(null),L=(0,s.useRef)(null),B=(0,s.useRef)(null),O=(0,s.useRef)(null),P=(0,s.useRef)({}),k=(0,s.useRef)(o),M=(0,s.useRef)(null),D=(0,s.useRef)(null),N=(0,s.useRef)(!0),$=(0,s.useRef)(null),j=(0,s.useRef)(!1),T=(0,s.useRef)([]),F=(0,s.useRef)(null),V=(0,s.useRef)(!1),W=(0,s.useRef)(!1),A=(0,s.useRef)(()=>{}
1),[I,H]=(0,s.useState)(o),[Q,Z]=(0,s.useState)({current:null,change:null,pct:null,crosshair:null}),[K,U]=(0,s.useState)(!0),[q,G]=(0,s.useState)(null);p[0].interval=S?"5m":"1m",(0,s.useEffect)(()=>{k.current=I},[I]);let J=(0,s.useMemo)(()=>Math.max(250,Number(_)||3e3),[_]),X="Asia/Kolkata",Y=(0,s.useCallback)(()=>{let e=c(X);if(!m(e))return!1;let t=d(x),i=d(C),n=f(e);return n>=60*t.h+t.m&&n<60*i.h+i.m},[x,C]),ee=(0,s.useCallback)(()=>{let e=c(X),t=d(x),i=60*t.h+t.m,n=f(e);if(m(e)&&n<i)return(i-n)*6e4;let r=e.getDay(),s=1;return 5===r?s=3:6===r&&(s=2),(1440-n+(s-1)*1440+i)*6e4},[x]);(0,s.useEffect)(()=>{if(!E.current)return;let e=E.current,t=(0,r.C2)(e,{width:e.clientWidth,height:h,layout:{background:{type:"solid",color:"#ffffff"},textColor:"#131722",fontSize:12,fontFamily:"'Trebuchet MS', Roboto, Ubuntu, sans-serif"},grid:{vertLines:{color:"rgba(46,46,46,0.06)"},horzLines:{color:"rgba(46,46,46,0.06)"}},crosshair:{mode:r.rM.Normal,vertLine:{color:"#758696",width:1,style:1,labelBackgroundColor:"#131722"},horzLine:{color:"#758696",width:1,style:1,labelBackgroundColor:"#131722"}},rightPriceScale:{borderColor:"#dde0e5",scaleMargins:{top:.1,bottom:.1}},timeScale:{borderColor:"#dde0e5",timeVisible:"D"===k.current,secondsVisible:!1,fixLeftEdge:!0,fixRightEdge:!0,lockVisibleTimeRangeOnResize:!0,rightBarStaysOnScroll:!0,shiftVisibleRangeOnNewBar:!1,tickMarkFormatter:(e,t)=>{let i=new Date(1e3*e);return"D"===k.current?i.toLocaleTimeString("en-IN",{timeZone:"Asia/Kolkata",hour:"2-digit",minute:"2-digit",hour12:!1}):t===r.lh.DayOfMonth?i.toLocaleDateString("en-IN",{timeZone:"Asia/Kolkata",day:"numeric",month:"short",year:"2-digit"}):""}},localization:{timeFormatter:e=>P.current[e]??new Date(1e3*e).toISOString().slice(11,16)},watermark:{visible:!1},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!1},handleScale:{mouseWheel:!1,pinch:!1,axisPressedMouseMove:{time:!1,price:!1}},kineticScroll:{touch:!0,mouse:!1}}),i=t.addSeries(r.f6,{lineColor:"#2962FF",topColor:"rgba(41,98,255,0.18)",bottomColor:"rgba(41,98,255,0)",lineWidth:2,lineType:r.SP.Simple,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:"#2962FF",crosshairMarkerBackgroundColor:"#ffffff",lastValueVisible:!0,priceLineVisible:!0,priceLineColor:"#2962FF",priceLineWidth:1,priceLineStyle:2});L.current=t,B.current=i;let n=e=>{if(!L.current||j.current)return;let t=b(L.current);if(t&&($.current=t),"1W"!==k.current||!e||!B.current)return;let i=B.current.barsInLogicalRange(e);i&&i.barsBefore<20&&A.current()};t.timeScale().subscribeVisibleLogicalRangeChange(n);let s=new ResizeObserver(e=>{e[0]&&t.applyOptions({width:e[0].contentRect.width})});s.observe(e);let l=e=>{let t=O.current,n=E.current;if(!t||!n)return;if(!e.time||!e.point||e.point.x<0||e.point.y<0||e.point.x>n.clientWidth||e.point.y>n.clientHeight){t.style.display="none",Z(e=>({...e,crosshair:null}));return}let r=e.seriesData.get(i);if(!r){t.style.display="none";return}let s=r.value;if(null==s){t.style.display="none";return}let l=null;if("number"==typeof e.time&&(l=e.time),!l){t.style.display="none";return}let o=new Date(1e3*l),c=o.toLocaleDateString("en-IN",{timeZone:"Asia/Kolkata",day:"2-digit",month:"short",year:"numeric"}),h=o.toLocaleTimeString("en-IN",{timeZone:"Asia/Kolkata",hour:"2-digit",minute:"2-digit",hour12:!1});t.innerHTML=` 2 <div class="${u().tooltipDate}"> 3 ${c} 4 </div> 5 6 <div class="${u().tooltipTime}"> 7 ${h} 8 </div> 9 10 <div class="${u().tooltipPrice}"> 11 â¹ ${(0,a.uf)(s)} 12 </div> 13 `,t.style.display="block";let d=t.offsetWidth,f=t.offsetHeight,m=n.clientWidth,g=n.clientHeight,p=e.point.x+12,v=e.point.y-f-12;p+d>m&&(p=e.point.x-d-12),p<0&&(p=12),v<0&&(v=e.point.y+12),v+f>g&&(v=g-f-12),t.style.left=`${p}px`,t.style.top=`${v}px`,Z(e=>({...e,crosshair:s}))};return t.subscribeCrosshairMove(l),()=>{s.disconnect(),t.timeScale().unsubscribeVisibleLogicalRangeChange(n),t.unsubscribeCrosshairMove(l),t.remove(),L.current=null,B.current=null}},[h]);let et=(0,s.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],{interval:n,rangeType:r}=p.find(e=>e.label===I)||p[0],s=encodeURIComponent(i.replace(/_/g,"-")),l=z||`${g}?exchange=${t}&symbol=${s}&interval=${n}&rangeType=${r}&sort=desc`;if(D.current)try{D.current.abort()}catch{}let o=new AbortController;D.current=o,e||(U(!0),G(null));try{let e=await fetch(l,{signal:o.signal});if(!e.ok)throw Error(`API error: ${e.status}`);let t=await e.json(),i=t?.data??[];
13if((0,a.M8)(t?.stockDetails),!i.length)throw Error("No data returned.");let n={...P.current},r=v(i,n);if(P.current=n,T.current=r,"1W"===k.current&&r.length&&(F.current=r[0].date),B.current&&L.current){let e=L.current,t=null;N.current?t=null:(t=b(e))&&($.current=t),j.current=!0;try{B.current.setData(r)}finally{j.current=!1}requestAnimationFrame(()=>{if(L.current&&B.current){if(N.current){!function(e,t,i){if(!e||!t?.length)return;let n=e.timeScale();i&&t[t.length-1].time,n.fitContent()}(e,r,"D"===I),$.current=b(e),N.current=!1;return}if(t?.timeRange)try{e.timeScale().setVisibleRange(t.timeRange),$.current=b(e)}catch(e){console.warn("Failed to restore viewport:",e)}}})}let s=r[0]?.value??0,u=r[r.length-1]?.value??0,c=u-s;Z({current:u,change:c,pct:0===s?0:c/s*100,crosshair:null})}catch(t){t?.name==="AbortError"||e||G(t.message)}finally{D.current===o&&(D.current=null),e||U(!1)}},[t,i,I]),ei=(0,s.useCallback)(async()=>{if("1W"!==k.current||V.current||W.current||!F.current)return;V.current=!0;let e=encodeURIComponent(i.replace(/_/g,"-")),n=z||`${g}?exchange=${t}&symbol=${e}&interval=30m&rangeType=last_7_days&beforeDate=${F.current}&sort=desc`;try{let e=await fetch(n);if(!e.ok)throw Error(`API error: ${e.status}`);let t=await e.json(),i=t?.data??[];if(!i.length){W.current=!0;return}let r={...P.current},s=v(i,r);P.current=r;let a=function(e,t){let i=new Set;return[...e,...t].sort((e,t)=>e.time-t.time).filter(e=>!i.has(e.time)&&(i.add(e.time),!0))}(s,T.current);if(a.length===T.current.length){W.current=!0;return}let l=L.current;if(!l)return;let o=b(l);T.current=a,F.current=a[0]?.date??F.current,j.current=!0;try{B.current?.setData(a)}finally{j.current=!1}requestAnimationFrame(()=>{L.current&&o&&(!function(e,t){if(!e||!t)return;let i=e.timeScale();try{if(t.timeRange){i.setVisibleRange(t.timeRange);return}t.logicalRange&&i.setVisibleLogicalRange(t.logicalRange)}catch(e){console.warn("Failed to restore viewport",e)}}(L.current,o),$.current=b(L.current))})}catch(e){console.warn("Failed to load older 1W data:",e)}finally{V.current=!1}},[t,i]);(0,s.useEffect)(()=>{A.current=ei},[ei]);let en=(0,s.useCallback)(e=>{e!==k.current&&(N.current=!0,$.current=null,T.current=[],F.current=null,W.current=!1,V.current=!1,O.current&&(O.current.style.display="none"),H(e))},[]),er=(0,s.useCallback)(()=>{M.current&&(clearTimeout(M.current),M.current=null)},[]),es=(0,s.useCallback)((e,t)=>{er();let i=Y(),n="number"==typeof e?e:J,r=i?n:ee();if(!0===t){et().finally(()=>{M.current=setTimeout(()=>es(),r)});return}M.current=setTimeout(()=>{et(!0).finally(()=>es())},r)},[J,er,et,Y,ee]);return(0,s.useEffect)(()=>{if(L.current)return es(0,!0),()=>{er()}},[es,er]),(0,s.useEffect)(()=>()=>{if(er(),D.current){try{D.current.abort()}catch{}D.current=null}},[er]),Q.crosshair??Q.current,(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:u().header,children:[(0,n.jsxs)("div",{className:u().headerLeft,children:[y&&(0,n.jsx)("div",{className:u().heighlow,children:(0,n.jsx)(l.Z,{name:"High",value:"â¹ "+(0,a.uf)(y)})}),R&&(0,n.jsx)("div",{className:u().heighlow,children:(0,n.jsx)(l.Z,{name:"Low",value:"â¹ "+(0,a.uf)(R)})})]}),(0,n.jsx)("div",{className:u().rangeBar,children:p.map(e=>{let{label:t}=e;return(0,n.jsx)("button",{className:` 14 ${u().rangeBtn} 15 ${I===t?u().rangeBtnActive:""} 16 `,onClick:()=>en(t),children:t},t)})})]}),(0,n.jsxs)("div",{className:u().chartWrap,style:{height:h},children:[K&&(0,n.jsx)("div",{className:u().overlay,children:(0,n.jsx)("div",{className:u().spinner})}),q&&!K&&(0,n.jsxs)("div",{className:u().overlay,children:[(0,n.jsx)("span",{className:u().errorText,children:q}),(0,n.jsx)("button",{className:u().retryBtn,onClick:()=>{N.current=!0,$.current=null,et()},children:"Retry"})]}),(0,n.jsx)("div",{ref:E,className:u().chart}),(0,n.jsx)("div",{ref:O,className:u().chartTooltip,style:{display:"none"}})]})]})})},71518:function(e,t,i){function n(e){var t=e.width,i=e.height;if(t<0)throw Error("Negative width is not allowed for Size");if(i<0)throw Error("Negative height is not allowed for Size");return{width:t,height:i}}function r(e,t){return e.width===t.width&&e.height===t.height}i.d(t,{qW:function(){return l},J$:function(){return r},dp:function(){return n},sE:function(){return c}});var s=function(){function e(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return e.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(e.prototype,"value",{get:function(){return this._window.devicePixelRatio}
16,enumerable:!1,configurable:!0}),e.prototype.subscribe=function(e){var t=this,i={next:e};return this._observers.push(i),{unsubscribe:function(){t._observers=t._observers.filter(function(e){return e!==i})}}},e.prototype._installResolutionListener=function(){if(null!==this._resolutionMediaQueryList)throw Error("Resolution listener is already installed");var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia("all and (resolution: ".concat(e,"dppx)")),this._resolutionMediaQueryList.addListener(this._resolutionListener)},e.prototype._uninstallResolutionListener=function(){null!==this._resolutionMediaQueryList&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},e.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},e.prototype._onResolutionChanged=function(){var e=this;this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},e}(),a=function(){function e(e,t,i){var r;this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=n({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=null!=t?t:function(e){return e},this._allowResizeObserver=null===(r=null==i?void 0:i.allowResizeObserver)||void 0===r||r,this._chooseAndInitObserver()}return e.prototype.dispose=function(){var e,t;if(null===this._canvasElement)throw Error("Object is disposed");null===(e=this._canvasElementResizeObserver)||void 0===e||e.disconnect(),this._canvasElementResizeObserver=null,null===(t=this._devicePixelRatioObservable)||void 0===t||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(e.prototype,"canvasElement",{get:function(){if(null===this._canvasElement)throw Error("Object is disposed");return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canvasElementClientSize",{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bitmapSize",{get:function(){return n({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),e.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=n(e),this.canvasElement.style.width="".concat(this._canvasElementClientSize.width,"px"),this.canvasElement.style.height="".concat(this._canvasElementClientSize.height,"px"),this._invalidateBitmapSize()},e.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},e.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(e.prototype,"suggestedBitmapSize",{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),e.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},e.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},e.prototype.applySuggestedBitmapSize=function(){if(null!==this._suggestedBitmapSize){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},e.prototype._resizeBitmap=function(e){var t=this.bitmapSize;r(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},e.prototype._emitBitmapSizeChanged=function(e,t){var i=this;this._bitmapSizeChangedListeners.forEach(function(n){return n.call(i,e,t)})},e.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,i=n(this._transformBitmapSize(e,this._canvasElementClientSize)),s=r(this.bitmapSize,i)?null:i;null===t&&null===s||null!==t&&null!==s&&r(t,s)||(this._suggestedBitmapSize=s,this._emitSuggestedBitmapSizeChanged(t,s))},e.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var i=this;
16this._suggestedBitmapSizeChangedListeners.forEach(function(n){return n.call(i,e,t)})},e.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}new Promise(function(e){var t=new ResizeObserver(function(i){e(i.every(function(e){return"devicePixelContentBoxSize"in e})),t.disconnect()});t.observe(document.body,{box:"device-pixel-content-box"})}).catch(function(){return!1}).then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},e.prototype._initDevicePixelRatioObservable=function(){var e=this;if(null!==this._canvasElement){var t=o(this._canvasElement);if(null===t)throw Error("No window is associated with the canvas");this._devicePixelRatioObservable=new s(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},e.prototype._invalidateBitmapSize=function(){if(null!==this._canvasElement){var e,t,i=o(this._canvasElement);if(null!==i){var r,s=null!==(t=null===(e=this._devicePixelRatioObservable)||void 0===e?void 0:e.value)&&void 0!==t?t:i.devicePixelRatio,a=this._canvasElement.getClientRects(),l=void 0!==a[0]?n({width:Math.round((r=a[0]).left*s+r.width*s)-Math.round(r.left*s),height:Math.round(r.top*s+r.height*s)-Math.round(r.top*s)}):n({width:this._canvasElementClientSize.width*s,height:this._canvasElementClientSize.height*s});this._suggestNewBitmapSize(l)}}},e.prototype._initResizeObserver=function(){var e=this;null!==this._canvasElement&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var i=t.find(function(t){return t.target===e._canvasElement});if(i&&i.devicePixelContentBoxSize&&i.devicePixelContentBoxSize[0]){var r=i.devicePixelContentBoxSize[0],s=n({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(s)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:"device-pixel-content-box"}))},e}();function l(e,t){if("device-pixel-content-box"===t.type)return new a(e,t.transform,t.options);throw Error("Unsupported binding target")}function o(e){return e.ownerDocument.defaultView}var u=function(){function e(e,t,i){if(0===t.width||0===t.height)throw TypeError("Rendering target could only be created on a media with positive width and height");if(this._mediaSize=t,0===i.width||0===i.height)throw TypeError("Rendering target could only be created using a bitmap with positive integer width and height");this._bitmapSize=i,this._context=e}return e.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}finally{this._context.restore()}},e.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(e.prototype,"_horizontalPixelRatio",{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_verticalPixelRatio",{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),e}();function c(e,t){var i=e.canvasElementClientSize;if(0===i.width||0===i.height)return null;var n=e.bitmapSize;if(0===n.width||0===n.height)return null;var r=e.canvasElement.getContext("2d",t);return null===r?null:new u(r,i,n)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.