@deephaven/embed-chart 0.49.2-beta.0 → 0.49.2-theme-plugins.31

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.
@@ -1,2 +1,2 @@
1
- import{H as Se,r as B,G as de,I as U,C as j,J as De,K as be,L as Y}from"./vendor-7af3c298.js";import{L as ie,d as Ae,v as Fe,a as Pe,b as we}from"./index-5bda7cda.js";import{a as K,T as se,F as ne,b as Oe,D as Ne,u as Le,c as Ie,C as Me}from"./useConnection-abd65b8b.js";import{P as Te,b as Re,h as _e,p as xe,o as ke,s as Ce,t as He,c as Ve}from"./plotly-ec6334b5.js";import"./helpers-042e6b4d.js";Te.register([Re,_e,xe,ke,Ce,He]);function L(u,e,t){return e=$e(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function $e(u){var e=We(u,"string");return typeof e=="symbol"?e:String(e)}function We(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}class T{constructor(e){L(this,"dh",void 0),L(this,"listeners",void 0),L(this,"formatter",void 0),L(this,"rect",void 0),L(this,"isDownsamplingDisabled",void 0),L(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(T.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(T.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(T.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(T.EVENT_LOADFINISHED))}}L(T,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");L(T,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");L(T,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");L(T,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");L(T,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");L(T,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");L(T,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");L(T,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");const x=T,Be="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",je="#403e41",Xe="#5b5a5c",ze="#c0bfbf",Ge="#4878ea",Ze="rgba(91, 90, 92, 0.7)",A={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Be,gridcolor:je,linecolor:Xe,zerolinecolor:ze,activecolor:Ge,rangebgcolor:Ze,"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"},M=Object.freeze({paper_bgcolor:A["paper-bgcolor"],plot_bgcolor:A["plot-bgcolor"],title_color:A["title-color"],colorway:A.colorway,gridcolor:A.gridcolor,linecolor:A.linecolor,zerolinecolor:A.zerolinecolor,activecolor:A.activecolor,rangebgcolor:A.rangebgcolor,area_color:A["area-color"],trend_color:A["trend-color"],line_color:A["line-color"],error_band_line_color:A["error-band-line-color"],error_band_fill_color:A["error-band-fill-color"],ohlc_increasing:A["ohlc-increasing"],ohlc_decreasing:A["ohlc-decreasing"]});function he(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(u);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,r)}return t}function W(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?he(Object(t),!0).forEach(function(r){b(u,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):he(Object(t)).forEach(function(r){Object.defineProperty(u,r,Object.getOwnPropertyDescriptor(t,r))})}return u}function b(u,e,t){return e=Ue(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function Ue(u){var e=Ye(u,"string");return typeof e=="symbol"?e:String(e)}function Ye(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}var q=ie.module("ChartUtils"),ce="io.deephaven.time.DateTime",Ke=36e5,qe=1e6;function Qe(u){return u.asDate!==void 0}function Je(u){return u.asNumber!==void 0}function pe(u){return u.dhTimeZone!==void 0}function et(u){return u!=null&&u.range!=null&&(u.autorange===!1||u.autorange===void 0)}class h{static getPlotlyErrorBars(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:M,a=r.map((s,l)=>s-e[l]),n=t.map((s,l)=>e[l]-s);return{type:"data",symmetric:!1,array:a,arrayminus:n,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);K(a);var[,n,s,l,,o,d,p,c,g]=a,m=l.replace(",","").length,E=s.indexOf(",")>=0||l.indexOf(",")>=0,v=E?",":"",f=p!=null&&p!==""?"e":"f",D=c!==""?c:f,S=o.length+d.length,F="",P="0".concat(m).concat(v,".").concat(S).concat(F).concat(D),k=h.convertNumberPrefix(n),R=h.convertNumberPrefix(g);return{tickformat:P,tickprefix:k,ticksuffix:R,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},n=i;return r&&(n=i/qe),t.log&&(n=Math.log(n)),a.tickmode="linear",a.dtick=n,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var n=i.sources[a];if(n.axis===t)return n}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:h.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){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 ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],n=0;n<a.series.length;n+=1)if(t===a.series[n])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],n=e[a];et(n)&&(t[a]=[...n.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,n=i[t],s=(a=r.get(n))!==null&&a!==void 0?a:[];return s.push(i),r.set(n,s),r},new Map)}static getColorwayFromTheme(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M,t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):q.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){b(this,"dh",void 0),b(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},n=h.getAllAxes(e),s=h.groupArray(n,"type"),{charts:l}=e,o=0;o<l.length;o+=1)for(var d=l[o],p=0;p<d.series.length;p+=1)for(var c=d.series[p],{sources:g}=c,m=g.filter(D=>D.axis),E=function(){var S=m[v],{axis:F}=S,{type:P}=F,k=s.get(P);K(k);var R=k.indexOf(F),_=r.getAxisPropertyName(P);if(_!=null){var I=h.getAxisLayoutProperty(_,R);if(i.has(I))q.debug("".concat(I," already added."));else{q.debug("Adding ".concat(I," to axisFormats."));var X=r.getPlotlyAxisFormat(S,t);if(X===null)i.set(I,a);else{i.set(I,X);var{businessCalendar:$}=F;if($!=null){var C=[],{businessPeriods:J,businessDays:z,holidays:ee,timeZone:G}=$,Z=t==null?void 0:t.getColumnTypeFormatter(ce),te;pe(Z)&&(te=Z.dhTimeZone);var ue=te?(G.standardOffset-te.standardOffset)/60:0;ee.length>0&&C.push(...r.createRangeBreakValuesFromHolidays(ee,G,te)),J.forEach(re=>C.push({pattern:"hour",bounds:[h.periodToDecimal(re.close)+ue,h.periodToDecimal(re.open)+ue]})),z.length<r.daysOfWeek.length&&r.createBoundsFromDays(z).forEach(re=>C.push({pattern:"day of week",bounds:re})),X.rangebreaks=C}if(i.size===d.axes.length)return{v:i}}}}},v=0;v<m.length;v+=1){var f=E();if(typeof f=="object")return f.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(h.MODE_LINES),(r??!0)&&a.add(h.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(h.MODE_LINES),(r??!1)&&a.add(h.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?h.ORIENTATION.HORIZONTAL:h.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:M,{name:n,isLinesVisible:s,isShapesVisible:l,plotStyle:o,lineColor:d,shapeColor:p,sources:c,shape:g,shapeSize:m}=e,E=c.some(F=>{var P;return(P=F.axis)===null||P===void 0?void 0:P.businessCalendar}),v=this.getChartType(o,E),f=this.getPlotlyChartMode(o,s??void 0,l??void 0),D=this.getPlotlySeriesOrientation(e),S=h.makeSeriesData(v,f,n,i,D);return this.addSourcesToSeriesData(S,o,c,t),this.addStylingToSeriesData(S,o,a,d,p,g,m,r),S}addSourcesToSeriesData(e,t,r,i){for(var a=e,n=0;n<r.length;n+=1){var s=r[n],{axis:l,type:o}=s,d=this.getPlotlyProperty(t,o);Se(a,d,[]);var p=l!=null?this.getAxisPropertyName(l.type):null;if(p!=null){var c=i.get(l.type);if(c){var g=c.indexOf(l),m=g>0?"".concat(g+1):"";a["".concat(p,"axis")]="".concat(p).concat(m)}}}}addStylingToSeriesData(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,n=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:o}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===o.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===o.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===o.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===o.plot.SeriesPlotStyle.HISTOGRAM?(d.width=[],d.marker.line!==void 0&&Object.assign(d.marker.line,{color:r.paper_bgcolor,width:1})):t===o.plot.SeriesPlotStyle.OHLC?(d.increasing={line:{color:r.ohlc_increasing}},d.decreasing={line:{color:r.ohlc_decreasing}}):t===o.plot.SeriesPlotStyle.PIE?(d.textinfo="label+percent",d.outsidetextfont={color:r.title_color}):t===o.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center",d.outsidetextfont={color:r.title_color}),i!=null&&(t===o.plot.SeriesPlotStyle.BAR?d.marker.color=i:d.line.color=i),a!=null&&(d.marker.color=a),n!=null&&n.length>0)try{d.marker.symbol=h.getMarkerSymbol(n)}catch(p){q.warn("Unable to handle shape",n,":",p)}s!=null&&(d.marker.size=s*h.DEFAULT_MARKER_SIZE),l!=null&&t!==o.plot.SeriesPlotStyle.PIE&&(d.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,n=arguments.length>5&&arguments[5]!==void 0?arguments[5]:M,s=e,l=h.getAllAxes(t),o=0;o<t.charts.length;o+=1){var d=t.charts[o],p=r==null?void 0:r(d),c=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(s,d.axes,l,i,a,c,p,n)}this.removeStaleAxes(s,l)}getChartBounds(e,t,r,i){var a,{dh:n}=this,{cols:s,rows:l}=e,{column:o,colspan:d,row:p,rowspan:c}=t,g=o+d,m=p+c,E=1/s,v=1/l,f=h.AXIS_SIZE_PX/r,D=h.AXIS_SIZE_PX/i,S={bottom:(l-m)*v+(m<l?D/2:0),top:(l-p)*v-(p>0?D/2:0),left:o*E+(o>0?f/2:0),right:g*E-(g<s?f/2:0)},F=h.groupArray(t.axes,"position"),P=(a=F.get(n.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return P.length>0&&(r>0?S.right-=(S.right-S.left)*Math.max(0,Math.min(h.LEGEND_WIDTH_PX/r,h.MAX_LEGEND_SIZE)):S.right-=(S.right-S.left)*h.DEFAULT_AXIS_SIZE),S}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.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",""),n,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&pe(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(n=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:n,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:n}=i,s=null;return se.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,n),s=h.addTickSpacing(s,i,!0)):se.isNumberType(a)&&(s=h.getPlotlyNumberFormat(t,a,n),s=h.addTickSpacing(s,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,n=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:M,{dh:o}=this,d=i>0?Math.max(h.MIN_AXIS_SIZE,Math.min(h.AXIS_SIZE_PX/a,h.MAX_AXIS_SIZE)):h.DEFAULT_AXIS_SIZE,p=a>0?Math.max(h.MIN_AXIS_SIZE,Math.min(h.AXIS_SIZE_PX/i,h.MAX_AXIS_SIZE)):h.DEFAULT_AXIS_SIZE,c=e,g=h.groupArray(t,"position"),m=h.groupArray(t,"type"),E=[...m.keys()],v=h.groupArray(r,"type"),f=0;f<E.length;f+=1){var D=E[f],S=this.getAxisPropertyName(D);if(S!=null){var F=m.get(D),P=v.get(D),k=D===o.plot.AxisType.Y,R=k?a:i;K(F),K(P);for(var _=0;_<F.length;_+=1){var I=F[_],X=P.indexOf(I),$=h.getAxisLayoutProperty(S,X);c[$]==null&&(c[$]=this.makeLayoutAxis(D,l));var C=c[$];if(C!=null){this.updateLayoutAxis(C,I,_,g,d,p,n);var{range:J,autorange:z}=C;if(s!=null&&J!==void 0&&(z===void 0||z===!1)){var ee=s(I),[G,Z]=ee(J);q.debug("Setting downsample range",R,G,Z),I.range(R,G,Z)}else I.range(R)}}}}}removeStaleAxes(e,t){for(var r=e,i=h.groupArray(t,"type"),a=[...i.keys()],n=0;n<a.length;n+=1){var s=a[n],l=i.get(s);K(l);var o=l.length,d=this.getAxisPropertyName(s);if(d!=null)for(var p=h.getAxisLayoutProperty(d,o);r[p]!=null;)delete r[p],o+=1,p=h.getAxisLayoutProperty(d,o)}}updateLayoutAxis(e,t,r,i,a,n,s){var l,{dh:o}=this,d=t.type===o.plot.AxisType.Y,p=d?n:a,c=e,g=(l=t.label)!==null&&l!==void 0?l:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=g:c.title={text:g},t.log&&(c.type="log"),c.side=this.getAxisSide(t.position),r>0){var m,E;c.overlaying=(m=this.getAxisPropertyName(t.type))!==null&&m!==void 0?m:void 0;var v=(E=i.get(t.position))!==null&&E!==void 0?E:[],f=v.indexOf(t);f>0&&(c.anchor="free",t.position===o.plot.AxisPosition.RIGHT?c.position=s.right+(f-v.length+1)*p:t.position===o.plot.AxisPosition.TOP?c.position=s.top+(f-v.length+1)*p:t.position===o.plot.AxisPosition.BOTTOM?c.position=s.bottom+(v.length-f+1)*p:t.position===o.plot.AxisPosition.LEFT&&(c.position=s.left+(v.length-f+1)*p))}else if(t.type===o.plot.AxisType.X){var D=i.get(o.plot.AxisPosition.LEFT)||[],S=i.get(o.plot.AxisPosition.RIGHT)||[],F=Math.max(s.left,s.left+(D.length-1)*n),P=Math.min(s.right-(S.length-1)*n,s.right);c.domain=[F,P]}else if(t.type===o.plot.AxisType.Y){var k=i.get(o.plot.AxisPosition.BOTTOM)||[],R=i.get(o.plot.AxisPosition.TOP)||[],_=Math.max(s.bottom,s.bottom+(k.length-1)*a),I=Math.min(s.top-(R.length-1)*a,s.top);c.domain=[_,I]}}createBoundsFromDays(e){var t=e.map(n=>this.daysOfWeek.indexOf(n)),r=this.daysOfWeek.filter(n=>!e.includes(n)).map(n=>this.daysOfWeek.indexOf(n)),i=new Set;r.forEach(n=>{for(var s=n+1;s<n+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(n=>{for(var s=n-1;s>n-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var o=(l+1)%7;a.push([o,n]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(n=>{n.businessPeriods.length>0?a.push(...this.createPartialHoliday(n,t,r)):i.push(this.createFullHoliday(n,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(c=>{a.push(c.open),a.push(c.close)}),a.push("24:00");for(var n=[],s=0;s<a.length;s+=2){var l=a[s],o=a[s+1];if(l!==o){var d=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],p=Ke*(h.periodToDecimal(o)-h.periodToDecimal(l));n.push({values:d,dvalue:p})}}return n}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ce,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:n}=e,s=h.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},o={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,o],series:(i??[]).map(d=>({plotStyle:"".concat(n),name:d,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:d,axis:o,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(Qe(e))return r.i18n.DateTimeFormat.format(h.DATE_FORMAT,e,t);if(Je(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(se.isDateType(t)&&typeof e=="string"){var a=e,n=h.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(n,a);if(!r)return s;var l="".concat(n," Z"),o=i.i18n.DateTimeFormat.format("Z",s,r),d=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(o)),p=i.i18n.DateTimeFormat.format("Z",d,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(p))}return e}makeLayoutAxis(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:M,{dh:r}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M,{dh:t}=this,r=W(W({},e),{},{autosize:!0,colorway:h.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:W({},h.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:W({},h.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return W(W({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}b(h,"DEFAULT_AXIS_SIZE",.15);b(h,"MIN_AXIS_SIZE",.025);b(h,"MAX_AXIS_SIZE",.2);b(h,"AXIS_SIZE_PX",75);b(h,"LEGEND_WIDTH_PX",50);b(h,"MAX_LEGEND_SIZE",.25);b(h,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));b(h,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");b(h,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));b(h,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));b(h,"SUBTITLE_LINE_HEIGHT",25);b(h,"DEFAULT_MARKER_SIZE",6);b(h,"MODE_MARKERS","markers");b(h,"MODE_LINES","lines");const O=h;function ge(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(u);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,r)}return t}function me(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ge(Object(t),!0).forEach(function(r){N(u,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):ge(Object(t)).forEach(function(r){Object.defineProperty(u,r,Object.getOwnPropertyDescriptor(t,r))})}return u}function N(u,e,t){return e=tt(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function tt(u){var e=rt(u,"string");return typeof e=="symbol"?e:String(e)}function rt(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}var H=ie.module("Chart");class V extends B.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,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"}constructor(e){super(e),N(this,"currentSeries",void 0),N(this,"PlotComponent",void 0),N(this,"plot",void 0),N(this,"plotWrapper",void 0),N(this,"columnFormats",void 0),N(this,"dateTimeFormatterOptions",void 0),N(this,"decimalFormatOptions",void 0),N(this,"integerFormatOptions",void 0),N(this,"rect",void 0),N(this,"ranges",void 0),N(this,"isSubscribed",void 0),N(this,"isLoadedFired",void 0),N(this,"getCachedConfig",De((t,r,i,a,n)=>{var s=[],l=!!t;if(l&&s.push({name:"Downsampling failed: ".concat(t),title:"Downsampling failed",click:()=>{},icon:V.convertIcon(Ae),attr:"fill-warning"}),r||i||a||l){var o=V.downsampleButtonTitle(i,a),d=V.downsampleButtonAttr(i,a),p=i?Fe:Pe;s.push({name:o,title:"Downsampling status",icon:V.convertIcon(p),click:this.handleDownsampleClick,attr:d})}var c=n.some(v=>{var{type:f}=v;return f!=null&&!f.includes("3d")}),g=n.some(v=>{var{type:f}=v;return f!=null&&f.includes("3d")}),m=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],E=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:i||l?!0:"hover",modeBarButtons:[s,["toImage"],["zoom2d","pan2d"],[...c?m:[],...g?E:[]]]}})),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.PlotComponent=Ve(e.Plotly),this.plot=de.createRef(),this.plotWrapper=de.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}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){var{isActive:t,settings:r}=this.props;this.updateFormatterSettings(r),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:me(me({},t),e.getLayout())})}subscribe(){if(!this.isSubscribed){var{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){H.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(){if(this.isSubscribed){var{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var{type:t,detail:r}=e;switch(H.debug2("Received data update",t,r),t){case x.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:c,revision:g}=p;return typeof c.datarevision=="number"&&(c.datarevision+=1),{data:r,layout:c,revision:g+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case x.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case x.EVENT_DISCONNECT:{var{onDisconnect:n}=this.props;n();break}case x.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case x.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case x.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case x.EVENT_DOWNSAMPLENEEDED:case x.EVENT_DOWNSAMPLEFAILED:{var l,o=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});var{onError:d}=this.props;d(new Error(o));break}default:H.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=O.getLayoutRanges(t),i=!U(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(H.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleRestyle(e){var[t,r]=e;if(H.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var n=i.reduce((s,l)=>{var{name:o,visible:d}=l;return o!=null&&d==="legendonly"?[...s,o]:s},[]);a({hiddenSeries:n})}}}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){H.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe()}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=ne.getColumnFormats(e),r=ne.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!U(this.columnFormats,t)||!U(this.dateTimeFormatterOptions,r)||!U(this.decimalFormatOptions,i)||!U(this.integerFormatOptions,a))&&(this.columnFormats=ne.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Oe(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{H.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:n,layout:s,revision:l}=this.state,o=this.getCachedConfig(r,i,a,n,t??[]),d=t!=null;return j.jsx("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:d&&j.jsx(e,{ref:this.plot,data:t,layout:s,revision:l,config:o,onAfterPlot:this.handleAfterPlot,onError:H.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}}N(V,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Ne.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:Te,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const it=V;function fe(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(u);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,r)}return t}function ve(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fe(Object(t),!0).forEach(function(r){y(u,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):fe(Object(t)).forEach(function(r){Object.defineProperty(u,r,Object.getOwnPropertyDescriptor(t,r))})}return u}function y(u,e,t){return e=at(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function at(u){var e=st(u,"string");return typeof e=="symbol"?e:String(e)}function st(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}var w=ie.module("FigureChartModel");class ae extends x{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:M;super(e),r=this,y(this,"chartUtils",void 0),y(this,"dh",void 0),y(this,"figure",void 0),y(this,"settings",void 0),y(this,"theme",void 0),y(this,"data",void 0),y(this,"layout",void 0),y(this,"seriesDataMap",void 0),y(this,"pendingSeries",void 0),y(this,"oneClicks",void 0),y(this,"filterColumnMap",void 0),y(this,"lastFilter",void 0),y(this,"isConnected",void 0),y(this,"seriesToProcess",void 0),y(this,"addPendingSeries",be(()=>{for(var s=O.getAllAxes(this.figure),{pendingSeries:l}=this,o=function(){var c,g=l[d],m=r.figure.charts.find(E=>E.series.includes(g));r.addSeries(g,s,(c=m==null?void 0:m.showLegend)!==null&&c!==void 0?c:null),g.subscribe()},d=0;d<l.length;d+=1)o();this.pendingSeries=[]},ae.ADD_SERIES_DEBOUNCE)),y(this,"getTimeZone",Y((s,l)=>{if(l!=null){var o=l.getColumnTypeFormatter(s);if(o!=null)return o.dhTimeZone}})),y(this,"getValueTranslator",Y((s,l)=>{var o=this.getTimeZone(s,l);return d=>this.chartUtils.unwrapValue(d,o)})),y(this,"getValueParser",Y((s,l)=>{var o=this.getTimeZone(s,l);return d=>this.chartUtils.wrapValue(d,s,o)})),y(this,"getRangeParser",Y((s,l)=>o=>{var[d,p]=o,c=this.getValueParser(s,l);return d=c(d),p=c(p),[d,p]})),y(this,"getAxisRangeParser",Y((s,l)=>o=>{var d=O.getSourceForAxis(s,o);return d!=null?this.getRangeParser(d.columnType,l):p=>p})),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 O(e),this.figure=t,this.settings=i,this.theme=a,this.data=[];var n={data:{},layout:this.chartUtils.makeDefaultLayout(a)};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(){if(this.figure.charts.length>0){var e=this.figure.charts[0];return e.title}return""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:e}=this.figure,t=O.getAllAxes(this.figure),r=[],i=0;i<e.length;i+=1)for(var a=e[i],n=0;n<a.series.length;n+=1){var s=a.series[n];r.push(s.name),this.addSeries(s,t,a.showLegend)}for(var l=[...this.seriesDataMap.keys()],o=l.filter(c=>r.indexOf(c)<0),d=0;d<o.length;d+=1){var p=o[d];this.seriesDataMap.delete(p)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=O.groupArray(t,"type"),n=this.chartUtils.makeSeriesDataFromSeries(e,a,O.getSeriesVisibility(e.name,this.settings),r,this.theme);if(this.seriesDataMap.set(e.name,n),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=O.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:l}=s,o=0;o<l.length;o+=1)this.filterColumnMap.set(l[o].name,l[o]);this.oneClicks.push(s)}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){w.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(){var{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(){var{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){w.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){w.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){w.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){w.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;w.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];w.debug2("handleFigureUpdated updating series",a.name);for(var{sources:n}=a,s=0;s<n.length;s+=1){var l=n[s],{columnType:o,type:d}=l,p=this.getValueTranslator(o,this.formatter),c=t.getArray(a,d,p);this.setDataArrayForSeries(a,d,c)}this.seriesToProcess.delete(a.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(a)}var{data:g}=this;this.fireUpdate(g)}handleRequestFailed(e){w.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){w.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){w.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;w.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=O.DEFAULT_MARGIN.t+i*O.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=ve({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=ve({},this.layout.title.pad),this.layout.title.pad.t=O.DEFAULT_TITLE_PADDING.t+i*O.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,r=>this.getAxisRangeParser(r,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{w.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):w.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,n=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);n&&Se(n,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:n,xHigh:s}=a;if(n&&s&&n.length===s.length){for(var l=[],o=0;o<n.length;o+=1)l.push(s[o]-n[o]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:d,xLow:p,xHigh:c,y:g,yLow:m,yHigh:E}=a;p&&c&&p!==d&&(a.error_x=O.getPlotlyErrorBars(d,p,c)),m&&E&&m!==g&&(a.error_y=O.getPlotlyErrorBars(g,m,E))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:v,labels:f}=a;v!==void 0&&f===void 0&&(a.labels=v)}}}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){var t=this;if(this.oneClicks.length===0){w.warn("Trying to set a filter, but no one click!");return}w.debug("setFilter",e);for(var r=function(){var n=t.oneClicks[i],{columns:s}=n,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(o=>{var d=e.get(o);t.lastFilter.get(o)!==d&&s.find(p=>p.name===o)!=null&&n.setValueForColumn(o,d)})},i=0;i<this.oneClicks.length;i+=1)r();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}}y(ae,"ADD_SERIES_DEBOUNCE",50);const Ee=ae;function ye(u,e,t,r,i,a,n){try{var s=u[a](n),l=s.value}catch(o){t(o);return}s.done?e(l):Promise.resolve(l).then(r,i)}function oe(u){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=u.apply(e,t);function n(l){ye(a,r,i,n,s,"next",l)}function s(l){ye(a,r,i,n,s,"throw",l)}n(void 0)})}}class le{static makeModelFromSettings(e,t,r){var i=arguments;return oe(function*(){var a=i.length>3&&i[3]!==void 0?i[3]:M,n=yield le.makeFigureFromSettings(e,t,r);return new Ee(e,n,t,a)})()}static makeFigureFromSettings(e,t,r){return oe(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new O(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r){var i=arguments;return oe(function*(){var a=i.length>3&&i[3]!==void 0?i[3]:M;return new Ee(e,r,t,a)})()}}const nt=le;const Q=ie.module("EmbedChart.App");async function ot(u,e,t){Q.info(`Fetching figure ${t}...`);const r={name:t,type:u.VariableType.FIGURE};return e.getObject(r)}function pt(){const[u,e]=B.useState(),[t,r]=B.useState(),[i,a]=B.useState(!0),n=B.useMemo(()=>new URLSearchParams(window.location.search),[]),s=Le(),l=Ie();B.useEffect(function(){async function p(){try{const c=n.get("name");if(c==null)throw new Error("No name param provided");Q.debug("Loading figure",c,"...");const g=await ot(l,s,c);Q.debug("Creating model...");const m=await nt.makeModel(l,void 0,g);e(m),Q.debug("Figure successfully loaded!")}catch(c){Q.error("Unable to load figure",c),r(`${c}`)}a(!1)}p()},[l,s,n]);const o=u!=null;return j.jsxs("div",{className:"App",children:[o&&j.jsx(it,{model:u}),!o&&j.jsx(we,{isLoaded:o,isLoading:i,errorMessage:t??null}),j.jsx(Me,{})]})}export{pt as default};
2
- //# sourceMappingURL=App-d6f8c02b.js.map
1
+ import{H as Se,r as B,G as de,I as U,C as j,J as De,K as be,L as Y}from"./vendor-7af3c298.js";import{L as ie,a as K,d as Ae,v as Fe,b as Pe,c as we}from"./index-e9fddf66.js";import{T as se,F as ne,a as Oe,D as Ne,u as Le,b as Ie,C as Me}from"./useConnection-25bb0172.js";import{P as Te,b as Re,h as _e,p as xe,o as ke,s as Ce,t as He,c as Ve}from"./plotly-ec6334b5.js";import"./helpers-042e6b4d.js";Te.register([Re,_e,xe,ke,Ce,He]);function L(u,e,t){return e=$e(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function $e(u){var e=We(u,"string");return typeof e=="symbol"?e:String(e)}function We(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}class T{constructor(e){L(this,"dh",void 0),L(this,"listeners",void 0),L(this,"formatter",void 0),L(this,"rect",void 0),L(this,"isDownsamplingDisabled",void 0),L(this,"title",void 0),this.dh=e,this.listeners=[],this.isDownsamplingDisabled=!1}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(e){}close(){}setFormatter(e){this.formatter=e}setDownsamplingDisabled(e){this.isDownsamplingDisabled=e}setDimensions(e){this.rect=e}setTitle(e){this.title=e}subscribe(e){this.listeners.push(e)}unsubscribe(e){this.listeners=this.listeners.filter(t=>t!==e)}fireEvent(e){for(var t=0;t<this.listeners.length;t+=1)this.listeners[t](e)}fireUpdate(e){this.fireEvent(new CustomEvent(T.EVENT_UPDATED,{detail:e}))}fireDisconnect(){this.fireEvent(new CustomEvent(T.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(T.EVENT_RECONNECT))}fireDownsampleStart(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLESTARTED,{detail:e}))}fireDownsampleFinish(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLEFINISHED,{detail:e}))}fireDownsampleFail(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLEFAILED,{detail:e}))}fireDownsampleNeeded(e){this.fireEvent(new CustomEvent(T.EVENT_DOWNSAMPLENEEDED,{detail:e}))}fireLoadFinished(){this.fireEvent(new CustomEvent(T.EVENT_LOADFINISHED))}}L(T,"EVENT_UPDATED","ChartModel.EVENT_UPDATED");L(T,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT");L(T,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT");L(T,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED");L(T,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED");L(T,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED");L(T,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED");L(T,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");const x=T,Be="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",je="#403e41",Xe="#5b5a5c",ze="#c0bfbf",Ge="#4878ea",Ze="rgba(91, 90, 92, 0.7)",A={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:Be,gridcolor:je,linecolor:Xe,zerolinecolor:ze,activecolor:Ge,rangebgcolor:Ze,"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"},M=Object.freeze({paper_bgcolor:A["paper-bgcolor"],plot_bgcolor:A["plot-bgcolor"],title_color:A["title-color"],colorway:A.colorway,gridcolor:A.gridcolor,linecolor:A.linecolor,zerolinecolor:A.zerolinecolor,activecolor:A.activecolor,rangebgcolor:A.rangebgcolor,area_color:A["area-color"],trend_color:A["trend-color"],line_color:A["line-color"],error_band_line_color:A["error-band-line-color"],error_band_fill_color:A["error-band-fill-color"],ohlc_increasing:A["ohlc-increasing"],ohlc_decreasing:A["ohlc-decreasing"]});function he(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(u);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,r)}return t}function W(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?he(Object(t),!0).forEach(function(r){b(u,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):he(Object(t)).forEach(function(r){Object.defineProperty(u,r,Object.getOwnPropertyDescriptor(t,r))})}return u}function b(u,e,t){return e=Ue(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function Ue(u){var e=Ye(u,"string");return typeof e=="symbol"?e:String(e)}function Ye(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}var q=ie.module("ChartUtils"),ce="io.deephaven.time.DateTime",Ke=36e5,qe=1e6;function Qe(u){return u.asDate!==void 0}function Je(u){return u.asNumber!==void 0}function pe(u){return u.dhTimeZone!==void 0}function et(u){return u!=null&&u.range!=null&&(u.autorange===!1||u.autorange===void 0)}class h{static getPlotlyErrorBars(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:M,a=r.map((s,l)=>s-e[l]),n=t.map((s,l)=>e[l]-s);return{type:"data",symmetric:!1,array:a,arrayminus:n,color:i.error_band_line_color}}static convertNumberPrefix(e){return e.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(e,t,r){if(!r)return null;var i=r.split(";"),a=i[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/);K(a);var[,n,s,l,,o,d,p,c,g]=a,m=l.replace(",","").length,E=s.indexOf(",")>=0||l.indexOf(",")>=0,v=E?",":"",f=p!=null&&p!==""?"e":"f",D=c!==""?c:f,S=o.length+d.length,F="",P="0".concat(m).concat(v,".").concat(S).concat(F).concat(D),k=h.convertNumberPrefix(n),R=h.convertNumberPrefix(g);return{tickformat:P,tickprefix:k,ticksuffix:R,automargin:!0}}static addTickSpacing(e,t,r){var{gapBetweenMajorTicks:i}=t;if(i>0){var a=e||{},n=i;return r&&(n=i/qe),t.log&&(n=Math.log(n)),a.tickmode="linear",a.dtick=n,a}return e}static getSourceForAxis(e,t){for(var r=0;r<e.series.length;r+=1)for(var i=e.series[r],a=0;a<i.sources.length;a+=1){var n=i.sources[a];if(n.axis===t)return n}return null}static getSeriesVisibility(e,t){return t!=null&&t.hiddenSeries!=null&&t.hiddenSeries.includes(e)?"legendonly":!0}static getHiddenLabels(e){return e!=null&&e.hiddenSeries?[...e.hiddenSeries]:[]}static makeSeriesData(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:h.ORIENTATION.VERTICAL;return{type:e,mode:t,name:r,orientation:a,showlegend:i??void 0}}static getMarkerSymbol(e){switch(e){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 ".concat(e))}}static getAllAxes(e){return e.charts.reduce((t,r)=>[...t,...r.axes],[])}static getChartForSeries(e,t){for(var{charts:r}=e,i=0;i<r.length;i+=1)for(var a=r[i],n=0;n<a.series.length;n+=1)if(t===a.series[n])return a;return null}static getLayoutRanges(e){for(var t={},r=Object.keys(e).filter(s=>s.indexOf("axis")>=0),i=0;i<r.length;i+=1){var a=r[i],n=e[a];et(n)&&(t[a]=[...n.range])}return t}static getAxisLayoutProperty(e,t){var r=t>0?"".concat(t+1):"";return"".concat(e??"","axis").concat(r)}static periodToDecimal(e){var t=e.split(":");return Number(t[0])+Number(t[1])/60}static groupArray(e,t){return e.reduce((r,i)=>{var a,n=i[t],s=(a=r.get(n))!==null&&a!==void 0?a:[];return s.push(i),r.set(n,s),r},new Map)}static getColorwayFromTheme(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M,t=[];return e.colorway&&(Array.isArray(e.colorway)?t=e.colorway:typeof e.colorway=="string"?t=e.colorway.split(" "):q.warn("Unable to handle colorway property: ".concat(e.colorway))),t}static titleFromSettings(e){var{series:t,xAxis:r,title:i="".concat((t??[]).join(", ")," by ").concat(r)}=e;return i}constructor(e){b(this,"dh",void 0),b(this,"daysOfWeek",void 0),this.dh=e,this.daysOfWeek=Object.freeze(e.calendar.DayOfWeek.values())}getAxisFormats(e,t){for(var r=this,i=new Map,a={tickformat:null,ticksuffix:null},n=h.getAllAxes(e),s=h.groupArray(n,"type"),{charts:l}=e,o=0;o<l.length;o+=1)for(var d=l[o],p=0;p<d.series.length;p+=1)for(var c=d.series[p],{sources:g}=c,m=g.filter(D=>D.axis),E=function(){var S=m[v],{axis:F}=S,{type:P}=F,k=s.get(P);K(k);var R=k.indexOf(F),_=r.getAxisPropertyName(P);if(_!=null){var I=h.getAxisLayoutProperty(_,R);if(i.has(I))q.debug("".concat(I," already added."));else{q.debug("Adding ".concat(I," to axisFormats."));var X=r.getPlotlyAxisFormat(S,t);if(X===null)i.set(I,a);else{i.set(I,X);var{businessCalendar:$}=F;if($!=null){var C=[],{businessPeriods:J,businessDays:z,holidays:ee,timeZone:G}=$,Z=t==null?void 0:t.getColumnTypeFormatter(ce),te;pe(Z)&&(te=Z.dhTimeZone);var ue=te?(G.standardOffset-te.standardOffset)/60:0;ee.length>0&&C.push(...r.createRangeBreakValuesFromHolidays(ee,G,te)),J.forEach(re=>C.push({pattern:"hour",bounds:[h.periodToDecimal(re.close)+ue,h.periodToDecimal(re.open)+ue]})),z.length<r.daysOfWeek.length&&r.createBoundsFromDays(z).forEach(re=>C.push({pattern:"day of week",bounds:re})),X.rangebreaks=C}if(i.size===d.axes.length)return{v:i}}}}},v=0;v<m.length;v+=1){var f=E();if(typeof f=="object")return f.v}return i}getPlotlyChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.SCATTER:return t?"scatter":"scattergl";case r.plot.SeriesPlotStyle.LINE:return"scatter";case r.plot.SeriesPlotStyle.BAR:case r.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case r.plot.SeriesPlotStyle.PIE:return"pie";case r.plot.SeriesPlotStyle.TREEMAP:return"treemap";case r.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case r.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return}}getPlotlyChartMode(e,t,r){var{dh:i}=this,a=new Set;switch(e){case i.plot.SeriesPlotStyle.SCATTER:(t??!1)&&a.add(h.MODE_LINES),(r??!0)&&a.add(h.MODE_MARKERS);break;case i.plot.SeriesPlotStyle.LINE:(t??!0)&&a.add(h.MODE_LINES),(r??!1)&&a.add(h.MODE_MARKERS);break}return a.size>0?[...a].join("+"):void 0}getPlotlyProperty(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.PIE:switch(t){case r.plot.SourceType.X:return"labels";case r.plot.SourceType.Y:return"values"}break;case r.plot.SeriesPlotStyle.OHLC:switch(t){case r.plot.SourceType.TIME:return"x"}break;case r.plot.SeriesPlotStyle.TREEMAP:switch(t){case r.plot.SourceType.X:return"ids";case r.plot.SourceType.Y:return"values";case r.plot.SourceType.LABEL:return"labels";case r.plot.SourceType.PARENT:return"parents";case r.plot.SourceType.COLOR:return"marker.colors"}break}switch(t){case r.plot.SourceType.X:return"x";case r.plot.SourceType.Y:return"y";case r.plot.SourceType.Z:return"z";case r.plot.SourceType.X_LOW:return"xLow";case r.plot.SourceType.X_HIGH:return"xHigh";case r.plot.SourceType.Y_LOW:return"yLow";case r.plot.SourceType.Y_HIGH:return"yHigh";case r.plot.SourceType.TIME:return"time";case r.plot.SourceType.OPEN:return"open";case r.plot.SourceType.HIGH:return"high";case r.plot.SourceType.LOW:return"low";case r.plot.SourceType.CLOSE:return"close";case r.plot.SourceType.SHAPE:return"shape";case r.plot.SourceType.SIZE:return"size";case r.plot.SourceType.LABEL:return"label";case r.plot.SourceType.COLOR:return"color";case r.plot.SourceType.PARENT:return"parent";case r.plot.SourceType.HOVER_TEXT:return"hovertext";case r.plot.SourceType.TEXT:return"text";default:throw new Error("Unrecognized source type: ".concat(t))}}getPlotlySeriesOrientation(e){var t,r,{dh:i}=this,{sources:a}=e;return a.length===2&&((t=a[0])===null||t===void 0||(r=t.axis)===null||r===void 0?void 0:r.type)===i.plot.AxisType.Y?h.ORIENTATION.HORIZONTAL:h.ORIENTATION.VERTICAL}makeSeriesDataFromSeries(e,t,r){var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:M,{name:n,isLinesVisible:s,isShapesVisible:l,plotStyle:o,lineColor:d,shapeColor:p,sources:c,shape:g,shapeSize:m}=e,E=c.some(F=>{var P;return(P=F.axis)===null||P===void 0?void 0:P.businessCalendar}),v=this.getChartType(o,E),f=this.getPlotlyChartMode(o,s??void 0,l??void 0),D=this.getPlotlySeriesOrientation(e),S=h.makeSeriesData(v,f,n,i,D);return this.addSourcesToSeriesData(S,o,c,t),this.addStylingToSeriesData(S,o,a,d,p,g,m,r),S}addSourcesToSeriesData(e,t,r,i){for(var a=e,n=0;n<r.length;n+=1){var s=r[n],{axis:l,type:o}=s,d=this.getPlotlyProperty(t,o);Se(a,d,[]);var p=l!=null?this.getAxisPropertyName(l.type):null;if(p!=null){var c=i.get(l.type);if(c){var g=c.indexOf(l),m=g>0?"".concat(g+1):"";a["".concat(p,"axis")]="".concat(p).concat(m)}}}}addStylingToSeriesData(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:M,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:null,n=arguments.length>5&&arguments[5]!==void 0?arguments[5]:null,s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:null,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:null,{dh:o}=this,d=e;if(d.marker={line:{}},d.line={width:1},t===o.plot.SeriesPlotStyle.AREA?d.fill="tozeroy":t===o.plot.SeriesPlotStyle.STACKED_AREA?d.stackgroup="stack":t===o.plot.SeriesPlotStyle.STEP?d.line.shape="hv":t===o.plot.SeriesPlotStyle.HISTOGRAM?(d.width=[],d.marker.line!==void 0&&Object.assign(d.marker.line,{color:r.paper_bgcolor,width:1})):t===o.plot.SeriesPlotStyle.OHLC?(d.increasing={line:{color:r.ohlc_increasing}},d.decreasing={line:{color:r.ohlc_decreasing}}):t===o.plot.SeriesPlotStyle.PIE?(d.textinfo="label+percent",d.outsidetextfont={color:r.title_color}):t===o.plot.SeriesPlotStyle.TREEMAP&&(d.hoverinfo="text",d.textinfo="label+text",d.tiling={packing:"squarify",pad:0},d.textposition="middle center",d.outsidetextfont={color:r.title_color}),i!=null&&(t===o.plot.SeriesPlotStyle.BAR?d.marker.color=i:d.line.color=i),a!=null&&(d.marker.color=a),n!=null&&n.length>0)try{d.marker.symbol=h.getMarkerSymbol(n)}catch(p){q.warn("Unable to handle shape",n,":",p)}s!=null&&(d.marker.size=s*h.DEFAULT_MARKER_SIZE),l!=null&&t!==o.plot.SeriesPlotStyle.PIE&&(d.visible=l)}getChartType(e,t){var{dh:r}=this;switch(e){case r.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return this.getPlotlyChartType(e,t)}}getAxisPropertyName(e){var{dh:t}=this;switch(e){case t.plot.AxisType.X:return"x";case t.plot.AxisType.Y:return"y";default:return null}}getAxisSide(e){var{dh:t}=this;switch(e){case t.plot.AxisPosition.BOTTOM:return"bottom";case t.plot.AxisPosition.TOP:return"top";case t.plot.AxisPosition.LEFT:return"left";case t.plot.AxisPosition.RIGHT:return"right";default:return}}updateFigureAxes(e,t,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,n=arguments.length>5&&arguments[5]!==void 0?arguments[5]:M,s=e,l=h.getAllAxes(t),o=0;o<t.charts.length;o+=1){var d=t.charts[o],p=r==null?void 0:r(d),c=this.getChartBounds(t,d,i,a);this.updateLayoutAxes(s,d.axes,l,i,a,c,p,n)}this.removeStaleAxes(s,l)}getChartBounds(e,t,r,i){var a,{dh:n}=this,{cols:s,rows:l}=e,{column:o,colspan:d,row:p,rowspan:c}=t,g=o+d,m=p+c,E=1/s,v=1/l,f=h.AXIS_SIZE_PX/r,D=h.AXIS_SIZE_PX/i,S={bottom:(l-m)*v+(m<l?D/2:0),top:(l-p)*v-(p>0?D/2:0),left:o*E+(o>0?f/2:0),right:g*E-(g<s?f/2:0)},F=h.groupArray(t.axes,"position"),P=(a=F.get(n.plot.AxisPosition.RIGHT))!==null&&a!==void 0?a:[];return P.length>0&&(r>0?S.right-=(S.right-S.left)*Math.max(0,Math.min(h.LEGEND_WIDTH_PX/r,h.MAX_LEGEND_SIZE)):S.right-=(S.right-S.left)*h.DEFAULT_AXIS_SIZE),S}getPlotlyDateFormat(e,t,r){var{dh:i}=this,a=r==null?void 0:r.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",""),n,s=e==null?void 0:e.getColumnTypeFormatter(t);return s!=null&&pe(s)&&s.dhTimeZone!=null&&s.showTimeZone&&(n=i.i18n.DateTimeFormat.format(" z",new Date,s.dhTimeZone)),{tickformat:a,ticksuffix:n,automargin:!0}}getPlotlyAxisFormat(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,{dh:r}=this,{axis:i,columnType:a}=e,{formatPattern:n}=i,s=null;return se.isDateType(a)?(s=this.getPlotlyDateFormat(t,a,n),s=h.addTickSpacing(s,i,!0)):se.isNumberType(a)&&(s=h.getPlotlyNumberFormat(t,a,n),s=h.addTickSpacing(s,i,!1)),i.formatType===r.plot.AxisFormatType.CATEGORY&&(s?s.type="category":s={type:"category",tickformat:void 0,ticksuffix:void 0}),s}updateLayoutAxes(e,t,r){for(var i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,n=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{left:0,top:0,right:1,bottom:1},s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:M,{dh:o}=this,d=i>0?Math.max(h.MIN_AXIS_SIZE,Math.min(h.AXIS_SIZE_PX/a,h.MAX_AXIS_SIZE)):h.DEFAULT_AXIS_SIZE,p=a>0?Math.max(h.MIN_AXIS_SIZE,Math.min(h.AXIS_SIZE_PX/i,h.MAX_AXIS_SIZE)):h.DEFAULT_AXIS_SIZE,c=e,g=h.groupArray(t,"position"),m=h.groupArray(t,"type"),E=[...m.keys()],v=h.groupArray(r,"type"),f=0;f<E.length;f+=1){var D=E[f],S=this.getAxisPropertyName(D);if(S!=null){var F=m.get(D),P=v.get(D),k=D===o.plot.AxisType.Y,R=k?a:i;K(F),K(P);for(var _=0;_<F.length;_+=1){var I=F[_],X=P.indexOf(I),$=h.getAxisLayoutProperty(S,X);c[$]==null&&(c[$]=this.makeLayoutAxis(D,l));var C=c[$];if(C!=null){this.updateLayoutAxis(C,I,_,g,d,p,n);var{range:J,autorange:z}=C;if(s!=null&&J!==void 0&&(z===void 0||z===!1)){var ee=s(I),[G,Z]=ee(J);q.debug("Setting downsample range",R,G,Z),I.range(R,G,Z)}else I.range(R)}}}}}removeStaleAxes(e,t){for(var r=e,i=h.groupArray(t,"type"),a=[...i.keys()],n=0;n<a.length;n+=1){var s=a[n],l=i.get(s);K(l);var o=l.length,d=this.getAxisPropertyName(s);if(d!=null)for(var p=h.getAxisLayoutProperty(d,o);r[p]!=null;)delete r[p],o+=1,p=h.getAxisLayoutProperty(d,o)}}updateLayoutAxis(e,t,r,i,a,n,s){var l,{dh:o}=this,d=t.type===o.plot.AxisType.Y,p=d?n:a,c=e,g=(l=t.label)!==null&&l!==void 0?l:"";if(c.title!==void 0&&typeof c.title!="string"?c.title.text=g:c.title={text:g},t.log&&(c.type="log"),c.side=this.getAxisSide(t.position),r>0){var m,E;c.overlaying=(m=this.getAxisPropertyName(t.type))!==null&&m!==void 0?m:void 0;var v=(E=i.get(t.position))!==null&&E!==void 0?E:[],f=v.indexOf(t);f>0&&(c.anchor="free",t.position===o.plot.AxisPosition.RIGHT?c.position=s.right+(f-v.length+1)*p:t.position===o.plot.AxisPosition.TOP?c.position=s.top+(f-v.length+1)*p:t.position===o.plot.AxisPosition.BOTTOM?c.position=s.bottom+(v.length-f+1)*p:t.position===o.plot.AxisPosition.LEFT&&(c.position=s.left+(v.length-f+1)*p))}else if(t.type===o.plot.AxisType.X){var D=i.get(o.plot.AxisPosition.LEFT)||[],S=i.get(o.plot.AxisPosition.RIGHT)||[],F=Math.max(s.left,s.left+(D.length-1)*n),P=Math.min(s.right-(S.length-1)*n,s.right);c.domain=[F,P]}else if(t.type===o.plot.AxisType.Y){var k=i.get(o.plot.AxisPosition.BOTTOM)||[],R=i.get(o.plot.AxisPosition.TOP)||[],_=Math.max(s.bottom,s.bottom+(k.length-1)*a),I=Math.min(s.top-(R.length-1)*a,s.top);c.domain=[_,I]}}createBoundsFromDays(e){var t=e.map(n=>this.daysOfWeek.indexOf(n)),r=this.daysOfWeek.filter(n=>!e.includes(n)).map(n=>this.daysOfWeek.indexOf(n)),i=new Set;r.forEach(n=>{for(var s=n+1;s<n+this.daysOfWeek.length;s+=1){var l=s%this.daysOfWeek.length;if(t.includes(l)){i.add(l);break}}});var a=[];return i.forEach(n=>{for(var s=n-1;s>n-this.daysOfWeek.length;s-=1){var l=s<0?s+this.daysOfWeek.length:s;if(t.includes(l)){var o=(l+1)%7;a.push([o,n]);break}}}),a}createRangeBreakValuesFromHolidays(e,t,r){var i=[],a=[];return e.forEach(n=>{n.businessPeriods.length>0?a.push(...this.createPartialHoliday(n,t,r)):i.push(this.createFullHoliday(n,t,r))}),[{values:i},...a]}createFullHoliday(e,t,r){return this.adjustDateForTimeZone("".concat(e.date.toString()," 00:00:00.000000"),t,r)}createPartialHoliday(e,t,r){var i=e.date.toString(),a=["00:00"];e.businessPeriods.forEach(c=>{a.push(c.open),a.push(c.close)}),a.push("24:00");for(var n=[],s=0;s<a.length;s+=2){var l=a[s],o=a[s+1];if(l!==o){var d=[this.adjustDateForTimeZone("".concat(i," ").concat(l,":00.000000"),t,r)],p=Ke*(h.periodToDecimal(o)-h.periodToDecimal(l));n.push({values:d,dvalue:p})}}return n}adjustDateForTimeZone(e,t,r){return r&&r.standardOffset!==t.standardOffset?this.unwrapValue(this.wrapValue(e,ce,t),r):e}makeFigureSettings(e,t){var{dh:r}=this,{series:i,xAxis:a,type:n}=e,s=h.titleFromSettings(e),l={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.X),position:"".concat(r.plot.AxisPosition.BOTTOM)},o={formatType:"".concat(r.plot.AxisFormatType.NUMBER),type:"".concat(r.plot.AxisType.Y),position:"".concat(r.plot.AxisPosition.LEFT)};return{charts:[{chartType:"".concat(r.plot.ChartType.XY),axes:[l,o],series:(i??[]).map(d=>({plotStyle:"".concat(n),name:d,dataSources:[{type:"".concat(r.plot.SourceType.X),columnName:a??"",axis:l,table:t},{type:"".concat(r.plot.SourceType.Y),columnName:d,axis:o,table:t}]}))}],title:s}}unwrapValue(e,t){var{dh:r}=this;if(e!=null){if(Qe(e))return r.i18n.DateTimeFormat.format(h.DATE_FORMAT,e,t);if(Je(e))return e.asNumber()}return e}wrapValue(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,{dh:i}=this;if(se.isDateType(t)&&typeof e=="string"){var a=e,n=h.DATE_FORMAT.substr(0,e.length),s=i.i18n.DateTimeFormat.parse(n,a);if(!r)return s;var l="".concat(n," Z"),o=i.i18n.DateTimeFormat.format("Z",s,r),d=i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(o)),p=i.i18n.DateTimeFormat.format("Z",d,r);return i.i18n.DateTimeFormat.parse(l,"".concat(a," ").concat(p))}return e}makeLayoutAxis(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:M,{dh:r}=this,i={automargin:!0,gridcolor:t.gridcolor,linecolor:t.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:t.paper_bgcolor,tickfont:{color:t.zerolinecolor},title:{font:{color:t.title_color}}};return e===r.plot.AxisType.X?Object.assign(i,{showgrid:!0}):e===r.plot.AxisType.Y&&Object.assign(i,{zerolinecolor:t.zerolinecolor,zerolinewidth:2}),i}makeDefaultLayout(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M,{dh:t}=this,r=W(W({},e),{},{autosize:!0,colorway:h.getColorwayFromTheme(e),font:{family:"'Fira Sans', sans-serif",color:e.title_color},title:{font:{color:e.title_color},yanchor:"top",pad:W({},h.DEFAULT_TITLE_PADDING),y:1},legend:{font:{color:e.title_color}},margin:W({},h.DEFAULT_MARGIN),xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),polar:{angularaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),radialaxis:this.makeLayoutAxis(t.plot.AxisType.SHAPE,e),bgcolor:e.plot_bgcolor},scene:{xaxis:this.makeLayoutAxis(t.plot.AxisType.X,e),yaxis:this.makeLayoutAxis(t.plot.AxisType.Y,e),zaxis:this.makeLayoutAxis(t.plot.AxisType.Z,e)}});return r.datarevision=0,r}hydrateSettings(e){var{dh:t}=this;return W(W({},e),{},{type:e.type!=null?t.plot.SeriesPlotStyle[e.type]:void 0})}}b(h,"DEFAULT_AXIS_SIZE",.15);b(h,"MIN_AXIS_SIZE",.025);b(h,"MAX_AXIS_SIZE",.2);b(h,"AXIS_SIZE_PX",75);b(h,"LEGEND_WIDTH_PX",50);b(h,"MAX_LEGEND_SIZE",.25);b(h,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"}));b(h,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS");b(h,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0}));b(h,"DEFAULT_TITLE_PADDING",Object.freeze({t:8}));b(h,"SUBTITLE_LINE_HEIGHT",25);b(h,"DEFAULT_MARKER_SIZE",6);b(h,"MODE_MARKERS","markers");b(h,"MODE_LINES","lines");const O=h;function ge(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(u);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,r)}return t}function me(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ge(Object(t),!0).forEach(function(r){N(u,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):ge(Object(t)).forEach(function(r){Object.defineProperty(u,r,Object.getOwnPropertyDescriptor(t,r))})}return u}function N(u,e,t){return e=tt(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function tt(u){var e=rt(u,"string");return typeof e=="symbol"?e:String(e)}function rt(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}var H=ie.module("Chart");class V extends B.Component{static convertIcon(e){var[t,,,,r]=e.icon,i="".concat(r);return{width:t,path:i,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"}constructor(e){super(e),N(this,"currentSeries",void 0),N(this,"PlotComponent",void 0),N(this,"plot",void 0),N(this,"plotWrapper",void 0),N(this,"columnFormats",void 0),N(this,"dateTimeFormatterOptions",void 0),N(this,"decimalFormatOptions",void 0),N(this,"integerFormatOptions",void 0),N(this,"rect",void 0),N(this,"ranges",void 0),N(this,"isSubscribed",void 0),N(this,"isLoadedFired",void 0),N(this,"getCachedConfig",De((t,r,i,a,n)=>{var s=[],l=!!t;if(l&&s.push({name:"Downsampling failed: ".concat(t),title:"Downsampling failed",click:()=>{},icon:V.convertIcon(Ae),attr:"fill-warning"}),r||i||a||l){var o=V.downsampleButtonTitle(i,a),d=V.downsampleButtonAttr(i,a),p=i?Fe:Pe;s.push({name:o,title:"Downsampling status",icon:V.convertIcon(p),click:this.handleDownsampleClick,attr:d})}var c=n.some(v=>{var{type:f}=v;return f!=null&&!f.includes("3d")}),g=n.some(v=>{var{type:f}=v;return f!=null&&f.includes("3d")}),m=["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"],E=["orbitRotation","tableRotation","resetCameraDefault3d"];return{displaylogo:!1,displayModeBar:i||l?!0:"hover",modeBarButtons:[s,["toImage"],["zoom2d","pan2d"],[...c?m:[],...g?E:[]]]}})),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.PlotComponent=Ve(e.Plotly),this.plot=de.createRef(),this.plotWrapper=de.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}}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();var{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){var{isActive:t,settings:r}=this.props;this.updateFormatterSettings(r),t!==e.isActive&&(t?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,t;return(e=(t=this.plotWrapper.current)===null||t===void 0?void 0:t.getBoundingClientRect())!==null&&e!==void 0?e:null}initData(){var{model:e}=this.props,{layout:t}=this.state;this.setState({data:e.getData(),layout:me(me({},t),e.getLayout())})}subscribe(){if(!this.isSubscribed){var{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){H.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}}unsubscribe(){if(this.isSubscribed){var{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}}handleAfterPlot(){this.plot.current!=null}handleDownsampleClick(){this.setState(e=>{var{isDownsamplingDisabled:t}=e;return{downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!t}},()=>{var{model:e}=this.props,{isDownsamplingDisabled:t}=this.state;e.setDownsamplingDisabled(t)})}handleModelEvent(e){var{type:t,detail:r}=e;switch(H.debug2("Received data update",t,r),t){case x.EVENT_UPDATED:{this.currentSeries+=1,this.setState(p=>{var{layout:c,revision:g}=p;return typeof c.datarevision=="number"&&(c.datarevision+=1),{data:r,layout:c,revision:g+1}});var{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case x.EVENT_LOADFINISHED:{var{onUpdate:a}=this.props;this.isLoadedFired=!0,a({isLoading:!1});break}case x.EVENT_DISCONNECT:{var{onDisconnect:n}=this.props;n();break}case x.EVENT_RECONNECT:{var{onReconnect:s}=this.props;s();break}case x.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case x.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case x.EVENT_DOWNSAMPLENEEDED:case x.EVENT_DOWNSAMPLEFAILED:{var l,o=(l=r.message)!==null&&l!==void 0?l:r;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:o});var{onError:d}=this.props;d(new Error(o));break}default:H.debug("Unknown event type",t,e)}}handlePlotUpdate(e){var{layout:t}=e,r=O.getLayoutRanges(t),i=!U(r,this.ranges);i&&(this.ranges=r,this.updateModelDimensions(!0))}handleRelayout(e){if(H.debug("handleRelayout",e),e.hiddenlabels!=null){var{onSettingsChanged:t}=this.props,r=[...e.hiddenlabels];t({hiddenSeries:r})}this.updateModelDimensions()}handleRestyle(e){var[t,r]=e;if(H.debug("handleRestyle",t,r),Object.keys(t).includes("visible")){var{data:i}=this.state,{onSettingsChanged:a}=this.props;if(i!=null){var n=i.reduce((s,l)=>{var{name:o,visible:d}=l;return o!=null&&d==="legendonly"?[...s,o]:s},[]);a({hiddenSeries:n})}}}updateModelDimensions(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.getPlotRect();if(!t){H.warn("Unable to get plotting rect");return}var r=!this.rect||this.rect.width!==t.width||this.rect.height!==t.height;if(r||e){this.rect=t;var{isActive:i,model:a}=this.props;a.setDimensions(t),i&&this.subscribe()}}initFormatter(){var{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){var t=ne.getColumnFormats(e),r=ne.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:a={}}=e;(!U(this.columnFormats,t)||!U(this.dateTimeFormatterOptions,r)||!U(this.decimalFormatOptions,i)||!U(this.integerFormatOptions,a))&&(this.columnFormats=ne.getColumnFormats(e),this.dateTimeFormatterOptions=r,this.decimalFormatOptions=i,this.integerFormatOptions=a,this.updateFormatter())}updateFormatter(){var{model:e}=this.props,t=new Oe(e.dh,this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions);e.setFormatter(t)}updateDimensions(){var e=this.getPlotRect(),{Plotly:t}=this.props;this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&t.relayout(this.plot.current.el,{autosize:!0}).catch(r=>{H.debug("Unable to resize, promise rejected",r)})}render(){var{PlotComponent:e}=this,{data:t,downsamplingError:r,isDownsampleFinished:i,isDownsampleInProgress:a,isDownsamplingDisabled:n,layout:s,revision:l}=this.state,o=this.getCachedConfig(r,i,a,n,t??[]),d=t!=null;return j.jsx("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper,children:d&&j.jsx(e,{ref:this.plot,data:t,layout:s,revision:l,config:o,onAfterPlot:this.handleAfterPlot,onError:H.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}})})}}N(V,"defaultProps",{isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:Ne.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},Plotly:Te,onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}});const it=V;function fe(u,e){var t=Object.keys(u);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(u);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(u,i).enumerable})),t.push.apply(t,r)}return t}function ve(u){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?fe(Object(t),!0).forEach(function(r){y(u,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(t)):fe(Object(t)).forEach(function(r){Object.defineProperty(u,r,Object.getOwnPropertyDescriptor(t,r))})}return u}function y(u,e,t){return e=at(e),e in u?Object.defineProperty(u,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):u[e]=t,u}function at(u){var e=st(u,"string");return typeof e=="symbol"?e:String(e)}function st(u,e){if(typeof u!="object"||u===null)return u;var t=u[Symbol.toPrimitive];if(t!==void 0){var r=t.call(u,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(u)}var w=ie.module("FigureChartModel");class ae extends x{constructor(e,t){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:M;super(e),r=this,y(this,"chartUtils",void 0),y(this,"dh",void 0),y(this,"figure",void 0),y(this,"settings",void 0),y(this,"theme",void 0),y(this,"data",void 0),y(this,"layout",void 0),y(this,"seriesDataMap",void 0),y(this,"pendingSeries",void 0),y(this,"oneClicks",void 0),y(this,"filterColumnMap",void 0),y(this,"lastFilter",void 0),y(this,"isConnected",void 0),y(this,"seriesToProcess",void 0),y(this,"addPendingSeries",be(()=>{for(var s=O.getAllAxes(this.figure),{pendingSeries:l}=this,o=function(){var c,g=l[d],m=r.figure.charts.find(E=>E.series.includes(g));r.addSeries(g,s,(c=m==null?void 0:m.showLegend)!==null&&c!==void 0?c:null),g.subscribe()},d=0;d<l.length;d+=1)o();this.pendingSeries=[]},ae.ADD_SERIES_DEBOUNCE)),y(this,"getTimeZone",Y((s,l)=>{if(l!=null){var o=l.getColumnTypeFormatter(s);if(o!=null)return o.dhTimeZone}})),y(this,"getValueTranslator",Y((s,l)=>{var o=this.getTimeZone(s,l);return d=>this.chartUtils.unwrapValue(d,o)})),y(this,"getValueParser",Y((s,l)=>{var o=this.getTimeZone(s,l);return d=>this.chartUtils.wrapValue(d,s,o)})),y(this,"getRangeParser",Y((s,l)=>o=>{var[d,p]=o,c=this.getValueParser(s,l);return d=c(d),p=c(p),[d,p]})),y(this,"getAxisRangeParser",Y((s,l)=>o=>{var d=O.getSourceForAxis(s,o);return d!=null?this.getRangeParser(d.columnType,l):p=>p})),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 O(e),this.figure=t,this.settings=i,this.theme=a,this.data=[];var n={data:{},layout:this.chartUtils.makeDefaultLayout(a)};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(){if(this.figure.charts.length>0){var e=this.figure.charts[0];return e.title}return""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();for(var{charts:e}=this.figure,t=O.getAllAxes(this.figure),r=[],i=0;i<e.length;i+=1)for(var a=e[i],n=0;n<a.series.length;n+=1){var s=a.series[n];r.push(s.name),this.addSeries(s,t,a.showLegend)}for(var l=[...this.seriesDataMap.keys()],o=l.filter(c=>r.indexOf(c)<0),d=0;d<o.length;d+=1){var p=o[d];this.seriesDataMap.delete(p)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e,t,r){var{dh:i}=this,a=O.groupArray(t,"type"),n=this.chartUtils.makeSeriesDataFromSeries(e,a,O.getSeriesVisibility(e.name,this.settings),r,this.theme);if(this.seriesDataMap.set(e.name,n),this.data=[...this.seriesDataMap.values()],e.plotStyle===i.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===i.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=O.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===i.plot.SeriesPlotStyle.PIE?r??void 0:!1,e.oneClick!=null){for(var{oneClick:s}=e,{columns:l}=s,o=0;o<l.length;o+=1)this.filterColumnMap.set(l[o].name,l[o]);this.oneClicks.push(s)}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){w.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(){var{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(){var{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){w.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){w.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){w.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){w.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){var{detail:t}=e,{series:r}=t;w.debug2("handleFigureUpdated",r);for(var i=0;i<r.length;i+=1){var a=r[i];w.debug2("handleFigureUpdated updating series",a.name);for(var{sources:n}=a,s=0;s<n.length;s+=1){var l=n[s],{columnType:o,type:d}=l,p=this.getValueTranslator(o,this.formatter),c=t.getArray(a,d,p);this.setDataArrayForSeries(a,d,c)}this.seriesToProcess.delete(a.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(a)}var{data:g}=this;this.fireUpdate(g)}handleRequestFailed(e){w.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){w.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){w.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){var{detail:t}=e;w.debug("handleFigureSeriesAdded",t),this.pendingSeries.push(t),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,r;super.setTitle(e);var i=(t=(r=(e??"").match(/<br>/g))===null||r===void 0?void 0:r.length)!==null&&t!==void 0?t:0,a=O.DEFAULT_MARGIN.t+i*O.SUBTITLE_LINE_HEIGHT;this.layout.margin?this.layout.margin.t=a:this.layout.margin={t:a},typeof this.layout.title=="string"?this.layout.title=e:(this.layout.title=ve({},this.layout.title),this.layout.title.text=e,this.layout.title.pad=ve({},this.layout.title.pad),this.layout.title.pad.t=O.DEFAULT_TITLE_PADDING.t+i*O.SUBTITLE_LINE_HEIGHT*.5)}getPlotWidth(){var e,t,r,i;return!this.rect||!this.rect.width?0:Math.max(this.rect.width-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.l)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.r)!==null&&r!==void 0?r:0),0)}getPlotHeight(){var e,t,r,i;return!this.rect||!this.rect.height?0:Math.max(this.rect.height-((e=(t=this.layout.margin)===null||t===void 0?void 0:t.t)!==null&&e!==void 0?e:0)-((r=(i=this.layout.margin)===null||i===void 0?void 0:i.b)!==null&&r!==void 0?r:0),0)}updateAxisPositions(){var e=this.getPlotWidth(),t=this.getPlotHeight();this.chartUtils.updateFigureAxes(this.layout,this.figure,r=>this.getAxisRangeParser(r,this.formatter),e,t,this.theme)}updateLayoutFormats(){if(this.formatter){var e=this.chartUtils.getAxisFormats(this.figure,this.formatter);e.forEach((t,r)=>{w.debug("Assigning ".concat(r),this.layout[r],t);var i=this.layout[r];i!=null?Object.assign(i,t):w.debug("Ignoring null layout.".concat(r))})}}setDataArrayForSeries(e,t,r){var{name:i,plotStyle:a}=e,n=this.seriesDataMap.get(i),s=this.chartUtils.getPlotlyProperty(a,t);n&&Se(n,s,r)}cleanSeries(e){var{dh:t}=this,{name:r,plotStyle:i}=e,a=this.seriesDataMap.get(r);if(a!=null){if(i===t.plot.SeriesPlotStyle.HISTOGRAM){var{xLow:n,xHigh:s}=a;if(n&&s&&n.length===s.length){for(var l=[],o=0;o<n.length;o+=1)l.push(s[o]-n[o]);a.width=l}}else if(i===t.plot.SeriesPlotStyle.LINE||i===t.plot.SeriesPlotStyle.ERROR_BAR||i===t.plot.SeriesPlotStyle.BAR){var{x:d,xLow:p,xHigh:c,y:g,yLow:m,yHigh:E}=a;p&&c&&p!==d&&(a.error_x=O.getPlotlyErrorBars(d,p,c)),m&&E&&m!==g&&(a.error_y=O.getPlotlyErrorBars(g,m,E))}else if(i===t.plot.SeriesPlotStyle.TREEMAP){var{ids:v,labels:f}=a;v!==void 0&&f===void 0&&(a.labels=v)}}}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){var t=this;if(this.oneClicks.length===0){w.warn("Trying to set a filter, but no one click!");return}w.debug("setFilter",e);for(var r=function(){var n=t.oneClicks[i],{columns:s}=n,l=new Set([...e.keys(),...t.lastFilter.keys()]);l.forEach(o=>{var d=e.get(o);t.lastFilter.get(o)!==d&&s.find(p=>p.name===o)!=null&&n.setValueForColumn(o,d)})},i=0;i<this.oneClicks.length;i+=1)r();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}}y(ae,"ADD_SERIES_DEBOUNCE",50);const Ee=ae;function ye(u,e,t,r,i,a,n){try{var s=u[a](n),l=s.value}catch(o){t(o);return}s.done?e(l):Promise.resolve(l).then(r,i)}function oe(u){return function(){var e=this,t=arguments;return new Promise(function(r,i){var a=u.apply(e,t);function n(l){ye(a,r,i,n,s,"next",l)}function s(l){ye(a,r,i,n,s,"throw",l)}n(void 0)})}}class le{static makeModelFromSettings(e,t,r){var i=arguments;return oe(function*(){var a=i.length>3&&i[3]!==void 0?i[3]:M,n=yield le.makeFigureFromSettings(e,t,r);return new Ee(e,n,t,a)})()}static makeFigureFromSettings(e,t,r){return oe(function*(){var i=yield r.copy();return i.applyCustomColumns(r.customColumns),i.applyFilter(r.filter),i.applySort(r.sort),e.plot.Figure.create(new O(e).makeFigureSettings(t,i))})()}static makeModel(e,t,r){var i=arguments;return oe(function*(){var a=i.length>3&&i[3]!==void 0?i[3]:M;return new Ee(e,r,t,a)})()}}const nt=le;const Q=ie.module("EmbedChart.App");async function ot(u,e,t){Q.info(`Fetching figure ${t}...`);const r={name:t,type:u.VariableType.FIGURE};return e.getObject(r)}function pt(){const[u,e]=B.useState(),[t,r]=B.useState(),[i,a]=B.useState(!0),n=B.useMemo(()=>new URLSearchParams(window.location.search),[]),s=Le(),l=Ie();B.useEffect(function(){async function p(){try{const c=n.get("name");if(c==null)throw new Error("No name param provided");Q.debug("Loading figure",c,"...");const g=await ot(l,s,c);Q.debug("Creating model...");const m=await nt.makeModel(l,void 0,g);e(m),Q.debug("Figure successfully loaded!")}catch(c){Q.error("Unable to load figure",c),r(`${c}`)}a(!1)}p()},[l,s,n]);const o=u!=null;return j.jsxs("div",{className:"App",children:[o&&j.jsx(it,{model:u}),!o&&j.jsx(we,{isLoaded:o,isLoading:i,errorMessage:t??null}),j.jsx(Me,{})]})}export{pt as default};
2
+ //# sourceMappingURL=App-3d89482d.js.map