@deephaven/code-studio 0.15.5-vite.12 → 0.15.6-vite.19

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,219 +0,0 @@
1
- var rr=Object.defineProperty;var lr=(l,s,e)=>s in l?rr(l,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[s]=e;var v=(l,s,e)=>(lr(l,typeof s!="symbol"?s+"":s,e),e);import{L as O,$ as Ro,a as Vi,b as zs,u as cr,d as S,T as de,D as ko,F as Bn,c as qn,e as dr,v as hr,f as ur,G as Mo,C as re,P as qs,g as Le,B as X,h as mr,i as pr,j as jn,k as Qe,l as ot,m as gr,n as fr,S as Dt,o as yt,p as vn,q as le,r as En,I as ge,s as Hn,t as Er,w as br,x as Cr,y as rs,z as Ae,V as un,A as Sr,E as yr,H as wr,J as vr,K as Fs,R as Bi,M as bn,N as Se,O as Oe,Q as Cn,U as js,W as Ks,X as Zs,Y as Ao,Z as Tr,_ as _r,a0 as Ir,a1 as Oo,a2 as xr,a3 as Uo,a4 as Nt,a5 as Vo,a6 as Ys,a7 as Bo,a8 as Hi,a9 as Ps,aa as Ho,ab as Rs,ac as Dr,ad as Nr,ae as ze,af as Xs,ag as Lr,ah as Js,ai as Fr,aj as $o,ak as ks,al as Ms,am as Sn,an as Pr,ao as Wo,ap as Kn,aq as Rr,ar as kr,as as Qs,at as qe,au as je,av as Mr,aw as As,ax as Bt,ay as tt,az as Ar,aA as Or,aB as Ur,aC as Ce,aD as Vr,aE as Br,aF as Hr,aG as $r,aH as Wr,aI as Gr,aJ as zr,aK as qr,aL as Go,aM as jr,aN as zo,aO as $i,aP as Wi,aQ as Kr,aR as Zr,aS as Yr,aT as Zn,aU as Ge,aV as Vt,aW as ei,aX as ti,aY as qo,aZ as Xr,a_ as ni,a$ as Jr,b0 as Tn,b1 as jo,b2 as Qr,b3 as At,b4 as el,b5 as Gi,b6 as tl,b7 as Ln,b8 as nl,b9 as sl,ba as il,bb as ol,bc as Os,bd as al,be as rl,bf as dn,bg as zi,bh as qi,bi as ll,bj as cl,bk as dl,bl as hl,bm as ul}from"./IrisGridModelFactory.cf1f96cc.js";import{E as ml,z as p,R as a,B as z,C as Ke,D as si,F as pl,G as gl,H as fl,I as El,J as ls,K as ji,L as Ee,A as u,M as ii,N as bl,O as Cl,P as Ko,Q as Zo,S as Yo,T as te,U as Ye,V as Ze,W as G,X as we,Y as Jt,Z as Xo,_ as Sl,$ as Jo,a0 as yl,a1 as wl,a2 as vl,a3 as Tl,a4 as _l,a5 as Qo,a6 as Il,a7 as ea,a8 as xl,a9 as Dl,aa as Nl,ab as Cs,ac as Ll}from"./vendor.6e314c31.js";import{_ as Fl}from"./monaco.175fac7f.js";import{P as Yn,b as Pl,h as Rl,p as kl,o as Ml,s as Al,t as Ol,c as Ss}from"./plotly.f4214248.js";var xe=(l=>(l.DEBUG="D",l.LOG="L",l.WARN="W",l.ERROR="E",l.UNCAUGHT_ERROR="U",l))(xe||{});function sn(l,s){return new CustomEvent(l,{detail:s})}class Ul{constructor(){this.isEnabled=!1,this.handleUncaughtError=s=>{const e=[];s.error&&e.push(s.error),s.message&&e.push(s.message),this.eventTarget.dispatchEvent(sn("U",e))},this.debug=console.debug,this.log=console.log,this.warn=console.warn,this.error=console.error,this.eventTarget=new ml}enable(){this.isEnabled||(console.debug=(...s)=>{this.eventTarget.dispatchEvent(sn("D",s)),this.debug.apply(console,s)},console.log=(...s)=>{this.eventTarget.dispatchEvent(sn("L",s)),this.log.apply(console,s)},console.warn=(...s)=>{this.eventTarget.dispatchEvent(sn("W",s)),this.warn.apply(console,s)},console.error=(...s)=>{this.eventTarget.dispatchEvent(sn("E",s)),this.error.apply(console,s)},window.addEventListener("error",this.handleUncaughtError),O.setLogLevel(O.level),this.isEnabled=!0)}disable(){!this.isEnabled||(console.debug=this.debug,console.log=this.log,console.warn=this.warn,console.error=this.error,window.removeEventListener("error",this.handleUncaughtError),O.setLogLevel(O.level),this.isEnabled=!1)}addEventListener(s,e){this.eventTarget.addEventListener(s,e)}removeEventListener(s,e){this.eventTarget.removeEventListener(s,e)}}class Xn{static formatMessages(s){return s.map(n=>{if(typeof n=="string")return n;let t="";try{t=JSON.stringify(n)}catch{t=n.toString()}return t==="{}"?n.toString():t}).join(" ")}static formatStack(s="",e){if(s==="")return"";let n=s.split(`
2
- `).map(t=>t.trim());switch(e){case xe.ERROR:n=n.splice(s[0]==="Error"?4:3);break;case xe.UNCAUGHT_ERROR:n=n.splice(s[0]==="Error"?3:2);break}return n?` ${n.join(`
3
- `)}`:""}constructor(s){this.history=[],this.offset=0,this.limit=1e4,this.isEnabled=!1,this.proxy=s,this.addHistory=this.addHistory.bind(this)}enable(){this.isEnabled||(this.proxy.addEventListener(xe.DEBUG,this.addHistory),this.proxy.addEventListener(xe.LOG,this.addHistory),this.proxy.addEventListener(xe.WARN,this.addHistory),this.proxy.addEventListener(xe.ERROR,this.addHistory),this.proxy.addEventListener(xe.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!0)}disable(){!this.isEnabled||(this.proxy.removeEventListener(xe.DEBUG,this.addHistory),this.proxy.removeEventListener(xe.LOG,this.addHistory),this.proxy.removeEventListener(xe.WARN,this.addHistory),this.proxy.removeEventListener(xe.ERROR,this.addHistory),this.proxy.removeEventListener(xe.UNCAUGHT_ERROR,this.addHistory),this.isEnabled=!1)}addHistory({type:s,detail:e}){const n={type:s,messages:e,time:new Date};switch(s){case xe.ERROR:case xe.UNCAUGHT_ERROR:n.stack=Error().stack;break}this.history[this.offset%this.limit]=n,this.offset+=1}getHistory(){if(this.offset>this.limit){const s=this.offset%this.limit;this.history=this.history.slice(s).concat(this.history.slice(0,s)),this.offset=this.limit}return this.history}getFormattedHistory(){return this.getHistory().map(e=>`${e.time.toISOString()} ${e.type} ${Xn.formatMessages(e.messages)}`+(e.stack?`
4
- ${Xn.formatStack(e.stack,e.type)}`:"")).join(`
5
- `)}}const oi=({className:l,isFlipped:s,children:e,"data-testid":n})=>{const t=c=>{if(e.length!==2)throw new Error("CardFlip requires 2 children to function");return e[c]},i=p.exports.useRef(null),o=p.exports.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.add("card-flip--is-flipping")},[]),r=p.exports.useCallback(c=>{c.target===c.currentTarget&&document.body.classList.remove("card-flip--is-flipping")},[]);return p.exports.useEffect(function(){if(!i.current)throw Error("ref undefined");i.current.addEventListener("transitionstart",o);const d=i.current;return function(){if(d)return d.removeEventListener("transitionstart",o)}},[o]),a.createElement("div",{className:z(l,{"card-flip--show-front":s,"card-flip--show-back":!s}),"data-testid":n},a.createElement("div",{className:"card-flip--back"},t(0)),a.createElement("div",{ref:i,className:"card-flip--front",onTransitionEnd:r},t(1)))},Vl={groovy:"Groovy",python:"Python",scala:"Scala"};class Ki{static normalizeScriptLanguage(s){return Vl[s]||null}static getDisabledRunTooltip(s,e,n,t){return s?e?null:`${n} doesn't match the session language \u2013 ${t} disabled`:`Console session not connected \u2013 ${t} disabled`}}const ta=Object.freeze({}),Bl=new Map,na=l=>l.user,ai=l=>l.storage,sa=l=>ai(l).commandHistoryStorage,ia=l=>ai(l).fileStorage,Hl=l=>ai(l).workspaceStorage,_n=l=>l.workspace,Fe=l=>_n(l).data.settings,$l=l=>Fe(l).defaultDateTimeFormat,Wl=l=>{var s;return(s=Fe(l).defaultDecimalFormatOptions)!=null?s:ta},Gl=l=>{var s;return(s=Fe(l).defaultIntegerFormatOptions)!=null?s:ta},zl=l=>Fe(l).formatter,cs=l=>Fe(l).timeZone,ql=l=>Fe(l).showTimeZone,jl=l=>Fe(l).showTSeparator,Kl=l=>Fe(l).truncateNumbersWithPound,Zl=l=>Fe(l).shortcutOverrides,ds=l=>l.activeTool,Yl=l=>{var s;return(s=l.plugins)!=null?s:Bl},oa="SET_ACTIVE_TOOL",aa="SET_COMMAND_HISTORY_STORAGE",ra="SET_FILE_STORAGE",la="SET_PLUGINS",ca="SET_USER",da="SET_WORKSPACE",ha="SET_WORKSPACE_STORAGE",Xl=l=>({type:ca,payload:l}),ri=l=>({type:da,payload:l}),Jl=l=>({type:ha,payload:l}),Ql=l=>({type:aa,payload:l}),ec=l=>({type:ra,payload:l}),tc=l=>(s,e)=>{s(ri(l));const{storage:n}=e(),{workspaceStorage:t}=n;return t.save(l)},ua=l=>(s,e)=>{const{workspace:n}=e(),{data:t}=n,i={...n,data:{...t,...l}};return s(tc(i))},ma=l=>s=>s(ua({settings:l})),hs=l=>({type:oa,payload:l}),nc=l=>({type:la,payload:l});function pa(l,s){return(e=s,n)=>{switch(n.type){case l:{const t=n.payload;return t==null?null:e!=null?{...e,...t}:{...t}}default:return e}}}function sc(l,s={},e=!0){return(n=s,t)=>{switch(t.type){case l:{const{id:i,payload:o}=t;return e&&Ke({payload:o},{payload:n[i]})?n:{...n,[i]:o}}default:return n}}}function Mt(l,s){return(e=s,n)=>{switch(n.type){case l:return n.payload;default:return e}}}const ic=Mt(oa,null),oc=Mt(la,null),ac=Mt(aa,null),rc=Mt(ra,null),lc=Mt(ha,null),cc=si({commandHistoryStorage:ac,fileStorage:rc,workspaceStorage:lc}),dc=pa(ca,null),hc=pa(da,null),uc={activeTool:ic,plugins:oc,storage:cc,user:dc,workspace:hc};class mc{constructor(){this.reducers={},this.listener=null}register(s,e){var n;this.reducers={...this.reducers,[s]:e},(n=this.listener)==null||n.call(this,this.reducers)}setListener(s){this.listener=s}}const tn=new mc,Zi=O.module("redux-logger"),pc=l=>s=>e=>{Zi.debug("dispatching",e);const n=s(e);return Zi.debug("next state",l.getState()),n},gc=O.module("redux-crashReporter"),fc=l=>s=>e=>{try{return s(e)}catch(n){throw gc.error("Error executing",e," with state ",l.getState(),":",n),n}},Ec=[pc,fc,pl];Object.entries(uc).map(([l,s])=>tn.register(l,s));const bc=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||El,us=gl(si(tn.reducers),bc(fl(...Ec)));tn.setListener(l=>{us.replaceReducer(si(l))});var ga={exports:{}};(function(l,s){(function(e){var n={config:{},container:{},controls:{},errors:{},items:{},utils:{}};n.utils.F=function(){},n.utils.extend=function(t,i){t.prototype=n.utils.createObject(i.prototype),t.prototype.contructor=t},n.utils.createObject=function(t){return typeof Object.create=="function"?Object.create(t):(n.utils.F.prototype=t,new n.utils.F)},n.utils.objectKeys=function(t){var i,o;if(typeof Object.keys=="function")return Object.keys(t);i=[];for(o in t)i.push(o);return i},n.utils.getHashValue=function(t){var i=location.hash.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},n.utils.getQueryStringParam=function(t){if(window.location.hash)return n.utils.getHashValue(t);if(!window.location.search)return null;var i=window.location.search.substr(1).split("&"),o={},r,c;for(c=0;c<i.length;c++)r=i[c].split("="),o[r[0]]=r[1];return o[t]||null},n.utils.copy=function(t,i){for(var o in i)t[o]=i[o];return t},n.utils.animFrame=function(t){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(i){window.setTimeout(i,1e3/60)})(function(){t()})},n.utils.indexOf=function(t,i){if(!(i instanceof Array))throw new Error("Haystack is not an Array");if(i.indexOf)return i.indexOf(t);for(var o=0;o<i.length;o++)if(i[o]===t)return o;return-1},typeof/./!="function"&&typeof Int8Array!="object"?n.utils.isFunction=function(t){return typeof t=="function"||!1}:n.utils.isFunction=function(t){return toString.call(t)==="[object Function]"},n.utils.fnBind=function(t,i,o){if(Function.prototype.bind!==void 0)return Function.prototype.bind.apply(t,[i].concat(o||[]));var r=function(){var c=(o||[]).concat(Array.prototype.slice.call(arguments,0));if(!(this instanceof r))return t.apply(i,c);t.apply(this,c)};return r.prototype=t.prototype,r},n.utils.removeFromArray=function(t,i){var o=n.utils.indexOf(t,i);if(o===-1)throw new Error("Can't remove item from array. Item is not in the array");i.splice(o,1)},n.utils.now=function(){return typeof Date.now=="function"?Date.now():new Date().getTime()},n.utils.getUniqueId=function(){return(Math.random()*1e15).toString(36).replace(".","")},n.utils.filterXss=function(t,i){var o=t.replace(/javascript/gi,"j&#97;vascript").replace(/expression/gi,"expr&#101;ssion").replace(/onload/gi,"onlo&#97;d").replace(/script/gi,"&#115;cript").replace(/onerror/gi,"on&#101;rror");return i===!0?o:o.replace(/>/g,"&gt;").replace(/</g,"&lt;")},n.utils.stripTags=function(t){return e.trim(t.replace(/(<([^>]+)>)/gi,""))},n.utils.EventEmitter=function(){this._mSubscriptions={},this._mSubscriptions[n.utils.EventEmitter.ALL_EVENT]=[],this.on=function(t,i,o){if(!n.utils.isFunction(i))throw new Error("Tried to listen to event "+t+" with non-function callback "+i);this._mSubscriptions[t]||(this._mSubscriptions[t]=[]),this._mSubscriptions[t].push({fn:i,ctx:o})},this.emit=function(t){var i,o,r;r=Array.prototype.slice.call(arguments,1);var c=this._mSubscriptions[t];if(c)for(c=c.slice(),i=0;i<c.length;i++)o=c[i].ctx||{},c[i].fn.apply(o,r);r.unshift(t);var d=this._mSubscriptions[n.utils.EventEmitter.ALL_EVENT].slice();for(i=0;i<d.length;i++)o=d[i].ctx||{},d[i].fn.apply(o,r)},this.unbind=function(t,i,o){if(!this._mSubscriptions[t])throw new Error("No subscribtions to unsubscribe for event "+t);var r,c=!1;for(r=0;r<this._mSubscriptions[t].length;r++)(!i||this._mSubscriptions[t][r].fn===i)&&(!o||o===this._mSubscriptions[t][r].ctx)&&(this._mSubscriptions[t].splice(r,1),c=!0);if(c===!1)throw new Error("Nothing to unbind for "+t)},this.off=this.unbind,this.trigger=this.emit},n.utils.EventEmitter.ALL_EVENT="__all",n.utils.DragListener=function(t,i){n.utils.EventEmitter.call(this),this._eElement=e(t),this._oDocument=e(document),this._eBody=e(document.body),this._destroyAfterMouseUp=i||!1,this._nDelay=400,this._timeout=null,this._nDistance=10,this._nX=0,this._nY=0,this._nOriginalX=0,this._nOriginalY=0,this._bDragging=!1,this._fMove=n.utils.fnBind(this.onMouseMove,this),this._fUp=n.utils.fnBind(this.onMouseUp,this),this._fDown=n.utils.fnBind(this.onMouseDown,this),this._eElement.on("mousedown",this._fDown)},n.utils.DragListener.timeout=null,n.utils.copy(n.utils.DragListener.prototype,{destroy:function(){this._eElement.unbind("mousedown",this._fDown),this._oDocument.unbind("mouseup",this._fUp),this._eElement=null,this._oDocument=null,this._eBody=null,clearTimeout(this._timeout),this._timeout=null},onMouseDown:function(t){if(t.preventDefault(),t.button===0){var i=this._getCoordinates(t);this._nOriginalX=i.x,this._nOriginalY=i.y,this._oDocument.on("mousemove",this._fMove),this._oDocument.one("mouseup",this._fUp),this._timeout=setTimeout(n.utils.fnBind(this._startDrag,this),this._nDelay)}},onMouseMove:function(t){if(this._timeout!=null){t.preventDefault();var i=this._getCoordinates(t);this._nX=i.x-this._nOriginalX,this._nY=i.y-this._nOriginalY,this._bDragging===!1&&(Math.abs(this._nX)>this._nDistance||Math.abs(this._nY)>this._nDistance)&&this._startDrag(),this._bDragging&&this.emit("drag",this._nX,this._nY,t)}},onMouseUp:function(t){this._timeout!=null&&(clearTimeout(this._timeout),this._oDocument.unbind("mousemove",this._fMove),this._oDocument.unbind("mouseup",this._fUp),this._oDocument.find("iframe").css("pointer-events",""),this._bDragging===!0&&(this._bDragging=!1,this.emit("dragStop",t,this._nOriginalX+this._nX)),this._eBody&&this._eBody.removeClass("lm_dragging"),this._eElement&&this._eElement.removeClass("lm_dragging"),this._destroyAfterMouseUp&&this.destroy())},_startDrag:function(){clearTimeout(this._timeout),this._bDragging=!0,this._eBody.addClass("lm_dragging"),this._eElement.addClass("lm_dragging"),this._oDocument.find("iframe").css("pointer-events","none"),this.emit("dragStart",this._nOriginalX,this._nOriginalY)},_getCoordinates:function(t){return t=t.originalEvent&&t.originalEvent.touches?t.originalEvent.touches[0]:t,{x:t.pageX,y:t.pageY}}}),n.LayoutManager=function(t,i){if(!e||typeof e.noConflict!="function"){var o="jQuery is missing as dependency for GoldenLayout. ";throw o+=`Please either expose $ on GoldenLayout's scope (e.g. window) or add "jquery" to `,o+="your paths when using RequireJS/AMD",new Error(o)}n.utils.EventEmitter.call(this),this.isInitialised=!1,this._isFullPage=!1,this._resizeTimeoutId=null,this._components={"lm-react-component":n.utils.ReactComponentHandler},this._fallbackComponent=void 0,this._itemAreas=[],this._resizeFunction=n.utils.fnBind(this._onResize,this),this._unloadFunction=n.utils.fnBind(this._onUnload,this),this._windowBlur=this._windowBlur.bind(this),this._windowFocus=this._windowFocus.bind(this),this._maximisedItem=null,this._maximisePlaceholder=e('<div class="lm_maximise_place"></div>'),this._creationTimeoutPassed=!1,this._subWindowsCreated=!1,this._dragSources=[],this._updatingColumnsResponsive=!1,this._firstLoad=!0,this.width=null,this.height=null,this.root=null,this.openPopouts=[],this.selectedItem=null,this.isSubWindow=!1,this.eventHub=new n.utils.EventHub(this),this.config=this._createConfig(t),this.container=i,this.dropTargetIndicator=null,this.transitionIndicator=null,this.tabDropPlaceholder=e('<div class="lm_drop_tab_placeholder"></div>'),this.isSubWindow===!0&&e("body").css("visibility","hidden"),this._typeToItem={column:n.utils.fnBind(n.items.RowOrColumn,this,[!0]),row:n.utils.fnBind(n.items.RowOrColumn,this,[!1]),stack:n.items.Stack,component:n.items.Component}},n.LayoutManager.__lm=n,n.LayoutManager.minifyConfig=function(t){return new n.utils.ConfigMinifier().minifyConfig(t)},n.LayoutManager.unminifyConfig=function(t){return new n.utils.ConfigMinifier().unminifyConfig(t)},n.utils.copy(n.LayoutManager.prototype,{registerComponent:function(t,i){if(typeof i!="function"&&(i==null||i.render==null||typeof i.render!="function"))throw new Error("Please register a constructor function");if(this._components[t]!==void 0)throw new Error("Component "+t+" is already registered");this._components[t]=i;function o(){if(this._components[t]===void 0)throw new Error("Component "+t+" is not registered");delete this._components[t]}return o.bind(this)},setFallbackComponent:function(t){this._fallbackComponent=t},toConfig:function(t){var i,o,r;if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");if(t&&!(t instanceof n.items.AbstractContentItem))throw new Error("Root must be a ContentItem");for(i={settings:n.utils.copy({},this.config.settings),dimensions:n.utils.copy({},this.config.dimensions),labels:n.utils.copy({},this.config.labels)},i.content=[],o=function(c,d){var h,m;for(h in d.config)h!=="content"&&(c[h]=d.config[h]);if(c.componentName==="lm-react-component"&&(c.type="react-component"),d.contentItems.length)for(c.content=[],m=0;m<d.contentItems.length;m++)c.content[m]={},o(c.content[m],d.contentItems[m])},t?o(i,{contentItems:[t]}):o(i,this.root),this._$reconcilePopoutWindows(),i.openPopouts=[],r=0;r<this.openPopouts.length;r++)i.openPopouts.push(this.openPopouts[r].toConfig());return i.maximisedItemId=this._maximisedItem?"__glMaximised":null,i},getComponent:function(t){return this._components[t]},getFallbackComponent:function(){return this._fallbackComponent},init:function(){if(this._subWindowsCreated===!1&&(this._createSubWindows(),this._subWindowsCreated=!0),document.readyState==="loading"||document.body===null){e(document).ready(n.utils.fnBind(this.init,this));return}if(this.isSubWindow===!0&&this._creationTimeoutPassed===!1){setTimeout(n.utils.fnBind(this.init,this),7),this._creationTimeoutPassed=!0;return}this.isSubWindow===!0&&this._adjustToWindowMode(),this._setContainer(),this.dropTargetIndicator=new n.controls.DropTargetIndicator(this.container),this.transitionIndicator=new n.controls.TransitionIndicator,this.updateSize(),this._create(this.config),this._bindEvents(),this.isInitialised=!0,this._adjustColumnsResponsive(),this.emit("initialised")},updateSize:function(t,i){arguments.length===2?(this.width=t,this.height=i):(this.width=this.container.width(),this.height=this.container.height()),this.isInitialised===!0&&(this.root.callDownwards("setSize",[this.width,this.height]),this._maximisedItem&&(this._maximisedItem.element.width(this.container.width()),this._maximisedItem.element.height(this.container.height()),this._maximisedItem.callDownwards("setSize")),this._adjustColumnsResponsive())},destroy:function(){this.isInitialised!==!1&&(this._onUnload(),e(window).off("resize",this._resizeFunction),e(window).off("unload beforeunload",this._unloadFunction),e(window).off("blur.lm").off("focus.lm"),this.root.callDownwards("_$destroy",[],!0),this.root.contentItems=[],this.tabDropPlaceholder.remove(),this.dropTargetIndicator.destroy(),this.transitionIndicator.destroy(),this.eventHub.destroy(),this._dragSources.forEach(function(t){t._dragListener.destroy(),t._element=null,t._itemConfig=null,t._dragListener=null}),this._dragSources=[])},createContentItem:function(t,i){var o,r;if(typeof t.type!="string")throw new n.errors.ConfigurationError("Missing parameter 'type'",t);if(t.type==="react-component"&&(t.type="component",t.componentName="lm-react-component"),!this._typeToItem[t.type])throw o="Unknown type '"+t.type+"'. Valid types are "+n.utils.objectKeys(this._typeToItem).join(","),new n.errors.ConfigurationError(o);return t.type==="component"&&!(i instanceof n.items.Stack)&&!!i&&!(this.isSubWindow===!0&&i instanceof n.items.Root)&&(t={type:"stack",width:t.width,height:t.height,content:[t]}),r=new this._typeToItem[t.type](this,t,i),r},createPopout:function(t,i,o,r){var c=t,d=t instanceof n.items.AbstractContentItem,h=this,m,g,f,E,b,y;if(o=o||null,d){for(c=this.toConfig(t).content,o=n.utils.getUniqueId(),E=t.parent,b=t;E.contentItems.length===1&&!E.isRoot;)E=E.parent,b=b.parent;E.addId(o),isNaN(r)&&(r=n.utils.indexOf(b,E.contentItems))}else c instanceof Array||(c=[c]);return!i&&d&&(m=window.screenX||window.screenLeft,g=window.screenY||window.screenTop,f=t.element.offset(),i={left:m+f.left,top:g+f.top,width:t.element.width(),height:t.element.height()}),!i&&!d&&(i={left:window.screenX||window.screenLeft+20,top:window.screenY||window.screenTop+20,width:500,height:309}),d&&t.remove(),y=new n.controls.BrowserPopout(c,i,o,r,this),y.on("initialised",function(){h.emit("windowOpened",y)}),y.on("closed",function(){h._$reconcilePopoutWindows()}),this.openPopouts.push(y),y},createDragSource:function(t,i){this.config.settings.constrainDragToContainer=!1;var o=new n.controls.DragSource(e(t),i,this);return this._dragSources.push(o),o},createDragSourceFromEvent:function(t,i){return this.config.settings.constrainDragToContainer=!1,new n.controls.DragSourceFromEvent(t,this,i)},selectItem:function(t,i){if(this.config.settings.selectionEnabled!==!0)throw new Error("Please set selectionEnabled to true to use this feature");t!==this.selectedItem&&(this.selectedItem!==null&&this.selectedItem.deselect(),t&&i!==!0&&t.select(),this.selectedItem=t,this.emit("selectionChanged",t))},_$maximiseItem:function(t){this._maximisedItem!==null&&this._$minimiseItem(this._maximisedItem),this._maximisedItem=t,this._maximisedItem.addId("__glMaximised"),t.element.addClass("lm_maximised"),t.element.after(this._maximisePlaceholder),this.root.element.prepend(t.element),t.element.width(this.container.width()),t.element.height(this.container.height()),t.callDownwards("setSize"),this._maximisedItem.emit("maximised"),this.emit("stateChanged")},_$minimiseItem:function(t){t.element.removeClass("lm_maximised"),t.removeId("__glMaximised"),this._maximisePlaceholder.after(t.element),this._maximisePlaceholder.remove(),t.parent.callDownwards("setSize"),this._maximisedItem=null,t.emit("minimised"),this.emit("stateChanged")},_$closeWindow:function(){window.setTimeout(function(){window.close()},1)},_$getArea:function(t,i){var o,r,c=1/0,d=null;for(o=0;o<this._itemAreas.length;o++)r=this._itemAreas[o],t>r.x1&&t<r.x2&&i>r.y1&&i<r.y2&&c>r.surface&&(c=r.surface,d=r);return d},_$createRootItemAreas:function(){var t=50,i={y2:"y1",x2:"x1",y1:"y2",x1:"x2"};for(var o in i){var r=this.root._$getArea();r.side=o,i[o][1]=="2"?r[o]=r[i[o]]-t:r[o]=r[i[o]]+t,r.surface=(r.x2-r.x1)*(r.y2-r.y1),this._itemAreas.push(r)}},_$calculateItemAreas:function(){var t,i,o=this._getAllContentItems();if(this._itemAreas=[],o.length===1){this._itemAreas.push(this.root._$getArea());return}for(this._$createRootItemAreas(),t=0;t<o.length;t++)if(!!o[t].isStack&&(i=o[t]._$getArea(),i!==null))if(i instanceof Array)this._itemAreas=this._itemAreas.concat(i);else{this._itemAreas.push(i);var r={};n.utils.copy(r,i),n.utils.copy(r,i.contentItem._contentAreaDimensions.header.highlightArea),r.surface=(r.x2-r.x1)*(r.y2-r.y1),this._itemAreas.push(r)}},_$normalizeContentItem:function(t,i){if(!t)throw new Error("No content item defined");if(n.utils.isFunction(t)&&(t=t()),t instanceof n.items.AbstractContentItem)return t;if(e.isPlainObject(t)&&t.type){var o=this.createContentItem(t,i);return o.callDownwards("_$init"),o}else throw new Error("Invalid contentItem")},_$reconcilePopoutWindows:function(){var t=[],i;for(i=0;i<this.openPopouts.length;i++)this.openPopouts[i].getWindow().closed===!1?t.push(this.openPopouts[i]):this.emit("windowClosed",this.openPopouts[i]);this.openPopouts.length!==t.length&&(this.emit("stateChanged"),this.openPopouts=t)},_getAllContentItems:function(){var t=[],i=function(o){if(t.push(o),o.contentItems instanceof Array)for(var r=0;r<o.contentItems.length;r++)i(o.contentItems[r])};return i(this.root),t},_bindEvents:function(){this._isFullPage&&e(window).resize(this._resizeFunction),e(window).on("unload beforeunload",this._unloadFunction).on("blur.lm",this._windowBlur).on("focus.lm",this._windowFocus)},_windowBlur:function(){this.root.element.addClass("lm_window_blur")},_windowFocus:function(){this.root.element.removeClass("lm_window_blur")},_onResize:function(){clearTimeout(this._resizeTimeoutId),this._resizeTimeoutId=setTimeout(n.utils.fnBind(this.updateSize,this),100)},_createConfig:function(t){var i=n.utils.getQueryStringParam("gl-window");i&&(this.isSubWindow=!0,t=localStorage.getItem(i),t=JSON.parse(t),t=new n.utils.ConfigMinifier().unminifyConfig(t),localStorage.removeItem(i)),t=e.extend(!0,{},n.config.defaultConfig,t);var o=function(r){for(var c in r)c!=="props"&&typeof r[c]=="object"?o(r[c]):c==="type"&&r[c]==="react-component"&&(r.type="component",r.componentName="lm-react-component")};return o(t),t.settings.hasHeaders===!1&&(t.dimensions.headerHeight=0),t},_adjustToWindowMode:function(){var t=e('<div class="lm_popin" title="'+this.config.labels.popin+'"><div class="lm_icon"></div><div class="lm_bg"></div></div>');t.click(n.utils.fnBind(function(){this.emit("popIn")},this)),document.title=n.utils.stripTags(this.config.content[0].title),e("head").append(e("body link, body style, template, .gl_keep")),this.container=e("body").html("").css("visibility","visible").append(t),document.body.offsetHeight,window.__glInstance=this},_createSubWindows:function(){var t,i;for(t=0;t<this.config.openPopouts.length;t++)i=this.config.openPopouts[t],this.createPopout(i.content,i.dimensions,i.parentId,i.indexInParent)},_setContainer:function(){var t=e(this.container||"body");if(t.length===0)throw new Error("GoldenLayout container not found");if(t.length>1)throw new Error("GoldenLayout more than one container element specified");t[0]===document.body&&(this._isFullPage=!0,e("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"})),this.container=t},_create:function(t){var i;if(!(t.content instanceof Array))throw t.content===void 0?i="Missing setting 'content' on top level of configuration":i="Configuration parameter 'content' must be an array",new n.errors.ConfigurationError(i,t);if(t.content.length>1)throw i="Top level content can't contain more then one element.",new n.errors.ConfigurationError(i,t);this.root=new n.items.Root(this,{content:t.content},this.container),this.root.callDownwards("_$init"),t.maximisedItemId==="__glMaximised"&&this.root.getItemsById(t.maximisedItemId)[0].toggleMaximise()},_onUnload:function(){if(this.config.settings.closePopoutsOnUnload===!0)for(var t=0;t<this.openPopouts.length;t++)this.openPopouts[t].close()},_adjustColumnsResponsive:function(){if(!this._useResponsiveLayout()||this._updatingColumnsResponsive||!this.config.dimensions||!this.config.dimensions.minItemWidth||this.root.contentItems.length===0||!this.root.contentItems[0].isRow){this._firstLoad=!1;return}this._firstLoad=!1;var t=this.root.contentItems[0].contentItems.length;if(!(t<=1)){var i=this.config.dimensions.minItemWidth,o=t*i;if(!(o<=this.width)){this._updatingColumnsResponsive=!0;for(var r=Math.max(Math.floor(this.width/i),1),c=t-r,d=this.root.contentItems[0],h=this._findAllStackContainers()[0],m=0;m<c;m++){var g=d.contentItems[d.contentItems.length-1];this._addChildContentItemsToContainer(h,g)}this._updatingColumnsResponsive=!1}}},_useResponsiveLayout:function(){return this.config.settings&&(this.config.settings.responsiveMode=="always"||this.config.settings.responsiveMode=="onload"&&this._firstLoad)},_addChildContentItemsToContainer:function(t,i){i.type==="stack"?i.contentItems.forEach(function(o){t.addChild(o),i.removeChild(o,!0)}):i.contentItems.forEach(n.utils.fnBind(function(o){this._addChildContentItemsToContainer(t,o)},this))},_findAllStackContainers:function(){var t=[];return this._findAllStackContainersRecursive(t,this.root),t},_findAllStackContainersRecursive:function(t,i){i.contentItems.forEach(n.utils.fnBind(function(o){o.type=="stack"?t.push(o):o.isComponent||this._findAllStackContainersRecursive(t,o)},this))}}),function(){l.exports=n.LayoutManager}(),n.config.itemDefaultConfig={isClosable:!0,isFocusOnShow:!0,reorderEnabled:!0,title:""},n.config.defaultConfig={openPopouts:[],settings:{hasHeaders:!0,constrainDragToContainer:!0,reorderEnabled:!0,selectionEnabled:!1,popoutWholeStack:!1,blockedPopoutsThrowError:!0,closePopoutsOnUnload:!0,showPopoutIcon:!0,showMaximiseIcon:!0,showCloseIcon:!0,responsiveMode:"onload",tabOverlapAllowance:0,tabControlOffset:10},dimensions:{borderWidth:5,borderGrabWidth:10,minItemHeight:10,minItemWidth:10,headerHeight:20,dragProxyWidth:300,dragProxyHeight:200},labels:{close:"Close",maximise:"Maximize",minimise:"Minimize",popout:"Open in new window",popin:"Pop in",tabDropdown:"Additional tabs",tabNextLabel:"Next",tabPreviousLabel:"Previous"}},n.container.ItemContainer=function(t,i,o){n.utils.EventEmitter.call(this),this.width=null,this.height=null,this.title=t.componentName,this.parent=i,this.layoutManager=o,this.isHidden=!1,this._config=t,this._element=e(['<div class="lm_item_container">','<div class="lm_content" tabindex="-1"></div>',"</div>"].join("")),this._contentElement=this._element.find(".lm_content")},n.utils.copy(n.container.ItemContainer.prototype,{getElement:function(){return this._contentElement},hide:function(){this.emit("hide"),this.isHidden=!0,this._element.hide()},show:function(){this.emit("show"),this.isHidden=!1,this._element.show(),(this.height!=0||this.width!=0)&&this.emit("shown")},setSize:function(t,i){for(var o=this.parent,r=this,c,d,h,m,g,f;!o.isColumn&&!o.isRow;)if(r=o,o=o.parent,o.isRoot)return!1;for(h=o.isColumn?"height":"width",m=h==="height"?i:t,c=this[h]*(1/(r.config[h]/100)),d=m/c*100,g=(r.config[h]-d)/(o.contentItems.length-1),f=0;f<o.contentItems.length;f++)o.contentItems[f]===r?o.contentItems[f].config[h]=d:o.contentItems[f].config[h]+=g;return o.callDownwards("setSize"),!0},close:function(){this._config.isClosable&&(this.emit("close"),this.parent.close())},getState:function(){return this._config.componentState},extendState:function(t){this.setState(e.extend(!0,this.getState(),t))},setState:function(t){this._config.componentState=t,this.parent.emitBubblingEvent("stateChanged")},setTitle:function(t){this.parent.setTitle(t)},_$setSize:function(t,i){if(t!==this.width||i!==this.height){this.width=t,this.height=i;var o=this._contentElement[0],r=o.offsetWidth-o.clientWidth,c=o.offsetHeight-o.clientHeight;this._contentElement.width(this.width-r).height(this.height-c),this.emit("resize")}}}),n.controls.BrowserPopout=function(t,i,o,r,c){n.utils.EventEmitter.call(this),this.isInitialised=!1,this._config=t,this._dimensions=i,this._parentId=o,this._indexInParent=r,this._layoutManager=c,this._popoutWindow=null,this._id=null,this._createWindow()},n.utils.copy(n.controls.BrowserPopout.prototype,{toConfig:function(){if(this.isInitialised===!1)throw new Error("Can't create config, layout not yet initialised");return{dimensions:{width:this.getGlInstance().width,height:this.getGlInstance().height,left:this._popoutWindow.screenX||this._popoutWindow.screenLeft,top:this._popoutWindow.screenY||this._popoutWindow.screenTop},content:this.getGlInstance().toConfig().content,parentId:this._parentId,indexInParent:this._indexInParent}},getGlInstance:function(){return this._popoutWindow.__glInstance},getWindow:function(){return this._popoutWindow},close:function(){if(this.getGlInstance())this.getGlInstance()._$closeWindow();else try{this.getWindow().close()}catch{}},popIn:function(){var t,i;this._indexInParent,this._parentId&&(t=e.extend(!0,{},this.getGlInstance().toConfig()).content[0],i=this._layoutManager.root.getItemsById(this._parentId)[0],i||(this._layoutManager.root.contentItems.length>0?i=this._layoutManager.root.contentItems[0]:i=this._layoutManager.root)),i.addChild(t,this._indexInParent),this.close()},_createWindow:function(){var t,i=this._createUrl(),o=Math.floor(Math.random()*1e6).toString(36),r=this._serializeWindowOptions({width:this._dimensions.width,height:this._dimensions.height,innerWidth:this._dimensions.width,innerHeight:this._dimensions.height,menubar:"no",toolbar:"no",location:"no",personalbar:"no",resizable:"yes",scrollbars:"no",status:"no"});if(this._popoutWindow=window.open(i,o,r),!this._popoutWindow)if(this._layoutManager.config.settings.blockedPopoutsThrowError===!0){var c=new Error("Popout blocked");throw c.type="popoutBlocked",c}else return;e(this._popoutWindow).on("load",n.utils.fnBind(this._positionWindow,this)).on("unload beforeunload",n.utils.fnBind(this._onClose,this)),t=setInterval(n.utils.fnBind(function(){this._popoutWindow.__glInstance&&this._popoutWindow.__glInstance.isInitialised&&(this._onInitialised(),clearInterval(t))},this),10)},_serializeWindowOptions:function(t){var i=[],o;for(o in t)i.push(o+"="+t[o]);return i.join(",")},_createUrl:function(){var t={content:this._config},i="gl-window-config-"+n.utils.getUniqueId(),o;t=new n.utils.ConfigMinifier().minifyConfig(t);try{localStorage.setItem(i,JSON.stringify(t))}catch(r){throw new Error("Error while writing to localStorage "+r.toString())}return o=document.location.href.split("?"),o.length===1?o[0]+"?gl-window="+i:document.location.href+"&gl-window="+i},_positionWindow:function(){this._popoutWindow.moveTo(this._dimensions.left,this._dimensions.top),this._popoutWindow.focus()},_onInitialised:function(){this.isInitialised=!0,this.getGlInstance().on("popIn",this.popIn,this),this.emit("initialised")},_onClose:function(){setTimeout(n.utils.fnBind(this.emit,this,["closed"]),50)}}),n.controls.DragProxy=function(t,i,o,r,c,d){n.utils.EventEmitter.call(this),this._dragListener=o,this._layoutManager=r,this._contentItem=c,this._originalParent=d,this._area=null,this._lastValidArea=null,this._dragListener.on("drag",this._onDrag,this),this._dragListener.on("dragStop",this._onDrop,this),this._contentItem.tab&&this._contentItem.tab.element&&(this._layoutManager.tabDropPlaceholder.width(this._contentItem.tab.element.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._contentItem.tab.element.outerHeight(!0))),this.element=e(n.controls.DragProxy._template),d&&d._side&&(this._sided=d._sided,this.element.addClass("lm_"+d._side),["right","bottom"].indexOf(d._side)>=0&&this.element.find(".lm_content").after(this.element.find(".lm_header"))),this.element.css({left:t,top:i}),this._proxyTab=this.element.find(".lm_tab"),this._proxyTab.attr("title",n.utils.stripTags(this._contentItem.config.title)),this.element.find(".lm_title").html(this._contentItem.config.title),this.childElementContainer=this.element.find(".lm_content"),this.childElementContainer.append(c.element),this._updateTree(),this._layoutManager._$calculateItemAreas(),this._setDimensions(),e(document.body).append(this.element),!this._contentItem.tab&&this._proxyTab.length&&(this._layoutManager.tabDropPlaceholder.width(this._proxyTab.outerWidth(!0)),this._layoutManager.tabDropPlaceholder.height(this._proxyTab.outerHeight(!0)));var h=this._layoutManager.container.offset();this._minX=h.left,this._minY=h.top,this._maxX=this._layoutManager.container.width()+this._minX,this._maxY=this._layoutManager.container.height()+this._minY,this._width=this.element.width(),this._height=this.element.height(),this._setDropPosition(t,i),this._layoutManager.emit("itemPickedUp",this._contentItem)},n.controls.DragProxy._template='<div class="lm_dragProxy"><div class="lm_header"><ul class="lm_tabs"><li class="lm_tab lm_active"><i class="lm_left"></i><span class="lm_title"></span><i class="lm_right"></i></li></ul></div><div class="lm_content"></div></div>',n.utils.copy(n.controls.DragProxy.prototype,{_onDrag:function(t,i,o){o=o.originalEvent&&o.originalEvent.touches?o.originalEvent.touches[0]:o;var r=o.pageX,c=o.pageY,d=r>this._minX&&r<this._maxX&&c>this._minY&&c<this._maxY;!d&&this._layoutManager.config.settings.constrainDragToContainer===!0||this._setDropPosition(r,c)},_setDropPosition:function(t,i){this.element.css({left:t,top:i}),this._area=this._layoutManager._$getArea(t,i),this._area!==null&&(this._lastValidArea=this._area,this._area.contentItem._$highlightDropZone(t,i,this._area))},_onDrop:function(){this._layoutManager.dropTargetIndicator.hide(),this._area!==null?this._area.contentItem._$onDrop(this._contentItem,this._area):this._lastValidArea!==null?this._lastValidArea.contentItem._$onDrop(this._contentItem,this._lastValidArea):this._originalParent?this._originalParent.addChild(this._contentItem):this._contentItem._$destroy(),this._dragListener.off("drag",this._onDrag,this),this._dragListener.off("dragStop",this._onDrop,this),this.element.remove(),this._layoutManager.emit("itemDropped",this._contentItem)},_updateTree:function(){this._contentItem.parent&&this._contentItem.parent.removeChild(this._contentItem,!0),this._contentItem._$setParent(this)},_setDimensions:function(){var t=this._layoutManager.config.dimensions,i=t.dragProxyWidth,o=t.dragProxyHeight;this.element.width(i),this.element.height(o),i-=this._sided?t.headerHeight:0,o-=this._sided?0:t.headerHeight,this.childElementContainer.width(i),this.childElementContainer.height(o),this._contentItem.element.width(i),this._contentItem.element.height(o),this._contentItem.callDownwards("_$show"),this._contentItem.callDownwards("setSize")}}),n.controls.DragSource=function(t,i,o){this._element=t,this._itemConfig=i,this._layoutManager=o,this._dragListener=null,this._createDragListener()},n.utils.copy(n.controls.DragSource.prototype,{_createDragListener:function(){this._dragListener=new n.utils.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._createDragListener,this)},_onDragStart:function(t,i){var o=this._itemConfig;n.utils.isFunction(o)&&(o=o());var r=this._layoutManager._$normalizeContentItem(e.extend(!0,{},o)),c=new n.controls.DragProxy(t,i,this._dragListener,this._layoutManager,r,null);this._layoutManager.transitionIndicator.transitionElements(this._element,c.element)}}),n.controls.DragSourceFromEvent=function(t,i,o){this._element=e(window),this._itemConfig=t,this._layoutManager=i,this._dragListener=null,this._createDragListener(o)},n.utils.copy(n.controls.DragSourceFromEvent.prototype,{_createDragListener:function(t){this._dragListener!==null&&this._dragListener.destroy(),this._dragListener=new n.utils.DragListener(this._element,!0),this._dragListener.on("dragStart",this._onDragStart,this),this._dragListener.on("dragStop",this._destroy,this),this._dragListener._fDown(t),this._dragListener._startDrag()},_destroy:function(){this._dragListener=null,this._element=null,this._itemConfig=null,this._layoutManager=null},_onDragStart:function(t,i){var o=this._itemConfig;n.utils.isFunction(o)&&(o=o());var r=this._layoutManager._$normalizeContentItem(e.extend(!0,{},o));new n.controls.DragProxy(t,i,this._dragListener,this._layoutManager,r,null)}}),n.controls.DropTargetIndicator=function(){this.element=e(n.controls.DropTargetIndicator._template),e(document.body).append(this.element)},n.controls.DropTargetIndicator._template='<div class="lm_dropTargetIndicator"><div class="lm_inner"></div></div>',n.utils.copy(n.controls.DropTargetIndicator.prototype,{destroy:function(){this.element.remove()},highlightArea:function(t){this.element.css({left:t.x1,top:t.y1,width:Math.floor(t.x2-t.x1),height:Math.floor(t.y2-t.y1)}).show()},hide:function(){this.element.hide()}}),n.controls.Header=function(t,i){n.utils.EventEmitter.call(this),this.layoutManager=t,this.element=e(n.controls.Header._template),this.layoutManager.config.settings.selectionEnabled===!0&&(this.element.addClass("lm_selectable"),this.element.on("click",n.utils.fnBind(this._onHeaderClick,this))),this.tabsContainer=this.element.find(".lm_tabs"),this.tabDropdownContainer=this.element.find(".lm_tabdropdown_list"),this.tabDropdownContainer.hide(),this.tabDropdownSearch=this.element.find(".lm_tabdropdown_search input"),this.tabDropdownList=null,this._handleFilterInput=this._handleFilterInput.bind(this),this._handleFilterKeydown=this._handleFilterKeydown.bind(this),this.tabDropdownSearch.on("input",this._handleFilterInput),this.tabDropdownSearch.on("keydown",this._handleFilterKeydown),this.controlsContainer=this.element.find(".lm_controls"),this.parent=i,this.parent.on("resize",this._updateTabSizes,this),this.tabs=[],this.activeContentItem=null,this.closeButton=null,this.tabDropdownButton=null,this.tabNextButton=e(n.controls.Header._nextButtonTemplate),this.tabPreviousButton=e(n.controls.Header._previousButtonTemplate),this._handleItemPickedUp=this._handleItemPickedUp.bind(this),this._handleItemDropped=this._handleItemDropped.bind(this),this._handleNextMouseEnter=this._handleNextMouseEnter.bind(this),this._handleNextMouseLeave=this._handleNextMouseLeave.bind(this),this._handlePreviousMouseEnter=this._handlePreviousMouseEnter.bind(this),this._handlePreviousMouseLeave=this._handlePreviousMouseLeave.bind(this),this._handleScrollRepeat=this._handleScrollRepeat.bind(this),this._handleNextButtonMouseDown=this._handleNextButtonMouseDown.bind(this),this._handlePreviousButtonMouseDown=this._handlePreviousButtonMouseDown.bind(this),this._handleScrollButtonMouseDown=this._handleScrollButtonMouseDown.bind(this),this._handleScrollButtonMouseUp=this._handleScrollButtonMouseUp.bind(this),this._handleScrollEvent=this._handleScrollEvent.bind(this),this.tabNextButton.on("mousedown",this._handleNextButtonMouseDown),this.tabPreviousButton.on("mousedown",this._handlePreviousButtonMouseDown),this.tabsContainer.on("scroll",this._handleScrollEvent),this.holdTimer=null,this.rAF=null,this.CLICK_TIMEOUT=500,this.START_SPEED=.01,this.ACCELERATION=5e-4,this.SCROLL_LEFT="left",this.SCROLL_RIGHT="right",this.layoutManager.on("itemPickedUp",this._handleItemPickedUp),this.layoutManager.on("itemDropped",this._handleItemDropped),this.isDraggingTab=!1,this.isOverflowing=!1,this.isDropdownShown=!1,this.dropdownKeyIndex=0,this.tabsContainer.before(this.tabPreviousButton),this.tabPreviousButton=this.tabPreviousButton.find(">:first-child"),this.tabPreviousButton.hide(),this._showAdditionalTabsDropdown=this._showAdditionalTabsDropdown.bind(this),this._hideAdditionalTabsDropdown=this._hideAdditionalTabsDropdown.bind(this),this._lastVisibleTabIndex=-1,this._tabControlOffset=this.layoutManager.config.settings.tabControlOffset,this._createControls()},n.controls.Header._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list">','<li class="lm_tabdropdown_search"><input type="text" placeholder="Find tab..."></li>',"</ul>","</div>"].join(""),n.controls.Header._previousButtonTemplate=['<ul class="lm_controls">','<li class="lm_tabpreviousbutton"></li>',"</ul>"].join(""),n.controls.Header._nextButtonTemplate=['<li class="lm_tabnextbutton"></li>'].join(""),n.utils.copy(n.controls.Header.prototype,{createTab:function(t,i){var o,r;for(r=0;r<this.tabs.length;r++)if(this.tabs[r].contentItem===t)return;if(o=new n.controls.Tab(this,t),this.tabs.length===0){this.tabs.push(o),this.tabsContainer.append(o.element);return}i===void 0&&(i=this.tabs.length),i>0?this.tabs[i-1].element.after(o.element):this.tabs[0].element.before(o.element),this.tabs.splice(i,0,o),this._updateTabSizes()},removeTab:function(t){for(var i=0;i<this.tabs.length;i++)if(this.tabs[i].contentItem===t){this.tabs[i]._$destroy(),this.tabs.splice(i,1);return}throw new Error("contentItem is not controlled by this header")},setActiveContentItem:function(t){for(var i,o=0;o<this.tabs.length;o++)i=this.tabs[o].contentItem===t,this.tabs[o].setActive(i),i===!0&&(this.activeContentItem=t,this.parent.config.activeItemIndex=o);this.tabs[this.parent.config.activeItemIndex].element.get(0).scrollIntoView({inline:"nearest"}),this._hideAdditionalTabsDropdown(),this._updateTabSizes(),this.parent.emitBubblingEvent("stateChanged")},position:function(t){var i=this.parent._header.show;return i&&!this.parent._side&&(i="top"),t!==void 0&&this.parent._header.show!==t&&(this.parent._header.show=t,this.parent._setupHeaderPosition()),i},_attachWheelListener:function(){this.tabsContainer.get(0).addEventListener("wheel",this._handleWheelEvent,{passive:!0})},_detachWheelListener:function(){this.tabsContainer.get(0).removeEventListener("wheel",this._handleWheelEvent,{passive:!0})},_handleWheelEvent:function(t){var i=t.currentTarget,o=Math.abs(t.deltaY)>Math.abs(t.deltaX)?t.deltaY:t.deltaX;t.deltaMode===WheelEvent.DOM_DELTA_PAGE?o*=this.tabsContainer.innerWidhth():t.deltaMode===WheelEvent.DOM_DELTA_LINE&&(o*=100/3),i.scrollLeft+=Math.round(o)},_handleScrollEvent:function(){this._checkScrollArrows()},_handleItemPickedUp:function(){this.isDraggingTab=!0,this.controlsContainer.on("mouseenter",this._handleNextMouseEnter),this.tabPreviousButton.on("mouseenter",this._handlePreviousMouseEnter)},_handleItemDropped:function(){this.isDraggingTab=!1,this.rAF=window.cancelAnimationFrame(this.rAF),this.controlsContainer.off("mouseenter",this._handleNextMouseEnter),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave),this.tabPreviousButton.off("mouseenter",this._handlePreviousMouseEnter),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)},_handleNextMouseEnter:function(){this.controlsContainer.on("mouseleave",this._handleNextMouseLeave),this._handleScrollRepeat(this.SCROLL_RIGHT,this.tabsContainer.scrollLeft())},_handlePreviousMouseEnter:function(){this.tabPreviousButton.on("mouseleave",this._handlePreviousMouseLeave),this._handleScrollRepeat(this.SCROLL_LEFT,this.tabsContainer.scrollLeft())},_handleNextMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.controlsContainer.off("mouseleave",this._handleNextMouseLeave)},_handlePreviousMouseLeave:function(){this.rAF=window.cancelAnimationFrame(this.rAF),this.tabPreviousButton.off("mouseleave",this._handlePreviousMouseLeave)},_handleNextButtonMouseDown:function(){for(var t,i=0;i<this.tabs.length;i+=1)if(this.tabs[i].element.get(0).offsetLeft>this.tabsContainer.get(0).offsetWidth+this.tabsContainer.scrollLeft()){t=this.tabs[i].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"nearest"}),this._handleScrollButtonMouseDown(this.SCROLL_RIGHT)):this.tabsContainer.get(0).scrollLeft=this.tabsContainer.get(0).scrollWidth},_handlePreviousButtonMouseDown:function(){for(var t,i=this.tabs.length-1;i>=0;i-=1)if(this.tabs[i].element.get(0).offsetLeft<this.tabsContainer.scrollLeft()){t=this.tabs[i].element.get(0);break}t?(t.scrollIntoView({behavior:"smooth",inline:"start"}),this._handleScrollButtonMouseDown(this.SCROLL_LEFT)):this.tabsContainer.get(0).scrollLeft=0},_handleScrollButtonMouseDown:function(t){this.holdTimer=setTimeout(function(){this._handleScrollRepeat(t,this.tabsContainer.scrollLeft(),100)}.bind(this),this.CLICK_TIMEOUT),window.addEventListener("mouseup",this._handleScrollButtonMouseUp)},_handleScrollButtonMouseUp:function(){this.holdTimer=clearTimeout(this.holdTimer),this.rAF=cancelAnimationFrame(this.rAF),window.removeEventListener("mouseup",this._handleScrollButtonMouseUp)},_checkScrollArrows:function(){this.tabsContainer.scrollLeft()===0?this.tabPreviousButton.first().attr("disabled",!0):this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth?this.tabNextButton.attr("disabled",!0):(this.tabNextButton.attr("disabled",!1),this.tabPreviousButton.first().attr("disabled",!1))},_handleScrollRepeat:function(t,i,o,r){o||(o=0);var c=this.tabsContainer.get(0).getBoundingClientRect();if(t===this.SCROLL_LEFT){if(this.tabsContainer.scrollLeft(i-o),this.isDraggingTab&&this.parent._highlightHeaderDropZone(c.left-1),this.tabsContainer.scrollLeft()===0){this._checkScrollArrows();return}}else if(t===this.SCROLL_RIGHT&&(this.tabsContainer.scrollLeft(i+o),this.isDraggingTab&&this.parent._highlightHeaderDropZone(c.right+1),this.tabsContainer.scrollLeft()+this.tabsContainer.innerWidth()===this.tabsContainer.get(0).scrollWidth)){this._checkScrollArrows();return}window.cancelAnimationFrame(this.rAF),this.rAF=window.requestAnimationFrame(function(d){var h=r||d,m=d-h,g=this.START_SPEED*m+.5*this.ACCELERATION*(m*m);g=Math.min(g,this.tabsContainer.get(0).scrollWidth),this._handleScrollRepeat(t,i,g,h)}.bind(this))},_$setClosable:function(t){return this.closeButton&&this._isClosable()?(this.closeButton.element[t?"show":"hide"](),!0):!1},_$destroy:function(){this.emit("destroy",this);for(var t=0;t<this.tabs.length;t++)this.tabs[t]._$destroy();this._detachWheelListener(),this._handleItemDropped(),e(document).off("mouseup",this._hideAdditionalTabsDropdown),this.tabDropdownSearch.off("input",this._handleFilterInput),this.tabDropdownSearch.off("keydown",this._handleFilterKeydown),this.element.remove()},_getHeaderSetting:function(t){if(t in this.parent._header)return this.parent._header[t]},_createControls:function(){var t,i,o,r,c,d,h,m;m=this.layoutManager.config.labels.tabDropdown,this.layoutManager.config.labels.tabNextLabel,this.layoutManager.config.labels.tabPreviousLabel,this.tabDropdownButton=new n.controls.HeaderButton(this,m,"lm_tabdropdown",this._showAdditionalTabsDropdown),this.tabDropdownButton.element.hide(),this.controlsContainer.prepend(this.tabNextButton),this.tabNextButton.hide(),this._getHeaderSetting("popout")&&(i=n.utils.fnBind(this._onPopoutClick,this),o=this._getHeaderSetting("popout"),new n.controls.HeaderButton(this,o,"lm_popout",i)),this._getHeaderSetting("maximise")&&(d=n.utils.fnBind(this.parent.toggleMaximise,this.parent),r=this._getHeaderSetting("maximise"),c=this._getHeaderSetting("minimise"),h=new n.controls.HeaderButton(this,r,"lm_maximise",d),this.parent.on("maximised",function(){h.element.attr("title",c)}),this.parent.on("minimised",function(){h.element.attr("title",r)})),this._isClosable()&&(t=n.utils.fnBind(this.parent.remove,this.parent),o=this._getHeaderSetting("close"),this.closeButton=new n.controls.HeaderButton(this,o,"lm_close",t))},_showAdditionalTabsDropdown:function(){if(this.isDropdownShown){this._hideAdditionalTabsDropdown();return}this.tabDropdownList=this.tabsContainer.clone(!0).appendTo(this.tabDropdownContainer).children().removeClass("lm_active"),this.tabDropdownContainer.show(),this.isDropdownShown=!0,this.element.addClass("lm_dropdown_open"),this.tabDropdownSearch.val("").focus(),this.dropdownKeyIndex=0,this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"),e(document).on("mousedown",this._hideAdditionalTabsDropdown),this._updateAdditionalTabsDropdown()},_handleFilterKeydown:function(t){if(this.dropdownKeyIndex===-1)return;if(t.key==="Escape"){this._hideAdditionalTabsDropdown();return}if(t.key==="Enter"||t.key===" "){this._hideAdditionalTabsDropdown(),this.tabs[this.dropdownKeyIndex]._onTabClick();return}function i(o,r,c){if(c.length<2)return-1;for(var d=(o+r+c.length)%c.length;d!==o;){if(c.eq(d).css("display")!=="none")return d;d=(d+r+c.length)%c.length}return o}t.key==="ArrowDown"||t.key==="Tab"&&t.shiftKey===!1?(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=i(this.dropdownKeyIndex,1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")):(t.key==="ArrowUp"||t.key==="Tab")&&(t.preventDefault(),this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=i(this.dropdownKeyIndex,-1,this.tabDropdownList),this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active"))},_handleFilterInput:function(t){this.tabDropdownList.eq(this.dropdownKeyIndex).removeClass("lm_keyboard_active"),this.dropdownKeyIndex=-1;for(var i=0;i<this.tabDropdownList.length;i++)this.tabs[i].contentItem.config.title.toLowerCase().indexOf(t.target.value.toLowerCase())!==-1?(this.tabDropdownList.eq(i).css("display",""),this.dropdownKeyIndex===-1&&(this.dropdownKeyIndex=i)):this.tabDropdownList.eq(i).css("display","none");this.dropdownKeyIndex!==-1&&this.tabDropdownList.eq(this.dropdownKeyIndex).addClass("lm_keyboard_active")},_hideAdditionalTabsDropdown:function(t){!this.isDropdownShown||t&&this.tabDropdownContainer.get(0).contains(t.target)||t&&this.tabDropdownButton.element.get(0)===t.target||(this.element.removeClass("lm_dropdown_open"),this.tabDropdownContainer.hide(),this.isDropdownShown=!1,this.tabDropdownContainer.find(".lm_tabs").remove(),e(document).off("mousedown",this._hideAdditionalTabsDropdown))},_updateAdditionalTabsDropdown:function(){this.tabDropdownContainer.css("max-height","");var t=this.tabDropdownContainer[0].scrollHeight;if(t!==0){var i=this.tabDropdownContainer.offset().top-e(window).scrollTop();i+t>e(window).height()&&this.tabDropdownContainer.css("max-height",e(window).height()-i-10)}},_isClosable:function(){return this.parent.config.isClosable&&this.layoutManager.config.settings.showCloseIcon},_onPopoutClick:function(){this.layoutManager.config.settings.popoutWholeStack===!0?this.parent.popout():this.activeContentItem.popout()},_onHeaderClick:function(t){t.target===this.element[0]&&this.parent.select()},_updateTabSizes:function(){this.tabs.length!==0&&(!this.isOverflowing&&this.tabsContainer.get(0).scrollWidth>this.tabsContainer.get(0).clientWidth?(this.tabDropdownButton.element.show(),this.tabNextButton.show(),this.tabPreviousButton.show(),this.isOverflowing=!0):this.isOverflowing&&this.tabsContainer.get(0).scrollWidth<=this.tabsContainer.get(0).clientWidth&&(this.tabDropdownButton.element.hide(),this.tabNextButton.hide(),this.tabPreviousButton.hide(),this.isOverflowing=!1),this.isOverflowing&&this._checkScrollArrows())}}),n.controls.HeaderButton=function(t,i,o,r){this._header=t,this.element=e('<li class="'+o+'" title="'+i+'"></li>'),this._header.on("destroy",this._$destroy,this),this._action=r,this.element.on("click",this._action),this._header.controlsContainer.append(this.element)},n.utils.copy(n.controls.HeaderButton.prototype,{_$destroy:function(){this.element.off(),this.element.remove()}}),n.controls.Splitter=function(t,i,o){this._isVertical=t,this._size=i,this._grabSize=o<i?i:o,this.element=this._createElement(),this._dragListener=new n.utils.DragListener(this.element)},n.utils.copy(n.controls.Splitter.prototype,{on:function(t,i,o){this._dragListener.on(t,i,o)},_$destroy:function(){this._dragListener.destroy(),this._dragListener=null,this.element.remove()},_createElement:function(){var t=e('<div class="lm_drag_handle"></div>'),i=e('<div class="lm_splitter"></div>');i.append(t);var o=this._grabSize-this._size,r=o/2;return this._isVertical?(t.css("top",-r),t.css("height",this._size+o),i.addClass("lm_vertical"),i.height(this._size)):(t.css("left",-r),t.css("width",this._size+o),i.addClass("lm_horizontal"),i.width(this._size)),i}}),n.controls.Tab=function(t,i){this.header=t,this.contentItem=i,this.element=e(n.controls.Tab._template),this.titleElement=this.element.find(".lm_title"),this.closeElement=this.element.find(".lm_close_tab"),this.closeElement[i.config.isClosable?"show":"hide"](),this.isActive=!1,this.setTitle(i.config.title),this.contentItem.on("titleChanged",this.setTitle,this),this._layoutManager=this.contentItem.layoutManager,this._layoutManager.config.settings.reorderEnabled===!0&&i.config.reorderEnabled===!0&&(this._dragListener=new n.utils.DragListener(this.element),this._dragListener.on("dragStart",this._onDragStart,this),this.contentItem.on("destroy",this._dragListener.destroy,this._dragListener)),this._onTabClickFn=n.utils.fnBind(this._onTabClick,this),this._onCloseClickFn=n.utils.fnBind(this._onCloseClick,this),this._onTabContentFocusInFn=n.utils.fnBind(this._onTabContentFocusIn,this),this._onTabContentFocusOutFn=n.utils.fnBind(this._onTabContentFocusOut,this),this.element.on("click",this._onTabClickFn),this.element.on("auxclick",this._onTabClickFn),this.contentItem.config.isClosable?(this.closeElement.on("click",this._onCloseClickFn),this.closeElement.on("mousedown",this._onCloseMousedown)):this.closeElement.remove(),this.contentItem.tab=this,this.contentItem.emit("tab",this),this.contentItem.layoutManager.emit("tabCreated",this),this.contentItem.isComponent&&(this.contentItem.container._contentElement.on("focusin click",this._onTabContentFocusInFn).on("focusout",this._onTabContentFocusOutFn),this.contentItem.container.tab=this,this.contentItem.container.emit("tab",this))},n.controls.Tab._template=['<li class="lm_tab">','<span class="lm_title_before"></span>','<span class="lm_title"></span>','<div class="lm_close_tab"></div>',"</li>"].join(""),n.utils.copy(n.controls.Tab.prototype,{setTitle:function(t){this.titleElement.html(t)},setActive:function(t){t!==this.isActive&&(this.isActive=t,t?this.element.addClass("lm_active"):this.element.removeClass("lm_active"))},_$destroy:function(){this.element.off("click",this._onTabClickFn),this.element.off("auxclick",this._onTabClickFn),this.closeElement.off("click",this._onCloseClickFn),this.contentItem.isComponent&&this.contentItem.container._contentElement.off(),this._dragListener&&(this.contentItem.off("destroy",this._dragListener.destroy,this._dragListener),this._dragListener.off("dragStart",this._onDragStart),this._dragListener=null),this.element.remove()},_onDragStart:function(t,i){this.contentItem.parent.isMaximised===!0&&this.contentItem.parent.toggleMaximise(),new n.controls.DragProxy(t,i,this._dragListener,this._layoutManager,this.contentItem,this.header.parent)},_onTabContentFocusIn:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.contentItem.container._contentElement[0].focus(),this.element.addClass("lm_focusin")},_onTabContentFocusOut:function(){this.contentItem.container._contentElement[0].contains(document.activeElement)||this.element.removeClass("lm_focusin")},_onTabClick:function(t){if(!t||t.button===0){var i=this.header.parent.getActiveContentItem();this.contentItem!==i?(this.header.parent.setActiveContentItem(this.contentItem),this.contentItem.container.emit("tabClicked")):this.contentItem.isComponent&&!this.contentItem.container._contentElement[0].contains(document.activeElement)&&(this.contentItem.container._contentElement.focus(),this.contentItem.container.emit("tabClicked")),this.header._hideAdditionalTabsDropdown(),this.element.get(0).scrollIntoView({inline:"nearest"})}else t.button===1&&this.contentItem.config.isClosable&&this._onCloseClick(t)},_onCloseClick:function(t){t.stopPropagation(),this.contentItem.isComponent?this.contentItem.container.close():this.header.parent.removeChild(this.contentItem)},_onCloseMousedown:function(t){t.stopPropagation()}}),n.controls.TransitionIndicator=function(){this._element=e('<div class="lm_transition_indicator"></div>'),e(document.body).append(this._element),this._toElement=null,this._fromDimensions=null,this._totalAnimationDuration=200,this._animationStartTime=null},n.utils.copy(n.controls.TransitionIndicator.prototype,{destroy:function(){this._element.remove()},transitionElements:function(t,i){},_nextAnimationFrame:function(){var t=this._measure(this._toElement),i=(n.utils.now()-this._animationStartTime)/this._totalAnimationDuration,o={},r;if(i>=1){this._element.hide();return}t.opacity=0;for(r in this._fromDimensions)o[r]=this._fromDimensions[r]+(t[r]-this._fromDimensions[r])*i;this._element.css(o),n.utils.animFrame(n.utils.fnBind(this._nextAnimationFrame,this))},_measure:function(t){var i=t.offset();return{left:i.left,top:i.top,width:t.outerWidth(),height:t.outerHeight()}}}),n.errors.ConfigurationError=function(t,i){Error.call(this),this.name="Configuration Error",this.message=t,this.node=i},n.errors.ConfigurationError.prototype=new Error,n.items.AbstractContentItem=function(t,i,o){n.utils.EventEmitter.call(this),this.config=this._extendItemNode(i),this.type=i.type,this.contentItems=[],this.parent=o,this.isInitialised=!1,this.isMaximised=!1,this.isRoot=!1,this.isRow=!1,this.isColumn=!1,this.isStack=!1,this.isComponent=!1,this.layoutManager=t,this._pendingEventPropagations={},this._throttledEvents=["stateChanged"],this.on(n.utils.EventEmitter.ALL_EVENT,this._propagateEvent,this),i.content&&this._createContentItems(i)},n.utils.copy(n.items.AbstractContentItem.prototype,{setSize:function(){throw new Error("Abstract Method")},callDownwards:function(t,i,o,r){var c;for(o!==!0&&r!==!0&&this[t].apply(this,i||[]),c=0;c<this.contentItems.length;c++)this.contentItems[c].callDownwards(t,i,o);o===!0&&r!==!0&&this[t].apply(this,i||[])},removeChild:function(t,i){var o=n.utils.indexOf(t,this.contentItems);if(o===-1)throw new Error("Can't remove child item. Unknown content item");i!==!0&&this.contentItems[o]._$destroy(),this.contentItems.splice(o,1),this.config.content.splice(o,1),this.contentItems.length>0?this.callDownwards("setSize"):!(this instanceof n.items.Root)&&this.config.isClosable===!0&&this.parent.removeChild(this)},addChild:function(t,i){i===void 0&&(i=this.contentItems.length),this.contentItems.splice(i,0,t),this.config.content===void 0&&(this.config.content=[]),this.config.content.splice(i,0,t.config),t.parent=this,t.parent.isInitialised===!0&&t.isInitialised===!1&&t._$init()},replaceChild:function(t,i,o){i=this.layoutManager._$normalizeContentItem(i);var r=n.utils.indexOf(t,this.contentItems),c=t.element[0].parentNode;if(r===-1)throw new Error("Can't replace child. oldChild is not child of this");c.replaceChild(i.element[0],t.element[0]),o===!0&&(t.parent=null,t._$destroy()),this.contentItems[r]=i,i.parent=this,this.isStack&&(this.header.tabs[r].contentItem=i),i.parent.isInitialised===!0&&i.isInitialised===!1&&i._$init(),this.callDownwards("setSize")},remove:function(){this.parent.removeChild(this)},popout:function(){var t=this.layoutManager.createPopout(this);return this.emitBubblingEvent("stateChanged"),t},toggleMaximise:function(t){t&&t.preventDefault(),this.isMaximised===!0?this.layoutManager._$minimiseItem(this):this.layoutManager._$maximiseItem(this),this.isMaximised=!this.isMaximised,this.emitBubblingEvent("stateChanged")},select:function(){this.layoutManager.selectedItem!==this&&(this.layoutManager.selectItem(this,!0),this.element.addClass("lm_selected"))},deselect:function(){this.layoutManager.selectedItem===this&&(this.layoutManager.selectedItem=null,this.element.removeClass("lm_selected"))},setTitle:function(t){this.config.title=t,this.emit("titleChanged",t),this.emitBubblingEvent("stateChanged")},hasId:function(t){if(this.config.id){if(typeof this.config.id=="string")return this.config.id===t;if(this.config.id instanceof Array)return n.utils.indexOf(t,this.config.id)!==-1}else return!1},addId:function(t){this.hasId(t)||(this.config.id?typeof this.config.id=="string"?this.config.id=[this.config.id,t]:this.config.id instanceof Array&&this.config.id.push(t):this.config.id=t)},removeId:function(t){if(!this.hasId(t))throw new Error("Id not found");if(typeof this.config.id=="string")delete this.config.id;else if(this.config.id instanceof Array){var i=n.utils.indexOf(t,this.config.id);this.config.id.splice(i,1)}},getItemsByFilter:function(t){var i=[],o=function(r){for(var c=0;c<r.contentItems.length;c++)t(r.contentItems[c])===!0&&i.push(r.contentItems[c]),o(r.contentItems[c])};return o(this),i},getItemsById:function(t){return this.getItemsByFilter(function(i){return i.config.id instanceof Array?n.utils.indexOf(t,i.config.id)!==-1:i.config.id===t})},getItemsByType:function(t){return this._$getItemsByProperty("type",t)},getComponentsByName:function(t){var i=this._$getItemsByProperty("componentName",t),o=[],r;for(r=0;r<i.length;r++)o.push(i[r].instance);return o},_$getItemsByProperty:function(t,i){return this.getItemsByFilter(function(o){return o[t]===i})},_$setParent:function(t){this.parent=t},_$highlightDropZone:function(t,i,o){this.layoutManager.dropTargetIndicator.highlightArea(o)},_$onDrop:function(t){this.addChild(t)},_$hide:function(){this._callOnActiveComponents("hide"),this.element.hide(),this.layoutManager.updateSize()},_$show:function(){this._callOnActiveComponents("show"),this.element.show(),this.layoutManager.updateSize()},_callOnActiveComponents:function(t){var i=this.getItemsByType("stack"),o,r;for(r=0;r<i.length;r++)o=i[r].getActiveContentItem(),o&&o.isComponent&&o.container[t]()},_$destroy:function(){this.emitBubblingEvent("beforeItemDestroyed"),this.callDownwards("_$destroy",[],!0,!0),this.element.remove(),this.emitBubblingEvent("itemDestroyed")},_$getArea:function(t){t=t||this.element;var i=t.offset(),o=t.width(),r=t.height();return{x1:i.left,y1:i.top,x2:i.left+o,y2:i.top+r,surface:o*r,contentItem:this}},_$init:function(){var t;for(this.setSize(),t=0;t<this.contentItems.length;t++)this.childElementContainer.append(this.contentItems[t].element);this.isInitialised=!0,this.emitBubblingEvent("itemCreated"),this.emitBubblingEvent(this.type+"Created")},emitBubblingEvent:function(t){var i=new n.utils.BubblingEvent(t,this);this.emit(t,i)},_createContentItems:function(t){var i,o;if(!(t.content instanceof Array))throw new n.errors.ConfigurationError("content must be an Array",t);for(o=0;o<t.content.length;o++)i=this.layoutManager.createContentItem(t.content[o],this),this.contentItems.push(i)},_extendItemNode:function(t){for(var i in n.config.itemDefaultConfig)t[i]===void 0&&(t[i]=n.config.itemDefaultConfig[i]);return t},_propagateEvent:function(t,i){i instanceof n.utils.BubblingEvent&&i.isPropagationStopped===!1&&this.isInitialised===!0&&(this.isRoot===!1&&this.parent?this.parent.emit.apply(this.parent,Array.prototype.slice.call(arguments,0)):this._scheduleEventPropagationToLayoutManager(t,i))},_scheduleEventPropagationToLayoutManager:function(t,i){n.utils.indexOf(t,this._throttledEvents)===-1?this.layoutManager.emit(t,i.origin):this._pendingEventPropagations[t]!==!0&&(this._pendingEventPropagations[t]=!0,n.utils.animFrame(n.utils.fnBind(this._propagateEventToLayoutManager,this,[t,i])))},_propagateEventToLayoutManager:function(t,i){this._pendingEventPropagations[t]=!1,this.layoutManager.emit(t,i)}}),n.items.Component=function(t,i,o){n.items.AbstractContentItem.call(this,t,i,o);var r=t.getComponent(this.config.componentName)||t.getFallbackComponent(),c=e.extend(!0,{},this.config.componentState||{});if(r==null)throw new n.errors.ConfigurationError('Unknown component "'+this.config.componentName+'"');c.componentName=this.config.componentName,this.componentName=this.config.componentName,this.config.title===""&&(this.config.title=this.config.componentName),this.isComponent=!0,this.container=new n.container.ItemContainer(this.config,this,t),this.instance=new r(this.container,c),this.element=this.container._element},n.utils.extend(n.items.Component,n.items.AbstractContentItem),n.utils.copy(n.items.Component.prototype,{close:function(){this.parent.removeChild(this)},setSize:function(){this.element.is(":visible")&&this.container._$setSize(this.element.width(),this.element.height())},_$init:function(){n.items.AbstractContentItem.prototype._$init.call(this),this.container.emit("open")},_$hide:function(){this.container.hide(),n.items.AbstractContentItem.prototype._$hide.call(this)},_$show:function(){this.container.show(),this.container._config.isFocusOnShow&&this.container._contentElement[0].focus({preventScroll:!0}),n.items.AbstractContentItem.prototype._$show.call(this)},_$destroy:function(){this.container.emit("destroy",this),n.items.AbstractContentItem.prototype._$destroy.call(this)},_$getArea:function(){return null}}),n.items.Root=function(t,i,o){n.items.AbstractContentItem.call(this,t,i,null),this.isRoot=!0,this.type="root",this.element=e('<div class="lm_goldenlayout lm_item lm_root"></div>'),this.childElementContainer=this.element,this._containerElement=o,this._containerElement.append(this.element)},n.utils.extend(n.items.Root,n.items.AbstractContentItem),n.utils.copy(n.items.Root.prototype,{addChild:function(t){if(this.contentItems.length>0)throw new Error("Root node can only have a single child");t=this.layoutManager._$normalizeContentItem(t,this),this.childElementContainer.append(t.element),n.items.AbstractContentItem.prototype.addChild.call(this,t),this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(t,i){t=typeof t>"u"?this._containerElement.width():t,i=typeof i>"u"?this._containerElement.height():i,this.element.width(t),this.element.height(i),this.contentItems[0]&&(this.contentItems[0].element.width(t),this.contentItems[0].element.height(i))},_$highlightDropZone:function(t,i,o){this.layoutManager.tabDropPlaceholder.remove(),n.items.AbstractContentItem.prototype._$highlightDropZone.apply(this,arguments)},_$onDrop:function(t,i){var o;if(t.isComponent&&(o=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this),o._$init(),o.addChild(t),t=o),!this.contentItems.length)this.addChild(t);else{var r=i.side[0]=="x"?"row":"column",c=i.side[0]=="x"?"width":"height",d=i.side[1]=="2",h=this.contentItems[0];if(!h instanceof n.items.RowOrColumn||h.type!=r){var m=this.layoutManager.createContentItem({type:r},this);this.replaceChild(h,m),m.addChild(t,d?0:void 0,!0),m.addChild(h,d?void 0:0,!0),h.config[c]=50,t.config[c]=50,m.callDownwards("setSize")}else{var g=h.contentItems[d?0:h.contentItems.length-1];h.addChild(t,d?0:void 0,!0),g.config[c]*=.5,t.config[c]=g.config[c],h.callDownwards("setSize")}}}}),n.items.RowOrColumn=function(t,i,o,r){n.items.AbstractContentItem.call(this,i,o,r),this.isRow=!t,this.isColumn=t,this.element=e('<div class="lm_item lm_'+(t?"column":"row")+'"></div>'),this.childElementContainer=this.element,this._splitterSize=i.config.dimensions.borderWidth,this._splitterGrabSize=i.config.dimensions.borderGrabWidth,this._isColumn=t,this._dimension=t?"height":"width",this._splitter=[],this._splitterPosition=null,this._splitterMinPosition=null,this._splitterMaxPosition=null},n.utils.extend(n.items.RowOrColumn,n.items.AbstractContentItem),n.utils.copy(n.items.RowOrColumn.prototype,{addChild:function(t,i,o){var r,c,d,h;if(t=this.layoutManager._$normalizeContentItem(t,this),i===void 0&&(i=this.contentItems.length),this.contentItems.length>0?(h=this._createSplitter(Math.max(0,i-1)).element,i>0?(this.contentItems[i-1].element.after(h),h.after(t.element)):(this.contentItems[0].element.before(h),h.before(t.element))):this.childElementContainer.append(t.element),n.items.AbstractContentItem.prototype.addChild.call(this,t,i),r=1/this.contentItems.length*100,o===!0){this.emitBubblingEvent("stateChanged");return}for(d=0;d<this.contentItems.length;d++)this.contentItems[d]===t?t.config[this._dimension]=r:(c=this.contentItems[d].config[this._dimension]*=(100-r)/100,this.contentItems[d].config[this._dimension]=c);this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},removeChild:function(t,i){var o=t.config[this._dimension],r=n.utils.indexOf(t,this.contentItems),c=Math.max(r-1,0),d,h;if(r===-1)throw new Error("Can't remove child. ContentItem is not child of this Row or Column");for(this._splitter[c]&&(this._splitter[c]._$destroy(),this._splitter.splice(c,1)),d=0;d<this.contentItems.length;d++)this.contentItems[d]!==t&&(this.contentItems[d].config[this._dimension]+=o/(this.contentItems.length-1));n.items.AbstractContentItem.prototype.removeChild.call(this,t,i),this.contentItems.length===1&&this.config.isClosable===!0?(h=this.contentItems[0],this.contentItems=[],this.parent.replaceChild(this,h,!0)):(this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged"))},replaceChild:function(t,i){var o=t.config[this._dimension];n.items.AbstractContentItem.prototype.replaceChild.call(this,t,i),i.config[this._dimension]=o,this.callDownwards("setSize"),this.emitBubblingEvent("stateChanged")},setSize:function(){this.contentItems.length>0&&(this._calculateRelativeSizes(),this._setAbsoluteSizes()),this.emitBubblingEvent("stateChanged"),this.emit("resize")},_$init:function(){if(this.isInitialised!==!0){var t;for(n.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length-1;t++)this.contentItems[t].element.after(this._createSplitter(t).element)}},_setAbsoluteSizes:function(){var t,i=this._calculateAbsoluteSizes();for(t=0;t<this.contentItems.length;t++)i.additionalPixel-t>0&&i.itemSizes[t]++,this._isColumn?(this.contentItems[t].element.width(i.totalWidth),this.contentItems[t].element.height(i.itemSizes[t])):(this.contentItems[t].element.width(i.itemSizes[t]),this.contentItems[t].element.height(i.totalHeight))},_calculateAbsoluteSizes:function(){var t,i=(this.contentItems.length-1)*this._splitterSize,o=this.element.width(),r=this.element.height(),c=0,d,h,m=[];for(this._isColumn?r-=i:o-=i,t=0;t<this.contentItems.length;t++)this._isColumn?h=Math.floor(r*(this.contentItems[t].config.height/100)):h=Math.floor(o*(this.contentItems[t].config.width/100)),c+=h,m.push(h);return d=Math.floor((this._isColumn?r:o)-c),{itemSizes:m,additionalPixel:d,totalWidth:o,totalHeight:r}},_calculateRelativeSizes:function(){var t,i=0,o=[],r=this._isColumn?"height":"width";for(t=0;t<this.contentItems.length;t++)this.contentItems[t].config[r]!==void 0?i+=this.contentItems[t].config[r]:o.push(this.contentItems[t]);if(Math.round(i)===100){this._respectMinItemWidth();return}if(Math.round(i)<100&&o.length>0){for(t=0;t<o.length;t++)o[t].config[r]=(100-i)/o.length;this._respectMinItemWidth();return}if(Math.round(i)>100)for(t=0;t<o.length;t++)o[t].config[r]=50,i+=50;for(t=0;t<this.contentItems.length;t++)this.contentItems[t].config[r]=this.contentItems[t].config[r]/i*100;this._respectMinItemWidth()},_respectMinItemWidth:function(){var t=this.layoutManager.config.dimensions&&this.layoutManager.config.dimensions.minItemWidth||0,i=null,o=[],r=0,c=0,d=0,h=0,m,g,f=[],E;if(!(this._isColumn||!t||this.contentItems.length<=1)){i=this._calculateAbsoluteSizes();for(var b=0;b<this.contentItems.length;b++)this.contentItems[b],h=i.itemSizes[b],h<t?(c+=t-h,E={width:t}):(r+=h-t,E={width:h},o.push(E)),f.push(E);if(!(c===0||c>r)){for(m=c/r,d=c,b=0;b<o.length;b++)E=o[b],g=Math.round((E.width-t)*m),d-=g,E.width-=g;for(d!==0&&(f[f.length-1].width-=d),b=0;b<this.contentItems.length;b++)this.contentItems[b].config.width=f[b].width/i.totalWidth*100}}},_createSplitter:function(t){var i;return i=new n.controls.Splitter(this._isColumn,this._splitterSize,this._splitterGrabSize),i.on("drag",n.utils.fnBind(this._onSplitterDrag,this,[i]),this),i.on("dragStop",n.utils.fnBind(this._onSplitterDragStop,this,[i]),this),i.on("dragStart",n.utils.fnBind(this._onSplitterDragStart,this,[i]),this),this._splitter.splice(t,0,i),i},_getItemsForSplitter:function(t){var i=n.utils.indexOf(t,this._splitter);return{before:this.contentItems[i],after:this.contentItems[i+1]}},_getMinimumDimensions:function(t){for(var i=0,o=0,r=0;r<t.length;++r)i=Math.max(t[r].minWidth||0,i),o=Math.max(t[r].minHeight||0,o);return{horizontal:i,vertical:o}},_onSplitterDragStart:function(t){var i=this._getItemsForSplitter(t),o=this.layoutManager.config.dimensions[this._isColumn?"minItemHeight":"minItemWidth"],r=this._getMinimumDimensions(i.before.config.content),c=this._isColumn?r.vertical:r.horizontal,d=this._getMinimumDimensions(i.after.config.content),h=this._isColumn?d.vertical:d.horizontal;this._splitterPosition=0,this._splitterMinPosition=-1*(i.before.element[this._dimension]()-(c||o)),this._splitterMaxPosition=i.after.element[this._dimension]()-(h||o)},_onSplitterDrag:function(t,i,o){var r=this._isColumn?o:i;r>this._splitterMinPosition&&r<this._splitterMaxPosition&&(this._splitterPosition=r,t.element.css(this._isColumn?"top":"left",r))},_onSplitterDragStop:function(t){var i=this._getItemsForSplitter(t),o=i.before.element[this._dimension](),r=i.after.element[this._dimension](),c=(this._splitterPosition+o)/(o+r),d=i.before.config[this._dimension]+i.after.config[this._dimension];i.before.config[this._dimension]=c*d,i.after.config[this._dimension]=(1-c)*d,t.element.css({top:0,left:0}),n.utils.animFrame(n.utils.fnBind(this.callDownwards,this,["setSize"]))}}),n.items.Stack=function(t,i,o){n.items.AbstractContentItem.call(this,t,i,o),this.element=e('<div class="lm_item lm_stack"></div>'),this._activeContentItem=null;var r=t.config;this._header={show:r.settings.hasHeaders===!0&&i.hasHeaders!==!1,popout:r.settings.showPopoutIcon&&r.labels.popout,maximise:r.settings.showMaximiseIcon&&r.labels.maximise,close:r.settings.showCloseIcon&&r.labels.close,minimise:r.labels.minimise},r.header&&n.utils.copy(this._header,r.header),i.header&&n.utils.copy(this._header,i.header),i.content&&i.content[0]&&i.content[0].header&&n.utils.copy(this._header,i.content[0].header),this._dropZones={},this._dropSegment=null,this._contentAreaDimensions=null,this._dropIndex=null,this.isStack=!0,this.childElementContainer=e('<div class="lm_items"></div>'),this.header=new n.controls.Header(t,this),this.element.append(this.header.element),this.element.append(this.childElementContainer),this._setupHeaderPosition(),this._$validateClosability()},n.utils.extend(n.items.Stack,n.items.AbstractContentItem),n.utils.copy(n.items.Stack.prototype,{setSize:function(){var t,i=this._header.show?this.layoutManager.config.dimensions.headerHeight:0,o=this.element.width()-(this._sided?i:0),r=this.element.height()-(this._sided?0:i);for(this.childElementContainer.width(o),this.childElementContainer.height(r),t=0;t<this.contentItems.length;t++)this.contentItems[t].element.width(o).height(r);this.emit("resize"),this.emitBubblingEvent("stateChanged")},_$init:function(){var t,i;if(this.isInitialised!==!0){for(this.header._attachWheelListener(),n.items.AbstractContentItem.prototype._$init.call(this),t=0;t<this.contentItems.length;t++)this.header.createTab(this.contentItems[t]),this.contentItems[t]._$hide();if(this.contentItems.length>0){if(i=this.contentItems[this.config.activeItemIndex||0],!i)throw new Error("Configured activeItemIndex out of bounds");this.setActiveContentItem(i)}}},setActiveContentItem:function(t){if(n.utils.indexOf(t,this.contentItems)===-1)throw new Error("contentItem is not a child of this stack");this._activeContentItem!==null&&this._activeContentItem._$hide(),this._activeContentItem=t,this.header.setActiveContentItem(t),t._$show(),this.emit("activeContentItemChanged",t),this.layoutManager.emit("activeContentItemChanged",t),this.emitBubblingEvent("stateChanged")},getActiveContentItem:function(){return this.header.activeContentItem},addChild:function(t,i){t=this.layoutManager._$normalizeContentItem(t,this),n.items.AbstractContentItem.prototype.addChild.call(this,t,i),this.childElementContainer.append(t.element),this.header.createTab(t,i),this.setActiveContentItem(t),this.callDownwards("setSize"),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},removeChild:function(t,i){var o=n.utils.indexOf(t,this.contentItems);n.items.AbstractContentItem.prototype.removeChild.call(this,t,i),this.header.removeTab(t),this.header.activeContentItem===t&&(this.contentItems.length>0?this.setActiveContentItem(this.contentItems[Math.max(o-1,0)]):this._activeContentItem=null),this._$validateClosability(),this.emitBubblingEvent("stateChanged")},_$validateClosability:function(){var t,i,o;for(t=this.header._isClosable(),o=0,i=this.contentItems.length;o<i&&t;o++)t=this.contentItems[o].config.isClosable;this.header._$setClosable(t)},_$destroy:function(){n.items.AbstractContentItem.prototype._$destroy.call(this),this.header._$destroy()},_$onDrop:function(t){if(this._dropSegment==="header"){this._resetHeaderDropZone(),this.addChild(t,this._dropIndex);return}if(this._dropSegment==="body"){this.addChild(t);return}var i=this._dropSegment==="top"||this._dropSegment==="bottom",o=this._dropSegment==="left"||this._dropSegment==="right",r=this._dropSegment==="top"||this._dropSegment==="left",c=i&&this.parent.isColumn||o&&this.parent.isRow,d=i?"column":"row",h=i?"height":"width",m,g,f;t.isComponent&&(g=this.layoutManager.createContentItem({type:"stack",header:t.config.header||{}},this),g._$init(),g.addChild(t),t=g),c?(m=n.utils.indexOf(this,this.parent.contentItems),this.parent.addChild(t,r?m:m+1,!0),this.config[h]*=.5,t.config[h]=this.config[h],this.parent.callDownwards("setSize")):(d=i?"column":"row",f=this.layoutManager.createContentItem({type:d},this),this.parent.replaceChild(this,f),f.addChild(t,r?0:void 0,!0),f.addChild(this,r?void 0:0,!0),this.config[h]=50,t.config[h]=50,f.callDownwards("setSize"))},_$highlightDropZone:function(t,i){var o,r;for(o in this._contentAreaDimensions)if(r=this._contentAreaDimensions[o].hoverArea,r.x1<t&&r.x2>t&&r.y1<i&&r.y2>i){o==="header"?(this._dropSegment="header",this._highlightHeaderDropZone(t,i)):(this._resetHeaderDropZone(),this._highlightBodyDropZone(o));return}},_$getArea:function(){if(this.element.is(":visible")===!1)return null;var t=n.items.AbstractContentItem.prototype._$getArea,i=t.call(this,this.header.element),o=t.call(this,this.childElementContainer),r=o.x2-o.x1,c=o.y2-o.y1;return this._contentAreaDimensions={header:{hoverArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},highlightArea:{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}}},this._activeContentItem&&this._activeContentItem.isComponent===!1?i:this.contentItems.length===0?(this._contentAreaDimensions.body={hoverArea:{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2},highlightArea:{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2}},t.call(this,this.element)):(this._contentAreaDimensions.left={hoverArea:{x1:o.x1,y1:o.y1,x2:o.x1+r*.25,y2:o.y2},highlightArea:{x1:o.x1,y1:o.y1,x2:o.x1+r*.5,y2:o.y2}},this._contentAreaDimensions.top={hoverArea:{x1:o.x1+r*.25,y1:o.y1,x2:o.x1+r*.75,y2:o.y1+c*.5},highlightArea:{x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y1+c*.5}},this._contentAreaDimensions.right={hoverArea:{x1:o.x1+r*.75,y1:o.y1,x2:o.x2,y2:o.y2},highlightArea:{x1:o.x1+r*.5,y1:o.y1,x2:o.x2,y2:o.y2}},this._contentAreaDimensions.bottom={hoverArea:{x1:o.x1+r*.25,y1:o.y1+c*.5,x2:o.x1+r*.75,y2:o.y2},highlightArea:{x1:o.x1,y1:o.y1+c*.5,x2:o.x2,y2:o.y2}},t.call(this,this.element))},_highlightHeaderDropZone:function(t){var i=this.header.tabs.length,o=null,r=null;if(i===0){var c=this.header.element.offset();this.layoutManager.dropTargetIndicator.highlightArea({x1:c.left,x2:c.left+100,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()});return}var d=this.header.tabsContainer,h=d.get(0).getBoundingClientRect(),m=this.layoutManager.tabDropPlaceholder.get(0).getBoundingClientRect();if(t<h.left?t=h.left+1:t>h.right&&(t=h.right-1),!(m.left<t&&t<m.right)){for(var g=0;g<i;g++)if(o=this.header.tabs[g].element,r=o.get(0).getBoundingClientRect(),r.left<t&&t<r.right){this._dropIndex=g;break}o&&t<r.left+r.width*.5?o.before(this.layoutManager.tabDropPlaceholder):o&&(this._dropIndex=Math.min(this._dropIndex+1,i),o.after(this.layoutManager.tabDropPlaceholder))}var f=this.layoutManager.tabDropPlaceholder.offset().left;f=Math.max(f,this.header.tabsContainer.offset().left);var E=f+this.layoutManager.tabDropPlaceholder.width();E=Math.min(E,this.header.tabsContainer.offset().left+this.header.tabsContainer.innerWidth()),this.layoutManager.dropTargetIndicator.highlightArea({x1:f,x2:E,y1:this.header.element.offset().top,y2:this.header.element.offset().top+this.header.element.innerHeight()})},_resetHeaderDropZone:function(){this.layoutManager.tabDropPlaceholder.remove()},_setupHeaderPosition:function(){var t=["right","left","bottom"].indexOf(this._header.show)>=0&&this._header.show;if(this.header.element.toggle(!!this._header.show),this._side=t,this._sided=["right","left"].indexOf(this._side)>=0,this.element.removeClass("lm_left lm_right lm_bottom"),this._side&&this.element.addClass("lm_"+this._side),this.element.find(".lm_header").length&&this.childElementContainer){var i=["right","bottom"].indexOf(this._side)>=0?"before":"after";this.header.element[i](this.childElementContainer),this.callDownwards("setSize")}},_highlightBodyDropZone:function(t){var i=this._contentAreaDimensions[t].highlightArea;this.layoutManager.dropTargetIndicator.highlightArea(i),this._dropSegment=t}}),n.utils.BubblingEvent=function(t,i){this.name=t,this.origin=i,this.isPropagationStopped=!1},n.utils.BubblingEvent.prototype.stopPropagation=function(){this.isPropagationStopped=!0},n.utils.ConfigMinifier=function(){if(this._keys=["settings","hasHeaders","constrainDragToContainer","selectionEnabled","dimensions","borderWidth","minItemHeight","minItemWidth","headerHeight","dragProxyWidth","dragProxyHeight","labels","close","maximise","minimise","popout","content","componentName","componentState","id","width","type","height","isClosable","title","popoutWholeStack","openPopouts","parentId","activeItemIndex","reorderEnabled","borderGrabWidth"],this._keys.length>36)throw new Error("Too many keys in config minifier map");this._values=[!0,!1,"row","column","stack","component","close","maximise","minimise","open in new window"]},n.utils.copy(n.utils.ConfigMinifier.prototype,{minifyConfig:function(t){var i={};return this._nextLevel(t,i,"_min"),i},unminifyConfig:function(t){var i={};return this._nextLevel(t,i,"_max"),i},_nextLevel:function(t,i,o){var r,c;for(r in t)t instanceof Array&&(r=parseInt(r,10)),t.hasOwnProperty(r)&&(c=this[o](r,this._keys),typeof t[r]=="object"?(i[c]=t[r]instanceof Array?[]:{},this._nextLevel(t[r],i[c],o)):i[c]=this[o](t[r],this._values))},_min:function(t,i){if(typeof t=="string"&&t.length===1)return"___"+t;var o=n.utils.indexOf(t,i);return o===-1?t:o.toString(36)},_max:function(t,i){return typeof t=="string"&&t.length===1?i[parseInt(t,36)]:typeof t=="string"&&t.substr(0,3)==="___"?t[3]:t}}),n.utils.EventHub=function(t){n.utils.EventEmitter.call(this),this._layoutManager=t,this._dontPropagateToParent=null,this._childEventSource=null,this.on(n.utils.EventEmitter.ALL_EVENT,n.utils.fnBind(this._onEventFromThis,this)),this._boundOnEventFromChild=n.utils.fnBind(this._onEventFromChild,this),e(window).on("gl_child_event",this._boundOnEventFromChild)},n.utils.EventHub.prototype._onEventFromThis=function(){var t=Array.prototype.slice.call(arguments);this._layoutManager.isSubWindow&&t[0]!==this._dontPropagateToParent&&this._propagateToParent(t),this._propagateToChildren(t),this._dontPropagateToParent=null,this._childEventSource=null},n.utils.EventHub.prototype._$onEventFromParent=function(t){this._dontPropagateToParent=t[0],this.emit.apply(this,t)},n.utils.EventHub.prototype._onEventFromChild=function(t){this._childEventSource=t.originalEvent.__gl,this.emit.apply(this,t.originalEvent.__glArgs)},n.utils.EventHub.prototype._propagateToParent=function(t){var i,o="gl_child_event";document.createEvent?(i=window.opener.document.createEvent("HTMLEvents"),i.initEvent(o,!0,!0)):(i=window.opener.document.createEventObject(),i.eventType=o),i.eventName=o,i.__glArgs=t,i.__gl=this._layoutManager,document.createEvent?window.opener.dispatchEvent(i):window.opener.fireEvent("on"+i.eventType,i)},n.utils.EventHub.prototype._propagateToChildren=function(t){var i,o;for(o=0;o<this._layoutManager.openPopouts.length;o++)i=this._layoutManager.openPopouts[o].getGlInstance(),i&&i!==this._childEventSource&&i.eventHub._$onEventFromParent(t)},n.utils.EventHub.prototype.destroy=function(){e(window).off("gl_child_event",this._boundOnEventFromChild)},n.utils.ReactComponentHandler=function(t,i){this._reactComponent=null,this._originalComponentWillUpdate=null,this._container=t,this._initialState=i,this._reactClass=this._getReactClass(),this._container.on("open",this._render,this),this._container.on("destroy",this._destroy,this)},n.utils.copy(n.utils.ReactComponentHandler.prototype,{_render:function(){ReactDOM.render(this._getReactComponent(),this._container.getElement()[0])},_gotReactComponent:function(t){!t||(this._reactComponent=t,this._originalComponentWillUpdate=this._reactComponent.componentWillUpdate||function(){},this._reactComponent.componentWillUpdate=this._onUpdate.bind(this),this._container.getState()&&this._reactComponent.setState(this._container.getState()))},_destroy:function(){ReactDOM.unmountComponentAtNode(this._container.getElement()[0]),this._container.off("open",this._render,this),this._container.off("destroy",this._destroy,this)},_onUpdate:function(t,i){this._container.setState(i),this._originalComponentWillUpdate.call(this._reactComponent,t,i)},_getReactClass:function(){var t=this._container._config.component,i;if(!t)throw new Error("No react component name. type: react-component needs a field `component`");if(i=this._container.layoutManager.getComponent(t)||this._container.layoutManager.getFallbackComponent(),!i)throw new Error('React component "'+t+'" not found. Please register all components with GoldenLayout using `registerComponent(name, component)`');return i},_getReactComponent:function(){var t={glEventHub:this._container.layoutManager.eventHub,glContainer:this._container,ref:this._gotReactComponent.bind(this)},i=e.extend(t,this._container._config.props);return React.createElement(this._reactClass,i)}})})(window.$)})(ga);const fa=ga.exports;window.$=Ro;window.jQuery=Ro;window.React=a;window.ReactDOM=ls;const Cc="_lm_goldenlayout_zgw7r_1",Sc="_lm_header_zgw7r_5",yc="_lm_controls_zgw7r_12",wc="_lm_maximised_zgw7r_17",vc="_lm_items_zgw7r_22",Tc="_lm_tabpreviousbutton_zgw7r_26",_c="_lm_tabnextbutton_zgw7r_31",Ic="_lm_tabdropdown_zgw7r_36",xc="_lm_maximise_zgw7r_17",Dc="_lm_tabs_zgw7r_49",Nc="_lm_tab_zgw7r_26",Lc="_lm_title_zgw7r_78",Fc="_lm_title_before_zgw7r_82",Pc="_lm_active_zgw7r_98",Rc="_lm_focusin_zgw7r_106",kc="_lm_window_blur_zgw7r_111",Mc="_lm_content_zgw7r_115",Ac="_lm_close_tab_zgw7r_120",Oc="_lm_splitter_zgw7r_139",Uc="_lm_dragging_zgw7r_144",Vc="_lm_dragProxy_zgw7r_148",Bc="_lm_tabdropdown_list_zgw7r_160",Hc="_lm_tabdropdown_search_zgw7r_169",$c="_lm_keyboard_active_zgw7r_200",Wc="_lm_dropTargetIndicator_zgw7r_225",Gc="_march_zgw7r_1",zc="_lm_inner_zgw7r_238",qc="_app_zgw7r_250",jc="_plotly_zgw7r_259",Yi={"tab-height":"28px","drag-border-width":"5px",lm_goldenlayout:Cc,lm_header:Sc,lm_controls:yc,lm_maximised:wc,lm_items:vc,lm_tabpreviousbutton:Tc,lm_tabnextbutton:_c,lm_tabdropdown:Ic,lm_maximise:xc,lm_tabs:Dc,lm_tab:Nc,lm_title:Lc,lm_title_before:Fc,"editor-unsaved-indicator":"_editor-unsaved-indicator_zgw7r_86","is-unsaved":"_is-unsaved_zgw7r_94",lm_active:Pc,lm_focusin:Rc,lm_window_blur:kc,lm_content:Mc,lm_close_tab:Ac,lm_splitter:Oc,lm_dragging:Uc,lm_dragProxy:Vc,lm_tabdropdown_list:Bc,lm_tabdropdown_search:Hc,lm_keyboard_active:$c,lm_dropTargetIndicator:Wc,march:Gc,lm_inner:zc,app:qc,"js-plotly-plot":"_js-plotly-plot_zgw7r_259",plotly:jc},Xi=Object.freeze({tabHeight:parseInt(Yi["tab-height"],10),dragBorderWidth:parseInt(Yi["drag-border-width"],10)}),ut=O.module("LayoutUtils");function Ea(l){return l.componentName!==void 0}function Ht(l){const s=l;return Ea(l)&&l.componentName==="lm-react-component"&&s.component!==void 0}function Fn(l){return l.focus!==void 0}function Ji(l){return l.type==="stack"}const se=class{static activateTab(l,s){const e=se.getStackForRoot(l,s,!1);if(!e){ut.error("Could not find stack for config",s);return}const n=se.getContentItemInStack(e,s);n&&e.setActiveContentItem(n)}static isActiveTab(l,s){const e=se.getStackForRoot(l,s,!1);if(!e)return ut.error("Could not find stack for config",s),!1;const n=se.getContentItemInStack(e,s);return e.getActiveContentItem()===n}static addStack(l,s=!0){const e=s?"column":"row";if(l.isRoot){(!l.contentItems||l.contentItems.length===0)&&l.addChild({type:e});const i=l.contentItems[0];if(!(s?i.isColumn:i.isRow)){l.removeChild(i,!0),l.addChild({type:e});const r=document.activeElement;l.contentItems[0].addChild(i),r&&r.focus&&r.focus()}return this.addStack(l.contentItems[0],s)}if(l.contentItems.length<2)return l.addChild({type:"stack"}),l.contentItems[l.contentItems.length-1];let n=l.contentItems[l.contentItems.length-1];return(s?n.isRow:n.isColumn)||(l.addChild({type:s?"row":"column"}),l.removeChild(n,!0),l.contentItems[l.contentItems.length-1].addChild(n),n=l.contentItems[l.contentItems.length-1]),this.addStack(n,!s)}static getStackForConfig(l,s={},e=!1){if(e&&l.isStack&&l.contentItems.length===0)return l;if(!l.contentItems)return null;for(let n=0;n<l.contentItems.length;n+=1){const t=l.contentItems[n];if(t.isComponent&&t.config&&ji(t.config,s))return l;const i=this.getStackForConfig(t,s,e);if(i)return i}return null}static getStackForRoot(l,s,e=!0,n=!0,t=!0){let i=this.getStackForConfig(l,s);return!i&&n&&(i=this.getStackForConfig(l,{component:s.component},t)),!i&&e&&(i=this.addStack(l)),i}static getStackForComponentTypes(l,s,e=!0,n=!0,t=!0){for(let i=0;i<s.length;i+=1){const o=s[i],r=i===s.length-1,c=se.getStackForRoot(l,{component:o},e&&r,n,t);if(c)return c}return null}static getContentItemInStack(l,s){if(!l)return null;for(let e=0;e<l.contentItems.length;e+=1){const n=l.contentItems[e];if(n.isComponent&&n.config&&ji(n.config,s))return n}return null}static dehydrateLayoutConfig(l,s){if(!l||!l.length)return[];const e=[];for(let n=0;n<l.length;n+=1){const t=l[n],{component:i,content:o}=t;if(i){const r=s(i,t);r?e.push(r):ut.debug2(`dehydrateLayoutConfig: skipping unmapped component "${i}"`)}else if(o){const r={...t,content:se.dehydrateLayoutConfig(o,s)};e.push(r)}else e.push(t)}return e}static getTabPoint(l){const{tab:s}=l;if(s==null)throw new Error(`Cannot get tab for panel container ${l}`);const e=s.element[0].getBoundingClientRect();return[e.left+e.width*.5,e.bottom-8]}static dropLayoutMinorChange(l){for(let s=0;s<l.length;s+=1){const e=l[s],{content:n}=e;n!==void 0?(Ji(e)&&delete e.activeItemIndex,se.dropLayoutMinorChange(n)):Ht(e)&&e.component==="IrisGridPanel"&&e.props.panelState&&(delete e.id,e.props.panelState.irisGridState.sorts=[],e.props.panelState.irisGridState.quickFilters=[])}}static isEqual(l,s,e=!1){if(e){const n=se.cloneLayout(l),t=se.cloneLayout(s);return se.dropLayoutMinorChange(n),se.dropLayoutMinorChange(t),Ke(n,t)}return Ke(l,s)}static cloneLayout(l){return JSON.parse(JSON.stringify(l))}static hydrateLayoutConfig(l,s){var n;if(!l||!l.length)return[];const e=[];for(let t=0;t<l.length;t+=1){const i=l[t];if(Ht(i)){const{component:o,props:r={}}=i;e.push({...i,id:(n=i==null?void 0:i.id)!=null?n:Ee(),props:s(o,r)})}else if(i.content!==void 0){const o=se.hydrateLayoutConfig(i.content,s);Ji(i)&&i.activeItemIndex!=null&&i.activeItemIndex>=o.length&&(ut.warn("Fixing bad activeItemIndex!",i.activeItemIndex,i),i.activeItemIndex=0),e.push({...i,content:o})}else e.push(i)}return e}static openComponent({root:l,config:s,replaceExisting:e=!0,replaceConfig:n=void 0,createNewStack:t=!1,focusElement:i=void 0,dragEvent:o=void 0}={}){const r=document.activeElement,c={...s};if(c.id||(c.id=Ee.generate()),o){l==null||l.layoutManager.createDragSourceFromEvent(c,o);return}const d=n||{id:c.id,component:c.component};Vi(l);const h=t?se.addStack(l):se.getStackForRoot(l,d);Vi(h);const m=se.getContentItemInStack(h,d);if(i){const g=f=>{ut.debug("Component created, focusing element",i),h.off("componentCreated",g);const{element:E}=f.origin;requestAnimationFrame(()=>{se.focusElement(E[0],i)})};h.on("componentCreated",g)}if(e&&m){const g=h.contentItems.indexOf(m);h.addChild(c,g+1),h.removeChild(m),h.setActiveContentItem(h.contentItems[g])}else h.addChild(c);!i&&r&&Fn(r)&&r.focus()}static openComponentInStack(l,s,e=!0){const n=document.activeElement,t={id:s.id},i=se.getContentItemInStack(l,t);if(e&&i&&l){const o=l==null?void 0:l.contentItems.indexOf(i);l.addChild(s,o+1),l.removeChild(i),l.setActiveContentItem(l.contentItems[o])}else l==null||l.addChild(s);n&&Fn(n)&&n.focus()}static closeComponent(l,s){const e=se.getStackForRoot(l,s,!1,!1,!1);if(!e){ut.warn("Cannot find stack for component, ignoring close",s);return}const n=se.getContentItemInStack(e,s),t=document.activeElement;n&&(n.isComponent?n.container.close():e.removeChild(n)),t&&document.contains(t)&&Fn(t)&&t.focus()}static renameComponent(l,s,e){const n=se.getStackForRoot(l,s,!1);if(!n){ut.error("Could not find stack for config",s);return}const t=se.getContentItemInStack(n,s);t&&t.setTitle(e)}static cloneComponent(l,s){const e=se.getStackForRoot(l,s,!1);if(!e)return ut.error("Could not find stack for config",s),null;const{props:n={}}=s,t=se.getPanelComponentState(s),i={type:"react-component",component:s.component,props:{...n,panelState:t},title:`${s.title} Copy`,id:Ee.generate()};return se.openComponentInStack(e,i),i}static getPanelComponentState(l){var s,e;return Ea(l)?(s=l.componentState)==null?void 0:s.panelState:Ht(l)?(e=l.props)==null?void 0:e.panelState:null}static makeDefaultLayout(){return{dimensions:{headerHeight:Xi.tabHeight,borderWidth:Xi.dragBorderWidth,borderGrabWidth:10},settings:{showPopoutIcon:!1,showCloseIcon:!1,constrainDragToContainer:!1}}}static getRootFromContainer(l){return l.layoutManager.root}static getComponentConfigFromContainer(l){return l?l.tab&&l.tab.contentItem?l.tab.contentItem.config:l._config:null}static getTitleFromContainer(l){return l&&l.tab&&l.tab.contentItem?l.tab.contentItem.config.title:null}static getTitleFromTab(l){return l&&l.contentItem?l.contentItem.config.title:null}static getIdFromContainer(l){const s=se.getComponentConfigFromContainer(l);return s?s.id:null}static getIdFromPanel(l){const{glContainer:s}=l.props;return se.getIdFromContainer(s)}static getComponentNameFromPanel(l){var n;const{glContainer:s}=l.props,e=se.getComponentConfigFromContainer(s);return e&&Ht(e)&&(n=e.component)!=null?n:null}static getComponentName(l){var e,n;const s=(n=(e=l.WrappedComponent)==null?void 0:e.displayName)!=null?n:l.displayName;if(s==null)throw new Error(`Component displayName not defined ${l}`);return s}static focusElement(l,s=se.DEFAULT_FOCUS_SELECTOR){if(l==null)return null;const e=l.querySelector(s);return e==null?null:(Fn(e)&&e.focus(),e)}static onInitialized(l){return new Promise(s=>{if(l.isInitialised){s();return}const e=()=>{l.off("initialised",e),s()};l.on("initialised",e)})}};let F=se;F.DEFAULT_FOCUS_SELECTOR="input, select, textarea, button";const Kc=a.forwardRef((l,s)=>{const e=F.getComponentNameFromPanel({props:l});return a.createElement("div",{ref:s,className:"panel-placeholder"},'Component "',e,'" is not registered.')}),Y=Object.freeze({FOCUS:"PanelEvent.FOCUS",MOUNT:"PanelEvent.MOUNT",UNMOUNT:"PanelEvent.UNMOUNT",TITLE_CHANGED:"PanelEvent.TITLE_CHANGED",REOPEN:"PanelEvent.REOPEN",DELETE:"PanelEvent.DELETE",CLONED:"PanelEvent.CLONED",CLOSED:"PanelEvent.CLOSED",OPEN:"PanelEvent.OPEN",CLOSE:"PanelEvent.CLOSE"});function Zc(l){return(l==null?void 0:l.WrappedComponent)!==void 0}function Yc(l){return typeof l.id=="string"&&l.layout instanceof fa&&l.panelManager instanceof li&&typeof l.registerComponent=="function"}function wt(l){if(!Yc(l))throw new Error(`Expected dashboard plugin props, but instead received ${l}`)}const He=O.module("PanelManager");class li{constructor(s,e=(r,c)=>c,n=(r,c)=>c,t=new Map,i=[],o=()=>{}){this.handleFocus=this.handleFocus.bind(this),this.handleMount=this.handleMount.bind(this),this.handleUnmount=this.handleUnmount.bind(this),this.handleReopen=this.handleReopen.bind(this),this.handleDeleted=this.handleDeleted.bind(this),this.handleClosed=this.handleClosed.bind(this),this.handleControlClose=this.handleControlClose.bind(this),this.layout=s,this.hydrateComponent=e,this.dehydrateComponent=n,this.onPanelsUpdated=o,this.openedMap=new Map(t),this.closed=[...i],this.startListening()}startListening(){const{eventHub:s}=this.layout;s.on(Y.FOCUS,this.handleFocus),s.on(Y.MOUNT,this.handleMount),s.on(Y.UNMOUNT,this.handleUnmount),s.on(Y.REOPEN,this.handleReopen),s.on(Y.DELETE,this.handleDeleted),s.on(Y.CLOSED,this.handleClosed),s.on(Y.CLOSE,this.handleControlClose)}stopListening(){const{eventHub:s}=this.layout;s.off(Y.FOCUS,this.handleFocus),s.off(Y.MOUNT,this.handleMount),s.off(Y.UNMOUNT,this.handleUnmount),s.off(Y.REOPEN,this.handleReopen),s.off(Y.DELETE,this.handleDeleted),s.off(Y.CLOSED,this.handleClosed),s.off(Y.CLOSE,this.handleControlClose)}getClosedPanelConfigsOfType(s){return this.closed.filter(e=>e.component===s)}getOpenedPanels(){return Array.from(this.openedMap.values())}getOpenedPanelConfigs(){return this.getOpenedPanels().map(s=>{const{glContainer:e}=s.props;return F.getComponentConfigFromContainer(e)})}getOpenedPanelConfigsOfType(s){return this.getOpenedPanelConfigs().filter(e=>e!=null&&Ht(e)&&e.component===s)}getOpenedPanelById(s){return this.openedMap.get(s)}getContainerByPanelId(s){var n;const e=F.getStackForConfig(this.layout.root,{id:s});return(n=e&&F.getContentItemInStack(e,{id:s}))!=null?n:null}getLastUsedPanel(s){const e=this.getOpenedPanels();for(let n=e.length-1;n>=0;n-=1){const t=e[n];if(s==null||s(t))return t}}getLastUsedPanelOfType(s){return this.getLastUsedPanelOfTypes([s])}getLastUsedPanelOfTypes(s){return this.getLastUsedPanel(e=>s.some(n=>e instanceof n||Zc(n)&&n.WrappedComponent&&e instanceof n.WrappedComponent))}updatePanel(s){const e=F.getIdFromPanel(s);if(!e){He.error("updatePanel Panel did not have an ID",s);return}He.debug2(`Updating panel ID ${e} in open panels map`),this.openedMap.delete(e),this.openedMap.set(e,s)}removePanel(s){const e=F.getIdFromPanel(s);if(!e){He.error("removePanel Panel did not have an ID",s);return}if(!this.openedMap.has(e)){He.error(`Missing panel ID ${e} in open panels map`);return}if(this.openedMap.get(e)!==s){He.debug(`Panel argument doesn't match the open panels map entry for ${e}, removePanel ignored`);return}He.debug2(`Removing panel ID ${e} from open panels map`),this.openedMap.delete(e)}removeClosedPanelConfig(s){const e=this.closed.findIndex(n=>n===s||n.id&&s.id&&n.id===s.id);e>=0&&this.closed.splice(e,1)}handleFocus(s){He.debug2("Focus: ",s),this.updatePanel(s)}handleMount(s){He.debug2("Mount: ",s),this.updatePanel(s),this.sendUpdate()}handleUnmount(s){He.debug2("Unmount: ",s),this.removePanel(s),this.sendUpdate()}handleReopen(s,e){He.debug2("Reopen:",s,e),this.removeClosedPanelConfig(s);const{component:n}=s;let{props:t}=s;t=this.hydrateComponent(n,t);const i={...s,props:t},{root:o}=this.layout;F.openComponent({root:o,config:i,replaceConfig:e})}handleDeleted(s){He.debug2("Deleted:",s),this.removeClosedPanelConfig(s),this.sendUpdate()}handleClosed(s,e){He.debug2("Closed: ",s),this.addClosedPanel(e),this.sendUpdate()}handleControlClose(s){const e={id:s},{root:n}=this.layout;F.closeComponent(n,e)}addClosedPanel(s){const e=F.getComponentConfigFromContainer(s);if(e&&Ht(e)){const n=this.dehydrateComponent(e.component,e);n&&this.closed.push(n)}}sendUpdate(){const{closed:s,openedMap:e}=this;this.onPanelsUpdated({closed:[...s],openedMap:new Map(e)})}}li.MAX_CLOSED_PANEL_COUNT=100;const Xc=O.module("PanelErrorBoundary");class Jc extends p.exports.Component{constructor(s){super(s),this.state={error:null}}componentDidCatch(s){this.setState({error:s})}componentWillUnmount(){const{glContainer:s,glEventHub:e}=this.props,n=F.getIdFromContainer(s);Xc.debug("componentWillUnmount",n),e.emit(Y.CLOSED,n,s)}render(){const{children:s}=this.props,{error:e}=this.state;return e!=null?a.createElement("div",{className:"panel-error-boundary"},a.createElement(zs,{errorMessage:`${e}`,isLoading:!1,isLoaded:!1})):s}}function ci(l){const{props:s,componentState:e}=l,{metadata:n}=s;let{panelState:t=null}=s;e&&({panelState:t}=e);const i={};return n&&(i.metadata=n),t&&(i.panelState=t),{...l,componentState:null,props:i,type:"react-component"}}function di(l,s=""){return{metadata:{},...l,localDashboardId:s}}const Qi={dehydrate:ci,hydrate:di},Qc=u.exports.shape({on:u.exports.func,off:u.exports.func,isHidden:u.exports.bool,tab:u.exports.shape({header:u.exports.shape({tabs:u.exports.arrayOf(u.exports.shape({contentItem:u.exports.shape({})}))})}),title:u.exports.string,setTitle:u.exports.func,close:u.exports.func}),ba=u.exports.shape({on:u.exports.func,off:u.exports.func,emit:u.exports.func}),ed=u.exports.shape({registerComponent:u.exports.func,root:u.exports.shape({addChild:u.exports.func}),on:u.exports.func,off:u.exports.func,eventHub:ba}),ae=Object.freeze({Container:Qc,EventHub:ba,Layout:ed}),oe=(l,s,e)=>p.exports.useEffect(function(){return l.on(s,e),()=>{l.off(s,e)}},[l,s,e]),Ca="SET_DASHBOARD_DATA",td=sc(Ca,{},!1),nd={dashboardData:td},sd=new Map,id=Object.freeze({}),od=Object.freeze([]),ad=l=>l.dashboardData,Ve=(l,s)=>{var e;return(e=ad(l)[s])!=null?e:id},rd=(l,s)=>{var e;return(e=Ve(l,s).closed)!=null?e:od},Sa=(l,s)=>{var e;return(e=Ve(l,s).openedMap)!=null?e:sd},ya=(l,s)=>({type:Ca,id:l,payload:s}),ht=(l,s)=>(e,n)=>e(ya(l,{...Ve(n(),l),...s}));Object.entries(nd).map(([l,s])=>tn.register(l,s));const Pn=O.module("DashboardLayout"),ld=Object.freeze({}),cd=[],eo=()=>{},to=l=>l,wa=({id:l,children:s,emptyDashboard:e=a.createElement("div",null,"Dashboard is empty."),layout:n,layoutConfig:t=cd,onLayoutChange:i=eo,onLayoutInitialized:o=eo,hydrate:r=di,dehydrate:c=ci})=>{var R,V;const d=ii(),h=(R=bl(M=>Ve(M,l)))!=null?R:ld,[m,g]=p.exports.useState(!1),[f,E]=p.exports.useState(!1),[b,y]=p.exports.useState(),[C]=p.exports.useState((V=h==null?void 0:h.closed)!=null?V:[]),[I,T]=p.exports.useState(!1),w=p.exports.useMemo(()=>new Map,[]),_=p.exports.useMemo(()=>new Map,[]),L=Cl(),D=p.exports.useCallback((M,q,j=r,ve=c)=>{Pn.debug2("registerComponent",M,q,j,ve);function Pe(A,K){const ie=q,{glContainer:be,glEventHub:Be}=A;return a.createElement(Ko,{store:L},a.createElement(Jc,{glContainer:be,glEventHub:Be},a.createElement(ie,{...A,ref:K})))}const We=a.forwardRef(Pe),vt=n.registerComponent(M,We);return w.set(M,j),_.set(M,ve),vt},[r,c,w,_,n,L]),P=p.exports.useCallback((M,q)=>{var j;return((j=w.get(M))!=null?j:to)(q,l)},[w,l]),B=p.exports.useCallback((M,q)=>{var j;return((j=_.get(M))!=null?j:to)(q,l)},[_,l]),H=p.exports.useMemo(()=>new li(n,P,B,new Map,C,({closed:M,openedMap:q})=>{d(ht(l,{closed:M,openedMap:q}))}),[B,d,P,l,C,n]),$=p.exports.useCallback(()=>{if(f)return;I||(o(),T(!0));const q=n.toConfig().content,j=F.dehydrateLayoutConfig(q,B),ve=b==null||!F.isEqual(b,j);Pn.debug("handleLayoutStateChanged",ve,q,j),ve&&(g(n.root.contentItems.length===0),y(j),i(j))},[B,I,f,b,n,i,o]),W=p.exports.useCallback(()=>{E(!0)},[]),Q=p.exports.useCallback(()=>{E(!1)},[]),x=p.exports.useCallback(M=>{if(Pn.debug2("handleComponentCreated",M),!M||!M.config||!M.config.component||!M.element)return;const j=`${M.config.component.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}-component`;M.element.addClass(j)},[]);oe(n,"stateChanged",$),oe(n,"itemPickedUp",W),oe(n,"itemDropped",Q),oe(n,"componentCreated",x),oe(n.eventHub,Y.TITLE_CHANGED,$);const N=cr(t);return p.exports.useEffect(function(){if(N!==t&&t!==b){Pn.debug("Setting new layout content...");const q=F.hydrateLayoutConfig(t,P);for(;n.root.contentItems.length>0;)n.root.contentItems[0].remove();for(let j=0;j<q.length;j+=1)n.root.addChild(q[j]);g(n.root.contentItems.length===0)}},[P,n,t,b,H,N]),a.createElement(a.Fragment,null,m&&e,a.Children.map(s,M=>M?a.cloneElement(M,{id:l,layout:n,panelManager:H,registerComponent:D}):null))};wa.propTypes={id:u.exports.string.isRequired,children:u.exports.node,data:u.exports.shape({}),emptyDashboard:u.exports.node,layout:ae.Layout.isRequired,layoutConfig:u.exports.arrayOf(u.exports.shape({})),onLayoutChange:u.exports.func,onLayoutInitialized:u.exports.func};const dd=100,ys=()=>{},hd=Object.freeze({}),ud=({id:l="default",children:s,emptyDashboard:e,layoutConfig:n,layoutSettings:t=hd,onLayoutConfigChange:i=ys,onGoldenLayoutChange:o=ys,onLayoutInitialized:r=ys,fallbackComponent:c=Kc,hydrate:d,dehydrate:h})=>{const m=p.exports.useRef(null),[g,f]=p.exports.useState(!1),[E,b]=p.exports.useState();p.exports.useEffect(function(){if(!m.current){b(void 0);return}const I={...F.makeDefaultLayout()};Object.assign(I.settings,t),I.content=[];const T=new fa(I,m.current),w=()=>{T.off("initialised",w),f(!0)};return T.on("initialised",w),c&&T.setFallbackComponent(c),T.init(),b(T),o(T),()=>{T.destroy()}},[t,c,o,f,b]);const y=p.exports.useMemo(()=>Zo(()=>{E!=null&&E.isInitialised&&(E==null||E.updateSize())},dd),[E]);return p.exports.useEffect(function(){return window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y)}},[y]),a.createElement("div",{className:"dashboard-container w-100 h-100"},a.createElement("div",{className:"w-100 h-100",ref:m}),g&&E&&a.createElement(wa,{emptyDashboard:e,id:l,layout:E,layoutConfig:n,onLayoutChange:i,onLayoutInitialized:r,hydrate:d,dehydrate:h},s))},St="default";Yn.register([Pl,Rl,kl,Ml,Al,Ol]);const md=typeof Ss=="function"?Ss(Yn):Ss.default(Yn),et=class{constructor(){this.listeners=[],this.formatter=null,this.rect=null,this.isDownsamplingDisabled=!1,this.title=null}getData(){return[]}getDefaultTitle(){return""}getLayout(){return{}}getFilterColumnMap(){return new Map}isFilterRequired(){return!1}setFilter(){}close(){}setFormatter(s){this.formatter=s}setDownsamplingDisabled(s){this.isDownsamplingDisabled=s}setDimensions(s){this.rect=s}setTitle(s){this.title=s}subscribe(s){this.listeners.push(s)}unsubscribe(s){this.listeners=this.listeners.filter(e=>e!==s)}fireEvent(s){for(let e=0;e<this.listeners.length;e+=1)this.listeners[e](s)}fireUpdate(s){this.fireEvent(new CustomEvent(et.EVENT_UPDATED,{detail:s}))}fireDisconnect(){this.fireEvent(new CustomEvent(et.EVENT_DISCONNECT))}fireReconnect(){this.fireEvent(new CustomEvent(et.EVENT_RECONNECT))}fireDownsampleStart(s){this.fireEvent(new CustomEvent(et.EVENT_DOWNSAMPLESTARTED,{detail:s}))}fireDownsampleFinish(s){this.fireEvent(new CustomEvent(et.EVENT_DOWNSAMPLEFINISHED,{detail:s}))}fireDownsampleFail(s){this.fireEvent(new CustomEvent(et.EVENT_DOWNSAMPLEFAILED,{detail:s}))}fireDownsampleNeeded(s){this.fireEvent(new CustomEvent(et.EVENT_DOWNSAMPLENEEDED,{detail:s}))}fireLoadFinished(){this.fireEvent(new CustomEvent(et.EVENT_LOADFINISHED))}};let he=et;v(he,"EVENT_UPDATED","ChartModel.EVENT_UPDATED"),v(he,"EVENT_DISCONNECT","ChartModel.EVENT_DISCONNECT"),v(he,"EVENT_RECONNECT","ChartModel.EVENT_RECONNECT"),v(he,"EVENT_DOWNSAMPLESTARTED","ChartModel.EVENT_DOWNSAMPLESTARTED"),v(he,"EVENT_DOWNSAMPLEFINISHED","ChartModel.EVENT_DOWNSAMPLEFINISHED"),v(he,"EVENT_DOWNSAMPLEFAILED","ChartModel.EVENT_DOWNSAMPLEFAILED"),v(he,"EVENT_DOWNSAMPLENEEDED","ChartModel.EVENT_DOWNSAMPLENEEDED"),v(he,"EVENT_LOADFINISHED","ChartModel.EVENT_LOADFINISHED");const Rn=O.module("ChartUtils"),mt=Object.freeze(S.calendar.DayOfWeek.values()),no="io.deephaven.time.DateTime",pd=36e5,gd=1e6,k=class{static getPlotlyChartType(s,e){switch(s){case S.plot.SeriesPlotStyle.SCATTER:return e?"scatter":"scattergl";case S.plot.SeriesPlotStyle.LINE:return"scatter";case S.plot.SeriesPlotStyle.BAR:case S.plot.SeriesPlotStyle.STACKED_BAR:return"bar";case S.plot.SeriesPlotStyle.PIE:return"pie";case S.plot.SeriesPlotStyle.TREEMAP:return"treemap";case S.plot.SeriesPlotStyle.HISTOGRAM:return"histogram";case S.plot.SeriesPlotStyle.OHLC:return"ohlc";default:return null}}static getPlotlyChartMode(s){switch(s){case S.plot.SeriesPlotStyle.SCATTER:return"markers";case S.plot.SeriesPlotStyle.LINE:return"lines";default:return null}}static getPlotlyProperty(s,e){switch(s){case S.plot.SeriesPlotStyle.PIE:switch(e){case S.plot.SourceType.X:return"labels";case S.plot.SourceType.Y:return"values"}break;case S.plot.SeriesPlotStyle.OHLC:switch(e){case S.plot.SourceType.TIME:return"x"}break;case S.plot.SeriesPlotStyle.TREEMAP:switch(e){case S.plot.SourceType.X:return"ids";case S.plot.SourceType.Y:return"values";case S.plot.SourceType.LABEL:return"labels";case S.plot.SourceType.PARENT:return"parents";case S.plot.SourceType.COLOR:return"marker.colors"}break}switch(e){case S.plot.SourceType.X:return"x";case S.plot.SourceType.Y:return"y";case S.plot.SourceType.Z:return"z";case S.plot.SourceType.X_LOW:return"xLow";case S.plot.SourceType.X_HIGH:return"xHigh";case S.plot.SourceType.Y_LOW:return"yLow";case S.plot.SourceType.Y_HIGH:return"yHigh";case S.plot.SourceType.TIME:return"time";case S.plot.SourceType.OPEN:return"open";case S.plot.SourceType.HIGH:return"high";case S.plot.SourceType.LOW:return"low";case S.plot.SourceType.CLOSE:return"close";case S.plot.SourceType.SHAPE:return"shape";case S.plot.SourceType.SIZE:return"size";case S.plot.SourceType.LABEL:return"label";case S.plot.SourceType.COLOR:return"color";case S.plot.SourceType.PARENT:return"parent";case S.plot.SourceType.HOVER_TEXT:return"hovertext";case S.plot.SourceType.TEXT:return"text";default:throw new Error(`Unrecognized source type: ${e}`)}}static getPlotlySeriesOrientation(s){var n,t;const{sources:e}=s;return e.length===2&&((t=(n=e[0])==null?void 0:n.axis)==null?void 0:t.type)===S.plot.AxisType.Y?k.ORIENTATION.HORIZONTAL:k.ORIENTATION.VERTICAL}static getPlotlyErrorBars(s,e,n){const t=n.map((o,r)=>o-s[r]),i=e.map((o,r)=>s[r]-o);return{type:"data",symmetric:!1,array:t,arrayminus:i}}static getPlotlyDateFormat(s,e,n){const t=n==null?null:n.replace("%","%%").replace(/S{9}/g,"%9f").replace(/S{8}/g,"%8f").replace(/S{7}/g,"%7f").replace(/S{6}/g,"%6f").replace(/S{5}/g,"%5f").replace(/S{4}/g,"%4f").replace(/S{3}/g,"%3f").replace(/S{2}/g,"%2f").replace(/S{1}/g,"%1f").replace(/y{4}/g,"%Y").replace(/y{2}/g,"%y").replace(/M{4}/g,"%B").replace(/M{3}/g,"%b").replace(/M{2}/g,"%m").replace(/M{1}/g,"%-m").replace(/E{4,}/g,"%A").replace(/E{1,}/g,"%a").replace(/d{2}/g,"%d").replace(/([^%]|^)d{1}/g,"$1%-d").replace(/H{2}/g,"%H").replace(/h{2}/g,"%I").replace(/h{1}/g,"%-I").replace(/m{2}/g,"%M").replace(/s{2}/g,"%S").replace("'T'","T").replace(" z","");let i=null;const o=s.getColumnTypeFormatter(e);return o.dhTimeZone!=null&&o.showTimeZone&&(i=S.i18n.DateTimeFormat.format(" z",new Date,o.dhTimeZone)),{tickformat:t,ticksuffix:i,automargin:!0}}static convertNumberPrefix(s){return s.replace(/\u00A4\u00A4/g,"USD").replace(/\u00A4/g,"$")}static getPlotlyNumberFormat(s,e,n){if(!n)return null;const t=n.split(";"),[,i,o,r,,c,d,h,m,g]=t[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\.?)(0*)(#*)(E?0*)(%?)(.*)/),f=r.replace(",","").length,b=o.indexOf(",")>=0||r.indexOf(",")>=0?",":"",C=m||(h?"e":"f"),I=c.length+d.length,w=`0${f}${b}.${I}${C}`,_=k.convertNumberPrefix(i),L=k.convertNumberPrefix(g);return{tickformat:w,tickprefix:_,ticksuffix:L,automargin:!0}}static getPlotlyAxisFormat(s,e=null){const{axis:n,columnType:t}=s,{formatPattern:i}=n;let o=null;return de.isDateType(t)?(o=k.getPlotlyDateFormat(e,t,i),o=k.addTickSpacing(o,n,!0)):de.isNumberType(t)&&(o=k.getPlotlyNumberFormat(e,t,i),o=k.addTickSpacing(o,n,!1)),n.formatType===S.plot.AxisFormatType.CATEGORY&&(o?o.type="category":o={type:"category",tickformat:null,ticksuffix:null}),o}static addTickSpacing(s,e,n){const{gapBetweenMajorTicks:t}=e;if(t>0){const i=s||{};let o=t;return n&&(o=t/gd),e.log&&(o=Math.log(o)),i.tickmode="linear",i.dtick=o,i}return s}static getSourceForAxis(s,e){for(let n=0;n<s.series.length;n+=1){const t=s.series[n];for(let i=0;i<t.sources.length;i+=1){const o=t.sources[i];if(o.axis===e)return o}}return null}static getSeriesVisibility(s,e){var n;return(n=e==null?void 0:e.hiddenSeries)!=null&&n.includes(s)?"legendonly":!0}static getHiddenLabels(s){return s!=null&&s.hiddenSeries?[...s.hiddenSeries]:[]}static makeSeriesData(s,e,n,t=k.ORIENTATION.VERTICAL){return{type:s,mode:e,name:n,orientation:t}}static makeSeriesDataFromSeries(s,e,n,t){const{name:i,plotStyle:o,lineColor:r,shapeColor:c,sources:d}=s,h=d.some(b=>{var y;return(y=b.axis)==null?void 0:y.businessCalendar}),m=k.getChartType(o,h),g=k.getPlotlyChartMode(o),f=k.getPlotlySeriesOrientation(s),E=k.makeSeriesData(m,g,i,f);return k.addSourcesToSeriesData(E,o,d,e),k.addStylingToSeriesData(E,o,t,r,c,n),E}static addSourcesToSeriesData(s,e,n,t){const i=s;for(let o=0;o<n.length;o+=1){const r=n[o],{axis:c,type:d}=r,h=k.getPlotlyProperty(e,d);Yo(i,h,[]);const m=c?k.getAxisPropertyName(c.type):null;if(m!=null){const f=t.get(c.type).indexOf(c),E=f>0?`${f+1}`:"";i[`${m}axis`]=`${m}${E}`}}}static addStylingToSeriesData(s,e,n={},t=null,i=null,o=null){const r=s;r.marker={line:{}},r.line={width:1},e===S.plot.SeriesPlotStyle.AREA?r.fill="tozeroy":e===S.plot.SeriesPlotStyle.STACKED_AREA?r.stackgroup="stack":e===S.plot.SeriesPlotStyle.STEP?r.line.shape="hv":e===S.plot.SeriesPlotStyle.HISTOGRAM?(r.width=[],Object.assign(r.marker.line,{color:n.paper_bgcolor,width:1})):e===S.plot.SeriesPlotStyle.OHLC?(r.increasing={line:{color:n.ohlc_increasing}},r.decreasing={line:{color:n.ohlc_decreasing}}):e===S.plot.SeriesPlotStyle.PIE?(r.textinfo="label+percent",r.outsidetextfont={color:n.title_color}):e===S.plot.SeriesPlotStyle.TREEMAP&&(r.hoverinfo="text",r.textinfo="label+text",r.tiling={packing:"squarify",pad:0},r.textposition="middle center"),t!=null&&(e===S.plot.SeriesPlotStyle.BAR?r.marker.color=t:r.line.color=t),i!=null&&(r.marker.color=i),o!=null&&e!==S.plot.SeriesPlotStyle.PIE&&(r.visible=o)}static getAxisFormats(s,e){var o;const n=new Map,t={tickformat:null,ticksuffix:null},{charts:i}=s;for(let r=0;r<i.length;r+=1){const c=i[r],d=k.groupArray(c.axes,"type");for(let h=0;h<c.series.length;h+=1){const m=c.series[h],{sources:g}=m,f=g.filter(E=>E.axis);for(let E=0;E<f.length;E+=1){const b=f[E],{axis:y}=b,{type:C}=y,T=d.get(C).indexOf(y),w=k.getAxisPropertyName(C),_=k.getAxisLayoutProperty(w,T);if(n.has(_))Rn.debug(`${_} already added.`);else{Rn.debug(`Adding ${_} to axisFormats.`);const L=k.getPlotlyAxisFormat(b,e);if(L===null)n.set(_,t);else{n.set(_,L);const{businessCalendar:D}=y;if(D){L.rangebreaks=[];const{businessPeriods:P,businessDays:B,holidays:H,timeZone:$}=D,W=(o=e==null?void 0:e.getColumnTypeFormatter(no))==null?void 0:o.dhTimeZone,Q=W?($.standardOffset-W.standardOffset)/60:0;H.length>0&&L.rangebreaks.push(...k.createRangeBreakValuesFromHolidays(H,$,W)),P.forEach(x=>L.rangebreaks.push({pattern:"hour",bounds:[k.periodToDecimal(x.close)+Q,k.periodToDecimal(x.open)+Q]})),B.length<mt.length&&k.createBoundsFromDays(B).forEach(x=>L.rangebreaks.push({pattern:"day of week",bounds:x}))}if(n.size===c.axes.length)return n}}}}}return n}static getChartType(s,e){switch(s){case S.plot.SeriesPlotStyle.HISTOGRAM:return"bar";default:return k.getPlotlyChartType(s,e)}}static getAxisPropertyName(s){switch(s){case S.plot.AxisType.X:return"x";case S.plot.AxisType.Y:return"y";default:return null}}static getAxisSide(s){switch(s){case S.plot.AxisPosition.BOTTOM:return"bottom";case S.plot.AxisPosition.TOP:return"top";case S.plot.AxisPosition.LEFT:return"left";case S.plot.AxisPosition.RIGHT:return"right";default:return null}}static getChartForSeries(s,e){const{charts:n}=s;for(let t=0;t<n.length;t+=1){const i=n[t];for(let o=0;o<i.series.length;o+=1)if(e===i.series[o])return i}return null}static getLayoutRanges(s){const e={},n=Object.keys(s).filter(t=>t.indexOf("axis")>=0);for(let t=0;t<n.length;t+=1){const i=n[t];s[i]&&s[i].range&&!s[i].autorange&&(e[i]=[...s[i].range])}return e}static updateLayoutAxes(s,e,n=0,t=0,i=null,o={}){const r=n>0?Math.max(k.MIN_AXIS_SIZE,Math.min(k.AXIS_SIZE_PX/t,k.MAX_AXIS_SIZE)):k.DEFAULT_AXIS_SIZE,c=t>0?Math.max(k.MIN_AXIS_SIZE,Math.min(k.AXIS_SIZE_PX/n,k.MAX_AXIS_SIZE)):k.DEFAULT_AXIS_SIZE,d={left:0,bottom:0,top:1,right:1},h=k.groupArray(e,"position");(h.get(S.plot.AxisPosition.RIGHT)||[]).length>0&&(n>0?d.right=1-Math.max(0,Math.min(k.LEGEND_WIDTH_PX/n,k.MAX_LEGEND_SIZE)):d.right=1-k.DEFAULT_AXIS_SIZE);const g=s,f=k.groupArray(e,"type"),E=[...f.keys()];for(let b=0;b<E.length;b+=1){const y=E[b],C=k.getAxisPropertyName(y);if(C!=null){const I=f.get(y),w=y===S.plot.AxisType.Y?t:n;let _=0;for(_=0;_<I.length;_+=1){const D=I[_],P=k.getAxisLayoutProperty(C,_);g[P]==null&&(g[P]=k.makeLayoutAxis(y,o));const B=g[P];k.updateLayoutAxis(B,D,_,h,r,c,d);const{range:H,autorange:$}=B;if(i&&H&&!$){const W=i(D),[Q,x]=W(H);Rn.debug("Setting downsample range",w,Q,x),D.range(w,Q,x)}else D.range(w)}let L=k.getAxisLayoutProperty(C,_);for(;g[L]!=null;)delete g[L],_+=1,L=k.getAxisLayoutProperty(C,_)}}}static getAxisLayoutProperty(s,e){const n=e>0?`${e+1}`:"";return`${s}axis${n}`}static updateLayoutAxis(s,e,n,t,i,o,r){const d=e.type===S.plot.AxisType.Y?o:i,h=s;if(h.title.text=e.label,e.log&&(h.type="log"),h.side=k.getAxisSide(e.position),n>0){h.overlaying=k.getAxisPropertyName(e.type);const m=t.get(e.position),g=m.indexOf(e);g>0&&(h.anchor="free",e.position===S.plot.AxisPosition.RIGHT?h.position=r.right+(g-m.length+1)*d:e.position===S.plot.AxisPosition.TOP?h.position=r.top+(g-m.length+1)*d:e.position===S.plot.AxisPosition.BOTTOM?h.position=r.bottom+(m.length-g+1)*d:e.position===S.plot.AxisPosition.LEFT&&(h.position=r.left+(m.length-g+1)*d))}else if(e.type===S.plot.AxisType.X){const m=t.get(S.plot.AxisPosition.LEFT)||[],g=t.get(S.plot.AxisPosition.RIGHT)||[],f=Math.max(r.left,r.left+(m.length-1)*o),E=Math.min(r.right-(g.length-1)*o,r.right);h.domain=[f,E]}else if(e.type===S.plot.AxisType.Y){const m=t.get(S.plot.AxisPosition.BOTTOM)||[],g=t.get(S.plot.AxisPosition.TOP)||[],f=Math.max(r.bottom,r.bottom+(m.length-1)*i),E=Math.min(r.top-(g.length-1)*i,r.top);h.domain=[f,E]}}static periodToDecimal(s){const e=s.split(":");return Number(e[0])+Number(e[1]/60)}static createBoundsFromDays(s){const e=s.map(o=>mt.indexOf(o)),n=mt.filter(o=>!s.includes(o)).map(o=>mt.indexOf(o)),t=new Set;n.forEach(o=>{for(let r=o+1;r<o+mt.length;r+=1){const c=r%mt.length;if(e.includes(c)){t.add(c);break}}});const i=[];return t.forEach(o=>{for(let r=o-1;r>o-mt.length;r-=1){const c=r<0?r+mt.length:r;if(e.includes(c)){const d=(c+1)%7;i.push([d,o]);break}}}),i}static createRangeBreakValuesFromHolidays(s,e,n){const t=[],i=[];return s.forEach(o=>{o.businessPeriods.length>0?i.push(...k.createPartialHoliday(o,e,n)):t.push(k.createFullHoliday(o,e,n))}),[{values:t},...i]}static createFullHoliday(s,e,n){return k.adjustDateForTimeZone(`${s.date.toString()} 00:00:00.000000`,e,n)}static createPartialHoliday(s,e,n){const t=s.date.toString(),i=["00:00"];s.businessPeriods.forEach(r=>{i.push(r.open),i.push(r.close)}),i.push("24:00");const o=[];for(let r=0;r<i.length;r+=2){const c=i[r],d=i[r+1];if(c!==d){const h=[k.adjustDateForTimeZone(`${t} ${c}:00.000000`,e,n)],m=pd*(k.periodToDecimal(d)-k.periodToDecimal(c));o.push({values:h,dvalue:m})}}return o}static adjustDateForTimeZone(s,e,n){return n&&n.standardOffset!==e.standardOffset?k.unwrapValue(k.wrapValue(s,no,e),n):s}static groupArray(s,e){return s.reduce((n,t)=>{const i=t[e],o=n.get(i)||[];return o.push(t),n.set(i,o),n},new Map)}static updateRanges(){}static unwrapValue(s,e=null){if(s!=null){if(s.asDate)return S.i18n.DateTimeFormat.format(k.DATE_FORMAT,s,e);if(s.asNumber)return s.asNumber()}return s}static wrapValue(s,e,n=null){if(de.isDateType(e)&&typeof s=="string"){const t=s,i=k.DATE_FORMAT.substr(0,s.length),o=S.i18n.DateTimeFormat.parse(i,t);if(!n)return o;const r=`${i} Z`,c=S.i18n.DateTimeFormat.format("Z",o,n),d=S.i18n.DateTimeFormat.parse(r,`${t} ${c}`),h=S.i18n.DateTimeFormat.format("Z",d,n);return S.i18n.DateTimeFormat.parse(r,`${t} ${h}`)}return s}static makeLayoutAxis(s,e={}){const n={automargin:!0,gridcolor:e.gridcolor,linecolor:e.linecolor,rangeslider:{visible:!1},showline:!0,ticklen:5,tickcolor:e.paper_bgcolor,tickfont:{color:e.zerolinecolor},title:{font:{color:e.title_color}}};return s===S.plot.AxisType.X?Object.assign(n,{showgrid:!0}):s===S.plot.AxisType.Y&&Object.assign(n,{zerolinecolor:e.zerolinecolor,zerolinewidth:2}),n}static getColorwayFromTheme(s){let e=[];return s.colorway&&(Array.isArray(s.colorway)?e=s.colorway:typeof s.colorway=="string"?e=s.colorway.split(" "):Rn.warn(`Unable to handle colorway property: ${s.colorway}`)),e}static makeDefaultLayout(s={}){const e={...s,autosize:!0,colorway:k.getColorwayFromTheme(s),font:{family:"'Fira Sans', sans-serif"},title:{font:{color:s.title_color},yanchor:"top",pad:{...k.DEFAULT_TITLE_PADDING},y:1},legend:{font:{color:s.title_color}},margin:{...k.DEFAULT_MARGIN},xaxis:k.makeLayoutAxis(S.plot.AxisType.X,s),yaxis:k.makeLayoutAxis(S.plot.AxisType.Y,s)};return e.datarevision=0,e}static hydrateSettings(s){return{...s,type:S.plot.SeriesPlotStyle[s.type]}}static titleFromSettings(s){const{series:e,xAxis:n,title:t=`${e.join(", ")} by ${n}`}=s;return t}static makeFigureSettings(s,e){const{series:n,xAxis:t,type:i}=s,o=k.titleFromSettings(s),r={formatType:`${S.plot.AxisFormatType.NUMBER}`,type:`${S.plot.AxisType.X}`,position:`${S.plot.AxisPosition.BOTTOM}`},c={formatType:`${S.plot.AxisFormatType.NUMBER}`,type:`${S.plot.AxisType.Y}`,position:`${S.plot.AxisPosition.LEFT}`};return{charts:[{chartType:`${S.plot.ChartType.XY}`,axes:[r,c],series:n.map(d=>({plotStyle:`${i}`,name:d,dataSources:[{type:`${S.plot.SourceType.X}`,columnName:t,axis:r,table:e},{type:`${S.plot.SourceType.Y}`,columnName:d,axis:c,table:e}]}))}],title:o}}};let Z=k;v(Z,"DEFAULT_AXIS_SIZE",.15),v(Z,"MIN_AXIS_SIZE",.025),v(Z,"MAX_AXIS_SIZE",.2),v(Z,"AXIS_SIZE_PX",75),v(Z,"LEGEND_WIDTH_PX",50),v(Z,"MAX_LEGEND_SIZE",.25),v(Z,"ORIENTATION",Object.freeze({HORIZONTAL:"h",VERTICAL:"v"})),v(Z,"DATE_FORMAT","yyyy-MM-dd HH:mm:ss.SSSSSS"),v(Z,"DEFAULT_MARGIN",Object.freeze({l:60,r:50,t:30,b:60,pad:0})),v(Z,"DEFAULT_TITLE_PADDING",Object.freeze({t:8})),v(Z,"SUBTITLE_LINE_HEIGHT",25);const pt=O.module("Chart");class lt extends p.exports.Component{constructor(e){super(e);v(this,"getCachedConfig",te((e,n,t,i)=>{const o=[];if(e&&o.push({name:`Downsampling failed: ${e}`,click:()=>{},icon:lt.convertIcon(dr),attr:"fill-warning"}),n||t||i||e){const r=lt.downsampleButtonTitle(t,i),c=lt.downsampleButtonAttr(t,i),d=t?hr:ur;o.push({name:r,icon:lt.convertIcon(d),click:this.handleDownsampleClick,attr:c})}return{displaylogo:!1,displayModeBar:t||e?!0:"hover",modeBarButtons:[o,["toImage"],["zoom2d","pan2d"],["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]]}}));this.handleAfterPlot=this.handleAfterPlot.bind(this),this.handleDownsampleClick=this.handleDownsampleClick.bind(this),this.handleModelEvent=this.handleModelEvent.bind(this),this.handlePlotUpdate=this.handlePlotUpdate.bind(this),this.handleRelayout=this.handleRelayout.bind(this),this.handleRestyle=this.handleRestyle.bind(this),this.plot=a.createRef(),this.plotWrapper=a.createRef(),this.columnFormats=[],this.dateTimeFormatterOptions={},this.decimalFormatOptions={},this.integerFormatOptions={},this.rect=null,this.ranges=null,this.isSubscribed=!1,this.isLoadedFired=!1,this.state={data:null,downsamplingError:null,isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,layout:{datarevision:0},revision:0}}static convertIcon(e){const[n,,,,t]=e.icon;return{width:n,path:t,ascent:n,descent:0,transform:"matrix(1, 0, 0, 1, 0, 0)"}}static downsampleButtonTitle(e,n){return e?"Downsampling in progress...":n?"Downsampling disabled, click to enable":"Downsampling enabled, click to disable"}static downsampleButtonAttr(e,n){return e?"animation-spin":n?void 0:"fill-active"}componentDidMount(){this.updateDimensions(),this.updateModelDimensions(),this.initData(),this.initFormatter();const{isActive:e}=this.props;e&&this.subscribe()}componentDidUpdate(e){const{isActive:n,settings:t}=this.props;this.updateFormatterSettings(t),n!==e.isActive&&(n?this.subscribe():this.unsubscribe())}componentWillUnmount(){this.unsubscribe()}getPlotRect(){var e,n;return(n=(e=this.plotWrapper.current)==null?void 0:e.getBoundingClientRect())!=null?n:null}initData(){const{model:e}=this.props,{layout:n}=this.state;this.setState({data:e.getData(),layout:{...n,...e.getLayout()}})}subscribe(){if(this.isSubscribed)return;const{model:e}=this.props;if(!this.rect||this.rect.width===0||this.rect.height===0){pt.debug2("Delaying subscription until model dimensions are set");return}e.subscribe(this.handleModelEvent),this.isSubscribed=!0}unsubscribe(){if(!this.isSubscribed)return;const{model:e}=this.props;e.unsubscribe(this.handleModelEvent),this.isSubscribed=!1}handleAfterPlot(){this.plot.current}handleDownsampleClick(){this.setState(({isDownsamplingDisabled:e})=>({downsamplingError:null,isDownsampleInProgress:!1,isDownsampleFinished:!1,isDownsamplingDisabled:!e}),()=>{const{model:e}=this.props,{isDownsamplingDisabled:n}=this.state;e.setDownsamplingDisabled(n)})}handleModelEvent(e){const{type:n,detail:t}=e;switch(pt.debug2("Received data update",n,t),n){case he.EVENT_UPDATED:{this.currentSeries+=1,this.setState(o=>{const{layout:r,revision:c}=o;return r.datarevision+=1,{data:t,layout:r,revision:c+1}});const{onUpdate:i}=this.props;i({isLoading:!this.isLoadedFired});break}case he.EVENT_LOADFINISHED:{const{onUpdate:i}=this.props;this.isLoadedFired=!0,i({isLoading:!1});break}case he.EVENT_DISCONNECT:{const{onDisconnect:i}=this.props;i();break}case he.EVENT_RECONNECT:{const{onReconnect:i}=this.props;i();break}case he.EVENT_DOWNSAMPLESTARTED:{this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!0,downsamplingError:null});break}case he.EVENT_DOWNSAMPLEFINISHED:{this.setState({isDownsampleFinished:!0,isDownsampleInProgress:!1,downsamplingError:null});break}case he.EVENT_DOWNSAMPLENEEDED:case he.EVENT_DOWNSAMPLEFAILED:{const i=t.message?t.message:t;this.setState({isDownsampleFinished:!1,isDownsampleInProgress:!1,isDownsamplingDisabled:!1,downsamplingError:i});const{onError:o}=this.props;o(new Error(i));break}default:pt.debug("Unknown event type",n,e)}}handlePlotUpdate(e){const{layout:n}=e,t=Z.getLayoutRanges(n);!Ke(t,this.ranges)&&(this.ranges=t,this.updateModelDimensions(!0))}handleRelayout(e){if(pt.debug("handleRelayout",e),Object.keys(e).includes("hiddenlabels")){const{onSettingsChanged:n}=this.props,t=[...e.hiddenlabels];n({hiddenSeries:t})}this.updateModelDimensions()}handleRestyle([e,n]){if(pt.debug("handleRestyle",e,n),Object.keys(e).includes("visible")){const{data:t}=this.state,{onSettingsChanged:i}=this.props,o=t.reduce((r,{name:c,visible:d})=>d==="legendonly"?[...r,c]:r,[]);i({hiddenSeries:o})}}updateModelDimensions(e=!1){const n=this.getPlotRect();if(!n){pt.warn("Unable to get plotting rect");return}if(!this.rect||this.rect.width!==n.width||this.rect.height!==n.height||e){this.rect=n;const{isActive:i,model:o}=this.props;o.setDimensions(n),i&&this.subscribe()}}initFormatter(){const{settings:e}=this.props;this.updateFormatterSettings(e)}updateFormatterSettings(e){const n=Bn.getColumnFormats(e),t=Bn.getDateTimeFormatterOptions(e),{decimalFormatOptions:i={},integerFormatOptions:o={}}=e;(!Ke(this.columnFormats,n)||!Ke(this.dateTimeFormatterOptions,t)||!Ke(this.decimalFormatOptions,i)||!Ke(this.integerFormatOptions,o))&&(this.columnFormats=Bn.getColumnFormats(e),this.dateTimeFormatterOptions=t,this.decimalFormatOptions=i,this.integerFormatOptions=o,this.updateFormatter())}updateFormatter(){const e=new qn(this.columnFormats,this.dateTimeFormatterOptions,this.decimalFormatOptions,this.integerFormatOptions),{model:n}=this.props;n.setFormatter(e)}updateDimensions(){const e=this.getPlotRect();this.plot.current!=null&&e!=null&&e.width>0&&e.height>0&&Yn.relayout(this.plot.current.el,{autosize:!0}).catch(n=>{pt.debug("Unable to resize, promise rejected",n)})}render(){const{data:e,downsamplingError:n,isDownsampleFinished:t,isDownsampleInProgress:i,isDownsamplingDisabled:o,layout:r,revision:c}=this.state,d=this.getCachedConfig(n,t,i,o),h=e!=null;return a.createElement("div",{className:"h-100 w-100 chart-wrapper",ref:this.plotWrapper},h&&a.createElement(md,{ref:this.plot,data:e,layout:r,revision:c,config:d,onAfterPlot:this.handleAfterPlot,onError:pt.error,onRelayout:this.handleRelayout,onUpdate:this.handlePlotUpdate,onRestyle:this.handleRestyle,useResizeHandler:!0,style:{height:"100%",width:"100%"}}))}}lt.propTypes={model:u.exports.instanceOf(he).isRequired,settings:u.exports.shape({timeZone:u.exports.string.isRequired,defaultDateTimeFormat:u.exports.string.isRequired,showTimeZone:u.exports.bool.isRequired,showTSeparator:u.exports.bool.isRequired,formatter:u.exports.arrayOf(u.exports.shape({})).isRequired,decimalFormatOptions:u.exports.shape({defaultFormatString:u.exports.string}),integerFormatOptions:u.exports.shape({defaultFormatString:u.exports.string})}),isActive:u.exports.bool,onDisconnect:u.exports.func,onReconnect:u.exports.func,onUpdate:u.exports.func,onError:u.exports.func,onSettingsChanged:u.exports.func};lt.defaultProps={isActive:!0,settings:{timeZone:"America/New_York",defaultDateTimeFormat:ko.FULL_DATE_FORMAT,showTimeZone:!1,showTSeparator:!0,formatter:[]},onDisconnect:()=>{},onReconnect:()=>{},onUpdate:()=>{},onError:()=>{},onSettingsChanged:()=>{}};const Te=O.module("FigureChartModel"),Pi=class extends he{constructor(e,n={},t={}){super();v(this,"getTimeZone",Ze((e,n)=>{if(n!=null){const t=n.getColumnTypeFormatter(e);if(t!=null)return t.dhTimeZone}return null}));v(this,"getValueTranslator",Ze((e,n)=>{const t=this.getTimeZone(e,n);return i=>Z.unwrapValue(i,t)}));v(this,"getValueParser",Ze((e,n)=>{const t=this.getTimeZone(e,n);return i=>Z.wrapValue(i,e,t)}));v(this,"getRangeParser",Ze((e,n)=>t=>{let[i,o]=t;const r=this.getValueParser(e,n);return i=r(i),o=r(o),[i,o]}));v(this,"getAxisRangeParser",Ze((e,n)=>t=>{const i=Z.getSourceForAxis(e,t);return i?this.getRangeParser(i.columnType,n):o=>o}));this.handleFigureUpdated=this.handleFigureUpdated.bind(this),this.handleFigureDisconnected=this.handleFigureDisconnected.bind(this),this.handleFigureReconnected=this.handleFigureReconnected.bind(this),this.handleFigureSeriesAdded=this.handleFigureSeriesAdded.bind(this),this.handleDownsampleStart=this.handleDownsampleStart.bind(this),this.handleDownsampleFinish=this.handleDownsampleFinish.bind(this),this.handleDownsampleFail=this.handleDownsampleFail.bind(this),this.handleDownsampleNeeded=this.handleDownsampleNeeded.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.addPendingSeries=Ye(this.addPendingSeries.bind(this),Pi.ADD_SERIES_DEBOUNCE),this.figure=e,this.settings=n,this.theme=t,this.data=[],this.layout=Z.makeDefaultLayout(t),this.seriesDataMap=new Map,this.pendingSeries=[],this.oneClicks=[],this.filterColumnMap=new Map,this.lastFilter=new Map,this.isConnected=!0,this.seriesToProcess=new Set,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure()}close(){this.figure.close(),this.addPendingSeries.cancel(),this.stopListeningFigure()}getDefaultTitle(){return this.figure.charts.length>0?this.figure.charts[0].title:""}initAllSeries(){this.oneClicks=[],this.filterColumnMap.clear();const{charts:e}=this.figure,n=[];for(let o=0;o<e.length;o+=1){const r=e[o];for(let c=0;c<r.series.length;c+=1){const d=r.series[c];n.push(d.name),this.addSeries(d)}}const i=[...this.seriesDataMap.keys()].filter(o=>n.indexOf(o)<0);for(let o=0;o<i;o+=1){const r=i[o];this.seriesDataMap.delete(r)}this.seriesToProcess=new Set([...this.seriesDataMap.keys()])}addSeries(e){const n=Z.getChartForSeries(this.figure,e);if(n==null){Te.error("Unable to find matching chart for series",e);return}const t=Z.groupArray(n.axes,"type"),i=Z.makeSeriesDataFromSeries(e,t,Z.getSeriesVisibility(e.name,this.settings),this.theme);if(this.seriesDataMap.set(e.name,i),this.data=[...this.seriesDataMap.values()],e.plotStyle===S.plot.SeriesPlotStyle.STACKED_BAR?this.layout.barmode="stack":e.plotStyle===S.plot.SeriesPlotStyle.PIE&&(this.layout.hiddenlabels=Z.getHiddenLabels(this.settings)),this.layout.showlegend=this.data.length>1||e.plotStyle===S.plot.SeriesPlotStyle.PIE,e.oneClick){const{oneClick:o}=e,{columns:r}=o;for(let c=0;c<r.length;c+=1)this.filterColumnMap.set(r[c].name,r[c]);this.oneClicks.push(o)}this.updateLayoutFormats()}addPendingSeries(){const{pendingSeries:e}=this;for(let n=0;n<e.length;n+=1){const t=e[n];this.addSeries(t),t.subscribe()}this.pendingSeries=[]}subscribe(...e){super.subscribe(...e),this.listeners.length===1&&(this.initAllSeries(),this.subscribeFigure())}unsubscribe(...e){super.unsubscribe(...e),this.listeners.length===0&&this.unsubscribeFigure()}subscribeFigure(){if(!this.isConnected){Te.debug("Ignoring subscribe when figure in disconnected state");return}this.figure.subscribe(this.isDownsamplingDisabled?S.plot.DownsampleOptions.DISABLE:S.plot.DownsampleOptions.DEFAULT)}unsubscribeFigure(){this.figure.unsubscribe()}startListeningFigure(){this.figure.addEventListener(S.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.addEventListener(S.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.addEventListener(S.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.addEventListener(S.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.addEventListener(S.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.addEventListener(S.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.addEventListener(S.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.addEventListener(S.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.addEventListener(S.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}stopListeningFigure(){this.figure.removeEventListener(S.plot.Figure.EVENT_UPDATED,this.handleFigureUpdated),this.figure.removeEventListener(S.plot.Figure.EVENT_SERIES_ADDED,this.handleFigureSeriesAdded),this.figure.removeEventListener(S.plot.Figure.EVENT_DISCONNECT,this.handleFigureDisconnected),this.figure.removeEventListener(S.plot.Figure.EVENT_RECONNECT,this.handleFigureReconnected),this.figure.removeEventListener(S.plot.Figure.EVENT_DOWNSAMPLESTARTED,this.handleDownsampleStart),this.figure.removeEventListener(S.plot.Figure.EVENT_DOWNSAMPLEFINISHED,this.handleDownsampleFinish),this.figure.removeEventListener(S.plot.Figure.EVENT_DOWNSAMPLEFAILED,this.handleDownsampleFail),this.figure.removeEventListener(S.plot.Figure.EVENT_DOWNSAMPLENEEDED,this.handleDownsampleNeeded),this.figure.removeEventListener(S.Client.EVENT_REQUEST_FAILED,this.handleRequestFailed)}handleDownsampleStart(e){Te.debug("Downsample started",e),this.fireDownsampleStart(e.detail)}handleDownsampleFinish(e){Te.debug("Downsample finished",e),this.fireDownsampleFinish(e.detail)}handleDownsampleFail(e){Te.error("Downsample failed",e),this.fireDownsampleFail(e.detail)}handleDownsampleNeeded(e){Te.info("Downsample needed",e),this.fireDownsampleNeeded(e.detail)}handleFigureUpdated(e){const{detail:n}=e,{series:t}=n;Te.debug2("handleFigureUpdated",t);for(let o=0;o<t.length;o+=1){const r=t[o];Te.debug2("handleFigureUpdated updating series",r.name);const{sources:c}=r;for(let d=0;d<c.length;d+=1){const h=c[d],{columnType:m,type:g}=h,f=this.getValueTranslator(m,this.formatter),E=n.getArray(r,g,f);this.setDataArrayForSeries(r,g,E)}this.seriesToProcess.delete(r.name),this.seriesToProcess.size===0&&this.fireLoadFinished(),this.cleanSeries(r)}const{data:i}=this;this.fireUpdate(i)}handleRequestFailed(e){Te.error("Request failed",e)}resubscribe(){this.listeners.length>0&&(this.unsubscribeFigure(),this.subscribeFigure())}setFormatter(e){super.setFormatter(e),this.updateLayoutFormats(),this.resubscribe()}setDownsamplingDisabled(...e){super.setDownsamplingDisabled(...e),this.resubscribe()}handleFigureDisconnected(e){Te.debug("Figure disconnected",e),this.isConnected=!1,this.listeners.length>0&&this.unsubscribeFigure(),this.fireDisconnect()}handleFigureReconnected(e){Te.debug("Figure reconnected",e),this.isConnected=!0,this.initAllSeries(),this.fireReconnect(),this.listeners.length>0&&this.subscribeFigure()}handleFigureSeriesAdded(e){const{detail:n}=e;Te.debug("handleFigureSeriesAdded",n),this.pendingSeries.push(n),this.addPendingSeries()}setDimensions(e){super.setDimensions(e),this.updateAxisPositions()}setTitle(e){var t,i;super.setTitle(e);const n=(i=(t=(e!=null?e:"").match(/<br>/g))==null?void 0:t.length)!=null?i:0;this.layout.margin.t=Z.DEFAULT_MARGIN.t+n*Z.SUBTITLE_LINE_HEIGHT,this.layout.title.text=e,this.layout.title.pad.t=Z.DEFAULT_TITLE_PADDING.t+n*Z.SUBTITLE_LINE_HEIGHT*.5}getPlotWidth(){return!this.rect||!this.rect.width?0:Math.max(this.rect.width-this.layout.margin.l-this.layout.margin.r,0)}getPlotHeight(){return!this.rect||!this.rect.height?0:Math.max(this.rect.height-this.layout.margin.t-this.layout.margin.b,0)}updateAxisPositions(){const e=this.getPlotWidth(),n=this.getPlotHeight();for(let t=0;t<this.figure.charts.length;t+=1){const i=this.figure.charts[t],o=this.getAxisRangeParser(i,this.formatter);Z.updateLayoutAxes(this.layout,i.axes,e,n,o,this.theme)}}updateLayoutFormats(){if(!this.formatter)return;Z.getAxisFormats(this.figure,this.formatter).forEach((n,t)=>{Te.debug(`Assigning ${t}`,this.layout[t],n),this.layout[t]!=null?Object.assign(this.layout[t],n):Te.debug(`Ignoring null layout.${t}`)})}setDataArrayForSeries(e,n,t){const{name:i,plotStyle:o}=e,r=this.seriesDataMap.get(i),c=Z.getPlotlyProperty(o,n);Yo(r,c,t)}cleanSeries(e){const{name:n,plotStyle:t}=e,i=this.seriesDataMap.get(n);if(t===S.plot.SeriesPlotStyle.HISTOGRAM){const{xLow:o,xHigh:r}=i;if(o&&r&&o.length===r.length){const c=[];for(let d=0;d<o.length;d+=1)c.push(r[d]-o[d]);i.width=c}}else if(t===S.plot.SeriesPlotStyle.LINE){const{x:o,xLow:r,xHigh:c,y:d,yLow:h,yHigh:m}=i;r&&c&&r!==o&&(i.error_x=Z.getPlotlyErrorBars(o,r,c)),h&&m&&h!==d&&(i.error_y=Z.getPlotlyErrorBars(d,h,m))}else if(t===S.plot.SeriesPlotStyle.TREEMAP){const{ids:o,labels:r}=i;o!==void 0&&r===void 0&&(i.labels=o)}}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){return new Map(this.filterColumnMap)}isFilterRequired(){return this.oneClicks.find(e=>e.requireAllFiltersToDisplay)!=null}setFilter(e){if(this.oneClicks.length===0){Te.warn("Trying to set a filter, but no one click!");return}Te.debug("setFilter",e);for(let n=0;n<this.oneClicks.length;n+=1){const t=this.oneClicks[n],{columns:i}=t;new Set([...e.keys(),...this.lastFilter.keys()]).forEach(r=>{const c=e.get(r);this.lastFilter.get(r)!==c&&i.find(d=>d.name===r)!=null&&t.setValueForColumn(r,c)})}this.lastFilter=new Map(e)}setFigure(e){this.close(),this.figure=e,this.setTitle(this.getDefaultTitle()),this.initAllSeries(),this.updateAxisPositions(),this.startListeningFigure(),this.listeners.length>0&&this.subscribeFigure()}updateSettings(e){this.settings=e}};let mn=Pi;v(mn,"ADD_SERIES_DEBOUNCE",50);const fd="#76d9e4 #9edc6f #fcd65b #aa9af4 #f37e3f #f95d84 #f0f0ee",Ed="#403e41",bd="#5b5a5c",Cd="#c0bfbf",Sd="#4878ea",yd="rgba(91, 90, 92, 0.7)",_e={"paper-bgcolor":"#2d2a2e","plot-bgcolor":"#322f33","title-color":"#f0f0ee",colorway:fd,gridcolor:Ed,linecolor:bd,zerolinecolor:Cd,activecolor:Sd,rangebgcolor:yd,"area-color":"#76d9e4","trend-color":"#d5f0c1","line-color":"#9edc6f","error-band-line-color":"white","error-band-fill-color":"rgba(213, 240, 193, 0.1)","ohlc-increasing":"#9edc6f","ohlc-decreasing":"#f95d84"},ft=Object.freeze({paper_bgcolor:_e["paper-bgcolor"],plot_bgcolor:_e["plot-bgcolor"],title_color:_e["title-color"],colorway:_e.colorway,gridcolor:_e.gridcolor,linecolor:_e.linecolor,zerolinecolor:_e.zerolinecolor,activecolor:_e.activecolor,rangebgcolor:_e.rangebgcolor,area_color:_e["area-color"],trend_color:_e["trend-color"],line_color:_e["line-color"],error_band_line_color:_e["error-band-line-color"],error_band_fill_color:_e["error-band-fill-color"],ohlc_increasing:_e["ohlc-increasing"],ohlc_decreasing:_e["ohlc-decreasing"]});class Qt{static async makeModelFromSettings(s,e,n=ft){const t=await Qt.makeFigureFromSettings(s,e);return new mn(t,s,n)}static async makeFigureFromSettings(s,e){const n=await e.copy();return n.applyCustomColumns(e.customColumns),n.applyFilter(e.filter),n.applySort(e.sort),S.plot.Figure.create(Z.makeFigureSettings(s,n))}static async makeModel(s,e,n=ft){return new mn(e,s,n)}}const Me=class extends he{static makeRandomSeries(s,e=1,n=100){const t=[],i=[],o=[],r=[],c=new Date;for(let d=0;d<n;d+=1){const h=new Date(c.getFullYear(),c.getMonth(),c.getDate()+d-n);t.push(`${h.getFullYear()}-${h.getMonth()+1}-${h.getDate()}`);let m=(Math.sin(d/n*s)*n/3+Math.cos(d*.2)*n/6+Math.sin(d*.5)*n/10+Math.random()*n/5+d*Me.smoothing)*e;m=Math.round(m*100)/100,i.push(m),r.push(40+d*Me.smoothing),o.push(Math.sin(d/n*s)*n/3+Math.random()*n/10+d*Me.smoothing)}return{x:t,y:i,s:o,l:r}}static makeScatter(s){return{name:"SCTR",x:s.x,y:s.y,type:"scattergl",mode:"markers",hoverinfo:"skip",marker:{size:5}}}static makeArea(s){return{name:"AREA",x:s.x,y:s.s,type:"scatter",mode:"line",fill:"tozeroy",hoverinfo:"all",line:{color:ft.area_color,width:3}}}static makeTrendline(s){return{name:"Trendline <br>R<sup>2</sup> = 0.91",x:s.x,y:s.l,type:"scattergl",mode:"line",hoverinfo:"skip",line:{width:3,dash:"dot",color:ft.trend_color}}}static makeErrorBand(s){const e=[],n=[];for(let i=0;i<s.y.length;i+=1){const o=s.y[i];e[i]=Math.round((o+18)*100)/100,n[i]=Math.round((o-18)*100)/100}const t=e.concat(n.reverse());return{name:"error",x:s.x.concat(s.x.slice().reverse()),y:t,type:"scattergl",mode:"line",hoverinfo:"skip",fill:"toself",fillcolor:ft.error_band_fill_color,line:{width:0,color:ft.error_band_line_color,shape:"spline"}}}static makeLine(s){return{name:"LINE",x:s.x,y:s.y,type:"scattergl",mode:"line",hoverinfo:"x+y+text+name",line:{color:ft.line_color,width:3}}}static makeRandomData(){const s=Me.makeRandomSeries(6),e=Me.makeArea(s),n=Me.makeTrendline(s),t=Me.makeRandomSeries(2),i=Me.makeLine(t),o=Me.makeErrorBand(t);return[e,n,i,o]}static makeDefaultLayout(){const s=Z.makeDefaultLayout(ft);return s.title="Chart",s.xaxis.title="Datestamp",s.yaxis.title="Price",s}constructor({data:s=Me.makeRandomData(),layout:e=Me.makeDefaultLayout(),filterFields:n=[]}={}){super(),this.data=s,this.layout=e,this.filterFields=n}getData(){return this.data}getLayout(){return this.layout}getFilterColumnMap(){const s=new Map;for(let e=0;e<this.filterFields.length;e+=1){const n=this.filterFields[e],t="java.lang.String";s.set(n,{name:n,type:t})}return s}isFilterRequired(){return this.filterFields.length>0}setFilter(){this.fireUpdate(this.data)}};let $n=Me;v($n,"smoothing",1.5);class wd extends Mo{constructor(s,e){var n;super(),this.data=s,this.numberOfColumns=Math.max(...s.map(t=>t.length),(n=e==null?void 0:e.length)!=null?n:0),this.columnHeaders=e}get rowCount(){return this.data.length}get columnCount(){return this.numberOfColumns}textForCell(s,e){var n;return`${(n=this.data[e])==null?void 0:n[s]}`}textForColumnHeader(s){var e,n;return(n=(e=this.columnHeaders)==null?void 0:e[s])!=null?n:""}}class vd extends Mo{constructor(s,e){super(),this.numberOfColumns=s,this.numberOfRows=e}get columnCount(){return this.numberOfColumns}get rowCount(){return this.numberOfRows}textForCell(s,e){var i,o,r,c,d,h,m;const n=e-((o=(i=this.viewportData)==null?void 0:i.rowOffset)!=null?o:0),t=s-((c=(r=this.viewportData)==null?void 0:r.columnOffset)!=null?c:0);return`${(m=(h=(d=this.viewportData)==null?void 0:d.data[n])==null?void 0:h[t])!=null?m:""}`}textForColumnHeader(s){return`${s}`}textForRowHeader(s){return`${s}`}}class Gt{}v(Gt,"OPEN","ChartEvent.OPEN"),v(Gt,"CLOSE","ChartEvent.CLOSE"),v(Gt,"COLUMN_SELECTED","ChartEvent.COLUMN_SELECTED");class fe{}v(fe,"SESSION_OPENED","ConsoleEvent.SESSION_OPENED"),v(fe,"SESSION_CLOSED","ConsoleEvent.SESSION_CLOSED"),v(fe,"FOCUS_HISTORY","ConsoleEvent.FOCUS_HISTORY"),v(fe,"SEND_COMMAND","ConsoleEvent.SEND_COMMAND"),v(fe,"SETTINGS_CHANGED","ConsoleEvent.SETTINGS_CHANGED");class J{}v(J,"TABLE_CHANGED","InputFilterEvent.TABLE_CHANGED"),v(J,"COLUMNS_CHANGED","InputFilterEvent.COLUMNS_CHANGED"),v(J,"FILTERS_CHANGED","InputFilterEvent.FILTERS_CHANGED"),v(J,"CLEAR_ALL_FILTERS","InputFilterEvent.CLEAR_ALL_FILTERS"),v(J,"COLUMN_SELECTED","InputFilterEvent.COLUMN_SELECTED"),v(J,"OPEN_DROPDOWN","InputFilterEvent.OPEN_DROPDOWN"),v(J,"OPEN_INPUT","InputFilterEvent.OPEN_INPUT"),v(J,"OPEN_FILTER_SET_MANAGER","InputFilterEvent.OPEN_FILTER_SET_MANAGER");class ye{}v(ye,"OPEN_GRID","IrisGridEvent.OPEN_GRID"),v(ye,"CLOSE_GRID","IrisGridEvent.CLOSE_GRID"),v(ye,"DATA_SELECTED","IrisGridEvent.DATA_SELECTED"),v(ye,"COLUMN_SELECTED","IrisGridEvent.COLUMN_SELECTED"),v(ye,"STATE_CHANGED","IrisGridEvent.STATE_CHANGED"),v(ye,"CREATE_CHART","IrisGridevent.CREATE_CHART");const va=Object.freeze({OPEN:"MarkdownEvent.OPEN"});class ee{}v(ee,"CREATE_NOTEBOOK","NotebookEvent.createNotebook"),v(ee,"SELECT_NOTEBOOK","NotebookEvent.selectNotebook"),v(ee,"CLOSE_FILE","NotebookEvent.closeFile"),v(ee,"RENAME","NotebookEvent.rename"),v(ee,"RENAME_FILE","NotebookEvent.renameFile"),v(ee,"REGISTER_FILE","NotebookEvent.registerFile"),v(ee,"SEND_TO_NOTEBOOK","NotebookEvent.sendToNotebook"),v(ee,"UNREGISTER_FILE","NotebookEvent.unregisterFile");class nt{}v(nt,"focus","TabEvent.focus"),v(nt,"blur","TabEvent.blur"),v(nt,"openPQObject","TabEvent.openPQObject"),v(nt,"openControl","TabEvent.openControl"),v(nt,"reload","TabEvent.reload"),v(nt,"clearAllFilters","TabEvent.clearAllFilters");class hi extends p.exports.PureComponent{constructor(s){super(s),this.handleCloseTab=this.handleCloseTab.bind(this),this.handleCloseTabsRight=this.handleCloseTabsRight.bind(this),this.handleCloseTabsAll=this.handleCloseTabsAll.bind(this)}getAllTabs(){var e,n,t;const{glContainer:s}=this.props;return[...(t=(n=(e=s==null?void 0:s.tab)==null?void 0:e.header)==null?void 0:n.tabs)!=null?t:[]]}handleCloseTab(){const{glContainer:s}=this.props;s.close()}handleCloseTabsAll(){this.getAllTabs().forEach(e=>{var n,t;return(t=(n=e==null?void 0:e.contentItem)==null?void 0:n.container)==null?void 0:t.close()})}handleCloseTabsRight(){var n,t,i,o,r,c,d,h;const{glContainer:s}=this.props,e=this.getAllTabs();for(let m=e.length-1;m>0&&((t=(n=e[m].contentItem)==null?void 0:n.config)==null?void 0:t.id)!==((r=(o=(i=s.tab)==null?void 0:i.contentItem)==null?void 0:o.config)==null?void 0:r.id);m-=1)(h=(d=(c=e[m])==null?void 0:c.contentItem)==null?void 0:d.container)==null||h.close()}canCloseTabsRight(){var t,i,o,r,c,d,h,m;const{glContainer:s}=this.props,e=this.getAllTabs();let n=!0;for(let g=e.length-1;g>0&&((i=(t=e[g].contentItem)==null?void 0:t.config)==null?void 0:i.id)!==((c=(r=(o=s.tab)==null?void 0:o.contentItem)==null?void 0:r.config)==null?void 0:c.id);g-=1)if((m=(h=(d=e[g])==null?void 0:d.contentItem)==null?void 0:h.config)!=null&&m.isClosable){n=!1;break}return n}canCloseAny(){var n,t,i;const s=this.getAllTabs();let e=!0;for(let o=s.length-1;o>0;o-=1)if((i=(t=(n=s[o])==null?void 0:n.contentItem)==null?void 0:t.config)!=null&&i.isClosable){e=!1;break}return e}render(){var t,i,o;const{additionalActions:s,glContainer:e}=this.props,n=[].concat(s);return n.push({title:"Close",order:10,group:re.groups.low,action:this.handleCloseTab,disabled:!((o=(i=(t=e.tab)==null?void 0:t.contentItem)==null?void 0:i.config)!=null&&o.isClosable)}),n.push(()=>({title:"Close Tabs to Right",order:20,group:re.groups.low,action:this.handleCloseTabsRight,disabled:this.canCloseTabsRight()})),n.push(()=>({title:"Close All",order:30,group:re.groups.low,action:this.handleCloseTabsAll,disabled:this.canCloseAny()})),a.createElement(re,{actions:n})}}hi.propTypes={additionalActions:u.exports.oneOfType([u.exports.array,u.exports.func]),glContainer:ae.Container.isRequired};hi.defaultProps={additionalActions:[]};class ms extends p.exports.PureComponent{constructor(s){super(s),this.handleRenameDialogOpened=this.handleRenameDialogOpened.bind(this),this.handleRenameInputChange=this.handleRenameInputChange.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.renameInputRef=a.createRef();const{value:e}=s;this.state={value:e,valueWasValidated:!1}}componentDidUpdate(s){const{isShown:e}=s,{isShown:n}=this.props;n&&!e&&this.resetState()}resetState(){const{value:s}=this.props;this.setState({value:s,valueWasValidated:!1})}handleRenameDialogOpened(){this.renameInputRef&&this.renameInputRef.current.focus()}handleRenameInputChange(s){this.setState({value:s.target.value})}handleRenameCancel(){const{onCancel:s}=this.props;s()}handleRenameSubmit(s){s.stopPropagation(),s.preventDefault();const{value:e}=this.state,n=e.trim();if(n!==""){const{onSubmit:t}=this.props;t(n)}else this.setState({value:n,valueWasValidated:!0})}renderRenameDialog(){const{isShared:s,isOwner:e,itemType:n}=this.props,{value:t,valueWasValidated:i}=this.state;return a.createElement("form",{className:z("p-3",{"was-validated":i}),onSubmit:this.handleRenameSubmit,noValidate:!0,role:"presentation",onMouseDown:o=>{o.stopPropagation()},onMouseUp:o=>{o.stopPropagation()}},a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:`rename-dialog-${n}-input`},"Rename ",n),a.createElement("input",{type:"text",className:"form-control",id:`rename-dialog-${n}-input`,value:t,ref:this.renameInputRef,onChange:this.handleRenameInputChange,required:!0}),a.createElement("div",{className:"invalid-feedback"},n," name cannot be empty"),(s||!e)&&a.createElement("div",{className:"pt-2"},"Renaming this ",n," will rename for all users.")),a.createElement("div",{className:"text-right"},a.createElement("button",{type:"button",className:"btn btn-outline-primary mr-2",onClick:this.handleRenameCancel},"Cancel"),a.createElement("button",{type:"submit",className:"btn btn-primary"},"Rename")))}render(){const{isShown:s,onCancel:e}=this.props;return a.createElement(qs,{isShown:s,onEntered:this.handleRenameDialogOpened,onExited:e,options:{placement:"bottom",modifiers:{preventOverflow:{boundariesElement:"viewport"}}},interactive:!0,closeOnBlur:!0},this.renderRenameDialog())}}ms.propTypes={isShared:u.exports.bool,isOwner:u.exports.bool,isShown:u.exports.bool.isRequired,itemType:u.exports.string,onSubmit:u.exports.func.isRequired,onCancel:u.exports.func.isRequired,value:u.exports.string};ms.defaultProps={isShared:!1,isOwner:!0,itemType:"Item"};ms.defaultProps={value:""};const Td=O.module("Panel");class Xe extends p.exports.PureComponent{constructor(e){super(e);v(this,"getAdditionActions",te((e,n,t)=>{const i=[];return n&&i.push(this.getCloneAction()),t&&i.push(this.getRenameAction()),[...i,...e]}));this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleCopyPanel=this.handleCopyPanel.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleBlur=this.handleBlur.bind(this),this.handleHide=this.handleHide.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleBeforeShow=this.handleBeforeShow.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRenameSubmit=this.handleRenameSubmit.bind(this),this.handleShowRenameDialog=this.handleShowRenameDialog.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleTab=this.handleTab.bind(this);const{glContainer:n}=this.props;this.state={title:F.getTitleFromContainer(n),showRenameDialog:!1}}componentDidMount(){const{componentPanel:e,glContainer:n,glEventHub:t}=this.props;n.on("resize",this.handleResize),n.on("show",this.handleBeforeShow),n.on("shown",this.handleShow),n.on("hide",this.handleHide),n.on("tab",this.handleTab),n.on("tabClicked",this.handleTabClicked),t.on(fe.SESSION_CLOSED,this.handleSessionClosed),t.on(fe.SESSION_OPENED,this.handleSessionOpened),t.on(nt.focus,this.handleTabFocus),t.on(nt.blur,this.handleTabBlur),t.on(J.CLEAR_ALL_FILTERS,this.handleClearAllFilters),t.emit(Y.MOUNT,e)}componentWillUnmount(){const{componentPanel:e,glContainer:n,glEventHub:t}=this.props;n.off("resize",this.handleResize),n.off("show",this.handleBeforeShow),n.off("shown",this.handleShow),n.off("hide",this.handleHide),n.off("tab",this.handleTab),n.off("tabClicked",this.handleTabClicked),t.off(fe.SESSION_CLOSED,this.handleSessionClosed),t.off(fe.SESSION_OPENED,this.handleSessionOpened),t.off(nt.focus,this.handleTabFocus),t.off(nt.blur,this.handleTabBlur),t.off(J.CLEAR_ALL_FILTERS,this.handleClearAllFilters),t.emit(Y.UNMOUNT,e)}handleTab(e){e&&this.setState({title:F.getTitleFromTab(e)}),this.forceUpdate();const{onTab:n}=this.props;n(e)}handleTabClicked(...e){const{onTabClicked:n}=this.props;n(...e)}handleClearAllFilters(...e){const{onClearAllFilters:n}=this.props;n(...e)}handleFocus(...e){const{componentPanel:n,glEventHub:t}=this.props;t.emit(Y.FOCUS,n);const{onFocus:i}=this.props;i(...e)}handleBlur(...e){const{onBlur:n}=this.props;n(...e)}handleHide(...e){const{onHide:n}=this.props;n(...e)}handleResize(...e){const{onResize:n}=this.props;n(...e)}handleSessionClosed(...e){const{onSessionClose:n}=this.props;n(...e)}handleSessionOpened(...e){const{onSessionOpen:n}=this.props;n(...e)}handleBeforeShow(...e){const{onBeforeShow:n}=this.props;n(...e)}handleShow(...e){const{onShow:n}=this.props;n(...e)}handleTabBlur(...e){const{onTabBlur:n}=this.props;n(...e)}handleTabFocus(...e){const{onTabFocus:n}=this.props;n(...e)}handleRenameCancel(){this.setState({showRenameDialog:!1})}handleShowRenameDialog(){this.setState({showRenameDialog:!0})}handleRenameSubmit(e){const{glContainer:n}=this.props;this.setState({showRenameDialog:!1,title:e});const t=F.getRootFromContainer(n),i=F.getComponentConfigFromContainer(n);F.renameComponent(t,i,e)}handleCopyPanel(){const{glContainer:e,glEventHub:n}=this.props,t=F.getRootFromContainer(e),i=F.getComponentConfigFromContainer(e);if(i==null){Td.error("Could not get component config from container",e);return}const o=F.cloneComponent(t,i);o!==null&&n.emit(Y.CLONED,this,o)}getCloneAction(){return{title:"Copy Panel",order:10,group:re.groups.high,action:this.handleCopyPanel}}getRenameAction(){return{title:"Rename",order:10,group:re.groups.medium,action:this.handleShowRenameDialog}}render(){const{children:e,className:n,renderTabTooltip:t,glContainer:i,additionalActions:o,errorMessage:r,isLoaded:c,isLoading:d,isClonable:h,isRenamable:m}=this.props,{tab:g}=i,{showRenameDialog:f,title:E}=this.state;return a.createElement("div",{className:z("h-100 w-100 iris-panel",n),onFocusCapture:this.handleFocus,onBlurCapture:this.handleBlur},e,a.createElement(zs,{errorMessage:r,isLoaded:c,isLoading:d}),g&&ls.createPortal(a.createElement(a.Fragment,null,a.createElement(hi,{glContainer:i,additionalActions:this.getAdditionActions(o,h,m)}),m&&a.createElement(ms,{isShown:f,value:E,itemType:"Panel",onCancel:this.handleRenameCancel,onSubmit:this.handleRenameSubmit}),t&&a.createElement(Le,{interactive:!0,options:{placement:"bottom"},popperClassName:"panel-tab-popper"},t())),g.element[0]))}}Xe.propTypes={componentPanel:u.exports.instanceOf(p.exports.Component).isRequired,children:u.exports.node.isRequired,glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,className:u.exports.string,onFocus:u.exports.func,onBlur:u.exports.func,onTab:u.exports.func,onTabClicked:u.exports.func,onClearAllFilters:u.exports.func,onHide:u.exports.func,onResize:u.exports.func,onSessionClose:u.exports.func,onSessionOpen:u.exports.func,onBeforeShow:u.exports.func,onShow:u.exports.func,onTabBlur:u.exports.func,onTabFocus:u.exports.func,renderTabTooltip:u.exports.func,additionalActions:u.exports.oneOfType([u.exports.array,u.exports.func]),errorMessage:u.exports.string,isLoading:u.exports.bool,isLoaded:u.exports.bool,isClonable:u.exports.bool,isRenamable:u.exports.bool};Xe.defaultProps={className:"",onTab:()=>{},onTabClicked:()=>{},onClearAllFilters:()=>{},onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onBeforeShow:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},renderTabTooltip:null,additionalActions:[],errorMessage:null,isLoading:!1,isLoaded:!0,isClonable:!1,isRenamable:!1};const _d=O.module("WidgetPanelTooltip"),ps=l=>{const{widgetType:s,widgetName:e,glContainer:n,description:t,children:i}=l,o=F.getTitleFromContainer(n),[r,c]=p.exports.useState(!1);return a.createElement("div",{className:"tab-tooltip-container"},a.createElement("div",{className:"row flex-nowrap align-items-start"},a.createElement("span",{className:"tab-tooltip-title"},a.createElement("b",null,s," Name ")),a.createElement("span",{className:"tab-tooltip-name"},e),a.createElement(X,{kind:"ghost",className:"tab-tooltip-copy",icon:r?mr:pr,onClick:()=>{jn.copyToClipboard(e).then(c(!0)).catch(d=>_d.error("Unable to column name",d))},tooltip:r?"Copied text":"Copy name"})),e!==o&&a.createElement("div",{className:"row"},a.createElement("span",{className:"tab-tooltip-title"},a.createElement("b",null,"Display Name")),a.createElement("span",{className:"tab-tooltip-name"},o)),t&&a.createElement("div",{className:"row"},a.createElement("span",{className:"tab-tooltip-description"},t)),i)};ps.propTypes={glContainer:ae.Container.isRequired,widgetType:u.exports.string,widgetName:u.exports.string,description:u.exports.string,children:u.exports.node};ps.defaultProps={widgetType:"",widgetName:"",description:null,children:null};class In extends p.exports.PureComponent{constructor(e){super(e);v(this,"getCachedRenderTabTooltip",te((e,n,t,i,o)=>e?()=>a.createElement(ps,{glContainer:n,widgetType:t,widgetName:i,description:o}):null));this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleCopyName=this.handleCopyName.bind(this),this.state={isClientDisconnected:!1,isPanelDisconnected:!1,isWidgetDisconnected:!1,isWaitingForReconnect:!1,isPanelInactive:!1}}handleCopyName(){const{widgetName:e}=this.props;jn.copyToClipboard(e)}getErrorMessage(){const{errorMessage:e}=this.props,{isClientDisconnected:n,isPanelDisconnected:t,isWidgetDisconnected:i,isWaitingForReconnect:o}=this.state;if(e)return`${e}`;if(n&&t&&o)return`Disconnected from server.
6
- Check your internet connection.`;if(n&&t)return"Disconnected from server.";if(t){const{widgetName:r,widgetType:c}=this.props;return`Variable "${r}" not set.
7
- ${c} does not exist yet.`}if(i){const{widgetName:r}=this.props;return`${r} is unavailable.`}return null}handleSessionClosed(...e){const{onSessionClose:n}=this.props;this.setState({isPanelDisconnected:!0,isWaitingForReconnect:!1}),n(...e)}handleSessionOpened(...e){const{onSessionOpen:n}=this.props;n(...e)}render(){const{children:e,className:n,componentPanel:t,isLoaded:i,isLoading:o,glContainer:r,glEventHub:c,isDisconnected:d,isClonable:h,isRenamable:m,showTabTooltip:g,renderTabTooltip:f,widgetType:E,widgetName:b,description:y,onClearAllFilters:C,onHide:I,onFocus:T,onBlur:w,onResize:_,onShow:L,onTabBlur:D,onTabFocus:P,onTabClicked:B}=this.props,{isPanelDisconnected:H,isWidgetDisconnected:$,isPanelInactive:W}=this.state,Q=this.getErrorMessage(),x=f!=null?f:this.getCachedRenderTabTooltip(g,r,E,b,y),N=[{title:`Copy ${E} Name`,group:re.groups.medium,order:20,action:this.handleCopyName}];return a.createElement(Xe,{className:z(n,{disconnected:H||$||d,inactive:W}),componentPanel:t,glContainer:r,glEventHub:c,onClearAllFilters:C,onHide:I,onFocus:T,onBlur:w,onResize:_,onShow:L,onSessionClose:this.handleSessionClosed,onSessionOpen:this.handleSessionOpened,onTabBlur:D,onTabFocus:P,onTabClicked:B,renderTabTooltip:x,errorMessage:Q,isLoaded:i,isLoading:o,isClonable:h,isRenamable:m,additionalActions:N},e,W&&a.createElement("div",{className:"fill-parent-absolute"}))}}In.propTypes={children:u.exports.node.isRequired,componentPanel:u.exports.instanceOf(p.exports.Component).isRequired,glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,className:u.exports.string,errorMessage:u.exports.string,isClonable:u.exports.bool,isDisconnected:u.exports.bool,isLoading:u.exports.bool,isLoaded:u.exports.bool,isRenamable:u.exports.bool,showTabTooltip:u.exports.bool,widgetName:u.exports.string,widgetType:u.exports.string,renderTabTooltip:u.exports.func,description:u.exports.string,onFocus:u.exports.func,onBlur:u.exports.func,onHide:u.exports.func,onClearAllFilters:u.exports.func,onResize:u.exports.func,onSessionClose:u.exports.func,onSessionOpen:u.exports.func,onShow:u.exports.func,onTabBlur:u.exports.func,onTabFocus:u.exports.func,onTabClicked:u.exports.func};In.defaultProps={className:"",errorMessage:null,isClonable:!0,isDisconnected:!1,isLoading:!1,isLoaded:!0,isRenamable:!0,showTabTooltip:!0,widgetName:"Widget",widgetType:"Widget",renderTabTooltip:null,description:"",onFocus:()=>{},onBlur:()=>{},onHide:()=>{},onClearAllFilters:()=>{},onResize:()=>{},onSessionClose:()=>{},onSessionOpen:()=>{},onShow:()=>{},onTabBlur:()=>{},onTabFocus:()=>{},onTabClicked:()=>{}};const Ue=Object.freeze({DEFAULT:"DEFAULT",LINKER:"LINKER"}),Id=(l,s)=>l[s]===null?null:u.exports.boolean,xd=(l,s)=>l[s]===null?null:u.exports.string,Dd=Object.freeze({nullableBoolean:Id,nullableString:xd}),Nd=u.exports.shape({name:u.exports.string.isRequired,type:u.exports.string.isRequired,value:Dd.nullableString.isRequired}),Ld=u.exports.shape({state:u.exports.shape({panelState:u.exports.shape({})})}),Fd=u.exports.shape({panelId:u.exports.string.isRequired,columnName:u.exports.string.isRequired,columnType:u.exports.string.isRequired}),so=u.exports.shape({panelId:u.exports.string.isRequired,columnName:u.exports.string.isRequired}),Ta=u.exports.shape({start:so,end:so,id:u.exports.string,isReversed:u.exports.bool}),Pd=u.exports.arrayOf(Ta),Rd=u.exports.shape({name:u.exports.string.isRequired,operateAs:u.exports.string.isRequired,groups:u.exports.arrayOf(u.exports.string).isRequired,permissions:u.exports.shape({isSuperUser:u.exports.bool.isRequired,isQueryViewOnly:u.exports.bool.isRequired,isNonInteractive:u.exports.bool.isRequired,canUsePanels:u.exports.bool.isRequired,canCreateDashboard:u.exports.bool.isRequired,canCreateCodeStudio:u.exports.bool.isRequired,canCreateQueryMonitor:u.exports.bool.isRequired,canCopy:u.exports.bool.isRequired,canDownloadCsv:u.exports.bool.isRequired}).isRequired}),ct=Object.freeze({InputFilter:Nd,LinkPoint:Fd,Link:Ta,Links:Pd,Panel:Ld,User:Rd}),kd="SET_SESSION_WRAPPER",Md=Mt(kd,null),Ad={sessionWrapper:Md},Od=new Map,gs=Object.freeze([]),_a=(l,s)=>{var e;return(e=Ve(l,s).columns)!=null?e:gs},Ud=(l,s)=>{var e;return(e=Ve(l,s).filterSets)!=null?e:gs},ui=(l,s)=>{var e;return(e=Ve(l,s).filters)!=null?e:gs},mi=(l,s)=>{var e;return(e=Ve(l,s).tableMap)!=null?e:Od},pi=(l,s)=>Ve(l,s).isolatedLinkerPanelId,nn=(l,s)=>{var e;return(e=Ve(l,s).links)!=null?e:gs},gi=(l,s)=>Ve(l,s).columnSelectionValidator,kt=(l,s)=>Ve(l,s).sessionWrapper,Vd=(l,s)=>e=>e(ht(l,{sessionWrapper:s})),fi=(l,s)=>e=>e(ht(l,{links:s})),Bd=(l,s)=>(e,n)=>{const t=nn(n(),l),i=s.filter(o=>t.findIndex(r=>Ke(r.start,o.start)&&Ke(r.end,o.end))<0);return e(fi(l,t.concat(i)))},Hd=(l,s)=>(e,n)=>{const i=nn(n(),l).filter(o=>!s.includes(o.id));return e(fi(l,i))},Ia=(l,s)=>e=>e(ht(l,{isolatedLinkerPanelId:s})),$d=(l,s)=>e=>e(ht(l,{columnSelectionValidator:s})),Wd=(l,s)=>e=>e(ht(l,{consoleSettings:s})),Gd=(l,s)=>e=>e(ht(l,{filterSets:s}));Object.entries(Ad).map(([l,s])=>tn.register(l,s));const xa=({columnMap:l,inputFilterMap:s,linkedColumnMap:e,onAdd:n,onOpenLinker:t,waitingFilterMap:i,waitingInputMap:o})=>{const r=p.exports.useMemo(()=>{const f=Array.from(o.keys()),E=f.find(C=>s.get(C)!=null),b=f.find(C=>e.get(C)!=null),y=Qe.join(f.map(C=>`"${C}"`));return E&&b?`Use a filter control or linked table to set a value for ${y}`:E?`Set a filter control value for ${y}`:`Double click a row in a linked table to set a value for ${y}`},[s,e,o]),c=p.exports.useMemo(()=>Array.from(l.values()),[l]),d=p.exports.useCallback(f=>{f.stopPropagation(),f.preventDefault(),n(Array.from(i.values()))},[n,i]),h=p.exports.useCallback(f=>{f.stopPropagation(),f.preventDefault(),t()},[t]),m=i.size>0,g=!m&&o.size>0;return a.createElement("div",{className:"chart-panel-overlay chart-filter-overlay"},a.createElement("div",{className:z("chart-panel-overlay-content chart-filter-overlay-content",{"chart-filter-waiting-filter":m},{"chart-filter-waiting-input":g})},m&&a.createElement(a.Fragment,null,a.createElement("div",{className:"info-message"},"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"),a.createElement("div",{className:"waiting-filter-list"},c.map(f=>{const E=i.has(f.name),b=E?gr:fr;return a.createElement("div",{key:f.name,className:z("waiting-filter-item",{"is-invalid":E})},a.createElement(G,{icon:b}),f.name)})),a.createElement("div",null,a.createElement(ot,{onClick:d,className:"btn-primary"},"Add Input Filters"),a.createElement(ot,{onClick:h,className:"btn-primary"},"Open Linker Tool"))),g&&a.createElement(a.Fragment,null,a.createElement("div",{className:"info-message"},"Waiting for User Input"),a.createElement("div",{className:""},r))))};xa.propTypes={columnMap:u.exports.instanceOf(Map).isRequired,inputFilterMap:u.exports.instanceOf(Map).isRequired,linkedColumnMap:u.exports.instanceOf(Map).isRequired,onAdd:u.exports.func.isRequired,onOpenLinker:u.exports.func.isRequired,waitingFilterMap:u.exports.instanceOf(Map).isRequired,waitingInputMap:u.exports.instanceOf(Map).isRequired};const en=({columns:l,onColumnSelected:s,onMouseEnter:e,onMouseLeave:n})=>a.createElement("div",{className:"chart-panel-overlay chart-column-selector-overlay"},a.createElement("div",{className:z("chart-panel-overlay-content")},a.createElement(a.Fragment,null,a.createElement("div",{className:"info-message"},"This plot requires a filter control to be added to the layout or a table link to be created on the following columns:"),a.createElement("div",{className:"waiting-column-select-list"},l.map(t=>a.createElement(Dt,{key:t.name,className:z("btn-chart-column-selector",en.makeButtonClassName(t.name)),onClick:()=>s(t.name),onMouseEnter:()=>e(t),onMouseLeave:n,disabled:!t.isValid,isLinked:t.isActive},t.name))))));en.makeButtonClassName=l=>`btn-chart-column-selector-${l}`;en.propTypes={columns:u.exports.arrayOf(u.exports.shape({name:u.exports.string.isRequired,isValid:u.exports.bool.isRequired,isActive:u.exports.bool.isRequired})).isRequired,onColumnSelected:u.exports.func.isRequired,onMouseEnter:u.exports.func,onMouseLeave:u.exports.func};en.defaultProps={onMouseEnter:()=>{},onMouseLeave:()=>{}};const Re=O.module("ChartPanel"),zd=150;class xn extends p.exports.Component{constructor(e){super(e);v(this,"getWaitingInputMap",te((e,n,t)=>{if(!e)return new Map;const i=new Map(n);return t.forEach((o,r)=>{i.delete(r)}),i}));v(this,"getWaitingFilterMap",te((e,n,t,i,o)=>{if(!e)return new Map;const r=new Map(n);return t.forEach((c,d)=>{r.delete(d)}),o.forEach((c,d)=>{r.delete(d)}),i.forEach((c,d)=>{r.delete(d)}),r}));v(this,"getInputFilterColumnMap",te((e,n)=>{const t=new Map;for(let i=0;i<n.length;i+=1){const o=n[i],{name:r,type:c}=o,d=e.get(r);d!=null&&d.type===c&&t.set(r,o)}return t}));v(this,"getLinkedColumnMap",te((e,n)=>{const t=new Map,i=F.getIdFromPanel(this);for(let o=0;o<n.length;o+=1){const r=n[o];let c=null;r.start&&r.start.panelId===i&&e.has(r.start.columnName)?c=r.start.columnName:r.end&&r.end.panelId===i&&e.has(r.end.columnName)&&(c=r.end.columnName),c!=null&&e.has(c)&&t.set(c,e.get(c))}return t}));v(this,"getSelectorColumns",te((e,n,t)=>Array.from(e.values()).map(i=>({name:i.name,type:i.type,isValid:t?t(this,i):!1,isActive:n.has(i.name)}))));this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleColumnMouseEnter=this.handleColumnMouseEnter.bind(this),this.handleColumnMouseLeave=this.handleColumnMouseLeave.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleFilterAdd=this.handleFilterAdd.bind(this),this.handleHide=this.handleHide.bind(this),this.handleError=this.handleError.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.handleOpenLinker=this.handleOpenLinker.bind(this),this.handleShow=this.handleShow.bind(this),this.handleSourceColumnChange=this.handleSourceColumnChange.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleUpdate=this.handleUpdate.bind(this),this.updateModelFromSource=Ye(this.updateModelFromSource.bind(this),zd),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.panelContainer=a.createRef(),this.chart=a.createRef(),this.pending=new vn;const{metadata:n,panelState:t}=e,{filterValueMap:i=[],settings:o={}}=t!=null?t:{},r=n.query;this.state={settings:o,error:null,isActive:!1,isDisconnected:!1,isLoading:!1,isLoaded:!1,isLinked:n&&n.settings&&n.settings.isLinked,filterMap:new Map(i),filterValueMap:new Map(i),model:null,columnMap:new Map,queryName:r,panelState:t}}componentDidMount(){this.isHidden()||(this.setState({isActive:!0}),this.initModel())}componentDidUpdate(e,n){const{inputFilters:t,source:i}=this.props,{columnMap:o,model:r,filterMap:c,filterValueMap:d,isLinked:h,settings:m}=this.state;!r||(o!==n.columnMap&&this.pruneFilterMaps(),t!==e.inputFilters&&this.updateChangedInputFilters(t,e.inputFilters),c!==n.filterMap?this.updateFilters():d!==n.filterValueMap&&this.updatePanelState(),m!==n.settings&&(r.updateSettings(m),this.updatePanelState()),h!==n.isLinked?i&&(h?(this.startListeningToSource(i),this.updateModelFromSource()):this.stopListeningToSource(i)):h&&i!==e.source&&(e.source&&this.stopListeningToSource(e.source),i&&(this.startListeningToSource(i),this.updateModelFromSource())))}componentWillUnmount(){this.pending.cancel();const{source:e}=this.props;e&&this.stopListeningToSource(e)}initModel(){this.setState({isLoading:!0,isLoaded:!1,error:null});const{makeModel:e}=this.props;this.pending.add(e(),n=>{n.close()}).then(this.handleLoadSuccess,this.handleLoadError)}startListeningToSource(e){Re.debug("startListeningToSource",e),e.addEventListener(S.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.addEventListener(S.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(S.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}stopListeningToSource(e){Re.debug("stopListeningToSource",e),e.removeEventListener(S.Table.EVENT_CUSTOMCOLUMNSCHANGED,this.handleSourceColumnChange),e.removeEventListener(S.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(S.Table.EVENT_SORTCHANGED,this.handleSourceSortChange)}loadModelIfNecessary(){const{isActive:e,isLoaded:n,isLoading:t}=this.state;e&&!n&&!t&&this.initModel()}isHidden(){const{glContainer:e}=this.props,{isHidden:n}=e;return n}handleColumnSelected(e){const{glEventHub:n}=this.props,{columnMap:t}=this.state;n.emit(Gt.COLUMN_SELECTED,this,t.get(e))}handleColumnMouseEnter({type:e,name:n}){const{columnSelectionValidator:t}=this.props;Re.debug("handleColumnMouseEnter",t,e,n),t&&t(this,{type:e,name:n})}handleColumnMouseLeave(){const{columnSelectionValidator:e}=this.props;Re.debug("handleColumnMouseLeave",e),e&&e(this,null)}handleDisconnect(){this.setState({error:new Error("Figure disconnected"),isDisconnected:!0})}handleFilterAdd(e){for(let n=0;n<e.length;n+=1)this.openInputFilter(e[n])}handleOpenLinker(){const{localDashboardId:e,setActiveTool:n,setDashboardIsolatedLinkerPanelId:t}=this.props;t(e,void 0),n(Ue.LINKER)}handleReconnect(){this.setState({isDisconnected:!1,error:null}),this.sendColumnChange(),this.updateColumnFilters()}handleLoadSuccess(e){Re.debug("handleLoadSuccess");const{model:n}=this.state;this.setState({model:e,isLoaded:!0},()=>{const{inputFilters:t,source:i}=this.props,{filterMap:o,isLinked:r}=this.state;e!==n&&(this.sendColumnChange(),this.updateColumnFilters(),this.updateInputFilters(t,o.size>0||e.isFilterRequired()),i&&r&&(this.startListeningToSource(i),this.updateModelFromSource()))})}handleLoadError(e){le.isCanceled(e)||(Re.error("handleLoadError",e),this.setState({error:e,isLoading:!1}))}handleSourceColumnChange(){this.updateModelFromSource()}handleSourceFilterChange(){this.updateModelFromSource()}handleSourceSortChange(){this.updateModelFromSource()}updateModelFromSource(){const{metadata:e,source:n}=this.props,{isLinked:t,model:i}=this.state,{settings:o}=e;if(!t||!i||!n){Re.debug2("updateModelFromSource ignoring",t,i,n);return}this.pending.cancel(),this.pending.add(S.plot.Figure.create(Z.makeFigureSettings(o,n))).then(r=>{i.setFigure(r)}).catch(this.handleLoadError),this.updatePanelState()}updatePanelState(){const{sourcePanel:e}=this.props,{panelState:n,filterValueMap:t,settings:i}=this.state;let{tableSettings:o}=n!=null?n:{};if(e){const{inputFilters:r}=e.props,{panelState:c}=e.state;c&&(o=ge.extractTableSettings(c,r))}this.setState({panelState:{settings:i,tableSettings:o,filterValueMap:Array.from(t)}})}handleError(){this.setState({isLoading:!1})}handleResize(){this.updateChart()}handleSettingsChanged(e){this.setState(({settings:n})=>{const t={...n,...e};return Re.debug("Updated settings",t),{settings:t}})}handleHide(){this.setActive(!1)}handleShow(){this.setActive(!0)}handleTabBlur(){this.setActive(!1)}handleTabFocus(){const e=this.isHidden();this.setActive(!e)}handleUpdate(){this.setState({isLoading:!1})}handleClearAllFilters(){this.setState({filterValueMap:new Map,filterMap:new Map}),this.updatePanelState()}openInputFilter(e){const{glEventHub:n}=this.props,{name:t,type:i}=e;n.emit(J.OPEN_INPUT,{title:`${t} Filter`,panelState:{name:t,type:i,isValueShown:!0},createNewStack:!0,focusElement:"input"})}setActive(e){this.setState({isActive:e},()=>{e&&(this.loadModelIfNecessary(),this.updateChart())})}sendColumnChange(){const{model:e}=this.state;if(!e)return;const{glEventHub:n}=this.props;n.emit(J.COLUMNS_CHANGED,this,Array.from(e.getFilterColumnMap().values()))}getCoordinateForColumn(e){var c;const n=en.makeButtonClassName(e);if(!this.panelContainer.current)return null;const t=this.panelContainer.current.querySelector(`.${n}`),i=(c=t==null?void 0:t.getBoundingClientRect())!=null?c:null;if(i==null||i.width<=0||i.height<=0)return null;const o=i.left+i.width/2,r=i.bottom;return[o,r]}setFilterMap(e){Re.debug("setFilterMap",e),this.setState(n=>{const{columnMap:t,filterMap:i}=n;let o=null;const r=new Map(n.filterValueMap);return e.forEach(({columnType:c,value:d},h)=>{const m=t.get(h);m==null||m.type!==c||(r.set(h,d),i.get(h)!==d&&(o===null&&(o=new Map(i)),o.set(h,d)))}),{filterValueMap:r,filterMap:o!=null?o:i}})}unsetFilterValue(e){this.setState(n=>{const{inputFilters:t}=this.props,{columnMap:i}=n;let{filterMap:o,filterValueMap:r}=n;if(!r.has(e))return null;r=new Map(n.filterValueMap),r.delete(e);const c=this.getInputFilterColumnMap(i,t);if(c.has(e)){const d=o.get(e),h=c.get(e).value;h!=null&&d!==h&&(o=new Map(n.filterMap),h.length>0?o.set(e,h):o.delete(e))}else o=new Map(n.filterMap),o.delete(e);return{filterMap:o,filterValueMap:r}})}updateChangedInputFilters(e,n){const t=n.filter(o=>!e.find(r=>r.name===o.name&&r.type===o.type));t.length>0&&this.deleteInputFilters(t);const i=e.filter(o=>!n.includes(o));i.length>0&&this.updateInputFilters(i)}updateInputFilters(e,n=!1){this.setState(t=>{const{columnMap:i}=t,o=new Map(t.filterValueMap),r=new Map(t.filterMap),c=n?{filterMap:r,filterValueMap:o}:{};for(let d=0;d<e.length;d+=1){const{name:h,type:m,value:g}=e[d],f=i.get(h);f!=null&&f.type===m&&(g!=null&&r.get(h)!==g&&(g===""?r.delete(h):r.set(h,g),c.filterMap=r),o.has(h)&&(o.delete(h),c.filterValueMap=o))}return Re.debug("updateInputFilters",c),c})}deleteInputFilters(e,n=!1){this.setState(t=>{const{columnMap:i,filterValueMap:o}=t,r=new Map(t.filterMap);let c=n;for(let d=0;d<e.length;d+=1){const{name:h,type:m}=e[d],g=i.get(h);if(g!=null&&g.type===m&&r.has(h)){const f=r.get(h);if(o.has(h)){const E=o.get(h);E!==f&&(c=!0,r.set(h,E))}else c=!0,r.delete(h)}}return Re.debug("deleteInputFilters",c),c?{filterMap:r}:null})}updateColumnFilters(){this.setState(({model:e})=>e?{columnMap:e.getFilterColumnMap()}:null)}updateFilters(){const{columnMap:e,filterMap:n,model:t}=this.state,i=this.getWaitingInputMap(t.isFilterRequired(),e,n);if(t.setFilter(n),n.size>0&&i.size===0){const o=t.getDefaultTitle(),r=Qe.join(Array.from(n.entries()).map(([c,d])=>`${c}: ${d}`));o?t.setTitle(`${o}<br><span style="font-size: smaller">${r}</span>`):t.setTitle(r),Re.debug2("updateFilters filters set",n),this.setState({isLoading:!0})}else Re.debug2("updateFilters waiting on inputs",i),t.setTitle(t.getDefaultTitle()),this.setState({isLoading:!1});this.updatePanelState()}pruneFilterMaps(){this.setState(e=>{const{columnMap:n}=e,t=new Map(e.filterMap),i=new Map(e.filterValueMap),o={};return e.filterValueMap.forEach((r,c)=>{n.has(c)||(i.delete(c),o.filterValueMap=i)}),e.filterMap.forEach((r,c)=>{n.has(c)||(t.delete(c),o.filterMap=t)}),o})}updateChart(){this.chart.current&&this.chart.current.updateDimensions()}render(){const{columnSelectionValidator:e,glContainer:n,glEventHub:t,inputFilters:i,isLinkerActive:o,links:r,metadata:c,settings:d}=this.props,{columnMap:h,filterMap:m,error:g,model:f,queryName:E,isActive:b,isDisconnected:y,isLoaded:C,isLoading:I}=this.state,{figure:T,querySerial:w,table:_}=c,L=this.getInputFilterColumnMap(h,i),D=this.getLinkedColumnMap(h,r),P=f!=null?this.getWaitingInputMap(f.isFilterRequired(),h,m):new Map,B=f!=null?this.getWaitingFilterMap(f.isFilterRequired(),h,m,D,L):new Map,H=g?`Unable to open chart. ${g}`:null,$=P.size>0,W=h.size>0&&o;return a.createElement(In,{className:z("iris-chart-panel",{"input-required":$}),componentPanel:this,glContainer:n,glEventHub:t,onHide:this.handleHide,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabBlur:this.handleTabBlur,onTabFocus:this.handleTabFocus,errorMessage:H,isDisconnected:y,isLoading:I,isLoaded:C,queryName:E,querySerial:w,widgetName:T||_,widgetType:"Chart"},a.createElement("div",{ref:this.panelContainer,className:"chart-panel-container h-100 w-100"},a.createElement("div",{className:"chart-container h-100 w-100"},C&&a.createElement(lt,{isActive:b,model:f,settings:d,ref:this.chart,onDisconnect:this.handleDisconnect,onReconnect:this.handleReconnect,onUpdate:this.handleUpdate,onError:this.handleError,onSettingsChanged:this.handleSettingsChanged})),a.createElement(Jt.CSSTransition,{in:$&&!W&&!I,timeout:En.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0},a.createElement(xa,{inputFilterMap:L,linkedColumnMap:D,onAdd:this.handleFilterAdd,onOpenLinker:this.handleOpenLinker,columnMap:h,waitingFilterMap:B,waitingInputMap:P})),a.createElement(Jt.CSSTransition,{in:W,timeout:En.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0},a.createElement(en,{columns:this.getSelectorColumns(h,D,e),onColumnSelected:this.handleColumnSelected,onMouseEnter:this.handleColumnMouseEnter,onMouseLeave:this.handleColumnMouseLeave}))))}}v(xn,"COMPONENT","ChartPanel");xn.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,metadata:u.exports.shape({figure:u.exports.string,table:u.exports.string,query:u.exports.string,querySerial:u.exports.string,sourcePanelId:u.exports.string,settings:u.exports.shape({isLinked:u.exports.bool})}).isRequired,makeModel:u.exports.func.isRequired,inputFilters:u.exports.arrayOf(ct.InputFilter).isRequired,links:ct.Links.isRequired,localDashboardId:u.exports.string.isRequired,isLinkerActive:u.exports.bool,source:yt.Table,sourcePanel:ct.Panel,columnSelectionValidator:u.exports.func,setActiveTool:u.exports.func.isRequired,setDashboardIsolatedLinkerPanelId:u.exports.func.isRequired,panelState:u.exports.shape({}),settings:u.exports.shape({})};xn.defaultProps={columnSelectionValidator:null,isLinkerActive:!1,source:null,sourcePanel:null,panelState:null,settings:{}};xn.displayName="ChartPanel";const qd=(l,s)=>{const{localDashboardId:e,metadata:n={}}=s,{sourcePanelId:t}=n,i=mi(l,e),o=Sa(l,e),r=ds(l),c=pi(l,e),d=r===Ue.LINKER&&c===void 0;return{columnSelectionValidator:gi(l,e),isLinkerActive:d,inputFilters:ui(l,e),links:nn(l,e),source:i.get(t),sourcePanel:o.get(t),settings:Fe(l)}},zt=we(qd,{setActiveTool:hs,setDashboardIsolatedLinkerPanelId:Ia},null,{forwardRef:!0})(xn);const kn=O.module("CommandHistoryPanel"),Ri=class extends p.exports.Component{static handleError(s){kn.error(s)}constructor(s){super(s),this.handleFocusHistory=this.handleFocusHistory.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleSendToConsole=this.handleSendToConsole.bind(this),this.handleSendToNotebook=this.handleSendToNotebook.bind(this),this.container=a.createRef(),this.pending=new vn;const{session:e,sessionId:n,language:t,panelState:i}=s;this.state={panelState:{},session:e,sessionId:n,language:t,contextActions:[{action:this.handleFocusHistory,shortcut:Hn.COMMAND_HISTORY.FOCUS_HISTORY}]}}componentDidMount(){const{glEventHub:s,session:e}=this.props;s.on(fe.FOCUS_HISTORY,this.handleFocusHistory),e!=null&&this.loadTable()}componentWillUnmount(){const{glEventHub:s}=this.props;s.off(fe.FOCUS_HISTORY,this.handleFocusHistory),this.pending.cancel()}handleFocusHistory(){this.container.current&&this.container.current.focus()}handleSessionOpened(s,{language:e,sessionId:n}){this.setState({session:s,sessionId:n,language:e},()=>{this.loadTable()})}handleSessionClosed(){this.pending.cancel(),this.setState({session:null,language:null,table:null})}handleSendToNotebook(s,e=!1){const{session:n,language:t}=this.state;if(kn.debug("handleSendToNotebook",n,s),!n){kn.error("Session is not connected.");return}const{glEventHub:i}=this.props;i.emit(e?ee.CREATE_NOTEBOOK:ee.SEND_TO_NOTEBOOK,n,t,s)}handleSendToConsole(s,e=!0,n=!1){kn.debug("handleSendToConsole",s);const{glEventHub:t}=this.props;t.emit(fe.SEND_COMMAND,s,e,n)}loadTable(){const{commandHistoryStorage:s}=this.props,{language:e,sessionId:n}=this.state;this.pending.add(s.getTable(e,n,Date.now()),t=>t.close()).then(t=>{this.setState({table:t})}).catch(Ri.handleError)}render(){const{glContainer:s,glEventHub:e,commandHistoryStorage:n}=this.props,{language:t,contextActions:i,table:o}=this.state;return a.createElement(Xe,{className:"command-history-pane",componentPanel:this,glContainer:s,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed},!o&&a.createElement("div",{className:"command-history-disconnected-message"},"Waiting for console connection"),o&&a.createElement(a.Fragment,null,a.createElement(Er,{ref:this.container,language:t,sendToNotebook:this.handleSendToNotebook,sendToConsole:this.handleSendToConsole,table:o,commandHistoryStorage:n}),a.createElement(re,{actions:i})))}};let Ft=Ri;v(Ft,"COMPONENT","CommandHistoryPanel"),v(Ft,"TITLE","Command History");Ft.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,panelState:u.exports.shape({}),session:u.exports.shape({}),sessionId:u.exports.string,language:u.exports.string,commandHistoryStorage:u.exports.shape({getTable:u.exports.func}).isRequired};Ft.defaultProps={panelState:null,session:null,sessionId:null,language:null};const jd=(l,s)=>{const e=sa(l),n=kt(l,s.localDashboardId),{session:t,config:i}=n!=null?n:{},{type:o,id:r}=i!=null?i:{};return{commandHistoryStorage:e,language:o,session:t,sessionId:r}},Jn=we(jd,null,null,{forwardRef:!0})(Ft);const Mn=O.module("ConsolePanel"),Kd=500,Zd=Object.freeze({consoleSettings:{},itemIds:[]});class yn extends p.exports.PureComponent{constructor(s){super(s),this.handleFocusCommandHistory=this.handleFocusCommandHistory.bind(this),this.handleOpenObject=this.handleOpenObject.bind(this),this.handleCloseObject=this.handleCloseObject.bind(this),this.handleResize=this.handleResize.bind(this),this.handleSettingsChange=this.handleSettingsChange.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handlePanelMount=this.handlePanelMount.bind(this),this.savePanelState=Ye(this.savePanelState.bind(this),Kd),this.consoleRef=a.createRef(),this.objectSubscriptionCleanup=null;const{panelState:e}=s,n={...Zd,...e||{}},{consoleSettings:t,itemIds:i}=n;this.state={consoleSettings:t,itemIds:new Map(i),objectMap:new Map,panelState:n}}componentDidMount(){const{glEventHub:s}=this.props;this.closeDisconnectedPanels(),s.on(Y.MOUNT,this.handlePanelMount),this.subscribeToFieldUpdates()}componentDidUpdate(s,e){const{consoleSettings:n,itemIds:t}=this.state;(e.consoleSettings!==n||e.itemIds!==t)&&this.savePanelState()}componentWillUnmount(){const{glEventHub:s}=this.props;this.savePanelState.flush(),s.off(Y.MOUNT,this.handlePanelMount),this.objectSubscriptionCleanup()}subscribeToFieldUpdates(){const{sessionWrapper:s}=this.props,{session:e}=s;this.objectSubscriptionCleanup=e.connection.subscribeToFieldUpdates(n=>{Mn.debug("Got updates",n),this.setState(({objectMap:t})=>{const{updated:i,created:o,removed:r}=n,c=[...i,...r],d=new Map(t);return c.forEach(m=>{d.delete(m.name)}),[...i,...o].forEach(m=>{m.name&&d.set(m.name,m)}),{objectMap:d}})})}setItemId(s,e){this.setState(({itemIds:n})=>{const t=new Map(n);return t.set(s,e),{itemIds:t}})}getItemId(s,e=!0){const{itemIds:n}=this.state;let t=n.get(s);return t==null&&e&&(t=Ee.generate(),this.setItemId(s,t)),t}handleTabBlur(){this.consoleRef&&this.consoleRef.blur()}handleTabFocus(){this.consoleRef&&this.consoleRef.focus()}handlePanelMount(s){var i,o,r;const{itemIds:e}=this.state,n=(i=s==null?void 0:s.props)==null?void 0:i.id,t=(r=(o=s==null?void 0:s.props)==null?void 0:o.metadata)==null?void 0:r.sourcePanelId;n&&t&&new Set(e.values()).has(t)&&this.setItemId(n,n)}handleFocusCommandHistory(){const{glEventHub:s}=this.props;s.emit(fe.FOCUS_HISTORY)}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions()}handleOpenObject(s){const{sessionWrapper:e}=this.props,{session:n}=e;this.openWidget(s,n)}handleCloseObject(s){const{name:e}=s,n=this.getItemId(e,!1),{glEventHub:t}=this.props;t.emit(Y.CLOSE,n)}handleSettingsChange(s){const{glEventHub:e}=this.props;Mn.debug("handleSettingsChange",s),this.setState({consoleSettings:s}),e.emit(fe.SETTINGS_CHANGED,s)}openWidget(s,e){const{glEventHub:n}=this.props,{name:t}=s,i=this.getItemId(t),o={fetch:()=>e.getObject(s),panelId:i,widget:s};Mn.debug("openWidget",o),n.emit(Y.OPEN,o)}addCommand(s,e=!0,n=!1){var t;(t=this.consoleRef.current)==null||t.addCommand(s,e,n)}closeDisconnectedPanels(s=!1){const{consoleSettings:e,itemIds:n}=this.state,{isClosePanelsOnDisconnectEnabled:t=!0}=e;if(!t&&!s)return;const i=[...n.values()],{glEventHub:o}=this.props;i.forEach(r=>{o.emit(Y.CLOSE,r)}),this.setState({itemIds:new Map})}savePanelState(){const{consoleSettings:s,itemIds:e}=this.state,n={consoleSettings:s,itemIds:[...e]};Mn.debug("Saving panel state",n),this.setState({panelState:n})}updateDimensions(){var s;(s=this.consoleRef.current)==null||s.updateDimensions()}render(){const{commandHistoryStorage:s,glContainer:e,glEventHub:n,sessionWrapper:t,timeZone:i,unzip:o}=this.props,{consoleSettings:r,error:c,objectMap:d}=this.state,{config:h,session:m}=t,{id:g,type:f}=h;return a.createElement(Xe,{componentPanel:this,glContainer:e,glEventHub:n,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,errorMessage:c!=null?`${c}`:null},a.createElement(a.Fragment,null,m&&a.createElement(br,{ref:this.consoleRef,settings:r,session:m,focusCommandHistory:this.handleFocusCommandHistory,openObject:this.handleOpenObject,closeObject:this.handleCloseObject,commandHistoryStorage:s,onSettingsChange:this.handleSettingsChange,language:f,statusBarChildren:a.createElement(a.Fragment,null,a.createElement("div",null,"\xA0"),a.createElement("div",null,Cr.LANGUAGE_MAP.get(f))),scope:g,timeZone:i,objectMap:d,unzip:o})))}}v(yn,"COMPONENT","ConsolePanel"),v(yn,"TITLE","Console");yn.propTypes={commandHistoryStorage:u.exports.shape({}).isRequired,glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,panelState:u.exports.shape({consoleCreatorSettings:u.exports.shape({}),consoleSettings:u.exports.shape({}),itemIds:u.exports.array}),sessionWrapper:u.exports.shape({session:yt.IdeSession.isRequired,config:u.exports.shape({type:u.exports.string,id:u.exports.string}).isRequired}).isRequired,timeZone:u.exports.string.isRequired,unzip:u.exports.func};yn.defaultProps={panelState:null,unzip:null};const Yd=(l,s)=>({commandHistoryStorage:sa(l),sessionWrapper:kt(l,s.localDashboardId),timeZone:cs(l)}),$t=we(Yd,null,null,{forwardRef:!0})(yn);const on=O.module("DropdownFilter"),Xd=150,fn=class extends p.exports.Component{constructor(e){super(e);v(this,"getCompatibleColumns",te((e,n)=>e?n.filter(({type:t})=>de.isCompatibleType(t,e.columnType)):[]));v(this,"getColumnOptions",te((e,n)=>{let t=-1;const i=[];return i.push(a.createElement("option",{key:"placeholder",value:"-1"},"Select a column")),e.forEach((o,r)=>{i.push(a.createElement("option",{key:`${o.name}/${o.type}`,value:r},this.getItemLabel(e,r))),n!==null&&o.name===n.name&&o.type===n.type&&(t=r)}),[i,t]}));v(this,"getSelectedOptionIndex",te((e,n)=>e.indexOf(n)));v(this,"getValueOptions",te(e=>[a.createElement("option",{value:"-1",key:"-1"},fn.PLACEHOLDER),...e.map((n,t)=>a.createElement("option",{value:t,key:`${t}/${n}`},n))]));v(this,"getItemLabel",Ze((e,n)=>{const{name:t,type:i}=e[n];if(n>0&&e[n-1].name===t||n<e.length-1&&e[n+1].name===t){const o=i.substring(i.lastIndexOf(".")+1);return`${t} (${o})`}return t}));this.handleColumnChange=this.handleColumnChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleDropdownKeyPress=this.handleDropdownKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.sendUpdate=Ye(this.sendUpdate.bind(this),Xd),this.dropdownRef=a.createRef();const{column:n,isValueShown:t,value:i}=e;this.state={column:n,selectedColumn:n,disableCancel:!t,isValueShown:t,value:i}}componentDidUpdate(e,n){const{source:t,values:i,isLoaded:o}=this.props,{column:r,value:c,isValueShown:d}=this.state;o&&(t!==e.source&&this.sourceUpdated(),i!==e.values&&c!==""&&!i.includes(c)&&this.resetValue(),d!==n.isValueShown&&d&&this.focusInput(),(r!==n.column||c!==n.value||d!==n.isValueShown)&&this.sendUpdate())}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){const{value:n}=e.target;if(on.debug2("handleColumnChange",n),n<0){this.setState({selectedColumn:null});return}const{columns:t,source:i}=this.props,o=this.getCompatibleColumns(i,t);this.setState({selectedColumn:o[n]})}handleDropdownKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),on.debug2("handleDropdownKeyPress"),this.sendUpdate(),this.sendUpdate.flush())}handleValueChange(e){const{value:n}=e.target,t=parseInt(n,10);let i="";const{values:o}=this.props;if(t===-1)on.debug2("Selected default item");else if(t>=0&&t<o.length)i=o[t];else{on.error("Invalid index",t,o);return}on.debug2("handleValueChange",i),this.setState({value:i})}handleSettingsCancel(){this.setState(({column:e})=>({selectedColumn:e,isValueShown:!0}))}handleSettingsSave(){this.setState(({column:e,selectedColumn:n,value:t})=>({column:n,value:e===n?t:"",isValueShown:!0,disableCancel:!1}))}handleSettingsClick(e){e.stopPropagation(),this.showSettings()}handleBackgroundClick(e){e.target!==this.dropdownRef.current&&this.focusInput()}handleMouseEnter(){const{onSourceMouseEnter:e}=this.props;e()}handleMouseLeave(){const{onSourceMouseLeave:e}=this.props;e()}sourceUpdated(){this.setState({column:null,selectedColumn:null,isValueShown:!1,disableCancel:!0,value:""})}showSettings(){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!1})}focusInput(){this.dropdownRef.current!==null&&this.dropdownRef.current.focus()}resetValue(){this.setState({value:""})}clearFilter(){this.resetValue()}setFilterState({name:e,type:n,value:t,isValueShown:i}){const o=e!=null&&n!=null?{name:e,type:n}:null;this.setState({column:o,value:t,isValueShown:i})}sendUpdate(){const{onChange:e}=this.props,{column:n,value:t,isValueShown:i}=this.state;e({column:n,isValueShown:i,value:t})}render(){var W;const{columns:e,disableLinking:n,isLinkerActive:t,isLoaded:i,source:o,onColumnSelected:r,onSourceMouseEnter:c,onSourceMouseLeave:d,values:h,settingsError:m}=this.props,{column:g,disableCancel:f,isValueShown:E,selectedColumn:b,value:y}=this.state,C=o===null,I=this.getCompatibleColumns(o,e),T=o!=null,w=(W=o==null?void 0:o.columnName)!=null?W:fn.SOURCE_BUTTON_PLACEHOLDER,_=g!=null?`${g.name} Filter`:null,[L,D]=this.getColumnOptions(I,b),P=this.getValueOptions(h),B=this.getSelectedOptionIndex(h,y),H=!T||b==null,$=E&&!t;return a.createElement(oi,{className:"dropdown-filter fill-parent-absolute",isFlipped:$},a.createElement("div",{className:"dropdown-filter-settings-card"},a.createElement("div",{className:"dropdown-filter-card-content"},a.createElement("div",{className:"dropdown-filter-settings-grid"},a.createElement("label",null,"Source Column"),a.createElement(Dt,{isLinked:T,onClick:r,onMouseEnter:c,onMouseLeave:d,className:fn.SOURCE_BUTTON_CLASS_NAME,disabled:n},w),a.createElement("div",{className:"text-muted small"},"Select a source column for the list by linking to a table."),a.createElement("label",null,"Filter Column"),a.createElement("select",{value:D,className:"custom-select",onChange:this.handleColumnChange,disabled:C},L),a.createElement("div",{className:"text-muted small"},"Dropdown filter control will apply its filter to all columns matching this name in this dashboard.")),m&&a.createElement("div",{className:"error-message text-center"},m),T&&a.createElement("div",{className:"dropdown-filter-settings-buttons"},a.createElement(X,{kind:"secondary",type:"button",onClick:this.handleSettingsCancel,disabled:f||E||t,tooltip:t?"Cancel disabled while linker open":null},"Cancel"),a.createElement(X,{kind:"primary",type:"button",className:"ml-2",onClick:this.handleSettingsSave,disabled:H||E||t,tooltip:t?"Save disabled while linker open":null},"Save")))),a.createElement("div",{className:"dropdown-filter-value-card",onClick:this.handleBackgroundClick},i&&a.createElement(a.Fragment,null,a.createElement("div",{className:"dropdown-filter-column"},a.createElement("div",{className:"dropdown-filter-column-title"},_)),a.createElement("div",{className:"dropdown-filter-card-content"},a.createElement("div",{className:"dropdown-filter-value-input d-flex flex-column justify-content-center"},a.createElement("select",{className:"custom-select",value:B,ref:this.dropdownRef,onChange:this.handleValueChange,onKeyPress:this.handleDropdownKeyPress},P)),m&&a.createElement("div",{className:"error-message mt-3 text-center"},m)),a.createElement("div",{className:"dropdown-filter-menu"},a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick},a.createElement(G,{icon:rs,transform:"grow-4"}))))))}};let rt=fn;v(rt,"PLACEHOLDER","Select a value..."),v(rt,"SOURCE_BUTTON_CLASS_NAME","btn-dropdown-filter-selector"),v(rt,"SOURCE_BUTTON_PLACEHOLDER","Select a column");rt.propTypes={column:yt.Column,columns:u.exports.arrayOf(yt.Column).isRequired,onSourceMouseEnter:u.exports.func,onSourceMouseLeave:u.exports.func,disableLinking:u.exports.bool,isLinkerActive:u.exports.bool,isLoaded:u.exports.bool,isValueShown:u.exports.bool,settingsError:u.exports.string,source:ct.LinkPoint,value:u.exports.string,values:u.exports.arrayOf(u.exports.string),onChange:u.exports.func.isRequired,onColumnSelected:u.exports.func};rt.defaultProps={column:null,disableLinking:!1,isLinkerActive:!1,isLoaded:!1,isValueShown:!1,settingsError:null,source:null,value:"",values:[],onColumnSelected:()=>{},onSourceMouseEnter:()=>{},onSourceMouseLeave:()=>{}};const ue=O.module("DropdownFilterPanel"),Jd=250,Et=class extends p.exports.Component{constructor(e){super(e);v(this,"getCachedValues",te((e,{type:n,name:t},i)=>de.isDateType(n)?e.map(o=>Et.DATETIME_FORMATTER.format(o)):e.map(o=>o!=null?i.getFormattedString(o,n,t):null)));v(this,"getCachedPanelLinks",te((e,n)=>{const t=F.getIdFromPanel(n);return ue.debug("getCachedPanelLinks",e,t),e.filter(i=>{var o;return((o=i.end)==null?void 0:o.panelId)===t})}));v(this,"getCachedSource",te(e=>{ue.debug("getCachedSource",e);let n=null;if(e.length>0){const[t]=e;n=t.start,e.length>1&&ue.error("Filter has more that one link",e)}return n}));v(this,"getCachedSourceTable",te((e,n)=>{var i;if(ue.debug("getCachedSourceTable",e,n),n==null)return null;const{panelId:t}=n;return(i=e.get(t))!=null?i:null}));v(this,"getCachedSourceColumn",te((e,n)=>{var t;return ue.debug("getCachedSourceColumn",e,n),e==null||n==null?null:(t=e.columns.find(({name:i,type:o})=>i===n.columnName&&o===n.columnType))!=null?t:null}));this.handleChange=Ye(this.handleChange.bind(this),Jd),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleSourceFilterChange=this.handleSourceFilterChange.bind(this),this.handleSourceSortChange=this.handleSourceSortChange.bind(this),this.handleSourceSizeChange=this.handleSourceSizeChange.bind(this),this.handleSourceMouseEnter=this.handleSourceMouseEnter.bind(this),this.handleSourceMouseLeave=this.handleSourceMouseLeave.bind(this),this.handleValuesTableUpdate=this.handleValuesTableUpdate.bind(this),this.dropdownFilterRef=a.createRef(),this.panelContainer=a.createRef(),this.pending=new vn,this.cleanup=null;const{panelState:n,settings:t}=e;this.columnFormats=t.columnFormats;const{value:i="",isValueShown:o=!1,name:r,type:c,timestamp:d=null}=n!=null?n:{},h=r!=null&&c!=null?{name:r,type:c}:null;this.state={column:h,formatter:new qn(this.columnFormats),valuesTable:null,valuesColumn:null,sourceSize:0,value:i,timestamp:d,values:[],isValueShown:o,wasFlipped:!1,skipUpdate:!1,panelState:n,isDisconnected:!1,isLoading:!1,isLoaded:!1,error:null}}componentDidMount(){this.updateValuesTable();const{column:e,value:n,timestamp:t}=this.state,i=this.getSourceTable();if(i!==null&&this.startListeningToSource(i),e!=null){const{name:o,type:r}=e;this.sendUpdate(o,r,n,t)}}componentDidUpdate(e,n){const{valuesTable:t}=this.state,{settings:i}=this.props,o=this.getSource(),r=this.getSourceTable(),c=this.getSource(e),d=this.getSourceTable(e);i!==e.settings&&this.updateFormatterSettings(i),t!==n.valuesTable&&n.valuesTable!==null&&(ue.debug("Table in state modified, closing the old table."),n.valuesTable.close()),(r!==d||o!==c)&&this.updateValuesTable(),r!==d&&(d!==null&&this.stopListeningToSource(d),r!==null&&this.startListeningToSource(r))}componentWillUnmount(){const{valuesTable:e}=this.state,n=this.getSourceTable();this.pending.cancel(),n!==null&&this.stopListeningToSource(n),this.cleanup&&this.cleanup(),e!==null&&e.close()}getCoordinateForColumn(){var o;if(!this.panelContainer.current)return null;const e=this.panelContainer.current.querySelector(`.${rt.SOURCE_BUTTON_CLASS_NAME}`),n=(o=e==null?void 0:e.getBoundingClientRect())!=null?o:null;if(n==null||n.width<=0||n.height<=0)return null;const t=n.left+n.width/2,i=n.bottom;return[t,i]}getSettingsErrorMessage(){const{sourceSize:e}=this.state;return e>Et.MAX_TABLE_SIZE?`Table too large, must have fewer than ${Et.MAX_TABLE_SIZE} options.`:null}getPanelErrorMessage(){const{error:e}=this.state;return e?`${e}`:null}getSource(e=this.props){const{dashboardLinks:n}=e,t=this.getCachedPanelLinks(n,this);return this.getCachedSource(t)}getSourceTable(e=this.props){const{panelTableMap:n}=e,t=this.getSource(e);return this.getCachedSourceTable(n,t)}getValuesColumn(e){const n=this.getSource();return this.getCachedSourceColumn(e,n)}startListeningToSource(e){ue.debug("startListeningToSource"),e.addEventListener(S.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.addEventListener(S.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.addEventListener(S.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.addEventListener(S.Table.EVENT_DISCONNECT,this.handleDisconnect),e.addEventListener(S.Table.EVENT_RECONNECT,this.handleReconnect)}stopListeningToSource(e){ue.debug("stopListeningToSource"),e.removeEventListener(S.Table.EVENT_FILTERCHANGED,this.handleSourceFilterChange),e.removeEventListener(S.Table.EVENT_SORTCHANGED,this.handleSourceSortChange),e.removeEventListener(S.Table.EVENT_SIZECHANGED,this.handleSourceSizeChange),e.removeEventListener(S.Table.EVENT_DISCONNECT,this.handleDisconnect),e.removeEventListener(S.Table.EVENT_RECONNECT,this.handleReconnect)}handleChange({column:e,isValueShown:n,value:t}){const{name:i=null,type:o=null}=e!=null?e:{};let r=!0,c=Date.now();this.setState(({panelState:d,timestamp:h,wasFlipped:m,skipUpdate:g})=>{const f=d!=null&&n!==d.isValueShown&&i===d.name&&o===d.type&&t===d.value;return r=!g&&n&&(!f||!m),r||(c=h),{panelState:{isValueShown:n,name:i,type:o,value:t,timestamp:c},timestamp:c,wasFlipped:f,skipUpdate:!1}},()=>{r&&this.sendUpdate(i,o,t,c)})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleSourceFilterChange(){this.applySourceFilters()}handleSourceSortChange(){this.applySourceSorts()}handleSourceSizeChange({detail:e}){this.setState({sourceSize:e})}handleColumnSelected(){ue.debug("handleColumnSelected");const{glEventHub:e}=this.props;e.emit(J.COLUMN_SELECTED,this,Et.SOURCE_COLUMN)}handleClearAllFilters(){this.dropdownFilterRef.current.clearFilter()}setPanelState(e,n=!1){var t;if(this.getSource()==null){ue.debug("Ignore state update for unlinked filter",e);return}this.setState({skipUpdate:!n}),(t=this.dropdownFilterRef.current)==null||t.setFilterState(e)}sendUpdate(e,n,t,i){var d;const{glEventHub:o}=this.props,r=(d=this.getSource())==null?void 0:d.panelId,c=r===null?[]:[r];ue.debug("sendUpdate",{name:e,type:n,value:t,timestamp:i,excludePanelIds:c}),o.emit(J.FILTERS_CHANGED,this,{name:e,type:n,value:t!=null?t:"=null",timestamp:i,excludePanelIds:c})}updateValuesTable(){const e=this.getSource(),n=this.getSourceTable();if(ue.debug("updateValuesTable",e,n),this.setState({values:[],valuesTable:null,error:null}),e==null){ue.debug("Filter unlinked."),this.setState({isLoading:!1,isLoaded:!0,isValueShown:!1,sourceSize:0});return}this.setState({isLoading:!0}),n!=null&&(this.setState({isLoaded:!1,sourceSize:n.size}),this.pending.add(n.copy(),t=>t.close()).then(t=>{this.updateViewportListener(t),this.setState({valuesTable:t})}).catch(t=>{le.isCancelled(t)||(ue.error(t),this.setState({isLoading:!1,error:t}))}))}applySourceSorts(){const{valuesTable:e}=this.state,n=this.getSourceTable();if(ue.debug("applySourceSorts",n.sort),e==null){ue.debug("Table not initialized");return}const t=[...n.sort];e.applySort(t),this.setViewport(e)}applySourceFilters(){const{valuesTable:e}=this.state,n=this.getSourceTable();if(ue.debug("applySourceFilters",n.filter),e==null){ue.debug("Table not initialized");return}const t=[...n.filter];e.applyFilter(t),this.setViewport(e)}updateViewportListener(e){if(ue.debug("updateViewportListener",e==null?void 0:e.size),this.cleanup&&this.cleanup(),e==null){this.cleanup=null;return}this.cleanup=e.addEventListener(S.Table.EVENT_UPDATED,this.handleValuesTableUpdate),this.setViewport(e)}setViewport(e){const n=this.getValuesColumn(e);e.setViewport(0,Et.MAX_TABLE_SIZE-1,[n])}updateFormatterSettings(e){const n=Bn.getColumnFormats(e);Ke(this.columnFormats,n)||(this.columnFormats=n,this.setState({formatter:new qn(n)}))}handleValuesTableUpdate({detail:e}){const{rows:n}=e,{valuesTable:t}=this.state,i=this.getValuesColumn(t);if(!i){ue.error("Values column not found");return}const o=n.map(r=>r.get(i));this.setState({values:o,isLoading:!1,isLoaded:!0,valuesColumn:i})}handleSourceMouseEnter(){const{columnSelectionValidator:e}=this.props;!e||e(this,Et.SOURCE_COLUMN)}handleSourceMouseLeave(){const{columnSelectionValidator:e}=this.props;!e||e(this,null)}render(){const{columns:e,disableLinking:n,glContainer:t,glEventHub:i,isLinkerActive:o}=this.props,{column:r,formatter:c,isDisconnected:d,isValueShown:h,value:m,values:g,valuesColumn:f,isLoading:E,isLoaded:b}=this.state,y=this.getSource(),C=this.getSettingsErrorMessage(),I=this.getPanelErrorMessage(),T=b&&f!=null?this.getCachedValues(g,f,c):[];return a.createElement(In,{errorMessage:I,isLoading:E,isLoaded:b,isDisconnected:d,className:"iris-dropdown-filter-panel",componentPanel:this,glContainer:t,glEventHub:i,onClearAllFilters:this.handleClearAllFilters,widgetName:"Dropdown Filter",widgetType:"DropdownFilter"},a.createElement("div",{ref:this.panelContainer,className:"dropdown-filter-container h-100 w-100 container"},a.createElement(rt,{ref:this.dropdownFilterRef,column:r,columns:e,isValueShown:h,isLinkerActive:o,disableLinking:n,isLoaded:b,settingsError:C,source:y,value:m,values:T,onChange:this.handleChange,onColumnSelected:this.handleColumnSelected,onSourceMouseEnter:this.handleSourceMouseEnter,onSourceMouseLeave:this.handleSourceMouseLeave})))}};let st=Et;v(st,"COMPONENT","DropdownFilterPanel"),v(st,"MAX_TABLE_SIZE",256),v(st,"DATETIME_FORMATTER",new Ae({showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:"yyyy-MM-dd HH:mm:ss.SSSSSSSSS"})),v(st,"SOURCE_COLUMN",Object.freeze({name:"FilterSource",type:null}));st.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,panelState:u.exports.shape({name:u.exports.string,type:u.exports.string,value:u.exports.string,isValueShown:u.exports.bool}),isLinkerActive:u.exports.bool.isRequired,columns:u.exports.arrayOf(u.exports.shape({})).isRequired,columnSelectionValidator:u.exports.func,disableLinking:u.exports.bool.isRequired,settings:u.exports.shape({columnFormats:u.exports.arrayOf(u.exports.shape({}))}).isRequired,panelTableMap:u.exports.instanceOf(Map).isRequired,dashboardLinks:ct.Links.isRequired};st.defaultProps={columnSelectionValidator:null,panelState:null};st.displayName="DropdownFilterPanel";const Qd=(l,s)=>{const{localDashboardId:e}=s,n=F.getIdFromPanel({props:s}),t=mi(l,e),i=nn(l,e),o=ds(l),r=pi(l,e),c=o===Ue.LINKER&&(r===void 0||r===n),d=o===Ue.LINKER&&r!==void 0&&r!==n;return{columns:_a(l,e),columnSelectionValidator:gi(l,e),isLinkerActive:c,disableLinking:d,settings:Fe(l),panelTableMap:t,dashboardLinks:i}},Rt=we(Qd,null,null,{forwardRef:!0})(st);function it(l){return l.type==="directory"}var Da=(l=>(l.GROOVY="text/x-groovy",l.PLAIN_TEXT="text/plain",l.PYTHON="text/x-python",l.PYTHON_COMPILED="application/x-python-code",l.SCALA="text/x-scala",l.UNKNOWN="",l))(Da||{});class U{static fileExtensionToString(s=""){return s.length===0?"":`.${s}`}static getDepth(s){var n;if(!U.hasPath(s))throw new Error(`Invalid path provided: ${s}`);return((n=s.match(/\//g))!=null?n:[]).length-1}static getExtension(s){var n;const e=this.getBaseName(s).split(".");return e.length>1&&(n=e.pop())!=null?n:""}static getBaseName(s){var e;return(e=s.split("/").pop())!=null?e:""}static getCopyFileName(s){const e=s.lastIndexOf(".");let n=null,t=null;e<0?t=s:(t=s.substring(0,e),n=s.substring(e+1));const i=t?`${t}-copy`:"Copy";return n!==null?`${i}.${n}`:i}static getMimeType(s){switch(this.getExtension(s).toLowerCase()){case"groovy":return"text/x-groovy";case"py":return"text/x-python";case"pyc":return"application/x-python-code";case"scala":return"text/x-scala";case"txt":return"text/plain";default:return""}}static getParent(s){if(!U.hasPath(s))throw new Error(`Invalid name provided: ${s}`);const e=s.split("/");for(;e.pop()==="";);if(e.length===0)throw new Error(`No parent for path provided: ${s}`);return`${e.join("/")}/`}static getPath(s){if(!U.hasPath(s))throw new Error(`Invalid filename provided: ${s}`);const e=s.split("/");return e.pop(),`${e.join("/")}/`}static hasPath(s){return s.startsWith("/")}static isPath(s){return s.startsWith("/")&&s.endsWith("/")}static makePath(s){return s.endsWith("/")?s:`${s}/`}static replaceExtension(s,e=""){const n=s.lastIndexOf("."),t=n>-1?s.substring(0,n):s,i=U.fileExtensionToString(e);return`${t}${i}`}static validateName(s){var i;const e=[".",".."],n=/[\\/\0]/g,t=new Map([["\0","null"]]);if(!s)throw new un("Name cannot be empty");if(e.includes(s))throw new un(`"${s}" is a reserved name`);if(n.test(s))throw new un(`Invalid characters in name: "${((i=s.match(n))!=null?i:[]).reduce((o,r)=>o.includes(r)?o:[...o,r],[]).map(o=>t.has(o)?t.get(o):o).join('", "')}"`)}static reducePaths(s){const e=s.filter(n=>U.isPath(n));return s.filter(n=>!e.some(t=>n!==t&&n.startsWith(t)))}}const Ie=O.module("FileList"),Us=l=>it(l)?U.makePath(l.filename):U.getPath(l.filename),Ei=26,eh=500,io="item-list-scroll-pane",Vs=l=>{var L;const{children:s,draggedItems:e,isDragInProgress:n,isDropTargetValid:t,isSelected:i,item:o,itemIndex:r,dropTargetItem:c,onDragStart:d,onDragOver:h,onDragEnd:m,onDrop:g}=l,f=(L=e==null?void 0:e.some(D=>D.id===o.id))!=null?L:!1,E=Us(o),b=n&&c?Us(c):null,y=n&&t&&it(o)&&b===E,C=n&&t&&b===E,I=n&&!t&&b===E,T=th(o),w=U.getDepth(o.filename),_=Array(w).fill(null).map((D,P)=>a.createElement("span",{className:"file-list-depth-line",key:P}));return a.createElement("div",{className:z("d-flex w-100 align-items-center","file-list-item",{"is-dragged":f,"is-exact-drop-target":y,"is-in-drop-target":C,"is-invalid-drop-target":I,"is-selected":i}),onDragStart:D=>d(r,D),onDragOver:D=>h(r,D),onDragEnd:D=>m(r,D),onDrop:D=>g(r,D),draggable:!0,role:"presentation"},_," ",a.createElement(G,{icon:T,className:"item-icon",fixedWidth:!0})," ",a.createElement("span",{className:"truncation-wrapper"},s!=null?s:o.basename,a.createElement(Le,{options:{modifiers:{preventOverflow:{boundariesElement:"window"}},placement:"left"}},s!=null?s:o.basename)))};function th(l){if(it(l))return l.isExpanded?Sr:yr;switch(U.getMimeType(l.basename)){case Da.PYTHON:return vr;default:return wr}}function oo(l,s){if(l.length===0||!s)throw new Error("No items to move");const e=Us(s);if(l.some(({filename:n})=>U.getPath(n)===e))throw new Error("File already in the destination folder");if(l.some(n=>it(n)&&e.startsWith(U.makePath(n.filename))))throw new Error("Destination folder cannot be a child of a dragged folder");return{files:l,targetPath:e}}const nh=l=>{const{isMultiSelect:s=!1,table:e,onFocusChange:n=()=>{},onMove:t,onSelect:i,onSelectionChange:o=()=>{},renderItem:r=Vs,rowHeight:c=Ei,overscanCount:d=Fs.DEFAULT_OVERSCAN}=l,[h,m]=p.exports.useState(()=>({items:[],offset:0,itemCount:0})),[g,f]=p.exports.useState({top:0,bottom:0}),[E,b]=p.exports.useState(),[y,C]=p.exports.useState(),[I,T]=p.exports.useState(),[w,_]=p.exports.useState([]),L=p.exports.useRef(null),D=p.exports.useRef(null),P=p.exports.useCallback(A=>{if(A.length===0||!h)return[];const K=[];for(let ie=0;ie<A.length;ie+=1){const be=A[ie];for(let Be=be[0];Be<=be[1];Be+=1)Be>=h.offset&&Be<h.offset+h.items.length&&K.push(h.items[Be-h.offset])}return K},[h]),B=p.exports.useCallback(A=>{const K=P([[A,A]]);if(K.length>0)return K[0]},[P]),H=p.exports.useCallback(()=>{const A=Bi.count(w);if(A===0)return null;if(A===1){const K=w[0][0],ie=B(K);if(ie!=null)return ie.filename}return`${A} items`},[B,w]),$=p.exports.useCallback(A=>{var K;if(!(!y||!E)){Ie.debug("dropItems",y,"to",A);try{const{files:ie,targetPath:be}=oo(y,E);t(ie,be),A!=null&&(_([[A,A]]),(K=L.current)==null||K.focusItem(A))}catch(ie){Ie.error("Unable to complete move",ie)}}},[y,E,t]),W=p.exports.useCallback((A,K)=>{const ie=h.items[A-h.offset];ie!==void 0&&(Ie.debug("handleItemClick",ie),i(ie,K),it(ie)&&(e==null||e.setExpanded(ie.filename,!ie.isExpanded)))},[h,i,e]),Q=p.exports.useCallback((A,K)=>{var Be;Ie.debug2("handleItemDragStart",A,w);let ie=w;Bi.isSelected(w,A)||(ie=[[A,A]],_(ie)),C(P(ie)),(Be=L.current)==null||Be.resetMouseState();const be=document.createElement("div");be.innerHTML=`<div class="dnd-placeholder-content">${H()}</div>`,be.className="file-list-dnd-placeholder",document.body.appendChild(be),K.dataTransfer.setDragImage(be,0,0),K.dataTransfer.effectAllowed="move",T(be)},[H,P,w]),x=p.exports.useCallback((A,K)=>{K.preventDefault(),Ie.debug2("handleItemDragOver",K),b(B(A))},[B]),N=p.exports.useCallback((A,K)=>{Ie.debug("handleItemDragEnd",A),I==null||I.remove(),C(void 0),b(void 0),T(void 0)},[I]),R=p.exports.useCallback((A,K)=>{$(A)},[$]),V=p.exports.useCallback(()=>{Ie.debug2("handleItemDragExit"),b(void 0)},[]),M=p.exports.useCallback(A=>{A.target instanceof Element&&A.target.classList.contains(io)&&(A.preventDefault(),Ie.debug2("handleListDragOver",A),b({type:"directory",filename:"/",basename:"/",id:"/"}))},[]),q=p.exports.useCallback(A=>{A.target instanceof Element&&A.target.classList.contains(io)&&(Ie.debug("handleListDrop"),$())},[$]),j=p.exports.useCallback(A=>{if(Ie.debug2("handleSelectionChange",A),A!==w){_(A);const K=P(A);o(K)}},[P,o,w]),ve=p.exports.useCallback(A=>{if(Ie.debug2("handleFocusChange",A),A!=null){const[K]=P([[A,A]]);n(K)}else n()},[P,n]),Pe=p.exports.useCallback((A,K)=>{Ie.debug("handleViewportChange",A,K),(A!==g.top||K!==g.bottom)&&f({top:A,bottom:K})},[g]),We=p.exports.useMemo(()=>{if(!y||!E)return!1;try{return oo(y,E),Ie.debug("handleValidateDropTarget true"),!0}catch{return Ie.debug("handleValidateDropTarget false"),!1}},[y,E]);p.exports.useEffect(function(){Ie.debug("updating table viewport",g),e==null||e.setViewport({top:Math.max(0,g.top-d),bottom:g.bottom+d})},[d,e,g]),p.exports.useEffect(function(){const K=e.onUpdate(ie=>{m({items:ie.items.map(be=>({...be,itemName:be.basename})),offset:ie.offset,itemCount:e.size})});return()=>{K()}},[e]),p.exports.useEffect(function(){if(E!=null&&it(E)&&E.filename!=="/"){const K=setTimeout(()=>{E.isExpanded||e==null||e.setExpanded(E.filename,!0)},eh);return()=>clearTimeout(K)}},[E,e]);const vt=p.exports.useCallback(A=>r({...A,isDragInProgress:y!=null,dropTargetItem:E,draggedItems:y,isDropTargetValid:We,onDragStart:Q,onDragEnd:N,onDragOver:x,onDragExit:V,onDrop:R}),[N,V,x,Q,R,y,E,We,r]);return a.createElement("div",{ref:D,className:z("file-list",{"is-dragging":y!=null}),onDragOver:M,onDrop:q},a.createElement(Fs,{ref:L,items:h.items,itemCount:h.itemCount,offset:h.offset,onFocusChange:ve,onSelect:W,onSelectionChange:j,onViewportChange:Pe,selectedRanges:w,renderItem:vt,rowHeight:c,isMultiSelect:s,isDragSelect:!1,isDeselectOnClick:!1}))};const sh={name:"File Explorer",DELETE:bn.createAndAdd({id:"FILE_EXPLORER.DELETE",name:"Delete",shortcut:[Se.DELETE],macShortcut:[Oe.CMD,Se.BACKSPACE]}),RENAME:bn.createAndAdd({id:"FILE_EXPLORER.RENAME",name:"Rename",shortcut:[Se.ENTER],macShortcut:[Se.ENTER]})},ao={FILE_EXPLORER:sh};const ro=O.module("FileListItemEditor"),ih=({item:l,onCancel:s,onSubmit:e,validate:n=()=>Promise.resolve()})=>{const t=p.exports.useRef(null),[i,o]=p.exports.useState(l.basename),[r,c]=p.exports.useState(),[d,h]=p.exports.useState(Promise.resolve()),m=p.exports.useCallback(()=>{var C;(C=t.current)==null||C.focus()},[t]),g=p.exports.useCallback(C=>C.stopPropagation(),[]),f=p.exports.useCallback(()=>{d.then(()=>{e(i)}).catch(C=>ro.info("Unable to validate name",C))},[e,i,d]);p.exports.useEffect(function(){const I=le.makeCancelable(n(i));return I.then(()=>c(void 0)).catch(T=>{le.isCanceled(T)||c(T)}),h(I),()=>I.cancel()},[n,i]),p.exports.useEffect(function(){m()},[m]);const E=p.exports.useCallback(()=>{ro.debug2("handleBlur"),f()},[f]),b=p.exports.useCallback(C=>{const{value:I}=C.target;o(I)},[]),y=p.exports.useCallback(C=>{C.stopPropagation();const{key:I}=C;switch(I){case"Enter":{f();break}case"Escape":{s();break}}},[s,f]);return a.createElement("div",{className:"file-list-item-editor"},a.createElement("input",{type:"text",className:z("form-control file-list-item-editor-input",{"is-invalid":r}),value:i,ref:t,onBlur:E,onKeyDown:y,onChange:b,onClick:g,onDoubleClick:g,onMouseDown:g}),r&&a.createElement("div",{className:"invalid-feedback"},`${r}`))},Na=l=>{const{isMultiSelect:s=!1,showContextMenu:e=!1,onCreateFile:n,onCreateFolder:t,onCopy:i,onDelete:o,onMove:r=()=>{},onRename:c,onSelect:d,table:h,rowHeight:m=Ei,validateRename:g=()=>Promise.resolve()}=l,[f,E]=p.exports.useState(),[b,y]=p.exports.useState([]),[C,I]=p.exports.useState(),T=p.exports.useCallback(N=>{y(N)},[]),w=p.exports.useCallback(N=>{I(N)},[]),_=p.exports.useCallback(()=>{C&&(i==null||i(C))},[C,i]),L=p.exports.useCallback(()=>{b.length>0&&(o==null||o(b))},[o,b]),D=p.exports.useCallback(()=>{n==null||n()},[n]),P=p.exports.useCallback(()=>{C&&(t==null||t(U.getPath(C.filename)))},[C,t]),B=p.exports.useCallback(()=>{C&&E(C)},[C]),H=p.exports.useCallback(()=>{E(void 0)},[]),$=p.exports.useCallback(N=>{f&&(c==null||c(f,N),E(void 0))},[c,f]),W=p.exports.useMemo(()=>{if(f)return[];const N=[];return n&&N.push({title:"New File",description:"Create new file",action:D,group:re.groups.medium}),t&&N.push({title:"New Folder",description:"Create new folder",action:P,group:re.groups.medium}),i&&N.push({title:"Copy",description:"Copy",action:_,group:re.groups.low,disabled:C==null||it(C)}),o&&b.length>0&&N.push({title:"Delete",description:"Delete",shortcut:ao.FILE_EXPLORER.DELETE,action:L,group:re.groups.low}),c&&N.push({title:"Rename",description:"Rename",shortcut:ao.FILE_EXPLORER.RENAME,action:B,group:re.groups.low,disabled:C==null}),N},[_,L,D,P,B,C,i,n,t,o,c,b,f]),Q=p.exports.useCallback(N=>f?g(f,N):Promise.reject(new Error("No rename item")),[f,g]),x=p.exports.useCallback(N=>{const{item:R}=N;return f&&f.filename===R.filename?Vs({...N,children:a.createElement(ih,{item:R,validate:Q,onSubmit:$,onCancel:H})}):Vs(N)},[H,$,f,Q]);return a.createElement("div",{className:"file-list-container"},h&&a.createElement(nh,{onMove:r,onSelect:d,onSelectionChange:T,onFocusChange:w,renderItem:x,rowHeight:m,table:h,isMultiSelect:s}),e&&a.createElement(re,{actions:W}))};Na.displayName="FileListContainer";class Wn extends un{constructor(s){super("Name already exists"),this.isExistingFile=!0,this.info=s}}class bi extends Error{constructor(){super("No file exists at the path specified"),this.isFileNotFound=!0}}const Tt=O.module("FileExplorer"),Ci=l=>{const{storage:s,isMultiSelect:e=!1,onDelete:n=()=>{},onRename:t=()=>{},onSelect:i,rowHeight:o=Ei}=l,[r,c]=p.exports.useState([]),[d,h]=p.exports.useState();p.exports.useEffect(function(){let _;async function L(){Tt.debug("initTable"),_=le.makeCancelable(s.getTable(),D=>D.close());try{h(await _)}catch(D){le.isCanceled(D)||Tt.error("Unable to initialize table",D)}}return L(),()=>{_.cancel()}},[s]);const m=p.exports.useCallback(w=>{le.isCanceled(w)||Tt.error(w)},[]),g=p.exports.useCallback(w=>{Tt.debug("handleDelete, pending confirmation",w),c(w)},[]),f=p.exports.useCallback(()=>{Tt.debug("handleDeleteConfirm",r),r.forEach(w=>s.deleteFile(it(w)?U.makePath(w.filename):w.filename)),n(r),c([])},[r,n,s]),E=p.exports.useCallback(()=>{Tt.debug("handleDeleteCancel"),c([])},[]),b=p.exports.useCallback((w,_)=>{U.reducePaths(w.map(D=>it(D)?U.makePath(D.filename):D.filename)).forEach(D=>{const P=U.isPath(D)?`${_}${U.getBaseName(D.substring(0,D.length-1))}/`:`${_}${U.getBaseName(D)}`;s.moveFile(D,P).then(()=>{t(D,P)}).catch(m)})},[m,t,s]),y=p.exports.useCallback((w,_)=>{let L=w.filename;const D=it(w);D&&!L.endsWith("/")&&(L=`${L}/`);let P=`${U.getParent(L)}${_}`;D&&!P.endsWith("/")&&(P=`${P}/`),Tt.debug2("handleRename",L,P),s.moveFile(L,P).catch(m),t(L,P)},[m,t,s]),C=p.exports.useCallback(async(w,_)=>{if(_===w.basename)return;U.validateName(_);const L=`${U.getPath(w.filename)}${_}`;try{const D=await s.info(L);throw new Wn(D)}catch(D){if(!(D instanceof bi))throw D}},[s]),I=r.length>0,T=p.exports.useMemo(()=>r.length===1?`Are you sure you want to delete "${r[0].filename}"?`:"Are you sure you want to delete the selected files?",[r]);return a.createElement("div",{className:"file-explorer"},d&&a.createElement(Na,{isMultiSelect:e,showContextMenu:!0,onMove:b,onDelete:g,onRename:y,onSelect:i,rowHeight:o,table:d,validateRename:C}),a.createElement(Cn,{isOpen:I,headerText:T,bodyText:"You cannot undo this action.",onCancel:E,onConfirm:f,confirmButtonText:"Delete"}))};Ci.displayName="FileExplorer";const _t=O.module("NewItemModal"),Gn=class extends p.exports.PureComponent{constructor(l){super(l),this.inputRef=a.createRef(),this.pending=new vn,this.pathMap=new Map,this.handleModalSubmit=this.handleModalSubmit.bind(this),this.handleModalOpened=this.handleModalOpened.bind(this),this.handleSelect=this.handleSelect.bind(this),this.handleChange=this.handleChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleValidationError=this.handleValidationError.bind(this),this.handleOverwriteCancel=this.handleOverwriteCancel.bind(this),this.handleOverwriteConfirm=this.handleOverwriteConfirm.bind(this),this.handleExtensionChangeCancel=this.handleExtensionChangeCancel.bind(this),this.handleExtensionChangeConfirm=this.handleExtensionChangeConfirm.bind(this);const{defaultValue:s}=l,e=U.hasPath(s)?U.getPath(s):"/";this.state={isSubmitting:!1,path:e,prevExtension:U.getExtension(s),showExtensionChangeModal:!1,showOverwriteModal:!1,value:U.getBaseName(s)}}static getValidationMessage(l){return l instanceof Wn&&l.info.type==="directory"?"Error: Cannot overwrite existing directory":`${l}`}static handleError(l){le.isCanceled(l)||_t.error(l)}componentDidUpdate(l,s){const{isOpen:e}=this.props,{isOpen:n}=l,{value:t,path:i}=this.state;!n&&e&&this.resetValue(),(i!==s.path||t!==s.value)&&this.updateValidationStatus(i,t)}componentWillUnmount(){this.pending.cancel(),this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableExistingItemPromise&&this.cancelableExistingItemPromise.cancel()}resetValue(){const{defaultValue:l}=this.props,s=U.hasPath(l)?U.getPath(l):"/";this.setState({path:s,value:U.getBaseName(l),validationError:void 0,prevExtension:U.getExtension(l),isSubmitting:!1})}getValidationPromise(l,s,e=!1){return this.cancelableValidatePromise&&this.cancelableValidatePromise.cancel(),this.cancelableValidatePromise=le.makeCancelable(this.validateName(l,s,e)),this.cancelableValidatePromise}async validateName(l,s,e){U.validateName(s);const{defaultValue:n,storage:t}=this.props;if(e){const i=`${l}${s}`;if(i!==n)try{const o=await t.info(i);throw new Wn(o)}catch(o){if(!(o instanceof bi))throw o}}return s}updateValidationStatus(l,s){this.getValidationPromise(l,s).then(()=>{this.setState({validationError:void 0})}).catch(this.handleValidationError).catch(Gn.handleError)}handleModalOpened(){this.focusRenameInput()}handleModalSubmit(){this.submitModal()}handleChange(l){const{value:s}=l.target;this.setState({value:s})}handleSelect(l){if(_t.debug("handleSelect",l),l.type==="directory")this.setState({path:U.makePath(l.filename)});else{const s=l.basename,e=U.getPath(l.filename);this.setState({value:s,path:e},()=>{this.focusRenameInput()})}}handleKeyDown(l){const{key:s}=l;switch(l.stopPropagation(),s){case"Enter":{l.preventDefault(),this.submitModal();break}case"Escape":{l.preventDefault();const{onCancel:e}=this.props;e();break}}}handleValidationError(l){if(!(l instanceof un))throw l;_t.debug("Validation error",l),this.setState({validationError:l})}handleOverwriteCancel(){this.setState({showOverwriteModal:!1,isSubmitting:!1})}handleOverwriteConfirm(){this.setState({showOverwriteModal:!1});const{onSubmit:l}=this.props,{path:s,value:e}=this.state;_t.debug("handleOverwriteConfirm",s,e),l(`${s}${e}`)}handleExtensionChangeCancel(){_t.debug("handleExtensionChangeCancel"),this.setState(({value:l,prevExtension:s})=>{const e=U.replaceExtension(l,s);return{showExtensionChangeModal:!1,value:e}}),this.submitModal(!0)}handleExtensionChangeConfirm(){_t.debug("handleExtensionChangeConfirm"),this.setState({showExtensionChangeModal:!1}),this.submitModal(!0)}focusRenameInput(){const l=this.inputRef.current;if(l){const{type:s}=this.props,{value:e}=l,n=s==="directory"?e.length:e.lastIndexOf(".");l.focus(),l.setSelectionRange(0,n>0?n:e.length)}}submitModal(l=!1){this.setState(({prevExtension:s,value:e,path:n})=>{const{notifyOnExtensionChange:t,type:i}=this.props;_t.debug("submitModal",s,e);const o=U.getExtension(e);return t&&!l&&s!==null&&s!==o?{isSubmitting:!1,showExtensionChangeModal:!0,newExtension:o}:(this.getValidationPromise(n,e,!0).then(r=>{const{onSubmit:c}=this.props;c(`${n}${e}`)}).catch(r=>{if(r instanceof Wn&&i!=="directory"&&r.info.type!=="directory"){this.setState({showOverwriteModal:!0});return}throw r}).catch(r=>{throw le.isCanceled(r)&&this.setState({isSubmitting:!1}),r}).catch(this.handleValidationError).catch(Gn.handleError),{isSubmitting:!0,showExtensionChangeModal:!1,newExtension:void 0})})}render(){const{storage:l,isOpen:s,onCancel:e,placeholder:n,title:t,type:i}=this.props,{isSubmitting:o,path:r,showExtensionChangeModal:c,showOverwriteModal:d,validationError:h,value:m,prevExtension:g,newExtension:f}=this.state,E=i==="directory",b=U.fileExtensionToString(g),y=U.fileExtensionToString(f),C=E?"Create":"Save",I=E?"New folder name":"Save file as";return a.createElement(a.Fragment,null,a.createElement(js,{isOpen:s,toggle:e,onOpened:this.handleModalOpened,className:"modal-dialog-centered new-file-modal theme-bg-dark"},a.createElement(Ks,{toggle:e},t),a.createElement(Zs,null,a.createElement("form",null,a.createElement("div",{className:"d-flex flex-column new-file-modal-content"},a.createElement("div",{className:"flex-grow-0 mb-4"},a.createElement("label",{htmlFor:"file-name-input"},I),a.createElement("input",{id:"file-name-input",type:"text",autoComplete:"off",autoCapitalize:"none",autoCorrect:"off",spellCheck:"false",className:z("form-control",{"is-invalid":h}),value:m,placeholder:n,ref:this.inputRef,onKeyDown:this.handleKeyDown,onChange:this.handleChange}),h&&a.createElement("div",{className:"invalid-feedback"},Gn.getValidationMessage(h))),a.createElement("div",{className:"flex-grow-0"},a.createElement("label",null,"Directory: ",a.createElement("span",{className:"new-item-parentId"},r))),a.createElement("div",{className:"flex-grow-1 file-explorer-container"},a.createElement(Ci,{onSelect:this.handleSelect,storage:l}))))),a.createElement(Ao,null,a.createElement("button",{className:"btn btn-outline-primary",onClick:e,type:"button"},"Cancel"),a.createElement("button",{className:"btn btn-primary",disabled:o,onClick:this.handleModalSubmit,type:"button"},C))),a.createElement(Cn,{isOpen:d,headerText:"Confirm overwrite",bodyText:"File with this name already exists, are you sure you want to overwrite it?",onCancel:this.handleOverwriteCancel,onConfirm:this.handleOverwriteConfirm,cancelButtonText:"Cancel",confirmButtonText:"Overwrite"}),a.createElement(Cn,{isOpen:c,headerText:"Confirm extension change",bodyText:`Are you sure you want to change extension from "${b}" to "${y}"?`,onCancel:this.handleExtensionChangeCancel,onConfirm:this.handleExtensionChangeConfirm,cancelButtonText:`Keep "${b}"`,confirmButtonText:`Use "${y}"`}))}};let fs=Gn;fs.propTypes={isOpen:u.exports.bool,title:u.exports.string.isRequired,defaultValue:u.exports.string,type:u.exports.oneOf(["file","directory"]).isRequired,onSubmit:u.exports.func,onCancel:u.exports.func,placeholder:u.exports.string,storage:u.exports.shape({}).isRequired,notifyOnExtensionChange:u.exports.bool};fs.defaultProps={isOpen:!1,defaultValue:"/",notifyOnExtensionChange:!1,placeholder:"",onSubmit:l=>{},onCancel:()=>{}};const oh=({createFile:l,createFolder:s,onSearchChange:e,defaultSearchText:n=""})=>a.createElement("div",{className:"file-explorer-toolbar"},a.createElement("div",{className:"file-explorer-toolbar-buttons"},a.createElement(X,{kind:"ghost",icon:Tr,tooltip:"New notebook",onClick:l}),a.createElement(X,{kind:"ghost",icon:_r,tooltip:"New folder",onClick:s})),e&&a.createElement("div",{className:"file-explorer-toolbar-search"},a.createElement(Ir,{value:n,onChange:e,placeholder:"Search by name"}))),ws=O.module("WebdavFileStorageTable");class Si{constructor(s,e="/"){this.currentSize=0,this.listeners=[],this.childTables=new Map,this.client=s,this.root=e}getViewportData(){var s;return this.viewportUpdatePromise||this.refreshInternal(),(s=this.viewportUpdatePromise)!=null?s:Promise.resolve({items:[],offset:0})}getSnapshot(s){throw new Error("Method not implemented.")}get size(){return this.currentSize}async setExpanded(s,e){const n=s.split("/");let t=n.shift();if(t||(t=n.shift()),!t)throw new Error(`Invalid path: ${s}`);const i=n.join("/");if(e){if(!this.childTables.has(t)){const o=new Si(this.client,`${this.root}${t}/`);this.childTables.set(t,o)}if(i){const o=this.childTables.get(t);o==null||o.setExpanded(i,e)}}else if(this.childTables.has(t))if(i){const o=this.childTables.get(t);o==null||o.setExpanded(i,e)}else this.childTables.delete(t);this.currentViewport&&await this.refreshInternal()}setSearch(s){throw new Error("Method not implemented.")}setViewport(s){this.currentViewport=s,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(s){return this.listeners=[...this.listeners,s],()=>{this.listeners=this.listeners.filter(e=>e!==s)}}async refresh(){var e;ws.debug2(this.root,"refreshData"),(e=this.viewportUpdatePromise)==null||e.cancel(),this.viewportUpdatePromise=le.makeCancelable(this.fetchData());const s=await this.viewportUpdatePromise;return this.currentViewportData=s,this.sendUpdate(),s}async refreshInternal(){try{await this.refresh()}catch(s){le.isCanceled(s)||ws.error("Unable to refresh data",s)}}async fetchData(){const{currentViewport:s}=this;if(!s)throw new Error("No viewport set");let e=await this.client.getDirectoryContents(this.root).then(n=>n.map(t=>({...t,id:t.filename,isExpanded:t.type==="directory"?this.childTables.has(t.basename):void 0})).sort((t,i)=>t.type!==i.type?t.type==="directory"?-1:1:t.basename.localeCompare(i.basename)));for(let n=0;n<e.length;n+=1){const t=e[n],{basename:i,filename:o}=t;if(o===`${this.root}${i}`&&t.type==="directory"){const r=this.childTables.get(i);if(r!=null){r.setViewport({top:0,bottom:s.bottom-n});const c=await r.getViewportData();e.splice(n+1,0,...c.items)}}}return this.currentSize=e.length,ws.debug2(this.root,"items",e,s),e=e.slice(s.top,s.bottom),{items:e,offset:s.top}}sendUpdate(){var n;const{listeners:s}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let t=0;t<s.length;t+=1)s[t](e)}}const La=class{constructor(l){this.tables=[],this.refreshTables=Zo(()=>{this.tables.every(s=>s.refresh().catch(()=>{}))},La.REFRESH_THROTTLE),this.client=l}async createDirectory(l){return await this.client.createDirectory(l),this.refreshTables(),{type:"directory",id:l,filename:l,basename:U.getBaseName(l)}}async getTable(){const l=new Si(this.client);return this.tables.push(l),l}async saveFile(l){if(!await this.client.putFileContents(l.filename,l.content))throw new Error("Unable to write file");return this.refreshTables(),l}async loadFile(l){const s=await this.client.getFileContents(l,{format:"text"});return{filename:l,basename:U.getBaseName(l),content:s}}async deleteFile(l){await this.client.deleteFile(l),this.refreshTables()}async moveFile(l,s){await this.client.moveFile(l,s),this.refreshTables()}async info(l){try{const s=await this.client.stat(l);return{filename:s.filename,basename:s.basename,id:s.filename,type:s.type}}catch{throw new bi}}};let Fa=La;Fa.REFRESH_THROTTLE=150;const Ot=O.module("FileExplorerPanel"),ah=(l,s)=>{const e=ia(l),n=kt(l,s.localDashboardId),{session:t,config:i}=n!=null?n:{},o=i==null?void 0:i.type;return{fileStorage:e,language:o,session:t}},rh=we(ah,null,null,{forwardRef:!0});function lh(l){const s=l;return s&&typeof s.button=="number"}const Bs=class extends a.Component{static handleError(l){Ot.error(l)}static isFocusEvent(l){return lh(l)?l.detail>=2:!0}constructor(l){super(l),this.handleFileSelect=this.handleFileSelect.bind(this),this.handleCreateFile=this.handleCreateFile.bind(this),this.handleCreateDirectory=this.handleCreateDirectory.bind(this),this.handleCreateDirectoryCancel=this.handleCreateDirectoryCancel.bind(this),this.handleCreateDirectorySubmit=this.handleCreateDirectorySubmit.bind(this),this.handleDelete=this.handleDelete.bind(this),this.handleRename=this.handleRename.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this);const{session:s,language:e}=l;this.state={isShown:!1,language:e,session:s,showCreateFolder:!1}}componentDidMount(){this.isHidden()||this.setState({isShown:!0})}handleCreateFile(){const{glEventHub:l}=this.props,{session:s,language:e}=this.state,n={language:e,value:""};Ot.debug("handleCreateFile",s,e,n),l.emit(ee.CREATE_NOTEBOOK,s,e,n)}handleCreateDirectory(l){this.setState({showCreateFolder:!0})}handleCreateDirectoryCancel(){Ot.debug("handleCreateDirectoryCancel"),this.setState({showCreateFolder:!1})}handleCreateDirectorySubmit(l){Ot.debug("handleCreateDirectorySubmit",l),this.setState({showCreateFolder:!1});const{fileStorage:s}=this.props;s.createDirectory(l).catch(Bs.handleError)}handleDelete(l){const{glEventHub:s}=this.props;l.forEach(e=>{s.emit(ee.CLOSE_FILE,{id:e.filename,itemName:e.filename})})}handleFileSelect(l,s){if(Ot.debug("fileSelect",l),l.type==="directory")return;const e=Bs.isFocusEvent(s),n={id:l.filename,itemName:l.filename},{glEventHub:t}=this.props,{session:i,language:o}=this.state,r={value:null,language:o};t.emit(ee.SELECT_NOTEBOOK,i,o,r,n,e)}handleRename(l,s){const{glEventHub:e}=this.props;Ot.debug("handleRename",l,s),e.emit(ee.RENAME_FILE,l,s)}handleSessionOpened(l,{language:s}){this.setState({session:l,language:s})}handleSessionClosed(){this.setState({session:void 0,language:void 0})}handleShow(){this.setState({isShown:!0})}isHidden(){const{glContainer:l}=this.props,{isHidden:s}=l;return s}render(){const{fileStorage:l,glContainer:s,glEventHub:e}=this.props,{isShown:n,showCreateFolder:t}=this.state;return a.createElement(Xe,{className:"file-explorer-panel",componentPanel:this,glContainer:s,glEventHub:e,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onShow:this.handleShow},a.createElement(oh,{createFile:this.handleCreateFile,createFolder:this.handleCreateDirectory}),n&&a.createElement(Ci,{isMultiSelect:!0,storage:l,onDelete:this.handleDelete,onRename:this.handleRename,onSelect:this.handleFileSelect}),a.createElement(fs,{isOpen:t,type:"directory",title:"Create New Folder",storage:l,onSubmit:this.handleCreateDirectorySubmit,onCancel:this.handleCreateDirectoryCancel}))}};let yi=Bs;yi.COMPONENT="FileExplorerPanel";yi.TITLE="File Explorer";const Qn=rh(yi);const ce=O.module("FilterSetManager"),ch="Enter name...",lo="No Available Filter Sets";class es extends p.exports.Component{constructor(s){super(s),this.renameInputRef=a.createRef(),this.dropdownRef=a.createRef(),this.editDropdownRef=a.createRef(),this.isRenamingExistingSet=te((e,n)=>n!==void 0&&e.some(({id:t})=>t===n.id)),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.handleEditDropdownChange=this.handleEditDropdownChange.bind(this),this.handleFilterChange=this.handleFilterChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleCaptureNewSet=this.handleCaptureNewSet.bind(this),this.handleNameInputChange=this.handleNameInputChange.bind(this),this.handleNameInputKeyPress=this.handleNameInputKeyPress.bind(this),this.handleRenameConfirm=this.handleRenameConfirm.bind(this),this.handleRenameCancel=this.handleRenameCancel.bind(this),this.handleRestoreFullStateChange=this.handleRestoreFullStateChange.bind(this),this.handleSetDelete=this.handleSetDelete.bind(this),this.handleSetEdit=this.handleSetEdit.bind(this),this.handleSetUpdate=this.handleSetUpdate.bind(this),this.state={editId:void 0,renameSet:void 0,nameInputValue:"",nameInputError:void 0,modifiedFilterSets:[],restoreFullState:!1}}static animateScreenFlash(){var e;const s=document.createElement("div");s.classList.add("screen-flash-overlay"),s.addEventListener("animationend",()=>{s.remove()}),(e=document.querySelector("body"))==null||e.appendChild(s)}componentDidMount(){const{isValueShown:s}=this.props;s?this.updateSelectedId():this.initSettingsScreen()}componentDidUpdate(s,e){const{isValueShown:n,filterSets:t}=this.props,{modifiedFilterSets:i}=this.state;if(s.isValueShown&&!n&&this.initSettingsScreen(),this.isNameInputScreen()&&!this.isNameInputScreen(e)&&this.focusRenameInput(),t!==s.filterSets)if(!n&&t.length>0&&s.filterSets.length===0&&i.length===0){const{onChange:o}=this.props;o({isValueShown:!0,selectedId:t[0].id})}else this.updateSelectedId()}initSettingsScreen(){const{filterSets:s,selectedId:e}=this.props;ce.debug("initSettingsScreen",s,e),this.setState({modifiedFilterSets:[...s],editId:e})}updateSelectedId(){const{isValueShown:s,filterSets:e,selectedId:n,onChange:t}=this.props;if(ce.debug("updateSelectedId",e,n),!!s&&!e.some(({id:i})=>i===n)){const i=e.length===0;t({isValueShown:!i,selectedId:i?void 0:e[0].id})}}handleEditDropdownChange(s){const{value:e}=s.target;this.setState({editId:e})}handleFilterChange(s){const{value:e}=s.target,{isValueShown:n,onChange:t}=this.props;this.applyFilterSet(e),t({isValueShown:n,selectedId:e})}handleFilterApply(){const{selectedId:s}=this.props;this.applyFilterSet(s)}handleSettingsCancel(){const{onChange:s,selectedId:e,filterSets:n}=this.props;this.setState({modifiedFilterSets:[]}),n.length>0&&s({isValueShown:!0,selectedId:e})}handleSettingsSave(){const{onChange:s,onUpdateSets:e}=this.props,{modifiedFilterSets:n,editId:t}=this.state;this.setState({modifiedFilterSets:[]}),ce.debug("Update sets",n,t),e(n),n.length>0&&s({isValueShown:!0,selectedId:t})}handleCaptureNewSet(){const{getFilterState:s}=this.props;es.animateScreenFlash();const e=Ee(),n=s(),t={id:e,title:"",panels:n};ce.debug("handleSetCreate",t),this.setState({nameInputValue:"",nameInputError:void 0,renameSet:t})}handleRenameCancel(){this.setState({renameSet:void 0})}handleRestoreFullStateChange(s){this.setState({restoreFullState:s.target.value==="true"})}getNameError(s){var i;const{renameSet:e,modifiedFilterSets:n}=this.state,t=(i=s==null?void 0:s.trim())!=null?i:"";if(t.length===0)return ce.debug("Name cannot be empty",t),"Name cannot be empty";if(e!==void 0&&n.some(({title:o,id:r})=>o===t&&r!==e.id))return ce.debug("Set with this name already exists",t),"Set with this name already exists"}handleRenameConfirm(){var h;const{nameInputValue:s,renameSet:e,modifiedFilterSets:n,restoreFullState:t}=this.state;if(e===void 0){ce.error("Renamed set undefined.");return}const i=this.getNameError(s);if(ce.debug("handleRenameConfirm",s,i),i!==void 0){this.setState({nameInputError:i});return}const o=(h=s==null?void 0:s.trim())!=null?h:"",r={...e,title:o,restoreFullState:t},c=n.findIndex(({id:m})=>m===e.id),d=[...n];c>=0?(d[c]=r,ce.debug("Renamed existing set",d)):(d.push(r),ce.debug("Added new set to modified sets",d)),this.setState({editId:r.id,modifiedFilterSets:d,renameSet:void 0})}handleSetDelete(){this.setState(s=>{const{editId:e,modifiedFilterSets:n}=s,t=n.findIndex(({id:c})=>c===e);if(t<0)return ce.error("Unable to find selected filterSet index",n,e),null;const i=n.filter(({id:c})=>c!==e),o=Math.max(0,Math.min(i.length-1,t-1)),r=i.length>0?i[o].id:void 0;return ce.debug("Deleted selected set",e,n,i),ce.debug("New selection",o,r),{modifiedFilterSets:i,editId:r}})}handleSetUpdate(){const{getFilterState:s}=this.props;es.animateScreenFlash();const e=s();this.setState(({modifiedFilterSets:n,editId:t})=>{if(t===void 0)return ce.error("Filter for update not selected."),null;const i=[...n],o=i.findIndex(({id:r})=>r===t);return o<0?(ce.error("Selected set for update not found."),null):(i[o]={...i[o],panels:e},ce.debug("Update set",i,e),{modifiedFilterSets:i})})}handleSetEdit(){this.setState(({editId:s,modifiedFilterSets:e})=>{const n=e.find(({id:o})=>o===s);if(n===void 0)return ce.error("Could not find selected set",s,e),null;const{title:t,restoreFullState:i=!1}=n;return{nameInputValue:t,nameInputError:void 0,renameSet:n,restoreFullState:i}})}handleSettingsClick(s){s.stopPropagation();const{onChange:e,selectedId:n}=this.props;e({isValueShown:!1,selectedId:n})}handleBackgroundClick(s){ce.debug("handleBackgroundClick"),s.target!==this.dropdownRef.current&&this.focusInput()}handleNameInputChange(s){const{value:e}=s.target,n=this.getNameError(e);this.setState({nameInputValue:e,nameInputError:n})}handleNameInputKeyPress(s){const{key:e}=s;e==="Enter"&&(s.preventDefault(),this.handleRenameConfirm())}isNameInputScreen(s=this.state){const{renameSet:e}=s;return e!==void 0}applyFilterSet(s){const{onApply:e,filterSets:n}=this.props;if(s===void 0){ce.debug("No filter selected");return}const t=n.find(({id:i})=>i===s);if(t===void 0){ce.debug("Selected id not found in filterSets",s,n);return}ce.debug("Apply filterSet",t),e(t)}focusInput(){var s;(s=this.dropdownRef.current)==null||s.focus()}focusRenameInput(){var s;(s=this.renameInputRef.current)==null||s.focus()}render(){const{nameInputValue:s,nameInputError:e,editId:n,renameSet:t,modifiedFilterSets:i,restoreFullState:o}=this.state,{isValueShown:r,filterSets:c,selectedId:d}=this.props,h=this.isNameInputScreen(),m=this.isRenamingExistingSet(i,t),g=i.length===0,f=!h&&g&&c.length===0,E=!h&&!f,b=a.createElement("div",{className:"fa-layers mr-3"},a.createElement(G,{icon:Hi,mask:Ps,transform:"shrink-1 down-5 right-7"}),a.createElement(G,{icon:Ho,className:"text-primary",transform:"shrink-6 down-5 right-7"})),y=a.createElement("div",{className:"fa-layers"},a.createElement(G,{icon:Hi,mask:Ps,transform:"shrink-1 down-5 right-7"}),a.createElement(G,{icon:Rs,transform:"shrink-1 down-5 right-7"}));return a.createElement("div",{className:"filter-set-manager fill-parent-absolute"},a.createElement(oi,{className:"w-100 h-100",isFlipped:r},a.createElement("div",{className:"filter-set-manager-settings-card fill-parent-absolute",key:"front"},a.createElement("div",{className:"filter-set-manager-card-content"},f&&a.createElement("div",null,a.createElement(X,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b},"Capture filter set"),a.createElement("div",{className:"py-3 text-muted small"},"Takes a snapshot of the currently applied filters on all panels, allowing you to restore saved filter sets later.")),h&&a.createElement("div",{className:"d-flex flex-column justify-content-center","data-testid":"edit-filter-set-container"},a.createElement("div",{className:"form-group"},a.createElement("label",null,m?"Edit set":"Name captured set"),a.createElement("div",{className:"name-input-container"},a.createElement("input",{type:"text",className:"input-set-name form-control",placeholder:ch,value:s,ref:this.renameInputRef,onChange:this.handleNameInputChange,onKeyPress:this.handleNameInputKeyPress,spellCheck:"false"}),a.createElement(X,{"data-testid":"rename-confirm-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameConfirm,tooltip:"Save","test-id":"button-save",icon:Oo}),a.createElement(X,{"data-testid":"rename-cancel-button",kind:"ghost",className:"btn btn-link no-underline pt-2 pb-2",onClick:this.handleRenameCancel,tooltip:"Cancel",icon:xr})),e&&a.createElement("div",{className:"error-message"},e)),a.createElement("div",{className:"form-group"},a.createElement(Uo,{onChange:this.handleRestoreFullStateChange,value:`${o}`},a.createElement(Nt,{value:"false"},"Restore only filters"),a.createElement(Nt,{value:"true"},"Restore full table state")))),E&&a.createElement("div",{className:"filter-set-manager-settings-grid-1"},a.createElement("div",{className:"form-group"},a.createElement("label",null,"Edit filter sets"),a.createElement("div",{className:"filter-select-container"},a.createElement("select",{"data-testid":"settings-card-filter-select",ref:this.editDropdownRef,value:n!=null?n:"-1",className:"custom-select filter-value-select",onChange:this.handleEditDropdownChange,disabled:g},g&&a.createElement("option",{value:"-1",disabled:!0},lo),i.map(({id:C,title:I})=>a.createElement("option",{key:C,value:C},I))),a.createElement(X,{kind:"ghost",onClick:this.handleSetUpdate,disabled:g,icon:y,tooltip:"Update"}),a.createElement(X,{kind:"ghost",onClick:this.handleSetEdit,disabled:g,icon:Vo,tooltip:"Edit"}),a.createElement(X,{kind:"ghost",onClick:this.handleSetDelete,disabled:g,icon:Ys,tooltip:"Delete"}))),a.createElement("div",null,a.createElement(X,{kind:"ghost",className:"btn btn-link no-underline",onClick:this.handleCaptureNewSet,icon:b},"Capture new filter set")),a.createElement("div",{className:"py-3 text-right"},a.createElement(X,{kind:"secondary",onClick:this.handleSettingsCancel},"Cancel"),"\xA0",a.createElement(X,{kind:"primary",onClick:this.handleSettingsSave},"Save"))))),a.createElement("div",{className:"filter-set-manager-value-card fill-parent-absolute",key:"back",onClick:this.handleBackgroundClick},a.createElement(a.Fragment,null,a.createElement("div",{className:"filter-set-manager-column"},a.createElement("div",{className:"filter-set-manager-column-title"},"Filter sets")),a.createElement("div",{className:"filter-set-manager-card-content"},a.createElement("div",{className:"filter-set-manager-value-input"},a.createElement("div",{className:"filter-select-container"},a.createElement("select",{"data-testid":"value-card-filter-select",ref:this.dropdownRef,value:d,className:"custom-select filter-value-select",onChange:this.handleFilterChange},c.length===0&&a.createElement("option",{value:"-1",disabled:!0},lo),c.map(({id:C,title:I})=>a.createElement("option",{key:C,value:C},I))),a.createElement(X,{"data-testid":"filter-apply-button",kind:"ghost",onClick:this.handleFilterApply,icon:Bo,tooltip:"Apply Filter Set"})))),a.createElement("div",{className:"filter-set-manager-menu"},a.createElement(X,{kind:"ghost",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick,tooltip:"Settings",icon:a.createElement(G,{icon:rs,transform:"grow-4"})}))))))}}const Je=O.module("IrisGridPanel"),hh=500,uh={IrisGrid:Xs,IrisGridTableModel:Lr,ContextMenuRoot:Js};class Dn extends p.exports.PureComponent{constructor(e){super(e);v(this,"getGridInputFilters",te((e,n)=>ge.getInputFiltersForColumns(e,n.filter(({value:t,excludePanelIds:i})=>t!=null&&(i==null||!i.includes(F.getIdFromPanel(this)))))));v(this,"getAlwaysFetchColumns",te((e,n)=>{const t=F.getIdFromPanel(this),i=new Set(n);for(let o=0;o<e.length;o+=1){const{start:r}=e[o];r&&r.panelId===t&&i.add(r.columnName)}return[...i]}));v(this,"getPluginContent",te((e,n,t,i,o)=>e==null||n==null?null:a.createElement("div",{className:"iris-grid-plugin"},a.createElement(e,{ref:this.pluginRef,filter:this.handlePluginFilter,onFilter:this.handlePluginFilter,fetchColumns:this.handlePluginFetchColumns,onFetchColumns:this.handlePluginFetchColumns,table:n,user:t,panel:this,workspace:i,components:uh,onStateChange:this.handlePluginStateChange,pluginState:o}))));v(this,"getDehydratedIrisGridPanelState",te((e,n,t,i)=>ge.dehydrateIrisGridPanelState(e,{isSelectingPartition:n,partition:t,partitionColumn:i})));v(this,"getDehydratedIrisGridState",te((e,n,t,i,o,r,c,d,h,m,g,f,E,b,y,C,I,T,w,_,L)=>ge.dehydrateIrisGridState(e,{advancedFilters:t,advancedSettings:T,aggregationSettings:I,customColumnFormatMap:i,isFilterBarShown:o,metrics:{userColumnWidths:y,userRowHeights:C},quickFilters:r,customColumns:c,reverseType:d,rollupConfig:h,showSearchBar:m,searchValue:g,selectDistinctColumns:f,selectedSearchColumns:E,sorts:n,invertSearchColumns:b,pendingDataMap:w,frozenColumns:_,conditionalFormats:L})));v(this,"getDehydratedGridState",te((e,n,t,i,o)=>ge.dehydrateGridState(e,{isStuckToBottom:i,isStuckToRight:o,movedColumns:n,movedRows:t})));v(this,"getCachedPanelState",te((e,n,t,i)=>({irisGridPanelState:e,irisGridState:n,gridState:t,pluginState:i})));this.savePanelState=Ye(this.savePanelState.bind(this),hh),this.handleAdvancedSettingsChange=this.handleAdvancedSettingsChange.bind(this),this.handleColumnsChanged=this.handleColumnsChanged.bind(this),this.handleTableChanged=this.handleTableChanged.bind(this),this.handleColumnSelected=this.handleColumnSelected.bind(this),this.handleDataSelected=this.handleDataSelected.bind(this),this.handleError=this.handleError.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePluginStateChange=this.handlePluginStateChange.bind(this),this.handlePartitionAppend=this.handlePartitionAppend.bind(this),this.handleCreateChart=this.handleCreateChart.bind(this),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleTabClicked=this.handleTabClicked.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.handleReconnect=this.handleReconnect.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.handleContextMenu=this.handleContextMenu.bind(this),this.handlePluginFilter=this.handlePluginFilter.bind(this),this.handlePluginFetchColumns=this.handlePluginFetchColumns.bind(this),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.irisGrid=a.createRef(),this.pluginRef=a.createRef(),this.modelPromise=null;const{panelState:n,metadata:t}=e,i=t.query;this.irisGridState=null,this.gridState=null,this.pluginState=null,this.state={error:null,isDisconnected:!1,isLoaded:!1,isLoading:!0,isModelReady:!1,model:null,advancedFilters:new Map,aggregationSettings:{aggregations:[],showOnTop:!1},advancedSettings:new Map(Dr.DEFAULTS),customColumns:[],customColumnFormatMap:new Map,isFilterBarShown:!1,quickFilters:new Map,sorts:[],userColumnWidths:new Map,userRowHeights:new Map,reverseType:de.REVERSE_TYPE.NONE,movedColumns:[],movedRows:[],isSelectingPartition:!1,partition:null,partitionColumn:null,queryName:i,rollupConfig:null,showSearchBar:!1,searchValue:"",selectedSearchColumns:null,invertSearchColumns:!0,Plugin:null,pluginFilters:[],pluginFetchColumns:[],modelQueue:[],pendingDataMap:new Map,frozenColumns:null,panelState:n,irisGridStateOverrides:{},gridStateOverrides:{}}}componentDidMount(){this.initModel()}componentDidUpdate(e,n){const{model:t}=this.state;t!==n.model&&(n.model!=null&&(this.stopModelListening(n.model),n.model.close()),t!=null&&this.startModelListening(t))}componentWillUnmount(){this.savePanelState.cancel(),this.modelPromise!=null&&(this.modelPromise.cancel(),this.modelPromise=null);const{model:e}=this.state;e&&(this.stopModelListening(e),e.close())}getTableName(){const{metadata:e}=this.props;return e.table}initModel(){this.setState({isModelReady:!1,isLoading:!0,error:null});const{makeModel:e}=this.props;this.modelPromise!=null&&this.modelPromise.cancel(),this.modelPromise=le.makeCancelable(e(),n=>n.close),this.modelPromise.then(this.handleLoadSuccess).catch(this.handleLoadError)}handleLoadSuccess(e){const n=e,{panelState:t,irisGridStateOverrides:i}=this.state,o=[];if(t!=null){const{irisGridState:r}=t,{aggregationSettings:c,customColumns:d,selectDistinctColumns:h=[],rollupConfig:m}={...r,...i};d.length>0&&o.push(g=>{g.customColumns=d}),m!=null&&m.columns.length>0&&o.push(g=>{g.rollupConfig=ge.getModelRollupConfig(g.originalColumns,m,c)}),h.length>0&&o.push(g=>{g.selectDistinctColumns=h})}this.setState({model:n,modelQueue:o}),this.initModelQueue(n,o)}initModelQueue(e,n){const t=e;if(n.length===0){this.modelInitialized(t);return}const i=n.shift();Je.debug("initModelQueue",i),i(t),this.setState({modelQueue:n})}handleAdvancedSettingsChange(e,n){Je.debug("handleAdvancedSettingsChange",e,n),this.setState(({advancedSettings:t})=>t.get(e)===n?null:{advancedSettings:new Map(t).set(e,n)})}handlePluginFilter(e){const{model:n}=this.state,{columns:t,formatter:i}=n,o=ge.getFiltersFromInputFilters(t,e,i.timeZone);this.setState({pluginFilters:o})}handlePluginFetchColumns(e){this.setState({pluginFetchColumns:e})}handleContextMenu(e){var n,t,i;return(i=(t=(n=this.pluginRef.current)==null?void 0:n.getMenu)==null?void 0:t.call(n,e))!=null?i:[]}isColumnSelectionValid(e){const{columnSelectionValidator:n}=this.props;return n?n(this,e):!1}handleGridStateChange(e,n){this.irisGridState=e,this.gridState=n,this.setState({isLoaded:!0,isLoading:!1}),this.savePanelState();const{glEventHub:t,onStateChange:i}=this.props;t.emit(ye.STATE_CHANGED,this),i(e,n)}handlePluginStateChange(e){const{irisGridState:n,gridState:t}=this;this.pluginState=e,n!==null&&t!==null&&this.savePanelState()}handleColumnsChanged(e){const{isModelReady:n,model:t,modelQueue:i}=this.state;n?this.sendColumnsChange(e.detail):this.initModelQueue(t,i)}handleTableChanged(e){Je.debug("handleTableChanged",e);const{glEventHub:n}=this.props,{detail:t}=e;n.emit(J.TABLE_CHANGED,this,t)}handlePartitionAppend(e,n){const{glEventHub:t}=this.props,{name:i}=e,o=this.getTableName(),r=`${o} = ${o}.where("${i}=\`${n}\`")`;t.emit(fe.SEND_COMMAND,r,!1,!0)}handleCreateChart(e,n){this.savePanelState.flush(),this.setState(()=>null,()=>{const{glEventHub:t,inputFilters:i,metadata:o}=this.props,{table:r}=o,{panelState:c}=this.state,d=F.getIdFromPanel(this),h=ge.extractTableSettings(c,i);t.emit(ye.CREATE_CHART,{metadata:{settings:e,sourcePanelId:d,table:r,tableSettings:h},table:n.table})})}handleColumnSelected(e){const{glEventHub:n}=this.props;n.emit(ye.COLUMN_SELECTED,this,e)}handleDataSelected(e,n){const{glEventHub:t}=this.props;t.emit(ye.DATA_SELECTED,this,n)}handleResize(){this.updateGrid()}handleShow(){this.updateGrid()}handleTabClicked(){this.irisGrid.current&&this.irisGrid.current.focus()}handleError(e){Je.error(e),this.setState({error:e,isLoading:!1})}handleDisconnect(){this.setState({error:new Error("Table disconnected"),isDisconnected:!0,isLoading:!1})}handleReconnect(){this.setState({isDisconnected:!1,error:null})}handleLoadError(e){le.isCanceled(e)||this.handleError(e)}modelInitialized(e){const{glEventHub:n,loadPlugin:t}=this.props;if(this.modelPromise=null,this.loadPanelState(e),this.setState({isModelReady:!0}),Nr(e)){const{table:i}=e,{pluginName:o}=i;if(o&&t&&o){const r=t(o);this.setState({Plugin:r})}n.emit(J.TABLE_CHANGED,this,i)}this.sendColumnsChange(e.columns)}handleClearAllFilters(){const e=this.irisGrid.current,{isDisconnected:n}=this.state;e!=null&&!n&&e.clearAllFilters()}sendColumnsChange(e){Je.debug2("sendColumnsChange",e);const{glEventHub:n}=this.props;n.emit(J.COLUMNS_CHANGED,this,e)}startModelListening(e){e.addEventListener(ze.EVENT.DISCONNECT,this.handleDisconnect),e.addEventListener(ze.EVENT.RECONNECT,this.handleReconnect),e.addEventListener(ze.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.addEventListener(ze.EVENT.TABLE_CHANGED,this.handleTableChanged)}stopModelListening(e){e.removeEventListener(ze.EVENT.DISCONNECT,this.handleDisconnect),e.removeEventListener(ze.EVENT.RECONNECT,this.handleReconnect),e.removeEventListener(ze.EVENT.COLUMNS_CHANGED,this.handleColumnsChanged),e.removeEventListener(ze.EVENT.TABLE_CHANGED,this.handleTableChanged)}getCoordinateForColumn(e){var I;const{model:n}=this.state;if(!n)return null;const t=this.irisGrid.current,{gridWrapper:i}=t||{},o=(I=i==null?void 0:i.getBoundingClientRect())!=null?I:null;if(o==null||o.width<=0||o.height<=0)return null;const{metrics:r}=t.state,{columnHeaderHeight:c,visibleColumnXs:d,visibleColumnWidths:h,right:m,columnHeaderMaxDepth:g}=r,f=t.getVisibleColumn(n.getColumnIndexByName(e)),E=d.get(f)||0,b=h.get(f)||0,y=Math.max(o.left,Math.min(f>m?o.right:o.left+E+b*.5,o.right)),C=o.top+c*g;return[y,C]}setFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setFilterMap(e)}setAdvancedFilterMap(e){const n=this.irisGrid.current;n!=null&&n.setAdvancedFilterMap(e)}setFilters({quickFilters:e,advancedFilters:n}){Je.debug("setFilters",e,n);const{model:t,isDisconnected:i}=this.state,o=this.irisGrid.current;if(o==null||i){Je.debug("Ignore setFilters, model disconnected");return}const{columns:r,formatter:c}=t,d=ge.changeFilterColumnNamesToIndexes(t.columns,e).filter(([m])=>t.isFilterable(m)),h=ge.changeFilterColumnNamesToIndexes(t.columns,n).filter(([m])=>t.isFilterable(m));o.clearAllFilters(),o.setFilters({quickFilters:ge.hydrateQuickFilters(r,d,c.timeZone),advancedFilters:ge.hydrateAdvancedFilters(r,h,c.timeZone)})}setStateOverrides(e){Je.debug("setStateOverrides",e);const{irisGridState:n,gridState:t}=e;this.setState({irisGridStateOverrides:n,gridStateOverrides:t},()=>{this.initModel()})}unsetFilterValue(){}loadPanelState(e){const{panelState:n,irisGridStateOverrides:t,gridStateOverrides:i}=this.state;if(n!=null)try{const{gridState:o,irisGridState:r,irisGridPanelState:c}=n,d={...t},{quickFilters:h,advancedFilters:m}=d;h&&(d.quickFilters=ge.changeFilterColumnNamesToIndexes(e.columns,h)),m&&(d.advancedFilters=ge.changeFilterColumnNamesToIndexes(e.columns,m));const{isSelectingPartition:g,partition:f,partitionColumn:E}=ge.hydrateIrisGridPanelState(e,c),{advancedFilters:b,advancedSettings:y,customColumns:C,customColumnFormatMap:I,isFilterBarShown:T,quickFilters:w,reverseType:_,rollupConfig:L,aggregationSettings:D,sorts:P,userColumnWidths:B,userRowHeights:H,showSearchBar:$,searchValue:W,selectDistinctColumns:Q,selectedSearchColumns:x,invertSearchColumns:N,pendingDataMap:R,frozenColumns:V,conditionalFormats:M}=ge.hydrateIrisGridState(e,{...r,...d}),{isStuckToBottom:q,isStuckToRight:j,movedColumns:ve,movedRows:Pe}=ge.hydrateGridState(e,{...o,...i},r.customColumns);this.setState({advancedFilters:b,advancedSettings:y,conditionalFormats:M,customColumns:C,customColumnFormatMap:I,isFilterBarShown:T,isSelectingPartition:g,movedColumns:ve,movedRows:Pe,partition:f,partitionColumn:E,quickFilters:w,reverseType:_,rollupConfig:L,aggregationSettings:D,sorts:P,userColumnWidths:B,userRowHeights:H,showSearchBar:$,searchValue:W,selectDistinctColumns:Q,selectedSearchColumns:x,invertSearchColumns:N,pendingDataMap:R,frozenColumns:V,isStuckToBottom:q,isStuckToRight:j})}catch(o){Je.error("loadPanelState failed to load panelState",n,o)}}savePanelState(){const{irisGridState:e,gridState:n,pluginState:t}=this,{onPanelStateUpdate:i}=this.props,{model:o,panelState:r,isSelectingPartition:c,partition:d,partitionColumn:h,advancedSettings:m}=this.state,{advancedFilters:g,aggregationSettings:f,customColumnFormatMap:E,isFilterBarShown:b,quickFilters:y,customColumns:C,reverseType:I,rollupConfig:T,showSearchBar:w,searchValue:_,selectDistinctColumns:L,selectedSearchColumns:D,sorts:P,invertSearchColumns:B,metrics:H,pendingDataMap:$,frozenColumns:W,conditionalFormats:Q}=e,{userColumnWidths:x,userRowHeights:N}=H,{isStuckToBottom:R,isStuckToRight:V,movedColumns:M,movedRows:q}=n,j=this.getCachedPanelState(this.getDehydratedIrisGridPanelState(o,c,d,h),this.getDehydratedIrisGridState(o,P,g,E,b,y,C,I,T,w,_,L,D,B,x,N,f,m,$,W,Q),this.getDehydratedGridState(o,M,q,R,V),t);j!==r&&(Je.debug("Saving panel state",this,j),this.setState({panelState:j}),i(j))}updateGrid(){var n,t;const e=(t=(n=this.irisGrid.current)==null?void 0:n.grid)!=null?t:null;!e||e.handleResize()}render(){var Ai,Oi,Ui;const{children:e,glContainer:n,glEventHub:t,columnSelectionValidator:i,getDownloadWorker:o,inputFilters:r,links:c,metadata:d,panelState:h,user:m,workspace:g,settings:f,theme:E}=this.props,{advancedFilters:b,aggregationSettings:y,advancedSettings:C,conditionalFormats:I,customColumns:T,customColumnFormatMap:w,error:_,isDisconnected:L,isFilterBarShown:D,isSelectingPartition:P,isStuckToBottom:B,isStuckToRight:H,isLoaded:$,isLoading:W,isModelReady:Q,model:x,movedColumns:N,movedRows:R,partition:V,partitionColumn:M,queryName:q,quickFilters:j,reverseType:ve,rollupConfig:Pe,sorts:We,userColumnWidths:vt,userRowHeights:A,showSearchBar:K,searchValue:ie,selectDistinctColumns:be,selectedSearchColumns:Be,invertSearchColumns:ja,Plugin:Ka,pluginFilters:Za,pluginFetchColumns:Ya,pendingDataMap:Xa,frozenColumns:Ja}=this.state,Qa=_?`Unable to open table. ${_}`:null,{table:bs,querySerial:er}=d,Mi=(Ai=x==null?void 0:x.description)!=null?Ai:null,tr=(Oi=h==null?void 0:h.pluginState)!=null?Oi:null,nr=e!=null?e:this.getPluginContent(Ka,x==null?void 0:x.table,m,g,tr),{permissions:sr}=m,{canCopy:ir,canDownloadCsv:or}=sr,ar=x==null?void 0:x.displayString((Ui=x==null?void 0:x.rowCount)!=null?Ui:0,"long");return a.createElement(In,{errorMessage:Qa,isDisconnected:L,isLoading:W,isLoaded:$,className:"iris-grid-panel",glContainer:n,glEventHub:t,onClearAllFilters:this.handleClearAllFilters,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleShow,onTabClicked:this.handleTabClicked,queryName:q,querySerial:er,widgetName:bs,widgetType:"Table",description:Mi,componentPanel:this,renderTabTooltip:()=>a.createElement(ps,{widgetType:"Table",widgetName:bs,glContainer:n,description:Mi},a.createElement("div",{className:"column-statistics-grid"},a.createElement("span",{className:"column-statistic-operation"},"Number of Rows"),a.createElement("span",{className:"column-statistic-value"},ar)))},Q&&a.createElement(Xs,{advancedFilters:b,aggregationSettings:y,advancedSettings:C,alwaysFetchColumns:this.getAlwaysFetchColumns(c,Ya),columnAllowedCursor:"linker",columnNotAllowedCursor:"not-allowed",customColumns:T,customColumnFormatMap:w,columnSelectionValidator:this.isColumnSelectionValid,conditionalFormats:I,inputFilters:this.getGridInputFilters(x.columns,r),applyInputFiltersOnInit:h==null,isFilterBarShown:D,isSelectingColumn:i!=null,isSelectingPartition:P,isStuckToBottom:B,isStuckToRight:H,movedColumns:N,movedRows:R,partition:V,partitionColumn:M,quickFilters:j,reverseType:ve,rollupConfig:Pe,settings:f,sorts:We,userColumnWidths:vt,userRowHeights:A,model:x,tableName:bs,showSearchBar:K,searchValue:ie,selectedSearchColumns:Be,selectDistinctColumns:be,invertSearchColumns:ja,onColumnSelected:this.handleColumnSelected,onCreateChart:this.handleCreateChart,onDataSelected:this.handleDataSelected,onError:this.handleError,onPartitionAppend:this.handlePartitionAppend,onStateChange:this.handleGridStateChange,onContextMenu:this.handleContextMenu,onAdvancedSettingsChange:this.handleAdvancedSettingsChange,customFilters:Za,pendingDataMap:Xa,canCopy:ir,canDownloadCsv:or,ref:this.irisGrid,getDownloadWorker:o,frozenColumns:Ja,theme:E},nr),!Q&&a.createElement(a.Fragment,null))}}v(Dn,"COMPONENT","IrisGridPanel");Dn.propTypes={children:u.exports.node,glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,metadata:u.exports.shape({table:u.exports.string.isRequired,query:u.exports.string,querySerial:u.exports.string}).isRequired,panelState:u.exports.shape({gridState:u.exports.shape({}),irisGridState:u.exports.shape({aggregationSettings:u.exports.shape({}),customColumns:u.exports.arrayOf(u.exports.string),conditionalFormats:u.exports.arrayOf(u.exports.shape({})),selectDistinctColumns:u.exports.arrayOf(u.exports.string),rollupConfig:u.exports.shape({columns:u.exports.arrayOf(u.exports.string).isRequired}),pendingDataMap:u.exports.arrayOf(u.exports.array),frozenColumns:u.exports.arrayOf(u.exports.string)}),irisGridPanelState:u.exports.shape({}),pluginState:u.exports.shape({})}),makeModel:u.exports.func.isRequired,inputFilters:u.exports.arrayOf(ct.InputFilter).isRequired,links:ct.Links.isRequired,columnSelectionValidator:u.exports.func,onStateChange:u.exports.func,onPanelStateUpdate:u.exports.func,user:ct.User.isRequired,workspace:u.exports.shape({}).isRequired,settings:u.exports.shape({timeZone:u.exports.string.isRequired}).isRequired,getDownloadWorker:u.exports.func,loadPlugin:u.exports.func,theme:u.exports.shape({})};Dn.defaultProps={children:null,panelState:null,columnSelectionValidator:null,onStateChange:()=>{},onPanelStateUpdate:()=>{},getDownloadWorker:void 0,loadPlugin:void 0,theme:void 0};Dn.displayName="IrisGridPanel";const mh=(l,s)=>{const{localDashboardId:e}=s;return{inputFilters:ui(l,e),links:nn(l,e),columnSelectionValidator:gi(l,e),user:na(l),workspace:_n(l),settings:Fe(l)}},dt=we(mh,null,null,{forwardRef:!0})(Dn);const co=O.module("InputFilter"),ph=150,is=class extends p.exports.Component{constructor(e){super(e);v(this,"getItemLabel",Ze((e,n)=>{const{name:t,type:i}=e[n];if(n>0&&e[n-1].name===t||n<e.length-1&&e[n+1].name===t){const o=i.substring(i.lastIndexOf(".")+1);return`${t} (${o})`}return t}));this.handleColumnChange=this.handleColumnChange.bind(this),this.handleInputKeyPress=this.handleInputKeyPress.bind(this),this.handleValueChange=this.handleValueChange.bind(this),this.handleSettingsCancel=this.handleSettingsCancel.bind(this),this.handleSettingsClick=this.handleSettingsClick.bind(this),this.handleSettingsSave=this.handleSettingsSave.bind(this),this.handleBackgroundClick=this.handleBackgroundClick.bind(this),this.sendUpdate=Ye(this.sendUpdate.bind(this),ph),this.inputRef=a.createRef();const{column:n,isValueShown:t,value:i}=e;this.state={column:n,selectedColumn:n,value:i,isValueShown:t}}componentDidUpdate(e,n){const{column:t}=this.props,{column:i,value:o,isValueShown:r}=this.state;t!==e.column&&this.setState({column:t,selectedColumn:t}),r&&r!==n.isValueShown&&this.focusInput(),(i!==n.column||o!==n.value||r!==n.isValueShown)&&this.sendUpdate()}componentWillUnmount(){this.sendUpdate.flush()}handleColumnChange(e){const{columns:n}=this.props,{value:t}=e.target,i=n[t];co.debug2("handleColumnChange",i),this.setState({selectedColumn:i,value:null})}handleInputKeyPress(e){e.key==="Enter"&&(e.preventDefault(),e.stopPropagation(),this.setState(({value:n})=>n==null?{value:""}:null,()=>{this.sendUpdate(),this.sendUpdate.flush()}))}handleValueChange(e){const{value:n}=e.target;co.debug2("handleValueChange",n),this.setState({value:n})}handleSettingsCancel(){const{column:e}=this.state;this.setState({selectedColumn:e,isValueShown:!0})}handleSettingsSave(){const{selectedColumn:e}=this.state;this.setState({column:e,isValueShown:!0})}handleSettingsClick(e){const{column:n}=this.state;this.setState({selectedColumn:n,isValueShown:!1}),e.stopPropagation()}handleBackgroundClick(e){e.target!==this.inputRef.current&&this.focusInput()}focusInput(){this.inputRef.current!==null&&(this.inputRef.current.select(),this.inputRef.current.focus())}clearFilter(){this.setState({value:""})}setFilterState({name:e,type:n,value:t,isValueShown:i}){const o=e!=null&&n!=null?{name:e,type:n}:null,r=i===void 0?{column:o,value:t}:{column:o,value:t,isValueShown:i};this.setState(r)}sendUpdate(){const{onChange:e}=this.props,{column:n,value:t,isValueShown:i}=this.state;e({column:n,isValueShown:i,value:t})}render(){const{columns:e}=this.props,{column:n,isValueShown:t,selectedColumn:i,value:o}=this.state,r=o==null||o.length===0?is.PLACEHOLDER.length:o.length;let c=null;if(n!=null){const d=e.findIndex(h=>h.name===n.name&&h.type===n.type);c=d>=0?this.getItemLabel(e,d):n.name}return a.createElement(oi,{className:"input-filter fill-parent-absolute",isFlipped:t},a.createElement("div",{className:"input-filter-settings-card"},a.createElement("div",{className:"input-filter-settings-content"},a.createElement("div",{className:"input-filter-settings-grid"},a.createElement("label",null,"Filter Column"),a.createElement("select",{value:e.findIndex(d=>d.name===(i==null?void 0:i.name)&&d.type===(i==null?void 0:i.type)),className:"custom-select",onChange:this.handleColumnChange},e.map((d,h)=>a.createElement("option",{key:`${d.name}/${d.type}`,value:h},this.getItemLabel(e,h))),e.length===0&&a.createElement("option",{value:"-1",disabled:!0},"No Available Columns")),a.createElement("div",{className:"text-muted small"},"Input filter control will apply its filter to all columns matching this name in this dashboard.")),a.createElement("div",{className:"input-filter-settings-buttons"},a.createElement("button",{type:"button",className:"btn btn-outline-primary",onClick:this.handleSettingsCancel,disabled:n==null},"Cancel"),a.createElement("button",{type:"button",className:"btn btn-primary ml-2",onClick:this.handleSettingsSave,disabled:i==null},"Save")))),a.createElement("div",{className:"input-filter-value-card",onClick:this.handleBackgroundClick},a.createElement("div",{className:"input-filter-column"},a.createElement("div",{className:"input-filter-column-title"},c," Filter")),a.createElement("div",{className:"d-flex justify-content-center align-items-center h-100 w-100"},a.createElement("div",{className:"input-filter-value-input d-flex flex-column justify-content-center"},a.createElement("input",{type:"text",ref:this.inputRef,placeholder:is.PLACEHOLDER,value:o!=null?o:"",onChange:this.handleValueChange,onKeyPress:this.handleInputKeyPress,style:{width:`${r+3}ch`},spellCheck:"false"}))),a.createElement("div",{className:"input-filter-menu"},a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon m-2 px-2",onClick:this.handleSettingsClick},a.createElement(G,{icon:rs,transform:"grow-4"})))))}};let qt=is;v(qt,"PLACEHOLDER","Enter value...");qt.propTypes={columns:u.exports.arrayOf(yt.Column).isRequired,column:yt.Column,isValueShown:u.exports.bool,value:u.exports.string,onChange:u.exports.func.isRequired};qt.defaultProps={column:null,isValueShown:!1,value:null};const gh=250;class Nn extends p.exports.Component{constructor(s){super(s),this.handleChange=Ye(this.handleChange.bind(this),gh),this.handleClearAllFilters=this.handleClearAllFilters.bind(this),this.inputFilterRef=a.createRef();const{panelState:e}=s,{value:n=null,isValueShown:t=!1,name:i,type:o,timestamp:r=null}=e!=null?e:{};this.state={columns:[],column:i&&o?{name:i,type:o}:null,value:n,timestamp:r,isValueShown:t,wasFlipped:!1,skipUpdate:!1,panelState:e}}componentDidMount(){this.updateColumns();const{column:s,value:e,timestamp:n}=this.state;if(s!=null){const{name:t,type:i}=s;this.sendUpdate(t,i,e,n)}}componentDidUpdate(s){const{columns:e}=this.props;e!==s.columns&&this.updateColumns()}handleChange({column:s,isValueShown:e,value:n}){const{name:t,type:i}=s;let o=!0,r=Date.now();this.setState(({panelState:c,timestamp:d,wasFlipped:h,skipUpdate:m})=>{const g=c!=null&&e!==c.isValueShown&&t===c.name&&i===c.type&&n===c.value;return o=!m&&e&&(!g||!h),o||(r=d),{panelState:{isValueShown:e,name:t,type:i,value:n,timestamp:r},timestamp:r,wasFlipped:g,skipUpdate:!1}},()=>{o&&this.sendUpdate(t,i,n,r)})}handleClearAllFilters(){this.inputFilterRef.current.clearFilter()}sendUpdate(s,e,n,t){const{glEventHub:i}=this.props;i.emit(J.FILTERS_CHANGED,this,{name:s,type:e,value:n,timestamp:t})}setPanelState(s,e=!1){var n;this.setState({skipUpdate:!e}),(n=this.inputFilterRef.current)==null||n.setFilterState(s)}updateColumns(){const{columns:s}=this.props;s!=null&&this.setState(e=>{const{column:n}=e;return n==null&&s.length>0?{columns:[...s],column:s[0]}:n!=null&&!s.find(({name:t,type:i})=>n.name===t&&n.type===i)?{columns:[...s,n]}:{columns:[...s]}})}render(){const{glContainer:s,glEventHub:e}=this.props,{column:n,columns:t,isValueShown:i,value:o}=this.state;return a.createElement(Xe,{className:"iris-input-filter-panel",componentPanel:this,glContainer:s,glEventHub:e,onClearAllFilters:this.handleClearAllFilters,isClonable:!0,isRenamable:!0},a.createElement(qt,{ref:this.inputFilterRef,column:n,columns:t,onChange:this.handleChange,isValueShown:i,value:o}))}}v(Nn,"COMPONENT","InputFilterPanel");Nn.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,panelState:u.exports.shape({name:u.exports.string,type:u.exports.string,value:u.exports.string,isValueShown:u.exports.bool}),columns:u.exports.arrayOf(u.exports.shape({})).isRequired};Nn.defaultProps={panelState:null};Nn.displayName="InputFilterPanel";const fh=(l,s)=>{const{localDashboardId:e}=s;return{columns:_a(l,e)}},pn=we(fh,null,null,{forwardRef:!0})(Nn);const ke=O.module("FilterSetManagerPanel"),os=class extends p.exports.Component{static changeFilterIndexesToColumnNames(s,e){return e.map(([n,t])=>{if(n>=s.columns.length)return null;const{name:i}=s.columns[n];return{name:i,filter:t}}).filter(n=>n!=null)}constructor(s){super(s),this.handleChange=this.handleChange.bind(this),this.handleFilterApply=this.handleFilterApply.bind(this),this.handleSetsUpdate=this.handleSetsUpdate.bind(this),this.handleGetFilterState=this.handleGetFilterState.bind(this);const{panelState:e,filterSets:n}=s,{selectedId:t=n.length>0?n[0].id:void 0,isValueShown:i=!1}=e!=null?e:{};this.state={selectedId:t,isValueShown:i,panelState:e}}getFilterState(){const{dashboardOpenedPanelMap:s}=this.props,e=[];return[...s.keys()].forEach(n=>{const t=s.get(n),i=F.getComponentNameFromPanel(t),o=F.getIdFromPanel(t);ke.debug("Panel:",t,i);const{glContainer:r=null}=t.props;if(r==null){ke.error("Could not get panel container",t);return}const c=F.getComponentConfigFromContainer(r);if(c==null){ke.error("Could not get component config from container",r);return}const d=F.getPanelComponentState(c);if(d==null){ke.debug(`Panel state is null ${o}`);return}switch(i){case F.getComponentName(dt):{const h=this.getIrisGridPanelFilters(o,d);h!=null&&e.push({panelId:o,type:i,state:h});break}case F.getComponentName(pn):case F.getComponentName(Rt):{const{isValueShown:h,name:m,type:g,value:f}=d;e.push({panelId:o,type:i,state:{isValueShown:h,name:m,type:g,value:f}});break}}}),e}getIrisGridPanelFilters(s,e){const{panelTableMap:n}=this.props,t=n.get(s);if(t==null)return ke.error(`Unable to get table for panel ${s}.`),null;const{irisGridState:i={},gridState:o={}}=e,{advancedFilters:r,quickFilters:c}=i,d=os.changeFilterIndexesToColumnNames(t,r),h=os.changeFilterIndexesToColumnNames(t,c);return{irisGridState:{...i,advancedFilters:d,quickFilters:h},gridState:{...o}}}handleGetFilterState(){return this.getFilterState()}handleChange({isValueShown:s,selectedId:e}){ke.debug("handleChange",s,e),this.setState({isValueShown:s,selectedId:e}),this.updatePanelState()}handleFilterApply(s){const{dashboardOpenedPanelMap:e}=this.props,{panels:n,restoreFullState:t=!1}=s;ke.debug("Apply filters from filter set",s),n.forEach(({panelId:i,type:o,state:r})=>{if(!e.has(i)){ke.debug("Ignore closed panel",i);return}ke.debug("Apply panel filters",i,o,r);const c=e.get(i);switch(o){case F.getComponentName(dt):this.restoreIrisGridFilters(c,r,t);break;case F.getComponentName(pn):case F.getComponentName(Rt):this.restoreInputFilterState(c,r);break}})}handleSetsUpdate(s){const{setDashboardFilterSets:e,localDashboardId:n}=this.props;ke.debug("Saving updated sets",s),e(n,[...s])}updatePanelState(){this.setState(({selectedId:s,isValueShown:e})=>({panelState:{selectedId:s,isValueShown:e}}))}restoreIrisGridFilters(s,e,n){const{irisGridState:t={},advancedFilters:i=[],quickFilters:o=[]}=e,{advancedFilters:r=i,quickFilters:c=o}=t,{panelTableMap:d}=this.props,h=F.getIdFromPanel(s);if(d.get(h)==null){ke.error(`Unable to get table for panel ${h}.`);return}ke.debug("restoreIrisGridFilters",h,e,n),n?s.setStateOverrides(e):s.setFilters({quickFilters:c,advancedFilters:r})}restoreInputFilterState(s,e){const n={...e};delete n.isValueShown,ke.debug("restoreInputFilterState",s,n),s.setPanelState(n)}render(){const{glContainer:s,glEventHub:e,filterSets:n}=this.props,{isValueShown:t,selectedId:i}=this.state;return a.createElement(Xe,{className:"filter-set-manager-panel",componentPanel:this,glContainer:s,glEventHub:e,isClonable:!0,isRenamable:!0},a.createElement("div",{className:"input-filter-container h-100 w-100 container"},a.createElement(es,{onChange:this.handleChange,onApply:this.handleFilterApply,onUpdateSets:this.handleSetsUpdate,isValueShown:t,filterSets:n,selectedId:i,getFilterState:this.handleGetFilterState})))}};let jt=os;v(jt,"COMPONENT","FilterSetManagerPanel");jt.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,panelState:u.exports.shape({name:u.exports.string,type:u.exports.string,selectedId:u.exports.string,isValueShown:u.exports.bool}),filterSets:u.exports.arrayOf(u.exports.shape({id:u.exports.string.isRequired,title:u.exports.string.isRequired,panels:u.exports.arrayOf(u.exports.shape({})).isRequired})).isRequired,localDashboardId:u.exports.string.isRequired,dashboardOpenedPanelMap:u.exports.instanceOf(Map).isRequired,setDashboardFilterSets:u.exports.func.isRequired,panelTableMap:u.exports.instanceOf(Map).isRequired};jt.defaultProps={panelState:null};const Eh=(l,s)=>{const{localDashboardId:e}=s;return{filterSets:Ud(l,e),dashboardOpenedPanelMap:Sa(l,e),dashboardInputFilters:ui(l,e),panelTableMap:mi(l,e)}},vs=we(Eh,{setDashboardFilterSets:Gd},null,{forwardRef:!0})(jt);const ho=O.module("LogPanel");class wn extends p.exports.PureComponent{constructor(s){super(s),this.handleResize=this.handleResize.bind(this),this.handleShow=this.handleShow.bind(this),this.handleHide=this.handleHide.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.isBottomVisible=!0,this.logView=null;const{session:e}=this.props;this.state={session:e}}handleResize(){this.updateDimensions()}handleShow(){this.updateDimensions(),this.logView&&(this.logView.triggerFindWidget(),this.isBottomVisible&&this.logView.scrollToBottom())}handleHide(){this.logView&&(this.isBottomVisible=this.logView.isBottomVisible())}handleSessionOpened(s){ho.debug("Session opened",[s]),this.setState({session:s})}handleSessionClosed(s){ho.debug("Session closed",s)}updateDimensions(){this.logView&&this.logView.updateDimensions()}render(){const{glContainer:s,glEventHub:e}=this.props,{session:n}=this.state;return a.createElement(Xe,{componentPanel:this,glContainer:s,glEventHub:e,onResize:this.handleResize,onHide:this.handleHide,onShow:this.handleShow,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed},!n&&a.createElement("div",{className:"log-panel-disconnected-message"},"Waiting for session connection"),n&&a.createElement(Fr,{session:n,ref:t=>{this.logView=t}}))}}v(wn,"COMPONENT","LogPanel"),v(wn,"TITLE","Log");wn.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,session:yt.IdeSession};wn.defaultProps={session:null};const bh=(l,s)=>{var e;return{session:(e=kt(l,s.localDashboardId))==null?void 0:e.session}},ts=we(bh,null,null,{forwardRef:!0})(wn);class wi extends p.exports.PureComponent{render(){const{isEditing:s,children:e,onDoubleClick:n}=this.props;return a.createElement("div",{className:"markdown-editor-container h-100 w-100",onDoubleClick:n},a.createElement("div",{className:z("text-muted","edit-hint",{viewing:!s})},a.createElement("span",null,"double-click to edit ",a.createElement(G,{icon:Vo}))),e)}}wi.propTypes={onDoubleClick:u.exports.func.isRequired,children:u.exports.node.isRequired,isEditing:u.exports.bool};wi.defaultProps={isEditing:!1};const Ch=O.module("MarkdownStartPage");class vi extends p.exports.PureComponent{constructor(s){super(s),this.handleDeleteButtonClick=this.handleDeleteButtonClick.bind(this),this.handleDeleteModalClose=this.handleDeleteModalClose.bind(this),this.state={isDeleteModalShown:!1,toBeDeleted:null}}handleDeleteButtonClick(s){this.setState({isDeleteModalShown:!0,toBeDeleted:s})}handleDeleteModalClose(){this.setState({isDeleteModalShown:!1,toBeDeleted:null})}handleDeleteMarkdown(s){Ch.debug("delete markdown: ",s);const{onDelete:e}=this.props;e(s),this.setState({isDeleteModalShown:!1,toBeDeleted:null})}render(){const{closedMarkdowns:s,onOpen:e,onCreate:n}=this.props,{isDeleteModalShown:t,toBeDeleted:i}=this.state;return a.createElement("div",{className:"markdown-panel-start-page h-100 w-100"},a.createElement("div",{className:"markdown-panel-start-page-container"},a.createElement("div",{className:"markdown-panel-start-list"},a.createElement("h3",{className:"list-title"},"Start"),a.createElement("div",{className:"list-item"},a.createElement("button",{className:"btn btn-link title",type:"button",onClick:n},"New Markdown Note"))),a.createElement("div",{className:"markdown-panel-start-list"},a.createElement("h3",{className:"list-title"},"Recently Closed from Dashboard"),s.map(o=>a.createElement("div",{className:"list-item",key:o.id},a.createElement("button",{className:"btn btn-link title",type:"button",onClick:()=>e(o)},o.title),a.createElement("button",{className:"btn-link icon",type:"button",onClick:()=>{this.handleDeleteButtonClick(o)}},a.createElement(G,{icon:Ys})))),a.createElement(js,{isOpen:t,toggle:this.handleDeleteModalClose,className:"modal-dialog-centered markdown-delete-modal theme-bg-light"},a.createElement(Ks,null,"Are you sure you want to permanently delete this note?"),a.createElement(Zs,null,"You can't undo this action."),a.createElement(Ao,null,a.createElement("button",{className:"btn btn-outline-primary",onClick:this.handleDeleteModalClose,type:"button"},"Cancel"),a.createElement("button",{className:"btn btn-danger",onClick:()=>{this.handleDeleteMarkdown(i)},type:"button"},"Delete"))))))}}vi.propTypes={closedMarkdowns:u.exports.arrayOf(u.exports.shape({title:u.exports.string,content:u.exports.string})),onOpen:u.exports.func,onCreate:u.exports.func,onDelete:u.exports.func};vi.defaultProps={closedMarkdowns:[],onOpen:()=>{},onCreate:()=>{},onDelete:()=>{}};class Ti extends p.exports.PureComponent{constructor(e){super(e);v(this,"renderMarkdown",e=>{const{children:n,className:t}=e,i=t!=null&&t.startsWith("language-")?t.substring(9):"plaintext";return a.createElement("pre",null,a.createElement("code",null,a.createElement($o,{language:i},a.Children.map(n,o=>typeof o=="string"?o.trim():o))))});this.container=null}render(){const{isEditing:e,content:n,onEditorInitialized:t}=this.props;return a.createElement("div",{className:"markdown-editor-container",ref:i=>{this.container=i}},e?a.createElement(ks,{settings:{language:"markdown",value:n,lineNumbers:"off"},onEditorInitialized:t}):a.createElement(Xo,{components:{code:this.renderMarkdown}},n))}}Ti.propTypes={isEditing:u.exports.bool,content:u.exports.string,onEditorInitialized:u.exports.func.isRequired};Ti.defaultProps={isEditing:!1,content:""};const An=O.module("MarkdownPanel");class Es extends p.exports.Component{constructor(e){super(e);v(this,"getClosedMarkdowns",te(e=>e.filter(n=>n.component==="MarkdownPanel").reverse()));this.handleContainerDoubleClick=this.handleContainerDoubleClick.bind(this),this.handleCreateMarkdown=this.handleCreateMarkdown.bind(this),this.handleDeleteMarkdown=this.handleDeleteMarkdown.bind(this),this.handleOpenMarkdown=this.handleOpenMarkdown.bind(this),this.handleEditorInitialized=this.handleEditorInitialized.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleEditorResize=this.handleEditorResize.bind(this);const{panelState:n}=e;let t=null;n&&n.content&&({content:t}=n),this.state={isStartPageShown:t==null,isEditing:!1,content:t,panelState:n},this.markdownEditor=null,this.editor=null}setEditorPosition(e){const{container:n}=this.markdownEditor;if(this.editor&&n){const t=n.getBoundingClientRect().top,i=n.scrollTop,o=n.scrollHeight,r=this.editor.getModel().getLineCount();let c=Math.round((i+e-t)/o*r);c>r&&(c=r),this.editor.revealLine(c),this.editor.setPosition({lineNumber:c,column:1}),this.editor.focus()}}handleContainerDoubleClick(e){const{isEditing:n}=this.state,t=e.clientY;n||this.setState({isEditing:!0},()=>{this.setEditorPosition(t)})}handleEditorInitialized(e){An.debug("Markdown Editor Initialized..."),this.editor=e}handleCreateMarkdown(){An.debug("create markdown..."),this.setState({isStartPageShown:!1,content:"",isEditing:!0,panelState:{content:""}},()=>{this.editor&&this.editor.focus&&this.editor.focus()})}handleOpenMarkdown(e){An.debug("open markdown...",e);const{glContainer:n,glEventHub:t}=this.props,i=F.getComponentConfigFromContainer(n);t.emit(Y.REOPEN,e,i)}handleDeleteMarkdown(e){const{glEventHub:n}=this.props;n.emit(Y.DELETE,e)}handleEditorBlur(e){var i,o;An.debug("markdown content changed, saving...");const{isEditing:n}=this.state;if(!n||((o=(i=this.markdownEditor)==null?void 0:i.container)==null?void 0:o.contains(e.relatedTarget)))return;const t=this.editor.getValue();this.setState({content:t,isEditing:!1,panelState:{content:t}})}handleEditorResize(){const{isEditing:e}=this.state;e&&this.editor&&this.editor.layout()}render(){const{glContainer:e,glEventHub:n,closedPanels:t}=this.props,{isEditing:i,isStartPageShown:o,content:r}=this.state,c=this.getClosedMarkdowns(t);return a.createElement(Xe,{glContainer:e,glEventHub:n,className:"markdown-panel",componentPanel:this,onResize:this.handleEditorResize,onBlur:this.handleEditorBlur,isClonable:!0,isRenamable:!0},o?a.createElement(vi,{closedMarkdowns:c,onCreate:this.handleCreateMarkdown,onOpen:this.handleOpenMarkdown,onDelete:this.handleDeleteMarkdown}):a.createElement(wi,{isEditing:i,onDoubleClick:this.handleContainerDoubleClick},a.createElement(Ti,{ref:d=>{this.markdownEditor=d},isEditing:i,content:r,onEditorInitialized:this.handleEditorInitialized})))}}v(Es,"COMPONENT","MarkdownPanel");Es.propTypes={glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,panelState:u.exports.shape({content:u.exports.string}),closedPanels:u.exports.arrayOf(u.exports.object).isRequired};Es.defaultProps={panelState:null};const Sh=(l,s)=>{const{localDashboardId:e}=s;return{closedPanels:rd(l,e)}},an=we(Sh,null,null,{forwardRef:!0})(Es);class _i extends p.exports.PureComponent{constructor(s){super(s),this.handleRunSelected=this.handleRunSelected.bind(this),this.renderCodeBlock=this.renderCodeBlock.bind(this),this.renderLink=this.renderLink.bind(this),this.commands=new Map,this.codeElements=new Map,this.editorScrollView=a.createRef(),this.state={hasCode:!1,hasRunCode:!1,nextStartLine:null}}componentDidMount(){this.updateHasCode()}componentDidUpdate(){this.updateHasCode()}updateHasCode(){const{hasCode:s}=this.state;this.commands.size===0&&s?this.setState({hasCode:!1}):this.commands.size>0&&!s&&this.setState({hasCode:!0})}getNextStartLine(s){const e=[...this.commands.keys()],n=e.findIndex(t=>t===s)+1;return n>=e.length?null:e[n]}handleRunSelected(s){var h,m;s.preventDefault(),s.stopPropagation();const{nextStartLine:e}=this.state,n=[...this.commands.keys()],t=n.findIndex(g=>g===e||e==null);if(t<0)return;const i=n[t],o=this.commands.get(i),r=this.getNextStartLine(i),c=(h=this.codeElements.get(i))==null?void 0:h.current,d=(m=c==null?void 0:c.parentElement)==null?void 0:m.nextElementSibling;if(d){const{offsetTop:g}=d,f=g;this.editorScrollView.current.scroll({top:f,left:0})}this.runCode(o),this.setState({nextStartLine:r})}runCode(s){const{onRunCode:e}=this.props;e(s),this.setState({hasRunCode:!0})}renderCodeBlock(s){const{children:e,className:n,inline:t,node:i}=s,{hasRunCode:o,nextStartLine:r}=this.state,{children:c,position:d}=i,{start:h}=d,{line:m}=h,g=c[0].value,f=a.createRef(),E=this.commands.size===0,b=r===m||E&&r==null&&!o,y=n!=null&&n.startsWith("language-")?n.substring(9):"plaintext";return t?a.createElement("code",{className:n},e):(this.commands.set(m,g),this.codeElements.set(m,f),a.createElement("div",{className:z("markdown-notebook-code-block",{"is-selected":b}),ref:f,onClick:()=>{this.setState({nextStartLine:m})},role:"presentation"},a.createElement(X,{kind:"ghost",icon:Ms,className:"btn-play-block",onClick:C=>{C.stopPropagation(),C.preventDefault(),this.runCode(g),this.setState({nextStartLine:m})},tooltip:"Run code"}),a.createElement("code",null,a.createElement($o,{language:y},a.Children.map(e,C=>typeof C=="string"?C.trim():C)))))}renderLink(s){const{onLinkClick:e}=this.props,{href:n,children:t,target:i}=s;return a.createElement("a",{href:n,onClick:e,target:i},t)}render(){const{content:s,transformImageUri:e,transformLinkUri:n}=this.props,{hasCode:t,hasRunCode:i,nextStartLine:o}=this.state;return a.createElement("div",{className:"markdown-notebook"},a.createElement("div",{className:"markdown-notebook-toolbar"},a.createElement(X,{className:z("btn-play-selected-cell",{flashing:t&&!i}),kind:"ghost",icon:Ms,onClick:this.handleRunSelected,tooltip:"Run code and select next",disabled:i&&o==null||!t},"Run Selected Code")),a.createElement("div",{className:"markdown-notebook-content",ref:this.editorScrollView},a.createElement(Xo,{components:{code:this.renderCodeBlock,a:this.renderLink},linkTarget:"_blank",remarkPlugins:[Sl],transformLinkUri:n,transformImageUri:e,includeElementIndex:!0},s)))}}_i.propTypes={onRunCode:u.exports.func,content:u.exports.string,onLinkClick:u.exports.func,transformImageUri:u.exports.func,transformLinkUri:u.exports.func};_i.defaultProps={content:"",onLinkClick:void 0,onRunCode:()=>{},transformImageUri:void 0,transformLinkUri:void 0};const ne=O.module("NotebookPanel"),uo=400,Lt=class extends p.exports.Component{constructor(e){super(e);v(this,"getOverflowActions",te(()=>[{title:"Find",icon:kr,action:this.handleFind,group:re.groups.high,shortcut:Hn.NOTEBOOK.FIND,order:10}]));this.handleBlur=this.handleBlur.bind(this),this.handleCloseCancel=this.handleCloseCancel.bind(this),this.handleCloseDiscard=this.handleCloseDiscard.bind(this),this.handleCloseSave=this.handleCloseSave.bind(this),this.handleCopy=this.handleCopy.bind(this),this.handleEditorChange=this.handleEditorChange.bind(this),this.handleFind=this.handleFind.bind(this),this.handleFocus=this.handleFocus.bind(this),this.handleLinkClick=this.handleLinkClick.bind(this),this.handleLoadSuccess=this.handleLoadSuccess.bind(this),this.handleLoadError=this.handleLoadError.bind(this),this.handlePanelTabClick=this.handlePanelTabClick.bind(this),this.handleRenameFile=this.handleRenameFile.bind(this),this.handleResize=this.handleResize.bind(this),this.handleRunCommand=this.handleRunCommand.bind(this),this.handleRunAll=this.handleRunAll.bind(this),this.handleRunSelected=this.handleRunSelected.bind(this),this.handleSave=this.handleSave.bind(this),this.handleSaveAsCancel=this.handleSaveAsCancel.bind(this),this.handleSaveAsSubmit=this.handleSaveAsSubmit.bind(this),this.handleSaveError=this.handleSaveError.bind(this),this.handleSaveSuccess=this.handleSaveSuccess.bind(this),this.handleSessionOpened=this.handleSessionOpened.bind(this),this.handleSessionClosed=this.handleSessionClosed.bind(this),this.handleShow=this.handleShow.bind(this),this.handleShowRename=this.handleShowRename.bind(this),this.handleTab=this.handleTab.bind(this),this.handleTabFocus=this.handleTabFocus.bind(this),this.handleTabBlur=this.handleTabBlur.bind(this),this.handleTransformLinkUri=this.handleTransformLinkUri.bind(this),this.pending=new vn,this.debouncedSavePanelState=Ye(this.savePanelState.bind(this),uo),this.debouncedLoad=Ye(this.load.bind(this),uo),this.notebook=null,this.tabTitleElement=null,this.unsavedIndicator=null,this.tabInitOnce=!1,this.shouldPromptClose=!0;const{isDashboardActive:n,session:t,sessionLanguage:i,panelState:o}=e;let r={value:""},c=null,{isPreview:d}=e;o&&({fileMetadata:c=c,isPreview:d=d,settings:r=r}=o);const h=c.itemName&&U.hasPath(c.itemName),g=h&&r.value!=null||!h&&r.value?1:0;this.state={error:null,isDashboardActive:n,isFocused:!1,isLoading:!0,isLoaded:!1,isPreview:d,savedChangeCount:0,changeCount:g,fileMetadata:c,settings:r,session:t,sessionLanguage:i,panelState:{fileMetadata:c,settings:r},showCloseModal:!1,showSaveAsModal:!1,scriptCode:""},ne.debug("constructor",e,this.state)}static handleError(e){le.isCanceled(e)||ne.error(e)}static languageFromFileName(e){switch(U.getExtension(e).toLowerCase()){case"py":case"python":return"python";case"groovy":return"groovy";case"scala":return"scala";default:return null}}componentDidMount(){const{glContainer:e,glEventHub:n}=this.props,{tab:t}=e;t&&this.initTab(t),this.initNotebookContent(),n.on(ee.RENAME_FILE,this.handleRenameFile),e.on("tabClicked",this.handlePanelTabClick)}componentDidUpdate(e,n){const{isPreview:t}=this.state;t!==n.isPreview&&this.setPreviewStatus(t)}componentWillUnmount(){this.debouncedSavePanelState.flush(),this.pending.cancel();const{glContainer:e,glEventHub:n}=this.props,{fileMetadata:t,isPreview:i}=this.state;n.off(ee.RENAME_FILE,this.handleRenameFile),e.off("tabClicked",this.handlePanelTabClick),n.emit(ee.UNREGISTER_FILE,t,i)}initTab(e){this.tabInitOnce||(this.tabInitOnce=!0,this.initTabCloseOverride()),this.initTabClasses(e)}initTabCloseOverride(){const{glContainer:e}=this.props,n=e.close.bind(e);e.close=()=>{const{changeCount:t,savedChangeCount:i}=this.state;t!==i&&this.shouldPromptClose?this.setState({showCloseModal:!0}):n()}}initTabClasses(e){const t=e.element.get(0).querySelector(".lm_title");this.tabTitleElement=t,t.classList.add("notebook-title"),this.setPreviewStatus()}getNotebookValue(){const{changeCount:e,savedChangeCount:n,settings:t}=this.state,{value:i}=t;if(e!==n&&this.notebook){const o=this.notebook.getValue();return o!=null?o:i}return i}initNotebookContent(){const{fileMetadata:e,settings:n,isPreview:t}=this.state;if(e&&e.id){ne.debug("Init content from file"),this.registerFileMetadata(e,t),this.load();return}if(n.value!=null){ne.debug("Use content passed in the settings prop"),this.handleLoadSuccess();return}this.handleLoadError(new Error("Missing file metadata"))}closeFileTabById(e){const{glEventHub:n}=this.props;n.emit(ee.CLOSE_FILE,{id:e})}registerFileMetadata(e,n){const{glEventHub:t,metadata:i}=this.props,{id:o}=i;t.emit(ee.REGISTER_FILE,o,e,n)}renameTab(e,n){const{glEventHub:t}=this.props;t.emit(ee.RENAME,e,n)}load(){const{fileMetadata:e,settings:n}=this.state,{id:t}=e,{fileStorage:i}=this.props;this.pending.add(i.loadFile(t)).then(o=>{ne.debug("Loaded file",o);const{filename:r}=o,{itemName:c}=this.state;if(r!==c){const{metadata:h}=this.props,{id:m}=h;this.renameTab(m,U.getBaseName(r))}const d={...n,language:Lt.languageFromFileName(r)};n.value==null&&(d.value=o.content),this.setState({fileMetadata:{id:r,itemName:r},settings:d}),this.debouncedSavePanelState()}).then(this.handleLoadSuccess).catch(this.handleLoadError)}save(){const{fileMetadata:e}=this.state;if(e&&U.hasPath(e.itemName)){const n=this.getNotebookValue();return this.saveContent(e.itemName,n),!0}return this.setState({showSaveAsModal:!0}),!1}saveContent(e,n){ne.debug("saveContent",e,n),this.updateSavedChangeCount();const{fileStorage:t}=this.props;this.pending.add(t.saveFile({filename:e,content:n})).then(this.handleSaveSuccess).catch(this.handleSaveError)}updateSavedChangeCount(){this.setState(({changeCount:e})=>({savedChangeCount:e}))}setPreviewStatus(){if(!this.tabTitleElement)return;const{isPreview:e}=this.state;ne.debug("setPreviewStatus",this.tabTitleElement,e),e?this.tabTitleElement.classList.add("is-preview"):this.tabTitleElement.classList.remove("is-preview")}savePanelState(){this.setState(e=>{const{changeCount:n,savedChangeCount:t,fileMetadata:i,isPreview:o,settings:r}=e,c=this.getNotebookValue(),d=n!==t?c:null,h={...r,value:c},g={settings:{...r,value:d},fileMetadata:i,isPreview:o};return ne.debug("Saving panel state",g),{settings:h,panelState:g}})}handleCloseDiscard(){this.shouldPromptClose=!1,this.setState({showCloseModal:!1});const{glContainer:e}=this.props;e.close()}handleCloseSave(){if(this.shouldPromptClose=!1,this.setState({showCloseModal:!1}),this.save()){const{glContainer:e}=this.props;e.close()}}handleCloseCancel(){this.shouldPromptClose=!0,this.setState({showCloseModal:!1})}handleCopy(){const{fileMetadata:e,settings:n}=this.state,t=this.getNotebookValue(),{language:i}=n,{itemName:o}=e,r=U.getCopyFileName(o);ne.debug("handleCopy",e,o,r),this.createNotebook(r,i,t)}handleEditorChange(e){ne.debug2("handleEditorChanged",e),this.removePreviewStatus(),this.setState(({changeCount:n,savedChangeCount:t})=>{const{isUndoing:i,isRedoing:o}=e;return i?{changeCount:n-1}:!o&&n<t?{changeCount:n+1,savedChangeCount:0}:{changeCount:n+1}}),this.debouncedSavePanelState()}handleFind(){this.notebook&&this.notebook.toggleFind()}handleBlur(){ne.debug("handleBlur"),this.setState({isFocused:!1})}handleFocus(){ne.debug("handleFocus"),this.setState({isFocused:!0})}handleLinkClick(e){const{notebooksUrl:n,session:t,sessionLanguage:i}=this.props,{href:o}=e.target;if(!o||!o.startsWith(n))return;e.stopPropagation(),e.preventDefault();const r=`/${o.substring(n.length)}`.replace(/%20/g," ");if(r==="/"){ne.debug("Ignoring invalid notebook link",r);return}ne.debug("Notebook link clicked, opening",r);const{glEventHub:c}=this.props,d={value:null,language:i},h={id:r,itemName:r};c.emit(ee.SELECT_NOTEBOOK,t,i,d,h)}handleLoadSuccess(){this.setState({error:null,isLoaded:!0,isLoading:!1})}handleLoadError(e){let n=e;le.isCanceled(n)||(le.isTimedOut(n)&&(n=new Error("File not found.")),ne.error(n),this.setState({error:n,isLoading:!1}))}handleSave(){ne.debug("handleSave"),this.save()}handleSaveSuccess(e){const{fileStorage:n}=this.props,t={id:e.filename,itemName:e.filename},i=Lt.languageFromFileName(e.filename);this.setState(o=>{const{fileMetadata:r}=o,c={...o.settings,language:i};return ne.debug("handleSaveSuccess",t,r,c),U.hasPath(r.itemName)&&r.itemName!==t.itemName&&(ne.debug("handleSaveSuccess deleting old file",r.itemName),n.deleteFile(r.itemName).catch(Lt.handleError)),{fileMetadata:t,settings:c,isPreview:!1}}),this.debouncedSavePanelState(),this.registerFileMetadata(t,!1)}handleSaveError(e){le.isCanceled(e)||(this.setState({savedChangeCount:0}),ne.error(e))}handleSaveAsCancel(){this.setState({showSaveAsModal:!1})}handleSaveAsSubmit(e){ne.debug("handleSaveAsSubmit",e);const{fileMetadata:n}=this.state,{itemName:t}=n,i=this.getNotebookValue();if(this.setState({showSaveAsModal:!1}),U.getBaseName(t)!==U.getBaseName(e)){const{metadata:o}=this.props,{id:r}=o;this.renameTab(r,U.getBaseName(e))}this.saveContent(e,i)}handleRenameFile(e,n){const{fileMetadata:t}=this.state;t.id===e&&(this.setState({fileMetadata:{id:n,itemName:n}}),this.debouncedSavePanelState())}handleResize(){var e;(e=this.notebook)==null||e.updateDimensions()}handleRunCommand(e){this.runCommand(e)}handleRunAll(){if(!this.notebook){ne.error("Editor is not initialized.");return}this.runCommand(this.notebook.getValue())}handleRunSelected(){if(!this.notebook){ne.error("Editor is not initialized.");return}this.runCommand(this.notebook.getSelectedCommand())}handleSessionOpened(e,{language:n}){this.setState({session:e,sessionLanguage:n})}handleSessionClosed(){this.setState({session:null,sessionLanguage:null})}handleShow(){var e;ne.debug("handleShow"),(e=this.notebook)==null||e.updateDimensions()}handleShowRename(){this.setState({showSaveAsModal:!0})}handleTab(e){ne.debug("NotebookPanel tab event",e),this.initTab(e)}handleTabFocus(...e){ne.debug("handleTabFocus",...e);const{glContainer:n}=this.props;this.setState({isDashboardActive:!0}),this.notebook&&!n.isHidden&&this.notebook.updateDimensions()}handleTabBlur(){ne.debug("handleTabBlur"),this.setState({isDashboardActive:!1})}handlePanelTabClick(){ne.debug("handlePanelTabClick"),this.focus()}handleTransformLinkUri(e){const{notebooksUrl:n}=this.props,{fileMetadata:t}=this.state;if(e.endsWith("/"))return e;if(e.startsWith("/"))return`${n}${e.substring(1)}`;let i=t==null?void 0:t.itemName;if(!i)return e;i.charAt(0)==="/"&&(i=i.substring(1));const o=new URL(i,n);return new URL(e,o).href}focus(){requestAnimationFrame(()=>{this.notebook&&this.notebook.focus()})}createNotebook(e,n,t){const{glEventHub:i}=this.props,{session:o,sessionLanguage:r,settings:c}=this.state,d={...c,language:n,value:t},h={id:null,itemName:e};ne.debug("handleCreateNotebook",o,r,d,h),i.emit(ee.CREATE_NOTEBOOK,o,r,d,h)}runCommand(e){if(!e){ne.debug("Ignoring empty command.");return}this.removePreviewStatus();const{glEventHub:n}=this.props;n.emit(fe.SEND_COMMAND,e,!1,!0)}removePreviewStatus(){this.setState(({isPreview:e})=>{if(e){const{fileMetadata:n}=this.state;return this.registerFileMetadata(n,!1),{isPreview:!1}}return null})}render(){var V;const{fileStorage:e,glContainer:n,glContainer:{tab:t},glEventHub:i}=this.props,{changeCount:o,savedChangeCount:r,error:c,isDashboardActive:d,isLoaded:h,isLoading:m,isPreview:g,fileMetadata:f,session:E,sessionLanguage:b,settings:y,showCloseModal:C,showSaveAsModal:I}=this.state,T=d&&!n.isHidden&&!g,w=(V=f==null?void 0:f.itemName)!=null?V:Lt.DEFAULT_NAME,_=w.endsWith(".md"),L=(f==null?void 0:f.id)!=null,D=this.getOverflowActions(),P={...y},B=E!=null,H=b===P.language,$=!h||!B||!H,W=!h,Q=[{action:this.handleSave,shortcut:Sn.SAVE}],x=Ki.getDisabledRunTooltip(B,H,"Notebook extension","Run"),N=Ki.getDisabledRunTooltip(B,H,"Notebook extension","Run Selected"),R=[{title:L?"Rename":"Save As\u2026",order:10,group:re.groups.high,action:this.handleShowRename},{title:"Copy File",action:this.handleCopy,group:re.groups.high,order:20}];return a.createElement(a.Fragment,null,t&&ls.createPortal(a.createElement("span",{className:z("editor-unsaved-indicator",{"is-unsaved":o!==r})}),t.element.find(".lm_title_before").get(0)),a.createElement(Xe,{className:"notebook-container",componentPanel:this,glContainer:n,glEventHub:i,onTab:this.handleTab,onResize:this.handleResize,onShow:this.handleShow,onTabFocus:this.handleTabFocus,onTabBlur:this.handleTabBlur,onSessionOpen:this.handleSessionOpened,onSessionClose:this.handleSessionClosed,onFocus:this.handleFocus,onBlur:this.handleBlur,additionalActions:R,renderTabTooltip:()=>w},!_&&a.createElement(a.Fragment,null,a.createElement("div",{className:"notebook-toolbar"},a.createElement("span",null,a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon btn-play",onClick:this.handleRunAll,disabled:$},a.createElement(G,{icon:Ms,transform:"grow-4"}),a.createElement(Le,null,"Run ",Hn.NOTEBOOK.RUN.getDisplayText())),x&&a.createElement(Le,null,x)),a.createElement("span",null,a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon btn-play",onClick:this.handleRunSelected,disabled:$},a.createElement(G,{icon:Pr,transform:"grow-4"}),a.createElement(Le,null,"Run Selected"," ",Hn.NOTEBOOK.RUN_SELECTED.getDisplayText())),N&&a.createElement(Le,null,N)),a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon mr-auto",disabled:W,onClick:this.handleSave},a.createElement(G,{icon:Oo}),a.createElement(Le,null,"Save")),a.createElement("button",{type:"button",className:"btn btn-link btn-overflow btn-link-icon",disabled:W},a.createElement(G,{icon:Wo}),a.createElement(Le,null,"More Actions..."),a.createElement(Kn,{actions:D,popperOptions:Lt.POPPER_OPTIONS}))),a.createElement(Rr,{isLoaded:h,isLoading:m,error:c,onChange:this.handleEditorChange,onRunCommand:this.handleRunCommand,session:E,sessionLanguage:b,settings:P,focusOnMount:T,ref:M=>{this.notebook=M}})),_&&a.createElement(_i,{content:P.value,onLinkClick:this.handleLinkClick,onRunCode:this.handleRunCommand,transformImageUri:this.handleTransformLinkUri,transformLinkUri:this.handleTransformLinkUri}),a.createElement(fs,{isOpen:I,type:"file",defaultValue:w,title:L?"Rename":"Save file as",onSubmit:this.handleSaveAsSubmit,onCancel:this.handleSaveAsCancel,notifyOnExtensionChange:!0,storage:e}),a.createElement(Cn,{isOpen:C,headerText:`Do you want to save the changes you made to ${w}?`,bodyText:"Your changes will be lost if you don't save them.",onCancel:this.handleCloseCancel,onDiscard:this.handleCloseDiscard,onConfirm:this.handleCloseSave,discardButtonText:"Discard Changes",confirmButtonText:"Save"}),a.createElement(re,{actions:Q})))}};let bt=Lt;v(bt,"COMPONENT","NotebookPanel"),v(bt,"POPPER_OPTIONS",{placement:"bottom-end"}),v(bt,"DEFAULT_NAME","Untitled");bt.propTypes={fileStorage:u.exports.shape({deleteFile:u.exports.func.isRequired,loadFile:u.exports.func.isRequired,saveFile:u.exports.func.isRequired}).isRequired,glContainer:ae.Container.isRequired,glEventHub:ae.EventHub.isRequired,isDashboardActive:u.exports.bool,isPreview:u.exports.bool,metadata:u.exports.shape({id:u.exports.string.isRequired}).isRequired,session:u.exports.shape({}),sessionLanguage:u.exports.string,panelState:u.exports.shape({settings:u.exports.shape({}),fileMetadata:u.exports.shape({})}).isRequired,notebooksUrl:u.exports.string.isRequired};bt.defaultProps={isDashboardActive:!0,isPreview:!1,session:null,sessionLanguage:null};const yh=(l,s)=>{const e=ia(l),n=kt(l,s.localDashboardId),{session:t,config:i}=n!=null?n:{},{type:o}=i!=null?i:{};return{fileStorage:e,session:t,sessionLanguage:o}},It=we(yh,null,null,{forwardRef:!0})(bt);class Kt extends p.exports.Component{constructor(s){super(s),this.irisGridRef=a.createRef(),this.buttonRef=a.createRef(),this.handleReload=this.handleReload.bind(this),this.handleGridStateChange=this.handleGridStateChange.bind(this),this.handlePanelStateUpdate=this.handlePanelStateUpdate.bind(this);const{panelState:e}=s;this.state={shouldFocusGrid:!1,panelState:e}}handleReload(){this.irisGridRef.current.initModel(),this.buttonRef.current.blur(),this.setState({shouldFocusGrid:!0})}handleGridStateChange(){var e,n,t;const{shouldFocusGrid:s}=this.state;s&&((t=(n=(e=this.irisGridRef.current)==null?void 0:e.irisGrid)==null?void 0:n.current)==null?void 0:t.grid)&&(this.irisGridRef.current.irisGrid.current.grid.focus(),this.setState({shouldFocusGrid:!1}))}handlePanelStateUpdate(s){this.setState({panelState:s})}render(){const{...s}=this.props;return a.createElement(dt,{ref:this.irisGridRef,onStateChange:this.handleGridStateChange,onPanelStateUpdate:this.handlePanelStateUpdate,...s},a.createElement("button",{ref:this.buttonRef,type:"button",className:"btn btn-primary btn-pandas",onClick:this.handleReload},"pandas dataframe",a.createElement("span",null,a.createElement(G,{icon:Bo,transform:"shrink-1",className:"mr-1"}),"Reload"),a.createElement(Le,null,"Click to refresh pandas dataframe, updates do not occur automatically.")))}}v(Kt,"COMPONENT","PandasPanel");Kt.propTypes={panelState:u.exports.shape({})};Kt.defaultProps={panelState:null};const wh=l=>{wt(l);const{id:s,layout:e,registerComponent:n,hydrate:t}=l,i=p.exports.useCallback(({dragEvent:o,fetch:r,panelId:c=Ee.generate(),widget:d})=>{const{name:h,type:m}=d;if(m!==dh.VariableType.FIGURE)return;const g={name:h,figure:h},f=()=>r().then(y=>Qt.makeModel(void 0,y)),E={type:"react-component",component:zt.COMPONENT,props:{localDashboardId:s,id:c,metadata:g,makeModel:f},title:h,id:c},{root:b}=e;F.openComponent({root:b,config:E,dragEvent:o})},[s,e]);return p.exports.useEffect(function(){const r=[n(zt.COMPONENT,zt,t)];return()=>{r.forEach(c=>c())}},[t,n]),oe(e.eventHub,Y.OPEN,i),a.createElement(a.Fragment,null)},vh=l=>{wt(l);const{id:s,layout:e}=l,n=p.exports.useCallback(({metadata:t,panelId:i=Ee.generate(),table:o})=>{const{settings:r}=t,c=()=>Qt.makeModelFromSettings(r,o),d=Z.titleFromSettings(r),h={type:"react-component",component:zt.COMPONENT,props:{localDashboardId:s,id:i,metadata:t,makeModel:c},title:d,id:i},{root:m}=e;F.openComponent({root:m,config:h})},[s,e]);return oe(e.eventHub,ye.CREATE_CHART,n),a.createElement(a.Fragment,null)},me=O.module("ConsolePlugin");function mo(l){return l.notebook!==void 0}function Th(l){wt(l)}const _h=l=>{Th(l);const{id:s,hydrateConsole:e,layout:n,panelManager:t,registerComponent:i,notebooksUrl:o}=l,r=p.exports.useRef(0),[c]=p.exports.useState(new Map),[d]=p.exports.useState(new Map),h=ii(),m=p.exports.useCallback(()=>t.getLastUsedPanelOfType($t),[t]),g=p.exports.useCallback((x,N=!0,R=!0)=>{if(!(x&&x.trim()))me.info("Ignoring empty code");else{const M=m();if(!M||!(M instanceof $t.WrappedComponent)){me.error("Console panel not found");return}me.debug("Send command: ",x,N,R),M.addCommand(x,N,R)}},[m]),f=p.exports.useCallback(x=>{h(Wd(s,x))},[h,s]),E=p.exports.useCallback(({language:x})=>{const N=x==="python"?"py":x;let R=null;return N?R=`Untitled-${r.current}.${N}`:(me.debug("No extension for language",x),R=`Untitled-${r.current}`),r.current+=1,R},[]),b=p.exports.useCallback((x,N=!0)=>{const{id:R}=x;return R&&c.has(R)?c.get(R):R&&d.has(R)?d.get(R):N?Ee.generate():null},[c,d]),y=p.exports.useCallback((x,N)=>{F.renameComponent(n.root,{id:x},N)},[n.root]),C=p.exports.useCallback((x,N)=>{me.debug("Rename file panel",x,N);let R;if(c.has(x)&&(R=c.get(x),c.delete(x),R!=null&&c.set(N,R)),d.has(x)&&(R=d.get(x),d.delete(x),R!=null&&d.set(N,R)),!R){me.debug2(`File ${x} isn't open, no need to rename the tab`);return}y(R,U.getBaseName(N))},[c,d,y]),I=p.exports.useCallback(x=>{const N=b(x,!1);if(N==null){me.error("Could not find panel id for file metadata",x);return}F.activateTab(n.root,{id:N})},[b,n.root]),T=p.exports.useCallback((x,N,R)=>{if(me.debug("registerFilePanel",x,N,R),!N||!N.id){me.debug("Ignore empty file id",N);return}const{id:V}=N;if(R){d.set(V,x);return}if(c.has(V)){const M=c.get(V);if(x===M){me.debug(`Update tab title for file ${V}`);const{itemName:q}=N;C(V,U.getBaseName(q))}else me.error(`File ${V} already associated with a different tab ${M}`);return}c.set(V,x),d.has(V)&&d.delete(V)},[c,d,C]),w=p.exports.useCallback((x,N)=>{if(me.debug("unregisterFileTab",x,N),!x||!x.id){me.debug("Ignore empty file id",x);return}const{id:R}=x;if(N){d.delete(R);return}c.delete(R)},[c,d]),_=p.exports.useCallback(x=>{me.debug("closeFilePanel",x);const{id:N}=x;let R=null,V=!1;if(c.has(N))R=c.get(N);else if(d.has(N))R=d.get(N),V=!0;else{me.debug(`File ${N} isn't open, ignore close event`);return}w(x,V),F.closeComponent(n.root,{id:R})},[n.root,c,d,w]),L=p.exports.useCallback(x=>{const{itemName:N}=x;return U.getBaseName(N)},[]),D=p.exports.useCallback(x=>{const{id:N}=x;return me.debug("fileIsOpen",x,N,c),N&&c.has(N)},[c]),P=p.exports.useCallback(x=>{const{id:N}=x;return me.debug("fileIsOpenAsPreview",x,N,d),N&&d.has(N)},[d]),B=p.exports.useCallback(x=>{if(!x)return;const N=t.getOpenedPanelById(x);N&&mo(N)&&N.focus()},[t]),H=p.exports.useCallback(({id:x,settings:N,fileMetadata:R,session:V,sessionLanguage:M,isPreview:q=!1})=>{const j={settings:N,fileMetadata:R},ve=L(R);return{type:"react-component",component:It.COMPONENT,isFocusOnShow:!1,props:{localDashboardId:s,metadata:{id:x},session:V,sessionLanguage:M,panelState:j,isPreview:q,notebooksUrl:o},title:ve,id:x}},[L,s,o]),$=p.exports.useCallback((x,N,R,V={id:null,itemName:E(R)})=>{const M=b(V);if(D(V)&&M){me.debug("File is already open, focus panel"),I(V),B(M);return}const q=F.getStackForComponentTypes(n.root,[It.COMPONENT]),j=H({id:M,settings:R,fileMetadata:V,session:x,sessionLanguage:N});me.debug("createNotebook",j,c),F.openComponentInStack(q,j)},[D,B,E,b,n.root,H,c,I]),W=p.exports.useCallback((x,N,R,V,M=!1)=>{me.debug("selectNotebook",V,M);const q=D(V),j=P(V);if(q){if(I(V),M){const A=b(V);B(A)}return}if(j&&!M){I(V);return}const[ve]=Array.from(d.values());let Pe=null,We=null;ve!=null&&(Pe=ve,We=F.getStackForConfig(n.root,{component:It.COMPONENT,id:Pe})),We==null&&(Pe=b(V),We=F.getStackForComponentTypes(n.root,[It.COMPONENT]));const vt=H({id:Pe,settings:R,fileMetadata:V,session:x,sessionLanguage:N,isPreview:!M});F.openComponentInStack(We,vt),M&&B(Pe)},[I,D,P,B,b,n.root,H,d]),Q=p.exports.useCallback((x,N,R={},V=!0)=>{const M=t.getLastUsedPanelOfType(It);M&&mo(M)?R&&R.value&&M.notebook&&M.notebook.append(R.value):V&&$(x,N,R)},[$,t]);return p.exports.useEffect(function(){const N=[i($t.COMPONENT,$t,e),i(Jn.COMPONENT,Jn),i(Qn.COMPONENT,Qn),i(ts.COMPONENT,ts),i(It.COMPONENT,It)];return()=>{N.forEach(R=>R())}},[i,e]),oe(n.eventHub,fe.SEND_COMMAND,g),oe(n.eventHub,fe.SETTINGS_CHANGED,f),oe(n.eventHub,ee.CLOSE_FILE,_),oe(n.eventHub,ee.CREATE_NOTEBOOK,$),oe(n.eventHub,ee.SELECT_NOTEBOOK,W),oe(n.eventHub,ee.RENAME,y),oe(n.eventHub,ee.RENAME_FILE,C),oe(n.eventHub,ee.SEND_TO_NOTEBOOK,Q),oe(n.eventHub,ee.REGISTER_FILE,T),oe(n.eventHub,ee.UNREGISTER_FILE,w),a.createElement(a.Fragment,null)},rn=O.module("FilterPlugin");function po(l,s){return l.concat(s)}const Ih=l=>{wt(l);const{id:s,layout:e,registerComponent:n}=l,t=ii(),[i]=p.exports.useState(()=>new Map),[o]=p.exports.useState(()=>new Map),[r]=p.exports.useState(()=>new Map),c=p.exports.useCallback(()=>{const y=Array.from(i.values()).reduce(po,[]).sort((T,w)=>{const _=Qe.toLower(T.name),L=Qe.toLower(w.name);if(_!==L)return _>L?1:-1;const D=Qe.toLower(T.type),P=Qe.toLower(w.type);return D!==P?D>P?1:-1:0}).reduce((T,w)=>((T.length===0||Qe.toLower(T[T.length-1].name)!==Qe.toLower(w.name)||Qe.toLower(T[T.length-1].type)!==Qe.toLower(w.type))&&T.push(w),T),[]),C=Array.from(o.values()).reduce(po,[]).sort((T,w)=>T.timestamp-w.timestamp),I=new Map(r);rn.debug("sendUpdate",{columns:y,filters:C,tableMap:I}),t(ht(s,{columns:y,filters:C,tableMap:I}))},[t,s,i,o,r]),d=p.exports.useCallback((y,C)=>{rn.debug2("handleColumnsChanged",y,C),i.set(y,[].concat(C)),c()},[i,c]),h=p.exports.useCallback((y,C)=>{rn.debug2("handleFiltersChanged",y,C),o.set(y,[].concat(C)),c()},[o,c]),m=p.exports.useCallback((y,C)=>{rn.debug2("handleTableChanged",y,C),r.set(F.getIdFromPanel(y),C),c()},[r,c]),g=p.exports.useCallback(y=>{rn.debug2("handlePanelUnmount",y),i.delete(y),o.delete(y),r.delete(F.getIdFromPanel(y)),c()},[i,o,r,c]),f=p.exports.useCallback(({title:y="DropdownFilter",metadata:C={},panelState:I=null,id:T=Ee.generate(),focusElement:w=F.DEFAULT_FOCUS_SELECTOR,createNewStack:_=!1,dragEvent:L=null})=>{const D={type:"react-component",component:Rt.COMPONENT,props:{id:T,metadata:C,panelState:I,localDashboardId:s},title:y,id:T},{root:P}=e;F.openComponent({root:P,config:D,focusElement:w,createNewStack:_,dragEvent:L})},[e,s]),E=p.exports.useCallback(({title:y="InputFilter",metadata:C={},panelState:I=null,id:T=Ee.generate(),focusElement:w=F.DEFAULT_FOCUS_SELECTOR,createNewStack:_=!1,dragEvent:L=null})=>{const D={type:"react-component",component:pn.COMPONENT,props:{id:T,metadata:C,panelState:I,localDashboardId:s},title:y,id:T},{root:P}=e;F.openComponent({root:P,config:D,focusElement:w,createNewStack:_,dragEvent:L})},[e,s]),b=p.exports.useCallback(({title:y="FilterSets",metadata:C={},panelState:I=null,id:T=Ee.generate(),focusElement:w=F.DEFAULT_FOCUS_SELECTOR,createNewStack:_=!1,dragEvent:L=null})=>{const D={type:"react-component",component:vs.COMPONENT,props:{id:T,metadata:C,panelState:I,localDashboardId:s},title:y,id:T},{root:P}=e;F.openComponent({root:P,config:D,focusElement:w,createNewStack:_,dragEvent:L})},[e,s]);return p.exports.useEffect(function(){const C=[n(Rt.COMPONENT,Rt),n(pn.COMPONENT,pn),n(vs.COMPONENT,vs)];return()=>{C.forEach(I=>I())}},[n]),oe(e.eventHub,J.COLUMNS_CHANGED,d),oe(e.eventHub,J.FILTERS_CHANGED,h),oe(e.eventHub,J.TABLE_CHANGED,m),oe(e.eventHub,J.OPEN_DROPDOWN,f),oe(e.eventHub,J.OPEN_INPUT,E),oe(e.eventHub,J.OPEN_FILTER_SET_MANAGER,b),oe(e.eventHub,Y.UNMOUNT,g),a.createElement(a.Fragment,null)},xh=[dh.VariableType.TABLE,dh.VariableType.TREETABLE],Dh=l=>{wt(l);const{getDownloadWorker:s,loadPlugin:e,id:n,layout:t,registerComponent:i,hydrate:o,theme:r}=l,c=p.exports.useCallback(({dragEvent:d,fetch:h,panelId:m=Ee.generate(),widget:g})=>{const{name:f,type:E}=g;if(!xh.includes(E))return;const b={name:f,table:f},y=()=>h().then(T=>Qs.makeModel(T)),C={type:"react-component",component:dt.COMPONENT,props:{getDownloadWorker:s,loadPlugin:e,localDashboardId:n,id:m,metadata:b,makeModel:y,theme:r},title:f,id:m},{root:I}=t;F.openComponent({root:I,config:C,dragEvent:d})},[s,n,t,e,r]);return p.exports.useEffect(function(){const h=[i(dt.COMPONENT,dt,o)];return()=>{h.forEach(m=>m())}},[o,i]),oe(t.eventHub,Y.OPEN,c),a.createElement(a.Fragment,null)};function Pa(l){return typeof l.getCoordinateForColumn=="function"}function go(l){const s=l;return Pa(l)&&typeof s.setFilterMap=="function"&&typeof s.unsetFilterValue=="function"}const ln=O.module("LinkerUtils"),Ra=class{static getLinkType(l,s,e){var r;if((l==null?void 0:l.panelId)==null||(s==null?void 0:s.panelId)==null||l.panelId===s.panelId||e!=null&&e!==l.panelId&&e!==s.panelId)return ln.debug2("Incompatible panel ids",l,s,e),"invalid";if(l.panelComponent==null||s.panelComponent==null)return ln.error("PanelComponent should not be null",l,s),"invalid";if(!((r=Ra.ALLOWED_LINKS.get(l.panelComponent))==null?void 0:r.includes(s.panelComponent)))return ln.debug2("Incompatible panel components",l,s),"invalid";const{columnType:t}=l,{columnType:i}=s;if(!(i===null||de.isCompatibleType(t,i)))return ln.debug2("Incompatible type",t,i),"invalid";switch(s.panelComponent){case F.getComponentName(zt):case F.getComponentName(dt):return"tableLink";case F.getComponentName(Rt):return"filterSource"}return ln.debug2("Incompatible target panel component",s.panelComponent),"invalid"}static findColumn(l,{columnName:s,columnType:e}){return l.find(({name:n,type:t})=>n===s&&t===e)}static cloneLinksForPanel(l,s,e){const n=[];return l.forEach(t=>{var i;t.start.panelId===s&&t.type!=="filterSource"?n.push({...t,id:Ee.generate(),start:{...t.start,panelId:e}}):((i=t.end)==null?void 0:i.panelId)===s&&n.push({...t,id:Ee.generate(),end:{...t.end,panelId:e}})}),n}};let xt=Ra;xt.ALLOWED_LINKS=new Map([[F.getComponentName(dt),[F.getComponentName(dt),F.getComponentName(zt),F.getComponentName(Rt)]]]);const fo=.015,Eo=1.5,ka=12,Ma=12,bo=2,On=Math.sqrt((Ma*.5)**2+ka**2),Co=Math.asin(Ma*.5/ka),So=15,Hs=class extends p.exports.PureComponent{static makeCirclePath(l,s,e){return`M ${l} ${s} m -${e},0 a ${e},${e} 0 1,0 ${e*2},0 a ${e},${e} 0 1,0 -${e*2},0 z`}constructor(l){super(l),this.handleClick=this.handleClick.bind(this)}handleClick(l){l.stopPropagation(),l.preventDefault();const{id:s,onClick:e}=this.props;e(s)}render(){const{className:l,x1:s,y1:e,x2:n,y2:t,id:i}=this.props,o=Math.sqrt((s-n)**2+(e-t)**2),r=Math.atan2(t-e,n-s),c=Math.sin(r),d=Math.cos(r)+2,h=window.innerWidth,m=window.innerHeight,g=0,f=0,E=Math.max(g,Math.min(s+(n-s)/2+c*(o*fo)**Eo,h)),b=Math.max(f,Math.min(e+(t-e)/2+d*(o*fo)**Eo,m)),y=`M ${s} ${e} Q ${E} ${b} ${n} ${t}`,C=`M ${g} ${f} L ${g} ${m} L ${h} ${m} L ${h} ${f} z
8
- ${Hs.makeCirclePath(s,e,So)}
9
- ${Hs.makeCirclePath(n,t,So)}`,I=`link-select-clip-${i}`,T=Math.atan2(t-b,n-E),w=T-Co+Math.PI,_=T+Co+Math.PI,L=n+Math.cos(T)*bo,D=t+Math.sin(T)*bo,P=L+Math.cos(w)*On,B=D+Math.sin(w)*On,H=L+Math.cos(_)*On,$=D+Math.sin(_)*On,W=`${L},${D} ${P},${B} ${H},${$}`;return a.createElement("svg",{className:l},a.createElement("clipPath",{id:I},a.createElement("path",{d:C,clipRule:"evenodd"})),a.createElement("path",{className:"link-select",d:y,onClick:this.handleClick,clipPath:`url(#${I})`}),a.createElement("path",{className:"link-background",d:y}),a.createElement("path",{className:"link-foreground",d:y}),a.createElement("circle",{className:"link-dot",cx:s,cy:e,r:"5"}),a.createElement("polygon",{className:"link-triangle",points:W}))}};let Aa=Hs;Aa.defaultProps={className:"",onClick(){}};const Ts=O.module("LinkerOverlayContent");class Oa extends p.exports.Component{constructor(s){super(s),this.handleMouseMove=this.handleMouseMove.bind(this),this.handleEscapePressed=this.handleEscapePressed.bind(this),this.state={mouseX:void 0,mouseY:void 0}}componentDidMount(){window.addEventListener("mousemove",this.handleMouseMove,!0)}componentDidCatch(s,e){Ts.error("componentDidCatch",s,e)}componentWillUnmount(){window.removeEventListener("mousemove",this.handleMouseMove,!0)}getPointFromLinkPoint(s){const{panelManager:e}=this.props,{panelId:n,columnName:t}=s,i=e.getOpenedPanelById(n);if(i!=null){if(!Pa(i))throw new Error(`Panel does not have getCoordinateForColumn method: ${n}`);try{const r=i.getCoordinateForColumn(t);if(r!=null)return r}catch{Ts.error("Could not get coordinate for column",t,i)}}const o=e.getContainerByPanelId(n);if(o==null)throw new Error(`Unable to find panel container for id: ${n}`);return F.getTabPoint(o)}handleMouseMove(s){this.setState({mouseX:s.clientX,mouseY:s.clientY})}handleEscapePressed(){const{onCancel:s}=this.props;s()}render(){const{disabled:s,links:e,messageText:n,onLinkDeleted:t,onAllLinksDeleted:i,onDone:o}=this.props,{mouseX:r,mouseY:c}=this.state,d=e.map(h=>{try{const{id:m,type:g,isReversed:f,start:E,end:b}=h;let[y,C]=this.getPointFromLinkPoint(E),I=r!=null?r:y,T=c!=null?c:C;if(b!=null&&([I,T]=this.getPointFromLinkPoint(b)),f){const[_,L]=[y,C];[y,C]=[I,T],[I,T]=[_,L]}const w=z("linker-link",{disabled:s},{"link-filter-source":g==="filterSource"},{"link-invalid":g==="invalid"},{interactive:h.end==null});return{x1:y,y1:C,x2:I,y2:T,id:m,className:w}}catch(m){return Ts.error("Unable to get point for link",h,m),null}}).filter(h=>h!=null);return a.createElement("div",{className:"linker-overlay"},a.createElement("svg",null,d.map(({x1:h,y1:m,x2:g,y2:f,id:E,className:b})=>a.createElement(Aa,{className:b,id:E,x1:h,y1:m,x2:g,y2:f,key:E,onClick:t}))),a.createElement("div",{className:"linker-toast-dialog"},a.createElement("div",{className:"toast-body"},n),a.createElement("div",{className:"toast-footer"},a.createElement("button",{className:"btn btn-outline-primary",onClick:i,type:"button"},"Clear All"),a.createElement("button",{className:"btn btn-primary",onClick:o,type:"button"},"Done"))),a.createElement(re,{actions:[{action:this.handleEscapePressed,shortcut:Sn.LINKER_CLOSE,isGlobal:!0}]}))}}Oa.defaultProps={disabled:"false"};const De=O.module("Linker"),Nh=(l,s)=>({activeTool:ds(l),isolatedLinkerPanelId:pi(l,s.localDashboardId),links:nn(l,s.localDashboardId),timeZone:cs(l)}),Lh=we(Nh,{setActiveTool:hs,setDashboardLinks:fi,addDashboardLinks:Bd,deleteDashboardLinks:Hd,setDashboardIsolatedLinkerPanelId:Ia,setDashboardColumnSelectionValidator:$d});class Fh extends p.exports.Component{constructor(s){super(s),this.getCachedLinks=te((e,n,t)=>{const i=[...e];return n&&n.start&&i.push(n),t!==void 0?i.filter(o=>{var r,c;return((r=o==null?void 0:o.start)==null?void 0:r.panelId)===t||((c=o==null?void 0:o.end)==null?void 0:c.panelId)===t||(o==null?void 0:o.end)==null}):i}),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.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.isColumnSelectionValid=this.isColumnSelectionValid.bind(this),this.state={linkInProgress:void 0}}componentDidMount(){const{layout:s}=this.props;this.startListening(s),this.updateSelectionValidators()}componentDidUpdate(s){const{activeTool:e,layout:n}=this.props;n!==s.layout&&(this.stopListening(s.layout),this.startListening(n)),e!==s.activeTool&&this.updateSelectionValidators()}componentDidCatch(s,e){De.error("componentDidCatch",s,e)}componentWillUnmount(){const{layout:s}=this.props;this.stopListening(s)}startListening(s){s.on("stateChanged",this.handleLayoutStateChanged);const{eventHub:e}=s;e.on(ye.COLUMN_SELECTED,this.handleGridColumnSelect),e.on(ye.DATA_SELECTED,this.handleUpdateValues),e.on(ye.STATE_CHANGED,this.handleStateChange),e.on(Gt.COLUMN_SELECTED,this.handleChartColumnSelect),e.on(Y.CLONED,this.handlePanelCloned),e.on(J.COLUMN_SELECTED,this.handleFilterColumnSelect),e.on(J.COLUMNS_CHANGED,this.handleColumnsChanged),e.on(Y.CLOSED,this.handlePanelClosed)}stopListening(s){s.off("stateChanged",this.handleLayoutStateChanged);const{eventHub:e}=s;e.off(ye.COLUMN_SELECTED,this.handleGridColumnSelect),e.off(ye.DATA_SELECTED,this.handleUpdateValues),e.off(ye.STATE_CHANGED,this.handleStateChange),e.off(Gt.COLUMN_SELECTED,this.handleChartColumnSelect),e.off(Y.CLONED,this.handlePanelCloned),e.off(J.COLUMN_SELECTED,this.handleFilterColumnSelect),e.off(J.COLUMNS_CHANGED,this.handleColumnsChanged),e.off(Y.CLOSED,this.handlePanelClosed)}handleCancel(){const{linkInProgress:s}=this.state;if(s==null){const{setActiveTool:e}=this.props;e(Ue.DEFAULT)}this.setState({linkInProgress:void 0})}handleDone(){const{setActiveTool:s}=this.props;s(Ue.DEFAULT),this.setState({linkInProgress:void 0})}handleChartColumnSelect(s,e){this.columnSelected(s,e,!0)}handleFilterColumnSelect(s,e){De.debug("handleFilterColumnSelect",this.isOverlayShown());const{links:n,localDashboardId:t,setActiveTool:i,setDashboardIsolatedLinkerPanelId:o}=this.props,r=F.getIdFromPanel(s),c=n.filter(d=>{var h,m;return((h=d.start)==null?void 0:h.panelId)===r||((m=d.end)==null?void 0:m.panelId)===r});if(!this.isOverlayShown()&&r!=null){i(Ue.LINKER),o(t,r),c.length===0&&this.columnSelected(s,e,!0,r);return}this.columnSelected(s,e,!0)}handleColumnsChanged(s,e){De.debug("handleColumnsChanged",s,e);const{links:n}=this.props,t=F.getIdFromPanel(s);if(t==null){De.error("Invalid panelId",s);return}const i=n.filter(({start:o,end:r})=>o.panelId===t&&xt.findColumn(e,o)==null||r!=null&&r.panelId===t&&xt.findColumn(e,r)==null);this.deleteLinks(i)}handleGridColumnSelect(s,e){this.columnSelected(s,e)}columnSelected(s,e,n=!1,t){if(t===void 0&&!this.isOverlayShown())return;const{isolatedLinkerPanelId:i}=this.props,{linkInProgress:o}=this.state,r=F.getIdFromPanel(s);if(r==null)return;const c=F.getComponentNameFromPanel(s),{name:d,type:h}=e;if(o==null||o.start==null){const m={id:Ee.generate(),start:{panelId:r,panelComponent:c,columnName:d,columnType:h},type:"invalid",isReversed:n};De.debug("starting link",m),this.setState({linkInProgress:m})}else{const{start:m,id:g,isReversed:f}=o,E={panelId:r,panelComponent:c,columnName:d,columnType:h},b=xt.getLinkType(f?E:m,f?m:E,t!=null?t:i);switch(b){case"invalid":De.debug("Ignore invalid link connection",o,E);return;case"filterSource":{const{links:C}=this.props,I=f?m.panelId:E.panelId,T=C.filter(({end:w})=>(w==null?void 0:w.panelId)===I);this.deleteLinks(T);break}}const y={start:f?E:m,end:f?m:E,id:g,type:b};De.info("creating link",y),this.setState({linkInProgress:void 0},()=>{this.addLinks([y])})}}unsetFilterValueForLink(s){const{panelManager:e}=this.props;if(s.end){const{end:n}=s,{panelId:t,columnName:i,columnType:o}=n,r=e.getOpenedPanelById(t);r?go(r)?r.unsetFilterValue(i,o):De.debug("endPanel.unsetFilterValue not implemented",r):De.debug("endPanel no longer exists, ignoring unsetFilterValue",t)}}setPanelFilterMap(s,e){De.debug("Set filter data for panel:",s,e);const{panelManager:n}=this.props,t=n.getOpenedPanelById(s);t?go(t)?t.setFilterMap(e):De.debug("panel.setFilterMap not implemented",s,t):De.debug("panel no longer exists, ignoring setFilterMap",s)}addLinks(s){const{addDashboardLinks:e,localDashboardId:n}=this.props;e(n,s)}deleteLinks(s,e=!1){const{localDashboardId:n}=this.props;if(s.forEach(t=>this.unsetFilterValueForLink(t)),e){const{setDashboardLinks:t}=this.props;t(n,[])}else if(s.length>0){const{deleteDashboardLinks:t}=this.props;t(n,s.map(({id:i})=>i))}}handleAllLinksDeleted(){const{links:s,isolatedLinkerPanelId:e}=this.props;if(e===void 0)this.deleteLinks(s,!0);else{const n=s.filter(t=>{var i,o;return((i=t==null?void 0:t.start)==null?void 0:i.panelId)===e||((o=t==null?void 0:t.end)==null?void 0:o.panelId)===e});this.deleteLinks(n)}this.setState({linkInProgress:void 0})}handleLinkDeleted(s){const{links:e}=this.props,n=e.find(t=>t.id===s);n?this.deleteLinks([n]):De.error("Unable to find link to delete",s)}handleUpdateValues(s,e){const n=F.getIdFromPanel(s),{links:t,timeZone:i}=this.props,o=new Map;for(let r=0;r<t.length;r+=1){const{start:c,end:d}=t[r];if(c.panelId===n&&d!=null){const{panelId:h,columnName:m,columnType:g}=d,f=o.has(h)?o.get(h):new Map,{value:E}=e[c.columnName];let b=`${E}`;de.isDateType(g)&&(b=new Ae({timeZone:i,showTimeZone:!1,showTSeparator:!0,defaultDateTimeFormatString:ko.FULL_DATE_FORMAT}).format(E)),f.set(m,{columnType:g,text:b,value:E}),o.set(h,f)}}o.forEach((r,c)=>{this.setPanelFilterMap(c,r)})}handlePanelCloned(s,e){const{links:n}=this.props,t=F.getIdFromPanel(s),i=e.id;if(t!=null){const o=xt.cloneLinksForPanel(n,t,i);this.addLinks(o)}}handlePanelClosed(s){De.debug(`Panel ${s} closed, deleting links.`),this.deleteLinksForPanelId(s)}handleLayoutStateChanged(){this.forceUpdate()}handleStateChange(){this.forceUpdate()}handleExited(){const{localDashboardId:s,setDashboardIsolatedLinkerPanelId:e}=this.props;e(s,void 0)}deleteLinksForPanelId(s){const{links:e}=this.props;for(let n=0;n<e.length;n+=1){const t=e[n],{start:i,end:o,id:r}=t;(i.panelId===s||(o==null?void 0:o.panelId)===s)&&this.handleLinkDeleted(r)}}isOverlayShown(){const{activeTool:s}=this.props;return s===Ue.LINKER}updateSelectionValidators(){const{activeTool:s,setDashboardColumnSelectionValidator:e,localDashboardId:n}=this.props;switch(s){case Ue.LINKER:e(n,this.isColumnSelectionValid);break;default:e(n,void 0);break}}updateLinkInProgressType(s,e="invalid"){this.setState({linkInProgress:{...s,type:e}})}isColumnSelectionValid(s,e){const{linkInProgress:n}=this.state,{isolatedLinkerPanelId:t}=this.props;if((n==null?void 0:n.start)==null)return!0;if(e==null)return this.updateLinkInProgressType(n),!1;const{isReversed:i,start:o}=n,r=F.getIdFromPanel(s);if(r==null)return!1;const c={panelId:r,panelComponent:F.getComponentNameFromPanel(s),columnName:e.name,columnType:e.type},d=i?xt.getLinkType(c,o,t):xt.getLinkType(o,c,t);return this.updateLinkInProgressType(n,d),d!=="invalid"}render(){const{links:s,isolatedLinkerPanelId:e,panelManager:n}=this.props,{linkInProgress:t}=this.state,i=this.isOverlayShown(),o=t!=null&&t.start!=null,r=e===void 0?"Click a column source, then click a column target to create a filter link. Remove a filter link by clicking again to erase. Click done when finished.":"Create a link between the source column button and a table column by clicking on one, then the other. Remove the link by clicking it directly. Click done when finished.";return a.createElement(a.Fragment,null,a.createElement(Jt.CSSTransition,{in:i,timeout:En.transitionMs,classNames:"fade",mountOnEnter:!0,unmountOnExit:!0,onExited:this.handleExited},a.createElement(Oa,{disabled:o,panelManager:n,links:this.getCachedLinks(s,t,e),messageText:r,onLinkDeleted:this.handleLinkDeleted,onAllLinksDeleted:this.handleAllLinksDeleted,onDone:this.handleDone,onCancel:this.handleCancel})))}}const Ph=Lh(Fh),Rh=l=>{wt(l);const{id:s,layout:e,panelManager:n}=l;return a.createElement(Ph,{layout:e,localDashboardId:s,panelManager:n})},as=class{static getNewMarkdownTitle(s){let e=`${as.DEFAULT_TITLE}`,n=0;for(;s.indexOf(e)>=0;)n+=1,e=`${as.DEFAULT_TITLE}-${n}`;return e}};let Pt=as;v(Pt,"DEFAULT_TITLE","Note"),v(Pt,"DEFAULT_CONTENT",`# Markdown Note
10
-
11
- This note can be edited using **markdown** for styling.`);const kh=l=>{wt(l);const{id:s,layout:e,panelManager:n,registerComponent:t}=l,i=p.exports.useCallback(r=>{const{title:c,componentState:d,props:h}=r;let{panelState:m=null}=h;return d&&({panelState:m=null}=d),!c||!m||!m.content||m.content.length===0||m.content===Pt.DEFAULT_CONTENT?null:ci(r)},[]),o=p.exports.useCallback(({title:r="",metadata:c={},id:d=Ee.generate(),focusElement:h=F.DEFAULT_FOCUS_SELECTOR,createNewStack:m=!1,dragEvent:g=null}={})=>{const f=n.getOpenedPanelConfigsOfType(an.COMPONENT),E=n.getClosedPanelConfigsOfType(an.COMPONENT),b=f.map(w=>{var _;return(_=w.title)!=null?_:""}),y=r||Pt.getNewMarkdownTitle(b),C=E.length>0?null:Pt.DEFAULT_CONTENT,I={type:"react-component",component:an.COMPONENT,props:{id:d,metadata:c,panelState:{content:C},localDashboardId:s},title:y,id:d},{root:T}=e;F.openComponent({root:T,config:I,focusElement:h,createNewStack:m,dragEvent:g})},[s,e,n]);return p.exports.useEffect(function(){const c=[t(an.COMPONENT,an,di,i)];return()=>{c.forEach(d=>d())}},[i,t]),oe(e.eventHub,va.OPEN,o),a.createElement(a.Fragment,null)},Mh=l=>{wt(l);const{hydrate:s,id:e,layout:n,registerComponent:t}=l,i=p.exports.useCallback(({dragEvent:o,fetch:r,panelId:c=Ee.generate(),widget:d})=>{const{name:h,type:m}=d;if(m!==dh.VariableType.PANDAS)return;const g={name:h,table:h},f=()=>r().then(y=>Qs.makeModel(y)),E={type:"react-component",component:Kt.COMPONENT,props:{localDashboardId:e,id:c,metadata:g,makeModel:f},title:h,id:c},{root:b}=n;F.openComponent({root:b,config:E,dragEvent:o})},[e,n]);return p.exports.useEffect(function(){const r=[t(Kt.COMPONENT,Kt,s)];return()=>{r.forEach(c=>c())}},[s,t]),oe(n.eventHub,Y.OPEN,i),a.createElement(a.Fragment,null)};class $e{}v($e,"DROPDOWN_FILTER","ControlType.DROPDOWN_FILTER"),v($e,"INPUT_FILTER","ControlType.INPUT_FILTER"),v($e,"MARKDOWN","ControlType.MARKDOWN"),v($e,"FILTER_SET_MANAGER","ControlType.FILTER_SET_MANAGER");const Ua="SET_LAYOUT_STORAGE",Ah=l=>({type:Ua,payload:l}),Va="/assets/community-wordmark-app.d2c5c1eb.svg";const gt=O.module("FormattingSectionContent"),pe=class extends p.exports.PureComponent{constructor(e){super(e);v(this,"getCachedColumnTypeOptions",Ze(()=>pe.renderColumnTypeOptions()));v(this,"getCachedDateTimeFormatOptions",Ze((e,n,t,i=!1,o=null)=>{const{timestampAtMenuOpen:r}=this.state;return pe.renderDateTimeOptions(r,e,n,t,i,o)}));this.debouncedCommitChanges=Ye(this.commitChanges.bind(this),pe.inputDebounceTime),this.handleDefaultDateTimeFormatChange=this.handleDefaultDateTimeFormatChange.bind(this),this.handleDefaultDecimalFormatChange=this.handleDefaultDecimalFormatChange.bind(this),this.handleDefaultIntegerFormatChange=this.handleDefaultIntegerFormatChange.bind(this),this.handleFormatRuleEntered=this.handleFormatRuleEntered.bind(this),this.handleFormatRuleChange=this.handleFormatRuleChange.bind(this),this.handleFormatRuleCreate=this.handleFormatRuleCreate.bind(this),this.handleFormatRuleDelete=this.handleFormatRuleDelete.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:n,defaultDateTimeFormat:t,defaultDecimalFormatOptions:i,defaultIntegerFormatOptions:o,showTimeZone:r,showTSeparator:c,timeZone:d,truncateNumbersWithPound:h}=e,m=n.map((g,f)=>({...g,id:f}));this.containerRef=a.createRef(),this.addFormatRuleButtonRef=a.createRef(),this.lastFormatRuleIndex=m.length,this.state={formatSettings:m,formatRulesChanged:!1,showTimeZone:r,showTSeparator:c,timeZone:d,defaultDateTimeFormat:t,defaultDecimalFormatOptions:i,defaultIntegerFormatOptions:o,truncateNumbersWithPound:h,timestampAtMenuOpen:new Date}}static focusFirstInputInContainer(e){const n=e.querySelector("input, select, textarea");n&&n.focus()}static isSameDecimalOptions(e,n){return(e==null?void 0:e.defaultFormatString)===(n==null?void 0:n.defaultFormatString)}static isSameIntegerOptions(e,n){return(e==null?void 0:e.defaultFormatString)===(n==null?void 0:n.defaultFormatString)}static isValidColumnName(e){return e&&Mr.isValidColumnName(e)}static isValidFormat(e,n){if(!e||!n.formatString)return!1;switch(e){case"datetime":return Ae.isValid(n);case"decimal":return qe.isValid(n);case"int":return je.isValid(n);default:return gt.warn("Trying to validate format of unknown type"),!0}}static removeFormatRuleExtraProps(e){const{id:n,isNewRule:t,...i}=e;return i}static isFormatRuleValidForSave(e){return pe.isValidColumnName(e.columnName)&&pe.isValidFormat(e.columnType,e.format)}static renderTimeZoneOptions(){return As.TIME_ZONES.map(n=>{const{label:t,value:i}=n;return a.createElement("option",{value:i,key:i},t)})}static renderColumnTypeOptions(){const n=[{value:de.dataType.DATETIME,label:"DateTime"},{value:de.dataType.DECIMAL,label:"Decimal"},{value:de.dataType.INT,label:"Integer"}].map(t=>a.createElement("option",{key:`key-columnType-${t.value}`,value:t.value},t.label));return a.createElement(a.Fragment,null,a.createElement("option",{key:"key-columnType-placeholder",disabled:!0,value:""},"Select Type"),n)}static renderDateTimeOptions(e,n,t,i,o,r){const c=new qn([],{timeZone:n,showTimeZone:t,showTSeparator:i}),d=o?Ae.getGlobalFormats(t,i):Ae.getFormats(t,i);return r&&!d.includes(r)&&d.unshift(r),d.map(h=>{const m=Ae.makeFormat("",h,Ae.TYPE_GLOBAL);return a.createElement("option",{value:h,key:h},c.getFormattedString(e,de.dataType.DATETIME,"",m))})}componentDidMount(){pe.focusFirstInputInContainer(this.containerRef.current)}componentWillUnmount(){this.debouncedCommitChanges.flush()}isDuplicateRule(e){const{formatSettings:n}=this.state;return n.some(t=>t.id!==e.id&&t.columnName===e.columnName&&t.columnType===e.columnType)}getAutoIncrementFormatRuleIndex(){const{lastFormatRuleIndex:e}=this;return this.lastFormatRuleIndex+=1,e}handleDefaultDateTimeFormatChange(e){gt.debug("handleDefaultDateTimeFormatChange",e.target.value),this.setState({defaultDateTimeFormat:e.target.value},()=>{this.debouncedCommitChanges()})}handleDefaultDecimalFormatChange(e){gt.debug("handleDefaultDecimalFormatChange",e.target.value),this.setState({defaultDecimalFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleDefaultIntegerFormatChange(e){gt.debug("handleDefaultIntegerFormatChange",e.target.value),this.setState({defaultIntegerFormatOptions:{defaultFormatString:e.target.value}},()=>{this.debouncedCommitChanges()})}handleFormatRuleChange(e,n,t){this.setState(i=>{const{formatSettings:o}=i,r=o.concat();let c={};n==="columnType"&&(c={format:""});const d={...r[e],...c,[n]:t};return r[e]=d,{formatSettings:r}},()=>{this.debouncedCommitChanges()})}handleFormatRuleCreate(){this.setState(e=>{const{formatSettings:n}=e,t={columnType:de.dataType.DATETIME,columnName:"",format:"",id:this.getAutoIncrementFormatRuleIndex(),isNewRule:!0};return{formatSettings:[...n,t],formatRulesChanged:!0}})}handleFormatRuleDelete(e){this.setState(n=>{const{formatSettings:t}=n;return{formatSettings:t.filter((o,r)=>r!==e),formatRulesChanged:!0}},()=>{this.debouncedCommitChanges()})}handleShowTimeZoneChange(){this.setState(e=>({showTimeZone:!e.showTimeZone}),()=>{this.debouncedCommitChanges()})}handleShowTSeparatorChange(){this.setState(e=>({showTSeparator:!e.showTSeparator}),()=>{this.debouncedCommitChanges()})}handleTimeZoneChange(e){this.setState({timeZone:e.target.value},()=>{this.debouncedCommitChanges()})}handleResetDateTimeFormat(){const{defaults:e}=this.props,{defaultDateTimeFormat:n,showTimeZone:t,showTSeparator:i}=e;gt.debug("handleResetDateTimeFormat"),this.setState({defaultDateTimeFormat:n,showTimeZone:t,showTSeparator:i},()=>{this.debouncedCommitChanges()})}handleResetTimeZone(){const{defaults:e}=this.props,{timeZone:n}=e;gt.debug("handleResetTimeZone"),this.setState({timeZone:n},()=>{this.debouncedCommitChanges()})}handleResetDecimalFormat(){const{defaults:e}=this.props,{defaultDecimalFormatOptions:n}=e;gt.debug("handleResetDecimalFormat"),this.setState({defaultDecimalFormatOptions:n},()=>{this.debouncedCommitChanges()})}handleResetIntegerFormat(){const{defaults:e}=this.props,{defaultIntegerFormatOptions:n}=e;gt.debug("handleResetIntegerFormat"),this.setState({defaultIntegerFormatOptions:n},()=>{this.debouncedCommitChanges()})}handleTruncateNumbersWithPoundChange(){this.setState(e=>({truncateNumbersWithPound:!e.truncateNumbersWithPound}),()=>{this.debouncedCommitChanges()})}handleFormatRuleEntered(e){this.scrollToFormatBlockBottom(),pe.focusFirstInputInContainer(e)}commitChanges(){const{formatSettings:e,defaultDateTimeFormat:n,showTimeZone:t,showTSeparator:i,timeZone:o,defaultDecimalFormatOptions:r,defaultIntegerFormatOptions:c,truncateNumbersWithPound:d}=this.state,h=e.filter(pe.isFormatRuleValidForSave).map(pe.removeFormatRuleExtraProps),{settings:m,saveSettings:g}=this.props,f={...m,formatter:h,defaultDateTimeFormat:n,showTimeZone:t,showTSeparator:i,timeZone:o,truncateNumbersWithPound:d};pe.isValidFormat(de.dataType.DECIMAL,qe.makeCustomFormat(r==null?void 0:r.defaultFormatString))&&(f.defaultDecimalFormatOptions=r),pe.isValidFormat(de.dataType.INT,je.makeCustomFormat(c.defaultFormatString))&&(f.defaultIntegerFormatOptions=c),g(f)}scrollToFormatBlockBottom(){const{scrollTo:e}=this.props;e(0,this.addFormatRuleButtonRef.current.offsetHeight+this.addFormatRuleButtonRef.current.offsetTop)}getRuleError(e){const n={hasColumnNameError:!1,hasFormatError:!1,message:""},t=[];return e.isNewRule||(this.isDuplicateRule(e)&&(n.hasColumnNameError=!0,t.push("Duplicate column name/type combo.")),pe.isValidColumnName(e.columnName)||(n.hasColumnNameError=!0,t.push("Column names must start with a letter or underscore and contain only alphanumeric characters or underscores.")),e.format?pe.isValidFormat(e.columnType,e.format)||(n.hasFormatError=!0,t.push("Invalid formatting rule.")):(n.hasFormatError=!0,t.push("Empty formatting rule.")),n.message=t.join(`
12
- `)),n}renderFormatRule(e,n){const t=`input-${e}-columnName`,i=`input-${e}-columnType`,o=`input-${e}-format`,r=this.getCachedColumnTypeOptions(),c=g=>this.handleFormatRuleChange(e,"columnName",g.target.value),d=()=>this.handleFormatRuleChange(e,"isNewRule",!1),h=g=>this.handleFormatRuleChange(e,"columnType",g.target.value),m=this.getRuleError(n);return a.createElement("fieldset",{key:e,className:"container-fluid format-rule-container"},a.createElement("div",{className:"form-row"},a.createElement("div",{className:"form-group col-7 mb-2"},a.createElement("label",{htmlFor:t},"Column Name"),a.createElement("input",{id:t,className:z("form-control",{"is-invalid":m.hasColumnNameError}),"data-lpignore":!0,type:"text",value:n.columnName,onChange:c,onBlur:d})),a.createElement("div",{className:"form-group col mb-2"},a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon btn-delete-format-rule float-right",tabIndex:"-1",onClick:()=>this.handleFormatRuleDelete(e)},a.createElement(G,{icon:Ys})),a.createElement("label",{htmlFor:i},"Column Type"),a.createElement("select",{id:i,className:"custom-select",value:n.columnType,onChange:h},r))),a.createElement("div",{className:"form-row"},a.createElement("div",{className:"form-group col-12 d-flex mb-2"},a.createElement("label",{className:"flex-shrink-0 col-form-label mr-3",htmlFor:o},"Formatting Rule"),this.renderFormatRuleInput(e,n.columnType,o,n.format,m.hasFormatError))),a.createElement("div",{className:"form-row"},a.createElement("div",{className:"form-group col-12 d-flex mb-2"},m.message&&a.createElement("p",{className:"text-danger"},m.message))))}renderFormatRuleInput(e,n,t,i,o){switch(de.getNormalizedType(n)){case de.dataType.DATETIME:return this.renderDateTimeFormatRuleInput(e,t,i,o);case de.dataType.DECIMAL:return this.renderDecimalFormatRuleInput(e,t,i,o);case de.dataType.INT:return this.renderIntegerFormatRuleInput(e,t,i,o);default:return null}}renderDateTimeFormatRuleInput(e,n,t,i){const{showTimeZone:o,showTSeparator:r,timeZone:c}=this.state,d=t&&t.formatString||"";return a.createElement("select",{className:z("custom-select",{"is-invalid":i}),value:d,id:n,onChange:h=>{const m=Ae.makeFormat("",h.target.value,Ae.TYPE_GLOBAL);this.handleFormatRuleChange(e,"format",m)}},a.createElement("option",{key:"default",value:"",disabled:!0},"Select format"),this.getCachedDateTimeFormatOptions(c,o,r))}renderIntegerFormatRuleInput(e,n,t,i){const o=t&&t.formatString||"";return a.createElement("input",{className:z("form-control","flex-grow-1",{"is-invalid":i}),"data-lpignore":!0,id:n,placeholder:je.DEFAULT_FORMAT_STRING,type:"text",value:o,onChange:r=>{const c=je.makeFormat("",r.target.value,je.TYPE_GLOBAL,null);this.handleFormatRuleChange(e,"format",c)}})}renderDecimalFormatRuleInput(e,n,t,i){const o=t&&t.formatString||"";return a.createElement("input",{className:z("form-control","flex-grow-1",{"is-invalid":i}),"data-lpignore":!0,id:n,placeholder:qe.DEFAULT_FORMAT_STRING,type:"text",value:o,onChange:r=>{const c=qe.makeFormat("",r.target.value,qe.TYPE_GLOBAL,null);this.handleFormatRuleChange(e,"format",c)}})}render(){const{defaults:e}=this.props,{formatRulesChanged:n,formatSettings:t,defaultDateTimeFormat:i,defaultDecimalFormatOptions:o,defaultIntegerFormatOptions:r,timeZone:c,showTimeZone:d,showTSeparator:h,truncateNumbersWithPound:m}=this.state,{defaultFormatString:g=qe.DEFAULT_FORMAT_STRING}=o!=null?o:{},{defaultFormatString:f=je.DEFAULT_FORMAT_STRING}=r!=null?r:{},E=t.map((w,_)=>a.createElement(Jt.CSSTransition,{key:w.id,classNames:"fade",timeout:En.transitionMs,onEnter:this.handleFormatRuleEntered},this.renderFormatRule(_,w))),b=a.createElement("button",{type:"button",className:"btn btn-link mb-3",onClick:this.handleFormatRuleCreate,ref:this.addFormatRuleButtonRef},a.createElement(G,{icon:Ho}),"Add New Rule"),y=c===e.timeZone,C=h===e.showTSeparator&&d===e.showTimeZone&&i===e.defaultDateTimeFormat,I=pe.isSameDecimalOptions(o,e.defaultDecimalFormatOptions),T=pe.isSameIntegerOptions(r,e.defaultIntegerFormatOptions);return a.createElement("div",{className:"app-settings-formatting-section",ref:this.containerRef},a.createElement("div",{className:"container-fluid p-0"},a.createElement("div",null,"Default formatting for column types"),a.createElement("div",{className:"app-settings-menu-description mb-3"},"Applies a formatting rule to all columns of a set type."),a.createElement("div",{className:"form-row mb-2"},a.createElement("label",{className:"col-form-label col-3",htmlFor:"select-reset-timezone"},"Time zone"),a.createElement("div",{className:"col pr-0"},a.createElement("select",{className:"custom-select",value:c,onChange:this.handleTimeZoneChange,id:"select-reset-timezone"},pe.renderTimeZoneOptions())),a.createElement("div",{className:"col-1 btn-col"},a.createElement(X,{kind:"ghost",icon:Bt,onClick:this.handleResetTimeZone,tooltip:"Reset Time Zone",className:z("btn-reset","btn-reset-time-zone",{hidden:y})}))),a.createElement("div",{className:"form-row mb-2"},a.createElement("label",{className:"col-form-label col-3",htmlFor:"select-default-time-format"},"DateTime"),a.createElement("div",{className:"col pr-0"},a.createElement("select",{className:"custom-select",value:i,onChange:this.handleDefaultDateTimeFormatChange,id:"select-default-time-format"},this.getCachedDateTimeFormatOptions(c,d,h,!0,i))),a.createElement("div",{className:"col-1 btn-col"},a.createElement(X,{kind:"ghost",icon:Bt,onClick:this.handleResetDateTimeFormat,tooltip:"Reset DateTime Options",className:z("btn-reset","btn-reset-date-time",{hidden:C})}))),a.createElement("div",{className:"form-row"},a.createElement("div",{className:"offset-3 col-9"},a.createElement(tt,{checked:d,onChange:this.handleShowTimeZoneChange},"Show time zone in dates"))),a.createElement("div",{className:"form-row mb-3"},a.createElement("div",{className:"offset-3 col-9"},a.createElement(tt,{checked:h,onChange:this.handleShowTSeparatorChange},"Show 'T' separator"))),a.createElement("div",{className:"form-row mb-2"},a.createElement("label",{className:"col-form-label col-3",htmlFor:"default-decimal-format-input"},"Decimal"),a.createElement("div",{className:"col pr-0"},a.createElement("input",{className:z("form-control","flex-grow-1","default-decimal-format-input",{"is-invalid":!pe.isValidFormat(de.dataType.DECIMAL,qe.makeCustomFormat(g))}),"data-lpignore":!0,placeholder:qe.DEFAULT_FORMAT_STRING,type:"text",id:"default-decimal-format-input",value:g,onChange:this.handleDefaultDecimalFormatChange})),a.createElement("div",{className:"col-1 btn-col"},a.createElement(X,{kind:"ghost",icon:Bt,onClick:this.handleResetDecimalFormat,tooltip:"Reset Decimal Formatting",className:z("btn-reset","btn-reset-decimal",{hidden:I})}))),a.createElement("div",{className:"form-row mb-2"},a.createElement("label",{className:"col-form-label col-3",htmlFor:"default-integer-format-input"},"Integer"),a.createElement("div",{className:"col pr-0"},a.createElement("input",{className:z("form-control","flex-grow-1","default-integer-format-input",{"is-invalid":!pe.isValidFormat(de.dataType.INT,je.makeCustomFormat(f))}),"data-lpignore":!0,placeholder:je.DEFAULT_FORMAT_STRING,type:"text",id:"default-integer-format-input",value:f,onChange:this.handleDefaultIntegerFormatChange})),a.createElement("div",{className:"col-1 btn-col"},a.createElement(X,{kind:"ghost",icon:Bt,onClick:this.handleResetIntegerFormat,tooltip:"Reset Integer Formatting",className:z("btn-reset","btn-reset-integer",{hidden:T})}))),a.createElement("div",{className:"form-row mb-3"},a.createElement("div",{className:"offset-3 col-9"},a.createElement(tt,{checked:m,onChange:this.handleTruncateNumbersWithPoundChange},"Truncate numbers with #")))),a.createElement("div",null,"Default formatting for matched column names"),a.createElement("div",{className:"app-settings-menu-description mb-3"},"Applies a formatting rule to all columns that match a specified name and type."),a.createElement(Jt.TransitionGroup,{appear:n,enter:n,exit:n},E),b)}};let Zt=pe;v(Zt,"inputDebounceTime",250);Zt.propTypes={formatter:u.exports.arrayOf(u.exports.shape({})).isRequired,defaultDateTimeFormat:u.exports.string.isRequired,showTimeZone:u.exports.bool.isRequired,showTSeparator:u.exports.bool.isRequired,timeZone:u.exports.string.isRequired,truncateNumbersWithPound:u.exports.bool.isRequired,settings:u.exports.shape({}).isRequired,saveSettings:u.exports.func.isRequired,scrollTo:u.exports.func,defaultDecimalFormatOptions:u.exports.shape({defaultFormatString:u.exports.string}).isRequired,defaultIntegerFormatOptions:u.exports.shape({defaultFormatString:u.exports.string}).isRequired,defaults:u.exports.shape({defaultDateTimeFormat:u.exports.string.isRequired,defaultDecimalFormatOptions:u.exports.shape({defaultFormatString:u.exports.string}).isRequired,defaultIntegerFormatOptions:u.exports.shape({defaultFormatString:u.exports.string}).isRequired,showTimeZone:u.exports.bool.isRequired,showTSeparator:u.exports.bool.isRequired,timeZone:u.exports.string.isRequired})};Zt.defaultProps={scrollTo:()=>{},defaults:{defaultDateTimeFormat:Ae.DEFAULT_DATETIME_FORMAT_STRING,defaultDecimalFormatOptions:{defaultFormatString:qe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:je.DEFAULT_FORMAT_STRING},showTimeZone:!1,showTSeparator:!0,timeZone:Ae.DEFAULT_TIME_ZONE_ID}};const Oh=l=>({formatter:zl(l),defaultDateTimeFormat:$l(l),defaultDecimalFormatOptions:Wl(l),defaultIntegerFormatOptions:Gl(l),showTimeZone:ql(l),showTSeparator:jl(l),truncateNumbersWithPound:Kl(l),timeZone:cs(l),settings:Fe(l)}),Uh=we(Oh,{saveSettings:ma})(Zt),Vh=()=>{const[l,s]=p.exports.useState(!1),e=()=>{s(!l)};return a.createElement("button",{type:"button",className:"btn btn-link",onClick:e},a.createElement(G,{icon:Ar}),"Legal Notices",a.createElement(js,{isOpen:l,toggle:e,className:"theme-bg-light"},a.createElement(Ks,{toggle:e},"Legal Notice"),a.createElement(Zs,null,a.createElement("p",null,"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."),a.createElement("p",null,"\xA9 2016-",new Date().getFullYear()," Deephaven Data Labs LLC. Patent Pending."))))},ns=l=>{const{children:s,isExpanded:e,sectionKey:n,title:t,onToggle:i}=l;return a.createElement(a.Fragment,null,a.createElement("div",null,a.createElement("button",{type:"button",className:"btn btn-link btn-collapse-trigger",onClick:()=>i(n)},a.createElement("div",{className:"flex-grow-1"},t),a.createElement("div",{className:"flex-shrink-0"},a.createElement(G,{transform:e?"flip-v":"",icon:Or})))),a.createElement(Ur,{in:e,autoFocusOnShow:!0},s))};ns.propTypes={children:u.exports.node,isExpanded:u.exports.bool.isRequired,sectionKey:u.exports.string.isRequired,title:u.exports.node.isRequired,onToggle:u.exports.func};ns.defaultProps={children:null,onToggle:()=>{}};function Bh({shortcut:l,displayText:s,categoryName:e,onChange:n}){const[t,i]=p.exports.useState(s),[o,r]=p.exports.useState(l.getKeyState()),[c,d]=p.exports.useState(!1),[h,m]=p.exports.useState("");p.exports.useEffect(function(){i(s),r(l.getKeyState())},[s,l]),p.exports.useEffect(function(){i(Ce.getDisplayText(o)),l.matchesKeyState(o)&&d(!1)},[o,l]),p.exports.useEffect(function(){if(c){if(!Ce.isValidKeyState(o)){Ce.isAllowedKey(o.keyValue)?m("Must contain a modifier key"):m("Must contain an allowed action key");return}const w=bn.getConflictingShortcuts(o).filter(_=>_.id.startsWith(e)&&_!==l).map(_=>_.name);if(w.length){m(`Conflicts with ${w.join(", ")}`);return}m("")}else m("")},[c,o,e,l]);function g(T){if(T.stopPropagation(),T.preventDefault(),l.isEditable&&!T.repeat){const w=Ce.getKeyStateFromEvent(T),_=Ce.createKeyState([Se.BACKSPACE]);Ce.doKeyStatesMatch(w,_)?r(Ce.NULL_KEY_STATE):r(w)}}function f(T){T.stopPropagation(),T.preventDefault(),l.matchesKeyState(o)||d(!0)}function E(){jn.disableAllActions()}function b(){jn.enableAllActions()}function y(){l.setKeyState(o),d(!1),n(l)}function C(){const T=l.getKeyState();r(T),d(!1)}function I(){d(!0),r(l.getDefaultKeyState())}return a.createElement(a.Fragment,null,a.createElement("div",{className:"shortcut-item-container"},a.createElement("label",{className:"shortcut-item-name"},l.name,l.tooltip&&a.createElement(Le,null,l.tooltip)),a.createElement("div",{className:"shortcut-item-input-container"},a.createElement("input",{className:z("form-control",{"is-invalid":h}),onKeyDown:g,onKeyUp:f,onFocus:E,onBlur:b,disabled:!l.isEditable,value:t,readOnly:!0}),!Ce.doKeyStatesMatch(o,l.getDefaultKeyState())&&!h&&a.createElement(X,{className:"reset-to-default-button",kind:"ghost",icon:a.createElement(G,{icon:Bt,transform:{rotate:90,flipX:!0}}),tooltip:"Reset to default",onClick:I}))),c&&a.createElement("div",{className:z("shortcut-item-message-container",{"is-invalid":h})},a.createElement("div",{className:"shortcut-item-message"},h),a.createElement("div",{className:"shortcut-item-message-buttons"},Ce.isValidKeyState(o)&&a.createElement(X,{kind:"ghost",onClick:y},"Confirm"),a.createElement(X,{kind:"ghost",onClick:C},"Undo"))))}function Hh({shortcutOverrides:l={},settings:s,saveSettings:e}){const n=p.exports.useCallback(r=>{const c=Ce.isMacPlatform,d={mac:{...l.mac},windows:{...l.windows}},h=c?d.mac:d.windows;r.forEach(m=>{m.isDefault()?delete h[m.id]:h[m.id]=m.getKeyState()}),e({...s,shortcutOverrides:d})},[s,e,l]);let t=Array.from(bn.shortcutsByCategory.entries()).map(([r,c])=>({name:r,shortcuts:c}));const i=t.findIndex(r=>r.name.toUpperCase()==="GLOBAL"),o=t.splice(i,1);return t=t.concat(o),a.createElement(a.Fragment,null,a.createElement("div",{className:"app-settings-menu-description"},"Customize shortcuts below. Assigning shortcuts that conflict with the browser or IDE shortcuts may cause unintended behavior"),t.map(r=>a.createElement($h,{key:r.name,name:r.name,shortcuts:r.shortcuts,saveShortcutOverrides:n})))}function $h({name:l,shortcuts:s,saveShortcutOverrides:e}){function n(c){return c.split("_").map(d=>`${d[0].toUpperCase()}${d.slice(1).toLowerCase()}`).join(" ")}const[t,i]=p.exports.useState(s);function o(c){const d=t.filter(m=>m!==c&&!m.isNull()&&m.matchesKeyState(c.getKeyState()));d.forEach(m=>m.setToNull());const h=[c,...d];e(h),i(m=>[...m])}const r=p.exports.useMemo(()=>t.map(c=>c.getDisplayText()),[t]);return a.createElement("div",{className:"mt-3"},a.createElement("div",{className:"font-weight-bold"},n(l)),t.map((c,d)=>a.createElement(Bh,{key:c.id,shortcut:c,displayText:r[d],categoryName:l,onChange:o})))}const Wh=l=>({settings:Fe(l),shortcutOverrides:Zl(l)}),Gh={saveSettings:ma},zh=we(Wh,Gh)(Hh),$s=new Ul,Ws=new Xn($s);function qh(){O.setLogLevel(parseInt("2",10)),$s.enable(),Ws.enable(),window&&(window.DHLog=O,window.DHLogProxy=$s,window.DHLogHistory=Ws)}const jh="yyyy-MM-dd-HHmmss";function Ba(l,s="root",e=new Map([[l,""]])){const n={};return Object.entries(l).forEach(([t,i])=>{try{JSON.stringify(i),n[t]=i}catch{const r=i;if(typeof i=="bigint")n[t]=i.toString();else if(e.has(r))n[t]=`Circular ref to ${e.get(r)}`;else{const c=`${s}.${t}`;e.set(r,c),n[t]=Ba(i,c,e)}}}),n}function Kh(){const l=us.getState();return JSON.stringify(Ba(l),null,2)}function Zh(){const l={uiVersion:"",userAgent:navigator.userAgent};return JSON.stringify(l,null,2)}async function Yh(l=`${S.i18n.DateTimeFormat.format(jh,new Date)}_support_logs`){const s=new Jo,e=s.folder(l);e.file("console.txt",Ws.getFormattedHistory()),e.file("redux.json",Kh()),e.file("metadata.json",Zh());const n=await s.generateAsync({type:"blob"}),t=document.createElement("a");t.href=URL.createObjectURL(n),t.download=`${l}.zip`,t.click()}const at=class extends p.exports.Component{static focusFirstInputInContainer(s){const e=s.querySelector("input, select, textarea");e&&e.focus()}static handleExportSupportLogs(){Yh()}constructor(s){super(s),this.handleClose=this.handleClose.bind(this),this.handleScrollTo=this.handleScrollTo.bind(this),this.handleSectionToggle=this.handleSectionToggle.bind(this),this.menuContentRef=a.createRef(),this.state={expandedSectionKey:at.FORMATTING_SECTION_KEY}}componentDidMount(){at.focusFirstInputInContainer(this.menuContentRef.current)}isSectionExpanded(s){const{expandedSectionKey:e}=this.state;return e===s}handleScrollTo(s,e){this.menuContentRef.current.scrollTo(s,e)}handleSectionToggle(s){this.setState(e=>({expandedSectionKey:e.expandedSectionKey===s?null:s}))}handleClose(){const{onDone:s}=this.props;s()}render(){const s="",e="https://github.com/deephaven/web-client-ui/",n="https://deephaven.io/core/docs/";return a.createElement("div",{className:"app-settings-menu"},a.createElement("header",{className:"app-settings-menu-header"},a.createElement("div",{className:"flex-spacer"}),a.createElement("button",{type:"button",className:"btn btn-link btn-link-icon btn-close-settings-menu",onClick:this.handleClose},a.createElement(G,{icon:Vr,transform:"grow-4"}))),a.createElement("div",{className:"app-settings-menu-content",ref:this.menuContentRef},a.createElement("h5",null,"Settings"),a.createElement("hr",{className:"my-0"}),a.createElement(ns,{sectionKey:at.FORMATTING_SECTION_KEY,isExpanded:this.isSectionExpanded(at.FORMATTING_SECTION_KEY),title:a.createElement(a.Fragment,null,a.createElement(G,{icon:Br,transform:"grow-4",className:"mr-2"}),"Formatting & Time zone"),onToggle:this.handleSectionToggle},a.createElement(Uh,{scrollTo:this.handleScrollTo})),a.createElement(ns,{sectionKey:at.SHORTCUT_SECTION_KEY,isExpanded:this.isSectionExpanded(at.SHORTCUT_SECTION_KEY),title:a.createElement(a.Fragment,null,a.createElement(G,{icon:Hr,transform:"grow-2"})," ","Keyboard Shortcuts"),onToggle:this.handleSectionToggle},a.createElement(zh,null)),a.createElement("div",{className:"app-settings-footer"},a.createElement("div",{className:"app-settings-footer-section"},a.createElement("div",{className:"app-settings-footer-item"},a.createElement("div",{className:"font-weight-bold"},"Support"),a.createElement("div",null,"GitHub:\xA0",a.createElement("a",{href:e,className:"custom-link",target:"_blank",rel:"noopener noreferrer"},e)),a.createElement("button",{type:"button",className:"btn btn-secondary mt-2 py-2",onClick:at.handleExportSupportLogs},"Export Logs")),a.createElement("div",{className:"app-settings-footer-item"},a.createElement("div",{className:"font-weight-bold"},"Documentation"),a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:n,className:"custom-link"},n)),a.createElement("div",{className:"app-settings-footer-item"},a.createElement("div",{className:"text-muted"},"Version ",s)),a.createElement("div",{className:"app-settings-footer-item"},a.createElement(Vh,null))),a.createElement("div",{className:"app-settings-footer-section"},a.createElement("div",{className:"logo"},a.createElement("a",{target:"_blank",rel:"noreferrer noopener",href:"https://deephaven.io",className:"d-inline-block custom-link p-1"},a.createElement("img",{src:Va,alt:"Deephaven Data Labs",width:"230px"})))))))}};let Ct=at;v(Ct,"FORMATTING_SECTION_KEY","SettingsMenu.formatting"),v(Ct,"APPLICATION_SECTION_KEY","ApplicationMenu.settings"),v(Ct,"SHORTCUT_SECTION_KEY","SettingsMenu.shortcuts");Ct.propTypes={onDone:u.exports.func};Ct.defaultProps={onDone:()=>{}};const yo=10,Wt=l=>{const{forwardedProps:{menuItem:{action:s,title:e,disabled:n},iconElement:t,displayShortcut:i,isMouseSelected:o,isKeyboardSelected:r,closeMenu:c}}=l,d=p.exports.useRef(),h=p.exports.useRef(),m=p.exports.useRef(null),[g,f]=p.exports.useState(!1),E=p.exports.useCallback(C=>{m.current&&(Math.abs(d.current-C.clientX)>=yo||Math.abs(h.current-C.clientY)>=yo)&&(f(!0),window.removeEventListener("mousemove",E),c(),s(C),m.current=null)},[s,c]);function b(C){d.current=C.clientX,h.current=C.clientY,m.current=C.target,window.addEventListener("mousemove",E)}function y(C){m.current===C.target&&(f(!0),c(),s(),window.removeEventListener("mousemove",E)),m.current=null}return p.exports.useEffect(function(){return function(){return window.removeEventListener("mousemove",E)}},[E]),a.createElement("button",{type:"button",className:z("btn-context-menu",{disabled:n},{active:o&&!n},{"keyboard-active":r&&!n}),onMouseDown:b,onMouseUp:y,disabled:g},a.createElement("span",{className:z("icon")},t),a.createElement("span",{className:"title"},e),a.createElement("span",{className:"shortcut"},i))},Ii=l=>{const{handleControlSelect:s,handleToolSelect:e,onClearFilter:n}=l,t=p.exports.useMemo(()=>[{title:"Input Filter",icon:$r,menuElement:a.createElement(Wt,null),action:(i=null)=>{s($e.INPUT_FILTER,i)},order:10},{title:"Dropdown Filter",icon:Wr,menuElement:a.createElement(Wt,null),action:(i=null)=>{s($e.DROPDOWN_FILTER,i)},order:15},{title:"Markdown Widget",icon:Gr,menuElement:a.createElement(Wt,null),action:(i=null)=>{s($e.MARKDOWN,i)},order:20},{title:"Filter Sets",icon:Ps,menuElement:a.createElement(Wt,null),action:(i=null)=>{s($e.FILTER_SET_MANAGER,i)},order:25},{disabled:!0,menuElement:a.createElement("div",{className:"context-menu-group-header"},"Tools"),order:30},{title:"Linker",icon:zr,action:()=>{e(Ue.LINKER)},order:40,shortcut:Sn.LINKER},{disabled:!0,menuElement:a.createElement("div",{className:"context-menu-group-header"},"Actions"),order:50},{title:"Clear All Filters",icon:qr,action:()=>{n()},order:60,shortcut:Go.TABLE.CLEAR_ALL_FILTERS}],[s,e,n]);return a.createElement(Kn,{popperClassName:"controls-menu-popper",actions:t})};Ii.propTypes={handleControlSelect:u.exports.func,handleToolSelect:u.exports.func,onClearFilter:u.exports.func};Ii.defaultProps={handleControlSelect:()=>{},handleToolSelect:()=>{},onClearFilter:()=>{}};Wt.propTypes={forwardedProps:u.exports.shape({iconElement:u.exports.node,displayShortcut:u.exports.string,isMouseSelected:u.exports.bool.isRequired,isKeyboardSelected:u.exports.bool.isRequired,closeMenu:u.exports.func.isRequired,menuItem:u.exports.shape({action:u.exports.func,title:u.exports.string,disabled:u.exports.bool}).isRequired})};Wt.defaultProps={forwardedProps:null};const Xh=Mt(Ua,null),Jh={layoutStorage:Xh},Qh=l=>l.layoutStorage;Object.entries(Jh).map(([l,s])=>tn.register(l,s));const wo=10,eu=l=>{const{onExportLayout:s,onImportLayout:e,onResetLayout:n,onSelect:t,widgets:i=[]}=l,[o,r]=p.exports.useState(!1),[c,d]=p.exports.useState(""),h=p.exports.useRef(null),m=p.exports.useRef(),g=p.exports.useCallback((w,_)=>{w&&t(w,_)},[t]),f=p.exports.useCallback(w=>{d(w.target.value)},[]),E=p.exports.useCallback(w=>{m.current!=null&&(Math.abs(m.current.x-w.clientX)>=wo||Math.abs(m.current.y-w.clientY)>=wo)&&(r(!0),window.removeEventListener("mousemove",E),g(m.current.widget,w),m.current=void 0)},[m,g]),b=p.exports.useCallback((w,_)=>{m.current={x:w.clientX,y:w.clientY,widget:_},window.addEventListener("mousemove",E)},[E]),y=p.exports.useCallback((w,_)=>{var L;window.removeEventListener("mousemove",E),((L=m.current)==null?void 0:L.widget)===_&&(r(!0),g(_)),m.current=void 0},[E,m,g]),C=p.exports.useMemo(()=>i.filter(w=>{var _;return c?(_=w.name)==null?void 0:_.toLowerCase().includes(c.toLowerCase()):!0}),[c,i]).sort((w,_)=>{var L,D,P;return(P=(D=w.name)==null?void 0:D.localeCompare((L=_.name)!=null?L:""))!=null?P:0}),I=p.exports.useMemo(()=>C.map(w=>{var _,L;return a.createElement("li",{key:w.name},a.createElement("button",{type:"button",className:"btn btn-link","data-testid":`panel-list-item-${(_=w.name)!=null?_:""}-button`,onMouseDown:D=>{b(D,w)},onMouseUp:D=>{y(D,w)},onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&g(w)},disabled:o},a.createElement(jr,{type:w.type})," ",(L=w.name)!=null?L:""))}),[C,o,b,y,g]),T=p.exports.useMemo(()=>I.length===0?a.createElement("span",null,"No bound variables found."):null,[I]);return a.createElement("div",{className:"widget-list-container d-flex flex-column"},a.createElement("div",{className:"widget-list-header"},a.createElement(zo,{value:c,placeholder:"Find Table, Plot or Widget",onChange:f,ref:h})),a.createElement("ul",{className:"widget-list flex-grow-1"},T&&a.createElement("li",{className:"widget-list-message"},T),!T&&I),a.createElement("div",null,a.createElement("hr",null)),a.createElement("div",{className:"widget-list-footer"},a.createElement(X,{kind:"ghost",onClick:s},a.createElement("div",{className:"fa-md fa-layers"},a.createElement(G,{mask:$i,icon:Wi,transform:"right-5 down-5"}),a.createElement(G,{icon:Wi,transform:"right-8 down-6"})),"Export Layout"),a.createElement(X,{kind:"ghost",onClick:e},a.createElement("div",{className:"fa-md fa-layers"},a.createElement(G,{mask:$i,icon:Rs,transform:"right-5 down-5"}),a.createElement(G,{icon:Rs,transform:"right-8 down-6"})),"Import Layout"),a.createElement(X,{kind:"ghost",icon:Bt,onClick:n,tooltip:"Reset Layout"})))},tu=async(l,s,e)=>{let{settings:n={},table:t="",figure:i="",tableSettings:o={}}=s;if(e&&(e.tableSettings&&(o=e.tableSettings),e.table&&(t=e.table),e.figure&&(i=e.figure),e.settings&&(n={...n,...e.settings})),i){const d={name:i,type:S.VariableType.FIGURE},h=await l.getObject(d);return Qt.makeModel(n,h)}const r={name:t,type:S.VariableType.TABLE},c=await l.getObject(r);return ge.applyTableSettings(c,o,cs(us.getState())),Qt.makeModelFromSettings(n,c)},nu=async(l,s,e=S.VariableType.TABLE)=>{const{table:n}=s,t={name:n,type:e},i=await l.getObject(t);return Qs.makeModel(i)};const su=({onAutoFillClick:l=()=>{}})=>a.createElement("div",{className:"empty-dashboard-container"},a.createElement("div",{className:"hint-container"},a.createElement(G,{icon:Kr})," ",a.createElement("br",null),"Use the panel list to add objects from a query."),a.createElement("div",{className:"empty-dashboard"},a.createElement("div",{className:"add-panels-hint"},"Drag Panels Here"),a.createElement(X,{kind:"tertiary",onClick:l},"Auto fill objects")));function iu(l){return l.version===2}function ou(l){return Array.isArray(l)}const Un=O.module("UserLayoutUtils"),au={layoutConfig:[{type:"column",content:[{type:"row",content:[{type:"stack",content:[{type:"react-component",component:$t.COMPONENT,title:$t.TITLE,isClosable:!1},{type:"react-component",component:ts.COMPONENT,title:ts.TITLE,isClosable:!1}]},{type:"stack",width:25,content:[{type:"react-component",component:Jn.COMPONENT,title:Jn.TITLE,isClosable:!1},{type:"react-component",component:Qn.COMPONENT,title:Qn.TITLE,isClosable:!1}]}]},{type:"row",content:[{type:"stack",title:"Notebooks",content:[]}]}]}],links:[],filterSets:[],version:2};function Ha(l){if(iu(l))return l;if(ou(l))return{layoutConfig:l,links:[],filterSets:[],version:2};throw new Error(`Unexpected layout import format: ${l}`)}async function ru(l){try{const s=await l.getLayouts();if(s.length>0)try{const e=await l.getLayout(s[0]);return Ha(e)}catch(e){Un.error("Unable to load layout",s[0],":",e),Un.warn("No valid layouts found, falling back to default layout")}}catch(s){Un.error("Unable to fetch layout list",s),Un.warn("Falling back to default layout")}return au}function lu(l){const{filterSets:s,layoutConfig:e,links:n}=l;return{filterSets:s,layoutConfig:e,links:n,version:2}}const zn={exportLayout:lu,getDefaultLayout:ru,normalizeLayout:Ha},Vn=O.module("DownloadServiceWorkerUtils"),ki=class{static registerOnLoaded(){new URL({VITE_CORE_API_URL:"/jsapi",VITE_CORE_API_NAME:"dh-core.js",VITE_OPEN_API_NAME:"dh-internal.js",VITE_VERSION:"",VITE_NAME:"",VITE_PLUGIN_URL:"/ide/plugins/",VITE_NOTEBOOKS_URL:"/notebooks",VITE_LAYOUTS_URL:"/layouts",VITE_ENABLE_LOG_PROXY:"true",VITE_SUPPORT_LINK:"https://github.com/deephaven/web-client-ui/",VITE_DOCS_LINK:"https://deephaven.io/core/docs/",VITE_FAVICON:"/favicon-cc-app.svg",VITE_BUILD_PATH:"./build",VITE_LOG_LEVEL:"2",VITE_COMPONENT_PLUGINS_URL:"/ide/plugins/",VITE_INTERNAL_COMPONENT_PLUGINS:"",VITE_MODULE_PLUGINS_URL:"/js-plugins",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}.PUBLIC_URL,window.location.href).origin===window.location.origin&&("serviceWorker"in navigator?window.addEventListener("load",()=>{const e=new URL(`${{VITE_CORE_API_URL:"/jsapi",VITE_CORE_API_NAME:"dh-core.js",VITE_OPEN_API_NAME:"dh-internal.js",VITE_VERSION:"",VITE_NAME:"",VITE_PLUGIN_URL:"/ide/plugins/",VITE_NOTEBOOKS_URL:"/notebooks",VITE_LAYOUTS_URL:"/layouts",VITE_ENABLE_LOG_PROXY:"true",VITE_SUPPORT_LINK:"https://github.com/deephaven/web-client-ui/",VITE_DOCS_LINK:"https://deephaven.io/core/docs/",VITE_FAVICON:"/favicon-cc-app.svg",VITE_BUILD_PATH:"./build",VITE_LOG_LEVEL:"2",VITE_COMPONENT_PLUGINS_URL:"/ide/plugins/",VITE_INTERNAL_COMPONENT_PLUGINS:"",VITE_MODULE_PLUGINS_URL:"/js-plugins",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}.PUBLIC_URL?`${{VITE_CORE_API_URL:"/jsapi",VITE_CORE_API_NAME:"dh-core.js",VITE_OPEN_API_NAME:"dh-internal.js",VITE_VERSION:"",VITE_NAME:"",VITE_PLUGIN_URL:"/ide/plugins/",VITE_NOTEBOOKS_URL:"/notebooks",VITE_LAYOUTS_URL:"/layouts",VITE_ENABLE_LOG_PROXY:"true",VITE_SUPPORT_LINK:"https://github.com/deephaven/web-client-ui/",VITE_DOCS_LINK:"https://deephaven.io/core/docs/",VITE_FAVICON:"/favicon-cc-app.svg",VITE_BUILD_PATH:"./build",VITE_LOG_LEVEL:"2",VITE_COMPONENT_PLUGINS_URL:"/ide/plugins/",VITE_INTERNAL_COMPONENT_PLUGINS:"",VITE_MODULE_PLUGINS_URL:"/js-plugins",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}.PUBLIC_URL}`:""}download/serviceWorker.js`,window.location.href);navigator.serviceWorker.register(e).then(n=>{n.update(),Vn.info("Registering service worker on ",e,n)}).catch(n=>{Vn.error("Failed to register service worker",n)})}):Vn.info("Service worker is not supported."))}static async getServiceWorker(){if("serviceWorker"in navigator){const e=(await navigator.serviceWorker.getRegistrations()).find(n=>n.scope.endsWith(ki.DOWNLOAD_PATH));if(e&&e.active)return Vn.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 Yt=ki;v(Yt,"DOWNLOAD_PATH","/download/");const $a={react:a},cu=yl($a),du=wl({requires:cu}),hu=vl.createRequires($a),uu=Tl({requires:hu}),mu=O.module("PluginUtils");class Gs{static loadComponentPlugin(s){if("".split(",").includes(s)){const i=a.lazy(()=>Fl(()=>import(`./internal/${s}`),[])),o=a.forwardRef((r,c)=>a.createElement(p.exports.Suspense,{fallback:a.createElement("div",null,"Loading Plugin...")},a.createElement(i,{ref:c,...r})));return o.pluginName=s,o.displayName="Local Plugin",o}const e=new URL("/ide/plugins/",window.location),n=new URL(`${s}.js`,e),t=a.forwardRef((i,o)=>a.createElement(du,{url:n,render:({err:r,Component:c})=>{if(r){const d=`Error loading plugin ${s} from ${n} due to ${r}`;return mu.error(d),a.createElement("div",{className:"error-message"},`${d}`)}return a.createElement(c,{ref:o,...i})}}));return t.pluginName=s,t.displayName="Plugin",t}static async loadModulePlugin(s){return await uu(s)}static async loadJson(s){return new Promise((e,n)=>{const t=new XMLHttpRequest;t.addEventListener("load",()=>{try{const i=JSON.parse(t.responseText);e(i)}catch(i){n(i)}}),t.addEventListener("error",i=>{n(i)}),t.open("GET",s),t.send()})}}const Ne=O.module("AppMainContainer");class Xt extends p.exports.Component{constructor(e){super(e);v(this,"getDashboardPlugins",te(e=>[...e.entries()].filter(([,{DashboardPlugin:n}])=>n).map(([n,{DashboardPlugin:t}])=>a.createElement(t,{key:n}))));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.goldenLayout=null,this.importElement=a.createRef(),this.widgetListenerRemover=null,this.state={contextActions:[{action:()=>{this.handleToolSelect(Ue.LINKER)},shortcut:Sn.LINKER,isGlobal:!0},{action:()=>{this.sendClearFilter()},shortcut:Go.TABLE.CLEAR_ALL_FILTERS,isGlobal:!0},{action:()=>{Ne.debug("Consume unhandled save shortcut")},shortcut:Sn.SAVE,isGlobal:!0}],isPanelsMenuShown:!1,isSettingsMenuShown:!1,widgets:[]}}static handleWindowBeforeUnload(e){e.preventDefault(),e.returnValue=""}static hydrateConsole(e,n){return Qi.hydrate({...e,unzip:t=>Jo.loadAsync(t).then(i=>Object.values(i.files))},n)}componentDidMount(){this.initWidgets(),window.addEventListener("beforeunload",Xt.handleWindowBeforeUnload)}componentDidUpdate(e){const{dashboardData:n}=this.props;e.dashboardData!==n&&this.handleDataChange(n)}componentWillUnmount(){this.deinitWidgets(),window.removeEventListener("beforeunload",Xt.handleWindowBeforeUnload)}initWidgets(){const{session:e}=this.props;if(!e.connection.subscribeToFieldUpdates){Ne.warn("subscribeToFieldUpdates not supported, not initializing widgets");return}this.widgetListenerRemover=e.connection.subscribeToFieldUpdates(n=>{Ne.debug("Got updates",n),this.setState(({widgets:t})=>{const{updated:i,created:o,removed:r}=n,c=[...i,...r],d=t.filter(m=>!c.some(g=>g.name===m.name));return[...i,...o].forEach(m=>{m.name&&d.push(m)}),{widgets:d}})})}deinitWidgets(){var e;(e=this.widgetListenerRemover)==null||e.call(this)}openNotebookFromURL(){const{match:e}=this.props,{notebookPath:n}=e.params;if(n){const t={id:`/${n}`,itemName:`/${n}`},{session:i,sessionConfig:o}=this.props,r=o.type,c={value:null,language:r};this.emitLayoutEvent(ee.SELECT_NOTEBOOK,i,r,c,t,!0)}}sendClearFilter(){this.emitLayoutEvent(J.CLEAR_ALL_FILTERS)}emitLayoutEvent(e,...n){var t;(t=this.goldenLayout)==null||t.eventHub.emit(e,...n)}handleError(e){le.isCanceled(e)||Ne.error(e)}handleSettingsMenuHide(){this.setState({isSettingsMenuShown:!1})}handleSettingsMenuShow(){this.setState({isSettingsMenuShown:!0})}handleControlSelect(e,n=null){switch(Ne.debug("handleControlSelect",e),e){case $e.DROPDOWN_FILTER:this.emitLayoutEvent(J.OPEN_DROPDOWN,{title:"DropdownFilter",type:e,createNewStack:!0,dragEvent:n});break;case $e.INPUT_FILTER:this.emitLayoutEvent(J.OPEN_INPUT,{title:"InputFilter",type:e,createNewStack:!0,dragEvent:n});break;case $e.MARKDOWN:this.emitLayoutEvent(va.OPEN,{title:"Markdown",type:e,dragEvent:n});break;case $e.FILTER_SET_MANAGER:this.emitLayoutEvent(J.OPEN_FILTER_SET_MANAGER,{title:"FilterSets",type:e,dragEvent:n});break;default:throw new Error("Unrecognized control type",e)}}handleToolSelect(e){Ne.debug("handleToolSelect",e);const{activeTool:n,setActiveTool:t}=this.props;t(n===e?Ue.DEFAULT:e)}handleClearFilter(){this.sendClearFilter()}handleDataChange(e){const{updateWorkspaceData:n}=this.props,{closed:t,filterSets:i,links:o}=e;n({closed:t,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}),Ne.debug("handleWidgetSelect",e,n),this.openWidget(e,n)}handleWidgetsMenuClose(){this.setState({isPanelsMenuShown:!1})}handleAutoFillClick(){const{widgets:e}=this.state;Ne.debug("handleAutoFillClick",e);const n=e.sort((t,i)=>t.name.localeCompare(i.name));for(let t=0;t<n.length;t+=1)this.openWidget(n[t])}handleExportLayoutClick(){Ne.info("handleExportLayoutClick"),this.setState({isPanelsMenuShown:!1});try{const{workspace:e}=this.props,{data:n}=e,t=zn.exportLayout(n);Ne.info("handleExportLayoutClick exportedConfig",t);const i=new Blob([JSON.stringify(t)],{mimeType:"application/json"}),o=S.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){Ne.error("Unable to export layout",e)}}handleImportLayoutClick(){Ne.info("handleImportLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.importElement.current.value="",this.importElement.current.click()}handleResetLayoutClick(){Ne.info("handleResetLayoutClick"),this.setState({isPanelsMenuShown:!1}),this.resetLayout()}handleImportLayoutFiles(e){e.stopPropagation(),e.preventDefault(),this.importLayoutFile(e.target.files[0])}async importLayoutFile(e){try{const{updateDashboardData:n,updateWorkspaceData:t}=this.props,i=await e.text(),o=JSON.parse(i),{filterSets:r,layoutConfig:c,links:d}=zn.normalizeLayout(o);t({layoutConfig:c}),n(St,{filterSets:r,links:d})}catch(n){Ne.error("Unable to import layout",n)}}async resetLayout(){const{layoutStorage:e}=this.props,{filterSets:n,layoutConfig:t,links:i}=await zn.getDefaultLayout(e),{updateDashboardData:o,updateWorkspaceData:r}=this.props;r({layoutConfig:t}),o(St,{filterSets:n,links:i})}handlePaste(e){let n=e.target.parentElement;for(;n!=null;){if(n.classList.contains("monaco-editor"))return;n=n.parentElement}const i=(e.clipboardData||window.clipboardData).getData("Text"),o=/“|”/g;o.test(i)&&(e.preventDefault(),e.stopPropagation(),document.execCommand("insertText",!1,i.replace(o,'"')))}handleLoadTablePlugin(e){const{plugins:n}=this.props,t=n.get(e);return t!=null&&t.TablePlugin?t.TablePlugin:Gs.loadComponentPlugin(e)}hydrateDefault(e,n){const{session:t}=this.props,{metadata:i}=e;if((i==null?void 0:i.type)&&((i==null?void 0:i.id)||(i==null?void 0:i.name))){const o=i.id?{type:i.type,id:i.id}:{type:i.type,name:i.name};return{fetch:()=>t.getObject(o),localDashboardId:n,...e}}return Qi.hydrate(e,n)}hydrateGrid(e,n){return this.hydrateTable(e,n,S.VariableType.TABLE)}hydratePandas(e,n){return this.hydrateTable(e,n,S.VariableType.PANDAS)}hydrateTable(e,n,t=S.VariableType.TABLE){const{session:i}=this.props;return{...e,getDownloadWorker:Yt.getServiceWorker,loadPlugin:this.handleLoadTablePlugin,localDashboardId:n,makeModel:()=>nu(i,e.metadata,t)}}hydrateChart(e,n){const{session:t}=this.props;return{...e,localDashboardId:n,makeModel:()=>{const{metadata:i,panelState:o}=e;return tu(t,i,o)}}}openWidget(e,n){const{session:t}=this.props;this.emitLayoutEvent(Y.OPEN,{dragEvent:n,fetch:()=>t.getObject(e),widget:e})}render(){const{activeTool:e,plugins:n,user:t,workspace:i}=this.props,{data:o={}}=i,{layoutConfig:r}=o,{permissions:c}=t,{canUsePanels:d}=c,{contextActions:h,isPanelsMenuShown:m,isSettingsMenuShown:g,widgets:f}=this.state,E=this.getDashboardPlugins(n);return a.createElement("div",{className:z("app-main-tabs","w-100","h-100","d-flex","flex-column",e?`active-tool-${e.toLowerCase()}`:""),onPaste:this.handlePaste,tabIndex:-1},a.createElement("nav",{className:"nav-container"},a.createElement("div",{className:"app-main-top-nav-menus"},a.createElement("img",{src:Va,alt:"Deephaven Data Labs",width:"115px",className:"ml-1"}),a.createElement("div",null,a.createElement("button",{type:"button",className:"btn btn-link btn-panels-menu"},a.createElement(G,{icon:Zr}),"Controls",a.createElement(Ii,{handleControlSelect:this.handleControlSelect,handleToolSelect:this.handleToolSelect,onClearFilter:this.handleClearFilter})),d&&a.createElement("button",{type:"button",className:"btn btn-link btn-panels-menu btn-show-panels","data-testid":"app-main-panels-button",onClick:this.handleWidgetMenuClick},a.createElement(G,{icon:Yr}),"Panels",a.createElement(qs,{isShown:m,className:"panels-menu-popper",onExited:this.handleWidgetsMenuClose,closeOnBlur:!0,interactive:!0},a.createElement(eu,{widgets:f,onExportLayout:this.handleExportLayoutClick,onImportLayout:this.handleImportLayoutClick,onResetLayout:this.handleResetLayoutClick,onSelect:this.handleWidgetSelect}))),a.createElement("button",{type:"button",className:z("btn btn-link btn-link-icon btn-settings-menu",{"text-warning":t.operateAs!==t.name}),onClick:this.handleSettingsMenuShow},a.createElement(G,{icon:rs,transform:"grow-3 right-1 down-1"}),a.createElement(Le,null,"User Settings"))))),a.createElement(ud,{emptyDashboard:a.createElement(su,{onAutoFillClick:this.handleAutoFillClick}),id:St,layoutConfig:r,onGoldenLayoutChange:this.handleGoldenLayoutChange,onLayoutConfigChange:this.handleLayoutConfigChange,onLayoutInitialized:this.openNotebookFromURL,hydrate:this.hydrateDefault},a.createElement(Dh,{hydrate:this.hydrateGrid,getDownloadWorker:Yt.getServiceWorker,loadPlugin:this.handleLoadTablePlugin}),a.createElement(wh,{hydrate:this.hydrateChart}),a.createElement(vh,null),a.createElement(_h,{hydrateConsole:Xt.hydrateConsole,notebooksUrl:new URL("/notebooks/",window.location).href}),a.createElement(Ih,null),a.createElement(Mh,{hydrate:this.hydratePandas}),a.createElement(kh,null),a.createElement(Rh,null),E),a.createElement(Jt.CSSTransition,{in:g,timeout:En.transitionMidMs,classNames:"slide-left",mountOnEnter:!0,unmountOnExit:!0},a.createElement(Ct,{onDone:this.handleSettingsMenuHide})),a.createElement(re,{actions:h}),a.createElement("input",{ref:this.importElement,type:"file",accept:".json",style:{display:"none"},onChange:this.handleImportLayoutFiles}))}}Xt.propTypes={activeTool:u.exports.string.isRequired,dashboardData:u.exports.shape({}).isRequired,layoutStorage:u.exports.shape({}).isRequired,match:u.exports.shape({params:u.exports.shape({notebookPath:u.exports.string})}).isRequired,session:yt.IdeSession.isRequired,sessionConfig:u.exports.shape({type:u.exports.string,id:u.exports.string}).isRequired,setActiveTool:u.exports.func.isRequired,updateDashboardData:u.exports.func.isRequired,updateWorkspaceData:u.exports.func.isRequired,user:ct.User.isRequired,workspace:u.exports.shape({data:u.exports.shape({data:u.exports.shape({}),filterSets:u.exports.arrayOf(u.exports.shape({})),layoutConfig:u.exports.arrayOf(u.exports.shape({})),settings:u.exports.shape({}),links:u.exports.arrayOf(u.exports.shape({}))})}).isRequired,plugins:u.exports.instanceOf(Map).isRequired};const pu=l=>({activeTool:ds(l),dashboardData:Ve(l,St),layoutStorage:Qh(l),plugins:Yl(l),session:kt(l,St).session,sessionConfig:kt(l,St).config,user:na(l),workspace:_n(l)}),gu=we(pu,{setActiveTool:hs,updateDashboardData:ht,updateWorkspaceData:ua})(_l(Xt)),fu=()=>a.createElement("div",{className:"app"},a.createElement(gu,null),a.createElement(Js,null));O.module("StorageTableViewportUpdater");class vo{static makeSortConfig(s,e){return{column:s,direction:e}}static makeFilterConfig(s){const e=[],n=[];return s.forEach((t,i)=>{e.push(t),i>0&&n.push(Zn.and)}),{filterItems:e,filterOperators:n}}static combineFilterConfigs(s,e,n=Zn.and){return{filterItems:[...s.filterItems,...e.filterItems],filterOperators:[...s.filterOperators,n,...e.filterOperators]}}static makeFilterItem(s,e,n){return{columnName:s,type:e,value:n}}}const _s=O.module("PouchStorageTable"),Eu="Deephaven.";Qo.plugin(Il);function bu(l,s){switch(l){case Ge.in:case Ge.contains:return{$regex:new RegExp(`${s}`)};case Ge.inIgnoreCase:return{$regex:new RegExp(`${s}`,"i")};case Ge.eq:return{$eq:s};case Ge.notEq:return{$neq:s};case Ge.greaterThan:return{$gt:s};case Ge.greaterThanOrEqualTo:return{$gte:s};case Ge.lessThan:return{$lt:s};case Ge.lessThanOrEqualTo:return{$lte:s};case Ge.startsWith:return{$regex:new RegExp(`^(?${s}).*`)};default:throw new Error(`Unsupported type: ${l}`)}}function Cu(l){const{filterItems:s,filterOperators:e}=l;let n=null;for(let t=0;t<s.length;t+=1){const i=s[t],{columnName:o,type:r,value:c}=i,d={[o]:bu(r,c)};if(t===0)n=d;else if(n!==null&&t-1<e.length){const h=e[t-1];if(h===Zn.and)n={$and:[n,d]};else if(h===Zn.or)n={$or:[n,d]};else throw new Error(`Unexpected filter operator ${h}, ${d}`)}}if(n==null)throw new Error(`Invalid filter config ${l}`);return n}function Is(l=[]){return{$and:[...l.map(s=>Cu(s)),{name:{$gt:null}},{id:{$gt:null}}]}}function Su(l,s=!1){var e;return[{id:s?"desc":"asc"},...(e=l==null?void 0:l.map(n=>({[n.column]:n.direction})))!=null?e:[]]}class yu{constructor(s){this.listeners=[],this.itemListeners=new Map,this.currentSize=0,this.currentReverse=!1,this.currentFilter=null,this.currentSort=null,this.db=new Qo(`${Eu}${s}`),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(s){return this.listeners=[...this.listeners,s],()=>{this.listeners=this.listeners.filter(e=>e!==s)}}onItemUpdate(s,e){return this.itemListeners.has(s)||this.itemListeners.set(s,[]),this.itemListeners.set(s,[...this.itemListeners.get(s),e]),this.refreshItem(s),()=>{this.itemListeners.set(s,this.itemListeners.get(s).filter(n=>n!==e))}}close(){this.listeners=[]}get size(){return this.currentSize}get viewport(){return this.currentViewport}setReversed(s){this.currentReverse=s,this.currentViewportData=void 0,this.refreshData()}setViewport(s){this.currentViewport=s,this.refreshInfo(),this.refreshData()}setSorts(s){this.currentSort=s,this.currentViewportData=void 0,this.refreshData()}setFilters(s){this.currentFilter=s,this.currentViewportData=void 0,this.refreshInfo(),this.refreshData()}get data(){return this.currentViewportData}async getViewportData(){var s;return this.viewportUpdatePromise||this.refreshData(),(s=this.viewportUpdatePromise)!=null?s:Promise.resolve({items:[],offset:0})}async put(s){const e={...s,_id:s.id};return await this.db.put(e),e}sendUpdate(){var n;const{listeners:s}=this,e=(n=this.currentViewportData)!=null?n:{items:[],offset:0};for(let t=0;t<s.length;t+=1)s[t](e)}sendItemUpdate(s){const e=this.itemListeners.get(s.id);if(e!==void 0)for(let n=0;n<e.length;n+=1)e[n](s)}dbUpdate(s){_s.debug("Update received",s),this.refreshInfo(),s.doc!==void 0&&this.sendItemUpdate(s.doc),this.refreshData()}async refreshInfo(){var s,e;try{(s=this.infoUpdatePromise)==null||s.cancel(),this.infoUpdatePromise=le.makeCancelable(this.db.find({selector:Is((e=this.currentFilter)!=null?e:[]),fields:[]}));const n=await this.infoUpdatePromise;this.currentSize=n.docs.length,this.sendUpdate()}catch(n){if(!le.isCanceled(n))throw _s.error("Unable to refreshInfo",n),n}}async refreshData(){var s,e;if(!!this.currentViewport)try{const{currentViewport:n}=this,t=Su(this.currentSort,this.currentReverse);(s=this.viewportUpdatePromise)==null||s.cancel(),this.viewportUpdatePromise=le.makeCancelable(this.db.find({selector:Is((e=this.currentFilter)!=null?e:[]),skip:n.top,limit:n.bottom-n.top+1,sort:t,fields:["id","name"]}).then(o=>({items:o.docs,offset:n.top})));const i=await this.viewportUpdatePromise;return this.currentViewportData=i,this.sendUpdate(),i}catch(n){if(!le.isCanceled(n))throw _s.error("Unable to refreshData",n),n}}async refreshItem(s){const n=(await this.db.find({selector:{id:s},limit:1})).docs[0];return n!==void 0&&this.sendItemUpdate(n),n}async getSnapshot(s){const e=new Map,n=[{id:this.currentReverse?"desc":"asc"}];return await Promise.all(s.map(async([t,i])=>{var r;const o=i-t+1;return this.db.find({selector:Is((r=this.currentFilter)!=null?r:[]),skip:t,limit:o,sort:n,fields:["id","name"]}).then(c=>{for(let d=0;d<o;d+=1){const h=t+d;e.set(h,c.docs[d])}})})),e}}class To extends yu{constructor(s){super(`CommandHistoryStorage.${s}`)}setSearch(s){this.setFilters(s?[vo.makeFilterConfig([vo.makeFilterItem("name",Ge.contains,s)])]:[])}}const _o=O.module("PouchCommandHistoryStorage");class wu{constructor(){this.updateTableMap=new Map}getUpdateTable(s){return this.updateTableMap.has(s)||this.updateTableMap.set(s,new To(s)),this.updateTableMap.get(s)}async getTable(s){return new To(s)}async addItem(s,e,n,t){return this.updateItem(s,{id:`${new Date().getTime()}`,name:n,data:t})}async updateItem(s,e){const n=this.getUpdateTable(s),t=await n.refreshItem(e.id),i={...t!=null?t:{},...e};return _o.debug("Updating item",i),await n.put(i),_o.debug("Update saved"),e}listenItem(s,e,n){return this.getUpdateTable(s).onItemUpdate(e,n)}}class vu{constructor(s,e="/"){this.client=s,this.root=e}async getLayouts(){return(await this.client.getDirectoryContents(this.root,{glob:"*.json"})).map(e=>e.basename)}async getLayout(s){const e=await this.client.getFileContents(`${this.root}${s}`,{format:"text"});return JSON.parse(e)}}const Tu=O.module("LocalWorkspaceStorage"),Wa=new vu(ea.exports.createClient("/layouts")),hn=class{static async makeDefaultWorkspaceData(){const{filterSets:l,links:s,layoutConfig:e}=await zn.getDefaultLayout(Wa);return{settings:{defaultDateTimeFormat:Ae.DEFAULT_DATETIME_FORMAT_STRING,formatter:[],timeZone:Ae.DEFAULT_TIME_ZONE_ID,showTimeZone:!1,showTSeparator:!0,disableMoveConfirmation:!1,defaultDecimalFormatOptions:{defaultFormatString:qe.DEFAULT_FORMAT_STRING},defaultIntegerFormatOptions:{defaultFormatString:je.DEFAULT_FORMAT_STRING},truncateNumbersWithPound:!1},layoutConfig:e,closed:[{}],links:s,filterSets:l}}static async makeDefaultWorkspace(){return{data:await hn.makeDefaultWorkspaceData()}}async load(){var l;try{return JSON.parse((l=localStorage.getItem(hn.STORAGE_KEY))!=null?l:"")}catch{return Tu.info("Unable to load workspace data, initializing to default data"),hn.makeDefaultWorkspace()}}async save(l){return localStorage.setItem(hn.STORAGE_KEY,JSON.stringify(l)),l}};let xi=hn;xi.STORAGE_KEY="deephaven.WorkspaceStorage";const cn=O.module("SessionUtils"),_u=async()=>{const l=new URL("/jsapi",`${window.location}`),s=`${l.protocol}//${l.host}`;cn.info(`Starting connection to '${s}'...`);const e=new S.IdeConnection(s);cn.info("Getting console types...");const n=await e.getConsoleTypes();if(cn.info("Available types:",n),n.length===0)throw new Error("No console types available");const t=n[0];cn.info("Starting session with type",t);const i=await e.startSession(t),o={type:t,id:Ee.generate()};return cn.info("Console session established",o),{session:i,config:o,connection:e}},Ut=O.module("AppInit"),Io="user",Iu={name:Io,operateAs:Io,groups:[],permissions:{isSuperUser:!1,isQueryViewOnly:!1,isNonInteractive:!1,canUsePanels:!0,canCreateDashboard:!0,canCreateCodeStudio:!0,canCreateQueryMonitor:!0,canCopy:!0,canDownloadCsv:!0}},xo=new xi,xu=new wu,Du=new Fa(ea.exports.createClient("/notebooks")),Di=l=>{const{workspace:s,setActiveTool:e,setCommandHistoryStorage:n,setDashboardData:t,setFileStorage:i,setLayoutStorage:o,setDashboardSessionWrapper:r,setPlugins:c,setUser:d,setWorkspace:h,setWorkspaceStorage:m}=l,[g,f]=p.exports.useState(),[E,b]=p.exports.useState(!0),y=p.exports.useCallback(async()=>{Ut.debug("Loading plugins...");try{const L=await Gs.loadJson("/js-plugins/manifest.json");Ut.debug("Plugin manifest loaded:",L);const D=[];for(let H=0;H<L.plugins.length;H+=1){const{name:$,main:W}=L.plugins[H],Q=`/js-plugins/${$}/${W}`;D.push(Gs.loadModulePlugin(Q))}const P=await Promise.all(D),B=new Map;for(let H=0;H<P.length;H+=1){const{name:$}=L.plugins[H];B.set($,P[H])}return Ut.info("Plugins loaded:",B),B}catch(L){return Ut.error("Unable to load plugins:",L),new Map}},[]),C=p.exports.useCallback(async()=>{var L,D;try{const P=await y(),B=await xo.load(),H=await _u();H.connection.addEventListener(S.IdeConnection.HACK_CONNECTION_FAILURE,V=>{var q;const{detail:M}=V;Ut.error("Connection failure",M),f(`Unable to connect: ${(q=M.details)!=null?q:"Unknown Error"}`)});const{data:$}=B,{settings:W}=$;W.defaultDecimalFormatOptions===void 0&&(W.defaultDecimalFormatOptions={defaultFormatString:qe.DEFAULT_FORMAT_STRING}),W.defaultIntegerFormatOptions===void 0&&(W.defaultIntegerFormatOptions={defaultFormatString:je.DEFAULT_FORMAT_STRING}),W.truncateNumbersWithPound===void 0&&(W.truncateNumbersWithPound=!1);const{shortcutOverrides:Q={}}=W,N=Ce.isMacPlatform?(L=Q.mac)!=null?L:{}:(D=Q.windows)!=null?D:{};Object.entries(N).forEach(([V,M])=>{var q;(q=bn.get(V))==null||q.setKeyState(M)});const R={filterSets:$.filterSets,links:$.links};e(Ue.DEFAULT),n(xu),t(St,R),i(Du),o(Wa),r(St,H),c(P),d(Iu),m(xo),h(B)}catch(P){Ut.error(P),f(P)}},[y,e,n,t,i,o,r,c,d,h,m]),I=p.exports.useCallback(()=>{document.fonts?document.fonts.ready.then(()=>{b(!1)}):b(!1)},[]);p.exports.useEffect(function(){C(),I()},[C,I]);const T=!s&&!g||E,w=!T&&!g,_=g?`${g}`:null;return a.createElement(a.Fragment,null,w&&a.createElement(fu,null),a.createElement(zs,{isLoading:T,isLoaded:w,errorMessage:_}),a.createElement("div",{id:"preload-fonts",style:{visibility:"hidden",position:"absolute",top:-1e4}},a.createElement("p",{className:"fira-sans-regular"},"preload"),a.createElement("p",{className:"fira-sans-semibold"},"preload"),a.createElement("p",{className:"fira-mono"},"preload")))};Di.propTypes={workspace:u.exports.shape({}),workspaceStorage:u.exports.shape({close:u.exports.func}),setActiveTool:u.exports.func.isRequired,setCommandHistoryStorage:u.exports.func.isRequired,setDashboardData:u.exports.func.isRequired,setFileStorage:u.exports.func.isRequired,setLayoutStorage:u.exports.func.isRequired,setDashboardSessionWrapper:u.exports.func.isRequired,setPlugins:u.exports.func.isRequired,setUser:u.exports.func.isRequired,setWorkspace:u.exports.func.isRequired,setWorkspaceStorage:u.exports.func.isRequired};Di.defaultProps={workspace:null,workspaceStorage:null};const Nu=l=>({workspace:_n(l),workspaceStorage:Hl(l)}),Do=we(Nu,{setActiveTool:hs,setCommandHistoryStorage:Ql,setDashboardData:ya,setFileStorage:ec,setLayoutStorage:Ah,setDashboardSessionWrapper:Vd,setPlugins:nc,setUser:Xl,setWorkspace:ri,setWorkspaceStorage:Jl})(Di);class Ni extends p.exports.Component{static renderAlert(s){return a.createElement("div",{key:s,className:z("alert",`alert-${s}`)},a.createElement("strong",null,"Well done!"),"You successfully read this ",s," alert message.")}render(){const s=["success","info","warning","danger"].map(e=>Ni.renderAlert(e));return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Alerts"),a.createElement("div",{style:{padding:"1rem 0"}},s))}}class gn extends p.exports.Component{static renderButtonBrand(s,e){const n=s.length?`btn-${s}-${e}`:`btn-${e}`;return a.createElement(ot,{key:e,className:n,style:{marginBottom:"1rem",marginRight:"1rem"}},e)}static renderButtons(s){const e=["primary","secondary","success","info","danger"].map(n=>gn.renderButtonBrand(s,n));return a.createElement("div",{key:s},a.createElement("h5",null,s.length?"Outline":"Regular"),e)}static renderSocketedButtons(){return a.createElement("div",null,a.createElement("h5",null,"Socketed Buttons (for linker)"),a.createElement(Dt,{style:{marginBottom:"1rem",marginRight:"1rem"}},"Unlinked"),a.createElement(Dt,{style:{marginBottom:"1rem",marginRight:"1rem"},isLinked:!0},"Linked"),a.createElement(Dt,{style:{marginBottom:"1rem",marginRight:"1rem"},isLinkedSource:!0},"Linked Source"),a.createElement(Dt,{style:{marginBottom:"1rem",marginRight:"1rem"},isLinked:!0,isInvalid:!0},"Error"),a.createElement(Dt,{style:{marginBottom:"1rem",marginRight:"1rem"},disabled:!0},"Disabled"))}constructor(s){super(s),this.state={toggle:!0}}renderInlineButtons(){const{toggle:s}=this.state;return a.createElement("div",{style:{padding:"1rem 0"}},a.createElement("h5",null,"Inline Buttons"),"Regular btn-inline:",a.createElement(ot,{className:"btn-inline mx-2"},a.createElement(G,{icon:Vt})),"Toggle button (class active):",a.createElement(ot,{className:z("btn-inline mx-2",{active:s}),onClick:()=>{this.setState({toggle:!s})}},a.createElement(G,{icon:Vt})),"Disabled:",a.createElement(ot,{className:"btn-inline mx-2",disabled:!0},a.createElement(G,{icon:Vt})),a.createElement("br",null),a.createElement("br",null),a.createElement("span",null,"btn-link-icon (no text):"),a.createElement(ot,{className:"btn-link btn-link-icon px-2"},a.createElement(G,{icon:Vt})),a.createElement("span",{className:"mx-2"},"btn-link:"),a.createElement(ot,{className:"btn-link"},"Text Button"),a.createElement("span",{className:"mx-2"},"btn-link (text w/ optional with icon):"),a.createElement(ot,{className:"btn-link"},a.createElement(G,{icon:Vt}),"Add Item"))}render(){const s=["","outline"].map(t=>gn.renderButtons(t)),e=this.renderInlineButtons(),n=gn.renderSocketedButtons();return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Buttons"),a.createElement("div",{style:{padding:"1rem 0"}},s,e,n))}}class Lu extends p.exports.PureComponent{constructor(s){super(s),this.state={model:new $n}}render(){const{model:s}=this.state;return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Chart"),a.createElement("div",{style:{height:500}},a.createElement(lt,{model:s})))}}const Fu=()=>{const l=["100","200","300","400","500","600","700","800","900"].map(e=>a.createElement("div",{key:e,className:z("swatch","gray-swatch",`gray-swatch-${e}`)},"Gray-",e)),s=["red","orange","yellow","green","blue","purple","white","black","content-bg","primary","primary-dark","background","foreground"].map(e=>a.createElement("div",{key:e,className:z("swatch",`swatch-${e}`)},e));return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Colors"),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},l),a.createElement("div",{className:"col"},s),a.createElement("div",{className:"col"},a.createElement("p",null,"Gray Range is available for background/tab colors, and should cover the full range used in mockups. Always use the semantic color names in your .scss files when applicable for UI elements."),a.createElement("p",null,"For refrence key colors are $primary for interactable elements, content-bg as background. White is same as gray-200. Gray-100 is used when white needs an active color. content-bg is between 800 and 900."),a.createElement("pre",null,`
13
- // as semantic colours
14
- $primary: $interfaceblue;
15
- $secondary: $gray-600;
16
- $content-bg: $interfacegray;
17
- $foreground: $interfacewhite;
18
- $background: $interfaceblack;
19
- $success: $green;
20
- $info: $yellow;
21
- $warning: $orange;
22
- $danger: $red;
23
- `))))};class Pu extends p.exports.Component{constructor(s){super(s),this.makeContextMenuItems=this.makeContextMenuItems.bind(this)}makeContextMenuItems(s){const e=s?` ${s}`:"";return[{title:`Show Alert${e}`,icon:ei,action:()=>{alert(`Alert${e}!`)},shortcut:new Ce({id:"STYLEGUIDE.SHOW_ALERT",name:"Show Alert",shortcut:[Oe.CTRL,Se.A],macShortcut:[Oe.CMD,Se.A]})},{title:`Log Message${e}`,icon:ti,action:()=>{console.log(`Logging a message${e}!`)},shortcut:new Ce({id:"STYLEGUIDE.LOG_MESSAGE",name:"Log Message",shortcut:[Oe.CTRL,Se.L],macShortcut:[Oe.CMD,Se.L]})},{title:"Sub-menu",actions:()=>this.makeContextMenuItems((s||0)+1),order:3}].concat(new Array(10).fill({title:`Disabled Option${e}`,disabled:!0,order:2}))}render(){const s=this.makeContextMenuItems(),n=[{title:"Show Shortcuts",icon:qo,action:()=>{alert("Show keyboard shortcuts!")},shortcut:new Ce({id:"STYLEGUIDE.SHOW_SHORTCUTS",name:"Show Shortcuts",shortcut:[Oe.CTRL,Se.SLASH],macShortcut:[Oe.CMD,Se.SLASH]}),group:re.groups.global}].concat(s),t=()=>new Promise(i=>{setTimeout(()=>{i(s)},3e3)});return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Context Menu"),a.createElement("button",{type:"button",className:"btn btn-primary",style:{cursor:"default",marginBottom:"1rem",marginRight:"1rem"}},"Right Click Me",a.createElement(re,{actions:n})),a.createElement("button",{type:"button",className:"btn btn-secondary",style:{cursor:"default",marginBottom:"1rem",marginRight:"1rem"}},"Right Click Me",a.createElement(re,{actions:t})))}}class Ru extends p.exports.Component{constructor(s){super(s),this.sampleInput=a.createRef(),this.handleUpdateCheckboxMap=this.handleUpdateCheckboxMap.bind(this);const e=["Parent A",new Map([["Child 1",!0],["Child 2",!1]])],n=["Parent B",new Map([["Child 3",!0],["Child 4",!1],["Child 5",!0],["Child 6",!1]])],t=["Leaf Parent",!0];this.state={isShown:!1,checkBoxMap:new Map([e,n,t])}}handleUpdateCheckboxMap(s){this.setState({checkBoxMap:s})}renderChild(){return a.createElement("div",{className:"p-3"},a.createElement("h4",null,"Sample Child"),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"exampleInput1"},"Input Label",a.createElement("input",{ref:this.sampleInput,type:"text",className:"form-control",id:"exampleInput1","aria-describedby":"emailHelp",placeholder:"Input Placeholder"})),a.createElement("small",{className:"form-text text-muted"},"Help text for a form input")))}render(){const{isShown:s,checkBoxMap:e}=this.state;return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Popover Dialog"),a.createElement("p",null,"Popover dialog that can contain interactive elements, can be set to self close on blur."),a.createElement("button",{type:"button",className:"btn btn-primary",style:{marginBottom:"1rem",marginRight:"1rem"},onClick:()=>{s?this.setState({isShown:!1}):this.setState({isShown:!0})}},"Open Dialog",a.createElement(qs,{options:{placement:"bottom"},isShown:s,onEntered:()=>{this.sampleInput.current&&this.sampleInput.current.focus()},onExited:()=>{this.setState({isShown:!1})},closeOnBlur:!0,interactive:!0},this.renderChild())),a.createElement("p",null,"The Hierarchical Checkbox Menu uses a popover dialog to display hierarchical groups of checkboxes."),a.createElement(Xr,{menuText:"Checkbox Menu",valueMap:e,onUpdateValueMap:this.handleUpdateCheckboxMap}))}}class ku extends p.exports.Component{constructor(s){super(s),this.state={isShown:!1}}render(){const s=[{title:"Show Alert",icon:ei,action:()=>{alert("Alert!")},shortcut:new Ce({id:"STYLEGUIDE.SHOW_ALERT",name:"Show Alert",shortcut:[Oe.CTRL,Se.A],macShortcut:[Oe.CMD,Se.A]})},{title:"Log Message",icon:ti,action:()=>{console.log("Logging a message!")},shortcut:new Ce({id:"STYLEGUIDE.LOG_MESSAGE",name:"Log Message",shortcut:[Oe.CTRL,Se.L],macShortcut:[Oe.CMD,Se.L]})}],n=[{title:"Show Shortcuts",icon:qo,action:()=>{alert("Show keyboard shortcuts!")},shortcut:new Ce({id:"STYLEGUIDE.SHOW_SHORTCUTS",name:"Show Shortcuts",shortcut:[Oe.CTRL,Se.SLASH],macShortcut:[Oe.CMD,Se.SLASH]}),group:re.groups.global}].concat(s),{isShown:t}=this.state;return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Dropdown Menu"),a.createElement("p",null,"A simple dropdown menu of actions, can open on click of parent container, or controlled by prop."),a.createElement("button",{type:"button",className:"btn btn-inline mx-2"},a.createElement(G,{icon:Wo}),a.createElement(Kn,{actions:n})),a.createElement("button",{type:"button",className:"btn btn-primary",style:{marginRight:"1rem",minWidth:"165px"},onClick:()=>{t?this.setState({isShown:!1}):this.setState({isShown:!0})}},"Menu Shown: ",t.toString()),a.createElement("div",{ref:this.button,className:"btn btn-secondary disabled",style:{marginRight:"1rem"}},"Shown using isShown",a.createElement(Kn,{isShown:t,onMenuClosed:()=>{this.setState({isShown:!1})},actions:n})))}}const Mu=`trades = db.t("LearnDeephaven", "StockTrades").where("Date=\`2017-08-25\`")\\
24
- .headBy(3, "Sym")\\
25
- .view("Sym", "Last")
26
-
27
- summary = trades.view("Sym", "AvgPrice=Last").avgBy("Sym")
28
-
29
- lj = summary.leftJoin(trades, "Sym", "Last")
30
-
31
-
32
-
33
- def rollingAvg(rows, values):
34
- calculations = jpy.array('double', values.size()) # create an array of integers
35
-
36
- sum = 0
37
- n = 0
38
- avg = 0
39
-
40
- for i in range(values.size()):
41
- sum += values.get(i) #add each value to sum
42
- if (i >= rows): sum -= values.get(i - rows) #subtract when needed
43
-
44
- n = i + 1 if (i < rows) else rows #n increments with i until i=rows
45
- avg = sum / n #get updated average every iteration
46
-
47
- calculations[i] = avg #store running average
48
-
49
- return calculations #return an array of rolling averages
50
-
51
- def rollingStd(rows, values, averages):
52
- calculations = jpy.array('double', values.size()) # create an array of integers
53
-
54
- sum = 0
55
- n = 0
56
-
57
- for i in range(values.size()):
58
- sum = 0
59
-
60
- j = i
61
- while j >= 0 and j > i - rows:
62
- difference = values.get(j) - averages[i]
63
- squareDiff = difference ** 2
64
- sum += squareDiff
65
- j -= 1
66
-
67
- n = i + 1 if (i < rows) else rows
68
- variance = sum / n
69
- standardDev = variance ** (1/2.0)
70
- calculations[i] = standardDev
71
-
72
- return calculations
73
-
74
- trades = db.t("LearnDeephaven", "StockTrades")\\
75
- .where("Date=\`2017-08-25\`")\\
76
- .view("Sym", "Last", "Size", "ExchangeTimestamp")
77
-
78
- trades30min = trades.updateView("TimeBin=lowerBin(ExchangeTimestamp, 30*MINUTE)")\\
79
- .firstBy("Sym", "TimeBin")
80
-
81
- rollingCalc = trades30min.by("Sym")\\
82
- .update("Avg=(double[])rollingAvg.call(30, Last)",
83
- "Std=(double[])rollingStd.call(30, Last, Avg)")\\
84
- .ungroup()
85
- minEdge = 0.5
86
- maxPos = 3.0
87
- liquidity = 1e6
88
-
89
- targetPos = rollingCalc.updateView("Zscore=(Avg-Last)/Std if (Std > 0) else NULL_DOUBLE", "AdjZscore=signum(Zscore) * min(maxPos, max(abs(Zscore)-minEdge), 0.0)", "TargetPosition=(int)(liquidity*AdjZscore/Last)")\\
90
- .dropColumns("ExchangeTimestamp", "Avg", "Std", "Zscore", "AdjZscore")
91
-
92
- timeBinIndexes = targetPos.leftJoin(trades30min, "Sym", "Times=ExchangeTimestamp, SharesTraded=Size")\\
93
- .updateView("StartIndex=binSearchIndex(Times, TimeBin-30*MINUTE, BS_LOWEST)", "EndIndex=binSearchIndex(Times, TimeBin, BS_HIGHEST)")\\
94
- .dropColumns("Times")
95
-
96
- shares30min = timeBinIndexes.updateView("SharesTraded30Min=sum(SharesTraded.subArray(StartIndex, EndIndex))")\\
97
- .dropColumns("SharesTraded", "StartIndex", "EndIndex")
98
-
99
- from math import copysign
100
- class SimulatorState:
101
- def __init__(self):
102
- self.hm = {}
103
-
104
- def __call__(self, sym, targetPos, shares10s):
105
- if sym not in self.hm:
106
- self.hm[sym] = [0.0] * 2
107
- tradedAndPosition = self.hm[sym]
108
- tradedAndPosition[0] = 0.0 if (targetPos == None) else copysign(1, targetPos - tradedAndPosition[1]) * min(abs(targetPos - tradedAndPosition[1]), shares10s * 0.1)
109
- tradedAndPosition[1] += tradedAndPosition[0]
110
- return jpy.array('double', list(tradedAndPosition))
111
-
112
- ss = SimulatorState()
113
-
114
- simulation = shares30min.update("Values=(double[])ss.call(Sym, TargetPosition, SharesTraded30Min)", "PositionChange=Values[0]", "Position=Values[1]")\\
115
- .dropColumns("Values")
116
- `,Au=`trades = db.t("LearnDeephaven", "StockTrades").where("Date=\`2017-08-25\`")
117
- .headBy(3, "Sym")
118
- .view("Sym", "Last")
119
-
120
- summary = trades.view("Sym", "AvgPrice=Last").avgBy("Sym")
121
-
122
- lj = summary.leftJoin(trades, "Sym", "Last")
123
-
124
-
125
- rollingAvg = { rows, values ->
126
-
127
- calculations = new double[values.size()]
128
-
129
- sum = 0
130
- n = 0
131
- avg = 0
132
-
133
- for (int i = 0; i < values.size(); ++i)
134
- {
135
- sum += values.get(i) //add each value to sum
136
- if (i >= rows) sum -= values.get(i - rows) //subtract when needed
137
-
138
- n = (i < rows) ? i + 1 : rows //n increments with i until i=rows
139
- avg = sum / n //get updated average every iteration
140
-
141
- calculations[i] = avg //store running average
142
- }
143
-
144
- return calculations //return an array of rolling averages
145
- }
146
-
147
- rollingStd = { rows, values, averages ->
148
- calculations = new double[values.size()]
149
-
150
- sum = 0
151
- n = 0
152
-
153
- for (int i = 0; i < values.size(); ++i)
154
- {
155
- sum = 0
156
- for (int j = i; j >= 0 && j > i - rows; --j)
157
- {
158
- difference = values.get(j) - averages[i]
159
- squareDiff = Math.pow(difference, 2)
160
- sum += squareDiff
161
- }
162
-
163
- n = (i < rows) ? i + 1 : rows
164
- variance = sum / n
165
- standardDev = Math.sqrt(variance)
166
- calculations[i] = standardDev
167
- }
168
- return calculations
169
- }
170
-
171
- trades = db.t("LearnDeephaven", "StockTrades")
172
- .where("Date=\`2017-08-25\`")
173
- .view("Sym", "Last", "Size", "ExchangeTimestamp")
174
-
175
- trades30min = trades.updateView("TimeBin=lowerBin(ExchangeTimestamp, 30*MINUTE)")
176
- .firstBy("Sym", "TimeBin")
177
-
178
- rollingCalc = trades30min.by("Sym")
179
- .update("Avg=(double[])rollingAvg.call(30, Last)","Std=(double[])rollingStd.call(30, Last, Avg)")
180
- .ungroup()
181
-
182
- minEdge = 0.5d
183
- maxPos = 3.0d
184
- liquidity = 1e6d
185
-
186
- targetPos = rollingCalc.updateView("Zscore=(Std > 0) ? (Avg-Last)/Std : NULL_DOUBLE", "AdjZscore=signum(Zscore) * min(maxPos, max(abs(Zscore)-minEdge), 0.0)", "TargetPosition=(int)(liquidity*AdjZscore/Last)")
187
- .dropColumns("ExchangeTimestamp", "Avg", "Std", "Zscore", "AdjZscore")
188
-
189
- timeBinIndexes = targetPos.leftJoin(trades30min, "Sym", "Times=ExchangeTimestamp, SharesTraded=Size")
190
- .updateView("StartIndex=binSearchIndex(Times, TimeBin-30*MINUTE, BS_LOWEST)", "EndIndex=binSearchIndex(Times, TimeBin, BS_HIGHEST)")
191
- .dropColumns("Times")
192
-
193
- shares30min = timeBinIndexes.updateView("SharesTraded30Min=sum(SharesTraded.subArray(StartIndex, EndIndex))")
194
- .dropColumns("SharesTraded", "StartIndex", "EndIndex")
195
-
196
-
197
- class SimulatorState
198
- {
199
- private HashMap<String, double[]> hm = new HashMap<>();
200
-
201
- public double[] update(String sym, int targetPos, int shares10s)
202
- {
203
- if (!hm.containsKey(sym)) hm.put(sym, new double[2]);
204
-
205
- double[] tradedAndPosition = hm.get(sym);
206
-
207
- tradedAndPosition[0] =
208
- isNull(targetPos) ? 0.0 : signum(targetPos - tradedAndPosition[1]) * min(abs(targetPos - tradedAndPosition[1]), shares10s * 0.1d)
209
- tradedAndPosition[1] += tradedAndPosition[0];
210
-
211
- return Arrays.copyOf(tradedAndPosition, tradedAndPosition.length);
212
- }
213
- }
214
- ss = new SimulatorState()
215
-
216
- simulation = shares30min.update("Values=(double[])ss.update(Sym, TargetPosition, SharesTraded30Min)", "PositionChange=Values[0]", "Position=Values[1]")
217
- .dropColumns("Values")
218
-
219
- `,No={testPython:Mu,testGroovy:Au},Ou=()=>a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Editor"),a.createElement("h5",{className:"sub-title"},"Python"),a.createElement("div",{style:{height:400,position:"relative"}},a.createElement(ks,{settings:{language:"python",value:No.testPython}})),a.createElement("h5",{className:"sub-title"},"Groovy"),a.createElement("div",{style:{height:400,position:"relative"}},a.createElement(ks,{settings:{language:"groovy",value:No.testGroovy}}))),Uu=[];class Vu extends ze{constructor(s=new ni){super(),this.getCachedColumns=te(e=>{const n=[];for(let t=0;t<e;t+=1)n.push({name:this.model.textForColumnHeader(t,0),type:"java.lang.String",description:`Mock column ${t}`});return n}),this.model=s,this.editedData=[]}get rowCount(){return this.model.rowCount}get columnCount(){return this.model.columnCount}get floatingTopRowCount(){return 3}get floatingBottomRowCount(){return 3}get isEditable(){return!0}isEditableRange(s){return this.isEditable}setValues(s){throw new Error("Method not implemented.")}delete(s){throw new Error("Method not implemented.")}get pendingRowCount(){return 0}set pendingRowCount(s){}get pendingDataMap(){return new Map}set pendingDataMap(s){}updateFrozenColumns(s){}getColumnIndexByName(s){return Number(s)}textForCell(s,e){var n,t;return(t=(n=this.editedData[s])==null?void 0:n[e])!=null?t:this.model.textForCell(s,e)}textForRowHeader(s){return this.model.textForRowHeader(s)}textForRowFooter(s){return this.model.textForRowHeader(s)}textForColumnHeader(s,e){return this.model.textForColumnHeader(s,e)}get hasExpandableRows(){return this.model.hasExpandableRows}isRowExpandable(s){return this.model.isRowExpandable(s)}isRowExpanded(s){return this.model.isRowExpanded(s)}setRowExpanded(s,e){this.model.setRowExpanded(s,e)}depthForRow(s){return this.model.depthForRow(s)}get columns(){return this.getCachedColumns(this.columnCount)}get groupedColumns(){return Uu}get description(){return"A mock used for testing."}get customColumns(){return[]}set customColumns(s){}get formatColumns(){return[]}set formatColumns(s){}get sort(){return[]}set sort(s){}get filter(){return[]}set filter(s){}set formatter(s){}displayString(s){return`${s}`}valueForCell(s,e){return this.textForCell(s,e)}formatForCell(s,e){}setViewport(){this.dispatchEvent(new CustomEvent(ze.EVENT.UPDATED))}async setValueForCell(s,e,n){this.editedData[s]==null&&(this.editedData[s]=[]),this.editedData[s][e]=`${n}`,this.dispatchEvent(new CustomEvent(ze.EVENT.UPDATED))}async setValueForRanges(s,e){Jr.forEachCell(s,(n,t)=>{this.setValueForCell(n,t,e)})}editValueForCell(s,e){return this.textForCell(s,e)}isValidForCell(s,e,n){return!0}async columnStatistics(s){throw new Error("Not defined in mock")}async commitPending(){throw new Error("Not defined in mock")}async export(){throw new Error("Not defined in mock")}get pendingDataErrors(){throw new Error("Not defined in mock")}get rollupConfig(){throw new Error("Not defined in mock")}set rollupConfig(s){throw new Error("Not defined in mock")}get selectDistinctColumns(){throw new Error("Not defined in mock")}set selectDistinctColumns(s){throw new Error("Not defined in mock")}async snapshot(s){throw new Error("Not defined in mock")}async textSnapshot(){throw new Error("Not defined in mock")}get totalsConfig(){throw new Error("Not defined in mock")}set totalsConfig(s){throw new Error("Not defined in mock")}valuesTable(s){throw new Error("Not defined in mock")}}const Bu=()=>{const[l]=p.exports.useState(()=>new wd([["Matthew Austins","Toronto",35,22],["Doug Millgore","Toronto",14,33],["Bart Marchant","Boston",20,14],["Luigi Dabest","Pittsburgh",66,33]],["Name","Team","Goals","Assists"]));return a.createElement(Tn,{model:l})},Hu=()=>{const[l]=p.exports.useState(()=>new jo({isEditable:!0,rowCount:Number.MAX_SAFE_INTEGER,columnCount:Number.MAX_SAFE_INTEGER}));return a.createElement(Tn,{model:l})},$u=()=>{const[l]=p.exports.useState(()=>new ni);return a.createElement(Tn,{model:l})},Wu=()=>{const[l]=p.exports.useState(()=>new vd(1e9,1e6)),s=p.exports.useRef(),[e,n]=p.exports.useState({top:0,bottom:0,left:0,right:0}),t=p.exports.useCallback(d=>{const{top:h,bottom:m,left:g,right:f}=d;n({top:h,bottom:m,left:g,right:f})},[]),{top:i,bottom:o,left:r,right:c}=e;return p.exports.useEffect(function(){let h=!1;return setTimeout(()=>{if(h)return;const m=[];for(let g=i;g<=o;g+=1){const f=[];for(let E=r;E<=c;E+=1)f.push(`${g},${E}`);m.push(f)}l.viewportData={rowOffset:i,columnOffset:r,data:m},s.current.forceUpdate()},250),()=>{h=!0}},[i,o,r,c,l]),a.createElement(Tn,{model:l,onViewChanged:t,ref:s})};class Gu extends p.exports.PureComponent{constructor(s){super(s),this.state={irisGridModel:new Vu(new ni),model:new jo,theme:{autoSelectRow:!0},contextTheme:{rowHeight:40}}}render(){const{contextTheme:s,irisGridModel:e,model:n,theme:t}=this.state;return a.createElement("div",null,a.createElement(Qr.Provider,{value:s},a.createElement("h2",{className:"ui-title"},"Grid"),a.createElement("div",null,a.createElement(Tn,{model:n,theme:t})),a.createElement("h2",{className:"ui-title"},"Static Data"),a.createElement("div",{style:{height:200}},a.createElement(Bu,null))),a.createElement("h2",{className:"ui-title"},"Quadrillion rows and columns"),a.createElement("div",{style:{height:500,position:"relative"}},a.createElement(Hu,null)),a.createElement("h2",{className:"ui-title"},"Async example"),a.createElement("div",{style:{height:500,position:"relative"}},a.createElement(Wu,null)),a.createElement("h2",{className:"ui-title"},"Tree Grid"),a.createElement("div",{style:{height:500}},a.createElement($u,null)),a.createElement("h2",{className:"ui-title"},"Iris Grid"),a.createElement("div",{style:{height:500}},a.createElement(Xs,{model:e})))}}async function zu(l){try{return await navigator.clipboard.writeText(l)}catch(s){throw new Error(`Unable to copy: ${s}`)}}const qu="dh",ju="vs",Ku=(l,s)=>s.toLowerCase()+l.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(""),Ga=({message:l,message:{text:s}})=>{const[e,n]=p.exports.useState(!1);return p.exports.useEffect(function(){if(!s)return;n(!0);const i=setTimeout(()=>{n(!1)},2e3);return()=>{clearTimeout(i)}},[l,s]),a.createElement("p",{className:e?"flash in":"flash out"},s)};Ga.propTypes={message:u.exports.shape({text:u.exports.node}).isRequired};const Zu=()=>{const[l,s]=p.exports.useState(!0),[e,n]=p.exports.useState(!0),[t,i]=p.exports.useState(""),[o,r]=p.exports.useState({text:""}),c=Object.values(At).filter(d=>{const h=(d.prefix.toLowerCase()+d.iconName.toLowerCase()).indexOf(t.toLowerCase())!==-1,m=l&&d.prefix===qu,g=e&&d.prefix===ju;return h&&(m||g)}).map(d=>{const h=Ku(d.iconName,d.prefix);return a.createElement(X,{key:h,kind:"inline",className:"card",onClick:()=>{zu(h).then(()=>{r({text:a.createElement("span",null,a.createElement(G,{icon:At.vsOutput})," Copied text:"," ",a.createElement("strong",null,h))})}).catch(m=>{r({text:a.createElement("span",{className:"text-danger"},m.message)})})}},a.createElement(G,{icon:d,className:"icon"}),a.createElement("label",{title:h},h))});return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Icons"),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},a.createElement("div",{className:"form-inline mb-3"},a.createElement("input",{type:"search",placeholder:"Basic icon search...",value:t,className:"form-control",onChange:d=>{i(d.target.value)}}),a.createElement("span",{className:"mx-2"},"Show: "),a.createElement(X,{kind:"inline",active:e,className:"mr-2",onClick:()=>n(!e),icon:e?At.vsCheck:At.vsClose},"VS ICONS"),a.createElement(X,{kind:"inline",active:l,className:"mr-2",onClick:()=>s(!l),icon:l?At.vsCheck:At.vsClose},"DH ICONS"),a.createElement("small",null,"(",c.length," icon",c.length===1?"":"s",")")),a.createElement("div",{className:"icons"},c,c.length===0&&a.createElement("p",{className:"no-result"},"No icons found."),a.createElement(Ga,{message:o})))))},Yu=O.module("DateInput"),Xu="[12][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])",Ju="([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}\u200B[0-9]{3}\u200B[0-9]{3}",Qu=`${Xu} ${Ju}`,za="yyyy-MM-dd HH:mm:ss.SSSSSSSSS",qa="2019-01-01 00:00:00.000\u200B000\u200B000",em=[qa],tm=l=>S.i18n.DateTimeFormat.parse(za,l.replace(/\u200B/g,"")),nm=l=>{const s=S.i18n.DateTimeFormat.format(za,l);return`${s.substring(0,23)}\u200B${s.substring(23,26)}\u200B${s.substring(26)}`},Li=l=>{const{className:s,defaultValue:e,onChange:n}=l,[t,i]=p.exports.useState(nm(e)),[o,r]=p.exports.useState(null);function c(g,f,E,b,y){const C=b-E+1;return`${((parseInt(f,10)-g-E)%C+C)%C+E}`.padStart(y,"0")}function d(g,f,E){const{selectionStart:b}=g;return b===0?c(f,E,1900,2099,4):b===5?c(f,E,1,12,2):b===8?c(f,E,1,31,2):b===11?c(f,E,0,23,2):b===17||b===14?c(f,E,0,59,2):b===20||b===24||b===28?c(f,E,0,999,3):E}function h(g){Yu.debug("handleChange",g),i(g),n(g)}function m(g){r(g)}return a.createElement(el,{className:s,pattern:Qu,example:em,getNextSegmentValue:d,value:t,onChange:h,onSelect:m,selection:o})};Li.propTypes={className:u.exports.string,defaultValue:u.exports.shape({}),onChange:u.exports.func};Li.defaultProps={className:"",defaultValue:tm(qa),onChange:()=>{}};class sm extends p.exports.Component{constructor(s){super(s),this.handleRadioChange=this.handleRadioChange.bind(this),this.handleToggleClick=this.handleToggleClick.bind(this),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.example=[{title:"Title 1",value:"Value 1"},{title:"Title 2",value:"Value 2"},{title:"Title 3",value:"Value 3"},{title:"Title 4",value:"Value 4"},{title:"Title 5",value:"Value 5"},{title:"Title 6",value:"Value 6"},{title:"Title 7",value:"Value 7"},{title:"Title 8",value:"Value 8"},{title:"Title 9",value:"Value 9"},{title:"Title 9",value:"Value 9"},{title:"Title 10",value:"Value 10"},{title:"Title 11",value:"Value 11"},{title:"Title 12",value:"Value 12"}],this.timeouts=[{title:"1 minute",value:1*60*1e3},{title:"5 minutes",value:5*60*1e3},{title:"20 minutes",value:20*60*1e3},{title:"45 minutes",value:45*60*1e3},{title:"1 hour",value:1*60*60*1e3},{title:"4 hours",value:4*60*60*1e3}],this.state={on:!1,searchValue:"",check1:!0,check2:!1,check3:!1,check4:!1,check5:null,radioValue:"1",customTimeValue:null,autoResizeTextareaValue:"-DLiveTableMonitor.updateThreads=8 -DLiveTableMonitor.printDependencyInformation=false -Dassertion.heapDump=true -Drequire.heapDump=true -Dassertion.heapDump=true -Drequire.heapDump=true"}}handleRadioChange(s){this.setState({radioValue:s.target.value})}handleToggleClick(){const{on:s}=this.state;this.setState({on:!s})}handleSearchInputChange(s){this.setState({searchValue:s.target.value})}render(){const{on:s,radioValue:e,searchValue:n,check1:t,check2:i,check3:o,check4:r,check5:c,customTimeValue:d,autoResizeTextareaValue:h}=this.state;return a.createElement("div",{className:"style-guide-inputs"},a.createElement("h2",{className:"ui-title"},"Inputs"),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},a.createElement("form",null,a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"exampleInput1"},"Input Label",a.createElement("input",{type:"text",className:"form-control",id:"exampleInput1","aria-describedby":"emailHelp",placeholder:"Input Placeholder"})),a.createElement("small",{className:"form-text text-muted"},"Help text for a form imput")),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"exampleInput2"},"Input Label",a.createElement("input",{type:"text",className:"form-control",id:"exampleInput2","aria-describedby":"emailHelp",placeholder:"Input Disabled",disabled:!0})),a.createElement("small",{className:"form-text text-muted"},"Disabled input")),a.createElement("div",{className:"form-group"},a.createElement("label",{htmlFor:"exampleInputPassword1"},"Password",a.createElement("input",{type:"password",className:"form-control",id:"exampleInputPassword1",placeholder:"Password",defaultValue:"123456789"}))),a.createElement("div",{className:"form-group"},a.createElement(zo,{value:n,placeholder:"Search Input",onChange:this.handleSearchInputChange})))),a.createElement("div",{className:"col"},a.createElement("form",null,a.createElement("h5",null," Checkboxes "),a.createElement(tt,{className:"form-group",checked:t,onChange:()=>this.setState({check1:!t})},"Checked checkbox"),a.createElement(tt,{className:"form-group",checked:i,onChange:()=>this.setState({check2:!i})},"Unchecked checkbox"),a.createElement(tt,{className:"form-group",disabled:!0,checked:null},"Disabled checkbox"),a.createElement(tt,{className:"form-group",isInvalid:!0,checked:o,onChange:()=>this.setState({check3:!o})},"Invalid checkbox"),a.createElement(tt,{className:"form-group",checked:r,onChange:()=>this.setState({check4:!r})},"Add radio button"),a.createElement(tt,{className:"form-group",checked:c,onChange:()=>{c==null?this.setState({check5:!0}):c?this.setState({check5:!1}):this.setState({check5:null})}},"Indeterminate Cycle"))),a.createElement("div",{className:"col"},a.createElement("form",null,a.createElement("h5",null," Radios "),a.createElement(Uo,{onChange:this.handleRadioChange,value:e},a.createElement(Nt,{value:"1"},"Toggle this custom radio"),a.createElement(Nt,{value:"2"},"Or toggle this other custom radio"),a.createElement(Nt,{value:"3",disabled:!0},"Disabled radio"),a.createElement(Nt,{value:"4",isInvalid:!0},"Invalid radio"),a.createElement(a.Fragment,null,r&&a.createElement(Nt,{value:"5"},"Extra radio item"))))),a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Selection Menu"),a.createElement("select",{defaultValue:"0",className:"custom-select"},a.createElement("option",{disabled:!0,value:"0"},"Custom Selection"),a.createElement("option",{value:"1"},"One"),a.createElement("option",{value:"2"},"Two"),a.createElement("option",{value:"3"},"Three"))),a.createElement("div",{className:"form-group"},a.createElement("select",{defaultValue:"0",className:"custom-select",disabled:!0},a.createElement("option",{disabled:!0,value:"0"},"Custom Selection"),a.createElement("option",{value:"1"},"One"),a.createElement("option",{value:"2"},"Two"),a.createElement("option",{value:"3"},"Three"))),a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Input with Select"),a.createElement("div",{className:"input-group"},a.createElement(Gi,{options:this.example,inputPlaceholder:"10.128.0.8",searchPlaceholder:"Search actions here"})),a.createElement("br",null),a.createElement("div",{className:"input-group"},a.createElement(Gi,{options:this.example,inputPlaceholder:"10.128.0.8",searchPlaceholder:"Search actions here",disabled:!0}))),a.createElement("div",{className:"form-group"},a.createElement("h5",null,"AutoCompleteInput"),a.createElement(tl,{options:this.example,noMatchText:"No Matches."}))),a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Toggle Buttons"),a.createElement("div",{className:"form-inline justify-content-between"},a.createElement("label",null,String(s)),a.createElement(Ln,{on:s,onClick:this.handleToggleClick})),a.createElement("div",{className:"form-inline justify-content-between"},a.createElement("label",null,String(!s)),a.createElement(Ln,{on:!s,onClick:this.handleToggleClick})),a.createElement("div",{className:"form-inline justify-content-between"},a.createElement("label",{className:"isInvalid"},"isInvalid"),a.createElement(Ln,{on:!s,isInvalid:!0,onClick:this.handleToggleClick})),a.createElement("div",{className:"form-inline justify-content-between"},a.createElement("label",{className:"disabled"},"disabled"),a.createElement(Ln,{on:!s,disabled:!0,onClick:this.handleToggleClick})))),a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Time Input"),a.createElement(nl,null),a.createElement("br",null),a.createElement("h5",null,"Date Input"),a.createElement(Li,null),a.createElement("small",{className:"text-muted"},"Does not work in mock"),a.createElement("br",null),a.createElement("h5",null,"Custom Timeselect"),a.createElement(sl,{options:this.timeouts,value:d,onChange:m=>{this.setState({customTimeValue:m})},customText:"Custom Timeout",placeholder:"Select a timeout",valueToTime:m=>Math.round(m/1e3),timeToValue:m=>m*1e3})))),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Auto Resize Textarea"),a.createElement(il,{value:h,delimiter:" -",onChange:m=>{this.setState({autoResizeTextareaValue:m})}})))))}}class im extends p.exports.PureComponent{constructor(s){super(s),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.selectedItems=[],this.state={items:[],offset:0,itemCount:5e5}}handleSelect(s){const e=this.selectedItems.indexOf(s);e>=0?this.selectedItems.splice(e,1):this.selectedItems.push(s);const n=e<0,{offset:t}=this.state;let{items:i}=this.state;i=[].concat(i);const o=s-t;o>=0&&o<i.length&&(i[o].isSelected=n),this.setState({items:i})}handleViewportChange(s,e){const{itemCount:n}=this.state,t=e-s+1,i=Math.max(0,s-t),o=Math.min(e+t,n),r=[];for(let d=i;d<=o&&d<=n;d+=1){const h=`Item ${d}`,m=this.selectedItems.indexOf(d)>=0;r.push({value:h,isSelected:m})}const c=i;this.setState({offset:c,items:r})}render(){const{offset:s,items:e,itemCount:n}=this.state;return a.createElement(ol,{itemCount:n,items:e,offset:s,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}}class Lo extends p.exports.PureComponent{constructor(s){super(s),this.handleSelect=this.handleSelect.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.selectedItems=[],this.state={items:[],offset:0,itemCount:5e5}}handleSelect(s){const{itemCount:e}=this.state;console.log("Item selected at index",s,"/",e)}handleViewportChange(s,e){const{itemCount:n}=this.state,t=e-s+1,i=Math.max(0,s-t),o=Math.min(e+t,n),r=[];for(let d=i;d<=o;d+=1){const h=`Item ${d}`,m=this.selectedItems.indexOf(d)>=0;r.push({value:h,isSelected:m})}const c=i;this.setState({offset:c,items:r})}render(){const{isMultiSelect:s}=this.props,{offset:e,items:n,itemCount:t}=this.state;return a.createElement(Fs,{isMultiSelect:s,itemCount:t,items:n,offset:e,onSelect:this.handleSelect,onViewportChange:this.handleViewportChange})}}const om=()=>a.createElement("div",{className:"style-guide-inputs"},a.createElement("h2",{className:"ui-title"},"Item Lists"),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Select List"),a.createElement("div",{style:{height:"300px"}},a.createElement(im,null)))),a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Item List"),a.createElement("div",{style:{height:"300px"}},a.createElement(Lo,null)))),a.createElement("div",{className:"col"},a.createElement("div",{className:"form-group"},a.createElement("h5",null,"Multi Select Item List"),a.createElement("div",{style:{height:"300px"}},a.createElement(Lo,{isMultiSelect:!0})))))),am=()=>{const[l,s]=p.exports.useState(0),[e,n]=p.exports.useState(!0),t=()=>{s(0)};function i(o){return a.createElement(a.Fragment,{key:o},a.createElement("button",{type:"button",className:"btn btn-primary",style:{marginBottom:"1rem",marginRight:"1rem"},onClick:()=>{s(o)}},o," ",o>1?"Actions":"Action"),a.createElement(Cn,{isOpen:l===o,headerText:"Header Text",bodyText:"This is where the body text goes",onConfirm:t,onCancel:o>=2?t:void 0,onDiscard:o>=3?t:void 0}))}return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Basic Modals"),a.createElement("div",{style:{padding:"1rem"}},[1,2,3].map(o=>i(o))),a.createElement("h2",{className:"ui-title"},"Custom Modal"),a.createElement("div",{style:{padding:"1rem"}},a.createElement("div",{className:"modal-dialog theme-bg-light",role:"dialog"},a.createElement("div",{className:"modal-content"},a.createElement("div",{className:"modal-header"},a.createElement("h5",{className:"modal-title"},"Modal title"),a.createElement("button",{type:"button",className:"close","data-dismiss":"modal","aria-label":"Close"},a.createElement("span",{"aria-hidden":"true"},"\xD7"))),a.createElement("div",{className:"modal-body"},a.createElement("p",null,"Modal body text goes here."),a.createElement(tt,{checked:e,onChange:()=>n(!e)},"Checked checkbox")),a.createElement("div",{className:"modal-footer"},a.createElement("button",{type:"button",className:"btn btn-outline-primary","data-dismiss":"modal"},"Close"),a.createElement("button",{type:"button",className:"btn btn-primary"},"Save changes"))))))},rm=()=>a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Progress"),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},a.createElement("h5",null,"Determinate Progress Loader"),a.createElement("br",null),a.createElement("div",{className:"progress",style:{marginBottom:"1rem"}},a.createElement("div",{className:"progress-bar bg-primary",style:{width:"25%"},"aria-valuenow":25,"aria-valuemin":0,"aria-valuemax":100}))),a.createElement("div",{className:"col"},a.createElement("h5",null,"Indeterminate Progress Spinner"),a.createElement(Os,{className:"loading-spinner-large"})),a.createElement("div",{className:"col"},a.createElement("h5",null,"DH Spinner"),a.createElement(al,null)),a.createElement("div",{className:"col"},a.createElement("h5",null,"Button Progress Spinner"),a.createElement("button",{type:"button",className:"btn btn-primary btn-spinner btn-cancelable",style:{minWidth:"10rem"}},a.createElement("span",null,a.createElement(Os,null),a.createElement("span",{className:"btn-normal-content"},"Connecting"),a.createElement("span",{className:"btn-hover-content"},"Cancel"))))));class lm extends p.exports.PureComponent{constructor(s){super(s),this.handleSliderChange=this.handleSliderChange.bind(this),this.state={startTime:24*60*60*.25,endTime:24*60*60*.75}}handleSliderChange(s){const{startTime:e,endTime:n}=s;this.setState({startTime:e}),this.setState({endTime:n})}render(){const{startTime:s,endTime:e}=this.state;return a.createElement("div",{className:"style-guide-inputs"},a.createElement("h2",{className:"ui-title"},"Time Slider"),a.createElement(rl,{startTime:s,endTime:e,onChange:this.handleSliderChange}),a.createElement("p",null,"StartTime: ",As.formatTime(s)),a.createElement("p",null,"EndTime: ",As.formatTime(e)))}}const cm=()=>{const s=[ti,ei].map(e=>a.createElement(G,{key:`${e.prefix}-${e.iconName}`,icon:e}));return a.createElement("div",null,a.createElement("h2",{className:"ui-title",title:"Make better looking tooltips than this one!"},"Tooltips"),a.createElement("div",{className:"btn btn-primary",style:{cursor:"default",marginBottom:"1rem",marginRight:"1rem"}},"Simple Tooltip",a.createElement(Le,null,"Text only content")),a.createElement("div",{className:"btn btn-secondary",style:{cursor:"default",marginBottom:"1rem",marginRight:"1rem"}},"Complex Tooltip",a.createElement(Le,null,a.createElement("div",null,"Here is some ",a.createElement("i",null,"cool")," ",a.createElement("b",null,"text")),a.createElement("hr",null),a.createElement("div",null,"And some icons down here"),a.createElement("div",null,a.createElement(Os,null),s))),a.createElement("div",{className:"btn btn-success",style:{cursor:"default",marginBottom:"1rem",marginRight:"1rem"}},"Interactive Tooltip",a.createElement(Le,{interactive:!0},a.createElement("div",null,"This tooltip is interactive."),a.createElement("hr",null),a.createElement("button",{type:"button",className:"btn btn-primary",onClick:()=>{alert("Button clicked!")}},"Show Alert"))))},dm=()=>a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Typograpy"),a.createElement("div",{className:"row"},a.createElement("div",{className:"col"},a.createElement("h1",{className:"text-muted"},"h1. Unused"),a.createElement("h2",{className:"text-muted"},"h2. Unused"),a.createElement("h3",{className:"text-muted"},"h3. Unused"),a.createElement("h4",null,"h4. Standard Heading"),a.createElement("h5",null,"h5. Small Heading"),a.createElement("h6",{className:"text-muted"},"h6. Unused")),a.createElement("div",{className:"col"},a.createElement("h4",null,"Fonts"),a.createElement("p",null,"UI: Fira Sans;"),a.createElement("p",{className:"text-monospace"},"Code: Fira Mono;"),a.createElement("p",null,'Tables: Fira Sans; font-feature-settings: "tnum";'),a.createElement("p",null,"Default font-size: 14px = 1rem"))));class hm extends p.exports.PureComponent{constructor(s){super(s),this.getViewportItems=te((e,n,t)=>e==null||n==null?[]:t.slice(e,n)),this.handleSelectionChange=this.handleSelectionChange.bind(this),this.handleViewportChange=this.handleViewportChange.bind(this),this.itemList=a.createRef(),this.selectedItems=[],this.state={topRow:null,bottomRow:null}}focusItem(s){this.itemList.current&&this.itemList.current.focusItem(s)}handleSelectionChange(s){console.log("Selection changed",s);const{onSelectionChange:e}=this.props;e(s)}handleViewportChange(s,e){const{items:n}=this.props,t=e-s+1,i=Math.max(0,s-t),o=Math.min(e+t,n.length);this.setState({topRow:i,bottomRow:o})}render(){const{draggablePrefix:s,droppableId:e,isDragDisabled:n,isDropDisabled:t,isMultiSelect:i,items:o,selectedRanges:r}=this.props,{topRow:c,bottomRow:d}=this.state;return a.createElement(dn,{draggablePrefix:s,droppableId:e,isDragDisabled:n,isDropDisabled:t,isMultiSelect:i,itemCount:o.length,items:this.getViewportItems(c,d,o),offset:c!=null?c:0,onSelectionChange:this.handleSelectionChange,onViewportChange:this.handleViewportChange,ref:this.itemList,selectedRanges:r})}}const xs=["Draggable Only","Drag and Drop","Droppable Only"],um=[{isDropDisabled:!0},{},{isDragDisabled:!0}],mm=(l="Item",s=1e3)=>{const e=[];for(let n=0;n<s;n+=1)e.push(`${l}-${n}`);return e};class ss extends p.exports.Component{constructor(s){super(s),this.getSelectionChangeHandler=Ze(i=>this.handleSelectionChange.bind(this,i)),this.getDraggableList=Ze((i,o,r,c)=>a.createElement(hm,{items:i,droppableId:dn.getDraggableId("drop-list",c),draggablePrefix:dn.getDraggableId("draggable-item",c),onSelectionChange:this.getSelectionChangeHandler(c),isMultiSelect:!0,ref:r,selectedRanges:o,...um[c]})),this.handleDragEnd=this.handleDragEnd.bind(this),this.animationFrame=null;const e=[],n=[],t=[];for(let i=0;i<xs.length;i+=1)e[i]=mm(xs[i]),n[i]=[],t[i]=a.createRef();this.state={items:e,lists:t,selectedRanges:n}}static handleDragStart(s){console.log("handleDragStart",s)}static handleDragUpdate(s){console.log("handleDragUpdate",s)}componentWillUnmount(){this.animationFrame&&cancelAnimationFrame(this.animationFrame)}handleDragEnd(s){console.log("handleDragEnd",s);const{source:e,destination:n}=s;if(e==null||n==null)return;const t=dn.getDraggableIndex(e.droppableId),i=dn.getDraggableIndex(n.droppableId),o=t===i;let r=n.index;o&&e.index<n.index&&(r+=1);let c=r;this.setState(({items:d,selectedRanges:h})=>{const m=[...d[t]],g=o?m:[...d[i]],f=zi.reorder(m,h[t],g,r),E=[...d];E[t]=m,E[i]=g,c=o?zi.adjustDestinationIndex(r,h[i]):r;const b=[...h];return b[t]=[],b[i]=[[c,c+f.length-1]],{items:E,selectedRanges:b}},()=>{this.animationFrame&&cancelAnimationFrame(this.animationFrame),this.animationFrame=requestAnimationFrame(()=>{var h,m;this.animationFrame=null;const{lists:d}=this.state;(m=(h=d[i])==null?void 0:h.current)==null||m.focusItem(c)})})}handleSelectionChange(s,e){this.setState(({selectedRanges:n})=>{const t=[...n];return t[s]=e,{selectedRanges:t}})}render(){const{items:s,lists:e,selectedRanges:n}=this.state;return a.createElement("div",{className:"style-guide-inputs"},a.createElement("h2",{className:"ui-title"},"Drag and Drop Lists"),a.createElement("div",{className:"row"},a.createElement(xl,{onDragStart:ss.handleDragStart,onDragUpdate:ss.handleDragUpdate,onDragEnd:this.handleDragEnd},xs.map((t,i)=>a.createElement("div",{className:"col",key:t},a.createElement("div",{className:"form-group"},a.createElement("h5",null,t," List"),a.createElement("div",{style:{height:"300px"}},this.getDraggableList(s[i],n[i],e[i],i))))))))}}let Fo=0;function pm(){const l=Fo;return Fo+=1,l}function Ds(l=1,s=5){return Math.floor(Math.random()*s)+l}function Ns(l,s=pm()){return{id:s,type:l}}function Po(l=Ds(),s=Ds(),e=Ds()){const n=[];for(let t=0;t<l;t+=1)n.push(Ns("SUBMENU"));for(let t=0;t<s;t+=1)n.push(Ns("PAGE"));for(let t=0;t<e;t+=1)n.push(Ns("SWITCH"));return n}function Ls({type:l,id:s}){switch(l){case"SUBMENU":return`Submenu ${s}`;case"PAGE":return`Page ${s}`;case"SWITCH":return`Switch ${s}`}}function gm({type:l}){switch(l){case"SUBMENU":return hl;case"PAGE":return dl;case"SWITCH":return Vt}}const fm=()=>{const[l,s]=p.exports.useState([]),[e,n]=p.exports.useState(new Map),t=p.exports.useCallback(h=>{s([...l,h])},[l,s]),i=p.exports.useCallback(()=>{const h=[...l];h.pop(),s(h)},[l,s]),o=p.exports.useCallback(()=>{const h=[l[0]];s(h)},[l,s]),r=p.exports.useCallback(h=>{var f;const m=(f=e.get(h))!=null?f:!1,g=new Map(e);g.set(h,!m),n(g)},[e,n]),c=p.exports.useCallback(h=>{const m=l[l.length-1],{items:g}=m;if(!g)throw new Error("Navigation handleSelect triggered without items to select");const f=g[h];switch(f.type){case"PAGE":t({title:Ls(f)});break;case"SUBMENU":t({title:Ls(f),items:Po()});break;case"SWITCH":r(f.id);break}},[l,r,t]);p.exports.useEffect(function(){s([{title:"Navigation Menu",items:Po()}])},[]);const d=p.exports.useMemo(()=>l.map(({items:h,title:m},g)=>{if(!h)return a.createElement(qi,{onBack:i,onClose:o,title:m,key:m},a.createElement("div",null,"Page content!"));let f=null;if(h){const E=h.map(b=>{var w;const y=Ls(b),C=gm(b);let I,T;return b.type==="SWITCH"&&(I=(w=e.get(b.id))!=null?w:!1,T=()=>{c(b.id)}),{title:y,icon:C,isOn:I,onChange:T}});f=a.createElement(cl,{onSelect:c,items:E})}else f=a.createElement("div",null,"Page content");return a.createElement(qi,{onBack:g>0?i:void 0,onClose:g>0?o:void 0,title:m,key:m},f)}),[l,e,c,i,o]);return a.createElement("div",null,a.createElement("h2",{className:"ui-title"},"Navigations"),a.createElement("div",{className:"navigations"},a.createElement(ll,null,d)))},Em=()=>a.createElement("div",{className:"container style-guide-container"},a.createElement("div",{style:{marginTop:"2rem",paddingBottom:"1rem"}},a.createElement("h1",{style:{paddingTop:"2rem"}},"Deephaven UI Components")),a.createElement(dm,null),a.createElement(Fu,null),a.createElement(gn,null),a.createElement(rm,null),a.createElement(Ni,null),a.createElement(sm,null),a.createElement(om,null),a.createElement(ss,null),a.createElement(lm,null),a.createElement(Ru,null),a.createElement(am,null),a.createElement(Pu,null),a.createElement(ku,null),a.createElement(fm,null),a.createElement(cm,null),a.createElement(Zu,null),a.createElement(Ou,null),a.createElement(Gu,null),a.createElement(Lu,null),a.createElement(Js,null)),Fi=l=>{const{workspace:s,setWorkspace:e}=l;return p.exports.useEffect(()=>{xi.makeDefaultWorkspace().then(e)},[e]),a.createElement(a.Fragment,null,s&&a.createElement(Em,null))};Fi.propTypes={workspace:u.exports.shape({}),setWorkspace:u.exports.func.isRequired};Fi.defaultProps={workspace:null};const bm=l=>({workspace:_n(l)}),Cm=we(bm,{setWorkspace:ri})(Fi),Sm=()=>a.createElement(Dl,{basename:{VITE_CORE_API_URL:"/jsapi",VITE_CORE_API_NAME:"dh-core.js",VITE_OPEN_API_NAME:"dh-internal.js",VITE_VERSION:"",VITE_NAME:"",VITE_PLUGIN_URL:"/ide/plugins/",VITE_NOTEBOOKS_URL:"/notebooks",VITE_LAYOUTS_URL:"/layouts",VITE_ENABLE_LOG_PROXY:"true",VITE_SUPPORT_LINK:"https://github.com/deephaven/web-client-ui/",VITE_DOCS_LINK:"https://deephaven.io/core/docs/",VITE_FAVICON:"/favicon-cc-app.svg",VITE_BUILD_PATH:"./build",VITE_LOG_LEVEL:"2",VITE_COMPONENT_PLUGINS_URL:"/ide/plugins/",VITE_INTERNAL_COMPONENT_PLUGINS:"",VITE_MODULE_PLUGINS_URL:"/js-plugins",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0}.PUBLIC_URL},a.createElement(Nl,null,a.createElement(Cs,{exact:!0,path:"/",component:Do}),a.createElement(Cs,{path:"/notebook/:notebookPath+",component:Do}),a.createElement(Cs,{path:"/styleguide",component:Cm}),a.createElement(Ll,{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 ym(){"serviceWorker"in navigator&&navigator.serviceWorker.getRegistrations().then(l=>{l.forEach(s=>{s.scope.endsWith("/download/")||s.unregister()})})}qh();ls.render(a.createElement(Ko,{store:us},a.createElement(Sm,null)),document.getElementById("root"));ym();Yt.registerOnLoaded();ul.init();window["__react-beautiful-dnd-disable-dev-warnings"]=!0;