@deephaven/embed-chart 0.38.1-beta.7 → 0.38.1-chart-refactor.20

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.
@@ -0,0 +1,2 @@
1
+ var pe=Object.defineProperty;var ge=(f,s,e)=>s in f?pe(f,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):f[s]=e;var u=(f,s,e)=>(ge(f,typeof s!="symbol"?s+"":s,e),e);import{H as de,A as $,G as le,I as me,J as X,C as W,K as fe,L as Z}from"./vendor-c6328e9a.js";import{L as te,d as Ee,v as ye,a as Se,b as Te}from"./index-1c678b43.js";import{a as G,T as se,D as Ae,F as ie,b as De,u as Fe,c as be,C as xe}from"./useConnection-f786b0a3.js";import{P as ee,b as Ne,h as we,p as Pe,o as Le,s as Ie,t as Oe,c as oe}from"./plotly-b153f4cb.js";import"./helpers-042e6b4d.js";ee.register([Ne,we,Pe,Le,Ie,Oe]);const Me=typeof oe=="function"?oe(ee):oe.default(ee),L=class{constructor(){u(this,"listeners");u(this,"formatter");u(this,"rect");u(this,"isDownsamplingDisabled");u(this,"title");this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(s){}close(){}setFormatter(s){this.formatter=s}setDownsamplingDisabled(s){this.isDownsamplingDisabled=s}setDimensions(s){this.rect=s}setTitle(s){this.title=s}subscribe(s){this.listeners.push(s)}unsubscribe(s){this.listeners=this.listeners.filter(e=>e!==s)}fireEvent(s){for(let e=0;e<this.listeners.length;e+=1)this.listeners[e](s)}fireUpdate(s){this.fireEvent(new CustomEvent(L.EVENT_UPDATED,{detail:s}))}fireDisconnect(){this.fireEvent(new CustomEvent(L.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(L.EVENT_RECONNECT))}fireDownsampleStart(s){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLESTARTED,{detail:s}))}fireDownsampleFinish(s){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFINISHED,{detail:s}))}fireDownsampleFail(s){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLEFAILED,{detail:s}))}fireDownsampleNeeded(s){this.fireEvent(new CustomEvent(L.EVENT_DOWNSAMPLENEEDED,{detail:s}))}fireLoadFinished(){this.fireEvent(new CustomEvent(L.EVENT_LOADFINISHED))}};let w=L;u(w,"EVENT_UPDATED","ChartModel.EVENT_UPDATED"),u(w,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT"),u(w,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT"),u(w,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED"),u(w,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED"),u(w,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED"),u(w,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED"),u(w,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");const M=w,Re="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",Ce="#403e41",ve="#5b5a5c",ke="#c0bfbf",_e="#4878ea",Ve="rgba(91, 90, 92, 0.7)",T={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Re,gridcolor:Ce,linecolor:ve,zerolinecolor:ke,activecolor:_e,rangebgcolor:Ve,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},I=Object.freeze({paper_bgcolor:T["paper-bgcolor"],plot_bgcolor:T["plot-bgcolor"],title_color:T["title-color"],colorway:T.colorway,gridcolor:T.gridcolor,linecolor:T.linecolor,zerolinecolor:T.zerolinecolor,activecolor:T.activecolor,rangebgcolor:T.rangebgcolor,area_color:T["area-color"],trend_color:T["trend-color"],line_color:T["line-color"],error_band_line_color:T["error-band-line-color"],error_band_fill_color:T["error-band-fill-color"],ohlc_increasing:T["ohlc-increasing"],ohlc_decreasing:T["ohlc-decreasing"]}),j=te.module("ChartUtils"),ce="io.deephaven.time.DateTime",He=36e5,Ue=1e6;function $e(f){return f.asDate!==void 0}function We(f){return f.asNumber!==void 0}function ue(f){return f.dhTimeZone!==void 0}function Be(f){return f!=null&&f.range!=null&&(f.autorange===!1||f.autorange===void 0)}const d=class{constructor(s){u(this,"dh");u(this,"daysOfWeek");this.dh=s,this.daysOfWeek=Object.freeze(s.calendar.DayOfWeek.values())}static getPlotlyErrorBars(s,e,t){const i=t.map((n,r)=>n-s[r]),o=e.map((n,r)=>s[r]-n);return{type:"data",symmetric:!1,array:i,arrayminus:o}}static convertNumberPrefix(s){return s.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(s,e,t){if(!t)return null;const o=t.split(";")[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);G(o);const[,n,r,a,,c,l,h,p,m]=o,g=a.replace(",","").length,S=r.indexOf(",")>=0||a.indexOf(",")>=0?",":"",b=h!=null&&h!==""?"e":"f",E=p!==""?p:b,N=c.length+l.length,x=`0${g}${S}.${N}${E}`,V=d.convertNumberPrefix(n),R=d.convertNumberPrefix(m);return{tickformat:x,tickprefix:V,ticksuffix:R,automargin:!0}}static addTickSpacing(s,e,t){const{gapBetweenMajorTicks:i}=e;if(i>0){const o=s||{};let n=i;return t&&(n=i/Ue),e.log&&(n=Math.log(n)),o.tickmode="linear",o.dtick=n,o}return s}static getSourceForAxis(s,e){for(let t=0;t<s.series.length;t+=1){const i=s.series[t];for(let o=0;o<i.sources.length;o+=1){const n=i.sources[o];if(n.axis===e)return n}}return null}static getSeriesVisibility(s,e){return e!=null&&e.hiddenSeries!=null&&e.hiddenSeries.includes(s)?"legendonly":!0}static getHiddenLabels(s){return s!=null&&s.hiddenSeries?[...s.hiddenSeries]:[]}static makeSeriesData(s,e,t,i,o=d.ORIENTATION.VERTICAL){return{type:s,mode:e,name:t,orientation:o,showlegend:i??void 0}}static getMarkerSymbol(s){switch(s){case"SQUARE":return"square";case"CIRCLE":return"circle";case"DIAMOND":return"diamond";case"UP_TRIANGLE":return"triangle-up";case"DOWN_TRIANGLE":return"triangle-down";case"RIGHT_TRIANGLE":return"triangle-right";case"LEFT_TRIANGLE":return"triangle-left";case"ELLIPSE":case"HORIZONTAL_RECTANGLE":case"VERTICAL_RECTANGLE":default:throw new Error(`Unrecognized shape ${s}`)}}static getAllAxes(s){return s.charts.reduce((e,t)=>[...e,...t.axes],[])}static getChartForSeries(s,e){const{charts:t}=s;for(let i=0;i<t.length;i+=1){const o=t[i];for(let n=0;n<o.series.length;n+=1)if(e===o.series[n])return o}return null}static getLayoutRanges(s){const e={},t=Object.keys(s).filter(i=>i.indexOf("axis")>=0);for(let i=0;i<t.length;i+=1){const o=t[i],n=s[o];Be(n)&&(e[o]=[...n.range])}return e}static getAxisLayoutProperty(s,e){const t=e>0?`${e+1}`:"";return`${s??""}axis${t}`}static periodToDecimal(s){const e=s.split(":");return Number(e[0])+Number(e[1])/60}static groupArray(s,e){return s.reduce((t,i)=>{const o=i[e],n=t.get(o)??[];return n.push(i),t.set(o,n),t},new Map)}static getColorwayFromTheme(s=I){let e=[];return s.colorway&&(Array.isArray(s.colorway)?e=s.colorway:typeof s.colorway=="string"?e=s.colorway.split(" "):j.warn(`Unable to handle colorway property: ${s.colorway}`)),e}static titleFromSettings(s){const{series:e,xAxis:t,title:i=`${(e??[]).join(", ")} by ${t}`}=s;return i}getAxisFormats(s,e){const t=new Map,i={tickformat:null,ticksuffix:null},o=d.getAllAxes(s),n=d.groupArray(o,"type"),{charts:r}=s;for(let a=0;a<r.length;a+=1){const c=r[a];for(let l=0;l<c.series.length;l+=1){const h=c.series[l],{sources:p}=h,m=p.filter(g=>g.axis);for(let g=0;g<m.length;g+=1){const A=m[g],{axis:S}=A,{type:b}=S,E=n.get(b);G(E);const N=E.indexOf(S),P=this.getAxisPropertyName(b);if(P!=null){const x=d.getAxisLayoutProperty(P,N);if(t.has(x))j.debug(`${x} already added.`);else{j.debug(`Adding ${x} to axisFormats.`);const V=this.getPlotlyAxisFormat(A,e);if(V===null)t.set(x,i);else{t.set(x,V);const{businessCalendar:R}=S;if(R!=null){const O=[],{businessPeriods:v,businessDays:q,holidays:H,timeZone:U}=R,z=e==null?void 0:e.getColumnTypeFormatter(ce);let k;ue(z)&&(k=z.dhTimeZone);const K=k?(U.standardOffset-k.standardOffset)/60:0;H.length>0&&O.push(...this.createRangeBreakValuesFromHolidays(H,U,k)),v.forEach(_=>O.push({pattern:"hour",bounds:[d.periodToDecimal(_.close)+K,d.periodToDecimal(_.open)+K]})),q.length<this.daysOfWeek.length&&this.createBoundsFromDays(q).forEach(_=>O.push({pattern:"day of week",bounds:_})),V.rangebreaks=O}if(t.size===c.axes.length)return t}}}}}}return t}getPlotlyChartType(s,e){const{dh:t}=this;switch(s){case t.plot.SeriesPlotStyle.SCATTER:return e?"scatter":"scattergl";case t.plot.SeriesPlotStyle.LINE:return"scatter";case t.plot.SeriesPlotStyle.BAR:case t.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case t.plot.SeriesPlotStyle.PIE:return"pie";case t.plot.SeriesPlotStyle.TREEMAP:return"treemap";case t.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case t.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(s,e,t){const{dh:i}=this,o=new Set;switch(s){case i.plot.SeriesPlotStyle.SCATTER:(e??!1)&&o.add(d.MODE_LINES),(t??!0)&&o.add(d.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(e??!0)&&o.add(d.MODE_LINES),(t??!1)&&o.add(d.MODE_MARKERS);break}return o.size>0?[...o].join("+"):void 0}getPlotlyProperty(s,e){const{dh:t}=this;switch(s){case t.plot.SeriesPlotStyle.PIE:switch(e){case t.plot.SourceType.X:return"labels";case t.plot.SourceType.Y:return"values"}break;case t.plot.SeriesPlotStyle.OHLC:switch(e){case t.plot.SourceType.TIME:return"x"}break;case t.plot.SeriesPlotStyle.TREEMAP:switch(e){case t.plot.SourceType.X:return"ids";case t.plot.SourceType.Y:return"values";case t.plot.SourceType.LABEL:return"labels";case t.plot.SourceType.PARENT:return"parents";case t.plot.SourceType.COLOR:return"marker.colors"}break}switch(e){case t.plot.SourceType.X:return"x";case t.plot.SourceType.Y:return"y";case t.plot.SourceType.Z:return"z";case t.plot.SourceType.X_LOW:return"xLow";case t.plot.SourceType.X_HIGH:return"xHigh";case t.plot.SourceType.Y_LOW:return"yLow";case t.plot.SourceType.Y_HIGH:return"yHigh";case t.plot.SourceType.TIME:return"time";case t.plot.SourceType.OPEN:return"open";case t.plot.SourceType.HIGH:return"high";case t.plot.SourceType.LOW:return"low";case t.plot.SourceType.CLOSE:return"close";case t.plot.SourceType.SHAPE:return"shape";case t.plot.SourceType.SIZE:return"size";case t.plot.SourceType.LABEL:return"label";case t.plot.SourceType.COLOR:return"color";case t.plot.SourceType.PARENT:return"parent";case t.plot.SourceType.HOVER_TEXT:return"hovertext";case t.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${e}`)}}getPlotlySeriesOrientation(s){var i,o;const{dh:e}=this,{sources:t}=s;return t.length===2&&((o=(i=t[0])==null?void 0:i.axis)==null?void 0:o.type)===e.plot.AxisType.Y?d.ORIENTATION.HORIZONTAL:d.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(s,e,t,i=null,o=I){const{name:n,isLinesVisible:r,isShapesVisible:a,plotStyle:c,lineColor:l,shapeColor:h,sources:p,shape:m,shapeSize:g}=s,A=p.some(P=>{var x;return(x=P.axis)==null?void 0:x.businessCalendar}),S=this.getChartType(c,A),b=this.getPlotlyChartMode(c,r??void 0,a??void 0),E=this.getPlotlySeriesOrientation(s),N=d.makeSeriesData(S,b,n,i,E);return this.addSourcesToSeriesData(N,c,p,e),this.addStylingToSeriesData(N,c,o,l,h,m,g,t),N}addSourcesToSeriesData(s,e,t,i){const o=s;for(let n=0;n<t.length;n+=1){const r=t[n],{axis:a,type:c}=r,l=this.getPlotlyProperty(e,c);de(o,l,[]);const h=a!=null?this.getAxisPropertyName(a.type):null;if(h!=null){const p=i.get(a.type);if(p){const m=p.indexOf(a),g=m>0?`${m+1}`:"";o[`${h}axis`]=`${h}${g}`}}}}addStylingToSeriesData(s,e,t=I,i=null,o=null,n=null,r=null,a=null){const{dh:c}=this,l=s;if(l.marker={line:{}},l.line={width:1},e===c.plot.SeriesPlotStyle.AREA?l.fill="tozeroy":e===c.plot.SeriesPlotStyle.STACKED_AREA?l.stackgroup="stack":e===c.plot.SeriesPlotStyle.STEP?l.line.shape="hv":e===c.plot.SeriesPlotStyle.HISTOGRAM?(l.width=[],l.marker.line!==void 0&&Object.assign(l.marker.line,{color:t.paper_bgcolor,width:1})):e===c.plot.SeriesPlotStyle.OHLC?(l.increasing={line:{color:t.ohlc_increasing}},l.decreasing={line:{color:t.ohlc_decreasing}}):e===c.plot.SeriesPlotStyle.PIE?(l.textinfo="label+percent",l.outsidetextfont={color:t.title_color}):e===c.plot.SeriesPlotStyle.TREEMAP&&(l.hoverinfo="text",l.textinfo="label+text",l.tiling={packing:"squarify",pad:0},l.textposition="middle center",l.outsidetextfont={color:t.title_color}),i!=null&&(e===c.plot.SeriesPlotStyle.BAR?l.marker.color=i:l.line.color=i),o!=null&&(l.marker.color=o),n!=null&&n.length>0)try{l.marker.symbol=d.getMarkerSymbol(n)}catch(h){j.warn("Unable to handle shape",n,":",h)}r!=null&&(l.marker.size=r*d.DEFAULT_MARKER_SIZE),a!=null&&e!==c.plot.SeriesPlotStyle.PIE&&(l.visible=a)}getChartType(s,e){const{dh:t}=this;switch(s){case t.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(s,e)}}getAxisPropertyName(s){const{dh:e}=this;switch(s){case e.plot.AxisType.X:return"x";case e.plot.AxisType.Y:return"y";default:return null}}getAxisSide(s){const{dh:e}=this;switch(s){case e.plot.AxisPosition.BOTTOM:return"bottom";case e.plot.AxisPosition.TOP:return"top";case e.plot.AxisPosition.LEFT:return"left";case e.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(s,e,t,i=0,o=0,n=I){const r=s,a=d.getAllAxes(e);for(let c=0;c<e.charts.length;c+=1){const l=e.charts[c],h=t==null?void 0:t(l),p=this.getChartBounds(e,l,i,o);this.updateLayoutAxes(r,l.axes,a,i,o,p,h,n)}this.removeStaleAxes(r,a)}getChartBounds(s,e,t,i){const{dh:o}=this,{cols:n,rows:r}=s,{column:a,colspan:c,row:l,rowspan:h}=e,p=a+c,m=l+h,g=1/n,A=1/r,S=d.AXIS_SIZE_PX/t,b=d.AXIS_SIZE_PX/i,E={bottom:(r-m)*A+(m<r?b/2:0),top:(r-l)*A-(l>0?b/2:0),left:a*g+(a>0?S/2:0),right:p*g-(p<n?S/2:0)};return(d.groupArray(e.axes,"position").get(o.plot.AxisPosition.RIGHT)??[]).length>0&&(t>0?E.right-=(E.right-E.left)*Math.max(0,Math.min(d.LEGEND_WIDTH_PX/t,d.MAX_LEGEND_SIZE)):E.right-=(E.right-E.left)*d.DEFAULT_AXIS_SIZE),E}getPlotlyDateFormat(s,e,t){const{dh:i}=this,o=t==null?void 0:t.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let n;const r=s==null?void 0:s.getColumnTypeFormatter(e);return r!=null&&ue(r)&&r.dhTimeZone!=null&&r.showTimeZone&&(n=i.i18n.DateTimeFormat.format(" z",new Date,r.dhTimeZone)),{tickformat:o,ticksuffix:n,automargin:!0}}getPlotlyAxisFormat(s,e=null){const{dh:t}=this,{axis:i,columnType:o}=s,{formatPattern:n}=i;let r=null;return se.isDateType(o)?(r=this.getPlotlyDateFormat(e,o,n),r=d.addTickSpacing(r,i,!0)):se.isNumberType(o)&&(r=d.getPlotlyNumberFormat(e,o,n),r=d.addTickSpacing(r,i,!1)),i.formatType===t.plot.AxisFormatType.CATEGORY&&(r?r.type="category":r={type:"category",tickformat:void 0,ticksuffix:void 0}),r}updateLayoutAxes(s,e,t,i=0,o=0,n={left:0,top:0,right:1,bottom:1},r,a=I){const{dh:c}=this,l=i>0?Math.max(d.MIN_AXIS_SIZE,Math.min(d.AXIS_SIZE_PX/o,d.MAX_AXIS_SIZE)):d.DEFAULT_AXIS_SIZE,h=o>0?Math.max(d.MIN_AXIS_SIZE,Math.min(d.AXIS_SIZE_PX/i,d.MAX_AXIS_SIZE)):d.DEFAULT_AXIS_SIZE,p=s,m=d.groupArray(e,"position"),g=d.groupArray(e,"type"),A=[...g.keys()],S=d.groupArray(t,"type");for(let b=0;b<A.length;b+=1){const E=A[b],N=this.getAxisPropertyName(E);if(N!=null){const P=g.get(E),x=S.get(E),R=E===c.plot.AxisType.Y?o:i;G(P),G(x);for(let O=0;O<P.length;O+=1){const v=P[O],q=x.indexOf(v),H=d.getAxisLayoutProperty(N,q);p[H]==null&&(p[H]=this.makeLayoutAxis(E,a));const U=p[H];if(U!=null){this.updateLayoutAxis(U,v,O,m,l,h,n);const{range:z,autorange:k}=U;if(r!=null&&z!==void 0&&(k===void 0||k===!1)){const K=r(v),[_,ae]=K(z);j.debug("Setting downsample range",R,_,ae),v.range(R,_,ae)}else v.range(R)}}}}}removeStaleAxes(s,e){const t=s,i=d.groupArray(e,"type"),o=[...i.keys()];for(let n=0;n<o.length;n+=1){const r=o[n],a=i.get(r);G(a);let c=a.length;const l=this.getAxisPropertyName(r);if(l!=null){let h=d.getAxisLayoutProperty(l,c);for(;t[h]!=null;)delete t[h],c+=1,h=d.getAxisLayoutProperty(l,c)}}}updateLayoutAxis(s,e,t,i,o,n,r){const{dh:a}=this,l=e.type===a.plot.AxisType.Y?n:o,h=s,p=e.label??"";if(h.title!==void 0&&typeof h.title!="string"?h.title.text=p:h.title={text:p},e.log&&(h.type="log"),h.side=this.getAxisSide(e.position),t>0){h.overlaying=this.getAxisPropertyName(e.type)??void 0;const m=i.get(e.position)??[],g=m.indexOf(e);g>0&&(h.anchor="free",e.position===a.plot.AxisPosition.RIGHT?h.position=r.right+(g-m.length+1)*l:e.position===a.plot.AxisPosition.TOP?h.position=r.top+(g-m.length+1)*l:e.position===a.plot.AxisPosition.BOTTOM?h.position=r.bottom+(m.length-g+1)*l:e.position===a.plot.AxisPosition.LEFT&&(h.position=r.left+(m.length-g+1)*l))}else if(e.type===a.plot.AxisType.X){const m=i.get(a.plot.AxisPosition.LEFT)||[],g=i.get(a.plot.AxisPosition.RIGHT)||[],A=Math.max(r.left,r.left+(m.length-1)*n),S=Math.min(r.right-(g.length-1)*n,r.right);h.domain=[A,S]}else if(e.type===a.plot.AxisType.Y){const m=i.get(a.plot.AxisPosition.BOTTOM)||[],g=i.get(a.plot.AxisPosition.TOP)||[],A=Math.max(r.bottom,r.bottom+(m.length-1)*o),S=Math.min(r.top-(g.length-1)*o,r.top);h.domain=[A,S]}}createBoundsFromDays(s){const e=s.map(n=>this.daysOfWeek.indexOf(n)),t=this.daysOfWeek.filter(n=>!s.includes(n)).map(n=>this.daysOfWeek.indexOf(n)),i=new Set;t.forEach(n=>{for(let r=n+1;r<n+this.daysOfWeek.length;r+=1){const a=r%this.daysOfWeek.length;if(e.includes(a)){i.add(a);break}}});const o=[];return i.forEach(n=>{for(let r=n-1;r>n-this.daysOfWeek.length;r-=1){const a=r<0?r+this.daysOfWeek.length:r;if(e.includes(a)){const c=(a+1)%7;o.push([c,n]);break}}}),o}createRangeBreakValuesFromHolidays(s,e,t){const i=[],o=[];return s.forEach(n=>{n.businessPeriods.length>0?o.push(...this.createPartialHoliday(n,e,t)):i.push(this.createFullHoliday(n,e,t))}),[{values:i},...o]}createFullHoliday(s,e,t){return this.adjustDateForTimeZone(`${s.date.toString()} 00:00:00.000000`,e,t)}createPartialHoliday(s,e,t){const i=s.date.toString(),o=["00:00"];s.businessPeriods.forEach(r=>{o.push(r.open),o.push(r.close)}),o.push("24:00");const n=[];for(let r=0;r<o.length;r+=2){const a=o[r],c=o[r+1];if(a!==c){const l=[this.adjustDateForTimeZone(`${i} ${a}:00.000000`,e,t)],h=He*(d.periodToDecimal(c)-d.periodToDecimal(a));n.push({values:l,dvalue:h})}}return n}adjustDateForTimeZone(s,e,t){return t&&t.standardOffset!==e.standardOffset?this.unwrapValue(this.wrapValue(s,ce,e),t):s}makeFigureSettings(s,e){const{dh:t}=this,{series:i,xAxis:o,type:n}=s,r=d.titleFromSettings(s),a={formatType:`${t.plot.AxisFormatType.NUMBER}`,type:`${t.plot.AxisType.X}`,position:`${t.plot.AxisPosition.BOTTOM}`},c={formatType:`${t.plot.AxisFormatType.NUMBER}`,type:`${t.plot.AxisType.Y}`,position:`${t.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${t.plot.ChartType.XY}`,axes:[a,c],series:(i??[]).map(l=>({plotStyle:`${n}`,name:l,dataSources:[{type:`${t.plot.SourceType.X}`,columnName:o??"",axis:a,table:e},{type:`${t.plot.SourceType.Y}`,columnName:l,axis:c,table:e}]}))}],title:r}}unwrapValue(s,e){const{dh:t}=this;if(s!=null){if($e(s))return t.i18n.DateTimeFormat.format(d.DATE_FORMAT,s,e);if(We(s))return s.asNumber()}return s}wrapValue(s,e,t=null){const{dh:i}=this;if(se.isDateType(e)&&typeof s=="string"){const o=s,n=d.DATE_FORMAT.substr(0,s.length),r=i.i18n.DateTimeFormat.parse(n,o);if(!t)return r;const a=`${n} Z`,c=i.i18n.DateTimeFormat.format("Z",r,t),l=i.i18n.DateTimeFormat.parse(a,`${o} ${c}`),h=i.i18n.DateTimeFormat.format("Z",l,t);return i.i18n.DateTimeFormat.parse(a,`${o} ${h}`)}return s}makeLayoutAxis(s,e=I){const{dh:t}=this,i={automargin:!0,gridcolor:e.gridcolor,linecolor:e.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:e.paper_bgcolor,tickfont:{color:e.zerolinecolor},title:{font:{color:e.title_color}}};return s===t.plot.AxisType.X?Object.assign(i,{showgrid:!0}):s===t.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:e.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(s=I){const{dh:e}=this,t={...s,autosize:!0,colorway:d.getColorwayFromTheme(s),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:s.title_color},yanchor:"top",pad:{...d.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:s.title_color}},margin:{...d.DEFAULT_MARGIN},xaxis:this.makeLayoutAxis(e.plot.AxisType.X,s),yaxis:this.makeLayoutAxis(e.plot.AxisType.Y,s),polar:{angularaxis:this.makeLayoutAxis(e.plot.AxisType.SHAPE,s),radialaxis:this.makeLayoutAxis(e.plot.AxisType.SHAPE,s),bgcolor:s.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(e.plot.AxisType.X,s),yaxis:this.makeLayoutAxis(e.plot.AxisType.Y,s),zaxis:this.makeLayoutAxis(e.plot.AxisType.Z,s)}};return t.datarevision=0,t}hydrateSettings(s){const{dh:e}=this;return{...s,type:s.type!=null?e.plot.SeriesPlotStyle[s.type]:void 0}}};let y=d;u(y,"DEFAULT_AXIS_SIZE",.15),u(y,"MIN_AXIS_SIZE",.025),u(y,"MAX_AXIS_SIZE",.2),u(y,"AXIS_SIZE_PX",75),u(y,"LEGEND_WIDTH_PX",50),u(y,"MAX_LEGEND_SIZE",.25),u(y,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"})),u(y,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS"),u(y,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0})),u(y,"DEFAULT_TITLE_PADDING",Object.freeze({t:8})),u(y,"SUBTITLE_LINE_HEIGHT",25),u(y,"DEFAULT_MARKER_SIZE",6),u(y,"MODE_MARKERS","markers"),u(y,"MODE_LINES","lines");const F=y;const C=te.module("Chart"),B=class extends $.Component{constructor(e){super(e);u(this,"currentSeries");u(this,"plot");u(this,"plotWrapper");u(this,"columnFormats");u(this,"dateTimeFormatterOptions");u(this,"decimalFormatOptions");u(this,"integerFormatOptions");u(this,"rect");u(this,"ranges");u(this,"isSubscribed");u(this,"isLoadedFired");u(this,"getCachedConfig",me((e,t,i,o,n)=>{const r=[],a=Boolean(e);if(a&&r.push({name:`Downsampling failed: ${e}`,click:()=>{},icon:B.convertIcon(Ee),attr:"fill-warning"}),t||i||o||a){const c=B.downsampleButtonTitle(i,o),l=B.downsampleButtonAttr(i,o),h=i?ye:Se;r.push({name:c,icon:B.convertIcon(h),click:this.handleDownsampleClick,attr:l})}return{displaylogo:!1,displayModeBar:i||a?!0:"hover",modeBarButtons:[r,["toImage"],n?["zoom3d","pan3d"]:["zoom2d","pan2d"],n?["orbitRotation","tableRotation","resetCameraDefault3d"]:["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}));this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=le.createRef(),this.plotWrapper=le.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.isSubscribed=!1,this.isLoadedFired=!1,this.currentSeries=0,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(e){const[t,,,,i]=e.icon,o=`${i}`;return{width:t,path:o,ascent:t,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,t){return e?"Downsampling in progress...":t?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,t){return e?"animation-spin":t?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:t,settings:i}=this.props;this.updateFormatterSettings(i),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e;return((e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())??null}initData(){const{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:{...t,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){C.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){const{type:t,detail:i}=e;switch(C.debug2("Received data update",t,i),t){case M.EVENT_UPDATED:{this.currentSeries+=1,this.setState(n=>{const{layout:r,revision:a}=n;return typeof r.datarevision=="number"&&(r.datarevision+=1),{data:i,layout:r,revision:a+1}});const{onUpdate:o}=this.props;o({isLoading:!this.isLoadedFired});break}case M.EVENT_LOADFINISHED:{const{onUpdate:o}=this.props;this.isLoadedFired=!0,o({isLoading:!1});break}case M.EVENT_DISCONNECT:{const{onDisconnect:o}=this.props;o();break}case M.EVENT_RECONNECT:{const{onReconnect:o}=this.props;o();break}case M.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case M.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case M.EVENT_DOWNSAMPLENEEDED:case M.EVENT_DOWNSAMPLEFAILED:{const o=i.message??i;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});const{onError:n}=this.props;n(new Error(o));break}default:C.debug("Unknown event type",t,e)}}handlePlotUpdate(e){const{layout:t}=e,i=F.getLayoutRanges(t);!X(i,this.ranges)&&(this.ranges=i,this.updateModelDimensions(!0))}handleRelayout(e){if(C.debug("handleRelayout",e),e.hiddenlabels!=null){const{onSettingsChanged:t}=this.props,i=[...e.hiddenlabels];t({hiddenSeries:i})}this.updateModelDimensions()}handleRestyle([e,t]){if(C.debug("handleRestyle",e,t),Object.keys(e).includes("visible")){const{data:i}=this.state,{onSettingsChanged:o}=this.props;if(i!=null){const n=i.reduce((r,{name:a,visible:c})=>a!=null&&c==="legendonly"?[...r,a]:r,[]);o({hiddenSeries:n})}}}updateModelDimensions(e=!1){const t=this.getPlotRect();if(!t){C.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==t.width||this.rect.height!==t.height||e){this.rect=t;const{isActive:o,model:n}=this.props;n.setDimensions(t),o&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const t=ie.getColumnFormats(e),i=ie.getDateTimeFormatterOptions(e),{decimalFormatOptions:o={},integerFormatOptions:n={}}=e;(!X(this.columnFormats,t)||!X(this.dateTimeFormatterOptions,i)||!X(this.decimalFormatOptions,o)||!X(this.integerFormatOptions,n))&&(this.columnFormats=ie.getColumnFormats(e),this.dateTimeFormatterOptions=i,this.decimalFormatOptions=o,this.integerFormatOptions=n,this.updateFormatter())}updateFormatter(){const{dh:e}=this.props,t=new De(e,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:i}=this.props;i.setFormatter(t)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&ee.relayout(this.plot.current.el,{autosize:!0}).catch(t=>{C.debug("Unable to resize, promise rejected",t)})}render(){var p;const{PlotComponent:e}=this.props,{data:t,downsamplingError:i,isDownsampleFinished:o,isDownsampleInProgress:n,isDownsamplingDisabled:r,layout:a,revision:c}=this.state,l=this.getCachedConfig(i,o,n,r,((p=t==null?void 0:t[0].type)==null?void 0:p.includes("3d"))??!1),h=t!=null;return W.jsx("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:h&&W.jsx(e,{ref:this.plot,data:t,layout:a,revision:c,config:l,onAfterPlot:this.handleAfterPlot,onError:C.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}};let Q=B;u(Q,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Ae.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},PlotComponent:Me,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const ze=Q,D=te.module("FigureChartModel"),ne=class extends M{constructor(e,t,i={},o=I){super();u(this,"chartUtils");u(this,"dh");u(this,"figure");u(this,"settings");u(this,"theme");u(this,"data");u(this,"layout");u(this,"seriesDataMap");u(this,"pendingSeries");u(this,"oneClicks");u(this,"filterColumnMap");u(this,"lastFilter");u(this,"isConnected");u(this,"seriesToProcess");u(this,"addPendingSeries",fe(()=>{const e=F.getAllAxes(this.figure),{pendingSeries:t}=this;for(let i=0;i<t.length;i+=1){const o=t[i],n=this.figure.charts.find(r=>r.series.includes(o));this.addSeries(o,e,(n==null?void 0:n.showLegend)??null),o.subscribe()}this.pendingSeries=[]},ne.ADD_SERIES_DEBOUNCE));u(this,"getTimeZone",Z((e,t)=>{if(t!=null){const i=t.getColumnTypeFormatter(e);if(i!=null)return i.dhTimeZone}}));u(this,"getValueTranslator",Z((e,t)=>{const i=this.getTimeZone(e,t);return o=>this.chartUtils.unwrapValue(o,i)}));u(this,"getValueParser",Z((e,t)=>{const i=this.getTimeZone(e,t);return o=>this.chartUtils.wrapValue(o,e,i)}));u(this,"getRangeParser",Z((e,t)=>i=>{let[o,n]=i;const r=this.getValueParser(e,t);return o=r(o),n=r(n),[o,n]}));u(this,"getAxisRangeParser",Z((e,t)=>i=>{const o=F.getSourceForAxis(e,i);return o!=null?this.getRangeParser(o.columnType,t):n=>n}));this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.dh=e,this.chartUtils=new F(e),this.figure=t,this.settings=i,this.theme=o,this.data=[];const n={data:{},layout:this.chartUtils.makeDefaultLayout(o)};this.layout={grid:{rows:t.rows,columns:t.cols,pattern:"independent"},template:n},this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,t=F.getAllAxes(this.figure),i=[];for(let r=0;r<e.length;r+=1){const a=e[r];for(let c=0;c<a.series.length;c+=1){const l=a.series[c];i.push(l.name),this.addSeries(l,t,a.showLegend)}}const n=[...this.seriesDataMap.keys()].filter(r=>i.indexOf(r)<0);for(let r=0;r<n.length;r+=1){const a=n[r];this.seriesDataMap.delete(a)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,i){const{dh:o}=this,n=F.groupArray(t,"type"),r=this.chartUtils.makeSeriesDataFromSeries(e,n,F.getSeriesVisibility(e.name,this.settings),i,this.theme);if(this.seriesDataMap.set(e.name,r),this.data=[...this.seriesDataMap.values()],e.plotStyle===o.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===o.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=F.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===o.plot.SeriesPlotStyle.PIE?i??void 0:!1,e.oneClick!=null){const{oneClick:a}=e,{columns:c}=a;for(let l=0;l<c.length;l+=1)this.filterColumnMap.set(c[l].name,c[l]);this.oneClicks.push(a)}this.updateLayoutFormats()}subscribe(e){super.subscribe(e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(e){super.unsubscribe(e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){D.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?this.dh.plot.DownsampleOptions.DISABLE:this.dh.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){const{dh:e}=this;this.figure.addEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){const{dh:e}=this;this.figure.removeEventListener(e.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(e.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(e.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(e.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(e.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){D.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){D.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){D.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){D.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:t}=e,{series:i}=t;D.debug2("handleFigureUpdated",i);for(let n=0;n<i.length;n+=1){const r=i[n];D.debug2("handleFigureUpdated updating series",r.name);const{sources:a}=r;for(let c=0;c<a.length;c+=1){const l=a[c],{columnType:h,type:p}=l,m=this.getValueTranslator(h,this.formatter),g=t.getArray(r,p,m);this.setDataArrayForSeries(r,p,g)}this.seriesToProcess.delete(r.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(r)}const{data:o}=this;this.fireUpdate(o)}handleRequestFailed(e){D.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(e){super.setDownsamplingDisabled(e),this.resubscribe()}handleFigureDisconnected(e){D.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){D.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:t}=e;D.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var o;super.setTitle(e);const t=((o=(e??"").match(/<br>/g))==null?void 0:o.length)??0,i=F.DEFAULT_MARGIN.t+t*F.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=i:this.layout.margin={t:i},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title={...this.layout.title},this.layout.title.text=e,this.layout.title.pad={...this.layout.title.pad},this.layout.title.pad.t=F.DEFAULT_TITLE_PADDING.t+t*F.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-(((e=this.layout.margin)==null?void 0:e.l)??0)-(((t=this.layout.margin)==null?void 0:t.r)??0),0)}getPlotHeight(){var e,t;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-(((e=this.layout.margin)==null?void 0:e.t)??0)-(((t=this.layout.margin)==null?void 0:t.b)??0),0)}updateAxisPositions(){const e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,i=>this.getAxisRangeParser(i,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(!this.formatter)return;this.chartUtils.getAxisFormats(this.figure,this.formatter).forEach((t,i)=>{D.debug(`Assigning ${i}`,this.layout[i],t);const o=this.layout[i];o!=null?Object.assign(o,t):D.debug(`Ignoring null layout.${i}`)})}setDataArrayForSeries(e,t,i){const{name:o,plotStyle:n}=e,r=this.seriesDataMap.get(o),a=this.chartUtils.getPlotlyProperty(n,t);r&&de(r,a,i)}cleanSeries(e){const{dh:t}=this,{name:i,plotStyle:o}=e,n=this.seriesDataMap.get(i);if(n!=null){if(o===t.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:r,xHigh:a}=n;if(r&&a&&r.length===a.length){const c=[];for(let l=0;l<r.length;l+=1)c.push(a[l]-r[l]);n.width=c}}else if(o===t.plot.SeriesPlotStyle.LINE){const{x:r,xLow:a,xHigh:c,y:l,yLow:h,yHigh:p}=n;a&&c&&a!==r&&(n.error_x=F.getPlotlyErrorBars(r,a,c)),h&&p&&h!==l&&(n.error_y=F.getPlotlyErrorBars(l,h,p))}else if(o===t.plot.SeriesPlotStyle.TREEMAP){const{ids:r,labels:a}=n;r!==void 0&&a===void 0&&(n.labels=r)}}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){D.warn("Trying to set a filter, but no one click!");return}D.debug("setFilter",e);for(let t=0;t<this.oneClicks.length;t+=1){const i=this.oneClicks[t],{columns:o}=i;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(r=>{const a=e.get(r);this.lastFilter.get(r)!==a&&o.find(c=>c.name===r)!=null&&i.setValueForColumn(r,a)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let J=ne;u(J,"ADD_SERIES_DEBOUNCE",50);const he=J;class re{static async makeModelFromSettings(s,e,t,i=I){const o=await re.makeFigureFromSettings(s,e,t);return new he(s,o,e,i)}static async makeFigureFromSettings(s,e,t){const i=await t.copy();return i.applyCustomColumns(t.customColumns),i.applyFilter(t.filter),i.applySort(t.sort),s.plot.Figure.create(new F(s).makeFigureSettings(e,i))}static async makeModel(s,e,t,i=I){return new he(s,t,e,i)}}const Xe=re;const Y=te.module("EmbedChart.App");async function Ze(f,s,e){Y.info(`Fetching figure ${e}...`);const t={name:e,type:f.VariableType.FIGURE};return s.getObject(t)}function Je(){const[f,s]=$.useState(),[e,t]=$.useState(),[i,o]=$.useState(!0),n=$.useMemo(()=>new URLSearchParams(window.location.search),[]),r=Fe(),a=be();$.useEffect(function(){async function h(){try{const p=n.get("name");if(p==null)throw new Error("No name param provided");Y.debug("Loading figure",p,"...");const m=await Ze(a,r,p);Y.debug("Creating model...");const g=await Xe.makeModel(a,void 0,m);s(g),Y.debug("Figure successfully loaded!")}catch(p){Y.error("Unable to load figure",p),t(`${p}`)}o(!1)}h()},[a,r,n]);const c=f!=null;return W.jsxs("div",{className:"App",children:[c&&W.jsx(ze,{dh:a,model:f}),!c&&W.jsx(Te,{isLoaded:c,isLoading:i,errorMessage:e??null}),W.jsx(xe,{})]})}export{Je as default};
2
+ //# sourceMappingURL=App-b78c2cda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App-b78c2cda.js","sources":["../../../chart/src/plotly/Plotly.js","../../../chart/src/plotly/Plot.js","../../../chart/src/ChartModel.ts","../../../chart/src/ChartTheme.ts","../../../chart/src/ChartUtils.ts","../../../chart/src/Chart.tsx","../../../chart/src/FigureChartModel.ts","../../../chart/src/ChartModelFactory.ts","../../src/App.tsx"],"sourcesContent":["/* eslint-disable global-require */\n// Create a partial plot with only the kinds of charts we need\n// https://github.com/plotly/plotly.js/#modules\n\nimport Plotly from 'plotly.js/lib/core.js';\nimport bar from 'plotly.js/lib/bar.js';\nimport histogram from 'plotly.js/lib/histogram.js';\nimport pie from 'plotly.js/lib/pie.js';\nimport ohlc from 'plotly.js/lib/ohlc.js';\nimport scattergl from 'plotly.js/lib/scattergl.js';\nimport treemap from 'plotly.js/lib/treemap.js';\n\n// Load in the trace types we need/support\nPlotly.register([bar, histogram, pie, ohlc, scattergl, treemap]);\n\nexport default Plotly;\n","// Import the react customizable bundle for building, only pull in the modules we need\n// This reduces the build size. Plotly has a lot of modules we don't need/use.\n// https://github.com/plotly/react-plotly.js#customizing-the-plotlyjs-bundle\nimport createPlotlyComponent from 'react-plotly.js/factory.js';\nimport Plotly from './Plotly';\n\n// Webpack 4 (used in CRA) handles this import such that createPlotlyComponent is a function\n// Webpack 5 (used in docusaurus) gives an object w/ a default key\n// This is probably something on react-plotly.js's side\nexport default typeof createPlotlyComponent === 'function'\n ? createPlotlyComponent(Plotly)\n : createPlotlyComponent.default(Plotly);\n","/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n\nimport { Formatter } from '@deephaven/jsapi-utils';\nimport { Layout, Data } from 'plotly.js';\nimport { FilterColumnMap, FilterMap } from './ChartUtils';\n\nexport type ChartEvent = CustomEvent;\n/**\n * Model for a Chart\n * All of these methods should return very quickly.\n * If data needs to be loaded asynchronously, return something immediately, then trigger an event for the chart to refresh.\n */\nclass ChartModel {\n static EVENT_UPDATED = 'ChartModel.EVENT_UPDATED';\n\n static EVENT_DISCONNECT = 'ChartModel.EVENT_DISCONNECT';\n\n static EVENT_RECONNECT = 'ChartModel.EVENT_RECONNECT';\n\n static EVENT_DOWNSAMPLESTARTED = 'ChartModel.EVENT_DOWNSAMPLESTARTED';\n\n static EVENT_DOWNSAMPLEFINISHED = 'ChartModel.EVENT_DOWNSAMPLEFINISHED';\n\n static EVENT_DOWNSAMPLEFAILED = 'ChartModel.EVENT_DOWNSAMPLEFAILED';\n\n static EVENT_DOWNSAMPLENEEDED = 'ChartModel.EVENT_DOWNSAMPLENEEDED';\n\n static EVENT_LOADFINISHED = 'ChartModel.EVENT_LOADFINISHED';\n\n constructor() {\n this.listeners = [];\n this.isDownsamplingDisabled = false;\n }\n\n listeners: ((event: ChartEvent) => void)[];\n\n formatter?: Formatter;\n\n rect?: DOMRect;\n\n isDownsamplingDisabled: boolean;\n\n title?: string;\n\n getData(): Partial<Data>[] {\n return [];\n }\n\n getDefaultTitle(): string {\n return '';\n }\n\n getLayout(): Partial<Layout> {\n return {};\n }\n\n getFilterColumnMap(): FilterColumnMap {\n return new Map();\n }\n\n isFilterRequired(): boolean {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setFilter(filter: FilterMap): void {}\n\n /**\n * Close this model, clean up any underlying subscriptions\n */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n close(): void {}\n\n /**\n * Set the formatter to use when charting the data.\n * @param formatter The formatter to use to format the charting data\n */\n setFormatter(formatter: Formatter): void {\n this.formatter = formatter;\n }\n\n /**\n * Disable downsampling\n * @param isDownsamplingDisabled True if downsampling should be disabled\n */\n setDownsamplingDisabled(isDownsamplingDisabled: boolean): void {\n this.isDownsamplingDisabled = isDownsamplingDisabled;\n }\n\n /**\n * Set the dimensions of the plot. May be needed to evaluate some of the percents\n * @param rect The bounding rectangle of the plot\n */\n setDimensions(rect: DOMRect): void {\n this.rect = rect;\n }\n\n setTitle(title: string): void {\n this.title = title;\n }\n\n /**\n * Subscribe to this ChartModel and start listening for all events.\n * @param callback Callback when an event occurs\n */\n subscribe(callback: (event: ChartEvent) => void): void {\n this.listeners.push(callback);\n }\n\n unsubscribe(callback: (event: ChartEvent) => void): void {\n this.listeners = this.listeners.filter(listener => listener !== callback);\n }\n\n fireEvent(event: ChartEvent): void {\n for (let i = 0; i < this.listeners.length; i += 1) {\n this.listeners[i](event);\n }\n }\n\n fireUpdate(data: unknown): void {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_UPDATED, { detail: data }));\n }\n\n fireDisconnect(): void {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DISCONNECT));\n }\n\n fireReconnect(): void {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_RECONNECT));\n }\n\n fireDownsampleStart(detail: unknown): void {\n this.fireEvent(\n new CustomEvent(ChartModel.EVENT_DOWNSAMPLESTARTED, { detail })\n );\n }\n\n fireDownsampleFinish(detail: unknown): void {\n this.fireEvent(\n new CustomEvent(ChartModel.EVENT_DOWNSAMPLEFINISHED, { detail })\n );\n }\n\n fireDownsampleFail(detail: unknown): void {\n this.fireEvent(\n new CustomEvent(ChartModel.EVENT_DOWNSAMPLEFAILED, { detail })\n );\n }\n\n fireDownsampleNeeded(detail: unknown): void {\n this.fireEvent(\n new CustomEvent(ChartModel.EVENT_DOWNSAMPLENEEDED, { detail })\n );\n }\n\n fireLoadFinished(): void {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_LOADFINISHED));\n }\n}\n\nexport default ChartModel;\n","import ChartTheme from './ChartTheme.module.scss';\n\nexport default Object.freeze({\n paper_bgcolor: ChartTheme['paper-bgcolor'],\n plot_bgcolor: ChartTheme['plot-bgcolor'],\n title_color: ChartTheme['title-color'],\n colorway: ChartTheme.colorway,\n gridcolor: ChartTheme.gridcolor,\n linecolor: ChartTheme.linecolor,\n zerolinecolor: ChartTheme.zerolinecolor,\n activecolor: ChartTheme.activecolor,\n rangebgcolor: ChartTheme.rangebgcolor,\n area_color: ChartTheme['area-color'],\n trend_color: ChartTheme['trend-color'],\n line_color: ChartTheme['line-color'],\n error_band_line_color: ChartTheme['error-band-line-color'],\n error_band_fill_color: ChartTheme['error-band-fill-color'],\n ohlc_increasing: ChartTheme['ohlc-increasing'],\n ohlc_decreasing: ChartTheme['ohlc-decreasing'],\n});\n","import Log from '@deephaven/log';\nimport {\n DateTimeColumnFormatter,\n Formatter,\n TableColumnFormatter,\n TableUtils,\n} from '@deephaven/jsapi-utils';\nimport type {\n Axis,\n AxisPosition,\n AxisType,\n Chart,\n DateWrapper,\n dh as DhType,\n Figure,\n Holiday,\n LongWrapper,\n Series,\n SeriesDataSource,\n SeriesPlotStyle,\n SourceType,\n TableTemplate,\n TimeZone,\n} from '@deephaven/jsapi-types';\nimport set from 'lodash.set';\nimport {\n Layout,\n PlotData,\n PlotType,\n Axis as PlotlyAxis,\n ErrorBar,\n LayoutAxis,\n AxisType as PlotlyAxisType,\n OhlcData,\n MarkerSymbol,\n} from 'plotly.js';\nimport { assertNotNull, Range } from '@deephaven/utils';\nimport ChartTheme from './ChartTheme';\n\nexport type FilterColumnMap = Map<\n string,\n {\n name: string;\n type: string;\n }\n>;\n\nexport type FilterMap = Map<string, unknown>;\n\nexport interface ChartModelSettings {\n hiddenSeries?: string[];\n type?: keyof SeriesPlotStyle;\n series?: string[];\n xAxis?: string;\n title?: string;\n}\n\nexport interface SeriesData {\n type: string | null;\n mode: string | null;\n name: string;\n orientation: string;\n xaxis?: number;\n marker?: unknown;\n xLow?: number;\n xHigh?: number;\n}\n\nexport type RangeParser = (range: Range) => unknown[];\n\nexport type AxisRangeParser = (axis: Axis) => RangeParser;\n\nexport type ChartAxisRangeParser = (chart: Chart) => AxisRangeParser;\n\ntype LayoutAxisKey =\n | 'xaxis'\n | 'xaxis2'\n | 'xaxis3'\n | 'xaxis4'\n | 'xaxis5'\n | 'xaxis6'\n | 'xaxis7'\n | 'xaxis8'\n | 'xaxis9'\n | 'yaxis'\n | 'yaxis2'\n | 'yaxis3'\n | 'yaxis4'\n | 'yaxis5'\n | 'yaxis6'\n | 'yaxis7'\n | 'yaxis8'\n | 'yaxis9';\n\nexport interface TreeMapData extends PlotData {\n tiling: {\n packing: 'squarify';\n pad: 0;\n };\n}\n\ninterface Rangebreaks {\n bounds?: number[];\n dvalue?: number;\n enable?: boolean;\n name?: string;\n pattern?: 'day of week' | 'hour' | '';\n values?: string[];\n}\ninterface RangebreakAxisFormat extends PlotlyAxis {\n rangebreaks: Rangebreaks[];\n}\n\nexport type ChartBounds = {\n left: number;\n right: number;\n top: number;\n bottom: number;\n};\n\nexport type AxisTypeMap = Map<AxisType, Axis[]>;\ntype AxisPositionMap = Map<AxisPosition, Axis[]>;\n\nconst log = Log.module('ChartUtils');\n\nconst BUSINESS_COLUMN_TYPE = 'io.deephaven.time.DateTime';\n\nconst MILLIS_PER_HOUR = 3600000;\n\nconst NANOS_PER_MILLI = 1000000;\n\nfunction isDateWrapper(value: unknown): value is DateWrapper {\n return (value as DateWrapper).asDate !== undefined;\n}\n\nfunction isLongWrapper(value: unknown): value is LongWrapper {\n return (value as LongWrapper).asNumber !== undefined;\n}\n\nfunction isDateTimeColumnFormatter(\n value: TableColumnFormatter\n): value is DateTimeColumnFormatter {\n return (value as DateTimeColumnFormatter).dhTimeZone !== undefined;\n}\n\nfunction isRangedPlotlyAxis(value: unknown): value is { range: Range[] } {\n return (\n value != null &&\n (value as PlotlyAxis).range != null &&\n ((value as PlotlyAxis).autorange === false ||\n (value as PlotlyAxis).autorange === undefined)\n );\n}\n\nclass ChartUtils {\n static DEFAULT_AXIS_SIZE = 0.15;\n\n static MIN_AXIS_SIZE = 0.025;\n\n static MAX_AXIS_SIZE = 0.2;\n\n static AXIS_SIZE_PX = 75;\n\n static LEGEND_WIDTH_PX = 50;\n\n static MAX_LEGEND_SIZE = 0.25;\n\n static ORIENTATION = Object.freeze({\n HORIZONTAL: 'h',\n VERTICAL: 'v',\n } as const);\n\n static DATE_FORMAT = 'yyyy-MM-dd HH:mm:ss.SSSSSS';\n\n static DEFAULT_MARGIN = Object.freeze({ l: 60, r: 50, t: 30, b: 60, pad: 0 });\n\n static DEFAULT_TITLE_PADDING = Object.freeze({ t: 8 });\n\n static SUBTITLE_LINE_HEIGHT = 25;\n\n static DEFAULT_MARKER_SIZE = 6;\n\n static MODE_MARKERS: PlotData['mode'] = 'markers';\n\n static MODE_LINES: PlotData['mode'] = 'lines';\n\n /**\n * Generate the plotly error bar data from the passed in data.\n * Iris passes in the values as absolute, plotly needs them as relative.\n * @param x The main data array\n * @param xLow The absolute low values\n * @param xHigh\n *\n * @returns The error_x object required by plotly, or null if none is required\n */\n static getPlotlyErrorBars(\n x: number[],\n xLow: number[],\n xHigh: number[]\n ): ErrorBar {\n const array = xHigh.map((value, i) => value - x[i]);\n const arrayminus = xLow.map((value, i) => x[i] - value);\n return {\n type: 'data',\n symmetric: false,\n array,\n arrayminus,\n };\n }\n\n static convertNumberPrefix(prefix: string): string {\n return prefix.replace(/\\u00A4\\u00A4/g, 'USD').replace(/\\u00A4/g, '$');\n }\n\n static getPlotlyNumberFormat(\n formatter: Formatter | null,\n columnType: string,\n formatPattern: string\n ): Partial<LayoutAxis> | null {\n if (!formatPattern) {\n return null;\n }\n\n // We translate java formatting: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html\n // Into d3 number formatting: https://github.com/d3/d3-format\n // We can't translate number formatting exactly, but should be able to translate the most common cases\n // First split it into the subpatterns; currently only handling the positive subpattern, ignoring the rest\n const subpatterns = formatPattern.split(';');\n\n const matchArray = subpatterns[0].match(\n /^([^#,0.]*)([#,]*)([0,]*)(\\.?)(0*)(#*)(E?0*)(%?)(.*)/\n );\n assertNotNull(matchArray);\n\n const [\n ,\n prefix,\n placeholderDigits,\n zeroDigits,\n ,\n decimalDigits,\n optionalDecimalDigits,\n numberType,\n percentSign,\n suffix,\n ] = matchArray;\n\n const paddingLength = zeroDigits.replace(',', '').length;\n const isCommaSeparated =\n placeholderDigits.indexOf(',') >= 0 || zeroDigits.indexOf(',') >= 0;\n const comma = isCommaSeparated ? ',' : '';\n const plotlyNumberType =\n numberType != null && numberType !== '' ? 'e' : 'f';\n\n const type = percentSign !== '' ? percentSign : plotlyNumberType;\n\n const decimalLength = decimalDigits.length + optionalDecimalDigits.length;\n // IDS-4565 Plotly uses an older version of d3 which doesn't support the trim option or negative brackets\n // If plotly updates it's d3 version, this should be re-enabled\n // const trimOption = optionalDecimalDigits.length > 0 ? '~' : '';\n const trimOption = '';\n\n const tickformat = `0${paddingLength}${comma}.${decimalLength}${trimOption}${type}`;\n const tickprefix = ChartUtils.convertNumberPrefix(prefix);\n // prefix and suffix are processed the same\n const ticksuffix = ChartUtils.convertNumberPrefix(suffix);\n\n return { tickformat, tickprefix, ticksuffix, automargin: true };\n }\n\n /**\n * Adds tick spacing for an axis that has gapBetweenMajorTicks defined.\n *\n * @param axisFormat the current axis format, may be null\n * @param axis the current axis\n * @param isDateType indicates if the columns is a date type\n */\n static addTickSpacing(\n axisFormat: Partial<LayoutAxis> | null,\n axis: Axis,\n isDateType: boolean\n ): Partial<PlotlyAxis> | null {\n const { gapBetweenMajorTicks } = axis;\n if (gapBetweenMajorTicks > 0) {\n const updatedFormat: Partial<PlotlyAxis> = axisFormat || {};\n let tickSpacing = gapBetweenMajorTicks;\n if (isDateType) {\n // Need to convert from nanoseconds to milliseconds\n tickSpacing = gapBetweenMajorTicks / NANOS_PER_MILLI;\n }\n if (axis.log) {\n tickSpacing = Math.log(tickSpacing);\n }\n // Note that tickmode defaults to 'auto'\n updatedFormat.tickmode = 'linear';\n updatedFormat.dtick = tickSpacing;\n return updatedFormat;\n }\n\n return axisFormat;\n }\n\n /**\n * Retrieve the data source for a given axis in a chart\n * @param chart The chart to get the source for\n * @param axis The axis to find the source for\n * @returns The first source matching this axis\n */\n static getSourceForAxis(chart: Chart, axis: Axis): SeriesDataSource | null {\n for (let i = 0; i < chart.series.length; i += 1) {\n const series = chart.series[i];\n for (let j = 0; j < series.sources.length; j += 1) {\n const source = series.sources[j];\n if (source.axis === axis) {\n return source;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get visibility setting for the series object\n * @param name The series name to get the visibility for\n * @param settings Chart settings\n * @returns True for visible series and 'legendonly' for hidden\n */\n static getSeriesVisibility(\n name: string,\n settings?: Partial<ChartModelSettings>\n ): boolean | 'legendonly' {\n if (\n settings != null &&\n settings.hiddenSeries != null &&\n settings.hiddenSeries.includes(name)\n ) {\n return 'legendonly';\n }\n return true;\n }\n\n /**\n * Get hidden labels array from chart settings\n * @param settings Chart settings\n * @returns Array of hidden series names\n */\n static getHiddenLabels(settings: Partial<ChartModelSettings>): string[] {\n if (settings?.hiddenSeries) {\n return [...settings.hiddenSeries];\n }\n return [];\n }\n\n /**\n * Create a default series data object. Apply styling to the object afterward.\n * @returns A simple series data object with no styling\n */\n static makeSeriesData(\n type: PlotType | undefined,\n mode: PlotData['mode'] | undefined,\n name: string,\n showLegend: boolean | null,\n orientation: 'h' | 'v' = ChartUtils.ORIENTATION.VERTICAL\n ): Partial<PlotData> {\n return {\n type,\n mode,\n name,\n orientation,\n showlegend: showLegend ?? undefined,\n };\n }\n\n /**\n * Get the Plotly marker symbol for the provided Deephaven shape\n * Deephaven shapes: https://deephaven.io/enterprise/docs/plotting/visual-formatting/#point-formatting\n * Plotly shapes: https://plotly.com/javascript/reference/scattergl/#scattergl-marker-symbol\n * Table of plotly shapes: https://plotly.com/python/marker-style/#custom-marker-symbols\n * @param deephavenShape Deephaven shape to get the marker symbol for\n */\n static getMarkerSymbol(deephavenShape: string): MarkerSymbol {\n switch (deephavenShape) {\n case 'SQUARE':\n return 'square';\n case 'CIRCLE':\n return 'circle';\n case 'DIAMOND':\n return 'diamond';\n case 'UP_TRIANGLE':\n return 'triangle-up';\n case 'DOWN_TRIANGLE':\n return 'triangle-down';\n case 'RIGHT_TRIANGLE':\n return 'triangle-right';\n case 'LEFT_TRIANGLE':\n return 'triangle-left';\n // There don't seem to be any plotly equivalents for ellipse or rectangles\n // Rectangles could be `line-ew`, `line-ns`, or `hourglass` and `bowtie` instead?\n // Ellipse could be `asterisk` or `diamond-wide` instead?\n // Just throw an error, we've already got a bunch of types.\n case 'ELLIPSE':\n case 'HORIZONTAL_RECTANGLE':\n case 'VERTICAL_RECTANGLE':\n default:\n throw new Error(`Unrecognized shape ${deephavenShape}`);\n }\n }\n\n /**\n * Get all axes for a given `Figure`. Iterates through all charts axes and concatenates them.\n * @param figure Figure to get all axes for\n */\n static getAllAxes(figure: Figure): Axis[] {\n return figure.charts.reduce(\n (axes, chart) => [...axes, ...chart.axes],\n [] as Axis[]\n );\n }\n\n /**\n * Retrieve the chart that contains the passed in series from the figure\n * @param figure The figure to retrieve the chart from\n * @param series The series to get the chart for\n */\n static getChartForSeries(figure: Figure, series: Series): Chart | null {\n const { charts } = figure;\n\n for (let i = 0; i < charts.length; i += 1) {\n const chart = charts[i];\n for (let j = 0; j < chart.series.length; j += 1) {\n if (series === chart.series[j]) {\n return chart;\n }\n }\n }\n\n return null;\n }\n\n /**\n * Get an object mapping axis to their ranges\n * @param layout The plotly layout object to get the ranges from\n * @returns An object mapping the axis name to it's range\n */\n static getLayoutRanges(layout: Layout): Record<string, Range[]> {\n const ranges: Record<string, Range[]> = {};\n const keys: (keyof Layout)[] = Object.keys(layout).filter(\n key => key.indexOf('axis') >= 0\n ) as LayoutAxisKey[];\n for (let i = 0; i < keys.length; i += 1) {\n const key = keys[i];\n const value = layout[key];\n if (isRangedPlotlyAxis(value)) {\n // Only want to add the range if it's not autoranged\n ranges[key] = [...(value as PlotlyAxis).range];\n }\n }\n\n return ranges;\n }\n\n static getAxisLayoutProperty(\n axisProperty: 'x' | 'y',\n axisIndex: number\n ): LayoutAxisKey {\n const axisIndexString = axisIndex > 0 ? `${axisIndex + 1}` : '';\n return `${axisProperty ?? ''}axis${axisIndexString}` as LayoutAxisKey;\n }\n\n /**\n * Converts an open or close period to a declimal. e.g '09:30\" to 9.5\n *\n * @param period the open or close value of the period\n */\n static periodToDecimal(period: string): number {\n const values = period.split(':');\n return Number(values[0]) + Number(values[1]) / 60;\n }\n\n /**\n * Groups an array and returns a map\n * @param array The object to group\n * @param property The property name to group by\n * @returns A map containing the items grouped by their values for the property\n */\n static groupArray<T, P extends keyof T>(\n array: T[],\n property: P\n ): Map<T[P], T[]> {\n return array.reduce((result, item) => {\n const key = item[property];\n const group: T[] = result.get(key) ?? [];\n group.push(item);\n result.set(key, group);\n return result;\n }, new Map());\n }\n\n /**\n * Parses the colorway property of a theme and returns an array of colors\n * Theme could have a single string with space separated colors or an array of strings representing the colorway\n * @param theme The theme to get colorway from\n * @returns Colorway array for the theme\n */\n static getColorwayFromTheme(theme = ChartTheme): string[] {\n let colorway: string[] = [];\n if (theme.colorway) {\n if (Array.isArray(theme.colorway)) {\n colorway = theme.colorway;\n } else if (typeof theme.colorway === 'string') {\n colorway = theme.colorway.split(' ');\n } else {\n log.warn(`Unable to handle colorway property: ${theme.colorway}`);\n }\n }\n\n return colorway;\n }\n\n static titleFromSettings(settings: ChartModelSettings): string {\n const {\n series,\n xAxis,\n title = `${(series ?? []).join(', ')} by ${xAxis}`,\n } = settings;\n\n return title;\n }\n\n private dh: DhType;\n\n private daysOfWeek: readonly string[];\n\n constructor(dh: DhType) {\n this.dh = dh;\n this.daysOfWeek = Object.freeze(dh.calendar.DayOfWeek.values());\n }\n\n /**\n * Retrieve the axis formats from the provided figure.\n * Currently defaults to just the x/y axes.\n * @param figure The figure to get the axis formats for\n * @param formatter The formatter to use when getting the axis format\n * @returns A map of axis layout property names to axis formats\n */\n getAxisFormats(\n figure: Figure,\n formatter: Formatter\n ): Map<LayoutAxisKey, Partial<PlotlyAxis>> {\n const axisFormats = new Map();\n const nullFormat = { tickformat: null, ticksuffix: null };\n\n const allAxes = ChartUtils.getAllAxes(figure);\n const axisTypeMap = ChartUtils.groupArray(allAxes, 'type');\n const { charts } = figure;\n\n for (let i = 0; i < charts.length; i += 1) {\n const chart = charts[i];\n\n for (let j = 0; j < chart.series.length; j += 1) {\n const series = chart.series[j];\n const { sources } = series;\n const axisSources = sources.filter(source => source.axis);\n for (let k = 0; k < axisSources.length; k += 1) {\n const source = axisSources[k];\n const { axis } = source;\n const { type: axisType } = axis;\n const typeAxes = axisTypeMap.get(axisType);\n assertNotNull(typeAxes);\n const axisIndex = typeAxes.indexOf(axis);\n const axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n const axisLayoutProperty = ChartUtils.getAxisLayoutProperty(\n axisProperty,\n axisIndex\n );\n\n if (axisFormats.has(axisLayoutProperty)) {\n log.debug(`${axisLayoutProperty} already added.`);\n } else {\n log.debug(`Adding ${axisLayoutProperty} to axisFormats.`);\n const axisFormat = this.getPlotlyAxisFormat(source, formatter);\n if (axisFormat === null) {\n axisFormats.set(axisLayoutProperty, nullFormat);\n } else {\n axisFormats.set(axisLayoutProperty, axisFormat);\n\n const { businessCalendar } = axis;\n if (businessCalendar != null) {\n const rangebreaks: Rangebreaks[] = [];\n const {\n businessPeriods,\n businessDays,\n holidays,\n timeZone: calendarTimeZone,\n } = businessCalendar;\n const typeFormatter = formatter?.getColumnTypeFormatter(\n BUSINESS_COLUMN_TYPE\n );\n let formatterTimeZone;\n if (isDateTimeColumnFormatter(typeFormatter)) {\n formatterTimeZone = typeFormatter.dhTimeZone;\n }\n const timeZoneDiff = formatterTimeZone\n ? (calendarTimeZone.standardOffset -\n formatterTimeZone.standardOffset) /\n 60\n : 0;\n if (holidays.length > 0) {\n rangebreaks.push(\n ...this.createRangeBreakValuesFromHolidays(\n holidays,\n calendarTimeZone,\n formatterTimeZone\n )\n );\n }\n businessPeriods.forEach(period =>\n rangebreaks.push({\n pattern: 'hour',\n bounds: [\n ChartUtils.periodToDecimal(period.close) + timeZoneDiff,\n ChartUtils.periodToDecimal(period.open) + timeZoneDiff,\n ],\n })\n );\n // If there are seven business days, then there is no weekend\n if (businessDays.length < this.daysOfWeek.length) {\n this.createBoundsFromDays(businessDays).forEach(\n weekendBounds =>\n rangebreaks.push({\n pattern: 'day of week',\n bounds: weekendBounds,\n })\n );\n }\n\n (axisFormat as RangebreakAxisFormat).rangebreaks = rangebreaks;\n }\n\n if (axisFormats.size === chart.axes.length) {\n return axisFormats;\n }\n }\n }\n }\n }\n }\n }\n\n return axisFormats;\n }\n\n /**\n * Converts the Iris plot style into a plotly chart type\n * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle\n * @param isBusinessTime If the plot is using business time for an axis\n */\n getPlotlyChartType(\n plotStyle: SeriesPlotStyle,\n isBusinessTime: boolean\n ): PlotType | undefined {\n const { dh } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.SCATTER:\n // scattergl mode is more performant, but doesn't support the rangebreaks we need for businessTime calendars\n return !isBusinessTime ? 'scattergl' : 'scatter';\n case dh.plot.SeriesPlotStyle.LINE:\n // There is also still some artifacting bugs with scattergl: https://github.com/plotly/plotly.js/issues/3522\n // The artifacting only occurs on line plots, which we can draw with fairly decent performance using SVG paths\n // Once the above plotly issue is fixed, scattergl should be used here (when !isBusinessTime)\n return 'scatter';\n case dh.plot.SeriesPlotStyle.BAR:\n case dh.plot.SeriesPlotStyle.STACKED_BAR:\n return 'bar';\n\n case dh.plot.SeriesPlotStyle.PIE:\n return 'pie';\n\n case dh.plot.SeriesPlotStyle.TREEMAP:\n return 'treemap';\n\n case dh.plot.SeriesPlotStyle.HISTOGRAM:\n return 'histogram';\n\n case dh.plot.SeriesPlotStyle.OHLC:\n return 'ohlc';\n\n default:\n return undefined;\n }\n }\n\n /**\n * Converts the Iris plot style into a plotly chart mode\n * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle.*\n * @param areLinesVisible Whether lines are visible or not\n * @param areShapesVisible Whether shapes are visible or not\n */\n getPlotlyChartMode(\n plotStyle: SeriesPlotStyle,\n areLinesVisible?: boolean | null,\n areShapesVisible?: boolean | null\n ): PlotData['mode'] | undefined {\n const { dh } = this;\n const modes = new Set<PlotData['mode']>();\n\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.SCATTER:\n // Default to only showing shapes in scatter plots\n if (areLinesVisible ?? false) {\n modes.add(ChartUtils.MODE_LINES);\n }\n if (areShapesVisible ?? true) {\n modes.add(ChartUtils.MODE_MARKERS);\n }\n break;\n case dh.plot.SeriesPlotStyle.LINE:\n // Default to only showing lines in line series\n if (areLinesVisible ?? true) {\n modes.add(ChartUtils.MODE_LINES);\n }\n if (areShapesVisible ?? false) {\n modes.add(ChartUtils.MODE_MARKERS);\n }\n break;\n default:\n break;\n }\n\n return modes.size > 0\n ? ([...modes].join('+') as PlotData['mode'])\n : undefined;\n }\n\n /**\n * Get the property to set on the series data for plotly\n * @param plotStyle The plot style of the series\n * @param sourceType The source type for the series\n */\n getPlotlyProperty(\n plotStyle: SeriesPlotStyle,\n sourceType: SourceType\n ): string {\n const { dh } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.PIE:\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'labels';\n case dh.plot.SourceType.Y:\n return 'values';\n default:\n break;\n }\n break;\n case dh.plot.SeriesPlotStyle.OHLC:\n switch (sourceType) {\n case dh.plot.SourceType.TIME:\n return 'x';\n default:\n break;\n }\n break;\n case dh.plot.SeriesPlotStyle.TREEMAP:\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'ids';\n case dh.plot.SourceType.Y:\n return 'values';\n case dh.plot.SourceType.LABEL:\n return 'labels';\n case dh.plot.SourceType.PARENT:\n return 'parents';\n case dh.plot.SourceType.COLOR:\n return 'marker.colors';\n default:\n break;\n }\n break;\n default:\n break;\n }\n\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'x';\n case dh.plot.SourceType.Y:\n return 'y';\n case dh.plot.SourceType.Z:\n return 'z';\n case dh.plot.SourceType.X_LOW:\n return 'xLow';\n case dh.plot.SourceType.X_HIGH:\n return 'xHigh';\n case dh.plot.SourceType.Y_LOW:\n return 'yLow';\n case dh.plot.SourceType.Y_HIGH:\n return 'yHigh';\n case dh.plot.SourceType.TIME:\n return 'time';\n case dh.plot.SourceType.OPEN:\n return 'open';\n case dh.plot.SourceType.HIGH:\n return 'high';\n case dh.plot.SourceType.LOW:\n return 'low';\n case dh.plot.SourceType.CLOSE:\n return 'close';\n case dh.plot.SourceType.SHAPE:\n return 'shape';\n case dh.plot.SourceType.SIZE:\n return 'size';\n case dh.plot.SourceType.LABEL:\n return 'label';\n case dh.plot.SourceType.COLOR:\n return 'color';\n case dh.plot.SourceType.PARENT:\n return 'parent';\n case dh.plot.SourceType.HOVER_TEXT:\n return 'hovertext';\n case dh.plot.SourceType.TEXT:\n return 'text';\n default:\n throw new Error(`Unrecognized source type: ${sourceType}`);\n }\n }\n\n getPlotlySeriesOrientation(series: Series): 'h' | 'v' | undefined {\n const { dh } = this;\n const { sources } = series;\n if (sources.length === 2 && sources[0]?.axis?.type === dh.plot.AxisType.Y) {\n return ChartUtils.ORIENTATION.HORIZONTAL;\n }\n\n return ChartUtils.ORIENTATION.VERTICAL;\n }\n\n /**\n * Create a data series (trace) for use with plotly\n * @param series The series to create the series data with\n * @param axisTypeMap The map of axes grouped by type\n * @param seriesVisibility Visibility setting for the series\n * @param theme The theme properties for the plot. See ChartTheme.js for an example\n * @returns The series data (trace) object for use with plotly.\n */\n makeSeriesDataFromSeries(\n series: Series,\n axisTypeMap: AxisTypeMap,\n seriesVisibility: boolean | 'legendonly',\n showLegend: boolean | null = null,\n theme = ChartTheme\n ): Partial<PlotData> {\n const {\n name,\n isLinesVisible,\n isShapesVisible,\n plotStyle,\n lineColor,\n shapeColor,\n sources,\n shape,\n shapeSize,\n } = series;\n\n const isBusinessTime = sources.some(\n source => source.axis?.businessCalendar\n );\n const type = this.getChartType(plotStyle, isBusinessTime);\n const mode = this.getPlotlyChartMode(\n plotStyle,\n isLinesVisible ?? undefined,\n isShapesVisible ?? undefined\n );\n const orientation = this.getPlotlySeriesOrientation(series);\n const seriesData = ChartUtils.makeSeriesData(\n type,\n mode,\n name,\n showLegend,\n orientation\n );\n\n this.addSourcesToSeriesData(seriesData, plotStyle, sources, axisTypeMap);\n\n this.addStylingToSeriesData(\n seriesData,\n plotStyle,\n theme,\n lineColor,\n shapeColor,\n shape,\n shapeSize,\n seriesVisibility\n );\n\n return seriesData;\n }\n\n addSourcesToSeriesData(\n seriesDataParam: Partial<PlotData>,\n plotStyle: SeriesPlotStyle,\n sources: SeriesDataSource[],\n axisTypeMap: AxisTypeMap\n ): void {\n const seriesData = seriesDataParam;\n for (let k = 0; k < sources.length; k += 1) {\n const source = sources[k];\n const { axis, type: sourceType } = source;\n\n const dataAttributeName = this.getPlotlyProperty(plotStyle, sourceType);\n set(seriesData, dataAttributeName, []);\n\n const axisProperty =\n axis != null ? this.getAxisPropertyName(axis.type) : null;\n if (axisProperty != null) {\n const axes = axisTypeMap.get(axis.type);\n if (axes) {\n const axisIndex = axes.indexOf(axis);\n const axisIndexString = axisIndex > 0 ? `${axisIndex + 1}` : '';\n seriesData[\n `${axisProperty}axis`\n ] = `${axisProperty}${axisIndexString}`;\n }\n }\n }\n }\n\n addStylingToSeriesData(\n seriesDataParam: Partial<PlotData>,\n plotStyle: SeriesPlotStyle,\n theme: typeof ChartTheme = ChartTheme,\n lineColor: string | null = null,\n shapeColor: string | null = null,\n shape: string | null = null,\n shapeSize: number | null = null,\n seriesVisibility: 'legendonly' | boolean | null = null\n ): void {\n const { dh } = this;\n const seriesData = seriesDataParam;\n // Add some empty objects so we can fill them in later with details without checking for existence\n seriesData.marker = { line: {} }; // border line width on markers\n seriesData.line = {\n width: 1, // default line width for lines, should eventually be able to override\n };\n\n if (plotStyle === dh.plot.SeriesPlotStyle.AREA) {\n seriesData.fill = 'tozeroy';\n } else if (plotStyle === dh.plot.SeriesPlotStyle.STACKED_AREA) {\n seriesData.stackgroup = 'stack';\n } else if (plotStyle === dh.plot.SeriesPlotStyle.STEP) {\n seriesData.line.shape = 'hv'; // plot.ly horizontal then vertical step styling\n } else if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {\n // The default histfunc in plotly is 'count', but the data passed up from the API provides explicit x/y values and bins\n // Since it's converted to bar, just set the widths of each bar\n seriesData.width = [];\n\n if (seriesData.marker.line !== undefined) {\n Object.assign(seriesData.marker.line, {\n color: theme.paper_bgcolor,\n width: 1,\n });\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.OHLC) {\n (seriesData as Partial<OhlcData>).increasing = {\n line: { color: theme.ohlc_increasing },\n };\n (seriesData as Partial<OhlcData>).decreasing = {\n line: { color: theme.ohlc_decreasing },\n };\n } else if (plotStyle === dh.plot.SeriesPlotStyle.PIE) {\n seriesData.textinfo = 'label+percent';\n\n // TODO Open DefinitelyTyped/Plotly PR to mark family and size as optional\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/lib/traces/pie.d.ts#L6\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (seriesData as any).outsidetextfont = {\n color: theme.title_color,\n };\n } else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {\n seriesData.hoverinfo = 'text';\n seriesData.textinfo = 'label+text';\n (seriesData as TreeMapData).tiling = {\n packing: 'squarify',\n pad: 0,\n };\n seriesData.textposition = 'middle center';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (seriesData as any).outsidetextfont = { color: theme.title_color };\n }\n\n if (lineColor != null) {\n if (plotStyle === dh.plot.SeriesPlotStyle.BAR) {\n seriesData.marker.color = lineColor;\n } else {\n seriesData.line.color = lineColor;\n }\n }\n\n if (shapeColor != null) {\n seriesData.marker.color = shapeColor;\n }\n\n if (shape != null && shape.length > 0) {\n try {\n seriesData.marker.symbol = ChartUtils.getMarkerSymbol(shape);\n } catch (e) {\n log.warn('Unable to handle shape', shape, ':', e);\n }\n }\n\n if (shapeSize != null) {\n seriesData.marker.size = shapeSize * ChartUtils.DEFAULT_MARKER_SIZE;\n }\n\n // Skipping pie charts\n // Pie slice visibility is configured in chart layout instead of series data\n if (seriesVisibility != null && plotStyle !== dh.plot.SeriesPlotStyle.PIE) {\n seriesData.visible = seriesVisibility;\n }\n }\n\n getChartType(\n plotStyle: SeriesPlotStyle,\n isBusinessTime: boolean\n ): PlotType | undefined {\n const { dh } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.HISTOGRAM:\n // When reading data from the `Figure`, it already provides bins and values, so rather than using\n // plot.ly to calculate the bins and sum values, just convert it to a bar chart\n return 'bar';\n default:\n return this.getPlotlyChartType(plotStyle, isBusinessTime);\n }\n }\n\n /**\n * Return the plotly axis property name\n * @param axisType The axis type to get the property name for\n */\n getAxisPropertyName(axisType: AxisType): 'x' | 'y' | null {\n const { dh } = this;\n switch (axisType) {\n case dh.plot.AxisType.X:\n return 'x';\n case dh.plot.AxisType.Y:\n return 'y';\n default:\n return null;\n }\n }\n\n /**\n * Returns the plotly \"side\" value for the provided axis position\n * @param axisPosition The Iris AxisPosition of the axis\n */\n getAxisSide(axisPosition: AxisPosition): LayoutAxis['side'] | undefined {\n const { dh } = this;\n switch (axisPosition) {\n case dh.plot.AxisPosition.BOTTOM:\n return 'bottom';\n case dh.plot.AxisPosition.TOP:\n return 'top';\n case dh.plot.AxisPosition.LEFT:\n return 'left';\n case dh.plot.AxisPosition.RIGHT:\n return 'right';\n default:\n return undefined;\n }\n }\n\n /**\n * Update the layout with all the axes information for the provided figure\n * @param figure Figure to update the axes for\n * @param layoutParam Layout object to update in place\n * @param chartAxisRangeParser Function to retrieve the axis range parser\n * @param plotWidth Width of the plot in pixels\n * @param plotHeight Height of the plot in pixels\n * @param theme Theme used for displaying the plot\n */\n updateFigureAxes(\n layoutParam: Partial<Layout>,\n figure: Figure,\n chartAxisRangeParser?: ChartAxisRangeParser,\n plotWidth = 0,\n plotHeight = 0,\n theme = ChartTheme\n ): void {\n const layout = layoutParam;\n const figureAxes = ChartUtils.getAllAxes(figure);\n for (let i = 0; i < figure.charts.length; i += 1) {\n const chart = figure.charts[i];\n const axisRangeParser = chartAxisRangeParser?.(chart);\n const bounds = this.getChartBounds(figure, chart, plotWidth, plotHeight);\n this.updateLayoutAxes(\n layout,\n chart.axes,\n figureAxes,\n plotWidth,\n plotHeight,\n bounds,\n axisRangeParser,\n theme\n );\n }\n\n this.removeStaleAxes(layout, figureAxes);\n }\n\n getChartBounds(\n figure: Figure,\n chart: Chart,\n plotWidth: number,\n plotHeight: number\n ): ChartBounds {\n const { dh } = this;\n const { cols, rows } = figure;\n const { column, colspan, row, rowspan } = chart;\n\n const endColumn = column + colspan;\n const endRow = row + rowspan;\n const columnSize = 1 / cols;\n const rowSize = 1 / rows;\n const xMarginSize = ChartUtils.AXIS_SIZE_PX / plotWidth;\n const yMarginSize = ChartUtils.AXIS_SIZE_PX / plotHeight;\n\n const bounds: ChartBounds = {\n // Need to invert the row positioning so the first one defined shows up on top instead of the bottom, since coordinates start in bottom left\n bottom: (rows - endRow) * rowSize + (endRow < rows ? yMarginSize / 2 : 0),\n top: (rows - row) * rowSize - (row > 0 ? yMarginSize / 2 : 0),\n\n left: column * columnSize + (column > 0 ? xMarginSize / 2 : 0),\n right: endColumn * columnSize - (endColumn < cols ? xMarginSize / 2 : 0),\n };\n\n // Adjust the bounds based on where the legend is\n // For now, always assume the legend is shown on the right\n const axisPositionMap = ChartUtils.groupArray(chart.axes, 'position');\n const rightAxes = axisPositionMap.get(dh.plot.AxisPosition.RIGHT) ?? [];\n if (rightAxes.length > 0) {\n if (plotWidth > 0) {\n bounds.right -=\n (bounds.right - bounds.left) *\n Math.max(\n 0,\n Math.min(\n ChartUtils.LEGEND_WIDTH_PX / plotWidth,\n ChartUtils.MAX_LEGEND_SIZE\n )\n );\n } else {\n bounds.right -=\n (bounds.right - bounds.left) * ChartUtils.DEFAULT_AXIS_SIZE;\n }\n }\n\n return bounds;\n }\n\n getPlotlyDateFormat(\n formatter: Formatter | null,\n columnType: string,\n formatPattern: string\n ): Partial<LayoutAxis> {\n const { dh } = this;\n const tickformat =\n formatPattern == null\n ? undefined\n : formatPattern\n .replace('%', '%%')\n .replace(/S{9}/g, '%9f')\n .replace(/S{8}/g, '%8f')\n .replace(/S{7}/g, '%7f')\n .replace(/S{6}/g, '%6f')\n .replace(/S{5}/g, '%5f')\n .replace(/S{4}/g, '%4f')\n .replace(/S{3}/g, '%3f')\n .replace(/S{2}/g, '%2f')\n .replace(/S{1}/g, '%1f')\n .replace(/y{4}/g, '%Y')\n .replace(/y{2}/g, '%y')\n .replace(/M{4}/g, '%B')\n .replace(/M{3}/g, '%b')\n .replace(/M{2}/g, '%m')\n .replace(/M{1}/g, '%-m')\n .replace(/E{4,}/g, '%A')\n .replace(/E{1,}/g, '%a')\n .replace(/d{2}/g, '%d')\n .replace(/([^%]|^)d{1}/g, '$1%-d')\n .replace(/H{2}/g, '%H')\n .replace(/h{2}/g, '%I')\n .replace(/h{1}/g, '%-I')\n .replace(/m{2}/g, '%M')\n .replace(/s{2}/g, '%S')\n .replace(\"'T'\", 'T')\n .replace(' z', ''); // timezone added as suffix if necessary\n\n let ticksuffix;\n const dataFormatter = formatter?.getColumnTypeFormatter(columnType);\n if (\n dataFormatter != null &&\n isDateTimeColumnFormatter(dataFormatter) &&\n dataFormatter.dhTimeZone != null &&\n dataFormatter.showTimeZone\n ) {\n ticksuffix = dh.i18n.DateTimeFormat.format(\n ' z',\n new Date(),\n dataFormatter.dhTimeZone\n );\n }\n\n return {\n tickformat,\n ticksuffix,\n automargin: true,\n };\n }\n\n /**\n * Gets the plotly axis formatting information from the source passed in\n * @param source The Source to get the formatter information from\n * @param formatter The current formatter for formatting data\n */\n getPlotlyAxisFormat(\n source: SeriesDataSource,\n formatter: Formatter | null = null\n ): Partial<PlotlyAxis> | null {\n const { dh } = this;\n const { axis, columnType } = source;\n const { formatPattern } = axis;\n\n let axisFormat = null;\n if (TableUtils.isDateType(columnType)) {\n axisFormat = this.getPlotlyDateFormat(\n formatter,\n columnType,\n formatPattern\n );\n axisFormat = ChartUtils.addTickSpacing(axisFormat, axis, true);\n } else if (TableUtils.isNumberType(columnType)) {\n axisFormat = ChartUtils.getPlotlyNumberFormat(\n formatter,\n columnType,\n formatPattern\n );\n axisFormat = ChartUtils.addTickSpacing(axisFormat, axis, false);\n }\n\n if (axis.formatType === dh.plot.AxisFormatType.CATEGORY) {\n if (axisFormat) {\n axisFormat.type = 'category';\n } else {\n axisFormat = {\n type: 'category' as PlotlyAxisType,\n tickformat: undefined,\n ticksuffix: undefined,\n };\n }\n }\n\n return axisFormat;\n }\n\n /**\n * Updates the axes positions and sizes in the layout object provided.\n * If the axis did not exist in the layout previously, it is created and added.\n * Any axis that no longer exists in axes is removed.\n * With Downsampling enabled, will also update the range on the axis itself as appropriate\n * @param layoutParam The layout object to update\n * @param chartAxes The chart axes to update the layout with\n * @param figureAxes All figure axes to update the layout with\n * @param plotWidth The width of the plot to calculate the axis sizes for\n * @param plotHeight The height of the plot to calculate the axis sizes for\n * @param bounds The bounds for this set of axes\n * @param axisRangeParser A function to retrieve the range parser for a given axis\n */\n updateLayoutAxes(\n layoutParam: Partial<Layout>,\n chartAxes: Axis[],\n figureAxes: Axis[],\n plotWidth = 0,\n plotHeight = 0,\n bounds: ChartBounds = { left: 0, top: 0, right: 1, bottom: 1 },\n axisRangeParser?: AxisRangeParser,\n theme = ChartTheme\n ): void {\n const { dh } = this;\n const xAxisSize =\n plotWidth > 0\n ? Math.max(\n ChartUtils.MIN_AXIS_SIZE,\n Math.min(\n ChartUtils.AXIS_SIZE_PX / plotHeight,\n ChartUtils.MAX_AXIS_SIZE\n )\n )\n : ChartUtils.DEFAULT_AXIS_SIZE;\n const yAxisSize =\n plotHeight > 0\n ? Math.max(\n ChartUtils.MIN_AXIS_SIZE,\n Math.min(\n ChartUtils.AXIS_SIZE_PX / plotWidth,\n ChartUtils.MAX_AXIS_SIZE\n )\n )\n : ChartUtils.DEFAULT_AXIS_SIZE;\n\n const layout = layoutParam;\n const axisPositionMap = ChartUtils.groupArray(chartAxes, 'position');\n const axisTypeMap = ChartUtils.groupArray(chartAxes, 'type');\n const axisTypes = [...axisTypeMap.keys()];\n const figureAxisTypeMap = ChartUtils.groupArray(figureAxes, 'type');\n for (let j = 0; j < axisTypes.length; j += 1) {\n const axisType = axisTypes[j];\n const axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n const typeAxes = axisTypeMap.get(axisType);\n const figureTypeAxes = figureAxisTypeMap.get(axisType);\n const isYAxis = axisType === dh.plot.AxisType.Y;\n const plotSize = isYAxis ? plotHeight : plotWidth;\n\n assertNotNull(typeAxes);\n assertNotNull(figureTypeAxes);\n for (\n let chartAxisIndex = 0;\n chartAxisIndex < typeAxes.length;\n chartAxisIndex += 1\n ) {\n const axis = typeAxes[chartAxisIndex];\n const figureAxisIndex = figureTypeAxes.indexOf(axis);\n const axisLayoutProperty = ChartUtils.getAxisLayoutProperty(\n axisProperty,\n figureAxisIndex\n );\n if (layout[axisLayoutProperty] == null) {\n layout[axisLayoutProperty] = this.makeLayoutAxis(axisType, theme);\n }\n\n const layoutAxis = layout[axisLayoutProperty];\n if (layoutAxis != null) {\n this.updateLayoutAxis(\n layoutAxis,\n axis,\n chartAxisIndex,\n axisPositionMap,\n xAxisSize,\n yAxisSize,\n bounds\n );\n\n const { range, autorange } = layoutAxis;\n if (\n axisRangeParser != null &&\n range !== undefined &&\n (autorange === undefined || autorange === false)\n ) {\n const rangeParser = axisRangeParser(axis);\n const [rangeStart, rangeEnd] = rangeParser(range as Range);\n\n log.debug(\n 'Setting downsample range',\n plotSize,\n rangeStart,\n rangeEnd\n );\n\n axis.range(plotSize, rangeStart, rangeEnd);\n } else {\n axis.range(plotSize);\n }\n }\n }\n }\n }\n }\n\n /**\n * Remove any axes from the layout param that no longer belong to any series\n * @param layoutParam Layout object to remove stale axes from\n * @param axes All axes in the figure\n */\n removeStaleAxes(layoutParam: Partial<Layout>, axes: Axis[]): void {\n const layout = layoutParam;\n const figureAxisTypeMap = ChartUtils.groupArray(axes, 'type');\n const figureAxisTypes = [...figureAxisTypeMap.keys()];\n for (let i = 0; i < figureAxisTypes.length; i += 1) {\n const axisType = figureAxisTypes[i];\n const typeAxes = figureAxisTypeMap.get(axisType);\n assertNotNull(typeAxes);\n let axisIndex = typeAxes.length;\n // Delete any axes that may no longer exist\n const axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n let axisLayoutProperty = ChartUtils.getAxisLayoutProperty(\n axisProperty,\n axisIndex\n );\n while (layout[axisLayoutProperty] != null) {\n delete layout[axisLayoutProperty];\n\n axisIndex += 1;\n axisLayoutProperty = ChartUtils.getAxisLayoutProperty(\n axisProperty,\n axisIndex\n );\n }\n }\n }\n }\n\n /**\n * Updates the layout axis object in place\n * @param layoutAxisParam The plotly layout axis param\n * @param axis The Iris Axis to update the plotly layout with\n * @param axisIndex The type index for this axis\n * @param axisPositionMap All the axes mapped by position\n * @param axisSize The size of each axis in percent\n * @param bounds The bounds of the axes domains\n */\n updateLayoutAxis(\n layoutAxisParam: Partial<LayoutAxis>,\n axis: Axis,\n axisIndex: number,\n axisPositionMap: AxisPositionMap,\n xAxisSize: number,\n yAxisSize: number,\n bounds: {\n left: number;\n bottom: number;\n top: number;\n right: number;\n }\n ): void {\n const { dh } = this;\n const isYAxis = axis.type === dh.plot.AxisType.Y;\n const axisSize = isYAxis ? yAxisSize : xAxisSize;\n const layoutAxis = layoutAxisParam;\n // Enterprise API returns null for empty axis labels\n // Passing null title text to Plotly results in incorrect axis position, DH-9164\n const label = axis.label ?? '';\n if (\n layoutAxis.title !== undefined &&\n typeof layoutAxis.title !== 'string'\n ) {\n layoutAxis.title.text = label;\n } else {\n layoutAxis.title = { text: label };\n }\n\n if (axis.log) {\n layoutAxis.type = 'log';\n }\n\n layoutAxis.side = this.getAxisSide(axis.position);\n\n if (axisIndex > 0) {\n layoutAxis.overlaying = this.getAxisPropertyName(axis.type) ?? undefined;\n\n const positionAxes = axisPositionMap.get(axis.position) ?? [];\n const sideIndex = positionAxes.indexOf(axis);\n if (sideIndex > 0) {\n layoutAxis.anchor = 'free';\n\n if (axis.position === dh.plot.AxisPosition.RIGHT) {\n layoutAxis.position =\n bounds.right + (sideIndex - positionAxes.length + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.TOP) {\n layoutAxis.position =\n bounds.top + (sideIndex - positionAxes.length + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.BOTTOM) {\n layoutAxis.position =\n bounds.bottom + (positionAxes.length - sideIndex + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.LEFT) {\n layoutAxis.position =\n bounds.left + (positionAxes.length - sideIndex + 1) * axisSize;\n }\n }\n } else if (axis.type === dh.plot.AxisType.X) {\n const leftAxes = axisPositionMap.get(dh.plot.AxisPosition.LEFT) || [];\n const rightAxes = axisPositionMap.get(dh.plot.AxisPosition.RIGHT) || [];\n const left = Math.max(\n bounds.left,\n bounds.left + (leftAxes.length - 1) * yAxisSize\n );\n const right = Math.min(\n bounds.right - (rightAxes.length - 1) * yAxisSize,\n bounds.right\n );\n layoutAxis.domain = [left, right];\n } else if (axis.type === dh.plot.AxisType.Y) {\n const bottomAxes = axisPositionMap.get(dh.plot.AxisPosition.BOTTOM) || [];\n const topAxes = axisPositionMap.get(dh.plot.AxisPosition.TOP) || [];\n const bottom = Math.max(\n bounds.bottom,\n bounds.bottom + (bottomAxes.length - 1) * xAxisSize\n );\n const top = Math.min(\n bounds.top - (topAxes.length - 1) * xAxisSize,\n bounds.top\n );\n layoutAxis.domain = [bottom, top];\n }\n }\n\n /**\n * Creates range break bounds for plotly from business days.\n * For example a standard business week of ['MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY']\n * will result in [[6,1]] meaning close on Saturday and open on Monday.\n * If you remove Wednesday from the array, then you get two closures [[6, 1], [3, 4]]\n *\n * @param businessDays the days to display on the x-axis\n */\n createBoundsFromDays(businessDays: string[]): Range[] {\n const businessDaysInt = businessDays.map(day =>\n this.daysOfWeek.indexOf(day)\n );\n const nonBusinessDaysInt = this.daysOfWeek\n .filter(day => !businessDays.includes(day))\n .map(day => this.daysOfWeek.indexOf(day));\n // These are the days when business reopens (e.g. Monday after a weekend)\n const reopenDays = new Set<number>();\n nonBusinessDaysInt.forEach(closed => {\n for (let i = closed + 1; i < closed + this.daysOfWeek.length; i += 1) {\n const adjustedDay = i % this.daysOfWeek.length;\n if (businessDaysInt.includes(adjustedDay)) {\n reopenDays.add(adjustedDay);\n break;\n }\n }\n });\n const boundsArray: Range[] = [];\n // For each reopen day, find the furthest previous closed day\n reopenDays.forEach(open => {\n for (let i = open - 1; i > open - this.daysOfWeek.length; i -= 1) {\n const adjustedDay = i < 0 ? i + this.daysOfWeek.length : i;\n if (businessDaysInt.includes(adjustedDay)) {\n const closedDay = (adjustedDay + 1) % 7;\n boundsArray.push([closedDay, open]);\n break;\n }\n }\n });\n return boundsArray;\n }\n\n /**\n * Creates an array of range breaks for all holidays.\n *\n * @param holidays an array of holidays\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createRangeBreakValuesFromHolidays(\n holidays: Holiday[],\n calendarTimeZone: TimeZone,\n formatterTimeZone?: TimeZone\n ): Rangebreaks[] {\n const fullHolidays: string[] = [];\n const partialHolidays: {\n values: string[];\n dvalue: number;\n }[] = [];\n holidays.forEach(holiday => {\n if (holiday.businessPeriods.length > 0) {\n partialHolidays.push(\n ...this.createPartialHoliday(\n holiday,\n calendarTimeZone,\n formatterTimeZone\n )\n );\n } else {\n fullHolidays.push(\n this.createFullHoliday(holiday, calendarTimeZone, formatterTimeZone)\n );\n }\n });\n return [{ values: fullHolidays }, ...partialHolidays];\n }\n\n /**\n * Creates the range break value for a full holiday. A full holiday is day that has no business periods.\n *\n * @param holiday the full holiday\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createFullHoliday(\n holiday: Holiday,\n calendarTimeZone: TimeZone,\n formatterTimeZone?: TimeZone\n ): string {\n return this.adjustDateForTimeZone(\n `${holiday.date.toString()} 00:00:00.000000`,\n calendarTimeZone,\n formatterTimeZone\n );\n }\n\n /**\n * Creates the range break for a partial holiday. A partial holiday is holiday with business periods\n * that are different than the default business periods.\n *\n * @param holiday the partial holiday\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createPartialHoliday(\n holiday: Holiday,\n calendarTimeZone: TimeZone,\n formatterTimeZone?: TimeZone\n ): {\n values: string[];\n dvalue: number;\n }[] {\n // If a holiday has business periods {open1, close1} and {open2, close2}\n // This will generate range breaks for:\n // closed from 00:00 to open1\n // closed from close1 to open2\n // closed from close2 to 23:59:59.999999\n const dateString = holiday.date.toString();\n const closedPeriods = ['00:00'];\n holiday.businessPeriods.forEach(period => {\n closedPeriods.push(period.open);\n closedPeriods.push(period.close);\n });\n // To go up to 23:59:59.999999, we calculate the dvalue using 24 - close\n closedPeriods.push('24:00');\n\n const rangeBreaks = [];\n for (let i = 0; i < closedPeriods.length; i += 2) {\n const startClose = closedPeriods[i];\n const endClose = closedPeriods[i + 1];\n // Skip over any periods where start and close are the same (zero hours)\n if (startClose !== endClose) {\n const values = [\n this.adjustDateForTimeZone(\n `${dateString} ${startClose}:00.000000`,\n calendarTimeZone,\n formatterTimeZone\n ),\n ];\n const dvalue =\n MILLIS_PER_HOUR *\n (ChartUtils.periodToDecimal(endClose) -\n ChartUtils.periodToDecimal(startClose));\n rangeBreaks.push({ values, dvalue });\n }\n }\n return rangeBreaks;\n }\n\n /**\n * Adjusts a date string from the calendar time zone to the formatter time zone.\n *\n * @param dateString the date string\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n adjustDateForTimeZone(\n dateString: string,\n calendarTimeZone: TimeZone,\n formatterTimeZone?: TimeZone\n ): string {\n if (\n formatterTimeZone &&\n formatterTimeZone.standardOffset !== calendarTimeZone.standardOffset\n ) {\n return this.unwrapValue(\n this.wrapValue(dateString, BUSINESS_COLUMN_TYPE, calendarTimeZone),\n formatterTimeZone\n ) as string;\n }\n return dateString;\n }\n\n /**\n * Creates the Figure settings from the Chart Builder settings\n * This should be deprecated at some point, and have Chart Builder create the figure settings directly.\n * This logic will still need to exist to translate existing charts, but could be part of a migration script\n * to translate the data.\n * Change when we decide to add more functionality to the Chart Builder.\n * @param settings The chart builder settings\n * @param settings.title The title for this figure\n * @param settings.xAxis The name of the column to use for the x-axis\n * @param settings.series The name of the columns to use for the series of this figure\n * @param settings.type The plot style for this figure\n */\n makeFigureSettings(\n settings: ChartModelSettings,\n table: TableTemplate\n ): {\n charts: {\n chartType: string;\n axes: { formatType: string; type: string; position: string }[];\n series: {\n plotStyle: string;\n name: string;\n dataSources: {\n type: string;\n columnName: string;\n axis: { formatType: string; type: string; position: string };\n table: TableTemplate;\n }[];\n }[];\n }[];\n title: string;\n } {\n const { dh } = this;\n const { series, xAxis: settingsAxis, type } = settings;\n const title = ChartUtils.titleFromSettings(settings);\n const xAxis = {\n formatType: `${dh.plot.AxisFormatType.NUMBER}`,\n type: `${dh.plot.AxisType.X}`,\n position: `${dh.plot.AxisPosition.BOTTOM}`,\n };\n const yAxis = {\n formatType: `${dh.plot.AxisFormatType.NUMBER}`,\n type: `${dh.plot.AxisType.Y}`,\n position: `${dh.plot.AxisPosition.LEFT}`,\n };\n\n return {\n charts: [\n {\n chartType: `${dh.plot.ChartType.XY}`,\n axes: [xAxis, yAxis],\n series: (series ?? []).map(name => ({\n plotStyle: `${type}`,\n name,\n dataSources: [\n {\n type: `${dh.plot.SourceType.X}`,\n columnName: settingsAxis ?? '',\n axis: xAxis,\n table,\n },\n {\n type: `${dh.plot.SourceType.Y}`,\n columnName: name,\n axis: yAxis,\n table,\n },\n ],\n })),\n },\n ],\n title,\n };\n }\n\n /**\n * Unwraps a value provided from API to a value plotly can understand\n * Eg. Unwraps DateWrapper, LongWrapper objects.\n */\n unwrapValue(value: unknown, timeZone?: TimeZone): unknown {\n const { dh } = this;\n if (value != null) {\n if (isDateWrapper(value)) {\n return dh.i18n.DateTimeFormat.format(\n ChartUtils.DATE_FORMAT,\n value,\n timeZone\n );\n }\n\n if (isLongWrapper(value)) {\n return value.asNumber();\n }\n }\n\n return value;\n }\n\n /**\n *\n * @param value The value to wrap up\n * @param columnType The type of column this value is from\n * @param timeZone The time zone if applicable\n */\n wrapValue(\n value: unknown,\n columnType: string,\n timeZone: TimeZone | null = null\n ): unknown {\n const { dh } = this;\n if (TableUtils.isDateType(columnType) && typeof value === 'string') {\n // Need to limit the format to the actual length of the string range set in plotly\n // Otherwise parse will fail\n const text = value;\n const format = ChartUtils.DATE_FORMAT.substr(0, value.length);\n const date = dh.i18n.DateTimeFormat.parse(format, text);\n if (!timeZone) {\n return date;\n }\n\n // IDS-5994 Due to date parsing, time zone, and daylight savings shenanigans, we need\n // to pass the actual offset with the time to have it parse correctly.\n // However, the offset can change based on the date because of Daylight Savings\n // So we end up parsing the date multiple times. And curse daylight savings.\n const tzFormat = `${format} Z`;\n const estimatedOffset = dh.i18n.DateTimeFormat.format(\n 'Z',\n date,\n timeZone\n );\n const estimatedDate = dh.i18n.DateTimeFormat.parse(\n tzFormat,\n `${text} ${estimatedOffset}`\n );\n const offset = dh.i18n.DateTimeFormat.format(\n 'Z',\n estimatedDate,\n timeZone\n );\n return dh.i18n.DateTimeFormat.parse(tzFormat, `${text} ${offset}`);\n }\n\n return value;\n }\n\n makeLayoutAxis(type: AxisType, theme = ChartTheme): Partial<LayoutAxis> {\n const { dh } = this;\n const axis = {\n automargin: true,\n gridcolor: theme.gridcolor,\n linecolor: theme.linecolor,\n rangeslider: { visible: false },\n showline: true,\n ticklen: 5, // act as padding, can't find a tick padding\n tickcolor: theme.paper_bgcolor, // hide ticks as padding\n tickfont: {\n color: theme.zerolinecolor,\n },\n title: {\n font: {\n color: theme.title_color,\n },\n },\n };\n\n if (type === dh.plot.AxisType.X) {\n Object.assign(axis, {\n showgrid: true,\n });\n } else if (type === dh.plot.AxisType.Y) {\n Object.assign(axis, {\n zerolinecolor: theme.zerolinecolor,\n zerolinewidth: 2,\n });\n }\n\n return axis;\n }\n\n makeDefaultLayout(theme = ChartTheme): Partial<Layout> {\n const { dh } = this;\n const layout: Partial<Layout> = {\n ...theme,\n autosize: true,\n colorway: ChartUtils.getColorwayFromTheme(theme),\n font: {\n family: \"'Fira Sans', sans-serif\",\n },\n title: {\n font: {\n color: theme.title_color,\n },\n yanchor: 'top',\n pad: { ...ChartUtils.DEFAULT_TITLE_PADDING },\n y: 1,\n },\n legend: {\n font: {\n color: theme.title_color,\n },\n },\n margin: { ...ChartUtils.DEFAULT_MARGIN },\n xaxis: this.makeLayoutAxis(dh.plot.AxisType.X, theme),\n yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme),\n polar: {\n angularaxis: this.makeLayoutAxis(dh.plot.AxisType.SHAPE, theme),\n radialaxis: this.makeLayoutAxis(dh.plot.AxisType.SHAPE, theme),\n bgcolor: theme.plot_bgcolor,\n },\n scene: {\n xaxis: this.makeLayoutAxis(dh.plot.AxisType.X, theme),\n yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme),\n zaxis: this.makeLayoutAxis(dh.plot.AxisType.Z, theme),\n },\n };\n layout.datarevision = 0;\n return layout;\n }\n\n /**\n * Hydrate settings from a JSONable object\n * @param settings Dehydrated settings\n */\n hydrateSettings(\n settings: ChartModelSettings\n ): Omit<ChartModelSettings, 'type'> & { type?: SeriesPlotStyle } {\n const { dh } = this;\n return {\n ...settings,\n type:\n settings.type != null\n ? dh.plot.SeriesPlotStyle[settings.type]\n : undefined,\n };\n }\n}\n\nexport default ChartUtils;\n","import React, { Component, ReactElement, RefObject } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport {\n vsLoading,\n dhGraphLineDown,\n dhWarningFilled,\n IconDefinition,\n} from '@deephaven/icons';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport {\n Formatter,\n FormatterUtils,\n DateUtils,\n DateTimeColumnFormatterOptions,\n DecimalColumnFormatterOptions,\n IntegerColumnFormatterOptions,\n FormattingRule,\n ColumnFormatSettings,\n DateTimeFormatSettings,\n} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { Layout, Icon, Data, PlotData } from 'plotly.js';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\nimport ChartModel from './ChartModel';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\ntype FormatterSettings = ColumnFormatSettings &\n DateTimeFormatSettings & {\n decimalFormatOptions?: DecimalColumnFormatterOptions;\n integerFormatOptions?: IntegerColumnFormatterOptions;\n };\n\ninterface ChartProps {\n dh: DhType;\n model: ChartModel;\n settings: FormatterSettings;\n isActive: boolean;\n PlotComponent?: typeof Plot;\n onDisconnect: () => void;\n onReconnect: () => void;\n onUpdate: (obj: { isLoading: boolean }) => void;\n onError: (error: Error) => void;\n onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;\n}\n\ninterface ChartState {\n data: Partial<Data>[] | null;\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n layout: Partial<Layout>;\n revision: number;\n}\n\nexport class Chart extends Component<ChartProps, ChartState> {\n static defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n PlotComponent: Plot,\n onDisconnect: (): void => undefined,\n onReconnect: (): void => undefined,\n onUpdate: (): void => undefined,\n onError: (): void => undefined,\n onSettingsChanged: (): void => undefined,\n };\n\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon: IconDefinition): Icon {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n const stringPath = `${path}`;\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n\n return isDownsamplingDisabled\n ? 'Downsampling disabled, click to enable'\n : 'Downsampling enabled, click to disable';\n }\n\n static downsampleButtonAttr(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string | undefined {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props: ChartProps) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount(): void {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount(): void {\n this.unsubscribe();\n }\n\n currentSeries: number;\n\n plot: RefObject<typeof Plot>;\n\n plotWrapper: RefObject<HTMLDivElement>;\n\n columnFormats?: FormattingRule[];\n\n dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;\n\n decimalFormatOptions: DecimalColumnFormatterOptions;\n\n integerFormatOptions: IntegerColumnFormatterOptions;\n\n rect?: DOMRect;\n\n ranges?: unknown;\n\n isSubscribed: boolean;\n\n isLoadedFired: boolean;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean,\n is3d: boolean\n ) => {\n const customButtons = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n hasDownsampleError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const attr = Chart.downsampleButtonAttr(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n is3d ? ['zoom3d', 'pan3d'] : ['zoom2d', 'pan2d'],\n is3d\n ? ['orbitRotation', 'tableRotation', 'resetCameraDefault3d']\n : ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect(): DOMRect | null {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData(): void {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe(): void {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe(): void {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot(): void {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick(): void {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event: CustomEvent): void {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ?? detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: { layout: Layout }): void {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes: { hiddenlabels?: string[] }): void {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: [\n Record<string, unknown>,\n number[]\n ]): void {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n if (data != null) {\n const hiddenSeries = (data as Partial<PlotData>[]).reduce(\n (acc: string[], { name, visible }) =>\n name != null && visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false): void {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter(): void {\n const { settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n }\n\n updateFormatterSettings(settings: FormatterSettings): void {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter(): void {\n const { dh } = this.props;\n const formatter = new Formatter(\n dh,\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(\n (e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n }\n );\n }\n }\n\n render(): ReactElement {\n const { PlotComponent } = this.props;\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n data?.[0].type?.includes('3d') ?? false\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <PlotComponent\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onError={log.error}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nexport default Chart;\n","/* eslint class-methods-use-this: \"off\" */\nimport memoize from 'memoizee';\nimport debounce from 'lodash.debounce';\nimport set from 'lodash.set';\nimport type {\n Axis,\n Chart,\n dh as DhType,\n Figure,\n OneClick,\n Series,\n SourceType,\n} from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { Range } from '@deephaven/utils';\nimport { Layout, Data, PlotData } from 'plotly.js';\nimport type {\n DateTimeColumnFormatter,\n Formatter,\n} from '@deephaven/jsapi-utils';\nimport ChartModel, { ChartEvent } from './ChartModel';\nimport ChartUtils, {\n AxisTypeMap,\n ChartModelSettings,\n FilterColumnMap,\n FilterMap,\n} from './ChartUtils';\nimport ChartTheme from './ChartTheme';\n\nconst log = Log.module('FigureChartModel');\n\n/**\n * Takes a Figure object from a widget to make a model for a chart\n */\nclass FigureChartModel extends ChartModel {\n static ADD_SERIES_DEBOUNCE = 50;\n\n /**\n * @param dh JSAPI instance\n * @param figure The figure object created by the API\n * @param settings Chart settings\n */\n constructor(\n dh: DhType,\n figure: Figure,\n settings: Partial<ChartModelSettings> = {},\n theme: typeof ChartTheme = ChartTheme\n ) {\n super();\n\n this.handleFigureUpdated = this.handleFigureUpdated.bind(this);\n this.handleFigureDisconnected = this.handleFigureDisconnected.bind(this);\n this.handleFigureReconnected = this.handleFigureReconnected.bind(this);\n this.handleFigureSeriesAdded = this.handleFigureSeriesAdded.bind(this);\n this.handleDownsampleStart = this.handleDownsampleStart.bind(this);\n this.handleDownsampleFinish = this.handleDownsampleFinish.bind(this);\n this.handleDownsampleFail = this.handleDownsampleFail.bind(this);\n this.handleDownsampleNeeded = this.handleDownsampleNeeded.bind(this);\n this.handleRequestFailed = this.handleRequestFailed.bind(this);\n\n this.dh = dh;\n this.chartUtils = new ChartUtils(dh);\n this.figure = figure;\n this.settings = settings;\n this.theme = theme;\n this.data = [];\n const template = {\n data: {},\n layout: this.chartUtils.makeDefaultLayout(theme),\n };\n this.layout = {\n grid: {\n rows: figure.rows,\n columns: figure.cols,\n pattern: 'independent',\n },\n template,\n };\n this.seriesDataMap = new Map();\n this.pendingSeries = [];\n this.oneClicks = [];\n this.filterColumnMap = new Map();\n this.lastFilter = new Map();\n this.isConnected = true; // Assume figure is connected to start\n this.seriesToProcess = new Set();\n\n this.setTitle(this.getDefaultTitle());\n this.initAllSeries();\n this.updateAxisPositions();\n this.startListeningFigure();\n }\n\n chartUtils: ChartUtils;\n\n dh: DhType;\n\n figure: Figure;\n\n settings: Partial<ChartModelSettings>;\n\n theme: typeof ChartTheme;\n\n data: Partial<Data>[];\n\n layout: Partial<Layout>;\n\n seriesDataMap: Map<\n string,\n Partial<PlotData> & {\n xLow?: number[];\n xHigh?: number[];\n yLow?: number[];\n yHigh?: number[];\n }\n >;\n\n pendingSeries: Series[];\n\n oneClicks: OneClick[];\n\n filterColumnMap: FilterColumnMap;\n\n lastFilter: FilterMap;\n\n isConnected: boolean; // Assume figure is connected to start\n\n seriesToProcess;\n\n close(): void {\n this.figure.close();\n this.addPendingSeries.cancel();\n this.stopListeningFigure();\n }\n\n getDefaultTitle(): string {\n if (this.figure.charts.length > 0) {\n const chart = this.figure.charts[0];\n return chart.title;\n }\n\n return '';\n }\n\n initAllSeries(): void {\n this.oneClicks = [];\n this.filterColumnMap.clear();\n\n const { charts } = this.figure;\n const axes = ChartUtils.getAllAxes(this.figure);\n const activeSeriesNames: string[] = [];\n for (let i = 0; i < charts.length; i += 1) {\n const chart = charts[i];\n\n for (let j = 0; j < chart.series.length; j += 1) {\n const series = chart.series[j];\n activeSeriesNames.push(series.name);\n this.addSeries(series, axes, chart.showLegend);\n }\n }\n\n // Remove any series that no longer exist\n const allSeriesNames = [...this.seriesDataMap.keys()];\n const inactiveSeriesNames = allSeriesNames.filter(\n seriesName => activeSeriesNames.indexOf(seriesName) < 0\n );\n for (let i = 0; i < inactiveSeriesNames.length; i += 1) {\n const seriesName = inactiveSeriesNames[i];\n this.seriesDataMap.delete(seriesName);\n }\n this.seriesToProcess = new Set([...this.seriesDataMap.keys()]);\n }\n\n /**\n * Add a series to the model\n * @param series Series object to add\n * @param axes All the axis in this figure\n * @param showLegend Whether this series should show the legend or not\n */\n addSeries(series: Series, axes: Axis[], showLegend: boolean | null): void {\n const { dh } = this;\n const axisTypeMap: AxisTypeMap = ChartUtils.groupArray(axes, 'type');\n\n const seriesData = this.chartUtils.makeSeriesDataFromSeries(\n series,\n axisTypeMap,\n ChartUtils.getSeriesVisibility(series.name, this.settings),\n showLegend,\n this.theme\n );\n\n this.seriesDataMap.set(series.name, seriesData);\n\n this.data = [...this.seriesDataMap.values()];\n\n if (series.plotStyle === dh.plot.SeriesPlotStyle.STACKED_BAR) {\n this.layout.barmode = 'stack';\n } else if (series.plotStyle === dh.plot.SeriesPlotStyle.PIE) {\n this.layout.hiddenlabels = ChartUtils.getHiddenLabels(this.settings);\n }\n\n // We only want to force hide the legend if there is only one series that is not a PIE\n // Right now this means that if the user only has one series, they cannot explicitly show the legend until deephaven-core#3254 is implemented\n // TODO: deephaven-core#3254, once done, this can be removed.\n this.layout.showlegend =\n this.data.length > 1 || series.plotStyle === dh.plot.SeriesPlotStyle.PIE\n ? showLegend ?? undefined\n : false;\n\n if (series.oneClick != null) {\n const { oneClick } = series;\n const { columns } = oneClick;\n for (let i = 0; i < columns.length; i += 1) {\n this.filterColumnMap.set(columns[i].name, columns[i]);\n }\n\n this.oneClicks.push(oneClick);\n }\n\n this.updateLayoutFormats();\n }\n\n // We need to debounce adding series so we subscribe to them all in the same tick\n // This should no longer be necessary after IDS-5049 lands\n addPendingSeries = debounce(() => {\n const axes = ChartUtils.getAllAxes(this.figure);\n const { pendingSeries } = this;\n for (let i = 0; i < pendingSeries.length; i += 1) {\n const series = pendingSeries[i];\n const chart = this.figure.charts.find(c => c.series.includes(series));\n this.addSeries(series, axes, chart?.showLegend ?? null);\n\n series.subscribe();\n // We'll get an update with the data after subscribing\n }\n\n this.pendingSeries = [];\n }, FigureChartModel.ADD_SERIES_DEBOUNCE);\n\n subscribe(callback: (event: ChartEvent) => void): void {\n super.subscribe(callback);\n\n if (this.listeners.length === 1) {\n // Need to initialize the series here as we may have missed some series when not subscribed\n this.initAllSeries();\n this.subscribeFigure();\n }\n }\n\n unsubscribe(callback: (event: ChartEvent) => void): void {\n super.unsubscribe(callback);\n\n if (this.listeners.length === 0) {\n this.unsubscribeFigure();\n }\n }\n\n subscribeFigure(): void {\n if (!this.isConnected) {\n log.debug('Ignoring subscribe when figure in disconnected state');\n return;\n }\n\n this.figure.subscribe(\n this.isDownsamplingDisabled\n ? this.dh.plot.DownsampleOptions.DISABLE\n : this.dh.plot.DownsampleOptions.DEFAULT\n );\n }\n\n unsubscribeFigure(): void {\n this.figure.unsubscribe();\n }\n\n startListeningFigure(): void {\n const { dh } = this;\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_UPDATED,\n this.handleFigureUpdated\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_SERIES_ADDED,\n this.handleFigureSeriesAdded\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_DISCONNECT,\n this.handleFigureDisconnected\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_RECONNECT,\n this.handleFigureReconnected\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLESTARTED,\n this.handleDownsampleStart\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLEFINISHED,\n this.handleDownsampleFinish\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLEFAILED,\n this.handleDownsampleFail\n );\n this.figure.addEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLENEEDED,\n this.handleDownsampleNeeded\n );\n this.figure.addEventListener(\n dh.Client.EVENT_REQUEST_FAILED,\n this.handleRequestFailed\n );\n }\n\n stopListeningFigure(): void {\n const { dh } = this;\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_UPDATED,\n this.handleFigureUpdated\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_SERIES_ADDED,\n this.handleFigureSeriesAdded\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_DISCONNECT,\n this.handleFigureDisconnected\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_RECONNECT,\n this.handleFigureReconnected\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLESTARTED,\n this.handleDownsampleStart\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLEFINISHED,\n this.handleDownsampleFinish\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLEFAILED,\n this.handleDownsampleFail\n );\n this.figure.removeEventListener(\n dh.plot.Figure.EVENT_DOWNSAMPLENEEDED,\n this.handleDownsampleNeeded\n );\n this.figure.removeEventListener(\n dh.Client.EVENT_REQUEST_FAILED,\n this.handleRequestFailed\n );\n }\n\n getTimeZone = memoize(\n (columnType: string, formatter: Formatter | undefined) => {\n if (formatter != null) {\n const dataFormatter = formatter.getColumnTypeFormatter(columnType);\n if (dataFormatter != null) {\n return (dataFormatter as DateTimeColumnFormatter).dhTimeZone;\n }\n }\n return undefined;\n }\n );\n\n getValueTranslator = memoize(\n (columnType: string, formatter: Formatter | undefined) => {\n const timeZone = this.getTimeZone(columnType, formatter);\n return (value: unknown) => this.chartUtils.unwrapValue(value, timeZone);\n }\n );\n\n /** Gets the parser for a value with the provided column type */\n getValueParser = memoize(\n (columnType: string, formatter: Formatter | undefined) => {\n const timeZone = this.getTimeZone(columnType, formatter);\n return (value: unknown) =>\n this.chartUtils.wrapValue(value, columnType, timeZone);\n }\n );\n\n /**\n * Gets the range parser for a particular column type\n */\n getRangeParser = memoize(\n (columnType: string, formatter?: Formatter) => (range: Range) => {\n let [rangeStart, rangeEnd]: [unknown, unknown] = range;\n const valueParser = this.getValueParser(columnType, formatter);\n rangeStart = valueParser(rangeStart);\n rangeEnd = valueParser(rangeEnd);\n return [rangeStart, rangeEnd];\n }\n );\n\n /**\n * Gets the parser for parsing the range from an axis within the given chart\n */\n getAxisRangeParser = memoize(\n (chart: Chart, formatter?: Formatter) => (axis: Axis) => {\n const source = ChartUtils.getSourceForAxis(chart, axis);\n if (source != null) {\n return this.getRangeParser(source.columnType, formatter);\n }\n\n return (range: [unknown, unknown]) => range;\n }\n );\n\n handleDownsampleStart(event: ChartEvent): void {\n log.debug('Downsample started', event);\n\n this.fireDownsampleStart(event.detail);\n }\n\n handleDownsampleFinish(event: ChartEvent): void {\n log.debug('Downsample finished', event);\n\n this.fireDownsampleFinish(event.detail);\n }\n\n handleDownsampleFail(event: ChartEvent): void {\n log.error('Downsample failed', event);\n\n this.fireDownsampleFail(event.detail);\n }\n\n handleDownsampleNeeded(event: ChartEvent): void {\n log.info('Downsample needed', event);\n\n this.fireDownsampleNeeded(event.detail);\n }\n\n handleFigureUpdated(event: ChartEvent): void {\n const { detail: figureUpdateEvent } = event;\n const { series: seriesArray } = figureUpdateEvent;\n\n log.debug2('handleFigureUpdated', seriesArray);\n\n for (let i = 0; i < seriesArray.length; i += 1) {\n const series = seriesArray[i];\n\n log.debug2('handleFigureUpdated updating series', series.name);\n\n const { sources } = series;\n for (let j = 0; j < sources.length; j += 1) {\n const source = sources[j];\n const { columnType, type } = source;\n const valueTranslator = this.getValueTranslator(\n columnType,\n this.formatter\n );\n const dataArray = figureUpdateEvent.getArray(\n series,\n type,\n valueTranslator\n );\n this.setDataArrayForSeries(series, type, dataArray);\n }\n\n this.seriesToProcess.delete(series.name);\n if (this.seriesToProcess.size === 0) {\n this.fireLoadFinished();\n }\n\n this.cleanSeries(series);\n }\n\n const { data } = this;\n this.fireUpdate(data);\n }\n\n handleRequestFailed(event: ChartEvent): void {\n log.error('Request failed', event);\n }\n\n /**\n * Resubscribe to the figure, should be done if settings change\n */\n resubscribe(): void {\n if (this.listeners.length > 0) {\n this.unsubscribeFigure();\n this.subscribeFigure();\n }\n }\n\n setFormatter(formatter: Formatter): void {\n super.setFormatter(formatter);\n\n this.updateLayoutFormats();\n\n // Unsubscribe and resubscribe to trigger a data update\n // Data may need to be translated again because of the new formatter\n this.resubscribe();\n }\n\n setDownsamplingDisabled(isDownsamplingDisabled: boolean): void {\n super.setDownsamplingDisabled(isDownsamplingDisabled);\n\n this.resubscribe();\n }\n\n handleFigureDisconnected(event: CustomEvent): void {\n log.debug('Figure disconnected', event);\n\n this.isConnected = false;\n\n if (this.listeners.length > 0) {\n this.unsubscribeFigure();\n }\n\n this.fireDisconnect();\n }\n\n handleFigureReconnected(event: CustomEvent): void {\n log.debug('Figure reconnected', event);\n\n this.isConnected = true;\n\n // It's possible the series have changed completely, as the query could have been changed\n this.initAllSeries();\n\n this.fireReconnect();\n\n if (this.listeners.length > 0) {\n this.subscribeFigure();\n }\n }\n\n handleFigureSeriesAdded(event: { detail: Series }): void {\n const { detail: series } = event;\n log.debug('handleFigureSeriesAdded', series);\n\n this.pendingSeries.push(series);\n this.addPendingSeries();\n }\n\n setDimensions(rect: DOMRect): void {\n super.setDimensions(rect);\n\n this.updateAxisPositions();\n }\n\n setTitle(title: string): void {\n super.setTitle(title);\n\n // Need to recalculate the padding based on how many lines of text the title is\n // Plotly doesn't handle positioning it correctly, and it's an undocumented feature\n const subtitleCount = (title ?? '').match(/<br>/g)?.length ?? 0;\n const margin =\n ChartUtils.DEFAULT_MARGIN.t +\n subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT;\n\n if (this.layout.margin) {\n this.layout.margin.t = margin;\n } else {\n this.layout.margin = { t: margin };\n }\n\n if (typeof this.layout.title === 'string') {\n this.layout.title = title;\n } else {\n this.layout.title = { ...this.layout.title };\n this.layout.title.text = title;\n this.layout.title.pad = { ...this.layout.title.pad };\n this.layout.title.pad.t =\n ChartUtils.DEFAULT_TITLE_PADDING.t +\n subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT * 0.5;\n }\n }\n\n getPlotWidth(): number {\n if (!this.rect || !this.rect.width) {\n return 0;\n }\n\n return Math.max(\n this.rect.width -\n (this.layout.margin?.l ?? 0) -\n (this.layout.margin?.r ?? 0),\n 0\n );\n }\n\n getPlotHeight(): number {\n if (!this.rect || !this.rect.height) {\n return 0;\n }\n\n return Math.max(\n this.rect.height -\n (this.layout.margin?.t ?? 0) -\n (this.layout.margin?.b ?? 0),\n 0\n );\n }\n\n updateAxisPositions(): void {\n const plotWidth = this.getPlotWidth();\n const plotHeight = this.getPlotHeight();\n this.chartUtils.updateFigureAxes(\n this.layout,\n this.figure,\n chart => this.getAxisRangeParser(chart, this.formatter),\n plotWidth,\n plotHeight,\n this.theme\n );\n }\n\n /**\n * Updates the format patterns used\n */\n updateLayoutFormats(): void {\n if (!this.formatter) {\n return;\n }\n\n const axisFormats = this.chartUtils.getAxisFormats(\n this.figure,\n this.formatter\n );\n axisFormats.forEach((axisFormat, axisLayoutProperty) => {\n log.debug(\n `Assigning ${axisLayoutProperty}`,\n this.layout[axisLayoutProperty],\n axisFormat\n );\n\n const props = this.layout[axisLayoutProperty];\n if (props != null) {\n Object.assign(props, axisFormat);\n } else {\n log.debug(`Ignoring null layout.${axisLayoutProperty}`);\n }\n });\n }\n\n /**\n * Set a specific array for the array of series properties specified.\n * @param series The series to set the data array for.\n * @param sourceType The source type within that series to set the data for.\n * @param dataArray The array to use for the data for this series source.\n */\n setDataArrayForSeries(\n series: Series,\n sourceType: SourceType,\n dataArray: unknown[]\n ): void {\n const { name, plotStyle } = series;\n\n const seriesData = this.seriesDataMap.get(name);\n const property = this.chartUtils.getPlotlyProperty(plotStyle, sourceType);\n\n if (seriesData) {\n set(seriesData, property, dataArray);\n }\n }\n\n /**\n * After setting all the data in the series data, we may need to adjust some other properties\n * Eg. Calculating the width from the xLow/xHigh values; Plot.ly uses `width` instead of a low/high\n * value for x.\n * @param series The series to clean the data for\n */\n cleanSeries(series: Series): void {\n const { dh } = this;\n const { name, plotStyle } = series;\n const seriesData = this.seriesDataMap.get(name);\n if (seriesData == null) {\n return;\n }\n if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {\n const { xLow, xHigh } = seriesData;\n if (xLow && xHigh && xLow.length === xHigh.length) {\n const width = [];\n for (let i = 0; i < xLow.length; i += 1) {\n width.push(xHigh[i] - xLow[i]);\n }\n seriesData.width = width;\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.LINE) {\n const { x, xLow, xHigh, y, yLow, yHigh } = seriesData;\n if (xLow && xHigh && xLow !== x) {\n seriesData.error_x = ChartUtils.getPlotlyErrorBars(\n x as number[],\n xLow,\n xHigh\n );\n }\n if (yLow && yHigh && yLow !== y) {\n seriesData.error_y = ChartUtils.getPlotlyErrorBars(\n y as number[],\n yLow,\n yHigh\n );\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {\n const { ids, labels } = seriesData;\n if (ids !== undefined && labels === undefined) {\n // If the user only provided IDs, we assign the IDs to the labels property as well automatically\n // Plotly uses the labels primarily, which from our API perspective seems kind of backwards\n seriesData.labels = ids;\n }\n }\n }\n\n getData(): Partial<Data>[] {\n return this.data;\n }\n\n getLayout(): Partial<Layout> {\n return this.layout;\n }\n\n getFilterColumnMap(): FilterColumnMap {\n return new Map(this.filterColumnMap);\n }\n\n isFilterRequired(): boolean {\n return (\n this.oneClicks.find(oneClick => oneClick.requireAllFiltersToDisplay) !=\n null\n );\n }\n\n /**\n * Sets the filter on the model. Will only set the values that have changed.\n * @param filterMap Map of filter column names to values\n */\n setFilter(filterMap: FilterMap): void {\n if (this.oneClicks.length === 0) {\n log.warn('Trying to set a filter, but no one click!');\n return;\n }\n\n log.debug('setFilter', filterMap);\n\n for (let i = 0; i < this.oneClicks.length; i += 1) {\n const oneClick = this.oneClicks[i];\n const { columns } = oneClick;\n // Need to get all the keys in case a filter was removed\n const keys = new Set([...filterMap.keys(), ...this.lastFilter.keys()]);\n keys.forEach(key => {\n const value = filterMap.get(key);\n if (\n this.lastFilter.get(key) !== value &&\n columns.find(column => column.name === key) != null\n ) {\n oneClick.setValueForColumn(key, value);\n }\n });\n }\n\n this.lastFilter = new Map(filterMap);\n }\n\n setFigure(figure: Figure): void {\n this.close();\n\n this.figure = figure;\n\n this.setTitle(this.getDefaultTitle());\n this.initAllSeries();\n this.updateAxisPositions();\n this.startListeningFigure();\n if (this.listeners.length > 0) {\n this.subscribeFigure();\n }\n }\n\n updateSettings(settings: Partial<ChartModelSettings>): void {\n this.settings = settings;\n }\n}\n\nexport default FigureChartModel;\n","import type { dh as DhType, Figure, Table } from '@deephaven/jsapi-types';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport FigureChartModel from './FigureChartModel';\nimport ChartTheme from './ChartTheme';\nimport ChartModel from './ChartModel';\n\nclass ChartModelFactory {\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The ChartModel Promise representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static async makeModelFromSettings(\n dh: DhType,\n settings: ChartModelSettings,\n table: Table,\n theme = ChartTheme\n ): Promise<ChartModel> {\n const figure = await ChartModelFactory.makeFigureFromSettings(\n dh,\n settings,\n table\n );\n return new FigureChartModel(dh, figure, settings, theme);\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @returns The Figure created with the settings provided\n */\n static async makeFigureFromSettings(\n dh: DhType,\n settings: ChartModelSettings,\n table: Table\n ): Promise<Figure> {\n // Copy the table first and then re-apply the filters from the original table\n // When we add table linking we'll want to listen to the original table and update\n // the copied table with any changes that occur.\n // The table gets owned by the Figure that gets created, which closes the table\n const tableCopy = await table.copy();\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n\n return dh.plot.Figure.create(\n new ChartUtils(dh).makeFigureSettings(settings, tableCopy)\n );\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param figure The figure to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The FigureChartModel representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static async makeModel(\n dh: DhType,\n settings: ChartModelSettings | undefined,\n figure: Figure,\n theme = ChartTheme\n ): Promise<ChartModel> {\n return new FigureChartModel(dh, figure, settings, theme);\n }\n}\n\nexport default ChartModelFactory;\n","import React, { useEffect, useMemo, useState } from 'react';\nimport { Chart, ChartModel, ChartModelFactory } from '@deephaven/chart'; // chart is used to display Deephaven charts\nimport { ContextMenuRoot, LoadingOverlay } from '@deephaven/components'; // Use the loading spinner from the Deephaven components package\nimport type { dh as DhType, IdeConnection } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport './App.scss'; // Styles for in this app\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { useConnection } from '@deephaven/app-utils';\n\nconst log = Log.module('EmbedChart.App');\n\n/**\n * Load an existing Deephaven figure with the connection provided\n * @param dh JSAPI instance\n * @param connection The Deephaven session object\n * @param name Name of the figure to load\n * @returns Deephaven figure\n */\nasync function loadFigure(dh: DhType, connection: IdeConnection, name: string) {\n log.info(`Fetching figure ${name}...`);\n\n const definition = { name, type: dh.VariableType.FIGURE };\n return connection.getObject(definition);\n}\n\n/**\n * A functional React component that displays a Deephaven figure using the @deephaven/chart package.\n * It will attempt to open and display the figure specified with the `name` parameter, expecting it to be present on the server.\n * E.g. http://localhost:3000/?name=myFigure will attempt to open a figure `myFigure`\n * If no query param is provided, it will display an error.\n * By default, tries to connect to the server defined in the VITE_CORE_API_URL variable, which is set to http://localhost:10000/jsapi\n * See create-react-app docs for how to update these env vars: https://create-react-app.dev/docs/adding-custom-environment-variables/\n */\nfunction App(): JSX.Element {\n const [model, setModel] = useState<ChartModel>();\n const [error, setError] = useState<string>();\n const [isLoading, setIsLoading] = useState(true);\n const searchParams = useMemo(\n () => new URLSearchParams(window.location.search),\n []\n );\n const connection = useConnection();\n const dh = useApi();\n\n useEffect(\n function initializeApp() {\n async function initApp() {\n try {\n // Get the table name from the query param `name`.\n const name = searchParams.get('name');\n\n if (name == null) {\n throw new Error('No name param provided');\n }\n\n log.debug('Loading figure', name, '...');\n\n // Load the figure up.\n const figure = await loadFigure(dh, connection, name);\n\n // Create the `ChartModel` for use with the `Chart` component\n log.debug(`Creating model...`);\n\n const newModel = await ChartModelFactory.makeModel(\n dh,\n undefined,\n figure\n );\n\n setModel(newModel);\n\n log.debug('Figure successfully loaded!');\n } catch (e: unknown) {\n log.error('Unable to load figure', e);\n setError(`${e}`);\n }\n setIsLoading(false);\n }\n initApp();\n },\n [dh, connection, searchParams]\n );\n\n const isLoaded = model != null;\n\n return (\n <div className=\"App\">\n {isLoaded && <Chart dh={dh} model={model} />}\n {!isLoaded && (\n <LoadingOverlay\n isLoaded={isLoaded}\n isLoading={isLoading}\n errorMessage={error ?? null}\n />\n )}\n <ContextMenuRoot />\n </div>\n );\n}\n\nexport default App;\n"],"names":["Plotly","bar","histogram","pie","ohlc","scattergl","treemap","Plot","createPlotlyComponent","_ChartModel","__publicField","filter","formatter","isDownsamplingDisabled","rect","title","callback","listener","event","i","data","detail","ChartModel","ChartModel$1","ChartTheme","log","Log","BUSINESS_COLUMN_TYPE","MILLIS_PER_HOUR","NANOS_PER_MILLI","isDateWrapper","value","isLongWrapper","isDateTimeColumnFormatter","isRangedPlotlyAxis","_ChartUtils","dh","x","xLow","xHigh","array","arrayminus","prefix","columnType","formatPattern","matchArray","assertNotNull","placeholderDigits","zeroDigits","decimalDigits","optionalDecimalDigits","numberType","percentSign","suffix","paddingLength","comma","plotlyNumberType","type","decimalLength","tickformat","tickprefix","ticksuffix","axisFormat","axis","isDateType","gapBetweenMajorTicks","updatedFormat","tickSpacing","chart","series","j","source","name","settings","mode","showLegend","orientation","deephavenShape","figure","axes","charts","layout","ranges","keys","key","axisProperty","axisIndex","axisIndexString","period","values","property","result","item","group","theme","colorway","xAxis","axisFormats","nullFormat","allAxes","axisTypeMap","sources","axisSources","k","axisType","typeAxes","axisLayoutProperty","businessCalendar","rangebreaks","businessPeriods","businessDays","holidays","calendarTimeZone","typeFormatter","formatterTimeZone","timeZoneDiff","weekendBounds","plotStyle","isBusinessTime","areLinesVisible","areShapesVisible","modes","sourceType","_b","_a","seriesVisibility","isLinesVisible","isShapesVisible","lineColor","shapeColor","shape","shapeSize","seriesData","seriesDataParam","dataAttributeName","set","e","axisPosition","layoutParam","chartAxisRangeParser","plotWidth","plotHeight","figureAxes","axisRangeParser","bounds","cols","rows","column","colspan","row","rowspan","endColumn","endRow","columnSize","rowSize","xMarginSize","yMarginSize","dataFormatter","TableUtils","chartAxes","xAxisSize","yAxisSize","axisPositionMap","axisTypes","figureAxisTypeMap","figureTypeAxes","plotSize","chartAxisIndex","figureAxisIndex","layoutAxis","range","autorange","rangeParser","rangeStart","rangeEnd","figureAxisTypes","layoutAxisParam","axisSize","label","positionAxes","sideIndex","leftAxes","rightAxes","left","right","bottomAxes","topAxes","bottom","top","businessDaysInt","day","nonBusinessDaysInt","reopenDays","closed","adjustedDay","boundsArray","open","closedDay","fullHolidays","partialHolidays","holiday","dateString","closedPeriods","rangeBreaks","startClose","endClose","dvalue","table","settingsAxis","yAxis","timeZone","text","format","date","tzFormat","estimatedOffset","estimatedDate","offset","ChartUtils","ChartUtils$1","_Chart","Component","props","memoize","downsamplingError","isDownsampleFinished","isDownsampleInProgress","is3d","customButtons","hasDownsampleError","dhWarningFilled","attr","icon","vsLoading","dhGraphLineDown","React","faIcon","width","path","stringPath","isActive","prevProps","model","state","revision","onUpdate","onDisconnect","onReconnect","onError","deepEqual","changes","onSettingsChanged","hiddenSeries","seriesIndexes","acc","visible","force","columnFormats","FormatterUtils","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","Formatter","PlotComponent","config","isPlotShown","jsx","Chart","DateUtils","Chart$1","_FigureChartModel","debounce","pendingSeries","c","valueParser","template","activeSeriesNames","inactiveSeriesNames","seriesName","oneClick","columns","figureUpdateEvent","seriesArray","valueTranslator","dataArray","subtitleCount","margin","y","yLow","yHigh","ids","labels","filterMap","FigureChartModel","FigureChartModel$1","ChartModelFactory","tableCopy","ChartModelFactory$1","loadFigure","connection","definition","App","setModel","useState","error","setError","isLoading","setIsLoading","searchParams","useMemo","useConnection","useApi","useEffect","initApp","newModel","isLoaded","jsxs","LoadingOverlay","ContextMenuRoot"],"mappings":"2jBAaAA,GAAO,SAAS,CAACC,GAAKC,GAAWC,GAAKC,GAAMC,GAAWC,EAAO,CAAC,ECJ/D,MAAeC,GAAA,OAAOC,IAA0B,WAC5CA,GAAsBR,EAAM,EAC5BQ,GAAsB,QAAQR,EAAM,ECElCS,EAAN,KAAiB,CAiBf,aAAc,CAKdC,EAAA,kBAEAA,EAAA,kBAEAA,EAAA,aAEAA,EAAA,+BAEAA,EAAA,cAZE,KAAK,UAAY,GACjB,KAAK,uBAAyB,EAChC,CAYA,SAA2B,CACzB,MAAO,EACT,CAEA,iBAA0B,CACjB,MAAA,EACT,CAEA,WAA6B,CAC3B,MAAO,EACT,CAEA,oBAAsC,CACpC,WAAW,GACb,CAEA,kBAA4B,CACnB,MAAA,EACT,CAGA,UAAUC,EAAyB,CAAC,CAMpC,OAAc,CAAC,CAMf,aAAaC,EAA4B,CACvC,KAAK,UAAYA,CACnB,CAMA,wBAAwBC,EAAuC,CAC7D,KAAK,uBAAyBA,CAChC,CAMA,cAAcC,EAAqB,CACjC,KAAK,KAAOA,CACd,CAEA,SAASC,EAAqB,CAC5B,KAAK,MAAQA,CACf,CAMA,UAAUC,EAA6C,CAChD,KAAA,UAAU,KAAKA,CAAQ,CAC9B,CAEA,YAAYA,EAA6C,CACvD,KAAK,UAAY,KA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,EAAaW,KACblR,EAAKmR,KAEXC,EAAA,UACE,UAAyB,CACvB,eAAeC,GAAU,CACnB,GAAA,CAEI,MAAAjP,EAAO4O,EAAa,IAAI,MAAM,EAEpC,GAAI5O,GAAQ,KACJ,MAAA,IAAI,MAAM,wBAAwB,EAGtC/C,EAAA,MAAM,iBAAkB+C,EAAM,KAAK,EAGvC,MAAMM,EAAS,MAAM4N,GAAWtQ,EAAIuQ,EAAYnO,CAAI,EAGpD/C,EAAI,MAAM,mBAAmB,EAEvB,MAAAiS,EAAW,MAAMnB,GAAkB,UACvCnQ,EACA,OACA0C,CAAA,EAGFgO,EAASY,CAAQ,EAEjBjS,EAAI,MAAM,6BAA6B,QAChC+G,GACH/G,EAAA,MAAM,wBAAyB+G,CAAC,EACpCyK,EAAS,GAAGzK,GAAG,CACjB,CACA2K,EAAa,EAAK,CACpB,CACQM,GACV,EACA,CAACrR,EAAIuQ,EAAYS,CAAY,CAAA,EAG/B,MAAMO,EAAWzE,GAAS,KAGxB,OAAA0E,EAAA,KAAC,MAAI,CAAA,UAAU,MACZ,SAAA,CAAYD,GAAAjD,EAAAA,IAACC,GAAM,CAAA,GAAAvO,EAAQ,MAAA8M,CAAc,CAAA,EACzC,CAACyE,GACAjD,EAAA,IAACmD,GAAA,CACC,SAAAF,EACA,UAAAT,EACA,aAAcF,GAAS,IAAA,CACzB,QAEDc,GAAgB,EAAA,CACnB,CAAA,CAAA,CAEJ"}
@@ -1,2 +1,2 @@
1
- var B=Object.defineProperty;var D=(r,e,s)=>e in r?B(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var u=(r,e,s)=>(D(r,typeof e!="symbol"?e+"":e,s),s);import{A as d,R as V,C as n,D as L,E as g,F as z,G as R}from"./vendor-c6328e9a.js";import"./helpers-042e6b4d.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))a(t);new MutationObserver(t=>{for(const o of t)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function s(t){const o={};return t.integrity&&(o.integrity=t.integrity),t.referrerPolicy&&(o.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?o.credentials="include":t.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(t){if(t.ep)return;t.ep=!0;const o=s(t);fetch(t.href,o)}})();const O="modulepreload",U=function(r,e){return new URL(r,e).href},H={},N=function(e,s,a){if(!s||s.length===0)return e();const t=document.getElementsByTagName("link");return Promise.all(s.map(o=>{if(o=U(o,a),o in H)return;H[o]=!0;const c=o.endsWith(".css"),m=c?'[rel="stylesheet"]':"";if(!!a)for(let v=t.length-1;v>=0;v--){const l=t[v];if(l.href===o&&(!c||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${m}`))return;const i=document.createElement("link");if(i.rel=c?"stylesheet":O,c||(i.as="script",i.crossOrigin=""),i.href=o,document.head.appendChild(i),c)return new Promise((v,l)=>{i.addEventListener("load",v),i.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())};const T="#1a171a",F="#f0f0ee",G="#fcd65b",W="#9edc6f",q="#76d9e4",K="#aa9af4",J="#f37e3f",Q="#f95d84",X="#4878ea",Y="#5b5a5c",Z="#9edc6f",ee="#fcd65b",te="#f37e3f",se="#f95d84",ne="#fcfcfa",re="#929192",oe="#373438",ae="#1a171a",ie="#f0f0ee",ce="0.15s",le={"gray-100":"#fcfcfa","gray-200":"#f0f0ee","gray-300":"#c0bfbf","gray-400":"#929192","gray-500":"#5b5a5c","gray-600":"#555356","gray-700":"#403e41","gray-800":"#373438","gray-850":"#322f33","gray-900":"#211f22",black:T,white:F,yellow:G,green:W,blue:q,purple:K,orange:J,red:Q,primary:X,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:Y,success:Z,info:ee,warning:te,danger:se,light:ne,mid:re,dark:oe,"text-muted":"#929192","content-bg":"#2d2a2e",background:ae,foreground:ie,transition:ce},de={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},A=Object.freeze({...de,...le}),ue=-1,C=0,S=1,w=2,I=3,P=4,Re=Object.freeze({SILENT:ue,ERROR:C,WARN:S,INFO:w,DEBUG:I,DEBUG2:P}),f=()=>{};class fe{constructor(e,s){u(this,"name");u(this,"prefix");u(this,"level");u(this,"error");u(this,"warn");u(this,"log");u(this,"info");u(this,"debug");u(this,"debug2");this.name=e,this.prefix=e!=null?`[${e}]`:"",this.error=f,this.warn=f,this.log=f,this.info=f,this.debug=f,this.debug2=f,this.level=s,this.setLogLevel(s)}setLogLevel(e){if(!Number.isFinite(e)){console.warn(`Expected a number for log level. Received: ${e}. Ignoring`);return}this.level=e,this.error=e>=C?console.error.bind(console,this.prefix):f,this.warn=e>=S?console.warn.bind(console,this.prefix):f,this.log=e>=w?console.log.bind(console,this.prefix):f,this.info=this.log,this.debug=e>=I?console.debug.bind(console,this.prefix):f,this.debug2=e>=P?console.debug.bind(console,this.prefix):f}}const M=fe;class he extends M{constructor(s=w){super(null,s);u(this,"modules");this.modules={}}module(s){return this.modules[s]==null&&(this.modules[s]=new M(s,this.level)),this.modules[s]}setLogLevel(s){if(super.setLogLevel(s),this.modules==null)return;const a=Object.keys(this.modules);for(let t=0;t<a.length;t+=1)this.modules[a[t]].setLogLevel(s)}}const me=he,ve=new me,pe=ve;function ge({className:r="theme-bg-light",children:e,role:s="role",keyboard:a=!0,isOpen:t=!1,centered:o=!1,size:c,onOpened:m,onClosed:p,toggle:i,"data-testid":v}){const l=d.useRef(),x=d.useRef(null),[$,j]=d.useState(!1),b=d.useCallback(h=>{switch(h.key){case"Escape":i==null||i();break}},[i]);d.useEffect(function(){if(t&&a)return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[b,t,a]),d.useEffect(function(){t&&m&&m()},[m,t]),d.useEffect(function(){!t&&p&&p()},[p,t]),t&&!l.current&&(l.current=document.createElement("div"),l.current.setAttribute("style","padding-right: 15px; display: block"),l.current.setAttribute("role","presentation"),document.body.appendChild(l.current));const E=()=>{l.current&&(document.body.removeChild(l.current),l.current=void 0)};return l.current?V.createPortal(n.jsxs(n.Fragment,{children:[n.jsx(L,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:t,classNames:{appearActive:"show",appearDone:"show"},timeout:A.transitionMs,onExited:E,children:n.jsx("div",{className:g("modal-backdrop fade"),style:{zIndex:1050}})}),n.jsx(L,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:t,classNames:{appearDone:"show"},timeout:A.transitionMs,onExited:E,children:n.jsx("div",{ref:x,className:"modal fade",onMouseDown:h=>{h.target===x.current?j(!0):j(!1)},onMouseUp:h=>{$&&h.target===x.current&&i!==void 0&&i()},role:"dialog",style:{display:"block"},children:n.jsx("div",{className:g(`modal-dialog ${r}`,{"modal-lg":c==="lg","modal-sm":c==="sm","modal-xl":c==="xl","modal-dialog-centered":o}),style:{zIndex:1040},children:n.jsx("div",{className:"modal-content",role:"presentation","data-testid":v,children:e})})})})]}),l.current):null}function xe({className:r="modal-body",style:e,children:s,"data-testid":a}){return n.jsx("div",{className:r,"data-testid":a,style:e,children:s})}function be({className:r,children:e,closeButton:s=!0,style:a,toggle:t,"data-testid":o}){return n.jsxs("div",{className:`modal-header ${r}`,style:a,children:[n.jsx("h5",{className:"modal-title",children:e}),s&&n.jsx("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:t,children:n.jsx("span",{"aria-hidden":"true",children:"×"})})]})}var Ce={prefix:"vs",iconName:"add",icon:[512,512,[],"f000","M448 224v32H256v192H224V256H32V224h192V32h32v192h192z"]},Se={prefix:"vs",iconName:"check",icon:[512,512,[],"f000","m461.792 106.336 -271.04 320 -25.28 -1.152 -107.2 -152.64 26.176 -18.368 95.296 135.68 257.632 -304.192 24.448 20.672z"]},Ie={prefix:"vs",iconName:"chevron-left",icon:[512,512,[],"f000","m189.696 255.232 139.424 139.424 -19.776 19.84L160 265.088v-19.776L309.344 96l19.776 19.808 -139.424 139.424z"]},Pe={prefix:"vs",iconName:"chevron-right",icon:[512,512,[],"f000","M322.304 256.768 182.88 117.344l19.776 -19.84L352 246.912v19.776L202.656 416l-19.776 -19.808 139.424 -139.424z"]},ye={prefix:"vs",iconName:"circle-large",icon:[512,512,[],"f000","M306.816 70.88A185.856 185.856 0 0 0 256 64c-17.728 0 -34.624 2.336 -50.816 6.88l-0.192 0.064c-16.448 4.512 -31.68 10.944 -45.824 19.232A196.992 196.992 0 0 0 90.24 159.36l-0.064 0.128A190.944 190.944 0 0 0 70.72 205.12 191.552 191.552 0 0 0 64 256c0 17.76 2.24 34.72 6.72 50.912a193.6 193.6 0 0 0 49.536 84.832c11.84 11.68 24.768 21.664 38.912 30.08a195.2 195.2 0 0 0 45.92 19.488A192.64 192.64 0 0 0 256 448c17.76 0 34.72 -2.24 50.912 -6.72 16.48 -4.64 31.68 -11.136 45.632 -19.424l0.128 -0.064a197.12 197.12 0 0 0 69.152 -68.96 187.2 187.2 0 0 0 19.2 -45.824l0.096 -0.192A185.824 185.824 0 0 0 448 256c0 -17.728 -2.304 -34.624 -6.88 -50.816l-0.064 -0.192a184.704 184.704 0 0 0 -19.2 -45.536l-0.064 -0.128a188.8 188.8 0 0 0 -30.144 -38.72l-0.256 -0.256a188.864 188.864 0 0 0 -38.72 -30.144l-0.128 -0.064a184.704 184.704 0 0 0 -45.536 -19.2l-0.192 -0.064zm142.56 298.24a229.024 229.024 0 0 1 -80.512 80.256 222.912 222.912 0 0 1 -53.376 22.72A223.488 223.488 0 0 1 256 480a223.488 223.488 0 0 1 -59.52 -7.872 227.136 227.136 0 0 1 -53.568 -22.752 233.6 233.6 0 0 1 -45.28 -35.008 233.44 233.44 0 0 1 -35.008 -45.28 227.136 227.136 0 0 1 -22.72 -53.6A223.52 223.52 0 0 1 32 256c0 -20.576 2.624 -40.384 7.872 -59.52a222.976 222.976 0 0 1 22.752 -53.344 228.992 228.992 0 0 1 80.288 -80.512 220.64 220.64 0 0 1 53.6 -22.528A217.856 217.856 0 0 1 256 32a217.6 217.6 0 0 1 59.52 8.096 220.768 220.768 0 0 1 98.656 57.76 220.896 220.896 0 0 1 57.728 98.656C477.312 215.616 480 235.424 480 256s-2.688 40.384 -8.096 59.52a220.8 220.8 0 0 1 -22.528 53.568z"]},_e={prefix:"vs",iconName:"close",icon:[512,512,[],"f000","m256 278.624 116.672 116.704 22.656 -22.624L278.624 256l116.704 -116.672 -22.624 -22.656L256 233.376 139.328 116.672l-22.624 22.656L233.376 256l-116.672 116.672 22.624 22.656L256 278.624z"]},$e={prefix:"vs",iconName:"copy",icon:[512,512,[],"f000","m128 128 32 -32h173.248L448 210.752V448l-32 32H160l-32 -32V128zm288 96 -96 -96H160v320h256V224zM96 32 64 64v320l32 32V64h205.248l-32 -32H96z"]},Be={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},De={prefix:"vs",iconName:"link",icon:[512,512,[],"f000","M140.8 96h98.72a108.8 108.8 0 0 1 108.8 108.8v6.56A108.8 108.8 0 0 1 239.52 320H224V288h15.52A76.8 76.8 0 0 0 316.16 211.52V204.8A76.8 76.8 0 0 0 239.68 128H140.8A76.8 76.8 0 0 0 64 204.8v6.56A76.608 76.608 0 0 0 128 286.72v32a108.8 108.8 0 0 1 -96 -107.2V204.8A108.96 108.96 0 0 1 140.8 96zM384 225.28v-32a108.8 108.8 0 0 1 96 107.52v6.56A108.96 108.96 0 0 1 371.36 416h-98.88A108.8 108.8 0 0 1 163.84 307.52V300.8A108.8 108.8 0 0 1 272.48 192H288v32h-15.52A76.8 76.8 0 0 0 195.84 300.8v6.56A76.8 76.8 0 0 0 272.48 384h98.88A76.8 76.8 0 0 0 448 307.52V300.8a76.608 76.608 0 0 0 -64 -75.52z"]},Le={prefix:"vs",iconName:"loading",icon:[512,512,[],"f000","M445.344 224A192.064 192.064 0 0 0 66.656 224H34.272a224.064 224.064 0 0 1 443.456 0h-32.384z"]},Oe={prefix:"vs",iconName:"pass-filled",icon:[512,512,[],"f000","M256 480A224 224 0 1 0 256 32a224 224 0 0 0 0 448zm-32.64 -132.16h-22.72L128 275.2l22.72 -22.72 61.44 61.44 134.4 -134.72 22.72 22.72 -145.92 145.92z"]},Ue={prefix:"vs",iconName:"search",icon:[512,512,[],"f000","M325.333 0a176 176 0 0 0 -131.84 292.693L21.333 488.107l23.893 21.333 171.733 -194.56A176.021 176.021 0 1 0 325.333 0.213V0zm0 320a144 144 0 1 1 0 -288 144 144 0 0 1 0 288z"]},Te={prefix:"vs",iconName:"trash",icon:[512,512,[],"f000","M320 96h96v32h-32v288l-32 32H128l-32 -32V128H64V96h96V64a32 32 0 0 1 32 -32h96a32 32 0 0 1 32 32v32zM288 64H192v32h96V64zM128 416h224V128H128v288zm64 -256H160v224h32V160zm32 0h32v224H224V160zm64 0h32v224H288V160z"]},Fe={prefix:"vs",iconName:"triangle-down",icon:[512,512,[],"f000","M64 177.92 77.216 160h358.208l12.576 17.28L267.936 352h-26.464L64 177.92z"]},ze={prefix:"vs",iconName:"warning",icon:[512,512,[],"f000","M241.92 32h28.16l209.28 392.32 -14.08 23.68H46.08L32 424.32 241.92 32zM256 72.96 72.96 416H438.4L256 72.96zM276 384v-32h-40v32h40zm-40 -64V192h40v128h-40z"]},Ge={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},We={prefix:"dh",iconName:"graph-line-down",icon:[512,512,[],"f000","M64 416V0H32v432l16 16H480v-32zm67.2 -291.2 -22.4 22.4 108.8 112 70.4 -64 108.8 124.8H320v32h112l16 -16V224h-32v70.4L288 150.4l-70.4 64z"]},qe={prefix:"dh",iconName:"sort",icon:[512,512,[],"f000","m128 224 -12.8 -25.6 128 -118.4h25.6l128 118.4 -12.8 25.6H128zm0 64 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Ke={prefix:"dh",iconName:"warning-filled",icon:[512,512,[],"f000","M268.8 32h-25.6L32 425.6l12.8 22.4h419.2l12.8 -22.4L268.8 32zm6.4 352H236.8v-32h38.4v32zm0 -64H236.8V192h38.4v128z"]};function Ae({className:r="","data-testid":e}){return n.jsxs("div",{className:g("loading-spinner fa-layers",r),"data-testid":e,children:[n.jsx(z,{icon:ye,className:"text-white-50"}),n.jsx(z,{icon:Le,className:"text-primary",spin:!0})]})}function _({isLoaded:r=!1,isLoading:e=!0,errorMessage:s=null,"data-testid":a}){const t=a!=null?`${a}-message`:void 0,o=a!=null?`${a}-spinner`:void 0;return n.jsx(L,{in:Boolean(s)||!r||e,timeout:A.transitionMs,classNames:r?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:n.jsx("div",{className:"fill-parent-absolute","data-testid":a,children:n.jsx("div",{className:g("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":r}),children:n.jsxs("div",{className:"message-content",children:[n.jsxs("div",{className:"message-icon",children:[e&&n.jsx(Ae,{"data-testid":o}),!e&&s!=null&&n.jsx(z,{icon:ze})]}),s!=null&&n.jsx("div",{className:"message-text","data-testid":t,children:s})]})})})})}const y=pe.module("@deephaven/jsapi-bootstrap.ApiBootstrap"),Ne=d.createContext(null);function we({apiUrl:r,children:e,failureElement:s,setGlobally:a=!1}){const[t,o]=d.useState(!0),[c,m]=d.useState();return d.useEffect(()=>{async function p(){try{const i=(await N(()=>import(r),[],import.meta.url)).default;y.info("API bootstrapped from",r),m(i),a&&(y.debug("API set globally"),globalThis.dh=i)}catch(i){y.error("Unable to bootstrap API",i)}o(!1)}p()},[r,a]),t?n.jsx(_,{}):c==null?s??n.jsxs(ge,{isOpen:!0,className:"modal-dialog-centered theme-bg-light",children:[n.jsx(be,{closeButton:!1,children:"Error: Unable to load API"}),n.jsx(xe,{children:n.jsxs("p",{className:"text-break",children:["Ensure the server is running and you are able to reach ",r,", then refresh the page."]})})]}):n.jsx(Ne.Provider,{value:c,children:e})}const je=R.lazy(()=>N(()=>import("./App-2fd87eab.js"),["./App-2fd87eab.js","./vendor-c6328e9a.js","./helpers-042e6b4d.js","./vendor-458ea229.css","./useConnection-87b8bdaa.js","./plotly-b153f4cb.js","./App-a2eeb683.css"],import.meta.url)),Ee=R.lazy(async()=>({default:(await N(()=>import("./index-11136157.js"),["./index-11136157.js","./vendor-c6328e9a.js","./helpers-042e6b4d.js","./vendor-458ea229.css","./useConnection-87b8bdaa.js","./index-d2bed521.css"],import.meta.url)).AppBootstrap})),k=new URL("../../jsapi/dh-core.js",document.baseURI),He=new URL("/js-plugins",document.baseURI);V.render(n.jsx(we,{apiUrl:k.href,setGlobally:!0,children:n.jsx(d.Suspense,{fallback:n.jsx(_,{}),children:n.jsx(Ee,{serverUrl:k.origin,pluginsUrl:He.href,children:n.jsx(je,{})})})}),document.getElementById("root"));export{we as A,pe as L,ge as M,A as T,We as a,_ as b,M as c,Ke as d,Re as e,xe as f,be as g,Ue as h,Fe as i,Oe as j,$e as k,Se as l,qe as m,Be as n,Ce as o,Te as p,Pe as q,Ie as r,_e as s,De as t,Ge as u,Le as v,Ae as w,Ne as x};
2
- //# sourceMappingURL=index-9192b18a.js.map
1
+ var B=Object.defineProperty;var D=(r,e,s)=>e in r?B(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var u=(r,e,s)=>(D(r,typeof e!="symbol"?e+"":e,s),s);import{A as d,R as V,C as n,D as L,E as g,F as z,G as R}from"./vendor-c6328e9a.js";import"./helpers-042e6b4d.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const t of document.querySelectorAll('link[rel="modulepreload"]'))a(t);new MutationObserver(t=>{for(const o of t)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&a(c)}).observe(document,{childList:!0,subtree:!0});function s(t){const o={};return t.integrity&&(o.integrity=t.integrity),t.referrerPolicy&&(o.referrerPolicy=t.referrerPolicy),t.crossOrigin==="use-credentials"?o.credentials="include":t.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(t){if(t.ep)return;t.ep=!0;const o=s(t);fetch(t.href,o)}})();const O="modulepreload",U=function(r,e){return new URL(r,e).href},H={},N=function(e,s,a){if(!s||s.length===0)return e();const t=document.getElementsByTagName("link");return Promise.all(s.map(o=>{if(o=U(o,a),o in H)return;H[o]=!0;const c=o.endsWith(".css"),m=c?'[rel="stylesheet"]':"";if(!!a)for(let v=t.length-1;v>=0;v--){const l=t[v];if(l.href===o&&(!c||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${m}`))return;const i=document.createElement("link");if(i.rel=c?"stylesheet":O,c||(i.as="script",i.crossOrigin=""),i.href=o,document.head.appendChild(i),c)return new Promise((v,l)=>{i.addEventListener("load",v),i.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e())};const T="#1a171a",F="#f0f0ee",G="#fcd65b",W="#9edc6f",q="#76d9e4",K="#aa9af4",J="#f37e3f",Q="#f95d84",X="#4878ea",Y="#5b5a5c",Z="#9edc6f",ee="#fcd65b",te="#f37e3f",se="#f95d84",ne="#fcfcfa",re="#929192",oe="#373438",ae="#1a171a",ie="#f0f0ee",ce="0.15s",le={"gray-100":"#fcfcfa","gray-200":"#f0f0ee","gray-300":"#c0bfbf","gray-400":"#929192","gray-500":"#5b5a5c","gray-600":"#555356","gray-700":"#403e41","gray-800":"#373438","gray-850":"#322f33","gray-900":"#211f22",black:T,white:F,yellow:G,green:W,blue:q,purple:K,orange:J,red:Q,primary:X,"primary-hover":"#235de6","primary-dark":"#343e5d",secondary:Y,success:Z,info:ee,warning:te,danger:se,light:ne,mid:re,dark:oe,"text-muted":"#929192","content-bg":"#2d2a2e",background:ae,foreground:ie,transition:ce},de={transitionMs:150,transitionMidMs:200,transitionLongMs:300,transitionSlowMs:1e3},A=Object.freeze({...de,...le}),ue=-1,C=0,S=1,w=2,I=3,P=4,Re=Object.freeze({SILENT:ue,ERROR:C,WARN:S,INFO:w,DEBUG:I,DEBUG2:P}),f=()=>{};class fe{constructor(e,s){u(this,"name");u(this,"prefix");u(this,"level");u(this,"error");u(this,"warn");u(this,"log");u(this,"info");u(this,"debug");u(this,"debug2");this.name=e,this.prefix=e!=null?`[${e}]`:"",this.error=f,this.warn=f,this.log=f,this.info=f,this.debug=f,this.debug2=f,this.level=s,this.setLogLevel(s)}setLogLevel(e){if(!Number.isFinite(e)){console.warn(`Expected a number for log level. Received: ${e}. Ignoring`);return}this.level=e,this.error=e>=C?console.error.bind(console,this.prefix):f,this.warn=e>=S?console.warn.bind(console,this.prefix):f,this.log=e>=w?console.log.bind(console,this.prefix):f,this.info=this.log,this.debug=e>=I?console.debug.bind(console,this.prefix):f,this.debug2=e>=P?console.debug.bind(console,this.prefix):f}}const M=fe;class he extends M{constructor(s=w){super(null,s);u(this,"modules");this.modules={}}module(s){return this.modules[s]==null&&(this.modules[s]=new M(s,this.level)),this.modules[s]}setLogLevel(s){if(super.setLogLevel(s),this.modules==null)return;const a=Object.keys(this.modules);for(let t=0;t<a.length;t+=1)this.modules[a[t]].setLogLevel(s)}}const me=he,ve=new me,pe=ve;function ge({className:r="theme-bg-light",children:e,role:s="role",keyboard:a=!0,isOpen:t=!1,centered:o=!1,size:c,onOpened:m,onClosed:p,toggle:i,"data-testid":v}){const l=d.useRef(),x=d.useRef(null),[$,j]=d.useState(!1),b=d.useCallback(h=>{switch(h.key){case"Escape":i==null||i();break}},[i]);d.useEffect(function(){if(t&&a)return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[b,t,a]),d.useEffect(function(){t&&m&&m()},[m,t]),d.useEffect(function(){!t&&p&&p()},[p,t]),t&&!l.current&&(l.current=document.createElement("div"),l.current.setAttribute("style","padding-right: 15px; display: block"),l.current.setAttribute("role","presentation"),document.body.appendChild(l.current));const E=()=>{l.current&&(document.body.removeChild(l.current),l.current=void 0)};return l.current?V.createPortal(n.jsxs(n.Fragment,{children:[n.jsx(L,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:t,classNames:{appearActive:"show",appearDone:"show"},timeout:A.transitionMs,onExited:E,children:n.jsx("div",{className:g("modal-backdrop fade"),style:{zIndex:1050}})}),n.jsx(L,{appear:!0,mountOnEnter:!0,unmountOnExit:!0,in:t,classNames:{appearDone:"show"},timeout:A.transitionMs,onExited:E,children:n.jsx("div",{ref:x,className:"modal fade",onMouseDown:h=>{h.target===x.current?j(!0):j(!1)},onMouseUp:h=>{$&&h.target===x.current&&i!==void 0&&i()},role:"dialog",style:{display:"block"},children:n.jsx("div",{className:g(`modal-dialog ${r}`,{"modal-lg":c==="lg","modal-sm":c==="sm","modal-xl":c==="xl","modal-dialog-centered":o}),style:{zIndex:1040},children:n.jsx("div",{className:"modal-content",role:"presentation","data-testid":v,children:e})})})})]}),l.current):null}function xe({className:r="modal-body",style:e,children:s,"data-testid":a}){return n.jsx("div",{className:r,"data-testid":a,style:e,children:s})}function be({className:r,children:e,closeButton:s=!0,style:a,toggle:t,"data-testid":o}){return n.jsxs("div",{className:`modal-header ${r}`,style:a,children:[n.jsx("h5",{className:"modal-title",children:e}),s&&n.jsx("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close",onClick:t,children:n.jsx("span",{"aria-hidden":"true",children:"×"})})]})}var Ce={prefix:"vs",iconName:"add",icon:[512,512,[],"f000","M448 224v32H256v192H224V256H32V224h192V32h32v192h192z"]},Se={prefix:"vs",iconName:"check",icon:[512,512,[],"f000","m461.792 106.336 -271.04 320 -25.28 -1.152 -107.2 -152.64 26.176 -18.368 95.296 135.68 257.632 -304.192 24.448 20.672z"]},Ie={prefix:"vs",iconName:"chevron-left",icon:[512,512,[],"f000","m189.696 255.232 139.424 139.424 -19.776 19.84L160 265.088v-19.776L309.344 96l19.776 19.808 -139.424 139.424z"]},Pe={prefix:"vs",iconName:"chevron-right",icon:[512,512,[],"f000","M322.304 256.768 182.88 117.344l19.776 -19.84L352 246.912v19.776L202.656 416l-19.776 -19.808 139.424 -139.424z"]},ye={prefix:"vs",iconName:"circle-large",icon:[512,512,[],"f000","M306.816 70.88A185.856 185.856 0 0 0 256 64c-17.728 0 -34.624 2.336 -50.816 6.88l-0.192 0.064c-16.448 4.512 -31.68 10.944 -45.824 19.232A196.992 196.992 0 0 0 90.24 159.36l-0.064 0.128A190.944 190.944 0 0 0 70.72 205.12 191.552 191.552 0 0 0 64 256c0 17.76 2.24 34.72 6.72 50.912a193.6 193.6 0 0 0 49.536 84.832c11.84 11.68 24.768 21.664 38.912 30.08a195.2 195.2 0 0 0 45.92 19.488A192.64 192.64 0 0 0 256 448c17.76 0 34.72 -2.24 50.912 -6.72 16.48 -4.64 31.68 -11.136 45.632 -19.424l0.128 -0.064a197.12 197.12 0 0 0 69.152 -68.96 187.2 187.2 0 0 0 19.2 -45.824l0.096 -0.192A185.824 185.824 0 0 0 448 256c0 -17.728 -2.304 -34.624 -6.88 -50.816l-0.064 -0.192a184.704 184.704 0 0 0 -19.2 -45.536l-0.064 -0.128a188.8 188.8 0 0 0 -30.144 -38.72l-0.256 -0.256a188.864 188.864 0 0 0 -38.72 -30.144l-0.128 -0.064a184.704 184.704 0 0 0 -45.536 -19.2l-0.192 -0.064zm142.56 298.24a229.024 229.024 0 0 1 -80.512 80.256 222.912 222.912 0 0 1 -53.376 22.72A223.488 223.488 0 0 1 256 480a223.488 223.488 0 0 1 -59.52 -7.872 227.136 227.136 0 0 1 -53.568 -22.752 233.6 233.6 0 0 1 -45.28 -35.008 233.44 233.44 0 0 1 -35.008 -45.28 227.136 227.136 0 0 1 -22.72 -53.6A223.52 223.52 0 0 1 32 256c0 -20.576 2.624 -40.384 7.872 -59.52a222.976 222.976 0 0 1 22.752 -53.344 228.992 228.992 0 0 1 80.288 -80.512 220.64 220.64 0 0 1 53.6 -22.528A217.856 217.856 0 0 1 256 32a217.6 217.6 0 0 1 59.52 8.096 220.768 220.768 0 0 1 98.656 57.76 220.896 220.896 0 0 1 57.728 98.656C477.312 215.616 480 235.424 480 256s-2.688 40.384 -8.096 59.52a220.8 220.8 0 0 1 -22.528 53.568z"]},_e={prefix:"vs",iconName:"close",icon:[512,512,[],"f000","m256 278.624 116.672 116.704 22.656 -22.624L278.624 256l116.704 -116.672 -22.624 -22.656L256 233.376 139.328 116.672l-22.624 22.656L233.376 256l-116.672 116.672 22.624 22.656L256 278.624z"]},$e={prefix:"vs",iconName:"copy",icon:[512,512,[],"f000","m128 128 32 -32h173.248L448 210.752V448l-32 32H160l-32 -32V128zm288 96 -96 -96H160v320h256V224zM96 32 64 64v320l32 32V64h205.248l-32 -32H96z"]},Be={prefix:"vs",iconName:"gripper",icon:[512,512,[],"f000","M160 96h64v64H160zm0 128h64v64H160zm0 128h64v64H160zm128 -256h64v64H288zm0 128h64v64H288zm0 128h64v64H288z"]},De={prefix:"vs",iconName:"link",icon:[512,512,[],"f000","M140.8 96h98.72a108.8 108.8 0 0 1 108.8 108.8v6.56A108.8 108.8 0 0 1 239.52 320H224V288h15.52A76.8 76.8 0 0 0 316.16 211.52V204.8A76.8 76.8 0 0 0 239.68 128H140.8A76.8 76.8 0 0 0 64 204.8v6.56A76.608 76.608 0 0 0 128 286.72v32a108.8 108.8 0 0 1 -96 -107.2V204.8A108.96 108.96 0 0 1 140.8 96zM384 225.28v-32a108.8 108.8 0 0 1 96 107.52v6.56A108.96 108.96 0 0 1 371.36 416h-98.88A108.8 108.8 0 0 1 163.84 307.52V300.8A108.8 108.8 0 0 1 272.48 192H288v32h-15.52A76.8 76.8 0 0 0 195.84 300.8v6.56A76.8 76.8 0 0 0 272.48 384h98.88A76.8 76.8 0 0 0 448 307.52V300.8a76.608 76.608 0 0 0 -64 -75.52z"]},Le={prefix:"vs",iconName:"loading",icon:[512,512,[],"f000","M445.344 224A192.064 192.064 0 0 0 66.656 224H34.272a224.064 224.064 0 0 1 443.456 0h-32.384z"]},Oe={prefix:"vs",iconName:"pass-filled",icon:[512,512,[],"f000","M256 480A224 224 0 1 0 256 32a224 224 0 0 0 0 448zm-32.64 -132.16h-22.72L128 275.2l22.72 -22.72 61.44 61.44 134.4 -134.72 22.72 22.72 -145.92 145.92z"]},Ue={prefix:"vs",iconName:"search",icon:[512,512,[],"f000","M325.333 0a176 176 0 0 0 -131.84 292.693L21.333 488.107l23.893 21.333 171.733 -194.56A176.021 176.021 0 1 0 325.333 0.213V0zm0 320a144 144 0 1 1 0 -288 144 144 0 0 1 0 288z"]},Te={prefix:"vs",iconName:"trash",icon:[512,512,[],"f000","M320 96h96v32h-32v288l-32 32H128l-32 -32V128H64V96h96V64a32 32 0 0 1 32 -32h96a32 32 0 0 1 32 32v32zM288 64H192v32h96V64zM128 416h224V128H128v288zm64 -256H160v224h32V160zm32 0h32v224H224V160zm64 0h32v224H288V160z"]},Fe={prefix:"vs",iconName:"triangle-down",icon:[512,512,[],"f000","M64 177.92 77.216 160h358.208l12.576 17.28L267.936 352h-26.464L64 177.92z"]},ze={prefix:"vs",iconName:"warning",icon:[512,512,[],"f000","M241.92 32h28.16l209.28 392.32 -14.08 23.68H46.08L32 424.32 241.92 32zM256 72.96 72.96 416H438.4L256 72.96zM276 384v-32h-40v32h40zm-40 -64V192h40v128h-40z"]},Ge={prefix:"dh",iconName:"exclamation",icon:[512,512,[],"f000","M275.2 384v-32H236.8v32h38.4zm-38.4 -64V128h38.4v192H236.8z"]},We={prefix:"dh",iconName:"graph-line-down",icon:[512,512,[],"f000","M64 416V0H32v432l16 16H480v-32zm67.2 -291.2 -22.4 22.4 108.8 112 70.4 -64 108.8 124.8H320v32h112l16 -16V224h-32v70.4L288 150.4l-70.4 64z"]},qe={prefix:"dh",iconName:"sort",icon:[512,512,[],"f000","m128 224 -12.8 -25.6 128 -118.4h25.6l128 118.4 -12.8 25.6H128zm0 64 -12.8 25.6 128 118.4h25.6l128 -118.4L384 288H128z"]},Ke={prefix:"dh",iconName:"warning-filled",icon:[512,512,[],"f000","M268.8 32h-25.6L32 425.6l12.8 22.4h419.2l12.8 -22.4L268.8 32zm6.4 352H236.8v-32h38.4v32zm0 -64H236.8V192h38.4v128z"]};function Ae({className:r="","data-testid":e}){return n.jsxs("div",{className:g("loading-spinner fa-layers",r),"data-testid":e,children:[n.jsx(z,{icon:ye,className:"text-white-50"}),n.jsx(z,{icon:Le,className:"text-primary",spin:!0})]})}function _({isLoaded:r=!1,isLoading:e=!0,errorMessage:s=null,"data-testid":a}){const t=a!=null?`${a}-message`:void 0,o=a!=null?`${a}-spinner`:void 0;return n.jsx(L,{in:Boolean(s)||!r||e,timeout:A.transitionMs,classNames:r?"fade":"",mountOnEnter:!0,unmountOnExit:!0,children:n.jsx("div",{className:"fill-parent-absolute","data-testid":a,children:n.jsx("div",{className:g("iris-panel-message-overlay","fill-parent-absolute",{"iris-panel-scrim-background":r}),children:n.jsxs("div",{className:"message-content",children:[n.jsxs("div",{className:"message-icon",children:[e&&n.jsx(Ae,{"data-testid":o}),!e&&s!=null&&n.jsx(z,{icon:ze})]}),s!=null&&n.jsx("div",{className:"message-text","data-testid":t,children:s})]})})})})}const y=pe.module("@deephaven/jsapi-bootstrap.ApiBootstrap"),Ne=d.createContext(null);function we({apiUrl:r,children:e,failureElement:s,setGlobally:a=!1}){const[t,o]=d.useState(!0),[c,m]=d.useState();return d.useEffect(()=>{async function p(){try{const i=(await N(()=>import(r),[],import.meta.url)).default;y.info("API bootstrapped from",r),m(i),a&&(y.debug("API set globally"),globalThis.dh=i)}catch(i){y.error("Unable to bootstrap API",i)}o(!1)}p()},[r,a]),t?n.jsx(_,{}):c==null?s??n.jsxs(ge,{isOpen:!0,className:"modal-dialog-centered theme-bg-light",children:[n.jsx(be,{closeButton:!1,children:"Error: Unable to load API"}),n.jsx(xe,{children:n.jsxs("p",{className:"text-break",children:["Ensure the server is running and you are able to reach ",r,", then refresh the page."]})})]}):n.jsx(Ne.Provider,{value:c,children:e})}const je=R.lazy(()=>N(()=>import("./App-b78c2cda.js"),["./App-b78c2cda.js","./vendor-c6328e9a.js","./helpers-042e6b4d.js","./vendor-458ea229.css","./useConnection-f786b0a3.js","./plotly-b153f4cb.js","./App-a2eeb683.css"],import.meta.url)),Ee=R.lazy(async()=>({default:(await N(()=>import("./index-bc9b0636.js"),["./index-bc9b0636.js","./vendor-c6328e9a.js","./helpers-042e6b4d.js","./vendor-458ea229.css","./useConnection-f786b0a3.js","./index-d2bed521.css"],import.meta.url)).AppBootstrap})),k=new URL("../../jsapi/dh-core.js",document.baseURI),He=new URL("/js-plugins",document.baseURI);V.render(n.jsx(we,{apiUrl:k.href,setGlobally:!0,children:n.jsx(d.Suspense,{fallback:n.jsx(_,{}),children:n.jsx(Ee,{serverUrl:k.origin,pluginsUrl:He.href,children:n.jsx(je,{})})})}),document.getElementById("root"));export{we as A,pe as L,ge as M,A as T,We as a,_ as b,M as c,Ke as d,Re as e,xe as f,be as g,Ue as h,Fe as i,Oe as j,$e as k,Se as l,qe as m,Be as n,Ce as o,Te as p,Pe as q,Ie as r,_e as s,De as t,Ge as u,Le as v,Ae as w,Ne as x};
2
+ //# sourceMappingURL=index-1c678b43.js.map