class Portal{constructor(n){this.name=n;this.defaultStockId=11111024;Portal.setStockIndexIsActive(this.defaultStockId)}Init(){this.setStockIsActive()}setStockIsActive(){let n=!1,t=$(".c-portal__stocktab");t.click(function(){n||(n=!0,t.parent().removeClass("is-active"),$(this).parent().addClass("is-active"),$.ajax({url:baseUrl+"Home/Portal/Jsondata.aspx",data:{stock:$(this).data("stockname")},dataType:"html",success:function(n){let t=$(".c-portal__ajax-data");t.html(n);let i=$(".c-portal__stockrow.is-active");Portal.setStockIndexIsActive(Number(i.find("a").data("paperid")))},complete:function(){n=!1}}))})}static setStockIndexIsActive(n){let u=$(".c-portal__stock"),f=$(".c-finance__stock-graph"),t=$(".c-portal__stock .c-portal__stockrow-link");t.on("click",function(){let n=t.parent(".c-portal__stockrow");n.removeClass("is-active");let i=$(this).parents(".c-portal__stockrow");i.addClass("is-active");let r=Number($(".c-finance__stock-graph").data("graphtype")),u=new Stock("c-finance__stock-graph","",$(this).data("paperid"),r);u.Init()});let i=Number($(".c-finance__stock-graph").data("graphtype")),r=new Stock("c-finance__stock-graph","",n,i);r.Init()}}$(function(){let n=$(".c-portal__stock");if(n!==""&&typeof n!="undefined"&&n!=="null"&&n.length>0){let n=new Portal("ny");n.Init()}});class Stock{constructor(n,t,i,r){this.renderedElementSelector=n;this.stockName=t;this.paperId=i;this.graphType=r}Init(){let n=this;Stock.submitStockRequest(n)}static submitStockRequest(n){n.paperId>0&&n.graphType!==null&&typeof n.graphType!="undefined"&&$.ajax({type:"get",url:baseUrl+"Finance/GetStockGraphdata/Jsondata.aspx",data:{paperId:n.paperId,graphType:n.graphType},contentType:"application/json; charset=utf-8",context:self,datatype:"json",beforeSend:function(){let t=$('<div class="showbox"> <div class="loader_js"> <svg class="circular" viewBox="25 25 50 50"> <circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/> <\/svg> <\/div> <\/div>');t.appendTo($("#"+n.renderedElementSelector))}}).done(function(t){if(t!==""&&typeof t!="undefined"&&t!=="null"){let i=$.parseJSON(t),r=Object.values(i.map(n=>Object.values(n)));Stock.BuildStockGraph(r,n)}else $("#"+n.renderedElementSelector).hide()}).fail(function(n){console.log("error",n.responseText)})}static MinMax(n){let t=n.map(n=>n[1]);return{min:Math.min.apply(null,t),max:Math.max.apply(null,t)}}static BuildStockGraph(n,t){var i="%d/%m/%Y %H:%M",r=12,u;switch(t.graphType){case 0:r=14;i="%H:%M";break;case 1:case 2:r=10;i="%d/%m";break;case 3:case 4:case 5:case 6:case 7:r=12;i="%m/%y";break;default:i="%d/%m/%Y %H:%M";r=12}u=Stock.MinMax(n);$.jqplot._noToImageButton=!0;$.jqplot(t.renderedElementSelector,[n],{gridPadding:{top:t.stockName===""?50:100,left:40,right:5,bottom:20},seriesColors:["#c7c7c7"],title:t.stockName,highlighter:{show:!0,sizeAdjust:.1,tooltipOffset:10},grid:{shadow:!1,background:"#fff",drawBorder:!1,gridLineColor:"#9a9a9a",gridLineWidth:1},legend:{show:!1,placement:"outside"},seriesDefaults:{shadow:!1,rendererOptions:{smooth:!1,animation:{show:!1}},showMarker:!1},series:[{fill:!0,fillAndStroke:!0,fillColor:"#c7c7c7"}],axesDefaults:{show:!1,ticks:[],numberTicks:undefined,renderer:$.jqplot.LinearAxisRenderer,rendererOptions:{},tickOptions:{mark:"inside",showMark:!1,showGridline:!0,markSize:1,show:!0,showLabel:!0},showTicks:!0,showTickMarks:!0},axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer,min:n[0][0],max:n[n.length-1][0],pad:0,show:!0,tickOptions:{formatString:i,show:!0,showMark:!0,textColor:"#000"},numberTicks:r,drawMajorGridlines:!1},yaxis:{renderer:$.jqplot.LinearAxisRenderer,min:u.min,max:u.max,pad:0,rendererOptions:{minorTicks:0},tickOptions:{formatString:"%#.2f",showMark:!0,show:!0,angle:0,textColor:"#aeaeae"},numberTicks:3,drawMajorGridlines:!1}}}).replot();Stock.GraphTypeBar(t)}static GraphTypeBar(n){var r=$("<li />",{"class":"c-finance__stock-graphtype STATE_1D","data-graphtype":0,text:"1D"}),u=$("<li />",{"class":"c-finance__stock-graphtype STATE_10D","data-graphtype":1,text:"10D"}),f=$("<li />",{"class":"c-finance__stock-graphtype STATE_1M","data-graphtype":2,text:"1M"}),e=$("<li />",{"class":"c-finance__stock-graphtype STATE_3M","data-graphtype":3,text:"3M"}),o=$("<li />",{"class":"c-finance__stock-graphtype STATE_1Y","data-graphtype":4,text:"1Y"}),s=$("<li />",{"class":"c-finance__stock-graphtype STATE_3Y","data-graphtype":5,text:"3Y"}),h=$("<li />",{"class":"c-finance__stock-graphtype STATE_YDT","data-graphtype":6,text:"YTD"}),c=$("<li />",{"class":"c-finance__stock-graphtype STATE_MAX","data-graphtype":7,text:"MAX"}),i;let t=$("<ul />",{"class":"c-finance__stock-bar"}).append(r,u,f,e,h,o,s,c);i=Stock;t.on("click","li",function(){n.graphType=$(this).data("graphtype");i.submitStockRequest(n)});let l=$("#"+n.renderedElementSelector).find(".jqplot-title");l.after(t);t.find('li[data-graphtype="'+n.graphType+'"]').addClass("is-active")}}$(function(){let n=$(".s-finance-stock-content");if(n!==""&&typeof n!="undefined"&&n!=="null"&&n.length>0){let n=$(".c-finance__stock-graph").data("stockname"),t=Number($(".c-finance__stock-graph").data("paperid")),i=Number($(".c-finance__stock-graph").data("graphtype")),r=new Stock("c-finance__stock-graph",n,t,i);r.Init()}});$(function(){if(dcPath.Type==="Home"){let n=document.querySelectorAll(".s-video-content");n=n.length>0?n[0]:null;n!==null&&($(n).after("<div id='taboola-taboola-mid-page'><\/div>"),setTimeout(()=>{window._taboola=window._taboola||[],_taboola.push({mode:"thumbnails-g",container:"taboola-taboola-mid-page",placement:"Taboola Mid Page",target_type:"mix"})},500))}})