@deephaven/code-studio 0.31.5 → 0.31.6

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,4 +1,4 @@
1
- import{A as b,F as v,E as K,C as h,R as de,T as vp,K as J,D as Ht,L as Se,M as Be,B as M,U as Ep,V as fe,W as ra,X as Pn,J as et,I as Re,Y as ph,Z as ht,_ as xa,$ as yp,a0 as Rp,a1 as Ip,a2 as Fp,a3 as pe,G as No,a4 as Hd,a5 as Oa,a6 as Dp,a7 as Np,a8 as gh,a9 as Je,aa as la,H as _p,ab as Zr,Q as fh,S as Aa,ac as Ud,ad as Mp,ae as On,af as kp,ag as xp,ah as Op,ai as Ap,aj as aa,ak as Lp,al as Pp,am as Hp,an as Vd,ao as Up,ap as Vp,aq as Bd,ar as Bp,as as $p,at as Gp,au as Wp,av as zp,aw as yt,ax as Ch,ay as qp,az as Sh,aA as Yp,aB as bh,aC as Kp,aD as Xp,aE as jp,aF as Zp,aG as Qp,aH as Jp,aI as eg,aJ as tg,aK as ng,aL as sg,aM as $d,aN as ig}from"./vendor.7d6152a1.js";import{P as ye,C as Hn,a as og,u as rg,B as V,v as lg,b as ag,c as dg,d as cg,e as Ui,T as je,f as da,g as hg,h as wh,i as La,L as as,j as Qr,k as ts,l as Th,m as Q,r as Ye,M as Te,K as Ie,n as Gd,o as ug,p as mg,q as pg,G as ls,s as le,t as gg,w as sn,x as xs,D as Vi,y as mn,z as ns,A as vh,S as Bi,E as Jr,F as mt,H as ss,I as el,J as Mi,N as fg,O as Cg,Q as Wd,R as Mr,U as zd,V as Eh,W as ko,X as ki,Y as Sg,Z as xo,_ as yh,$ as Rh,a0 as bg,a1 as wg,a2 as He,a3 as Pa,a4 as Jn,a5 as Ha,a6 as kr,a7 as Wn,a8 as Tg,a9 as vg,aa as Eg,ab as yg,ac as Rg,ad as Ua,ae as Ig,af as Os,ag as qd,ah as Sn,ai as Oo,aj as is,ak as Va,al as Ba,am as Ih,an as Fg,ao as tl,ap as Dg,aq as xr,ar as Ng,as as $a,at as Fh,au as ei,av as _g,aw as Mg,ax as kg,ay as xg,az as Og,aA as Ag,aB as nl,aC as Yd,aD as Bl,aE as Lg,aF as Pg,aG as Hg,aH as Dh,aI as sl,aJ as il,aK as Ug,aL as Vg,aM as ol,aN as Nh,aO as Bg,aP as $g,aQ as Gg,aR as Wg,aS as _h,aT as zg,aU as qg,aV as Yg,aW as Kg,aX as Xg,aY as jg,aZ as Zg,a_ as Xe,a$ as Kd,b0 as Mh,b1 as Qg,b2 as Jg,b3 as ef,b4 as tf,b5 as Xd,b6 as Or,b7 as nf,b8 as kh,b9 as sf,ba as of,bb as xh,bc as rf,bd as ca,be as ha,bf as lf,bg as af,bh as df,bi as cf,bj as fn,bk as hf,bl as uf,bm as mf,bn as pf,bo as gf,bp as ff,bq as Cf,br as Sf,bs as jd,bt as bf,bu as wf}from"./index.a3fafc96.js";import{e as os,l as wi,K as cn,a as Zd,b as Ds,_ as Tf,W as vf}from"./monaco.1292e04e.js";import{P as Ar,b as Ef,h as yf,p as Rf,o as If,s as Ff,t as Df,c as $l}from"./plotly.4a640e26.js";import"./helpers.162e09a8.js";function Ga({className:t,isFlipped:e,children:n,"data-testid":s}){const i=a=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[a]},o=b.exports.useRef(null),r=b.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=b.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.exports.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",r);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",r)}},[r]),v("div",{className:K(t,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":s,children:[h("div",{className:"card-flip--back",children:i(0)}),h("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:i(1)})]})}class rl{static isDark(e){const n=document.createElement("div");n.style.display="none",n.style.color=e;const s=getComputedStyle(document.body.appendChild(n)).color,i=s.match(/\d+/g);let o=[];if(i)o=i.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),rl.getBrightness(o)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}function Nf(t,e){return t?t.closest(`.${e}`):null}const _f={getClosestByClassName:Nf};class ds{constructor(){this.pending=[],this.resolved=[]}add(e,n){const s=ye.makeCancelable(e,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(e){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===e){this.pending.splice(n,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let n=0;n<e.length;n+=1)e[n].cancel();this.pending=[],this.resolved=[]}}function k(t){if(t==null)throw new Error("Value is null or undefined")}class jt{static join(e,n="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${n} ${e[1]}`;const s=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return`${s}, ${n} ${i}`}static toLower(e,n=!0){if(e==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,n,s=!0){return e<n?s?-1:1:e>n?s?1:-1:0}}class Di extends Error{constructor(){super(...arguments),this.isInvalid=!0}}class Oh extends b.exports.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=de.createRef(),this.openMenu=de.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(!Hn.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const n=Hn.getMenuItems(e.contextActions),s=this.container.current.getBoundingClientRect(),i=e.clientY-s.top,o=e.clientX-s.left;if(n.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(o,i),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});r?.dispatchEvent(l)});return}return}e.preventDefault(),this.setState({actions:n,top:i,left:o})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":n}=this.props,{actions:s,top:i,left:o}=this.state;return s&&(e=h(og,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:K("context-menu-root",{active:s}),ref:this.container,children:e})}}function ll(t){const e=b.exports.useRef();return b.exports.useEffect(function(){e.current=t}),e.current}function al({copy:t,kind:e="ghost",tooltip:n="Copy",className:s,"data-testid":i,children:o}){const[r,l]=rg();return h(V,{kind:e,className:s,"data-testid":i,icon:r?lg:ag,tooltip:r?"Copied":n,onClick:()=>{l(typeof t=="function"?t():t)},children:o})}class Yt{static reorder(e,n,s,i){const o=e===s?Yt.adjustDestinationIndex(i,n):i,r=Yt.removeItems(e,n);return s.splice(o,0,...r),r}static removeItems(e,n){const s=[],i=n.map((o,r)=>({range:o,index:r})).sort((o,r)=>r.range[0]-o.range[0]);for(let o=0;o<i.length;o+=1){const{range:r,index:l}=i[o],[a,d]=r;s[l]=e.splice(a,d-a+1)}return vp(s)}static adjustDestinationIndex(e,n){let s=e;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>e)break;s-=Math.min(r,e-1)-o+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}function Ah({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r}){return h("button",{type:"button",className:K("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})})}function Qd(t){return t.isOn!==void 0}function Mf({item:t,onSelect:e=()=>{},"data-testid":n}){const{icon:s,subtitle:i,title:o}=t,r=b.exports.useMemo(()=>Qd(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return v("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(J,{icon:s})}),h("div",{className:"title",children:o}),i!==void 0&&h("div",{className:"shortcut",children:i}),h("div",{className:"accessory","data-testid":n,children:Qd(t)?h(Ah,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(J,{icon:dg})})]})}function Lh({items:t,onSelect:e=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:t.map((s,i)=>h("li",{children:h(Mf,{item:s,onSelect:()=>{e(i)}})},s.title))})})}function Jd({children:t,onBack:e,onClose:n,title:s,"data-testid":i}){return v("div",{className:"navigation-page","data-testid":i,children:[v("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:e!==void 0&&h(V,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:cg,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(V,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:Ui,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:t})]})}function kf({children:t,"data-testid":e}){const n=b.exports.useMemo(()=>de.Children.toArray(t),[t]),s=ll(n),[i,o]=b.exports.useState(n[n.length-1]),[r,l]=b.exports.useState(null),[a,d]=b.exports.useState(null);b.exports.useEffect(function(){if(s===void 0||n===s)return;const p=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&p!==r?l(p):p!==a&&p!==i&&o(p):n.length>s.length?l(p):n.length<s.length&&(o(p),d(s[s.length-1]))},[n,s,r,a,i]);const c=b.exports.useCallback(()=>{o(r),l(null)},[r]),u=b.exports.useCallback(()=>{d(null)},[]);return v("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":e,children:i}),h(Ht,{in:a!=null,timeout:je.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(Se,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(Ht,{in:r!=null,timeout:je.transitionMidMs,classNames:"slide-left",onEntered:c,children:h(Se,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function xf({children:t,disabled:e,value:n,"data-testid":s}){return h("option",{value:n,disabled:e,"data-testid":s,children:t})}function dl(t){const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=b.exports.useState(s??Be());return h(Se,{children:de.Children.map(e,a=>a?de.cloneElement(a,{name:l,onChange:a.props.onChange??i,checked:o===a.props.value,disabled:a.props.disabled??n,"data-testid":r}):null)})}function Of({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a}){const d=b.exports.useCallback(c=>{n(c.target.value)},[n]);return h("select",{className:K("custom-select",s),onBlur:e,onChange:d,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})}const{dh:I}=globalThis,cl=M.exports.shape({name:M.exports.string.isRequired,type:M.exports.string.isRequired,description:M.exports.string,constituentType:M.exports.string}),Ph=M.exports.shape({not:M.exports.func.isRequired,and:M.exports.func.isRequired,or:M.exports.func.isRequired}),Af=M.exports.shape({asc:M.exports.func.isRequired,desc:M.exports.func.isRequired,abs:M.exports.func.isRequired,column:cl.isRequired,direction:M.exports.string.isRequired,isAbs:M.exports.bool.isRequired}),Lf=M.exports.shape({columns:M.exports.arrayOf(cl).isRequired,customColumns:M.exports.arrayOf(M.exports.string).isRequired,filter:M.exports.arrayOf(Ph),addEventListener:M.exports.func.isRequired,removeEventListener:M.exports.func.isRequired,size:M.exports.number.isRequired,sort:M.exports.arrayOf(M.exports.any),copy:M.exports.func.isRequired,applyFilter:M.exports.func.isRequired,applySort:M.exports.func.isRequired,applyCustomColumns:M.exports.func.isRequired,description:M.exports.string}),Pf=M.exports.shape({columns:M.exports.arrayOf(cl),filter:M.exports.arrayOf(M.exports.any),isExpanded:M.exports.func.isRequired,saveExpandedState:M.exports.func.isRequired,addEventListener:M.exports.func.isRequired,removeEventListener:M.exports.func.isRequired,size:M.exports.number.isRequired,sort:M.exports.arrayOf(M.exports.any),applyFilter:M.exports.func.isRequired,applySort:M.exports.func.isRequired}),Er=M.exports.shape({name:M.exports.string.isRequired,type:M.exports.string.isRequired}),Hf=M.exports.shape({created:M.exports.arrayOf(Er).isRequired,updated:M.exports.arrayOf(Er).isRequired,removed:M.exports.arrayOf(Er).isRequired}),Uf=M.exports.shape({groupingColumns:M.exports.arrayOf(M.exports.string),aggregations:M.exports.shape({}),includeConstituents:M.exports.bool,includeOriginalColumns:M.exports.bool,includeDescriptions:M.exports.bool}),Vf=M.exports.shape({addEventListener:M.exports.func.isRequired,removeEventListener:M.exports.func.isRequired,onLogMessage:M.exports.func,getTable:M.exports.func.isRequired,runCode:M.exports.func.isRequired});Object.freeze({Column:cl,FilterCondition:Ph,IdeSession:Vf,RollupConfig:Uf,Sort:Af,Table:Lf,TreeTable:Pf,VariableChanges:Hf,VariableDefinition:Er});function Hh({type:t}){switch(t){case I.VariableType.TABLE:case I.VariableType.TABLEMAP:case I.VariableType.TREETABLE:case I.VariableType.HIERARCHICALTABLE:return h(J,{icon:La});case I.VariableType.FIGURE:return h(J,{icon:wh});case I.VariableType.PANDAS:return h(J,{icon:hg});default:return h(J,{icon:da})}}class hl extends b.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&os.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:e})})}}class Uh{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class xi{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:Ep.parse(e).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const n=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0"),i=`${e.getSeconds()}`.padStart(2,"0"),o=`${e.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(e){return e===I.VariableType.TABLE||e===I.VariableType.TREETABLE||e===I.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===I.VariableType.FIGURE||e===I.VariableType.OTHERWIDGET||e===I.VariableType.PANDAS}static isOpenableType(e){return xi.isTableType(e)||xi.isWidgetType(e)}static isFigureType(e){return e===I.VariableType.FIGURE}static isPandas(e){return e===I.VariableType.PANDAS}}function Vh({children:t}){return v("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:t})]})}Vh.propTypes={children:M.exports.node.isRequired};class Bh extends b.exports.Component{constructor(e){super(e),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:K("console-history-result-in-progress",{disabled:e}),children:v("span",{className:"badge",children:[h(as,{}),"\xA0Running... ",Qr.formatElapsedTime(s),"\xA0",h(V,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Ui,tooltip:"Cancel",onClick:n,disabled:e})]})})}}Bh.defaultProps={disabled:!1};const ua=class extends b.exports.PureComponent{constructor(t){super(t),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(t){switch(t.key){case"Enter":case" ":this.handleToggleError(),t.stopPropagation(),t.preventDefault();break}}handleMouseDown(t){this.mouseX=t.clientX,this.mouseY=t.clientY,this.isClicking=!0}handleMouseMove(t){this.mouseX!=null&&this.mouseY!=null?(Math.abs(t.clientX-this.mouseX)>=ua.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=ua.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(t){this.isClicking&&!t.shiftKey&&!t.metaKey&&!t.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(t=>({isExpanded:!t.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:t,isTriggerHovered:e}=this.state,{message:n}=this.props;k(n);const s=n.indexOf(`
1
+ import{A as b,F as v,E as K,C as h,R as de,T as vp,K as J,D as Ht,L as Se,M as Be,B as M,U as Ep,V as fe,W as ra,X as Pn,J as et,I as Re,Y as ph,Z as ht,_ as xa,$ as yp,a0 as Rp,a1 as Ip,a2 as Fp,a3 as pe,G as No,a4 as Hd,a5 as Oa,a6 as Dp,a7 as Np,a8 as gh,a9 as Je,aa as la,H as _p,ab as Zr,Q as fh,S as Aa,ac as Ud,ad as Mp,ae as On,af as kp,ag as xp,ah as Op,ai as Ap,aj as aa,ak as Lp,al as Pp,am as Hp,an as Vd,ao as Up,ap as Vp,aq as Bd,ar as Bp,as as $p,at as Gp,au as Wp,av as zp,aw as yt,ax as Ch,ay as qp,az as Sh,aA as Yp,aB as bh,aC as Kp,aD as Xp,aE as jp,aF as Zp,aG as Qp,aH as Jp,aI as eg,aJ as tg,aK as ng,aL as sg,aM as $d,aN as ig}from"./vendor.7d6152a1.js";import{P as ye,C as Hn,a as og,u as rg,B as V,v as lg,b as ag,c as dg,d as cg,e as Ui,T as je,f as da,g as hg,h as wh,i as La,L as as,j as Qr,k as ts,l as Th,m as Q,r as Ye,M as Te,K as Ie,n as Gd,o as ug,p as mg,q as pg,G as ls,s as le,t as gg,w as sn,x as xs,D as Vi,y as mn,z as ns,A as vh,S as Bi,E as Jr,F as mt,H as ss,I as el,J as Mi,N as fg,O as Cg,Q as Wd,R as Mr,U as zd,V as Eh,W as ko,X as ki,Y as Sg,Z as xo,_ as yh,$ as Rh,a0 as bg,a1 as wg,a2 as He,a3 as Pa,a4 as Jn,a5 as Ha,a6 as kr,a7 as Wn,a8 as Tg,a9 as vg,aa as Eg,ab as yg,ac as Rg,ad as Ua,ae as Ig,af as Os,ag as qd,ah as Sn,ai as Oo,aj as is,ak as Va,al as Ba,am as Ih,an as Fg,ao as tl,ap as Dg,aq as xr,ar as Ng,as as $a,at as Fh,au as ei,av as _g,aw as Mg,ax as kg,ay as xg,az as Og,aA as Ag,aB as nl,aC as Yd,aD as Bl,aE as Lg,aF as Pg,aG as Hg,aH as Dh,aI as sl,aJ as il,aK as Ug,aL as Vg,aM as ol,aN as Nh,aO as Bg,aP as $g,aQ as Gg,aR as Wg,aS as _h,aT as zg,aU as qg,aV as Yg,aW as Kg,aX as Xg,aY as jg,aZ as Zg,a_ as Xe,a$ as Kd,b0 as Mh,b1 as Qg,b2 as Jg,b3 as ef,b4 as tf,b5 as Xd,b6 as Or,b7 as nf,b8 as kh,b9 as sf,ba as of,bb as xh,bc as rf,bd as ca,be as ha,bf as lf,bg as af,bh as df,bi as cf,bj as fn,bk as hf,bl as uf,bm as mf,bn as pf,bo as gf,bp as ff,bq as Cf,br as Sf,bs as jd,bt as bf,bu as wf}from"./index.1b2f8a72.js";import{e as os,l as wi,K as cn,a as Zd,b as Ds,_ as Tf,W as vf}from"./monaco.1292e04e.js";import{P as Ar,b as Ef,h as yf,p as Rf,o as If,s as Ff,t as Df,c as $l}from"./plotly.4a640e26.js";import"./helpers.162e09a8.js";function Ga({className:t,isFlipped:e,children:n,"data-testid":s}){const i=a=>{if(n.length!==2)throw new Error("CardFlip requires 2 children to function");return n[a]},o=b.exports.useRef(null),r=b.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),l=b.exports.useCallback(a=>{a.target===a.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return b.exports.useEffect(function(){if(!o.current)throw Error("ref undefined");o.current.addEventListener("transitionstart",r);const d=o.current;return function(){if(d!=null)return d.removeEventListener("transitionstart",r)}},[r]),v("div",{className:K(t,{"card-flip--show-front":e,"card-flip--show-back":!e}),"data-testid":s,children:[h("div",{className:"card-flip--back",children:i(0)}),h("div",{ref:o,className:"card-flip--front",onTransitionEnd:l,children:i(1)})]})}class rl{static isDark(e){const n=document.createElement("div");n.style.display="none",n.style.color=e;const s=getComputedStyle(document.body.appendChild(n)).color,i=s.match(/\d+/g);let o=[];if(i)o=i.map(l=>parseInt(l,10));else throw new Error(`Invalid color received. Got ${s}`);return document.body.removeChild(n),rl.getBrightness(o)<125}static getBrightness(e){return Math.round((e[0]*299+e[1]*587+e[2]*114)/1e3)}}function Nf(t,e){return t?t.closest(`.${e}`):null}const _f={getClosestByClassName:Nf};class ds{constructor(){this.pending=[],this.resolved=[]}add(e,n){const s=ye.makeCancelable(e,n);return this.pending.push(s),s.then(()=>{this.resolve(s)},()=>{this.resolve(s)}),s}remove(e){for(let n=0;n<this.pending.length;n+=1)if(this.pending[n]===e){this.pending.splice(n,1);return}}resolve(e){this.remove(e),this.resolved.push(e)}cancel(){const e=[...this.pending,...this.resolved];for(let n=0;n<e.length;n+=1)e[n].cancel();this.pending=[],this.resolved=[]}}function k(t){if(t==null)throw new Error("Value is null or undefined")}class jt{static join(e,n="and"){if(e==null||e.length===0)return"";if(e.length===1)return e[0];if(e.length===2)return`${e[0]} ${n} ${e[1]}`;const s=e.slice(0,e.length-1).join(", "),i=e[e.length-1];return`${s}, ${n} ${i}`}static toLower(e,n=!0){if(e==null){if(n)return"";throw new Error("Null string passed in to TextUtils.toLower")}return e.toLowerCase()}static sort(e,n,s=!0){return e<n?s?-1:1:e>n?s?1:-1:0}}class Di extends Error{constructor(){super(...arguments),this.isInvalid=!0}}class Oh extends b.exports.Component{constructor(e){super(e),this.handleMenuClose=this.handleMenuClose.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.container=de.createRef(),this.openMenu=de.createRef(),this.state={actions:null,left:0,top:0}}componentDidMount(){this.container.current?.parentElement&&this.container.current.parentElement.addEventListener("contextmenu",this.handleContextMenu)}componentWillUnmount(){this.container.current?.parentElement&&this.container.current.parentElement.removeEventListener("contextmenu",this.handleContextMenu)}handleContextMenu(e){if(!Hn.isContextActionEvent(e)||!this.container.current||e.metaKey||e.ctrlKey)return;const n=Hn.getMenuItems(e.contextActions),s=this.container.current.getBoundingClientRect(),i=e.clientY-s.top,o=e.clientX-s.left;if(n.length===0){if(e.target===this.container.current){e.preventDefault(),this.setState({actions:null},()=>{const r=document.elementFromPoint(o,i),l=new MouseEvent("contextmenu",{clientX:e.clientX,clientY:e.clientY,bubbles:!0,cancelable:!0});r?.dispatchEvent(l)});return}return}e.preventDefault(),this.setState({actions:n,top:i,left:o})}handleMenuClose(e){e===this.openMenu.current&&this.setState({actions:null})}render(){let e=null;const{"data-testid":n}=this.props,{actions:s,top:i,left:o}=this.state;return s&&(e=h(og,{ref:this.openMenu,actions:s,onMenuClosed:this.handleMenuClose,top:i,left:o,updatePosition:(r,l)=>{this.setState({top:r,left:l})},"data-testid":n})),h("div",{className:K("context-menu-root",{active:s}),ref:this.container,children:e})}}function ll(t){const e=b.exports.useRef();return b.exports.useEffect(function(){e.current=t}),e.current}function al({copy:t,kind:e="ghost",tooltip:n="Copy",className:s,"data-testid":i,children:o}){const[r,l]=rg();return h(V,{kind:e,className:s,"data-testid":i,icon:r?lg:ag,tooltip:r?"Copied":n,onClick:()=>{l(typeof t=="function"?t():t)},children:o})}class Yt{static reorder(e,n,s,i){const o=e===s?Yt.adjustDestinationIndex(i,n):i,r=Yt.removeItems(e,n);return s.splice(o,0,...r),r}static removeItems(e,n){const s=[],i=n.map((o,r)=>({range:o,index:r})).sort((o,r)=>r.range[0]-o.range[0]);for(let o=0;o<i.length;o+=1){const{range:r,index:l}=i[o],[a,d]=r;s[l]=e.splice(a,d-a+1)}return vp(s)}static adjustDestinationIndex(e,n){let s=e;for(let i=0;i<n.length;i+=1){const[o,r]=n[i];if(o>e)break;s-=Math.min(r,e-1)-o+1}return s}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}function Ah({on:t,id:e,className:n,isInvalid:s,disabled:i=!1,onClick:o,"data-testid":r}){return h("button",{type:"button",className:K("btn","btn-switch",n,{active:t},{"is-invalid":s}),id:e,onClick:o,disabled:i,"data-testid":r,children:h("div",{className:"handle"})})}function Qd(t){return t.isOn!==void 0}function Mf({item:t,onSelect:e=()=>{},"data-testid":n}){const{icon:s,subtitle:i,title:o}=t,r=b.exports.useMemo(()=>Qd(t)?()=>{t.onChange(!t.isOn)}:e,[t,e]);return v("div",{className:"btn btn-navigation-menu-item","data-testid":`menu-item-${o}`,onClick:r,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&r()},tabIndex:0,role:"menuitem",children:[s!==void 0&&h("div",{className:"icon",children:h(J,{icon:s})}),h("div",{className:"title",children:o}),i!==void 0&&h("div",{className:"shortcut",children:i}),h("div",{className:"accessory","data-testid":n,children:Qd(t)?h(Ah,{on:t.isOn,onClick:l=>{l.stopPropagation(),r()}}):h(J,{icon:dg})})]})}function Lh({items:t,onSelect:e=()=>{},"data-testid":n}){return h("div",{className:"navigation-menu-view","data-testid":n,children:h("ul",{className:"navigation-menu-list",children:t.map((s,i)=>h("li",{children:h(Mf,{item:s,onSelect:()=>{e(i)}})},s.title))})})}function Jd({children:t,onBack:e,onClose:n,title:s,"data-testid":i}){return v("div",{className:"navigation-page","data-testid":i,children:[v("div",{className:"navigation-title-bar",children:[h("div",{className:"navigation-left-buttons",children:e!==void 0&&h(V,{kind:"ghost",className:"btn-back","data-testid":"btn-page-back",onClick:e,icon:cg,children:"Back"})}),h("div",{className:"navigation-title",children:s}),h("div",{className:"navigation-right-buttons",children:n!==void 0&&h(V,{kind:"ghost",className:"btn-close px-2 m-1","data-testid":"btn-page-close",onClick:n,icon:Ui,tooltip:"Close"})})]}),h("div",{className:"navigation-content",children:t})]})}function kf({children:t,"data-testid":e}){const n=b.exports.useMemo(()=>de.Children.toArray(t),[t]),s=ll(n),[i,o]=b.exports.useState(n[n.length-1]),[r,l]=b.exports.useState(null),[a,d]=b.exports.useState(null);b.exports.useEffect(function(){if(s===void 0||n===s)return;const p=n[n.length-1];n.length===s.length||s.length===0||r!==null||a!==null?r!==null&&p!==r?l(p):p!==a&&p!==i&&o(p):n.length>s.length?l(p):n.length<s.length&&(o(p),d(s[s.length-1]))},[n,s,r,a,i]);const c=b.exports.useCallback(()=>{o(r),l(null)},[r]),u=b.exports.useCallback(()=>{d(null)},[]);return v("div",{className:"navigation-stack",children:[h("div",{className:"main-view","data-testid":e,children:i}),h(Ht,{in:a!=null,timeout:je.transitionMidMs,classNames:"slide-right",onEntered:u,children:h(Se,{children:a!=null&&h("div",{className:"popping-view",children:a})})}),h(Ht,{in:r!=null,timeout:je.transitionMidMs,classNames:"slide-left",onEntered:c,children:h(Se,{children:r!=null&&h("div",{className:"pushing-view",children:r})})})]})}function xf({children:t,disabled:e,value:n,"data-testid":s}){return h("option",{value:n,disabled:e,"data-testid":s,children:t})}function dl(t){const{children:e,disabled:n=!1,name:s,onChange:i,value:o="","data-testid":r}=t,[l]=b.exports.useState(s??Be());return h(Se,{children:de.Children.map(e,a=>a?de.cloneElement(a,{name:l,onChange:a.props.onChange??i,checked:o===a.props.value,disabled:a.props.disabled??n,"data-testid":r}):null)})}function Of({children:t,onBlur:e,onChange:n,className:s,defaultValue:i,name:o,value:r,disabled:l,"data-testid":a}){const d=b.exports.useCallback(c=>{n(c.target.value)},[n]);return h("select",{className:K("custom-select",s),onBlur:e,onChange:d,defaultValue:i,value:r,name:o,disabled:l,"data-testid":a,children:t})}const{dh:I}=globalThis,cl=M.exports.shape({name:M.exports.string.isRequired,type:M.exports.string.isRequired,description:M.exports.string,constituentType:M.exports.string}),Ph=M.exports.shape({not:M.exports.func.isRequired,and:M.exports.func.isRequired,or:M.exports.func.isRequired}),Af=M.exports.shape({asc:M.exports.func.isRequired,desc:M.exports.func.isRequired,abs:M.exports.func.isRequired,column:cl.isRequired,direction:M.exports.string.isRequired,isAbs:M.exports.bool.isRequired}),Lf=M.exports.shape({columns:M.exports.arrayOf(cl).isRequired,customColumns:M.exports.arrayOf(M.exports.string).isRequired,filter:M.exports.arrayOf(Ph),addEventListener:M.exports.func.isRequired,removeEventListener:M.exports.func.isRequired,size:M.exports.number.isRequired,sort:M.exports.arrayOf(M.exports.any),copy:M.exports.func.isRequired,applyFilter:M.exports.func.isRequired,applySort:M.exports.func.isRequired,applyCustomColumns:M.exports.func.isRequired,description:M.exports.string}),Pf=M.exports.shape({columns:M.exports.arrayOf(cl),filter:M.exports.arrayOf(M.exports.any),isExpanded:M.exports.func.isRequired,saveExpandedState:M.exports.func.isRequired,addEventListener:M.exports.func.isRequired,removeEventListener:M.exports.func.isRequired,size:M.exports.number.isRequired,sort:M.exports.arrayOf(M.exports.any),applyFilter:M.exports.func.isRequired,applySort:M.exports.func.isRequired}),Er=M.exports.shape({name:M.exports.string.isRequired,type:M.exports.string.isRequired}),Hf=M.exports.shape({created:M.exports.arrayOf(Er).isRequired,updated:M.exports.arrayOf(Er).isRequired,removed:M.exports.arrayOf(Er).isRequired}),Uf=M.exports.shape({groupingColumns:M.exports.arrayOf(M.exports.string),aggregations:M.exports.shape({}),includeConstituents:M.exports.bool,includeOriginalColumns:M.exports.bool,includeDescriptions:M.exports.bool}),Vf=M.exports.shape({addEventListener:M.exports.func.isRequired,removeEventListener:M.exports.func.isRequired,onLogMessage:M.exports.func,getTable:M.exports.func.isRequired,runCode:M.exports.func.isRequired});Object.freeze({Column:cl,FilterCondition:Ph,IdeSession:Vf,RollupConfig:Uf,Sort:Af,Table:Lf,TreeTable:Pf,VariableChanges:Hf,VariableDefinition:Er});function Hh({type:t}){switch(t){case I.VariableType.TABLE:case I.VariableType.TABLEMAP:case I.VariableType.TREETABLE:case I.VariableType.HIERARCHICALTABLE:return h(J,{icon:La});case I.VariableType.FIGURE:return h(J,{icon:wh});case I.VariableType.PANDAS:return h(J,{icon:hg});default:return h(J,{icon:da})}}class hl extends b.exports.Component{constructor(e){super(e),this.container=null}componentDidMount(){this.colorize()}colorize(){const{children:e}=this.props;this.container&&e!=null&&os.colorizeElement(this.container,{theme:"dh-dark"})}render(){const{children:e,language:n}=this.props;return h("div",{children:h("div",{"data-lang":n,ref:s=>{this.container=s},style:{pointerEvents:"none"},children:e})})}}class Uh{static get LANGUAGE_MAP(){return new Map([["python","Python"],["groovy","Groovy"],["scala","Scala"]])}}class xi{static hasComment(e){return e.comment!==void 0}static hasPattern(e){return e.pattern!==void 0}static hasOp(e){return e.op!==void 0}static parseArguments(e){return e==null||!(typeof e=="string"||e instanceof String)?[]:Ep.parse(e).filter(n=>!this.hasComment(n)).map(n=>this.hasPattern(n)?n.pattern:this.hasOp(n)?n.op:`${n}`)}static formatTimestamp(e){if(e==null||!(e instanceof Date))return null;const n=`${e.getHours()}`.padStart(2,"0"),s=`${e.getMinutes()}`.padStart(2,"0"),i=`${e.getSeconds()}`.padStart(2,"0"),o=`${e.getMilliseconds()}`.padStart(3,"0");return`${n}:${s}:${i}.${o}`}static isTableType(e){return e===I.VariableType.TABLE||e===I.VariableType.TREETABLE||e===I.VariableType.HIERARCHICALTABLE}static isWidgetType(e){return e===I.VariableType.FIGURE||e===I.VariableType.OTHERWIDGET||e===I.VariableType.PANDAS}static isOpenableType(e){return xi.isTableType(e)||xi.isWidgetType(e)}static isFigureType(e){return e===I.VariableType.FIGURE}static isPandas(e){return e===I.VariableType.PANDAS}}function Vh({children:t}){return v("div",{className:"console-history-item-result",children:[h("div",{className:"console-history-gutter",children:"-"}),h("div",{className:"console-history-content",children:t})]})}Vh.propTypes={children:M.exports.node.isRequired};class Bh extends b.exports.Component{constructor(e){super(e),this.updateElapsed=this.updateElapsed.bind(this),this.startTime=Date.now(),this.state={elapsed:0}}componentDidMount(){this.timer=setInterval(this.updateElapsed,1e3)}componentWillUnmount(){this.timer&&clearInterval(this.timer),this.timer=void 0}updateElapsed(){this.setState({elapsed:Math.round((Date.now()-this.startTime)/1e3)})}render(){const{disabled:e,onCancelClick:n}=this.props,{elapsed:s}=this.state;return h("div",{className:K("console-history-result-in-progress",{disabled:e}),children:v("span",{className:"badge",children:[h(as,{}),"\xA0Running... ",Qr.formatElapsedTime(s),"\xA0",h(V,{className:"console-history-result-in-progress-cancel",kind:"ghost",icon:Ui,tooltip:"Cancel",onClick:n,disabled:e})]})})}}Bh.defaultProps={disabled:!1};const ua=class extends b.exports.PureComponent{constructor(t){super(t),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleToggleError=this.handleToggleError.bind(this),this.handleMouseEnter=this.handleMouseEnter.bind(this),this.handleMouseLeave=this.handleMouseLeave.bind(this),this.mouseX=null,this.mouseY=null,this.isClicking=!1,this.state={isExpanded:!1,isTriggerHovered:!1}}handleKeyPress(t){switch(t.key){case"Enter":case" ":this.handleToggleError(),t.stopPropagation(),t.preventDefault();break}}handleMouseDown(t){this.mouseX=t.clientX,this.mouseY=t.clientY,this.isClicking=!0}handleMouseMove(t){this.mouseX!=null&&this.mouseY!=null?(Math.abs(t.clientX-this.mouseX)>=ua.mouseDragThreshold||Math.abs(t.clientY-this.mouseY)>=ua.mouseDragThreshold)&&(this.isClicking=!1):this.isClicking&&(this.isClicking=!1)}handleMouseUp(t){this.isClicking&&!t.shiftKey&&!t.metaKey&&!t.altKey&&this.handleToggleError(),this.mouseX=null,this.mouseY=null,this.isClicking=!1}handleToggleError(){this.setState(t=>({isExpanded:!t.isExpanded}))}handleMouseEnter(){this.setState({isTriggerHovered:!0})}handleMouseLeave(){this.setState({isTriggerHovered:!1})}render(){const{isExpanded:t,isTriggerHovered:e}=this.state,{message:n}=this.props;k(n);const s=n.indexOf(`
2
2
  `),i=s>-1;let o=n;i&&(o=n.slice(0,s));const r=n.slice(s),l=e?"error-btn-link error-btn-link--active":"error-btn-link";return v("div",{className:K("error-message",{expanded:t}),children:[i&&v(Se,{children:[h("div",{className:"error-gutter",children:h("button",{type:"button",onClick:this.handleToggleError,className:l,tabIndex:-1,children:h(J,{icon:t?ts:Th,transform:"left-3"})})}),v("div",{className:"error-content",children:[h("div",{className:"console-error-text-trigger",role:"button",tabIndex:0,onKeyPress:this.handleKeyPress,onMouseDown:this.handleMouseDown,onMouseMove:this.handleMouseMove,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,onMouseUp:this.handleMouseUp,children:o}),t?r:""]})]}),!i&&h("div",{className:"error-content",children:h("div",{className:"console-error-text",children:o})})]},"error")}};let Wa=ua;Wa.defaultProps={message:""};Wa.mouseDragThreshold=5;const ec=Q.module("ConsoleHistoryItem");class $h extends b.exports.PureComponent{constructor(e){super(e),this.handleCancelClick=this.handleCancelClick.bind(this),this.handleObjectClick=this.handleObjectClick.bind(this)}handleObjectClick(e){ec.debug("handleObjectClick",e);const{openObject:n}=this.props;n(e)}handleCancelClick(){const{item:e}=this.props;e!=null&&e.cancelResult&&(ec.debug(`Cancelling command: ${e.command}`),e.cancelResult())}render(){const{disabled:e,item:n,language:s}=this.props,{disabledObjects:i,result:o}=n;let r=null;n.command!=null&&n.command!==""&&(r=v("div",{className:"console-history-item-command",children:[h("div",{className:"console-history-gutter",children:">"}),h("div",{className:"console-history-content",children:h(hl,{language:s,children:n.command})})]}));const l=[];let a=!1;if(o){const{error:c,message:u,changes:m}=o;if(m){const{created:p,updated:g}=m;[...p,...g].forEach(f=>{a=!0;const{title:C}=f,S=`${C}`,w=e===void 0||e||(i??[]).indexOf(S)>=0,T=h(V,{kind:"primary",onClick:()=>this.handleObjectClick(f),className:"btn-console-object",disabled:w,icon:h(Hh,{type:f.type}),children:C},S);l.push(T)})}if(c!=null&&n.command==null){let p=`${c.message??c}`;p||(p=c);const g=h(Wa,{message:p},"result-error");l.push(g)}if(u!==void 0&&u!==""){const p=h("div",{className:"log-message",children:u},"log-message");l.push(p)}}else{a=!0;const c=h(Bh,{onCancelClick:this.handleCancelClick,disabled:e},"in_progress");l.push(c)}let d=null;return l.length>0&&(d=h(Vh,{children:l})),v("div",{className:K("console-command-result",{"console-result-buttons":a}),children:[r,d]})}}$h.defaultProps={disabled:!1};const Gh=class extends b.exports.Component{static itemKey(t,e){return`${t}.${e.command}.${e.result&&e.result.message}.${e.result&&e.result.error}`}render(){const{disabled:t,items:e,language:n,openObject:s}=this.props,i=[];for(let o=0;o<e.length;o+=1){const r=e[o],l=h($h,{disabled:t,item:r,openObject:s,language:n},Gh.itemKey(o,r));i.push(l)}return h("div",{className:"container-fluid console-history",children:i})}};let Wh=Gh;Wh.defaultProps={disabled:!1};const Bf={name:"Console",CLEAR:Ye.createAndAdd({id:"CONSOLE.CLEAR",name:"Clear",shortcut:[Te.CTRL,Ie.L],macShortcut:[Te.CTRL,Ie.C]}),FOCUS_HISTORY:Ye.createAndAdd({id:"CONSOLE.FOCUS_HISTORY",name:"Focus History",shortcut:[Te.CTRL,Ie.H],macShortcut:[Te.CTRL,Te.OPTION,Ie.H]})},$f={name:"Command History",FOCUS_HISTORY:Ye.createAndAdd({id:"COMMAND_HISTORY.FOCUS_HISTORY",name:"Focus History Search",shortcut:[Te.CTRL,Ie.H],macShortcut:[Te.CTRL,Te.OPTION,Ie.H]}),SEND_TO_CONSOLE:Ye.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_CONSOLE",name:"Send to Console",shortcut:[Ie.ENTER],macShortcut:[Ie.ENTER]}),SEND_TO_NOTEBOOK:Ye.createAndAdd({id:"COMMAND_HISTORY.SEND_TO_NOTEBOOK",name:"Send to Notebook",shortcut:[Te.CTRL,Ie.ENTER],macShortcut:[Te.CMD,Ie.ENTER]}),RUN:Ye.createAndAdd({id:"COMMAND_HISTORY.RUN",name:"Run",shortcut:[Te.ALT,Ie.R],macShortcut:[Te.OPTION,Ie.R]})},Gf={name:"Notebook",RUN:Ye.createAndAdd({id:"NOTEBOOK.RUN",name:"Run",shortcut:[Te.ALT,Ie.R],macShortcut:[Te.OPTION,Ie.R]}),RUN_SELECTED:Ye.createAndAdd({id:"NOTEBOOK.RUN_SELECTED",name:"Run Selected",shortcut:[Te.ALT,Te.SHIFT,Ie.R],macShortcut:[Te.OPTION,Te.SHIFT,Ie.R]}),FIND:Ye.createAndAdd({id:"NOTEBOOK.FIND",name:"Find",shortcut:[Te.CTRL,Ie.F],macShortcut:[Te.CMD,Ie.F],isEditable:!1}),MINIMAP:Ye.createAndAdd({id:"NOTEBOOK.MINIMAP",name:"Show Minimap",shortcut:[Te.ALT,Ie.M],macShortcut:[Te.OPTION,Ie.M]}),WORDWRAP:Ye.createAndAdd({id:"NOTEBOOK.WORDWRAP",name:"Word Wrap",shortcut:[Te.ALT,Ie.Z],macShortcut:[Te.OPTION,Ie.Z]})},Pt={CONSOLE:Bf,COMMAND_HISTORY:$f,NOTEBOOK:Gf},wt=Object.freeze({FATAL:"FATAL",STDERR:"STDERR",ERROR:"ERROR",WARN:"WARN",STDOUT:"STDOUT",INFO:"INFO",DEBUG:"DEBUG",TRACE:"TRACE"}),Wf="#2d2a2e",zf="#fcfcfa",qf="#fcd65b",Yf="#b2b1b2",Kf="#9edc6f",Xf="#76d9e4",jf="#f95d84",Zf="#aa9af4",Qf="#f95d84",Jf="#fcfcfa",eC="#7c7b7c",we={"error-foreground":"#f95d84",background:Wf,foreground:zf,"line-height":"19px",string:qf,"string-delim":"#929192",delimiter:Yf,predefined:Kf,keyword:Xf,storage:jf,number:Zf,operator:Qf,identifier:Jf,"namespace-identifier":"#f95d84","identifier-js":"#fcd65b",comment:eC,"input-option-active-border":"#929192","focus-border":"rgba(72, 120, 234, 0.85)","input-background":"#555356","input-foreground":"#f0f0ee","input-border":"#929192","editor-line-number-foreground":"#929192","editor-selection-background":"#676368","editor-line-highlight-bg":"#373438","context-menu-background":"#555356","context-menu-foreground":"#f0f0ee","menu-selection-background":"#4878ea","log-date":"#929192","log-error":"#f95d84","log-info":"#76d9e4","log-stdout":"#f0f0ee","log-warn":"#fcd65b","log-debug":"#aa9af4","log-trace":"#9edc6f","editor-find-match-background":"#3c5595","editor-find-match-highlight-background":"#343e5d","editor-widget-background":"#403e41","input-option-active-background":"#4878ea","input-option-active-foreground":"#f0f0ee","editor-suggest-widget-background":"#403e41","editor-suggest-widget-border":"#5b5a5c","editor-suggest-widget-foreground":"#f0f0ee","editor-suggest-widget-selected-background":"#41475a","editor-suggest-widget-highlightForeground":"#4878ea","list-hover-background":"#555356"},tC="python",nC={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},sC={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","exec","in","raise","continue","finally","is","return","for","try",":","=","isinstance","__debug__"],storage:["class","def","async","lambda"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@storage":"storage","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],["\\*/","comment","@pop"],[/[/*]/,"comment"]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/\s+/,"white"],[/(^#.*$)/,"comment"],[/'''/,"string","@endDocString"],[/"""/,"string","@endDblDocString"]],endDocString:[[/[^']+/,"string"],[/\\'/,"string"],[/'''/,"string","@popall"],[/'/,"string"]],endDblDocString:[[/[^"]+/,"string"],[/\\"/,"string"],[/"""/,"string","@popall"],[/"/,"string"]]}},iC={id:tC,conf:nC,language:sC},oC="groovy",rC={comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},lC={keywords:["and","del","from","not","while","as","elif","global","or","with","assert","else","if","pass","yield","break","except","import","print","println","class","exec","in","raise","continue","finally","is","return","def","for","lambda","try",":","=","isinstance","__debug__"],operators:["+","-","*","**","/","//","%","<<",">>","&","|","^","~","<",">","<=",">=","==","!=","<>","+=","-=","*=","/","//=","%=","&=","|=","^=",">>=","<<=","**="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[=><!~&|+\-*/^%]+/,delimiters:/[;=.@:,`]/,escapes:/\\(?:[abfnrtv\\"'\n\r]|x[0-9A-Fa-f]{2}|[0-7]{3}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|N\{\w+\})/,rawpre:/(?:[rR]|ur|Ur|uR|UR|br|Br|bR|BR)/,strpre:/(?:[buBU])/,tokenizer:{root:[[/@strpre?("""|''')/,{token:"string.delim",bracket:"@open",next:"@mstring.$1"}],[/@strpre?"([^"\\]|\\.)*$/,"string.invalid"],[/@strpre?'([^'\\]|\\.)*$/,"string.invalid"],[/@strpre?(["])/,{token:"string.delim",bracket:"@open",next:"@sstring.$1",nextEmbedded:"deephavenDb"}],[/@strpre?(["'])/,{token:"string.delim",bracket:"@open",next:"@string.$1"}],[/@rawpre("""|''')/,{token:"string.delim",bracket:"@open",next:"@mrawstring.$1"}],[/@rawpre"([^"\\]|\\.)*$/,"string.invalid"],[/@rawpre'([^'\\]|\\.)*$/,"string.invalid"],[/@rawpre(["'])/,{token:"string.delim",bracket:"@open",next:"@rawstring.$1"}],[/__[\w$]*/,"predefined"],[/[a-z_$][\w$]*/,{cases:{"@keywords":"keyword","@default":"identifier"}}],[/[A-Z][\w]*/,{cases:{"~[A-Z0-9_]+":"constructor.identifier","@default":"namespace.identifier"}}],{include:"@whitespace"},[/[{}()[\]]/,"@brackets"],[/@symbols/,{cases:{"@keywords":"keyword","@operators":"operator","@default":""}}],[/\d*\.\d+([eE][-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+[lL]?/,"number.hex"],[/0[bB][0-1]+[lL]?/,"number.binary"],[/(0[oO][0-7]+|0[0-7]+)[lL]?/,"number.octal"],[/(0|[1-9]\d*)[lL]?/,"number"],[":",{token:"keyword",bracket:"@open"}],[/@delimiters/,{cases:{"@keywords":"keyword","@default":"delimiter"}}]],mstring:[{include:"@strcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],sstring:[{include:"@strcontent"},[/["]/,{token:"string.delim",bracket:"@close",next:"@pop",nextEmbedded:"@pop"}],[/./,"string.invalid"]],string:[{include:"@strcontent"},[/[']/,{token:"string.delim",bracket:"@close",next:"@pop"}],[/./,"string.invalid"]],strcontent:[[/[^\\"']+/,"string"],[/\\$/,"string.escape"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"]],mrawstring:[{include:"@rawstrcontent"},[/"""|'''/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/["']/,"string"],[/./,"string.invalid"]],rawstring:[{include:"@rawstrcontent"},[/["']/,{cases:{"$#==$S2":{token:"string.delim",bracket:"@close",next:"@pop"},"@default":{token:"string"}}}],[/./,"string.invalid"]],rawstrcontent:[[/[^\\"']+/,"string"],[/\\["']/,"string"],[/\\u[0-9A-Fa-f]{4}/,"string.escape"],[/\\/,"string"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@doccomment"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],doccomment:[[/[^/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[/*]/,"comment.doc"]]}},aC={id:oC,conf:rC,language:lC},dC="scala",cC={wordPattern:/(unary_[@~!#%^&*()\-=+\\|:<>/?]+)|([a-zA-Z_$][\w$]*?_=)|(`[^`]+`)|([a-zA-Z_$][\w$]*)/g,comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:/^\s*\/\/\s*(?:(?:#?region\b)|(?:<editor-fold\b))/,end:/^\s*\/\/\s*(?:(?:#?endregion\b)|(?:<\/editor-fold>))/}}},hC={keywords:["asInstanceOf","catch","class","classOf","def","do","else","extends","finally","for","foreach","forSome","if","import","isInstanceOf","macro","match","new","object","package","return","throw","trait","try","type","until","val","var","while","with","yield","given","enum","then"],softKeywords:["as","export","extension","end","derives","on"],constants:["true","false","null","this","super"],modifiers:["abstract","final","implicit","lazy","override","private","protected","sealed"],softModifiers:["inline","opaque","open","transparent","using"],name:/(?:[a-z_$][\w$]*|`[^`]+`)/,type:/(?:[A-Z][\w$]*)/,symbols:/[=><!~?:&|+\-*/^\\%@#]+/,digits:/\d+(_+\d+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,escapes:/\\(?:[btnfr\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,fstring_conv:/[bBhHsScCdoxXeEfgGaAt]|[Tn](?:[HIklMSLNpzZsQ]|[BbhAaCYyjmde]|[RTrDFC])/,tokenizer:{root:[[/\braw"""/,{token:"string.quote",bracket:"@open",next:"@rawstringt"}],[/\braw"/,{token:"string.quote",bracket:"@open",next:"@rawstring"}],[/\bs"""/,{token:"string.quote",bracket:"@open",next:"@sstringt"}],[/\bs"/,{token:"string.quote",bracket:"@open",next:"@sstring"}],[/\bf""""/,{token:"string.quote",bracket:"@open",next:"@fstringt"}],[/\bf"/,{token:"string.quote",bracket:"@open",next:"@fstring"}],[/"""/,{token:"string.quote",bracket:"@open",next:"@stringt"}],[/"/,{token:"string.quote",bracket:"@open",next:"@string"}],[/(@digits)[eE]([-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/(@digits)\.(@digits)([eE][-+]?(@digits))?[fFdD]?/,"number.float","@allowMethod"],[/0[xX](@hexdigits)[Ll]?/,"number.hex","@allowMethod"],[/(@digits)[fFdD]/,"number.float","@allowMethod"],[/(@digits)[lL]?/,"number","@allowMethod"],[/\b_\*/,"key"],[/\b(_)\b/,"keyword","@allowMethod"],[/\bimport\b/,"keyword","@import"],[/\b(case)([ \t]+)(class)\b/,["keyword.modifier","white","keyword"]],[/\bcase\b/,"keyword","@case"],[/\bva[lr]\b/,"keyword","@vardef"],[/\b(def)([ \t]+)((?:unary_)?@symbols|@name(?:_=)|@name)/,["keyword","white","identifier"]],[/@name(?=[ \t]*:(?!:))/,"variable"],[/(\.)(@name|@symbols)/,[{token:"operator"},{token:"@rematch",next:"@allowMethod"}]],[/([{(])(\s*)(@name(?=\s*=>))/,["@brackets","white","variable"]],[/@name/,{cases:{"@keywords":"keyword","@softKeywords":"keyword","@modifiers":"keyword.modifier","@softModifiers":"keyword.modifier","@constants":{token:"constant",next:"@allowMethod"},"@default":{token:"identifier",next:"@allowMethod"}}}],[/@type/,"type","@allowMethod"],{include:"@whitespace"},[/@[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*/,"annotation"],[/[{(]/,"@brackets"],[/[})]/,"@brackets","@allowMethod"],[/\[/,"operator.square"],[/](?!\s*(?:va[rl]|def|type)\b)/,"operator.square","@allowMethod"],[/]/,"operator.square"],[/([=-]>|<-|>:|<:|:>|<%)(?=[\s\w()[\]{},."'`])/,"keyword"],[/@symbols/,"operator"],[/[;,.]/,"delimiter"],[/'[a-zA-Z$][\w$]*(?!')/,"attribute.name"],[/'[^\\']'/,"string","@allowMethod"],[/(')(@escapes)(')/,[{token:"string"},{token:"string.escape"},{token:"string",next:"@allowMethod"}]],[/'/,"string.invalid"]],import:[[/;/,"delimiter","@pop"],[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/@name|@type/,"type"],[/[(){}]/,"@brackets"],[/[[\]]/,"operator.square"],[/[.,]/,"delimiter"]],allowMethod:[[/^|$/,"","@pop"],[/[ \t]+/,"white"],[/[\n\r]+/,"white","@pop"],[/\/\*/,"comment","@comment"],[/(?==>[\s\w([{])/,"keyword","@pop"],[/(@name|@symbols)(?=[ \t]*[[({"'`]|[ \t]+(?:[+-]?\.?\d|\w))/,{cases:{"@keywords":{token:"keyword",next:"@pop"},"->|<-|>:|<:|<%":{token:"keyword",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],["","","@pop"]],comment:[[/[^/*]+/,"comment"],[/\/\*/,"comment","@push"],[/\*\//,"comment","@pop"],[/[/*]/,"comment"]],case:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword","@allowMethod"],[/\bif\b|=>/,"keyword","@pop"],[/`[^`]+`/,"identifier","@allowMethod"],[/@name/,"variable","@allowMethod"],[/:::?|\||@(?![a-z_$])/,"keyword"],{include:"@root"}],vardef:[[/\b_\*/,"key"],[/\b(_|true|false|null|this|super)\b/,"keyword"],[/@name/,"variable"],[/:::?|\||@(?![a-z_$])/,"keyword"],[/=|:(?!:)/,"operator","@pop"],[/$/,"white","@pop"],{include:"@root"}],string:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],stringt:[[/[^\\"\n\r]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],fstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],fstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/%%/,"string"],[/(%)([-#+ 0,(])(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","keyword.modifier","number","metatag"]],[/(%)(\d+|\.\d+|\d+\.\d+)(@fstring_conv)/,["metatag","number","metatag"]],[/(%)([-#+ 0,(])(@fstring_conv)/,["metatag","keyword.modifier","metatag"]],[/(%)(@fstring_conv)/,["metatag","metatag"]],[/./,"string"]],sstring:[[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],sstringt:[[/@escapes/,"string.escape"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/\$\$/,"string"],[/(\$)([a-z_]\w*)/,["operator","identifier"]],[/\$\{/,"operator","@interp"],[/./,"string"]],interp:[[/{/,"operator","@push"],[/}/,"operator","@pop"],{include:"@root"}],rawstring:[[/[^"]/,"string"],[/"/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}]],rawstringt:[[/[^"]/,"string"],[/"(?=""")/,"string"],[/"""/,{token:"string.quote",bracket:"@close",switchTo:"@allowMethod"}],[/"/,"string"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]]}},uC={id:dC,conf:cC,language:hC},mC="deephavenDb",pC={comments:{lineComment:"#",blockComment:["'''","'''"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],onEnterRules:[{beforeText:/^\s*(?:def|class|for|if|elif|else|while|try|with|finally|except|async).*?:\s*$/,action:{indentAction:1}}],folding:{offSide:!0,markers:{start:/^\s*#region\b/,end:/^\s*#endregion\b/}}},gC={tokenPostfix:".js",keywords:["boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with"],builtins:["define","require","window","document","undefined"],operators:["=",">","<","!","~","?",":","==","<=",">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%","<<",">>",">>>","+=","-=","*=","/=","&=","|=","^=","%=","<<=",">>=",">>>="],brackets:[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"}],symbols:/[~!@#%\^&*-+=|\\:`<>.?\/]+/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,exponent:/[eE][\-+]?[0-9]+/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/([a-zA-Z_\$][\w\$]*)(\s*)(:?)/,{cases:{"$1@keywords":["keyword","white","delimiter"],$3:["key.identifier","white","delimiter"],"$1@builtins":["predefined.identifier","white","delimiter"],"@default":["identifier","white","delimiter"]}}],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash",bracket:"@open",next:"@regexp"}],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/@symbols/,{cases:{"@operators":"operator","@default":""}}],[/\d+\.\d*(@exponent)?/,"number.float"],[/\.\d+(@exponent)?/,"number.float"],[/\d+@exponent/,"number.float"],[/0[xX][\da-fA-F]+/,"number.hex"],[/0[0-7]+/,"number.octal"],[/\d+/,"number"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string",'@string."'],[/'/,"string","@string.'"]],whitespace:[[/[ \t\r\n]+/,"white"],[/\/\*/,"comment","@comment"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\/\*/,"comment.invalid"],["\\*/","comment","@pop"],[/[\/*]/,"comment"]],string:[[/[^\\"']+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/["']/,{cases:{"$#==$S2":{token:"string",next:"@pop"},"@default":"string"}}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["@brackets.regexp.escape.control","regexp.escape.control","@brackets.regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[{token:"@brackets.regexp.escape.control"},{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["@brackets.regexp.escape.control","regexp.escape.control"]],[/[()]/,"@brackets.regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],["/",{token:"regexp.slash",bracket:"@close"},"@pop"]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"@brackets.regexp.escape.control","@pop"]]}},fC={id:mC,conf:pC,language:gC},CC="log",SC={},bC={tokenizer:{root:[[/ FATAL[\s\S]*/,{token:"error",next:"@error"}],[/ ERROR[\s\S]*/,{token:"error",next:"@error"}],[/ STDERR[\s\S]*/,{token:"error",next:"@error"}],[/ STDOUT.*/,{token:"stdout",next:"@stdout"}],[/ INFO[\s\S]*/,{token:"info",next:"@info"}],[/ WARN.*/,{token:"warn",next:"@warn"}],[/ TRACE[\s\S]*/,{token:"trace",next:"@trace"}],[/ DEBUG[.\s\S]*/,{token:"debug",next:"@debug"}],[/^\d{2}:\d{2}:\d{2}.\d{3}/,"date"]],error:[{include:"@body"}],info:[{include:"@body"}],warn:[{include:"@body"}],stdout:[{include:"@body"}],trace:[{include:"@body"}],debug:[{include:"@body"}],body:[[/^\d{2}:\d{2}:\d{2}.\d{3}/,{token:"date",next:"@pop"}],[/[\s\S]*/,{token:"$S0"}]]}},wC={id:CC,conf:SC,language:bC},Dn=Q.module("MonacoUtils");class lt{static init({getWorker:e}={}){Dn.debug("Initializing Monaco..."),e!==void 0&&lt.registerGetWorker(e);const{registerLanguages:n,removeHashtag:s}=lt,i=[{token:"",foreground:s(we.foreground)},{token:"string",foreground:s(we.string)},{token:"string.delim",foreground:s(we["string-delim"])},{token:"keyword",foreground:s(we.keyword)},{token:"identifier.js",foreground:s(we["identifier-js"])},{token:"delimiter",foreground:s(we.delimiter)},{token:"comment",foreground:s(we.comment)},{token:"number",foreground:s(we.number)},{token:"storage",foreground:s(we.storage)},{token:"identifier",foreground:s(we.identifier)},{token:"namespace.identifier",foreground:s(we["namespace-identifier"])},{token:"operator",foreground:s(we.operator)},{token:"predefined",foreground:s(we.predefined)},{token:"error.log",foreground:we["log-error"].substring(1)},{token:"warn.log",foreground:s(we["log-warn"])},{token:"info.log",foreground:s(we["log-info"])},{token:"stdout.log",foreground:s(we["log-stdout"])},{token:"trace.log",foreground:s(we["log-trace"])},{token:"debug.log",foreground:s(we["log-debug"])},{token:"date.log",foreground:s(we["log-date"])}],o={errorForeground:we["error-foreground"],"inputOption.activeBorder":we["input-option-active-border"],"editor.background":we.background,"editor.foreground":we.foreground,"editor.lineHighlightBackground":we["editor-line-highlight-bg"],"editorLineNumber.foreground":we["editor-line-number-foreground"],"editor.selectionBackground":we["editor-selection-background"],"editor.findMatchBackground":we["editor-find-match-background"],"editor.findMatchHighlightBackground":we["editor-find-match-highlight-background"],"editorSuggestWidget.background":we["editor-suggest-widget-background"],"editorSuggestWidget.border":we["editor-suggest-widget-border"],"editorSuggestWidget.foreground":we["editor-suggest-widget-foreground"],"editorSuggestWidget.selectedBackground":we["editor-suggest-widget-selected-background"],"editorSuggestWidget.highlightForeground":we["editor-suggest-widget-highlightForeground"],"list.hoverBackground":we["list-hover-background"],"dropdown.background":we["context-menu-background"],"dropdown.foreground":we["context-menu-foreground"],"menu.selectionBackground":we["menu-selection-background"],"list.focusBackground":we["menu-selection-background"],"editorWidget.background":we["editor-widget-background"],"inputOption.activeBackground":we["input-option-active-background"],"inputOption.activeForeground":we["input-option-active-foreground"],focusBorder:we["focus-border"],"input.background":we["input-background"],"input.foreground":we["input-foreground"],"input.border":we["input-border"]};os.defineTheme("dh-dark",{base:"vs-dark",inherit:!0,rules:i,colors:o}),Dn.debug2("monaco theme: ",we),os.setTheme("dh-dark"),n([fC,iC,aC,wC,uC]),Dn.debug("Monaco initialized.")}static registerGetWorker(e){window.MonacoEnvironment={...window.MonacoEnvironment,getWorker:e}}static removeHashtag(e){return e.substring(1)}static registerLanguages(e){const n=e.map(({id:s})=>s);wi.getLanguages().filter(({id:s})=>n.includes(s)).forEach(s=>{const i=s;Dn.debug2("Overriding default language loader:",i.id)}),e.forEach(s=>{lt.registerLanguage(s)})}static registerLanguage(e){Dn.debug2("Registering language: ",e.id),wi.register(e),wi.onLanguage(e.id,()=>{wi.setLanguageConfiguration(e.id,e.conf),wi.setMonarchTokensProvider(e.id,e.language)})}static setEOL(e,n=os.EndOfLineSequence.LF){e.getModel()?.setEOL(n)}static openDocument(e,n){const s=e.getModel();k(s);const i={textDocument:{uri:`${s.uri}`,languageId:s.getLanguageId(),version:s.getVersionId(),text:s.getValue()}};return Dn.debug2("didOpenDocumentParams: ",i),n.openDocument(i),e.onDidChangeModelContent(r=>{const{changes:l,versionId:a}=r,d=[];for(let c=0;c<l.length;c+=1){const u=l[c],{range:m,rangeLength:p,text:g}=u,f={range:{start:{line:m.startLineNumber-1,character:m.startColumn-1},end:{line:m.endLineNumber-1,character:m.endColumn-1}},rangeLength:p,text:g};d.push(f)}if(d.length>0){const c={textDocument:{version:a,uri:`${s.uri}`},contentChanges:d};Dn.debug2("didChangeDocumentParams",c),n.changeDocument(c)}})}static closeDocument(e,n){const s=e.getModel();k(s);const i={textDocument:{uri:`${s.uri}`}};n.closeDocument(i)}static registerPasteHandler(e){e.onDidPaste(n=>{const s=/“|”/g,i=/\u200b/g,o=/\u00A0/g,r=e.getModel();k(r);const l=r.getValueInRange(n.range);(s.test(l)||i.test(l)||o.test(l))&&r.applyEdits([{range:n.range,text:l.replace(s,'"').replace(i,"").replace(o," ")}])})}static isMacPlatform(){const{platform:e}=window.navigator;return e.startsWith("Mac")}static removeConflictingKeybindings(e){const n=[{windows:"ctrl+D",mac:"meta+D"},{windows:"ctrl+H"}];try{n.forEach(s=>{lt.isMacPlatform()&&s.mac===""||!lt.isMacPlatform()&&s.windows===""||lt.removeKeybinding(e,lt.isMacPlatform()?s.mac:s.windows)})}catch(s){Dn.error(s)}}static removeKeybinding(e,n){if(n===void 0)return;const s=e._standaloneKeybindingService._getResolver()._map.get(n);s!=null?s.forEach(i=>{Dn.debug2(`Removing Monaco keybinding ${n} for ${i.command}`),e._standaloneKeybindingService.addDynamicKeybinding(`-${i.command}`,null,()=>{})}):Dn.warn(`Did not find any keybindings to remove for ${n}`)}static getMonacoKeyCodeFromShortcut(e){const{keyState:n}=e,{keyValue:s}=n;return s===null?0:lt.isMacPlatform()?(n.metaKey?cn.CtrlCmd:0)|(n.shiftKey?cn.Shift:0)|(n.altKey?cn.Alt:0)|(n.ctrlKey?cn.WinCtrl:0)|Zd.fromString(s):(n.ctrlKey?cn.CtrlCmd:0)|(n.shiftKey?cn.Shift:0)|(n.altKey?cn.Alt:0)|(n.metaKey?cn.WinCtrl:0)|Zd.fromString(s)}}const tc=Q.module("MonacoCompletionProvider");class zh extends b.exports.PureComponent{constructor(e){super(e),this.handleCompletionRequest=this.handleCompletionRequest.bind(this)}componentDidMount(){const{language:e}=this.props;this.registeredCompletionProvider=wi.registerCompletionItemProvider(e??"",{provideCompletionItems:this.handleCompletionRequest,triggerCharacters:['"',".","'","(","[","{",","]})}componentWillUnmount(){this.registeredCompletionProvider?.dispose()}handleCompletionRequest(e,n,s){const{model:i,session:o}=this.props;if(e!==i)return null;const r={textDocument:{uri:`${e.uri}`,version:e.getVersionId()},position:{line:n.lineNumber-1,character:n.column-1},context:s},l=o.getCompletionItems(r);return tc.debug("Completion items received: ",r,l),l.then(d=>{const c=d.map(u=>{const{label:m,kind:p,detail:g,documentation:f,sortText:C,filterText:S,textEdit:w,insertTextFormat:T}=u,{start:y,end:E}=w.range,R={startLineNumber:y.line+1,startColumn:y.character+1,endLineNumber:E.line+1,endColumn:E.character+1};return{label:m,kind:p,detail:g,documentation:f,sortText:C,filterText:S,insertText:w.text,insertTextRules:T===2?4:T,range:R}});return{incomplete:!0,suggestions:c}}).catch(d=>(tc.error("There was an error retrieving completion items",d),{suggestions:[]}))}render(){return null}}const Gl=Q.module("ConsoleInput"),Lr=parseInt(we["line-height"],10),qh=6,Yh=6,TC=Lr+qh+Yh,Wl=100,Kh=class extends b.exports.PureComponent{constructor(t){super(t),this.handleWindowResize=this.handleWindowResize.bind(this),this.commandContainer=de.createRef(),this.commandHistoryIndex=null,this.timestamp=Date.now(),this.bufferIndex=0,this.history=[],this.modifiedCommands=new Map,this.state={commandEditorHeight:Lr,isFocused:!1,model:null}}componentDidMount(){this.initCommandEditor(),window.addEventListener("resize",this.handleWindowResize),this.loadMoreHistory()}componentDidUpdate(){this.layoutEditor()}componentWillUnmount(){window.removeEventListener("resize",this.handleWindowResize),this.loadingPromise!=null&&this.loadingPromise.cancel(),this.destroyCommandEditor()}setConsoleText(t,e=!0,n=!1){!t||(Gl.debug("Command received: ",t),n||(this.commandHistoryIndex=null,this.commandEditor?.setValue(t)),e&&this.focusEnd(),this.updateDimensions(),n&&this.processCommand(t))}initCommandEditor(){const{language:t,session:e}=this.props,n={copyWithSyntaxHighlighting:!1,cursorStyle:"block",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:t,lineHeight:Lr,lineDecorationsWidth:3,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollBeyondLastLine:!1,scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},padding:{top:qh,bottom:Yh},tabCompletion:"on",value:"",wordWrap:"on"},s=this.commandContainer.current;k(s),this.commandEditor=os.create(s,n),lt.setEOL(this.commandEditor),lt.openDocument(this.commandEditor,e),this.commandEditor.onDidChangeModelContent(()=>{const i=this.commandEditor?.getValue();this.modifiedCommands.set(this.commandHistoryIndex,i??null),this.updateDimensions()}),this.commandEditor.onDidFocusEditorText(()=>{this.setState({isFocused:!0})}),this.commandEditor.onDidBlurEditorText(()=>{this.setState({isFocused:!1})}),this.commandEditor.onKeyDown(i=>{const{commandEditor:o,commandHistoryIndex:r}=this,l=o?.getPosition();k(l);const{lineNumber:a}=l,d=o?.getModel();if(i.code==="ArrowUp"&&!this.isSuggestionMenuPopulated()&&a===1){r!=null?this.loadCommand(r+1):this.loadCommand(0),this.focusStart(),i.stopPropagation(),i.preventDefault();return}if(i.code==="ArrowDown"&&!this.isSuggestionMenuPopulated()&&a===d?.getLineCount()){r!=null&&r>0?this.loadCommand(r-1):this.loadCommand(null),this.focusEnd(),i.stopPropagation(),i.preventDefault();return}if(!i.altKey&&!i.shiftKey&&!i.metaKey)if(i.keyCode===Ds.Enter){if(!this.isSuggestionMenuPopulated()){i.stopPropagation(),i.preventDefault();const c=this.commandEditor?.getValue().trim();c!==void 0&&(this.processCommand(c),this.commandEditor?.setValue(""))}}else i.keyCode===Ds.Tab&&(this.isSuggestionMenuActive()?this.isSuggestionMenuPopulated()||(i.stopPropagation(),i.preventDefault()):(i.stopPropagation(),i.preventDefault(),this.commandEditor?.trigger("Tab key trigger suggestions","editor.action.triggerSuggest",{})))}),this.commandEditor.addCommand(cn.CtrlCmd|Ds.KeyF,()=>{}),lt.removeConflictingKeybindings(this.commandEditor),lt.registerPasteHandler(this.commandEditor),this.commandEditor.focus(),this.updateDimensions(),this.setState({model:this.commandEditor.getModel()})}destroyCommandEditor(){const{session:t}=this.props;this.commandEditor&&(lt.closeDocument(this.commandEditor,t),this.commandEditor.dispose(),this.commandEditor=void 0)}handleWindowResize(){this.updateDimensions()}isSuggestionMenuActive(){return this.commandSuggestionContainer||(this.commandSuggestionContainer=this.commandEditor?.getDomNode()?.querySelector(".suggest-widget")),(this.commandSuggestionContainer&&this.commandSuggestionContainer.classList.contains("visible"))??!1}isSuggestionMenuPopulated(){return this.isSuggestionMenuActive()&&(this.commandSuggestionContainer?.querySelector(".monaco-list-rows")?.childElementCount??0)>0}focus(){this.commandEditor?.focus()}focusStart(){const t=this.commandEditor?.getModel();k(t);const e=t.getLineLength(1)+1,n=this.commandEditor?.getTopForPosition(1,e);k(n),this.commandEditor?.setPosition({lineNumber:1,column:e}),this.commandEditor?.setScrollTop(n),this.commandEditor?.focus()}focusEnd(){const t=this.commandEditor?.getModel();k(t);const e=t.getLineCount(),n=t.getLineLength(e)+1,s=this.commandEditor?.getTopForPosition(e,n);k(s),this.commandEditor?.setPosition({lineNumber:e,column:n}),this.commandEditor?.setScrollTop(s),this.commandEditor?.focus()}clear(){this.commandEditor?.focus(),this.commandEditor?.getModel()?.setValue(""),this.commandHistoryIndex=null}layoutEditor(){this.commandEditor&&this.commandEditor.layout()}loadCommand(t){if(t!==null&&t>=this.history.length)return;const e=this.modifiedCommands.get(t),n=t===null?"":this.history[this.history.length-t-1];this.commandHistoryIndex=t,this.commandEditor?.getModel()?.setValue(e??n),t!==null&&t>this.history.length-Wl&&this.loadMoreHistory()}async loadMoreHistory(){try{if(this.loadingPromise!=null||this.bufferIndex==null)return;const{commandHistoryStorage:t,language:e,scope:n}=this.props;this.loadingPromise=ye.makeCancelable(t.getTable(e,n??"",this.timestamp),o=>o.close());const s=await this.loadingPromise;s.setReversed(!0),s.setViewport({top:this.bufferIndex,bottom:this.bufferIndex+Wl-1}),this.loadingPromise=ye.makeCancelable(s.getViewportData(),()=>s.close());const i=await this.loadingPromise;this.bufferIndex+=Wl,this.bufferIndex>=s.size&&(this.bufferIndex=null),this.history=[...i.items.filter(({name:o},r,l)=>r===0||o!==l[r-1].name).map(({name:o})=>o).reverse(),...this.history],this.loadingPromise=void 0,s.close()}catch(t){if(this.loadingPromise=void 0,ye.isCanceled(t)){Gl.debug2("Promise canceled, not loading history");return}Gl.error("Error fetching history",t)}}processCommand(t){this.commandHistoryIndex=null,this.modifiedCommands.clear(),k(t),t!==""&&(this.history.length===0||t!==this.history[this.history.length-1])&&this.history.push(t),this.updateDimensions();const{onSubmit:e}=this.props;e(t)}updateDimensions(){if(!this.commandEditor)return;const{maxHeight:t}=this.props;k(t);const e=this.commandEditor.getContentHeight(),n=Math.max(Math.min(e,t),TC),i={overviewRulerLanes:e>n?void 0:0};this.setState({commandEditorHeight:n},()=>{this.commandEditor?.updateOptions(i),this.commandEditor?.layout()})}render(){const{disabled:t,language:e,session:n}=this.props,{commandEditorHeight:s,isFocused:i,model:o}=this.state;return h("div",{className:K("console-input-wrapper",{disabled:t}),children:v("div",{className:K("console-input-inner-wrapper",{focus:i}),children:[h("div",{className:Kh.INPUT_CLASS_NAME,ref:this.commandContainer,style:{height:s}}),o&&h(zh,{model:o,language:e,session:n})]})})}};let Pr=Kh;Pr.defaultProps={maxHeight:Lr*10,scope:null,disabled:!1};Pr.INPUT_CLASS_NAME="console-input";const nc="pasted values",vC=[/^audio.*/,/^font.*/,/^image.*/,/^video.*/],zl=[".csv",".tsv",".tab",".psv",".dsv",".txt"],sc=[".zip"],Ti=class extends b.exports.Component{constructor(t){super(t),this.getValidExtensions=fe(e=>e?[...zl,...sc]:[...zl]),this.getAcceptString=fe(e=>this.getValidExtensions(e).join(", ")),this.getFileTypeErrorString=fe(e=>jt.join(this.getValidExtensions(e),"or")),this.handleSelectFile=this.handleSelectFile.bind(this),this.handleFiles=this.handleFiles.bind(this),this.handleDrop=this.handleDrop.bind(this),this.unstageFile=this.unstageFile.bind(this),this.handleMenuPaste=this.handleMenuPaste.bind(this),this.handlePasteEvent=this.handlePasteEvent.bind(this),this.fileElem=de.createRef(),this.divElem=de.createRef(),this.state={selectedFileName:""}}static isValidDropItem(t){return t!=null&&t.kind==="file"&&!vC.find(e=>e.test(t.type))}static isValidExtension(t,e=!1){return zl.some(n=>t.endsWith(n))||e&&sc.some(n=>t.endsWith(n))}static handleDragOver(t){t.preventDefault(),t.stopPropagation()}static getIcon(t){return t===nc?Gd:t.endsWith(".csv")?ug:t.endsWith(".zip")?mg:pg}componentDidMount(){this.divElem.current?.addEventListener("paste",this.handlePasteEvent),this.divElem.current?.focus()}componentWillUnmount(){this.divElem.current?.removeEventListener("paste",this.handlePasteEvent)}handleSelectFile(){this.fileElem.current&&(this.fileElem.current.value="",this.fileElem.current?.click())}handleFiles(t){t.stopPropagation(),t.preventDefault();const{files:e}=t.target;e!=null&&this.handleFile(e[0])}handleDrop(t){const{allowZip:e,clearDragError:n,dragError:s}=this.props;if(t.preventDefault(),t.stopPropagation(),s!=null){n();return}if(t.dataTransfer==null||t.dataTransfer.items==null||t.dataTransfer.items.length===0)return;const i=t.dataTransfer.items[0].getAsFile();k(i),Ti.isValidExtension(i.name,e)?this.handleFile(i):this.setState({dropError:Ti.FILE_TYPE_ERROR})}unstageFile(t){const{onCancel:e}=this.props;t.stopPropagation(),t.preventDefault(),e(),this.setState({selectedFileName:"",dropError:void 0})}handleFile(t){const{onFileOpened:e}=this.props;e(t),this.setState({selectedFileName:t.name,dropError:void 0})}handleMenuPaste(){const{onPaste:t,onError:e,uploadInProgress:n}=this.props;n||navigator.clipboard.readText().then(s=>{t(s),this.setState({selectedFileName:nc,dropError:void 0})}).catch(s=>e(s))}handlePasteEvent(t){t.stopPropagation(),t.preventDefault(),this.handleMenuPaste()}makeContextMenuItems(){const{uploadInProgress:t}=this.props;return[{title:"Paste",icon:Gd,action:this.handleMenuPaste,shortcut:ls.PASTE,disabled:t}]}render(){const{allowZip:t,dragError:e,uploadInProgress:n}=this.props,{selectedFileName:s,dropError:i}=this.state,o=e??i,r=this.makeContextMenuItems();return v("div",{ref:this.divElem,className:"csv-overlay fill-parent-absolute",onDragOver:Ti.handleDragOver,onDrop:this.handleDrop,tabIndex:-1,children:[h(le,{actions:r}),h("input",{ref:this.fileElem,type:"file",id:"fileElem",accept:this.getAcceptString(t),style:{display:"none"},onChange:this.handleFiles,"data-testid":"fileElem"}),!s&&(o===void 0||o==="")&&v("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(J,{icon:gg})}),h("label",{children:"Drop file (or paste values) here to import"}),h("div",{className:"message-small",children:h("label",{children:"or"})}),h(V,{kind:"primary",onClick:this.handleSelectFile,children:"Select File..."})]}),s&&(o===void 0||o==="")&&v("div",{className:"selected-content",children:[h("div",{className:"selected-icon",children:h(J,{icon:Ti.getIcon(s)})}),v("div",{className:"selected-text",children:[h("label",{children:"Selected File"}),v("label",{className:"selected-name",children:[s,!n&&h(V,{kind:"ghost",className:"ml-2",onClick:this.unstageFile,icon:sn,tooltip:"Remove"})]})]})]}),Boolean(o)&&v("div",{className:"message-content",children:[h("div",{className:"message-icon",children:h(J,{icon:xs})}),h("label",{children:o}),o===Ti.FILE_TYPE_ERROR&&h("div",{className:"message-small",children:h("label",{children:this.getFileTypeErrorString(t)})})]})]})}};let es=Ti;es.defaultProps={allowZip:!1,dragError:null};es.MULTIPLE_FILE_ERROR="Please select only one file";es.FILE_TYPE_ERROR="Filetype not supported.";class Me{}Me.INTEGER="int";Me.LONG="long";Me.DOUBLE="double";Me.BOOLEAN="bool";Me.STRING="string";Me.DATE_TIME="datetime";Me.LOCAL_TIME="localtime";const ic="unknown",EC=2147483647,yC=-2147483648,oc=/^[0-9]{4}-[0-1][0-9]-[0-3][0-9][ T][0-2][0-9]:[0-5][0-9]:[0-6][0-9](?:\.[0-9]{1,9})?(?: [a-zA-Z]+)?$/,rc=/^([0-9]+T)?([0-9]+):([0-9]+)(:[0-9]+)?(?:\.[0-9]{1,9})?$/;class Nt{static determineType(e,n,s){if(!e||e===s)return n;switch(n){case Me.STRING:return Me.STRING;case Me.INTEGER:return Nt.checkInteger(e);case Me.LONG:return Nt.checkLong(e);case Me.DOUBLE:return Nt.checkDouble(e);case Me.BOOLEAN:return Nt.checkBoolean(e);case Me.DATE_TIME:return Nt.checkDateTime(e);case Me.LOCAL_TIME:return Nt.checkLocalTime(e);default:return Nt.getTypeFromUnknown(e)}}static isNotParsableNumber(e){return isNaN(e)||e==="Infinity"||e==="-Infinity"}static checkInteger(e){const n=e.replace(/,/g,"");return Nt.isNotParsableNumber(n)?Me.STRING:Nt.getNumberType(n)}static checkLong(e){const n=e.replace(/,/g,"");return Nt.isNotParsableNumber(n)?Me.STRING:n.includes(".")?Me.DOUBLE:Me.LONG}static checkDouble(e){const n=e.replace(/,/g,"");return Nt.isNotParsableNumber(n)?Me.STRING:Me.DOUBLE}static checkBoolean(e){const n=e.toLowerCase();return n==="true"||n==="false"?Me.BOOLEAN:Me.STRING}static checkDateTime(e){return oc.test(e)?Me.DATE_TIME:Me.STRING}static checkLocalTime(e){return rc.test(e)?Me.LOCAL_TIME:Me.STRING}static getTypeFromUnknown(e){const n=e.replace(/,/g,"");if(Nt.isNotParsableNumber(n)){const s=e.toLowerCase();return s==="true"||s==="false"?Me.BOOLEAN:oc.test(e)&&e.includes(":")?Me.DATE_TIME:rc.test(e)?Me.LOCAL_TIME:Me.STRING}return Nt.getNumberType(n)}static getNumberType(e){if(e.includes("."))return Me.DOUBLE;const n=e.startsWith("-")?11:10;if(e.length>n)return Me.LONG;const s=parseInt(e,10);return s>EC||s<yC?Me.LONG:Me.INTEGER}constructor(e,n,s,i,o,r,l,a,d,c){this.onFileCompleted=e,this.file=n,this.readHeaders=s,this.nullString=o,this.onProgress=r,this.onError=l,this.chunks=0,this.totalChunks=a,this.isZip=d,this.shouldTrim=c,this.zipProgress=0,this.handleChunk=this.handleChunk.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleError=this.handleError.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.config={...i,error:this.handleError,chunk:this.handleChunk,complete:this.handleComplete}}parse(){const e=this.isZip?this.file.nodeStream("nodebuffer",this.handleNodeUpdate):this.file;ra.parse(e,this.config)}handleChunk(e,n){let{data:s}=e;if(!this.types){if(s==null||s.length===0){n.abort(),this.onError("Error parsing CSV: no data in file.");return}this.types=new Array(s[0].length).fill(ic),this.readHeaders&&(s=s.slice(1))}k(this.types);const i=[...this.types];s.forEach(l=>{if(l.length>=i.length){for(let a=0;a<i.length;a+=1)i[a]=Nt.determineType(this.shouldTrim?l[a].trim():l[a],i[a],this.nullString);this.types=i}else n.abort(),this.onError(`Error parsing CSV: Insufficient data in row.
3
3
  Expected length ${i.length} but found ${l.length}.
4
4
  Row = ${l}`)}),this.chunks+=1;let o=0;this.totalChunks>0?o=Math.round(this.chunks/this.totalChunks*50):o=Math.round(this.zipProgress/2),this.onProgress(o)&&n.abort()}handleComplete(e){const{types:n,onFileCompleted:s}=this;k(n),(e==null||!e.meta.aborted)&&s(n.map(i=>i===ic?Me.STRING:i))}handleError(e){const{onError:n}=this;n(e)}handleNodeUpdate(e){this.zipProgress=e.percent}}const or=Q.module("CsvParser"),RC=650,Hr=class{static generateHeaderRecursive(t){let e="",n=t;return t>=26&&(e=e.concat(Hr.generateHeaderRecursive(Math.floor(t/26)-1)),n=t%26),e.concat(String.fromCharCode(65+n))}constructor({onFileCompleted:t,session:e,file:n,type:s,readHeaders:i=!0,onProgress:o,onError:r,timeZone:l,isZip:a}){this.onFileCompleted=t,this.session=e,this.file=n,this.isZip=a,this.type=s,this.readHeaders=i,this.timeZone=l,this.onProgress=o,this.onError=r,this.tables=[],this.chunks=0,this.totalChunks=a?0:Math.ceil(n.size/ra.LocalChunkSize),this.isComplete=!1,this.zipProgress=0,this.numConsolidated=0,this.isCancelled=!1,this.handleChunk=this.handleChunk.bind(this),this.handleError=this.handleError.bind(this),this.handleComplete=this.handleComplete.bind(this),this.handleNodeUpdate=this.handleNodeUpdate.bind(this),this.handleCreateTable=this.handleCreateTable.bind(this),this.config={delimiter:s.delimiter,newline:s.newline,escapeChar:s.escapeChar,dynamicTyping:!1,error:this.handleError,skipEmptyLines:s.skipEmptyLines,chunk:this.handleChunk,complete:this.handleComplete,fastMode:!1}}cancel(){this.isCancelled=!0}transpose(t,e){const n=e.length,s=new Array(t).fill(null).map(()=>new Array(n));for(let i=0;i<n;i+=1){const o=e[i];if(o.length<t)throw new Error(`Insufficient columns. Expected ${t} but found ${o.length}
@@ -34,9 +34,9 @@ ${l} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is un
34
34
  ${Nr.makeCirclePath(s,i,oh)}
35
35
  ${Nr.makeCirclePath(o,r,oh)}`,F=`link-select-clip-${l}`,D=Math.atan2(r-y,o-T),_=D-ih+Math.PI,U=D+ih+Math.PI,H=o+Math.cos(D)*sh,O=r+Math.sin(D)*sh,q=H+Math.cos(_)*wr,W=O+Math.sin(_)*wr,z=H+Math.cos(U)*wr,x=O+Math.sin(U)*wr,L=`${H},${O} ${q},${W} ${z},${x}`,P=.25*s+.5*T+.25*o,j=.25*i+.5*y+.25*r,oe=T-s+(o-T),G=(y-i+(r-y))/oe;let ne=20/Math.sqrt(1+G**2),he=ne*G,Z=ne*-1,ce=he*-1;Number.isFinite(G)?G>0?(ne*=-1,he*=-1,Z*=-1,ce*=-1,Z-=50-10*(Math.abs(m)%ys),ce+=10*(Math.abs(m)%ys),ne-=50-10*(Math.abs(m)%ys),he+=10*(Math.abs(m)%ys)):G<0?(Z+=10*(Math.abs(m)%ys),ce+=10*(Math.abs(m)%ys),ne+=10*(Math.abs(m)%ys),he+=10*(Math.abs(m)%ys)):(Z=15,ce=10,ne=-25,he=10):(Z=10,ce=5,ne=10,he=-35);let ge="";e!==void 0&&(e==="startsWith"?ge="a*":e==="endsWith"?ge="*z":ge=N.getFilterOperatorString(e));const Fe=d!=="chartLink"&&d!=="filterSource";return v(Se,{children:[v("svg",{className:K(t,{hovering:c}),children:[h("clipPath",{id:F,children:h("path",{d:R,clipRule:"evenodd"})}),h("path",{className:"link-select",d:E,onClick:this.handleClick,onMouseEnter:this.handleMouseEnter,onMouseLeave:this.handleMouseLeave,clipPath:`url(#${F})`}),h("path",{className:"link-background",d:E}),h("path",{className:"link-foreground",d:E}),h("circle",{className:"link-dot",cx:s,cy:i,r:"5"}),h("polygon",{className:"link-triangle",points:L})]}),a!=null&&n&&v(Se,{children:[Fe&&h(V,{kind:"primary",className:"btn-fab btn-operator",style:{top:j+(G>=0?he:ce),left:P+(G>=0?ne:Z)},onClick:()=>{},icon:v("div",{className:"fa-md fa-layers",children:[h("b",{children:ge}),h(J,{icon:ts,transform:"right-8 down-9 shrink-5"})]}),tooltip:"Change comparison operator",children:h(ns,{actions:this.getDropdownActions,popperOptions:{placement:"bottom-start"}})}),h(V,{kind:"primary",className:"btn-fab btn-delete",style:{top:j+(G<0?he:ce),left:P+(G<0?ne:Z)},onClick:this.handleDelete,icon:sn,tooltip:"Delete"})]})]})}};let Jm=Nr;Jm.defaultProps={className:"",isSelected:!1,onClick(){},onDelete(){}};const sa=Q.module("LinkerOverlayContent");class ep extends b.exports.Component{constructor(e){super(e),this.handleBlur=this.handleBlur.bind(this),this.handleResize=this.handleResize.bind(this),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleMouseDown=this.handleMouseDown.bind(this),this.handleMouseUp=this.handleMouseUp.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.handleOperatorChanged=this.handleOperatorChanged.bind(this),this.dialogRef=de.createRef(),this.state={mouse:void 0,dialog:void 0,offset:{x:0,y:0},isDragging:!1,mode:"select"}}componentDidMount(){window.addEventListener("blur",this.handleBlur,!0),window.addEventListener("mousemove",this.handleMouseMove,!0),window.addEventListener("mouseup",this.handleMouseUp,!0),window.addEventListener("keydown",this.handleKeyDown,!0),window.addEventListener("keyup",this.handleKeyUp,!0),window.addEventListener("resize",this.handleResize,!0)}componentDidCatch(e,n){sa.error("componentDidCatch",e,n)}componentWillUnmount(){window.removeEventListener("blur",this.handleBlur,!0),window.removeEventListener("mousemove",this.handleMouseMove,!0),window.removeEventListener("mouseup",this.handleMouseUp,!0),window.removeEventListener("keydown",this.handleKeyDown,!0),window.removeEventListener("keyup",this.handleKeyUp,!0),window.removeEventListener("resize",this.handleResize,!0)}getPointFromLinkPoint(e){const{panelManager:n}=this.props,{panelId:s,columnName:i}=e,o=n.getOpenedPanelById(s);if(o!=null){if(!Xm(o))throw new Error(`Panel does not have getCoordinateForColumn method: ${s}`);try{const l=o.getCoordinateForColumn(i);if(l!=null)return l}catch{sa.error("Could not get coordinate for column",i,o)}}const r=n.getContainerByPanelId(s);if(r==null)throw new Error(`Unable to find panel container for id: ${s}`);return se.getTabPoint(r)}handleOperatorChanged(e,n){const{links:s,onLinksUpdated:i}=this.props,o=s.map(r=>r.id===e?{...r,operator:n}:r);i(o)}handleBlur(){this.setState({mode:"select"})}handleResize(){const{dialog:e}=this.state;if(e&&this.dialogRef.current){const n=this.dialogRef.current.getBoundingClientRect(),s=Je(e.x,0,window.innerWidth-n.width),i=Je(e.y,0,window.innerHeight-n.height);this.setState({dialog:{x:s,y:i}})}}handleMouseMove(e){const{offset:n,isDragging:s}=this.state;if(this.setState({mouse:{x:e.clientX,y:e.clientY}}),s&&this.dialogRef.current){const i=this.dialogRef.current.getBoundingClientRect(),o=Je(window.innerWidth-(e.clientX+i.width+n.x),0,window.innerWidth-i.width),r=Je(window.innerHeight-(e.clientY+i.height+n.y),0,window.innerHeight-i.height);this.setState({dialog:{x:o,y:r}})}}handleMouseDown(e){const n={x:0,y:0};if(this.dialogRef.current){const s=this.dialogRef.current.getBoundingClientRect();n.x=s.right-(s.width+e.clientX),n.y=s.bottom-(s.height+e.clientY)}this.setState({isDragging:!0,offset:n})}handleMouseUp(){this.setState({isDragging:!1})}handleKeyDown(e){if(e.key==="Alt")e.preventDefault(),this.setState({mode:"delete"});else if(e.key==="Delete"||e.key==="Backspace"){const{selectedIds:n,onLinkDeleted:s}=this.props;e.preventDefault(),n.forEach(i=>s(i))}}handleKeyUp(e){e.key==="Alt"&&(e.preventDefault(),this.setState({mode:"select"}))}handleEscapePressed(){const{onCancel:e}=this.props;e()}render(){const{disabled:e,links:n,selectedIds:s,messageText:i,onLinkSelected:o,onLinkDeleted:r,onAllLinksDeleted:l,onDone:a}=this.props,{mouse:d,dialog:c,isDragging:u,mode:m}=this.state,p=n.map(g=>{try{const{id:f,type:C,isReversed:S,start:w,end:T,operator:y}=g,E=w.columnType;let[R,F]=this.getPointFromLinkPoint(w),D=d?.x??R,_=d?.y??F;if(T!=null&&([D,_]=this.getPointFromLinkPoint(T)),S!=null&&S){const[H,O]=[R,F];[R,F]=[D,_],[D,_]=[H,O]}const U=K("linker-link",{disabled:e},{"link-filter-source":C==="filterSource"},{"link-invalid":C==="invalid"},{interactive:g.end==null},{"link-is-selected":s.has(f)},{"danger-delete":m==="delete"});return{x1:R,y1:F,x2:D,y2:_,id:f,className:U,operator:y,startColumnType:E,type:C}}catch(f){return sa.warn("Unable to get point for link",g,f),null}}).filter(g=>g!=null);return v("div",{className:K("linker-overlay",{"danger-delete":m==="delete"}),children:[p.map(({x1:g,y1:f,x2:C,y2:S,id:w,className:T,operator:y,startColumnType:E,type:R})=>h(Jm,{className:T,id:w,x1:g,y1:f,x2:C,y2:S,onClick:o,onDelete:r,isSelected:s.has(w),operator:y,startColumnType:E,type:R,onOperatorChanged:this.handleOperatorChanged},w)),v("div",{className:K("linker-toast-dialog",{dragging:u}),ref:this.dialogRef,style:{bottom:c?.y,right:c?.x},children:[h(V,{draggable:!0,kind:"inline",className:"btn-drag-handle",icon:tl,onClick:()=>{},onMouseDown:this.handleMouseDown,children:!u&&h(mt,{children:"Drag to reposition"})}),h("div",{className:"toast-body",children:i}),v("div",{className:"toast-footer",children:[h(V,{kind:"secondary",onClick:l,children:"Clear All"}),h(V,{kind:"primary",onClick:a,children:"Done"})]})]}),h(le,{actions:[{action:this.handleEscapePressed,shortcut:ls.LINKER_CLOSE,isGlobal:!0}]})]})}}ep.defaultProps={disabled:"false"};const St=Q.module("Linker"),wy=(t,e)=>({activeTool:gl(t),isolatedLinkerPanelId:Td(t,e.localDashboardId),links:Ki(t,e.localDashboardId),timeZone:Ao(t)}),Ty=yt(wy,{setActiveTool:Cl,setDashboardLinks:Ed,addDashboardLinks:RE,deleteDashboardLinks:IE,setDashboardIsolatedLinkerPanelId:Vm,setDashboardColumnSelectionValidator:FE});class vy extends b.exports.Component{constructor(e){super(e),this.getCachedLinks=fe((n,s,i)=>{const o=[...n];return s!=null&&s.start!=null&&o.push(s),i!==void 0?o.filter(r=>r?.start?.panelId===i||r?.end?.panelId===i||r?.end==null):o}),this.handleCancel=this.handleCancel.bind(this),this.handleDone=this.handleDone.bind(this),this.handlePanelCloned=this.handlePanelCloned.bind(this),this.handleFilterColumnSelect=this.handleFilterColumnSelect.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handlePanelClosed=this.handlePanelClosed.bind(this),this.handleLayoutStateChanged=this.handleLayoutStateChanged.bind(this),this.handleAllLinksDeleted=this.handleAllLinksDeleted.bind(this),this.handleLinkDeleted=this.handleLinkDeleted.bind(this),this.handleLinksUpdated=this.handleLinksUpdated.bind(this),this.handleChartColumnSelect=this.handleChartColumnSelect.bind(this),this.handleGridColumnSelect=this.handleGridColumnSelect.bind(this),this.handleUpdateValues=this.handleUpdateValues.bind(this),this.handleStateChange=this.handleStateChange.bind(this),this.handleExited=this.handleExited.bind(this),this.handleLinkSelected=this.handleLinkSelected.bind(this),this.handlePanelDragging=this.handlePanelDragging.bind(this),this.handlePanelDropped=this.handlePanelDropped.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0,selectedIds:new Set,isDraggingPanel:!1}}componentDidMount(){const{layout:e}=this.props;this.startListening(e),this.updateSelectionValidators()}componentDidUpdate(e){const{activeTool:n,layout:s}=this.props;s!==e.layout&&(this.stopListening(e.layout),this.startListening(s)),n!==e.activeTool&&(this.updateSelectionValidators(),n===zt.DEFAULT&&this.reset())}componentDidCatch(e,n){St.error("componentDidCatch",e,n)}componentWillUnmount(){const{layout:e}=this.props;this.stopListening(e)}startListening(e){e.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.on(vt.COLUMN_SELECTED,this.handleGridColumnSelect),n.on(vt.DATA_SELECTED,this.handleUpdateValues),n.on(vt.STATE_CHANGED,this.handleStateChange),n.on(Li.COLUMN_SELECTED,this.handleChartColumnSelect),n.on(Ee.CLONED,this.handlePanelCloned),n.on(Le.COLUMN_SELECTED,this.handleFilterColumnSelect),n.on(Le.COLUMNS_CHANGED,this.handleColumnsChanged),n.on(Ee.CLOSE,this.handlePanelClosed),n.on(Ee.CLOSED,this.handlePanelClosed),n.on(Ee.DRAGGING,this.handlePanelDragging),n.on(Ee.DROPPED,this.handlePanelDropped)}stopListening(e){e.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:n}=e;n.off(vt.COLUMN_SELECTED,this.handleGridColumnSelect),n.off(vt.DATA_SELECTED,this.handleUpdateValues),n.off(vt.STATE_CHANGED,this.handleStateChange),n.off(Li.COLUMN_SELECTED,this.handleChartColumnSelect),n.off(Ee.CLONED,this.handlePanelCloned),n.off(Le.COLUMN_SELECTED,this.handleFilterColumnSelect),n.off(Le.COLUMNS_CHANGED,this.handleColumnsChanged),n.off(Ee.CLOSE,this.handlePanelClosed),n.off(Ee.CLOSED,this.handlePanelClosed),n.off(Ee.DRAGGING,this.handlePanelDragging),n.off(Ee.DROPPED,this.handlePanelDropped)}reset(){this.setState({linkInProgress:void 0,selectedIds:new Set})}handleCancel(){const{linkInProgress:e}=this.state;if(e==null){const{setActiveTool:n}=this.props;n(zt.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:e}=this.props;e(zt.DEFAULT)}handleChartColumnSelect(e,n){this.columnSelected(e,n,!0)}handleFilterColumnSelect(e,n){St.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:s,localDashboardId:i,setActiveTool:o,setDashboardIsolatedLinkerPanelId:r}=this.props,l=se.getIdFromPanel(e),a=s.filter(d=>d.start?.panelId===l||d.end?.panelId===l);if(!this.isOverlayShown()&&l!=null){o(zt.LINKER),r(i,l),a.length===0&&this.columnSelected(e,n,!0,l);return}this.columnSelected(e,n,!0)}handleColumnsChanged(e,n){St.debug("handleColumnsChanged",e,n);const{links:s}=this.props,i=se.getIdFromPanel(e);if(i==null){St.error("Invalid panelId",e);return}const o=s.filter(({start:r,end:l})=>r.panelId===i&&Js.findColumn(n,r)==null||l!=null&&l.panelId===i&&Js.findColumn(n,l)==null);this.deleteLinks(o)}handleGridColumnSelect(e,n){if(!eh(n)){St.debug2("Column is not filterable");return}this.columnSelected(e,n)}columnSelected(e,n,s=!1,i){if(i===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:o}=this.props,{linkInProgress:r}=this.state,l=se.getIdFromPanel(e);if(l==null)return;const a=se.getComponentNameFromPanel(e),{name:d,type:c}=n;if(r==null||r.start==null){const u={id:Be.generate(),start:{panelId:l,panelComponent:a,columnName:d,columnType:c},type:"invalid",isReversed:s};St.debug("starting link",u),this.setState({linkInProgress:u})}else{const{links:u}=this.props,{start:m,id:p,isReversed:g}=r,f={panelId:l,panelComponent:a,columnName:d,columnType:c},C=Js.getLinkType(g!==void 0&&g?f:m,g!==void 0&&g?m:f,i??o);switch(C){case"invalid":St.debug("Ignore invalid link connection",r,f);return;case"filterSource":{const w=g!==void 0&&g?m.panelId:f.panelId,T=u.filter(({end:y})=>y?.panelId===w);this.deleteLinks(T);break}case"chartLink":{const w=g===!0?m:f,T=g===!0?f:m;St.debug("creating chartlink",{existingLinkEnd:w,start:m,end:f});const y=u.filter(({end:E,start:R})=>R?.panelId===T.panelId&&E?.panelId===w.panelId&&E?.columnName===w.columnName&&E?.columnType===w.columnType);this.deleteLinks(y);break}}const S={start:g!==void 0&&g?f:m,end:g!==void 0&&g?m:f,id:p,type:C,operator:B.eq};St.info("creating link",S),this.setState({linkInProgress:void 0,selectedIds:new Set([p])},()=>{this.addLinks([S])})}}unsetFilterValueForLink(e){const{panelManager:n}=this.props;if(e.end){const{end:s}=e,{panelId:i,columnName:o,columnType:r}=s,l=n.getOpenedPanelById(i);l?Jc(l)?l.unsetFilterValue(o,r):St.debug("endPanel.unsetFilterValue not implemented",l):St.debug("endPanel no longer exists, ignoring unsetFilterValue",i)}}setPanelFilterMap(e,n){St.debug("Set filter data for panel:",e,n);const{panelManager:s}=this.props,i=s.getOpenedPanelById(e);i?Jc(i)?i.setFilterMap(n):St.debug("panel.setFilterMap not implemented",e,i):St.debug("panel no longer exists, ignoring setFilterMap",e)}addLinks(e){const{addDashboardLinks:n,localDashboardId:s}=this.props;n(s,e)}deleteLinks(e,n=!1){const{localDashboardId:s}=this.props;if(e.forEach(i=>this.unsetFilterValueForLink(i)),n){const{setDashboardLinks:i}=this.props;i(s,[])}else if(e.length>0){const{deleteDashboardLinks:i}=this.props;i(s,e.map(({id:o})=>o))}}handleAllLinksDeleted(){const{links:e,isolatedLinkerPanelId:n}=this.props;if(n===void 0)this.deleteLinks(e,!0);else{const s=e.filter(i=>i?.start?.panelId===n||i?.end?.panelId===n);this.deleteLinks(s)}this.reset()}handleLinkDeleted(e){const{links:n}=this.props,s=n.find(i=>i.id===e);s?this.deleteLinks([s]):St.error("Unable to find link to delete",e)}handleUpdateValues(e,n){const s=se.getIdFromPanel(e),{links:i,timeZone:o}=this.props,r=new Map;for(let l=0;l<i.length;l+=1){const{start:a,end:d,operator:c}=i[l];if(a.panelId===s&&d!=null){const{panelId:u,columnName:m,columnType:p}=d,g=r.has(u)?r.get(u):new Map,f=g.has(m)===!0?g.get(m).filterList:[],{visibleIndex:C,isExpandable:S,isGrouped:w}=n[a.columnName];let{value:T}=n[a.columnName],y=`${T}`;T===null&&S&&w&&(T=void 0),p!=null&&N.isDateType(p)&&(y=new st({timeZone:o,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:vn.FULL_DATE_FORMAT}).format(T));const E={operator:c,text:y,value:T,startColumnIndex:C};f.push(E),g.set(m,{columnType:p,filterList:f}),r.set(u,g)}}r.forEach((l,a)=>{this.setPanelFilterMap(a,l)})}handlePanelCloned(e,n){const{links:s}=this.props,i=se.getIdFromPanel(e),o=n.id;if(i!=null){const r=Js.cloneLinksForPanel(s,i,o);this.addLinks(r)}}handlePanelDragging(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r}=i;if(o.panelId===e||r?.panelId===e){this.setState({isDraggingPanel:!0});return}}}handlePanelDropped(){this.setState({isDraggingPanel:!1})}handlePanelClosed(e){St.debug(`Panel ${e} closed, deleting links.`),this.deleteLinksForPanelId(e)}handleLinkSelected(e){this.setState({selectedIds:new Set([e])})}handleLinksUpdated(e){const{localDashboardId:n,setDashboardLinks:s}=this.props;s(n,e)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:e,setDashboardIsolatedLinkerPanelId:n}=this.props;n(e,void 0)}deleteLinksForPanelId(e){const{links:n}=this.props;for(let s=0;s<n.length;s+=1){const i=n[s],{start:o,end:r,id:l}=i;(o.panelId===e||r?.panelId===e)&&this.handleLinkDeleted(l)}}isOverlayShown(){const{activeTool:e}=this.props;return e===zt.LINKER}updateSelectionValidators(){const{activeTool:e,setDashboardColumnSelectionValidator:n,localDashboardId:s}=this.props;switch(e){case zt.LINKER:n(s,this.isColumnSelectionValid);break;default:n(s,void 0);break}}updateLinkInProgressType(e="invalid"){this.setState(({linkInProgress:n})=>n!==void 0?{linkInProgress:{...n,type:e}}:null)}isColumnSelectionValid(e,n){const{linkInProgress:s}=this.state,{isolatedLinkerPanelId:i}=this.props;if(n==null)return s?.start!=null&&this.updateLinkInProgressType(),!1;if(!eh(n))return St.debug2("Column is not filterable",n.description),s?.start!=null&&this.updateLinkInProgressType("invalid"),!1;if(s?.start==null)return!0;const{isReversed:o,start:r}=s,l=se.getIdFromPanel(e);if(l==null)return!1;const a={panelId:l,panelComponent:se.getComponentNameFromPanel(e),columnName:n.name,columnType:n.type},d=o!==void 0&&o?Js.getLinkType(a,r,i):Js.getLinkType(r,a,i);return this.updateLinkInProgressType(d),d!=="invalid"}render(){const{links:e,isolatedLinkerPanelId:n,panelManager:s}=this.props,{linkInProgress:i,selectedIds:o,isDraggingPanel:r}=this.state,l=this.isOverlayShown(),a=i!=null&&i.start!=null,d=n===void 0?"Click a column source, then click a column target to create a filter link. The filter comparison operator used by a selected link can be changed. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Delete a filter link by clicking the delete button or with alt+click. Click done when finished.";return r?null:h(Ht,{in:l,timeout:je.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited,children:h(ep,{disabled:a,panelManager:s,links:this.getCachedLinks(e,i,n),selectedIds:o,messageText:d,onLinkSelected:this.handleLinkSelected,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onLinksUpdated:this.handleLinksUpdated,onDone:this.handleDone,onCancel:this.handleCancel})})}}const Ey=Ty(vy);function yy(t){Ls(t);const{id:e,layout:n,panelManager:s}=t;return h(Ey,{layout:n,localDashboardId:e,panelManager:s})}const Na=class{static getNewMarkdownTitle(t){let e=`${Na.DEFAULT_TITLE}`,n=0;for(;t.indexOf(e)>=0;)n+=1,e=`${Na.DEFAULT_TITLE}-${n}`;return e}};let Io=Na;Io.DEFAULT_TITLE="Note";Io.DEFAULT_CONTENT=`# Markdown Note
36
36
 
37
- This note can be edited using **markdown** for styling.`;function Ry(t){Ls(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=b.exports.useCallback(l=>{const{title:a,componentState:d,props:c}=l;let{panelState:u=null}=c;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===Io.DEFAULT_CONTENT?null:nd(l)},[]),r=b.exports.useCallback(({title:l="",metadata:a={},id:d=Be.generate(),focusElement:c=se.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(ho.COMPONENT),g=s.getClosedPanelConfigsOfType(ho.COMPONENT),f=p.map(y=>y.title??""),C=l!=null&&l!==""?l:Io.getNewMarkdownTitle(f),S=g.length>0?null:Io.DEFAULT_CONTENT,w={type:"react-component",component:ho.COMPONENT,props:{id:d,metadata:a,panelState:{content:S},localDashboardId:e},title:C,id:d},{root:T}=n;se.openComponent({root:T,config:w,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return b.exports.useEffect(function(){const a=[i(ho.COMPONENT,ho,sd,o)];return()=>{a.forEach(d=>d())}},[o,i]),Ge(n.eventHub,Lm.OPEN,r),null}function Iy(t){Ls(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=b.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=Be.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.PANDAS)return;const m={name:c,table:c},p=()=>l().then(C=>Cd.makeModel(C)),g={type:"react-component",component:Ro.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;se.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return b.exports.useEffect(function(){const l=[i(Ro.COMPONENT,Ro,e)];return()=>{l.forEach(a=>a())}},[e,i]),Ge(s.eventHub,Ee.OPEN,o),null}class un{}un.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";un.INPUT_FILTER="ControlType.INPUT_FILTER";un.MARKDOWN="ControlType.MARKDOWN";un.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const Fy=M.exports.shape({state:M.exports.shape({panelState:M.exports.shape({})})}),Dy=M.exports.shape({panelId:M.exports.string.isRequired,columnName:M.exports.string.isRequired,columnType:M.exports.string.isRequired}),rh=M.exports.shape({panelId:M.exports.string.isRequired,columnName:M.exports.string.isRequired}),tp=M.exports.shape({start:rh,end:rh,id:M.exports.string,isReversed:M.exports.bool}),Ny=M.exports.arrayOf(tp),_y=M.exports.shape({name:M.exports.string.isRequired,operateAs:M.exports.string.isRequired,groups:M.exports.arrayOf(M.exports.string).isRequired,permissions:M.exports.shape({isSuperUser:M.exports.bool.isRequired,isQueryViewOnly:M.exports.bool.isRequired,isNonInteractive:M.exports.bool.isRequired,canUsePanels:M.exports.bool.isRequired,canCreateDashboard:M.exports.bool.isRequired,canCreateCodeStudio:M.exports.bool.isRequired,canCreateQueryMonitor:M.exports.bool.isRequired,canCopy:M.exports.bool.isRequired,canDownloadCsv:M.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:Dy,Link:tp,Links:Ny,Panel:Fy,User:_y});const My=(t,e)=>t[e]===null?null:M.exports.bool,ky=(t,e)=>t[e]===null?null:M.exports.string;Object.freeze({nullableBoolean:My,nullableString:ky});Q.module("StorageTableViewportUpdater");class lh{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(qt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=qt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const ia=Q.module("PouchStorageTable"),xy="Deephaven.";Sh.plugin(Yp);function Oy(t,e){switch(t){case B.in:case B.contains:return{$regex:new RegExp(`${e}`)};case B.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case B.eq:return{$eq:e};case B.notEq:return{$neq:e};case B.greaterThan:return{$gt:e};case B.greaterThanOrEqualTo:return{$gte:e};case B.lessThan:return{$lt:e};case B.lessThanOrEqualTo:return{$lte:e};case B.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function Ay(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,d={[r]:Oy(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===qt.and)s={$and:[s,d]};else if(c===qt.or)s={$or:[s,d]};else throw new Error(`Unexpected filter operator ${c}, ${d}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function oa(t=[]){return{$and:[...t.map(e=>Ay(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function Ly(t,e=!1){return[{id:e?"desc":"asc"},...t?.map(n=>({[n.column]:n.direction}))??[]]}class Py{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new Sh(`${xy}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){const{listeners:e}=this,n=this.currentViewportData??{items:[],offset:0};for(let s=0;s<e.length;s+=1)e[s](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){ia.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=ye.makeCancelable(this.db.find({selector:oa(this.currentFilter??[]),fields:[]}));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!ye.isCanceled(e))throw ia.error("Unable to refreshInfo",e),e}}async refreshData(){if(!!this.currentViewport)try{const{currentViewport:e}=this,n=Ly(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=ye.makeCancelable(this.db.find({selector:oa(this.currentFilter??[]),skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(i=>({items:i.docs,offset:e.top})));const s=await this.viewportUpdatePromise;return this.currentViewportData=s,this.sendUpdate(),s}catch(e){if(!ye.isCanceled(e))throw ia.error("Unable to refreshData",e),e}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{const r=o-i+1;return this.db.find({selector:oa(this.currentFilter??[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(l=>{for(let a=0;a<r;a+=1){const d=i+a;n.set(d,l.docs[a])}})})),n}}class ah extends Py{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[lh.makeFilterConfig([lh.makeFilterItem("name",B.contains,e)])]:[])}}const ch=Q.module("PouchCommandHistoryStorage");class Hy{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new ah(e)),this.updateTableMap.get(e)}async getTable(e){return new ah(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),o={...await s.refreshItem(n.id)??{},...n};return ch.debug("Updating item",o),await s.put(o),ch.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const np="SET_LAYOUT_STORAGE",Uy=t=>({type:np,payload:t}),sp="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const Vy=Q.module("FormattingSectionContent");function By(t){return t.formatString!=null}function _a(t){const e=t?.querySelector("input, select, textarea");e&&e.focus()}function ip(t,e){return t.defaultFormatString===e.defaultFormatString}function $y(t,e){return ip(t,e)}function Gy(t,e){return ip(t,e)}function op(t){return t!==""&&Vi.isValidColumnName(t)}function Ms(t,e){if(!t||e.formatString==null||!By(e))return!1;switch(t){case"datetime":return st.isValid(e);case"decimal":return ke.isValid(e);case"int":return Qe.isValid(e);default:return Vy.warn("Trying to validate format of unknown type"),!0}}function rp(t){const{id:e,isNewRule:n,...s}=t;return s}function lp(t){return op(t.columnName)&&Ms(t.columnType,t.format)}function ap(t){const{timestamp:e,timeZone:n,showTimeZone:s,showTSeparator:i,isGlobalOptions:o,legacyGlobalFormat:r}=t,l=new nn([],{timeZone:n,showTimeZone:s,showTSeparator:i}),a=o?st.getGlobalFormats(s,i):st.getFormats(s,i);return r!=null&&!a.includes(r)&&a.unshift(r),h(Se,{children:a.map(d=>{const c=st.makeFormat("",d,st.TYPE_GLOBAL);return h("option",{value:d,"data-testid":"time-format",children:l.getFormattedString(e,N.dataType.DATETIME,"",c)},d)})})}function Wy(){return h(Se,{children:Qr.TIME_ZONES.map(t=>{const{label:e,value:n}=t;return h("option",{value:n,children:e},n)})})}const Ys=Q.module("FormattingSectionContent"),dp=class extends b.exports.PureComponent{constructor(t){super(t),this.getCachedDateTimeFormatOptions=Re((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(ap,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=et(this.commitChanges.bind(this),dp.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=de.createRef(),this.state={formatSettings:d,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){_a(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}handleDefaultDateTimeFormatChange(t){Ys.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){Ys.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){Ys.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;Ys.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;Ys.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;Ys.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;Ys.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=t.filter(lp).map(rp)??[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ms(N.dataType.DECIMAL,ke.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ms(N.dataType.INT,Qe.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}render(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:r,truncateNumbersWithPound:l}=this.state,{defaultFormatString:a=ke.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:d=Qe.DEFAULT_FORMAT_STRING}=s??{},c=i===t.timeZone,u=r===t.showTSeparator&&o===t.showTimeZone&&e===t.defaultDateTimeFormat,m=$y(n,t.defaultDecimalFormatOptions),p=Gy(s,t.defaultIntegerFormatOptions);return h("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:v("div",{className:"container-fluid p-0",children:[h("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:h(Wy,{})})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:K("btn-reset","btn-reset-time-zone",{hidden:c})})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:e,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,r,!0,e)})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:K("btn-reset","btn-reset-date-time",{hidden:u})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(mn,{checked:o??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(mn,{checked:r??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:K("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ms(N.dataType.DECIMAL,ke.makeCustomFormat(a))}),"data-lpignore":!0,placeholder:ke.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:a,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:K("btn-reset","btn-reset-decimal",{hidden:m}),"data-testid":"btn-reset-decimal"})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:K("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ms(N.dataType.INT,Qe.makeCustomFormat(d))}),"data-lpignore":!0,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:d,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:K("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(mn,{checked:l??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}};let Od=dp;Od.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:ke.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Od.inputDebounceTime=250;const zy=t=>({formatter:gu(t),defaultDateTimeFormat:uu(t),defaultDecimalFormatOptions:mu(t),defaultIntegerFormatOptions:pu(t),showTimeZone:fu(t),showTSeparator:Cu(t),truncateNumbersWithPound:Su(t),timeZone:Ao(t),settings:Rt(t)}),qy=yt(zy,{saveSettings:fl})(Od);function Yy(){const[t,e]=b.exports.useState(!1),n=()=>{e(!t)};return v(V,{kind:"ghost",onClick:n,icon:df,children:["Legal Notices",v(sl,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h(il,{toggle:n,children:"Legal Notice"}),v(ol,{children:[h("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,495; 9,836,494; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,353,893; 10,346,394; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; and 10,783,191. Other patents pending."}),v("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Fo(t){const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return v(Se,{children:[h("div",{children:v(V,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(J,{transform:n?"flip-v":"",icon:ts})})]})}),h(cf,{in:n,autoFocusOnShow:!0,children:e})]})}Fo.propTypes={children:M.exports.node,isExpanded:M.exports.bool.isRequired,sectionKey:M.exports.string.isRequired,title:M.exports.node.isRequired,onToggle:M.exports.func};Fo.defaultProps={children:null,onToggle:()=>{}};function Ky({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=b.exports.useState(e),[r,l]=b.exports.useState(t.getKeyState()),[a,d]=b.exports.useState(!1),[c,u]=b.exports.useState("");b.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),b.exports.useEffect(function(){o(fn.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),b.exports.useEffect(function(){if(a){if(!fn.isValidKeyState(r)){fn.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Ye.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(T){if(T.stopPropagation(),T.preventDefault(),t.isEditable&&!T.repeat){const y=fn.getKeyStateFromEvent(T),E=fn.createKeyState([Ie.BACKSPACE]);fn.doKeyStatesMatch(y,E)?l(fn.NULL_KEY_STATE):l(y)}}function p(T){T.stopPropagation(),T.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){Hn.disableAllActions()}function f(){Hn.enableAllActions()}function C(){t.setKeyState(r),d(!1),s(t)}function S(){const T=t.getKeyState();l(T),d(!1)}function w(){d(!0),l(t.getDefaultKeyState())}return v(Se,{children:[v("div",{className:"shortcut-item-container",children:[v("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(mt,{children:t.tooltip})]}),v("div",{className:"shortcut-item-input-container",children:[h("input",{className:K("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!fn.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(V,{className:"reset-to-default-button",kind:"ghost",icon:h(J,{icon:ei,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:w})]})]}),a&&v("div",{className:K("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),v("div",{className:"shortcut-item-message-buttons",children:[fn.isValidKeyState(r)&&h(V,{kind:"ghost",onClick:C,children:"Confirm"}),h(V,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function Xy({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=b.exports.useCallback(l=>{const a=fn.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Ye.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),v(Se,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),i.map(l=>h(jy,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function jy({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=b.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=b.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return v("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(Ky,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const Zy=t=>({settings:Rt(t),shortcutOverrides:aS(t)}),Qy={saveSettings:fl},Jy=yt(Zy,Qy)(Xy),eR="yyyy-MM-dd-HHmmss";function cp(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=cp(o,a,n)}}}),s}function tR(){const t=Sl.getState();return JSON.stringify(cp(t),null,2)}function nR(t){const e={uiVersion:"0.31.5",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function sR(t=`${I.i18n.DateTimeFormat.format(eR,new Date)}_support_logs`,e){const n=new bh,s=n.folder(t);s.file("console.txt",hf.getFormattedHistory()),s.file("redux.json",tR()),s.file("metadata.json",nR(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const iR=[{value:N.dataType.DATETIME,label:"DateTime"},{value:N.dataType.DECIMAL,label:"Decimal"},{value:N.dataType.INT,label:"Integer"}];function oR(){const t=iR.map(e=>h("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return v(Se,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),t]})}const hp=class extends b.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=Re(()=>h(oR,{})),this.getCachedDateTimeFormatOptions=Re((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(ap,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=et(this.commitChanges.bind(this),hp.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=de.createRef(),this.addFormatRuleButtonRef=de.createRef(),this.lastFormatRuleIndex=d.length,this.state={formatSettings:d,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){_a(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){const{formatSettings:e}=this.state;return e.some(n=>n.id!==t.id&&n.columnName===t.columnName&&n.columnType===t.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;k(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:N.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),_a(t)}commitChanges(){const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=t.filter(lp).map(rp)??[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ms(N.dataType.DECIMAL,ke.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ms(N.dataType.INT,Qe.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}scrollToFormatBlockBottom(){const{scrollTo:t}=this.props;t(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),op(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format.formatString!==void 0&&t.format.formatString.length===0?(e.hasFormatError=!0,n.push("Empty formatting rule.")):Ms(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
38
- `)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return v("fieldset",{className:"container-fluid format-rule-container",children:[v("div",{className:"form-row",children:[v("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:K("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),v("div",{className:"form-group col mb-2",children:[h(V,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:sn,tooltip:"Delete","aria-label":"Delete Format Rule"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:v("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(N.getNormalizedType(e)){case N.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case N.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case N.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:throw new Error(`Unrecognized column type: ${e}`)}}renderDateTimeFormatRuleInput(t,e,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=n.formatString??"";return v("select",{className:K("custom-select",{"is-invalid":s}),value:l,id:e,onChange:a=>{const d=st.makeFormat("",a.target.value,st.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",d)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){const i=n.formatString??"";return h("input",{className:K("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=Qe.makeFormat("",o.target.value,Qe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}renderDecimalFormatRuleInput(t,e,n,s){const i=n.formatString??"";return h("input",{className:K("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:ke.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=ke.makeFormat("",o.target.value,ke.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}render(){const{formatRulesChanged:t,formatSettings:e}=this.state,n=e.map((i,o)=>h(Ht,{classNames:"fade",timeout:je.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=h(V,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Os,children:"Add New Rule"});return v("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[h("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),h(Kp,{appear:t,enter:t,exit:t,children:n}),s]})}};let Ad=hp;Ad.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:ke.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Ad.inputDebounceTime=250;const rR=t=>({formatter:gu(t),defaultDateTimeFormat:uu(t),defaultDecimalFormatOptions:mu(t),defaultIntegerFormatOptions:pu(t),showTimeZone:fu(t),showTSeparator:Cu(t),truncateNumbersWithPound:Su(t),timeZone:Ao(t),settings:Rt(t)}),lR=yt(rR,{saveSettings:fl})(Ad),Qn=class extends b.exports.Component{constructor(t){super(t),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=de.createRef(),this.state={expandedSectionKey:Qn.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t?.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){Qn.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){this.menuContentRef.current?.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;sR(void 0,Object.fromEntries(t))}render(){const t="0.31.5",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>v(Se,{children:[h("div",{children:a}),h("div",{children:d})]});return v("div",{className:"app-settings-menu",children:[v("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(V,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(J,{icon:Ui,transform:"grow-4"}),tooltip:"Close"})]}),v("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(Fo,{sectionKey:Qn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(Qn.FORMATTING_SECTION_KEY),title:v(Se,{children:[h(J,{icon:uf,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:h(qy,{})}),h(Fo,{sectionKey:Qn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(Qn.COLUMN_SPECIFIC_SECTION_KEY),title:v(Se,{children:[h(J,{icon:mf,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:h(lR,{scrollTo:this.handleScrollTo})}),h(Fo,{sectionKey:Qn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(Qn.SHORTCUT_SECTION_KEY),title:v(Se,{children:[h(J,{icon:pf,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(Jy,{})}),v("div",{className:"app-settings-footer",children:[v("div",{className:"app-settings-footer-section",children:[v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),v("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(V,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),v("span",{className:"d-inline-block text-muted",children:[r," ",h(J,{icon:gf}),v(mt,{interactive:!0,children:[v("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]}),h(al,{tooltip:"Copy version numbers",copy:`Engine Version: ${r}
37
+ This note can be edited using **markdown** for styling.`;function Ry(t){Ls(t);const{id:e,layout:n,panelManager:s,registerComponent:i}=t,o=b.exports.useCallback(l=>{const{title:a,componentState:d,props:c}=l;let{panelState:u=null}=c;return d!=null&&({panelState:u=null}=d),a==null||u==null||u.content==null||u.content.length===0||u.content===Io.DEFAULT_CONTENT?null:nd(l)},[]),r=b.exports.useCallback(({title:l="",metadata:a={},id:d=Be.generate(),focusElement:c=se.DEFAULT_FOCUS_SELECTOR,createNewStack:u=!1,dragEvent:m=null}={})=>{const p=s.getOpenedPanelConfigsOfType(ho.COMPONENT),g=s.getClosedPanelConfigsOfType(ho.COMPONENT),f=p.map(y=>y.title??""),C=l!=null&&l!==""?l:Io.getNewMarkdownTitle(f),S=g.length>0?null:Io.DEFAULT_CONTENT,w={type:"react-component",component:ho.COMPONENT,props:{id:d,metadata:a,panelState:{content:S},localDashboardId:e},title:C,id:d},{root:T}=n;se.openComponent({root:T,config:w,focusElement:c,createNewStack:u,dragEvent:m})},[e,n,s]);return b.exports.useEffect(function(){const a=[i(ho.COMPONENT,ho,sd,o)];return()=>{a.forEach(d=>d())}},[o,i]),Ge(n.eventHub,Lm.OPEN,r),null}function Iy(t){Ls(t);const{hydrate:e,id:n,layout:s,registerComponent:i}=t,o=b.exports.useCallback(({dragEvent:r,fetch:l,panelId:a=Be.generate(),widget:d})=>{const{name:c,type:u}=d;if(u!==dh.VariableType.PANDAS)return;const m={name:c,table:c},p=()=>l().then(C=>Cd.makeModel(C)),g={type:"react-component",component:Ro.COMPONENT,props:{localDashboardId:n,id:a,metadata:m,makeModel:p},title:c,id:a},{root:f}=s;se.openComponent({root:f,config:g,dragEvent:r})},[n,s]);return b.exports.useEffect(function(){const l=[i(Ro.COMPONENT,Ro,e)];return()=>{l.forEach(a=>a())}},[e,i]),Ge(s.eventHub,Ee.OPEN,o),null}class un{}un.DROPDOWN_FILTER="ControlType.DROPDOWN_FILTER";un.INPUT_FILTER="ControlType.INPUT_FILTER";un.MARKDOWN="ControlType.MARKDOWN";un.FILTER_SET_MANAGER="ControlType.FILTER_SET_MANAGER";const Fy=M.exports.shape({state:M.exports.shape({panelState:M.exports.shape({})})}),Dy=M.exports.shape({panelId:M.exports.string.isRequired,columnName:M.exports.string.isRequired,columnType:M.exports.string.isRequired}),rh=M.exports.shape({panelId:M.exports.string.isRequired,columnName:M.exports.string.isRequired}),tp=M.exports.shape({start:rh,end:rh,id:M.exports.string,isReversed:M.exports.bool}),Ny=M.exports.arrayOf(tp),_y=M.exports.shape({name:M.exports.string.isRequired,operateAs:M.exports.string.isRequired,groups:M.exports.arrayOf(M.exports.string).isRequired,permissions:M.exports.shape({isSuperUser:M.exports.bool.isRequired,isQueryViewOnly:M.exports.bool.isRequired,isNonInteractive:M.exports.bool.isRequired,canUsePanels:M.exports.bool.isRequired,canCreateDashboard:M.exports.bool.isRequired,canCreateCodeStudio:M.exports.bool.isRequired,canCreateQueryMonitor:M.exports.bool.isRequired,canCopy:M.exports.bool.isRequired,canDownloadCsv:M.exports.bool.isRequired}).isRequired});Object.freeze({LinkPoint:Dy,Link:tp,Links:Ny,Panel:Fy,User:_y});const My=(t,e)=>t[e]===null?null:M.exports.bool,ky=(t,e)=>t[e]===null?null:M.exports.string;Object.freeze({nullableBoolean:My,nullableString:ky});Q.module("StorageTableViewportUpdater");class lh{static makeSortConfig(e,n){return{column:e,direction:n}}static makeFilterConfig(e){const n=[],s=[];return e.forEach((i,o)=>{n.push(i),o>0&&s.push(qt.and)}),{filterItems:n,filterOperators:s}}static combineFilterConfigs(e,n,s=qt.and){return{filterItems:[...e.filterItems,...n.filterItems],filterOperators:[...e.filterOperators,s,...n.filterOperators]}}static makeFilterItem(e,n,s){return{columnName:e,type:n,value:s}}}const ia=Q.module("PouchStorageTable"),xy="Deephaven.";Sh.plugin(Yp);function Oy(t,e){switch(t){case B.in:case B.contains:return{$regex:new RegExp(`${e}`)};case B.inIgnoreCase:return{$regex:new RegExp(`${e}`,"i")};case B.eq:return{$eq:e};case B.notEq:return{$neq:e};case B.greaterThan:return{$gt:e};case B.greaterThanOrEqualTo:return{$gte:e};case B.lessThan:return{$lt:e};case B.lessThanOrEqualTo:return{$lte:e};case B.startsWith:return{$regex:new RegExp(`^(?${e}).*`)};default:throw new Error(`Unsupported type: ${t}`)}}function Ay(t){const{filterItems:e,filterOperators:n}=t;let s=null;for(let i=0;i<e.length;i+=1){const o=e[i],{columnName:r,type:l,value:a}=o,d={[r]:Oy(l,a)};if(i===0)s=d;else if(s!==null&&i-1<n.length){const c=n[i-1];if(c===qt.and)s={$and:[s,d]};else if(c===qt.or)s={$or:[s,d]};else throw new Error(`Unexpected filter operator ${c}, ${d}`)}}if(s==null)throw new Error(`Invalid filter config ${t}`);return s}function oa(t=[]){return{$and:[...t.map(e=>Ay(e)),{name:{$gt:null}},{id:{$gt:null}}]}}function Ly(t,e=!1){return[{id:e?"desc":"asc"},...t?.map(n=>({[n.column]:n.direction}))??[]]}class Py{constructor(e){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new Sh(`${xy}${e}`),this.db._remote=!1,this.db.changes({live:!0,since:"now",include_docs:!0}).on("change",this.dbUpdate.bind(this)),this.db.createIndex({index:{fields:["id","name"]}}),this.refreshInfo()}onUpdate(e){return this.listeners=[...this.listeners,e],()=>{this.listeners=this.listeners.filter(n=>n!==e)}}onItemUpdate(e,n){return this.itemListeners.has(e)||this.itemListeners.set(e,[]),this.itemListeners.set(e,[...this.itemListeners.get(e),n]),this.refreshItem(e),()=>{this.itemListeners.set(e,this.itemListeners.get(e).filter(s=>s!==n))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(e){this.currentReverse=e,this.currentViewportData=void 0,this.refreshData()}setViewport(e){this.currentViewport=e,this.refreshInfo(),this.refreshData()}setSorts(e){this.currentSort=e,this.currentViewportData=void 0,this.refreshData()}setFilters(e){this.currentFilter=e,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){return this.viewportUpdatePromise||this.refreshData(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}async put(e){const n={...e,_id:e.id};return await this.db.put(n),n}sendUpdate(){const{listeners:e}=this,n=this.currentViewportData??{items:[],offset:0};for(let s=0;s<e.length;s+=1)e[s](n)}sendItemUpdate(e){const n=this.itemListeners.get(e.id);if(n!==void 0)for(let s=0;s<n.length;s+=1)n[s](e)}dbUpdate(e){ia.debug("Update received",e),this.refreshInfo(),e.doc!==void 0&&this.sendItemUpdate(e.doc),this.refreshData()}async refreshInfo(){try{this.infoUpdatePromise?.cancel(),this.infoUpdatePromise=ye.makeCancelable(this.db.find({selector:oa(this.currentFilter??[]),fields:[]}));const e=await this.infoUpdatePromise;this.currentSize=e.docs.length,this.sendUpdate()}catch(e){if(!ye.isCanceled(e))throw ia.error("Unable to refreshInfo",e),e}}async refreshData(){if(!!this.currentViewport)try{const{currentViewport:e}=this,n=Ly(this.currentSort,this.currentReverse);this.viewportUpdatePromise?.cancel(),this.viewportUpdatePromise=ye.makeCancelable(this.db.find({selector:oa(this.currentFilter??[]),skip:e.top,limit:e.bottom-e.top+1,sort:n,fields:["id","name"]}).then(i=>({items:i.docs,offset:e.top})));const s=await this.viewportUpdatePromise;return this.currentViewportData=s,this.sendUpdate(),s}catch(e){if(!ye.isCanceled(e))throw ia.error("Unable to refreshData",e),e}}async refreshItem(e){const s=(await this.db.find({selector:{id:e},limit:1})).docs[0];return s!==void 0&&this.sendItemUpdate(s),s}async getSnapshot(e){const n=new Map,s=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(e.map(async([i,o])=>{const r=o-i+1;return this.db.find({selector:oa(this.currentFilter??[]),skip:i,limit:r,sort:s,fields:["id","name"]}).then(l=>{for(let a=0;a<r;a+=1){const d=i+a;n.set(d,l.docs[a])}})})),n}}class ah extends Py{constructor(e){super(`CommandHistoryStorage.${e}`)}setSearch(e){this.setFilters(e?[lh.makeFilterConfig([lh.makeFilterItem("name",B.contains,e)])]:[])}}const ch=Q.module("PouchCommandHistoryStorage");class Hy{constructor(){this.updateTableMap=new Map}getUpdateTable(e){return this.updateTableMap.has(e)||this.updateTableMap.set(e,new ah(e)),this.updateTableMap.get(e)}async getTable(e){return new ah(e)}async addItem(e,n,s,i){return this.updateItem(e,{id:`${new Date().getTime()}`,name:s,data:i})}async updateItem(e,n){const s=this.getUpdateTable(e),o={...await s.refreshItem(n.id)??{},...n};return ch.debug("Updating item",o),await s.put(o),ch.debug("Update saved"),n}listenItem(e,n,s){return this.getUpdateTable(e).onItemUpdate(n,s)}}const np="SET_LAYOUT_STORAGE",Uy=t=>({type:np,payload:t}),sp="/ide/assets/community-wordmark-app.d2c5c1eb.svg";const Vy=Q.module("FormattingSectionContent");function By(t){return t.formatString!=null}function _a(t){const e=t?.querySelector("input, select, textarea");e&&e.focus()}function ip(t,e){return t.defaultFormatString===e.defaultFormatString}function $y(t,e){return ip(t,e)}function Gy(t,e){return ip(t,e)}function op(t){return t!==""&&Vi.isValidColumnName(t)}function Ms(t,e){if(!t||e.formatString==null||!By(e))return!1;switch(t){case"datetime":return st.isValid(e);case"decimal":return ke.isValid(e);case"int":return Qe.isValid(e);default:return Vy.warn("Trying to validate format of unknown type"),!0}}function rp(t){const{id:e,isNewRule:n,...s}=t;return s}function lp(t){return op(t.columnName)&&Ms(t.columnType,t.format)}function ap(t){const{timestamp:e,timeZone:n,showTimeZone:s,showTSeparator:i,isGlobalOptions:o,legacyGlobalFormat:r}=t,l=new nn([],{timeZone:n,showTimeZone:s,showTSeparator:i}),a=o?st.getGlobalFormats(s,i):st.getFormats(s,i);return r!=null&&!a.includes(r)&&a.unshift(r),h(Se,{children:a.map(d=>{const c=st.makeFormat("",d,st.TYPE_GLOBAL);return h("option",{value:d,"data-testid":"time-format",children:l.getFormattedString(e,N.dataType.DATETIME,"",c)},d)})})}function Wy(){return h(Se,{children:Qr.TIME_ZONES.map(t=>{const{label:e,value:n}=t;return h("option",{value:n,children:e},n)})})}const Ys=Q.module("FormattingSectionContent"),dp=class extends b.exports.PureComponent{constructor(t){super(t),this.getCachedDateTimeFormatOptions=Re((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(ap,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=et(this.commitChanges.bind(this),dp.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleShowTimeZoneChange=this.handleShowTimeZoneChange.bind(this),this.handleShowTSeparatorChange=this.handleShowTSeparatorChange.bind(this),this.handleTimeZoneChange=this.handleTimeZoneChange.bind(this),this.handleResetDateTimeFormat=this.handleResetDateTimeFormat.bind(this),this.handleResetDecimalFormat=this.handleResetDecimalFormat.bind(this),this.handleResetIntegerFormat=this.handleResetIntegerFormat.bind(this),this.handleResetTimeZone=this.handleResetTimeZone.bind(this),this.handleTruncateNumbersWithPoundChange=this.handleTruncateNumbersWithPoundChange.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=de.createRef(),this.state={formatSettings:d,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){_a(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}handleDefaultDateTimeFormatChange(t){Ys.debug("handleDefaultDateTimeFormatChange",t.target.value),this.setState({defaultDateTimeFormat:t.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(t){Ys.debug("handleDefaultDecimalFormatChange",t.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(t){Ys.debug("handleDefaultIntegerFormatChange",t.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:t.target.value}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(t=>({showTimeZone:!t.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(t=>({showTSeparator:!t.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(t){this.setState({timeZone:t.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s}=t;Ys.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:t}=this.props,{timeZone:e}=t;Ys.debug("handleResetTimeZone"),this.setState({timeZone:e},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:t}=this.props,{defaultDecimalFormatOptions:e}=t;Ys.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:t}=this.props,{defaultIntegerFormatOptions:e}=t;Ys.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:e},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(t=>({truncateNumbersWithPound:!t.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}commitChanges(){const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=t.filter(lp).map(rp)??[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ms(N.dataType.DECIMAL,ke.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ms(N.dataType.INT,Qe.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}render(){const{defaults:t}=this.props,{defaultDateTimeFormat:e,defaultDecimalFormatOptions:n,defaultIntegerFormatOptions:s,timeZone:i,showTimeZone:o,showTSeparator:r,truncateNumbersWithPound:l}=this.state,{defaultFormatString:a=ke.DEFAULT_FORMAT_STRING}=n??{},{defaultFormatString:d=Qe.DEFAULT_FORMAT_STRING}=s??{},c=i===t.timeZone,u=r===t.showTSeparator&&o===t.showTimeZone&&e===t.defaultDateTimeFormat,m=$y(n,t.defaultDecimalFormatOptions),p=Gy(s,t.defaultIntegerFormatOptions);return h("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:v("div",{className:"container-fluid p-0",children:[h("div",{className:"app-settings-menu-description mb-3",children:"Choose the default formatting rule to apply to all table columns based on their type."}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone",children:"Time zone"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:i,onChange:this.handleTimeZoneChange,id:"select-reset-timezone",children:h(Wy,{})})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:K("btn-reset","btn-reset-time-zone",{hidden:c})})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format",children:"DateTime"}),h("div",{className:"col pr-0",children:h("select",{className:"custom-select",value:e,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format",children:this.getCachedDateTimeFormatOptions(i,o,r,!0,e)})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:K("btn-reset","btn-reset-date-time",{hidden:u})})})]}),h("div",{className:"form-row",children:h("div",{className:"offset-3 col-9",children:h(mn,{checked:o??null,onChange:this.handleShowTimeZoneChange,children:"Show time zone in dates"})})}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(mn,{checked:r??null,onChange:this.handleShowTSeparatorChange,children:"Show 'T' separator"})})}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input",children:"Decimal"}),h("div",{className:"col pr-0",children:h("input",{className:K("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!Ms(N.dataType.DECIMAL,ke.makeCustomFormat(a))}),"data-lpignore":!0,placeholder:ke.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:a,onChange:this.handleDefaultDecimalFormatChange})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:K("btn-reset","btn-reset-decimal",{hidden:m}),"data-testid":"btn-reset-decimal"})})]}),v("div",{className:"form-row mb-2",children:[h("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input",children:"Integer"}),h("div",{className:"col pr-0",children:h("input",{className:K("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!Ms(N.dataType.INT,Qe.makeCustomFormat(d))}),"data-lpignore":!0,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:d,onChange:this.handleDefaultIntegerFormatChange})}),h("div",{className:"col-1 btn-col",children:h(V,{kind:"ghost",icon:ei,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:K("btn-reset","btn-reset-integer",{hidden:p}),"data-testid":"btn-reset-integer"})})]}),h("div",{className:"form-row mb-3",children:h("div",{className:"offset-3 col-9",children:h(mn,{checked:l??null,onChange:this.handleTruncateNumbersWithPoundChange,children:"Truncate numbers with #"})})})]})})}};let Od=dp;Od.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:ke.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Od.inputDebounceTime=250;const zy=t=>({formatter:gu(t),defaultDateTimeFormat:uu(t),defaultDecimalFormatOptions:mu(t),defaultIntegerFormatOptions:pu(t),showTimeZone:fu(t),showTSeparator:Cu(t),truncateNumbersWithPound:Su(t),timeZone:Ao(t),settings:Rt(t)}),qy=yt(zy,{saveSettings:fl})(Od);function Yy(){const[t,e]=b.exports.useState(!1),n=()=>{e(!t)};return v(V,{kind:"ghost",onClick:n,icon:df,children:["Legal Notices",v(sl,{isOpen:t,toggle:n,className:"theme-bg-light",children:[h(il,{toggle:n,children:"Legal Notice"}),v(ol,{children:[h("p",{children:"Deephaven software is protected by U.S. Patent Nos. 9,612,959; 9,613,018; 9,613,109; 9,619,210; 9,633,060; 9,639,570; 9,672,238; 9,679,006; 9,690,821; 9,710,511; 9,760,591; 9,805,084; 9,836,495; 9,836,494; 9,886,469; 9,898,496; 9,934,266; 10,002,153; 10,002,154; 10,002,155; 10,003,673; 10,019,138; 10,069,943; 10,176,211; 10,198,465; 10,198,466; 10,198,469; 10,212,257; 10,241,960; 10,241,965; 10,242,040; 10,242,041; 10,353,893; 10,346,394; 10,452,649; 10,496,639; 10,540,351; 10,552,412; 10,565,194; 10,565,206; 10,572,474; 10,621,168; 10,642,829; 10,657,184; 10,678,787; 10,691,686; and 10,783,191. Other patents pending."}),v("p",{children:["\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."]})]})]})]})}function Fo(t){const{children:e,isExpanded:n,sectionKey:s,title:i,onToggle:o}=t;return v(Se,{children:[h("div",{children:v(V,{kind:"ghost",className:"btn-collapse-trigger",onClick:()=>o(s),children:[h("div",{className:"flex-grow-1",children:i}),h("div",{className:"flex-shrink-0",children:h(J,{transform:n?"flip-v":"",icon:ts})})]})}),h(cf,{in:n,autoFocusOnShow:!0,children:e})]})}Fo.propTypes={children:M.exports.node,isExpanded:M.exports.bool.isRequired,sectionKey:M.exports.string.isRequired,title:M.exports.node.isRequired,onToggle:M.exports.func};Fo.defaultProps={children:null,onToggle:()=>{}};function Ky({shortcut:t,displayText:e,categoryName:n,onChange:s}){const[i,o]=b.exports.useState(e),[r,l]=b.exports.useState(t.getKeyState()),[a,d]=b.exports.useState(!1),[c,u]=b.exports.useState("");b.exports.useEffect(function(){o(e),l(t.getKeyState())},[e,t]),b.exports.useEffect(function(){o(fn.getDisplayText(r)),t.matchesKeyState(r)&&d(!1)},[r,t]),b.exports.useEffect(function(){if(a){if(!fn.isValidKeyState(r)){fn.isAllowedKey(r.keyValue)?u("Must contain a modifier key"):u("Must contain an allowed action key");return}const y=Ye.getConflictingShortcuts(r).filter(E=>E.id.startsWith(n)&&E!==t).map(E=>E.name);if(y.length){u(`Conflicts with ${y.join(", ")}`);return}u("")}else u("")},[a,r,n,t]);function m(T){if(T.stopPropagation(),T.preventDefault(),t.isEditable&&!T.repeat){const y=fn.getKeyStateFromEvent(T),E=fn.createKeyState([Ie.BACKSPACE]);fn.doKeyStatesMatch(y,E)?l(fn.NULL_KEY_STATE):l(y)}}function p(T){T.stopPropagation(),T.preventDefault(),t.matchesKeyState(r)||d(!0)}function g(){Hn.disableAllActions()}function f(){Hn.enableAllActions()}function C(){t.setKeyState(r),d(!1),s(t)}function S(){const T=t.getKeyState();l(T),d(!1)}function w(){d(!0),l(t.getDefaultKeyState())}return v(Se,{children:[v("div",{className:"shortcut-item-container",children:[v("label",{className:"shortcut-item-name",children:[t.name,t.tooltip!==void 0&&h(mt,{children:t.tooltip})]}),v("div",{className:"shortcut-item-input-container",children:[h("input",{className:K("form-control",{"is-invalid":c}),onKeyDown:m,onKeyUp:p,onFocus:g,onBlur:f,disabled:!t.isEditable,value:i,readOnly:!0}),!fn.doKeyStatesMatch(r,t.getDefaultKeyState())&&!c&&h(V,{className:"reset-to-default-button",kind:"ghost",icon:h(J,{icon:ei,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:w})]})]}),a&&v("div",{className:K("shortcut-item-message-container",{"is-invalid":c}),children:[h("div",{className:"shortcut-item-message",children:c}),v("div",{className:"shortcut-item-message-buttons",children:[fn.isValidKeyState(r)&&h(V,{kind:"ghost",onClick:C,children:"Confirm"}),h(V,{kind:"ghost",onClick:S,children:"Undo"})]})]})]})}function Xy({shortcutOverrides:t={},settings:e,saveSettings:n}){const s=b.exports.useCallback(l=>{const a=fn.isMacPlatform,d={mac:{...t.mac},windows:{...t.windows}},c=a?d.mac:d.windows;l.forEach(u=>{u.isDefault()?delete c[u.id]:c[u.id]=u.getKeyState()}),n({...e,shortcutOverrides:d})},[e,n,t]);let i=Array.from(Ye.shortcutsByCategory.entries()).map(([l,a])=>({name:l,shortcuts:a}));const o=i.findIndex(l=>l.name.toUpperCase()==="GLOBAL"),r=i.splice(o,1);return i=i.concat(r),v(Se,{children:[h("div",{className:"app-settings-menu-description",children:"Customize shortcuts below. To prevent unexpected results, avoid conflicting shortcuts with the browser or IDE editor."}),i.map(l=>h(jy,{name:l.name,shortcuts:l.shortcuts,saveShortcutOverrides:s},l.name))]})}function jy({name:t,shortcuts:e,saveShortcutOverrides:n}){function s(a){return a.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[i,o]=b.exports.useState(e);function r(a){const d=i.filter(u=>u!==a&&!u.isNull()&&u.matchesKeyState(a.getKeyState()));d.forEach(u=>u.setToNull());const c=[a,...d];n(c),o(u=>[...u])}const l=b.exports.useMemo(()=>i.map(a=>a.getDisplayText()),[i]);return v("div",{className:"mt-3",children:[h("div",{className:"font-weight-bold",children:s(t)}),i.map((a,d)=>h(Ky,{shortcut:a,displayText:l[d],categoryName:t,onChange:r},a.id))]})}const Zy=t=>({settings:Rt(t),shortcutOverrides:aS(t)}),Qy={saveSettings:fl},Jy=yt(Zy,Qy)(Xy),eR="yyyy-MM-dd-HHmmss";function cp(t,e="root",n=new Map([[t,""]])){const s={};return Object.entries(t).forEach(([i,o])=>{try{JSON.stringify(o),s[i]=o}catch{const l=o;if(typeof o=="bigint")s[i]=o.toString();else if(n.has(l))s[i]=`Circular ref to ${n.get(l)}`;else{const a=`${e}.${i}`;n.set(l,a),s[i]=cp(o,a,n)}}}),s}function tR(){const t=Sl.getState();return JSON.stringify(cp(t),null,2)}function nR(t){const e={uiVersion:"0.31.6",userAgent:navigator.userAgent,...t};return JSON.stringify(e,null,2)}async function sR(t=`${I.i18n.DateTimeFormat.format(eR,new Date)}_support_logs`,e){const n=new bh,s=n.folder(t);s.file("console.txt",hf.getFormattedHistory()),s.file("redux.json",tR()),s.file("metadata.json",nR(e));const i=await n.generateAsync({type:"blob"}),o=document.createElement("a");o.href=URL.createObjectURL(i),o.download=`${t}.zip`,o.click()}const iR=[{value:N.dataType.DATETIME,label:"DateTime"},{value:N.dataType.DECIMAL,label:"Decimal"},{value:N.dataType.INT,label:"Integer"}];function oR(){const t=iR.map(e=>h("option",{value:e.value,children:e.label},`key-columnType-${e.value}`));return v(Se,{children:[h("option",{disabled:!0,value:"",children:"Select Type"},"key-columnType-placeholder"),t]})}const hp=class extends b.exports.PureComponent{constructor(t){super(t),this.getCachedColumnTypeOptions=Re(()=>h(oR,{})),this.getCachedDateTimeFormatOptions=Re((c,u,m,p=!1,g)=>{const{timestampAtMenuOpen:f}=this.state;return h(ap,{timestamp:f,timeZone:c,showTimeZone:u,showTSeparator:m,isGlobalOptions:p,legacyGlobalFormat:g})}),this.debouncedCommitChanges=et(this.commitChanges.bind(this),hp.inputDebounceTime),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.bind(this);const{formatter:e,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,showTimeZone:o,showTSeparator:r,timeZone:l,truncateNumbersWithPound:a}=t,d=e.map((c,u)=>({...c,id:u}));this.containerRef=de.createRef(),this.addFormatRuleButtonRef=de.createRef(),this.lastFormatRuleIndex=d.length,this.state={formatSettings:d,formatRulesChanged:!1,showTimeZone:o,showTSeparator:r,timeZone:l,defaultDateTimeFormat:n,defaultDecimalFormatOptions:s,defaultIntegerFormatOptions:i,truncateNumbersWithPound:a,timestampAtMenuOpen:new Date}}componentDidMount(){_a(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(t){const{formatSettings:e}=this.state;return e.some(n=>n.id!==t.id&&n.columnName===t.columnName&&n.columnType===t.columnType)??!1}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:t}=this;return this.lastFormatRuleIndex+=1,t}handleFormatRuleChange(t,e,n){this.setState(s=>{const{formatSettings:i}=s;k(i);const o=[...i];let r={};e==="columnType"&&(r={format:""});const l={...o[t],...r,[e]:n};return o[t]=l,{formatSettings:o}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(t=>{const{formatSettings:e}=t,n={columnType:N.dataType.DATETIME,columnName:"",format:{},id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:e!=null?[...e,n]:[n],formatRulesChanged:!0}})}handleFormatRuleDelete(t){this.setState(e=>{const{formatSettings:n}=e;return{formatSettings:n.filter((i,o)=>o!==t),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(t){this.scrollToFormatBlockBottom(),_a(t)}commitChanges(){const{formatSettings:t,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,truncateNumbersWithPound:l}=this.state,a=t.filter(lp).map(rp)??[],{settings:d,saveSettings:c}=this.props,u={...d,formatter:a,defaultDateTimeFormat:e,showTimeZone:n,showTSeparator:s,timeZone:i,truncateNumbersWithPound:l};Ms(N.dataType.DECIMAL,ke.makeCustomFormat(o.defaultFormatString))&&(u.defaultDecimalFormatOptions=o),Ms(N.dataType.INT,Qe.makeCustomFormat(r.defaultFormatString))&&(u.defaultIntegerFormatOptions=r),c(u)}scrollToFormatBlockBottom(){const{scrollTo:t}=this.props;t(0,(this.addFormatRuleButtonRef.current?.offsetHeight??0)+(this.addFormatRuleButtonRef.current?.offsetTop??0))}getRuleError(t){const e={hasColumnNameError:!1,hasFormatError:!1,message:""},n=[];return t.isNewRule!==void 0&&t.isNewRule||(this.isDuplicateRule(t)&&(e.hasColumnNameError=!0,n.push("Duplicate column name/type combo.")),op(t.columnName)||(e.hasColumnNameError=!0,n.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),t.format.formatString!==void 0&&t.format.formatString.length===0?(e.hasFormatError=!0,n.push("Empty formatting rule.")):Ms(t.columnType,t.format)||(e.hasFormatError=!0,n.push("Invalid formatting rule.")),e.message=n.join(`
38
+ `)),e}renderFormatRule(t,e){const n=`input-${t}-columnName`,s=`input-${t}-columnType`,i=`input-${t}-format`,o=this.getCachedColumnTypeOptions(),r=c=>this.handleFormatRuleChange(t,"columnName",c.target.value),l=()=>this.handleFormatRuleChange(t,"isNewRule",!1),a=c=>this.handleFormatRuleChange(t,"columnType",c.target.value),d=this.getRuleError(e);return v("fieldset",{className:"container-fluid format-rule-container",children:[v("div",{className:"form-row",children:[v("div",{className:"form-group col-7 mb-2",children:[h("label",{htmlFor:n,children:"Column Name"}),h("input",{id:n,className:K("form-control",{"is-invalid":d.hasColumnNameError}),"data-lpignore":!0,type:"text",value:e.columnName,onChange:r,onBlur:l})]}),v("div",{className:"form-group col mb-2",children:[h(V,{kind:"ghost",className:"btn-delete-format-rule float-right",tabIndex:-1,onClick:()=>this.handleFormatRuleDelete(t),icon:sn,tooltip:"Delete","aria-label":"Delete Format Rule"}),h("label",{htmlFor:s,children:"Column Type"}),h("select",{id:s,className:"custom-select",value:e.columnType,onChange:a,children:o})]})]}),h("div",{className:"form-row",children:v("div",{className:"form-group col-12 d-flex mb-2",children:[h("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:i,children:"Formatting Rule"}),this.renderFormatRuleInput(t,e.columnType,i,e.format,d.hasFormatError)]})}),h("div",{className:"form-row",children:h("div",{className:"form-group col-12 d-flex mb-2",children:d.message&&h("p",{className:"text-danger",children:d.message})})})]},t)}renderFormatRuleInput(t,e,n,s,i){switch(N.getNormalizedType(e)){case N.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(t,n,s,i);case N.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(t,n,s,i);case N.dataType.INT:return this.renderIntegerFormatRuleInput(t,n,s,i);default:throw new Error(`Unrecognized column type: ${e}`)}}renderDateTimeFormatRuleInput(t,e,n,s){const{showTimeZone:i,showTSeparator:o,timeZone:r}=this.state,l=n.formatString??"";return v("select",{className:K("custom-select",{"is-invalid":s}),value:l,id:e,onChange:a=>{const d=st.makeFormat("",a.target.value,st.TYPE_GLOBAL);this.handleFormatRuleChange(t,"format",d)},children:[h("option",{value:"",disabled:!0,children:"Select format"},"default"),this.getCachedDateTimeFormatOptions(r,i,o)]})}renderIntegerFormatRuleInput(t,e,n,s){const i=n.formatString??"";return h("input",{className:K("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:Qe.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=Qe.makeFormat("",o.target.value,Qe.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}renderDecimalFormatRuleInput(t,e,n,s){const i=n.formatString??"";return h("input",{className:K("form-control","flex-grow-1",{"is-invalid":s}),"data-lpignore":!0,id:e,placeholder:ke.DEFAULT_FORMAT_STRING,type:"text",value:i,onChange:o=>{const r=ke.makeFormat("",o.target.value,ke.TYPE_GLOBAL,void 0);this.handleFormatRuleChange(t,"format",r)}})}render(){const{formatRulesChanged:t,formatSettings:e}=this.state,n=e.map((i,o)=>h(Ht,{classNames:"fade",timeout:je.transitionMs,onEnter:this.handleFormatRuleEntered,children:this.renderFormatRule(o,i)},i.id)),s=h(V,{kind:"ghost",className:"mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef,icon:Os,children:"Add New Rule"});return v("div",{className:"app-settings-formatting-section",ref:this.containerRef,children:[h("div",{className:"app-settings-menu-description mb-3",children:"Customize the formatting of table columns by applying rules based on matching both a column name and column type."}),h(Kp,{appear:t,enter:t,exit:t,children:n}),s]})}};let Ad=hp;Ad.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:ke.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:st.DEFAULT_TIME_ZONE_ID}};Ad.inputDebounceTime=250;const rR=t=>({formatter:gu(t),defaultDateTimeFormat:uu(t),defaultDecimalFormatOptions:mu(t),defaultIntegerFormatOptions:pu(t),showTimeZone:fu(t),showTSeparator:Cu(t),truncateNumbersWithPound:Su(t),timeZone:Ao(t),settings:Rt(t)}),lR=yt(rR,{saveSettings:fl})(Ad),Qn=class extends b.exports.Component{constructor(t){super(t),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.handleExportSupportLogs=this.handleExportSupportLogs.bind(this),this.menuContentRef=de.createRef(),this.state={expandedSectionKey:Qn.FORMATTING_SECTION_KEY}}static focusFirstInputInContainer(t){const e=t?.querySelector("input, select, textarea");e&&e.focus()}componentDidMount(){Qn.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(t){const{expandedSectionKey:e}=this.state;return e===t}handleScrollTo(t,e){this.menuContentRef.current?.scrollTo(t,e)}handleSectionToggle(t){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===t?void 0:t}))}handleClose(){const{onDone:t}=this.props;t()}handleExportSupportLogs(){const{serverConfigValues:t}=this.props;sR(void 0,Object.fromEntries(t))}render(){const t="0.31.6",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/",{serverConfigValues:s}=this.props,i=s.get("barrage.version"),o=s.get("java.version"),r=s.get("deephaven.version"),l=(a,d)=>v(Se,{children:[h("div",{children:a}),h("div",{children:d})]});return v("div",{className:"app-settings-menu",children:[v("header",{className:"app-settings-menu-header",children:[h("div",{className:"flex-spacer"}),h(V,{kind:"ghost",className:"btn-close-settings-menu",onClick:this.handleClose,icon:h(J,{icon:Ui,transform:"grow-4"}),tooltip:"Close"})]}),v("div",{className:"app-settings-menu-content",ref:this.menuContentRef,children:[h("h5",{children:"Settings"}),h("hr",{className:"my-0"}),h(Fo,{sectionKey:Qn.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(Qn.FORMATTING_SECTION_KEY),title:v(Se,{children:[h(J,{icon:uf,transform:"grow-4",className:"mr-2"}),"Default Format & Time zone"]}),onToggle:this.handleSectionToggle,children:h(qy,{})}),h(Fo,{sectionKey:Qn.COLUMN_SPECIFIC_SECTION_KEY,isExpanded:this.isSectionExpanded(Qn.COLUMN_SPECIFIC_SECTION_KEY),title:v(Se,{children:[h(J,{icon:mf,transform:"grow-4",className:"mr-2"}),"Format by Column Name & Type"]}),onToggle:this.handleSectionToggle,children:h(lR,{scrollTo:this.handleScrollTo})}),h(Fo,{sectionKey:Qn.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(Qn.SHORTCUT_SECTION_KEY),title:v(Se,{children:[h(J,{icon:pf,transform:"grow-2"})," ","Keyboard Shortcuts"]}),onToggle:this.handleSectionToggle,children:h(Jy,{})}),v("div",{className:"app-settings-footer",children:[v("div",{className:"app-settings-footer-section",children:[v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Support"}),v("div",{children:["GitHub:\xA0",h("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer",children:e})]}),h(V,{kind:"tertiary",className:"mt-2 py-2",onClick:this.handleExportSupportLogs,children:"Export Logs"})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Documentation"}),h("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link",children:n})]}),v("div",{className:"app-settings-footer-item",children:[h("div",{className:"font-weight-bold",children:"Version"}),v("span",{className:"d-inline-block text-muted",children:[r," ",h(J,{icon:gf}),v(mt,{interactive:!0,children:[v("div",{className:"detailed-server-config",children:[l("Engine Version",r),l("Web UI Version",t),l("Java Version",o),l("Barrage Version",i)]}),h(al,{tooltip:"Copy version numbers",copy:`Engine Version: ${r}
39
39
  Web UI Version: ${t}
40
40
  Java Version: ${o}
41
- Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(Yy,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:sp,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let ji=Qn;ji.defaultProps={onDone:()=>{}};ji.FORMATTING_SECTION_KEY="SettingsMenu.formatting";ji.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";ji.APPLICATION_SECTION_KEY="ApplicationMenu.settings";ji.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const hh=10;function Ii(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=b.exports.useRef(),c=b.exports.useRef(),u=b.exports.useRef(null),[m,p]=b.exports.useState(!1),g=b.exports.useCallback(S=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-S.clientX)>=hh||Math.abs(c.current-S.clientY)>=hh)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(S),u.current=null)},[e,a]);function f(S){d.current=S.clientX,c.current=S.clientY,u.current=S.target,window.addEventListener("mousemove",g)}function C(S){u.current===S.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return b.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),v("button",{type:"button",className:K("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:C,disabled:m,children:[h("span",{className:K("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function Ld(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=b.exports.useMemo(()=>[{title:"Input Filter",icon:ff,menuElement:h(Ii,{}),action:o=>{e(un.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:_h,menuElement:h(Ii,{}),action:o=>{e(un.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:Cf,menuElement:h(Ii,{}),action:o=>{e(un.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:ca,menuElement:h(Ii,{}),action:o=>{e(un.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Ih,action:()=>{n(zt.LINKER)},order:40,shortcut:ls.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Sf,action:()=>{s()},order:60,shortcut:en.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(ns,{popperClassName:"controls-menu-popper",actions:i})}Ld.propTypes={handleControlSelect:M.exports.func,handleToolSelect:M.exports.func,onClearFilter:M.exports.func};Ld.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Ii.propTypes={forwardedProps:M.exports.shape({iconElement:M.exports.node,displayShortcut:M.exports.string,isMouseSelected:M.exports.bool.isRequired,isKeyboardSelected:M.exports.bool.isRequired,closeMenu:M.exports.func.isRequired,menuItem:M.exports.shape({action:M.exports.func,title:M.exports.string,disabled:M.exports.bool}).isRequired})};Ii.defaultProps={forwardedProps:null};const aR=As(np,null),dR={layoutStorage:aR},cR=t=>t.layoutStorage,hR=t=>t.serverConfigValues;Object.entries(dR).map(([t,e])=>Gi.register(t,e));const uh=10;function uR(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=b.exports.useState(!1),[a,d]=b.exports.useState(""),c=b.exports.useRef(null),u=b.exports.useRef(),m=b.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=b.exports.useCallback(y=>{d(y.target.value)},[]),g=b.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=uh||Math.abs(u.current.y-y.clientY)>=uh)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=b.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),C=b.exports.useCallback((y,E)=>{window.removeEventListener("mousemove",g),u.current?.widget===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),S=b.exports.useMemo(()=>o.filter(y=>a?y.name?.toLowerCase().includes(a.toLowerCase()):!0),[a,o]).sort((y,E)=>y.name?.localeCompare(E.name??"")??0),w=b.exports.useMemo(()=>S.map(y=>h("li",{children:v(V,{kind:"ghost","data-testid":`panel-list-item-${y.name??""}-button`,onMouseDown:E=>{f(E,y)},onMouseUp:E=>{C(E,y)},onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(Hh,{type:y.type})," ",y.name??""]})},y.name)),[S,r,f,C,m]),T=b.exports.useMemo(()=>w.length===0?h("span",{children:"No bound variables found."}):null,[w]);return v("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Bi,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),v("ul",{className:"widget-list flex-grow-1",children:[T&&h("li",{className:"widget-list-message",children:T}),!T&&w]}),h("div",{children:h("hr",{})}),v("div",{className:"widget-list-footer",children:[v(V,{kind:"ghost",onClick:e,children:[v("div",{className:"fa-md fa-layers",children:[h(J,{mask:da,icon:jd,transform:"right-5 down-5"}),h(J,{icon:jd,transform:"right-8 down-6"})]}),"Export Layout"]}),v(V,{kind:"ghost",onClick:n,children:[v("div",{className:"fa-md fa-layers",children:[h(J,{mask:da,icon:ha,transform:"right-5 down-5"}),h(J,{icon:ha,transform:"right-8 down-6"})]}),"Import Layout"]}),h(V,{kind:"ghost",icon:ei,onClick:s,tooltip:"Reset Layout"})]})]})}const mR=async(t,e,n)=>{let s,i,o,r;if(Rr(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:I.VariableType.FIGURE},c=await t.getObject(d);return Oi.makeModel(s,c)}const l={title:o,name:i,type:I.VariableType.TABLE},a=await t.getObject(l);return te.applyTableSettings(a,r,Ao(Sl.getState())),Oi.makeModelFromSettings(s,a)},pR=async(t,e,n=I.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return Cd.makeModel(o)};function gR({onAutoFillClick:t=()=>{}}){return v("div",{className:"empty-dashboard-container",children:[v("div",{className:"hint-container",children:[h(J,{icon:Nh})," ",h("br",{}),"Use the panel list to add objects from a query."]}),v("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(V,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function fR(t){return t.version===2}function CR(t){return Array.isArray(t)}const Tr=Q.module("UserLayoutUtils"),SR={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Ri.COMPONENT,title:Ri.TITLE,isClosable:!1},{type:"react-component",component:Xr.COMPONENT,title:Xr.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:qr.COMPONENT,title:qr.TITLE,isClosable:!1},{type:"react-component",component:Yr.COMPONENT,title:Yr.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},bR={layoutConfig:[],links:[],filterSets:[],version:2};function up(t){if(fR(t))return t;if(CR(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function wR(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return up(s)}catch(s){Tr.error("Unable to load layout",n[0],":",s),Tr.warn("No valid layouts found, falling back to default layout")}}catch(n){Tr.error("Unable to fetch layout list",n),Tr.warn("Falling back to default layout")}return e?SR:bR}function TR(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const _r={exportLayout:TR,getDefaultLayout:wR,normalizeLayout:up},vr=Q.module("DownloadServiceWorkerUtils"),mp=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),vr.info("Registering service worker on ",e,n)}).catch(n=>{vr.error("Failed to register service worker",n)})}):vr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(mp.DOWNLOAD_PATH));if(e&&e.active)return vr.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let jr=mp;jr.DOWNLOAD_PATH="/download/";const pp={react:de,"react-dom":No,redux:Xp,"react-redux":jp},vR=Zp(pp),ER=Qp({requires:vR}),yR=Jp.createRequires(pp),RR=eg({requires:yR}),IR=Q.module("PluginUtils");class Ma{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=de.lazy(()=>Tf(()=>import(`./internal/${e}`),[])),r=de.forwardRef((l,a)=>h(b.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=de.forwardRef((o,r)=>h(ER,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return IR.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await RR(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Ot=Q.module("AppMainContainer");class Do extends b.exports.Component{constructor(e){super(e),this.getDashboardPlugins=fe(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=de.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(zt.LINKER)},shortcut:ls.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:en.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ot.debug("Consume unhandled save shortcut")},shortcut:ls.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return wa.hydrate({...e,unzip:s=>bh.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Do.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Do.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ot.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ot.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Ot.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Ae.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Le.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){this.goldenLayout?.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Ot.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ot.debug("handleControlSelect",e),e){case un.DROPDOWN_FILTER:this.emitLayoutEvent(Le.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case un.INPUT_FILTER:this.emitLayoutEvent(Le.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case un.MARKDOWN:this.emitLayoutEvent(Lm.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case un.FILTER_SET_MANAGER:this.emitLayoutEvent(Le.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Ot.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?zt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Ot.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ot.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Ot.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=_r.exportLayout(n);Ot.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=I.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Ot.error("Unable to export layout",e)}}handleImportLayoutClick(){Ot.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ot.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=_r.normalizeLayout(o);s({layoutConfig:l}),n(bn,{filterSets:r,links:a})}catch(n){Ot.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await _r.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(bn,{filterSets:s,links:o})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:n}=e,s=n.getData("Text"),i=/“|”/g;i.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(i,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Ma.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if(i?.type!=null&&(i?.id!=null||i?.name!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return wa.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,e.metadata.type??I.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,I.VariableType.PANDAS)}hydrateTable(e,n,s=I.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:jr.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>pR(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return mR(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return v("div",{className:K("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:v("div",{className:"app-main-top-nav-menus",children:[h("img",{src:sp,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),v("div",{children:[v(V,{kind:"ghost",className:"btn-panels-menu",icon:bf,onClick:()=>{},children:["Controls",h(Ld,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&v(V,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:wf,children:["Panels",h(nl,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(uR,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(V,{kind:"ghost",className:K("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(J,{icon:xo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),v(rw,{emptyDashboard:h(gR,{onAutoFillClick:this.handleAutoFillClick}),id:bn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(Sy,{hydrate:this.hydrateGrid,getDownloadWorker:jr.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(uy,{hydrate:this.hydrateChart}),h(my,{}),h(gy,{hydrateConsole:Do.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(fy,{}),h(Iy,{hydrate:this.hydratePandas}),h(Ry,{}),h(yy,{}),g]}),h(Ht,{in:m,timeout:je.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(ji,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(le,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const FR=t=>({activeTool:gl(t),dashboardData:Kt(t,bn),layoutStorage:cR(t),plugins:cS(t),connection:vE(t,bn),session:ai(t,bn)?.session,sessionConfig:ai(t,bn)?.config,user:du(t),workspace:pl(t),serverConfigValues:hR(t)}),DR=yt(FR,{setActiveTool:Cl,updateDashboardData:Vn,updateWorkspaceData:Du})(tg(Do));function NR(){return v("div",{className:"app",children:[h(DR,{}),h(Oh,{})]})}const _R=Q.module("LocalWorkspaceStorage"),To=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await _r.getDefaultLayout(t,e?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:st.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:ke.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await To.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){try{return JSON.parse(localStorage.getItem(To.STORAGE_KEY)??"")}catch{return _R.info("Unable to load workspace data, initializing to default data"),To.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(To.STORAGE_KEY,JSON.stringify(t)),t}};let gp=To;gp.STORAGE_KEY="deephaven.WorkspaceStorage";class MR extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function kR(t){return t.isNoConsolesError}const Fi=Q.module("SessionUtils");var fp=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))(fp||{});function xR(){return new URL("/jsapi",`${window.location}`)}function Cp(){const t=xR();return`${t.protocol}//${t.host}`}function OR(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function AR(){const t=Cp();return Fi.info(`Starting connection to '${t}'...`),new I.IdeConnection(t)}async function LR(t,e){Fi.info("Getting console types...");const n=await t.getConsoleTypes();if(Fi.info("Available types:",n),n.length===0)throw new MR("No console types available");const s=n[0];Fi.info("Starting session with type",s);const i=await t.startSession(s),o={type:s,id:Be.generate()};return Fi.info("Console session established",o),{session:i,config:o,connection:t,details:e}}function PR(){const t=Cp();return Fi.info("createCoreClient",t),new I.CoreClient(t)}async function HR(){return ou(zC)}async function UR(){return ou(qC)}async function VR(t){switch(t){case"parent":return HR();case"anonymous":return{type:I.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}async function BR(t){switch(t){case"parent":return UR();case"anonymous":return{};default:throw new Error(`Unknown auth type: ${t}`)}}class $R{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const po=Q.module("GrpcFileStorageTable"),ka=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=et(this.doRefresh.bind(this),ka.REFRESH_DEBOUNCE))}removeBaseRoot(t){return me.removeRoot(this.baseRoot,t)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new ka(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}i&&this.childTables.get(s)?.setExpanded(i,e)}else this.childTables.has(s)&&(i?this.childTables.get(s)?.setExpanded(i,e):this.childTables.delete(s));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){po.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){po.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const t=new Promise(n=>{this.doRefresh(n)}),e=ye.makeCancelable(t.then(n=>{if(this.viewportUpdatePromise!==e)throw new Jr;return this.currentViewportData=n,this.sendUpdate(),n}));e.catch(n=>{ye.isCanceled(n)||po.error("Error updating viewport",n)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||po.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,po.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){const{listeners:t}=this,e=this.currentViewportData??{items:[],offset:0};for(let n=0;n<t.length;n+=1)t[n](e)}};let Sp=ka;Sp.REFRESH_DEBOUNCE=50;const GR=Q.module("GrpcFileStorage"),bp=class{constructor(t,e=""){this.tables=[],this.refreshTables=Pn(()=>{this.tables.forEach(n=>n.refresh())},bp.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return me.removeRoot(this.root,t)}addRoot(t){return me.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:me.getBaseName(t)}}async getTable(){const t=new Sp(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:me.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(me.getPath(t)),me.getBaseName(t));if(e.length===0)throw new Fd;if(e.length>1)throw GR.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let wp=bp;wp.REFRESH_THROTTLE=150;const ks=Q.module("AppInit");async function WR(){ks.debug("Loading plugins...");try{const t=await Ma.loadJson("/js-plugins/manifest.json");ks.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Ma.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return ks.info("Plugins loaded:",s),s}catch(t){return ks.error("Unable to load plugins:",t),new Map}}async function zR(t,e){let n;try{n=await LR(t,e)}catch(s){if(!kR(s))throw s}return n}function Pd(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=b.exports.useState(),[C,S]=b.exports.useState(!0),w=b.exports.useCallback(async()=>{try{ks.info("Initializing Web UI","0.31.5",navigator.userAgent);const F=PR(),D=OR();ks.info(`Login using auth type ${D}...`);const[_,U]=await Promise.all([VR(D),BR(D)]);await F.login(_);const H=await WR(),O=await(D===fp.ANONYMOUS&&F.getAsIdeConnection==null?AR():F.getAsIdeConnection());O.addEventListener(I.IdeConnection.HACK_CONNECTION_FAILURE,$e=>{const{detail:at}=$e;ks.error("Connection failure",`${JSON.stringify(at)}`),f(`Unable to connect: ${at.details??"Unknown Error"}`)});const q=await zR(O,U),W="user",z=F.getStorageService(),x=new $R(z,"/layouts"),L=new wp(z,"/notebooks"),P=new gp(x),j=new Hy,oe=await P.load({isConsoleAvailable:q!==void 0}),{data:$}=oe,{settings:G}=$;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:ke.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:Qe.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:ee={}}=G,he=fn.isMacPlatform?ee.mac??{}:ee.windows??{};Object.entries(he).forEach(([$e,at])=>{Ye.get($e)?.setKeyState(at)});const Z={filterSets:$.filterSets,links:$.links},ce=await F.getServerConfigValues(),ge=new Map(ce),Fe={name:W,operateAs:W,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ge.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ge.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(zt.DEFAULT),p(ge),s(j),i(bn,Z),o(L),r(x),l(bn,O),q!==void 0&&a(bn,q),d(H),c(Fe),m(P),u(oe)}catch(F){ks.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),T=b.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{S(!1)}):S(!1)},[]);b.exports.useEffect(function(){w(),T()},[w,T]);const y=e==null&&g==null||C,E=!y&&g==null,R=g!=null?`${g}`:null;return v(Se,{children:[E&&h(NR,{}),h(el,{isLoading:y,isLoaded:E,errorMessage:R}),v("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}Pd.propTypes={workspace:M.exports.shape({}),workspaceStorage:M.exports.shape({close:M.exports.func}),setActiveTool:M.exports.func.isRequired,setCommandHistoryStorage:M.exports.func.isRequired,setDashboardData:M.exports.func.isRequired,setFileStorage:M.exports.func.isRequired,setLayoutStorage:M.exports.func.isRequired,setDashboardConnection:M.exports.func.isRequired,setDashboardSessionWrapper:M.exports.func.isRequired,setPlugins:M.exports.func.isRequired,setUser:M.exports.func.isRequired,setWorkspace:M.exports.func.isRequired,setWorkspaceStorage:M.exports.func.isRequired};Pd.defaultProps={workspace:null,workspaceStorage:null};const qR=t=>({workspace:pl(t),workspaceStorage:lS(t)}),mh=yt(qR,{setActiveTool:Cl,setCommandHistoryStorage:mS,setDashboardData:Qu,setFileStorage:pS,setLayoutStorage:Uy,setDashboardConnection:EE,setDashboardSessionWrapper:yE,setPlugins:fS,setUser:hS,setWorkspace:Fu,setWorkspaceStorage:uS,setServerConfigValues:CS})(Pd);function YR(){return h(ng,{basename:"/ide/",children:v(sg,{children:[h($d,{exact:!0,path:"/",component:mh}),h($d,{path:"/notebook/:notebookPath+",component:mh}),h(ig,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function KR(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}function eI(){return KR(),jr.registerOnLoaded(),lt.init({getWorker:()=>new vf}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,h(gh,{store:Sl,children:h(YR,{})})}export{eI as AppRoot,eI as default};
42
- //# sourceMappingURL=AppRoot.509a9a52.js.map
41
+ Barrage Version: ${i}`,children:"Copy Versions"})]})]})]}),h("div",{className:"app-settings-footer-item",children:h(Yy,{})})]}),h("div",{className:"app-settings-footer-section",children:h("div",{className:"logo",children:h("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1",children:h("img",{src:sp,alt:"Deephaven Data Labs",width:"230px"})})})})]})]})]})}};let ji=Qn;ji.defaultProps={onDone:()=>{}};ji.FORMATTING_SECTION_KEY="SettingsMenu.formatting";ji.COLUMN_SPECIFIC_SECTION_KEY="SettingsMenu.columnFormatting";ji.APPLICATION_SECTION_KEY="ApplicationMenu.settings";ji.SHORTCUT_SECTION_KEY="SettingsMenu.shortcuts";const hh=10;function Ii(t){const{forwardedProps:{menuItem:{action:e,title:n,disabled:s},iconElement:i,displayShortcut:o,isMouseSelected:r,isKeyboardSelected:l,closeMenu:a}}=t,d=b.exports.useRef(),c=b.exports.useRef(),u=b.exports.useRef(null),[m,p]=b.exports.useState(!1),g=b.exports.useCallback(S=>{d.current!=null&&c.current!=null&&u.current&&(Math.abs(d.current-S.clientX)>=hh||Math.abs(c.current-S.clientY)>=hh)&&(p(!0),window.removeEventListener("mousemove",g),a(),e(S),u.current=null)},[e,a]);function f(S){d.current=S.clientX,c.current=S.clientY,u.current=S.target,window.addEventListener("mousemove",g)}function C(S){u.current===S.target&&(p(!0),a(),e(),window.removeEventListener("mousemove",g)),u.current=null}return b.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",g)}},[g]),v("button",{type:"button",className:K("btn-context-menu",{disabled:s},{active:r&&!s},{"keyboard-active":l&&!s}),onMouseDown:f,onMouseUp:C,disabled:m,children:[h("span",{className:K("icon"),children:i}),h("span",{className:"title",children:n}),h("span",{className:"shortcut",children:o})]})}function Ld(t){const{handleControlSelect:e,handleToolSelect:n,onClearFilter:s}=t,i=b.exports.useMemo(()=>[{title:"Input Filter",icon:ff,menuElement:h(Ii,{}),action:o=>{e(un.INPUT_FILTER,o)},order:10},{title:"Dropdown Filter",icon:_h,menuElement:h(Ii,{}),action:o=>{e(un.DROPDOWN_FILTER,o)},order:15},{title:"Markdown Widget",icon:Cf,menuElement:h(Ii,{}),action:o=>{e(un.MARKDOWN,o)},order:20},{title:"Filter Sets",icon:ca,menuElement:h(Ii,{}),action:o=>{e(un.FILTER_SET_MANAGER,o)},order:25},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Tools"}),order:30},{title:"Linker",icon:Ih,action:()=>{n(zt.LINKER)},order:40,shortcut:ls.LINKER},{disabled:!0,menuElement:h("div",{className:"context-menu-group-header",children:"Actions"}),order:50},{title:"Clear All Filters",icon:Sf,action:()=>{s()},order:60,shortcut:en.TABLE.CLEAR_ALL_FILTERS}],[e,n,s]);return h(ns,{popperClassName:"controls-menu-popper",actions:i})}Ld.propTypes={handleControlSelect:M.exports.func,handleToolSelect:M.exports.func,onClearFilter:M.exports.func};Ld.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Ii.propTypes={forwardedProps:M.exports.shape({iconElement:M.exports.node,displayShortcut:M.exports.string,isMouseSelected:M.exports.bool.isRequired,isKeyboardSelected:M.exports.bool.isRequired,closeMenu:M.exports.func.isRequired,menuItem:M.exports.shape({action:M.exports.func,title:M.exports.string,disabled:M.exports.bool}).isRequired})};Ii.defaultProps={forwardedProps:null};const aR=As(np,null),dR={layoutStorage:aR},cR=t=>t.layoutStorage,hR=t=>t.serverConfigValues;Object.entries(dR).map(([t,e])=>Gi.register(t,e));const uh=10;function uR(t){const{onExportLayout:e,onImportLayout:n,onResetLayout:s,onSelect:i,widgets:o=[]}=t,[r,l]=b.exports.useState(!1),[a,d]=b.exports.useState(""),c=b.exports.useRef(null),u=b.exports.useRef(),m=b.exports.useCallback((y,E)=>{y!=null&&i(y,E)},[i]),p=b.exports.useCallback(y=>{d(y.target.value)},[]),g=b.exports.useCallback(y=>{u.current!=null&&(Math.abs(u.current.x-y.clientX)>=uh||Math.abs(u.current.y-y.clientY)>=uh)&&(l(!0),window.removeEventListener("mousemove",g),m(u.current.widget,y),u.current=void 0)},[u,m]),f=b.exports.useCallback((y,E)=>{u.current={x:y.clientX,y:y.clientY,widget:E},window.addEventListener("mousemove",g)},[g]),C=b.exports.useCallback((y,E)=>{window.removeEventListener("mousemove",g),u.current?.widget===E&&(l(!0),m(E)),u.current=void 0},[g,u,m]),S=b.exports.useMemo(()=>o.filter(y=>a?y.name?.toLowerCase().includes(a.toLowerCase()):!0),[a,o]).sort((y,E)=>y.name?.localeCompare(E.name??"")??0),w=b.exports.useMemo(()=>S.map(y=>h("li",{children:v(V,{kind:"ghost","data-testid":`panel-list-item-${y.name??""}-button`,onMouseDown:E=>{f(E,y)},onMouseUp:E=>{C(E,y)},onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&m(y)},disabled:r,onClick:()=>{},children:[h(Hh,{type:y.type})," ",y.name??""]})},y.name)),[S,r,f,C,m]),T=b.exports.useMemo(()=>w.length===0?h("span",{children:"No bound variables found."}):null,[w]);return v("div",{className:"widget-list-container d-flex flex-column",children:[h("div",{className:"widget-list-header",children:h(Bi,{value:a,placeholder:"Find Table, Plot or Widget",onChange:p,ref:c})}),v("ul",{className:"widget-list flex-grow-1",children:[T&&h("li",{className:"widget-list-message",children:T}),!T&&w]}),h("div",{children:h("hr",{})}),v("div",{className:"widget-list-footer",children:[v(V,{kind:"ghost",onClick:e,children:[v("div",{className:"fa-md fa-layers",children:[h(J,{mask:da,icon:jd,transform:"right-5 down-5"}),h(J,{icon:jd,transform:"right-8 down-6"})]}),"Export Layout"]}),v(V,{kind:"ghost",onClick:n,children:[v("div",{className:"fa-md fa-layers",children:[h(J,{mask:da,icon:ha,transform:"right-5 down-5"}),h(J,{icon:ha,transform:"right-8 down-6"})]}),"Import Layout"]}),h(V,{kind:"ghost",icon:ei,onClick:s,tooltip:"Reset Layout"})]})]})}const mR=async(t,e,n)=>{let s,i,o,r;if(Rr(e)?(s=e.settings,i=e.table,o=void 0,r=e.tableSettings):(s={},i="",o=e.figure,r={}),n!==void 0&&(n.tableSettings!=null&&(r=n.tableSettings),n.table!=null&&(i=n.table),n.figure!=null&&(o=n.figure),n.settings!=null&&(s={...s,...n.settings})),o!==void 0){const d={title:o,name:o,type:I.VariableType.FIGURE},c=await t.getObject(d);return Oi.makeModel(s,c)}const l={title:o,name:i,type:I.VariableType.TABLE},a=await t.getObject(l);return te.applyTableSettings(a,r,Ao(Sl.getState())),Oi.makeModelFromSettings(s,a)},pR=async(t,e,n=I.VariableType.TABLE)=>{const{table:s}=e,i={title:s,name:s,type:n},o=await t.getObject(i);return Cd.makeModel(o)};function gR({onAutoFillClick:t=()=>{}}){return v("div",{className:"empty-dashboard-container",children:[v("div",{className:"hint-container",children:[h(J,{icon:Nh})," ",h("br",{}),"Use the panel list to add objects from a query."]}),v("div",{className:"empty-dashboard",children:[h("div",{className:"add-panels-hint",children:"Drag Panels Here"}),h(V,{kind:"tertiary",onClick:t,children:"Auto fill objects"})]})]})}function fR(t){return t.version===2}function CR(t){return Array.isArray(t)}const Tr=Q.module("UserLayoutUtils"),SR={layoutConfig:[{type:"column",content:[{type:"row",height:40,content:[{type:"stack",content:[{type:"react-component",component:Ri.COMPONENT,title:Ri.TITLE,isClosable:!1},{type:"react-component",component:Xr.COMPONENT,title:Xr.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:qr.COMPONENT,title:qr.TITLE,isClosable:!1},{type:"react-component",component:Yr.COMPONENT,title:Yr.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2},bR={layoutConfig:[],links:[],filterSets:[],version:2};function up(t){if(fR(t))return t;if(CR(t))return{layoutConfig:t,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${t}`)}async function wR(t,e=!0){try{const n=await t.getLayouts();if(n.length>0)try{const s=await t.getLayout(n[0]);return up(s)}catch(s){Tr.error("Unable to load layout",n[0],":",s),Tr.warn("No valid layouts found, falling back to default layout")}}catch(n){Tr.error("Unable to fetch layout list",n),Tr.warn("Falling back to default layout")}return e?SR:bR}function TR(t){const{filterSets:e,layoutConfig:n,links:s}=t;return{filterSets:e,layoutConfig:n,links:s,version:2}}const _r={exportLayout:TR,getDefaultLayout:wR,normalizeLayout:up},vr=Q.module("DownloadServiceWorkerUtils"),mp=class{static registerOnLoaded(){new URL("/ide/",window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL("/ide/download/serviceWorker.js",window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),vr.info("Registering service worker on ",e,n)}).catch(n=>{vr.error("Failed to register service worker",n)})}):vr.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(mp.DOWNLOAD_PATH));if(e&&e.active)return vr.info("Download service worker is active."),e.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")}static unregisterSW(){}};let jr=mp;jr.DOWNLOAD_PATH="/download/";const pp={react:de,"react-dom":No,redux:Xp,"react-redux":jp},vR=Zp(pp),ER=Qp({requires:vR}),yR=Jp.createRequires(pp),RR=eg({requires:yR}),IR=Q.module("PluginUtils");class Ma{static loadComponentPlugin(e){if("".split(",").includes(e)){const o=de.lazy(()=>Tf(()=>import(`./internal/${e}`),[])),r=de.forwardRef((l,a)=>h(b.exports.Suspense,{fallback:h("div",{children:"Loading Plugin..."}),children:h(o,{ref:a,...l})}));return r.pluginName=e,r.displayName="Local Plugin",r}const n=new URL("/ide/plugins/",`${window.location}`),s=new URL(`${e}.js`,n),i=de.forwardRef((o,r)=>h(ER,{url:s,render:({err:l,Component:a})=>{if(l!=null&&l!==""){const d=`Error loading plugin ${e} from ${s} due to ${l}`;return IR.error(d),h("div",{className:"error-message",children:`${d}`})}return h(a,{ref:r,...o})}}));return i.pluginName=e,i.displayName="Plugin",i}static async loadModulePlugin(e){return await RR(e)}static async loadJson(e){return new Promise((n,s)=>{const i=new XMLHttpRequest;i.addEventListener("load",()=>{try{const o=JSON.parse(i.responseText);n(o)}catch(o){s(o)}}),i.addEventListener("error",o=>{s(o)}),i.open("GET",e),i.send()})}}const Ot=Q.module("AppMainContainer");class Do extends b.exports.Component{constructor(e){super(e),this.getDashboardPlugins=fe(n=>[...n.entries()].filter(([,s])=>s.DashboardPlugin!=null).map(([s,{DashboardPlugin:i}])=>h(i,{},s))),this.handleSettingsMenuHide=this.handleSettingsMenuHide.bind(this),this.handleSettingsMenuShow=this.handleSettingsMenuShow.bind(this),this.handleError=this.handleError.bind(this),this.handleControlSelect=this.handleControlSelect.bind(this),this.handleToolSelect=this.handleToolSelect.bind(this),this.handleClearFilter=this.handleClearFilter.bind(this),this.handleDataChange=this.handleDataChange.bind(this),this.handleAutoFillClick=this.handleAutoFillClick.bind(this),this.handleGoldenLayoutChange=this.handleGoldenLayoutChange.bind(this),this.handleLayoutConfigChange=this.handleLayoutConfigChange.bind(this),this.handleExportLayoutClick=this.handleExportLayoutClick.bind(this),this.handleImportLayoutClick=this.handleImportLayoutClick.bind(this),this.handleImportLayoutFiles=this.handleImportLayoutFiles.bind(this),this.handleLoadTablePlugin=this.handleLoadTablePlugin.bind(this),this.handleResetLayoutClick=this.handleResetLayoutClick.bind(this),this.handleWidgetMenuClick=this.handleWidgetMenuClick.bind(this),this.handleWidgetsMenuClose=this.handleWidgetsMenuClose.bind(this),this.handleWidgetSelect=this.handleWidgetSelect.bind(this),this.handlePaste=this.handlePaste.bind(this),this.hydrateChart=this.hydrateChart.bind(this),this.hydrateGrid=this.hydrateGrid.bind(this),this.hydratePandas=this.hydratePandas.bind(this),this.hydrateDefault=this.hydrateDefault.bind(this),this.openNotebookFromURL=this.openNotebookFromURL.bind(this),this.importElement=de.createRef(),this.state={contextActions:[{action:()=>{this.handleToolSelect(zt.LINKER)},shortcut:ls.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:en.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ot.debug("Consume unhandled save shortcut")},shortcut:ls.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return wa.hydrate({...e,unzip:s=>bh.loadAsync(s).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Do.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Do.handleWindowBeforeUnload)}initWidgets(){const{connection:e}=this.props;if(e.subscribeToFieldUpdates==null){Ot.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.subscribeToFieldUpdates(n=>{Ot.debug("Got updates",n),this.setState(({widgets:s})=>{const{updated:i,created:o,removed:r}=n,l=[...i,...r],a=s.filter(c=>!l.some(u=>u.name===c.name));return[...i,...o].forEach(c=>{c.name!=null&&c.name!==""&&a.push(c)}),{widgets:a}})})}deinitWidgets(){this.widgetListenerRemover?.()}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const{session:s,sessionConfig:i}=this.props;if(s==null||i==null){Ot.error("No session available to open notebook URL",n);return}const o={id:`/${n}`,itemName:`/${n}`},r=i.type,l={value:null,language:r};this.emitLayoutEvent(Ae.SELECT_NOTEBOOK,s,r,l,o,!0)}}sendClearFilter(){this.emitLayoutEvent(Le.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){this.goldenLayout?.eventHub.emit(e,...n)}handleError(e){ye.isCanceled(e)||Ot.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ot.debug("handleControlSelect",e),e){case un.DROPDOWN_FILTER:this.emitLayoutEvent(Le.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case un.INPUT_FILTER:this.emitLayoutEvent(Le.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case un.MARKDOWN:this.emitLayoutEvent(Lm.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case un.FILTER_SET_MANAGER:this.emitLayoutEvent(Le.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error(`Unrecognized control type ${e}`)}}handleToolSelect(e){Ot.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:s}=this.props;s(n===e?zt.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:s,filterSets:i,links:o}=e;n({closed:s,filterSets:i,links:o})}handleGoldenLayoutChange(e){this.goldenLayout=e}handleLayoutConfigChange(e){const{updateWorkspaceData:n}=this.props;n({layoutConfig:e})}handleWidgetMenuClick(){this.setState(({isPanelsMenuShown:e})=>({isPanelsMenuShown:!e}))}handleWidgetSelect(e,n){this.setState({isPanelsMenuShown:!1}),Ot.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ot.debug("handleAutoFillClick",e);const n=e.sort((s,i)=>s.title!=null&&i.title!=null?s.title.localeCompare(i.title):0);for(let s=0;s<n.length;s+=1)this.openWidget(n[s])}handleExportLayoutClick(){Ot.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,s=_r.exportLayout(n);Ot.info("handleExportLayoutClick exportedConfig",s);const i=new Blob([JSON.stringify(s)],{type:"application/json"}),o=I.i18n.DateTimeFormat.format("yyyy-MM-dd-HHmmss",new Date),r=document.createElement("a");r.href=URL.createObjectURL(i),r.download=`deephaven-app-layout-${o}.json`,r.click()}catch(e){Ot.error("Unable to export layout",e)}}handleImportLayoutClick(){Ot.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current!=null&&(this.importElement.current.value="",this.importElement.current.click())}handleResetLayoutClick(){Ot.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),e.target.files!=null&&this.importLayoutFile(e.target.files?.[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:s}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:l,links:a}=_r.normalizeLayout(o);s({layoutConfig:l}),n(bn,{filterSets:r,links:a})}catch(n){Ot.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e,session:n}=this.props,{filterSets:s,layoutConfig:i,links:o}=await _r.getDefaultLayout(e,n!==void 0),{updateDashboardData:r,updateWorkspaceData:l}=this.props;l({layoutConfig:i}),r(bn,{filterSets:s,links:o})}handlePaste(e){if(e.target instanceof HTMLElement&&e.target.closest(".monaco-editor"))return;const{clipboardData:n}=e,s=n.getData("Text"),i=/“|”/g;i.test(s)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,s.replace(i,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,s=n.get(e);return s!=null&&s.TablePlugin!=null?s.TablePlugin:Ma.loadComponentPlugin(e)}hydrateDefault(e,n){const{connection:s}=this.props,{metadata:i}=e;if(i?.type!=null&&(i?.id!=null||i?.name!=null)){const o=i.id!=null?{type:i.type,id:i.id}:{type:i.type,name:i.name,title:i.name};return{fetch:()=>s.getObject(o),localDashboardId:n,...e}}return wa.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,e.metadata.type??I.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,I.VariableType.PANDAS)}hydrateTable(e,n,s=I.VariableType.TABLE){const{connection:i}=this.props;return{...e,getDownloadWorker:jr.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>pR(i,e.metadata,s)}}hydrateChart(e,n){const{connection:s}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return mR(s,i,o)}}}openWidget(e,n){const{connection:s}=this.props;this.emitLayoutEvent(Ee.OPEN,{dragEvent:n,fetch:()=>s.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:s,workspace:i,serverConfigValues:o}=this.props,{data:r}=i,{layoutConfig:l}=r,{permissions:a}=s,{canUsePanels:d}=a,{contextActions:c,isPanelsMenuShown:u,isSettingsMenuShown:m,widgets:p}=this.state,g=this.getDashboardPlugins(n);return v("div",{className:K("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1,children:[h("nav",{className:"nav-container",children:v("div",{className:"app-main-top-nav-menus",children:[h("img",{src:sp,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),v("div",{children:[v(V,{kind:"ghost",className:"btn-panels-menu",icon:bf,onClick:()=>{},children:["Controls",h(Ld,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})]}),d&&v(V,{kind:"ghost",className:"btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick,icon:wf,children:["Panels",h(nl,{isShown:u,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0,children:h(uR,{widgets:p,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect})})]}),h(V,{kind:"ghost",className:K("btn-settings-menu",{"text-warning":s.operateAs!==s.name}),onClick:this.handleSettingsMenuShow,icon:h(J,{icon:xo,transform:"grow-3 right-1 down-1"}),tooltip:"User Settings"})]})]})}),v(rw,{emptyDashboard:h(gR,{onAutoFillClick:this.handleAutoFillClick}),id:bn,layoutConfig:l,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault,children:[h(Sy,{hydrate:this.hydrateGrid,getDownloadWorker:jr.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),h(uy,{hydrate:this.hydrateChart}),h(my,{}),h(gy,{hydrateConsole:Do.hydrateConsole,notebooksUrl:new URL("/notebooks/",`${window.location}`).href}),h(fy,{}),h(Iy,{hydrate:this.hydratePandas}),h(Ry,{}),h(yy,{}),g]}),h(Ht,{in:m,timeout:je.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0,children:h(ji,{serverConfigValues:o,onDone:this.handleSettingsMenuHide})}),h(le,{actions:c}),h("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles})]})}}const FR=t=>({activeTool:gl(t),dashboardData:Kt(t,bn),layoutStorage:cR(t),plugins:cS(t),connection:vE(t,bn),session:ai(t,bn)?.session,sessionConfig:ai(t,bn)?.config,user:du(t),workspace:pl(t),serverConfigValues:hR(t)}),DR=yt(FR,{setActiveTool:Cl,updateDashboardData:Vn,updateWorkspaceData:Du})(tg(Do));function NR(){return v("div",{className:"app",children:[h(DR,{}),h(Oh,{})]})}const _R=Q.module("LocalWorkspaceStorage"),To=class{static async makeDefaultWorkspaceData(t,e){const{filterSets:n,links:s,layoutConfig:i}=await _r.getDefaultLayout(t,e?.isConsoleAvailable);return{settings:{defaultDateTimeFormat:st.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:st.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:ke.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:Qe.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1,defaultNotebookSettings:{isMinimapEnabled:!1}},layoutConfig:i,closed:[{}],links:s,filterSets:n}}static async makeDefaultWorkspace(t,e){return{data:await To.makeDefaultWorkspaceData(t,e)}}constructor(t){this.layoutStorage=t}async load(t){try{return JSON.parse(localStorage.getItem(To.STORAGE_KEY)??"")}catch{return _R.info("Unable to load workspace data, initializing to default data"),To.makeDefaultWorkspace(this.layoutStorage,t)}}async save(t){return localStorage.setItem(To.STORAGE_KEY,JSON.stringify(t)),t}};let gp=To;gp.STORAGE_KEY="deephaven.WorkspaceStorage";class MR extends Error{constructor(){super(...arguments),this.isNoConsolesError=!0}}function kR(t){return t.isNoConsolesError}const Fi=Q.module("SessionUtils");var fp=(t=>(t.ANONYMOUS="anonymous",t.PARENT="parent",t))(fp||{});function xR(){return new URL("/jsapi",`${window.location}`)}function Cp(){const t=xR();return`${t.protocol}//${t.host}`}function OR(){switch(new URLSearchParams(window.location.search).get("authProvider")){case"parent":return"parent";default:return"anonymous"}}function AR(){const t=Cp();return Fi.info(`Starting connection to '${t}'...`),new I.IdeConnection(t)}async function LR(t,e){Fi.info("Getting console types...");const n=await t.getConsoleTypes();if(Fi.info("Available types:",n),n.length===0)throw new MR("No console types available");const s=n[0];Fi.info("Starting session with type",s);const i=await t.startSession(s),o={type:s,id:Be.generate()};return Fi.info("Console session established",o),{session:i,config:o,connection:t,details:e}}function PR(){const t=Cp();return Fi.info("createCoreClient",t),new I.CoreClient(t)}async function HR(){return ou(zC)}async function UR(){return ou(qC)}async function VR(t){switch(t){case"parent":return HR();case"anonymous":return{type:I.CoreClient.LOGIN_TYPE_ANONYMOUS};default:throw new Error(`Unknown auth type: ${t}`)}}async function BR(t){switch(t){case"parent":return UR();case"anonymous":return{};default:throw new Error(`Unknown auth type: ${t}`)}}class $R{constructor(e,n=""){this.storageService=e,this.root=n}async getLayouts(){return(await this.storageService.listItems(this.root,"*.json")).map(n=>n.basename)}async getLayout(e){const s=await(await this.storageService.loadFile(`${this.root}/${e}`)).text();return JSON.parse(s)}}const po=Q.module("GrpcFileStorageTable"),ka=class{constructor(t,e="",n=e){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.storageService=t,this.baseRoot=e,this.root=n,n===e&&(this.doRefresh=et(this.doRefresh.bind(this),ka.REFRESH_DEBOUNCE))}removeBaseRoot(t){return me.removeRoot(this.baseRoot,t)}getViewportData(){return this.viewportUpdatePromise||this.refreshInternal(),this.viewportUpdatePromise??Promise.resolve({items:[],offset:0})}getSnapshot(t){throw new Error("Method not implemented.")}get size(){return this.currentSize}setExpanded(t,e){const n=t.split("/");let s=n.shift();if((s===void 0||s==="")&&(s=n.shift()),s===void 0||s==="")throw new Error(`Invalid path: ${t}`);const i=n.join("/");if(e){if(!this.childTables.has(s)){const o=new ka(this.storageService,this.baseRoot,`${this.root}/${s}`);this.childTables.set(s,o)}i&&this.childTables.get(s)?.setExpanded(i,e)}else this.childTables.has(s)&&(i?this.childTables.get(s)?.setExpanded(i,e):this.childTables.delete(s));this.currentViewport&&this.refreshInternal()}collapseAll(){this.childTables.clear(),this.currentViewport&&this.refreshInternal()}setSearch(t){throw new Error("Method not implemented.")}setViewport(t){this.currentViewport=t,this.refreshInternal()}setFilters(){throw new Error("Method not implemented.")}setSorts(){throw new Error("Method not implemented.")}setReversed(){throw new Error("Method not implemented.")}close(){this.listeners=[]}onUpdate(t){return this.listeners=[...this.listeners,t],()=>{this.listeners=this.listeners.filter(e=>e!==t)}}doRefresh(t){po.debug2("doRefresh",this.root),t(this.fetchData())}refresh(){po.debug2("refresh",this.root),this.viewportUpdatePromise?.cancel();const t=new Promise(n=>{this.doRefresh(n)}),e=ye.makeCancelable(t.then(n=>{if(this.viewportUpdatePromise!==e)throw new Jr;return this.currentViewportData=n,this.sendUpdate(),n}));e.catch(n=>{ye.isCanceled(n)||po.error("Error updating viewport",n)}),this.viewportUpdatePromise=e}refreshInternal(){try{this.refresh()}catch(t){ye.isCanceled(t)||po.error("Unable to refresh data",t)}}async fetchData(){const{currentViewport:t}=this;if(!t)throw new Error("No viewport set");let n=(await this.storageService.listItems(this.root)).map(s=>({type:s.type,filename:this.removeBaseRoot(s.filename),basename:s.basename,id:this.removeBaseRoot(s.filename),isExpanded:s.type==="directory"?this.childTables.has(s.basename):void 0})).sort((s,i)=>s.type!==i.type?s.type==="directory"?-1:1:s.basename.localeCompare(i.basename));for(let s=0;s<n.length;s+=1){const i=n[s],{basename:o,filename:r}=i;if(r===this.removeBaseRoot(`${this.root}/${o}`)&&i.type==="directory"){const l=this.childTables.get(o);if(l!=null){l.setViewport({top:0,bottom:t.bottom-s});const a=await l.getViewportData();n.splice(s+1,0,...a.items)}}}return this.currentSize=n.length,po.debug2(this.root,"items",n,t),n=n.slice(t.top,t.bottom),{items:n,offset:t.top}}sendUpdate(){const{listeners:t}=this,e=this.currentViewportData??{items:[],offset:0};for(let n=0;n<t.length;n+=1)t[n](e)}};let Sp=ka;Sp.REFRESH_DEBOUNCE=50;const GR=Q.module("GrpcFileStorage"),bp=class{constructor(t,e=""){this.tables=[],this.refreshTables=Pn(()=>{this.tables.forEach(n=>n.refresh())},bp.REFRESH_THROTTLE),this.storageService=t,this.root=e}removeRoot(t){return me.removeRoot(this.root,t)}addRoot(t){return me.addRoot(this.root,t)}async createDirectory(t){return await this.storageService.createDirectory(this.addRoot(t)),this.refreshTables(),{type:"directory",id:t,filename:t,basename:me.getBaseName(t)}}async getTable(){const t=new Sp(this.storageService,this.root);return this.tables.push(t),t}async saveFile(t){const e=dh.storage.FileContents.text(t.content);return await this.storageService.saveFile(this.addRoot(t.filename),e,!0),this.refreshTables(),t}async loadFile(t){const n=await(await this.storageService.loadFile(this.addRoot(t))).text();return{filename:t,basename:me.getBaseName(t),content:n}}async deleteFile(t){await this.storageService.deleteItem(this.addRoot(t)),this.refreshTables()}async moveFile(t,e){await this.storageService.moveItem(this.addRoot(t),this.addRoot(e)),this.refreshTables()}async info(t){const e=await this.storageService.listItems(this.addRoot(me.getPath(t)),me.getBaseName(t));if(e.length===0)throw new Fd;if(e.length>1)throw GR.error("More than one matching file found, should never happen.",e),new Error("More than one matching file found");const n=e[0];return{filename:this.removeRoot(n.filename),basename:n.basename,id:this.removeRoot(n.filename),type:n.type}}};let wp=bp;wp.REFRESH_THROTTLE=150;const ks=Q.module("AppInit");async function WR(){ks.debug("Loading plugins...");try{const t=await Ma.loadJson("/js-plugins/manifest.json");ks.debug("Plugin manifest loaded:",t);const e=[];for(let i=0;i<t.plugins.length;i+=1){const{name:o,main:r}=t.plugins[i],l=`/js-plugins/${o}/${r}`;e.push(Ma.loadModulePlugin(l))}const n=await Promise.all(e),s=new Map;for(let i=0;i<n.length;i+=1){const{name:o}=t.plugins[i];s.set(o,n[i])}return ks.info("Plugins loaded:",s),s}catch(t){return ks.error("Unable to load plugins:",t),new Map}}async function zR(t,e){let n;try{n=await LR(t,e)}catch(s){if(!kR(s))throw s}return n}function Pd(t){const{workspace:e,setActiveTool:n,setCommandHistoryStorage:s,setDashboardData:i,setFileStorage:o,setLayoutStorage:r,setDashboardConnection:l,setDashboardSessionWrapper:a,setPlugins:d,setUser:c,setWorkspace:u,setWorkspaceStorage:m,setServerConfigValues:p}=t,[g,f]=b.exports.useState(),[C,S]=b.exports.useState(!0),w=b.exports.useCallback(async()=>{try{ks.info("Initializing Web UI","0.31.6",navigator.userAgent);const F=PR(),D=OR();ks.info(`Login using auth type ${D}...`);const[_,U]=await Promise.all([VR(D),BR(D)]);await F.login(_);const H=await WR(),O=await(D===fp.ANONYMOUS&&F.getAsIdeConnection==null?AR():F.getAsIdeConnection());O.addEventListener(I.IdeConnection.HACK_CONNECTION_FAILURE,$e=>{const{detail:at}=$e;ks.error("Connection failure",`${JSON.stringify(at)}`),f(`Unable to connect: ${at.details??"Unknown Error"}`)});const q=await zR(O,U),W="user",z=F.getStorageService(),x=new $R(z,"/layouts"),L=new wp(z,"/notebooks"),P=new gp(x),j=new Hy,oe=await P.load({isConsoleAvailable:q!==void 0}),{data:$}=oe,{settings:G}=$;G.defaultDecimalFormatOptions===void 0&&(G.defaultDecimalFormatOptions={defaultFormatString:ke.DEFAULT_FORMAT_STRING}),G.defaultIntegerFormatOptions===void 0&&(G.defaultIntegerFormatOptions={defaultFormatString:Qe.DEFAULT_FORMAT_STRING}),G.truncateNumbersWithPound===void 0&&(G.truncateNumbersWithPound=!1);const{shortcutOverrides:ee={}}=G,he=fn.isMacPlatform?ee.mac??{}:ee.windows??{};Object.entries(he).forEach(([$e,at])=>{Ye.get($e)?.setKeyState(at)});const Z={filterSets:$.filterSets,links:$.links},ce=await F.getServerConfigValues(),ge=new Map(ce),Fe={name:W,operateAs:W,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:ge.get("internal.webClient.appInit.canCopy")!=="false",canDownloadCsv:ge.get("internal.webClient.appInit.canDownloadCsv")!=="false"}};n(zt.DEFAULT),p(ge),s(j),i(bn,Z),o(L),r(x),l(bn,O),q!==void 0&&a(bn,q),d(H),c(Fe),m(P),u(oe)}catch(F){ks.error(F),f(F)}},[n,s,i,o,r,l,a,d,c,u,m,p]),T=b.exports.useCallback(()=>{document.fonts!=null?document.fonts.ready.then(()=>{S(!1)}):S(!1)},[]);b.exports.useEffect(function(){w(),T()},[w,T]);const y=e==null&&g==null||C,E=!y&&g==null,R=g!=null?`${g}`:null;return v(Se,{children:[E&&h(NR,{}),h(el,{isLoading:y,isLoaded:E,errorMessage:R}),v("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4},children:[h("p",{className:"fira-sans-regular",children:"preload"}),h("p",{className:"fira-sans-semibold",children:"preload"}),h("p",{className:"fira-mono",children:"preload"})]})]})}Pd.propTypes={workspace:M.exports.shape({}),workspaceStorage:M.exports.shape({close:M.exports.func}),setActiveTool:M.exports.func.isRequired,setCommandHistoryStorage:M.exports.func.isRequired,setDashboardData:M.exports.func.isRequired,setFileStorage:M.exports.func.isRequired,setLayoutStorage:M.exports.func.isRequired,setDashboardConnection:M.exports.func.isRequired,setDashboardSessionWrapper:M.exports.func.isRequired,setPlugins:M.exports.func.isRequired,setUser:M.exports.func.isRequired,setWorkspace:M.exports.func.isRequired,setWorkspaceStorage:M.exports.func.isRequired};Pd.defaultProps={workspace:null,workspaceStorage:null};const qR=t=>({workspace:pl(t),workspaceStorage:lS(t)}),mh=yt(qR,{setActiveTool:Cl,setCommandHistoryStorage:mS,setDashboardData:Qu,setFileStorage:pS,setLayoutStorage:Uy,setDashboardConnection:EE,setDashboardSessionWrapper:yE,setPlugins:fS,setUser:hS,setWorkspace:Fu,setWorkspaceStorage:uS,setServerConfigValues:CS})(Pd);function YR(){return h(ng,{basename:"/ide/",children:v(sg,{children:[h($d,{exact:!0,path:"/",component:mh}),h($d,{path:"/notebook/:notebookPath+",component:mh}),h(ig,{from:"*",to:"/"})]})})}Boolean(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));function KR(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(t=>{t.forEach(e=>{e.scope.endsWith("/download/")||e.unregister()})})}function eI(){return KR(),jr.registerOnLoaded(),lt.init({getWorker:()=>new vf}),window["__react-beautiful-dnd-disable-dev-warnings"]=!0,h(gh,{store:Sl,children:h(YR,{})})}export{eI as AppRoot,eI as default};
42
+ //# sourceMappingURL=AppRoot.dd6af37e.js.map